akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
import math

def solve(H: int, A: int):
    print(math.ceil(H / A))
    return 0


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    solve(H, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define vpii vector<pii>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()

const ll Mod = 998244353;

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

    string s;cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])
        cout<<"Yes\n";
    else
        cout<<"No\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int n, m ;
ll ans ;
vector<pair<int,int> > v;
vector<int> a;
int main()
{
    IO
    cin>>n>>m;
    for(int i=1; i<=n; i++)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    while(m--)
    {
        int b, c;
        cin>>b>>c;
        v.push_back({c,b});
    }
    sort(v.begin(),v.end());
    sort(a.rbegin(),a.rend());
    while(!v.empty())
    {
        int rem=v.back().second, c=v.back().first;
        v.pop_back();
        while(rem-- && !a.empty())
        {
            ans+=max(a.back(),c);
            a.pop_back();
        }
    }
    while(!a.empty())
    {
        ans+=a.back();
        a.pop_back();
    }
    cout<<ans;

}


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

int main(int argc, const char * argv[]) {
    int K, S;
    int count = 0;
    
    cin >> K >> S;
    
    for (int x = 0; x <= K; x++) {
        for (int y = 0; y <= K; y++) {
            int z = S - x - y;
            if (z <= K && z >= 0) {
                if (x + y + z == S) {
                    count++;
                }
            }
        }
    }
    
    cout << count << endl;
    
    return 0;
}

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

