akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;

class Dice{
public:
    int s[6];
    // s[0] : top
    // s[1] : south  front
    // s[2] ; east  right
    // s[3] : west  left
    // s[4] : north  back
    // s[5] : bottom
    string str = "EWNSRL";
    int d[6][4] = {{0, 3, 5, 2}, {0, 2, 5, 3}, {0, 1, 5, 4}, {0, 4, 5, 1}, {1, 2, 4, 3}, {1, 3, 4, 2}};
    void roll(char c){
        //  N
        // W E
        //  S
        // R : clock rotate
        // L : counter clock rotate
        int idx = str.find(c);
        int b = s[d[idx][0]];
        for(int i = 0; i < 3; i++){
            s[d[idx][i]] = s[d[idx][i + 1]];
        }
        s[d[idx][3]] = b;
    }
    int hash(){
        int res = 0;
        for(int i = 0; i < 6; i++) res = res * 256 + s[i];
        return res;
    }
};

int d[110][210][210];
int dy[4] = {1, 0, 0, -1};
int dx[4] = {0, 1, -1, 0};


int main(){
    int n;
    Dice dc;
    rep(i, 0, 6) dc.s[i] = i + 1;
    string str = "NRRRRNRRRRNRRRRNRRRRERRRRERRRRERRRR";
    string st = "SEWN";
    while(cin >> n, n){
        rep(i, 0, 110) rep(j, 0, 210) rep(k, 0, 210) d[i][j][k] = -1;
        vector<Dice> dcs(n);
        rep(i, 0, n){
            int top, south;
            cin >> top >> south;
            rep(j, 0, str.size()){
                if(dc.s[0] == top && dc.s[1] == south){
                    dcs[i] = dc;
                    break;
                }
                dc.roll(str[j]);
            }
        }
        rep(i, 0, n){
            int y = 100, x = 100, h = 101;
            while(1){
                int nowH = h;
                for(int j = h - 1; j >= 0; j--){
                    if(d[j][y][x] != -1){
                        nowH = j + 1;
                        break;
                    }
                    nowH = j;
                }
                int fall = -1;
                int MAX = -1;
                int ny, nx;
                if(nowH > 0){
                    rep(j, 1, 5){
                        if(dcs[i].s[j] <= 3) continue;
                        ny = y + dy[j - 1];
                        nx = x + dx[j - 1];
                        if(d[nowH - 1][ny][nx] != -1) continue;
                        if(MAX < dcs[i].s[j]){
                            MAX = dcs[i].s[j];
                            fall = j;
                        }
                    }
                }
                if(fall == -1){
                    d[nowH][y][x] = dcs[i].s[0];
                    break;
                }else{
                    ny = y + dy[fall - 1];
                    nx = x + dx[fall - 1];
                    dcs[i].roll(st[fall - 1]);
                    y = ny; x = nx; h = nowH;
                    
                }
            }
        }
        int ans[6] = {};
        rep(i, 0, 210) rep(j, 0, 210){
            for(int k = 100; k >= 0; k--){
                if(d[k][i][j] != -1){
                    ans[d[k][i][j] - 1]++;
                    break;
                }
            }
        }
        rep(i, 0, 6){
            if(i) cout << " ";
            cout << ans[i];
        }
        cout << endl;
    }
}


Measured memory_bytes: 22112
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	ll w,h,x,y;
	double ans1=0.0;
	bool ans2=false;
	cin >>w>>h>>x>>y;
	ans1=w*h/2.0;
	ans2=(x*2==w and y*2==h);
	printf("%.9lf %d\n",ans1,ans2);
}

Measured memory_bytes: 256
import itertools
 
N, M = map(int, input().split())
 
S = []
for i in range(M):
    k, *s = map(int, input().split())
    S.append(s)
    
P = [int(i) for i in input().split()]
 
A = [0, 1]
ans = 0
for i in itertools.product(A, repeat = N):
    flag = 0
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if i[s - 1] == 1:
                cnt += 1
        if cnt % 2 != P[j]:
            flag = 1
    if flag == 0:
        ans += 1
        
print(ans)

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

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

    vector<int> vec;
    for (int i = 0; i < n; ++i) {
        int v;
        cin >> v;
        vec.push_back(v);
    }

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

    double ans = vec[0];

    for (int i = 1; i < n; ++i) {
        ans = (ans + vec[i]) * 0.5;
    }

    cout << ans << endl;

    return 0;
}


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

flag = 0

if m != 0:
    s, c = [list(i) for i in zip(*sc)]


    if n == 1:
        for i in range (0,10):
            p = str(i)
            flag = 0
            for j in range(m):
                if p[s[j]-1] != str(c[j]):
                    flag = 1
                    break

            if flag == 0:
                print(i)
                flag = 2
                break
    else:
        for i in range (10**(n-1),10**n):
            p = str(i)
            flag = 0
            for j in range(m):
                if p[s[j]-1] != str(c[j]):
                    flag = 1
                    break

            if flag == 0:
                print(i)
                flag = 2
                break

