akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

 ll x,y;
 cin>>x>>y;
 ll legs=x*2;
 if(legs>y)
 {
     cout<<"No"<<endl;
 }
 else
 {
     while(x>0&&legs<y)
     {
         legs+=2;
         x--;
         if(legs==y)
            break;
     }
     if(legs==y)
     {
         cout<<"Yes"<<endl;
     }
     else
     {
         cout<<"No"<<endl;
     }
 }
return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x)  (int)x.size()
#define en     '\n'
#define sp     ' '
#define in(v)  for(auto &a: v)cin >> a;
#define out(v) for(auto &a: v)cout << a << sp;cout << en;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int c;
    cin >> c;
    if(c == 1)cout << "0\n";
    else cout << "1\n";
    return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, a[N], r;

int32_t main(){_
   
   cin>>n>>r;

   if (n >= 10){
      cout<<r;
      exit(0);
   }

   cout<<r + 100 * (10-n);
   

   return 0;
}

Measured memory_bytes: 256
#define DEBUG(...)
/*                        Strip me down and go to town                        */
/*                          Lick me over upside down                          */
/*                     Pound and pound and pound and pound                    */
/*                        Baby make me make that sound                        */
/*                Aaah, aaah, aaah, aaah, aaaaaaaaaaaaaaaaaah!                */
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>

using namespace std;
typedef long long int LL;
const LL INF = 1000000000;

int comp[1005];
int len[1005];
char str[1005][20];
int cost[1 << 17];
int n;
priority_queue<pair<int,int> > Q;

int getLen(int mask) {
  int ret = 0;
  while (mask > 1) {
    mask /= 2;
    ret++;
  }
  return ret;
}

int rev(int mask, int l) {
  int ret = 0;
  for (int i = 0; i < l; i++) {
    ret |= (1 << (l-i-1)) * ((mask & (1 << i)) > 0);
  }
  return ret;
}

int merg(int M, int m, int l) {
  int mask = (1 << l) - 1;
  return (M & mask) == (m & mask);
}

int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", str[i]);
    int l = strlen(str[i]);
    for (int j = 0; j < l; j++) {
      comp[i] |= (1 << j) * (str[i][j] - '0');
    }
    comp[i] |= (1 << l);
    len[i] = l;
  }
  for (int i = 0; i < 1<<17; i++) {
    cost[i] = -1;
  }
  Q.push(pair<int,int>(0, 1));
  while (!Q.empty()) {
    int v = Q.top().second;
    int c = -Q.top().first;
    Q.pop();
    if (cost[v] != -1) continue;
    cost[v] = c;
    int L = getLen(v);
    int Ma = v ^ (1 << L);
    for (int i = 0; i < n; i++) {
      int l = len[i];
      int ma = comp[i] ^ (1 << l);
      if (L + l <= 16) {
        int nmask = Ma | (ma << (L));
        nmask |= (1 << (L + l));
        if (cost[nmask] == -1) {
          Q.push(pair<int,int>(-(c + l), nmask));
        }
      }
      if (L >= l && merg(Ma, ma, l)) {
        int nmask = Ma >> l;
        nmask |= (1 << (L-l));
        if (cost[nmask] == -1) {
          Q.push(pair<int,int>(-(c), nmask));
        }
      }
      if (l >= L && merg(Ma, ma, L)) {
        int nmask = ma >> L;
        nmask |= (1 << (l-L));
        if (cost[nmask] == -1) {
          Q.push(pair<int,int>(-(c + (l-L)), nmask));
        }
      }
    }
  }
  int ans = INF;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int a = i, b = j;
      if (len[i] < len[j]) {
        a = j;
        b = i;
      }
      int val = 1;
      for (int k = 0; k < len[b]; k++) {
        if (str[a][len[a]-1 - k] != str[b][len[b]-1 - k]) {
          val = 0;
          break;
        }
      }
      if (val == 1) {
        int mask = 0, car = 1;
        for (int k = 0; k < len[a] - len[b]; k++) {
          mask |= car * (str[a][k] - '0');
          car *= 2;
        }
        mask |= car;
        if (cost[mask] != -1) {
          ans = min(ans, cost[mask] + len[b]);
        }
      }
    }
  }
  if (ans < INF) printf("%d\n", ans);
  else printf("0\n");
  return 0;
}


Measured memory_bytes: 4356
n, y = map(int, input().split())

a, b, c = -1, -1, -1

for i in range(n+1):
    for j in range(n-i+1):
        k = n - i - j
        if 10000*i + 5000*j + 1000*k == y:
            a, b, c = i, j, k

print(a, b, c)

Measured memory_bytes: 3060
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;

