akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll N;
    string S;
    cin >> N;
    vector<ll> a(N);

    REP(i, N)
        cin >> a.at(i);
    
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    ll A = 0, B = 0;
    REP(i,N){
        if(i%2==0){
            A += a.at(i);
        }
        else{
            B += a.at(i);
        }
    }
    cout << A - B << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
using namespace std;
 
int main() {
    //input
    long long n;cin >> n;
    long long m;cin >> m;
    long long ans;

    //compute
    if(2 * n >= m){
        ans = m / 2;
    }else{
        m = m - 2 * n;
        ans = n + m / 4;
    }

    //output
    cout << ans << endl;
}

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

ll n;vector<vector<ll>> vw;vector<vector<ll>> dp;
ll c1,c2;

void dfs(ll i){
    ll j=i/2;
    if(i>1){
        for(ll k=c2;k+1;k--){
            if(dp[j-1][k]!=0 or k==0){
                ll ne=k+vw[i-1][1];
                if(ne<=c2)dp[i-1][ne]=max(dp[j-1][k]+vw[i-1][0],dp[i-1][ne]);
            }
            dp[i-1][k]=dp[j-1][k];
        }
    }
    if(i*2<=min(c1,n))dfs(i*2);
    if(i*2+1<=min(c1,n))dfs(i*2+1);
}

