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


using namespace std;

using ll = long long;
using ld = long double;

#define mp make_pair

int p = 1000000007;


int mul(int a, int b) {
    return (1LL * a * b) % p;
}

int add(int a, int b) {
    int s = (a+b);
    if (s>=p) s-=p;
    return s;
}

int sub(int a, int b) {
    int s = (a+p-b);
    if (s>=p) s-=p;
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}

struct DSU {
    vector<int> sz;
    vector<int> parent;

    void make_set(int v) {
        parent[v] = v;
        sz[v] = 1;
    }

    int find_set(int v) {
        if (v == parent[v])
            return v;
        return parent[v] = find_set(parent[v]);
    }

    void union_sets(int a, int b) {
        a = find_set(a);
        b = find_set(b);
        if (a != b) {
            if (sz[a] < sz[b])
                swap(a, b);
            parent[b] = a;
            sz[a] += sz[b];
        }
    }

    DSU(int n) {
        sz.resize(n);
        parent.resize(n);
        for (int i = 0; i < n; i++) make_set(i);
    }
};

/*const int N = 1200000;

vector<int> facs(N), invfacs(N);

void init()
{
    facs[0] = 1;
    for (int i = 1; i<N; i++) facs[i] = mul(facs[i-1], i);
    invfacs[N-1] = inv(facs[N-1]);
    for (int i = N-2; i>=0; i--) invfacs[i] = mul(invfacs[i+1], i+1);
}

int C(int n, int k)
{
    return mul(facs[n], mul(invfacs[k], invfacs[n-k]));
}*/

vector<pair<int, pair<int, int>>> edges;

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

    int n;
    cin>>n;

    vector<pair<pair<int, int>, int>> a(n);

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

    sort(a.begin(), a.end());
    for (int i = 0; i<n-1; i++) edges.push_back(mp(abs(a[i].first.first - a[i+1].first.first), mp(a[i].second, a[i+1].second)));

    for (int i = 0; i<n; i++) swap(a[i].first.first, a[i].first.second);

    sort(a.begin(), a.end());
    for (int i = 0; i<n-1; i++) edges.push_back(mp(abs(a[i].first.first - a[i+1].first.first), mp(a[i].second, a[i+1].second)));

    sort(edges.begin(), edges.end());

    DSU dsu(n);

    ll res = 0;
    for (auto it: edges)
    {
        if (dsu.find_set(it.second.first)!=dsu.find_set(it.second.second))
        {
            res+=it.first;
            dsu.union_sets(it.second.first, it.second.second);
        }
    }
    cout<<res;




}



Measured memory_bytes: 6004
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	int c=(a%m+b%m);	if(c>=m)	c-=m;	return c;}
int sub(int a,int b,int m=mod){	int c=(a%m-b%m);	if(c<0)		c+=m;	return c;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}
//	x<<1 => x*2		x>>1 => x/2;	cout<<flush;
//	cout<<fixed<<setprecision(10)<<ans<<endl;


void solve()
{
	int n,i,a=0,b=0,c=0,d=0;
	cin >> n ;
	string s;
	for(i=0;i<n;i++){
	    cin >> s;
	    if(s=="AC")a++;
	    else if(s=="WA")b++;
	    else if(s=="TLE")c++;
	    else d++;
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << b << endl;
	cout << "TLE x " << c << endl;
	cout << "RE x " << d << endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++){	solve();}
	return 0;
}

Measured memory_bytes: 3652
def examA():
    A, B, C = LI()
    ans = "No"
    if (A+B)-C>=0:
        ans = "Yes"
    print(ans)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examA()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
    {
        cout<<"YES"<<endl;

    }
    else
    {
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
ll n,k;
ll p(ll x,vector<pii> v)
{
	ll sum=0;
	for(ll i=0;i<n;i++)
	{
		if(v[i].fi>x)
		{
			sum+=((v[i].fi-x+v[i].se-1)/v[i].se);
		}
	}
	if(sum<=k)
	return true;
	return false;
}
ll binsearch(ll low,ll high,vector<pii> v)
{
	if(low==high)
	{
		return low;
	}
	ll mid=(low+high)/2;
	if(p(mid,v)==true)
	return binsearch(low,mid,v);
	else
	return binsearch(mid+1,high,v);
}
int main()
{
	//ll n,k;
	cin>>n>>k;
	vector<ll> a(n),f(n);
		ll sum=0;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	for(ll i=0;i<n;i++)
	{
		cin>>f[i];
	}
	if(sum<=k)
	{
		cout<<0;
		return 0;
	}
	sort(a.begin(),a.end());
	sort(f.rbegin(),f.rend());
	vector<pii> v;
	ll mx=0;
	for(ll i=0;i<n;i++)
	{
		v.pb(mp(a[i]*f[i],f[i]));
		mx=max(a[i]*f[i],mx);
	}
	ll ans=binsearch(0,mx,v);
	cout<<ans;
}

Measured memory_bytes: 131508
<?php
$input = explode(' ', fgets(STDIN));
$a = trim($input[0]);
$b = trim($input[1]);
 
    if($a < $b)
        print("a < b\n");
    elseif ($a > $b)
        print("a > b\n");
    else
        print("a == b\n");

Measured memory_bytes: 15284
import java.util.Scanner;

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

			long S = scan.nextLong();

			long mod = (long)1e9+7;

			COMinit();


			if(S<3) {
				System.out.println(0);
				return;
			}
//for(long S = 1;S<=2000;S++) {





			long goukei = 0;
			long k = S/3;

			for(int i = 1;i<=k;i++) {
				int amari =  (int)(S-3*i);
				if(amari==0) {
					goukei =  (goukei+1)%mod;
					continue;
				}
				for(int j = 1;j<=i;j++) {
					if(j>amari)break;
					long go = (COM(i,j)*COM(amari-1,j-1))%mod;
					goukei =  (goukei+go)%mod;

				}
			}


			System.out.println(goukei);
//}






		}


	}


	//拡張ユークリッドでの逆元の求め方でnCkをつくる、前処理必須。

	static  int MAX = 510000;
	static  int MOD = 1000000007;

	 static long[] fac = new long[MAX];
	 static long[] finv = new long[MAX];
	 static long[] inv = new long[MAX];

	// テーブルを作る前処理
	static void COMinit() {
	    fac[0] = fac[1] = 1;
	    finv[0] = finv[1] = 1;
	    inv[1] = 1;
	    for (int i = 2; i < MAX; i++){
	        fac[i] = fac[i - 1] * i % MOD;
	        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
	        finv[i] = finv[i - 1] * inv[i] % MOD;
	    }
	}

	// 二項係数計算
	static long COM(int n, int k){
	    if (n < k) return 0;
	    if (n < 0 || k < 0) return 0;
	    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}


}