int n;
struct P{
	char ch[12];
	int l;
	bool operator <(const P &z)const{
	     for(int i=1;i<=min(l,z.l);++i){
				if(ch[i]<z.ch[i])return true;
				if(ch[i]>z.ch[i])return false;
	     }
	     if(l<z.l)return true;
	     return false;
	}
}a[300010];
inline bool cmp(int i,int j){
	if(a[i]<a[j])return false;
	if(a[j]<a[i])return false;
	return true;
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%s",a[i].ch+1);
		a[i].l=strlen(a[i].ch+1);
	}
	sort(a+1,a+n+1);
	int lst=1,ans=0;
	for(int i=1;i<=n;++i){
		if(i>1&&(!cmp(i,i-1)))lst=i;
		ans=max(ans,i-lst+1);
	}
	lst=1;
	for(int i=1;i<=n;++i){
		if(i>1&&(!cmp(i,i-1)))lst=i;
		if(i-lst+1==ans){
			for(int j=1;j<=a[i].l;++j)printf("%c",a[i].ch[j]);
			puts(""); 
		}
	}
	return 0;
}

Measured memory_bytes: 6144
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define deb(x) cout<<#x<<" = "<<x<<"\n";
#define F first
#define S second

bool fun(pair<string , int> p1, pair<string , int>p2)
{
	if(p1.F == p2.F) return p2.S<p1.S;
	return p2.F>p1.F;
}
signed main()
{
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//#endif
	/************************************/
	
	int n; cin>>n;
	vector<pair<string , int> > city(n), kk;
	
	for(int i=0; i<n; i++)
		cin>>city[i].F>>city[i].S;
	kk = city;
	sort(city.begin(), city.end(), fun);
	
	//for(auto it : city) cout<<it.first<<" "<<it.second<<"\n";
	int ans[n];
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<n; j++)
		{
			if(city[i] == kk[j])
			{
				cout<<j+1<<"\n";
				break;
			}
		}
	}
	
}

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

#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) (x).begin(), (x).end()

inline void Main() {
  // code
  int n, k, h, r = 0;
  cin >> n >> k;
  rep(i, n) {
    cin >> h;
    if(h >= k) r++;
  }
  cout << r << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n;
long long a[404], b[404], d[404][404];
int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) b[i] = b[i - 1] + a[i];
    for (int i = 1; i < n; i++) for (int j = 1; j + i <= n; j++) {
        int l = j, r = j + i;
        d[l][r] = 1e18;
        for (int k = l; k < r; k++)
            d[l][r] = min(d[l][r], d[l][k] + d[k + 1][r] + b[r] - b[l - 1]);
    }
    cout << d[1][n] << '\n';
}

Measured memory_bytes: 4880
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll a,b,v,w,t;

int main()
{
	cin>>a>>v>>b>>w>>t;
	if(a==b)
	{
		return puts("YES"),0;
	}
	ll tmp=abs(a-b);
	if(v<=w) return puts("NO"),0;
	ll p2=(v-w)*t;
	if(p2>=tmp) puts("YES"); else puts("NO");
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <bitset>
#include <set>
using namespace std;

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

set<int> ans;
int k[11];
int s[11][11];
int p[11];

void gen(int i, int v)
{
    if(i > 0) {
        gen(i - 1, v << 1);
        gen(i - 1, (v << 1) + 1);
    } else {
        ans.insert(v);
    }
}

int solve(int n, int i, int v)
{
    if(n > 0) {
        solve(n - 1, i, v << 1);
        solve(n - 1, i, (v << 1) + 1);
    } else {
        int c = 0;
        for(int k2 = 1; k2 <= k[i]; k2++) {
            int a = 1 << (s[i][k2] - 1);
            if(a & v) {
                c++;
            }
        }
        if(c % 2 != p[i]) {
            IFD cout << "v: " << bitset<10>(v) << endl;
            ans.erase(v);
        }
    }
}

int main()
{
    int N, M;

    cin >> N >> M;
    for(int i = 1; i <= M; i++) {
        cin >> k[i];
        for(int k2 = 1; k2 <= k[i]; k2++) {
            cin >> s[i][k2];
        }
    }
    for(int i = 1; i <= M; i++) {
        cin >> p[i];
    }

    gen(N, 0);

    IFD {
        for(auto itr = ans.begin(); itr != ans.end(); itr++) {
            cout << bitset<10>(*itr) << " ";
        }
        cout << endl;
    }

    for(int i = 1; i <= M; i++) {
        IFD cout << "[i] " << i << endl;
        solve(N, i, 0);
    }

    IFD {
        for(auto itr = ans.begin(); itr != ans.end(); itr++) {
            cout << bitset<10>(*itr) << " ";
        }
        cout << endl;
    }

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

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int N;
	int W[100];
	int i,j;
	int s1=0,s2=0;
	int abs;

	scanf("%d",&N);
	for(i=0; i<N; i++){
		scanf("%d",&W[i]);
	}
	i=0; j=N-1;
	while(1){
		if(s1>=s2){
			s2 += W[j];
			j--;
		}else{
			s1 += W[i];
			i++;
		}
		if(i>j)break;
	}
	if(s1>=s2)abs=s1-s2;
	else abs=s2-s1;
	printf("%d\n",abs );
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
typedef long long ll;
ll ans,n;
ll f(ll n,ll k){
    while(n%k==0){
        n/=k;
    }
    if(n%k==1)return 1;
    else return 0;
}
int main(void){
    cin>>n;
    if(n==2){cout<<1<<endl;return 0;}
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            ans+=f(n,i);
            if(i*i!=n){ans+=f(n,n/i);}
        }
    }
    for(ll i=2;i*i<=n-1;i++){
        if((n-1)%i==0){
            ans+=f(n,i);
            if(i*i!=(n-1)){ans+=f(n,(n-1)/i);}
        }
    }
    cout<<ans+2<<endl;
}


