akhauriyash/Code-Regression huggingface dataset:
#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) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;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 A,B;
cin>>A>>B;
int ans=0;
fyg(B+1,A){
	
	int a=y%10;
	int b=(y/10)%10;
	int c=(y/1000)%10;
	int d=(y/10000)%10;
	if(a==d&&b==c){
		ans++;
	}
	
}
ce(ans)

}

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


using namespace std;


#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 100011
#define inf 1LL << 55

int n, i;
ll a[maxN];
char op[maxN];

ll dp[maxN][3];

int main() {
    
    scanf("%d", &n);
    for (i = 1; i < n; i++) 
        scanf("%lld %c", &a[i], &op[i + 1]);
    scanf("%lld", &a[n]);

    for (i = 0; i <= n; i++)
        dp[i][0] = dp[i][1] = dp[i][2] = -inf;
        
    op[1] = '+';
    dp[0][0] = 0;
    for (i = 1; i <= n; i++) {
        if (op[i] == '+') {
            dp[i][0] = max(dp[i - 1][0], max(dp[i - 1][1], dp[i - 1][2])) + a[i];
            dp[i][1] = max(dp[i - 1][1], dp[i - 1][2]) - a[i];
            dp[i][2] = dp[i - 1][2] + a[i];
        } else {
            dp[i][1] = max(dp[i - 1][0], max(dp[i - 1][1], dp[i - 1][2])) - a[i];
            dp[i][2] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        }
    }
    
    ll ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
    printf("%lld", ans);
    
    
    return 0;
}

Measured memory_bytes: 3456
N, X, Y = map(int, input().split())
l = [0] * (N-1)

for i in range(1, N):
  for j in range(i+1, N+1):
    d = min(abs(j-i), abs(X-i)+1+abs(j-Y))
    l[d-1] += 1

for k in range(N-1):
  print(l[k])

Measured memory_bytes: 3444
n = int(input())
h = list(map(int, input().split()))

dp = [0]*n
for i in range(n):
    if i == 0:
        continue
    if i == 1:
        dp[1] = abs(h[0] - h[1])
    else:
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))
        
print(dp[n-1])

Measured memory_bytes: 13980
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
 

int digit[3];

