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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

struct data {
    string era;
    int y1;
    int y2;
};

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

    int n, q;
    while (cin >> n >> q, n) {
        map<P, string> mp;
        rep(i, n) {
            string s;
            int x, y;
            cin >> s >> x >> y;
            mp[P(y - x + 1, y)] = s;
        }

        rep(_, q) {
            int x;
            cin >> x;
            bool flag = false;
            for (auto p : mp) {
                int l, r;
                tie(l, r) = p.first;
                if (l <= x && x <= r) {
                    cout << p.second << " " << x - l + 1 << endl;
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                cout << "Unknown" << endl;
            }
        }
    }
}

Measured memory_bytes: 3288
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
#include<algorithm>
#define debug1 cout<<"?"<<endl;
#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=1e3+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	char s[maxn],t[maxn],u[maxn];
	int n,m;
	scanf("%s%s",s,t);
	scanf("%d%d",&n,&m);
	scanf("%s",u);
	if(strcmp(u,s)==0)n--;
	else m--;
	printf("%d %d\n",n,m);
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int m,f,r,i,s=0;
	char grade[100];
	for(i=0;i<100;i++){
		scanf("%d %d %d",&m,&f,&r);
		if(m==-1&&f==-1&&r==-1)
			break;
		s++;
		if(m==-1||f==-1){
			grade[i]='F';
		}
		else if(m+f>=80){
			grade[i]='A';
		}
		else if(m+f>=65){
			grade[i]='B';
		}
		else if(m+f>=50){
			grade[i]='C';
		}
		else if(m+f>=30){
			if(r>=50)
				grade[i]='C';
			else
				grade[i]='D';
		}
		else
			grade[i]='F';
	}
	for(i=0;i<s;i++){
		printf("%c\n",grade[i]);
	}
	
	
	return 0;
}


Measured memory_bytes: 1804
from math import factorial

mod_n = 10**9+7
n,m = map(int, input().split())

if abs(n-m)>1:
  print(0)
elif n==m:
  print(2*pow(factorial(n), 2, mod_n)%mod_n)
else:
  print(factorial(n)*factorial(m)%mod_n)

Measured memory_bytes: 5184
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
int main() {
  long long k,a,b,ans,cnt;
  cin >> k >> a >> b;
  if(a>=k) {
    cout << 1 << endl;
  }
  else if(a<=b) {
    cout << -1 << endl;
  }
  else {
    cout << (k-b-1)/(a-b)*2+1 << endl;
  }
}


Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
S="U"*(ty-sy)+"R"*(tx-sx)+"U"+"L"*(tx-sx+1)+"D"*(ty-sy+1)+"R"+"D"+"R"*(tx-sx+1)+"U"*(ty-sy+1)+"L"+"D"*(ty-sy)+"L"*(tx-sx)
print(S)

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

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}


//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;

int main(){
 
int a ,b,c,d,e;cin>>a>>b>>c>>d>>e;  
  if(a==0)cout<<1;
  else if(b==0)cout<<2;
  else if(c==0)cout<<3;
  else if(d==0)cout<<4;
  else if(e==0)cout<<5;
}

Measured memory_bytes: 3572
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;
using ll=long long;