if flag != 2:
    if m == 0:
        if n == 1:
            print("0")
        elif n == 2:
            print("10")
        else:
            print("100")
    else:
        print("-1")

Measured memory_bytes: 3064
l = input().split()
n = int(l[0])
m = int(l[1])

a = []
for i in range(n):
    a.append(list(map(int, input().split())))

b = []
for i in range(m):
    b.append(int(input()))

c = [[] for i in range(n)]
for i in range(n):
    for j in range(m):
        c[i].append(a[i][j] * b[j])
    print(sum(c[i]))

Measured memory_bytes: 6304
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> L(N,0);
    for (int i = 0; i < N; i++) cin >> L[i];
    sort(L.begin(),L.end());

    int a,b,c;
    ll ans=0;
    for (int i = 0; i < N-2; i++) {
        a=L[i];
        for (int j = i+1; j < N-1; j++) {
            b=L[j]; 
            if(L[i]<L[j]+L[j+1]){
                for (int k = j+1; k < N; k++) {
                    c=L[k];
                    if(b<a+c && c<a+b) ans++;
                    else break;
                }
            }else continue;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;

ll n, ans, jc[1001000], inv[1001000];

ll K(ll x,ll y=mod-2){
  ll t=1;
  for (;y;y>>=1, x=x*x%mod)
    if (y&1) t=t*x%mod;
  return t;
}

ll C(int x,int y){
  return x>=y? jc[x]*inv[y]%mod*inv[x-y]%mod: 0;
}

int main(){
  cin>>n; --n;
  jc[0]=1; for (int i=1;i<=n;++i) jc[i]=jc[i-1]*i%mod;
  inv[n]=K(jc[n]); for (int i=n;i;--i) inv[i-1]=inv[i]*i%mod;
  ans=jc[n]*n%mod;
  for (int i=1;i<=(n-1)/2;++i){
    ans-=C(n-1-i,i) *jc[i]%mod *jc[n-i]%mod;
  }
  ans=(ans%mod+mod)%mod;
  cout<<ans<<endl;
}


Measured memory_bytes: 15872
fun main(args: Array<String>) {
    val (m1, d1) = readLine()!!.split(" ").map { it.toInt() }
    val (m2, d2) = readLine()!!.split(" ").map { it.toInt() }
    if (m1 == m2) {
        println(0)
    } else {
        println(1)
    }
}

Measured memory_bytes: 36032
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip> 
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(j, a, b) for (int j = a; j >= b; j--)
using namespace std;
const int MAX = 100001; 

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // double a, b, c;
    // cin >> a >> b>> c;
    // if(sqrt(a)+sqrt(b)<sqrt(c)){
    //     cout << "YES" << endl;
    // } else{
    //     cout << "NO" << endl;
    // }
    long long m, n;
    cin >> m >> n;
    if(m==1||n==1){
        cout << 1 << endl;
        return 0;
    }
    long long k = floor((double)m/2)*floor((double)n/2)+ceil((double)m/2)*ceil((double)n/2);
    cout << k << endl;
}



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

int main( void )
{
    ll n;
    cin >> n;
    ll p[n];
    for ( ll i = 0; i < n; i++ )
        cin >> p[i];
    
    ll ans = 1,min = p[0];
    for ( ll i = 1; i < n; i++ )
        if ( p[i] <= min )
        {
            min = p[i];
            ans++;
        }
        
        cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
ll dp[1001][10001];
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h,n;
    cin>>h>>n;
    ll a,b;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=h;j++){
            dp[i][j]=1e9;
        }
    }
    dp[0][0]=0;
    for(int i=0;i<n;i++){
        cin>>a>>b;
        for(int j=0;j<=h;j++){
            dp[i+1][j]=dp[i][j];
        }
        for(int j=0;j<=h;j++){
            dp[i+1][min(j+a,h)]=min(dp[i+1][min(j+a,h)],dp[i+1][j]+b);
        }
    }
    /*for(int i=0;i<=n;i++){
        for(int j=0;j<=h;j++){
            cout << dp[i][j]<<" ";
        }
        cout << endl;
    }*/
    cout << dp[n][h]<<endl;

    return 0;
}


Measured memory_bytes: 78464
import java.util.Scanner;

public class Main {

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

		long A = sc.nextInt();
		long B = sc.nextInt();
		long C = sc.nextInt();
		long K = sc.nextInt();
		long ans = 0;

		if (A < K){
			ans = A;
			K -= A;
		} else {
			ans = K;
			System.out.println(ans);
			return;
		}

		if (B < K){
			K -= B;
		} else {
			System.out.println(ans);
			return;
		}

		ans += -1 * K;
		System.out.println(ans);
	}

}


Measured memory_bytes: 35728
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
#include <cstdlib>
#include <cctype>
#include <random>