int main(void){
    int n,m;
    for(int i=0;i<3;i++)digit[i]=-1;
    cin>>n>>m;
    if(n==1){
        int ans = 0;
        bool flag = false;
        bool flag1 = false;
        for(int i=0;i<m;i++){
            int s,c;
            cin>>s>>c;
            if(!flag){
                ans = c;
                flag = true;
            }
            else{
                if(ans != c){
                    flag1 = true;
                }
            }
        }
        if(flag1)cout<<-1<<endl;
        else cout<<ans<<endl;
    }
    else{
        bool flag = false;
        if(n == 2){
            for(int i=0;i<m;i++){
                int s,c;
                cin>>s>>c;
                if(digit[s-1]==-1)digit[s-1]=c;
                else{
                    if(digit[s-1]!= c){
                        flag = true;
                    }
                }
            }
            if(flag){
                cout<<-1<<endl;
                return 0;
            }
            if(digit[0]==0){
                cout<<-1<<endl;
                return 0;
            }
            int ans = 0;
            for(int i=0;i<n;i++){
                if(i==0){
                    if(digit[i]==-1)ans+=10;
                    else ans+=10*digit[i];
                }
                else{
                    if(digit[i]!=-1)ans+=digit[i];
                }
            }
            cout<<ans<<endl;
        }
        else{
            bool flag = false;
            for(int i=0;i<m;i++){
                int s,c;
                cin>>s>>c;
                if(digit[s-1]==-1)digit[s-1]=c;
                else{
                    if(digit[s-1]!= c){
                        flag = true;
                    }
                }
            }
            if(flag){
                cout<<-1<<endl;
                return 0;
            }
            if(digit[0]==0){
                cout<<-1<<endl;
                return 0;
            }
            int ans = 100;
            if(digit[0]!=0 && digit[0]!=-1)ans*=digit[0];
            if(digit[1]!=-1)ans+=10*digit[1];
            if(digit[2]!=-1)ans+=digit[2];
            cout<<ans<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 2e5 + 5;

int n, k, l, u, v, visited[maxn], comp[maxn], sz[maxn];
vector<int> adj[2][maxn];   // adj[road / rail]

void dfs(int x, int type, int compid, vector<int>& cities)
{
    visited[x] = 1;
    if(type == 0)
        comp[x] = compid;
    else
        cities.push_back(x);
    for(auto v : adj[type][x])
        if(!visited[v])
            dfs(v, type, compid, cities);
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k >> l;
    for(int i = 0; i < k; i++)
    {
        cin >> u >> v;
        u--; v--;
        adj[0][u].push_back(v);
        adj[0][v].push_back(u);
    }
    for(int i = 0; i < l; i++)
    {
        cin >> u >> v;
        u--; v--;
        adj[1][u].push_back(v);
        adj[1][v].push_back(u);
    }
    for(int i = 0; i < n; i++)
    {
        visited[i] = 0;
        comp[i] = -1;
        sz[i] = 0;
    }
    int curcomp = 0;
    vector<int> cities;
    for(int i = 0; i < n; i++)
        if(!visited[i])
        {
            dfs(i, 0, curcomp, cities);
            curcomp++;
        }
    assert(cities.empty());
    for(int i = 0; i < n; i++)
        visited[i] = 0;
    for(int i = 0; i < n; i++)
        if(!visited[i])
        {
            dfs(i, 1, -1, cities);
            vector<pii> order;
            for(auto x : cities)
                order.push_back({comp[x], x});
            sort(order.begin(), order.end());
            for(int i = 0; i < order.size(); )
            {
                int j = i;
                while(j < order.size() && order[j].first == order[i].first)
                    j++;
                int compsz = (j - i);
                for(int cur = i; cur < j; cur++)
                    sz[order[cur].second] += compsz;
                i = j;
            }
            cities.clear();
        }
    for(int i = 0; i < n; i++)
        assert(comp[i] != -1 && sz[i] != 0);
    for(int i = 0; i < n; i++)
        cout << sz[i] << " ";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 26632
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N = 100001;
    vector<int> P;
    for (int i = 2; i < N; i++) {
        bool prime = true;
        for (auto p : P) if (i%p == 0) {
            prime = false;
            break;
        }
        if (prime) {
            P.push_back(i);
        }
    }
    vector<int> C(N, 0), sum(N+1, 0);
    for (const auto &p : P) {
        if (binary_search(P.begin(), P.end(), (p+1)/2)) C[p]++;
    }
    for (int i = 0; i < N; i++) {
        sum[i+1] = sum[i] + C[i];
    }
    int Q;
    cin >> Q;
    vector<pair<int, int> > LR(Q);
    for (auto &lr : LR) cin >> lr.first >> lr.second;
    for (const auto &lr : LR) printf("%d\n", sum[lr.second+1] - sum[lr.first]);
    return 0;
}

Measured memory_bytes: 2304
import java.util.Scanner;

import static java.lang.Math.round;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int d = (a + b + 1) / 2;
        System.out.println(d);
    }
}


Measured memory_bytes: 22868
S=input()
case1=False
case2=False
cnt=0
for i in range(len(S)):
  if i==0 and S[i]=="A":
    case1=True
  if S[i]=="C" and 2<=i<=len(S)-2:
    case2=True
  if S[i].lower()!=S[i]:
    cnt+=1
if case1 and case2 and cnt==2:
  print("AC")
else:
  print("WA")

Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int flag=1;
    char a[105];
    scanf("%s",a+1);
    for(int i=1; a[i]!='\0'; i++)
    {
        if(i%2)
        {
            if(a[i]!='R'&&a[i]!='U'&&a[i]!='D')
            {
                flag=0;
                break;
            }
        }
        else
        {
            if(a[i]!='L'&&a[i]!='U'&&a[i]!='D')
            {
                flag=0;
                break;
            }
            }
    }
    if(flag)
        printf("Yes");
    else
        printf("No");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
     long long int n1, n2, i, gcd,multi;


    scanf("%lld %lld", &n1, &n2);
    multi=n1*n2;
    for(i=1; i <= n1 && i <= n2; i++)
    {

        if(n1%i==0 && n2%i==0)
            gcd = i;
    }

    printf("%lld", multi/gcd);

    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
int main(void){
    char S[101]; scanf("%s", S);
    int len = strlen(S);
    int ans = 0;
    for (int i = 0; i < len / 2; i++) {
        if (S[i] != S[len - 1 - i]) {
            ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    set<int> st;
    for (int i = 1; i <= 33; i++) {
        for (int j = 2; j <= 11; j++) {
            if (pow(i, j) <= 1000) {
                st.insert((pow(i, j)));
            }
            else {
                break;
            }
        }
    }
    int x;
    cin >> x;
    int ans = -1;
    for (auto bp : st) {
        if (bp > x) {
            break;
        }
        else {
            ans = bp;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define watch(x) cout << (#x) << " is " << (x) << endl
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)

typedef unsigned long long int ll;
typedef long double ld;
typedef long int li;

const int inf=1e9+5;

int main()
{
    fio;
    int n;cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++)cin>>h[i];
    vector<int> dp(n,inf);
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+2;j++)
        {
            if(j<n)dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1]<<"\n";
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 999999999ll
#define MIN -999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define gcd(x,y) __gcd(x,y) 
#define Gput(a,b) G[a].push_back(b)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*(y/z);
}
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
vector<bool> seen;
void dfs(const Graph &G,ll v){
    seen[v]=true;
    for(auto nextv:G[v]){ 
        if(seen[nextv])continue;
        dfs(G,nextv);
    }
}

int main() {
  cout << fixed << setprecision(16);
 ll n;
 cin>>n;
 vec a(n);
 loop(i,n){
 cin>>a[i];
 }
 ll ans=gcd(a[0],a[1]);
 loop(i,n){
 ans=gcd(ans,a[i]);
 }
 putout(ans);
 
 
 
 
 
 
 
 
}

Measured memory_bytes: 1152
import bisect


def get_closest(nums, target):
    pos = bisect.bisect_left(nums, target)
    if pos == 0:
        return nums[0]
    if pos == len(nums):
        return nums[-1]

    before = nums[pos - 1]
    after = nums[pos]

    if target in [before, after]:
        return target

    if after - target < target - before:
        return after
    else:
        return before


n = int(raw_input())
nums = map(int, raw_input().split())

nums = sorted(nums)
top = nums[-1]
nums.remove(top)

if top % 2 == 0:
    optimal = top / 2
    bottom = get_closest(nums, optimal)
else:
    res1 = get_closest(nums, top / 2)
    res2 = get_closest(nums, (top + 1) / 2)

    if abs(res1 - (top/2)) < abs(res2 - ((top + 1) / 2)):
        bottom = res1
    else:
        bottom = res2

print "{} {}".format(top, bottom)


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int
#define endl '\n'

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/*template*/
template<class T>constexpr bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>constexpr bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
constexpr int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
constexpr int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
constexpr int32_t LCM(int32_t a, int32_t b){return a / GCD(a, b) * b;}
constexpr int64_t LCM(int64_t a, int64_t b){return a / GCD(a, b) * b;}

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7;
constexpr int32_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

//#define int int64_t

/*global*/



signed main()
{
	//t:time alice, bob
	int t1, t2,r1,r2; cin >> t1 >> t2 >> r1 >> r2;
	//r: rate

	//rateがあるとき
	if(r1 != -1 && r2 != -1)
	{
		if(r1 > r2)
		{
			cout << "Alice" << '\n';
			return 0;
		}
		else if(r1 == r2)
		{
			cout << "Draw" << '\n';
			return 0;
		}
		else if(r1 < r2)
		{
			cout << "Bob" << '\n';
			return 0;
		}
	}
	else if(t1 == t2)
	{
		
			cout << "Draw" << '\n';
			return 0;
		
	}
	else if(t2 > t1)
	{
		cout << "Alice" << '\n';
		return 0;
	}
	else if(t1 > t2)
	{
		cout << "Bob" << '\n';
		return 0;
	}
}


Measured memory_bytes: 3212
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    char c;
    R(c);
    c++;
    W(c);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  sort(all(a));
  ll ans=0;
  ll cu=1;
  rep(i,n-1){
    if(a[i]==a[i+1]){
      cu++;
    }
    else{
      if(cu%2==0){
        cu=1;
      }
      else{
        ans++;
        cu=1;
      }
    }
  }
  if(cu%2==1){
    ans++;
  }
  COUT(ans);
}


Measured memory_bytes: 1024
#include <vector>
#include <iostream>
using namespace std;
int main() {
	int M, K;
	cin >> M >> K;
	if (K >= (1 << M) || (K == 1 && M == 1)) {
		cout << -1 << endl;
	}
	else if (M == 1 && K == 0) {
		cout << 0 << ' ' << 1 << ' ' << 1 << ' ' << 0 << endl;
	}
	else {
		vector<int> a;
		a.push_back(K);
		for (int i = 0; i < 1 << M; ++i) {
			if (i != K) a.push_back(i);
		}
		a.push_back(K);
		for (int i = (1 << M) - 1; i >= 0; --i) {
			if (i != K) a.push_back(i);
		}
		for (int i = 0; i < 2 << M; ++i) {
			if (i) cout << ' ';
			cout << a[i];
		}
		cout << endl;
	}
	return 0;
}

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

#define N 10000

int main() {
    
    int n;
    cin>>n; //入力

    int a[N];
    for(int i = 0; i < n; i++) cin>>a[i];
    
    int q, b, count = 0;
    cin>>q; //入力
    
    /* 線形探索 */
    for(int j = 0; j < q; j++) {
        cin>>b;
        a[n] = b;
        int i = 0;
        while(b != a[i]) {
            i++;
        }
        if(i != n) count++;
    }
    
    cout<<count<<endl; //出力
}



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

using namespace std;

template <typename T>
class fenwick {
 public:
  int n;
  vector<T> fenw;

  fenwick(int n) : n(n) {
    fenw.resize(n, numeric_limits<T>::max());
  }

  void modify(int x, T v) {
    while (x < n) {
      fenw[x] = min(fenw[x], v);
      x |= (x + 1);
    }
  }

  T get(int x) {
    T v = numeric_limits<T>::max();
    while (x >= 0) {
      v = min(v, fenw[x]);
      x = (x & (x + 1)) - 1;
    }
    return v;
  }
};

const int N = 333333;

int main() {
  string s;
  cin >> s;
  int n = (int) s.size();
  pair<int, int> ans(-1, -1);
  for (char c = 'a'; c <= 'z'; ++c) {
    vector<int> f(n);
    set<int> se;
    se.insert(0);
    for (int i = 0; i < n; ++i) {
      f[i] = (i > 0 ? f[i - 1] : 0) + (s[i] == c ? 1 : -1);
      se.insert(f[i]);
      se.insert(f[i] - 1);
    }
    vector<int> vals(se.begin(), se.end());
    auto pos = [&](int x) {
      return lower_bound(vals.begin(), vals.end(), x) - vals.begin();
    };
    fenwick<int> fenw(N);
    fenw.modify(pos(0), -1);
    pair<int, int> cur(-1, -1);
    for (int i = 0; i < n; ++i) {
      int j = fenw.get(pos(f[i] - 1));
      if (j != numeric_limits<int>::max() && i - j >= 2) {
        cur = max(cur, make_pair(i - j, j + 1));
      }
      fenw.modify(pos(f[i]), i);
    }
    ans = max(ans, cur);
  }
  if (ans == make_pair(-1, -1)) {
    printf("-1 -1\n");
  } else {
    printf("%d %d\n", ans.second + 1, ans.second + ans.first);
  }
  return 0;
}

Measured memory_bytes: 7168
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush=
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var N = cin.ReadInt;
			var A = cin.ReadLongArray(N);
			long count = 0;
			int end = 0;
			long sum = 0;
			for(int sta = 0; sta<N; sta++) {
				//P[s,e) == xor(A[s..e])==sum(A[s..e])
				//sum==A[sta..end]
				while(end<N && (sum^A[end])==sum+A[end]) {
					sum+=A[end];
					end++;
				}
				//sum==sum(A[sta..end]) && (end==N||!P[sta,end+1))
				//for all $e==sta..end+1, P[sta,e) holds.
				if(end>=sta) count+=end-sta;
				if(end<=sta) { end=sta+1; sum=0; } else sum-=A[sta];
			}
			Console.WriteLine(count);
		}
	}
	static class ExtendClass {
		public static void Swap<T>(this T[] A, int x, int y) {
			var tmp = A[x];
			A[x]=A[y];
			A[y]=tmp;
		}
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
		public static IEnumerable<int> Indices<T>(this T[] X) => Enumerable.Range(0, X.Length);
		public static IEnumerable<int> Indices<T>(this T[,] X, int dim)
			=> Enumerable.Range(0, X.GetLength(dim));
		public static string Join<T>(this T[,] X, string separatorD2 = ",", string separatorD1 = "\n")
			=> X.Indices(0).Select(
				i => X.Indices(1).Select(j => X[i, j]).Join(separatorD2)
			).Join(separatorD1);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator=separator;
			this._stream=stream;
			inputStream=new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count!=0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i<tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i<N; ++i)
				ret[i]=Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i<N; ++i) ret[i]=ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i<N; ++i) ret[i]=ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i<N; ++i) ret[i]=ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek()==-1; }
		}
	}
}