Measured memory_bytes: 48876
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w0,r0,c,r,c0,i=0;
  while(1){
    i = 0;
    cin >> r0 >> w0 >> c >> r;
    if(w0==0 && r0==0 && c==0 && r==0) break;
    while(1){
      c0 = r0/w0;
      if(c0<c){
        r0 += r;
        i++;
      }else{
        break;
      }
    }
    cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 3084
#include <stdio.h>

int sort(int a[], int n)
{
	int i, j, temp;
	int cnt = 0;

	for (i = 0; i < n - 1; i++) {
		for (j = n - 1; j > i; j--) {
			if (a[j] < a[j - 1]) {
				temp = a[j - 1];
				a[j - 1] = a[j];
				a[j] = temp;
				cnt++;
			}
		}
	}

	return cnt;
}

int main(void) {
	int n, cnt;
	int line[100];
	int i;

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

	cnt = sort(line, n);

	for (i = 0; i < n; i++) {
		printf("%d", line[i]);
		if (i < n - 1) {
			printf(" ");
		}
	}
	printf("\n%d\n", cnt);

	return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;

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

    while (true) {
        int n, q; cin >> n >> q;
        if(n+q == 0) break;

        map<int, int> schedule;
        rep(i, n) {
            int m; cin >> m;
            rep(j, m) {
                int x; cin >> x;
                schedule[x]++;
            }
        }

        int ans = 100;
        int max_attendance = 0;
        for(const auto s: schedule) {
            if ((s.second>max_attendance)||
                (s.second==max_attendance && s.first < ans)) {
                ans = s.first;
                max_attendance = s.second;
            }
        }

        if (ans == 100 || max_attendance < q) cout << 0 << endl;
        else cout << ans << endl;
    }
}


Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int x,y;
	int p,q;
	int a,b,c,d;
	int sum,sum1;
	cin>>x>>y;
	cin>>p>>q;
	cin>>a>>b>>c>>d;
	sum=a*x+b*y+x/10*c+y/20*d;
	sum1=a*p+b*q+p/10*c+q/20*d;
	if(sum>sum1)		printf("hiroshi\n");
	else if(sum<sum1)	printf("kenjiro\n");
	else				printf("even\n");
	return 0;
}