Measured memory_bytes: 384
#pragma GCC optimize "trapv"
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int M = 1000000007;
#define pb push_back
#define fs first
#define sc second
#define forn(i,k,n) for(int i = k; i < n; ++i)
#define nfor(i,n,k) for(int i = n; i >= k; --i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vvpii vector<vector<pait<int,int>>>
#define all(arr) arr.begin(), arr.end()
#define endl '\n'
#define dbgarr(V,n) forn(i,0,n) cout << V[i] << " "; cout << endl;
#define dbgarrrev(V,n) nfor(i,n,0) cout << V[i] << " "; cout << endl;
#define dbgmaze(V) for(auto x: V) {for(auto y : x) cout << y <<  " ";cout << endl;}
#define dbg2d(V,n,m) forn(i,0,n) {forn(j,0,m) cout << V[i][j] <<  " ";cout << endl;}
#define N 100005
#define inf 1000000000
int H[N];
int dp[N];
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, k; cin >> n >> k;
	forn(i,0,n) cin >> H[i];
	dp[0] = 0; dp[1] = abs(H[1] - H[0]);
	dp[2] = min(abs(H[2] - H[0]), dp[1] + abs(H[2] - H[1]));
	forn(i,3,k + 1){
		dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), abs(H[0] - H[i]));
	}
	forn(i,k + 1,n){
		dp[i] = inf;
		nfor(j,k,0){
			dp[i] = min(dp[i], dp[i - j] + abs(H[i - j] - H[i]));
		}
	}
//	dbgarr(dp,n);
	cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 4360
import numpy as np

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

a = np.zeros(M, dtype='int')
b = np.zeros(M, dtype='int')
for i in range(M):
    a[i], b[i] = map(int, input().split())

ind = np.argsort(b)
a = a[ind]
b = b[ind]

num_broken_bridge = 0
last_bridge_position = - float("inf")
for i in range(len(a)):
    if a[i] > last_bridge_position:
        last_bridge_position = b[i] - 1
        num_broken_bridge += 1
    
print(num_broken_bridge)

Measured memory_bytes: 22240
n=int(input())
maxn=110000
dp=[n for i in range(maxn)] #n円のお金は、最悪全部１円玉でn枚でok
dp[0]=0
for i in range(n): #0-(n-1)円まで
    pow6=1
    while i+pow6<=n:
        dp[i+pow6]=min(dp[i+pow6],dp[i]+1)
        pow6*=6
    pow9=1
    while i+pow9<=n:
        dp[i+pow9]=min(dp[i+pow9],dp[i]+1)
        pow9*=9
print(dp[n])

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 1000000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, a[200002], sum = 0, maxx = 0;
  cin >> n;
  rep(i, n) {
    cin >> a[i];
    a[i] -= (i + 1);
  }
  sort(a, a + n);
  ll mid = a[n / 2];
  rep(i, n) {
    a[i] -= mid;
    sum += abs(a[i]);
  }
  cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
using namespace std ;

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e18
#define endl "\n"

ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,(e-1)/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,(e-1)/2);
	return power(b*b,e/2);
}

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

	int n,k;
	cin>>n>>k;
	int a[n],dp[n+1],i,j;
	for(i=0;i<n;i++)
		cin>>a[i];
	dp[1]=0;dp[2]=abs(a[1]-a[0]);
	for(i=3;i<=n;i++)
	{
		dp[i]=dp[i-1]+abs(a[i-1]-a[i-2]);
		for(j=2;j<=k && i-j>0 ;j++)
			dp[i]=min(dp[i],dp[i-j]+abs(a[i-1]-a[i-j-1]));
	}
	cout<<dp[n];
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
    int a,b,c,d,e;
    scanf("%d %d %d %d %d", &a ,&b ,&c ,&d ,&e);
    if(c>=e){
        if(a>=c+e){
            if(d>=e){
                if(b>=e+d){
                    printf("Yes\n");
                }
                else{
                    printf("No\n");
                }
            }
            else{
                printf("No\n");
            }
        }
        else{
            printf("No\n");
        }
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 584
N, K = map(int, input().split())
A_lst = list(map(int, input().split()))
mod = 10**9 + 7

count1 = 0
count2 = 0
for i in range(N):
    for j in range(i+1, N):
        if j <= K * N - 1 and A_lst[i] > A_lst[j]:
            count1 += 1
    for j in range(N):
        if j <= K * N - 1 and A_lst[i] > A_lst[j]:
            count2 += 1

count2 %= mod

F = (K-1)*K // 2
F %= mod

ans = count1 * K + count2 * F
ans %= mod

"""
if A_lst[N-1] > A_lst[0]:
    ans -= 1
"""

print(ans)

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

int main(){
    int t;
    cin>>t;
    int a=0,b=0,c=0,d=0;
    while(t--){
        string s;
        cin>>s;
        if(s=="AC")a++;
        if(s=="WA")b++;
        if(s=="TLE")c++;
        if(s=="RE")d++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
    return 0;
}

Measured memory_bytes: 3628
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) {
		java.util.Scanner s = new java.util.Scanner(System.in);
		BigInteger n = s.nextBigInteger();
		if (BigInteger.ONE.equals(n)) {
			System.out.println(0);
		} else {
			System.out.println(n.add(BigInteger.ONE).multiply(n)
					.divide(BigInteger.valueOf(2)).subtract(n));
		}
	}
}

