akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.append(0)
ans = 0

for i in range(n):
    ans += b[a[i] - 1]
    if(a[i] + 1 == a[i+1]):
        ans += c[a[i]-1]

print(ans)

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

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

  int ans = 0;
  int sum = 0;
  int i = 1;
  while (n > sum) {
    ans ++;
    sum += i;
    i ++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast", "unroll-loops", "no-stack-protector")
#include <bits/stdc++.h>
#define pb push_back
#define MP make_pair
#define F first
#define S second
#define mem(x, y) memset((x), (y), sizeof(x))
#define loli ios::sync_with_stdio(0), cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename Ta, typename Tb>istream &operator>>(istream &in, pair<Ta, Tb> &p){ return in >> p.F >> p.S; }
template<typename Ta, typename Tb>ostream &operator<<(ostream &out, pair<Ta, Tb> &p){ return out << p.F << " " << p.S; }
template<typename T>void arr_print(T a, T b){ T i = a; for(cout << *i++; i != b; i++) cout << " " << *i; cout << "\n"; }
template<typename T>ostream &print(T a){ return cout << a << "\n"; }
template<typename T, typename... Args>ostream &print(T a, Args ...args){ cout << a << " "; return print(args...); }

//--------------------Main Code--------------------

int main() {loli
	int n;
	cin >> n;
	cout << 1000 * ((n + 999) / 1000) - n << "\n";
}

Measured memory_bytes: 3652
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    int L,N;
    cin >> N >> L;

    string S[N];

    for(int i = 0; i < N; i++)
    {
        cin >> S[i];
    }    
    sort(S, S + N);
    
    for(int i = 0; i < N; i++)
    {
        cout << S[i];
    }
    cout << endl;
}


Measured memory_bytes: 256
fn main() {
    let vec = read_line();

    // 0 0 1 2
    let mut sx : i32 = vec[0];
    let mut sy : i32 = vec[1];
    let mut tx : i32 = vec[2];
    let mut ty : i32 = vec[3];

    // 1 s-->t
    // 2 t-->s
    {
        // go ahead
        let h = (sy - ty).abs();
        let w = (sx - tx).abs();
        for _ in 0..h {
            print!("U");
        }
        for _ in 0..w {
            print!("R");
        }
        
        // go back
        for _ in 0..h {
            print!("D");
        }
        for _ in 0..w {
            print!("L");
        }
    }

    // 3 s-->t
    {
        sx = sx - 1;
        ty = ty + 1;
        let h = (sy - ty).abs();
        let w = (sx - tx).abs();
        print!("L");
        for _ in 0..h {
            print!("U");
        }
        for _ in 0..w {
            print!("R");
        }
        print!("D");
    }

    // 4 t-->s
    {
        sx = sx + 1;
        ty = ty - 1;

        sy = sy - 1;
        tx = tx + 1;

        let h = (sy - ty).abs();
        let w = (sx - tx).abs();
        print!("R");
        for _ in 0..h {
            print!("D");
        }
        for _ in 0..w {
            print!("L");
        }
        print!("U");
    }

    println!("");
}

fn read_line() -> Vec<i32> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v = s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();
    return v
}

/*
UUURRRDDDLLLLUUUURRRRDRDDDDLLLLU
UURRURRDDDLLDLLULUUURRURRDDDLLDL
*/

Measured memory_bytes: 4352
// AOJ 2110: Radio Base
// 2017.12.29 bal4u@uu

#include <stdio.h>

#define ABS(a) ((a)>=0?(a):-(a))

int x1, y1, x2, y2, x, y;
char buf[80], *p;

int in()
{
	int n = 0;
	if (*p == '-') {
		p++; while (*p >= '0') n = 10*n + (*p++ & 0xf);
		n = -n;
	} else while (*p >= '0') n = 10*n + (*p++ & 0xf);
	p++;
	return n;
}

int calc(int x, int y)
{
	int f = 0;
	if (x == x1 || y == y1 || ABS(x-x1) == ABS(y-y1)) f |= 1;
	if (x == x2 || y == y2 || ABS(x-x2) == ABS(y-y2)) f |= 2;
	return f;
}

int _chk(int x3, int y3)
{
	return x == x3 || y == y3 || ABS(x-x3) == ABS(y-y3);
}

int check()
{
	if (_chk(x1, y2) || _chk(x2, y1)) return 1;
	if (x2 > x1) {
		if (_chk(x2, y1+x2-x1) || _chk(x2, y1-(x2-x1))) return 1;
		if (_chk(x1, y2+x2-x1) || _chk(x1, y2-(x2-x1))) return 1; 
	} else {
		if (_chk(x2, y1+x1-x2) || _chk(x2, y1-(x1-x2))) return 1;
		if (_chk(x1, y2+x1-x2) || _chk(x2, y2-(x1-x2))) return 1;
	}
	if (y2 > y1) {
		if (_chk(x1+y2-y1, y2) || _chk(x1-(y2-y1), y2)) return 1;
		if (_chk(x2+y2-y1, y1) || _chk(x2-(y2-y1), y1)) return 1; 
	} else {
		if (_chk(x1+y1-y2, y2) || _chk(x1-(y1-y2), y2)) return 1;
		if (_chk(x2+y1-y2, y1) || _chk(x2-(y1-y2), y1)) return 1;
	}
	if (x1 == x2 || y1 == y2 || ABS(x1-x2) == ABS(y1-y2)) return 1;

	return 0;
}