int main(){
  int N,A,sum=0;
  cin >> N;
  A=N;
  for(int i=0;i<10;i++){
  sum+=A % 10;
  A/=10;
  }
   if(N%sum==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}
    

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int H,W;
    int i,j;
    while(1){
        scanf("%d %d",&H,&W);
        if((H==0)&&(W==0))
            break;
        for(j=0;j<W;j++)
            printf("#");
        printf("\n");
        for(i=1;i<H-1;i++){
            printf("#");
            for(j=1;j<W-1;j++)
                printf(".");
            printf("#");
            printf("\n");
        }
        for(j=0;j<W;j++)
                printf("#");
        printf("\n");
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 572
number, baseTime = gets.chomp.split(" ").map(&:to_i)
bestCost = "TLE"
number.times do
  cost, t = gets.chomp.split(" ").map(&:to_i)
  bestCost = cost if(t <= baseTime &&(bestCost == "TLE" || bestCost > cost))
end
puts bestCost

Measured memory_bytes: 1788
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<vector>
#include<list>
#include<queue>
#include<map>
using namespace std;

list< pair<int, int> > edge;
list<int> edge_list[55];
int flag[55];
int edge_mat[55][55];

int main(){
	int i, j, n, m, a, b;

	scanf("%d%d", &n, &m);
	memset(edge_mat, 0, sizeof(int)*50*50);
	for (i = 0; i < m; i++) {
		scanf("%d%d", &a, &b);
		a--;b--;
		edge.push_back(make_pair(a, b));
		edge_list[a].push_back(b);
		edge_list[b].push_back(a);
		edge_mat[a][b] = 1;
		edge_mat[b][a] = 1;
	}
	/*for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) printf("%d", edge_mat[i][j]);
		printf("\n");
	}*/
	
	int ans = 0;
	list< pair<int, int> >::iterator it;
	for (it = edge.begin(); it != edge.end(); it++) {
		int x = (*it).first;
		int y = (*it).second;
		//printf("-----------%d %d\n", x, y);
		edge_mat[x][y] = 0;
		edge_mat[y][x] = 0;

		memset(flag, 0, sizeof(int)*n);
		queue<int> q;
		
		q.push(0);
		flag[0] = 1;
		int cnt = 1;
		while (q.size() != 0) {
			int index = q.front();
			q.pop();

			//printf("now::%d\n", index);
			
			list<int>::iterator it;
			for (it = edge_list[index].begin(); it != edge_list[index].end(); it++) {
				int nxt_index = (*it);
				
				if (edge_mat[index][nxt_index] == 0) continue;
				
				if (flag[nxt_index] == 0) {
					flag[nxt_index] = 1;
					q.push(nxt_index);
					cnt++;
				}
			}
		}
		if (cnt != n) {
			ans++;
			//printf("bridge!!\n");
		}

		edge_mat[x][y] = 1;
		edge_mat[y][x] = 1;
	}

	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

int partition(int arr[], int begin_i, int end_i)
{
  int x = arr[end_i];
  int i = begin_i;

  for (int j = begin_i; j < end_i; ++j)
  {
    if (arr[j] <= x)
    {
      std::swap(arr[i], arr[j]);
      ++i;
    }
  }

  std::swap(arr[i], arr[end_i]);

  return i;
}

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

  int seq[100000];
  for (int i = 0; i < n; ++i)
  {
    std::cin >> seq[i];
  }

  int criterion = partition(seq, 0, n - 1);

  for (int i = 0; i < n; ++i)
  {
    if (i < criterion)
    {
      std::cout << seq[i] << ' ';
    }
    else if (i > criterion)
    {
      std::cout << ' ' << seq[i];
    }
    else
    {
      std::cout << '[' << seq[i] << ']';
    }
  }
  std::cout << std::endl;

  return 0;
}



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

typedef long long int   ll;
#define int             ll
#define PI              3.1415926535897932384626433832795

#define pb              push_back
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]

#define hell            freopen("input.txt","r", stdin);freopen("output.txt", "w", stdout);freopen("error.txt", "w",stderr);
#define fastasF_boi()   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
//#define cerr            if(false)cerr

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mulmod(int a,int b){return ((a%mod)*(b%mod))%mod;}
int addmod(int a,int b){return (((a%mod)+(b%mod))+mod)%mod;}

void solve();

signed main(){
//    hell;

    fastasF_boi();
    int t=1;
//    cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
}

void solve(){
    int n,k;cin>>n>>k;
    int ar[n];
    inputar0(ar);
    for(int i=0;i+k<n;i++){
        if(ar[i]>=ar[i+k]) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 5232
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static int n;
	public static int m;
	public static long k;
	public static long[] a;
	public static long[] b;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		n = parseInt(sc.next());
		m = parseInt(sc.next());
		k = parseLong(sc.next());
		a = new long[n];
		for (i = 0; i < n; i++) {
			a[i] = parseLong(sc.next());
		}
		b = new long[m];
		for (i = 0; i < m; i++) {
			b[i] = parseLong(sc.next());
		}
		sc.close();
//		out.println(Arrays.toString(a));
		long ans=0;
		long cnt=0;
		long tot=0;
		i=0;
		j=0;
		while(tot<=k&&i<n) {
			tot+=a[i];
			i++;
			cnt++;
		}
		if(tot>k) {
			cnt--;
			i--;
			tot-=a[i];
		}
		ans=cnt;
		j=0;
		for ( i--;  ; i--) {
			while(tot<=k&&j<m) {
				tot+=b[j];
				j++;
				cnt++;
			}
			if(tot>k) {
				cnt--;
				j--;
				tot-=b[j];
			}
			ans=Math.max(ans, cnt);
			if(i<0) break;
			cnt--;
			tot-=a[i];
		}
		out.println(ans);
			
//			if(a[i]<b[j]) {
//				tot+=a[i];
//				i++;
//			} else if(a[i]>b[j]){
//				tot+=b[j];
//				j++;
//			} else {
//				tot+=a[i];
//				i++;
//				if(tot<=k) {
//					tot+=b[j];
//					j++;
//					ans++;
//				}
//			}
//			ans++;
//		}
//		if(tot<=k) {
//			if(i>=n) {
//				while(tot<=k&&j<m) {
//					tot+=b[j];
//					j++;
//					ans++;
//				}
//			} else if(j>=m) {
//				while(tot<=k&&i<n) {
//					tot+=a[i];
//					i++;
//					ans++;
//				}
//			}
//		}
//		if(tot>k) {
//			ans--;
//		}
//		out.println(ans);
//		out.println(b2(0, 0, 0, 0));
//	}
//	public static int b2(long tot, int i, int j, int cnt) {
////		out.printf("%d,%d,%d,%d%n", tot, i , j , cnt);
//		if(tot>k) return cnt-1;
//		if(i==n&&j==m) return cnt;
//		int aa=0;
//		int bb=0;
//		if(i<n) {
//			aa = b2(tot+a[i], i+1, j, cnt+1);
//		}
//		if(j<m) {
//			bb = b2(tot+b[j], i, j + 1, cnt+1);
//		}
////		out.println(aa);
////		out.println(bb);
//		return Math.max(aa, bb);
	}
}


Measured memory_bytes: 53400
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N, K;
  cin>>N>>K;
  ll A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  ll l=0,r=mod,m;
  int tmp;
  while(l<r) {
    m = (l+r)/2;
    if(m==0) {
      l = 1;
      break;
    }
    tmp = 0;
    for(int i=0;i<N;++i) {
      if(A[i]<=m) continue;
      if(A[i]%m==0) {
        tmp += A[i]/m-1;
      }
      else {
        tmp += A[i]/m;
      }
    }
    if(tmp<=K) r = m;
    else l = m+1;
  }
  cout<<l<<endl;
}



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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll H, W;
    cin >> H >> W;
    string S[H];
    REP(i, H) cin >> S[i];
    bool isOk[H][W];
    vector<ll> hA[W], wA[H];
    REP(i, H)
    {
        REP(j, W)
        {
            if (S[i][j] == '#')
            {
                isOk[i][j] = false;
                hA[j].push_back(i);
                wA[i].push_back(j);
            }
            else
            {
                isOk[i][j] = true;
            }
        }
    }

    ll ans = 0;
    REP(i, H)
    {
        REP(j, W)
        {
            if (isOk[i][j])
            {
                ll countH, countW;
                auto iterH = upper_bound(ALL(hA[j]), i);
                auto iterW = upper_bound(ALL(wA[i]), j);
                if (iterH == hA[j].end())
                {
                    if (hA[j].size() >= 1) countH = H - hA[j][hA[j].size() - 1] - 1;
                    else countH = H;
                }
                else
                {
                    int index = distance(hA[j].begin(), iterH);
                    if (index == 0) countH = hA[j][index];
                    else countH = hA[j][index] - hA[j][index - 1] - 1;
                }
                if (iterW == wA[i].end())
                {
                    if (wA[i].size() >= 1) countW = W - wA[i][wA[i].size() - 1] - 1;
                    else countW = W;
                }
                else
                {
                    int index = distance(wA[i].begin(), iterW);
                    if (index == 0) countW = wA[i][index];
                    else countW = wA[i][index] - wA[i][index - 1] - 1;
                }
                ans = max(ans, countH + countW - 1);
            }
        }
    }

    cout << ans << endl;
}


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

