Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    CastError
Message:      Couldn't cast
format_version: int64
name: string
language: string
model_id: string
model_revision: string
query_prefix: string
doc_prefix: string
query_clean: string
max_seq_length: int64
n_docs: int64
dim: int64
normalized: bool
similarity: string
dataset: struct<path: string, revision: string, config: string, limit: null>
  child 0, path: string
  child 1, revision: string
  child 2, config: string
  child 3, limit: null
embeddings_sha256: string
buffers_restored: struct<restored: int64, differed: int64>
  child 0, restored: int64
  child 1, differed: int64
device: string
encode_s: double
versions: struct<torch: string, transformers: string, sentence_transformers: string>
  child 0, torch: string
  child 1, transformers: string
  child 2, sentence_transformers: string
created_at: timestamp[s]
partition: string
id: string
url: string
code: string
to
{'id': Value('string'), 'code': Value('string'), 'url': Value('string'), 'partition': Value('string'), 'language': Value('string')}
because column names don't match
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1827, in _prepare_split_single
                  for key, table in generator:
                                    ^^^^^^^^^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 613, in wrapped
                  for item in generator(*args, **kwargs):
                              ~~~~~~~~~^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2306, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              format_version: int64
              name: string
              language: string
              model_id: string
              model_revision: string
              query_prefix: string
              doc_prefix: string
              query_clean: string
              max_seq_length: int64
              n_docs: int64
              dim: int64
              normalized: bool
              similarity: string
              dataset: struct<path: string, revision: string, config: string, limit: null>
                child 0, path: string
                child 1, revision: string
                child 2, config: string
                child 3, limit: null
              embeddings_sha256: string
              buffers_restored: struct<restored: int64, differed: int64>
                child 0, restored: int64
                child 1, differed: int64
              device: string
              encode_s: double
              versions: struct<torch: string, transformers: string, sentence_transformers: string>
                child 0, torch: string
                child 1, transformers: string
                child 2, sentence_transformers: string
              created_at: timestamp[s]
              partition: string
              id: string
              url: string
              code: string
              to
              {'id': Value('string'), 'code': Value('string'), 'url': Value('string'), 'partition': Value('string'), 'language': Value('string')}
              because column names don't match
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1694, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1880, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