Measured memory_bytes: 21972
import math
import numpy as np
from operator import mul

# 整数Nを桁ごとのリストにする
# l = [int(x) for x in list(str(N))]

# リストliから重複を削除したリストli_uniqを作成
#li_uniq = []
#for i in li:
#    if x not in li_uniq:
#        li_uniq.append(x)

# 複数行のinput - list版
#list = [list(map(int, input().split())) for i in range(N)]
# 複数行のinput - dictionary版
# key = a, value = b
#for i in range(N):
#    a, b = map(int, input().split())
#    dict[a] = b


X = int(input())
A = int(input())
B = int(input())

X = X - A
while X >= 0:
    X = X - B

print(X + B)


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

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

	int p[N], min_p[N], answer;

	cin >> p[0];
	min_p[0] = p[0];
	answer = 1;
	for (int i = 1; i < N; i++) { 
		cin >> p[i]; 
		min_p[i] = min(p[i], min_p[i - 1]);	

		if (p[i] == min_p[i]) answer++;
	}
	
	cout << answer << endl;
	
	return 0;
}

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

const int N = 1e6 + 100;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    vector<int> F(N);
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        F[x]++;
    }
    for(int i = 1; i < N; i++) {
        if(F[i] == 0) continue;
        if(F[i] == 1) ans++;
        for(int j = i+i; j < N; j += i) {
            F[j] = 0;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 7092
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}

const int maxn=100005;
//i_am_noob
int n,t,a,b,minn=4e18;

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> t;
	rep(n){
		cin >> a >> b;
		if(b<=t) minn=min(minn,a);
	}
	if(minn>3e18) print1("TLE");
	else print1(minn);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define mod1 998244353
#define timepass 1073741824
#define MAXN 200000 + 5
#define LOGN 20
#define over ((1ll << 32))
using namespace std;
#define N 2005

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define int ll 
#define all(arr) arr.begin() , arr.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i , a , n) for(int i = a ; i < n ; i++)
#define rrep(i , n , a) for (int i = n - 1 ; i >= a ; i--)
#define ms(arr , val) memset(arr , val , sizeof(arr))
#define sp(a , x) cout << fixed << setprecision(a) << x << endl; 
#define siz(temp) (ll)temp.size()
#define len(temp) (ll)temp.length()
#define s(arr) sort(all(arr))
#define r(arr) reverse(all(arr))
#define rs(arr) s(arr) ; r(arr)
#define pi acos(-1)
#define con continue
#define endl "\n"
#define w(q) while(q--)

//debug
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace7(a, b, c, d, e, f , g) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<< f << " | "<< #g <<": "<<g<<endl
#define trace8(a, b, c, d, e, f , g , h) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<< f << " | " << #g <<": "<< g <<" | "<<#h<< ": " << h << endl

typedef pair<int , int> pii;
typedef pair<int , pii> piii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<piii> vpiii;

signed main()
{
    int a , b;
    cin >> a >> b;
    if (abs(a - b) % 2 != 0)
    {
        cout << "IMPOSSIBLE\n";
    }
    else
    {
        cout << min(a , b) + (abs(a - b) / 2) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    long long N;
    cin >> N;
    long long res = 0;

    // same
    for (long long a = 1; a * a < N; ++a) ++res;

    // different
    for (long long a = 1; a * a <= N; ++a) {
        for (long long b = a + 1; a * b < N; ++b) {
            res += 2;
        }
    }
    cout << res << endl;
}

















Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int M;
    cin >> M;
    vector<pair<ll, ll>> A(M);
    rep(i, M) cin >> A[i].first >> A[i].second;
    
    ll sum = 0;
    ll dig = 0;
    rep(i, M) {
        sum += A[i].first * A[i].second;
        dig += A[i].second;
    }
    ll div = sum / 9;
    if(sum % 9 == 0) div -= 1;
    ll ans = div + dig - 1;
    output(ans);
    
    
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	long long int a = 0;
	long long int count = 1;
	cin >> a ;
	while (1) {
		if (a == 4 || a == 1 || a == 2) {
			break;
		}
		if (a % 2 == 0) {
			a = a / 2;
		}
		else {
			a = 3 * a + 1;
		}
		count++;
	}
	cout << count + 3 << endl;
	return 0;
}

Measured memory_bytes: 3592
import sys
import numpy as np

n=int(sys.stdin.readline())
#x=list(map(int,sys.stdin.readline().split()))
x=np.array([sys.stdin.readline().split() for i in range(1)],np.int64)

min=(100**2)*n
for i in range(1,101):
    a=np.sum((i-x)**2)
    if a<min:
        min=a
print(min)
    


Measured memory_bytes: 21696
#include  <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 1000000007
//P pa(114,514);   ,vector<P>vec(N,0);
//vector<vector<int>> vec(縦, vector<int>(横));
#define REP(i,N) for(int i=0;i<N;i++)
int gcd(int a, int b) {
    if(a>b){
        swap(a,b);
        }
    while(b%a!=0){
        b%=a;
        swap(a,b);
    }
    return a;
}
int kaijou(int n){
    int a=1;
  if(n==0){
    return 1;
  }
    REP(i,n){
        a*=i+1;
    }
    return a;
}
int ncr(int n,int r){
  int a;
  if(n<0||r<0||n<r){
    return 0;
  }
  a=kaijou(n)/kaijou(r)/kaijou(n-r);
  return a;
}
//cout << setprecision(123);
int main(){
  int n;
  cin>>n;
  vector<int>v(n);
  REP(i,n)cin>>v[i];
  
  sort(v.begin(),v.end());
  cout<<v[n/2]-v[n/2-1]<<endl;
}

Measured memory_bytes: 640
import sys

def resolve():
    N, M = list(map(int, input().split()))
    XYZ = [list(map(int, input().split())) for _ in range(N)]
    ans = 0
    for bits in range(1<<3):
        coef = [-1, -1, -1]
        for odr in range(3):
            if bits & (1<<odr):
                coef[odr] = 1
        _XYZ = sorted(XYZ, key=lambda x: coef[0]*x[0]+coef[1]*x[1]+coef[2]*x[2], reverse=True)
        totals = [0, 0, 0]
        for i in range(M):
            totals[0] += _XYZ[i][0]
            totals[1] += _XYZ[i][1]
            totals[2] += _XYZ[i][2]
        ans = max(ans, sum(map(abs, totals)))
    print(ans)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 39792
n = int(input())
a = list(map(int, input().split()))

dp = [0]*n
for i in range(n):
    if i >= 2:
        dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]))
    elif i == 1:
        dp[i] = abs(a[i]-a[i-1])