int main()
{
	int n, x3, y3, f;

	fgets(p=buf, 10, stdin), n = in();
	while (n--) {
		fgets(p=buf, 80, stdin);
		x1 = in(), y1 = in(), x2 = in(), y2 = in(), x = in(), y = in();
		if (x == x1 && y == y1 || x == x2 && y == y2) { puts("0"); continue; }
		f = calc(x, y);
		if (f == 3) { puts("1"); continue; }
		if (f > 0 ) { puts("2"); continue; }

		f = check();
		if (!f) {
			if (y > y2) {
				y3 = y, x3 = x2 + y-y2;
				f |= (ABS(x3-x1) == ABS(y3-y1));
			} else {
				y3 = y, x3 = x2 + y2-y;
				f |= (ABS(x3-x1) == ABS(y3-y1));
			}
			if (x > x2) {
				x3 = x, y3 = y2 + x-x2;
				f |= (ABS(x3-x1) == ABS(y3-y1));
			} else {
				x3 = x, y3 = y2 + x2-x;
				f |= (ABS(x3-x1) == ABS(y3-y1));
			}
		}
		if (f) puts("3");
		else puts("4");
	}
	return 0;
}

Measured memory_bytes: 1736
mod = 10 ** 9 + 7
N, K = map(int, input().split())
M = max(K - 1, N - K + 1)
W = [1] * (M + 1)
for i in range(M):
	W[i + 1] = ((i + 1) * W[i]) % mod	
def rev(a):
	return pow(a, mod - 2, mod)	
def comb(a, b):
	if a >= b:
		return (W[a] * rev(W[b]) * rev(W[a - b])) % mod
	else:
		return 0
for i in range(K):
	s = comb(K - 1, i)
	t = comb(N - K + 1, i + 1)
	print(s * t % mod)

Measured memory_bytes: 3444
import java.io.*;
import java.util.*;

public class Main {
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        long k = in.nl();
        long ans = 0;
        if(k%2==0){
            ans = -1;
        }else{
            long x = 0;
            long d = 1;
            for (int i = 1; i <= k; i++) {
                x += (d * 7) % k;
                x %= k;
                d *= 10;
                d %= k;
                if (x == 0) {
                    ans = i;
                    break;
                }
            }
        }
        out.println(ans!=0?ans:-1);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 32800
#include <bits/stdc++.h>
#define PI 3.14159265358979323846264338327
#define NUM 1000000007
#define ss second
#define ff first
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	int n, k;
	string s;
	//cin >> n >> k;
	getline(cin >> ws, s);
	
	//s[k - 1] = tolower(s[k - 1]);
	int a = stoi(s.substr(0,2));
	int b = stoi(s.substr(2,2));
	if (a > 0 && a <= 12 && b > 0 && b <= 12)
		cout << "AMBIGUOUS\n";
	else if (a > 0 && a <= 12)
		cout << "MMYY\n";
	else if (b <= 12 && b > 0)
		cout << "YYMM\n";
	else cout << "NA\n";
	