Measured memory_bytes: 34012
#include <bits/stdc++.h>
using namespace std;
#define int long long

// dfs := HPがHのやつを倒すのに必要な攻撃回数
int dfs(int H) {
    if (H == 1) return 1;
    return 2 * dfs (H / 2) + 1;
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int H;
    cin >> H;
    cout << dfs(H) << endl;
    return 0;
}





Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n;
  vi a(n);
  REP(i,n) cin>>a[i];

  REP(i,n){
    for(int j=i+1;j<n;j++){
      ans+=a[i]*a[j];
    }
  }

  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
	int n;
	cin >> n;
	for(int i = 0; i <= n; i++){
		if(floor(i * 1.08) == n){
			cout << i;
			return 0;
		}
	}
	cout << ":(";
}


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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int kr(int a);

int D,G,p,c,ans=10000000000;
vector<pair<int,int>> v;

main() {
    cin >> D >> G;
    rep(i,D) {
        cin >> p >> c;
        v.pb(make_pair(p,p*(i+1)*100+c))
    }
    int hoge=pow(2,D);
    rep(i,hoge) ans = min(ans,kr(i));
    ct(ans)
}

int kr(int a) {
    int sum=0,cnt=0,last;
    rep(i,D) {
        int f=a%2;
        if (f) {
           sum += v[i].se;
           cnt += v[i].fi;
        } else last=i;
        a/=2;
    }

    if (sum >= G) return cnt;
    if (G-sum < v[last].fi*100*(last+1)) {
        cnt += (G-sum+(last+1)*100-1)/((last+1)*100);
        return cnt;
    }
    return 10000000000;
}