Measured memory_bytes: 3088
#include<stdio.h>
int main()
{
  int h,a;
  scanf("%d %d",&h,&a);
  double times;
  int ans;
  times=(double)h/(double)a;
  ans=times;
  if(times!=h/a)
    ans++;
    
    
    
   printf("%d",ans);
 return 0; 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;

ll GCD(ll a,ll b){
  ll r = a % b;
  if(r==0){
    return b;
  }
  else{
    return GCD(b,r);
  }

}



int main() {
    
    int N;
    ll M;
    cin>>N>>M;
    ll A[N];
    rep(i,N){
        cin>>A[i];
        A[i]/=2;
    }
    int ord2=0;
    
    while(true){
        int count=0;
        rep(i,N){
        if(A[i]%2==1){
           count++;
        }
        
        }
        if(count==N){
            break;
        }
        else if(count==0){

        rep(i,N){
            A[i]/=2;
        }
        ord2++;
        
        }
        else{
            cout<<0<<endl;
            return 0;
        }

    }
    ll lcm=1;
    rep(i,N){
        ll gcd =GCD(lcm,A[i]);
        lcm=lcm*A[i]/gcd;
        if(lcm>M){
            cout<<0<<endl;
            return 0;
        }
        
    }
    rep(i,ord2){
        lcm*=2;
    }
    if(lcm>M){
        cout<<0<<endl;
    }
    else{
        cout<<((M/lcm)/2+(M/lcm)%2)<<endl;
    }
   
return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e12;

ll f(ll a, ll b, ll c, ll d) { return abs(a - b) + abs(c - d); }

int main() {
  ll n, ans = 0, mx1 = 0, mx0 = 0, mn0 = INF, mn1 = INF;
  cin >> n;
  vector<pair<ll, ll>> v(n), x(n);
  set<pair<ll, ll>> st;

  rep(i, n) {
    cin >> v[i].first >> v[i].second;
    st.insert(v[i]);
    x[i].first = v[i].first - v[i].second;
    x[i].second = v[i].first + v[i].second;
    mx0 = max(mx0, x[i].first);
    mn0 = min(mn0, x[i].first);
    mx1 = max(mx1, x[i].second);
    mn1 = min(mn1, x[i].second);
  }
  // cout << mx0 << " " << mx1 << " " << mn0 << " " << mn1 << endl;
  if (st.size() == 1) {
    cout << 0 << endl;
    return 0;
  }
  ans = max({mx0 - mn0, mx1 - mn1});
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 21928
#include <cstdio>
#include <cstring>

#define maxn 50
const int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
char mp[maxn][maxn];
bool vis[maxn][maxn];
int ans;
struct Queue {
  int x, y, d;
} q[maxn * maxn];
int n, m;
void bfs(int x, int y)
{
  memset(vis, 0, sizeof (vis));
  int head = 0, tail = 1;
  q[1] = (Queue) {x, y, 0}; vis[x][y] = 1;
  while (head < tail)
  {
    Queue now = q[++head];
    ans < now.d ? ans = now.d : 0;
    for (int i = 0; i < 4; ++i)
    {
      int nx = now.x + dx[i], ny = now.y + dy[i];
      if (!vis[nx][ny] && nx && ny && nx <= n && ny <= m && mp[nx][ny] != '#')
      {
        vis[nx][ny] = 1;
        q[++tail] = (Queue) {nx, ny, now.d + 1};
      }
    }
  }
}
int main()
{
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i)
    scanf("%s", mp[i] + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (mp[i][j] != '#')
      bfs(i, j);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

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

        int numberOfCombinationsForN = 0;
        for (int i = N - 1; i > 0; i--) {
            numberOfCombinationsForN += i;
        }

        int numberOfCombinationsForM = 0;
        for (int i = M - 1; i > 0; i--) {
            numberOfCombinationsForN += i;
        }
        System.out.println(numberOfCombinationsForN + numberOfCombinationsForM);
    }
}

Measured memory_bytes: 21972
n,ma,mb = map(int, input().split())
abc = [list(map(int, input().split())) for i in range(n)]

inf = float('inf')

dp = [[inf for i in range(n*10)] for i in range(n*10)]

for i in range(n):
    for j in range(i*10-1,-1,-1):
        for k in range(i*10-1,-1,-1):
            if dp[j][k]!=inf:
                dp[j + abc[i][0]][k + abc[i][1]] =min(dp[j+abc[i][0]][k+abc[i][1]],dp[j][k]+abc[i][2])
    dp[abc[i][0] - 1][abc[i][1] - 1]= min(dp[abc[i][0] - 1][abc[i][1] - 1], abc[i][2])

ans = inf

for j in range(n*10):
    for k in range(n*10):
        if ma*(k+1)==mb*(j+1):
            ans = min(ans,dp[j][k])

print(ans if ans!=inf else -1)

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

struct Edge {
    int from;
    int to;
    int cost;
};

struct Graph {
    Graph(const int n)
    {
        edge.resize(n);
    }
    void addEdge(const int from, const int to, const int cost)
    {
        edge[from].push_back(Edge{from, to, cost});
        edge[to].push_back(Edge{to, from, cost});
    }
    vector<vector<Edge>> edge;
};

int main()
{
    while (true) {
        int N, M;
        cin >> N >> M;
        if (N == 0 and M == 0) {
            break;
        }

        Graph load(N);
        Graph sea(N);

        for (int i = 0; i < M; i++) {
            int x, y, t;
            char sl;
            cin >> x >> y >> t >> sl;
            x--;
            y--;
            if (sl == 'L') {
                load.addEdge(x, y, t);
            } else {
                sea.addEdge(x, y, t);
            }
        }
        constexpr int INF = (1 << 28);
        vector<vector<int>> load_dist(N, vector<int>(N, INF));
        vector<vector<int>> sea_dist(N, vector<int>(N, INF));
        for (int i = 0; i < N; i++) {
            load_dist[i][i] = 0;
            sea_dist[i][i] = 0;
        }
        for (int i = 0; i < N; i++) {
            for (const auto& e : load.edge[i]) {
                load_dist[i][e.to] = min(load_dist[i][e.to], e.cost);
            }
        }
        for (int i = 0; i < N; i++) {
            for (const auto& e : sea.edge[i]) {
                sea_dist[i][e.to] = min(sea_dist[i][e.to], e.cost);
            }
        }
        for (int k = 0; k < N; k++) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    load_dist[i][j] = min(load_dist[i][j], load_dist[i][k] + load_dist[k][j]);
                    sea_dist[i][j] = min(sea_dist[i][j], sea_dist[i][k] + sea_dist[k][j]);
                }
            }
        }

        int R;
        cin >> R;
        vector<int> pos(R + 1, 0);
        for (int i = 0; i < R; i++) {
            cin >> pos[i + 1];
            pos[i + 1]--;
        }
        pos[0] = pos[1];
        vector<vector<int>> dp(R + 1, vector<int>(N, INF));  // i-th query; Ship @j-th town
        dp[0][pos[0]] = 0;

        for (int i = 0; i < R; i++) {
            for (int j = 0; j < N; j++) {
                for (int k = 0; k < N; k++) {
                    if (dp[i][k] == INF) {
                        continue;
                    }
                    const int toship = load_dist[pos[i]][k];
                    const int seacost = sea_dist[k][j];
                    const int totown = load_dist[j][pos[i + 1]];
                    dp[i + 1][j] = min(dp[i + 1][j], dp[i][k] + toship + seacost + totown);
                }
                dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + load_dist[pos[i]][pos[i + 1]]);
            }
        }
        int mini = INF;
        for (int i = 0; i < N; i++) {
            mini = min(mini, dp[R][i]);
        }
        cout << mini << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll N, A, B; cin >> N >> A >> B;
  int p[N]; rep(i,N) p[i]=i+1;
  if (A*B<N||A+B>N+1) { cout << -1 << endl; return 0; }

  int pos = 0;
  A = N-A;
  while(A>=B-1) {
    if (pos+B>N) break;
    reverse(p+pos,p+pos+B);
    pos += B;
    A -= B-1;
  }
  reverse(p+pos,p+pos+A+1);
  rep(i,N) cout << p[i] << " "; cout << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>

