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
p02761
N, M = map(int, input().split()) guess = [-1] * N for i in range(M): s, c = map(int, input().split()) s = s - 1 if s == 0 and c == 0 and M>1: print(-1) exit() if guess[s] == -1: guess[s] = c elif guess[s] == c: continue else: print(-1) exit() if len(guess) > 1 and guess[0] == -1: guess[0] = 1 for i in range(len(guess)): if guess[i] == -1: guess[i] = 0 res = map(str, guess) print(''.join(res))
N, M = map(int, input().split()) guess = [-1] * N for i in range(M): s, c = map(int, input().split()) s = s - 1 if s == 0 and c == 0 and N>1: print(-1) exit() if guess[s] == -1: guess[s] = c elif guess[s] == c: continue else: print(-1) exit() if len(guess) > 1 and guess[0] == -1: guess[0] = 1 for i in range(len(guess)): if guess[i] == -1: guess[i] = 0 res = map(str, guess) print(''.join(res))
[ "identifier.change", "control_flow.branch.if.condition.change" ]
549,955
549,956
u074687136
python
p02761
import sys input = sys.stdin.readline N,M=map(int,input().split()) score=[-1]*N for i in range(M): s,c=map(int,input().split()) s-=1 if score[s]==-1 or score[s]==c: score[s]=c else: print(-1) sys.exit() if N>1 and score[0]==0: print(-1) sys.exit() for i in range(N): if score[i]==-1: score[i]=0 if max(score)==0 and N>1: score[0]=1 print("".join(map(str,score)))
import sys input = sys.stdin.readline N,M=map(int,input().split()) score=[-1]*N for i in range(M): s,c=map(int,input().split()) s-=1 if score[s]==-1 or score[s]==c: score[s]=c else: print(-1) sys.exit() if N>1 and score[0]==0: print(-1) sys.exit() for i in range(N): if score[i]==-1: score[i]=0 if score[0]==0 and N>1: score[0]=1 print("".join(map(str,score)))
[ "call.remove", "control_flow.branch.if.condition.change" ]
549,958
549,959
u695811449
python
p02761
import sys N,M=map(int,input().split()) if M==0: if N==1: ans=0 else: ans=10**(N-1) print(ans) sys.exit() listSC=[] for k in range(M): s,c=map(int,input().split()) listSC+=[[s,c]] MAX=0 if N==1: for s,c in listSC: MAX==max(MAX,c) if MAX==0: print(0) sys.exit() for i in range(10**(N-1),10**N): A=list(str(i)) for k in range(M): if A[listSC[k][0]-1]!=str(listSC[k][1]): break if k==M-1: ans=i print(ans) sys.exit() if i==10**N-1: print(-1)
import sys N,M=map(int,input().split()) if M==0: if N==1: ans=0 else: ans=10**(N-1) print(ans) sys.exit() listSC=[] for k in range(M): s,c=map(int,input().split()) listSC+=[[s,c]] MAX=0 if N==1: for s,c in listSC: MAX=max(MAX,c) if MAX==0: print(0) sys.exit() for i in range(10**(N-1),10**N): A=list(str(i)) for k in range(M): if A[listSC[k][0]-1]!=str(listSC[k][1]): break if k==M-1: ans=i print(ans) sys.exit() if i==10**N-1: print(-1)
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
549,972
549,973
u829249049
python
p02761
n, m = list(map(int, input().split())) sc = [list(map(int,input().split())) for i in range(m)] for i in range(0, 10**n): str_i = str(i) if len(str_i) != n: continue chk = True for s, c in sc: cnt &= str_i[s-1] == str(c) if chk: print(i) exit() print(-1)
n, m = list(map(int, input().split())) sc = [list(map(int,input().split())) for i in range(m)] for i in range(0, 10**n): str_i = str(i) if len(str_i) != n: continue chk = True for s, c in sc: chk &= str_i[s-1] == str(c) if chk: print(i) exit() print(-1)
[ "identifier.change" ]
549,976
549,977
u057993957
python
p02761
N,M = map(int,input().split()) m = [] for i in range(M): m.append(list(map(int,input().split()))) for i in range(10**N): a = str(i) if i >= 10**(N-1): for j in range(M): try: if a[m[j][0]-1] == str(m[j][1]): True else: break except: break if j == M-1: print(i) exit() if M==0: if N == 1: print(0) else: print(10**(N-1)) elif M==1: if N == 1: m == [[1,0]] print(0) else : print(-1)
N,M = map(int,input().split()) m = [] for i in range(M): m.append(list(map(int,input().split()))) for i in range(10**N): a = str(i) if i >= 10**(N-1): for j in range(M): try: if a[m[j][0]-1] == str(m[j][1]): True else: break except: break if j == M-1: print(i) exit() if M==0: if N == 1: print(0) else: print(10**(N-1)) exit() elif M==1: if N == 1: m == [[1,0]] print(0) exit() print(-1)
[ "call.add", "call.arguments.change" ]
549,991
549,992
u093783313
python
p02761
import sys N, M = map(int, input().split()) num_map = [None for _ in range(N)] for _ in range(M): s, c = map(int, input().split()) s -= 1 if s > N or (num_map[s] is not None and num_map[s] != c) or (s == 0 and c == 0 and N > 1): print(-1) sys.exit() num_map[s] = c num_map.reverse() ans = 0 for i, num in enumerate(num_map): if num is not None: ans += num*(10**i) elif i == N-1: ans += N*(10**i) print(ans)
import sys N, M = map(int, input().split()) num_map = [None for _ in range(N)] for _ in range(M): s, c = map(int, input().split()) s -= 1 if s > N or (num_map[s] is not None and num_map[s] != c) or (s == 0 and c == 0 and N > 1): print(-1) sys.exit() num_map[s] = c num_map.reverse() ans = 0 for i, num in enumerate(num_map): if num is not None: ans += num*(10**i) elif i == N-1 and N > 1: ans += (10**i) print(ans)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "expression.operation.binary.remove" ]
549,993
549,994
u538632589
python
p02761
n,m = map(int,input().split()) s_li=[0]*m l_li=[0]*m for i in range(m): s_li[i],l_li[i] = map(int,input().split()) for i in range(1,1000): string = str(i) if len(string)!=n: continue flag=True for j in range(m): if int(string[s_li[j]-1])==l_li[j]: continue flag=False break if flag: print(string);exit() print(-1)
n,m = map(int,input().split()) s_li=[0]*m l_li=[0]*m for i in range(m): s_li[i],l_li[i] = map(int,input().split()) for i in range(1000): string = str(i) if len(string)!=n: continue flag=True for j in range(m): if int(string[s_li[j]-1])==l_li[j]: continue flag=False break if flag: print(string);exit() print(-1)
[ "call.arguments.change" ]
550,012
550,013
u535171899
python
p02761
n, m = map(int, input().split()) a = [[],[],[]] for i in range(m): s, c = map(int, input().split()) if not c in a[s-1]: a[s-1].append(c) ans = 0 if m==0: if n==3: print(100) elif n==2: print(10) else : print(0) elif (len(a[0]) > 1) or (len(a[1]) > 1) or (len(a[2]) > 1): print(-1) else: if (n==3 or n==2) and len(a[0]) == 0: a[0][0]=1 if (n==3 or n==2) and a[0][0] == 0: print(-1) else: for i in range(n): if len(a[i]) == 1: ans += a[i][0] * (10**(n-1-i)) print(ans)
n, m = map(int, input().split()) a = [[],[],[]] for i in range(m): s, c = map(int, input().split()) if not c in a[s-1]: a[s-1].append(c) ans = 0 if m==0: if n==3: print(100) elif n==2: print(10) else : print(0) elif (len(a[0]) > 1) or (len(a[1]) > 1) or (len(a[2]) > 1): print(-1) else: if (n==3 or n==2) and len(a[0]) == 0: a[0].append(1) if (n==3 or n==2) and a[0][0] == 0: print(-1) else: for i in range(n): if len(a[i]) == 1: ans += a[i][0] * (10**(n-1-i)) print(ans)
[ "call.arguments.change" ]
550,045
550,046
u235027735
python
p02761
N,M = map(int,input().split()) sc = [tuple(map(int,input().split())) for i in range(M)] if N==1: r = range(1,10) elif N==2: r = range(10,100) else: r = range(100,1000) for n in r: n = str(n) for s,c in sc: s -= 1 if n[s] != str(c): break else: print(n) exit() print(-1)
N,M = map(int,input().split()) sc = [tuple(map(int,input().split())) for i in range(M)] if N==1: r = range(0,10) elif N==2: r = range(10,100) else: r = range(100,1000) for n in r: n = str(n) for s,c in sc: s -= 1 if n[s] != str(c): break else: print(n) exit() print(-1)
[ "literal.number.integer.change", "assignment.value.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
550,063
550,064
u028014940
python
p02761
n, m = map(int, input().split()) lst = [list(map(int, input().split())) for _ in range(m)] ans = -1 for i in range(10 ** n): tmp = str(i) if len(tmp) == n: flg = False for l in lst: if tmp[l[0] - 1] == str(l[1]): flg = True break if flg == True: ans = i break print(ans)
n, m = map(int, input().split()) lst = [list(map(int, input().split())) for _ in range(m)] ans = -1 for i in range(10 ** n): tmp = str(i) if len(tmp) == n: flg = True for l in lst: if tmp[l[0] - 1] != str(l[1]): flg = False break if flg == True: ans = i break print(ans)
[ "misc.opposites", "assignment.value.change", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
550,067
550,068
u731322489
python
p02761
def main(): N, M = map(int, input().split()) num = [-1] * N for _ in range(M): s, c = map(int, input().split()) s -= 1 if s == 0 and c == 0: if N != 1: print(-1) return if num[s] == -1: num[s] = c elif num[s] != c: print(-1) return ans = "" for i in range(len(num)): c = num[i] if c == -1: if i != 0: ans += "0" else: ans += "1" else: ans += str(c) print(ans) main()
def main(): N, M = map(int, input().split()) num = [-1] * N for _ in range(M): s, c = map(int, input().split()) s -= 1 if s == 0 and c == 0: if N != 1: print(-1) return if num[s] == -1: num[s] = c elif num[s] != c: print(-1) return ans = "" for i in range(len(num)): c = num[i] if c == -1: if i != 0 or N == 1: ans += "0" else: ans += "1" else: ans += str(c) print(ans) main()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,096
550,097
u720721463
python
p02761
N, M = list(map(int, input().split())) sc = [] for i in range(M): s, c = list(map(int, input().split())) sc.append([s, c]) print(sc) for i in range(10**N): stri = str(i) if len(stri) == N: for j in range(M): k = sc[j][0] if not stri[k-1] == str(sc[j][1]): break else: print(i) break else: print(-1)
N, M = list(map(int, input().split())) sc = [] for i in range(M): s, c = list(map(int, input().split())) sc.append([s, c]) for i in range(10**N): stri = str(i) if len(stri) == N: for j in range(M): k = sc[j][0] if not stri[k-1] == str(sc[j][1]): break else: print(i) break else: print(-1)
[ "call.remove" ]
550,100
550,101
u752774573
python
p02761
n, m = map(int, input().split()) number = [0] * n cou = [0] * n #logging.debug(number)# for i in range(m): s, c = map(int, input().split()) s -= 1 if cou[s] > 0 and c != number[s]: print(-1) exit() else: cou[s] += 1 number[s] = c #logging.debug("number = {}, cou = {}".format(number, cou)) if n > 1 and number[0] == 0 and cou[0] >= 1: print(-1) exit() elif n > 1 and number[0] == 0: number[1] = 1 number = map(str, number) print(''.join(number))
n, m = map(int, input().split()) number = [0] * n cou = [0] * n #logging.debug(number)# for i in range(m): s, c = map(int, input().split()) s -= 1 if cou[s] > 0 and c != number[s]: print(-1) exit() else: cou[s] += 1 number[s] = c #logging.debug("number = {}, cou = {}".format(number, cou)) if n > 1 and number[0] == 0 and cou[0] >= 1: print(-1) exit() elif n > 1 and number[0] == 0: number[0] = 1 number = map(str, number) print(''.join(number))
[ "literal.number.integer.change", "assignment.variable.change", "variable_access.subscript.index.change" ]
550,106
550,107
u620238824
python
p02761
N, M = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(M)] cand = [-1] * N flag = False for s, c in X: s -= 1 if cand[s] == -1: cand[s] = c elif cand[s] != c: flag = True if flag or (N > 1 and cand[0] == 0): print(-1) else: ans = 0 for i in range(N): if cand[i] == -1: if i == 0: cand[i] = 1 else: cand[i] = 0 ans += cand[i] * 10 ** (N - i - 1) print(ans)
N, M = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(M)] cand = [-1] * N flag = False for s, c in X: s -= 1 if cand[s] == -1: cand[s] = c elif cand[s] != c: flag = True if flag or (N > 1 and cand[0] == 0): print(-1) else: ans = 0 for i in range(N): if cand[i] == -1: if i == 0 and N > 1: cand[i] = 1 else: cand[i] = 0 ans += cand[i] * 10 ** (N - i - 1) print(ans)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,112
550,113
u057109575
python
p02761
#from statistics import median #import collections #aa = collections.Counter(a) # list to list #from itertools import combinations # (string,3) 3回 # # # pythonで無理なときは、pypyでやると正解するかも!! # # mod = 10**9 + 7 def readInts(): return list(map(int,input().split())) def main(): n,m = readInts() S = [] for i in range(m): x,y = readInts() x -=1 S.append((x,y)) for i in range(10**n): s = str(i) if len(S) != n: continue if all(S[a] == str(b) for a,b in S): print(i) exit() print(-1) """for i in range(n): S.append(0) La = False for i in range(m): s,c = readInts() s -=1 if S[s] == 0 or S[s] == c: S[s] = c La = True else: print('-1') exit() if La: if n == 3 and S[0] == 0: print('-1') exit() if n == 2 and S[0] == 0: print('-1') exit() if S.count(0) == n and not n == 1: # もし0の数が桁数と一緒ならば、 S[0] = 1 print(*S,sep='') """ if __name__ == '__main__': main()
#from statistics import median #import collections #aa = collections.Counter(a) # list to list #from itertools import combinations # (string,3) 3回 # # # pythonで無理なときは、pypyでやると正解するかも!! # # mod = 10**9 + 7 def readInts(): return list(map(int,input().split())) def main(): n,m = readInts() S = [] for i in range(m): x,y = readInts() x -=1 S.append((x,y)) for i in range(10**n): s = str(i) if len(s) != n: continue if all(s[a] == str(b) for a,b in S): print(i) exit() print(-1) """for i in range(n): S.append(0) La = False for i in range(m): s,c = readInts() s -=1 if S[s] == 0 or S[s] == c: S[s] = c La = True else: print('-1') exit() if La: if n == 3 and S[0] == 0: print('-1') exit() if n == 2 and S[0] == 0: print('-1') exit() if S.count(0) == n and not n == 1: # もし0の数が桁数と一緒ならば、 S[0] = 1 print(*S,sep='') """ if __name__ == '__main__': main()
[ "misc.typo", "identifier.change", "control_flow.branch.if.condition.change" ]
550,142
550,143
u156815136
python
p02761
n, m = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(m)] ans = [-1]*n flag = False for s, c in X: if ans[s-1]>=0 and ans[s-1]!=c: flag = False if n > 1 and s == 1 and c == 0: flag = False else: ans[s-1] = c if flag: print(-1) exit(0) for i in range(n): if ans[i] == -1: if n > 1 and i == 0: ans[i] = 1 else: ans[i] = 0 print(*ans, sep="")
n, m = map(int, input().split()) X = [list(map(int, input().split())) for _ in range(m)] ans = [-1]*n flag = False for s, c in X: if ans[s-1] >= 0 and ans[s-1] != c: flag = True if n > 1 and s == 1 and c == 0: flag = True else: ans[s-1] = c if flag: print(-1) exit(0) for i in range(n): if ans[i] == -1: if n > 1 and i == 0: ans[i] = 1 else: ans[i] = 0 print(*ans, sep="")
[ "misc.opposites", "assignment.value.change" ]
550,159
550,160
u441175813
python
p02761
N, M = map(int, input().split()) s = [] c = [] for i in range(M): si, ci = map(int, input().split()) s.append(si-1) c.append(ci) answer = [-1] * N valid = True for i in range(M): if answer[s[i]] != -1 and answer[s[i]] != c[i]: valid = False break answer[s[i]] = c[i] if answer[0] == 0 and N != 1: valid = False if valid: if N == 1 and answer[0] == -1: answer[0] = 0 elif answer[0] == -1: answer[0] == 1 for i in range(N): if answer[i] == -1: answer[i] = 0 print(int(''.join(map(lambda x: str(x), answer)))) else: print(-1)
N, M = map(int, input().split()) s = [] c = [] for i in range(M): si, ci = map(int, input().split()) s.append(si-1) c.append(ci) answer = [-1] * N valid = True for i in range(M): if answer[s[i]] != -1 and answer[s[i]] != c[i]: valid = False break answer[s[i]] = c[i] if answer[0] == 0 and N != 1: valid = False if valid: if N == 1 and answer[0] == -1: answer[0] = 0 elif answer[0] == -1: answer[0] = 1 for i in range(N): if answer[i] == -1: answer[i] = 0 print(int(''.join(map(lambda x: str(x), answer)))) else: print(-1)
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,161
550,162
u850390157
python
p02761
n,m = map(int,input().split()) l = [list(map(int,input().split())) for i in range(m)] s,c = [list(i) for i in zip(*l)] z = ['a'] * n for i in range(m): if z[s[i]-1] == 'a': z[s[i]-1] = str(c[i]) elif z[s[i]-1] == str(c[i]): pass else: print('-1') exit(0) if n == 1: if z[0] == 'a': print(0) else: print(z[0]) else: if z[0] == '0': print(-1) else: if z[0] == 'a': z[0] = '1' for i in range(1,n): if z[i] == 'a': z[i] = '0' print(''.join(z))
n,m = map(int,input().split()) if m != 0: l = [list(map(int,input().split())) for i in range(m)] s,c = [list(i) for i in zip(*l)] z = ['a'] * n for i in range(m): if z[s[i]-1] == 'a': z[s[i]-1] = str(c[i]) elif z[s[i]-1] == str(c[i]): pass else: print('-1') exit(0) if n == 1: if z[0] == 'a': print(0) else: print(z[0]) else: if z[0] == '0': print(-1) else: if z[0] == 'a': z[0] = '1' for i in range(1,n): if z[i] == 'a': z[i] = '0' print(''.join(z))
[ "control_flow.branch.if.add" ]
550,171
550,172
u357751375
python
p02761
from sys import stdin import sys import math from functools import reduce import itertools n,m = [int(x) for x in stdin.readline().rstrip().split()] x = list('a'*n) for i in range(m): a, b = [x for x in stdin.readline().rstrip().split()] a = int(a) - 1 if x[a] == 'a' or x[a] == b: x[a] = b else: print(-1) sys.exit() if x[0] == '0' and n != 1: print(-1) sys.exit() if x[0] == 'a': x[0] = '1' if x[0] == 'a' and n == 1: x[0] = '0' for i in range(1,n): if x[i] == 'a': x[i] = '0' print(''.join(x))
from sys import stdin import sys import math from functools import reduce import itertools n,m = [int(x) for x in stdin.readline().rstrip().split()] x = list('a'*n) for i in range(m): a, b = [x for x in stdin.readline().rstrip().split()] a = int(a) - 1 if x[a] == 'a' or x[a] == b: x[a] = b else: print(-1) sys.exit() if x[0] == '0' and n != 1: print(-1) sys.exit() if x[0] == 'a' and n > 1: x[0] = '1' if x[0] == 'a' and n == 1: x[0] = '0' for i in range(1,n): if x[i] == 'a': x[i] = '0' print(''.join(x))
[ "control_flow.branch.if.condition.change" ]
550,183
550,184
u788260274
python
p02761
def main(): n, m = map(int, input().split()) C = [-1] * n flag = 0 for i in range(m): s, c = map(int, input().split()) if C[s - 1] == -1 or C[s - 1] == c: C[s - 1] = c else: flag = 1 if flag or (C[0] == 0 and n != 0): print(-1) return else: C = [0 if i == -1 else i for i in C] if C[0] == 0 and n != 0: C[0] = 1 print(''.join(list(map(str, C)))) if __name__ == '__main__': main()
# def main(): # n, m = map(int, input().split()) # ans = [0] * n # count = [0] * n # for i in range(m): # s, c = map(int, input().split()) # if s == 1 and c == 0 and n != 1: # print(-1) # exit() # if count[s - 1] == 0 or ans[s - 1] == c: # ans[s - 1] = c # count[s - 1] += 1 # else: # print(-1) # exit() # if ans[0] == 0 and n != 1: # ans[0] = 1 # print(''.join(map(str, ans))) # if __name__ == '__main__': # main() def main(): n, m = map(int, input().split()) C = [-1] * n flag = 0 for i in range(m): s, c = map(int, input().split()) if C[s - 1] == -1 or C[s - 1] == c: C[s - 1] = c else: flag = 1 if flag or (C[0] == 0 and n != 1): print(-1) return else: C = [0 if i == -1 else i for i in C] if C[0] == 0 and n != 1: C[0] = 1 print(''.join(list(map(str, C)))) if __name__ == '__main__': main()
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
550,189
550,190
u279266699
python
p02761
def main(): n, m = map(int, input().split()) ans = [0] * n count = [0] * n for i in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n != 1: print(-1) exit() if count[s - 1] == 0 or ans[s - 1] == c: ans[s - 1] = c count[s - 1] += 1 else: print(-1) exit() if ans[0] == 0: ans[0] = 1 print(''.join(map(str, ans))) if __name__ == '__main__': main()
def main(): n, m = map(int, input().split()) ans = [0] * n count = [0] * n for i in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n != 1: print(-1) exit() if count[s - 1] == 0 or ans[s - 1] == c: ans[s - 1] = c count[s - 1] += 1 else: print(-1) exit() if ans[0] == 0 and n != 1: ans[0] = 1 print(''.join(map(str, ans))) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change" ]
550,191
550,192
u279266699
python
p02761
def main(): n, m = map(int, input().split()) ans = [0] * n count = [0] * n for i in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n != 0: print(-1) exit() if count[s - 1] == 0 or ans[s - 1] == c: ans[s - 1] = c count[s - 1] += 1 else: print(-1) exit() if ans[0] == 0: ans[0] = 1 print(''.join(map(str, ans))) if __name__ == '__main__': main()
def main(): n, m = map(int, input().split()) ans = [0] * n count = [0] * n for i in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n != 1: print(-1) exit() if count[s - 1] == 0 or ans[s - 1] == c: ans[s - 1] = c count[s - 1] += 1 else: print(-1) exit() if ans[0] == 0 and n != 1: ans[0] = 1 print(''.join(map(str, ans))) if __name__ == '__main__': main()
[ "literal.number.integer.change", "control_flow.branch.if.condition.change" ]
550,193
550,192
u279266699
python
p02761
N,M = map(int, input().split()) dp = [-1] * N for i in range(M): s, c = map(int, input().split()) s -= 1 if dp[s] != -1 and dp[s] != c: print(-1) exit() dp[s] = c if N != 1: if dp[0] == 0: print(-1) exit() if dp[0] == -1: dp[0] == 1 for i in range(1, N): if dp[i] == -1: dp[i] = 0 else: if dp[0] == -1: dp[0] = 0 print(''.join(map(str, dp)))
N,M = map(int, input().split()) dp = [-1] * N for i in range(M): s, c = map(int, input().split()) s -= 1 if dp[s] != -1 and dp[s] != c: print(-1) exit() dp[s] = c if N != 1: if dp[0] == 0: print(-1) exit() if dp[0] == -1: dp[0] = 1 for i in range(1, N): if dp[i] == -1: dp[i] = 0 else: if dp[0] == -1: dp[0] = 0 print(''.join(map(str, dp)))
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,196
550,197
u323859575
python
p02761
N,M = map(int,input().split()) a = [0]*N b = [None]*N for i in range(M): s,c = map(int,input().split()) if b[s-1] == c: continue else: a[s-1] +=1 b[s-1] =c count = 0 for i in range(N): if a[i]>=2: count=-1 elif b[0]==0 and N>1: count =-1 elif b[i]==0: if i is None: if N==1: b[i] =0 else: b[i]=1 elif i>0: if b[i] is None: b[i]=0 b.reverse() if count == 0: for i in range(N): count+=b[i]*10**i print(count)
N,M = map(int,input().split()) a = [0]*N b = [None]*N for i in range(M): s,c = map(int,input().split()) if b[s-1] == c: continue else: a[s-1] +=1 b[s-1] =c count = 0 for i in range(N): if a[i]>=2: count=-1 elif b[0]==0 and N>1: count =-1 elif i==0: if b[i] is None: if N==1: b[i] =0 else: b[i]=1 elif i>0: if b[i] is None: b[i]=0 b.reverse() if count == 0: for i in range(N): count+=b[i]*10**i print(count)
[ "control_flow.loop.for.condition.change", "control_flow.branch.if.condition.change" ]
550,198
550,199
u766646838
python
p02761
N,M = map(int,input().split()) a = [0]*N b = [None]*N for i in range(M): s,c = map(int,input().split()) if b[s-1] == c: continue else: a[s-1] +=1 b[s-1] =c count = 0 for i in range(N): if a[i]>=2: count=-1 elif b[0]==0 and N>1: count =-1 elif i==0: if i is None: if N==1: b[i] =0 else: b[i]=1 elif i>0: if b[i] is None: b[i]=0 b.reverse() if count == 0: for i in range(N): count+=b[i]*10**i print(count)
N,M = map(int,input().split()) a = [0]*N b = [None]*N for i in range(M): s,c = map(int,input().split()) if b[s-1] == c: continue else: a[s-1] +=1 b[s-1] =c count = 0 for i in range(N): if a[i]>=2: count=-1 elif b[0]==0 and N>1: count =-1 elif i==0: if b[i] is None: if N==1: b[i] =0 else: b[i]=1 elif i>0: if b[i] is None: b[i]=0 b.reverse() if count == 0: for i in range(N): count+=b[i]*10**i print(count)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,200
550,199
u766646838
python
p02761
n, m = map(int, input().split()) ans = [-1] * n for _ in range(m): s, c = map(int, input().split()) if ans[s - 1] == -1: ans[s - 1] = c elif ans[s - 1] != -1 and ans[s - 1] != c: print(-1) exit() if n != 1 and ans[0] == 0: print(-1) exit() if ans[0] == -1: ans[0] = 1 for i in range(n): if ans[i] == -1: ans[i] = 0 print(''.join(map(str, ans)))
n, m = map(int, input().split()) ans = [-1] * n for _ in range(m): s, c = map(int, input().split()) if ans[s - 1] == -1: ans[s - 1] = c elif ans[s - 1] != -1 and ans[s - 1] != c: print(-1) exit() if n != 1 and ans[0] == 0: print(-1) exit() if n != 1 and ans[0] == -1: ans[0] = 1 for i in range(n): if ans[i] == -1: ans[i] = 0 print(''.join(map(str, ans)))
[ "control_flow.branch.if.condition.change" ]
550,215
550,216
u411537765
python
p02761
N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] for X in range(10**N): X = str(X) #all すべてがtrueならという意味 if len(X) == N and all(X[s-1] == str(c) for s, c in SC): print(X[s-1]) break else: print(-1)
N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] for X in range(10**N): X = str(X) #all すべてがtrueならという意味 if len(X) == N and all(X[s-1] == str(c) for s, c in SC): print(X) break else: print(-1)
[]
550,217
550,218
u861886710
python
p02761
import sys input = sys.stdin.readline n,m = map(int,input().split()) L=[-1]*n if n==1 and m==0: print(0) sys.exit() for i in range(m): s,c=map(int,input().split()) s-=1 if L[s]==-1 or L[s]==c: L[s] = c else: print(-1) sys.exit() if L[0]==0: print(-1) sys.exit() for i in range(n): if L[i]==-1: if i==0: L[i]=1 else: L[i]=0 print(*L,sep="")
import sys input = sys.stdin.readline n,m = map(int,input().split()) L=[-1]*n if n==1 and m==0: print(0) sys.exit() for i in range(m): s,c=map(int,input().split()) s-=1 if L[s]==-1 or L[s]==c: L[s] = c else: print(-1) sys.exit() if L[0]==0 and n>1: print(-1) sys.exit() for i in range(n): if L[i]==-1: if i==0: L[i]=1 else: L[i]=0 print(*L,sep="")
[ "control_flow.branch.if.condition.change" ]
550,223
550,222
u505564549
python
p02761
N,M = list(map(int,input().split())) A = ['a']*N for i in range(M): s,c = list(map(int,input().split())) if A[s-1] != 'a' and A[s-1] != str(c): print('-1') exit() else: A[s-1] = str(c) if A[0] == '0' and len(A) != 1: print('-1') exit() elif A[0] == 'a' and len(A) != 1: A[0] == '1' for i in range(N): if A[i] == 'a': A[i] = '0' print(''.join(A))
N,M = list(map(int,input().split())) A = ['a']*N for i in range(M): s,c = list(map(int,input().split())) if A[s-1] != 'a' and A[s-1] != str(c): print('-1') exit() else: A[s-1] = str(c) if A[0] == '0' and len(A) != 1: print('-1') exit() elif A[0] == 'a' and len(A) != 1: A[0] = '1' for i in range(N): if A[i] == 'a': A[i] = '0' print(''.join(A))
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,226
550,227
u514118270
python
p02761
import sys N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] flagN = [False]*N numN = [0]*N numN[0] = 1 for sc in SC: s, c = sc[0], sc[1] if flagN[s-1] == False: flagN[s-1] = True numN[s-1] = c elif numN[s-1] == c: continue else: print(-1) sys.exit() if N != 1 and numN[0] == 0: print(-1) sys.exit() ans = '' for n in numN: ans += str(n) print(ans)
import sys N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] flagN = [False]*N numN = [0]*N if N > 1: numN[0] = 1 for sc in SC: s, c = sc[0], sc[1] if flagN[s-1] == False: flagN[s-1] = True numN[s-1] = c elif numN[s-1] == c: continue else: print(-1) sys.exit() if N != 1 and numN[0] == 0: print(-1) sys.exit() ans = '' for n in numN: ans += str(n) print(ans)
[ "control_flow.branch.if.add" ]
550,228
550,229
u377834804
python
p02761
n, m = map(int, input().split()) ans = ['0'] * n for i in range(m): s, c = map(int,input().split()) if s == 1 and c == 0 and n != 1: print(-1) break if ans[s-1] != '0' and c != ans[s-1]: print(-1) break ans[s-1] = c else: if n == 1 and int(ans[0]) == 0: print(0) break elif ans[0] == '0': ans[0] = '1' ans = map(str, ans) print(''.join(ans))
n, m = map(int, input().split()) ans = ['0'] * n for i in range(m): s, c = map(int,input().split()) if s == 1 and c == 0 and n != 1: print(-1) break if ans[s-1] != '0' and c != ans[s-1]: print(-1) break ans[s-1] = c else: if n == 1 and int(ans[0]) == 0: print(0) exit() elif ans[0] == '0': ans[0] = '1' ans = map(str, ans) print(''.join(ans))
[ "control_flow.break.remove", "control_flow.exit.add", "call.add" ]
550,251
550,252
u658915215
python
p02761
n, m = map(int, input().split()) ans = ['0'] * n for i in range(m): s, c = map(int,input().split()) if s == 1 and c == 0 and n != 1: print(-1) break if ans[s-1] != '0' and c != ans[s-1]: print(-1) break ans[s-1] = c else: if n == 1 and int(ans[0]) == 0: print(0) elif ans[0] == '0': ans[0] = '1' ans = map(str, ans) print(''.join(ans))
n, m = map(int, input().split()) ans = ['0'] * n for i in range(m): s, c = map(int,input().split()) if s == 1 and c == 0 and n != 1: print(-1) break if ans[s-1] != '0' and c != ans[s-1]: print(-1) break ans[s-1] = c else: if n == 1 and int(ans[0]) == 0: print(0) exit() elif ans[0] == '0': ans[0] = '1' ans = map(str, ans) print(''.join(ans))
[ "call.add" ]
550,253
550,252
u658915215
python
p02761
n,m=map(int,input().split()) s,c=[],[] t=0 for i in range(m): a,b=map(int,input().split()) s.append(a) c.append(b) ans=[10]*n for i in range(m): if ans[s[i]-1]==10: ans[s[i]-1]=c[i] elif ans[s[i]-1]!=10 and ans[s[i]-1]!=c[i]: t=-1 if t==-1: print(-1) elif n==1 and (ans[0]==0 or ans[0]==10): print(0) elif ans[0]==0: print(-1) else: for i in range(n): if i==0 and ans[0]==10: ans[0]==1 elif ans[i]==10: ans[i]=0 print(*ans,sep='')
n,m=map(int,input().split()) s,c=[],[] t=0 for i in range(m): a,b=map(int,input().split()) s.append(a) c.append(b) ans=[10]*n for i in range(m): if ans[s[i]-1]==10: ans[s[i]-1]=c[i] elif ans[s[i]-1]!=10 and ans[s[i]-1]!=c[i]: t=-1 if t==-1: print(-1) elif n==1 and (ans[0]==0 or ans[0]==10): print(0) elif ans[0]==0: print(-1) else: for i in range(n): if i==0 and ans[0]==10: ans[0]=1 elif ans[i]==10: ans[i]=0 print(*ans,sep='')
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,256
550,257
u271210469
python
p02761
import sys N, M = map(int, input().split()) s = [0] * M c = [0] * M for i in range(M): s[i], c[i] = map(int, input().split()) for i in range(1000): S = str(i) if len(S) != N: continue for j in range(M): if int(S[s[j]-1]) != c[j]: break if j == M-1: print(S) sys.exit() if M == 0: print(S) print("-1")
import sys N, M = map(int, input().split()) s = [0] * M c = [0] * M for i in range(M): s[i], c[i] = map(int, input().split()) for i in range(1000): S = str(i) if len(S) != N: continue for j in range(M): if int(S[s[j]-1]) != c[j]: break if j == M-1: print(S) sys.exit() if M == 0: print(S) sys.exit() print("-1")
[ "call.add" ]
550,258
550,259
u698902360
python
p02761
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf from itertools import accumulate,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator import itemgetter from heapq import heappop,heappush from copy import deepcopy from time import time import string import sys sys.setrecursionlimit(10 ** 7) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) n, m = MAP() ans = [-1]*n for i in range(m): s, c = MAP() s -= 1 if ans[s] == -1 or ans[s] == c: ans[s] = c else: print(-1) exit() if ans[0] == 0: if n == 1: print(0) else: print(-1) exit() else: for i in range(n): if ans[i] == -1: if i == 0: ans[i] = 1 else: ans[i] = 0 print(*ans, sep='')
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,pi,inf from itertools import accumulate,permutations,combinations,product,combinations_with_replacement from collections import deque,defaultdict,Counter from bisect import bisect_left,bisect_right from operator import itemgetter from heapq import heappop,heappush from copy import deepcopy from time import time import string import sys sys.setrecursionlimit(10 ** 7) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) n, m = MAP() ans = [-1]*n for i in range(m): s, c = MAP() s -= 1 if ans[s] == -1 or ans[s] == c: ans[s] = c else: print(-1) exit() if ans[0] == 0: if n == 1: print(0) else: print(-1) exit() else: for i in range(n): if ans[i] == -1: if n != 1 and i == 0: ans[i] = 1 else: ans[i] = 0 print(*ans, sep='')
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,278
550,279
u603958124
python
p02761
if __name__ == "__main__": n, m = map(int, input().split()) sc = list() for i in range(m): sc.append(list(map(int, input().split()))) for i in range(1000): s = str(i).zfill(3) if n == 3 and s[0] == '0': continue if n == 2 and s[1] == '0': continue flag = 0 for j in range(m): if str(sc[j][1]) != s[sc[j][0]-1]: flag = 1 if flag == 0: print(i) exit() print('-1')
if __name__ == "__main__": n, m = map(int, input().split()) sc = list() for i in range(m): sc.append(list(map(int, input().split()))) for i in range(1000): s = str(i).zfill(3) if n == 3 and s[0] == '0': continue if n == 2 and s[1] == '0': continue flag = 0 for j in range(m): if str(sc[j][1]) != s[sc[j][0]-1 + (3-n)]: flag = 1 if flag == 0: print(i) exit() print('-1')
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,305
550,306
u426649993
python
p02761
n,m=map(int,input().split()) jouken=[] for x in range(m): jouken.append(list(map(int,input().split()))) for x in range(10**n): ans=0 xx=str(x) if not len(xx)==n: continue for y in range(m): a=jouken[y][0]-1 b=jouken[y][1] if not int(xx[a])==b: ans+=1 if ans==0: print(x) break if ans>1: print(-1)
n,m=map(int,input().split()) jouken=[] for x in range(m): jouken.append(list(map(int,input().split()))) for x in range(10**n): ans=0 xx=str(x) if not len(xx)==n: continue for y in range(m): a=jouken[y][0]-1 b=jouken[y][1] if not int(xx[a])==b: ans+=1 if ans==0: print(x) break if ans>=1: print(-1)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
550,309
550,310
u516554284
python
p02761
N,M = map(int,input().split()) ret = ['a']*N for _ in range(M): s,c = map(int,input().split()) if ret[s-1] not in ['a', c]: print(-1) exit() ret[s-1] = c if ret[0] == 0: if N != 1: print(-1) exit() ans = '' for i in range(N): if ret[i] != 'a': ans += str(ret[i]) else: if i == 0: ans += '1' else: ans += '0' print(int(ans))
N,M = map(int,input().split()) ret = ['a']*N for _ in range(M): s,c = map(int,input().split()) if ret[s-1] not in ['a', c]: print(-1) exit() ret[s-1] = c if ret[0] == 0: if N != 1: print(-1) exit() ans = '' for i in range(N): if ret[i] != 'a': ans += str(ret[i]) else: if i == 0 and N > 1: ans += '1' else: ans += '0' print(int(ans))
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,321
550,322
u760794812
python
p02761
n, m = map(int, input().split()) ans = ['t'] * n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] =='t' or ans[s-1] == str(c): ans[s-1]= str(c) else: print(-1) exit(0) if ans[0] == 't': ans[0]=str(1) ans = ''.join(ans).replace('t', str(0)) ans = int(ans) l = str(ans) if len(l) != n: print(-1) else: print(ans)
n, m = map(int, input().split()) ans = ['t'] * n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] =='t' or ans[s-1] == str(c): ans[s-1]= str(c) else: print(-1) exit(0) if ans[0] == 't' and n >1: ans[0]=str(1) ans = ''.join(ans).replace('t', str(0)) ans = int(ans) l = str(ans) if len(l) != n: print(-1) else: print(ans)
[ "control_flow.branch.if.condition.change" ]
550,327
550,328
u137226361
python
p02761
N, M = map(int,input().split()) num = [0,1,2,3,4,5,6,7,8,9] ans = [str(i) for i in range(10**(N-1), 10**N)] check = [1 for i in range(10**(N-1), 10**N)] if N == 1: ans.insert(0,0) check.insert(0,1) for i in range(M): s, c = map(int,input().split()) s -= 1 for idx, j in enumerate(ans): if j[s] != str(c): check[idx] = 0 for idx, i in enumerate(check): if i == 1: print(ans[idx]) quit() print(-1)
N, M = map(int,input().split()) num = [0,1,2,3,4,5,6,7,8,9] ans = [str(i) for i in range(10**(N-1), 10**N)] check = [1 for i in range(10**(N-1), 10**N)] if N == 1: ans.insert(0,"0") check.insert(0,1) for i in range(M): s, c = map(int,input().split()) s -= 1 for idx, j in enumerate(ans): if j[s] != str(c): check[idx] = 0 for idx, i in enumerate(check): if i == 1: print(ans[idx]) quit() print(-1)
[ "call.arguments.change" ]
550,331
550,332
u735891571
python
p02761
N,M = map(int,input().split()) keep_value = [None]*N check = False for i in range(M): s,c = map(int,input().split()) if((keep_value[s-1]!=None) and (keep_value[s-1]!=c)): print('-1') exit() else: keep_value[s-1]=c if(None not in keep_value): print(''.join(map(str,keep_value))) else: if(N>2 and keep_value[0]==0): print('-1') else: if(keep_value[0]==None and N>2): keep_value[0]=1 keep_value=[0 if i==None else i for i in keep_value] print(''.join(map(str,keep_value)))
N,M = map(int,input().split()) keep_value = [None]*N check = False for i in range(M): s,c = map(int,input().split()) if((keep_value[s-1]!=None) and (keep_value[s-1]!=c)): print('-1') exit() else: keep_value[s-1]=c if(None not in keep_value): print(''.join(map(str,keep_value))) else: if(N>2 and keep_value[0]==0): print('-1') else: if(keep_value[0]==None and N>=2): keep_value[0]=1 keep_value=[0 if i==None else i for i in keep_value] print(''.join(map(str,keep_value)))
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
550,337
550,338
u388971072
python
p02761
N,M = map(int,input().split()) keep_value = [None]*N check = False for i in range(M): s,c = map(int,input().split()) if((keep_value[s-1]!=None) and (keep_value[s-1]!=c)): print('-1') exit() else: keep_value[s-1]=c if(None not in keep_value): print(''.join(map(str,keep_value))) else: if(N>2 and keep_value[0]==0): print('-1') else: if(keep_value[0]==None): keep_value[0]=1 keep_value=[0 if i==None else i for i in keep_value] print(''.join(map(str,keep_value)))
N,M = map(int,input().split()) keep_value = [None]*N check = False for i in range(M): s,c = map(int,input().split()) if((keep_value[s-1]!=None) and (keep_value[s-1]!=c)): print('-1') exit() else: keep_value[s-1]=c if(None not in keep_value): print(''.join(map(str,keep_value))) else: if(N>2 and keep_value[0]==0): print('-1') else: if(keep_value[0]==None and N>=2): keep_value[0]=1 keep_value=[0 if i==None else i for i in keep_value] print(''.join(map(str,keep_value)))
[ "control_flow.branch.if.condition.change" ]
550,339
550,338
u388971072
python
p02761
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from math import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 n,m=map(int,input().split()) sc=[list(map(int,input().split())) for i in range(m)] sc.sort() lst=[-1]*n for i in range(m): s,c=sc[i] if n!=1 and s==1 and c==0: print(-1) quit() if lst[s-1]!=-1 and lst[s-1]!=c: print(-1) quit() lst[s-1]=c ans=0 if lst[0]==-1: lst[0]=1 for i in range(n): if lst[i]!=-1: ans=ans*10 + lst[i] else: ans=ans*10 + 0 print(ans)
import sys from collections import * import heapq import math import bisect from itertools import permutations,accumulate,combinations,product from math import gcd def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) mod=pow(10,9)+7 n,m=map(int,input().split()) sc=[list(map(int,input().split())) for i in range(m)] sc.sort() lst=[-1]*n for i in range(m): s,c=sc[i] if n!=1 and s==1 and c==0: print(-1) quit() if lst[s-1]!=-1 and lst[s-1]!=c: print(-1) quit() lst[s-1]=c ans=0 if lst[0]==-1 and n!=1: lst[0]=1 for i in range(n): if lst[i]!=-1: ans=ans*10 + lst[i] else: ans=ans*10 + 0 print(ans)
[ "control_flow.branch.if.condition.change" ]
550,369
550,370
u654470292
python
p02761
import sys n, m = map(int, input().split()) sc = [list(map(int, input().split())) for _ in range(m)] ans = [-1] * n for i in sc: s, c = i if (ans[s-1] == c) | (ans[s-1] == -1): ans[s-1] = c else: print(-1) sys.exit() for i in range(n): if ans[i] == -1: if (i == 0) & (n == 1): ans[i] = 1 else: ans[i] = 0 if n != 1: if ans[0] == 0: print(-1) sys.exit() print(*ans, sep='')
import sys n, m = map(int, input().split()) sc = [list(map(int, input().split())) for _ in range(m)] ans = [-1] * n for i in sc: s, c = i if (ans[s-1] == c) | (ans[s-1] == -1): ans[s-1] = c else: print(-1) sys.exit() for i in range(n): if ans[i] == -1: if (i == 0) & (n != 1): ans[i] = 1 else: ans[i] = 0 if n != 1: if ans[0] == 0: print(-1) sys.exit() print(*ans, sep='')
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
550,371
550,372
u222668979
python
p02761
import sys n,m = map(int, input().split()) num = [0]*n count = [0]*n for _ in range(m): b,c = map(int, input().split()) if num[b-1] != c and count[b-1] > 0: print(-1) sys.exit() count[b-1]+=1 num[b-1] = c if n == 3 and num[0] == 0 and count[0] == 0: num[0] == 1 elif n == 3 and num[0] == 0 and count[0]>0: print(-1) sys.exit() elif n == 2 and num[0] == 0 and count[0] == 0: num[0] == 1 elif n == 2 and num[0] == 0 and count[0] > 0: print(-1) sys.exit() ans = "" for i in range(n): ans+=str(num[i]) print(ans)
import sys n,m = map(int, input().split()) num = [0]*n count = [0]*n for _ in range(m): b,c = map(int, input().split()) if num[b-1] != c and count[b-1] > 0: print(-1) sys.exit() count[b-1]+=1 num[b-1] = c if n == 3 and num[0] == 0 and count[0] == 0: num[0] = 1 elif n == 3 and num[0] == 0 and count[0]>0: print(-1) sys.exit() elif n == 2 and num[0] == 0 and count[0] == 0: num[0] = 1 elif n == 2 and num[0] == 0 and count[0] > 0: print(-1) sys.exit() ans = "" for i in range(n): ans+=str(num[i]) print(ans)
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,377
550,378
u518891382
python
p02761
n, m = map(int, input().split()) s = [] c = [] for i in range(n): S, C = map(int, input().split()) s.append(S) c.append(C) for i in range(10 **(n + 1)): tmp = str(i) if len(tmp) == n and all([tmp[s[j] - 1] == str(c[j]) for j in range(m)]): print(tmp) exit() print(-1)
n, m = map(int, input().split()) s = [] c = [] for i in range(m): S, C = map(int, input().split()) s.append(S) c.append(C) for i in range(10 **(n + 1)): tmp = str(i) if len(tmp) == n and all([tmp[s[j] - 1] == str(c[j]) for j in range(m)]): print(tmp) exit() print(-1)
[ "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.upper.change" ]
550,379
550,380
u004482945
python
p02761
N,M = map(int,input().split()) ans = [-1] * N for i in range(M): s,c = map(int,input().split()) if ans[s-1] != -1 and ans[s-1] != c : print(-1) exit() t[s-1] = c if N != 1 : if ans[0] == 0 : print(-1) exit() if ans[0] == -1 : ans[0] = 1 for i in range(N): if ans[i] == -1: ans[i] = 0 else : if ans[0] == -1 : ans[0] = 0 print(*ans,sep='')
N,M = map(int,input().split()) ans = [-1] * N for i in range(M): s,c = map(int,input().split()) if ans[s-1] != -1 and ans[s-1] != c : print(-1) exit() ans[s-1] = c if N != 1 : if ans[0] == 0 : print(-1) exit() if ans[0] == -1 : ans[0] = 1 for i in range(N): if ans[i] == -1: ans[i] = 0 else : if ans[0] == -1 : ans[0] = 0 print(*ans,sep='')
[ "assignment.variable.change", "identifier.change" ]
550,383
550,384
u453623947
python
p02761
import sys def main(): n, m = map(int, input().split()) s = [tuple(map(int, input().split())) for _ in range(m)] s = set(s) len_s = len(s) if len_s != len(set([sc[0] for sc in s])): print(-1) sys.exit() if m == 0 and n == 1: print(0) sys.exit() r = -1 for i in range(10**n): i_s = str(i) i_s = i_s.zfill(n) flag = True for sc in s: if i_s[sc[0]-1] != str(sc[1]): flag = False continue if n == 3 and i_s[0] == '0': flag = False elif n == 3 and i_s[0] == '0' and i_s[1] == '0': flag = False elif n == 2 and i_s[1] == '0': flag = False if flag: r = i break print(r) main()
import sys def main(): n, m = map(int, input().split()) s = [tuple(map(int, input().split())) for _ in range(m)] s = set(s) len_s = len(s) if len_s != len(set([sc[0] for sc in s])): print(-1) sys.exit() if m == 0 and n == 1: print(0) sys.exit() r = -1 for i in range(10**n): i_s = str(i) i_s = i_s.zfill(n) flag = True for sc in s: if i_s[sc[0]-1] != str(sc[1]): flag = False continue if n == 3 and i_s[0] == '0': flag = False elif n == 3 and i_s[0] == '0' and i_s[1] == '0': flag = False elif n == 2 and i_s[0] == '0': flag = False if flag: r = i break print(r) main()
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change" ]
550,393
550,394
u072717685
python
p02761
import sys N, M = map(int, input().split()) #とりまぶっこむ SClis = [] for _ in range(M): a, b = map(int, input().split()) SClis.append([a,b]) ans = [-1]*N for i in range(M): singlelis = SClis[i] S = (singlelis[0] - 1) C = (singlelis[1]) if ans[S] != -1 and ans[S] != C: print(-1) sys.exit() else: ans[S] = C if N == 1: if ans[0] == -1: ans[0] = 0 print(''.join(map(str, ans))) if N != 1: if ans[0] == 0: print(-1) sys.exit() if ans[0] == -1: ans[0] = 1 for i in range(1,N): if ans[i] == -1: ans[i] = 0 print(''.join(map(str, ans)))
import sys N, M = map(int, input().split()) #とりまぶっこむ SClis = [] for _ in range(M): a, b = map(int, input().split()) SClis.append([a,b]) ans = [-1]*N for i in range(M): singlelis = SClis[i] S = (singlelis[0] - 1) C = (singlelis[1]) if ans[S] != -1 and ans[S] != C: print(-1) sys.exit() else: ans[S] = C if N == 1: if ans[0] == -1: ans[0] = 0 print(''.join(map(str, ans))) sys.exit() if N != 1: if ans[0] == 0: print(-1) sys.exit() if ans[0] == -1: ans[0] = 1 for i in range(1,N): if ans[i] == -1: ans[i] = 0 print(''.join(map(str, ans)))
[ "call.add" ]
550,397
550,398
u609814378
python
p02761
N,M = map(int,input().split()) li = ["#"]*N A = "#" if N==1: for i in range(M): s,c = map(int,input().split()) if not c==A and not c=="#": print(-1) exit() else: A=c if A == "#": print(0) else: print(int(A)) exit() for i in range(M): s,c = map(int,input().split()) if s==1 and c==0: print(-1) break if not li[s-1]=="#" and not li[s-1]==c: print(-1) break if li[s-1]=="#": li[s-1]=c else: if li[0]=="#": li[0]=1 num="".join(map(str,li)) num_new=num.replace("#","0") print(num_new)
N,M = map(int,input().split()) li = ["#"]*N A = "#" if N==1: for i in range(M): s,c = map(int,input().split()) if not c==A and not A=="#": print(-1) exit() else: A=c if A == "#": print(0) else: print(int(A)) exit() for i in range(M): s,c = map(int,input().split()) if s==1 and c==0: print(-1) break if not li[s-1]=="#" and not li[s-1]==c: print(-1) break if li[s-1]=="#": li[s-1]=c else: if li[0]=="#": li[0]=1 num="".join(map(str,li)) num_new=num.replace("#","0") print(num_new)
[ "identifier.change", "control_flow.branch.if.condition.change" ]
550,401
550,402
u772029934
python
p02761
N,M = map(int,input().split()) li = ["#"]*N A = "#" if N==1: for i in range(M): s,c = map(int,input().split()) if not c==A and not c=="#": print(-1) break else: A=c if A == "#": print(0) else: print(int(A)) exit() for i in range(M): s,c = map(int,input().split()) if s==1 and c==0: print(-1) break if not li[s-1]=="#" and not li[s-1]==c: print(-1) break if li[s-1]=="#": li[s-1]=c else: if li[0]=="#": li[0]=1 num="".join(map(str,li)) num_new=num.replace("#","0") print(num_new)
N,M = map(int,input().split()) li = ["#"]*N A = "#" if N==1: for i in range(M): s,c = map(int,input().split()) if not c==A and not A=="#": print(-1) exit() else: A=c if A == "#": print(0) else: print(int(A)) exit() for i in range(M): s,c = map(int,input().split()) if s==1 and c==0: print(-1) break if not li[s-1]=="#" and not li[s-1]==c: print(-1) break if li[s-1]=="#": li[s-1]=c else: if li[0]=="#": li[0]=1 num="".join(map(str,li)) num_new=num.replace("#","0") print(num_new)
[ "identifier.change", "control_flow.branch.if.condition.change", "control_flow.break.remove", "control_flow.exit.add", "call.add" ]
550,403
550,402
u772029934
python
p02761
n,m = map(int,input().split()) sc = [list(map(int,input().split())) for i in range(m)] temp = [-1] * n ans = -1 for i in sc: if temp[i[0]-1] != -1 and temp[i[0]-1] != i[1]: print(-1) exit() temp[i[0]-1] = i[1] if n == 1: mini = 0 maxi = 10 if n == 2: mini = 10 maxi = 100 if n == 3: mini = 100 maxi = 1000 print(mini,maxi) for i in range(mini,maxi): s = str(i) ok = True for j in sc: if s[j[0]-1] != str(j[1]): ok = False if ok: ans = i print(ans) exit() print(ans)
n,m = map(int,input().split()) sc = [list(map(int,input().split())) for i in range(m)] temp = [-1] * n ans = -1 for i in sc: if temp[i[0]-1] != -1 and temp[i[0]-1] != i[1]: print(-1) exit() temp[i[0]-1] = i[1] if n == 1: mini = 0 maxi = 10 if n == 2: mini = 10 maxi = 100 if n == 3: mini = 100 maxi = 1000 for i in range(mini,maxi): s = str(i) ok = True for j in sc: if s[j[0]-1] != str(j[1]): ok = False if ok: ans = i print(ans) exit() print(ans)
[ "call.remove" ]
550,414
550,415
u564770050
python
p02761
#157 def main(): N, M = map(int,input().split()) num = [-1]*N for i in range(M): s, c = map(int,input().split()) if(s==1 and c==0 and N!=1): print(-1) return if(num[s-1]==-1 or num[s-1]==c): num[s-1] = c else: print(-1) return result = '' for i in ramge(N): if(num[i]!=-1): result+=str(num[i]) else: if(N==1): result+='0' elif(i==0): result+='1' else: result+='0' print(result) main()
#157 def main(): N, M = map(int,input().split()) num = [-1]*N for i in range(M): s, c = map(int,input().split()) if(s==1 and c==0 and N!=1): print(-1) return if(num[s-1]==-1 or num[s-1]==c): num[s-1] = c else: print(-1) return result = '' for i in range(N): if(num[i]!=-1): result+=str(num[i]) else: if(N==1): result+='0' elif(i==0): result+='1' else: result+='0' print(result) main()
[ "identifier.change", "call.function.change" ]
550,420
550,421
u966836999
python
p02761
N, M = list(map(int, input().split())) ans = [-1]*N flag = True if N == 1: for _ in range(M): s, c = list(map(int, input().split())) if ans[s-1] == -1: ans[s-1] = c else: if ans[s-1] != c: flag = False break if flag: print(ans[0]) else: print(-1) else: for _ in range(M): s, c = list(map(int, input().split())) if s == 1 and c == 0: flag = False break if ans[s-1] == -1: ans[s-1] = c else: if ans[s-1] != c: flag = False break if flag: ans[0] = max(1, ans[0]) print("".join(["0" if e == -1 else str(e) for e in ans])) else: print(-1)
N, M = list(map(int, input().split())) ans = [-1]*N flag = True if N == 1: for _ in range(M): s, c = list(map(int, input().split())) if ans[s-1] == -1: ans[s-1] = c else: if ans[s-1] != c: flag = False break if flag: print(max(0, ans[0])) else: print(-1) else: for _ in range(M): s, c = list(map(int, input().split())) if s == 1 and c == 0: flag = False break if ans[s-1] == -1: ans[s-1] = c else: if ans[s-1] != c: flag = False break if flag: ans[0] = max(1, ans[0]) print("".join(["0" if e == -1 else str(e) for e in ans])) else: print(-1)
[ "call.add", "call.arguments.change" ]
550,426
550,427
u098968285
python
p02761
N,M=map(int,input().split()) sc=[list(map(int,input().split()))for _ in [0]*M] ans=['1']+['0']*(N-1) count=[0]*N for s,c in sc: if count[s-1]==1 and ans[s-1]!=str(c): ans='-1' break else: ans[s-1]=str(c) count[s-1]=1 if N>=2 and ans[0]=='0': ans='-1' if M==0: ans='0' print(''.join(ans))
N,M=map(int,input().split()) sc=[list(map(int,input().split()))for _ in [0]*M] ans=['1']+['0']*(N-1) count=[0]*N for s,c in sc: if count[s-1]==1 and ans[s-1]!=str(c): ans='-1' break else: ans[s-1]=str(c) count[s-1]=1 if N>=2 and ans[0]=='0': ans='-1' if M==0 and N==1: ans='0' print(''.join(ans))
[ "control_flow.branch.if.condition.change" ]
550,428
550,429
u391819434
python
p02761
n,m=map(int,input().split()) a=['.'] a*=n ans=0 for i in range(m): si,ci=input().split() si=int(si) ci=str(ci) if a[si-1]=='.': a[si-1]=ci else: if a[si-1]==ci: continue else: ans=-1 break if ans==-1 or (n>=2 and a[0]=='0'): print(-1) else: if n==1 and a[0]=='.': a[0]=0 elif a[0]=='.': a[0]='1' for i in range(1,n): if a[i]=='.': a[i]='0' a=''.join(a) print(a)
n,m=map(int,input().split()) a=['.'] a*=n ans=0 for i in range(m): si,ci=input().split() si=int(si) ci=str(ci) if a[si-1]=='.': a[si-1]=ci else: if a[si-1]==ci: continue else: ans=-1 break if ans==-1 or (n>=2 and a[0]=='0'): print(-1) else: if n==1 and a[0]=='.': a[0]='0' elif a[0]=='.': a[0]='1' for i in range(1,n): if a[i]=='.': a[i]='0' a=''.join(a) print(a)
[]
550,434
550,435
u919235786
python
p02761
n,m=map(int,input().split()) a=['.'] a*=n ans=0 for i in range(m): si,ci=input().split() si=int(si) ci=str(ci) if a[si-1]=='.': a[si-1]=ci else: if a[si-1]==ci: continue else: ans=-1 break if ans==-1 or (n>=2 and a[0]=='0'): print(-1) else: if n==1 and a[0]=='.': a[0]=0 elif a[0]=='.': a[0]=1 for i in range(1,n): if a[i]=='.': a[i]='0' a=''.join(a) print(a)
n,m=map(int,input().split()) a=['.'] a*=n ans=0 for i in range(m): si,ci=input().split() si=int(si) ci=str(ci) if a[si-1]=='.': a[si-1]=ci else: if a[si-1]==ci: continue else: ans=-1 break if ans==-1 or (n>=2 and a[0]=='0'): print(-1) else: if n==1 and a[0]=='.': a[0]='0' elif a[0]=='.': a[0]='1' for i in range(1,n): if a[i]=='.': a[i]='0' a=''.join(a) print(a)
[]
550,436
550,435
u919235786
python
p02761
N,M=map(int,input().split()) s=[] c=[] for i in range(M): a,b=map(int,input().split()) s.append(a) c.appemd(b) found=False start=pow(10,N-1) stop=pow(10,N) if N==1: start=0 for i in range(start,stop): i_str=str(i) passed=True for j in range(M): if not i_str[s[j]-1]==str(c[j]): passed=False break if passed: found=False print(i) break if not found: print('-1')
N,M=map(int,input().split()) s=[] c=[] for i in range(M): a,b=map(int,input().split()) s.append(a) c.append(b) found=False start=pow(10,N-1) stop=pow(10,N) if N==1: start=0 for i in range(start,stop): i_str=str(i) passed=True for j in range(M): if not i_str[s[j]-1]==str(c[j]): passed=False break if passed: found=True print(i) break if not found: print('-1')
[ "identifier.change", "misc.opposites", "assignment.value.change" ]
550,449
550,450
u194472175
python
p02761
n, m = map(int, input().split()) order = [] num = [-1 for i in range(n)] for i in range(m): tmp = [int(i) for i in input().split()] order.append(tmp) flag = True for od in order: if num[od[0]-1] == -1: num[od[0]-1] = od[1] else: if num[od[0]-1] != od[1]: flag = False if num[0] == 0 and n != 1: flag = False else: for i in range(n): if num[i] == -1: if i == 0: num[i] = "1" else: num[i] = "0" else: num[i] = str(num[i]) if flag: print("".join(num)) else: print(-1)
n, m = map(int, input().split()) order = [] num = [-1 for i in range(n)] for i in range(m): tmp = [int(i) for i in input().split()] order.append(tmp) flag = True for od in order: if num[od[0]-1] == -1: num[od[0]-1] = od[1] else: if num[od[0]-1] != od[1]: flag = False if num[0] == 0 and n != 1: flag = False else: for i in range(n): if num[i] == -1: if i == 0 and n != 1: num[i] = "1" else: num[i] = "0" else: num[i] = str(num[i]) if flag: print("".join(num)) else: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,493
550,494
u821989875
python
p02761
import sys n,m=map(int,input().split()) l=[-1]*(n) for i in range(m): s,c=map(int,input().split()) if l[s-1]==-1 or l[s-1]==c: l[s-1]=c else: print(-1) sys.exit() if l[0]==0 and len(l)!=1: print(-1) sys.exit() for i in range(n): if l[i]==-1: l[i]=0 if l[0]==0 and len(l)==1: l[0]=1 if l[0]==0 and len(l)==1: print(0) else: for i in range(n): print(l[i],end="")
import sys n,m=map(int,input().split()) l=[-1]*(n) for i in range(m): s,c=map(int,input().split()) if l[s-1]==-1 or l[s-1]==c: l[s-1]=c else: print(-1) sys.exit() if l[0]==0 and len(l)!=1: print(-1) sys.exit() for i in range(n): if l[i]==-1: l[i]=0 if l[0]==0 and len(l)!=1: l[0]=1 if l[0]==0 and len(l)==1: print(0) else: for i in range(n): print(l[i],end="")
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
550,503
550,504
u474925961
python
p02761
import sys n,m=map(int,input().split()) l=[-1]*(n) for i in range(m): s,c=map(int,input().split()) if l[s-1]==-1 or l[s-1]==c: l[s-1]=c else: print(-1) sys.exit() if l[0]==0 and len(l)!=1: print(-1) sys.exit() for i in range(n): if l[i]==-1: l[i]=0 if l[0]==0 and len(l)==1: l[0]=0 if l[0]==0 and len(l)==1: print(0) else: for i in range(n): print(l[i],end="")
import sys n,m=map(int,input().split()) l=[-1]*(n) for i in range(m): s,c=map(int,input().split()) if l[s-1]==-1 or l[s-1]==c: l[s-1]=c else: print(-1) sys.exit() if l[0]==0 and len(l)!=1: print(-1) sys.exit() for i in range(n): if l[i]==-1: l[i]=0 if l[0]==0 and len(l)!=1: l[0]=1 if l[0]==0 and len(l)==1: print(0) else: for i in range(n): print(l[i],end="")
[ "misc.opposites", "expression.operator.compare.change", "control_flow.branch.if.condition.change", "literal.number.integer.change", "assignment.value.change" ]
550,505
550,504
u474925961
python
p02761
def main(): n, m = map(int, input().split()) sc = [list(map(int, input().split())) for _ in range(m)] ans = [-1]* n for s, c in sc: s -= 1 if ans[s] == -1or ans[s] == c: ans[s] = c else: print(-1) return if ans[0] == -1: ans[0] = 1 elif ans[0] == 0: if n == 1: print(0) else: print(-1) return print(''.join(list(map(str, ans))).replace('-1', '0')) if __name__ == '__main__': main()
def main(): n, m = map(int, input().split()) sc = [list(map(int, input().split())) for _ in range(m)] ans = [-1]* n for s, c in sc: s -= 1 if ans[s] == -1or ans[s] == c: ans[s] = c else: print(-1) return if ans[0] == -1 and n >1: ans[0] = 1 elif ans[0] == 0: if n == 1: print(0) else: print(-1) return print(''.join(list(map(str, ans))).replace('-1', '0')) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change" ]
550,513
550,514
u167647458
python
p02761
n , m = map(int, input().split()) num = [-1] * n for _ in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n > 1: print(-1) exit() if num[s-1] == -1 or num[s-1] == c: num[s-1] = c else: print(-1) exit() for i in range(n): if i == 0 and num[i] == -1: if n > 1: num[i] == 1 else: num[i] == 0 elif i != 0 and num[i] == -1: num[i] = 0 print(''.join(map(str, num)))
n , m = map(int, input().split()) num = [-1] * n for _ in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n > 1: print(-1) exit() if num[s-1] == -1 or num[s-1] == c: num[s-1] = c else: print(-1) exit() for i in range(n): if i == 0 and num[i] == -1: if n > 1: num[i] = 1 else: num[i] = 0 elif i != 0 and num[i] == -1: num[i] = 0 print(''.join(map(str, num)))
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,540
550,541
u826785572
python
p02761
n, m = map(int,input().split()) n_list = [] for i in range(m): s, c = map(int,input().split()) n_list.append([s, c]) n_list = list(tuple(sorted(n_list))) keta = [-1 for i in range(n)] flag = 0 for i in range(len(n_list)): if keta[n_list[i][0]-1] == -1: keta[n_list[i][0]-1] = n_list[i][1] elif keta[n_list[i][0]-1] == n_list[i][1]: continue else: flag = 1 break if flag == 1 or (n == 3 and keta[0] == 0) or (n == 2 and keta[0] == 0): print(-1) else: if len(keta) == 1: if keta[0] == -1: print(0) else: print(keta[0]) elif len(keta) == 2: if keta[0] == -1: keta[0] = 1 if keta[1] == -1: keta[1] = 0 print(keta[0]*10 + keta[1]) else: if keta[0] == -1: keta[0] = 1 if keta[1] == -1: keta[1] = 0 if keta[2] == -1: keta[2] = 0 print(keta[0]*100 + keta[1]*10 + keta[0])
n, m = map(int,input().split()) n_list = [] for i in range(m): s, c = map(int,input().split()) n_list.append([s, c]) n_list = list(tuple(sorted(n_list))) keta = [-1 for i in range(n)] flag = 0 for i in range(len(n_list)): if keta[n_list[i][0]-1] == -1: keta[n_list[i][0]-1] = n_list[i][1] elif keta[n_list[i][0]-1] == n_list[i][1]: continue else: flag = 1 break if flag == 1 or (n == 3 and keta[0] == 0) or (n == 2 and keta[0] == 0): print(-1) else: if len(keta) == 1: if keta[0] == -1: print(0) else: print(keta[0]) elif len(keta) == 2: if keta[0] == -1: keta[0] = 1 if keta[1] == -1: keta[1] = 0 print(keta[0]*10 + keta[1]) else: if keta[0] == -1: keta[0] = 1 if keta[1] == -1: keta[1] = 0 if keta[2] == -1: keta[2] = 0 print(keta[0]*100 + keta[1]*10 + keta[2])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "call.arguments.change", "expression.operation.binary.change", "io.output.change" ]
550,571
550,572
u436982376
python
p02761
N,M = map(int,input().split()) num = [-1 for _ in range(N)] flag = False for i in range(M): s,c = map(int,input().split()) if num[s-1] == -1 or num[s-1] == c: num[s-1] = c else: break else: flag = True if flag==False or (num[0]==0 and N>1): print(-1) else: ans = 0 if num[0] == -1: num[0] = 1 for i in range(N): if num[i]!=-1: ans += num[i]*(10**(N-i-1)) print(ans)
N,M = map(int,input().split()) num = [-1 for _ in range(N)] flag = False for i in range(M): s,c = map(int,input().split()) if num[s-1] == -1 or num[s-1] == c: num[s-1] = c else: break else: flag = True if flag==False or (num[0]==0 and N>1): print(-1) else: ans = 0 if num[0]==-1 and N>1: num[0] = 1 for i in range(N): if num[i]!=-1: ans += num[i]*(10**(N-i-1)) print(ans)
[ "control_flow.branch.if.condition.change" ]
550,573
550,574
u582415761
python
p02761
N,M = map(int,input().split()) num = [-1 for _ in range(N)] flag = False for i in range(M): s,c = map(int,input().split()) if num[s-1] == -1 or num[s-1] == c: num[s-1] = c else: break else: flag = True if flag==False or (num[0]==0 and N==1): print(-1) else: ans = 0 if num[0] == -1: num[0] = 1 for i in range(N): if num[i]!=-1: ans += num[i]*(10**(N-i-1)) print(ans)
N,M = map(int,input().split()) num = [-1 for _ in range(N)] flag = False for i in range(M): s,c = map(int,input().split()) if num[s-1] == -1 or num[s-1] == c: num[s-1] = c else: break else: flag = True if flag==False or (num[0]==0 and N>1): print(-1) else: ans = 0 if num[0]==-1 and N>1: num[0] = 1 for i in range(N): if num[i]!=-1: ans += num[i]*(10**(N-i-1)) print(ans)
[ "expression.operator.compare.change", "control_flow.branch.if.condition.change" ]
550,575
550,574
u582415761
python
p02761
N, M = map(int, input().split()) l = ["a"] * N for i in range(M): s, c = map(int, input().split()) if l[s-1] == "a" or l[s-1] == c: l[s-1] = c else: print(-1) exit() if l[0] == "a": l[0] = 1 elif l[0] == 0 and N != 1: print(-1) exit() for i in range(N): if l[i-1] == "a": l[i-1] = 0 l = [str(i) for i in l] print("".join(l))
N, M = map(int, input().split()) l = ["a"] * N for i in range(M): s, c = map(int, input().split()) if l[s-1] == "a" or l[s-1] == c: l[s-1] = c else: print(-1) exit() if l[0] == "a" and N != 1: l[0] = 1 elif l[0] == 0 and N != 1: print(-1) exit() #elif l[0] == 0 and N == 1: for i in range(N): if l[i-1] == "a": l[i-1] = 0 l = [str(i) for i in l] print("".join(l))
[ "control_flow.branch.if.condition.change" ]
550,592
550,593
u048176319
python
p02761
n,m=map(int,input().split()) l=[] for i in range(m): s,c=map(int,input().split()) l.append((s,c)) ans=0 for i in range(1,1000): k=str(i) cnt=0 if len(k)==n: for j in range(m): if int(k[l[j][0]-1])==l[j][1]: cnt+=1 if cnt==m: ans=i break if ans==0: print(-1) else: print(ans)
n,m=map(int,input().split()) l=[] for i in range(m): s,c=map(int,input().split()) l.append((s,c)) ans=-1 for i in range(1000): k=str(i) cnt=0 if len(k)==n: for j in range(m): if int(k[l[j][0]-1])==l[j][1]: cnt+=1 if cnt==m: ans=i break if ans==-1: print(-1) else: print(ans)
[ "assignment.value.change", "expression.operation.unary.add", "call.arguments.change", "control_flow.branch.if.condition.change" ]
550,596
550,597
u674959776
python
p02761
n,m=map(int,input().split()) l=[] for i in range(m): s,c=map(int,input().split()) l.append((s,c)) ans=0 for i in range(1000): k=str(i) cnt=0 if len(k)==n: for j in range(m): if int(k[l[j][0]-1])==l[j][1]: cnt+=1 if cnt==m: ans=i break if ans==0: print(-1) else: print(ans)
n,m=map(int,input().split()) l=[] for i in range(m): s,c=map(int,input().split()) l.append((s,c)) ans=-1 for i in range(1000): k=str(i) cnt=0 if len(k)==n: for j in range(m): if int(k[l[j][0]-1])==l[j][1]: cnt+=1 if cnt==m: ans=i break if ans==-1: print(-1) else: print(ans)
[ "assignment.value.change", "expression.operation.unary.add", "control_flow.branch.if.condition.change" ]
550,598
550,597
u674959776
python
p02761
def main(): n, m = map(int, input().split()) ans = [-1]*n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] == -1: ans[s-1] = c elif ans[s-1] != -1 and ans[s-1] != c: print(-1) exit() if n == 1: if ans[0] == -1: ans[0] = 0 else: if ans[0] == -1: print(-1) exit() if ans[0] == -1: ans[0] = 1 for i in range(1, n): if ans[i] == -1: ans[i] = 0 print(*ans, sep="") if __name__ == "__main__": main()
def main(): n, m = map(int, input().split()) ans = [-1]*n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] == -1: ans[s-1] = c elif ans[s-1] != -1 and ans[s-1] != c: print(-1) exit() if n == 1: if ans[0] == -1: ans[0] = 0 else: if ans[0] == 0: print(-1) exit() if ans[0] == -1: ans[0] = 1 for i in range(1, n): if ans[i] == -1: ans[i] = 0 print(*ans, sep="") if __name__ == "__main__": main()
[ "control_flow.branch.if.condition.change", "expression.operation.unary.remove" ]
550,603
550,604
u044964932
python
p02761
def main(): n, m = map(int, input().split()) ans = [-1]*n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] == -1: ans[s-1] = c elif ans[s-1] != -1 and ans[s-1] != c: print(-1) exit() if n == 1: if ans[0] == -1: ans[0] = 0 else: if ans[0] == -1: print(-1) exit() if ans[0] == -1: ans[0] = 1 for i in range(n): if ans[i] == -1: ans[i] = 0 print(*ans, sep="") if __name__ == "__main__": main()
def main(): n, m = map(int, input().split()) ans = [-1]*n for _ in range(m): s, c = map(int, input().split()) if ans[s-1] == -1: ans[s-1] = c elif ans[s-1] != -1 and ans[s-1] != c: print(-1) exit() if n == 1: if ans[0] == -1: ans[0] = 0 else: if ans[0] == 0: print(-1) exit() if ans[0] == -1: ans[0] = 1 for i in range(1, n): if ans[i] == -1: ans[i] = 0 print(*ans, sep="") if __name__ == "__main__": main()
[ "control_flow.branch.if.condition.change", "expression.operation.unary.remove", "call.arguments.add" ]
550,605
550,604
u044964932
python
p02761
n,m=map(int,input().split()) sc=[list(map(int,input().split())) for i in range(m)] start=10**(n-1) end=10**n if n == 1: start = 0 for i in range(start,end): i=str(i) for s,c in sc: if i[s-1] != str(c): break else: print(i) break print(-1)
n,m=map(int,input().split()) sc=[list(map(int,input().split())) for i in range(m)] start=10**(n-1) end=10**n if n == 1: start = 0 for i in range(start,end): i=str(i) for s,c in sc: if i[s-1] != str(c): break else: print(i) exit() print(-1)
[ "control_flow.break.remove", "control_flow.exit.add", "call.add" ]
550,613
550,614
u238940874
python
p02761
def main(): import sys input = sys.stdin.readline n,m=map(int,input().split()) if m==0: if n==1: print(0) exit() else: print(-1) exit() sc=[list(map(int,input().split())) for _ in range(m)] sc=list(map(list, set(map(tuple, sc)))) sc=sorted(sc,key=lambda x: (x[0],x[1])) if len(sc)>n: print(-1) exit() l=['0']*n l[0]='1' if n==1: if sc[0][0]==1: print(sc[0][1]) exit() else: print(-1) exit() for i in range(len(sc)): if type(l[sc[i][0]-1])==str: l[sc[i][0]-1]=sc[i][1] else: if l[sc[i][0]-1]!=sc[i][1]: print(-1) exit() if len(''.join([str(int(i)) for i in l]))==n and int(''.join([str(int(i)) for i in l]))>=pow(10,n-1): print(int(''.join([str(int(i)) for i in l]))) else: print(-1) if __name__ == '__main__': main()
def main(): import sys input = sys.stdin.readline n,m=map(int,input().split()) if m==0: if n==1: print(0) exit() else: print(pow(10,n-1)) exit() sc=[list(map(int,input().split())) for _ in range(m)] sc=list(map(list, set(map(tuple, sc)))) sc=sorted(sc,key=lambda x: (x[0],x[1])) if len(sc)>n: print(-1) exit() l=['0']*n l[0]='1' if n==1: if sc[0][0]==1: print(sc[0][1]) exit() else: print(-1) exit() for i in range(len(sc)): if type(l[sc[i][0]-1])==str: l[sc[i][0]-1]=sc[i][1] else: if l[sc[i][0]-1]!=sc[i][1]: print(-1) exit() if len(''.join([str(int(i)) for i in l]))==n and int(''.join([str(int(i)) for i in l]))>=pow(10,n-1): print(int(''.join([str(int(i)) for i in l]))) else: print(-1) if __name__ == '__main__': main()
[ "call.add", "call.arguments.change" ]
550,619
550,620
u652569315
python
p02761
N,M = map(int,input().split()) SC = [tuple(map(int,input().split())) for i in range(M)] if N==1: r = range(10) elif N==2: r = range(10,100) else: r = range(100,1000) for n in r: print(n) n = str(n) for s,c in SC: #print("s=",s,"c",c) if n[s-1] != str(c): break else: print(n) exit() print(-1)
N,M = map(int,input().split()) SC = [tuple(map(int,input().split())) for i in range(M)] if N==1: r = range(10) elif N==2: r = range(10,100) else: r = range(100,1000) for n in r: #print(n) n = str(n) for s,c in SC: #print("s=",s,"c",c) if n[s-1] != str(c): break else: print(n) exit() print(-1)
[ "call.remove" ]
550,644
550,645
u391675400
python
p02761
N, M = map(int, input().split()) sc = [tuple(map(int, input().split())) for _ in range(M)] def cands(N): if N ==1: return range(10) else: return range(10 ** (N-1), 10 **N) def main(N, sc): nums = cands(N) print(nums) for n in nums: try: for s,c in sc: assert(int(str(n)[s-1]) == c) except AssertionError as e: continue return n else: return -1 print(main(N, sc))
N, M = map(int, input().split()) sc = [tuple(map(int, input().split())) for _ in range(M)] def cands(N): if N ==1: return range(10) else: return range(10 ** (N-1), 10 **N) def main(N, sc): nums = cands(N) for n in nums: try: for s,c in sc: assert(int(str(n)[s-1]) == c) except AssertionError as e: continue return n else: return -1 print(main(N, sc))
[ "call.remove" ]
550,648
550,649
u221537793
python
p02761
n, m = map(int, input().split()) s = [0]*m c = [0]*m for i in range(m): s[i], c[i] = map(int, input().split()) ans = -1 for num in range(1, 1000): num_car = str(num) con1 = len(num_car) == n con2 = True for i in range(m): if con1 and num_car[s[i] - 1] != str(c[i]): con2 = False if con1 and con2: ans = num break print(ans)
n, m = map(int, input().split()) s = [0]*m c = [0]*m for i in range(m): s[i], c[i] = map(int, input().split()) ans = -1 for num in range(0, 1000): num_car = str(num) con1 = len(num_car) == n con2 = True for i in range(m): if con1 and num_car[s[i] - 1] != str(c[i]): con2 = False if con1 and con2: ans = num break print(ans)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
550,650
550,651
u006880673
python
p02761
n,m = map(int, input().split()) ans = [-1] *n f= 0 for i in range(m): s,c = map(int, input().split()) #if (ans[s-1] != -1) and (ans[s-1] != c): # 重複 if (ans[s-1] == -1) or (ans[s-1] == c): ans[s-1] = c else: print('-1') exit() ''' f = 1 if f == 1: print('-1') exit()''' if ans[0] == 0 and len(ans) != 1: # 1桁以外の頭0 print('-1') exit() if ans[0] == -1: if len(ans) != 1: # 頭に指定がない時は1 ans[0] == 1 else: print(0) exit() for i in range(n): if ans[i] == -1: ans[i] = 0 print(''.join(map(str, ans)))
n,m = map(int, input().split()) ans = [-1] *n f= 0 for i in range(m): s,c = map(int, input().split()) #if (ans[s-1] != -1) and (ans[s-1] != c): # 重複 if (ans[s-1] == -1) or (ans[s-1] == c): ans[s-1] = c else: print('-1') exit() ''' f = 1 if f == 1: print('-1') exit()''' if ans[0] == 0 and len(ans) != 1: # 1桁以外の頭0 print('-1') exit() if ans[0] == -1: if len(ans) != 1: # 頭に指定がない時は1 ans[0] = 1 else: print(0) exit() for i in range(n): if ans[i] == -1: ans[i] = 0 print(''.join(map(str, ans)))
[ "expression.operation.compare.replace.remove", "assignment.replace.add", "misc.typo" ]
550,671
550,672
u488884575
python
p02761
import sys import re N,M = map(int,input().split()) nums = ["0"]*N if N != 1: nums[0] = "1" checked = [False]*N for i in range(M): s,c = map(int,input().split()) s -= 1 if not checked[s]: #初めての指定 nums[s] = str(c) checked[s] = True elif nums[s] != str(c): #同じ場所に異なる数字が来たら作れない print(-1) sys.exit() if nums[0] == "0": print(-1) else: print("".join(nums))
import sys import re N,M = map(int,input().split()) nums = ["0"]*N if N != 1: nums[0] = "1" checked = [False]*N for i in range(M): s,c = map(int,input().split()) s -= 1 if not checked[s]: #初めての指定 nums[s] = str(c) checked[s] = True elif nums[s] != str(c): #同じ場所に異なる数字が来たら作れない print(-1) sys.exit() if N != 1 and nums[0] == "0": print(-1) else: print("".join(nums))
[ "control_flow.branch.if.condition.change" ]
550,684
550,685
u757117214
python
p02761
n, m = map(int, input().split()) exist = True if n == 1: sc_list = [] for i in range(m): sc_list.append(list(map(int, input().split()))) if m >= 2: for j in range(m-1): if sc_list[j][1] != sc_list[j+1][1]: exist = False if exist: if m >= 1: x = str(sc_list[0][1]) elif m == 0: x = '0' elif n >= 2: x = [-1] * n for i in range(m): s, c = map(int, input().split()) if s == 1: if c == 0: exist = False else: if x[0] != -1 and x[0] != c: exist = False else: x[0] = c else: if x[s-1] != -1 and x[s-1] != c: exist = False else: x[s-1] = c if x[0] == -1: exist = False if exist: x = [0 if j == -1 else j for j in x] x = "".join(map(str,x)) if exist: print(x) else: print('-1')
n, m = map(int, input().split()) exist = True if n == 1: sc_list = [] for i in range(m): sc_list.append(list(map(int, input().split()))) if m >= 2: for j in range(m-1): if sc_list[j][1] != sc_list[j+1][1]: exist = False if exist: if m >= 1: x = str(sc_list[0][1]) elif m == 0: x = '0' elif n >= 2: x = [-1] * n for i in range(m): s, c = map(int, input().split()) if s == 1: if c == 0: exist = False else: if x[0] != -1 and x[0] != c: exist = False else: x[0] = c else: if x[s-1] != -1 and x[s-1] != c: exist = False else: x[s-1] = c if x[0] == -1 : x[0] = 1 if exist: x = [0 if j == -1 else j for j in x] x = "".join(map(str,x)) if exist: print(x) else: print('-1')
[ "assignment.variable.change", "assignment.value.change" ]
550,694
550,695
u542190960
python
p02761
n, m = list(map(int, input().split())) out = ['a']*n err_flg = False err_flg2 = False for i in range(m): s = list(map(int, input().split())) if s[0]==1 and s[1]==0 and n==1: err_flg2 = True elif m==0 and n==1: err_flg2 = True elif s[0]==1 and s[1]==0 and n > 1: err_flag = True if out[s[0]-1]=='a': out[s[0]-1] = s[1] elif out[s[0]-1]==s[1]: out[s[0]-1] = s[1] # elif out[s[0]-1]!=s[1]: elif out[s[0]-1]!=s[1]: err_flg = True if out[0]=='a' and n>1: out[0]=1 out_s = "".join(map(str,out)) if err_flg2: print('0') elif err_flg: print('-1') else: print(out_s.replace('a','0'))
n, m = list(map(int, input().split())) out = ['a']*n err_flg = False err_flg2 = False for i in range(m): s = list(map(int, input().split())) # print(s) if s[0]==1 and s[1]==0 and n==1: err_flg2 = True elif m==0 and n==1: err_flg2 = True elif s[0]==1 and s[1]==0 and n > 1: # print('kore') err_flg = True if out[s[0]-1]=='a': out[s[0]-1] = s[1] elif out[s[0]-1]==s[1]: out[s[0]-1] = s[1] # elif out[s[0]-1]!=s[1]: elif out[s[0]-1]!=s[1]: err_flg = True if out[0]=='a' and n>1: out[0]=1 out_s = "".join(map(str,out)) if err_flg2: print('0') # print('err2') elif err_flg: print('-1') # print('err') else: print(out_s.replace('a','0'))
[ "assignment.variable.change", "identifier.change" ]
550,696
550,697
u936050991
python
p02761
# input N, M = map(int, input().split()) c = [] c_append = c.append for i in range(M): sm, cm = map(int, input().split()) c_append((sm, cm)) ans = -1 # check for i in range(1, 1000, 1): str_i = str(i) if N < len(str_i): break if N == len(str_i) and False not in [int(str_i[sm - 1]) == cm for sm, cm in c]: ans = i break print(ans)
# input N, M = map(int, input().split()) c = [] c_append = c.append for i in range(M): sm, cm = map(int, input().split()) c_append((sm, cm)) ans = -1 # check for i in range(1000): str_i = str(i) if N < len(str_i): break if N == len(str_i) and False not in [int(str_i[sm - 1]) == cm for sm, cm in c]: ans = i break print(ans)
[ "call.arguments.change" ]
550,700
550,701
u284363684
python
p02761
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") N, M = list(map(int, sys.stdin.readline().split())) lines = [list(map(int, sys.stdin.readline().split())) for _ in range(M)] print(lines) ret = -1 for n in range(0, pow(10, N)): if len(str(n)) != N: continue flg = True for s, c in lines: if str(n)[s - 1] != str(c): flg = False if flg: ret = n break print(ret) if __name__ == '__main__': main()
import sys import os def main(): if os.getenv("LOCAL"): sys.stdin = open("input.txt", "r") N, M = list(map(int, sys.stdin.readline().split())) lines = [list(map(int, sys.stdin.readline().split())) for _ in range(M)] ret = -1 for n in range(0, pow(10, N)): if len(str(n)) != N: continue flg = True for s, c in lines: if str(n)[s - 1] != str(c): flg = False if flg: ret = n break print(ret) if __name__ == '__main__': main()
[ "call.remove" ]
550,706
550,707
u634079249
python
p02761
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split())) import math;floor,ceil=math.floor,math.ceil from collections import deque Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO') is_even=lambda x:True if x%2==0 else False def main(): n,m = ints() dig = [None]*(n);flg = False for _ in range(m): s,c=ints() if dig[s-1]==None: dig[s-1]=c elif dig[s-1]!=c: flg = True if flg or (n!=1and dig[0]==0): print(-1) else: num=0 for i in range(n): if i==0 and dig[0]==None: dig[0]=1 elif dig[i]==None: dig[i]=0 num += dig[i]*10**(n-1-i) print(num) if __name__ == '__main__': main()
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split())) import math;floor,ceil=math.floor,math.ceil from collections import deque Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO') is_even=lambda x:True if x%2==0 else False def main(): n,m = ints() dig = [None]*(n);flg = False for _ in range(m): s,c=ints() if dig[s-1]==None: dig[s-1]=c elif dig[s-1]!=c: flg = True if flg or (n!=1and dig[0]==0): print(-1) else: num=0 for i in range(n): if i==0 and dig[0]==None and n!=1: dig[0]=1 elif dig[i]==None: dig[i]=0 num += dig[i]*10**(n-1-i) print(num) if __name__ == '__main__': main()
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,737
550,738
u203588891
python
p02761
n,m = map(int,input().split()) sc = [list(map(int,input().split())) for _ in range(m)] li = [-1] * n for s,c in sc: if li[s-1] == -1 or li[s-1] == c: li[s-1] = c else: print(-1) exit() if n != 1 and s == 1 and c == 0: print(-1) exit() for i in range(n): if li[i] == -1: if i == 0: li[i] = 1 else: li[i] = 0 ans = '' for i in li: ans += str(i) print(int(ans))
n,m = map(int,input().split()) sc = [list(map(int,input().split())) for _ in range(m)] li = [-1] * n for s,c in sc: if li[s-1] == -1 or li[s-1] == c: li[s-1] = c else: print(-1) exit() if n != 1 and s == 1 and c == 0: print(-1) exit() for i in range(n): if li[i] == -1: if i == 0 and n != 1: li[i] = 1 else: li[i] = 0 ans = '' for i in li: ans += str(i) print(int(ans))
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,743
550,744
u623231048
python
p02761
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) n,m = iim() l = [-1]*n flag = True for i in range(m): s,c = iim() if l[s-1] != -1 and l[s-1] != c: flag = False else: l[s-1] = c if n > 1 and l[0] == 0: flag = False ans = '' for i,item in enumerate(l): if item == -1: if i == 0: ans += '1' else: ans += '0' else: ans += str(item) print(ans if flag else -1)
def ii():return int(input()) def iim():return map(int,input().split()) def iil():return list(map(int,input().split())) def ism():return map(str,input().split()) def isl():return list(map(str,input().split())) n,m = iim() l = [-1]*n flag = True for i in range(m): s,c = iim() if l[s-1] != -1 and l[s-1] != c: flag = False else: l[s-1] = c if n > 1 and l[0] == 0: flag = False ans = '' for i,item in enumerate(l): if item == -1: if i == 0 and n > 1: ans += '1' else: ans += '0' else: ans += str(item) print(ans if flag else -1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,755
550,756
u021916304
python
p02761
N, M = map(int, input().split()) s = [] c = [] for m in range(M): si, ci = map(int, input().split()) s.append(si) c.append(ci) s = 10 ** (N - 1) if N == 1: s -= 1 for i in range(s, 10 ** N): for m in range(M): if str(i)[s[m] - 1] != str(c[m]): break else: print(i) exit() print(-1)
N, M = map(int, input().split()) s = [] c = [] for m in range(M): si, ci = map(int, input().split()) s.append(si) c.append(ci) ss = 10 ** (N - 1) if N == 1: ss -= 1 for i in range(ss, 10 ** N): for m in range(M): if str(i)[s[m] - 1] != str(c[m]): break else: print(i) exit() print(-1)
[ "assignment.variable.change", "identifier.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
550,757
550,758
u339199690
python
p02761
#!/usr/bin/env python3 N, M = map(int, input().split()) A = [list(input().split()) for i in range(M)] if N == 1: for i in range(1, 10): while all(str(i)[int(A[j][0])-1] == A[j][1] for j in range(M)): print(i) exit() if N == 2: for i in range(10, 100): while all(str(i)[int(A[j][0])-1] == A[j][1] for j in range(M)): print(i) exit() if N == 3: for i in range(100, 1000): while all(str(i)[int(A[j][0])-1] == A[j][1] for j in range(M)): print(i) exit() print(-1)
#!/usr/bin/env python3 N, M = map(int, input().split()) A = [list(input().split()) for i in range(M)] if N == 1: for i in range(0, 10): while all(str(i)[int(A[j][0])-1] == A[j][1] for j in range(M)): print(i) exit() if N == 2: for i in range(10, 100): while all(str(i)[int(A[j][0])-1] == A[j][1] for j in range(M)): print(i) exit() if N == 3: for i in range(100, 1000): while all(str(i)[int(A[j][0])-1] == A[j][1] for j in range(M)): print(i) exit() print(-1)
[ "literal.number.integer.change", "call.arguments.change", "control_flow.loop.range.bounds.lower.change" ]
550,766
550,767
u756420279
python
p02761
N, M = map(int, input().split()) ans = [None] * N for _ in range(M): s, c = map(int, input().split()) if ans[s - 1] in [None, c]: ans[s - 1] = c else: print(-1) quit() ans = "".join(map(lambda pair :str(pair[1]) if pair[1] != None else "0" if pair[0] else "1", enumerate(ans))) if N > 1 and ans[0] == "0": print(-1) quit() print(ans)
N, M = map(int, input().split()) ans = [None] * N for _ in range(M): s, c = map(int, input().split()) if ans[s - 1] in [None, c]: ans[s - 1] = c else: print(-1) quit() ans = "".join(map(lambda pair :str(pair[1]) if pair[1] != None else "0" if pair[0] or N == 1 else "1", enumerate(ans))) if N > 1 and ans[0] == "0": print(-1) quit() print(ans)
[]
550,793
550,794
u638282348
python
p02761
import sys N,M=list(map(int, input().split())) s=[list(map(int, input().split())) for _ in range(M)] a=["a" for _ in range(N+1)] if len(s)==0 and N==1: print(0) sys.exit() elif len(s)==0: print(10**(N-1)) sys.exit() for i in s: if i[1]==0 and i[0]==1 and N!=1: print(-1) sys.exit() if a[i[0]-1]=="a": a[i[0]-1]=str(i[1]) elif a[i[0]-1]!="a" and a[i[0]-1]==str(i[1]): continue elif a[i[0]-1]!="a" and a[i[0]-1]!=str(i[1]): print(-1) sys.exit() num=[int(i) if i!="a" else 0 for i in a ] if N==1: print(int(num[2])) elif N==2: ans=10*int(num[1])+int(num[2]) if ans//10==0: ans+=10 print(ans) elif N==3: ans=100*int(num[0])+10*int(num[1])+int(num[2]) if ans//100==0: ans+=100 print(ans)
import sys N,M=list(map(int, input().split())) s=[list(map(int, input().split())) for _ in range(M)] a=["a" for _ in range(N)] if len(s)==0 and N==1: print(0) sys.exit() elif len(s)==0: print(10**(N-1)) sys.exit() for i in s: if i[1]==0 and i[0]==1 and N!=1: print(-1) sys.exit() if a[i[0]-1]=="a": a[i[0]-1]=str(i[1]) elif a[i[0]-1]!="a" and a[i[0]-1]==str(i[1]): continue elif a[i[0]-1]!="a" and a[i[0]-1]!=str(i[1]): print(-1) sys.exit() num=[int(i) if i!="a" else 0 for i in a ] if N==1: print(int(num[-1])) elif N==2: ans=10*int(num[0])+int(num[1]) if ans//10==0: ans+=10 print(ans) elif N==3: ans=100*int(num[0])+10*int(num[1])+int(num[2]) if ans//100==0: ans+=100 print(ans)
[ "expression.operation.binary.remove", "variable_access.subscript.index.change", "call.arguments.change", "io.output.change", "expression.operation.unary.add", "literal.number.integer.change", "assignment.value.change", "expression.operation.binary.change" ]
550,820
550,821
u247680229
python
p02761
n, m = map(int,input().split()) sc = [list(map(int,input().split())) for _ in range(m)] for i in range(1,10**n): i = str(i) flag = True if len(i) == n: for j in range(m): if i[sc[j][0]-1] != str(sc[j][1]): flag = False if flag: print(i) quit() print(-1)
n, m = map(int,input().split()) sc = [list(map(int,input().split())) for _ in range(m)] for i in range(10**n): i = str(i) flag = True if len(i) == n: for j in range(m): if i[sc[j][0]-1] != str(sc[j][1]): flag = False if flag: print(i) quit() print(-1)
[ "call.arguments.change" ]
550,822
550,823
u197968862
python
p02761
n, m = map(int, input().split()) sc = [list(map(int, input().split())) for i in range(m)] for i in range(0, 10**n): if len(str(i)) == n and all(str(i)[s-1] == str(c) for j in sc): print(i) break else: print(-1)
n, m = map(int, input().split()) sc = [list(map(int, input().split())) for i in range(m)] for i in range(0, 10**n): if len(str(i)) == n and all(str(i)[s-1] == str(c) for s,c in sc): print(i) break else: print(-1)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,831
550,832
u118760114
python
p02761
n, m = map(int, input().split()) ans = [-1]*n a = 0 for i in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n != 1: a = -1 elif ans[s-1] not in [-1, c]: a = -1 else: ans[s-1] = c if a == -1: print(a) else: b = "" if ans[0] == -1 and n != 1: ans[0] = 0 for x in ans: if x == -1: b += "0" else: b += str(x) print(b)
n, m = map(int, input().split()) ans = [-1]*n a = 0 for i in range(m): s, c = map(int, input().split()) if s == 1 and c == 0 and n != 1: a = -1 elif ans[s-1] not in [-1, c]: a = -1 else: ans[s-1] = c if a == -1: print(a) else: b = "" if ans[0] == -1 and n != 1: ans[0] = 1 for x in ans: if x == -1: b += "0" else: b += str(x) print(b)
[ "literal.number.integer.change", "assignment.value.change" ]
550,835
550,836
u085910248
python
p02761
N, M = map(int, input().split(' ')) if M == 0: if N == 1: print(0) else: print('1', '0' * (N - 1)) else: is_end = False rst = [''] * N for i in range(M): s, c = input().split(' ') idx = int(s) - 1 if idx == 0 and N != 1 and c == '0': print(-1) is_end = True break elif rst[idx] == '': rst[idx] = c elif rst[idx] != c: print(-1) is_end = True break if not is_end: for i, j in enumerate(rst): if i == 0 and j == '': print('1', end='') elif j == '': print('0', end='') else: print(j, end='')
N, M = map(int, input().split(' ')) if M == 0: if N == 1: print(0) else: print('1', '0' * (N - 1), sep='') else: is_end = False rst = [''] * N for i in range(M): s, c = input().split(' ') idx = int(s) - 1 if idx == 0 and N != 1 and c == '0': print(-1) is_end = True break elif rst[idx] == '': rst[idx] = c elif rst[idx] != c: print(-1) is_end = True break if not is_end: for i, j in enumerate(rst): if i == 0 and j == '': print('1', end='') elif j == '': print('0', end='') else: print(j, end='')
[ "call.arguments.add" ]
550,878
550,879
u418149936
python
p02761
N, M = map(int, input().split(' ')) if M == 0: if N == 1: print(0) else: print('1', '0' * (N - 1), sep='') else: rst = [''] * N is_end = False for i in range(M): s, c = input().split(' ') idx = int(s) - 1 if idx == 0 and N != 1 and c == '1': print(-1) is_end = True break elif rst[idx] == '': rst[idx] = c elif rst[idx] != c: print(-1) is_end = True break if not is_end: for i, j in enumerate(rst): if i == 0 and rst[i] == '': print('1', end='') elif rst[i] == '': print('0', end='') else: print(j, end='')
N, M = map(int, input().split(' ')) if M == 0: if N == 1: print(0) else: print('1', '0' * (N - 1), sep='') else: rst = [''] * N is_end = False for i in range(M): s, c = input().split(' ') idx = int(s) - 1 if idx == 0 and N != 1 and c == '0': print(-1) is_end = True break elif rst[idx] == '': rst[idx] = c elif rst[idx] != c: print(-1) is_end = True break if not is_end: for i, j in enumerate(rst): if i == 0 and rst[i] == '': print('1', end='') elif rst[i] == '': print('0', end='') else: print(j, end='')
[ "literal.string.change", "control_flow.branch.if.condition.change" ]
550,880
550,881
u418149936
python
p02761
# # abc157 c # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.read()[:-1] sys.stdout, sys.stdin = stdout, stdin self.assertEqual(out, output) def test_入力例_1(self): input = """3 3 1 7 3 2 1 7""" output = """702""" self.assertIO(input, output) def test_入力例_2(self): input = """3 2 2 1 2 3""" output = """-1""" self.assertIO(input, output) def test_入力例_3(self): input = """3 1 1 0""" output = """-1""" self.assertIO(input, output) def resolve(): N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] SC = set(map(tuple, SC)) SC = list(set(SC)) SC.sort() ans = -1 for i in range(10**N): si = str(i) if len(si) != N: continue for sc in SC: s, c = sc if si[s-1] != str(c): break else: ans = i break print(ans) if __name__ == "__main__": unittest.main() # resolve()
# # abc157 c # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.read()[:-1] sys.stdout, sys.stdin = stdout, stdin self.assertEqual(out, output) def test_入力例_1(self): input = """3 3 1 7 3 2 1 7""" output = """702""" self.assertIO(input, output) def test_入力例_2(self): input = """3 2 2 1 2 3""" output = """-1""" self.assertIO(input, output) def test_入力例_3(self): input = """3 1 1 0""" output = """-1""" self.assertIO(input, output) def resolve(): N, M = map(int, input().split()) SC = [list(map(int, input().split())) for _ in range(M)] SC = set(map(tuple, SC)) SC = list(set(SC)) SC.sort() ans = -1 for i in range(10**N): si = str(i) if len(si) != N: continue for sc in SC: s, c = sc if si[s-1] != str(c): break else: ans = i break print(ans) if __name__ == "__main__": # unittest.main() resolve()
[]
550,931
550,932
u481250941
python
p02761
# -*- coding: utf-8 -*- """ Created on Mon Sep 7 17:11:27 2020 @author: liang """ N, M = map(int, input().split()) ans = [-1]*N res = 0 for i in range(M): s, c = map(int, input().split()) if s == 1 and c == 0 and N != 1: print(-1) break if ans[s-1] == -1 or ans[s-1] == c: ans[s-1] = c else: print(-1) break else: if ans[0] == -1: ans[0] = 1 if M == 0: ans[0] = 0 ans = [0 if a == -1 else a for a in ans] #print(ans) for i in range(N): res += ans[-(i+1)]*10**i print(res)
# -*- coding: utf-8 -*- """ Created on Mon Sep 7 17:11:27 2020 @author: liang """ N, M = map(int, input().split()) ans = [-1]*N res = 0 for i in range(M): s, c = map(int, input().split()) if s == 1 and c == 0 and N != 1: print(-1) break if ans[s-1] == -1 or ans[s-1] == c: ans[s-1] = c else: print(-1) break else: if ans[0] == -1: ans[0] = 1 if M == 0 and N == 1: ans[0] = 0 ans = [0 if a == -1 else a for a in ans] #print(ans) for i in range(N): res += ans[-(i+1)]*10**i print(res)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change" ]
550,937
550,938
u628285938
python
p02761
N,M=map(int, input().split()) SC=[list(map(int, input().split())) for _ in range(M)] num=[-1]*N for sc in SC: s,c=sc[0],sc[1] if s==1 and c==0 and N>1: print(-1) exit() elif num[s-1]==c or num[s-1]==-1: num[s-1]=c else: print(-1) exit() if N==3: if num[0]==-1: num[0]=1 if num[1]==-1: num[1]=0 if num[0]==-1: num[0]=0 print(num[0]*100+num[1]*10+num[2]) elif N==2: if num[0]==-1: num[0]=1 if num[1]==-1: num[1]=0 print(num[0]*10+num[1]) else: if num[0]==-1: num[0]=0 print(num[0])
N,M=map(int, input().split()) SC=[list(map(int, input().split())) for _ in range(M)] num=[-1]*N for sc in SC: s,c=sc[0],sc[1] if s==1 and c==0 and N>1: print(-1) exit() elif num[s-1]==c or num[s-1]==-1: num[s-1]=c else: print(-1) exit() if N==3: if num[0]==-1: num[0]=1 if num[1]==-1: num[1]=0 if num[2]==-1: num[2]=0 print(num[0]*100+num[1]*10+num[2]) elif N==2: if num[0]==-1: num[0]=1 if num[1]==-1: num[1]=0 print(num[0]*10+num[1]) else: if num[0]==-1: num[0]=0 print(num[0])
[ "literal.number.integer.change", "variable_access.subscript.index.change", "control_flow.branch.if.condition.change", "assignment.variable.change" ]
550,952
550,953
u608178601
python
p02761
n,m = map(int,input().split()) done = [0]*n ans = [0]*n for i in range(m): s,c = map(int,input().split()) if done[s-1] != 0 and ans[s-1] != c: print(-1) exit() elif s == n and c == 0: print(-1) exit() else: done[s-1] = 1 ans[s-1] = c ans_f = str() for j in ans: ans_f += str(j) if n>1 and ans_f[0] == "0": print("1"+ans_f[1::]) else: print(ans_f)
n,m = map(int,input().split()) done = [0]*n ans = [0]*n for i in range(m): s,c = map(int,input().split()) if done[s-1] != 0 and ans[s-1] != c: print(-1) exit() elif n != 1 and s == 1 and c == 0: print(-1) exit() else: done[s-1] = 1 ans[s-1] = c ans_f = str() for j in ans: ans_f += str(j) if n>1 and ans_f[0] == "0": print("1"+ans_f[1::]) else: print(ans_f)
[ "control_flow.branch.if.condition.change", "control_flow.loop.for.condition.change", "identifier.replace.remove", "literal.replace.add" ]
550,960
550,959
u624613992
python
p02761
N, M = map(int, input().split()) s = [0] * M c = [0] * M for i in range(M): s[i], c[i] = map(int, input().split()) ran = [] for i in range(10 ** (N - 1), 10 ** N): ran.append(i) if N == 1: ran.append(0) minimum = 10 ** N for r in ran: st = str(r) ok = True for j in range(M): if st[s[j] - 1] != str(c[j]): ok = False if ok == True: minimum = min(minimum, r) break if minimum == 10 ** N: print(-1) else: print(minimum)
N, M = map(int, input().split()) s = [0] * M c = [0] * M for i in range(M): s[i], c[i] = map(int, input().split()) ran = [] for i in range(10 ** (N - 1), 10 ** N): ran.append(i) if N == 1: ran.append(0) ran.sort() minimum = 10 ** N for r in ran: st = str(r) ok = True for j in range(M): if st[s[j] - 1] != str(c[j]): ok = False if ok == True: minimum = min(minimum, r) break if minimum == 10 ** N: print(-1) else: print(minimum)
[ "call.add" ]
550,967
550,968
u364555831
python
p02761
N, M = map(int, input().split()) s = [0] * M c = [0] * M for i in range(M): s[i], c[i] = map(int, input().split()) ran = [] for i in range(10 ** (N - 1), 10 ** N): ran.append(i) if N == 1: ran.append(0) minimum = 10 ** N for r in ran: st = str(r) ok = True for j in range(M): if st[s[j] - 1] != str(c[j]): ok = False if ok == True: minimum = min(minimum, r) break if min == 10 ** N: print(-1) else: print(minimum)
N, M = map(int, input().split()) s = [0] * M c = [0] * M for i in range(M): s[i], c[i] = map(int, input().split()) ran = [] for i in range(10 ** (N - 1), 10 ** N): ran.append(i) if N == 1: ran.append(0) ran.sort() minimum = 10 ** N for r in ran: st = str(r) ok = True for j in range(M): if st[s[j] - 1] != str(c[j]): ok = False if ok == True: minimum = min(minimum, r) break if minimum == 10 ** N: print(-1) else: print(minimum)
[ "call.add", "identifier.change", "control_flow.branch.if.condition.change" ]
550,969
550,968
u364555831
python