Measured memory_bytes: 256
a,b,c,k=map(int, input().split())

sum = 0
end = False
if a < k:
    sum+=a
    k-=a
else:
    sum=k
    end=True

if end==False and b < k:
    k-=b
else:
    end=True

if end==False:
    sum-=k

print(sum)


Measured memory_bytes: 61628
<?php
  list($n, $m, $k) = explode(" ", trim(fgets(STDIN)));

  $a = array_map('intval', explode(" ", trim(fgets(STDIN))));
  $b = array_map('intval', explode(" ", trim(fgets(STDIN))));

  $sum = 0;
  $max = 0;
  $aindex = $n-1;
  for ($i=0; $i<$n; $i++) {
    $sum+=$a[$i];
    if($k < $sum){
      $aindex = $i-1;
      $sum-=$a[$i];
      break;
    }
    $max++;
  }
  $ans = $max;

  for ($i=0; $i<$m; $i++) {    
    $sum+=$b[$i];
    $max++;
    if($sum > $k && $aindex < 0){      
      break;
    }
    while($k < $sum && $aindex >= 0){
      $sum-=$a[$aindex];
      $aindex--;
      $max--;
    }
    if($aindex < 0){
      if($sum <= $k){
        $ans = max($ans, $max);
      }
    }
    $ans = max($ans, $max);
  }

  echo $ans;