signed main(){
    cin>>n;
    vw.resize(n);
    REP(i,n){ll x,y;cin>>x>>y;vw[i]={x,y};}
    c1=1<<10;c2=100000;
    dp.resize(c1);REP(i,c1)dp[i].resize(c2+1);
    dp[0][vw[0][1]]=vw[0][0];
    dfs(1);
    REP(i,c1)REP(j,c2)dp[i][j+1]=max(dp[i][j],dp[i][j+1]);
    ll q;cin>>q;
    REP(i,q){
        ll v,l;cin>>v>>l;
        vector<ll> cand;
        while(v>c1){
            cand.push_back(v);
            v=v/2;
        }
        ll r=cand.size();
        ll ans=0;
        REP(j,1<<r){
            ll v_sub=0;ll w_sub=0;
            REP(k,r){
                if((j>>k)&1){
                    v_sub+=vw[cand[k]-1][0];
                    w_sub+=vw[cand[k]-1][1];
                }
            }
            if(w_sub<=l)ans=max(ans,dp[v-1][l-w_sub]+v_sub);
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 820252
n = int(input(''))
alist = list(map(int,input('').split()))

#print(alist)
h=0
pre=0
for a in alist:
    if pre>0 and pre>a:
        h+=(pre-a)
#        print('{}->{}[{}]'.format(a,pre,h))
    if a > pre:
        pre=a

print(h)        
    


Measured memory_bytes: 32232
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll q,h,s,d,n;
    cin>>q>>h>>s>>d>>n;
    if(q*2<h){
      h=q*2;
    }
    if(h*2<s){
      s=h*2;
    }
    if(s*2<d){
      d=s*2;
    }
    ll ans=0;
    if(n%2==0){
      ans=d*(n/2);
    }else{
      ans=d*(n/2)+s;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
let k = Int(readLine()!)!

func gcd(_ m: Int, _ n: Int) -> Int {
    var m = m
    var n = n
    var r: Int?
    if n > m {
        (m, n) = (n, m)
    }
    while r != 0 {
        r = m % n
        (m, n) = (n, r!)
    }
    return m
}

var result = 0

for a in 1...k {
    for b in 1...k {
        for c in 1...k {
            result += gcd(a, gcd(b, c))
        }
    }
}

print(result)


Measured memory_bytes: 7808
#include <iostream>
#include <vector>
#include <stdio.h>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <deque>
#include <map>
using namespace std;
#define intl long long
vector <intl> subset;
map <pair<string,string>, intl> m;
intl ans=0;
void search(intl k,string a,intl b,intl cual) {
	if (k == b) {
		if(cual==0){
			string r,t;
			for(intl i=0;i<b;i++){
				bool y=true;
				for(intl j=0;j<subset.size();j++){
					if(subset[j]==i){
						r.push_back(a[i]);
						y=false;
					}
				}
				if(y){
					t.push_back(a[i]);
				}
			}
			if(m.count({r,t})){
				m[{r,t}]++;
			}
			else{
				m[{r,t}]=1;
			}
		}
		else{
			string r,t;
			for(intl i=b-1;i>=0;i--){
				bool y=true;
				for(intl j=0;j<subset.size();j++){
					if(subset[j]==i){
						r.push_back(a[i]);
						y=false;
					}
				}
				if(y){
					t.push_back(a[i]);
				}
			
				
			}
			if(m.count({t,r})){
				
				ans+=m[{t,r}];	
			}
		}
	} 
	else {
	search(k+1,a,b,cual);
	subset.push_back(k);
	search(k+1,a,b,cual);
	subset.pop_back();
	}
}
int main(){
	intl a;
	cin>>a;
	string b;
	cin>>b;
	string c;
	for(intl i=0;i<a;i++){
		c.push_back(b[i+a]);
	}
	search(0,b,a,0);
	subset.resize(0);
	search(0,c,a,1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 46080
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}

vector<ll> pw2(51,1);vector<ll> pw10(19,1);
int main(){
    {rep1(i,50) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    ll ans=INF;
    ll tmp=sqrt(N)+3;
    rrep1(i,tmp){
        if(N%i==0){
            chmin(ans,i+(N/i)-2);
        }
    }
    cout<<ans;
}



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



int main(){
    int n;
    cin >> n;
    vector<int> cost(n);
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin >> h.at(i);
    }
    cost.at(0)=0;
    cost.at(1)=abs(h.at(0)-h.at(1));
    for(int i=2;i<n;i++){
        cost.at(i) = min(cost.at(i-1)+abs(h.at(i-1)-h.at(i)),cost.at(i-2)+abs(h.at(i-2)-h.at(i)));
    }
    cout << cost.at(n-1) << endl;
}

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

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

	return 0;
}

Measured memory_bytes: 256
MOD = 10**9+7
max_n = 1000

n = int(input())

ans = 0
nums = [0]*(n+1)

for i in range(1,n+1):  
  v = i
  j = 2
  while v > 0 and i>=j:    
    if v%j==0:
      nums[j] += 1
      v = v//j      
    else:
      j+=1

ans = 1      
for i in range(n+1):
  if nums[i] > 0:
    ans *= (1+nums[i])
  ans %= MOD

print(ans)    

Measured memory_bytes: 3064
#include "bits/stdc++.h"

#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;
const long double PI = (acos(-1));
const ull MOD = 1000000007;


struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i = 0; i < N; i++) cin >> S[i];
    vector<map<char,int>> cnt(N);
    for(int i = 0; i < N; i++) for(char c : S[i]) cnt[i][c]++;
    vector<char> ans;
    for(char x = 'a'; x <= 'z'; x++){
        int min_n = I_INF;
        for(int i = 0; i < N; i++) min_n = min(cnt[i][x], min_n);
        for(int i = 0; i < min_n; i++) ans.push_back(x);
    }
    sort(all(ans));
    for(char a : ans) cout << a;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<list>
#include<bitset>
#include<sstream>
using namespace std;

int main() {

	long long N;
	cin >> N;

	vector<long long> val(100001, 0);
	long long a;
	long long ans = 0;
	for (long long i = 0; i < N; i++) {
		cin >> a;
		if (a > 100000) {
			ans += 1;
		}
		else {
			val[a] += 1;
		}
	}

	for (long long i = 0; i < val.size(); i++) {
		if (val[i] >= i) {
			ans += val[i] - i;
		}
		else {
			ans += val[i];
		}
	}

	cout << ans << endl;

	return 0;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n, m;
  cin >> n >> m;
  vi h(n);
  rep(i, n) cin >> h[i];
  vvi to(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dump(h);
  int ans = 0;
  rep(i, n) {
    int ok = 1;
    for (auto& v : to[i]) {
      if (h[i] <= h[v]) {
        ok = 0;
        break;
      }
    }
    if (ok) ans++;
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include<list>
#include<algorithm>
#define ll long long int
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(a,b,c) for(a=b;a<c;a++)
#define repr for(i=n-1;i>=0;i--)
#define pll pair<ll, ll>
#define inf 100000001
#define mod 1000000007
#define lb lower_bound
#define up upper_bound
#define rep1 for(i=1;i<=n;i++)
#define vr vector
#define ef else if
#define all(x) (x).begin(), (x).end()
#define SORT(A) sort(A.begin(), A.end());
#define REVERSE(A) reverse(A.begin(), A.end());
#define MAX LLONG_MIN
#define MIN LLONG_MIN
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll myXOR(unsigned long long int x, unsigned long long int y)
{
    return (x|y)&(~x|~y);   
}
ll powerLL(ll x, ll n) 
{ 
    ll result = 1; 
    while (n) { 
        if (n & 1) 
            result = result * x % mod; 
        n = n / 2; 
        x = x * x % mod; 
    }
    return result; 
}
int main()
{
    // fastio
    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r, t,u,w,x,y,z;
    string str, s, ss, str1;
    cin>>n>>m;
    ll arr[m];
    ll sum=0;
    rep(i,0,m)
    {
    	cin>>a;
    	sum+=a;
    }
    if(sum>n)
    	cout<<-1;
    else
    	cout<<n-sum;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD (ll)1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll count = 0;
    ll i = 0;
    for (ll i = 0; i < n;)
    {
        count++;
        ll j = i;
        while (j < n && s[j] == s[i])
        {
            j++;
        }
        i = j;
    }
    cout << count << endl;
}

Measured memory_bytes: 512
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;

int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003

int dp[353][353]={0};
int bow[353][353]={0};


int main(){
	
	vector<int> p(1000100);
	
	p[1]=1;
	p[2]=1;
	p[3]=1;
	p[4]=1;
	p[5]=1;
	for(ll i=6;i<=1000000;i++){
		if(i%2==0&&p[i/2]||i%3==0&&p[i/3]||i%5==0&&p[i/5])
			p[i]=1;
	}
	
	int m,n;
	
	while(cin>>m,m!=0){
		cin>>n;
		ll count=0;
		for(int i=m;i<=n;i++)
			count+=p[i];
		cout<<count<<endl;
	}
	
	
	

	
}

Measured memory_bytes: 4900
import java.util.Scanner;

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

        while (true) {
            int n = sc.nextInt();
            if (n == 0)
                break;

            double m = 0;
            int[] s = new int [n];

            for (int i = 0; i < n; i++) {
                s[i] = sc.nextInt();
                m += s[i];
            }
            m /= n;

            double d = 0;

            for (int i = 0; i < n; i++) {
                d += Math.pow(s[i]-m,2);
            }

            System.out.println(Math.sqrt(d / n));
        }
    }
}


Measured memory_bytes: 31656
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn=100010;
int n;
int a;

int main(){
   scanf("%d",&n);
   int temp1=0,temp2=0;
   for(int i=0;i<n;i++){
        scanf("%d",&a);
        if(a%2==0) temp1++;
        if(a%4==0) temp2++;
   }
   temp1-=temp2;
   n=n-temp1+(temp1>=1);
   if(temp2>=n/2) puts("Yes");
   else puts("No");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int main() {
	scanf("%d%d",&n,&m);
	if(m>=(1<<n)) {
		puts("-1");
		return 0;
	}
	if(n==1) {
		if(m) {
			puts("-1");
		} else {
			puts("1 1 0 0");
		}
		return 0;
	}
	for(register int i=0; i<(1<<n); i++) {
		if(i!=m) {
			printf("%d ",i);
		}
	}
	printf("%d ",m);
	for(register int i=(1<<n)-1; i>=0; i--) {
		if(i!=m) {
			printf("%d ",i);
		}
	}
	printf("%d ",m);
	return 0;
}

Measured memory_bytes: 3816
from bisect import bisect_left

n = int(input())
l = list(map(int, input().split()))
ans = 0

l.sort()
for i in range(n-2):
  for j in range(i+1, n-1):
    ans += bisect_left(l, l[i]+l[j]) - j - 1
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<vector>
#include<algorithm>
#include<iterator>


using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int> v(N);
    for (auto &x : v)
    {
        cin>>x;
    }

    vector<int> tmp;
    copy(v.begin(),v.end(),back_inserter(tmp));

    sort(tmp.begin(),tmp.end());
int cnt=0;
    for (int i = 0; i < N; i++)
    {
        if(tmp[i]!=v[i])cnt++;
    }
    


    if(cnt==0||cnt==2){
        cout<<"YES"<<endl;
    }else{

    cout<<"NO"<<endl;
}
}


Measured memory_bytes: 256
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();
		int n = saori.saori_hayami();
		String[] s = saori.nextHayami().split("");
		String[] t = saori.nextHayami().split("");
		String ans = "";
		for(int i = 0;i < n;i++){
			ans += s[i];
			ans += t[i];
		}
		System.out.println(ans);
		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: 21332
#include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;

int main() {
    #ifdef LOCAL_RUN
    freopen("task.in", "r", stdin);
    freopen("task.out", "w", stdout);
    //freopen("task.err", "w", stderr);
    #endif // ONLINE_JUDGE
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, T;
    cin >> n >> T;

    int ans = T;
    int last;
    cin >> last;
    for (int i = 2; i <= n; ++i) {
        int x;
        cin >> x;
        if (last + T >= x) {
            ans -= last + T - x;
        }
        ans += T;
        last = x;
    }
    cout << ans << '\n';
}


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

int main() {
  int N, M, a, b;
  cin >> N >> M;
  vector<int> cnt(N);

  loop(i, M){
    cin >> a >> b;
    cnt.at(a - 1) += 1;
    cnt.at(b - 1) += 1;
  }

  loop(i, N) cout << cnt.at(i) << endl;
}


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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}

#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

void err(vector<string>::iterator it) {}

template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

/* Union Find (Disjoint Set) */
struct UF {
    vector<int> par, rk;

    UF(int _n) {
        par.resize(_n + 1), rk.assign(_n + 1, 0);
        for (int i = 0; i <= _n; ++i) {
            par[i] = i;
        }
    }

    int find(int x) {
        if (x != par[x]) par[x] = find(par[x]);
        return par[x];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    bool unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return false;
        if (rk[x] < rk[y]) par[x] = y;
        else {
            par[y] = x;
            if (rk[x] == rk[y]) rk[x]++;
        }
        return true;
    }
};

inline int encode(int x, int y, int h) {
	return x * (h + 1) + y;
}

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	int w, h;
	typedef pair<int, int> P;

	cin >> w >> h;
	vector<int> p(w), q(h);
	vector<P> es;
	REPU(i, 0, w) {
		cin >> p[i];
		es.push_back(P(p[i], i));
	}
	REPU(j, 0, h) {
		cin >> q[j];
		es.push_back(P(q[j], w + j));
	}
	sort(ALL(es));
	int r = 0, c = 0;
	ll ans = 0;
	REPU(i, 0, es.size()) {
		if (es[i].second >= w) {
			ans += es[i].first * 1LL * (w + 1 - r);
			c++;
		}
		else {
			ans += es[i].first * 1LL * (h + 1 - c);
			r++;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
using std::cin;
using std::cout;

int main() {
    int n;
    cin >> n;
    std::vector<int> h(n);
    for (int &hi : h) cin >> hi;

    for (int i = n - 1; i; --i) {
        if (h.at(i) < h.at(i - 1)) {
            h.at(i - 1)--;
            if (h.at(i) < h.at(i - 1)) {
                cout << "No\n";
                return 0;
            }
        }
    }
    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 3788
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        var k = sc.nextLong()

        val cnt = Array(100001) { 0L }
        for (i in 1..n) {
            val a = sc.nextInt()
            val b = sc.nextLong()
            cnt[a] += b
        }

        for (i in 0..100000) {
            if (k <= cnt[i]) {
                println(i)
                return
            } else {
                k -= cnt[i]
            }
        }
    }
}

class MyScanner {
    private var ptr = 0
    private var l = listOf<String>()

    fun next(): String {
        while (l.size <= ptr) {
            l = readLine()!!.split(' ')
            ptr = 0
        }
        return l[ptr++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun list(): List<String> {
        ptr = l.size
        return readLine()!!.split(' ')
    }

    fun intList() = list().map { s -> s.toInt() }
    fun longList() = list().map { s -> s.toLong() }
    fun doubleList() = list().map { s -> s.toDouble() }

    fun array() = list().toTypedArray()
    fun intArray() = intList().toIntArray()
    fun longArray() = longList().toLongArray()
    fun doubleArray() = doubleList().toDoubleArray()
}


Measured memory_bytes: 61124
#include "bits/stdc++.h"

using namespace std;
using uint = unsigned int;
using int64 = long long;
using uint64 = unsigned long long;
using vint = vector<int>;
using vint64 = vector<int64>;
#define rep(i,N) for(int i=0;i<(int)(N);++i)
#define rep1(i,N) for(int i=1;i<=(int)(N);++i)
#define fs first
#define sc second
#define eb emplace_back
#define all(x) x.begin(),x.end()

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

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "[";
	for (auto& e : v) os << e << ", ";
	return os << "]";
}

template<class T, class U> ostream& operator<<(ostream& os, const vector<pair<T, U>> p) {
	os << "P(" << p.first << ", " << p.second << endl;
}

/*
template<class T, class U> ostream& operator<<(ostream& os, const map<T, U>& mp) {
	os << "{";
	for (auto& e : mp) os << P << " ";
	return os << "}";
}
*/

void Main();
signed main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
}

/* Insert from here! */
/* Cut from here! */

void Main() {
	int Q; cin >> Q;
	for (int i = 0; i < Q; ++i) {
		int c, a, n; cin >> c >> a >> n;
		int ans = 0;

		int n1 = min({ c, a, n });
		ans += n1;
		c -= n1, a -= n1, n -= n1;

		int n2 = min(c / 2, a);
		ans += n2;
		c -= n2 * 2, a -= n2;

		ans += c / 3;

		cout << ans << endl;
	}
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; ++i) cin >> a[i];
  int q;
  cin >> q;
  while(q--) {
    int b, e, k;
    cin >> b >> e >> k;
    cout << count(a.begin()+b, a.begin()+e, k) << endl;
  }
  return 0;
}



Measured memory_bytes: 3056
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

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

    // i番目まででj枚使ってkになる個数
    static long long dp[51][51][2501] = {0};
    for (int i = 0; i <= n; ++i) {
        dp[i][0][0] = 1;
    }

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = a * n; k >= 0; --k) {
                if (k - x[i - 1] >= 0) {
                    dp[i][j][k] += dp[i - 1][j - 1][k - x[i - 1]];
                }
                dp[i][j][k] += dp[i - 1][j][k];
            }
        }
    }

    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        int target = a * i;

        ans += dp[n][i][target];
    }

    cout << ans << endl;
}