int main(void) {

	int a,b;
	
	while(1){
		scanf("%d%d",&a,&b);
		if(a==0&&b==0)break;
		if(a<b){
			printf("%d %d\n",a,b);
		}else{
			printf("%d %d\n",b,a);
		}
	}
	return 0;
}

Measured memory_bytes: 600
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#include <math.h>
#define pb push_back
using namespace std;
using ll = long long;
const char E = '\n';
const int N = 200005;
const ll mod = 1e9+7;
const int lim = 1e5;

mt19937_64 mt_rnd_64(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll l, ll r) {
    return (mt_rnd_64() % (r-l+1)) + l;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, a[N];
	pair <int, int> mx;
	cin >> n;
	for (int i=1; i<=n; i++)
    {
        cin >> a[i];
        if (a[i] > mx.first) mx = {a[i], mx.first};
        else if (a[i] > mx.second) mx.second = a[i];
    }
    for (int i=1; i<=n; i++)
    {
        if (a[i] != mx.first) cout << mx.first << E;
        else cout << mx.second << E;
    }
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include <math.h>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a < 10 && b < 10) cout << a * b << endl;
	else cout << -1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cmath>
#include<ctime>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<iomanip>
#include<utility>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define rg register
#define il inline
#define lch(x) ((x)<<1)
#define rch(x) ((x)<<1^1)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define rep0(i,n) for(register int i=0;i<(n);++i)
#define per0(i,n) for(register int i=(n)-1;i>=0;--i)
#define rep(i,st,ed) for(register int i=(st);i<=(ed);++i)
#define per(i,ed,st) for(register int i=(ed);i>=(st);--i)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef double dbl;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> il T qmin(const T &a,const T &b){return a<b?a:b;}
template<typename T> il T qmax(const T &a,const T &b){return a>b?a:b;}
template<typename T> il void getmin(T &a,const T &b){if(a>b) a=b;}
template<typename T> il void getmax(T &a,const T &b){if(a<b) a=b;}
il void fileio(string s){
	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

const int inf=(int)1e9+7;
const ll linf=(ll)1e17+7;
const int N=2e5+7;

int isend[N],dep[N],ch[N][2],node;
int n;
ll l,ans;
char tmp[N];

il ll lowbit(ll x){
	return x&-x;
}

il void ins(int &u,char *s,int d){
	if(!u){
		u=++node;
		dep[u]=d;
	}
	if(!*s){
		isend[u]=true;
		return;
	}
	ins(ch[u][*s-'0'],s+1,d+1);
}

il void dfs(int u){
	if(!u||isend[u]) return;
	if(!ch[u][0]||!ch[u][1]) ans^=lowbit(l-dep[u]);
	dfs(ch[u][0]),dfs(ch[u][1]);
}

int main(){
//	fileio("test");
	scanf("%d%lld",&n,&l);
	int rt=0;
	rep(i,1,n){
		scanf("%s",tmp);
		ins(rt,tmp,0);
	}
	dfs(rt);
	puts(ans?"Alice":"Bob");
	return 0;
} 

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>a>>b;
  cout<<max({a+b,a-b,a*b})<<endl;
  return 0;
}

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

using namespace std;