Measured memory_bytes: 44176
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String[] s = saori.nextHayami().split("");
		String[] t = saori.nextHayami().split("");
		int count = 0;
		for(int i = 0;i < s.length;i++){
			if(s[i].equals(t[i])){
				count++;
			}
		}
		System.out.println(count);

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
//INF = 1 061 109 567 ; INF + INF = 2 122 219 134 ;
//LINF = 4 557 430 888 798 830 399 ; LINF + LINF = 9 114 861 777 597 660 798 ;
const int INF = 0x3f3f3f3f;     // -INF: 0xc0   abs(-INF) = INF + 1
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*}}}*/                         // zr, zm
const int MOD = (int)1e9+7;     // when MOD = 1e9+7, inv2 = 500000004
const int N = (int)1e6+7;
const int M = (int)-1;

vi e[N];
int ans[N],w[N];
void dfs(int u,int f,int s) {
	s += w[u];
	ans[u] = s;
	for(int v:e[u]) {
		if(v == f) continue;
		dfs(v,u,s);
	}
}
int main()
{
	int n,q;scanf("%d%d",&n,&q);
	rep(i,1,n) {
		int u,v;scanf("%d%d",&u,&v);
		e[u].pb(v);
		e[v].pb(u);
	}
	rep(i,0,q) {
		int p,x;scanf("%d%d",&p,&x);
		w[p] += x;
	}
	dfs(1,-1,0);
	rep(i,1,n+1) printf("%d%c",ans[i]," \n"[i==n]);
	return 0;
}


