akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int r,D,x;
	cin >> r >> D >> x;
	int ans = r * x;
	REP(i, 10) {
		cout << ans - D << endl;
		ans -= D;
		ans *= r;
	}
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
typedef long long ll;

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

int main(void) {
  ll i, j, k, n, ans = 0, a, b, c, d;
  scanf("%lld%lld", &a, &b);
  if(a > b) ans += a, a--;
  else ans += b, b--;
  if(a > b) ans += a, a--;
  else ans += b, b--;
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>

#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define lf else if

#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;

typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;

int IN(){
	int c,f,x;
	while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
	while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}

const int N=200000+19;

int f[1<<20],g[1<<20];
int x[N],A[20][N],B[20][N];
int n,V,pV,mx;

int main(){
	n=IN(),pV=V=IN();
	For(i,1,n+1) x[i]=IN();
	for (mx=0;;mx++){
		int sum=0;
		for (int l=1,r;l<=n;l=r+1){
			for (r=l;r+1<=n&&x[r+1]-x[r]<=V;r++);
			For(i,l,r+1) A[mx][i]=r,B[mx][i]=l;
			sum++;
		}
		if (mx==0&&sum>20){
			For(i,1,n+1) puts("Impossible");
			return 0;
		}
		if (V==0) break;
		V/=2;
	}
	For(t,0,1<<mx){
		f[t]=0;
		g[t]=n+1;
	}
	For(t,0,1<<mx){
		For(i,0,mx) if (!(t>>i&1)){
			f[t|1<<i]=max(f[t|1<<i],A[i+1][f[t]+1]);
			g[t|1<<i]=min(g[t|1<<i],B[i+1][g[t]-1]);
		}
	}
	V=pV;
	for (int l=1,r;l<=n;l=r+1){
		bool chk=0;
		for (r=l;r+1<=n&&x[r+1]-x[r]<=V;r++);
		For(t,0,1<<mx){
			if (f[t]>=l-1&&g[((1<<mx)-1)^t]<=r+1) chk=1;
		}
		For(i,l,r+1) puts(chk?"Possible":"Impossible");
	}
}

Measured memory_bytes: 41344
a[10],m;
int D(s,x1,x2){
	int r=0,i=0;
	for(;i<m;i++)
		if(x1)r+=D(s+a[i],x1-1,x2);
		else if(x2)r+=D(s+a[i]/5+a[i]%5*2,x1,x2-1);
		else return s%10==0;
	return r;
}
main(i,j,n,c,s,x1,x2){
	scanf("%d",&n);getchar();
	for(s=x1=x2=i=0;i<n;i++)
		if(c=getchar()-48,(n-i)&1)//odd position from right
			if(c==-6)x1++;else s+=c;
		else
			if(c==-6)x2++;else s+=c/5+c%5*2;
	for(scanf("%d",&m),i=0;i<m;i++)scanf("%d\n",a+i);
	printf("%d\n",D(s,x1,x2));
	exit(0);
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define befv(V) ((V)[(sz(V)-2)])
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MAXH = 45;
const int MAXW = 45;

int dp[MAXH][MAXH][MAXW][MAXW];
int C[MAXH][MAXH][MAXW][MAXW];

int B[MAXH][MAXW];
char A[MAXH][MAXW];

int H, W, PY, PX, Ans = INF;

int main() {
	scanf("%d%d", &H, &W);
	for(int i = 1; i <= H; i++) {
		scanf(" %s", A[i]+1);
		for(int j = 1; j <= W; j++) {
			B[i][j] = ('#' == A[i][j]) + B[i][j-1] - B[i-1][j-1] + B[i-1][j];
			if('P' == A[i][j]) { PY = i; PX = j; }
		}
	}

	for(int ys = 1; ys <= H; ys++) for(int ye = ys; ye <= H; ye++)
		for(int xs = 1; xs <= W; xs++) for(int xe = xs; xe <= W; xe++) {
			C[ys][ye][xs][xe] = B[ye][xe] - B[ye][xs-1] + B[ys-1][xs-1] - B[ys-1][xe];
			dp[ys][ye][xs][xe] = INF;
		}
	
	dp[1][H][1][W] = 0;
	for(int yl = H; yl--;) for(int xl = W; xl--;) {
		for(int ys = 1, ye = yl+1; ye <= H; ys++, ye++) {
			for(int xs = 1, xe = xl+1; xe <= W; xs++, xe++) {
				int ret = dp[ys][ye][xs][xe];
				for(int X = xs; X < xe; X++) for(int Y = ys; Y < ye; Y++) {
					int t = ret + C[ys][Y][X+1][xe] + C[Y+1][ye][xs][X];
					if(t < dp[ys][Y][xs][X]) dp[ys][Y][xs][X] = t;
					if(t < dp[Y+1][ye][X+1][xe]) dp[Y+1][ye][X+1][xe] = t;

					t = ret + C[ys][Y][xs][X] + C[Y+1][ye][X+1][xe];
					if(t < dp[ys][Y][X+1][xe]) dp[ys][Y][X+1][xe] = t;
					if(t < dp[Y+1][ye][xs][X]) dp[Y+1][ye][xs][X] = t;
				}
				if(ys <= PY && PY <= ye && xs <= PX && PX <= xe) {
					int nw = C[ys][PY][xs][PX], t;
					t = C[ys][PY][PX][xe];
					if(t < nw) nw = t;
					t = C[PY][ye][xs][PX];
					if(t < nw) nw = t;
					t = C[PY][ye][PX][xe];
					if(t < nw) nw = t;
					nw += ret;
					if(nw < Ans) Ans = nw;
				}
			}
		}
	}

	cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 30464
#include<cstdio>
long long int rank(long long int n)
{
	for (long long int i=n-1;i>1;i--)
	{
		n*=i;
		n=n%1000000007;
	}
	return n;
}
int main()
{
	long long int n;
	while (scanf("%I64d",&n)==1)
	{
		printf("%I64d\n",rank(n));
	}
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct node{
    int x,y;
}a[200008];
bool cmp(node q,node p){
    if(q.y==p.y)
        return q.x<p.x;
    else
        return q.y<p.y;
}
int main(){
  int n;
  while(~scanf("%d",&n)){
    for(int i=0;i<n;i++)
        scanf("%d%d",&a[i].x,&a[i].y);
    sort(a,a+n,cmp);
    int t=0,i;
    for(i=0;i<n;i++){
        if(t+a[i].x<=a[i].y)
            t+=a[i].x;
        else
            break;
    }
    if(i==n){
        printf("Yes\n");
    }
    else
        printf("No\n");
  }
}


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

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

  if(s/100 >= 1 && s/100 <= 12){
    if(s%100 >= 1 && s%100 <= 12) cout << "AMBIGUOUS" << endl;
    else cout << "MMYY" << endl;
  } else{
    if(s%100 >= 1 && s%100 <= 12) cout << "YYMM" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A=0, B=0, C=0, X=0, sum=0, count=0;
  cin >> A >> B >> C >> X;
 for(int i=0;i<=A;i++){
   sum = X-(500*i);
     if(sum == 0){
       count++;
     }
   for(int j=0;j<=B;j++){
     sum = X-(500*i)-(100*j);
     if(sum == 0 && j != 0){
         count++;
       }
     for(int k=0;k<=C;k++){
       sum = X-(500*i)-(100*j)-(50*k);
       if(sum == 0 && k != 0){
         count++;
       }
     }//for k
   }//for j
 }//for i
  cout << count << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int h,w,n;
  cin >> h >> w >> n;

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

  vector< vector<int> > m(h, vector<int>(w, 0));

  int asidx = 0;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      int jidx = i % 2 == 0 ? j : w - (j + 1);
      if (as[asidx] == 0) {
        asidx++;
      }

      m[i][jidx] = asidx + 1;
      as[asidx]--;
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (j != 0) cout << " ";
      cout << m[i][j];
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main()
{
	int N;
	cin >> N;
	
	int dsum = 0;
	int tmp = N;
	while(tmp) {
		dsum += tmp % 10;
		tmp /= 10;
	}
	if(N % dsum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("-O3")
    #include <bits/stdc++.h>  
     
    using namespace std;
     
    typedef long long ll;
    typedef long double ld;
    typedef pair<int,int> p32;
    typedef pair<ll,ll> p64;
    typedef pair<double,double> pdd;
    typedef vector<ll> v64;
    typedef vector<int> v32;
    typedef vector<vector<int> > vv32;
    typedef vector<vector<ll> > vv64;
    typedef vector<vector<p64> > vvp64;
    typedef vector<p64> vp64;
    typedef vector<p32> vp32;
    ll MOD = 998244353;
    #define forn(i,e) for(ll i = 0; i < e; i++)
    #define forsn(i,s,e) for(int i = s; i < e; i++)
    #define rforn(i,s) for(ll i = s; i >= 0; i--)
    #define rforsn(i,s,e) for(ll i = s; i >= e; i--)
    #define ln "\n"
    #define dbg(x) cout<<#x<<" = "<<x<<ln
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define INF 1e18
    #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((ll)(x).size())
     
    ll mpow(ll a, ll b){
        if(b >= (MOD-1)) b %= (MOD-1);
        if(b==0) return 1;
        ll t1 = mpow(a,b/2);
        t1 *= t1;
        t1 %= MOD;
        if(b%2) t1 *= a;
        t1 %= MOD;
        return t1;
    }
     
    ll mpow(ll a, ll b, ll p){
        if(b==0) return 1;
        ll t1 = mpow(a,b/2,p);   t1 *= t1;
        t1 %= p;
        if(b%2) t1 *= a;
        t1 %= p;
        return t1;
    }
    ll modinverse(ll a, ll m){
        ll m0 = m; 
        ll y = 0, x = 1; 
        if (m == 1) return 0; 
        while (a > 1){
            ll q = a / m; 
            ll t = m; 
            m = a % m, a = t; 
            t = y; 
            y = x - q * y; 
            x = t; 
        }
        if (x < 0) x += m0; 
        return x; 
    }
    ll range(ll l, ll r){
        return l + rand()%(r-l+1);
    }
    
    int main()
    {
        ll t=1;//cin>>t;
        while(t--)
        {
            int h1,m1,h2,m2,k;
            cin>>h1>>m1>>h2>>m2>>k;
            int rem = 60*(h2-h1) + (m2-m1);
            cout<<max(0,rem-k)<<endl;
        }
    }

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

def main():
    n, m, l = map(int, input().split())
    A = [list(map(int, input().split())) for i in range(n)]
    B = [list(map(int, input().split())) for i in range(m)]

    for i in range(n):
        ans = []
        for j in range(l):
            tmp = 0
            for k in range(m):
                tmp += A[i][k] * B[k][j]
            ans.append(str(tmp))
        print(" ".join(ans))


if __name__ == "__main__":
    main()


Measured memory_bytes: 6316
N=int(input())
dish=[]
for i in range(N):
  a,b=map(int,input().split())
  dish.append([a,b])
d2=sorted(dish,key=lambda x:-x[1]-x[0])
ans=0
for i in range(0,N,2):
  ans+=d2[i][0]
for i in range(1,N,2):
  ans-=d2[i][1]
print(ans)

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

unsigned long long dp[21][101] = { 0 };

int main() {
	unsigned long long n, num;
	cin >> n;
	for (unsigned long long i = 0; i < n - 1; ++i) {
		cin >> num;
		if (i == 0) {
			++dp[num][i];
		}
		else {
			for (unsigned long long j = 0; j <= 20; ++j) {
				if (dp[j][i - 1] != 0) {
					if (j + num >= 0 && j + num <= 20) {
						dp[j + num][i] += dp[j][i - 1];
					}
					if (j - num >= 0 && j - num <= 20) {
						dp[j - num][i] += dp[j][i - 1];
					}
				}
			}
		}
	}

	cin >> num;
	cout << dp[num][n - 2] << endl;

	return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; const ll MOD = 1000000007;
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; }

//---------------------------------------------------------------------------------------------------
void _main() {
    string S; cin >> S;
    ll res = 0, count = 0;
    rep(i, 0, S.size()) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') count++;
        else count = 0;
        chmax(res, count);
    }
    cout << res << endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
g=[set() for _ in range(n)]
for _ in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  g[a].add(b)
  g[b].add(a)

start=0
spath={0}
path=[0]
todo=[0]
next=g[0].pop()
spath.add(next)
path.append(next)
while g[path[-1]]:
  next=g[path[-1]].pop()
  if next not in spath:
    spath.add(next)
    path.append(next)
rpath=[0]
while g[rpath[-1]]:
  next=g[rpath[-1]].pop()
  if next not in spath:
    spath.add(next)
    rpath.append(next)
rpath.reverse()
rpath.pop()
rpath+=path
rpath=[i+1 for i in rpath]
print(len(rpath))
print(*rpath,sep=' ')


Measured memory_bytes: 116780
import java.io.*;
import java.util.*;


//I have to use hashset
public class Main{
    static int count =0;
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        
        str = br.readLine();
        int n = Integer.parseInt(str);

        str=br.readLine();
        String[] line = str.split("\\s");

        int[] A = new int[n];
        for(int i=0;i<n;i++){
            A[i] = Integer.parseInt(line[i]);
        }
        String[] B = partition(A,0,n-1);
        for(int i=0;i<n;i++){
            System.out.print(B[i]);
            if(i != B.length-1){
                System.out.print(" ");
            }else{
                System.out.print("\n");
            }
        }
    }
//Errorn case 1 3 2
    public static String[] partition(int[]A,int p,int r){
        int x = A[r];
        int i= p -1;
        for(int j= p;j<r;j++){
            if(A[j] <= x){
                i++;
                int tmp = A[i];
                A[i] = A[j];
                A[j] = tmp;
            }
        }
        String[] B = new String[A.length];
        for(int j=0;j<B.length;j++){
            B[j] = String.valueOf(A[j]);
        }
        String y = "["; 
        y+=String.valueOf(A[r]);
        y+= "]";
        B[i+1] = y;
        B[r] = String.valueOf(A[i+1]);
        return B;
    }
   
     
}


Measured memory_bytes: 59640
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
using namespace std;

#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        ll n,k;
        cin>>n>>k;
        ll p=(n-1)*(n-2)/2;
        if(k>p)
        {
        	cout<<-1;
        	return 0;
        }
        ll x=p-k;
        cout<<n-1+x<<endl;
        int c=0;
        for(int i=1;i<=n;i++)
        {
        	for(int j=i+1;j<=n;j++)
        	{
        		c++;
        		cout<<i<<" "<<j<<endl;
        		if(c==n-1+x)
        			return 0;
        	}
        }

    }
    return 0;
}

Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n = inp[0]
t = ("A".."Z").to_a
s = gets.chomp
s.each_char do |c|
  print(t[(c.ord-"A".ord+n)%26])
end
#777


Measured memory_bytes: 2300
S=str(input())
N=len(S)
part1 = S[:(N-1)//2]
part2 = S[(N+3)//2-1:N]

if S[::-1] == S and part1[::-1] == part1 and part2[::-1] == part2:
    print('Yes')
else:
    print('No')
    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    std::deque<int> q;
    for (int i = 1; i <= std::min(n, k - 1); i++) {
        int j = 0;
        while ((i << j) < k) j++;
        q.push_back(j);
    }
    int max = q.front();
    i64 s = 0;
    for (int p : q) {
        s += (1 << max) - (1 << (max - p));
    }
    double ret = (double)1 - (double)s / (double)(1 << max) / (double)n;
    printf("%.10lf\n", ret);

    return 0;
}


Measured memory_bytes: 256
#include <regex>
#include "bits/stdc++.h"
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define INF (INT_MAX / 2)
#define LINF (LLONG_MAX / 2)
#define EPS (1.0e-8)
const int MGN = 10;
const int ARY_SZ_MAX = (int)1e7;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>;
using vc = vector<char>; using vvc = vector<vc>;
using vb = vector<bool>; using vvb = vector<vb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using psl = pair<string, ll>;


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


  int N,M; cin>>N>>M;
  vi P(M); 
  vs S(M);
  REP(i,M) cin>>P[i]>>S[i];

  int ac = 0, wa = 0;
  set<int> st;
  vi w(N+1,0);
  REP(i,M) {
    if (S[i] == "AC" && st.count(P[i]) == 0) {
      ac++;
      st.insert(P[i]);
    } else if(S[i]=="WA" && st.count(P[i]) == 0) {
      w[P[i]]++;
    }
  }

  FOR(i,1,N+1) {
    if (st.count(i)==0) continue;
    wa += w[i];
  }

  cout << ac << " " << wa << endl;


  return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define For(i,n) for(ll int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(a,b,c) for(ll a=b;a<c;a++)
#define M 1000000007
/*
TOO MUCH TO LEARN
 	ostringstream str1;
    str1 << c;
    string x = str1.str();
 
    accumulate(a,b,sum)
*/
//............
//set
/*
set <ll> :: iterator itr;
if (b.find(a[i]) != b.end())
*/
//............
//queue
/*
void Print(queue<ll>& Queue)
{
    while (!Queue.empty()) {
        cout << Queue.front() << " ";
        Queue.pop();
    }
}
 
// Function to reverse the queue
void reverseQueue(queue<ll>& Queue)
{
    stack<ll> Stack;
    while (!Queue.empty()) {
        Stack.push(Queue.front());
        Queue.pop();
    }
    while (!Stack.empty()) {
        Queue.push(Stack.top());
        Stack.pop();
    }
}
*/
/*
ll power(ll x, ll y, ll m)
{
    ll res = 1;      // Initialize result
 
    x = x % m;  // Update x if it is more than or
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % m;
 
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % m;
    }
    return res;
}
*/
 
// ll knapSack(ll W, ll wt[], ll val[], ll n) 
// { 
//    ll i, w; 
   
  
//    // Build table K[][] in bottom up manner 
//    for (i = 0; i <= n; i++) 
//    { 
//        for (w = 0; w <= W; w++) 
//        { 
//            if (i==0 || w==0) 
//                K[i][w] = 0; 
//            else if (wt[i-1] <= w) 
//                  K[i][w] = max(val[i-1] + K[i-1][w-wt[i-1]],  K[i-1][w]); 
//            else
//                  K[i][w] = K[i-1][w]; 
//        } 
//    } 
  
//    return K[n][W]; 
// } 
int main()
{
	fast;
    ll n;
    cin>>n;
    ll a[n];
    For(i,n)cin>>a[i];
    ll X[n];
    X[0]=0;
    X[1]=abs(a[0]-a[1]);
    f(i,2,n)
    {
        X[i]=min(abs(a[i]-a[i-2])+X[i-2],abs(a[i]-a[i-1])+X[i-1]);
    }
    cout<<X[n-1]<<endl;
}

Measured memory_bytes: 1792
x = []
y = []
for i in range(5):
    a = int(input())
    if a % 10 != 0:
        y.append(a % 10)
    if a % 10 != 0:
        a = a + (10 - (a % 10))
    x.append(a)

ans = sum(x)
if len(y) != 0:
    s = 10 - min(y)
    ans -= s

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(void){
		#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
 	//string s,t;
  	int a,b,c,k,ans=0;
  	cin>>a>>b>>c>>k;
  	if(k>a){
      if(k>a+b)
        ans=a-(k-a-b);
      else
        ans=a;
    }
  else
    ans=k;
  cout<<ans;
}
  



Measured memory_bytes: 3588
def gcd(x, y):
    if y > x:
        return gcd(y, x)
    elif x == 0:
        return 0
    else:
        z = x % y
        if z == 0:
            return y
        else:
            return gcd(y, z)

N, X = map(int, input().split())
city = [X] + list(map(int, input().split()))
city_diff = [abs(city[i + 1] - city[i]) for i in range(N)]
ans = city_diff[0]
for i in range(1, N, 1):
    ans = gcd(ans, city_diff[i])
print(ans)


Measured memory_bytes: 14252
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<string.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main()
{
    ll a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    if(a*c<=b)
        printf("%lld",c);
    else
        printf("%lld\n",b/a);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a + b + c) - max({a, b, c});
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x:x-1, A))

visited = [False for _ in range(N)]
visited[0] = True
pattern = [0]
x = 0
start = 0
patternBegin = 0
while True:
    x = A[x]
    if visited[x]:
        patternBegin = x
        break
    pattern.append(x)
    visited[x] = True

# print(pattern)
patternBeginIndex = pattern.index(patternBegin)
beforeLoop = pattern[0:patternBeginIndex]
repeat = pattern[patternBeginIndex:]
# print(beforeLoop, repeat)

if len(pattern) > K:
    print(pattern[K]+1)
else:
    ans = repeat[(K - len(beforeLoop))%len(repeat)]
    # print(pattern)
    print(ans+1)


Measured memory_bytes: 129200
#include<stdio.h>
#include<stdlib.h>
 
void Bubble(int a[36],char b[36],int n)
{
  int i,tempa,flag;
  char tempb;
  flag = 1;
  while(flag == 1) {
  flag = 0;
  for (i =n-2; i >=0;i--) {
    if(a[i]>a[i+1]){
      tempa = a[i+1];
      tempb = b[i+1];
      a[i+1] = a[i];
      b[i+1] = b[i];
      a[i] = tempa;
      b[i] = tempb;
      flag = 1;
    
    }
  }
  }
  for(i = 0; i<n-1;i++)
    printf("%c%d ",b[i],a[i]);
  printf("%c%d\n",b[n-1],a[n-1]);
  printf("Stable\n");
}
 

void Selection(int a[36],char b[36],int n)
{
  int i,mini,tempa,j;
  char tempb;
  for (i = 0; i < n; i++) {
    mini = i;
    for (j = i; j < n; j++) {
      if(a[mini] > a[j])
        mini = j;
    }
    if(mini != i){
      tempa = a[i];
      tempb = b[i];
      a[i] = a[mini];
      b[i] = b[mini];
      a[mini] = tempa;
      b[mini] = tempb;
    }  
   }
  for (i = 0; i < n-1; i++)
  printf("%c%d ",b[i],a[i]);
  printf("%c%d\n",b[n-1],a[n-1]);
}

void Stable(char b1[36],char b2[36],int n){
  int i,flag = 0;
  for(i = 0;i < n ;i++){
    if(b1[i]!=b2[i]) {
      printf("Not stable\n");
      flag = 1;
      break;
    }
  }
  if(flag == 0)
    printf("Stable\n");  
}

int main ()
{
 int i,a1[36],a2[36],n,num=0;
 char b1[36],b2[36],input[72];
 scanf("%d",&n);
 for (i = 0; i < 2*n; i+=2) {
  scanf("%s",input);
  a1[num]=atoi(&input[1]);
  b1[num]=input[0];
  num++;
}
 for (i = 0; i < n; i++) {
  a2[i]=a1[i];
  b2[i]=b1[i];
 }
 Bubble(a1,b1,n);
 Selection(a2,b2,n);
 Stable(b1,b2,n);
 return 0;
}

Measured memory_bytes: 1780
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int m = sc.nextInt();
        ArrayList<Shop> list = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            list.add(new Shop(sc.nextLong(), sc.nextInt()));
        }
        list.sort(Comparator.comparingLong(a -> a.value));

        long ans = 0;

        while (m > 0) {
            Shop target = list.get(0);
            list.remove(0);
            int kosu = Math.min(m, target.kosu);
            ans += target.value * kosu;
            m -= kosu;
        }

        System.out.println(ans);
    }

    public static class Shop {
        public long value;
        public int kosu;

        public Shop(long value, int kosu) {
            this.value = value;
            this.kosu = kosu;
        }
    }
}

Measured memory_bytes: 94508
#include <iostream>

int main(void) {
  int A, B, a, s, m;
  std::cin >> A >> B;
  a = A + B;
  s = A - B;
  m = A * B;
  if (a > s) {
    if (a > m) {
      std::cout << a << std::endl;
    } else {
      std::cout << m << std::endl;
    }
  } else {
    if (s > m) {
      std::cout << s << std::endl;
    } else {
      std::cout << m << std::endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

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

class Flow{
private:
    struct edge{
        ll to;
        ll cap;
        ll rev;
    };
    
    ll INF;
    ll v;
    vector<vector<edge>> e;
    vector<bool> used;
    
    void reset_used(){
        for(int i=0;i<used.size();i++){used[i]=false;}
    }
    
    ll dfs(ll where,ll to,ll flow){
        if(where==to){return flow;}
        used[where]=true;
        for(int i=0;i<e[where].size();i++){
            edge &E=e[where][i];
            if(!used[E.to] && E.cap>0){
                ll d=dfs(E.to,to,min(flow,E.cap));
                if(d>0){
                    E.cap-=d;
                    e[E.to][E.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }
    
public:
    Flow(ll v):v(v){
        e.resize(v);
        used.resize(v,false);
        INF=1e18+7;
    }
    
    void add_edge(ll from,ll to,ll cap){
        e[from].push_back((edge){to,cap,(ll)e[to].size()});
        e[to].push_back((edge){from,0,(ll)e[from].size()-1});
    }
    
    ll max_flow(ll s,ll t){
        vector<vector<edge>> ed=e;
        ll flow=0;
        while(1){
            reset_used();
            ll f=dfs(s,t,INF);
            if(f==0){break;}
            flow+=f;
        }
        e=ed;
        return flow;
    }
};



int main(){
    ll m,n;
    while(cin>>m>>n){
        if(m==0 && n==0){break;}
    vector<ll> a(m),b(n);
    Flow F(m+n+2);
    ll s=m+n;
    ll g=s+1;
    for(int i=0;i<m;i++){cin>>a[i]; F.add_edge(s,i,1);}
    for(int i=0;i<n;i++){cin>>b[i]; F.add_edge(m+i,g,1);}
    for(int i=0;i<m;i++){
        for(int t=0;t<n;t++){
            if(gcd(a[i],b[t])>1){
                F.add_edge(i,m+t,1);
            }
        }
    }
    cout<<F.max_flow(s,g)<<endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 16620
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
x=I()
base=2*(x//11)
if x%11==0:
    print(base)
elif x%11<=6:
    print(base+1)
else:
    print(base+2)

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

namespace ConsoleApplication19
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string b = Console.ReadLine();
            int count = 0;
            for(int i=0; i<3; i++)
            {
                if (a[i] == b[i])
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
/*abc157D*/
#include <malloc.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

long long com(int x, int y);
long long gya(long long tmp);

int main(void) {
  int a, b, i, max=1;
  long long n, n2, spe=1, x[31], p=2;
  //spe:種類, x:2^(i^2),p:2^i
  scanf(" %lld %d %d", &n, &a, &b);

  x[0]=1, x[1]=2, n2=n;
  for(i=2; n >= p; i++){
    p*=2;
    x[i]=x[i - 1] * x[i - 1] % (1000000007);
    max=i;
  }

  for(i=max; i >= 0; i--){
    if(n2 >= pow(2, i - 1)){
      n2-=pow(2, i - 1);
      spe=spe * x[i] % (1000000007);
    }
  }

  spe-=com(n, a) + com(n, b) + 1;
  if(spe < 0) spe=spe % 1000000007 + 1000000007;
  printf("%lld", spe);

}
long long com(int x, int y) {
  int i;
  long long ret=1, tmp=1;

  for(i=0; i < y; i++){
    ret=ret * (x - i) % 1000000007;
    tmp=tmp * (i + 1) % 1000000007;
  }
  return (ret * gya(tmp)) % 1000000007;
}

long long gya(long long a) { //逆元を求める
  long long m=1000000007, b=m, u=1, v=0, c, t;
  while(b){
    t=a / b; //何これ
    a-=t * b, u-=t * v; //何これ
    c=a, a=b, b=c, c=u, u=v, v=c; //swap
  }
  return (u + m) % m;
}

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
    string s;
    cin>>s;
    vector<vector<mint>> dp(s.size()+5,vector<mint>(15));
    dp[0][0]=1;
    for(int i=0;i<(int)s.size();i++){
        if('0'<=s[i]&&s[i]<='9'){
            rep(j,13){
                dp[i+1][(j*10+(s[i]-'0'))%13]+=dp[i][j];
                //dp[i+1][(j*10+int(s[i]-'0'))%13]%=MOD;
                //dp[i+1][(j*10+int(s[i]-'0'))%13]=(dp[i+1][(j*10+int(s[i]-'0'))%13]+MOD)%MOD;
            }
        }
        else{
            rep(k,10){
                rep(j,13){
                    dp[i+1][(j*10+k)%13]+=dp[i][j];
                    //dp[i+1][(j*10+k)%13]%=MOD;
                    //dp[i+1][(j*10+k)%13]=(dp[i+1][(j*10+k)%13]+MOD)%MOD;
                }
            }
        }
    }
    cout<<dp[s.size()][5]<<endl;
}

Measured memory_bytes: 18280
#include <iostream>
#include <cmath>

using namespace std;
int main(void){
    // Your code here!
    int x(0), y(0), z(0);
    cin >> x;
    
    for(int i=3;i>0;i--)
    {
        z=pow(60, i-1);
        y=x/z;
        x-=z*y;
        cout<<y;
        
        if(i!=1)
            cout<<":";
    }
    
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3268
#include"bits/stdc++.h"
    #include<valarray>
     
    using namespace std;
     
    int k;
    int h;
    int w;
    #define MAX 312
    char room[MAX][MAX];
    int fl[MAX][MAX];
    void col(int x,int y,int xx,int yy,int w){
    	for(int i=x;i<=xx;i++){
    		for(int j=y;j<=yy;j++){
    			fl[i][j]=w;
    		}
    	}
    }
    int main(){
    	cin>>h>>w>>k;
    	int cn=0;
    	for(int i=0;i<h;i++){
    		scanf("%s",room[i]);
    		for(int j=0;j<w;j++){
    			if(room[i][j]=='#'){
    				fl[i][j]=++cn;
    			}
    		}
    	}
    	int oc=0;
    	for(int j=0;j<w;j++){
    		int lef=0;
    		bool ex=false;
    		for(int i=0;i<h;i++){
    			if(fl[i][j]){
    				col(lef,oc,i,j,fl[i][j]);
    				lef=i+1;
    				ex=true;
    			}
    		}
    		if(ex==true){
    			for(int i=lef;i<h;i++){
    				col(i,oc,i,j,fl[i-1][j]);//fl[i][j]=fl[i-1][j];
    			}
    			oc=j+1;
    			continue;
    		}
    		if(ex==false){
    			if(oc!=0){
    				for(int i=0;i<h;i++){
    					fl[i][j]=fl[i][j-1];
    				}
    				oc=j+1;
    			}
    			else{
    				continue;
    			}
    		}
    	}
    	for(int i=0;i<h;i++){
    		for(int j=0;j<w;j++){
    			if(j)printf(" ");
    			printf("%d",fl[i][j]);
    		}
    		puts("");
    	}
    	return 0;
    }


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

using namespace std;

int main(){
    int N;
    int A1,A2,A3;
    cin >> A1 >> A2 >> A3;
    if( A1+A2+A3 >=22) cout << "bust" << endl;
    else
    {
        cout << "win" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll A,B;
    cin>>A>>B;
    
    ll ans=0;
    if(A==B){
        ans=A;
    }else if(B-A<=100){
        for(ll i=A;i<=B;i++){
            ans = ans^i;
        }
    }else{
        ll x=A;
        for(x;x%2!=0;x++){
            ans ^= x;
        }
        
        ll k = (B-x);
        k -= k%4;
        for(x=x+k;x<=B;x++) ans^=x;
    }
    
    cout1(ans)
}

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

#define i64 long long int
#define ran 303

int n, m;
int h[ran];
i64 f[ran][ran][ran];

void upd(i64 &a, i64 b) {
	if(a<0 || a>b) a = b;
}

int main() {
	scanf("%d%d", &n, &m);
	for(int i=1;i<=n;i++) scanf("%d", &h[i]);
	h[0] = 0;
	
	memset(f, -1, sizeof f);
	f[0][0][0] = 0;
	for(int i=0;i<n;i++)
	for(int j=0;j<=i;j++)
	for(int k=0;k<=m;k++) {
		if(f[i][j][k]<0) continue;
		upd(f[i+1][i+1][k], f[i][j][k] + max(0, h[i+1]-h[j]));
		if(k<m)
			upd(f[i+1][j][k+1], f[i][j][k]);
	}
	
	i64 ans = -1LL;
	for(int j=0;j<=n;j++)
	for(int k=0;k<=m;k++)
		if(f[n][j][k]>=0)
			upd(ans, f[n][j][k]);
	cout<<ans<<endl;
	
	return 0;
}

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

const int N = 100005;
vector<P> G[N];
int clr[N];
vector<bool> visited(N, false);
int k = 0;

void dfs(int pos, int c) {
  visited[pos] = true;
  int cnt = 0;
  rep(i, G[pos].size()) {
    P p = G[pos][i];
    int to = p.first;
    if (visited[to]) continue;
    clr[p.second] = (c + (cnt++)) % k + 1;
    dfs(to, clr[p.second]);
  }
  return;
}

int main() {
  int n;
  cin >> n;
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    G[a].push_back(make_pair(b, i));
    G[b].push_back(make_pair(a, i));
  }

  rep(i, n) k = max(k, (int)G[i].size());
  cout << k << endl;

  dfs(0, 0);
  rep(i, n-1) cout << clr[i] << endl;
  return 0;
}

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

#define ll long long int
#define endl '\n'

void solve()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll z = a*c;
	ll z1 = a*d;
	ll z2 = b*c;
	ll z3 = b*d; 

	 z = max(z,z1);
	 z = max(z,z2);
	 z = max(z,z3);
	 cout<<z<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef JAY
        freopen("C:/Users/jayra/Desktop/cp/input.txt","r",stdin);
        freopen("C:/Users/jayra/Desktop/cp/output.txt","w",stdout);
    #endif

    
        solve();
   
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(1e5+1, 0);
    rep(i, n) {
        int tmp_a;
        cin >> tmp_a;
        ++a[tmp_a];
    }
    int ans = 0;
    for ( int i = 1; i < 1e5; ++i ) {
        ans = max(ans, a[i-1] + a[i] + a[i+1]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
import math
#print(math.cos(math.radians(90)))
#exit()
n = int(input())
x = 0
y = 1
deg = 90 - n
cnt = 1
#print(x<-10**(-5))
while 1 == 1:
    x += math.cos(math.radians(deg))
    y += math.sin(math.radians(deg))
    deg -= n
    cnt += 1
    if x > -10**(-5) and x < 10**(-5) and y > -10**(-5) and y < 10**(-5):
        break
print(cnt)

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

int main(){
  string S;
  cin>>S;
  if(S=="Cloudy"){
    cout<<"Rainy"<<endl;
  }
  if(S=="Sunny"){
    cout<<"Cloudy"<<endl;
  }
  if(S=="Rainy"){
    cout<<"Sunny"<<endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N;
const int MAX_N = 100010;
int dp[MAX_N];
int memo(int rest)
{
    if (rest == 0)
    {
        return 0;
    }
    int &res = dp[rest];
    if (res >= 0)
    {
        return res;
    }
    res = INF;
    res = min(res, memo(rest - 1) + 1);
    int six = 6;
    while (rest - six >= 0)
    {
        res = min(res, memo(rest - six) + 1);
        six *= 6;
    }
    int nine = 9;
    while (rest - nine >= 0)
    {
        res = min(res, memo(rest - nine) + 1);
        nine *= 9;
    }
    return res;
}
int main()
{
    int N;
    cin >> N;
    memset(dp, -1, sizeof(dp));
    cout << memo(N) << endl;
    return 0;
}


Measured memory_bytes: 3712
fun main(args: Array<String>) {
    val N = nextInt()
    val dp = Array(N + 1) { Array(4) { Array(4) { Array(4) { 0 } } } }
    var MOD = 1000000007
    // A C G T -> 0 1 2 3
    dp[0][3][3][3] = 1
    for (len in 0 until N)
        for (c1 in 0 until 4)
            for (c2 in 0 until 4)
                for (c3 in 0 until 4) {
                    if (dp[len][c1][c2][c3] == 0) continue
                    for (a in 0 until 4) {
                        if (a == 2 && c1 == 1 && c2 == 0) continue // 0 1 2
                        if (a == 2 && c1 == 0 && c2 == 1) continue // 1 0 2
                        if (a == 1 && c1 == 2 && c2 == 0) continue // 0 2 1
                        if (a == 2 && c1 == 1 && c3 == 0) continue // 0 ? 1 2
                        if (a == 2 && c2 == 1 && c3 == 0) continue // 0 1 ? 2
                        // S = ...... c3 c2 c1
                        // nextS = ...... c2 c1 a
                        dp[len + 1][a][c1][c2] += dp[len][c1][c2][c3]
                        dp[len + 1][a][c1][c2] %= MOD
                    }
                }
    var ans = 0
    for (c1 in 0 until 4)
        for (c2 in 0 until 4)
            for (c3 in 0 until 4) {
                ans += dp[N][c1][c2][c3]
                ans %= MOD
            }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())

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

#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int N, R;
signed main() {
    cin >> N >> R;
    if (N >= 10) { cout << R << endl; }
    else { cout << R + 100 * (10 - N) << endl; }
}

Measured memory_bytes: 256
unittest
{
	assert( [ "5 3 5", "1", "2", "3", "6", "12" ].parse.expand.solve == 3 );
	assert( [ "6 3 3", "7", "6", "2", "8", "10", "6" ].parse.expand.solve == 3 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nck = input.front.split.to!( long[] );
	auto ts = new long[ nck[ 0 ] ];
	foreach( ref t; ts )
	{
		input.popFront;
		t = input.front.to!( long );
	}
	return tuple( nck[ 1 ], nck[ 2 ], ts );
}

auto solve( long c, long k, long[] ts )
{
	ts.sort();
	
	auto ans = 0L;
	auto tn = 0L;
	auto tk = 0L;
	foreach( t; ts )
	{
		if( c <= tn || tk < t )
		{
			// 時間or定員オーバーで次のバスに乗せる
			ans++;
			tn = 1;
			tk = t + k;
		}
		else
		{
			// 今のバスに乗せる
			tn++;
		}
	}
	return ans;
}


Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void put(string d){}template<class H,class...T>void put(string d,H&h,T&...t){cout<<h;if(sizeof...(t))cout<<d;put(d,t...);}
template<class T>void puti(T&a,string d=" "){bool f=1;for(auto&_:a)cout<<(exchange(f,0)?"":d)<<_;cout<<endl;}
template<class T>void putii(T&a,string d=" "){for(auto&_:a)puti(_,d);}

int ds(int n){
    int r=0;
    while(n){
        r=r+n%10;
        n/=10;
    }
    return r;
}

int main(){
    int n;
    cin>>n;
    int ans=100000000;
    range(i,1,n){
        ans=min(ans,ds(i)+ds(n-i));
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

    int A,B, max;

    cin >> A >> B;

    max=A+B;

    if(A-B>max)
        max=A-B;

    if(A*B>max)
        max=A*B;

    std::cout << max << std::endl;
    return 0;
}

Measured memory_bytes: 256