print(dp[-1])

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
int h[2019],t=1,c;
int main(){
	string s;
	long long ans=0;
	int i,j;
	cin>>s;
	int n=s.size();
	s=' '+s;
	for(i=n;i;--i)++h[c=(c+(s[i]-'0')*t)%2019],t=t*10%2019;
	ans+=h[0];
	for(i=0;i<2019;++i)ans+=h[i]*(h[i]-1)>>1;
	cout<<ans;
}

Measured memory_bytes: 3820
#include <stdio.h>

int main(){
  int fuda[50];
  int tfuda[50];
  int n,r,p,c,i,ii,iii;
  
  scanf("%d %d",&n,&r);
  while (n!=0 && r!=0){
    for(i=0;i<n;i++) fuda[i]=n-i;

    // printf("{");
    //for(iii=0;iii<n;iii++)
    //  printf("%d,",fuda[iii]);
    //printf("}"); 


    for(i=0;i<r;i++){
      scanf("%d %d",&p,&c);
      p--;
      for (ii=0;ii<p;ii++)
	tfuda[ii]=fuda[ii];
      for (ii=0;ii<c;ii++)
	fuda[ii]=fuda[ii+p];
      for (ii=c;ii<c+p;ii++)
	fuda[ii]=tfuda[ii-c];

      //     printf("{");
      //  for(iii=0;iii<n;iii++)
      //    printf("%d,",fuda[iii]);
      //   printf("}"); 

    }
    printf("%d\n",fuda[0]);
    
    scanf("%d %d",&n,&r);
    //printf(";%d;",r);
  }
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
#define err(x) cout<<#x<<"= "<<x<<endl;
#define FOR(i,a,b) for(int i =a; i< b; ++i)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define INF 1000000000
#define TRVI(it,it1,it2) for(vi::iterator it = it1; it!= it2; it++)
#define ff first
#define ss second
#define mp make_pair
#define pq priority_queue<int, vector<int>, greater<int> >
#define ll long long
const ll PR = 1000000009;
#define SIZE 1
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'

int main(){
//	#ifdef ONLINE_JUDGE
//	freopen("a.in", "r" , stdin);
//	freopen("a.out", "w", stdout);
//      cin.tie(false); cout.tie(false);	
//	#endif
	ios::sync_with_stdio(false);
	int no=0,ne=0,z;
	int n;
	cin>>n;
	for(int i = 0; i< n; i++){
		cin>>z;
		if(z%2)no++;
		else ne++;
	}
	if(no%2  && n>1){
		cout<<"NO"<<endl;}
	else
		cout<<"YES"<<endl;



	return 0;
};

Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <stdio.h>

using namespace std;

#define fo(i,n) for(int i=0; i<(int)n; i++)
#define rep(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
#define pii pair<int,int>

int n,m;
int par[100010];
long long w[100010];

int get(int a) {
	if (a==par[a]) return a;
	int p = par[a];
	p = get(p);
	w[a] += w[par[a]];
	par[a] = p;
	return par[a];
}

void connect(int a, int b, int c) {
	int i = get(a);
	int j = get(b);
	par[i] = j;
	w[i] = -(w[a] - c - w[b]);
}

int main() {

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

	while (scanf("%d%d",&n,&m) && n!=0) {
		for (int i=0; i<n; i++) par[i] = i;
		for (int i=0; i<n; i++) w[i] = 0;
		
		for (int i=0; i<m; i++) {
			char c[5];
			scanf("%s",c);
			if (c[0]=='!') {
				int a,b,d;
				scanf("%d%d%d",&a,&b,&d);
				a--; b--;
				if (get(a)==get(b)) continue;
				connect(a,b,d);
			}
			else {
				int a,b;
				scanf("%d%d",&a,&b);
				a--; b--;
				if (get(a)!=get(b)) {
					printf("UNKNOWN\n");
				}
				else {
					printf("%lld\n",w[a]-w[b]);
				}
			}
		}
	}
	
    return 0;

}

Measured memory_bytes: 3408
#include <stdio.h>
#include <algorithm>

#define MAX 100

using namespace std;

int numbers[MAX];

int selectionSort(int a[], int n)
{
    int i, j, place, swapNum = 0;
    for (i = 0; i < n - 1; i++) {
        place = i;
        for (j = i; j < n; j++) {
            if (a[j] < a[place]) place = j;
        }
        swap(a[i], a[place]);
        if (i != place) swapNum++;
    }
    return swapNum;
}

int main()
{
    // input
    int n, i, swapNum;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &numbers[i]);
    }
    // processing
    swapNum = selectionSort(numbers, n);
    // output
    for (int i = 0; i < n; i++) {
        if (i) printf(" ");
        printf("%d", numbers[i]);
    }
    printf("\n");
    printf("%d\n", swapNum);

    return 0;
}