int main(){
    int n;
    cin>>n;
    int num[1100]={0};
    int _i;
    for(int i=2;i<n+1;i++){
        _i=i;
        for(int k=2;k<_i+1;k++){
            while(_i%k==0){
                num[k]++;
                _i /= k;
            }
        }
    }
    ll ans=1;
    for(int i=2;i<n+1;i++){
        if(num[i] != 0){
            ans *= num[i]+1;
            ans = ans % 1000000007;
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
r=j=x=1
M=10**9+7
`sed 1d`.split.map{x=$*[k=_1.to_i]||x+1
$*[k]=$.+=1}.map{p (-j+r=r*($.+1-_1)%M*s=_1.pow(M-2,M))%M
j=j*s%M*x-=1}

Measured memory_bytes: 26572
#include <iostream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <vector>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);
	string ans[] = { "No", "Yes" };
	long long int q, right = 0, left = 0;
	cin >> q;
	for(int i = 0; i < q; i++) {
		char ch;
		long long int a, b;
		cin >> a >> ch >> b;
		if( ch == '(' )
			left += b;
		else
			left -= b;
		cout << ans[left == 0] << endl;
	}
	//while(1){}
	return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    int sum=0;
    while(n){
      n /= 5;
      sum += n;
    }
    cout<<sum<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i,  n) for (int i  =  0; i < (int)(n); ++i)
#define REPR(i,  n) for (int i  =  n - 1; i >= 0; --i)
using namespace std;
#define int long long int
//------------ATCODER TEMPLATE-------------

signed main() {
  int X, Y; cin >> X >> Y;
  for (int i = 0; i <= X; ++i) {
    int j = X - i;
    if (2 * i + 4 * j == Y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
int H, W;
vector<string> A;
bool f() {
	int p = 0;
	for (auto& x : A) {
		if (x[p] != '#') return false;
		x[p] = '$';
		while (p+1 < W && x[p+1] == '#') {
			x[++ p] = '$';
		}
	}
	if (p != W-1) return false;
	for (auto& x : A) {
		for (char c : x) if (c == '#') return false;
	}
	return true;
}
int main() {
	cin >> H >> W;
	A.resize(H);
	for (auto& x : A) cin >> x;
	cout << (f() ? "Possible" : "Impossible") << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <cmath>
using namespace std;
long long gcd(long long a, long long b) {
	if (a < b) gcd(b, a);
	long long  r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
long long lcm(long long a, long long b) {
	return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

long long modinv(long long a, long long mod) {
	long long b = mod, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}
namespace NTT {
	const int MOD = 998244353;  // to be set appropriately
	const long long PR = 3;     // to be set appropriately

	void trans(vector<long long> &v, bool inv = false) {
		int n = (int)v.size();
		for (int i = 0, j = 1; j < n - 1; j++) {
			for (int k = n >> 1; k >(i ^= k); k >>= 1);
			if (i > j) swap(v[i], v[j]);
		}
		for (int t = 2; t <= n; t <<= 1) {
			long long bw = modpow(PR, (MOD - 1) / t, MOD);
			if (inv) bw = modinv(bw, MOD);
			for (int i = 0; i < n; i += t) {
				long long w = 1;
				for (int j = 0; j < t / 2; ++j) {
					int j1 = i + j, j2 = i + j + t / 2;
					long long c1 = v[j1], c2 = v[j2] * w % MOD;
					v[j1] = c1 + c2;
					v[j2] = c1 - c2 + MOD;
					while (v[j1] >= MOD) v[j1] -= MOD;
					while (v[j2] >= MOD) v[j2] -= MOD;
					w = w * bw % MOD;
				}
			}
		}
		if (inv) {
			long long inv_n = modinv(n, MOD);
			for (int i = 0; i < n; ++i) v[i] = v[i] * inv_n % MOD;
		}
	}

	// C is A*B
	vector<long long> mult(vector<long long> A, vector<long long> B) {
		int size_a = 1; while (size_a < A.size()) size_a <<= 1;
		int size_b = 1; while (size_b < B.size()) size_b <<= 1;
		int size_fft = max(size_a, size_b) << 1;

		vector<long long> cA(size_fft, 0), cB(size_fft, 0), cC(size_fft, 0);
		for (int i = 0; i < A.size(); ++i) cA[i] = A[i];
		for (int i = 0; i < B.size(); ++i) cB[i] = B[i];

		trans(cA); trans(cB);
		for (int i = 0; i < size_fft; ++i) cC[i] = cA[i] * cB[i] % MOD;
		trans(cC, true);

		vector<long long> res((int)A.size() + (int)B.size() - 1);
		for (int i = 0; i < res.size(); ++i) res[i] = cC[i];
		return res;
	}
};
typedef pair<int, int> p;
typedef pair<int, p> pai;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k, x, y;
	cin >> n >> k >> x >> y;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i > k)ans += y;
		else ans += x;
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

struct union_find{
    vector<ll> parent;
    union_find(ll n){
        parent.resize(n);
        rep(i, 0, n) parent[i] = i;
    }

    ll root(ll x){
        if(parent[x] == x) return x;
        parent[x] = root(parent[x]);
        return parent[x];
    }

    void unite(ll x, ll y){
        ll rx = root(x);
        ll ry = root(y);
        if(rx != ry) parent[rx] = ry;
    }

    bool same(ll x, ll y){
        ll rx = root(x);
        ll ry = root(y);
        if(rx == ry) return true;
        return false;
    }
};

ll N, M;

int main(){
    cin >> N >> M;
    union_find t(N+1);
    VL L(M+1), R(M+1), D(M+1);
    vector<VP> G(N+1); 
    rep(i, 0, M){
        cin >> L[i] >> R[i] >> D[i];
        t.unite(L[i], R[i]);
        G[L[i]].push_back({R[i],D[i]});
        G[R[i]].push_back({L[i],-D[i]});
    }

    VL x(N+1, -1e18);
    queue<ll> que;
    rep(i, 1, N+1){
        ll r = t.root(i);
        if(x[r] == -1e18){
            x[r] = 0;
            que.push(r);
        }
    }

    while(!que.empty()){
        auto q = que.front();
        que.pop();
        for(auto g : G[q]){
            ll next = x[q] + g.second;
            if(next != x[g.first] && x[g.first] != -1e18){
                cout << "No" << endl;
                return 0;
            }
            if(x[g.first] == -1e18){
                x[g.first] = next;
                que.push(g.first);
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 19456
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<char>>();
    let t = read::<String>().chars().collect::<Vec<char>>();
    let mut count = 0;
    for i in 0..3 {
        if s[i] == t[i] {
            count += 1;
        }
    }
    println!("{}", count);
}

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

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

int main() {
  char c;
  cin >> c;

  cout << ((c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
               ? "vowel"
               : "consonant")
       << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	long long int n, m;
	cin >> n >> m;
	vector<vector<int> > graph(n);
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	vector<int> check(n, -1);
	queue<int> qu;
	check[0] = 0;
	qu.push(0);
	while(!qu.empty()){
		int now = qu.front();
		qu.pop();
		for(int i = 0; i < graph[now].size(); i++){
			int next = graph[now][i];
			if(check[next] == -1){
				check[next] = !check[now];
				qu.push(next);
			} else if(check[next] == check[now]){
				cout << n * (n - 1) / 2 - m << endl;
				return 0;
			}
		}
	}
	long long int cnt = 0;
	for(int i = 0; i < n; i++){
		if(check[i] == 0) cnt++;
	}
	cout << cnt * (n - cnt) - m << endl;
	return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    ll H, W; cin >> H >> W;
    if (H > 1 && W > 1) {
        if (H % 2 == 0) cout << W * (H / 2) << endl;
        else cout << (W * (H / 2)) + ((W+1) / 2) << endl;
    } else {
        cout << 1 << endl;
    }
}


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

int main(){

    double l;
    cin >> l;
    cout << setprecision(12);
    cout << pow(l/3.0,3) << endl;

    return 0;
}

Measured memory_bytes: 384
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

def f(b,n):
    if(n<b): return n
    return f(b,n//b)+n%b

def resolve():
    n=int(input())
    s=int(input())

    if(s>n):
        print(-1)
        return
    if(s==n):
        print(n+1)
        return

    # 2 <= b <= sqrt(n) を全探索
    k=int(n**.5)
    for b in range(2,k+2):
        if(f(b,n)==s):
            print(b)
            return

    # sqrt(n) < b <= n を考える
    B=[]
    for p in range(1,k+1):
        if((n-s)%p): continue
        b=(n-s)//p+1
        if(b<2): continue
        if(f(b,n)==s):
            B.append(b)

    print(min(B) if(B) else -1)
resolve()

Measured memory_bytes: 42864
#include<stdio.h>
#include<string.h>
int main()
{
	int n,len,sum,max=0;
	char ch[105];
	int mp[26],np[26];
	scanf("%d",&n);getchar();
	scanf("%s",ch);
	len=strlen(ch);
	for(int i=1;i<len-1;i++)
	{
		sum=0;
		for(int j=0;j<26;j++)
		{
			mp[j]=0;
			np[j]=0;
		}
		for(int j=0;j<i;j++)mp[ch[j]-'a']++;
		for(int j=i;j<=len-1;j++)np[ch[j]-'a']++;
		for(int j=0;j<26;j++)if(mp[j]!=0&&np[j]!=0)sum++;
		if(sum>max)max=sum;
	}
	printf("%d\n",max);
}

Measured memory_bytes: 888
import sys
from math import ceil

def main():
    n = int(sys.stdin.readline().rstrip())
    x = ceil(n / 1.08)

    res = []
    while x * 27 // 25 == n:
        res.append(x)
        x += 1
    
    if res:
        print(res[0])
    else:
        print(':(')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include<bits/stdc++.h>
#include<algorithm>
#include<set>
#include<iterator>
#include<map>
#include<cmath>
#include<unordered_map>
#include<vector>
using namespace std;
#define int long long
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define fo(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
const int inf = (1e18)+7;
const int neginf = -1*((int)1e17 ) + 7 ;
set<int> s;
void primeFactors(int n)  
{  
    
    // Print the number of 2s that divide n  
    while (n % 2 == 0)  
    {  
        s.insert(2); 
        n = n/2;  
    }  
  
    // n must be odd at this point. So we can skip  
    // one element (Note i = i +2)  
    for (int i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            s.insert(i);
            n = n/i;  
        }  
    }  
  
    // This condition is to handle the case when n  
    // is a prime number greater than 2  
    if (n > 2)  
        s.insert(n);
    
}
int32_t main() {
    fastio
    
      int a,b;
     cin>>a>>b;
    
    int gcdd = __gcd(a,b);
   
     primeFactors(gcdd);
   // int ans =  primeFactors(gcdd);
   // cout<<ans;
    cout<<s.size()+1;
   // for(auto x:s)
     //   cout<<x<<" ";
        
    
    
     
    
    
    

        
        
        
    
            
        
       
        
        
        
    
     
    
    
	return 0;
}


Measured memory_bytes: 256
n, m = map(int,input().split())
a = list(map(int,input().split()))
rewrite = []
for i in range(m):
    rewrite.append(list(map(int,input().split())))
rewrite.sort(key= lambda x : x[1], reverse=True)
a.sort()
k = 0
flag = 0
for i in range(m):
    for j in range(rewrite[i][0]):
        if rewrite[i][1] > a[k]:
            a[k] = rewrite[i][1]
            k += 1
            if k == n:
                flag = 1
                break
        else:
            flag = 1
            break
    if flag == 1:
        break
print(sum(a))


Measured memory_bytes: 81432
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0092
"""
import sys


def find_square0(data):
    max_size = 0
    dp = [] # dp??¨???2?¬??????????
    # '.'????????????1??????'*'????????????0????????????
    for row in data:
        temp = []
        for c in row:
            if c == '.':
                temp.append(1)
            else:
                temp.append(0)
        dp.append(temp)

    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????
    for y in range(1, len(dp)):
        for x in range(1, len(dp[0])):
            if dp[y][x] == 1:
                dp[y][x] = min(dp[y-1][x-1], dp[y-1][x], dp[y][x-1]) + 1
                if dp[y][x] > max_size:
                    max_size = dp[y][x]
    return max_size


def find_square2(data):
    max_size = 0
    dp = [[0]*len(data[0]) for _ in range(len(data))] # dp??¨???2?¬???????????????¨??????0??§?????????
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == '.':
                dp[y][x] = 1

    # (?????¨???(curr_row)??¨???????????????(prev_row)????????¢????????????????????§?????????????????????)
    prev_row = dp[0]
    for curr_row in dp[1:]:
        for x, t in enumerate(curr_row[1:], start=1):
            if t == 1:
                curr_row[x] = min(prev_row[x-1], prev_row[x], curr_row[x-1]) + 1
                if curr_row[x] > max_size:
                    max_size = curr_row[x]
        prev_row = curr_row
    return max_size


def find_square3(data):
    from array import array
    max_size = 0
    dp = [array('I', [0]*len(data[0])) for _ in range(len(data))]  # ????¬?????????????array??????????????§?¢????
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == '.':
                dp[y][x] = 1

    prev_row = dp[0]
    for curr_row in dp[1:]:
        for x, t in enumerate(curr_row[1:], start=1):
            if t == 1:
                curr_row[x] = min(prev_row[x-1], prev_row[x], curr_row[x-1]) + 1
                if curr_row[x] > max_size:
                    max_size = curr_row[x]
        prev_row = curr_row
    return max_size


def find_square4(data):
    # 4.91[s]
    max_size = 0
    dp = [0 for _ in range(1024*1024)]
    # '.'????????????1???
    for y, row in enumerate(data):
        for x, c in enumerate(row):
            if c == '.':
                dp[y*1024+x] = 1

    # ????±?????????????????????????????????£????????????????????£?????¢????¢??????§??????????????§????????????
    for y in range(1, len(data)):
        for x in range(1, len(data)):
            if dp[y*1024+x] == 1:
                dp[y*1024+x] = min(dp[(y-1)*1024+x-1], dp[(y-1)*1024+x], dp[y*1024+x-1]) + 1
                if dp[y*1024+x] > max_size:
                    max_size = dp[y*1024+x]
    return max_size



def main(args):
    while True:
        n = int(input())
        if n == 0:
            break
        data = [input() for _ in range(n)]
        result = find_square2(data)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 34264
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

struct Node
{
    Node()
    {
        parent = left = right = -1;
    };
    int left, right, parent;
};

void preORDER(vector<Node> G, int id)
{
    cout << " " << id;
    if (G.at(id).left != -1)
    {
        preORDER(G, G.at(id).left);
    }
    if (G.at(id).right != -1)
    {
        preORDER(G, G.at(id).right);
    }
}

void inORDER(vector<Node> G, int id)
{
    if (G.at(id).left != -1)
    {
        inORDER(G, G.at(id).left);
    }
    cout << " " << id;
    if (G.at(id).right != -1)
    {
        inORDER(G, G.at(id).right);
    }
}
void postORDER(vector<Node> G, int id)
{
    if (G.at(id).left != -1)
    {
        postORDER(G, G.at(id).left);
    }
    if (G.at(id).right != -1)
    {
        postORDER(G, G.at(id).right);
    }
    cout << " " << id;
}
int main()
{
    int n;
    cin >> n;
    vector<Node> G(n);
    repi(i, n, 0)
    {
        int node, left, right;
        cin >> node >> left >> right;
        if (left != -1)
        {
            G.at(node).left = left;
            G.at(left).parent = node;
        }
        if (right != -1)
        {
            G.at(node).right = right;
            G.at(right).parent = node;
        }
    }
    int root = 0;
    repi(i, n, 0)
    {
        if (G.at(i).parent == -1)
        {
            root = i;
            break;
        }
    }
    cout << "Preorder" << endl;
    preORDER(G, root);
    cout << endl;
    cout << "Inorder" << endl;
    inORDER(G, root);
    cout << endl;
    cout << "Postorder" << endl;
    postORDER(G, root);
    cout << endl;
    return 0;
}


Measured memory_bytes: 3128
import itertools

X, K, D = list(map(int, input().split()))

l = 0
r = K
min_distance = float('inf')
diff_set = set()

while (l <= r):
    n = (r + l) // 2
    diff = (2 * n - K) * D + X
    if min_distance == float('inf'):
        min_distance = abs(diff)
    if abs(diff) < min_distance :
        min_distance = abs(diff)

    if diff in diff_set:
        break
    else:
        diff_set.add(diff)

    if diff > 0:
        r = n - 1
    else:
        l = n + 1

print(min_distance)

Measured memory_bytes: 61788
N,T=map(int,input().split())
L=[list(map(int,input().split())) for _ in range(N)]
c=1001
for i in range(N):
    if L[i][1]<=T:
        c=min(c,L[i][0])
if c<1001:
    print(c)
else:
    print("TLE")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi = acos(-1);
#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    ll n; cin >> n;
    vector<ll> A(n);
    REP(i, n) cin >> A[i];
    vector<ll> A0 = A;
    sort(A.begin(), A.end());
    map<ll, ll> order;
    REP(i, n) order[A[i]] = i;
    ll ans = 0;
    REP(i, n) {
        if (i % 2 != order[A0[i]] % 2) {
            ans += 1;
        }
    }
    assert(ans % 2 == 0);
    cout << ans/2 << endl;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  A = 0;
  B = 0;
  cin >> N ;
  
  vector<int> Card(N);
  for(int i=0 ; i<Card.size() ; i++){
    cin >> Card.at(i);
  } 
  
  sort(Card.begin(),Card.end());
  reverse(Card.begin(),Card.end());
  
  for(int i=0 ; i<N ; i++){
  if (i%2 == 0) A += Card.at(i);
    else B += Card.at(i);
  }
  
  cout << A-B ;
  
}

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

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p)
#define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;

typedef pair<double, double> Pd;


const int INF = 1000000009; //0x2aaaaaaa; // 715,827,882
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << ", " << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second

int a[200001];


int main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	int x = a[n - 1];

	int y;
	int d = -1;
	rep(i, n) {
		int D = min(a[i], x-a[i]);
		if (d < D) {
			y = a[i]; d = D;
		}
	}
	cout << x << " " << y << endl;


}

Measured memory_bytes: 640
#include<stdio.h>

int main(){

	int i,n,flagX[2],flagY[2];
	double x[4],y[4],a[2];

	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
		flagY[0]=0;
		flagX[0]=0;
		flagY[1]=0;
		flagX[1]=0;
		a[0]=0;
		a[1]=0;

		if(x[0]-x[1]==0){
			flagY[0]=1;
			a[0]=99999;
		}
		else if(y[0]-y[1]==0){
			flagX[0]=1;
			a[0]=99999;
		}
		else{
			a[0]=(y[0]-y[1])/(x[0]-x[1]);
		}

		if(x[2]-x[3]==0){
			flagY[1]=1;
			a[1]=99999;
		}
		else if(y[2]-y[3]==0){
			flagX[1]=1;
			a[1]=99999;
		}
		else{
			a[1]=(y[2]-y[3])/(x[2]-x[3]);
		}

		if((flagX[0]==1 && flagX[1]==1) || (flagY[0]==1 && flagY[1]==1) || ((a[0]<99999 && a[1]<99999) && a[0]==a[1])){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}


	return 0;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, m;
ll calc(ll a, ll b, ll x){
    ll l = (a * x) / b;
    ll r = a * (x / b);
    return  l - r;
}

int main()
{
    ll a, b;
    cin >> a >> b >> n;
    ll ans = calc(a, b, min(b-1, n));

    cout << ans << '\n';
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>; // グラフ型

int main()
{
    int n; cin >> n;
    map<string, int> mp;
    rep(i,n){
        string s; cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


/*
g++ b.cpp
./a.out

oj d https://atcoder.jp/contests/abc172/tasks/abc172_c
oj t
*/


Measured memory_bytes: 3636
//break_the_bond
//jatt_james_bond
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
#define NIL -1
#define MAX 100000009
#define IOS std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
bool comp(int a, int b)
{
    return a > b;
}
void solve()
{
    int n;
    cin >> n;

    for (int i = 0; i < n; ++i){
        cout << "ACL";
    }
}
// I really wish i could help you but I have a really busy college schedule and a lot of projects.  
int32_t main()
{
    IOS int testcases = 1;
    // cin >> testcases;
    while (testcases--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int main(){
  int h,w;
  cin >> h >> w;
  while(h!=0){
    int i,j;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	if(i==0||i==h-1||j==0||j==w-1)
	  cout << "#";
	else cout << ".";
      }
      cout << endl;
    }
    cout << endl;
    cin >> h >> w;
  }
  return 0;
}



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

#define all(x) (x).begin(),(x).end()
#define pb push_back
#define pf push_front
#define sz(x) (int)(x).size()
#define lb lower_bound 
#define ub upper_bound 
#define mp make_pair
#define fi first
#define se second
#define setbits(x) __builtin_popcount(x)
#define zerobits(x) __builtin_ctz(x)
#define setbitsll(x) __builtin_popcountll(x)
#define zerobitsll(x) __builtin_ctzll(x)
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

typedef vector<int> vi;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef vector<string> vs;
typedef unsigned long long ull;
typedef long double ld;
typedef map<int,int> mii;

const int MOD = 1e9+7;
const ld PI = acos((ld)-1);

void solve () {
	ll n,k,d;
	cin >> n >> k >> d;
	n = abs(n),k = abs(k),d = abs(d);
	ll times = n/d;
	if (k <= times) {
		cout << n-k*d;
	} else {
		k -= times;
		n -= times*d;
		if (k&1) {
			cout << abs(n-d);
		} else {
			cout << n;
		}
	}
}

int main () {
#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output1.txt","w",stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	solve();
	return 0;
}



Measured memory_bytes: 3684
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFLL = LLONG_MAX / 3;
const double eps = (1e-9);

const int mod = 1000000007;

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

  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  rep(i, H) cin >> a[i];
  vector<vector<ll>> dp(H, vector<ll>(W, 0));

  dp[0][0] = 1;
  rep(h, H) {
    rep(w, W) {
      if (a[h][w] == '#') continue;
      if (w + 1 < W && a[h][w+1] != '#') {
        dp[h][w+1] += dp[h][w];
        dp[h][w+1] %= mod;
      }
      if (h + 1 < H && a[h+1][w] != '#') {
        dp[h+1][w] += dp[h][w];
        dp[h+1][w] %= mod;
      }
    }
  }

  cout << dp[H-1][W-1] % mod << endl;

  return 0;
}


Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
char sa[1010];
int la;
int main()
{
	scanf("%s",&sa);
	la=strlen(sa);
	if(sa[0]=='Y'&&sa[1]=='A'&&sa[2]=='K'&&sa[3]=='I')
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n,m,a,b,c=0,d,x=0,y,z;
  string s,t;
  //

  // ここから
  IN(n);
  Vi H(n);
  VIN(H)
  REP(i,n) {
    x = max(x,H[i]);
    if(H[i] >= x) c++;
  }
  OUT(c);
}

Measured memory_bytes: 256
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

S = input()
T = input()

sd = defaultdict(lambda: ".")
td = defaultdict(lambda: ".")

for s, t in zip(S, T):
    if sd[s] != "." and sd[s] != t:
        print("No")
        exit()
    if td[t] != "." and td[t] != s:
        print("No")
        exit()
    sd[s] = t
    td[t] = s
print("Yes")


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

int main(){
	int n; cin>>n;
	set<string> set;
	vector<string> a(n);
	for(int i = 0; i < n; ++i){
		cin>>a[i];
		if(set.count(a[i])){
			cout<<"No\n";
			return 0;
		}
		set.insert(a[i]);
	}
	for(int i = 1; i < n; i++){
		if(a[i][0] != a[i - 1][a[i - 1].size() - 1]){
			puts("No");
			return 0;
		}
	}
	cout<<"Yes\n";	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll a[3];
int main(){
	REP(i,3)
		cin >> a[i];

	ll b[3];

	ll c = 0;

	while(c < 1000000) {
		bool f = false;

		REP(i,3) {
			if(a[i] % 2 == 1)
				f = true;
		}
		if(f)
			break;
		REP(i,3) {
			b[i] = a[i] / 2;
		}
		REP(i,3) {
			a[i] = b[(i + 1) % 3] + b[(i + 2) % 3];
		}
		c++;
	}
	if(c >= 1000000)
		cout << -1 << endl;
	else {
		cout << c << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  vector<int> n;
  n.push_back(a);
  n.push_back(b);
  n.push_back(c);
  sort(n.begin(), n.end());
  int num = n[2] - n[1];
  n[0] += num;
  if(n[0] == n[2])
  {
    cout << num << endl;
  }else{
    if(n[0] % 2 == n[2] % 2)
    {
      num += (n[2] - n[0]) / 2;
    }else{
      num += ceil((n[2] - n[0]) * 0.5) + 1;
    }
    cout << num << endl;
  }
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 21:54:27 2019

@author: yuta
"""

ABCDE = [int(input()) for i in range(5)]

def main(x):
    rest = list(map(lambda y: 10 - y%10,x))
    for i in range(5):
        if rest[i] == 10:
            rest[i] = 0
    rest_sort = sorted(rest)
    t = sum(x) + sum(rest_sort[0:4])
    print(t)

main(ABCDE)

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

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

typedef long long ll;

ll c[30],s[370][30];
int a[370],last[30];

unsigned seed=chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(seed);

ll f(int d)
{
    ll x=0;
    memset(last,-1,sizeof(last));
    for(int i=0;i<d;i++){
        x+=s[i][a[i]];
        last[a[i]]=i;
        for(int j=0;j<26;j++){
            x-=c[j]*(ll)(i-last[j]);
        }
    }
    return x;
}

int main()
{
    auto start=chrono::high_resolution_clock::now();
    ll x=LLONG_MIN,sc=0;
    int d,ans[370];
    scanf("%d",&d);
    for(int i=0;i<26;i++){
        scanf("%lld",&c[i]);
        sc+=c[i];
    }
    for(int i=0;i<d;i++){
        for(int j=0;j<26;j++){
            scanf("%lld",&s[i][j]);
        }
    }
    if(sc==0){
        for(int i=0;i<d;i++){
            int mx=-1,j=-1;
            for(int k=0;k<26;k++){
                if(s[i][k]>mx) mx=s[i][k],j=k;
            }
            printf("%d\n",j+1);
        }
        return 0;
    }
    while(true){
        for(int i=0;i<d;i++) a[i]=rng()%26;
        ll y=f(d);
        if(y>x) copy(a,a+d,ans),x=y;
        auto stop=chrono::high_resolution_clock::now();
        int duration=chrono::duration_cast<chrono::microseconds>(stop-start).count();
        if(2000000-duration<100000) break;
    }
    for(int i=0;i<d;i++){
        assert(ans[i]>=0 && ans[i]<26);
        printf("%d\n",ans[i]+1);
    }
    return 0;
}

Measured memory_bytes: 3924
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define forn(i,n)for(ll i=0;i<(n);i++)
#define forn_rev(i,n)for(ll i=(n)-1;i>=0;i--)
#define for1n(i,n) for(ll i=1;i<=(n);i++)
#define ARRAY_SIZE(a) sizeof(a)/sizeof(*a)
#define MOD 1000000007
#define MAXN 100005
#define PI 3.1415926535897932384626433
#define gcd(a,b) __gcd(a,b)

using namespace std;

ll power(ll x,ll y,ll p)
{
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0)
    {
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}



int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    
    ll T=1;
    //cin>>T;
    while(T--)
    {
        ll a,b;
        cin>>a>>b;
        cout<<a*b;



    }


    return 0;
}

Measured memory_bytes: 3616
fn eighty_one() -> Result<&'static str, &'static str> {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input)
        .map_err(|_| "input error")?;
    let n = input.trim_right().parse::<i32>()
        .map_err(|_| "parse error")?;

    for i in 1..10 {
        if n % i == 0 && n / i <= 9 {
            return Ok("Yes");
        }
    }
    Ok("No")
}

fn main() {
    println!("{}", eighty_one().unwrap());
}

Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 01:14:08 2020

@author: shinba
"""

a,b,c,d = map(int,input().split())

if a+b > c+d:
    print("Left")
elif a+b < c+d:
    print("Right")
else:
    print("Balanced")


Measured memory_bytes: 9052
#include <stdio.h>		// standard input output
#include <iostream>		// input output stream, cin cout( console in console out)
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>		// input output manipulation

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i,N){
    cin >> A.at(i);
  }
  
  rep(i, N-K){
    if(A.at(i) < A.at(K+i)){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4016
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

static size_t A[100000];

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	int32_t x[4], y[4];

	scanf("%"PRId32" %"PRId32" %"PRId32"%"PRId32, &x[0], &y[0], &x[1], &y[1]);

	x[2] = x[1] - (y[1] - y[0]);
	y[2] = y[1] + (x[1] - x[0]);
	x[3] = x[2] - (y[2] - y[1]);
	y[3] = y[2] + (x[2] - x[1]);
	printf("%"PRId32" %"PRId32" %"PRId32" %"PRId32"\n", x[2], y[2], x[3], y[3]);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
// vector v において、x の前方と後方の index を求める
template<class T> int former(const vector<T> &v, T x) {
	return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}//前方のindex(自分自身を含んでよい場合)
template<class T> int latter(const vector<T> &v, T x) {
	return lower_bound(v.begin(), v.end(), x) - v.begin();
}//後方のindex(自分自身を含んで良い場合)

int main() {
	int A, B, Q;
	cin >> A >> B >> Q;
	vector<ll>s(A);
	vector<ll>t(B);
	for (int i = 0; i < A; ++i)cin >> s[i];
	for (int i = 0; i < B; ++i)cin >> t[i];
	s.push_back(1e15); s.push_back(-1e15);
	t.push_back(1e15); t.push_back(-1e15);
	sort(s.begin(), s.end());
	sort(t.begin(), t.end());
	for (int i = 0; i < Q; ++i) {
		ll x;
		cin >> x;
		ll res = 1e17;
		for (int j = 0; j < 2; ++j) {
			//最初にs
			ll first = (j ? s[(lower_bound(s.begin(), s.end(), x) - s.begin())]:s[lower_bound(s.begin(),s.end(),x)-s.begin()-1]);
			for (int k = 0; k < 2; ++k) {
				ll second = (k ? t[lower_bound(t.begin(), t.end(), x) - t.begin()] : t[lower_bound(t.begin(), t.end(), x) - t.begin() - 1]);
				chmin(res, abs(x - first) + abs(first - second));
			}
		}
		for (int j = 0; j < 2; ++j) {
			//最初にt
			ll first = (j ? t[(lower_bound(t.begin(), t.end(), x) - t.begin())] : t[lower_bound(t.begin(), t.end(), x) - t.begin() - 1]);
			for (int k = 0; k < 2; ++k) {
				ll second = (k ? s[lower_bound(s.begin(), s.end(), x) - s.begin()] : s[lower_bound(s.begin(), s.end(), x) - s.begin() - 1]);
				chmin(res, abs(x - first) + abs(first - second));
			}
		}
		cout << res << endl;
	}

	return 0;
}


Measured memory_bytes: 2912
#include <stdio.h>
int main(){
	int a,b,c,x,y;
	y=0;     
	scanf("%d%d%d",&a,&b,&c);
	for(x=a;x<=b;x++){
		if(c%x==0)
		y++;    
	}    
	printf("%d\n",y);
	return 0;
} 

Measured memory_bytes: 596
import java.util.Scanner;

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

		int[] xList = new int[5];

		for(int i=0;i<5;i++) {
			int x = n.nextInt();
			xList[i] = x;
		}

		for(int i=0;i<5;i++) {
			if(xList[i] == 0) {
				System.out.println(i+1);
				break;
			}
		}
	}
}


Measured memory_bytes: 35580