int main(){
  int x, y, z, k;
  cin >> x >> y >> z >> k;
  vector<int64_t> A(x), B(y), C(z);
  for (int i = 0; i < x; i++) cin >> A[i];
  for (int i = 0; i < y; i++) cin >> B[i];
  for (int i = 0; i < z; i++) cin >> C[i];
  
  sort(A.begin(), A.end(), greater<int64_t>());
  sort(B.begin(), B.end(), greater<int64_t>());
  sort(C.begin(), C.end(), greater<int64_t>());
  
  priority_queue<tuple<int64_t, int, int, int>> q;
  q.push(make_tuple(A[0] + B[0] + C[0], 0, 0, 0));
  int a, b, c;
  vector<int> d = {1, 0, 0};
  int64_t sum = 0;
  vector<int64_t> ans;
  set<tuple<int, int, int>> used;
  while(ans.size() != k){
    tie(sum, a, b, c) = q.top(); q.pop();
    if (used.count(make_tuple(a, b, c)) > 0)
      continue;
    used.insert(make_tuple(a, b, c));
    ans.push_back(sum);
    int na, nb, nc;
    for (int j = 0; j < 3; j++){
      na = a + d[j];
      nb = b + d[(j + 1) % 3];
      nc = c + d[(j + 2) % 3];
      if (na < 0 or na >= x) break;
      if (nb < 0 or nb >= y) break;
      if (nc < 0 or nc >= z) break;
      if (A[na] + B[nb] + C[nc] < 0)
        cout << A[na] + B[nb] + C[nc] << na << nb << nc << endl;
      q.push(make_tuple(A[na] + B[nb] + C[nc], na, nb, nc));
    }
  }
    
  for (const auto &ans_: ans)
    cout << ans_ << endl;
}
    
    

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    cout << (N + 1000 - 1) / 1000 * 1000  - N << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
	int s;
	string a;
	cin>>a;
	s=a.length();
	for (int i=0;i<s;i++)
	{
		if(a[i]==',')a[i]=' ';
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
using namespace std;

int main() {
    int H, W;
    while(1) {
        scanf("%d %d", &H, &W);
        if (H == 0 && W == 0) break;
        
        for (int i = 0; i < H; i++) {
            string line = "";
            for (int j = 0; j < W; j++) {
                line += "#";
            }
            line += "\n";
            printf("%s", line.c_str());
        }
        printf("\n");
    }
}


Measured memory_bytes: 2716
# C - Triangular Relationship

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

# arr = a mod k の値のカウント
arr = [0] * K
for a in range(1, N+1):
    arr[a%K] += 1

# arr(a mod k)の値の範囲を探索する(0 〜 k-1)
# aの取りうる値の範囲ではない！
ans = 0
for a in range(K):
    b = -a % K
    c = -a % K
    if (b+c)%K == 0:
        ans += arr[a] * arr[b] * arr[c]
print(ans)

Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define N 105
using namespace std;
int n;
struct vec {
	long long x, y;
	vec (long long tx = 0, long long ty = 0) { x = tx, y = ty; }
	vec operator + (const vec &t) const { return vec(x + t.x, y + t.y); }
	vec operator - (const vec &t) const { return vec(x - t.x, y - t.y); }
	long long lenth() { return x * x + y * y; }
}a[2 * N];
bool cmp(const vec &lhs, const vec &rhs) {
	return atan2(lhs.y, lhs.x) < atan2(rhs.y, rhs.x);
}
inline int read() {
	int x = 0; bool neg = false; char ch = getchar();
	while(!isdigit(ch)) (ch == '-') && (neg = true), ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return neg ? -x : x;
}
int main() {
	n = read();
	for(int i = 1; i <= n; ++i)
		a[i].x = read(), a[i].y = read();
	
	sort(a + 1, a + n + 1, cmp);
	
	for(int i = 1; i <= n; ++i)
		a[n + i] = a[i];
	
	vec cur;
	long long ans = 0;
	for(int l = 1; l <= n; ++l) {
		cur = vec(0, 0);
		for(int r = l; r < l + n; ++r) {
			cur = cur + a[r];
			ans = max(ans, cur.lenth());
		}
	}
	
	printf("%.10lf\n", sqrt(ans));
	return 0;
}


Measured memory_bytes: 4000
#include <bits/stdc++.h> 
using namespace std; 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
#define rand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define EPS 0.000001
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
void setIO(string s) {
  ios_base::sync_with_stdio(0); cin.tie(0); 
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}
int main()
{
  //flash;
  ve arr;
  int ans=0;
  for (int i = 0; i < 5; ++i)
  {
   int yo;cin>>yo;if(!yo)ans=i;
  }
  cout<<ans+1;
  return 0;
}
//code the AC sol !
// BS/queue/map

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

int main(){
  int w, h, x, y, r;
  cin >> w >> h >> x >> y >> r;
  if(r<=x && x<=w-r && r<=y && y<=h-r) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3088
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key){
    int left = 0;
    int right = n;
    int mid;

    while(left < right){
        mid = (left + right) / 2;
        if( key == A[mid] ) return 1;
        if( key > A[mid] ) left = mid + 1;
        else if( key < A[mid] ) right = mid;
    }
    return 0;
}

int main(void){
    int i, q, k,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", &k);
        if(binarySearch( k ) ) sum++;
    }
    printf("%d\n", sum);
    return 0;
}

Measured memory_bytes: 1416
// izrak's code from cf
#include <bits/stdc++.h>

#define FO(i,a,b) for (int i = (a); i < (b); i++)
#define sz(v) int(v.size())

using namespace std;

typedef long long ll;

int n, m; ll t;
int s[300005]; int d[300005];
pair<int,int> o[300005];
int res[300005];

int main() {
    scanf("%d%d%lld", &n, &m, &t);
    FO(i,0,n) scanf("%d %d", s+i, d+i), s[i]--;
    FO(i,0,n) o[i] = make_pair(s[i],i);
    sort(o,o+n);
    vector<ll> p;
    ll nc = 0;
    FO(i,0,n) {
        int dir = d[i] == 2 ? -1 : 1;
        ll pos = s[i] + dir * t;
        ll fp = ((pos%m)+m)%m;
        ll g = pos > 0 ? pos / m : (pos-m+1) / m;
        nc += g;
        p.push_back(fp);
    }
    nc = ((nc%n)+n)%n;
    sort(p.begin(),p.end());
    FO(i,0,n) res[o[i].second] = p[(i+nc)%n];
    FO(i,0,n) printf("%d\n", (res[i]+1) % m);
}


Measured memory_bytes: 5748
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