Measured memory_bytes: 47744
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    String S;
    int w;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        S = sc.next();
        w = sc.nextInt();
    }
    
    //解答処理
    private String solve() {
        String answer = String.valueOf(S.charAt(0));
        
        for (int i=w; i<S.length(); i+=w) {
        	answer += S.charAt(i);
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }
}


Measured memory_bytes: 39612
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    if(n==1){
        cout<<1<<endl;
        return 0;
    }
    vector<ll> x(n),y(n);
    ll p,q;
    REP(i,n){
        cin>>x[i]>>y[i];
    }
    map<LP,ll> mp;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i==j)continue;
            p=x[j]-x[i],q=y[j]-y[i];
            mp[{p,q}]++;
        }
    }
    ll ma = 0;
    for(auto x:mp){
        //cout<<x.first.first<<":"<<x.first.second<<":"<<x.second<<endl;
        chmax(ma,x.second);
    }
    cout<<n-ma<<endl;

}


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

int main(int argc, char const *argv[])
{
    int a,b,c;
    cin >>a>>b>>c;
    if((c<b && c>a) || (c<a && c>b))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits>

using namespace std;
using ull = unsigned long long;

int main() {
    ull l, r;
    cin >> l >> r;
    ull x = numeric_limits<ull>::max();
    for (ull i = l; i < r; ++i) {
        for (ull j = l + 1; j <= r; ++j) {
            x = min(x, ((i % 2019) * (j % 2019) % 2019));
            if (x == 0) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256
// AOJ GRL_5_D Tree - Range Query on a Tree
// 2019.3.29 bal4u

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

//// 入力の高速化
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void out(int n)
{
	int i;
	char ob[40];

	if (!n) pc('0');
	else {
		if (n < 0) pc('-'), n = -n;
		i = 0; while (n) ob[i++] = n % 10 + '0', n /= 10;
		while (i--) pc(ob[i]);
	}
	pc('\n');
}


//// BIT library
#define MAX 100005
int bit[2*MAX]; int bmax;

int sum(int i)
{
	int s = 0;

	while (i > 0) {
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add(int i, int v)
{
	while (i <= bmax) {
		bit[i] += v;
		i += i & -i;
	}
}


//// 本問題関連
int N;
int hi[MAX], *to[MAX];
int idx[2*MAX][2]; int sz;
int que[2*MAX], top;

void eularTour()
{
	int i, node;

	sz = 1;

	// 非再帰dfs
	que[0] = 0, top = 1;
	while (top) {
		node = que[--top];

		// dfsにする
		if (node < 0) {
			node = -node;
			idx[node - 1][1] = sz++;
			continue;
		}
		que[top++] = -(node + 1);

		idx[node][0] = sz++;
		for (i = 0; i < hi[node]; i++) que[top++] = to[node][i];
	}

#if 0
	int j;
	for (j = 0; j <= 1; j++) {
		for (i = 0; i < sz; i++) printf("%3d ", idx[i][j]); printf("\n");
	}
#endif
}

int main()
{
	int i, j, k, Q;
	int cmd;

	N = in();
	for (i = 0; i < N; i++) {
		hi[i] = k = in();
		if (k > 0) {
			to[i] = malloc(sizeof(int)*k);
			for (j = 0; j < k; j++) to[i][j] = in();
		}
	}
	eularTour();
	bmax = sz + 1;

	Q = in();
	while (Q--) {
		cmd = in();
		if (cmd == 0) {  // add(v, w)
			int v, w;
			v = in(), w = in();
			add(idx[v][0], w);
			add(idx[v][1], -w);
		}
		else {           // getSum(u)
			int u = in();
			if (u == 0) out(0);
			else out(sum(idx[u][0]));
		}
	}
	return 0;
}


Measured memory_bytes: 7872
w, h, n = map(int, input().split())
sx, gx, sy, gy = 0, w, 0, h
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and sx < x:
        sx = x
    if a == 2 and gx > x:
        gx = x
    if a == 3 and sy < y:
        sy = y
    if a == 4 and gy > y:
        gy = y
if (gx-sx) > 0 and (gy-sy) > 0:
    print(max((gx-sx)*(gy-sy), 0))
else:
    print(0)


Measured memory_bytes: 3064
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        Set<String> set = new HashSet<String>();

        for (int i = 0; i < n; i++) {
            set.add(sc.next());
        }

        sc.close();

        System.out.println(set.size());

    }
}


Measured memory_bytes: 23124
from sys import stdin
N, K = map(int, input().split())

data = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N*2)]
sunuke = []
for i in data[1::2]:
  for j in i:
    if not j in sunuke:
      sunuke.append(j)

print( N - len(sunuke))



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

char mov[110];

int main(){
	vector<int> dice(6), temp(6);
	for(int i = 0; i < 6; i++)
		scanf("%d", &dice[i]);
	scanf("%s", mov);
	int len = strlen(mov);
	for(int i = 0; i < len; i++) {
		if(mov[i] == 'S')
			temp = {dice[4],dice[0],dice[2],dice[3],dice[5],dice[1]};
		else if(mov[i] == 'N')
			temp = {dice[1],dice[5],dice[2],dice[3],dice[0],dice[4]};
		else if(mov[i] == 'W')
			temp = {dice[2],dice[1],dice[5],dice[0],dice[4],dice[3]};
		else if(mov[i] == 'E')
			temp = {dice[3],dice[1],dice[0],dice[5],dice[4],dice[2]};
		dice = temp;
	}
	printf("%d\n", dice[0]);
}



Measured memory_bytes: 3276
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        long[] b = new long[n];
        long[] d = new long[n];
        for(int i = 0; i < n; i++){
           a[i] = sc.nextLong();
        }
        for(int i = 0; i < n; i++){
           b[i] = sc.nextLong();
           d[i] = a[i] - b[i];
        }
        Arrays.sort(d);
        long[] matcher = d.clone();
        int r = n-1;
        for(int i = 0; i < n; i++){
            if(d[i] >= 0){
                break;
            }
            while(d[i] < 0){
                if(d[r] <= 0){
                    System.out.println(-1);
                    return;
                }
                if(d[r] + d[i] > 0){
                    d[r] += d[i];
                    d[i] = 0;
                }else{
                    d[i] += d[r];
                    d[r] = 0;
                    r--;
                }
            }
        }
        int ans = 0;
        for(int i = 0; i < n; i++){
            if(d[i] != matcher[i]) ans++;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 88148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pf push_front
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define ft front()
#define bk back()
#define endl '\n'
#define FOR(a, b, c) for (auto(a) = (b); (a) < (c); ++(a))
#define ROF(a, b, c) for (auto(a) = (b); (a) > (c); --(a))
#define F0R(a, b) FOR ((a), 0, (b))
#define R0F(a, b) ROF ((a), (b), -1)
#define CEIL(a, b) ((a) + (b)-1) / (b)
#define SET(a, b) memset((a), (b), sizeof(a))
template <class t>
bool ckmin(t& a, const t& b) {
    return a > b ? a = b, true : false;
}
template <class t>
bool ckmax(t& a, const t& b) {
    return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
    if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p);
template <class T>
struct IsC {
    template <class C>
    static char test(typename C::const_iterator*);
    template <class C>
    static int test(...);
    static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
    static const bool value = false;
};
template <class C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream& o,
                                                             const C& c) {
    o << '{';
    for (auto it = c.begin(); it != c.end();)
        o << *it << (++it != c.end() ? ", " : "}");
    return o;
}
template <class a, class b>
ostream& operator<<(ostream& o, const pair<a, b>& p) {
    return o << '(' << p.fi << ", " << p.se << ')';
}

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

    int n;
    cin >> n;
    vvi vs(n, vi(3));
    F0R (i, n)
        cin >> vs[i][0] >> vs[i][1] >> vs[i][2];
    vvi dp(n, vi(3, 0));
    for (int i = 0; i < 3; ++i) dp[0][i] = vs[0][i];

    for (int i = 1; i < n; ++i)
        for (int j = 0; j < 3; ++j)
            for (int k = 0; k < 3; ++k)
                if (k != j) ckmax(dp[i][j], dp[i - 1][k] + vs[i][j]);

    dout << dvar(dp) << endl;

    cout << *max_element(ALL(dp[n - 1])) << endl;

    return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))