Measured memory_bytes: 49280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define MOD 1'000'000'007LL

#define N 2048
ll fct[N]={1};

inline ll pw(ll a, ll b){
	ll c=1, d=a;
	while(b){
		if(b&1) c=c*d%MOD;
		d=d*d%MOD;
		b /= 2;
	}
	return c;
}

inline ll inv(ll a){
	return pw(a, MOD-2);
}

inline ll cmb(ll a, ll b){
	return fct[a]*inv(fct[b])%MOD*inv(fct[a-b])%MOD;
}

int main(){
	FOR(i, 1, N) fct[i]=fct[i-1]*i%MOD;
	ll n, k; scanf("%lld%lld", &n, &k);
	FOR(i, 1, k+1){
		ll ans = cmb(k-1, i-1);
		if(n-k+1 < i) ans=0;
		else ans = ans * cmb(n-k+1, i) % MOD;
		printf("%lld\n", ans);
	}
}


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


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))

import itertools
def main():
    n, m, k = input_to_int_map()
    a_list = input_to_int_tuple()
    b_list = input_to_int_tuple()


    a_sums = [0]
    temp_sums = 0
    for temp in a_list:
        temp_sums += temp
        a_sums.append(temp_sums)
    temp_sums = 0
    b_sums = [0]
    for temp in b_list:
        temp_sums += temp
        b_sums.append(temp_sums)

    ans = 0
    j = m
    for i in range(n + 1):
        now_a_sum = a_sums[i]
        if now_a_sum > k:
            continue

        while b_sums[j] > k - now_a_sum:
            j -= 1

        ans = max(ans, i + j)

    return ans

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


