akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long 
#define int ll
//#define slld(t) scanf("%lld",&t)
// #define sd(t) scanf("%d",&t)
// #define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define pdd pair<double , double>
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N    300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
#define s3   1.73205080757          // square root 3
const  int inf = (int)1e18+10 ;
const int MAX= 100;

 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set S;

int powmod(int x , int y){
	int res = 1;
	while(y > 0){
		if(y%2==1)
			res = (res*x)%mod;
		x = (x*x)%mod;
		y/=2;
	}
	return res;
}
int mul(int x , int y){
	return (x*y)%mod;
}
int p[64];
int v[N][64] = {{0}} , pre[N][64] = {{0}};
int a[N];
signed main(){
  fast;
  
 int n;
 cin >> n;
 int ans = 0;
 p[0] = 1;
 for(int i = 1 ; i <= 61 ; i++){
 	    p[i] = (p[i-1] + p[i-1]) % mod;
 }
 for(int i = 0 ; i < n ; i++){
 	    cin >> a[i];
 	    for(int j = 0 ; j <= 60 ; j++){
 	    	    int val = (1ll << j);
 	    	    if((a[i] & val) > 0) v[i][j] = 1;
 	    	    else v[i][j] = 0;
 	    }
 }
 for(int j = 0 ; j <= 60 ; j++){
 	   for(int i = n-1 ; i >= 0 ; i--){
 	   	    pre[i][j] = v[i][j] + pre[i+1][j];
 	   }
 }

 for(int j = 0 ; j <= 60 ; j++){
 	    for(int i = 0 ; i < n ; i++){
 	    	   if(v[i][j] == 1){
 	    	   	    ans += ((n - i - 1 - pre[i+1][j])*p[j] ) % mod;
 	    	   	    ans %= mod;
 	    	   }
 	    	   else{
 	    	   	    ans += (pre[i+1][j] * p[j] ) % mod;
 	    	   	    ans %= mod;
 	    	   }
 	    }
 }
 cout << ans << endl;

 }

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main()
{
	int N;
	vec(W)
		cin >> N;
	int D[110];
	D[0] = 0;
	fx(N) {
		vecp(W)
		D[x + 1] = D[x] + W.at(x);
	}
	int ans = INT_MAX;
	fx(N + 1) {
		ans = min(ans,abs(D[N]-D[x]-D[x]));
	}
	ce(ans)
    return 0;
}



Measured memory_bytes: 384
import heapq

N, M = map(int,input().strip().split())
alist = map(int, input().strip().split())

nalist = [-i for i in alist]
heapq.heapify(nalist)
for _ in range(M):
    a = int((heapq.heappop(nalist)+1)//2)
    heapq.heappush(nalist, a)

print(-sum(nalist))

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

#define F first
#define S second
#define PB push_back
#define PP pop_back
#define sz(x) (int)(x.size())

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

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

	double PI = 3.141592;
	int r;
	cin >> r;
	cout << fixed << setprecision(8) <<  2 * r * PI << endl;
	return 0;
}