	//cout << s << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#define LL long long
using namespace std;

int main()
{
	LL h,w;
	scanf("%lld%lld",&h,&w);
	if(h==w&&h==2)
	{
		printf("1\n");
	} 
	
	else if(h%3==0||w%3==0)
	{
		printf("0\n");
	}
	else
	{
		LL s=min(h,w);
		LL l=max(h,w);//一定大于等于3 
		LL ans=100000000000;
		//平行线
		ans=min(ans,s);
		//不是平行的
		//  把长的分成两段 
		LL x1=l/3;
		LL a1=x1*s;
		LL a2,a3;
		if(s%2==0)
		{
			a2=(l-x1)*(s/2);
			ans=min(ans,abs(a1-a2));
		}
		else
		{
			a2=(l-x1)*(s/2);
			a3=(l-x1)*(s/2+1);
			LL xx=min(a1,min(a2,a3));
			LL yy=max(a1,max(a2,a3));
			ans=min(ans,yy-xx);
		}
		
		x1++;
		a1=x1*s;
		if(s%2==0)
		{
			a2=(l-x1)*(s/2);
			ans=min(ans,abs(a1-a2));
		}
		else
		{
			a2=(l-x1)*(s/2);
			a3=(l-x1)*(s/2+1);
			LL xx=min(a1,min(a2,a3));
			LL yy=max(a1,max(a2,a3));
			ans=min(ans,yy-xx);
		}
		
		
		
		
		 l=min(h,w);
		s=max(h,w);//一定大于等于3 
		//平行线
		ans=min(ans,s);
		//不是平行的
		//  把长的分成两段 
		x1=l/3;
		a1=x1*s;
		if(s%2==0)
		{
			a2=(l-x1)*(s/2);
			ans=min(ans,abs(a1-a2));
		}
		else
		{
			a2=(l-x1)*(s/2);
			a3=(l-x1)*(s/2+1);
			LL xx=min(a1,min(a2,a3));
			LL yy=max(a1,max(a2,a3));
			ans=min(ans,yy-xx);
		}
		
		x1++;
		a1=x1*s;
		if(s%2==0)
		{
			a2=(l-x1)*(s/2);
			ans=min(ans,abs(a1-a2));
		}
		else
		{
			a2=(l-x1)*(s/2);
			a3=(l-x1)*(s/2+1);
			LL xx=min(a1,min(a2,a3));
			LL yy=max(a1,max(a2,a3));
			ans=min(ans,yy-xx);
		}
		
		 printf("%lld\n",ans);
	}
	return 0;
}

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

using namespace std;

int main() {
	// your code goes here
	
	int n;
	cin>>n; 
	
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int ans[n+1];
	
	memset(ans,0,sizeof(ans));
	
	vector<int>no;

	for(int i=n; i>=1 ; i--){
		
		int sum=0;
		
		for(int j= i *2; j<=n; j+=i ){
			sum+=ans[j];
			sum%=2;
		}

		if( (a[i] - sum)%2 !=0 ){
			ans[i]=1;
			no.push_back(i);
		}
	}

	cout<<no.size()<<endl;
	for(auto x:no)
		cout<<x<<" ";
	
	return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L;
  cin >> N >> L;
  vector<string> strings(N);
  for(int i=0; i<N; i++) cin >> strings.at(i);
  
  sort(strings.begin(), strings.end());
  for(int i=0; i<N; i++) cout << strings.at(i);
  cout << endl;
  return 0;
}


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

#define all(s) s.begin(), s.end()
#define vi vector<int>
#define pb push_back
#define ii pair<int, int>
#define x first
#define y second

const int N = 105;

int n, a[N];

int calc(int x) {
    int ans = 0;
    for (int i = 1; i <= n; i++) ans += (x - a[i]) * (x - a[i]);
    return ans;
}

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int mn = 1e9;
    for (int i = 1; i <= 100; i++) {
        mn = min(mn, calc(i));
    }
    cout << mn;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] a = new int[n]; 
		for(int i = 0; i < n; i++){
		    a[i] = sc.nextInt()-1;
		}
		
		
		// 計算
		int result = 0;
		result = func(a, new boolean[n], 0, 0);
		
		// 出力
		System.out.println(result);
	}
	
	public static int func(int[] a, boolean[] flg, int now, int cnt) {
	    if(now == 1) return cnt;
	    if(flg[a[now]]) return -1;
	    flg[a[now]] = true;
	    return func(a, flg, a[now], cnt + 1);
	}
}


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

int main ()
{
    int i, n[26] = {0}, c = 0;
    string a, b;
    cin >> a >> b;
    for(i=0; i<a.length(); i++)
        if(a[i] != b[i])
            c++;
    cout << c << endl;

    return 0;
}

Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
struct point{
	int a,b,c,d;
};
int n,m,q;
point query[55];
int arr[15];
int mx,call;
void f(int curr,int before){
	call++;
	for(int i=before; i<=m; i++){
		arr[curr] = i;
		if(curr==n){
			int sum = 0;
			for(int j=0; j<q; j++){
				point&k = query[j];
				if(arr[k.b]-arr[k.a] == k.c) sum+=k.d;
			}
			mx = max(mx,sum);
		}
		else f(curr+1,i);
	}
}

int main(){
	cin>>n>>m>>q;
	for(int i=0; i<q; i++){
		cin>>query[i].a>>query[i].b>>query[i].c>>query[i].d;
	}
	f(1,1);
	cout<<mx;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    vector<LL> ruiseki(n+1, 0);
    ruiseki[0] = 0;
    REP(i, n) ruiseki[i+1] += ruiseki[i] + a[i];

    LL ans = 0;
    map<LL, LL> mp;

    REP(i, n+1) mp[ruiseki[i] % m]++;

    REP(i, n){
        mp[ruiseki[i] % m]--;
        ans += mp[ruiseki[i] % m];
    }

    cout << ans << endl;
/*
    cout << "Ans.." << endl;
    REP(i, n){
        FOR(j, i, n){
            if((ruiseki[j] - (i != 0 ? ruiseki[i-1] : 0)) % m == 0){
                cout << i << " " << j << " " << ruiseki[j] - (i != 0 ? ruiseki[i-1] : 0) << endl;
            }
        }
    }
*/
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }

const int maxn = 300 + 7;

int n;
int a[maxn];
int cnt[3];
double dp[maxn][maxn][maxn];

double solve(int z, int o, int t) {
    if (z == n) return 0.0;

    if (dp[z][o][t] > -0.5) return dp[z][o][t];

    double num = n;
    if (o > 0) {
        num += o * solve(z+1,o-1,t);
    }
    if (t > 0) {
        num += t * solve(z,o+1,t-1);
    }
    int three = n - z - o - t;
    if (three > 0) {
        num += three * solve(z,o,t+1);
    }

    double den = n - z;
    return dp[z][o][t] = (num/den);
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    for (int i = 0; i < maxn; i++) {
        for (int j = 0; j < maxn; j++) {
            for (int k = 0; k < maxn; k++) {
                dp[i][j][k] = -1;
            }
        }
    }

    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        if (a[i] < 3) cnt[a[i]]++;
    }

    solve(cnt[0],cnt[1],cnt[2]);

    cout << fixed << setprecision(12) << dp[cnt[0]][cnt[1]][cnt[2]] << "\n";
    
    
    return 0;
}


