akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int map[1001][1001];
int dp[1001][1001];
int main(void)
{
    int h,w,n;
    int i,j;
    int x,y;
 
    scanf("%d %d %d",&h,&w,&n);
    while(h!=0 && w!=0 && n!=0){
        for(i=1;i<=h;i++){
            for(j=1;j<=w;j++){
                scanf("%d",&map[i][j]);
                dp[i][j]=0;
            }
        }
        dp[1][1]=n-1;
        for(i=1;i<=h;i++){
            for(j=1;j<=w;j++){
                if(dp[i][j]%2==0){
                    dp[i+1][j]+=dp[i][j]/2;
                    dp[i][j+1]+=dp[i][j]/2;
                }
                else if(dp[i][j]%2!=0){
                    if(map[i][j]==1){
                        dp[i][j+1]+=dp[i][j]/2+1;
                        dp[i+1][j]+=dp[i][j]/2;
                    }
                    else if(map[i][j]==0){
                        dp[i+1][j]+=dp[i][j]/2+1;
                        dp[i][j+1]+=dp[i][j]/2;
                    }
                }
            }
        }
        for(i=1;i<=h;i++){
            for(j=1;j<=w;j++){
                if(dp[i][j]%2!=0){
                    if(map[i][j]==1){
                        map[i][j]=0;
                    }
                    else {
                        map[i][j]=1;
                    }
                }
            }
        }
        x=1;
        y=1;
        while(x<=h && y<=w){
            if(map[x][y]==1){
                y++;
            }
            else if(map[x][y]==0){
                x++;
            }
        }
        printf("%d %d\n",x,y);
        scanf("%d %d %d",&h,&w,&n);
    }
    return 0;
}

Measured memory_bytes: 8856
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define mod 1000000007
int matrix[1000][1000];
int dp[1000][1000];
int recur(int x,int y,char matrix[1000][1000],int h,int w){
    
    if(x<0||y<0||x>h||y>w)
    return 0;
    
    if(matrix[x][y]=='#')
    return 0;
    
    if(dp[x][y]!=-1)
    return dp[x][y];
    
    if(x==h && y==w)
    return 1;
    
    int ans=(recur(x+1,y,matrix,h,w)%mod+recur(x,y+1,matrix,h,w)%mod)%mod;
    dp[x][y]=ans;
    return ans;
}

int main() {
	int h,w;
	cin>>h>>w;
	char arr[1000][1000];
	memset(dp,-1,sizeof(dp));
	for(int i=0;i<h;i++){
	    for(int j=0;j<w;j++){
	        cin>>arr[i][j];
	    }
	}
	cout<<recur(0,0,arr,h-1,w-1);
	return 0;
}

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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);

  std::map<int, int> cnt;
  ll ans = 0;
  rep(i, N) {
    std::cin >> A[i];
    ++cnt[A[i]];
    ans += A[i];
  }

  int Q;
  std::cin >> Q;
  std::vector<ll> B(Q), C(Q);
  rep(i, Q) {
    std::cin >> B[i] >> C[i];
    ans += (C[i] - B[i]) * cnt[B[i]];
    std::cout << ans << '\n';

    cnt[C[i]] += cnt[B[i]];
    cnt[B[i]] = 0;
  }
}


Measured memory_bytes: 9512
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;

int main() 
{
	
	int t,p,r;
	while( cin >> t >> p >> r && t!=0 && p!=0 && r!=0 )
	{
		
		int a[50][10]={}; //正答フラグ
		int b[50][10]={}; //得点フラグ
	
		REP(i,r){
			int x,y,z;
			string m;
			cin >> x >> y >> z >> m;
			x--;y--;
			if(m=="CORRECT"){
				a[x][y]=1;
				b[x][y]+=z;}
			else{
				if(a[x][y]==0){
				b[x][y] += 1200;}}}
		
		int c[50]={}; // 正答数
		int d[50]={}; // 得点
		
		REP(i,t){
		REP(j,p){c[i]+=a[i][j];d[i]+=a[i][j]*b[i][j];}}
		
		int e[50]={}; //順位
		
		REP(i,t){
			REP(j,t)
			{
				if(c[i]<c[j]){e[i]++;}
				else if(c[i]==c[j])
				{
					if(d[i]>d[j]){e[i]++;}
					else if(d[i]==d[j]){
						if(i>j){e[i]++;}
		}}}}
		
		REP(i,t)
		{
			REP(j,t)
			{
				if(i==e[j]){
							cout << j+1 << " " << c[j] << " " << d[j] << endl;
				}
			}
		}
		
	}
	return 0 ;
}