Measured memory_bytes: 2632
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int y = sc.nextInt();
		for (int i = 0; i <= n; i++) {
		    for (int j = 0; i + j <= n; j++) {
		        int k = n - i - j;
	            int cash = i * 10000 + j * 5000 + k * 1000;
	            if (y == cash) {
	                System.out.println(i + " " + j + " " + k);
	                return;
	            }
		    }
		}
		System.out.println("-1 -1 -1");
	}
}


Measured memory_bytes: 21844
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    FOR(i,1,10000) {
        int g = int(i * 8 / 100.0);
        int h = int(i / 10.0);
        // cout << g << ' ' << h << endl;
        if (g == a && h == b) {
            cout << i;
            return 0;
        }
    }
    cout << -1;
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m = MOD){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}

//-------------------< start here >-------------------------// 
void solve(){
   int n;
   cin >> n;
   
   vector<int> v(n);
   for(auto &it : v) cin >> it;	
   int odd = 0, even = 0;
   
   for(auto it : v){
	   if (it % 2 == 0) even++;
	   else odd++;  
	 }
   if (odd % 2 == 0) cout << "YES" << endl;
   else cout << "NO" << endl;
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
   #endif
}


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

int main() {
  int N, A;
  
  cin >> N;
  cin >> A;

  if ((N % 500 == 0) || (N % 500 < A)) {
    cout << "Yes" << endl;
  } else { 
    cout << "No" << endl;
  }
}

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

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);

int main() {
    fastio;

    int n;
    cin >> n;
    int A[n];
    FOR(i, 0, n) {cin >> A[i];}
    int switches = 0;
    int current = 0;
    bool possible = false;
    while (switches < n) {
        current = A[current]-1;
        switches++;
        if (current == 0) {
            break;
        } else if (current == 1) {
            possible = true;
            break;
        }
    }
    possible ? cout << switches << "\n" : cout << -1 << "\n";
    return 0;
}


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