Measured memory_bytes: 226432
import java.util.Scanner;

class Main {
    public static void main(String[] args) {

        Scanner scn = new Scanner(System.in);
        while (true){
            int num = scn.nextInt();
            int count = scn.nextInt();

            if(num == 0 && count == 0) break;

            int x[];
            x = new int[num];
            int tmp[];

            for(int i = 0; i < num; i++){
                x[i] = num - i;
            }
            
            for(int i = 0; i < count; i++){
                int num1 = scn.nextInt();
                int num2 = scn.nextInt();
                tmp = new int[num1  + num2 - 1];

                for(int j = num1 - 1; j < num1 + num2 - 1; j++){
                    tmp[j - (num1 - 1)] = x[j];
                }

                for(int j = num2; j < num1 + num2 - 1; j++){
                    tmp[j] = x[j - num2];
                }

                for(int j = 0; j < num1 + num2 - 1; j++){
                    x[j] = tmp[j];
                }
            }
            System.out.println(x[0]);
        }
    }
}


Measured memory_bytes: 37288
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 2000000009
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  int h,w,i,j;cin>>h>>w;
  vvint a(h+1,vint(w+1));
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      cin>>a[i][j];
    }
  }
  //caricurate
  int ans=0;vint p,q,r,s;
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(a[i][j]%2){
       if((i<h)&&(j<w)){
         if(a[i][j+1]%2){
           a[i][j]--;a[i][j+1]++;ans++;
           p.pb(i);q.pb(j);r.pb(i);s.pb(j+1);
         }else{
           a[i][j]--;a[i+1][j]++;ans++;
           p.pb(i);q.pb(j);r.pb(i+1);s.pb(j);
         }
       }else if(j<w){
         a[i][j]--;a[i][j+1]++;ans++;
         p.pb(i);q.pb(j);r.pb(i);s.pb(j+1);
       }else if(i<h){
         a[i][j]--;a[i+1][j]++;ans++;
         p.pb(i);q.pb(j);r.pb(i+1);s.pb(j);
       }
      }
    }
  }
  //output
  cout<<ans<<endl;
  for(int k=0;k<ans;k++){
  cout<<p[k]<<" "<<q[k]<<" "<<r[k]<<" "<<s[k]<<endl;
  }
}

Measured memory_bytes: 5220
n = int(input()) # n = จำนวน node ทั้งหมด
rt = {}
cs = [0 for i in range(n)]
for i in range(n):
    #เก็บค่าแต่ละตัวใน list
    #ตนข้อมูลที่ 0 คือ node
    #ตนข้อมูลที่ 1 คือ จำนวน children ของ node นั้นๆ
    #ตนที่2เป็นต้นไปคือ children
    id, k, *c = list(map(int, input().split()))
    for j in c:
    #การ update value ใน key เช่น node 0 มี 1 4 10 เก็บค่าใน dict
        rt[j] = id
        #print(rt)
    cs[id] = c
    
    #วน loop ตามจำนวน node
for i in range(n):
    print("node " + str(i) + ": parent = ", end = "")
    p = [i] # i ตั้งแต่ 0ถึงจนnode
    #check ว่าเป็น root หรือไม่
    while True:
        try:
            #เช่น rt 0 ก็เป็น 1 กับ 2
            #แล้วทำการ append 1 กับ 2
            
            #ถ้าเป็น root จะไม่ทำตรงนี้ เพราะไม่มี key ไหน = 0 จะ break
            #check จากตัวแรกใน dict ว่าถ้าเลขตรงกับ node
            #ก็จะ append แต่ถ้าไม่ ก็ไม่ append ทำให้ len(p)=1
            p.append(rt[p[-1]])
        except:
            break
    #เมื่อเป็น root parent = -1    
    if len(p) == 1:
        print("-1, depth = 0, root, ", end = "")
        print(cs[i])
    
    else:
        print(str(p[1]) + ", depth = " + str(len(p) - 1), end = "")
        #ถ้าไม่ได้เป็น root และกิ่งเป็น null     
        if cs[i] == []:
            print(", leaf, []")
        #ถ้าไม่ได้เป็น root และกิ่งนั้นมี children       
        else:
            print(", internal node, ",end = "")
            print(cs[i])



Measured memory_bytes: 23700
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 100000

int h,t,A1[N];
char A2[N][10];

void enqueue(char *l, int q)
{
  int i = 0;

  if(isFull()){
    fprintf(stderr,"overflow!\n");
    exit(2);
  }

  A1[t] = q;
  strcpy(A2[t],l);
  if(t + 1 == N) t = 0;
  else t++;
}

int dequeue()
{
  int f;

  if(isEmpty()){
    fprintf(stderr,"underflow!\n");
    exit(1);
  }

  f = h;
  if(h + 1 == N) h = 0;
  else h++;
 
  return f;
}