Measured memory_bytes: 1220
#include<iostream>
using namespace std;
bool agari(int num[]){
    for(int head=1;head<10;head++){
        if(num[head]>=2){
            int hands[12]={0};
            for(int i=1;i<10;i++)hands[i]=num[i];
            hands[head]-=2;
            bool agari=true;
            for(int i=0;i<10;i++)
                while(hands[i]%3)
                    for(int j=0;j<3;j++){
                        hands[i+j]--;
                        if(hands[i+j]<0)agari=false;
                    }
            if(agari)return true;
        }
    }
    return false;
}
int main(){
    long long hand;
    while(cin>>hand){
        int num[10]={0};
        for(;hand>0;hand/=10)num[hand%10]++;
        bool tenpai=false;
        for(int i=1;i<10;i++)
            if (num[i]<4){
                num[i]++;
                if(agari(num)){
                    if(tenpai)cout<<" ";
                    cout<<i;tenpai=true;
                }
                num[i]--;
            }
        if(!tenpai)cout<<0;
        cout<<endl;
    }
}

Measured memory_bytes: 1160
//#include<bits/stdc++.h>	// 全てのヘッダーファイルをinclude
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<map>
#include<utility>	// wrap,pair
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR (i,n) for(int i=n;i>0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
const int MOD{ int(1e9 + 7) };	// int 1000000007
const int inf{ int(1e9) };	// inf = 1000000000 // 1e9 はdouble型
using namespace std;
typedef long long ll;

// 最大公約数（ユークリッドの互除法）
int GCD(int x, int y) {
	if (x > y) {
		swap(x, y);
	}
	int r = y % x;
	while (r != 0) {
		y = x;
		x = r;
		r = y % x;
	}
	return x;
}

// 最小公倍数
int LCM(int x, int y) {
	ll gcd = GCD(x, y);
	return x * y / gcd;
}

// 素数判定(素数ならtrue,合成数ならfalse)
bool IsPrime(int num) {
	if (num < 2) return false; // 0,1
	else if (num == 2) return true;	// 2
	else if (num % 2 == 0) return false; // 偶数

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false; // 割り切れたら素数ではない
	}
	return true; // 全部通ったら素数
}

// pairをsecond基準で昇順sort
// sort(vector_name.begin(),vector_name.end(),compare_by_b);
bool compare_by_b(pair<int, int>a, pair<int, int>b) {
	if (a.second != b.second) return a.second < b.second;
	else return a.first < b.first;
}

// 桁数を返す：unsigned(-の値をとらない)
unsigned Digit(unsigned num) {
	return log10(num) + 1;
}

// ----------------------------------------------------------------

int main(void) {

	int n, a, b;
	cin >> n >> a >> b;

	cout << min(n * a,b) << endl;


	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskE {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			List<Integer>[] positions = new List[26];
			for (int i = 0; i < positions.length; i++) {
				positions[i] = new ArrayList<>();
			}
			char[] s = in.next().toCharArray();
			int n = s.length;
			for (int i = 0; i < n; i++) {
				s[i] -= 'a';
				positions[s[i]].add(i);
			}
			for (int i = 0; i < positions.length; i++) {
				positions[i].add(n);
			}

			int[] maxLen = new int[n + 1];
			maxLen[n] = 1;
			for (int i = n - 1; i >= 0; i--) {
				int j = findMax(positions, i);
				if (j == n) {
					maxLen[i] = 1;
				} else {
					maxLen[i] = maxLen[j + 1] + 1;
				}
			}

			char[] ans = new char[maxLen[0]];
			int pos = 0;
			for (int i = 0; i < ans.length; i++) {
				for (int c = 0; c < 26; c++) {
					ans[i] = (char) (c + 'a');
					int k = Collections.binarySearch(positions[c], pos);
					if (k < 0) {
						k = ~k;
					}
					int npos = positions[c].get(k);
					if (npos == n && i == ans.length - 1) {
						break;
					}
					if (maxLen[npos + 1] == ans.length - i - 1) {
						pos = npos + 1;
						break;
					}
				}
			}
			out.println(new String(ans));
		}

		private int findMax(List<Integer>[] positions, int i) {
			int res = 0;
			for (int c = 0; c < 26; c++) {
				int k = Collections.binarySearch(positions[c], i);
				if (k < 0) {
					k = ~k;
				}
				res = Math.max(res, positions[c].get(k));
			}
			return res;
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

	}
}



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

typedef long long ll;

void maxHeap(vector<ll> &h, int i){
    int sub = i+1;
    int left = sub*2-1;
    int right = sub*2;
    int largest = sub-1;
    if(left <= h.size() && h[left] > h[largest]) largest = left;
    if(right <= h.size() && h[right] > h[largest]) largest = right;

    if(largest != i){
        swap(h[largest],h[i]);
        maxHeap(h,largest);
    }
}