using namespace std;

int main() {
    int t, x;
    cin >> t >> x;
    printf("%.10f\n", (double)t/x);

    return 0;
}


Measured memory_bytes: 888
#include <iostream>
using namespace std;
int main(void){
    int a, b;

    cin >> a;
    cin >> b;

    if(a > b){
       cout << "a > b" <<endl;
    }

    else{
       if(a == b){
           cout << "a == b" <<endl;
       }
       
       else{
       cout << "a < b" <<endl;
       }
       
    }

return 0;

}


Measured memory_bytes: 3120
#include <stdio.h>
#define YOU 1000
int main()
{
  int nyugyo,haire[YOU],i,j,v,w;
  scanf("%d",&nyugyo);
  for(i=0;i<nyugyo;i++)
    {
      scanf("%d",&haire[i]);
      if(i<nyugyo-1)
	{
	  printf("%d ",haire[i]);
	}
      else
	{
	  printf("%d",haire[i]);
	}
    }
  printf("\n");
  for(i=1;i<nyugyo;i++)
    {
      v=haire[i];
      j=i-1;
      while((j>=0)&&(haire[j])>v)
	{
	  haire[j+1]=haire[j];
	  j--;
	}
      haire[j+1]=v;
      for(w=0;w<nyugyo;w++)
	{
	  if(w<nyugyo-1)
	    {
	      printf("%d ",haire[w]);
	    }
	  else
	    {
	      printf("%d",haire[w]);
	    }
	}
      printf("\n");
    }

  return 0;
}
/*
 if(haire[i]>haire[i+1])
	{
	  haire[i+1]=haire[i];
	  for(i=0;i<nyugyo;i++)
	    {
	      printf("%d ",haire[i]);
	    }
	  i++;
	}
      for(i=0;i<nyugyo;i++)
	{
	  printf("%d ",haire[i]);
	}
 */




Measured memory_bytes: 2044
#include <stdio.h>

#define MOD 1000000007

int dp[2001][2001], a[2000], b[2000];

int main(void) {
	int n, m;
	scanf("%d%d", &n, &m);

	for (int i = 0; i < n; i++) scanf("%d", &a[i]);
	for (int i = 0; i < m; i++) scanf("%d", &b[i]);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
			dp[i][j] = (dp[i][j] + MOD - dp[i-1][j-1]) % MOD;
			if (a[i-1] == b[j-1]) {
				dp[i][j] = (dp[i][j] + dp[i-1][j-1] + 1) % MOD;
			}
		}
	}
	printf("%d\n", dp[n][m]+1);
}


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

int main() {
  int n,m;
  cin >> n >> m;
  priority_queue<long> que;
  long a = 0;
  for(int i = 0;i < n;i++){
    cin >> a;
    que.push(a);
  }
  for(int i = 0;i < m;i++){
    a = que.top();
    que.pop();
    que.push(a/2);
  }
  a = 0;
  while(!que.empty()){
    a += que.top();
    que.pop();
  }
  cout << a << endl;

  return 0;
}

Measured memory_bytes: 1400
import numpy as np

L, R = map(int, input().split())

if R - L >= 2019:
    ans = 0
else:
    A = np.arange(L, R + 1) % 2019
    B = A.reshape(1, -1)
    C = (A.reshape(-1, 1) * B) % 2019
    r = np.arange(len(A))
    C[r, r] = 2019
    ans = np.min(C)

print(ans)


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

using ll = long long;
using namespace std;
const int INFint = 1e9+1;
const ll INFll = (ll)1e18+1;
ll MOD=1e9+7;


int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  //cout << a*c << " " << b*d << endl;
  cout << max(-min(abs(a),abs(b))*min(abs(c),abs(d)),max(b*d,a*c)) << endl;
  return 0;
}



Measured memory_bytes: 3600
N = int(input())
ls = list(map(int, input().split()))

def is_valid(a, b, c):
    valid = a != b and a != c and b != c
    is_triangle = a + b > c and b + c > a and c + a > b

    return valid and is_triangle


count = 0
for i in range(N):
    for j in range(i, N):
        for k in range(j, N):
            if is_valid(ls[i], ls[j], ls[k]):
                # print(i+1, j+1, k+1)
                count += 1

print(count)


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n ;
	vll a(n);
	for(ll i=0;i<n;i++) cin>>a[i];
	sort(all(a));
	reverse(all(a));
	ll A=0,B=0;
	for(ll i=0;i<n;i+=2) A+=a[i];
	for(ll i=1;i<n;i+=2) B+=a[i];
	cout<<A - B;
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 238004
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