template<typename T>
vector<T> prime_factor(T n)
{
    vector<T> result;

    T boundary = sqrt(n);

    for (T i = 1; i <= boundary; i++) {
        if (n % i == 0) {
            result.push_back(i);
            if(i != (n / i) && i * i != n)
                result.push_back(n/i);
        }
    }
    sort(result.begin(),result.end());
    return result;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n+1), memo(n+1, 0);
    
    for(int i=1; i<=n; i++) cin >> a[i];

    int m = 0;
    vector<int> b;

    for(int i=n; i>0; i--) {
        vector<int> factors = prime_factor<int>(i);
        // cout << "i: " << i << " factors = ";
        // for(auto x: factors) cout << x << ", ";cout << endl;
        if(a[i]==1) {
            int sub_sum = memo[i];
            if(sub_sum==0) {
                b.push_back(i);
                for(auto x: factors) memo[x] = (memo[x] + 1) % 2;
                memo[i] = (memo[i] + 1) % 2;
            }
        }
        else {
            int sub_sum = memo[i];
            if(sub_sum==1) {
                b.push_back(i);
                for(auto x: factors) memo[x] = (memo[x] + 1) % 2;
                memo[i] = (memo[i] + 1) % 2;
            }
        }
    }

    // cout << "debug" << endl;
    // for(auto x: memo) cout << x << " "; cout << endl;

    cout << b.size() << endl;
    if(b.size() > 0) {
        for(auto x: b) cout << x << " ";
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {
	int add[12];
	int target;
	int in,out;
	int i;
	int now;
	while(1) {
		scanf("%d",&target);
		if(target==0)break;
		for(i=0;i<12;i++) {
			scanf("%d%d",&in,&out);
			add[i]=in-out;
		}
		for(now=0,i=0;i<12;i++) {
			now+=add[i];
			if(now>=target) {
				printf("%d\n",i+1);
				break;
			}
		}
		if(i>=12)puts("NA");
	}
	return 0;
}

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

#define int long long
typedef vector<int> vint;
typedef pair<int, int> pint;
const double PI = 3.141592653589793238462643383279;
const int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct Init {
    Init() {
        cout << fixed << setprecision(20);
    };
} init;

int N;
int L[110000];
signed main() {
    cin >> N;
    for (int i = 0; i < 2 * N; i++) { cin >> L[i]; }
    sort(L, L + 2 * N);
    int ans = 0;
    for (int i = 0; i < 2 * N; i += 2) { ans += L[i]; }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000010;
constexpr ll INF= 1000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}

ll RS(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P < 0) {
        return 0;
    }
    if(P%2==0){
        ll t = RS(N, P/2, M);
        return t*t % M;
    }
    return N * RS(N, P-1, M) % M;
}

struct edge {
    int to,cost;
    ll time;
};

int N,M,S;
vector<edge> graph[55];
vector<P> Exchange(55);
ll d[55][2501]; //d[i][j] = i番目の駅にj枚の銀貨を持って入るときの最小値
bool used[55][2501];

void dijkstra() {
    for(int i = 0;i < 55;i++) {
        for(int j = 0;j < 2501;j++) {
            d[i][j] = INF;
            used[i][j] = false;
        }
    }
    priority_queue<pair<ll,P>,vector<pair<ll,P>>,greater<pair<ll,P>>> que;
    d[0][S] = 0;
    que.push(make_pair(0,P(0,S)));
    while(!que.empty()) {
        pair<ll,P> p = que.top();
        que.pop();
        if(d[p.second.first][p.second.second] < p.first) {
            continue;
        }
        ll time = p.first;
        int v = p.second.first;
        int s = p.second.second;
        if(s + Exchange.at(v).first <= 2500) {
            int ns = s + Exchange.at(v).first;
            ll ntime = time + Exchange.at(v).second;
            if(d[v][ns] > ntime) {
                d[v][ns] = ntime;
                que.push(make_pair(ntime,P(v,ns)));
            }
        }
        for(int i = 0;i < graph[v].size();i++) {
            if(s < graph[v].at(i).cost) {
                continue;
            }
            int nv = graph[v].at(i).to;
            ll ns = s - graph[v].at(i).cost;
            ll ntime = time + graph[v].at(i).time;
            if(d[nv][ns] > ntime) {
                d[nv][ns] = ntime;
                que.push(make_pair(ntime,P(nv,ns)));
            }
        }
    }
}

