Datasets:

problem_id
stringlengths
6
6
buggy_code
stringlengths
8
526k
fixed_code
stringlengths
12
526k
labels
listlengths
0
15
buggy_submission_id
int64
1
1.54M
fixed_submission_id
int64
2
1.54M
user_id
stringlengths
10
10
language
stringclasses
8 values
p02854
# サンプル1はべつに3*2=6じゃなくても4*2=8([1 3 4][2 2 4])や5*1=10([1 4 5])も同じコストで実現できることがわかる # つまり総和に近い偶数を目指す n = int(input()) arr = list(map(int, input().split())) s = sum(arr) tmp = arr[0] ans = 10**10 e = -1 for i in range(1, n): # 超えないギリギリ if tmp + arr[i] <= s // 2: tmp += arr[i] e = i else: break c = abs(s // 2 - tmp) + abs(s // 2 - sum(arr[i:])) ans = min(ans, c) e = -1 for i in range(1, n): # 超えたギリギリ if tmp > s // 2: break else: tmp += arr[i] e = i c = abs(s // 2 - tmp) + abs(s // 2 - sum(arr[i:])) ans = min(ans, c) print(ans)
# サンプル1はべつに3*2=6じゃなくても4*2=8([1 3 4][2 2 4])や5*1=10([1 4 5])も同じコストで実現できることがわかる # つまり総和に近い偶数を目指す n = int(input()) arr = list(map(int, input().split())) s = sum(arr) tmp = arr[0] ans = 10**10 e = -1 for i in range(1, n): # 超えないギリギリ if tmp + arr[i] <= s // 2: tmp += arr[i] e = i else: break c = abs(s // 2 - tmp) + abs(s // 2 - sum(arr[i:])) # print("超えない左側の合計と右側の合計 : {}, {}".format(tmp, sum(arr[i:]))) ans = min(ans, c) e = -1 tmp = arr[0] for i in range(1, n): # 超えたギリギリ if tmp > s // 2: break else: tmp += arr[i] e = i c = abs(s // 2 - tmp) + abs(s // 2 - sum(arr[i:])) # print("超えたギリギリの左側の合計と右側の合計 : {}, {}".format(tmp, sum(arr[i:]))) ans = min(ans, c) print(ans)
[ "assignment.add" ]
658,464
658,465
u445624660
python
p02854
import math from collections import deque def main(): n = int(input()) a = [int(t)for t in input().split()] a_rev = a[::-1] cusum = [a[0]] rcusum = [a_rev[0]] for i in range(1,n): cusum.append(cusum[i-1]+a[i]) rcusum.append(rcusum[i-1]+a[i]) rcusum = rcusum[::-1] result = [] for i in range(n): result.append(abs(cusum[i]-rcusum[i])) print(min(result)) if __name__ == "__main__": main()
import math from collections import deque def main(): n = int(input()) a = [int(t)for t in input().split()] a_rev = a[::-1] cusum = [a[0]] rcusum = [a_rev[0]] for i in range(1,n): cusum.append(cusum[i-1]+a[i]) rcusum.append(rcusum[i-1]+a_rev[i]) rcusum = rcusum[::-1] result = [] for i in range(1,n): result.append(abs(cusum[i-1]-rcusum[i])) print(min(result)) if __name__ == "__main__": main()
[ "identifier.change", "call.arguments.change", "expression.operation.binary.change", "call.arguments.add" ]
658,475
658,476
u711238850
python
p02854
n = int(input()) a = [int(i) for i in input().split()] len_f = sum(a) sum_a = 0 min = 2020202021 for i in range(1,len(a)): sum_a += a[i] len_f -= a[i] if min > abs(sum_a - len_f): min = abs(sum_a - len_f) print(min)
n = int(input()) a = [int(i) for i in input().split()] len_f = sum(a) sum_a = 0 min = 2020202021 for i in range(n): sum_a += a[i] len_f -= a[i] if min > abs(sum_a - len_f): min = abs(sum_a - len_f) print(min)
[ "identifier.replace.add", "literal.replace.remove", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
658,485
658,486
u749770850
python
p02854
import sys n = int(input()) a = list(map(int, input().split())) tmp=sys.maxsize s = sum(a) for i in range(n): t += a[i] tmp = min(tmp,abs(s-t*2)) print(tmp)
import sys n = int(input()) a = list(map(int, input().split())) tmp=sys.maxsize s = sum(a) t = 0 for i in range(n): t += a[i] tmp = min(tmp,abs(s-t*2)) print(tmp)
[ "assignment.add" ]
658,494
658,495
u879478232
python
p02854
N=int(input()) A=list(map(int,input().split())) l=0 r=0 li=0 ri=0 for i in range(N): if l<=r: l+=A[li] li+=1 else: r+=A[-1-ri] ri+=1 print(l-r)
N=int(input()) A=list(map(int,input().split())) l=0 r=0 li=0 ri=0 for i in range(N): if l<=r: l+=A[li] li+=1 else: r+=A[-1-ri] ri+=1 print(abs(l-r))
[ "call.arguments.add", "call.arguments.change" ]
658,505
658,506
u498487134
python
p02854
n = int(input()) a = list(map(int, input().split())) for i in range(n-1): a[i+1] += a[i] ans = 100000000000000 for i in range(n-1): ans = min(ans, abs(a[-1] - 2*a[i]))
n = int(input()) a = list(map(int, input().split())) for i in range(n-1): a[i+1] += a[i] ans = 100000000000000 for i in range(n-1): ans = min(ans, abs(a[-1] - 2*a[i])) print(ans)
[ "call.add" ]
658,549
658,550
u426108351
python
p02854
n=int(input()) arr=list(map(int,input().split())) total=sum(arr) acum=[arr[0]] for i in range(1,n): acum.append(arr[i]+acum[-1]) ans=10**18 for i in range(n): tmp=abs(acum[i]-(total-acu[i])) ans=min(ans,tmp) print(ans)
n=int(input()) arr=list(map(int,input().split())) total=sum(arr) acum=[arr[0]] for i in range(1,n): acum.append(arr[i]+acum[-1]) ans=10**18 for i in range(n): tmp=abs(acum[i]-(total-acum[i])) ans=min(ans,tmp) print(ans)
[ "assignment.value.change", "identifier.change", "call.arguments.change", "expression.operation.binary.change" ]
658,570
658,571
u163320134
python
p02854
from itertools import accumulate n = int(input()) a = list(map(int, input().split())) sum_l = [0]+list(accumulate(a)) sum_r = [0]+list(accumulate(a[:-1])) cost = sum_r[-1] for i in range(n+1): cost = min(cost, abs(sum_l[i]-sum_r[n-i])) print(cost)
from itertools import accumulate n = int(input()) a = list(map(int, input().split())) sum_l = [0]+list(accumulate(a)) sum_r = [0]+list(accumulate(a[-1::-1])) cost = sum_r[-1] for i in range(n+1): cost = min(cost, abs(sum_l[i]-sum_r[n-i])) print(cost)
[]
658,572
658,573
u530844517
python
p02854
from itertools import accumulate as ac n=int(input()) a=list(ac(list(map(int,input().split())))) d=float("INF") for i in range(n): d=min(d,abs(d-2*a[i])) print(d)
from itertools import accumulate as ac n=int(input()) a=list(ac(list(map(int,input().split())))) d=float("INF") for i in range(n): d=min(d,abs(a[-1]-2*a[i])) print(d)
[ "assignment.value.change", "call.arguments.change", "expression.operation.binary.change" ]
658,580
658,581
u619819312
python
p02854
n=int(input()) a=[int(i) for i in input().split()] asum2=sum(a)/2 j,k=0,0 for i in range(n): j+=a[i] if j>=asum2: break for i in range(n): k+=a[n-i-1] if k>=asum2: break if j-asum2>k-asum2: print(int(2*j-2*asum2)) else: print(int(2*k-2*asum2))
n=int(input()) a=[int(i) for i in input().split()] asum2=sum(a)/2 j,k=0,0 for i in range(n): j+=a[i] if j>=asum2: break for i in range(n): k+=a[n-i-1] if k>=asum2: break if j-asum2<k-asum2: print(int(2*j-2*asum2)) else: print(int(2*k-2*asum2))
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
658,629
658,630
u821712904
python
p02854
N = int(input()) A = list(map(int, input().split())) sumA = sum(A) ans, sumA2 = abs(sumA - 0), 0 for i in range(N): sumA2 += A[i] ans = min(ans, abs(sumA - sumA2)) print(ans)
N = int(input()) A = list(map(int, input().split())) sumA = sum(A) ans, sumA2 = abs(sumA - 0), 0 for i in range(N): sumA2 += A[i] ans = min(ans, abs(sumA - sumA2 * 2)) print(ans)
[ "assignment.change" ]
658,631
658,632
u332906195
python
p02854
# coding: utf-8 n = map(int,input().split()) a = list(map(int,input().split())) a_sum = sum(a) kyoukaisen = a_sum /2 left = 0 for i in range(len(a)): left += a[i] if left >= kyoukaisen: print(min(abs(a_sum - 2*left),abs( (a_sum - left-a[i]) - (a_sum-(a_sum - left-a[i]))) )) break
# coding: utf-8 n = map(int,input().split()) a = list(map(int,input().split())) a_sum = sum(a) kyoukaisen = a_sum /2 left = 0 for i in range(len(a)): left += a[i] if left >= kyoukaisen: print(min(abs(a_sum - 2*left),abs( (a_sum - (left-a[i])) - (a_sum-(a_sum - (left-a[i])))) )) break
[ "call.arguments.change" ]
658,636
658,637
u963128036
python
p02854
N = int(input()) a = list(map(int, input.split())) r = sum(a) ra = 0 result = 1e30 for i in range(0,N): ra += a[i] r -= a[i] result = min(result, abs(ra-r)) print(int(result))
N = int(input()) a = list(map(int, input().split())) r = sum(a) ra = 0 result = 1e30 for i in range(0,N): ra += a[i] r -= a[i] result = min(result, abs(ra-r)) print(int(result))
[ "call.add" ]
658,645
658,646
u660571124
python
p02854
N = int(input()) a = list(map(int, input().split())) r = sum(a) ra = 0 result = 1e30 for i in tqdm(range(0,N)): ra += a[i] r -= a[i] result = min(result, abs(ra-r)) print(result)
N = int(input()) a = list(map(int, input().split())) r = sum(a) ra = 0 result = 1e30 for i in range(0,N): ra += a[i] r -= a[i] result = min(result, abs(ra-r)) print(int(result))
[ "call.remove", "call.arguments.change", "call.add" ]
658,647
658,646
u660571124
python
p02854
import sys def main(): n, *a = map(int, sys.stdin.readline().split()) l = 0 r = sum(a) m = sum(a) for i in range(n): l += a[i] r -= a[i] m = min(m, abs(l - r)) print(m) if __name__ == '__main__': main()
import sys def main(): n, *a = map(int, sys.stdin.read().split()) l = 0 r = sum(a) m = sum(a) for i in range(n): l += a[i] r -= a[i] m = min(m, abs(l - r)) print(m) if __name__ == '__main__': main()
[ "assignment.value.change", "identifier.change", "call.arguments.change" ]
658,650
658,651
u254871849
python
p02854
n=int(input()) a=list(map(int,input().split())) sumFrontHalf=0 halfIndex=0 sumA=aum(a) for i in range(n): sumFrontHalf+=a[i] if sumFrontHalf>=sumA/2: halfIndex=i break sumBackHalf=sumA-sumFrontHalf+a[halfIndex] if sumFrontHalf<sumBackHalf: print(sumFrontHalf-sumBackHalf+a[halfIndex]) else: print(sumBackHalf-sumFrontHalf+a[halfIndex])
n=int(input()) a=list(map(int,input().split())) sumFrontHalf=0 halfIndex=0 sumA=sum(a) for i in range(n): sumFrontHalf+=a[i] if sumFrontHalf>=sumA/2: halfIndex=i break sumBackHalf=sumA-sumFrontHalf+a[halfIndex] if sumFrontHalf<sumBackHalf: print(sumFrontHalf-sumBackHalf+a[halfIndex]) else: print(sumBackHalf-sumFrontHalf+a[halfIndex])
[ "assignment.value.change", "identifier.change", "call.function.change" ]
658,699
658,700
u234582237
python
p02854
n=int(input()) a=list(map(int,input().split())) x=sum(a) i=ans1=0 while True: if ans1<x/2 and i<n: ans1+=a[i] i+=1 else: break if i==n-1: print(2*a[i-1]-x) else: i-=1 ans2=x-ans1 ans1-=a[i] print(a[i]-abs(ans1-ans2))
n=int(input()) a=list(map(int,input().split())) x=sum(a) i=ans1=0 while True: if ans1<x/2 and i<n: ans1+=a[i] i+=1 else: break if i==n: print(2*a[i-1]-x) else: i-=1 ans2=x-ans1 ans1-=a[i] print(a[i]-abs(ans1-ans2))
[ "expression.operation.binary.remove" ]
658,701
658,702
u225388820
python
p02854
n = int(input()) a= [int(x) for x in input().split(" ",n-1)] print(a) s = 0 for x in range(n): s += a[x-1] r = 0 l = 0 x = 0 while r < s/2: r += a[x] x += 1 y = 1 while l < s/2: l += a[n-y] y += 1 if r == s//2: print(0) else: k = min(r,l) v = k - s/2 m = v // 0.5 print(int(m))
n = int(input()) a= [int(x) for x in input().split(" ",n-1)] s = 0 for x in range(n): s += a[x-1] r = 0 l = 0 x = 0 while r < s/2: r += a[x] x += 1 y = 1 while l < s/2: l += a[n-y] y += 1 if r == s//2: print(0) else: k = min(r,l) v = k - s/2 m = v // 0.5 print(int(m))
[ "call.remove" ]
658,721
658,722
u985408358
python
p02854
n = int(input()) A = list(map(int,input().split())) for i in A: i = int(i) def h(n,A): res = float('inf') f = [] b = [] t = 0 for i in range(len(A)): t+=A[i] f.append(t) t = 0 for i in range(len(A)-1,-1,-1): t += A[i] b.append(t) for i in range(len(A)-1): temp1 = f[i] temp2 = b[i+1] res = min(res,abs(temp1-temp2)) #print(f) #print(b) print(res) h(n,A)
n = int(input()) A = list(map(int,input().split())) for i in A: i = int(i) def h(n,A): res = float('inf') f = [] b = [] t = 0 for i in range(len(A)): t+=A[i] f.append(t) t = 0 for i in range(len(A)-1,-1,-1): t += A[i] b.append(t) b.reverse() for i in range(len(A)-1): temp1 = f[i] temp2 = b[i+1] res = min(res,abs(temp1-temp2)) #print(f) #print(b) print(res) h(n,A)
[ "call.add" ]
658,734
658,735
u284901982
python
p02854
def solve(): N = int(input()) A = list(map(int,input().split())) sm = sum(A) agg = 0 idx = 0 mid = sm / 2 shrink_cnt = sm - N while agg < mid and idx < N-1: agg += A[idx] idx += 1 oneleft = agg oneright = sm - oneleft twoleft = agg-A[idx] tworight = sm - twoleft ans = min(abs(oneleft-oneright), abs(twoleft-tworight)) print(int(ans)) if __name__ == '__main__': solve()
def solve(): N = int(input()) A = list(map(int,input().split())) sm = sum(A) agg = 0 idx = 0 mid = sm / 2 shrink_cnt = sm - N while agg < mid and idx < N-1: agg += A[idx] idx += 1 oneleft = agg oneright = sm - oneleft twoleft = agg-A[idx-1] tworight = sm - twoleft ans = min(abs(oneleft-oneright), abs(twoleft-tworight)) print(int(ans)) if __name__ == '__main__': solve()
[ "assignment.change" ]
658,753
658,754
u647999897
python
p02854
from sys import stdin from itertools import accumulate, dropwhile, takewhile, groupby import bisect import copy import math N = int(stdin.readline().rstrip()) d = [int(s) for s in stdin.readline().rstrip().split()] count = 0 sumF = d[0] sumB = d[len(d) - 1] count = 0 countF = 0 countB = len(d) - 1 while count != len(d): if sumF < sumB: sumF += d[countF+1] countF += 1 count += 1 elif sumB < sumF: sumB += d[countB-1] countB -= 1 count += 1 else: sumF += d[countF+1] countF += 1 sumB += d[countB-1] countB -= 1 count += 2 print(abs(sum(d[0:countF])-sum(d[countF:len(d)])))
from sys import stdin from itertools import accumulate, dropwhile, takewhile, groupby import bisect import copy import math N = int(stdin.readline().rstrip()) d = [int(s) for s in stdin.readline().rstrip().split()] count = 0 sumF = d[0] sumB = d[len(d) - 1] count = 0 countF = 0 countB = len(d) - 1 while count < len(d): if sumF < sumB: sumF += d[countF+1] countF += 1 count += 1 elif sumB < sumF: sumB += d[countB-1] countB -= 1 count += 1 else: sumF += d[countF+1] countF += 1 sumB += d[countB-1] countB -= 1 count += 2 print(abs(sum(d[0:countF])-sum(d[countF:len(d)])))
[ "expression.operator.compare.change", "control_flow.loop.condition.change" ]
658,759
658,760
u606372527
python
p02854
N = int(input()) List = list(map(int,input().split())) length = sum(List) sum = 0 center = length / 2 centerIdx = 0 for idx in range(len(List)): sum += List[idx] if center <= sum: centerIdx = idx break if center == sum: print(0) else: if (centerIdx == 0): print(sum * 2 - length) elif (sum -center) < (center - (sum - List[centerIdx])): print(sum * 2 - length) else: print(length - (sum - List[centerIdx-1]) * 2)
N = int(input()) List = list(map(int,input().split())) length = sum(List) sum = 0 center = length / 2 centerIdx = 0 for idx in range(len(List)): sum += List[idx] if center <= sum: centerIdx = idx break if center == sum: print(0) else: if (centerIdx == 0): print(sum * 2 - length) elif (sum -center) < (center - (sum - List[centerIdx])): print(sum * 2 - length) else: print(length - (sum - List[centerIdx]) * 2)
[ "expression.operation.binary.remove" ]
658,767
658,768
u820284192
python
p02854
N = int(input()) A = list(map(int, input().split())) forward = [0]*N forward[0] = A[0] total = sum(A) m = 10*9 for i in range(1, N): forward[i] = forward[i-1] + A[i] for i in range(N-1): tmp = total - forward[i] diff = abs(tmp - forward[i]) m = min(diff, m) print(m)
N = int(input()) A = list(map(int, input().split())) forward = [0]*N forward[0] = A[0] total = sum(A) m = 10**12 for i in range(1, N): forward[i] = forward[i-1] + A[i] for i in range(N-1): tmp = total - forward[i] diff = abs(tmp - forward[i]) m = min(diff, m) print(m)
[]
658,771
658,770
u529180657
python
p02854
N = int(input()) A = list(map(int, input().split())) ans = 1000000000000 sum_A = sum(A) left = 0 for i in range(N - 1): print(left) left += A[i] ans = min(ans, abs(sum_A - left - left)) print(ans)
N = int(input()) A = list(map(int, input().split())) ans = 1000000000000 sum_A = sum(A) left = 0 for i in range(N - 1): left += A[i] ans = min(ans, abs(sum_A - left - left)) print(ans)
[ "call.remove" ]
658,796
658,797
u623349537
python
p02854
import numpy as np n=int(input()) a=list(int(x) for x in input().split()) bou_length=0 l=[] for i in range(len(a)): bou_length += a[i] l.append(bou_length) #print(bou_length) #print(l) def getNearestValue(list, num): """ 概要: リストからある値に最も近い値を返却する関数 list: データ配列 num: 対象値 return 対象値に最も近い値 """ # リスト要素と対象値の差分を計算し最小値のインデックスを取得 idx = np.abs(np.asarray(list) - num).argmin() return list[idx] diff=getNearestValue(l, (bou_length/2)) #print(diff) print(l[-1]-diff)
import numpy as np n=int(input()) a=list(int(x) for x in input().split()) bou_length=0 l=[] for i in range(len(a)): bou_length += a[i] l.append(bou_length) #print(bou_length) #print(l) def getNearestValue(list, num): """ 概要: リストからある値に最も近い値を返却する関数 list: データ配列 num: 対象値 return 対象値に最も近い値 """ # リスト要素と対象値の差分を計算し最小値のインデックスを取得 idx = np.abs(np.asarray(list) - num).argmin() return list[idx] diff=getNearestValue(l, (bou_length/2)) #print(diff) print(abs(l[-1]-2*diff))
[ "call.arguments.add", "call.arguments.change" ]
658,814
658,815
u117078923
python
p02854
n= int(input()) a = list(int(i) for i in input().split()) import math import sys sta=sum(a)/2 sum=0 ans=0 for i in range(0,n-1): if sum==sta: print(0) sys.exit() elif sum<sta and sum+a[i]>sta: ans=min(sta-sum,sum+a[i]-sta)/0.5 print(int(ans)) sys.exit() else: sum+=a[i] ans=min(sta-sum,sum+a[n]-sta)/0.5 print(abs(int(ans)))
n= int(input()) a = list(int(i) for i in input().split()) import math import sys sta=sum(a)/2 sum=0 ans=0 for i in range(0,n-1): if sum==sta: print(0) sys.exit() elif sum<sta and sum+a[i]>sta: ans=min(sta-sum,sum+a[i]-sta)/0.5 print(int(ans)) sys.exit() else: sum+=a[i] ans=min(sta-sum,sum+a[n-1]-sta)/0.5 print(abs(int(ans)))
[ "assignment.change" ]
658,816
658,817
u504507648
python
p02854
n= int(input()) a = list(int(i) for i in input().split()) import math import sys sta=sum(a)/2 sum=0 ans=0 for i in range(0,n-1): if sum==sta: print(0) sys.exit() elif sum<sta and sum+a[i]>sta: ans=min(sta-sum,sum+a[i+1]-sta)/0.5 print(int(ans)) sys.exit() else: sum+=a[i] ans=min(sta-sum,sum+a[n-1]-sta)/0.5 print(abs(int(ans)))
n= int(input()) a = list(int(i) for i in input().split()) import math import sys sta=sum(a)/2 sum=0 ans=0 for i in range(0,n-1): if sum==sta: print(0) sys.exit() elif sum<sta and sum+a[i]>sta: ans=min(sta-sum,sum+a[i]-sta)/0.5 print(int(ans)) sys.exit() else: sum+=a[i] ans=min(sta-sum,sum+a[n-1]-sta)/0.5 print(abs(int(ans)))
[ "expression.operation.binary.remove" ]
658,818
658,817
u504507648
python
p02854
import sys n=int(input()) a=list(map(int,input().split())) s=sum(a) totl=0 idx=0 dif1=0 for i in range(n): totl+=a[i] idx=i if (s/2)==totl: print(0) sys.exit() elif (s/2)<totl: dif1=totl-(s/2) break dif2=a[idx]-dif1 if dif1-(dif1//1)==0: print(int(min(dif1,dif2))) else: print(int(2*min(dif1,dif2)))
import sys n=int(input()) a=list(map(int,input().split())) s=sum(a) totl=0 idx=0 dif1=0 for i in range(n): totl+=a[i] idx=i if (s/2)==totl: print(0) sys.exit() elif (s/2)<totl: dif1=totl-(s/2) break dif2=a[idx]-dif1 if dif1-(dif1//1)==0: print(int(2*min(dif1,dif2))) else: print(int(2*min(dif1,dif2)))
[ "expression.operation.binary.add" ]
658,823
658,824
u527261492
python
p02854
n = int(input()) a = list(map(int, input().split())) s = 0 t = sum(a) for i in range(n-1): s += a[i] if s - t / 2 > 0: break s1 = s - a[i] print(min((t - s1 -s1), (s- (t - s) )))
n = int(input()) a = list(map(int, input().split())) s = 0 t = sum(a) for i in range(n): s += a[i] if s - t / 2 > 0: break s1 = s - a[i] print(min((t - s1 -s1), (s- (t - s) )))
[ "expression.operation.binary.remove" ]
658,889
658,890
u597017430
python
p02854
import math n=int(input()) a=list(map(int,input().split())) ans=9999999999 hidari=sum(a) migi=0 for i in range(n): hidari-=a[i] migi+=a[i] sa=math.abs(hidari-migi) if sa<ans: ans=sa print(ans)
import math n=int(input()) a=list(map(int,input().split())) ans=9999999999 hidari=sum(a) migi=0 for i in range(n): hidari-=a[i] migi+=a[i] sa=math.fabs(hidari-migi) if sa<ans: ans=sa print(int(ans))
[ "assignment.value.change", "identifier.change", "call.add", "call.arguments.change" ]
658,891
658,892
u189188797
python
p02854
import bisect N = int(input()) A = list(map(int, input().split())) s = [0]*N s[0] = A[0] for i in range(1, N): s[i] = s[i-1] + A[i] id = bisect.bisect_left(s, s[-1] // 2) if s[id] == s[-1] // 2: if s[-1] % 2 == 0: print(0) else: print(1) else: k = 0 if s[-1] % 2 != 0: k = 1 ans = abs(s[id]*2 - s[-1]) if id > 0: ans = min(ans, abs(s[id-1] - s[-1])) print(ans)
import bisect N = int(input()) A = list(map(int, input().split())) s = [0]*N s[0] = A[0] for i in range(1, N): s[i] = s[i-1] + A[i] id = bisect.bisect_left(s, s[-1] // 2) if s[id] == s[-1] // 2: if s[-1] % 2 == 0: print(0) else: print(1) else: k = 0 if s[-1] % 2 != 0: k = 1 ans = abs(s[id]*2 - s[-1]) if id > 0: ans = min(ans, abs(s[id-1]*2 - s[-1])) print(ans)
[ "assignment.change" ]
658,893
658,894
u814986259
python
p02854
n=int(input()) A=list(map(int,input().split())) L=sum(A) l=0 for i in range(n): l+=A[i] if l >= L/2: r=l-A[i] break print(l,r) print(min(abs((L-r)-r),abs((L-l)-l)))
n=int(input()) A=list(map(int,input().split())) L=sum(A) l=0 for i in range(n): l+=A[i] if l >= L/2: r=l-A[i] break print(min(abs((L-r)-r),abs((L-l)-l)))
[ "call.remove" ]
658,960
658,961
u469953228
python
p02856
n=int(input()) dnum =0 dsum =0 for i in range(n): d,c=map(int,input().split()) dnum += c dsum += d*c ans = dnum-1 + dsum//9 print(ans)
n=int(input()) dnum =0 dsum =0 for i in range(n): d,c=map(int,input().split()) dnum += c dsum += d*c ans = dnum-1 + (dsum-1)//9 print(ans)
[]
659,663
659,664
u276588887
python
p02856
n=int(input()) dnum =0 dsum =0 for i in range(n): d,c=map(int,input().split()) dnum += c dsum += d*c ans = c-1 + dsum//9 print(ans)
n=int(input()) dnum =0 dsum =0 for i in range(n): d,c=map(int,input().split()) dnum += c dsum += d*c ans = dnum-1 + (dsum-1)//9 print(ans)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
659,665
659,664
u276588887
python
p02856
M=int(input()) n_digit=0 n_sum=0 for _ in range(M): d,c=map(int,input().split()) n_digit+=c n_sum+=d*c #print(n_digit,n_sum) print(n_digit-1+n_sum//9)
M=int(input()) n_digit=0 n_sum=0 for _ in range(M): d,c=map(int,input().split()) n_digit+=c n_sum+=d*c #print(n_digit,n_sum) print(n_digit-1+(n_sum-1)//9)
[ "call.arguments.change" ]
659,720
659,721
u203843959
python
p02856
M = int(input()) DC = [tuple(map(int,input().split())) for i in range(M)] sumd = sumc = 0 for d,c in DC: sumd += d sumc += c ans = sumc-1 + (sumd-1)//9 print(ans)
M = int(input()) DC = [tuple(map(int,input().split())) for i in range(M)] sumd = sumc = 0 for d,c in DC: sumd += d*c sumc += c ans = sumc-1 + (sumd-1)//9 print(ans)
[ "expression.operation.binary.add" ]
659,733
659,734
u761320129
python
p02856
m=int(input()) n=0 ans=0 for i in range(m): x,y=map(int,input().split()) n+=y ans+=x*y n-=1 n+=ans//9 print(n)
m=int(input()) n=0 ans=0 for i in range(m): x,y=map(int,input().split()) n+=y ans+=x*y n-=1 ans-=1 n+=ans//9 print(n)
[]
659,748
659,749
u730769327
python
p02856
M = int(input()) cur = 0 keta = 0 csum = 0 for _ in range(M): d,c = map(int,input().split()) s = 0 for i in str(d): s += int(i) csum += s * c keta += c print(keta-1 + csum//9)
M = int(input()) cur = 0 keta = 0 csum = 0 for _ in range(M): d,c = map(int,input().split()) s = 0 for i in str(d): s += int(i) csum += s * c keta += c # 9をカウントしたくないため print(keta-1 + (csum-1)//9)
[ "call.arguments.change" ]
659,754
659,755
u723711163
python
p02856
M = int(input()) Keta=0 Sum=0 for _ in range(M): d,c = map(int,input().split()) Keta+=c Sum=d*c print(Keta-1 + (Sum-1)//9)
M = int(input()) Keta=0 Sum=0 for _ in range(M): d,c = map(int,input().split()) Keta+=c Sum+=d*c print(Keta-1 + (Sum-1)//9)
[ "assignment.value.change" ]
659,758
659,759
u375616706
python
p02856
n = int(input()) d, d_sum = 0, 0 for _ in range(n): a, b = map(int, input().split()) d += b d_sum += a * b print(d - 1 + d_sum // 9)
n = int(input()) d, d_sum = 0, 0 for _ in range(n): a, b = map(int, input().split()) d += b d_sum += a * b print(d - 1 + (d_sum - 1) // 9)
[ "call.arguments.change" ]
659,760
659,761
u285022453
python
p02854
# coding: utf-8 def solve(*args: str) -> str: n = int(args[0]) A = tuple(map(int, args[1].split())) left = 0 right = sum(A) ret = 0 for i in range(0, n-1): r_g = right - left left += A[i] right -= A[i] if left == right: break elif left > right: l_g = left - right ret = min(r_g, l_g) break return str(ret) if __name__ == "__main__": print(solve(*(open(0).read().splitlines())))
# coding: utf-8 def solve(*args: str) -> str: n = int(args[0]) A = tuple(map(int, args[1].split())) left = 0 right = sum(A) ret = 0 for i in range(0, n): r_g = right - left left += A[i] right -= A[i] if left == right: break elif left > right: l_g = left - right ret = min(r_g, l_g) break return str(ret) if __name__ == "__main__": print(solve(*(open(0).read().splitlines())))
[ "expression.operation.binary.remove" ]
659,785
659,786
u164727245
python
p02854
N = int(input()) A = list(map(int, input().split())) M = sum(A)/2 M a = 0 i = 0 while a < M: a += A[i] i += 1 print(int(min(a-M,M-a+A[i])*2))
N = int(input()) A = list(map(int, input().split())) M = sum(A)/2 M a = 0 i = 0 while a < M: a += A[i] i += 1 print(int(min(a-M,M-a+A[i-1])*2))
[ "expression.operation.binary.add" ]
659,811
659,812
u212786022
python
p02854
N = int(input()) A = list(map(int, input().split())) M = sum(A)/2 M a = 0 i = 0 while a < M: a += A[i] i += 1 print(int(min(a-M,a-M+A[i])*2))
N = int(input()) A = list(map(int, input().split())) M = sum(A)/2 M a = 0 i = 0 while a < M: a += A[i] i += 1 print(int(min(a-M,M-a+A[i-1])*2))
[ "expression.operation.binary.remove" ]
659,813
659,812
u212786022
python
p02854
#!/usr/bin/env python3 import sys def solve(N: int, A: "List[int]"): M=sum(A)/2 l=0 for i in range(N): o=l l+=A[i] if l>=M: break if (l-M) > (M-o): l=o print(int((l-M)*2)) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int A = [int(next(tokens)) for _ in range(N)] # type: "List[int]" solve(N, A) if __name__ == '__main__': main()
#!/usr/bin/env python3 import sys def solve(N: int, A: "List[int]"): M=sum(A)/2 l=0 for i in range(N): o=l l+=A[i] if l>=M: break if (l-M) > (M-o): l=o print(int(abs(l-M)*2)) return # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): def iterate_tokens(): for line in sys.stdin: for word in line.split(): yield word tokens = iterate_tokens() N = int(next(tokens)) # type: int A = [int(next(tokens)) for _ in range(N)] # type: "List[int]" solve(N, A) if __name__ == '__main__': main()
[ "call.add", "call.arguments.change" ]
659,827
659,828
u090649502
python
p02854
n=int(input()) a = [int(i) for i in input().split()] length = sum(a) if length %2 ==0: check = 0 half = length//2 idx = 0 for i in range(len(a)): check+=a[i] if check > half: idx = i break if check - half > half - (check-a[idx]): check -=a[idx] ans = (half-check)*2 else: check = 0 half = length//2 idx = 0 for i in range(len(a)): check+=a[i] if check > half: idx = i break check -=a[idx] afte = sum(a[idx:]) ans = half-check+afte-half check +=a[idx] afte = sum(a[idx+1:]) ans = min(ans,check-half+abs(afte-half)) print(ans)
n=int(input()) a = [int(i) for i in input().split()] length = sum(a) if length %2 ==0: check = 0 half = length//2 idx = 0 for i in range(len(a)): check+=a[i] if check > half: idx = i break if check - half > half - (check-a[idx]): check -=a[idx] ans = abs((half-check)*2) else: check = 0 half = length//2 idx = 0 for i in range(len(a)): check+=a[i] if check > half: idx = i break check -=a[idx] afte = sum(a[idx:]) ans = half-check+afte-half check +=a[idx] afte = sum(a[idx+1:]) ans = min(ans,abs(check-half)+abs(afte-half)) print(ans)
[ "call.add", "call.arguments.change" ]
659,861
659,862
u598229387
python
p02854
n = int(input()) a = list(map(int,input().split())) l = sum(a) b = list() t = 0 ans = 10**10 for i in a: t += i n.append(t) for j in b: x = abs(l-(2*j)) if x < ans: ans = x print(ans)
n = int(input()) a = list(map(int,input().split())) l = sum(a) b = list() t = 0 ans = 10**10 for i in a: t += i b.append(t) for j in b: x = abs(l-(2*j)) if x < ans: ans = x print(ans)
[ "identifier.change" ]
659,870
659,871
u025463382
python
p02854
n = int(input()) a = list(map(int,input().split())) l = sum(a) b = list() t = 0 ans = 10**10 for i in a: t += i b.append(t) for j in b: x = abs(l-(2*j)) if x < ans: ans = x else: break print(ans)
n = int(input()) a = list(map(int,input().split())) l = sum(a) b = list() t = 0 ans = 10**10 for i in a: t += i b.append(t) for j in b: x = abs(l-(2*j)) if x < ans: ans = x print(ans)
[ "control_flow.break.remove" ]
659,872
659,871
u025463382
python
p02854
N = int(input()) A = list(map(int, input().split())) total_length = sum(A) left_length = 0 for i in range(len(A) - 1): left_length += A[i] if left_length * 2 >= total_length: break cost_from_left = left_length * 2 - total_length right_length = 0 for j in reversed(range(len(A) - 1)): right_length += A[j] if right_length * 2 >= total_length: break cost_from_right = right_length * 2 - total_length print(min(cost_from_left, cost_from_right))
N = int(input()) A = list(map(int, input().split())) total_length = sum(A) left_length = 0 for i in range(len(A)): left_length += A[i] if left_length * 2 >= total_length: break cost_from_left = left_length * 2 - total_length right_length = 0 for j in reversed(range(len(A))): right_length += A[j] if right_length * 2 >= total_length: break cost_from_right = right_length * 2 - total_length print(min(cost_from_left, cost_from_right))
[ "expression.operation.binary.remove" ]
659,873
659,874
u733377702
python
p02854
# -*- coding: utf-8 -*- import sys import math from bisect import bisect_left from bisect import bisect_right import collections import copy import heapq from collections import defaultdict from heapq import heappop, heappush import itertools input = sys.stdin.readline ##### リストの 二分木検索 ##### # bisect_left(lists, 3) # bisect_right(lists, 3) ##### プライオリティキュー ##### # heapq.heapify(a) #リストaのheap化 # heapq.heappush(a,x) #heap化されたリストaに要素xを追加 # heapq.heappop(a) #heap化されたリストaから最小値を削除&その最小値を出力 # heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう # heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと ##### タプルリストのソート ##### # sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順 # sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順 # sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順 # sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順 # sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順 # sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順 def inputInt(): return int(input()) def inputMap(): return map(int, input().split()) def inputList(): return list(map(int, input().split())) def main(): N = inputInt() A = inputList() to = 0 for i in A: to += i to = to // 2 manaka = 0 tmp = 0 for i,val in enumerate(A): tmp += val if tmp >= to: manaka = i #print(to) #print(manaka) to1 = 0 to11 = 0 to2 = 0 to22 = 0 to111 = 0 to222 = 0 for i,val in enumerate(A): if i >= manaka+1: to2 += val else: to1 += val if i >= manaka-1: to22 += val else: to11 += val if i >= manaka: to222 += val else: to111 += val ans = min(abs(to1-to2),abs(to11-to22),abs(to111-to222)) print(ans) if __name__ == "__main__": main()
# -*- coding: utf-8 -*- import sys import math from bisect import bisect_left from bisect import bisect_right import collections import copy import heapq from collections import defaultdict from heapq import heappop, heappush import itertools input = sys.stdin.readline ##### リストの 二分木検索 ##### # bisect_left(lists, 3) # bisect_right(lists, 3) ##### プライオリティキュー ##### # heapq.heapify(a) #リストaのheap化 # heapq.heappush(a,x) #heap化されたリストaに要素xを追加 # heapq.heappop(a) #heap化されたリストaから最小値を削除&その最小値を出力 # heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう # heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと ##### タプルリストのソート ##### # sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順 # sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順 # sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順 # sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順 # sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順 # sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順 def inputInt(): return int(input()) def inputMap(): return map(int, input().split()) def inputList(): return list(map(int, input().split())) def main(): N = inputInt() A = inputList() to = 0 for i in A: to += i to = to // 2 manaka = 0 tmp = 0 for i,val in enumerate(A): tmp += val if tmp >= to: manaka = i break #print(to) #print(manaka) to1 = 0 to11 = 0 to2 = 0 to22 = 0 to111 = 0 to222 = 0 for i,val in enumerate(A): if i >= manaka+1: to2 += val else: to1 += val if i >= manaka-1: to22 += val else: to11 += val if i >= manaka: to222 += val else: to111 += val ans = min(abs(to1-to2),abs(to11-to22),abs(to111-to222)) print(ans) if __name__ == "__main__": main()
[ "control_flow.break.add" ]
659,894
659,895
u448994613
python
p02854
# -*- coding: utf-8 -*- import sys import math from bisect import bisect_left from bisect import bisect_right import collections import copy import heapq from collections import defaultdict from heapq import heappop, heappush import itertools input = sys.stdin.readline ##### リストの 二分木検索 ##### # bisect_left(lists, 3) # bisect_right(lists, 3) ##### プライオリティキュー ##### # heapq.heapify(a) #リストaのheap化 # heapq.heappush(a,x) #heap化されたリストaに要素xを追加 # heapq.heappop(a) #heap化されたリストaから最小値を削除&その最小値を出力 # heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう # heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと ##### タプルリストのソート ##### # sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順 # sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順 # sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順 # sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順 # sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順 # sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順 def inputInt(): return int(input()) def inputMap(): return map(int, input().split()) def inputList(): return list(map(int, input().split())) def main(): N = inputInt() A = inputList() to = 0 for i in A: to += i to = to // 2 manaka = 0 tmp = 0 for i,val in enumerate(A): tmp += i if tmp >= to: manaka = i to1 = 0 to11 = 0 to2 = 0 to22 = 0 to111 = 0 to222 = 0 for i,val in enumerate(A): if i >= manaka+1: to2 += val else: to1 += val if i >= manaka-1: to22 += val else: to11 += val if i >= manaka: to222 += val else: to111 += val ans = min(abs(to1-to2),abs(to11-to22),abs(to111-to222)) print(ans) if __name__ == "__main__": main()
# -*- coding: utf-8 -*- import sys import math from bisect import bisect_left from bisect import bisect_right import collections import copy import heapq from collections import defaultdict from heapq import heappop, heappush import itertools input = sys.stdin.readline ##### リストの 二分木検索 ##### # bisect_left(lists, 3) # bisect_right(lists, 3) ##### プライオリティキュー ##### # heapq.heapify(a) #リストaのheap化 # heapq.heappush(a,x) #heap化されたリストaに要素xを追加 # heapq.heappop(a) #heap化されたリストaから最小値を削除&その最小値を出力 # heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう # heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと ##### タプルリストのソート ##### # sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順 # sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順 # sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順 # sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順 # sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順 # sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順 def inputInt(): return int(input()) def inputMap(): return map(int, input().split()) def inputList(): return list(map(int, input().split())) def main(): N = inputInt() A = inputList() to = 0 for i in A: to += i to = to // 2 manaka = 0 tmp = 0 for i,val in enumerate(A): tmp += val if tmp >= to: manaka = i break #print(to) #print(manaka) to1 = 0 to11 = 0 to2 = 0 to22 = 0 to111 = 0 to222 = 0 for i,val in enumerate(A): if i >= manaka+1: to2 += val else: to1 += val if i >= manaka-1: to22 += val else: to11 += val if i >= manaka: to222 += val else: to111 += val ans = min(abs(to1-to2),abs(to11-to22),abs(to111-to222)) print(ans) if __name__ == "__main__": main()
[ "identifier.change", "control_flow.break.add" ]
659,896
659,895
u448994613
python
p02856
M = int(input()) ans = 0 prev = 0 arr = [] for _ in range(M): d, c = map(int, input().split()) ans += c-1 total = 0 a = (c-1) // 9 b = (c-1) % 9 + 1 if d == 1: ans += a total = b elif d == 2: ans += a * 2 if b >= 5: ans += 1 total = [2,4,6,8,1,3,5,7,9][b-1] elif d == 3: ans += (c-1) // 3 total = ((c-1) % 3 + 1) * 3 elif d == 4: ans += a * 4 if b >= 3: ans += 1 if b >= 5: ans += 1 if b >= 7: ans += 1 total = [4,8,3,7,2,6,1,5,9][b-1] elif d == 5: ans += a * 5 if b >= 2: ans += 1 if b >= 4: ans += 1 if b >= 6: ans += 1 if b >= 8: ans += 1 total = [5,1,6,2,7,3,8,4,9][b-1] elif d == 6: ans += ((c-1) // 3) * 2 b = (c-1) % 3 + 1 if b >= 2: ans += 1 total = [6,3,9][b-1] elif d == 7: ans += a * 7 if b >= 2: ans += 1 if b >= 3: ans += 1 if b >= 4: ans += 1 if b >= 6: ans += 1 if b >= 7: ans += 1 if b >= 8: ans += 1 total = [7,5,3,1,8,6,4,2,9][b-1] elif d == 8: ans += a * 8 if b >= 2: ans += 1 if b >= 3: ans += 1 if b >= 4: ans += 1 if b >= 5: ans += 1 if b >= 6: ans += 1 if b >= 7: ans += 1 if b >= 8: ans += 1 total = [8,7,6,5,4,3,2,1,9][b-1] elif d == 9: ans += (c-1)*2 total = 9 elif d == 0: total = 0 # if prev + total >= 10: # ans += 1 # total = (prev + total - 1) % 9 + 1 # prev = total arr.append(total) p = arr[0] for m in arr[1:]: ans += 1 if p + m >= 10: ans += 1 p = (p + m - 1) % 9 + 1 else: p = p + m print(ans)
M = int(input()) ans = 0 prev = 0 arr = [] for _ in range(M): d, c = map(int, input().split()) ans += c-1 total = 0 a = (c-1) // 9 b = (c-1) % 9 + 1 if d == 1: ans += a total = b elif d == 2: ans += a * 2 if b >= 5: ans += 1 total = [2,4,6,8,1,3,5,7,9][b-1] elif d == 3: ans += (c-1) // 3 total = ((c-1) % 3 + 1) * 3 elif d == 4: ans += a * 4 if b >= 3: ans += 1 if b >= 5: ans += 1 if b >= 7: ans += 1 total = [4,8,3,7,2,6,1,5,9][b-1] elif d == 5: ans += a * 5 if b >= 2: ans += 1 if b >= 4: ans += 1 if b >= 6: ans += 1 if b >= 8: ans += 1 total = [5,1,6,2,7,3,8,4,9][b-1] elif d == 6: ans += ((c-1) // 3) * 2 b = (c-1) % 3 + 1 if b >= 2: ans += 1 total = [6,3,9][b-1] elif d == 7: ans += a * 7 if b >= 2: ans += 1 if b >= 3: ans += 1 if b >= 4: ans += 1 if b >= 6: ans += 1 if b >= 7: ans += 1 if b >= 8: ans += 1 total = [7,5,3,1,8,6,4,2,9][b-1] elif d == 8: ans += a * 8 if b >= 2: ans += 1 if b >= 3: ans += 1 if b >= 4: ans += 1 if b >= 5: ans += 1 if b >= 6: ans += 1 if b >= 7: ans += 1 if b >= 8: ans += 1 total = [8,7,6,5,4,3,2,1,9][b-1] elif d == 9: ans += (c-1) total = 9 elif d == 0: total = 0 # if prev + total >= 10: # ans += 1 # total = (prev + total - 1) % 9 + 1 # prev = total arr.append(total) p = arr[0] for m in arr[1:]: ans += 1 if p + m >= 10: ans += 1 p = (p + m - 1) % 9 + 1 else: p = p + m print(ans)
[ "expression.operation.binary.remove" ]
659,918
659,919
u792078574
python
p02856
# coding: utf-8 # Your code here! m= int(input()) dc=[] s=0 for i in range(m): dc.append(list(map(int,input().split()))) s+=dc[i][0]*dc[i][1] print(s) ans=s//9 for i in range(m): ans+=dc[i][1] if s%9==0: ans-=1 print(ans-1)
# coding: utf-8 # Your code here! m= int(input()) dc=[] s=0 for i in range(m): dc.append(list(map(int,input().split()))) s+=dc[i][0]*dc[i][1] ans=s//9 for i in range(m): ans+=dc[i][1] if s%9==0: ans-=1 print(ans-1)
[ "call.remove" ]
659,923
659,924
u095426154
python
p02856
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline m = int(input()) #a = [int(i) for i in readline().split()] keta = 0 wa = 0 for i in range(m): d,c = [int(i) for i in readline().split()] keta += c wa += d*c #print(keta,wa) print(keta-1 + wa//9)
import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline m = int(input()) #a = [int(i) for i in readline().split()] keta = 0 wa = 0 for i in range(m): d,c = [int(i) for i in readline().split()] keta += c wa += d*c #print(keta,wa) print(keta-1 + (wa-1)//9)
[ "call.arguments.change" ]
659,950
659,951
u875291233
python
p02856
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): m=int(input()) D=[0]*m;C=[0]*m for i in range(m): D[i],C[i]=map(int,input().split()) digit=sum(D[i]*C[i] for i in range(m)) print(sum(C)+digit//9-1) resolve()
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): m=int(input()) D=[0]*m;C=[0]*m for i in range(m): D[i],C[i]=map(int,input().split()) digit=sum(D[i]*C[i] for i in range(m)) print(sum(C)+(digit-1)//9-1) resolve()
[ "call.arguments.change" ]
659,983
659,984
u440566786
python
p02856
def main(): M = int(input()) DC = [list(map(int, input().split())) for _ in range(M)] S = 0 cS = 0 for d, c in DC: cS += c S += d*c ans = cS - 1 + S//10 print(ans) if __name__ == "__main__": main()
def main(): M = int(input()) DC = [list(map(int, input().split())) for _ in range(M)] S = 0 cS = 0 for d, c in DC: cS += c S += d*c ans = cS - 1 + (S-1)//9 print(ans) if __name__ == "__main__": main()
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
659,988
659,989
u237362582
python
p02856
M = int(input()) DC = [list(map(int, input().split())) for _ in range(M)] digits_sum = 0 digits_length = 0 for d, c in DC: digits_sum += d*c digits_length += c # print(digits_sum, digits_length) print((digits_length - 1) + (digits_sum // 9))
M = int(input()) DC = [list(map(int, input().split())) for _ in range(M)] digits_sum = 0 digits_length = 0 for d, c in DC: digits_sum += d*c digits_length += c # print(digits_sum, digits_length) print((digits_length - 1) + ((digits_sum-1) // 9))
[ "call.arguments.change" ]
660,076
660,077
u599547273
python
p02856
import sys sys.setrecursionlimit(10**9) INF=10**18 def input(): return sys.stdin.readline().rstrip() def main(): M=int(input()) d=[0]*M c=[0]*M ans=0 l=[] for i in range(M): d[i],c[i]=map(int,input().split()) ans+=sum(c)-1 x=0 for i in range(M): x+=c[i]*d[i] ans+=x//9 print(ans) if __name__ == '__main__': main()
import sys sys.setrecursionlimit(10**9) INF=10**18 def input(): return sys.stdin.readline().rstrip() def main(): M=int(input()) d=[0]*M c=[0]*M ans=0 l=[] for i in range(M): d[i],c[i]=map(int,input().split()) ans+=sum(c)-1 x=0 for i in range(M): x+=c[i]*d[i] ans+=(x-1)//9 print(ans) if __name__ == '__main__': main()
[]
660,078
660,079
u714642969
python
p02856
M = int(input()) cnt = 0 cnt_c = 0 L = [] for _ in range(M): d, c = map(int, input().split()) cnt += c*d cnt_c += c ans = cnt//10 + cnt_c - 1 print(ans)
M = int(input()) cnt = 0 cnt_c = 0 L = [] for _ in range(M): d, c = map(int, input().split()) cnt += c*d cnt_c += c ans = (cnt-1) // 9 + cnt_c - 1 print(ans)
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
660,101
660,102
u504836877
python
p02856
m=int(input()) counter=0 s=0 for i in range(m): d,c=map(int,input().split()) counter+=d*c s+=c print(s-1+counter//9)
m=int(input()) counter=0 s=0 for i in range(m): d,c=map(int,input().split()) counter+=d*c s+=c print(s-1+(counter-1)//9)
[ "call.arguments.change" ]
660,113
660,114
u780962115
python
p02856
m=int(input()) a=[list(map(int, input().split())) for i in range(m)] x=0 y=0 for i in range(m): x+=a[i][1] y+=a[i][0]*a[i][1] print(x-1+y//10)
m=int(input()) a=[list(map(int, input().split())) for i in range(m)] x=0 y=0 for i in range(m): x+=a[i][1] y+=a[i][0]*a[i][1] print(x-1+(y-1)//9)
[ "call.arguments.change", "literal.number.integer.change", "expression.operation.binary.change", "io.output.change" ]
660,119
660,118
u970899068
python
p02856
from collections import Counter mod = 1000000007 def inverse(a): return pow(a, mod - 2, mod) def usearch(x, a): lft = 0 rgt = len(a) + 1 while rgt - lft > 1: mid = (rgt + lft) // 2 if a[mid] <= x: lft = mid else: rgt = mid return lft def main(): m = int(input()) ans = 0 a = 0 for i in range(m): d, c = map(int, input().split()) ans += c a += d * c print(ans + a // 9 - 1) main()
from collections import Counter mod = 1000000007 def inverse(a): return pow(a, mod - 2, mod) def usearch(x, a): lft = 0 rgt = len(a) + 1 while rgt - lft > 1: mid = (rgt + lft) // 2 if a[mid] <= x: lft = mid else: rgt = mid return lft def main(): m = int(input()) ans = 0 a = 0 for i in range(m): d, c = map(int, input().split()) ans += c a += d * c print(ans + (a - 1) // 9 - 1) main()
[ "call.arguments.change" ]
660,123
660,124
u702582248
python
p02856
# -*- coding: utf-8 -*- M = int(input()) d = 0 c = 0 for _ in range(M): c1, d1 = map(int, input().split()) d += d1 c += c1 if c % 9 != 0: s = c // 9 else: s = c // 9 - 1 print((d - 1) + s)
# -*- coding: utf-8 -*- M = int(input()) d = 0 c = 0 for _ in range(M): c1, d1 = map(int, input().split()) d += d1 c += c1 * d1 if c % 9 != 0: s = c // 9 else: s = c // 9 - 1 print((d - 1) + s)
[ "expression.operation.binary.add" ]
660,127
660,128
u513434790
python
p02856
n = int(input()) d, c = 0, 0 for i in range(n): p, q = map(int, input().split()) d = d + p c = c + p*q print((d-1)+(c-1)//9)
n = int(input()) d, c = 0, 0 for i in range(n): p, q = map(int, input().split()) d = d + q c = c + p*q print((d-1)+(c-1)//9)
[ "assignment.value.change", "identifier.change", "expression.operation.binary.change" ]
660,131
660,132
u021548497
python
p02856
M = int(input()) D = C = 0 for i in range(M): d, c = map(int, input().split()) D += d C += c print(C - 1 + (D - 1) // 9)
M = int(input()) CD = C = 0 for i in range(M): d, c = map(int, input().split()) CD += c * d C += c print(C - 1 + (CD - 1) // 9)
[ "assignment.variable.change", "identifier.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
660,148
660,149
u716529032
python
p02856
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import math import collections M, = map(int, sys.stdin.readline().rstrip().split(" ")) total_sum = 0 total_digits = 0 for _ in range(M): d, c = map(int, sys.stdin.readline().rstrip().split(" ")) total_digits += c total_sum += d*c answer = (total_sum // 9) + total_digits -1 print(answer) exit(0)
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import math import collections M, = map(int, sys.stdin.readline().rstrip().split(" ")) total_sum = 0 total_digits = 0 for _ in range(M): d, c = map(int, sys.stdin.readline().rstrip().split(" ")) total_digits += c total_sum += d*c answer = ((total_sum-1) // 9) + total_digits -1 print(answer) exit(0)
[]
660,156
660,157
u532827876
python
p02856
import sys input = sys.stdin.readline def main(): M = int(input()) count = 0 wa = 0 for _ in range(M): d, c = [int(x) for x in input().split()] count += c wa += d * c print(count - 1 + (wa // 9)) if __name__ == '__main__': main()
import sys input = sys.stdin.readline def main(): M = int(input()) count = 0 wa = 0 for _ in range(M): d, c = [int(x) for x in input().split()] count += c wa += d * c print(count - 1 + ((wa - 1) // 9)) if __name__ == '__main__': main()
[ "call.arguments.change" ]
660,197
660,198
u098012509
python
p02856
M = int(input()) D = 0 S = 0 for i in range(M): c,d = map(int,input().split()) D += d S += c*d print(D-1+S//9)
M = int(input()) D = 0 S = 0 for i in range(M): c,d = map(int,input().split()) D += d S += c*d print(D-1+(S-1)//9)
[ "call.arguments.change" ]
660,203
660,204
u170201762
python
p02856
m=int(input()) s,c=0,0 for i in range(m): d,c=map(int,input().split()) s+=d*c k+=c print(k-1+(s-1)//9)
m=int(input()) s,k=0,0 for i in range(m): d,c=map(int,input().split()) s+=d*c k+=c print(k-1+(s-1)//9)
[ "assignment.variable.change", "identifier.change" ]
660,220
660,221
u623819879
python
p02856
import sys read = sys.stdin.read M = int(input()) dc = map(int, read().split()) dig = [0] * 10 cnt = 0 answer = 0 for d, c in zip(*[iter(dc)] * 2): dig[d] += c trans = dict() for i in range(10): if i < 5: trans[i] = i + i elif i == 5: trans[i] = 1 else: trans[i] = trans[i - 1] + 2 while True: tmp = [0] * 10 for i, x in enumerate(dig): q, r = divmod(x, 2) if x >= 2: if i < 5: answer += q tmp[trans[i]] += q tmp[i] += r else: answer += q tmp[trans[i]] += q tmp[i] += r else: tmp[i] += x dig = tmp.copy() for i in dig: if i > 1: break else: break last = [i for i in range(10) if dig[i] == 1] while len(last) > 1: a = last.pop() b = last.pop() c = a + b if c >= 10: answer += 2 last.append(c // 10 + c % 10) else: answer += 1 last.append(c) print(answer)
import sys read = sys.stdin.read M = int(input()) dc = map(int, read().split()) dig = [0] * 10 cnt = 0 answer = 0 for d, c in zip(*[iter(dc)] * 2): dig[d] += c trans = dict() for i in range(10): if i < 5: trans[i] = i + i elif i == 5: trans[i] = 1 else: trans[i] = trans[i - 1] + 2 while True: tmp = [0] * 10 for i, x in enumerate(dig): q, r = divmod(x, 2) if x >= 2: if i < 5: answer += q tmp[trans[i]] += q tmp[i] += r else: answer += q * 2 tmp[trans[i]] += q tmp[i] += r else: tmp[i] += x dig = tmp.copy() for i in dig: if i > 1: break else: break last = [i for i in range(10) if dig[i] == 1] while len(last) > 1: a = last.pop() b = last.pop() c = a + b if c >= 10: answer += 2 last.append(c // 10 + c % 10) else: answer += 1 last.append(c) print(answer)
[ "expression.operation.binary.add" ]
660,232
660,233
u945181840
python
p02856
import sys read = sys.stdin.read M = int(input()) dc = map(int, read().split()) dig_sum = 0 dig = 0 for d, c in zip(*[iter(dc)] * 2): dig_sum += d * c dig += c answer = dig_sum // 9 + dig - 1 print(answer)
import sys read = sys.stdin.read M = int(input()) dc = map(int, read().split()) dig_sum = 0 dig = 0 for d, c in zip(*[iter(dc)] * 2): dig_sum += d * c dig += c answer = (dig_sum - 1) // 9 + dig - 1 print(answer)
[]
660,234
660,235
u945181840
python
p02856
M = int(input()) S = 0 res = -1 for _ in range(M): d, c = map(int, input().split()) res += c S += d*c res += S // 9 print(res)
M = int(input()) S = -1 res = -1 for _ in range(M): d, c = map(int, input().split()) res += c S += d*c res += S // 9 print(res)
[ "assignment.value.change", "expression.operation.unary.add" ]
660,238
660,239
u813102292
python
p02856
M = int(input()) S = 0 res = -1 for _ in range(M): d, c = map(int, input().split()) res += d S += c res += S // 9 print(res)
M = int(input()) S = -1 res = -1 for _ in range(M): d, c = map(int, input().split()) res += c S += d*c res += S // 9 print(res)
[ "assignment.value.change", "expression.operation.unary.add", "identifier.change" ]
660,240
660,239
u813102292
python
p02856
import sys input = sys.stdin.readline m = int(input()) sum1 = 0 sumc = 0 ans = 0 for i in range(m): d,c = map(int,input().split()) sum1 += d * c sumc += c ans += sumc + sum1 // 9 - 1 print(ans)
import sys input = sys.stdin.readline m = int(input()) sum1 = 0 sumc = 0 ans = 0 for i in range(m): d,c = map(int,input().split()) sum1 += d * c sumc += c ans += sumc + (sum1 - 1) // 9 - 1 print(ans)
[]
660,244
660,245
u623231048
python
p02856
M = int(input()) a = 0 csum = 0 for i in range(M): d,c = map(int, input().split()) a += d*c csum += c print(a // 9 + 1 + csum - 2)
M = int(input()) a = 0 csum = 0 for i in range(M): d,c = map(int, input().split()) a += d*c csum += c print((a - 1) // 9 + 1 + csum - 2)
[ "call.arguments.change" ]
660,250
660,251
u552357043
python
p02856
M = int(input()) dc = [list(map(int,input().split())) for _ in range(M)] ans = 0 s = 0 for i in dc: d = i[0] c = i[1] ans += c s+=d*c if s>=10: t = s//9 ans+=t s-= t*9 ans -= 1 print(ans)
M = int(input()) dc = [list(map(int,input().split())) for _ in range(M)] ans = 0 s = 0 for i in dc: d = i[0] c = i[1] ans += c s+=d*c if s>=10: t = (s-1)//9 ans+=t s-= t*9 ans -= 1 print(ans)
[]
660,281
660,282
u268554510
python
p02856
M = int(input()) dc = [list(map(int,input().split())) for _ in range(M)] ans = 0 s = 0 for i in dc: d = i[0] c = i[1] ans += c s+=d*c if s>=9: t = s//9 ans+=t s-= t*9 ans -= 1 print(ans)
M = int(input()) dc = [list(map(int,input().split())) for _ in range(M)] ans = 0 s = 0 for i in dc: d = i[0] c = i[1] ans += c s+=d*c if s>=10: t = (s-1)//9 ans+=t s-= t*9 ans -= 1 print(ans)
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
660,283
660,282
u268554510
python
p02856
M = int(input()) dc = [list(map(int,input().split())) for _ in range(M)] ans = 0 s = 0 for i in dc: d = i[0] c = i[1] ans += c s+=d*c if s>=10: t = s//10 ans+=t s-= t*10 ans -= 1 print(ans)
M = int(input()) dc = [list(map(int,input().split())) for _ in range(M)] ans = 0 s = 0 for i in dc: d = i[0] c = i[1] ans += c s+=d*c if s>=10: t = (s-1)//9 ans+=t s-= t*9 ans -= 1 print(ans)
[ "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
660,284
660,282
u268554510
python
p02856
M = int(input()) s = 0 t = 0 for _ in range(M): d, c = map(int,input().split()) s += d * c t += c ans = (s//10) + t-1 print(ans)
M = int(input()) s = 0 t = 0 for _ in range(M): d, c = map(int,input().split()) s += d * c t += c ans = (s-1)//9 + t-1 print(ans)
[ "assignment.change" ]
660,291
660,292
u983918956
python
p02856
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] = c able += d * c print ( sum(lis)-1 + (able-1) // 9 )
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] += c able += d * c print ( sum(lis)-1 + (able-1) // 9 )
[ "assignment.value.change" ]
660,307
660,308
u828766688
python
p02856
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] = c able += d * c print ( sum(lis) + (able-1) // 9 )
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] += c able += d * c print ( sum(lis)-1 + (able-1) // 9 )
[ "assignment.value.change" ]
660,309
660,308
u828766688
python
p02856
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] = c able += d * c print ( sum(lis) - 1 + (able-1) // 9 )
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] += c able += d * c print ( sum(lis)-1 + (able-1) // 9 )
[ "assignment.value.change" ]
660,310
660,308
u828766688
python
p02856
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] = c able += d * c #print (sum(lis),able) print ( sum(lis) -1 + able // 10 )
M = int(input()) lis = [0] * 10 able =0 for i in range(M): d,c = map(int,input().split()) lis[d] += c able += d * c print ( sum(lis)-1 + (able-1) // 9 )
[ "assignment.value.change", "call.arguments.change", "literal.number.integer.change", "expression.operation.binary.change", "io.output.change" ]
660,311
660,308
u828766688
python
p02856
M = int(input()) nums = [tuple(map(int, input().split())) for _ in range(M)] digits = sum(t[1] for t in nums) d_sum = sum(t[0] * t[1] for t in nums) ans = digits - 1 + d_sum // 9 print(ans)
M = int(input()) nums = [tuple(map(int, input().split())) for _ in range(M)] digits = sum(t[1] for t in nums) d_sum = sum(t[0] * t[1] for t in nums) ans = digits - 1 + (d_sum - 1) // 9 print(ans)
[]
660,337
660,338
u497046426
python
p02856
M=int(input()) D,C=zip(*[map(int,input().split()) for i in range(M)]) X=[d*c for d,c in zip(D,C)] print(sum(C)-1+sum(X)//10)
M=int(input()) D,C=zip(*[map(int,input().split()) for i in range(M)]) X=[d*c for d,c in zip(D,C)] print(sum(C)-1+(sum(X)-1)//9)
[ "call.arguments.change", "call.arguments.add" ]
660,368
660,369
u509368316
python
p02856
M = int(input()) dcnt = 0 calc = 0 for i in range(M) : c,d = map(int,input().split()) dcnt += d calc += d*c res = calc//9 + dcnt - 1 print(res)
M = int(input()) dcnt = 0 calc = 0 for i in range(M) : c,d = map(int,input().split()) dcnt += d calc += d*c calc -= 1 res = calc//9 + dcnt - 1 print(res)
[]
660,382
660,383
u879870653
python
p02856
m=int(input()) l=[list(map(int,input().split())) for i in range(m)] ct=0;sum=0 for i in range(m): ct+=l[i][0]*l[i][1] sum+=l[i][1] print(sum-1+(ct//9))
m=int(input()) l=[list(map(int,input().split())) for i in range(m)] ct=0;sum=0 for i in range(m): ct+=l[i][0]*l[i][1] sum+=l[i][1] print(sum-1+((ct-1)//9))
[ "call.arguments.change" ]
660,394
660,395
u017810624
python
p02856
m=int(input()) l=[list(map(int,input().split())) for i in range(m)] ct=0;sum=0 for i in range(m): ct+=l[i][0]*l[i][1] sum+=l[i][1] print(sum-1+(ct//9)-1)
m=int(input()) l=[list(map(int,input().split())) for i in range(m)] ct=0;sum=0 for i in range(m): ct+=l[i][0]*l[i][1] sum+=l[i][1] print(sum-1+((ct-1)//9))
[ "call.arguments.change", "call.arguments.add" ]
660,396
660,395
u017810624
python
p02856
N=int(input()) d=[];c=[] for i in range(N): di,ci=map(int,input().split()) d.append(di);c.append(ci) # print(d) #DB # print(c) #DB s=sum([d[i]*c[i] for i in range(N)]) # print(s) #DB t=0 while s>=10: t+=s//10 s=s//+s%10 ans=sum(c)-1+t print(ans)
N=int(input()) d=[];c=[] for i in range(N): di,ci=map(int,input().split()) d.append(di);c.append(ci) # print(d) #DB # print(c) #DB s=sum([d[i]*c[i] for i in range(N)]) # print(s) #DB t=0 while s>=10: t+=s//10 s=s//10+s%10 ans=sum(c)-1+t print(ans)
[]
660,403
660,404
u042802884
python
p02856
def main(): #print = out.append ''' Cook your dish here! ''' m = get_int() sm = 0 smc = 0 for _ in range(m): a, b = get_list() sm += a*b smc += b print(smc-1 + (sm//9)) ''' Coded with love at India by Satyam Kumar ''' import sys #from collections import defaultdict #import math input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ out = [] get_int = lambda: int(input()) get_list = lambda: list(map(int, input().split())) main() #[main() for _ in range(int(input()))] print(*out, sep='\n')
def main(): #print = out.append ''' Cook your dish here! ''' m = get_int() sm = 0 smc = 0 for _ in range(m): a, b = get_list() sm += a*b smc += b print(smc-1 + ((sm-1)//9)) ''' Coded with love at India by Satyam Kumar ''' import sys #from collections import defaultdict import math input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__ out = [] get_int = lambda: int(input()) get_list = lambda: list(map(int, input().split())) main() #[main() for _ in range(int(input()))] print(*out, sep='\n')
[ "call.arguments.change" ]
660,426
660,427
u824793212
python
p02856
import sys input = sys.stdin.readline ri = lambda: int(input()) rs = lambda: input().rstrip() ril = lambda: list(map(int, input().split())) rsl = lambda: input().rstrip().split() ris = lambda n: [ri() for _ in range(n)] rss = lambda n: [rs() for _ in range(n)] rils = lambda n: [ril() for _ in range(n)] rsls = lambda n: [rsl() for _ in range(n)] m = ri() ls = rils(m) res = -1 s = 0 for d, c in ls: res += c s += d * c res += s // 10 print(res)
import sys input = sys.stdin.readline ri = lambda: int(input()) rs = lambda: input().rstrip() ril = lambda: list(map(int, input().split())) rsl = lambda: input().rstrip().split() ris = lambda n: [ri() for _ in range(n)] rss = lambda n: [rs() for _ in range(n)] rils = lambda n: [ril() for _ in range(n)] rsls = lambda n: [rsl() for _ in range(n)] m = ri() ls = rils(m) res = -1 s = 0 for d, c in ls: res += c s += d * c res += (s - 1) // 9 print(res)
[ "literal.number.integer.change", "expression.operation.binary.change" ]
660,434
660,435
u891635666
python
p02856
import sys def input(): return sys.stdin.readline()[:-1] inf=float("inf") m=int(input()) dc=[list(map(int,input().split())) for i in range(m)] tmp=0 ans=0 for i in range(m): tmp+=dc[i][0]*dc[i][1] ans+=dc[i][1] # print(tmp) ans-=1 ans+=tmp//9 print(ans)
import sys def input(): return sys.stdin.readline()[:-1] inf=float("inf") m=int(input()) dc=[list(map(int,input().split())) for i in range(m)] tmp=0 ans=0 for i in range(m): tmp+=dc[i][0]*dc[i][1] ans+=dc[i][1] # print(tmp) ans-=1 ans+=(tmp-1)//9 print(ans)
[]
660,440
660,441
u654470292
python
p02856
import sys def input(): return sys.stdin.readline()[:-1] inf=float("inf") m=int(input()) dc=[list(map(int,input().split())) for i in range(m)] tmp=0 ans=0 for i in range(m): tmp+=dc[i][0]*dc[i][1] ans+=dc[i][1] ans-=1 ans+=tmp//10 print(ans)
import sys def input(): return sys.stdin.readline()[:-1] inf=float("inf") m=int(input()) dc=[list(map(int,input().split())) for i in range(m)] tmp=0 ans=0 for i in range(m): tmp+=dc[i][0]*dc[i][1] ans+=dc[i][1] # print(tmp) ans-=1 ans+=(tmp-1)//9 print(ans)
[ "literal.number.integer.change", "expression.operation.binary.change" ]
660,442
660,441
u654470292
python
p02856
m = int(input()) ans = -1 all = 0 for i in range(m): a,b = map(int, input().split()) ans += b all += a * b ans += all // 10 print(ans)
m = int(input()) ans = -1 all = 0 for i in range(m): a,b = map(int, input().split()) ans += b all += a * b ans += (all-1) // 9 print(ans)
[ "literal.number.integer.change", "expression.operation.binary.change" ]
660,457
660,458
u299869545
python
p02856
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np M = int(readline()) DC = np.array(read().split(),np.int64) D = DC[::2]; C = DC[1::2] # 桁数が減って総和は不変 or 桁数が不変で総和が-9 # 手順によらない # 「桁数 * 9 + 和」が9ずつの減少量 x = 9 * C.sum() + (D * C).sum() y = x % 9 if y == 0: y = 0 y += 9 answer = (x - y) // 9 print(answer)
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np M = int(readline()) DC = np.array(read().split(),np.int64) D = DC[::2]; C = DC[1::2] # 桁数が減って総和は不変 or 桁数が不変で総和が-9 # 手順によらない # 「桁数 * 9 + 和」が9ずつの減少量 x = 9 * C.sum() + (D * C).sum() y = x % 9 if y == 0: y = 9 y += 9 answer = (x - y) // 9 print(answer)
[ "literal.number.integer.change", "assignment.value.change" ]
660,459
660,460
u102461423
python
p02856
n = int(input()) ans = -1 num = 0 for i in range(n): a,b = map(int,input().split()) ans += b num += a * b if num > 9: ans += num // 9 num %= 9 if num == 0: num = 9 print(ans)
n = int(input()) ans = -1 num = 0 for i in range(n): a,b = map(int,input().split()) ans += b num += a * b if num > 9: ans += num // 9 num %= 9 if num == 0: ans -= 1 num = 9 print(ans)
[]
660,489
660,490
u667024514
python
p02856
m=int(input()) total=0 keta=0 for i in range(m): d,c=map(int,input().split()) total+=d*c keta+=c print(keta-1+total//9)
m=int(input()) total=0 keta=0 for i in range(m): d,c=map(int,input().split()) total+=d*c keta+=c print(keta-1+(total-1)//9)
[ "call.arguments.change" ]
660,532
660,533
u296150111
python
p02856
m=int(input()) total=0 keta=0 for i in range(m): d,c=map(int,input().split()) total+=d*c keta+=c print(keta-1+total//10)
m=int(input()) total=0 keta=0 for i in range(m): d,c=map(int,input().split()) total+=d*c keta+=c print(keta-1+(total-1)//9)
[ "call.arguments.change", "literal.number.integer.change", "expression.operation.binary.change", "io.output.change" ]
660,534
660,533
u296150111
python
p02859
a = int(input()) print(r**2)
print(int(input())**2)
[ "call.remove" ]
660,671
660,672
u392361133
python
p02859
a = int(input()) print(r**2)
r = int(input()) print(r**2)
[ "assignment.variable.change", "identifier.change" ]
660,671
660,673
u392361133
python
p02859
pritn(int(input())**2)
print(int(input())**2)
[ "identifier.change", "call.function.change" ]
660,686
660,687
u556594202
python