int main(void){
    ll n, m;
    cin >> n >> m;

    ll cost[n][3];
    rep(i, 0, n){
        cin >> cost[i][0] >> cost[i][1] >> cost[i][2];
    }


    ll sum[n];
    ll ma = 0;
    rep(i, 0, 8){
        rep(j, 0, n){
            sum[j] = 0;
            rep(k, 0, 3){
                if(i & (1 << k)){
                    sum[j] -= cost[j][k];
                }else{
                    sum[j] += cost[j][k];
                }
            }
        }
        sort(sum, sum + n);
        ll sum1 = 0;
        rep(l, 0, m){
            sum1 += sum[n - 1 - l];
        }
        ma = max(ma, sum1);
    }

    cout << ma << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,h,a[21][21],count=0,m;
  char in;
  while(1){
    cin>>w>>h;
    if(w==0 && h==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>in;
	if(in=='#') a[i][j]=0;
	else if(in=='@') {
	  a[i][j]=2;
	}
	else a[i][j]=1;
      }
    }
    count=0;
    while(1){
      m=0;
      for(int i=0;i<h;i++){
	for(int j=0;j<w;j++){
	  if(a[i][j]==2){
	    m=1;
	    count++;
	    a[i][j]=3;
	    if(i==0){
	      if(j==0){
		if(a[i+1][j]==1) a[i+1][j]=2;
		if(a[i][j+1]==1) a[i][j+1]=2;
	      }
	      else {
		if(a[i][j-1]==1) a[i][j-1]=2;
		if(a[i+1][j]==1) a[i+1][j]=2;
		if(a[i][j+1]==1) a[i][j+1]=2;
	      }
	    }
	    else if(j==0){
		if(a[i-1][j]==1) a[i-1][j]=2;
		if(a[i+1][j]==1) a[i+1][j]=2;
		if(a[i][j+1]==1) a[i][j+1]=2;
	    }
	    else if(i==h-1){
	      if(j==w-1){
		if(a[i-1][j]==1) a[i-1][j]=2;
		if(a[i][j-1]==1) a[i][j-1]=2;
	      }
	      else {
		if(a[i][j+1]==1) a[i][j+1]=2;
		if(a[i-1][j]==1) a[i-1][j]=2;
		if(a[i][j-1]==1) a[i][j-1]=2;
	      }
	    }
	    else if(j==w-1){
		if(a[i+1][j]==1) a[i+1][j]=2;
		if(a[i-1][j]==1) a[i-1][j]=2;
		if(a[i][j-1]==1) a[i][j-1]=2;
	    }
	    else {
		if(a[i+1][j]==1) a[i+1][j]=2;
		if(a[i-1][j]==1) a[i-1][j]=2;
		if(a[i][j-1]==1) a[i][j-1]=2;
		if(a[i][j+1]==1) a[i][j+1]=2;
	    }
	  }
	}
      }
      if(m==0) break;
      
    }
    cout<<count<<endl;
  }
    
    
  return 0;
}



Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
 
using namespace std;

int main() {
    string S;

    cin >> S;
    bool f = true;

    for(int i = 0; i < S.size(); i++){
        if(i % 2 == 0 && S[i] == 'L'){
            f = false;
        }

        if(i % 2 == 1 && S[i] == 'R'){
            f = false;
        }
    }

    if(f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int ar[1001] = {};
int main()
{
	int n, k; cin >> n >> k;
	for (int i = 0; i < n; i++) cin >> ar[i];
	sort(ar, ar + n);
	int res = 0;
	for (int i = 0; i < k; i++) res += ar[i];
	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
int main(void)
{
	int x,y,z,a,b,c,i;
	scanf("%d%d",&x,&y);
	z=x;
	for(i=1; i<=2; i++){
		switch(z){
			case 2:
				c=3;
				break;
			case 4:
				c=2;
				break;
				case 6:
				c=2;
				break;
			case 9:
				c=2;
				break;
			case 11:
				c=2;
				break;
			default:
				c=1;
				break;
		}
		if(i==1){
			a=c;
			z=y;
		}else{
			b=c;
		}
	}
	if(a==b){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}

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

int main() {
  string s;
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (islower(s[i])) {
      s[i] = toupper(s[i]);
    } else {
      s[i] = tolower(s[i]);
    }
  }
  cout << s << "\n";
}


Measured memory_bytes: 3144
import java.util.Scanner;
import java.util.Arrays;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int[] num = new int[n];
        long sum = 0;
        
        for(int i = 0; i < n ; i ++){
            num[i] = sc.nextInt();
            sum += num[i];
        }
        
        Arrays.sort(num);
        
        System.out.println(num[0] + " " + num[n-1] + " " + sum);
        
        
    }
}


Measured memory_bytes: 41276
#include <stdio.h>

#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail, n;

void enqueue(P);
P dequeue();

int main(){
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);
  head=1;
  tail=n+1;

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }

  while(head!=tail){
  	u = dequeue();
  	if(q>u.t) c=u.t;
  	else c=q;
  	u.t=u.t-c;
  	elaps = elaps+c;
  	if(u.t>0) enqueue(u);
  	else printf("%s %d\n",u.name,elaps);
  }

  return 0;
}