Measured memory_bytes: 48396
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
using namespace std;
int main() {
	int A[12] = { 0,1,0,2,0,2,0,0,2,0,2,0 },x,y;
	cin >> x >> y;
	if (A[x-1] == A[y-1])cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

asum = sum(A)
asumhalf = asum/2.0
foresum = 0
presum = 0
for ai in A:
	foresum += ai
	if foresum>=asumhalf: break
	presum = foresum

latsum = asum-foresum
difa = abs(foresum-latsum)
latsum = asum-presum
difb = abs(presum-latsum)
print(min(difa,difb))

Measured memory_bytes: 80976
#include <stdio.h>

int main(){
	int L, R, d, ctr = 0;
	scanf("%d %d %d", &L, &R, &d);
	
	
	while(L <= R){
		if( L % d == 0){
			ctr = ctr + 1;		
		}
		L++;
		
	}
	printf("%d\n", ctr);
	
	return 0;
}

Measured memory_bytes: 1688
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <map>
#include <iomanip>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main()
{
    int n;
    cin >> n;
    map<int, vector<pair<int, int>>> g;
    rep(i, n - 1)
    {
        int a, b, w;
        cin >> a >> b >> w;

        g[a].push_back({b, w});
        g[b].push_back({a, w});
    }
    int ans[n + 1];
    map<int, bool> used;
    ans[1] = 0;
    queue<int> que;
    que.push(1);
    used[1] = true;
    while (!que.empty())
    {
        // cerr << que.size() << endl;
        int t = que.front();
        que.pop();
        for (auto x : g[t])
        {
            int b = x.first, w = x.second;
            if (used[b] == true)
            {
                continue;
            }
            if (w % 2 == 0)
            {
                ans[b] = ans[t];
            }
            else
            {
                ans[b] = 1 - ans[t];
            }
            used[b] = true;
            que.push(b);
        }
    }
    rep(i, 1, n + 1)
    {
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 17024
import java.io.*;

/**
 * Created by Ayushi on 01/09/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] a = r.readLine().split("");
        String[] b = r.readLine().split("");
        r.close();

        int ans = 0;
        if (a[0].equals(b[0])) ans++;
        if (a[1].equals(b[1])) ans++;
        if (a[2].equals(b[2])) ans++;

        System.out.println(ans);
    }
}


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

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

int dist[100][100];
int dist2[100][100];

int INF = 1e8;

using namespace std;

int main() {
  while(1) {
    int n,m,l,k,a,h;
    cin>>n>>m>>l>>k>>a>>h;
    if(!n) break;
    REP(i,n)REP(j,n) dist[i][j] = INF;
    vector<int> fv(l+2);
    REP(i,l) cin>>fv[i];
    fv[l] = a; fv[l+1] = h;
    l+=2;
    REP(i,k) {
      int x,y,t;
      cin>>x>>y>>t;
      dist[x][y] = dist[y][x] = t;
    }
    REP(k,n)REP(i,n)REP(j,n) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
    REP(i,l)REP(j,l) {
      dist2[i][j] = dist[fv[i]][fv[j]];
      if (dist2[i][j] > m) dist2[i][j] = INF;
    }
    REP(k,l)REP(i,l)REP(j,l) dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j]);
    int d = dist2[l-2][l-1];
    if (d >= INF) {
      cout << "Help!" << endl;
    } else if (d > m) {
      cout << 2 * (d - m) + m << endl;
    } else {
      cout << d << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int red = 0;
  int blue = 0;
  for(int i=0; i<N; i++){
    if(S.at(i) == 'R'){
      red++;
    }
    else{
      blue++;
    }
  }
  if(red > blue){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt(), a = scanner.nextInt();
        int[] x = java.util.stream.IntStream.range(0, n)
                .map(i -> scanner.nextInt())
                .toArray();
        long[][][] dp = new long[n + 1][n + 1][2501];
        dp[0][0][0]++;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                for (int k = 0; k <= 2500; k++) {
                    if (dp[i][j][k] != 0) {
                        dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
                        dp[i + 1][j][k] += dp[i][j][k];
                    }
                }
            }
        }
        System.out.println(java.util.stream.IntStream.rangeClosed(1, n)
                .mapToLong(i -> dp[n][i][i * a])
                .sum());
    }
}

Measured memory_bytes: 87620
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################
from fractions import gcd

# 最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)


N = int(input())
T = [0] * N
for i in range(N):
    t = int(input())
    T[i] = t

ans = T[0]
for i in range(1, N):
    ans = lcm(ans, T[i])

print(ans)

Measured memory_bytes: 5048
import java.util.Scanner;

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

		int N = sc.nextInt();
		int X = sc.nextInt();
		int count = 1;
		int point = 0;
		for (int i = 0; i < N; i++) {
			point += sc.nextInt();
			if(point<=X) {
				count++;
			}else {
				break;
			}
		}
      sc.close();
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
#define int long long
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);
#define f first
#define s second

const int maxn = 200010;
vector <int> v;
int n;

int pre[maxn];
int suf[maxn];

int32_t main() {
	cin >> n;
	for (int i =0;i<n;i++) {
		char x; cin >> x;
		if (x == 'W') v.push_back(1);
		else v.push_back(0);
	}
	
	for (int i =0;i<n;i++) {
		pre[i] = (i==0?0:pre[i-1]) + (v[i] == 1);
	}
	
	for (int i =n-1;i>=0;i--) {
		suf[i] = suf[i+1] + (v[i] == 0);
	}
	
	int ans = suf[0];
	for (int i =0;i<n;i++) {
		int swaps = min(pre[i],suf[i+1]);
		int res = swaps + pre[i]-swaps + suf[i+1] - swaps;
		ans = min(ans, res);
	}
	
	cout << ans;
}


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

def main():
    N = int(input())
    S = input().strip()
    
    E = [0]*N
    e = 0
    for i in range(0,N):
        E[i] = e
        if S[i] == "W":
            e += 1
    W = [0]*N
    w = 0
    for i in range(N-1,-1,-1):
        W[i] = w
        if S[i] == "E":
            w += 1

    X = [0]*N
    for i in range(N):
        X[i] = W[i] + E[i]
    print(min(X))
if __name__ == '__main__':
    main()


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

int main(void) {
    int N;
    cin >> N;
    map<string, int> M;

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

    cout << M.size() << endl;

    return 0;
}

Measured memory_bytes: 19100
#include<stdio.h>
#define HASHSIZE 3456781
#define SIZE 1000
struct hash {
  long long v;
  int f;
};
struct hash h[HASHSIZE], *hend = h+HASHSIZE;
int N;
long long V, V2, V3;
long long a[SIZE], b[SIZE], c[SIZE], d[SIZE];
int Input(long long *x);
void Insert(long long n);
int Lookup(long long n);
int main(void)
{
  int i, j, ca, cb, cc, cd;
  long long temp, ans = 0;
  scanf("%d%lld", &N, &V);
  V2 = V - 2, V3 = V - 3;
  ca = Input(a);
  cb = Input(b);
  cc = Input(c);
  cd = Input(d);
  for (i = 0; i < ca; i++) {
    for (j = 0; j < cb; j++) {
      temp = a[i] + b[j];
      if (temp <= V2) Insert(temp);
    }
  }
  for (i = 0; i < cc; i++) {
    for (j = 0; j < cd; j++) {
      temp = c[i] + d[j];
      if (temp <= V2) ans += Lookup(V - temp);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
int Input(long long *x)
{
  int i, count = 0;
  long long temp;

  for (i = 0; i < N; i++) {
    scanf("%lld", &temp);
    if (temp <= V3) x[count++] = temp;
  }
  return count;
}
void Insert(long long n)
{
  struct hash *p = h + (int)(n % HASHSIZE);
  while (p->v) {
    if (p->v == n) {
      p->f++;
      return;
    }
    if (++p == hend) p = h;
  }
  p->v = n, p->f = 1;
}

int Lookup(long long n)
{
  struct hash *p = h + (int)(n % HASHSIZE);
  while (p->v) {
    if (p->v == n) return p->f;
    if (++p == hend) p = h;
  }
  return 0;
}


Measured memory_bytes: 55896
using System;
using System.Collections.Generic;

    class Program
    {
        static void Main(string[] args)
        {
            var line = System.Console.ReadLine();
            int N = Convert.ToInt16(line);
            int[] cards = new int[N];
            line = Console.ReadLine();
            var nums = line.Split(new char[] { ' ' });

            for (int i = 0; i < N; i++)
            {
                cards[i] = Convert.ToInt32(nums[i]);
            }
            Array.Sort(cards);
            Array.Reverse(cards);

            int a = 0;
            int b = 0;
            
            for (int i = 0; i < N; i++)
            {
                if (i % 2 != 0) { b += cards[i]; }
                else { a += cards[i]; }
            }

            int diffp = a - b;
            Console.WriteLine(diffp);
        } 
    }

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int n;
int a[N], b[N], c[N];
int ans = 0;

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	for(int i = 1; i <= n; i++)
	{
		cin >> b[i];
		ans += b[i];
	}
	for(int i = 1; i <= n; i++)
		cin >> c[i];
	for(int i = 2; i <= n; i++)
	{
		if(a[i] - a[i - 1] == 1)
			ans += c[a[i - 1]];
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int  ll;
const ll mod = 1e9+7;
#define rep(i,a,b) for(ll i=a;i<b;i++)

void swap(ll &a , ll &b){
    ll t = a;
    a = b;
    b = t;
}

ll min(ll a, ll b){
    if(a<b)return a;
    return b;
}

ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

 ll pow(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return ans;
}

const int MAX = 1e5+3;

vector<ll> vp[MAX];

ll indegree[MAX];

int main(){

  
   ios_base :: sync_with_stdio(0);
   cin.tie(0);
   ll n;
   cin>>n;
   ll a[n];
   ll total = 0;
   rep(i , 0 ,n){
    cin>>a[i];
    total += a[i];
   }

   ll dp[n+1][n+1];
   memset(dp ,0  ,sizeof(dp));
   for(int i = 0 ; i <n;i++){
        dp[i+1][i+1] = a[i];
        if(i+2 <= n)
            dp[i+1][i+2] = max(a[i],a[i+1]);
   }

   ll t1,t2;
   for(int len = 3;len<=n;len++){
        /// i....j -> i or j
        for(int i = 1 ; i <= n;i++){
            int j = i+(len-1);
            if(j >n)break;
            t1 = a[i-1]+min( dp[i+2][j],dp[i+1][j-1]);
            t2 = a[j-1]+min( dp[i][j-2] , dp[i+1][j-1]  );
            dp[i][j] = max(t1,t2);
           // cout<<" for i = "<<i<<" j = "<<j<<" val = "<<dp[i][j]<<endl;
        }
   }
   total = (total-dp[1][n]);

    cout<<dp[1][n]-total;

}


Measured memory_bytes: 72960
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

#define EPS 1e-9


int main() {
	ld x;
	ld y = 100.0;
	cin >> x;
	int ret = 0;
	while (y < x - EPS) {
		y *= 1.01;
		y = (ll)(y + EPS);
		ret++;
	}
	cout << ret << endl;

//	cout << 1 + int(((logl(x) - logl(100))/logl(1.01)) - EPS)  << endl;
	return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

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

    ll H, W; cin >> H >> W;
    ll ans = INFL;

    REPS(h, H-1)
    {
        ll s = h * W;
        ll t = (H-h) / 2 * W;
        ll u = H * W - s - t;
        chmin(ans, max(s, max(t, u))-min(s, min(t, u)));

        t = W / 2 * (H-h);
        u = H * W - s - t;
        chmin(ans, max(s, max(t, u))-min(s, min(t, u)));
    }

    swap(H, W);
    REPS(h, H-1)
    {
        ll s = h * W;
        ll t = (H-h) / 2 * W;
        ll u = H * W - s - t;
        chmin(ans, max(s, max(t, u))-min(s, min(t, u)));

        t = W / 2 * (H-h);
        u = H * W - s - t;
        chmin(ans, max(s, max(t, u))-min(s, min(t, u)));
    }

    cout << ans << endl;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    if(a >= 13){
        cout << b << endl;
    }else if(a >= 6){
        cout << b / 2 << endl;
    }else{
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
#define debug(x) cout << #x << " = " << x << '\n'
#define debug_arr(a , n) for(ll i = 0 ; i < n ; i++)cout << a[i] << " "
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define vi vector<ll>
#define vll vector<ll> 
#define inf 1000000000
#define mod 1000000007

const ll max_n = 1e5 + 9;

typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a , ll b)
{
    ll prod = 1;
    while(b)
    {
        if(b&1)
        prod = (prod*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return prod;
}
int main()
{
    ll n;
    cin >> n;

    ll a[n];
    for(ll i = 0 ; i < n ; i++)
        cin >> a[i];
    
    map<ll,ll> m;

    ll sum = 0;
    for(ll i = 0 ; i < n ; i++){
        ll num = i+1 - a[i];

        sum += m[num];
        // debug(num);
        // debug(m[num]);
        m[i + a[i]+1]++;
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 27880
S = input()
T = input()
n = len(S)

X = [[] for _ in range(26)]
Y = [[] for _ in range(26)]
for i in range(n):
    s = ord(S[i]) - 97
    t = ord(T[i]) - 97
    X[s].append(i)
    Y[t].append(i)

P = [tuple(x) for x in X]
Q = [tuple(y) for y in Y]
if set(P) == set(Q):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 17072
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define FOR0(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)

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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256