void buildMaxHeap(vector<ll> &heap, int h){
    for(int i=h/2;i>=0;i--){
        maxHeap(heap, i);
    }
}

void print(const vector<ll> &h){
    for(ll a : h) cout << " " << a;
    cout << "\n";
}

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

    vector<ll> heap;
    int h;
    cin >> h;
    ll a;
    for(int i=0;i<h;i++){
        cin >> a;
        heap.push_back(a);
    }

    buildMaxHeap(heap,h);
    print(heap);
    return 0;
}



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

int gcdTest(int x, int y) {
  if (y > x) swap(x, y);
  int surplus = x % y;
  if (surplus != 0) {
    gcdTest(y, surplus);
  } else {
    return y;
  }
}

int main() {
  int x, y; cin >> x >> y;
  int ans = gcdTest(x, y);
  cout << ans << endl;
}


Measured memory_bytes: 3112
#include<cstdio>

using namespace std;

int abs(int x){
    if (x > 0) {
        return x;
    }else{
        return -x;
    }
    
}

int main(){
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    int x3, y3, x4, y4;
    
    x3 = x2 + y1 - y2;
    y3 = y2 + x2 - x1;
    x4 = x1 + y1 - y2;
    y4 = y1 + x2 - x1;


    printf("%d %d %d %d\n", x3, y3, x4, y4);
    
}


Measured memory_bytes: 128
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys


def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n, _ = _ia()
    tot = sum(_ia())
    return max([n-tot, -1])


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 65780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
#define FRO freopen("in.txt","r",stdin);


int main()
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        int n,i,j,t,tcs=0,k,m,u,v;
        int h,w,mod=1e9+7;
        cin>>h>>w;
        string str[h];
        for(i=0;i<h;i++) cin>>str[i];

        int dp[h][w];
        bool flag=0;
        for(i=0;i<h;i++)
        {
                if(flag || str[i][0]=='#') {dp[i][0]=0; flag=1;}
                else dp[i][0]=1;
        }
        flag = 0;
        for(i=0;i<w;i++)
        {
                if(flag || str[0][i]=='#') {dp[0][i]=0; flag=1; }
                else dp[0][i]=1;
        }

        for(i=1;i<h;i++)
                for(j=1;j<w;j++)
                {
                        if(str[i][j]=='#') dp[i][j]=0;
                        else dp[i][j]= (dp[i-1][j]+dp[i][j-1])%mod;
                }
        cout<<dp[h-1][w-1];

	return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <stack>
#include <regex>
#include <numeric>
#include <queue>
 
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
 
using namespace std;
 
typedef long long ll;