int main() {
    int h, w;
    cin >> h >> w;
    char g[h][w];
    rep(y, h) rep(x, w) cin >> g[y][x];

    rep(y, h) {
        rep(x, w) {
            if (g[y][x] == '#') {
                cout << '#';
                continue;
            }

            int cnt = 0;
            for (int i = -1; i <= 1; i++) {
                int dy = y + i;
                if (dy < 0 || dy >= h) continue;
                for (int j = -1; j <= 1; j++) {
                    int dx = x + j;
                    if (dx < 0 || dx >= w) continue;
                    if (g[dy][dx] == '#') cnt++;
                }
            }
            cout << cnt;
        }
        cout << endl;
    }

    return 0;
}


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

int main(){
    int a, b, k;
    cin >> a >> b >> k;
    
    set<int> n;
    
    for(int i=a; i<=b; i++){
        if(i<a+k) n.insert(i);
        else if(i>b-k) n.insert(i);
    }
    
    for(set<int>::iterator it = n.begin(); it != n.end(); it++){
        cout << *it << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n,k,q; cin>>n>>k>>q;
    vector <int> a(n, k-q); 
    rep(i,q){
        int tmp;
        cin>>tmp;
        tmp--;
        a[tmp] += 1;
    }
    rep(i,n){
        if(a[i]<=0) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
const int MAX = 100000;
int n, U[MAX];
void init()
{
	for (int i = 0; i < n; i++)
		U[i] = i;
}
int getAncestor(int v)
{
	if (U[v] == v)
		return v;
	else
	{
		U[v] = getAncestor(U[v]);
		return U[v];
	}
}
void merge(int s, int t)
{
	int a1 = getAncestor(s);
	int a2 = getAncestor(t);
	if (a1 != a2)
		U[a2] = a1;
}
int main()
{
	int m;
	cin >> n >> m;
	init();
	for (int i = 0; i < m; i++)
	{
		int s, t;
		cin >> s >> t;
		merge(s, t);
	}
	int q;
	cin >> q;
	for (int i = 0; i < q; i++)
	{
		int s, t;
		cin >> s >> t;
		cout << ((getAncestor(s) == getAncestor(t)) ? "yes" : "no") << endl;
	}
}


Measured memory_bytes: 3440
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e10;
const ll MAX_N = 1010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	if (n > k * 2) {

	}
	return fac[n] / (fac[k] * fac[n - k]);
}

ll dp[201010][2];
ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
char c[10][10];
bool flag[10][10];
bool flag2[10][10];

//long longしか使わない
//素数は1より大きい
int main() {
	ll n;
	cin >> n;
	string s;
	cin >> s;
	ll res = 0;
	ll ans = 0;
	rep(i, n) {
		if (s[i] == '#')res++;
		else {
			if (res) {
				res--;
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

typedef struct Maze{
    int h;
    int w;
    int t;
} MAZE;

int main(){
    int H,W;
    cin >> H >> W;
    vector<vector<char>> A(H,vector<char>(W,'0'));
    vector<vector<int>> TURN(H,vector<int>(W, -1));
    queue<MAZE> que;
    rep(i,H){
        rep(j,W){
            cin >> A[i][j];
            if(A[i][j] == '#'){
                que.push(MAZE{i,j,0});
            }
        }
    }
    while(!que.empty()){
        int h = que.front().h;
        int w = que.front().w;
        int t = que.front().t;
        que.pop();
        if(!(0 <= h && h < H))continue;
        if(!(0 <= w && w < W))continue;
        if(TURN[h][w] != -1)continue;
        TURN[h][w] = t;
        que.push(MAZE{h-1,w,t+1});
        que.push(MAZE{h+1,w,t+1});
        que.push(MAZE{h,w-1,t+1});
        que.push(MAZE{h,w+1,t+1});
    }
    int M=0;
    rep(i,H){
        rep(j,W){
            M = max(M, TURN[i][j]);
        }
    }
    cout << M << endl;
}



Measured memory_bytes: 54856
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(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()
//#pragma GCC optimize ("-O3")
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;
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; }
//------------------------------------------------------------------------------
template<typename T, int N, T F(const T& a, const T& b)>
struct SegTree
{
public:
    SegTree()
    {
        dat = vector<T>(N * 2 - 1, 0);
    }

    void update(int i, T x)
    {
        i += N - 1;
        dat[i] = x;
        while (i > 0)
        {
            i = (i - 1) / 2;
            dat[i] = F(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    T query(int a, int b, int k = 0, int l = 0, int r = N)
    {
        if (r <= a || b <= l) return 0;
        if (a <= l && r <= b) return dat[k];
        else
        {
            T vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
            return F(vl, vr);
        }
    }

    vector<T> dat;
};

/*------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
------------------------------------------------------------------------------*/











//------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------
void _main()
{
    int N;
    string s;
    cin >> N >> s;
    int r = 0;
    for (char c : s)
    {
        if (c == 'R') ++r;
    }

    cout << ((r > s.size() - r) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] lines = line.split(" ");

		int A = Integer.parseInt(lines[0]);
		int B = Integer.parseInt(lines[1]);

		if( (A+B) % 2 == 0) {
			System.out.println((A+B) / 2 );
		}
		else {
			System.out.println("IMPOSSIBLE");
		}
	}

}

Measured memory_bytes: 21844
n = int(input())
ws = [int(i) for i in input().split() ] 
ans = sum(ws)-ws[0]
for t in range(1,n):
    s1 = sum(ws[:t])
    s2 = sum(ws) - s1
    ans = min(ans,abs(s1 - s2))

print(ans)

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

struct Info {
	vector<int> score;
	Info() : score(vector<int>(3, 0)) {};
};

/// 
/// indexにおける価値総和最大値を返す
int act(int index/*node sequence index*/, vector<Info> &info, vector<vector<int> > &dp) {
	if (index == 0) {
		for (int j = 0; j < 3; ++j) {
			dp[0][j] = info[0].score[j];
		}
	}
	else {
		for (int j = 0; j < 3; ++j) {
			dp[index][j] = INT32_MIN;
			for (int k = 0; k < 3; ++k) {
				if (j == k) continue;
				dp[index][j] = max(dp[index][j], info[index].score[j] + dp[index - 1][k]);
			}
		}
	}
	return max(dp[index][0], max(dp[index][1], dp[index][2]));
}

int main()
{
	int N;
	cin >> N;
	Info temp_info;
	vector<Info> info(N);
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> info[i].score[j];
		}
	}
	vector<int> temp_value(3, 0);
	vector<vector<int> > dp(N, temp_value);
	/* Frogと違う。dp[i]をi番目を選択したときの最大のスコアと定義したとして、dp[i+1]はdp[i]の関数ではない。
	0番目で3通り、i>0番目で2通りの選択肢があるため、選択の場合の数は3*2*...*2 = 3*2^(N-1)通り。
	dp[i][x]: iはノードの番号, xはノードiでの選択肢a,b,cのいずれか。状態・時点毎の最大価値を求めればよい。
	*/
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		ans = act(i, info, dp);
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 11136
import sys


input = sys.stdin.readline


def main():
    N, Q = map(int, input().split())
    lst_ab = [tuple(map(int, input().split())) for i in range(N - 1)]
    lst_px = [tuple(map(int, input().split())) for i in range(Q)]

    tree = [[] for _ in range(N)]
    for a, b in lst_ab:
        a -= 1
        b -= 1
        tree[a].append(b)
        tree[b].append(a)

    lst_score = [0] * N
    for p, x in lst_px:
        p -= 1
        lst_score[p] += x

    lst_ans = [0] * N
    lst_ans[0] = lst_score[0]
    lst_visited = [0] * N
    stack = [0]
    while stack:
        v = stack.pop()
        lst_visited[v] = 1
        for to in tree[v]:
            if lst_visited[to]:
                continue
            stack.append(to)
            lst_ans[to] = lst_ans[v] + lst_score[to]
    
    print(*lst_ans)


if __name__ == "__main__":
    main()

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

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

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

  vector<int> d(n);
  rep(i,n) cin >> d.at(i);

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

  int center = n/2;
  cout << d.at(center)-d.at(center-1);
}

Measured memory_bytes: 3788
#include <vector>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
    int i, N;
    scanf("%d", &N);
    vector<int> A(N);

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

    int minv = A[0];
    int maxv = A[0];

    for(i=1; i<N; i++) {
        if (minv > A[i])
            minv = A[i];
        if (maxv < A[i])
            maxv = A[i];
    }

    printf("%d\n", maxv-minv);
    return 0;
}


Measured memory_bytes: 256
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=int(input())
dp=[-1]*2010

for i in range(3):
    dp[i]=0
for i in range(3,6):
    dp[i]=1

def solve(n):
    # print(n)
    if dp[n]!=-1:
        return dp[n]
    cnt=1
    for i in range(3,n-2):
        cnt+=solve(i)
        cnt%=mod
    # print(n,cnt)
    dp[n]=cnt%mod
    return dp[n]

print(solve(s))
# print(dp[:10])

Measured memory_bytes: 68864
//Mahir Ratanpara (DA-IICT)
#include<bits/stdc++.h>
using namespace std;
#define Ff(i,a,n) for(i=a;i<n;i++)
#define Fr(i,a,n) for(i=a;i>n;i--)
#define ll long long
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pa;
typedef vector<ll>		vc;
typedef vector<pa>		vp;
typedef vector<vc>		vvc;
int mpow(int base, int exp); 
void ipgraph(ll n,ll m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vc g[N];

int main() {
    FAST;
    ll t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin>>n;
    ll ans=0,cnt=0;
    // set<ll> s;
    ll lol=n;
    for(i=2;i*i<=lol;i++)
    {
      ll e=0,z=0;
        while(n%i==0){
            ++e;
            if(e>z){
                ++cnt;
                z=e;
                e=0;
            }
            n/=i;
        }
    }
    if(n!=1)
    cnt++;
    cout<<cnt;
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(ll n, ll m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

Measured memory_bytes: 10660
N = gets.to_i
S = gets.chomp

east = Array.new(N+1,0)
west = Array.new(N+1,0)

for i in 1..N do
  if S[i-1] == "E"
    east[i] = east[i-1] + 1
    west[i] = west[i-1]
  else
    east[i] = east[i-1]
    west[i] = west[i-1] + 1
  end
end

min = 10**6
for i in 1..N do
  tmp = west[i-1] + (east[N] - east[i])
  min = tmp if tmp < min
end

puts min


Measured memory_bytes: 7180
#include <stdio.h>

//最大公約数を求める
int gcd(int x, int y);
//最小値を返す
int min(int a, int b);

int main(void)
{
	int x;	//整数
	int y;	//整数

	//2つの整数を入力する
	scanf("%d%d", &x, &y);

	//結果を出力する
	printf("%d\n", gcd(x, y));

	return 0;
}

//最大公約数を求める
int gcd(int x, int y)
{
	int g = 0;	//最大公約数
	int n = 0;
	int i = 0;

	if (x == y)
	{
		g = x;
	}
	else
	{
		for (i = 1; i < min(x, y) / 2; i++)
		{
			if ((x % i == 0) && (y % i == 0))
			{
				if (g < i)
				{
					g = i;
				}
				else
				{
					//何もしない
				}
			}
			else
			{
				//何もしない
			}
		}
	}

	//結果を返す
	return g;
}

//最小値を返す
int min(int a, int b)
{
	return (a >= b) ? b : a;
}


Measured memory_bytes: 2148
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string ans = "No";
  for(int i=1;i<=9;i++){
    for (int j=1;j<=9;j++){
      if (N==i*j) ans="Yes";
    }
  }
  cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void print(const vector<vector<int>>&xs,int N){
  for(int i=0;i<N;++i){
    for(int j=0;j<N;++j){
      cout<<xs[i][j]<<", ";
    }
    cout<<endl;
  }
  cout<<endl;
}
main(){
  int N,M;
  cin>>N>>M;
  constexpr int INF=numeric_limits<int>::max();
  // adjacency matrix.
  vector<vector<int>>es(N,vector<int>(N, 0x3f3f3f3f));
  vector<pair<int,int>>es_list;
  for(int i=1;i<=M;++i){
    int a,b,c;
    cin>>a>>b>>c;
    --a;
    --b;
    es[a][b]=c;
    es[b][a]=c;
    es_list.push_back(make_pair(a,b));
  }
  // print(es,N);
  // Floyd–Warshall algorithm
  auto ds=es;  // distances.
  for(int i=0;i<N;++i)ds[i][i]=0;
  for(int k=0;k<N;++k){
    for(int i=0;i<N;++i){
      for(int j=0;j<N;++j){
        // printf("%d>%d+%d\n",ds[i][j],ds[i][k],ds[k][j]);
        if(ds[i][j]>ds[i][k]+ds[k][j]){
          ds[i][j]=ds[i][k]+ds[k][j];
        }
      }
    }
  }
  // print(ds,N);
  int ans=0;
  for(const auto&edge:es_list){
    int i=edge.first;
    int j=edge.second;
    bool used=false;
    for(int s=0;s<N;++s){
      if(ds[s][i]+es[i][j]==ds[s][j])used=true;
    }
    if(!used)++ans;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int N = Integer.parseInt(in.next());
            int M = Integer.parseInt(in.next());

            // 出力
            if (N == M) {
                out.println("Yes");

            } else {
                out.println("No");
            }

        }

    }
}



Measured memory_bytes: 23508
n=gets.to_i
sum=0.0
n.times do|i|
money=gets.chomp.split(" ")
case money[1]
	when "JPY" then
		sum+=money[0].to_f
	when "BTC" then
		sum+=(money[0].to_f*380000.0)
	end 
end
print(sum)

Measured memory_bytes: 1788
from collections import deque
n,q = map(int,input().split())
lst = [[]for i in range(n)]
ans = [0 for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    lst[a-1].append(b)
    lst[b-1].append(a)
for i in range(q):
    p,x = map(int,input().split())
    ans[p-1] += x
q = deque([1])
while q:
    x = q.popleft()
    for i in lst[x-1]:
        q.append(i)
        lst[i-1].remove(x)
        ans[i-1] += ans[x-1]
print(" ".join(map(str,ans)))


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define repo(i,o,n) for(int i=o;i<(int)(n);i++)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int n,m,a,sum,tmp,cnt,ans;
priority_queue<int> que;

main() {
    cin >> n >> m;
    rep(i,n) cin >> a,sum+=a,que.push(sum%m);
    if (!que.top()) ans++;
    tmp = que.top();
    cnt++;
    que.pop();
    rep(i,n-1) {
        if (!que.top()) ans++;
        if (tmp == que.top()) {
            cnt++;
            que.pop();
        } else {
            ans += cnt*(cnt-1)/2;
            tmp = que.top();
            cnt=1;
            que.pop();
        }
    }
    ans += cnt*(cnt-1)/2;
    cout << ans << endl;
}

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

public class Main {

    private static FastReader in = new FastReader(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int k = in.nextInt();
        int[] h = in.nextIntArray(n);

        Arrays.sort(h);
        long ans = 0;
        for (int i = 0; i < n - k; i++) {
            ans += h[i];
        }
        out.println(ans);
    }

    // https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream inputStream) {
            br = new BufferedReader(new
                    InputStreamReader(inputStream));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        // https://qiita.com/masakinpo/items/5f77f2a879578a85a0bb
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 56636
s = input()
l = len(s)


def dfs(i, f):
    if i == l - 1:
        return sum(list(map(int, f.split('+'))))

    return dfs(i + 1,  f + s[i + 1]) + dfs(i + 1, f + '+' + s[i + 1])


print(dfs(0, s[0]))


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
using namespace std;

struct UnionFind {
    vector<int> par;

    UnionFind(int N) : par(N) {
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int> friends(n, 0);
    vector<int> suggests(n, 0);
    vector<vector<int>> blocks(n, vector<int>{});

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        friends[a]++;
        friends[b]++;
        uf.unite(a, b);
    }
    map<int, int> par;
    for (int i = 0; i < n; i++) {
        int p = uf.root(i);
        if (par.count(p) == 0) {
            par[p] = 1;
        } else {
            par[p]++;
        }
    }
    for (int i = 0; i < n; i++) {
        suggests[i] = par[uf.root(i)] - friends[i] - 1;
    }
    for (int i = 0; i < k; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (uf.same(a, b)) {
            suggests[a]--;
            suggests[b]--;
        }
    }
    for (int i = 0; i < n; i++) {
        cout << suggests[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 11364
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}

int n;
// vector<int> d;
priority_queue<ll> q;
void input(){
    cin>>n;
    // d.resize(n);
    rep(i,n){
        ll qq;
        cin>>qq;
        q.push(qq);
    }
}
void src(){
    rep(i,n/2-1){
        q.pop();
    }
    ll a=q.top();q.pop();
    ll b=q.top();
    cout<<a-b;
    return;
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    int a,b,c,d;
    while(scanf("%d%d%d%d",&a,&b,&c,&d)==4)
    {
        int s=0;
        int min1=max(a,c);
        int max1=min(b,d);
        s=max(0,max1-min1);
        printf("%d\n",s);
    }
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def li(i):
        if i == 0:
            return [0,1]
        if i < 9:
            return [i-1,i,i+1]
        else:
            return [8,9]

    f = [(i,i) for i in range(1,10)]
    s = 10
    while len(f) < 10**5:
        nf = [(i*10+k,k) for (i,j) in f[-s:] for k in li(j)]
        f += nf
        s = len(nf)
    k = I()
    print(f[k-1][0])
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 53340
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		ArrayList<Integer> inputs = new ArrayList<Integer>();
		for(int n =0; n<a; n++) {
			int ele = scanner.nextInt();
			inputs.add(ele);
		}
		
		List<Integer> answers = new ArrayList<Integer>();
		for(int xi =1; xi<=100 ; xi++) {
			answers.add(min(xi,inputs));
		}
		
		List<Integer> sorted = answers.stream().sorted((o1,o2)->o1.intValue()-o2.intValue()).collect(Collectors.toList());
		System.out.println(sorted.get(0));
	}
	
	public static int min(int in,ArrayList<Integer> inputs) {
		int ans = 0;
		for(Integer ins: inputs) {
			ans += (ins-in)*(ins-in);
		}
		return ans;
	}
	
}

Measured memory_bytes: 29396
#include <algorithm>
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  int x = 0;
  {
    int n = in();
    rep(i,n)x|=bit(in());
  }
  vector<int> ans;
  for(int i=x;i;(--i)&=x){
    ans.emplace_back(i);
  }
  ans.emplace_back(0);
  reverse(all(ans));
  foreach(i,ans){
    cout << i << ":";
    rep(j,n){
      if(bit(j)&i){
        cout << " " << j;
      }
    }
    cout << endl;
  }
}



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

int euklides(int a, int b) {
    while (a % b!= 0) {
        int tmp = b;
        b = a % b;
        a = tmp;
    }
    return b;
}

int main()
{
    int a, b;
    while (std::scanf("%d %d", &a, &b) != EOF) {
        (a > b) ? std::cout << euklides(a, b) << std::endl : std::cout << euklides(b, a) << std::endl;
    }
    return 0;
}



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

int main(){
    ll N,K;
    string S;
    char x;
    cin >> N >> S;
    K=S.size();
    for(ll i=0;i<K;i++){
        x=S[i];
        x=x+N;
        if(isupper(x)){
            S[i] = x;
        }else{
            S[i] = x-26;
        }
    }
    
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a,b,sum,counter,i;
  while(scanf("%d %d",&a,&b)!=-1){
    sum = a + b;
    for(i=0;sum!=0;i++)
      sum = sum / 10;
    printf("%d\n",i);
  }
  return 0;
}

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

 int main(){
    string S;
    long i;
    long size;

    cin >> S;
    size = S.size();

    for (i=0; i<size; i++)
        if(S[i]=='?')
          S[i] = 'D';

    cout << S << endl;

    return 0;
 }




Measured memory_bytes: 3756
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    long long A, V, B, W, T; cin >> A >> V >> B >> W >> T;

    long long len = abs(B - A);
    long long speed = V - W;

    if (speed * T >= len) cout << "YES" << endl;
    else cout << "NO" << endl;

}


int main() {
    solve();
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, n+1)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define rwhole(x) (x).rbegin(), (x).rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define P pair<int, int>
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


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 {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=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 {
        mint res(*this);
        return res/=a;
    }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint p(int n, int k) {
        return fact[n]*ifact[n-k];
    }
};



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    combination comb(h+w+5);

    mint ans = 0;
    rep(i, h) {
        if (h-i<=a) continue;
        mint res;
        res = comb(i+b-1, i);
        res *= comb((h-1-i)+(w-1-b), h-1-i);
        ans += res;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6260
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=1e9+7;
const llint big=1e15+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
int main(void){
	string str;cin>>str;str.pub('T');
	int i,x,y,ima=-1,ss=0;cin>>x>>y;
	vector<int>xate;
	vector<int>yoko;
	for(auto c:str){
		if(c=='F'&&ima==-1){x--;}
		else if(c=='F'){ss++;}
		else if(ima==-1){ss=0;ima=0;}
		else if(ima==0){yoko.pub(ss);ss=0;ima=1;}
		else{xate.pub(ss);ss=0;ima=0;}
	}
	vector<bool>dp(8001);dp[0]=true;
	for(auto it:xate){
		vector<bool>ddp(8001);
		for(i=0;i<=8000;i++){
			if(!dp[i]){continue;}
			ddp[i+it]=true;
			ddp[abs(i-it)]=true;
		}
		swap(dp,ddp);
	}
	if(!dp[abs(x)]){cout<<"No"<<endl;RE;}
	
	vector<bool>dP(8001);dP[0]=true;
	for(auto it:yoko){
		vector<bool>ddp(8001);
		for(i=0;i<=8000;i++){
			if(!dP[i]){continue;}
			ddp[i+it]=true;
			ddp[abs(i-it)]=true;
		}
		swap(dP,ddp);
	}
	if(!dP[abs(y)]){cout<<"No"<<endl;RE;}
	cout<<"Yes"<<endl;
	RE;
}

Measured memory_bytes: 384
S = input()

s_sort = sorted(list(S))

new_character = "?"

if len(S) < 26:
  for  s in range(97,123,1):
    if S.count(chr(s))==0:
      new_character = chr(s)
      print(S + new_character)
      break
else:
  if S == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    for x in range(25,0,-1):
      if ord(S[x-1]) < ord(S[x]):
        letters = sorted([ord(n) for n in list(S[x:])])
        letter = chr([l for l in letters if l >= ord(S[x-1])][0])
        ans = S[:x-1] + letter
        print(ans)
        break
      


Measured memory_bytes: 3064