akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <vector>
#include <cmath>
#include <cstdint>
#include <string>

using namespace std;

int gcd(int x, int y) {
  if (x < y) {
    return gcd(y, x);
  }
  int q = x % y;
  if (q == 0) {
    return y;
  } else {
    return gcd(q, y);
  }
}

int main() {
  int x, y;
  cin >> x >> y;
  cout << gcd(x, y) << endl;
}



Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <array>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INT_MAX 2000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(i = (a); i < (b); i++)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vsort(x) sort(x.begin(),x.end())

using namespace std;

int main() {

	int i, j, k;
	int n;
	cin >> n;
	if (n / 100 == n % 10) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(1000000)

num_node = int(input())
relation = [[[], []] for i in range(num_node + 1)]
for i in range(num_node - 1):
    u, v, w = map(int, input().split())
    if w % 2 == 0:
        relation[u][0].append(v)
        relation[v][0].append(u)
    else:
        relation[u][1].append(v)
        relation[v][1].append(u)
colors = [None] * (num_node + 1)


def dfs(n: int, c: int):
    colors[n] = c
    # 偶数
    for even_idx in relation[n][0]:
        if colors[even_idx] is not None:
            continue
        else:
            dfs(even_idx, colors[n])
    # 奇数
    for odd_idx in relation[n][1]:
        if colors[odd_idx] is not None:
            continue
        else:
            dfs(odd_idx, 1 - colors[n])


if __name__ == '__main__':
    dfs(1, 0)
    for ans in list(map(int, colors[1:])):
        print(ans)


Measured memory_bytes: 83964
#include <iostream>

using namespace std;

int n, i, a;
int fr[200005];

int main()
{
    cin >> n;
    for(i = 1; i < n; i++)
    {
        cin >> a;
        fr[a]++;
    }
    for(i = 1; i <= n; i++)
        cout << fr[i] << "\n";
    return 0;
}


Measured memory_bytes: 4368
#include <stdio.h>
int main(void){
    // Your code here!
    /*
    pushBack(x): Aの末尾に整数xを挿入する
    randomAccess(p):Aの要素apの値を出力する
    popBack(): Aの末尾の要素を削除する
    */
    int a[200000];
    int N,mode,val,i,idx;
    idx = 0;
    scanf( "%d" , &N );
    for( i = 0 ; i < N ; i++ ){
        scanf( "%d " , &mode );
        if( mode < 2 ){
            scanf( "%d " , &val );
        }
        switch( mode ){
            case 0:
                a[idx++] = val;
                break;
            case 1:
                printf( "%d\n" , a[val] );
                break;
            case 2:
                idx--;
                break;
        }
    }
    
}



Measured memory_bytes: 2480
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    long long A, B, C; cin >> A >> B >> C;
    cout << min({(A % 2) * B * C, A * (B % 2) * C, A * B * (C % 2)}) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in) ) {
            String[] line = sc.nextLine().split(" ");
            String[] dList = sc.nextLine().split(" ");

            Arrays.sort(dList,  Collections.reverseOrder());

            int h = Integer.valueOf(line[0]);

            for (String d : dList) {
                h -= Integer.valueOf(d);

                if (h <= 0) {
                    System.out.println("Yes");
                    return;
                }
            }

            // 出力
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 46868
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int main(){
	char moji[10][6];
	strcpy(moji[1],".,!? ");
	strcpy(moji[2] ,"abc  ");
strcpy(moji[3], "def  ");
strcpy(moji[4],"ghi  ");
strcpy(moji[5],"jkl  ");
strcpy(moji[6],"mno  ");
strcpy(moji[7],"pqrs ");
strcpy(moji[8],"tuv  ");
strcpy(moji[9],"wxyz ");

	string str;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>str;
		int cnt=0;
		int num=0;
		for(int j=0;j<str.size();j++){
			if(str.at(j)=='0')continue;
			cnt=0;
			num=str.at(j)-'0';
			if(j==str.size()-2){
				cout<<moji[num][cnt];
				break;
			}

			while(str.at(j)==str.at(j+1)){
				cnt++;
				j++;
				if(j==str.size()-2){
					break;
				}
			}

			if(num==1){
				cnt%=5;
			}
			else if(num==7||num==9){
				cnt%=4;
			}
			else{
				cnt%=3;
			}

			cout<<moji[num][cnt];
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1204
code = """

# distutils: language=c++
# distutils: include_dirs=[/home/USERNAME/.local/lib/python3.8/site-packages/numpy/core/include, /opt/atcoder-stl]
# cython: boundscheck=False
# cython: wraparound=False


cimport numpy as np
cdef extern from "<atcoder/fenwicktree>" namespace "atcoder" nogil:
    cdef cppclass fenwick_tree[T]:
        fenwick_tree(int n)
        void add(int p, T x)
        T sum(int l, int r)

cdef class FenwickTree:
    cdef fenwick_tree[long long] *_thisptr
    def __cinit__(self, np.ndarray[long, ndim=1] array):
        cdef int N = array.size
        self._thisptr = new fenwick_tree[long long](N)
        for i in range(N):
            self.add(i, array[i])
    cpdef void add(self, int p, long long x):
        self._thisptr.add(p, x)
    cpdef long long sum(self, int l, int r):
        return self._thisptr.sum(l, r)
"""


import os, sys, getpass

if sys.argv[-1] == 'ONLINE_JUDGE':
    code = code.replace("USERNAME", getpass.getuser())
    open('atcoder.pyx','w').write(code)
    os.system('cythonize -i -3 -b atcoder.pyx')
    sys.exit(0)


from atcoder import FenwickTree
import numpy as np

N,Q = list(map(int,input().split()))
bit = FenwickTree(np.array(list(map(int,input().split())), dtype=np.int))

for i in range(Q):
    a,b,c = list(map(int,input().split()))
    if a==0:
        bit.add(b,c)
    else:
        print(bit.sum(b,c))

Measured memory_bytes: 83892
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll; //long longをllとして簡略

int main(){
  int r,g,b;
  cin >> r >> g >> b;
  int n;
  cin >> n; //求めるのは数のみ
  int ans=0;
  rep(x,n+1){
    rep(y,n+1){
      int temp = n-(r*x)-(g*y);//temp = bz
      if(temp >= 0 && temp % b ==0 ){
        ++ans;
      }
    }
  }
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        char[] alp = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
        List<Character> clist = new ArrayList<Character>();
        for(char each : alp){
            clist.add(each);
        }
        int[] count = new int[26];
        while(sc.hasNextLine()){
            String str = sc.nextLine();
            for(int i = 0; i < str.length(); i++){
                char c = str.charAt(i);
                if(c >= 'A' && c <= 'Z'){
                    c += 'a' - 'A';
                    int index = clist.indexOf(c);
                    count[index]++;
                }else if(c >= 'a' && c <= 'z'){
                    int index = clist.indexOf(c);
                    count[index]++;
                }
            }
        }
        for(int i = 0; i < 26; i++){
            System.out.println(clist.get(i) + " : " + count[i]);
        }
    }
}


Measured memory_bytes: 26300
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    string str;
    cin >> str;
    ll sum = 0;

    for(ll i=0;i<str.size();i++){
        ll n = 0;
        n = (int)(str.at(i) - '0');
        sum += n;
    }
    if(sum % 9 == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3724
open Printf
open Scanf

let readint () = scanf " %d" (fun x -> x)

let () =
  let n = readint () in 
  let a = Array.init n (fun _ -> readint ()) in
  a.(0) <- a.(0) - 1;
  for i = 1 to n - 1 do
    if a.(i-1) < a.(i) then
      a.(i) <- a.(i) - 1
  done;
  printf "%s\n" @@ let x = Array.to_list a in if x = List.sort compare x then "Yes" else "No"



Measured memory_bytes: 11520
h, w, k = map(int, input().split())
s = [[int(s_ij) for s_ij in input()] for _ in range(h)]

minimum = (h - 1) * (w - 1)
for div_h in range(1 << (h - 1)):
  h_index = [0] * h
  cur_index = 0
  mask = 1 << (h - 2)
  for i in range(1, h):
    if div_h & mask:
      cur_index += 1
    h_index[i] = cur_index
    mask >>= 1
  white_choco = [0] * (cur_index + 1)
  divide = 0
  j = 0
  flag = False
  while j < w:
    for i in range(h):
      white_choco[h_index[i]] += s[i][j]
    if max(white_choco) > k:
      if flag:
        break
      flag = True
      white_choco = [0] * (cur_index + 1)
      divide += 1
    else:
      j += 1
      flag = False
  else:
    minimum = min(minimum, divide + cur_index)
print(minimum)

Measured memory_bytes: 3192
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int n = 0;
  fscanf(stdin, "%d", &n);
  vector<vector<int> > mat(n, vector<int>(n, 0));
  for (int i = 0; i < n; ++i) {
    int u = -1, k = -1, v = -1;
    fscanf(stdin, "%d %d", &u, &k);
    for (int j = 0; j < k; ++j) {
      fscanf(stdin, "%d", &v);
      mat[u - 1][v - 1] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (j) { fprintf(stdout, " "); }
      fprintf(stdout, "%d", mat[i][j]);
    }
    fprintf(stdout, "\n");
  }
  return 0;
}

Measured memory_bytes: 1252
//ABC111 A-ATCODER BEGINNER CONTEST 999
#include<bits/stdc++.h>
using namespace std;
int main(){
    string N;cin >> N;
    for(int i = 0 ;i < N.size();i++){
        if(N.at(i) == '9'){
            cout << 1;
        }
        else{
            cout << 9;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

const int INF = 1e9;

const int dx[2] = {1, 0};
const int dy[2] = {0, 1};


int main() {
    int H, W; cin >> H >> W;
    vector<string> G(H);
    for(auto &e : G) cin >> e;
    vector<vector<int>> dp(H, vector<int>(W, INF));
    dp[0][0] = G[0][0] == '#';
    rep(y, H) rep(x, W) {
        rep(i, 2) {
            int ny = y + dy[i], nx = x + dx[i];
            if(ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
            chmin(dp[ny][nx], dp[y][x] + (G[y][x] == '.' && G[ny][nx] == '#'));
        }
    }
    cout << dp[H-1][W-1] << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1000000007
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
    vector<pair<int, pair<int, int>>> A(M);
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        A[i].first         = a;
        A[i].second.first  = b;
        A[i].second.second = i;
    }
    vector<pair<int, pair<int, int>>> B = A;
    SORT(B);
    vector<int> index(M);
    vector<int> id(N + 1, 1);
    REP(i, M) {
        index[B[i].second.second] = id[B[i].first];
        id[B[i].first]++;
    }

    REP(i, M) {
        cout << setfill('0') << setw(6) << A[i].first;
        cout << setfill('0') << setw(6) << index[i] << '\n';
    }

    return 0;
}

Measured memory_bytes: 4608
#include <cmath>
#include <iostream>
#include <cstdio>
#include <ctype.h>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <iomanip>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <sstream>


using namespace std;



string shift_str(string str, int num)
{
	int ascii;
	string ret;
	
	for (int i=0; i<str.length(); i++)
	{
		ascii = (int)str[i];
		//cout << "ascii = " << ascii << endl;
		
		if (!('a' <= ascii && ascii <= 'z'))
		{
			ret += ascii;
		} else {
			ascii += num;
			if (ascii > 'z')
			{
				ret += ((ascii - 'z') + 'a' - 1);
			} else {
				ret += ascii;
			}
		}
		
	}
	
	return ret;
}
//the this that


int main()
{
	string str;
	string ret;
	
	while (getline(cin, str))
	{
		for (int i=1; i<=26; i++)
		{
			ret = shift_str(str, i);
			if ( ret.find("the", 0) != string::npos
				|| ret.find("this", 0) != string::npos
				|| ret.find("that", 0) != string::npos )
			{
				//cout << "i = " << i << endl;
				cout << ret << endl;
				break;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 1188
#include<iostream>
#include<cstdio>
using namespace std;

int main(){
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c) != EOF) {
        int ans = 99999;
        ans = min(ans,a+b);
        ans = min(ans,a+c);
        ans = min(ans,b+c);
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 256
import itertools
h, w, k = map(int, input().split())
field = []
for i in range(h):
  field.append(list(input()))
  
hb = [0 for i in range(h)]
wb = [0 for j in range(w)]
slist = []
tlist = []
bl = 0
ans = 0

for i in range(h):
  for j in range(w):
    if field[i][j] == "#":
      hb[i] += 1
      wb[j] += 1
      bl += 1

for i in range(h):
  for s in itertools.combinations(range(h), i):
    tmp = 0
    for es in s:
      tmp += hb[es]
    slist.append([list(s), tmp])
    
for j in range(w):
  for t in itertools.combinations(range(w), j):
    tmp = 0
    for et in t:
      tmp += wb[et]
    tlist.append([list(t), tmp])

    
for s in slist:
  for t in tlist:
    tmp = s[1] + t[1]
    if s and t:
      for es in s[0]:
        for et in t[0]:
          if field[es][et] == "#":
            tmp -= 1
    if bl - tmp == k:
      ans += 1
      
print(ans)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;

int arr[100002];

int main(){
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> arr[i];
    }
    
    vector<bool>visited(n+1, false);
    int idx = 1;
    int res = 0;
    bool visit = false;
    while(idx != 2){
        res += 1;
        if(!visited[idx]){
            visited[idx] = true;
            idx = arr[idx];
        }else{
            visit = true;
            break;
        }
    }
    
    if(!visit){
        cout << res << endl;
    }else{
        cout << -1 << endl;
    }
    
    
}


Measured memory_bytes: 4028
#include<stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    n=n%10;
    if(n==3)
    printf("bon");
    else if(n==0||n==1||n==6||n==8)
    printf("pon");
    else
    {
        printf("hon");
    }
    return 0;
    
}

Measured memory_bytes: 1716
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;cin>>s;
  ll l=s.length(),gcnt=0,pcnt=0,ans=0;
  rep(i,l) {if(s[i]=='g') gcnt++;else pcnt++;}
  if(l/2>pcnt) ans=l/2-pcnt;
  print(ans);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;

int n, table[200];
int dp[1000000], odddp[1000000];

int main()
{
	for (int i = 0; i < 183; ++i)table[i] = i * (i + 1) * (i + 2) / 6;
	for (int i = 0; i < 1000000; ++i){
		odddp[i] = 20000000;
		dp[i] = 20000000;
	}
	dp[0] = odddp[0] = 0;
	dp[1] = odddp[1] = 1;
	for (int i = 2; i < 1000000; ++i){
		for (int j = 1; table[j] <= i; ++j){
			dp[i] = min(dp[i], dp[i - table[j]] + 1);
			if (table[j] % 2)odddp[i] = min(odddp[i], odddp[i - table[j]] + 1);
		}
	}
	while (cin >> n){
		if (!n)return 0;
		cout << dp[n] << ' ' << odddp[n] << endl;
	}
}


Measured memory_bytes: 10912
program kadai
implicit none
integer(8)  ::  l,r
integer  ::  i,j,k
integer,allocatable  ::  ans(:)
integer  ::  mn


read(*,*) l,r

if (r/2019-l/2019>0) then
    write(*,*) 0
    stop
end if

l=mod(l,2019)
r=mod(r,2019)

allocate(ans(r*r))
ans=2020
k=1
if (l<r) then
do i=l,r
    do j=i+1,r
        ans(k)=mod(i*j,2019)
        k=k+1
    end do
end do
end if

if (l==r) then
    write(*,*) mod(l*r,2019)
    stop
end if

mn=minval(ans)
!write(*,*) ans
write(*,*) mn!,l,r

stop

end program kadai


Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;

const int RLEN=1<<18|1;
inline char nc() {
	static char ibuf[RLEN],*ib,*ob;
	(ib==ob) && (ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
	return (ib==ob) ? -1 : *ib++;
}
inline int rd() {
	char ch=nc(); int i=0,f=1;
	while(!isdigit(ch)) {if(ch=='-')f=-1; ch=nc();}
	while(isdigit(ch)) {i=(i<<1)+(i<<3)+ch-'0'; ch=nc();}
	return i*f;
}

const int N=4e5+50;
int n,q,mn[N],anc[N];
long long ans;

struct data {
	int x,y,w;
	data(int x,int y,int w) : x(x),y(y),w(w) {}
	friend inline bool operator <(const data &a,const data &b) {return a.w<b.w;}
};
vector <data> edge;

inline int ga(int x) {while(x!=anc[x]) x=anc[x]=anc[anc[x]]; return x;}
int main() {
	n=rd(), q=rd();
	for(int i=0;i<2*n;i++) mn[i]=0x3f3f3f3f;
	for(int i=1;i<=q;i++) {
		int x=rd(), y=rd(), w=rd();
		mn[x]=min(mn[x],w+1);
		mn[y]=min(mn[y],w+2);
		edge.push_back(data(x,y,w));
	}
	for(int i=1;i<2*n;i++) mn[i]=min(mn[i],mn[i-1]+2);
	for(int i=0;i<=n-1;i++) {
		int w=min(mn[i],mn[i+n]);
		int x=i%n, y=(i+1)%n;
		edge.push_back(data(x,y,w));
	} sort(edge.begin(),edge.end());
	for(int i=0;i<n;i++) anc[i]=i;
	for(auto v:edge) {
		int x=ga(v.x), y=ga(v.y);
		if(x==y) continue;
		ans+=v.w; anc[x]=y; 
	} cout<<ans<<'\n';
}

Measured memory_bytes: 10352
/*
{By GWj
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
#define check_min(a,b) a=min(a,b)
#define check_max(a,b) a=max(a,b)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
/*}
*/
LL sum[100000+20];
LL app[100000+20];
LL rest=0;
int main(){
	fastio;
	LL n,x,m;
	cin>>n>>x>>m;
	if(n<=200000){
		rb(i,1,n){
			rest+=x;
			x*=x;
			x%=m;
		}
		cout<<rest<<endl;
		return 0;
	}
	sum[1]=x;
	app[x]=1;
	int nn=1;
	while(1){
		x=x*x%m;
		if(app[x]){
			int len=nn-app[x]+1;
			rest=sum[app[x]-1];
			rest+=(n-(app[x]-1))/len*(sum[nn]-sum[app[x]-1]);
			int remi=(n-app[x]+1)%len;
			rest+=sum[app[x]+remi-1]-sum[app[x]-1];
			cout<<rest<<endl;
			break;
		}
		nn++;
		app[x]=nn;
		sum[nn]=sum[nn-1]+x;
	}
	return 0;
}


Measured memory_bytes: 4712
#include <stdio.h>
int main(void){
  int h,w,i,j;
  char s[101];
  scanf("%d%d\n",&h,&w);
  for (i=0;i<h;i++){
    scanf("%s",s);
    for (j=0;j<2;j++) printf("%s\n",s);
  }
  return 0;
}

Measured memory_bytes: 128
import math
import sys
import copy
input = sys.stdin.readline


N=int(input())

T=input()

S=[]
Wcount=0
Rcount=0
for i in range(N):
    S.append(T[i])
    if T[i]=="W":
        Wcount+=1
    else:
        Rcount+=1

search_count=min(Wcount,Rcount)
ans=0

pos=0
Rpos=N-1

#print(S)

while ans<search_count and pos!=Rpos:
    if S[pos]=="W":
        while pos!=Rpos:
            if S[Rpos]=="R":
                #print("kita")
                S[pos]="R"
                S[Rpos]="W"
                ans+=1
                pos+=1
                break
            else:
                Rpos-=1
    else:
        pos+=1

#print(S)




print(ans)
#print(Wcount,Rcount)

Measured memory_bytes: 10992
#include <iostream>
#include <map>

using namespace std;

int f(int n)
{
    return (n%2 == 0 ? n/2 : 3*n + 1);
}

int main()
{
    int start;
    cin >> start;

    const int NOT_FOUND = -1;
    map <int, int> visited;

    int answer = NOT_FOUND;

    visited[start] = true;
    int previous = start;

    for(int i = 2; answer == NOT_FOUND; i++)
    {
        int next = f(previous);

        if(visited[next])
        {
            answer = i;
        }

        visited[next] = true;
        previous = next;
    }

    cout << answer;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstring>
#include<vector>
using namespace std;
#define AMA (100000)
int N,M;
int S[100005];
int main(){
  scanf("%d %d",&N,&M);
  for(int i=2;i<=N;i++){
    int s;
    scanf("%d",&s);
    S[i]=S[i-1]+s;
  }
  int now = 1;
  int res = 0;
  for(int i=0;i<M;i++){
    int a;
    scanf("%d",&a);
    res += (abs(S[now+a]-S[now]));
    res%=AMA;
    now = now + a;
  }
  printf("%d\n",res);
}

Measured memory_bytes: 1576
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
vector<vector<int>>a;
vector<int>vis;
void dfs(int i);
long long modular_expo(long long x,long long y);

bool cmp(pair<double,int>p1,pair<double,int>p2)
{
    if(p1.first>p2.first)
        return true;
    else
    {
        if(p1.first<p2.first)
            return false;
        else if(p1.first==p2.first)
        {
            if(p1.second<p2.second)
                return true;
            else
                return false;
        }
    }
}
/*bool cmp1(map<int,int>a,map<int,int>b)
{
    if(a.first<b.first)
        return true;
    else
        return false;
}*/
ll m;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);


    ll n,q;
    cin>>n;
    int i;
    ll sum=0;
    vector<ll>a(n,0);
    vector<ll>freq(100005,0);
    for(i=0;i<n;i++)
        {
            cin>>a[i];
            freq[a[i]]++;
            sum+=a[i];
        }
        cin>>q;
    while(q)
    {
        q--;
        int x,y;
        cin>>x>>y;

        sum+=(freq[x]*y);
        sum-=(freq[x]*x);
        freq[y]+=freq[x];
        freq[x]=0;
        cout<<sum<<endl;;

    }



}

long long modular_expo(long long x,long long y)
{

    if(y==0)
        return 1;
    if(y%2==0)
        return (modular_expo((x*x)%m,y/2))%m;
    if(y%2==1)
        return ((x%m)*modular_expo((x*x)%m,(y-1)/2))%m;


}


Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

bool fuck(char c){
    return (c == 'a' || c == 't' || c == 'c' || c == 'o' || c == 'd' || c == 'e' || c == 'r' || c == '@');
}

int main(){
    ll n,m;cin>>n>>m;
    vector<vector<ll>> s;
    rep(i,0,m){
        ll k;cin>>k;
        vector<ll> tmp;
        rep(j,0,k){
            ll t;cin>>t;t--;
            tmp.pb(t);
        }
        s.pb(tmp);
    }
    ll p[m];rep(i,0,m)cin>>p[i];
    ll res = 0;
  	//cout << (1<<n)+1<<endl;
    rep(i,0,(1<<n)){
        vector<ll> v;
        rep(j,0,n)if((i>>j) & 1)v.pb(j);
        ll light[m];rep(j,0,m)light[j]=0;
        rep(j,0,v.size()){
            rep(l,0,m){
                rep(k,0,s[l].size())if(s[l][k] == v[j])light[l]++;
            }
        }
      	//rep(j,0,m)cout<<light[j];
      	//cout<<endl;
        bool f = true;
        rep(j,0,m){
            if(light[j]%2 != p[j]){
                f = false;
                break;
            }
        }
        if(f) res++;
    }
    cout << res << ednl;
}




Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define print(x) cout << x << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

ll MOD = 1000000007;

int main()
{
    string s;
    cin >> s;
    ll N = s.size();
    ll cnt1 = 0;
    rep(i, N - 1)
    {
        if (s[i] == s[i+1]) {
            cnt1 += 1;
            if (s[i] == '0')
                s[i + 1] = '1';
            else
                s[i + 1] = '0';
        }
    }
    // ll cnt2 = 0;
    // rep(i, N - 1)
    // {
    //     if (s[i] == '0')
    //             s[i + 1] = '1';
    //         else
    //             s[i + 1] = '0';
    // }
    print(cnt1);
    return 0;
}


Measured memory_bytes: 512
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        string[] line2 = Console.ReadLine().Trim().Split(' ');
        var p1 = 0d; var p2 = 0d; var p3 = 0d;
        var wmax = 0d;
        for (int i = 0; i < n; i++)
        {
            var w = Math.Abs(double.Parse(line[i]) - double.Parse(line2[i]));
            wmax = Math.Max(wmax, w);
            p1 += w;
            var t = w * w;
            p2 += t;
            p3 += t * w;
        }
        Console.WriteLine(p1);
        Console.WriteLine(Math.Sqrt(p2));
        Console.WriteLine(Math.Pow(p3, 1 / 3d));
        Console.WriteLine(wmax);
    }
}



Measured memory_bytes: 9444
#include<stdio.h>

int main(){
  long long int N, A, B;

  scanf("%lld %lld %lld", &N, &A, &B);

  if(B - A <= 2){
    printf("%lld\n", N+1);
    return 0;
  }

  long long int have = 1;
  long long int i = 0;

  while(i < N){
    if(have < A){
      have++;
      i++;
    }
    else{
      have = have - A + B;
      i += 2;
    }
  }

  if(i == N) printf("%lld\n", have);
  else if(i == N+1){
    printf("%lld\n", have - B + A + 1);
  }

  return 0;
}


Measured memory_bytes: 128
n= int(input())
lista=[]
listanova=[]
for x in input().split():
	x= int(x)
	if x %2 ==0:
		lista.append(x)
for x in lista:
	if x %3==0 or x%5==0:
		listanova.append(x)

if len(lista)==len(listanova):
	print('APPROVED')
else:
	print('DENIED')


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
using namespace std;
const long long mod=1000000007;
int main()
{
    long long n,a[200005],i,j,s,m,total=0,d[200005];
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        total+=(a[i]%mod);
        total%=mod;
    }
    for(i=1;i<n;i++)
    {
        d[i]=total-(a[i]%mod);
        d[i]=((d[i]%mod)+mod)%mod;
        total=d[i];
    }
    total=0;
    for(i=1;i<n;i++)
    {
        total+=(((a[i]%mod)*d[i])%mod);
        total%=mod;
    }
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n,m;
  cin >> n >> m;
  int d[n+1],c[n+1];
  memset(d,0,sizeof(d));
  d[1]=1;
  fill(c,c+n+1,1);
  while(m--) {
    int x,y;
    cin >> x >> y;
    d[y]|=d[x];
    c[x]--,c[y]++;
    if(!c[x]) d[x]=0;
  }
  int ans=0;
  for(int i=1; i<=n; i++) ans+=d[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;

int dp[5050][5050];
int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    string s;
    cin >> n >> s;
    for(int i = n-1; i >= 0; --i){
        for(int j = n-1; j >= 0; --j){
            if(s[i] != s[j]) dp[i][j] = 0;
            else dp[i][j] = dp[i + 1][j + 1] + 1;
        }
    }
    int ans = 0;
    rep(i, n) rep(j, n){
        if (i >= j) continue; // i < j;
        int now = min(dp[i][j], j-i);
        chmax(ans, now);
    }
    print(ans);



}


Measured memory_bytes: 102308
#include <bits/stdc++.h>
using namespace std;

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/
//約数列挙配列生成
vector<int> divisor(int n){
    vector<int> ret;
    for(int i = 1; i * i <= n; i++){
        if(n % i == 0){
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    int n; cin >> n;
    int cnt = 0;
    for(int i = 1; i <= n; i+=2) {
        vi p = divisor(i);
        int pp = p.size();
        if(pp==8) cnt++;
    }

    cout << cnt << '\n';
    // printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
 
int main(){
	unsigned k;cin>>k;
     string s;
     cin>>s;
	 if(s.length()<=k) cout<<s<<endl;
     else{
     cout<<s.substr(0,k)+"..."<<endl;
     }
   return 0;
}


Measured memory_bytes: 3564
import bisect

s = list(input())
t = list(input())

dic = {}
for i, j in enumerate(s):
    if j in dic:
        dic[j].append(i)

    else:
        dic[j] = [i]

loop = 0
try:
    for i in range(len(t)):
        if i == 0:
            idx = dic[t[0]][0]

        else:
            lis = dic[t[i]]
            idx2 = bisect.bisect_right(lis, idx)
            if idx2 == len(lis):
                loop += 1
                idx = lis[0]

            else:
                idx = lis[idx2]
    # print(idx)

    print(len(s) * loop + idx + 1)
except:
    print(-1)

Measured memory_bytes: 8928
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll lcm(vector<ll> a, int p, ll ans = 1LL){
    if(p>=a.size())return ans;
    ans = a[p]/__gcd(ans, a[p])*ans;
    ans = lcm(a, p+1, ans);
    return ans;
}

int main(){
	int N; cin>>N;
	vector<ll> T(N);
	rep(i,N)cin>>T[i];
	cout<<lcm(T, 0)<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;cin>>n;
    ll ary[n];
    rep(i,n) cin >> ary[i];
    ll ruisekiwa[n+1];
    ruisekiwa[0] = 0;
    map<ll, ll> mp;
    mp[0] = 1;
    rep(i,n)
    {
        ruisekiwa[i+1] = ruisekiwa[i]+ary[i];
        if (mp.find(ruisekiwa[i+1])==mp.end())
        {
            mp[ruisekiwa[i+1]] = 1;
        }
        else
        {
            mp[ruisekiwa[i+1]]++;
        }
    }
    ll ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr)
    {
        ans += itr->second * (itr->second-1) / 2;
        // std::cout << "key = " << itr->first           // キーを表示
        //                 << ", val = " << itr->second << "\n";    // 値を表示
    }
    cout << ans << endl;

}


Measured memory_bytes: 15872
#include <iostream>                                       
using namespace std;                                      
                                                          
int main(){                                               
  int W,H,x,y,r;                                          
                                                          
  cin >> W >> H >> x >> y >> r;                           
                                                          
  if((y - r >= 0) && (y + r <= H) && (x - r >= 0) &&      
     (x + r <= W))                                        
    cout << "Yes" << endl;                                
  else                                                    
    cout << "No" << endl;                                 
                                                          
  return 0;                                               
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long double ld;
typedef long long ll;
const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;

// 繰り返し二乗法
ll mod_pow(ll x, ll a){
    if(a == 1) return x;
    // 指数aが奇数の時はx*x^(a-1)
    if(a % 2) return (x * mod_pow(x, a - 1)) % MOD;
    // 指数aが偶数の時はx^(a/2)
    ll t = mod_pow(x, a / 2);
    return (t * t) % MOD;
}

// フェルマーの小定理からxのMOD-2乗を計算
ll mod_inv(ll x){
    return mod_pow(x, MOD - 2);
}

// kまでの階乗計算
ll mod_perm(ll n, ll k){
    ll ret = 1;
    for(int i = 0; i < k; i++){
        ret = (ret * (n - i)) % MOD;
    }
    return ret;
}

// 二項係数(n = 1e9, k = 1e7まで対応可能))
ll mod_comb(ll n, ll k){
    ll a, b;
    // n - k + 1からnまでの積
    a = mod_perm(n, k);
    // k!
    b = mod_perm(k, k);
    return (a * mod_inv(b)) % MOD;
}


int main() {
    ll n, a, b; cin >> n >> a >> b;
    ll ans = (mod_pow(2, n) - 1 - mod_comb(n, a) - mod_comb(n, b)) % MOD;
    ans = (ans + MOD) % MOD;
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main()
{     
      char a,b;
      cin>>a>>b;
      while(a!='H'&&a!='D'&&b!='H'&&b!='D')
      {
           cin>>a>>b;
      }
      if(a=='H') 
      {
          cout<<b;
      }
      if(a=='D')
      {
            if(b=='H')
            {  cout<< a; }
             else
            {cout<<'H';} 
 
       }
      return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cerr << "\n\n" << "Time elapsed: " << \
					  (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
					  return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'

ll dp[105][100005];

int main()
{
	start_routine();
	fastio;
	

    ll n,W;cin>>n>>W;
    ll w[n+1],v[n+1],V=0;

    for(ll i=1;i<=n;i++)
    {
    	cin>>w[i]>>v[i];
    	V+=v[i];
    }

    for(ll i=0;i<=n;i++)
    {
    	for(ll j=0;j<=V;j++)
    	{
    		if(i==0 || j==0)
    		{
    			if(i==0)
    				dp[i][j]=inf;
    			if(j==0)
    				dp[i][j]=0;
    		}
    		else if(j>=v[i])
    			dp[i][j]=min(dp[i-1][j],w[i]+dp[i-1][j-v[i]]);
    		else
    			dp[i][j]=dp[i-1][j];
    	}
    }

    // for(ll i=0;i<=n;i++)
    // {
    // 	for(ll j=0;j<=V;j++)
    // 	{
    // 		if(dp[i][j]>=inf)
    // 			cout<<" * ";
    // 		else
    // 			cout<<dp[i][j]<<" ";
    // 	}
    // 	cout<<endl;
    // }

    ll ans=0;
    for(ll j=0;j<=V;j++)
    {
    	for(ll i=0;i<=n;i++)
    	{
    		if(dp[i][j]<=W)
    		{
    			ans=j;
    			break;
    		}
    	}
    }
    cout<<ans;

	end_routine();
}

Measured memory_bytes: 80128
#include <iostream>
#include <map>

typedef long long ll;

int main() {
	int n;
	std::cin >> n;
	ll sum = 0;
	std::map<ll, int> freq;
	freq[0]++;
	ll ans = 0;
	while(n--) {
		int t;
		std::cin >> t;
		sum += t;
		ans += freq[sum];
		freq[sum]++;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(){
	int n, k;
  	cin >> n >> k;
  	
  	int ans = 0;
  	while(n > 0){
    	n /= k;
      	ans++;
    }
  
  	cout << ans << endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define LOG1(a)			  cerr<< #a << " = " << (a) << "\n"
#define LOG2(a, b)		  cerr<< #a << " = " << (a) << ", " << #b << " = " << (b) << "\n"
#define endl "\n"

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const ll INF = 1e18;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int nax = 100 + 10;

int n, arr[nax][nax];
int main()
{
    ios::sync_with_stdio(0);
    int n = 3;
    for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) cin >> arr[i][j];
    for(int j = 1; j <= n; j++)
    {
        int num = arr[1][j];
        for(int i = 1; i <= n; i++)
        {
            arr[i][j] -= num;
        }
    }
    /*for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }*/
    bool f = 0;
    for(int j = 1; j <= n; j++)
    {
       for(int i = 1; i <= n; i++)
       {
           if(arr[i][j] != arr[i][1]) f = 1;
       }
    }
    if(!f)
    cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
using namespace std;

template<class T>
void in(vector<T>& V) {
	for (auto itr = V.begin(); itr != V.end(); itr++)cin >> *itr;
	return;
}

template<class T>
void out(vector<T>& V) {
	for (T& itr : V)cout << itr << endl;
	return;
}

int N, K,MOD = 1e9+7;
vector<int> A;

int main() {
	cin >> N >> K;
	A.resize(N);
	in(A);
	vector<vector<long long>> DP;
	DP.resize(N, vector<long long>(K + 1,0));
	for (int k = 0; k <= A[0]; k++) {
		DP[0][k] = 1;
	}
	for (int n = 1; n < N; n++) {
		DP[n][0] = 1;
		for (int k = 1; k <= A[n]; k++) {
			DP[n][k] = DP[n][k - 1] + DP[n - 1][k];
			DP[n][k] %= MOD;
		}
		for (int k = A[n] + 1; k <= K; k++) {
			DP[n][k] = DP[n][k - 1] + DP[n - 1][k] + MOD - DP[n - 1][k - A[n] - 1];
			DP[n][k] %= MOD;
		}
	}
	cout << DP[N-1][K] << endl;
	return 0;
}

Measured memory_bytes: 79488
#include <bits/stdc++.h>

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, k; cin >> n >> k;
  set<int> st;
  REP(i, k) {
    int d; cin >> d;
    REP(j, d) {
      int x; cin >> x;
      st.insert(x);
    }
  }
  cout << n - SZ(st) << endl;

}
























Measured memory_bytes: 3644
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

class UnionFind{
    public:
    vector<lint> par;
    UnionFind(lint n){
        par.resize(n);
        for(lint i=0; i<n; i++) par[i] = i;
    }
    lint root(lint x){
        if(par[x]==x) return x;
        else return par[x] = root(par[x]);
    }
    void unite(lint x, lint y){
        lint px = root(x);
        lint py = root(y);
        if(px==py) return;
        else{
            par[py] = px;
        }
        return;
    }
};
signed main(){
    int N, M; cin >> N >> M;
    UnionFind uf(N);
    for(int i=0; i<M; i++){
        int x, y, z;
        x--;
        y--;
        cin >> x >> y >> z;
        uf.unite(x, y);
    }
    set<lint> cnt;
    for(int i=0; i<N; i++){
        cnt.insert(uf.root(i));
    }
    cout << cnt.size() << endl;
    return 0;
}

Measured memory_bytes: 5760
#include <stdio.h>

int a,b,x ;

int main(void){
    
    scanf ("%d%d%d",&a,&b,&x) ;
    
    if ( a<=x && a+b>=x ){
        printf ("YES\n") ;
    } else {
        printf ("NO\n") ;
    }

    return 0 ;
}

Measured memory_bytes: 128