int main() {
    cin >> N >> M >> S;
    for(int i = 0;i < M;i++) {
        int U,V,A,B;
        cin >> U >> V >> A >> B;
        U--;
        V--;
        graph[U].push_back(edge{V,A,B});
        graph[V].push_back(edge{U,A,B});
    }
    for(int i = 0;i < N;i++) {
        cin >> Exchange.at(i).first >> Exchange.at(i).second;
    }
    if(S >= 2500) {
        S = 2500;
    }
    dijkstra();
    for(int i = 1;i < N;i++) {
        ll ret = INF;
        for(int j = 0;j < 2501;j++) {
            ret = min(ret,d[i][j]);
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 7416
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#define int long long 
using namespace std;

signed main() {
	int N;
	cin >> N;
	vector<int> vec(N + 2);
	vec.at(0) = 0;
	for(int i = 1;i < N + 1;i++) {
		cin >> vec.at(i);
	}
	vec.at(N + 1) = 0;
	int count = 0;
	for(int i = 0;i < N + 1;i++) {
		count += abs(vec.at(i) - vec.at(i + 1));
	}
	for(int i = 1;i < N + 1;i++) {
		cout << count - abs(vec.at(i - 1) - vec.at(i)) - abs(vec.at(i) - vec.at(i + 1)) + abs(vec.at(i - 1) - vec.at(i + 1)) << endl;
	}
}

Measured memory_bytes: 2048
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 262144
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int n;
	cin >> n;
	int gogo[8];
	REP(i, 8) {
		cin >> gogo[i];
	}
	long long ans = 1e9;
	REP(i, 100) {
		REP(q, 100) {
			REP(j, 100) {
				REP(t, 100) {
					int hoge = i * gogo[4] + q * gogo[5] + j * gogo[6] + t * gogo[7];
					if (hoge >= n) {
						ans = min(ans, i * gogo[0] + q * gogo[1] + j * gogo[2] + t * gogo[3]);
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	long double a,b,c;
	cin >> a >> b >> c;
	if(c < b-1) {
		cout << floor(a*c/b)-a*floor(c/b);
	}
	else {
		cout << floor(a*(b-1)/b);
	}
} 

Measured memory_bytes: 3828
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得
            if(int.Parse(str[0]) % int.Parse(str[1]) == 0)
            {
                Console.WriteLine(int.Parse(str[0]) / int.Parse(str[1]));
            }
            else
            {
                Console.WriteLine((int.Parse(str[0]) / int.Parse(str[1])) +1);
            }
        }
    }
}


Measured memory_bytes: 13140
#![allow(unused_imports, dead_code, unused_variables, unused_mut)]
use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::mem::swap;
use permutohedron::LexicalPermutation;
const INF: i32 = std::i32::MAX;
const MOD: i32 = 1e9 as i32 + 7;

struct Get<R: std::io::BufRead> {
    stdin: R,
    v: Vec<String>,
    i: usize,
}
impl<R: std::io::BufRead> Get<R> {
    pub fn new(stdin: R) -> Self {
        Get {
            stdin: stdin,
            v: Vec::new(),
            i: 0,
        }
    }
    fn split_line(&mut self) {
        self.i = 0;
        self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        let mut ws = buf.split_whitespace();
        loop {
            let x = ws.next();
            if x.is_none() {
                break;
            }
            let x = x.unwrap().to_owned();
            self.v.push(x);
        }
    }
    #[allow(dead_code)]
    pub fn once<T: std::str::FromStr>(&mut self) -> T {
        if self.i == self.v.len() {
            self.split_line();
        }
        let elem = &self.v[self.i];
        self.i += 1;
        elem.parse().unwrap_or_else(|_| panic!())
    }
    #[allow(dead_code)]
    pub fn line<T: std::str::FromStr>(&mut self) -> String {
        self.i = 0;
        self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        buf
    }
}

fn main() {
    let stdin = std::io::stdin();
    let stdin = std::io::BufReader::new(stdin.lock());
    let get = Get::new(stdin);
    solve(get);
}

fn solve<R: std::io::BufRead>(mut get: Get<R>) {
    let n: usize = get.once();
    let k: i32 = get.once();
    let mut a: Vec<i64> = Vec::new();
    for i in 0..n {
        a.push(get.once());
    }

    for i in 0..n-(k as usize) {
        if a[i] < a[i+k as usize] {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


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

using u32 = uint32_t;
using u64 = uint64_t;
using i32 = int32_t;
using i64 = int64_t;

int main()
{
	std::ios_base::sync_with_stdio(0);
	
	u32 n;

	std::cin >> n;

	std::string s;

	std::cin >> s;

	std::transform(s.begin(), s.end(), s.begin(), 
				   [n](unsigned char c) -> unsigned char{ return (((c-'A')+n)%26)+'A'; });

	std::cout << s << "\n";
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = "0357"
ans = []
for a in s:
    for b in s:
        for c in s:
            for d in s:
                for e in s:
                    for f in s:
                        for g in s:
                            for h in s:
                                for i in s:
                                    for j in s:
                                        for k in s:
                                            o = int(a+b+c+d+e+f+g+h+i+j+k)
                                            if o > n:
                                                break
                                            elif set(str(o)) == {"3","5","7"}:
                                                ans.append(o)
print(len(ans))
                                             

Measured memory_bytes: 4072
using System;
 
public class ITP1_8_A
{
  static void Main()
  {
    string str = Console.ReadLine();
    foreach (var c in str)
    {
      if (char.IsLower(c)) Console.Write(char.ToUpper(c));
      else if (char.IsUpper(c)) Console.Write(char.ToLower(c));
      else Console.Write(c);
    }
    Console.WriteLine();
  }
}

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(a)  (a).begin(),(a).end()
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
template<class T> bool contain(const std::string& s, const T& v) {
   return s.find(v) != std::string::npos;
}
using Edge=pair<int,ll>;
using Graph=vector<vector<ll> >;//ll or Edge
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse -> greater<long long>()
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back
int main(){
    int n,m;
    cin>>n>>m;
    Graph G(n);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    VI list;
    for(int i=1;i<n;i++)list.emplace_back(i);
    int ans=0;
    do{
        int t=0;
        bool ok=true;
        for(auto v:list){
            ok=false;
            for(auto s:G[t]){if(v==s){ok=true;}}
            if(ok==false)break;
            t=v;
        }
        if(ok==true)ans++;
    }while(next_permutation(ALL(list)));
    cout<<ans<<endl;
}

Measured memory_bytes: 3612
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

ans = -1
for i in range(1000):
    num = str(i)
    if len(num) != n:
        continue

    bl = True
    for s, c in sc:
        s -= 1
        if num[s] != str(c):
            bl = False

    if bl:
        ans = i
        break

print(ans)


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

using namespace std;

const int OO = 0x3f3f3f3f;
//const long long OO = (long long) 1e18L+7;
//const unsigned long long UOO = (long long) 10e18+7;
#define lp(i,a,n) for(int i = a ; i < n ; ++i)
#define lpr(i,a,n) for(int i = a ; i >= n ; --i)
#define rep(i,vec) for(int i = 0 ; i < vec.size() ; ++i)
#define reprv(i,vec) for(int i = vec.size()-1; i >=0 ; --i)
#define eps (1e-5)
#define pb(i) push_back(i)
#define EPS 1e-9
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef vector<int> vi ;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll ;
typedef pair<int,int> pii ;
typedef vector< pair<int,int> >  vpii;
typedef vector<pair<long long,long long>> vpll;
typedef vector<vector<int> > vvi ;
typedef complex<double> point;
typedef pair<ll,ll> pll;

ll  inv(ll a, ll b) {return 1 < a ? b - inv(b % a, a) * b / a : 1;}
ll  Pow(ll  B,ll  P){ll  R=1; while(P>0)  {if(P&1) R=(R*B);P/=2;B=(B*B);}return R;} //compute b^p
ll  GCD(ll  a,ll  b){ while(b){b ^= a ^=b ^= a %=b;}  return a;}
ll  LCM(ll  a,ll  b) { return (a / GCD(a,b)*b); }
ll  BigMod(ll  B,ll  P,ll  M){ ll  R=1; while(P>0)  {if(P&1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return (ll )R;} //compute b^p%m
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//int i=uniform_int_distribution<int>(1,n)(rng);
///-----------------------------------------------------------------------------

const int mx = 100005;

int ans[mx];
vi nms;


///-----------------------------------------------------------------------------
int main()
{
    #ifndef ONLINE_JUDGE
//       freopen( "output.txt" , "w" , stdout ) ;
    //   freopen( "input.txt" , "r" , stdin ) ;
    auto stTime = clock();
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0);
//    cout.tie(0);
///-----------------------------------------------------------------------------------

    int n,k;
    cin >> n >> k;
    nms.resize(n);
    lp(i,0,n) cin >> nms[i];
    lp(i,0,k){
        if(ans[i]) continue;
        for(int x:nms) if(x+i<=k ){
            ans[i+x] = 1;
        }
    }
    ans[k] ? cout << "First": cout << "Second";


///------------------------------------------------------------------------------------
    #ifndef ONLINE_JUDGE
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif

    return 0;
}


Measured memory_bytes: 4024
input()
a=list(map(int,input().split()))
a.sort(reverse=True)

import collections
count=len(a)
ans=0
c = collections.Counter(a)
for i in c.keys():
    tmp = c[i]*2
    if count<=tmp:
        ans+=i*count
        break
    else:
        ans+=i*tmp
        count-=tmp
print(ans-max(a))

Measured memory_bytes: 35452
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef vector<ll> vl;
typedef vector<vl> vv;
#define pb push_back
#define MOD 1000000007
#define INF 1000000000
#define endl '\n'
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }

vv dp(3005,vl(3005));
string s1,s2;

string lcsstr(ll x,ll y){

    if(dp[x][y]==0){return "";}
    else{
    string ans="";
    if(s1[x-1]==s2[y-1]){ans+=s1[x-1];ans+=lcsstr(x-1,y-1);}
    else{
        if(dp[x-1][y]==dp[x][y]){ans+=lcsstr(x-1,y);}
        else{ans+=lcsstr(x,y-1);}
    }
    return ans;
    }


}

int main(){
    
    fast();
    //#ifndef ONLINE_JUDGE
   // freopen("F:\\Codes\\input.txt", "r", stdin);
   // freopen("F:\\Codes\\output.txt", "w", stdout);
  //  #endif

    cin>>s1>>s2;

    ll len1=s1.length(),len2=s2.length(),i,j;

    for(i=1;i<=len1;i++){
        for(j=1;j<=len2;j++){
            if(s1[i-1]==s2[j-1]){dp[i][j]=dp[i-1][j-1]+1;}
            else{dp[i][j]=max(dp[i-1][j],dp[i][j-1]);}
        }
    }

    string ans=lcsstr(len1,len2);
    reverse(ans.begin(),ans.end());
    
    cout<<ans<<endl;

    
    

    
    return 0;
}

Measured memory_bytes: 39796
#include <stdio.h>
void Insertion_Sort(int *a,int n);
int main(){
    int i=0,n,a[100];
    for(scanf("%d",&n);i<n;i++)
    scanf("%d",a+i);
    Insertion_Sort(a,n);
    return 0;
}
void Insertion_Sort(int *a,int n){
    int i=0,j=0,t=0;
    for(i=0;i<n;i++)
    printf(i<n-1?"%d ":"%d\n",a[i]);
    for(i=1;i<n;i++){
        t=a[i];
        for(j=i-1;j>=0&&a[j]>t;j--){
            a[j+1]=a[j];
        }
        a[j+1]=t;
        for(j=0;j<n;j++)
        printf(j<n-1?"%d ":"%d\n",a[j]);
    }
}


Measured memory_bytes: 2040