Measured memory_bytes: 3760
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
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;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BDigits solver = new BDigits();
        solver.solve(1, in, out);
        out.close();
    }

    static class BDigits {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int n = s.nextInt();
            int base = s.nextInt();
            out.println(Integer.toString(n, base).length());
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <set>
#include <map>
using namespace std;
using ll = long long;
const ll INF = 1<<30;
const ll MOD = (ll)1e9 + 7;
const ll MAX_N = (ll)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(ll i = 0; i < (ll) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

ll n, x, y;

void solve()
{
    cin >> n >> x >> y;
    x--, y--;
    vector<vector<ll>> G(n);
    for(ll i = 0; i < n - 1; i++)
    {
        G[i].push_back(i + 1);
        G[i + 1].push_back(i);
    }
    G[x].push_back(y);
    G[y].push_back(x);

    map<ll, ll> mp;
    for(ll i = 0; i < n; i++)
    {
        for(ll j = i + 1; j < n; j++)
        {
            ll k = min(abs(i - j), abs(i - x) + abs(j - y) + 1);
            mp[k]++;
        }
    }
    for(ll k = 1; k < n; k++)
    {
        cout << mp[k] << endl;
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

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

const int N = 100 * 1000 + 10;

int n;
pair <int, int> arr[N];
long long ans;

void input() {
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i].first >> arr[i].second;
    return;
}

bool cmp(pair <int, int> a, pair <int, int> b) {
    return (a.first + a.second > b.first + b.second) ;
}

void solve() {
    sort(arr, arr + n, cmp) ;
    for (int i = 0; i < n; i++)
        if (i % 2)
            ans -= arr[i].second;
        else
            ans += arr[i].first;
    return;
}

int main() {
    input() ;
    solve() ;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Spandan Mishra
 */
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);
        AFiveVariables solver = new AFiveVariables();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFiveVariables {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int ans = 0;
            for (int i = 1; i <= 5; i++) {
                if (in.readInt() == 0)
                    ans = i;
            }

            System.out.println(ans);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new RuntimeException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 32272
#include<bits/stdc++.h>
using namespace std;
string s;
int k;
int main() {
	cin >> k >> s;
	if(s.size() <= k)	cout << s << "\n";
	else {
		for(int i = 0; i < k; i++) {
			cout << s[i];
		}
		cout << "...\n";
	}
	return 0;
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	if s == "A" {
		fmt.Println("T")
	} else if s == "C"{
		fmt.Println("G")
	} else if s == "G" {
		fmt.Println("C")
	} else if s == "T" {
		fmt.Println("A")
	}
	
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int a,b;
    cin >> a >> b;
    int ans = 0;
    if(a>b){
        ans += a;
        a--;
    }else{
        ans += b;
        b--;
    }
    int dai = max(a,b);
    ans += dai;
    cout << ans << endl;
}

Measured memory_bytes: 3608
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
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;
}
///////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
	ll a,b; cin >> a >> b;
    if (a*b <= 0) cout << "Zero" << endl;
	else if (a+b > 0 || (b-a) % 2 == 1) cout << "Positive" << endl;
	else cout << "Negative" << endl;
}


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

int main(void)
{
    int a;
    cin >> a;

    int ans=a+(a*a)+(a*a*a);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
map<int, int> mp;
int main()
{
	int a, b, c, x;
	cin >> a >> b >> c >> x;
	int ans = 0;
	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (500 * i + 100 * j + 50 * k == x) ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        if (a > 0)
        {
            ans++;
            a--;
        }
        else if (b > 0)
        {
            b--;
        }
        else if (c > 0)
        {
            ans--;
            c--;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
x = list(map(int, input().split()))

if x[0]<=x[1]:
    a=x[1]-x[0] 
    if 16-2*x[0]-2*a>=0:
        print('Yay!')   
    else:
     print(':(')
    
if x[0]>x[1]:
    a=x[0]-x[1] 
    if 16-2*x[1]-2*a>=0:
        print('Yay!')   
    else:
     print(':(')

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

int main() {
    cin.tie(0);
    int Q, H, S, D;
    cin >> Q >> H >> S >> D;
    int N;
    cin >> N;
    long long s2 = min(8 * Q, min(4 * H, min(2 * S, D)));
    long long s1 = min(4 * Q, min(2 * H, S));
    long long ans = (N / 2) * s2 + (N % 2) * s1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
from collections import deque

def main():
    N = int(input())
    if N == 1:
        print("First")
        exit()
    edge = [[] for _ in range(N)]
    
    for _ in range(N-1):
        a,b = map(int,input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
        
    dep = [-1 for _ in range(N)]
    dep[0] = 0
    q = deque([0])
    while q:
        now = q.popleft()
        for fol in edge[now]:
            if dep[fol] == -1:
                dep[fol] = dep[now]+1
                q.append(fol)
    
    st = dep.index(max(dep))
    dep = [-1 for _ in range(N)]
    dep[st] = 0
    q = deque([st])
    while q:
        now = q.popleft()
        for fol in edge[now]:
            if dep[fol] == -1:
                dep[fol] = dep[now]+1
                q.append(fol)
                
    if max(dep)%3 == 1:
        print("Second")
    else:
        print("First")

if __name__ == "__main__":
    main()


Measured memory_bytes: 49216
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll a,b,v,w,t;
	cin>>a>>v>>b>>w>>t;
	ll dst = abs(a-b);
	ll val = t*(v-w);
	if(val>=dst)
		cout<<"YES\n";
	else
		cout<<"NO\n";	
	return 0;
}

Measured memory_bytes: 3648
#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 all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> s(1, 6), t(1, 9);
	while (1) {
		int tmp = s.back();
		if (tmp * 6 <= n) s.push_back(tmp * 6);
		else break;
	}
	while (1) {
		int tmp = t.back();
		if (tmp * 9 <= n) t.push_back(tmp * 9);
		else break;
	}
	vector<int> dp(1000000, inf);
	dp[0] = 0;
	rep(i, n) {
		mins(dp[i + 1], dp[i] + 1);
		for (int j = 0; j < s.size(); ++j) {
			mins(dp[i + s[j]], dp[i] + 1);
		}
		for (int j = 0; j < t.size(); ++j) {
			mins(dp[i + t[j]], dp[i] + 1);
		}
	}
	cout << dp[n] << endl;
	return 0;
}


Measured memory_bytes: 7164
#include<stdio.h>
#include<string.h>

int main(){
	int a,b;
	char keta[16];
	
	while(scanf("%d %d",&a,&b)!=EOF){
	
	sprintf(keta,"%d",a+b);
	printf("%d\n",strlen(keta));
	}
	
	return 0;
}
	

Measured memory_bytes: 612
import java.io.*;

class Main{
    public static void main(String[] args){
        try{
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            String line = reader.readLine();
            String str[] = line.split(" ",0);
            int a = Integer.parseInt(str[0]);
            int b = Integer.parseInt(str[1]);
            System.out.println(a*b + " " + (a+b)*2);
        }catch(IOException e){
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 24208
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
const ll inf=1e9+7;
const ll INF=1e18;

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


ll fermat(ll a,ll b,ll m){
    return (a%m)*modpow(b,m-2,m)%m;
}

int main(){
    int n,k;cin>>n>>k;
    ll a;
    vector<pair<ll,int>> b(n);
    rep(i,n){
        cin>>a;
        if(a>0)b[i]=mp(a,1);
        else if(a==0)b[i]=mp(a,0);
        else b[i]=mp(-a,-1);
    }
    sort(all(b));reverse(all(b));
    int mnum=0;int pnum=0;
    ll lm=(ll)1;ll lp=(ll)1;
    ll ans=(ll)1;
    rep(i,k){
        if(b[i].second==0){
            cout<<0<<endl;
            return 0;
        }
        if(b[i].second==-1){
            mnum++;
            lm=b[i].first;
        }
        else if(b[i].second==1){
            pnum++;
            lp=b[i].first;
        }
        ans*=b[i].first;
        ans%=inf;
    }
    if(mnum%2==0){
        cout<<ans<<endl;
        return 0;
    }
    if(k==n){
        cout<<inf-ans<<endl;
        return 0;
    }
    if(mnum%2){
        ll x=-2*inf;ll y=-2*inf;
        rep2(i,k,n){
            if(b[i].second==0){
                x=0;
                break;
            }
            if(b[i].second==1){
                x=b[i].first;
                break;
            }
        }
        rep2(i,k,n){
            if(b[i].second==0){
                y=0;
                break;
            }
            if(b[i].second==-1){
                y=b[i].first;
                break;
            }
        }
        if(pnum==0&&x==-2*inf){
            ans=(ll)1;
            reverse(all(b));
            rep(i,k){
                ans*=b[i].first;
                ans%=inf;
            }
            cout<<inf-ans<<endl;
            return 0;
        }
        if(pnum&&x*lp<y*lm){
            ans*=y;ans%=inf;
            ans=fermat(ans,lp,inf);
        }
        else{
            ans*=x;ans%=inf;
            ans=fermat(ans,lm,inf);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6308
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
  string s;
  std::cin >>x>> s;
  rep(i,s.size()){
    s[i]=(s[i]-'A'+x)%26+'A';
  }
  std::cout << s << '\n';
}


Measured memory_bytes: 256
/*
 *	Argorithms and Data Structures
 *	Lectuire 11 
 *	Graph
 */

#include <stdio.h>

#define MAX_N 100

int main(void) {
	int map[MAX_N][MAX_N];
	int i, j, n, u, k, v;

	scanf("%d", &n);

	for( i=0; i<n; i++) {
		for( j=0; j<n; j++) {
			map[i][j] = 0;
		}
	}

	for( i=0; i<n; i++) {
		scanf("%d %d ", &u, &k);
		for( j=0; j<k; j++) {
			scanf("%d", &v);
			map[u-1][v-1] = 1;
		}
	}

	for( i=0; i<n; i++) {
		for( j=0; j<n; j++) {
			if(j) printf(" ");
			printf("%d", map[i][j]);
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int A,B;
    cin>>A>>B;
    if(A==1)A=14;
    if(B==1)B=14;
    if(A==B)cout<<"Draw"<<endl;
    else cout<<(A<B?"Bob":"Alice")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	// your code goes here
	int n;
	cin>>n;
	
	int a=n%10;
	int b=(n%100);
	
	if((n>699  && n<800) || (a==7) || (b>69 && b<80))
	cout<<"Yes";
	else
	cout<<"No";
	
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>

#define MAX_N 100000
#define MAX_M 100000
using namespace std;


int field[MAX_N + 1];
int scdl[MAX_M];
int ans;

int n,m;


void solve(){
	ans = 0;
	int pos = 1;
	for(int i = 0;i < m;i++){
		ans += abs(field[pos + scdl[i]] - field[pos]);
		ans %= 100000;
		pos += scdl[i];
	}
	return ;
}

int main(){
	
	scanf("%d%d",&n,&m);
	for(int i = 1;i < n;i++){
		scanf("%d",field + i + 1);
		field[i + 1] += field[i];
	}
	//for(int i = 1;i <= n;i++){
	//	printf("###%d\n",field[i]);
	//}
	for(int i = 0;i < m;i++){
		scanf("%d",scdl + i);
	}

	solve();

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 1968
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

typedef long long int ll;
using namespace std;

int main() {
	string S;
	cin >> S;

	if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  string s;
  cin>>s;
  s.erase(unique(s.begin(),s.end()),s.end());
  if(s[0]!='o') reverse(s.begin(),s.end());
  cout<<"ox"[(s[0]=='x')&&(s.size()&1)]<<endl;
  return 0;
}



Measured memory_bytes: 3204
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,i,e,f,g;
  scanf("%d %d",&a,&b);
int s[b],c[b],d[a];
  f=0;
  g=0;
  for(i=0;i<a;++i) {d[i]=10;}
  
  for(i=0;i<b;++i)
  {scanf("%d %d",&s[i],&c[i]);
  e=s[i]-1;
   if(d[e]==10) d[e]=c[i];
  else if(d[e]!=c[i]) f++;
  }

  if(f>0) printf("-1");
  else if(a>1 && d[0]==0) printf("-1");
  else if(a==1 && b==0) printf("0");
else{
     for(i=0;i<a;++i)
     {
     if(d[i]==10 && i!=0)  d[i]=0;
     else if(d[i]==10 &&  i==0) d[i]=1;
     g=g+d[i]*pow(10,a-i-1);
     }
   
    printf("%d",g);
    }
return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>

int main() {
    long long a, b, c, x, y;
    std::cin >> a >> b>> c >> x >> y;

    long long ans = 0;

    if ((a + b) > c * 2) {
        long long buy = std::min(x, y);
        ans += c * 2 * buy;
        x -= buy;
        y -= buy;
    } else {
        ans += x * a;
        ans += y * b;
        std::cout << ans;
        return 0;
    }
    
    
    if (x == 0 && y == 0) {
        std::cout << ans;
        return 0;
    }

    if (x == 0) {
        std::swap(x, y);
        std::swap(a, b);
    }

    if (a > 2 * c) {
        ans += x * 2 * c;
    } else {
        ans += a * x;
    }
    std::cout << ans;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.*;
class Main
{
	public static void main (String[] args)
	{
		Scanner sc=new Scanner(System.in); 
		int i;
		int n=sc.nextInt();
		double dp[][][]=new double[n+5][n+5][n+5];
		int one=0,two=0,three=0;
		for(i=0;i<n;i++)
		{
			int v=sc.nextInt();
			if(v==1)
				one++;
			else if(v==2)
				two++;
			else
				three++;
		}
		for(int k=0;k<=n;k++)
		{
			for(int j=0;j<=n;j++)
			{
				for(i=0;i<=n;i++)
				{
					if(i+j+k==0)
						continue;
					if(i+j+k>n)
						continue;
					dp[i][j][k]=(double)n/(i+j+k);
					if(i>0)
						dp[i][j][k]+=(dp[i-1][j][k]*i)/(i+j+k);
					if(j>0)
						dp[i][j][k]+= (dp[i+1][j-1][k]*j)/(i+j+k);
					if(k>0)
						dp[i][j][k]+= (dp[i][j+1][k-1]*k)/(i+j+k);
				}
			}
		}
		System.out.println(dp[one][two][three]);
		
		
	}
}

Measured memory_bytes: 280764
#include <cstdio>

const int MAXN = 3e2+3;

int n, x;
double mem[MAXN][MAXN][MAXN];
bool solved[MAXN][MAXN][MAXN];
int cnt[5];

double dp(int x, int y, int z) {
  if (x == 0 && y == 0 && z == 0) return 0;
  
  double &ret = mem[x][y][z];
  if (solved[x][y][z]) return ret;
  solved[x][y][z] = 1;

  double t = x+y+z;
  ret += n / t;
  if (x != 0) ret += x / t * dp(x-1, y, z);
  if (y != 0) ret += y / t * dp(x+1, y-1, z);
  if (z != 0) ret += z / t * dp(x, y+1, z-1);

  return ret;
}

int main() {
  
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    cnt[x]++;
  }
  

  printf("%.15f\n", dp(cnt[1], cnt[2], cnt[3]));
  return 0;
}


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

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        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()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        
        int n = r.nextInt();
        int k = r.nextInt();
        String s = r.next();
        int c = 0;
        for(int i = 0; i < n-1; i++){
            if(s.charAt(i) == s.charAt(i+1)){
                c++;
            }
        }
        pw.println(Math.min(c+2*k, n-1));
        pw.close();
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

Measured memory_bytes: 24404
*A, = list(input())
s = ['+', '-']
for i in range(2**3):
    formula = A[0]
    for j in range(3):
        if i >> j & 1:
            formula += s[0]
        else:
            formula += s[1]
        formula += A[j+1]
    if eval(formula) == 7:
        print(formula+'=7')
        exit()


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#define llint long long

using namespace std;

string s;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s;
	for(int i = 0; i < s.size(); i++) cout << "x";
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use grapth::*;
use input_scanner::*;
use math::*;
use string_algorithm::*;
use util::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let n: usize = scan.next();
    let a: Vec<u64> = scan.next_vec(n);

    let mut res: Option<u64> = Some(1);
    for x in a {
        if x == 0 {
            res = Some(0);
            break;
        }
        if let Some(y) = res {
            res = y.checked_mul(x);
            if res.is_none() || res.unwrap() > 1_000_000_000_000_000_000 {
                res = None;
            }
        }
    }

    if let Some(ans) = res {
        println!("{}", ans);
    } else {
        println!("-1");
    }
}

mod datastructure {}
mod grapth {}
mod math {}
mod string_algorithm {}
mod util {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }

    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str =
                unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


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

using namespace std;

typedef long long ll;

const int MX = 100005;
const int MOD = 1000000007;

template <typename T> void cmin(T &x, const T &y)
{
	if(y < x) x = y;
}

template <typename T> void cmax(T &x, const T &y)
{
	if(y > x) x = y;
}

template <typename T> void read(T &x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

struct FEN
{
	int sum[MX];

	void add(int p, int x)
	{
		for(int i=p+1; i<MX; i+=i&-i) sum[i] += x, sum[i] %= MOD;
	}

	int qur(int p)
	{
		int ret = 0;
		for(int i=p+1; i; i-=i&-i) ret += sum[i], ret %= MOD;
		return ret;
	}
} F;

struct vec
{
	int x, y;

	vec (const ll &x0 = 0, const ll &y0 = 0) : x(x0), y(y0) {}
};

int n, m;
int ext[MX], rob[MX];
vec pot[MX];
vector<int> seq[MX];

void input()
{
	read(n), read(m);
	for(int i=1; i<=n; i++) read(rob[i]);
	for(int i=1; i<=m; i++) read(ext[i]);
}

void discrete()
{
	int tmp[MX];
	int num = 0;
	for(int i=1; i<=n; i++) tmp[++num] = pot[i].x;
	sort(tmp+1, tmp+num+1);
	num = unique(tmp+1, tmp+num+1) - tmp - 1;
	for(int i=1; i<=n; i++) pot[i].x = lower_bound(tmp+1, tmp+num+1, pot[i].x) - tmp;
	num = 0;
	for(int i=1; i<=n; i++) tmp[++num] = pot[i].y;
	sort(tmp+1, tmp+num+1);
	num = unique(tmp+1, tmp+num+1) - tmp - 1;
	for(int i=1; i<=n; i++) pot[i].y = lower_bound(tmp+1, tmp+num+1, pot[i].y) - tmp;
}

void work()
{
	int l = 1, r = n;
	while(l<=n && rob[l]<ext[1]) l++;
	while(r>=1 && rob[r]>ext[m]) r--;
	if(l > r) puts("1"), exit(0);
	else memmove(rob+1, rob+l, sizeof(int)*(r-l+1)), n = r-l+1;
	for(int i=1; i<=n; i++)
	{
		auto rt = upper_bound(ext+1, ext+m+1, rob[i]);
		auto lt = rt; lt--;
		pot[i] = vec(rob[i]-*lt, *rt-rob[i]);
	}
	discrete();
	for(int i=1; i<=n; i++) seq[pot[i].x].push_back(pot[i].y);
	for(int i=1; i<=n; i++)
	{
		sort(seq[i].begin(), seq[i].end());
		seq[i].erase(unique(seq[i].begin(), seq[i].end()), seq[i].end());
	}
	F.add(0, 1);
	for(int i=1; i<=n; i++)
		for(int j=seq[i].size()-1; j>=0; j--)
			F.add(seq[i][j], F.qur(seq[i][j]-1));
	printf("%d\n", F.qur(n));
}

int main()
{
	input();
	work();
	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#define endl '\n'
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const ll mod = 1e9 + 7;
const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }

void solve()
{
	ll s;
	cin >> s;

	ll sq = sqrt(s);
	ll C = 120;

	for(ll x1 = sq - C; x1 <= sq + C; ++x1)
	{
		if(x1 < 0)
			continue;

		if(x1 > (ll)1e9)
			continue;

		for(ll y2 = sq - C; y2 <= sq + C; ++y2)
		{
			if(y2 < 0)
				continue;

			if(y2 > (ll)1e9)
				continue;

			ll rem = x1 * y2 - s;

			if(rem == 0)
			{
				cout << "0 0 " << x1 << " 0 0 " << y2 << endl;
				exit(0);
			}

			if(rem < 0)
				continue;

			for(ll d = 1; d * d <= rem; ++d)
			{
				if(rem % d == 0)
				{
					ll x2 = d;
					ll y1 = rem / d;

					if(x2 <= (ll)1e9 && y1 <= (ll)1e9)
					{
						cout << "0 0 " << x1 << " " << y1 << " " << x2 << " " << y2 << endl;

#ifdef __LOCAL
						assert(x1 * y2 - x2 * y1 == s);
#endif

						exit(0);
					}
				}
			}
		}
	}
}

int main()
{
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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




int main(){
    int K, X; cin >> K >> X;
    cout << (500 * K >= X ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
/**************************************************************************
Coded by: Saba Karimi(_VINTAGE)
Institution: AIT PUNE
***************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
/**************************************************************************/
signed main()
{
    fast;
    int a,b,k;
    cin>>a>>b>>k;
    int g = __gcd(a,b);
    vector<int> ans;
    for(int i=1;i<=g;i++)
    {
        if(g%i==0)
            ans.pb(i);
    }
    int n = ans.size();
    cout<<ans[n-k];
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k;
  cin>>k;
  vector<int> v({1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51});
  assert(k <= v.size());
  cout<< v[k-1] << endl;
}

Measured memory_bytes: 256
from bisect import bisect
N=int(input())
A=set()
B=set()
C=[]
for i in range(N):
    s=int(input())
    if i%2==0:
        A.add(s)
    else:
        B.add(s)
    C.append(s)
C.sort()
ans=0
for i in range(N):
    s=C[i]
    if i%2==0:
        if s not in A:
            ans+=1        
print(ans)

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

int main() {
	long long N, M; cin >> N >> M;
	long long num = abs(M - N + 1);
	if (N < 0) {
		if (min(num, abs(N)) % 2 != 0 && M < 0) cout << "Negative" << endl;
		else if ((min(num, abs(N)) % 2 == 0 && M < 0)) cout << "Positive" << endl;
		else cout << "Zero" << endl;
	}
	else {
		cout << "Positive" << endl;
	}
}

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

int N;
int a[110];

int main(){
  cin >> N;
  for(int i=0; i<N; ++i){
    cin >> a[i];
  }
  sort(a, a+N, greater<int>());
  int Alice =0;
  int Bob =0;
  for(int i=0; i<N; ++i){
    if ((i+1)%2 == 1){
      Alice += a[i];
    }
    else Bob += a[i];
  }
  
  int diff = Alice -Bob;
  cout << diff << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.stream.Collectors;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        int n = in.nextInt();
        Map<Integer, Integer> students = new TreeMap<>();
        String[] tokens = in.nextLine().split(" ");
        for (int i = 1; i <= n; i++) {
            students.put(Integer.parseInt(tokens[i - 1]), i);
        }

        String answer = students.entrySet().stream().map(entry -> entry.getValue().toString())
                .collect(Collectors.joining(" "));
        out.println(answer);
    }
}


Measured memory_bytes: 58596
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define ri rd<int>
using namespace std;
const int maxN = 1e5 + 7;

template<class T> inline T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

inline void NIE() { puts("No"); exit(0); }
inline void TAK() { puts("Yes"); exit(0); }

int n, K, A, B;
int a[maxN];

int main() {

	n = ri(); rep (i, 1, n) a[i] = ri();
	sort(a+1, a+n+1);
	if (a[1] + 1 < a[n]) NIE();
	if (a[1] == a[n]) {
		if (a[1] == n - 1) TAK();
		if (a[1] * 2 <= n) TAK();
		NIE();
	}
	else {
		K = a[n], A = B = 0;
		rep (i, 1, n) a[i] == K - 1 ? ++ A : ++ B;
		K -= A;
		if (K > 0 && K * 2 <= B) TAK();
		NIE();
	}

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
LL dp[100010] = {-1};
vector<vector<LL>> G;

LL rec(int v){
    if(dp[v] > 0)   return dp[v];
    LL res = 0;
    for(auto iter : G[v]){
        res = max(res, rec(iter)+1LL);
    }
    return dp[v] = res;
}
int main(){
    LL N, M;
    cin >> N >> M;
    G.assign(N, vector<LL>());
    for(int i = 0;i < M;i++){
        LL xi, yi;
        cin >> xi >> yi;
        xi--, yi--;
        G[xi].push_back(yi);
    }
    LL ans = 0;
    for(int i = 0;i < N;i++){
        ans = max(ans, rec(i));
    }
    cout << ans << endl;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
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; }
const long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 998244353
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}

int main(){
    ll h,w;
    cin >> h >> w;
    ll c[10][10];
    for (ll i=0;i<10;i++){
        for (ll j=0;j<10;j++){
            cin >> c[i][j];
        }
    }
    for (ll k=0;k<10;k++){
        for (ll i=0;i<10;i++){
            for (ll j=0;j<10;j++){
                chmin(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    ll a[h][w],ans=0;
    for (ll i=0;i<h;i++){
        for (ll j=0;j<w;j++){
            cin >> a[i][j];
            if (a[i][j]!=-1){
                ans+=c[a[i][j]][1];
            }
        }
    }
    cout << ans << endl;
    return 0;
}    


Measured memory_bytes: 3836