int main(){
  int A[3][3];
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> A[i][j];
    }
  }
  int N; cin >> N;
  for(int i=0; i<N; i++){
    int tmp; cin >> tmp;
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if(A[j][k]==tmp) A[j][k]=0;
      }
    }
  }
  bool isbingo=false;
  
  //tate
  for(int i=0; i<3; i++){
    if(A[0][i]==0&&A[1][i]==0&&A[2][i]==0) isbingo=true;
  }
  //yoko
  for(int i=0; i<3; i++){
    if(A[i][0]==0&&A[i][1]==0&&A[i][2]==0) isbingo=true;
  }
  //naname
  if(A[0][0]==0&&A[1][1]==0&&A[2][2]==0) isbingo=true;
  if(A[0][2]==0&&A[1][1]==0&&A[2][0]==0) isbingo=true;
  cout << (isbingo?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;
 
int main(){
  int n,m,k;
  cin>>n>>m>>k;
  vector<int>a(n);
  vector<int>b(m);
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];

  ll t=0;
  rep(i,m)t+=b[i];

  int j=m;
  int ans=0;
  rep(i,n+1){
    while(j>0&&t>k){
      --j;
      t-=b[j];
    }
    if(t>k)break;
    ans=max(ans,i+j);
    if(i==n)break;
    t+=a[i];
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4828
def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


if __name__ == '__main__':
    n, x = map(int, input().split())
    X = list(map(int, input().split()))

    X = sorted(X)

    if n == 1:
        print(abs(X[0] - x))
        exit()

    diff = []
    for i in range(n):
        diff.append(abs(x-X[i]))

    ans = 0
    if (len(diff) == 1):
        print(diff[0])
        exit()
    else:
        ans = gcd(diff[0], diff[1])
        for i in range(2, len(diff)):
            ans = gcd(ans, diff[i])

        print(ans)


Measured memory_bytes: 19960
#include<iostream>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<queue>

using namespace std;

int  n;
long long k;
pair<long long,int> a[200005];

int bit[200005];

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

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

int main(){
  cin>>n;
  cin>>k;
  for(int i=0;i<n;i++){
    long long tmp;cin>>tmp;
    a[i] = make_pair(tmp-k,i);
  }

  for(int i=1;i<n;i++){
    a[i].first += a[i-1].first;
  }

  sort(a,a+n);

  //for(int i=0;i<n;i++)cout<<a[i].first<<" "<<a[i].second<<endl;
  //cout<<endl;

  long long ans = 0;


  for(int i=0;i<n;i++){
    //for(int j=0;j<=n;j++)cout<<bit[j]<<" ";cout<<endl;
    ans += (long long)sum(a[i].second);
    //cout<<i<<" "<<a[i].second<<" "<<ans<<endl;
    add(a[i].second+1, 1);
  }

  //cout<<ans<<endl;

  for(int i=0;i<n;i++){
    if(a[i].first >= 0) ans++;
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
 int main()
 {
     int n;
     int a[200000];
     cin>>n;
     for(int i=0;i<n;i++)
     {
         cin>>a[i];
     }
     sort(a,a+n);
     int x=unique(a,a+n)-a;
     if(x%2)
     {
         cout<<x;
     }
     else
     {
         cout<<x-1;
     }
     return 0;
}

Measured memory_bytes: 640
import sys
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
N = int(input())
C1 =  [0] * 3
C2 =  [0] * 3
C3 =  [0] * 3
for j in range(N):
    b = int(input())
    if b in A1:
        C1[A1.index(b)]=1
    if b in A2:
        C2[A2.index(b)] = 1
    if b in A3:
        C3[A3.index(b)] = 1

if sum(C1)==3 or sum(C2)==3 or sum(C3)==3:
    print('Yes')
    sys.exit()
elif C1[0]+C2[1]+C3[2]==3:
    print('Yes')
    sys.exit()
elif C3[0]+C2[1]+C1[2]==3:
    print('Yes')
    sys.exit()
else:
    for m in range(3):
        if C1[m]+C2[m]+C3[m]==3:
            print('Yes')
            sys.exit()

print('No')

Measured memory_bytes: 62192
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=200005,M=1e9+7,Inv=M/2+1;
int a[N],cnt[N],f[N],d[N],pre[N],nxt[N],n;
struct Tree{
	int l,r,num1,num2,num3;
}T[N*4];
int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=x*x%M)
		if (y&1)(ans*=x)%=M;
	return ans;	
}
void build(int x,int l,int r){
	T[x].l=l;T[x].r=r;
	if (l==r)return;
	int mid=(l+r)/2;
	build(x*2,l,mid);
	build(x*2+1,mid+1,r);
}
void insert(int x,int y){
	if (T[x].l==T[x].r){
		T[x].num3++;
		(T[x].num2+=ksm(f[T[x].l],M-2))%=M;
		(T[x].num1+=f[T[x].l])%=M;
		return;
	}
	int mid=(T[x].l+T[x].r)/2;
	if (y<=mid)insert(x*2,y);
	else insert(x*2+1,y);
	T[x].num1=(T[x*2].num1+T[x*2+1].num1)%M;
	T[x].num2=(T[x*2].num2+T[x*2+1].num2)%M;
	T[x].num3=(T[x*2].num3+T[x*2+1].num3)%M;
}
int find1(int x,int l,int r){
	if (T[x].l>r||l>T[x].r)return 0;
	if (T[x].l>=l&&T[x].r<=r)return T[x].num1;
	return (find1(x*2,l,r)+find1(x*2+1,l,r))%M;
}
int find2(int x,int l,int r){
	if (T[x].l>r||l>T[x].r)return 0;
	if (T[x].l>=l&&T[x].r<=r)return T[x].num2;
	return (find2(x*2,l,r)+find2(x*2+1,l,r))%M;
}
int find3(int x,int l,int r){
	if (T[x].l>r||l>T[x].r)return 0;
	if (T[x].l>=l&&T[x].r<=r)return T[x].num3;
	return (find3(x*2,l,r)+find3(x*2+1,l,r))%M;
}
signed main(){
	scanf("%lld",&n);
	for (int i=1;i<=n;i++)scanf("%lld",&a[i]),cnt[a[i]]++;
	for (int i=n;i;i--)cnt[i]+=cnt[i+1];
	for (int i=1;i<=n;i++)cnt[i]-=n-i;
	int num=1;
	for (int i=1;i<=n;i++)(num*=cnt[i])%=M;
	if (!num){
		puts("0");
		return 0;
	}
	f[0]=1;
	for (int i=1;i<=n;i++){
		d[i]=(cnt[i]-1)*ksm(cnt[i],M-2)%M;
		f[i]=f[i-1]*(d[i]==0?1:d[i])%M;
	}
	pre[1]=1;nxt[n]=n+1;
	for (int i=2;i<=n;i++){
		if (!d[i])pre[i]=i;
		else pre[i]=pre[i-1];
	}
	for (int i=n-1;i;i--){
		if (!d[i+1])nxt[i]=i+1;
		else nxt[i]=nxt[i+1];
	}
	int ans=0;
	build(1,1,n);
	for (int i=n;i;i--){
		(ans+=num*find1(1,a[i]+1,nxt[a[i]]-1)%M*ksm(f[a[i]],M-2)%M*Inv)%=M;
		(ans+=num*find3(1,1,a[i])-num*find2(1,pre[a[i]],a[i])%M*f[a[i]]%M*Inv%M+M)%=M;
		insert(1,a[i]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 32640
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;
const int M = 1e9 + 7;
#pragma unused(M)

int main(){
	int n, t;
	cin >> n >> t;
    vector<int> as(n);
    int mini = M, diff = -1, ans = 1;
    for(int i=0;i<n;i++){
        // cin >> as[i];
        int a;
        cin >> a;
        mini = min(mini, a);
        if(diff < a - mini){
            diff = a - mini;
            ans = 1;
        }else if(diff == a - mini){
            ans++;
        }
    }
    cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1272
#![allow(unused_imports)]
use proconio::{
   fastout, input,
   marker::{Bytes, Isize1, Usize1},
};

const INF: usize = std::usize::MAX;
macro_rules !min {($a :expr $(,) *) =>{{$a } } ;($a :expr ,$b :expr $(,) *) =>{{std ::cmp ::min ($a ,$b ) } } ;($a :expr ,$($rest :expr ) ,+$(,) *) =>{{std ::cmp ::min ($a ,min !($($rest ) ,+) ) } } ;}
macro_rules !chmin {($base :expr ,$($cmps :expr ) ,+$(,) *) =>{{let cmp_min =min !($($cmps ) ,+) ;if $base >cmp_min {$base =cmp_min ;true } else {false } } } ;}

#[fastout]
fn main() {
   input! {
      mut n: usize,
      mut t: [usize; n],
      mut v: [usize; n]
   }
   let mut tm = 0;
   for i in 0..n {
      t[i] *= 2;
      v[i] *= 2;
      tm += t[i];
   }
   t.insert(0, 0);
   v.insert(0, 0);
   t.push(0);
   v.push(0);
   n += 2;
   let mut vm = vec![INF; tm + 1];
   let mut l = 0;
   for i in 0..n {
      let r = l + t[i];
      for tn in 0..l {
         chmin! {vm[tn], v[i] + l - tn};
      }
      for tn in l..=r {
         chmin! {vm[tn], v[i]};
      }
      for tn in r + 1..=tm {
         chmin! {vm[tn], v[i] + tn - r};
      }
      l = r;
   }
   let mut ans = 0;
   for t in 0..tm {
      ans += 2 * vm[t];
   }
   println!("{}", (ans as f64) / 8.0);
}


Measured memory_bytes: 2296
/**
 * @author      : omgursocute
 * @file        : 149/B.cpp
 * @created     : 30/12/2019
 */

#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	ll a, b, k;
	cin >> a >> b >> k;

	if(k <= a) cout << a-k << ' ' << b;
	else if(k <= a+b) cout << "0 " << b-(k-a);
	else cout << "0 0";
	
	return 0;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n int
	fmt.Fscan(in, &n)
	
	T := 0
	X := 0
	Y := 0

	for i := 0; i < n; i++ {
		var t, x, y int
		fmt.Fscan(in, &t, &x, &y)
		
        if (t^x^y)&1 == 1 || abs(x-X)+abs(y-Y) > t-T {
			fmt.Println("No")
			return
		}

		T, X, Y = t, x, y
	}
	fmt.Println("Yes")
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

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

template<typename T>
T kiriage(T a, T b)
{
	return (a + b - 1) / b;
}

int N, A, B;
int h[100010];

bool ok(int num)
{
	ll cnt = 0;
	rep(i,N) {
		ll tmp = (ll)h[i] - (ll)num * (ll)B;
		if (tmp > 0) {
			cnt += kiriage(tmp, (ll)(A - B));
		}
	}
	return cnt <= num;
}

void Main()
{
	cin >> N >> A >> B;
	rep(i, N) cin >> h[i];
	int l = 0;
	int r = 1e9;
	while (r >= l) {
        int mid = l + (r - l) / 2;
		if (ok(mid)) r = mid - 1;
		else l = mid + 1;
    }
	cout << l << endl;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 640
import std.stdio, std.array, std.conv, std.string;

void main() {
  while (true) {
    string[] input = split(readln());
    int h = to!int(input[0]);
    int w = to!int(input[1]);

    if (h == 0 && w == 0) return;

    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        write("#");
      }
      writeln("");
    }

    writeln("");
  }
}

Measured memory_bytes: 2464
#include<stdio.h>
int search(int A[], int n, int key){
    int i=0;
    A[n] =key;
    while (A[i] != key) i++;
    return i != n;
}

int main(){
    int i, n, A[10000+1], q, key, sum=0;
    
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &A[i]);
    }
    
    scanf("%d", &q);
    
    for(i=0; i<q; i++){
        scanf("%d", &key);
        if(search(A,n,key)) sum++;
    }
    printf("%d\n", sum);
    
    return 0;
}


Measured memory_bytes: 2768