int isEmpty()
{
  return h == t;

}

int isFull()
{
  return h == (t + 1) % N;
}

void roundschedule(int d, int b)
{
  int i,num,s;
  int total = 0;
  char B[10];

  for(i=0;i<d;i++){
    scanf("%s%d",B,&num);
    enqueue(B,num);
  }

  while(!isEmpty()){
    num = dequeue();
    if(b>=A1[num]){
      total += A1[num];
      printf("%s %d\n",A2[num],total);
    }
    else{
      s = A1[num] - b;
      total += b;
      enqueue(A2[num],s);
    }
  }
}

int main()
{
  int n,m;
  scanf("%d%d",&n,&m);
  roundschedule(n,m);

  return 0;
}



Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll l,r;
    cin >> l >> r;
    int ans = 1000000;
    if(r-l >= 2019)cout << 0 << endl;
    else {
        r %= 2019;
        l %= 2019;
        if(r < l)r += 2019;
        for(int i = r;i > l;i--){
            for(int j = l;j < i;j++){
                ans = min(ans,(i % 2019)*(j % 2019)%2019);
            }
        }
        cout << ans << endl;
    }
    cin >> r;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        
        for(int i = a; i <= b; i++){
            if(c % i == 0){
                count++;
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 26416
import java.util.Scanner;


public class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextLine()) {
			String line = sc.nextLine();
			ByteSequence bs = new ByteSequence(line);
			System.out.println(bs.getBottommost());
		}
		sc.close();
	}
	
}

class ByteSequence{
	byte[] sequence;
	
	ByteSequence(byte[] bs){
		this.sequence = bs;
	}
	ByteSequence(String str){
		byte[] bs = new byte[str.length()];
		for(int i = 0; i < str.length(); i++) {
			bs[i] = Byte.valueOf(str.substring(i, i+1));
		}
		this.sequence = bs;
	}
	
	ByteSequence nextSequence() {
		byte[] result = new byte[sequence.length-1];
		for(int i = 0; i < sequence.length-1; i++) {
			result[i] = (byte) ((sequence[i] + sequence[i+1]) % 10);
		}
		return new ByteSequence(result);
	}
	
	byte getBottommost() {
		ByteSequence next = this.nextSequence();
		if(next.sequence.length == 1) return next.sequence[0];
		else return next.getBottommost();
	}
}