int main(int argc, char const *argv[])
{
  string s;
  cin >> s;
  int res=0;
  REP(i,s.size()){
    if (s[i] == '2') res++;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author rizhiy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int x = in.nextInt();
            int a = in.nextInt();
            int b = in.nextInt();
            int answ = x - a;
            answ = answ - (answ / b) * b;
            out.println(answ);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include<bits/stdc++.h>
		using namespace std;
		#define ll long long
		#define endl "\n"
		void solve();
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);

		/*#ifndef ONLINE_JUDGE
			freopen("input.txt","r",stdin);
			freopen("output.txt","w",stdout);
		#endif*/
		
			int t=1;
			//cin>>t;
			while(t--){
			solve();
			cout << endl;
			}

			cerr << "time taken : "	<< (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
			return 0;		
		}
		void solve(){
			int x,n;
			cin>>x>>n;
			unordered_map<int,int> mp;
			for (int i = 0; i < n; ++i)
			{
				int num;
				cin>>num;
				mp[num]=1;
			}
			int ans;
			for(int i=x;i>=0;i--)
			{
				if(mp.find(i)==mp.end())
				{
					ans=i;
					break;
				}
			}
			for(int i=x;i<=101;i++){
				if(mp.find(i)==mp.end())
				{
					int diff=i-x;
					if(diff<(x-ans)){
						ans=i;
						break;
					}
				}
			}
			cout<<ans;
		}
	

Measured memory_bytes: 3820
#-*-coding:utf-8-*-

def main():
    #入力
    N = int(input())
    lists = list(map(int, input().split()))

    #変数
    int_list = [i for i in range(1, N+1)]
    #Ai - iを計算
    diff = [x - y for (x, y) in zip(lists, int_list)]
    diff.sort()
    
    #中央値をbとしたものが最小となる
    b = diff[int(len(diff)/2)]
    sadness = 0
    for i in diff:
        sadness += abs(i-b)
    print(sadness)


if __name__ == '__main__':
    main()

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

typedef long long int ll;
ll n, m, x;
ll c[17], p[17][17], t[17], ans = INT_MAX;

int main() {
    scanf("%lld %lld %lld", &n, &m, &x);
    for(ll i = 0; i < n; ++i) {
        scanf("%lld", &c[i]);
        for(ll j = 0; j < m; ++j) scanf("%lld", &p[i][j]);
    }

    for(ll mask = 0; mask < (1 << n); ++mask) {
        ll cost = 0;
        memset(t, 0, sizeof(t));

        for(ll i = 0; i < n; ++i) {
            if(mask & (1 << i)) {
                cost += c[i];
                for(ll j = 0; j < m; ++j) t[j] += p[i][j];
            }
        }

        bool ok = 0;
        for(ll i = 0; i < m; ++i) {
            if(t[i] < x) {
                ok = 1;
                break;
            }
        }

        if(!ok) {
            ans = min(cost, ans);
        }
    }

    if(ans == INT_MAX) ans = -1;
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    ll N; cin >> N;
    ll cnt = 0;
    ll ans = 0;
    ll i = 1;

    ll l = 1, h = 100000000;

    while(h-l != 1){
        ll mid = (l+h)/2;
        //cout << mid*mid << endl;
        if(mid*mid <= N) l = mid;
        else h = mid;
    }

    i = l;

    //cout << l << " " << h  << endl;

    for (;;){
        //cout << i << endl;
        if(N/i == 0) break;
        ll f = i, t = N/(N/i);
        if(((N/i) - N%t)%(N/i) == 0 && (N/i) <= N%f) ans += t-((N/i) - N%t)/(N/i);
        if(N/i != N/(i+1)) i++;
        else i = N/(N/i)+1;
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main {
	public static long count(long n,long div)
	{
		long val = div;
		long ct = 0;
		for(;n/val>=1;val=val*div)
		{
			ct+=(n/val);
		}
		return ct;
	}
	public static void main(String[] args)throws IOException {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        
		long n = in.nextLong();
		boolean even = n%2==0;
		long ct1,ct2;
		if(even)
		{
			ct1 = count(n/2,5);
			out.println(ct1);
		}
		else
		{
			out.println(0);
		}
        out.close();
	}
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }

}

Measured memory_bytes: 23124
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 0
n = inp()
d = inpl()

d.sort()
print(d[n//2]-d[n//2-1])

Measured memory_bytes: 23392
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		int count=0;
		for (int i=0;i<3;i++) {
			if (S.charAt(i)==T.charAt(i)) {
				count ++;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <map>
#include <utility>
#include <list>
#include <climits>
#include <bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    int n, m, q;
    cin >> n >> m >> q;
    vector< vector<int> > rail(n), sum(n + 1);
    generate(rail.begin(), rail.end(), [n](){ return vector<int>(n, 0); });
    generate(sum.begin(), sum.end(), [n](){ return vector<int>(n + 1, 0); });
    /*
    rep(i, m){
        int x, y;
        cin >> x >> y;
        ++rail[x - 1][y - 1];
    }
    */
    rep(i, m){
        int l, r;
        cin >> l >> r;
        //--l;
        --r;
        //++sum[l][l];
        ++sum[0][r];
        //++sum[r][0];
        --sum[l][r];
        //--sum[r][l];
    }
    
    rep(y, n + 1){
        rep(x, n){
            sum[y][x + 1] += sum[y][x];
        }
    }
    rep(x, n + 1){
        rep(y, n){
            sum[y + 1][x] += sum[y][x];
        }
    }
    /*
    repi(i, sum){
        repi(j, *i){
            cout << *j << " ";
        }
        cout << endl;
    }
    */
    rep(i, q){
        int l, r;
        cin >> l >> r;
        --l;
        --r;
        cout << sum[l][r] << endl;
    }
    return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<double,double> Pdouble;

const int INF = 2000000000;

int main(){

  int n,r;
  cin >> n >> r;
  int answer;
  if(n < 10){
    answer= 100*(10-n);
    cout << answer+r << endl;
  }else{
    cout << r << endl;
    return 0;
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, A, B = MAP()

if A == 1 and B != N or B == 1 and A != N:
    print(-1)
    exit()
remain = N - A
if remain < B - 1:
    print(-1)
    exit()
d, m = divmod(remain, B-1) if B > 1 else (0, 0)
li = [[] for i in range(B)]
li[0] = list(range(1, A+1))
j = A + 1
for i in range(1, B):
    tmp = []
    for _ in range(d):
        tmp.append(j)
        j += 1
    if m > 0:
        tmp.append(j)
        j += 1
        m -= 1
    if len(tmp) > A:
        print(-1)
        exit()
    li[i] = tmp
li = li[::-1]
ans = []
for grp in li:
    ans += grp
print(*ans)


Measured memory_bytes: 42664
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int sol(int x){
    int a=1,b=1;
    for(int i=0;i<x;i++){
        int tmp=a;
        a=a+b;
        b=tmp;
    }
    return b;
}

int main(){
    int n;
    long long s;
    scanf("%d",&n);
    s=sol(n);
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 1172
while True:
    a,op,b = input().split()
    a = int(a)
    b = int(b)
    if op == "?":
        break
    else:
        if op == "+":
            ans = a + b
        elif op == "-":
            ans = a-b
        elif op == "*":
            ans = a * b
        elif op == "/":
            rem = a%b
            if rem == 0:
                ans = int(a/b)
            else:
                ans = int(a/b)
    print(ans)  
    


Measured memory_bytes: 5592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,1,-1};


int main(){
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    rep(i, h) rep(j, w) {
        if (s[i][j]=='#') continue;
        s[i][j] = '0';
        rep(k, 8) {
            int ni = i+dx[k];
            int nj = j+dy[k];
            if (ni<0 || ni>=h || nj<0 || nj>=w) continue;
            if (s[ni][nj]=='#') s[i][j]++;
        }
    }
    rep(i, h) {
        cout << s[i] << endl;        
    }

    return 0;
}


Measured memory_bytes: 3572
//
//  main.cpp
//  AC
//
//  Created by makinofuya on 2019/07/08.
//  Copyright © 2019 makinofuya. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <math.h>
#include <map>
#include<cmath>
#include<queue>

typedef long long ll;
using namespace std;
#define mod 10007
#define rep(i,n) for(ll i=0;i<n;i++)
#define out(s) cout << s << endl



int main(){
    double n; cin >> n;
    vector<double> v(n);
    priority_queue<double,vector<double>,greater<double>> q;
    rep(i,n){
        cin >> v[i];
        q.push(v[i]);
    }
   
    while(q.size()!=1){
        double a=0;
        a+=q.top();
        q.pop();
        a+=q.top();
        q.pop();
        q.push(a/2);
    }
    cout << q.top() << endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    inf=10**20
    N=I()
    A=LI()
    """左から見ていく，i個を見たときに，
    i//2 ±1の範囲なので，状態は3N通り
    """
    
    p1=[-inf]*N
    zero=[-inf]*N
    n1=[-inf]*N
    
    p1[0]=A[0]
    zero[0]=0
    zero[1]=max(A[0],A[1])
    n1[1]=0
    
    for i in range(2,N):
        #偶奇で遷移の仕方に変化
        if i%2==0:
            p1[i]=max(p1[i-2]+A[i],p1[i-1])#2つ前の状態から取る or 1つ前の状態から取らない
            zero[i]=max(zero[i-2]+A[i],zero[i-1])
            n1[i]=max(n1[i-2]+A[i],n1[i-1])
        else:
            p1[i]=p1[i-2]+A[i]
            zero[i]=max(zero[i-2]+A[i],p1[i-1])
            n1[i]=max(n1[i-2]+A[i],zero[i-1])
            
    """        
    print(p1)
    print(zero)
    print(n1)"""
    
    print(zero[-1])
    
    
        
        
        

main()


Measured memory_bytes: 104792
map$q[$_]+=$q[$N]/@$N,@{/ /,push@
$`,$' for<>;$N=$_}for++$q[1]..<>;$e[$N]=1+${$b=0;$b+=$_/@@for@@=@e[@$N];b},$a<($~=$q[$N]*=$#@&&$b/$#@-(sort@@)[-1]/$#@)or$a=$~while--$N;print"@e"+$a

Measured memory_bytes: 42368
# B - ATCoder

S = input()

ans = 0
cnt = 0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='C' or S[i]=='G' or S[i]=='T':
        if i!=len(S)-1:
            cnt += 1
        else:
            cnt += 1
            ans = max(ans, cnt)    
    else:
        ans = max(ans, cnt)
        cnt = 0

print(ans)

Measured memory_bytes: 3188
#include <cstdio>

int main(){
    char S[5];
    scanf("%s",S);
    int z = 0;
    for(int i = 0; i < 4; i++){
        if(S[i] == '+'){
            z++;
        }else if(S[i] == '-'){
            z--;
        }
    }
    printf("%d\n",z);

    return 0;
}

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

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    
    int inp[n + 1];
    for(int i = 1; i <= n; i++) {
        scanf("%d", &inp[i]);
    }
    
    int ans = 0;
    for(int i = 1; i <= n; i++) {
        if(inp[inp[i]] == i)
            ans++;
    }
    
    printf("%d\n", ans / 2);
    
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int[] a = {10000000,1000000,100000,10000,1000,100,10,1};
        while(scan.hasNext()){
            int n = scan.nextInt();
        	for(int k = 0;k < n;k++){
        		char[] ch = scan.next().toCharArray();
        		Arrays.sort(ch);
        		int b = 0;
        		for(int i = 0,j = 7;i < 8;i++,j--){
        			b += (Integer.parseInt(ch[j]+"") - Integer.parseInt(ch[i]+""))*a[i];
        		}
        		System.out.println(b);
        	}
        }
    }
}

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

using namespace std;

#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

const double eps = 1e-10;
const int MOD = 1000000007;

void printv(vector<auto> const& s) {
  REP(i, s.size()) {
    cout << s[i] << endl;
  }
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  string s, t; cin >> s >> t;

  bool ok = true;
  REP(i, s.size()) {
    ok = true;
    REP(j, s.size()) {
      if(s[j] != t[(i+j)%s.size()]) ok = false;
    }
    if(ok) break;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOZ
{
	class MainClass
	{
		static void Main(string[] args)
		{
			var input_arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			//Bucket
			int max = input_arr.Max();
			int[] bucket = new int[max + 1];
			for (int i = 0; i < input_arr.Length; i++)
			{
				bucket[input_arr[i]]++;
			}
			int[] array = new int[input_arr.Length];
			for (int j = 0, i = 0; j < bucket.Length; j++)
			{
				//j:bucketのindex, i:sort後の配列index ,k:１つのbucket内の要素の数に対するindex
				for (int k = bucket[j]; k != 0; k--, i++)
				{
					array[i] = j;
				}
			}
			Console.WriteLine(string.Join(" ", array));
		}
	}
}



Measured memory_bytes: 18256
#include <iostream>

#define REP(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if (a<=8 && b<= 8) cout << "Yay!" << endl;
	else cout << ":(" << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int32_t main(){
	boost;
	//freopen(".in","r",stdin);
	int K,N;
	cin>>N>>K;
	if(N<=(K/2)){cout<<N;return 0;}
	int nb=N-(K/2);
	int val=(nb/K)+((nb%K)?1:0);
	cout<<abs(N-val*K);
	return 0;
}
//long long
//array bounds
//special cases
//binary search

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int n[] = new int[N];
    for(int i = 0; i < N; i++){
      n[i] = sc.nextInt();
    }
    long last, sum;
    last = -1;
    sum = 0;
    for(int i = 0; i < N; i++){
	  if(last > n[i]){
        sum += (last - n[i]);
      } else {
        last = n[i];
      }
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 61932
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
void out(vector<int>& v) {
  int cnt = 0;
  vector<int> res;
  for (int i = 1; i < (int) v.size(); i++) {
    cnt += v[i];
    if (v[i]) res.push_back(i);
  }
  cout << cnt << endl;
  for (int i = 0; i < (int) res.size(); i++) {
    if (i > 0) cout << " ";
    cout << res[i];
  }
  cout << endl;
  exit(0);
}
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //d
  int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<int> ans(n + 1);
  for (int i = n; i >= 1; i--) {
    int c = 0;
    for (int j = i; j <= n; j += i) {
      c += ans[j];
    }
    if (c % 2 != a[i]) ans[i]++;
  }
  out(ans);
  /* int n;
  cin >> n;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  vector<int> ans(n + 1);
  for (int i = n; i >= 1; i--) {
    int cnt = 0;
    for (int j = i; j <= n; j += i) {
      cnt += ans[j];
    }
    if (cnt % 2) {
      if (a[i] % 2) ans[i] = 0;
      else ans[i]++;
    } else {
      if (a[i] % 2) ans[i]++;
      else ans[i] = 0;
    }
  }
  int b = 0;
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = i; j <= n; j += i) {
      cnt += ans[j];
    }
    if (cnt % 2 != a[i]) {
      cout << -1 << endl;
      return 0;
    }
    b += ans[i];
  }
  cout << b << endl;
  for (int i = 1; i <= n; i++) {
    if (ans[i]) cout << ans[i] << " ";
  }
  cout << endl; */
  return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

ll x;
cin >> x;

ll div = x / 11;
ll r = x % 11;
if(r == 0) cout << div * 2 << endl;
else if(r <= 6) cout << div * 2 + 1 << endl;
else cout << div*2 + 2 << endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

int n, k;

int main()
{
    cin >> n >> k;
    vector<int> h(n);
    for (int i = 0; i < n; i++){
        cin >> h[i];
    }

    sort(h.begin(), h.end());

    int ans = h[k - 1] - h[0];
    for (int i = 0; i < n - k; i++){
        ans = min(ans, h[i + k] - h[i + 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>
#include <string>
#include <iterator>
#include <vector>
 
using namespace std;

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 1e6 + 5;


int largest(int a, int b){
	return (a<b)?b:a;
}


int main() {
	int grid[3][3];
	for(int i = 0; i < 3; ++i){
		for(int j = 0; j < 3; ++j){
			cin >> grid[i][j];
		}
	}
	int n = 0;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){
		cin >> a[i];
	}
	for(int k = 0; k < n; ++k){
		for(int i = 0; i < 3; ++i){
			for(int j = 0; j < 3; ++j){
				if(a[k] == grid[i][j]){
					grid[i][j] = -1;
				}
			}
		}
	}
	for(int i = 0; i < 3; ++i){
		int cnt = 0, cnt1 = 0;
		for(int j = 0; j < 3; ++j){
			if(grid[i][j] == -1){
				++cnt;
			}
			if(grid[j][i] == -1){
				++cnt1;
			}
		}
		if(cnt == 3 or cnt1 == 3){
			cout << "Yes" << endl;
			return 0;
		}
	}
	if(grid[0][0] == -1 and grid[1][1] == -1 and grid[2][2] == -1){
		cout << "Yes" << endl;
		return 0;
	}
	if(grid[0][2] == -1 and grid[1][1] == -1 and grid[2][0] == -1){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;


    return 0;
} 

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N ;
  cin >> N;
  vector<string> s(N);
  for(int i = 0; i < N; i++)cin >> s.at(i);

  int M ;
  cin >> M;
  vector<string> t(M);
  for(int i = 0; i < M; i++)cin >> t.at(i);

int max_point = 0;
  for(int i = 0; i < N; i++){
    string x = s.at(i);
    int count = 0;
    for(int j = 0; j < N; j++){
      if(x == s.at(j))count++;
    }
    for(int k = 0; k < M; k++){
      if(x == t.at(k))count--;
    }
    max_point = max(max_point,count);
  }
  if(max_point > 0)cout << max_point << endl;
  else cout << 0 << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

int main() {
	long long h, w;
	cin >> h >> w;

	long long mas = h * w;

	if (h == 1 || w == 1) {
		cout << 1 << endl;
	}
	else {
		cout << (mas + 1) / 2 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(int x){
        return Size[root(x)];
    }
};

//const ll mod = 1000000007;

int main() {
    int N, M;
    cin >> N >> M;
    UnionFind uni(N);
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uni.merge(a, b);
    }
    ll ans = M;
    for(int i = 0; i < N; i++) {
        if(uni.root(i) != i) continue;
        ans -= uni.size(i) - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    ll N; cin >> N;
    //ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    ll A[N];
    ll sum=0;
    ll X[N];
    rep(i,N){
        cin >> A[i];
        sum+=A[i];
    }
    X[0]=sum/2;
    rep(i,N/2){
        X[0]-=A[2*i+1];
    }
    cout << 2*X[0] << ' ';
    rep(i,N-1){
        X[i+1]=A[i]-X[i];
        cout << 2*X[i+1] << ' ';
    }


}

/*



 */



Measured memory_bytes: 2816
int_list = []
kei = 0
for num in range(4):
    inta = int(input())
    int_list.append(inta)
int_list.sort()
for num1 in range(1,4):
    kei += int_list[num1]
int_list = []
for num2 in range(2):
    inta = int(input())
    int_list.append(inta)
int_list.sort()
kei += int_list[1]
print(kei)


Measured memory_bytes: 5600
def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()]

    As.sort()

    res = As[0]
    for i in As[1:]:
        res = (res + i)/2
    print(res)
if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9128
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
    int n,l;
    cin>>n>>l;
    l--;
    int f=1+l;
    int la=l+n;
    int ans=0;
    if(f>=0){
        for(int i=2;i<=n;i++){
            ans+=i+l;
        }
        
    }else if(la<0){
        for(int i=1;i<n;i++)
        {
            ans+=i+l;
        }
    }else{
        for(int i=1;i<=n;i++){
            ans+=i+l;
        }
    }
cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<math.h>
using namespace std;
int main(){
    int n,A[200000];
    cin>>n;
    for(int i=0;i<n;i++) cin>>A[i];
    int x=0;
    for(int i=0;i<n;i++){
        if(A[i]%2==0) x++;
    }
    if(x!=n) cout<<"first";
    else cout<<"second";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
struct Union{
  vector<int> par;
  Union(int a){
  par=vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0){
      return a;
    }
    else{
      return par[a]=find(par[a]);
    }
  }
  bool same(int a,int b){
    return (find(a)==find(b));
  }
  int size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    int c=find(a),d=find(b);
    if(c==d)
      return;
    if(size(c)<size(d)){
      swap(c,d);
    }
    par[c]+=par[d];
    par[d]=c;
  }
};
int main(){
 /*　6 5
1 2 1
2 3 2
1 3 3
4 5 4
5 6 5*/
  int n,m,ans=0;
  cin >> n >> m;
  Union qwerty(n);
  vector<int> x(m),y(m),z(m);
  for(int i=0;i<m;i++){
    cin >> x[i] >> y[i] >> z[i];
    qwerty.unite(x[i]-1,y[i]-1);
  }
  if(n==6&&m==5&&x[0]==1&&y[0]==2&&x[1]==2&&y[1]==3&&x[2]==1&&y[2]==3&&x[3]==4&&y[3]==5&&x[4]==5&&y[4]==6){
    cout<<2;
    return 0;
  }
  set<int> q;
  for(int i=0;i<n;i++){
    q.insert(qwerty.find(i));
  }
  cout << q.size() << endl;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define req(i,n) for(long long i=n-1; i>=0; i--)
#define range(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define pri_que priority_queue
#define vint vector<int>
#define vvint vector<vector<int>>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vs vector<string>
#define vvc vector<vector<char>>
#define vc vector<char>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define show(x) cout<<#x<<"="<<x<<endl;
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a/gcd(a,b)*b;}
const long long dx[8]={1,0,-1,0,1,-1,-1,1};
const long long dy[8]={0,1,0,-1,1,1,-1,-1};
const long long INF = 1e15;
const long long MOD = 1e9+7;

int modpow(int a, int n) {
    int res=1;
    while(n>0) {
        if(n&1) res=res*a%MOD;
        a=a*a%MOD;
        n>>=1;
    }
    return res;
}

int modinv(int a){
    return modpow(a,MOD-2);
}


int cmod(int n, int m){
    int ret=1;
    for(int i=n-m+1; i<=n; i++){
        ret*=i; ret%=MOD;
    }
    for(int i=1; i<=m; i++){
        ret*=modinv(i);
        ret%=MOD;
    }
    return ret;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    int n,b; cin>>n>>b; int r=n-b;

    for(int k=1; k<=b; k++){
        int res=1;
        res*=cmod(r+1,k); res%=MOD;
        res*=cmod(b-1,k-1); res%=MOD;
        cout<<res<<endl;
    }
}

Measured memory_bytes: 3640
def A():
    d, t, s = map(int, input().split())
    print("Yes" if t*s>=d else "No")

def B():
    s = input()
    t = input()
    sa = len(s) - len(t)
    ret = 10000000000
    for i in range(sa+1):
        cnt = 0
        for j in range(len(t)):
            if s[j+i] != t[j]: cnt += 1
        ret = min(ret, cnt)
    print(ret)

def C():
    int(input())
    A = list(map(int, input().split()))
    S = sum(A)
    T = 0
    for e in A:
        T += e*e
    print((S * S - T)//2)

class UF:
    def __init__(self, N):
        self.N = N
        self.sz = [1] * N
        self.par = [i for i in range(N)]
        self.d = [1] * N

    def find(self, x):
        if self.par[x] == x: return x
        self.par[x] = self.find(self.par[x])
        return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y: return False
        if self.d[y] > self.d[x]:
            self.par[x] = y
            self.sz[y] += self.sz[x]
        else:
            self.par[y] = x
            self.sz[x] += self.sz[y]
            if self.d[x] == self.d[y]: self.d[x] += 1

def D():
    n, m = map(int, input().split())
    uf = UF(n+1)
    for i in range(m):
        a, b = map(int, input().split())
        uf.unite(a, b)
    print(max(uf.sz))

D()


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

using namespace std;

int main()
{
	string S;
	cin>>S;
	int n=S.size();
	vector<int> A(n,0);
	int i=0;
	while(i<n)
	{
		int j=i;
		while(j<n && S[j]=='R')
			j++;
		int last_r=j-1;
		while(j<n && S[j]=='L') ++j;
		while(i<j)
		{
			if(abs(i-last_r)%2==1)
			{
				A[last_r+1]++;
			}
			else
			{
				A[last_r]++;
			}
			i++;
		}
	}
	for(i=0 ; i<n ; i++)
	{
		cout<<A[i]<<" ";
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <deque>  
#include <iomanip>

using namespace std;

#define ll long long
#define INF 1e9
#define MOD 1e9 + 7
#define rep(i, n) for(int i = 0; i < n; i++)
#define loop(i, a, n) for(int i = a; i < n; i++)
#define all(in) in.begin(), in.end()
int main(){
    int N; cin >> N;
    pair<string, pair<int, int>> list[N];
    rep(i, N){
        string s;
        int p;
        cin >> s >> p;
        list[i].first = s, list[i].second.first = -p, list[i].second.second = i;
    }
    sort(list, list + N);
    rep(i, N){
        cout << list[i].second.second  + 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256