id
string
code
string
url
string
partition
string
language
string
d1
for _ in range(int(input())): n = int(input()) mass = [] zo = 0 oz = 0 zz = 0 oo = 0 ozs = [] zos = [] ozss = set() zoss = set() for j in range(n): k = input() mass.append(k) if k[0] == '0' and k[-1] == '1': zoss.add(k) zos.appe...
https://codeforces.com/problemset/problem/1259/D
train
python
d2
q=int(input()) for e in range(q): x,y,k=list(map(int,input().split())) x,y=abs(x),abs(y) x,y=max(x,y),min(x,y) if(x%2!=k%2): k-=1 y-=1 if(x>k): print(-1) continue if((x-y)%2): k-=1 x-=1 print(k)
https://codeforces.com/problemset/problem/1036/B
train
python
d3
import sys import random from fractions import Fraction from math import * def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def finput(): return float(input()) def tinput(): return input().split() def linput(): return list(input()) def rinput(): return ...
https://codeforces.com/problemset/problem/1408/A
train
python
d4
def solve(): n, k = map(int,input().split()) lst = list(map(int,input().split())) lst.sort() ans = 0 for i in range(n - k - 1, n): ans += lst[i] print(ans) for i in range(int(input())): solve()
https://codeforces.com/problemset/problem/1430/B
train
python
d5
for _ in range(int(input())): input() nums = [int(x) for x in input().split()] new_ar = list(zip(nums,[i for i in range(len(nums))])) new_ar.sort() maxx = new_ar[0][1] minn = new_ar[0][1] s="1" for j in range(1,len(new_ar)): if(new_ar[j][1]>maxx): maxx = new_ar[j...
https://codeforces.com/problemset/problem/1265/B
train
python
d6
def possible(a): ans = set() s = set() lmax = 0 for i in range(len(a)): lmax = max(lmax, a[i]) s.add(a[i]) if lmax == i + 1 and len(s) == i + 1: ans.add(i + 1) return ans t = int(input()) for case_num in range(t): n = int(input()) a = list(map(int, input...
https://codeforces.com/problemset/problem/1330/B
train
python
d7
import sys input = sys.stdin.readline for f in range(int(input())): n,m=list(map(int,input().split())) neig=[0]*n for i in range(n): neig[i]=[0] for i in range(m): a,b=list(map(int,input().split())) a-=1 b-=1 neig[a][0]+=1 neig[a].append(b) lev=[1...
https://codeforces.com/problemset/problem/1368/E
train
python
d8
import sys def I(): return sys.stdin.readline().rstrip() class Heap: def __init__( self ): self.l = [ -1 ] self.n = 0 def n( self ): return self.n def top( self ): return self.l[ 1 ] def ins( self, x ): self.l.append( x ) n = len( self.l ) - 1 ...
https://codeforces.com/problemset/problem/1251/E2
train
python
d9
import sys input = sys.stdin.readline def main(): n, k = map(int, input().split()) string = input().strip() if "W" not in string: ans = min(n, k) * 2 - 1 print(max(ans, 0)) return L_s = [] cnt = 0 bef = string[0] ans = 0 for s in string: if s == ...
https://codeforces.com/problemset/problem/1427/B
train
python
d10
for _ in range(int(input())): s = input() p = [i for i in s.split("0") if i!=""] p.sort(reverse=True) ans = 0 for i in range(0,len(p),2): ans+=len(p[i]) print(ans)
https://codeforces.com/problemset/problem/1398/B
train
python
d11
for _ in range(int(input())): # n, x = map(int, input().split()) n = int(input()) arr = list(map(int, input().split())) ans = [arr[0]] for i in range(1, n - 1): if arr[i - 1] < arr[i] and arr[i] > arr[i + 1]: ans.append(arr[i]) elif arr[i - 1] > arr[i] and arr[i] < arr[i ...
https://codeforces.com/problemset/problem/1364/B
train
python
d12
n = int(input()) def area(width, height) : return (width+1) * (height+1) def calcul(s1, c, s2) : maxx, maxy, minx, miny = 0, 0, 0, 0 x, y = 0, 0 for k in range(len(s1)) : if s1[k] == "W" : y += 1 if s1[k] == "S" : y -= 1 if s1[k] == "A" : x -...
https://codeforces.com/problemset/problem/1202/C
train
python
d13
from math import * mod = 1000000007 for zz in range(int(input())): n = int(input()) a = [ int(i) for i in input().split()] b = [int(i) for i in input().split()] ha = True hp = False hm = False for i in range(n): if b[i] != a[i]: if b[i] > a[i]: if (hp): ...
https://codeforces.com/problemset/problem/1333/B
train
python
d14
for i in range(int(input())): n,g,b=map(int,input().split()) nn=(n+1)//2 print(max(nn+(nn-1)//g*b,n))
https://codeforces.com/problemset/problem/1303/B
train
python
d15
for _ in range(int(input())): a1, b1 = list(map(int, input().split())) a2, b2 = list(map(int, input().split())) if a1 > b1: a1, b1 = b1, a1 if a2 > b2: a2, b2 = b2, a2 flag = False if a1 == a2 and a1 == b1 + b2: flag = True if b1 == b2 and b1 == a1 + a2: flag ...
https://codeforces.com/problemset/problem/1351/B
train
python
d16
from math import * zzz = int(input()) for zz in range(zzz): a, b, x, y = list(map(int, input().split())) print(max(x*b, (a-x-1)*b, y*a, (b - y - 1)*a))
https://codeforces.com/problemset/problem/1315/A
train
python
d17
from math import sqrt class pro(object): def __init__(self,dif,sc): self.dif=dif self.sc=sc def __lt__(self,other): return self.dif>other.dif T=int(input()) mul=[1] for i in range(100): mul.append(mul[i]*10/9) inf=1000000007 for t in range(T): n=int(input()) effi,tim=list(m...
https://codeforces.com/problemset/problem/1056/F
train
python
d18
class BIT(): def __init__(self,n): self.BIT=[0]*(n+1) self.num=n def query(self,idx): res_sum = 0 while idx > 0: res_sum += self.BIT[idx] idx -= idx&(-idx) return res_sum #Ai += x O(logN) def update(self,idx,x): while idx <= self....
https://codeforces.com/problemset/problem/1400/D
train
python
d19
import math T = int(input()) for _ in range(T): n = int(input()) print(1/math.tan(math.pi/2/n))
https://codeforces.com/problemset/problem/1354/C1
train
python
d20
for _ in range(int(input())): n, k, d = list(map(int, input().split())) a = list(map(int, input().split())) s = {} for q in range(d): s[a[q]] = s.get(a[q], 0)+1 ans = len(s) for q in range(d, n): if s[a[q-d]] == 1: del s[a[q-d]] else: s[a[q-d]] -= ...
https://codeforces.com/problemset/problem/1225/B2
train
python
d21
q = int(input()) for _ in range(q): n, m = list(map(int, input().split())) info = [list(map(int, input().split())) for i in range(n)] info = sorted(info) now =(m, m) time = 0 flag = True for i in range(n): t, l, h = info[i] l_now = now[0] - (t - time) h_now = now[1] +...
https://codeforces.com/problemset/problem/1304/C
train
python
d22
t = int(input()) for _ in range(t): n = list(input().strip()) s = list(map(int, input().strip().split())) check = set(s) found = False for i in range(1, 1025): newset = set([e^i for e in s]) if check == newset: print(i) found = True break if ...
https://codeforces.com/problemset/problem/1362/B
train
python
d23
import sys input = sys.stdin.readline for _ in range(int(input())): a, k = list(map(int, input().split())) for _ in range(k - 1): if '0' in str(a): break a += int(min(list(str(a)))) * int(max(list(str(a)))) print(a)
https://codeforces.com/problemset/problem/1355/A
train
python
d24
import heapq for _ in range(int(input())): n = int(input()) voters = [] for i in range(n): m,p = list(map(int, input().split())) voters.append((m, -p)) voters.sort() for i in range(n): voters[i] = (voters[i][0], -voters[i][1]) ans = 0 costs = [] heapq.heapify(co...
https://codeforces.com/problemset/problem/1251/E1
train
python
d25
for _ in range(int(input())): d=int(input()) anws=False if d**2>=4*d: root=(d**2-4*d)**0.5 a=(d+root)/2 b=(d-root)/2 anws=True if anws: print("Y {:.9f} {:.9f}".format(a,b)) else: print("N")
https://codeforces.com/problemset/problem/1076/C
train
python
d26
import os from io import BytesIO import sys import threading sys.setrecursionlimit(10 ** 9) threading.stack_size(67108864) def main(): # input = BytesIO(os.read(0, os.fstat(0).st_size)).readline def ad(i, j): nonlocal g if j in g[i]: g[i].remove(j) g[j].remove(i) ...
https://codeforces.com/problemset/problem/1282/E
train
python
d27
for _ in range(int(input())): n, m = list(map(int, input().split())) if n < m: n, m = m, n # n > m if m == 1: print("YES") continue if m == 2 and n == 2: print("YES") continue print("NO")
https://codeforces.com/problemset/problem/1345/A
train
python
d28
tests = int(input()) for test in range(tests): n = int(input()) a = [int(i) for i in input().split()] d = {} for i in range(n): s = 0 while a[i] % 2 == 0: a[i] //= 2 s += 1 if a[i] in list(d.keys()): d[a[i]] = max(s, d[a[i]]) else: ...
https://codeforces.com/problemset/problem/1259/B
train
python
d29
import sys INF = 10**20 MOD = 10**9 + 7 I = lambda:list(map(int,input().split())) from math import gcd from math import ceil from collections import defaultdict as dd, Counter from bisect import bisect_left as bl, bisect_right as br """ Facts and Data representation Constructive? Top bottom up down """ def check(s): ...
https://codeforces.com/problemset/problem/1379/A
train
python
d30
input=__import__('sys').stdin.readline for _ in range(int(input())): n=int(input()) s=list(map(int,input().split())) g=[[-1]for _ in range(n+1)] for i in range(n): g[s[i]].append(i) inf=10**10 ans=[-1]*n lstunused=n for i in range(1,n+1): g[i].append(n) mx=0 for j in range(1,len(g[i])): mx=max(mx,g[i...
https://codeforces.com/problemset/problem/1417/C
train
python
d31
t = int(input()) for i in range(t): n = int(input()) s = input() ans = 0 for y in range(1, n): if s[y] == s[y-1]: ans += 1 print((ans + ans % 2) // 2)
https://codeforces.com/problemset/problem/1437/B
train
python
d32
DIR = {"N": (0, 1), "S": (0, -1), "W": (-1, 0), "E": (1, 0)} for t in range(int(input())): path = input() tracks = set() x, y = 0, 0 time = 0 for char in path: x1 = x + DIR[char][0] y1 = y + DIR[char][1] if (x, y, x1, y1) in tracks or (x1, y1, x, y) in tracks: time += 1 ...
https://codeforces.com/problemset/problem/1351/C
train
python
d33
from sys import stdin, stdout from collections import defaultdict input = stdin.readline for _ in range(int(input())): n = int(input()) chanek = 0 flag = 1 while n>0: if n%4==0 and n!=4: if flag: chanek += 1 n-=1 flag = 0 else: n-=1 flag = 1 elif n%2: if flag: chanek += 1 n-...
https://codeforces.com/problemset/problem/1425/A
train
python
d34
t=int(input()) for i in range(t): n=int(input()) print(2) print(n-1,n) for i in range(n-2,0,-1): print(i,i+2)
https://codeforces.com/problemset/problem/1430/C
train
python
d35
for _ in range(int(input())): n = int(input()) if(n%2): print("7"+"1"*((n-3)//2)) else: print("1"*(n//2))
https://codeforces.com/problemset/problem/1295/A
train
python
d36
import sys input=sys.stdin.readline for _ in range(int(input())): N=int(input()) e=list(map(int,input().split())) e.sort() ans=0 val=0 g=0 for i in range(0,N): g+=1 val=e[i] if g>=val: ans+=1 g=0 val=0 print(ans)
https://codeforces.com/problemset/problem/1355/B
train
python
d37
n=int(input()) a=list(map(int,input().split())) k=[] for i in range(n): for j in range(a[i]): k.append(i+1) m=int(input()) b=list(map(int,input().split())) for i in b: print(k[i-1])
https://codeforces.com/problemset/problem/474/B
train
python
d38
3 from math import factorial as fact N = 55 c = [1] for i in range(N): c.append(fact(i)) dp = [0] * N dp[0] = 1 for i in range(1, N): for j in range(i): dp[i] += dp[j] * c[i - j - 1] def get_kth_cycle(n, k): if n == 1: return [1] ans = [-1] * n ans[0] = n - 1 fin = [i for i in range(n)] fin[0] = n - 1 in...
https://codeforces.com/problemset/problem/1279/E
train
python
d39
q = int(input()) for z in range(q): n, k1, k2 = map(int, input().split()) arr1 = list(map(int, input().split())) arr2 = list(map(int, input().split())) if max(arr1) > max(arr2): print('YES') else: print('NO')
https://codeforces.com/problemset/problem/1270/A
train
python
d40
t=int(input()) for tt in range(t): a,b,p=map(int,input().split()) s=input() n=len(s) cost = [0]*n cost[-1] = 0 typ = '' i=n-2 while i>=0: if s[i]==typ: cost[i] = cost[i+1] else: typ = s[i] cost[i] = cost[i+1] + (a if typ=='A' else b) ...
https://codeforces.com/problemset/problem/1315/B
train
python
d41
def main(): from sys import stdin, stdout for _ in range(int(stdin.readline())): n = int(stdin.readline()) inp1 = [-1] * (n + 1) inp2 = [-1] * (n + 1) for i, ai in enumerate(map(int, stdin.readline().split())): if inp1[ai] < 0: inp1[ai] = i ...
https://codeforces.com/problemset/problem/1223/D
train
python
d42
t = int(input()) for tt in range(t): n,k=list(map(int,input().split())) s = input() ans = [] if s[0] == ')': for i in range(n): if s[i] == '(': ans.append([1,i+1]) s = s[i::-1] + s[i+1:] break for i in range(1,(k-1)*2): if i...
https://codeforces.com/problemset/problem/1227/C
train
python
d43
LOG = 20 def solve(s): n = len(s) res = 0 z = 0 for t in range(0, n): if s[t] == '0': z += 1 continue for l in range(1, min(LOG, n - t + 1)): x = int(s[t:t+l], 2) # print(l, t, x, l + z) if l + z >= x: res += 1 # print(t, l, x, res, z) z = 0 return res t = int(input()) while t > 0: ...
https://codeforces.com/problemset/problem/1217/C
train
python
d44
def check(M): sm = 0 for i in range(n): if a[i] > M: sm += b[i] return sm <= M gans = [] for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) L = 0 R = max(a) while R - L > 1: M = (L + R) ...
https://codeforces.com/problemset/problem/1443/C
train
python
d45
t=int(input()) for you in range(t): n=int(input()) for i in range(n): print(4*n-2*i,end=" ") print()
https://codeforces.com/problemset/problem/1443/A
train
python
d46
import sys import random from fractions import Fraction from math import * def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def finput(): return float(input()) def tinput(): return input().split() def linput(): return list(input()) def rinput(): return ...
https://codeforces.com/problemset/problem/1419/B
train
python
d47
# # ------------------------------------------------ # ____ _ Generatered using # / ___| | | # | | __ _ __| | ___ _ __ ______ _ # | | / _` |/ _` |/ _ \ '_ \|_ / _` | # | |__| (_| | (_| | __/ | | |/ / (_| | # \____\____|\____|\___|_| |_/...
https://codeforces.com/problemset/problem/1380/B
train
python
d48
import sys input = sys.stdin.readline from bisect import bisect_right bin_s = [1] while bin_s[-1] <= 10 ** 9: bin_s.append(bin_s[-1] * 2) def main(): n, q = map(int, input().split()) alst = list(map(int, input().split())) dp = [[-1, -1] for _ in range(n)] dp[0] = [alst[0], 0] for i, a in enum...
https://codeforces.com/problemset/problem/1420/C1
train
python
d49
for haaghfj in range(int(input())): x,y,k = list(map(int,input().split())) print(k + (y * k + k - 1 +x-2) // (x - 1))
https://codeforces.com/problemset/problem/1418/A
train
python
d50
import sys #sys.stdin=open("data.txt") input=sys.stdin.readline # this math tutorial is boring classy=set() for i in range(19): for j in range(i): for k in range(j): for a in range(10): # a=0 for good measure for b in range(10): for c in range(10): ...
https://codeforces.com/problemset/problem/1036/C
train
python
d51
for tcase in range(int(input())): n=int(input()) ls = list(map(int, input().split())) oneneed = 2*(n - ls.count(1)) ldct = {0:0} ctr = 0 eaten = 0 for i in range(n-1,-1,-1): eaten += 1 ctr += (1 if ls[i] == 2 else -1) if ctr not in ldct: ldct[ctr] = eaten ...
https://codeforces.com/problemset/problem/1278/C
train
python
d52
def main(): t = int(input()) for z in range(t): n, k, d1, d2 = map(int, input().split()) if n % 3 != 0: print('no') continue f = 0 for i in [-1, +1]: for j in [-1, +1]: w = (k - i * d1 - j * d2) if f == 0 and (w ...
https://codeforces.com/problemset/problem/451/C
train
python
d53
n=int(input()) a=sorted(int(input()) for _ in range(n)) print(sum(a[i]*a[-i-1] for i in range(n))%10007)
https://codeforces.com/problemset/problem/717/C
train
python
d54
import sys input = sys.stdin.readline def compress(array): array2 = sorted(set(array)) memo = {value : index for index, value in enumerate(array2)} for i in range(len(array)): array[i] = memo[array[i]] + 1 return array t = int(input()) base = 10 ** 6 for _ in range(t): n, b = list(map(st...
https://codeforces.com/problemset/problem/1304/D
train
python
d55
for i in range(int(input())): n=int(input()) s=list(map(int,input().split())) a=0 for i in s: if i<2049:a+=i if a<2048:print("NO") else:print("YES")
https://codeforces.com/problemset/problem/1221/A
train
python
d56
for __ in range(int(input())): n = int(input()) print((n + 1) // 2)
https://codeforces.com/problemset/problem/1371/A
train
python
d57
for _ in range(int(input())): n, k = map(int, input().split()) mat = [[0] * n for _ in range(n)] for i in range(n): b = False for j in range(n): if i*n+j == k: b = True break mat[(i+j)%n][j] = 1 if b: break if k%...
https://codeforces.com/problemset/problem/1371/D
train
python
d58
t = int(input()) for case in range(t): n = int(input()) arr = list(map(int, input().split())) if arr[-1] > arr[0]: print("YES") else: print("NO")
https://codeforces.com/problemset/problem/1375/C
train
python
d59
mem = [[[0 for i in range(51)] for j in range(31)] for k in range(31)] def f(n, m, k): if mem[n][m][k]: return mem[n][m][k] if (n*m == k) or (k == 0): return 0 cost = 10**9 for x in range(1, n//2 + 1): for z in range(k+1): cost = min(cost, m*m + f(n-x, m, k-z) + f(x...
https://codeforces.com/problemset/problem/598/E
train
python
d60
for _ in range(int(input())): n=int(input()) a=list(map(int,input().split())) ans,small,big=0,2*10**9,-1 for i in range(len(a)-1): if a[i]==-1 and a[i+1]!=-1: small=min(small, a[i+1]) big=max(big, a[i+1]) if a[i]!=-1 and a[i+1]==-1: small = min(small, ...
https://codeforces.com/problemset/problem/1301/B
train
python
d61
n = int(input()) for _ in range(n): a, b = list(map(int, input().split())) print(a ^ b)
https://codeforces.com/problemset/problem/1421/A
train
python
d62
import sys import math #from queue import * import random #sys.setrecursionlimit(int(1e6)) input = sys.stdin.readline ############ ---- USER DEFINED INPUT FUNCTIONS ---- ############ def inp(): return(int(input())) def inara(): return(list(map(int,input().split()))) def insr(): s = input() return(list...
https://codeforces.com/problemset/problem/1380/A
train
python
d63
T = int(input()) def solve(S): res = [S[0]] pos = 0 # think... for s in S[1:]: # can we change? if 0 <= pos-1 < len(res) and res[pos-1] == s: pos = pos-1 elif 0 <= pos+1 < len(res) and res[pos+1] == s: pos = pos+1 elif pos == 0 and s not in res: ...
https://codeforces.com/problemset/problem/1303/C
train
python
d64
def solve(): n, k = map(int,input().split()) lst1 = list(map(int,input().split())) lst1.sort(reverse=True) ind = 0 ans = 0 lst2 = list(map(int,input().split())) lst2.sort() for i in range(k): lst2[i] -= 1 if lst2[i] == 0: ans += lst1[ind] ans += lst1[ind] ...
https://codeforces.com/problemset/problem/1369/C
train
python
d65
import sys import random from fractions import Fraction from math import * def input(): return sys.stdin.readline().strip() def iinput(): return int(input()) def finput(): return float(input()) def tinput(): return input().split() def linput(): return list(input()) def rinput(): return ...
https://codeforces.com/problemset/problem/1408/C
train
python
d66
import math from collections import deque from sys import stdin, stdout from string import ascii_letters import sys letters = ascii_letters input = stdin.readline #print = stdout.write for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) ans = [999999999] * n ans[0] = 1 ...
https://codeforces.com/problemset/problem/1418/C
train
python
d67
#list(map(int,input().split())) t=int(input()) for _ in range(t): n=int(input()) aa=list(map(int,input().split())) bb=list(map(int,input().split())) aa.sort() bb.sort() print(*aa) print(*bb)
https://codeforces.com/problemset/problem/1305/A
train
python
d68
for _ in range(int(input())): n = int(input()) s = input() t = input() d = {} for i in range(ord('a'), ord('z') + 1): d[chr(i)] = 0 for cs in s: d[cs] += 1 for ct in t: d[ct] += 1 ok = True for e in d: if d[e] % 2 == 1: ok = False i...
https://codeforces.com/problemset/problem/1243/B2
train
python
d69
from itertools import groupby def main(): N = int(input()) S = input() C = [len(list(x[1])) for x in groupby(S)] M = len(C) dup_idx = [] for i, c in enumerate(C): if c > 1: dup_idx.append(i) dup_idx.reverse() curr = 0 while dup_idx: i = dup_idx[...
https://codeforces.com/problemset/problem/1430/D
train
python
d70
t = int(input()) for case in range(t): a, b = list(map(int, input().split())) s = input() z = 10000 total = 0 act = False for i in range(len(s)): cur = s[i] if cur == '0': z += 1 act = False else: if not act: act = Tr...
https://codeforces.com/problemset/problem/1443/B
train
python
d71
import sys input = sys.stdin.readline from collections import defaultdict class Unionfind: def __init__(self, n): self.par = [-1]*n self.rank = [1]*n def root(self, x): r = x while not self.par[r]<0: r = self.par[r] t = x ...
https://codeforces.com/problemset/problem/1332/C
train
python
d72
t=int(input()) while t>0 : n=int(input()) a=list(map(int,input().split())) an=0 s=0 for i in a : if s+i>=0 : s+=i else : s+=i an-=s s=0 print(an) t-=1
https://codeforces.com/problemset/problem/1405/B
train
python
d73
t = int(input()) for _ in range(t): n, k = [int(x) for x in input().split()] a = [int(x) for x in input().split()] if len(set(a)) > k: print(-1) continue l = list(set(a)) l.extend([1]*(k - len(l))) print(n*k) for _ in range(n): print(*l, end=" ") print()
https://codeforces.com/problemset/problem/1348/B
train
python
d74
def solve(): n = int(input()) a = list(map(int, input().split())) c = [0] * (n + 1) def inc(): for i in range(n - 1): if a[i] > a[i + 1]: return False return True def calc(): for i in range(n + 1): c[i] = 0 for i in a: ...
https://codeforces.com/problemset/problem/1375/D
train
python
d75
def read_int(): return int(input()) def read_ints(): return list(map(int, input().split(' '))) t = read_int() for case_num in range(t): n, k = read_ints() p = [] for i in range(n): ai, bi = read_ints() p.append((bi, ai, i + 1)) p.sort() dp = [[0 for j in range(k + 1)] for...
https://codeforces.com/problemset/problem/1354/F
train
python
d76
import math T = int(input()) for _ in range(T): n = int(input()) diags = 1/math.sin(math.pi/2/n) print(diags * math.cos(math.pi/4/n))
https://codeforces.com/problemset/problem/1354/C2
train
python
d77
t = int(input()) for _ in range(t): n = int(input()) if n%4 == 0: print("YES") else: print("NO")
https://codeforces.com/problemset/problem/1369/A
train
python
d78
3 import math import os import sys DEBUG = 'DEBUG' in os.environ def inp(): return sys.stdin.readline().rstrip() def dprint(*value, sep=' ', end='\n'): if DEBUG: print(*value, sep=sep, end=end) INF = 10 ** 20 def solve(N, A, B): dp = {A[0]: 0, A[0] + 1: B[0], A[0] + 2: B[0] * 2} for i...
https://codeforces.com/problemset/problem/1221/D
train
python
d79
import sys q = int(sys.stdin.readline().strip()) for t in range(0, q): n, m = list(map(int, sys.stdin.readline().strip().split())) L = [] R = [0] * n C = [0] * m for i in range (0, n): L.append(sys.stdin.readline().strip()) for j in range (0, m): if L[i][j] != "*": ...
https://codeforces.com/problemset/problem/1194/B
train
python
d80
from math import ceil t = int(input()) for _ in range(t): n = int(input()) pf = [] for i in range(2, ceil(n**0.5)+1): while n % i == 0: pf.append(i) n //= i if n > 1: pf.append(n) if len(pf) == 2 and pf[0] != pf[1]: print(pf[0], pf[1], pf[0]*pf[1]) print(1) else: pg = [] ...
https://codeforces.com/problemset/problem/1419/E
train
python
d81
def solve(L, R): res = 0 for i in range(32): for j in range(32): l = (L >> i) << i r = (R >> j) << j #print(l, r) if l>>i&1==0 or r>>j&1==0: continue l -= 1<<i r -= 1<<j if l & r: continue...
https://codeforces.com/problemset/problem/1245/F
train
python
d82
for _ in range(int(input())): a, b, c = input(), input(), input() n = len(a) ok = True for i in range(n): if c[i] not in [a[i], b[i]]: ok = False print('YES' if ok else 'NO')
https://codeforces.com/problemset/problem/1301/A
train
python
d83
for __ in range(int(input())): n = int(input()) ar = list(map(int, input().split())) ar.reverse() print(*ar)
https://codeforces.com/problemset/problem/1405/A
train
python
d84
def one(): return int(input()) def two(): return list(map(int, input().split())) def lis(): return list(map(int, input().split())) def st(): return input() for _ in range(one()): x, y, a, b = list(map(int, input().split())) d = y - x if d%(a+b)==0: print(d//(a+b)) else: ...
https://codeforces.com/problemset/problem/1304/A
train
python
d85
# encoding: utf-8 from sys import stdin def solve(a): # root node of tries denotes empty stack stack = [None] node_stack = [[1, {}]] trie = node_stack[-1] counter = 0 for i in range(len(a)): el = a[i] if len(stack) == 0 or stack[-1] != el: current_node = node_sta...
https://codeforces.com/problemset/problem/1241/F
train
python
d86
import sys input=sys.stdin.readline for _ in range(int(input())): s=input().rstrip() x=int(input()) n=len(s) ans=["1" for i in range(n)] for i in range(n): if s[i]=="0": if i-x>=0: ans[i-x]="0" if i+x<n: ans[i+x]="0" for i in rang...
https://codeforces.com/problemset/problem/1400/C
train
python
d87
def solve(): n = int(input()) lst = list(map(int,input().split())) if sum(lst) <= n // 2: print(n//2) print("0 " * (n // 2)) else: print(n//2 + (n // 2) % 2) print("1 " * (n//2 + (n // 2) % 2)) for i in range(int(input())): solve()
https://codeforces.com/problemset/problem/1407/A
train
python
d88
import sys readline = sys.stdin.readline readlines = sys.stdin.readlines ns = lambda: readline().rstrip() ni = lambda: int(readline().rstrip()) nm = lambda: map(int, readline().split()) nl = lambda: list(map(int, readline().split())) prn = lambda x: print(*x, sep='\n') def gcd(a, b): while b: a, b = b, a%...
https://codeforces.com/problemset/problem/1389/E
train
python
d89
n = input() a = list(map(int, input().split())) for i in a: if i % 7 == 0 or (i // 7) % 2 == 1 or i <= 14: print('NO') else: print('YES')
https://codeforces.com/problemset/problem/1266/B
train
python
d90
from sys import stdin tt = int(stdin.readline()) for loop in range(tt): n = int(stdin.readline()) a = list(map(int,stdin.readline().split())) lis = [ [1] ] now = [] tmp = 0 for i in range(1,n): if len(now) == 0: now.append(a[i]) tmp = 1 elif now[-1] ...
https://codeforces.com/problemset/problem/1437/D
train
python
d91
import math from collections import deque from sys import stdin, stdout from string import ascii_letters import sys letters = ascii_letters input = stdin.readline #print = stdout.write for _ in range(int(input())): n = int(input()) arr = list(map(int, input().split())) can = list(map(int, input().split()))...
https://codeforces.com/problemset/problem/1418/B
train
python
d92
t = int(input()) for faw in range(t): n = int(input()) a = [0] + list(map(int,input().split())) nun = [] ans = [] f = True for i in range(1, n + 1): if a[i] == a[i-1]: if len(nun) == 0: f = False break else: ans.appe...
https://codeforces.com/problemset/problem/1227/B
train
python
d93
for _ in range(int(input())): print("YES" if set(input()).intersection(input()) else "NO")
https://codeforces.com/problemset/problem/1223/B
train
python
d94
for tc in range(int(input())): n,m = list(map(int, input().split())) al = list(map(int, input().split())) bl = list(map(int, input().split())) aidx = {} for i,e in enumerate(al): aidx[e]=i midx = -1 res = 0 for i,e in enumerate(bl): idx = aidx[e] if idx <= midx: ...
https://codeforces.com/problemset/problem/1279/C
train
python
d95
T = int(input()) for test in range(T): n,t = list(map(int,input().split())) a = list(map(int,input().split())) res = [] j=0 for i in a: if(i*2<t): res+=["0"] elif(i*2>t): res+=["1"] else: res.append(["0","1"][j]) j = 1-j pri...
https://codeforces.com/problemset/problem/1417/B
train
python
d96
#JMD #Nagendra Jha-4096 import sys import math #import fractions #import numpy ###File Operations### fileoperation=0 if(fileoperation): orig_stdout = sys.stdout orig_stdin = sys.stdin inputfile = open('W:/Competitive Programming/input.txt', 'r') outputfile = open('W:/Competitive Programming/output...
https://codeforces.com/problemset/problem/1326/A
train
python
d97
import sys from operator import itemgetter def count(a, b, num_a, num_b, cur_time): current_result = 0 #print('count time = ', cur_time, "num_a =", num_a, 'num_b = ', num_b) if num_a * a + num_b * b <= cur_time and cur_time >= 0: cur_time -= num_a * a + num_b * b current_result = num_a + num_b if num_a < tota...
https://codeforces.com/problemset/problem/1282/C
train
python
d98
import sys reader = (s.rstrip() for s in sys.stdin) input = reader.__next__ def solve(): s,c = input().split() # i,jでjが複数あるとき n = len(s) for i in range(n-1): prev = s[i] pos = i for j in range(i+1, n): if s[j]<prev: prev = s[j] pos = j...
https://codeforces.com/problemset/problem/1281/B
train
python
d99
q = int(input()) for _ in range(q): c, m, x = list(map(int, input().split())) print(min([c, m, (c + m + x) // 3]))
https://codeforces.com/problemset/problem/1221/C
train
python
d100
for _ in range(int(input())): # a, b = map(int, input().split()) n = int(input()) # arr = list(map(int, input().split())) s = input() l = 0 r = n - 1 if s.count('0') == n: print(s) continue if s.count('1') == n: print(s) continue while s[l] == '0': ...
https://codeforces.com/problemset/problem/1369/B
train
python
End of preview.

apps-corpus-index

Precomputed embeddings of the 8,765-document AppsRetrieval corpus (CoIR-Retrieval/apps @ f22508f), for the code-search Space.

  • Model: madhurr382/coderankembed-apps-ft @ c9f6787afd037f4981130ce48335723ed7e65057
  • embeddings.npy: float32 [8765, 768], L2-normalised (cosine = dot product)
  • docs.jsonl: id, code, url, partition, language, row-aligned with the embeddings
  • manifest.json: query prefix 'Represent this query for searching relevant code: ', query cleaning desc-io, library versions, sha256 of the embeddings

Queries must be encoded with the same model revision, prefix and cleaning. Built by retrieval/precompute_corpus.py in https://github.com/madhurgrover-cs/TASIE.

Downloads last month
57

Space using madhurr382/apps-corpus-index 1