Measured memory_bytes: 26408
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void judgement(bool a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
vec diviserlist(ll N){
  ll i;
  vec res;
  for(i=1;i*i<N;i++){
    if(N%i==0){
      res.pb(i);res.pb(N/i);
    }
  }
  if(i*i==N)res.pb(i);
  vsort(res);
  return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll i,j,N,H,W,ans=inf;
  cin>>N;
  for(i=1;i*i<=N;i++){
    if(N%i==0){
      chmin(ans,N/i+i);
    }
  }
  ans=ans-2LL;
  cout<<ans<<endl;
  return 0;
}


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

int main()
{
  long long n, x;
  cin >> n >> x;
  vector<long long> a;
  for (int i = 0; i < n; i++) {
	long long t;
	cin >> t;
	a.push_back(t);
  }
  long long ans = 0;
  if (a[0] > x) {
	ans += a[0] - x;
	a[0] = x;
  }
  for (int i = 0; i < n - 1; i++) {
	long long  t = a[i] + a[i + 1];
	if (t > x) {
	  long long tmp = t - x;
	  ans += tmp;
	  if (a[i + 1] > 0) {
		if (a[i + 1] >= tmp) {
		  a[i + 1] -= tmp;
		}
		else {
		  a[i + 1] = 0;
		}
	  }
	}
  }
  cout << ans << endl;
  return 0;
}



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

int N;
string S[100];
int P[100];

int main() {
    cin >> N;
    rep(i, N) cin >> S[i] >> P[i];

    pair<pair<string, int>, int> p[100];
    rep(i, N) {
        p[i] = make_pair(make_pair(S[i], -P[i]), i);
    }

    sort(p, p + N);

    rep(i, N) {
        printf("%d\n", p[i].second + 1);
    }
}

Measured memory_bytes: 256
k,n = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
d = []
for i in range(n-1):
  d.append(a[i+1]-a[i])
d.append(k-a[n-1]+a[0])
d.sort()
for i in range(len(d)-1):
  ans += d[i]
print(ans)

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

using namespace std;

int L, R, N = 2019;
int has[3000];

int main(){
    cin >> L >> R;
    for(int i = L, c = 0; i<=R && c < 3*N; i++, c++){
        has[i%N]++;
    }
    int ans = 2019;
    for(int i= 0; i<N; i++){
        if(has[i] >= 2){
            ans = min(i*i%2019, ans);
        }
        for(int j = i+1; j<N; j++){
            if(has[i] && has[j]){
                ans = min(i*j%2019, ans);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

int getNum(string a,int &i){
  int res=0;
  while(isdigit(a[i]))res=res*10+a[i++]-'0';
  return res;
}

double getx(double R,double r){return sqrt((R+r)*(R+r)-(R-r)*(R-r));}


int n;
vector<double> num;
double mem[11][11][1<<12];
int used[11][11][1<<12];
double dfs(int l,int r,int sta){
  if(sta==(1<<n)-1)return 0;
  if(used[l][r][sta]++)return mem[l][r][sta];

  double res=INF;
  for(int i=0;i<n;i++){
    if((sta&(1<<i)))continue;
    double lcost=num[i]+getx(l,num[i])-l;
    double rcost=num[i]+getx(num[i],r)-r;
    res=min(res,lcost+dfs(num[i],r,sta|(1<<i)));
    res=min(res,rcost+dfs(l,num[i],sta|(1<<i)));
  }
  return mem[l][r][sta]=res;
}

int main(){
  string str;
  while(getline(cin,str)){
    int w,idx=0;
    w = getNum(str,idx);
    num.clear();
    while(idx++<str.size())num.push_back(getNum(str,idx));
    n = num.size();
    memset(used,0,sizeof(used));
    double mn=INF;
    for(int i=0;i<n;i++)mn=min(mn,2*num[i]+dfs(num[i],num[i],1<<i));
    cout<<(mn<=w? "OK":"NA")<<endl;
  }
  return 0;
}

Measured memory_bytes: 7124
#include <stdio.h>
int main(){
    int a[6],temp;
    char c;
    for(int i=0;i<6;i++)scanf("%d",&a[i]);
    while(scanf("%c",&c)!=EOF){
        if(c=='E'){
            temp=a[0];
            a[0]=a[3];
            a[3]=a[5];
            a[5]=a[2];
            a[2]=temp;
        }
        if(c=='W'){
            temp=a[0];
            a[0]=a[2];
            a[2]=a[5];
            a[5]=a[3];
            a[3]=temp;
        }
        if(c=='N'){
            temp=a[0];
            a[0]=a[1];
            a[1]=a[5];
            a[5]=a[4];
            a[4]=temp;
        }
        if(c=='S'){
            temp=a[0];
            a[0]=a[4];
            a[4]=a[5];
            a[5]=a[1];
            a[1]=temp;
        }
    }
    printf("%d\n",a[0]);
}

Measured memory_bytes: 2760
n, h, w  = list(map(int, input().split()))
a = []
for i in range(n):
    a.append(list(map(int, input().split())))

cnt = 0
for i in range(n):
    if a[i][0] >= h and a[i][1] >= w:
        cnt += 1
print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
//#include<iostream>
//#include<vector>
//#include<map>
//#include<math.h>
//#include<algorithm>

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define rrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

map<ll, ll> PrimeFactorial(ll n) 
{
    map<ll,ll> ret;
    
    for(ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while (n % i == 0) {
                ret[i]++;
                n /= i;
            }
        }
    }

    if(n > 1) { ret[n]++; }

    return ret;
}

int main(void)
{
    int n;
    cin >> n;
        
    ll cnt = 0;
    
    for(ll ab = 1; ab <= n-1; ab++) {
        auto mp = PrimeFactorial(ab);
        ll sum = 1;
        for(auto f : mp) {
            sum *= (f.se+1);
        }
        cnt += sum;
    }
    cout << cnt << endl;
    return 0;
} /*atcoder*/


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

int main(){
    int n,m ; cin >> n >> m;
    vector<vector<int>> edge(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--;b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    queue<int> que;
    que.push(0);
    vector<int> num(n,-1);
    num[0] = 0;
    while(que.size()){
        int x = que.front(); que.pop();
        for(auto y : edge[x]){
            if(num[y] != -1) continue;
            num[y] = x;
            que.push(y);
        }
    }
    cout << "Yes" << endl;
    rep(i,n-1) cout << num[i+1]+1 << endl;
}

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

using namespace std;

int tab[100020][3];



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


  for (int i=1;i<=n;i++)
  {
      cin>> tab[i][0] >> tab[i][1] >> tab[i][2];
      tab[i][0]+=max(tab[i-1][1],tab[i-1][2]);
      tab[i][1]+=max(tab[i-1][0],tab[i-1][2]);
      tab[i][2]+=max(tab[i-1][1],tab[i-1][0]);
  }

int wynik=max(tab[n][1],tab[n][2]);
 wynik=max(wynik,tab[n][0]);
cout << wynik;
}


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

int main() {
    int N, M, S, T;
    cin >> N >> M;
    vector<int>v(M);
    vector<int>u(M);
    for (int i = 0; i < M; ++i) {
      cin >> u[i] >> v[i];
    }
    cin >> S >> T;

    vector<int> graph[N+1];
    for (int i = 0; i < M; ++i) {
        graph[u[i]].push_back(v[i]);
    }

    // 各頂点にmod 3の初到達時刻fptの情報を持たせてBFS
    vector<vector<int>> fpt(N+1, vector<int>(3, -3));
    queue<pair<int, int>> que;
    que.push(make_pair(S, 0));
    fpt[S][0] = 0;
    while (! que.empty()){
        auto top = que.front();
        que.pop();
        int modT = (top.second + 1) % 3;
        for (int x : graph[top.first]) {
            if(fpt[x][modT] == -3){
                fpt[x][modT] = fpt[top.first][top.second] + 1;
                que.push(make_pair(x, modT));
            }
        }
    }
    cout << fpt[T][0] / 3 << "\n";
    return 0;
}

Measured memory_bytes: 11904
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    lint K,N;
    cin >> K >> N;
    lint A[N];
    rep(i,N) cin >> A[i];
    lint dis[N]={};
    rep(i,N-1) dis[i]=A[i+1]-A[i];
    dis[N-1]=(A[0]+K)-A[N-1];
    lint ans=K;
    rep(i,N) ans=min(ans,K-dis[i]);
    cout << ans << endl;
}

Measured memory_bytes: 3328
//
//AtCoder Beginner Contest 177
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>
#include <numeric>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


mint combination(int n, int a)
{
    mint x = 1;
    mint y = 1;
    REP(i, a){
        x *= n - i;
        y *= i + 1;
    }
    return x / y;
}

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

    vector<ll> a(n);
    mint sum=0;
    REP(i, n) {
        cin >> a[i];
        sum+=a[i];
    }
    mint ans = 0;
    REP(i, n){
        sum -= a[i];
        ans += sum*a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4660
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define endl "\n"
    #define ll long long int
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T=1;
        //cin>>T;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll n;
            cin>>n;
            ll a[n];
            for(ll i=0;i<n;i++)
                cin>>a[i];
            ll dp[n+1][n+1];
            for(ll l=n-1;l>=0;l--)
            {
                for(ll r=l;r<n;r++)
                {
                    if(l==r)
                        dp[l][r]=a[l];
                    else
                        dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
                }
            }
            cout<<dp[0][n-1];
        }
        return 0;
    }


Measured memory_bytes: 46464
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(int i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    long long N, W;
    cin >> N >> W;
    vector<long long> w(N), v(N);
    REP(i, N)
        cin >> w[i] >> v[i];

    vector<vector<long long>> dp(N+1, vector<long long>(W+1, 0));
    REP(i, N){
        dp[i+1] = dp[i];
        REP(j, W){
            long long to = j + w[i];
            if(to > W) continue;
            dp[i+1][to] = max(dp[i+1][to], dp[i][j] + v[i]);
        }
    }
    long long ans = 0;
    REP(i, W+1)
        ans = max(ans, dp[N][i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 80256
x=[0,0,0,0]
y=['AC','WA','TLE','RE']
y1=' x '
#y=['AC x ','WA x ','TLE x ','RE x ']

n=int(input())

for i in range(n):
    a=input()  
    for i in range(4):
        if a==y[i]:
            x[i]=x[i]+1
    
for i in range(4):
    x[i]=str(x[i])
    y[i]=y[i]+y1+x[i]
    print(y[i])


Measured memory_bytes: 9052
#include <iostream>
#include <map>
#include <cmath>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int N;
map<int, int> M;

bool check(){
    if(N%2==0){
        for(int i=1; i<N; i=i+2)
            if(M[i]!=2)
                return false;
    }else{
        if(M[0]!=1) return false;
        for(int i=2; i<N; i=i+2)
            if(M[i]!=2)
                return false;
    }
    return true;
}

map<int, int> memo;
//a^b (mod MOD)の計算
int power(int a, int b){
    if(b == 0) return 1;
    if(b == 1) return a%MOD;
    if(memo.count(b)!=0) return memo[b];
    if(b%2 == 0){
        ll t = power(a, b/2);
        t = t * t % MOD;
        memo[b] = t % MOD;
        return memo[b];
    } else {
        ll t = power(a, b/2);
        t = t * t % MOD;
        memo[b] = t * a % MOD;
        return memo[b];
    }
}

int main() {
    cin >> N;
    for(int i=0; i<N; i++){
        int a; cin >> a;
        M[a]++;
    }

    if(!check()) cout << 0 << endl;
    else cout << power(2, N/2) << endl;
    
    return 0;
}


Measured memory_bytes: 3200
// IO library
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>

// container library
#include <deque>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>

// namespace
using namespace std;

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VB> VVB;

// container
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define SORT(c) sort((c).begin(), (c).end())
#define GSORT(c) sort((c).begin(), (c).end(), greater<decltype((c).front())>())
#define SZ(x) ((int)(x).size())
#define MEMSET(c, v) memset((c), v, sizeof(c))

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define NREP(i, n) FOR(i, 1, n + 1)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define RREP(i, n) RFOR(i, n, 0)
#define RNREP(i, n) RFOR(i, n, 1)

// constant
// const ll MOD = 1e9 + 7;
// const int INF = 1e9;
// const ll INF = 1e15;
// const int dx[4] = {0, -1, 1, 0};
// const int dy[4] = {-1, 0, 0, 1};
// const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
// const int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1};

// debug
#define test(x) cout << #x << " = " << x << endl

// answer output
#define Yes(c) cout << ((c) ? "Yes" : "No") << endl;
#define YES(c) cout << ((c) ? "YES" : "NO") << endl;
#define possible(c) cout << ((c) ? "possible" : "impossible") << endl;
#define POSSIBLE(c) cout << ((c) ? "POSSIBLE" : "INPOSSIBLE") << endl;


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


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

  int n, m;
  cin >> n >> m;
  cout << (n - 1) * (m - 1) << endl;
  return 0;
}

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

public class  Main 
{
	public static void main(String arg[])
	{
		int a[] = new int[10];
		Scanner scan = new Scanner(System.in);
		for(int i = 0; i < 10; i++)
		{
			a[i]=scan.nextInt();		
		}
		Arrays.sort(a);
		for(int i=0; i<3; i++)
			System.out.println(a[10-i-1]);
	}

}

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

using ll = long long;
using namespace std;

const int INF = 1e9;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, w;
  cin >> n >> w;
  vector<ll> dp(w + 1, 0);
  for (int i = 0; i < n; ++i) {
    int weight, value;
    cin >> weight >> value;
    for (int j = w; j > 0; --j) {
      if (j - weight < 0)
        break;
      dp[j] = max(dp[j], dp[j - weight] + value);
    }
  }
  cout << dp[w] << '\n';
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>

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


int main(){
    
    int n,l;
    string s[100];
    cin >> n >> l;
    rep(i,n) cin >> s[i];

    sort(s,s+n);

    string ans ;
    rep(i,n){
        ans += s[i];
    }


    
    cout << ans << endl;

    return 0;
};



Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    static int[] nodes;
    static int size;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int q = in.nextInt();
        init(n);
        for (int i = 0; i < q; i++) {
            if (in.nextInt() == 0) {
                update(in.nextInt(), in.nextInt());
            } else {
                System.out.println(find(in.nextInt(), in.nextInt()));
            }
        }
    }
    static void init(int n) {
     size=1;
     while (size<n)
         size*=2;
     nodes = new int[size*2-1];
     for (int i=0;i<nodes.length;i++) {
         nodes[i] = Integer.MAX_VALUE;
     }
 }
 static void update(int target, int value) {
     int up = size-1 + target;
     nodes[up] = value;
     if (up==0) return;
     up = (up-1)/2;
     while (true) {
         nodes[up] = Math.min(nodes[up*2+1], nodes[up*2+2]);
         if (up==0)
             break;
         up = (up-1)/2;
     }
 }
 static int find(int s, int t) {
     return _find(s, t, 0, 0, size-1);
 }
 static int _find(int s, int t, int node, int node_s, int node_t) {
     if (t<node_s||s>node_t)
         return Integer.MAX_VALUE;
     if (s<=node_s&&node_t<=t)
         return nodes[node];
     int cl = _find(s, t, node*2+1, node_s, (node_s+node_t)/2);
     int rl = _find(s, t, node*2+2, (node_s+node_t)/2+1, node_t);
     return Math.min(cl, rl);
 }
}


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

int main(void)
{
    int i, h, m, s;
    cin >> i;
    h = i / 3600;
    m = i / 60 - h * 60;
    s = i - (m + h * 60) * 60;
    cout << h << ":" << m << ":" << s << endl;;
    return 0;
}


Measured memory_bytes: 3104
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iterator>
//#include<math.h>

using namespace std;
#define int long long
/*                      */    //#undef int
#define INF 1000000009ll
#define INFL 1000000000000000018ll
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define mk make_pair
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef priority_queue<PA, vector<PA>, greater<PA> >PQG;

int N, K, L, a[200005];

int sum(int i, int *bit)
{
    //printf("sum(%d)\n", i);
    int s = 0;
    while(i > 0){
        s += bit[i];
        i -= (i & (-i));
    }
    //printf("sumfin\n");
    return s;
}

void add(int i, int x, int *bit)
{
    //printf("add(%d, %d)\n", i, x);
    while(i <= N){
        bit[i] += x;
        i += (i & (-i));
    }
    //printf("addfin\n");
}

bool C(int x)
{
    //printf("C(%d)\n", x);
    int s[200010] = {0};
    int bit[200010] = {0};
    for(int i = 0; i < N; i++){
        if(a[i] <= x)s[i] = 1;
        if(i > 0)s[i] += s[i - 1];
    }
    int res = 0;
    add(1, 1, bit);
    //printf("add(1, 1)\n");
    for(int i = 0; i < N; i++){
        if(s[i] - K >= 0)res += sum(s[i] - K + 1, bit);
        add(s[i] + 1, 1, bit);
    }
    //printf("C(mid)fin\n");
    return (res >= L);
}

int binary(int lb, int ub)
{
    //printf("binary_search\n");
    for(int i = 0; i < 32; i++){
        int mid = (lb + ub) / 2;
        //printf("mid:%d\n", mid);
        if(C(mid))ub = mid;
        else lb = mid;
    }
    //printf("binary_searchfin\n");
    return ub;
}

signed main()
{
    cin >> N >> K >> L;
    int mx = 0, mn = INF;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        mx = max(mx, a[i]);
        mn = min(mn, a[i]);
    }
    cout << binary(mn - 1, mx + 1) << endl;


    return 0;
}
/*


*/



Measured memory_bytes: 7776
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        if(a<b&&b<c)System.out.println("Yes");
        else System.out.println("No");
    }
}



Measured memory_bytes: 26216