void enqueue(P x){
  Q[tail]=x;
  tail = (tail+1)%LEN;
}

P dequeue(){
	P x = Q[head];
	head = (head+1)%LEN;
	return x;
}



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

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	vector<int> init(n),v(n);
	for (int i=0; i<n; ++i){
		cin >> init[i];
		v[i] = init[i];
	}
	sort(v.begin(),v.end());
	int cnt=0;
	for (int i=0; i<n; ++i){
		if (v[i] != init[i]) ++cnt;
	}
	if (cnt <= 2) cout <<"YES";
	else cout << "NO";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10001

int n;

void CountingSort(unsigned short int *,unsigned short int *,int);

int main(){

  unsigned short int *A,*B;
  int i,j,k=0;
  int maxim=-1;

  scanf("%d",&n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);
   
  for(i=1;i<=n;i++){
    scanf("%hd",&A[i]);
    if(A[i]>maxim){
      maxim=A[i];
    }
  }

  k=maxim+1;

  CountingSort(A,B,k);

  for(j=1;j<=n;j++){
    printf("%d",B[j]);
    if(j==n) printf("\n");
    else printf(" ");
  }

  return 0;
  
}

void CountingSort(unsigned short int *A,unsigned short int *B,int k){

  int i,j;
  int C[VMAX+1];

  for(i=0;i<=k;i++){
    C[i]=0;
  }

  for(j=1;j<=n;j++){
    C[A[j]]++;
  }

  for(i=1;i<=k;i++){
    C[i] = C[i]+C[i-1];
  }
  
  for(j=n;j>=1;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
  
}



Measured memory_bytes: 9540
#include <stdio.h>

int main(void)
{
	int a,b,menseki,syuu;
	scanf("%d",&a);
	scanf("%d",&b);
	menseki=a*b;
	syuu=a+a+b+b;
	printf("%d %d\n",menseki,syuu);
	
	return 0;
}


Measured memory_bytes: 2056
#include<bits/stdc++.h>
using namespace std;
int main()
{
  vector<int>v(4);
  for(int i=0;i<4;i++)
    cin>>v[i];
  sort(v.begin(),v.end());
  if(v[0]==1 && v[1]==4 && v[2]==7 && v[3]==9)
  {
    cout<<"YES";
  }
  else
  {
    cout<<"NO";
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 1111
#define MAX_E 2222
#define INF 1111111111
struct edge{int from,to,cost;};

edge es[MAX_E]; //辺
int d[MAX_V]; //最短距離
int V,E; //頂点数、辺数

//最短距離を求める
int shortest_path(int s){
  fill(d,d+V,INF);
  d[s]=0;
  int cnt=0;
  while(1){
    bool update=false;
    for(int i=0;i<E;i++){
      edge e=es[i];
      if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
	d[e.to]=d[e.from]+e.cost;
	update=true;
      }
    }
    if(!update)break;
    cnt++;
    if(cnt==V)return 0;
  }
  return 1;
}

int main(){
  int r;
  cin>>V>>E>>r;
  for(int i=0;i<E;i++)
    cin>>es[i].from>>es[i].to>>es[i].cost;
  if(shortest_path(r)){
    for(int i=0;i<V;i++){
      if(d[i]==INF)cout<<"INF"<<endl;
      else cout<<d[i]<<endl;
    }
  }else cout<<"NEGATIVE CYCLE"<<endl;
  return 0;
}



Measured memory_bytes: 3120
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N;
  cin >> N;
  vi deg(N);
  rep(i, 1, N) {
    int p;
    cin >> p;
    p--;
    deg[p]++;
  }
  rep(i, 0, N) { cout << deg[i] << endl; }
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 4780
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;


int main() {
	ll n, t;
	cin >> n >> t;
	ll ans = 0;
	ll last = 0;
	for (ll i = 0; i < n; i++) {
		ll temp;
		cin >> temp;
		if (temp < last) {
			ans += temp + t - last;
			last = temp + t;
		}
		else {
			ans += t;
			last = temp + t;
		}
	}
	cout << ans << endl;
	return 0;
}

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

signed main(){
	int n,k,a;
	cin>>n>>k;
	map<int,int>mp;
	for(int i=0;i<n;i++){
		cin>>a;
		mp[a]++;
	}
	vector<int>vec;
	for(auto i=mp.begin();i!=mp.end();i++){
		vec.push_back(i->second);
	}
	sort(vec.begin(),vec.end());
	if(k<vec.size()){
		for(int i=0;i<vec.size()-k;i++){
			ans+=vec[i];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 10748
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int N;
    cin >> N;
    string s;
    cin >> s;
	rep(i,s.size()) {
        s[i] += N;
        if (s[i] > 90) s[i] -= 26;
        cout << (char)s[i];  
    }
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007

int main(){
	int n;
	cin >> n;
	string s,t;
	cin >> s >> t;
	int a = (int)s.size();
	int b = (int)t.size();
	if(s==t){
		int x=0;
		while(x!=n){
			cout << s;
			x += a;
		}
		cout << endl;
		return 0;
	}
	if(s<t){
		if(a<b){
			int x = a;
			string tmp = s;
			while(x<b){
				tmp += s;
				x+=a;
			}
			string tmp2 = t;
			if(x>b){
				tmp2 += t;
			}
			if(tmp>tmp2){
				swap(s,t);
				swap(a,b);	
			}
		}
	}
	if(s>t){
		if(a<=b){
			swap(s,t);
			swap(a,b);
		}else{
			int x = b;
			string tmp = t;
			while(x<a){
				tmp += t;
				x+=b;
			}
			string tmp2 = s;
			if(x>a){
				tmp2 += s;
			}
			if(tmp2>tmp){
				swap(s,t);
				swap(a,b);	
			}
		}
	}
	int x = 0;
	int k = 0;
	for(int i=0;i<2000000;i++){
		if(x>n)break;
		if((n-x)%b==0){
			k = i;
		}
		x += a;
	}
	for(int i=0;i<k;i++){
		cout << s;
	}
	x = a*k;
	while(x!=n){
		cout << t;
		x+=b;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1284
//#define NDEBUG

#include <bits/stdc++.h>

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define iter(a) a.begin(), a.end()
#define riter(a) a.rbegin(), a.rend()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(riter(a))
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define pf(a) push_front(a)
#define pob pop_back()
#define pof pop_front()
#define F first
#define S second
#define B back()
#define FR front()
#define printv(a, b) {bool pvaspace=false; \
for(auto pva : a){ \
    if(pvaspace) b << " "; pvaspace=true;\
    b << pva;\
}\
b << "\n";}
#define pii pair<int, int>
#define pll pair<ll, ll>
#define tiii tuple<int, int, int>
#define mt make_tuple
#define gt(t, i) get<i>(t)

//#define TEST

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

const ll MOD = 1000000007;
const ll MAX = 2147483647;

int main(){
    StarBurstStream

    char c;
    cin >> c;
    cout << (char)(c + 1) << "\n";

    return 0;
}

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

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

    int mini = 10000;
    for (int i = 0; i < s.length()-2; i++) {
        int x = atoi(s.substr(i, 3).c_str());
        mini = min(abs(x - 753), mini);
    }

    cout << mini << endl;
}

Measured memory_bytes: 3552
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        long DP[][] = new long [N+1][W+1];
        for(int i=0;i<N+1;i++) Arrays.fill(DP[i],0);
        for(int i=1;i<=N;i++){
            int w = sc.nextInt();
            int v = sc.nextInt();
            for(int j=1;j<=W;j++){
                if(j-w>=0){
                    DP[i][j] = Math.max(DP[i-1][j-w]+v,DP[i][j-1]);
                    DP[i][j] = Math.max(DP[i][j],DP[i-1][j]);
                }
                else DP[i][j] = Math.max(DP[i][j-1],DP[i-1][j]);
            }
        }
        System.out.println(DP[N][W]);
    }
}

Measured memory_bytes: 127188
/*
 *
 * Author: r3gz3n
 * 3b 13 12 9 56 4e
 * 6 56 a a 5f f
 * 6 56 47 18 56 d
 * 13 46 14 1f 13 27
 * 52 52 a 5a 47 1
 * 1d 13 b 1b 49 17
 *
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T=int> using order_statistics = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

const int MAX = 3e3 + 5;
int dp[MAX][MAX];

int main(int argc, char* argv[]) {
    if(argc == 2 or argc == 3) freopen(argv[1], "r", stdin);
    if(argc == 3) freopen(argv[2], "w", stdout);
    ios::sync_with_stdio(false);
    string a, b;
    cin >> a >> b;
    a = '0' + a;
    b = '0' + b;
    for (int i = 0;i < (int)a.length();++i) {
        for (int j = 0;j < (int)b.length();++j) {
            if (i == 0 or j == 0) dp[i][j] = 0;
            else if (a[i] == b[j]) dp[i][j] = dp[i-1][j-1]+1;
            else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }
    int n = (int)a.length()-1, m = (int)b.length() - 1;
    int x = dp[n][m];
    string ans = "";
    while (n > 0 and m > 0) {
        if (a[n] == b[m]) ans += a[n], n--, m--, x--;
        else if (dp[n-1][m] > dp[n][m-1]) n--;
        else m--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 35456
def solve():
    n,m = map(int, input().split())
    A = [input() for _ in range(n)]
    B = [input() for _ in range(m)]
    for r in range(n-m+1):
        for c in range(n-m+1):
            X = []
            for i,a in enumerate(A[r:r+m]):
                if a[c:c+m] != B[i]:
                    break
            else:
                print('Yes')
                exit()
    print('No')

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	string s; cin >> s;
	int ans = inf;
	rep(j, 26){
		string t = s;
		while(1){
			bool ok = 1;
			rep(i, t.size() - 1) if(t[i] != t[i + 1]){
				ok = 0;
				break;
			}
			if(ok) break;
			string u;
			rep(i, t.size() - 1) u += t[i] == 'a' + j || t[i + 1] == 'a' + j ? 'a' + j : t[i];
			t = u;
		}
		ans = min(ans, (int)(s.size() - t.size()));
	}
	cout << ans << endl;
	return 0;
}

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

int main(void) {
    int n, m ,x;
    
    cin >> n >> m >> x;
    
    int gate[m];
    for (int i = 0; i < m; i++) {
        cin >> gate[i];
    }
    
    int left_cost = 0;
    int right_cost = 0;
    
    for (int k = 0; k < m; k++) {
        if (gate[k] < x) {
            left_cost++;
        }else{
            right_cost++;
        }
    }
    
    if (left_cost < right_cost) {
        cout << left_cost << endl;
    }else{
        cout << right_cost << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B;
    cin >> A>>B;
    vector<int> vec;
    int count=0;
    int x;
    for (int i=0;i<B-A+1;i++){
     vec.push_back(A+i);}
    

     for (int i=0;i<B-A+1;i++){
        
          vector <int> kore;//まいかい宣言うわがきできる
       for(int j =1 ;j<100000;j*=10){
           x =vec.at(i)/j%10;
           kore.push_back(x);}
          
           if((kore.at(0)==kore.at(4))&&(kore.at(1)==kore.at(3))){
              ++count;
            }
           }  
          
          cout << count << endl;
     
}

Measured memory_bytes: 892
#include <stdio.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long lld;
#define Ma(x,y)(x>y?x:y)

int main(){
	lld dp1[2<<6][2<<16]={0},dp2[2<<6][2<<16]={0},dp3[2<<6][2<<16]={0},dp4[2<<6][2<<16]={0},dp5[2<<6][2<<16]={0},dp6[2<<6][2<<16]={0},dp7[2<<6][2<<16]={0},dp8[2<<6][2<<16]={0},dp9[2<<6][2<<16]={0};
	int n,W,v[2<<6],w[2<<16];
	scanf("%d%d", &n, &W);
	rep(i,n)scanf("%d%d",&w[i],&v[i]);
	lld dp[2<<6][2<<16];//dp[a+1][b]...v[a]w[a]までの品物の中から重さがbを超えぬように選んだ時の価値の総和の最大値
	rep(i,W+1)dp[0][i] = 0;//1つも選んでいない
	rep(i,n){//(0~N-1で)i番目まで
		rep(j,W+1){//(0~Wで)j gまで
		//(0から数えて)i番目のを入れるかどうか
			if(j<w[i])dp[i+1][j]=dp[i][j];//w[i]がjより大きくて選べない
			else dp[i+1][j]=Ma(dp[i][j],dp[i][j-w[i]]+v[i]);
		}
	}
	printf("%lld",dp[n][W]);
}

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

int main(){
  //ここからコードを書く
  string S; 
  cin >> S;//判定する回文の入力
  int N;
  N = S.size(); //回文Sの長さ
  bool zenhan = true;
  bool kouhan = true;
  bool kaibun = true;
  for (int i = 0 ; i < N ; i++ ){
    if (S.at(i) != S.at(N-1-i)){
      kaibun = false;
      break;
    }
  }
  for (int i = 0; i < (N-1)/2 ; i++){//前半の回文かどうかの判定
    if (S.at(i) != S.at((N-1)/2-i-1)){ 
      zenhan = false;
      break;
    }
  }
  for (int i = ((N+3)/2)-1 ; i < N ; i++){
    int j = i - ((N+3)/2)+1;
    if (S.at(j) != S.at((N-1)/2-j-1)){
      kouhan =false;
      break;
    }
  }
  if (zenhan && kouhan && kaibun) cout << "Yes" << endl;
  else cout << "No" << endl;
} 



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,int *A){F(N)scanf("%d",A+i);}
#define MX 222222
char s[MX];
map<int,int> L,l;
int N,X[MX],O[26][MX],B,dp[MX],x[MX],o[26][MX];
int dyn(int u){
    if(u==N)return 0;
    int&v=dp[u];
    if(~v)return v;
    v=INF;
    if(~X[u])v=min(v,dyn(X[u]));
    F(26)if(~O[i][u])v=min(v,dyn(O[i][u])+1);
    return v;
}
int main(void){
    scanf("%s",s),N=strlen(s),CL(X,-1),CL(dp,-1),CL(O,-1);
    for(int i=N;~i;--i){
        if(i<N)B^=1<<(s[i]-97);
        if(L.count(B))X[i]=L[B];
        FF(26)if(L.count(B^1<<j))O[j][i]=L[B^1<<j];
//        if(!L.count(B))
            L[B]=i;
    }
    if(!B)return puts("1"),0;
    printf("%d\n",dyn(0));
    return 0;
}


Measured memory_bytes: 41344
#include<iostream>
#include<string>

using namespace std;

typedef long long ll;

int K;

int f(ll x) {
	//x以下のるんるん数を求める。

	string s = to_string(x);
	int n = s.size();
	int dp[12][2][10][2] = {};//dp[i][j][k][m] := (0-idx)i桁目まで見て、jがtrueならギリギリそうでないなら未満確定、
	//今の桁がkの時のルンルン数(mがtrueなら、0以外の値を取り始めている)
	dp[0][1][0][1] = 1;
	for (int i = 0; i <= n; i++) {
		for (int j = 0; j < 2; j++) {
			for (int k = 0; k <= 9; k++) {
				for (int m = 0; m < 2; m++) {
					int limit = j ? s[i] - '0' : 9;
					for (int l = 0; l <= limit; l++) {
						if (m == 1) {
							if (k == 0 && l == 0)
								dp[i + 1][(!j ? 0 : (l == limit ? 1 : 0))][0][1] += dp[i][j][k][1];
							else {
								dp[i + 1][(!j ? 0 : (l == limit ? 1 : 0))][l][0] += dp[i][j][k][1];
							}
						}
						else {
							if (abs(l - k) <= 1) {
								dp[i + 1][(!j ? 0 : (l == limit ? 1 : 0))][l][0] += dp[i][j][k][m];
							}
						}
					}
				}
			}
		}
	}

	ll ret = 0;
	for (int i = 0; i < 2; i++)for (int j = 0; j <= 9; j++)ret += dp[n][i][j][0];
	return ret;
}

int main() {
	cin >> K;

	if (K <= 12) {
		cout << K << endl;
		return 0;
	}

	ll ok = 5000000000, ng = 0;
	while (ok - ng > 1) {
		ll mid = (ok + ng) / 2;
		if (f(mid) >= K)ok = mid;
		else ng = mid;
	}
	cout << ok << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll X,Y;
    cin >>X>>Y;

    rep(i,X+1){
        if(2*i + 4*(X-i) == Y){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    
    cout << "No" << endl;


    return 0;
    

}

Measured memory_bytes: 3632
print$,=$",map{
	(0)x~-y/R//,
	y///c%2?
		y/R//%2?
			(y///c+1>>1,y///c>>1)
		:
			(y///c>>1,y///c+1>>1)
	:
		(y///c/2)x2,
	(0)x~-y/L//
}<>=~/R+L+/g


Measured memory_bytes: 17280
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const int INF=1e6;
const ll int MOD=998244353;

main(){
    int a=in(),b=in(),h=in();
    set<int> s={a,b,h};
    cout<<s.size();
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    vector<int64_t> vec(n);
    for (int i = 0; i < n; i++)
    {
        cin >> vec.at(i);
    }
    sort(vec.begin(), vec.end());
    if (k >= n)
    {
        cout << 0 << endl;
    }
    else if (n > k)
    {
        for (int i = 0; i < k; i++)
        {
            vec.pop_back();
        }
        int64_t sum = 0;
        for (int i = 0; i < vec.size(); i++)
        {
            sum += vec.at(i);
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	long long a,b;
  cin >> a >> b;
  cout << a * b << endl;
 
return 0;
}

Measured memory_bytes: 3620
n, m = map(int, input().split())
h = list(map(int, input().split()))
good = [True] * n
for _ in range(m):
    a, b = map(int, input().split())
    a-=1
    b-=1
    if h[a] >= h[b]: good[b]=False
    if h[a] <= h[b]: good[a]=False
ans = 0
for g in good:
    if g:ans+=1
print(ans)

Measured memory_bytes: 20044
using System;
using System.Collections.Generic;
using System.Globalization;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            int min = int.MaxValue;
            int max = 0;
            for (int i = 0; i < n; i++)
            {
                int a = cin.nextInt();

                if (a < min)
                {
                    min = a;
                }

                if (a > max)
                {
                    max = a;
                }
            }
            Console.WriteLine(max - min);
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

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

int main(){
  int n,i,kotae=0;
  cin >> n;
  int a[n],b[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
    scanf("%d",&b[i]);
  }
  for(i=0;i<n;i++){
    if(a[i]-b[i]>0){
      kotae+=a[i]-b[i];
    }
  }
  cout << kotae << endl;
}

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

int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    int c[100000];
    for(int i=0;i<100000;i++){
        c[i]=0;
    }
    for(int i=0;i<n;i++){
        if(a[i]-1>=0) c[a[i]-1]++;
        c[a[i]]++;
        if(a[i]+1<100000) c[a[i]+1]++;
    }
    int ans=0;
    for(int i=0;i<100000;i++){
        if(c[i]>ans){
            ans=c[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024