#define y0 y12345
#define y1 y54321
typedef unsigned long ul;
typedef long long ll;
//typedef pair<int, int> mpair;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
using namespace std;

ul kaijo(int a){
    if(a == 0||a==1)return 1;
    return a*kaijo(a-1);
}

int main() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        int n,m;cin >> n>> m;
        //cout << kaijo(3) << endl;
        cout << n-m+1 << endl;
        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MAXSIZE 10000000;

const int MAX = 510000;
const int MOD = 1000000007;
const long long INF = 1LL << 60;

const ll MAXINDx = 3000;
const ll MAXINDy = 3000;


double dp[MAXINDx][MAXINDy] = {0};

vector<vector<int>> edges;
/*
int rec(int v){
    int res = 0;

    if(dp[v] > -1)return dp[v];

    for(auto nv: edges[v]){
        res = max(res, rec(nv) + 1);
    }
    return dp[v] = res;
}
*/
int main(){
    int N;

    cin >>N;

    double p[MAXINDx] = {0};

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

    for(int i = 0; i < MAXINDx; i ++){
      dp[0][i] = 0.0;
    }

    dp[0][0] = 1.0;
/*
    for(int j = 0; j < N; j++){
      dp[j+1][0] += dp[j][0]*p[j];
    }*/

    for(int i = 0; i < N; i++){
      for(int j = 0; j <= i; j++){
          dp[i+1][j+1] += dp[i][j] * p[i];
          dp[i+1][j] += dp[i][j] * (1.0 - p[i]);
      }
    }

    double ans = 0;
    for(int i = (N+1)/2 ; i <= N; i++){
      ans += dp[N][i];
    }

    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

/*Syakutori
while(cin >>b && b)){
      ll t = 1;
      long long int ansS = 1,ansT=0;
      long long int sum = 0;

      for(ll s = 1;s < 50000000;s++){

        while(t <  50000000 && sum+Rsum[t] < b){
          sum += Rsum[t];
          t++;
        }
        if(b == sum+Rsum[t]){
          if(ansT - ansS < t-s){
            ansS = s;
            ansT = t;
          }
          cout <<ansS<<" "<<ansT-ansS + 1<<endl;
          break;
        }
        if(t == s)++t;
        else sum -= Rsum[s];
        }
    }

//priority_queue<long long int,vector<long long int>, greater<long long int>> PQ;
//priority_queue<long long int> PQ1;

bool comp(const pair<int,int> a, const pair<int,int> b) {
    return a.second < b.second;
}

ll gcd(ll a,ll b){
  if(a%b == 0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
*/


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N; cin >> N;
  string S; cin >> S;
  ll ans = 0;
  ll b_l = 0; ll w_l = 0; ll b_r = 0; ll w_r = 0;
  REP(i, N) {
    if(S[i] == '#') b_l++;
    if(S[i] == '.') w_l++;
  }
  for(int i = N; i >= 0; --i) {
    if(i == N) {
      ans = b_l;
      continue;
    }
    int tmp = 0;
    if(S[i] == '#') {
      b_l--; b_r++;
      tmp = b_l + w_r;
    } else {
      w_l--; w_r++;
      tmp = b_l + w_r;
    }
    if(ans > tmp) ans = tmp;
  }
  cout << ans << endl;
}

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

int n, a, b, h, w;
int res;
int main()
{
    while(cin >> n >> a >> b)
    {
        res = 0;
        while(n--)
        {
            cin >> h >> w;
            if(h >= a && w >= b)
                res++;
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256