akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    int n, x; cin >> n >> x;
    vector<int> nums;
    nums.push_back(0);
    for(int i = 1; i <= n; ++i){
        int x; cin >> x;
        nums.push_back(nums[i - 1] + x);
    }
    int ans = 0;
    for(int i = 0; i <= n; ++i){
        if(nums[i] > x) {ans = i; break;}
    }
    if(ans == 0) cout << n + 1 << endl;
    else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
let inp : unit -> string = fun () -> 
  input_line stdin
let () =
  let s = inp () in
  let rec loop s n pred =
    if n = 0 then true
    else
      let a = s.[n - 1] in
      if a = pred then false
      else loop s (n - 1) a
  in
  if loop s 4 'a' then
    print_endline "Good"
  else
    print_endline "Bad"


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

using namespace std;
using ll = long long;

int main() {
  int N, M;
  cin >> N >> M;
  if (M <= N) {
    cout << 0 << endl;
    return 0;
  }
  vector<int> X(M);
  for (int i = 0; i < M; ++i) {
    cin >> X[i];
  }
  sort(X.begin(), X.end());
  vector<int> L(M - 1);
  for (int i = 0; i < M - 1; ++i) {
    L[i] = X[i + 1] - X[i];
  }
  sort(L.begin(), L.end());
  ll ans = 0;
  for (int i = 0; i < M - N; ++i) {
    ans += L[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;
const int N_MAX = pow(10,5);

int main() {
  int N, M; cin >> N >> M;
  ll p[N_MAX] = {}; p[0] = 1;
  rep(i, N_MAX) p[i+1] = ( (i+1) * p[i] ) % MOD;

  ll r_tmp = ( p[N] * p[M] ) % MOD;
  ll result;
  if (N==M) result = (r_tmp * 2) % MOD;
  else if (abs(N-M)==1) result = r_tmp;
  else result = 0;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1024
n=int(input())
a,b=1,1
from math import ceil
# ans=0
for i in range(n):
    x,y=map(int,input().split())
    base= max((b//y if b%y==0 else b//y+1),(a//x if a%x==0 else a//x+1))
    a= base*x ; b=base*y 
    # print(a,b)
print(a+b)


Measured memory_bytes: 9116
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<climits>
#include <sstream>
using namespace std;

int main() {
  int N;
  int cnt=0;
  int tmp=0;
  int f1=0;
  int f2=0;
  string S;
  string s1;
  string s2;
  string s3;
  istringstream ss1;
  istringstream ss2;
  istringstream ss3;
  int p1;
  int p2;
  int p3;

  cin >> S;

  s1 = S.substr(0,4);
  s2 = S.substr(5,2);
  s3 = S.substr(8,2);

  ss1 = istringstream(s1);
  ss2 = istringstream(s2);
  ss3 = istringstream(s3);

  ss1 >> p1;
  ss2 >> p2;
  ss3 >> p3;

  //2019/4
  if(p1 == 2019 && p2 == 4 && p3 <= 30){
    cout << "Heisei" << endl;
  }else if(p1 == 2019 && p2 <=4){
    cout << "Heisei" << endl;
  }else if(p1 < 2019){
    cout << "Heisei" << endl;
  }else{
    cout << "TBD" << endl;
  }

}


Measured memory_bytes: 384
import java.util.Scanner;

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

        String[] s = sc.next().split("/", 3);

        int y = Integer.valueOf(s[0]);
        int m = Integer.valueOf(s[1]);
        int d = Integer.valueOf(s[2]);

        boolean ans = false;
        if (y > 2019)
            ans = true;
        else {
            if (y == 2019) {
                if (m > 4)
                    ans = true;
            }
        }
        System.out.println(ans ? "TBD" : "Heisei");
    }
}


Measured memory_bytes: 22996
import sys
num_bill, y = map(int, input().split())

for num_10000 in range(y // 10000 + 1):
    for num_5000 in range(min((y - num_10000 * 10000) // 5000 + 1, num_bill - num_10000 + 1)):
        num_1000 = num_bill - num_10000 - num_5000
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()

print('-1 -1 -1')

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include <unordered_map>
#include <unordered_set>
using namespace std;

const long long INF = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<int> nums(n);

	for (int i = 0; i < n; i++) cin >> nums[i];

	

	vector<int> dp(n, INF);

	dp[0] = 0;
	dp[1] = abs(nums[1] - nums[0]);

	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i], dp[i - 1] + abs(nums[i] - nums[i - 1]));
		dp[i] = min(dp[i], dp[i - 2] + abs(nums[i] - nums[i - 2]));
	}

	cout << dp[n - 1];
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int x1, y1, x2, y2;
    int x3, y3, x4, y4;
    
    cin >> x1 >> y1 >> x2 >> y2;
    x3 = x2 + y1 - y2;
    y3 = y2 + x2 - x1;
    x4 = x1 + y1 - y2;
    y4 = y1 + x2 - x1;
    
    cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;

    return 0;
    
}


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

int n, k;
const int N = 2e5+10, mod = 998244353 ;
ll a[N][2], dp[N];

void solve(){
    cin >> n >> k;
    for(int i=0;i<k;++i) {
        cin >> a[i][0] >> a[i][1];
    }
    dp[n] = 1;
    for(int i=n;i>=1;--i) {
        for(int j=0;j<k;++j) {
            //this is standard dp
            //for(int x=a[j][0];x<=a[j][1];++x)
                //if(i-x>0)
                    //dp[i-x] += dp[i], dp[i-x]%=mod;
            //observation is : we are incrementing whole range
            //so we can use prefix sums
            int f = a[j][0], s = a[j][1];
            int i0 = i-f, i1 = i-s-1;
            if(i0>0)
                dp[i0] += dp[i]%mod, dp[i0]%=mod;
            if(i1>0)
                dp[i1] -= dp[i]%mod, dp[i1]=(dp[i1]+mod)%mod;
        }
        if(i<n)
            dp[i-1] += dp[i], dp[i-1]%=mod;
    }
    cout << dp[1] << "\n";
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t =1;
    while(t--)
        solve();
    return 0;
}



Measured memory_bytes: 5168
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  string s;
  cin >> s;
  int n = s.size() + 1;
  vector<ll> v(n);
  ll ans = 0;
  char sw[2] = {'<', '>'};
  rep(i,2) {
    char c = sw[i];
    rep(j, n-1) {
      if (s[j] == c && v[j + 1] <= v[j]) {
        v[j + 1] = v[j] +  1;
      }
    }
    reverse(ALL(s));
    reverse(ALL(v));
  }
  rep(i,n) ans += v[i];
  cout << ans << endl;
}

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

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

struct edge{ int to, cap, rev; };

vector<edge> G[202];
bool used[202];

void add_edge(int from, int to, int cap){
  G[from].push_back((edge){to,cap,(int)G[to].size()});
  G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0; i < G[v].size(); i++){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  while(1){
    memset(used,0,sizeof(used));
    int f=dfs(s,t,INF);
    if(f==0)return flow;
    flow+=f;
  }
}


struct ed{
  int s,t,d,c;
};

int n,m,s,t;
int dist[202][202];
vector<ed> es;

int main(){
  cin>>n>>m>>s>>t;
  s--;t--;
  rep(i,n)rep(j,n)dist[i][j]=(i==j?0:INF);
  rep(i,m){
    int a,b,c,d;
    cin>>a>>b>>d>>c;
    a--;b--;
    dist[a][b]=d;
    es.push_back((ed){a,b,d,c});
  }

  rep(k,n)rep(i,n)rep(j,n)minch(dist[i][j],dist[i][k]+dist[k][j]);

  rep(i,m){
    ll u=es[i].s,v=es[i].t;
    if(dist[s][v]!=INF&&dist[s][v]==dist[s][u]+es[i].d){ // use
      add_edge(u,v,es[i].c);
    }
  }

  cout<<max_flow(s,t)<<endl;

  return 0;
}



Measured memory_bytes: 3360
#include<stdio.h>
#include<math.h>
 
int main()
{
        double x1, y1, x2, y2;
        scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
        printf("%f", sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
        return 0;
}



Measured memory_bytes: 2076
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <queue>
#include <ctime>
#include <string>
#include <cstring>
#define mp make_pair
#define pb push_back
#define NAME ""
#define y1 y1_423
#define list lista

using namespace std;

typedef long long ll;
typedef long double ld;

template<typename T>
ostream& operator << (ostream& cout, const vector<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "()");
	}
	cout << "(" << a[0];
	for (int i = 1; i < (int)a.size(); i++) {
		cout << "; " << a[i];
	}
	return (cout << ")");
}

template<typename T>
ostream& operator << (ostream& cout, const set<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T>
ostream& operator << (ostream& cout, const multiset<T> &a) {
	if ((int)a.size() == 0) {
		return (cout << "{}");
	}
	auto it = a.begin();
	cout << "{" << *it;
	++it;
	for (; it != a.end(); ++it) {
		cout << "; " << *it;
	}
	return (cout << "}");
}

template<typename T1, typename T2>
ostream& operator << (ostream& cout, const pair<T1, T2> &a) {
	return cout << "(" << a.first << "; " << a.second << ")";
}

const int nmax = 2000 * 1000;
const int inf = 2000 * 1000 * 1000;
const ll infl = 1000ll * 1000ll * 1000ll * 1000ll * 1000ll * 1000ll;
const int mod = 1000 * 1000 * 1000 + 7;
const ld pi = acos(-1.0);

int main() {
	//freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
	//freopen(NAME".in", "r", stdin);freopen(NAME".out", "w", stdout);
	int n, x, cnt = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		cnt += (x % 2);
	}
	if (cnt % 2 == 0) {
		cout << "YES\n";
	} else {
		cout <<"NO\n";
	}
	return 0;
}



Measured memory_bytes: 256
N=int(input())
D,X=map(int,input().split())

alist=[]
for i in range(N):
  alist.append(int(input()))
#print(alist)

choco=0
for i in range(1,D+1):
  for a in alist:
    if (i-1)%a==0:
      choco+=1
      
print(X+choco)

Measured memory_bytes: 3064
ans = 0; buf = 0; c = 0;
func = {'+':lambda x, y : x+y,
        '-':lambda x, y : x-y,
        '*':lambda x, y : x*y,
        '/':lambda x, y : x//y
        }
while 1:
    if c==0:
        ans = int(raw_input())
    elif c%2==0:
        ans = func[buf](ans, int(raw_input()))
    else:
        buf = raw_input()
        if buf=='=':break
    c+=1
print ans

Measured memory_bytes: 4220
#include<bits/stdc++.h>
template<class T> inline void read(T &x){
	x=0; register char c=getchar(); register bool f=0;
	while(!isdigit(c))f^=c=='-',c=getchar();
	while(isdigit(c))x=x*10+c-'0',c=getchar(); if(f)x=-x;
}
template<class T> inline void print(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)print(x/10); putchar(x%10+'0');
}
template<class T> inline void print(T x,char c){print(x),putchar(c);}
const int N=1e5+10;
long long ans;
std::vector<std::pair<int,int>> G[N];
int n,root,root2,fa[N],siz[N],maxp[N];
void dfs(int u){
	siz[u]=1;
	for(auto it:G[u]){
		int v=it.first,w=it.second;
		if(v!=fa[u]){
			fa[v]=u,dfs(v);
			siz[u]+=siz[v];
			maxp[u]=std::max(maxp[u],siz[v]);
			ans+=2ll*w*std::min(siz[v],n-siz[v]);
		}
	}
	maxp[u]=std::max(maxp[u],n-siz[u]);
	if(maxp[u]<maxp[root])root=u,root2=0;
	else if(maxp[u]==maxp[root])root2=u;
}
int main(){
	read(n);
	for(int u,v,w,i=1;i<n;i++){
		read(u),read(v),read(w);
		G[u].push_back(std::make_pair(v,w));
		G[v].push_back(std::make_pair(u,w));
	}
	maxp[root]=n,dfs(1);
	// for(int i=1;i<=n;i++)printf("%d%c",siz[i]," \n"[i==n]);
	// for(int i=1;i<=n;i++)printf("%d%c",maxp[i]," \n"[i==n]);
	// printf(">> %d %d\n",root,root2);
	if(root2){
		for(auto it:G[root])if(it.first==root2){ans-=it.second;break;}
	}else{
		int min=G[root].begin()->second;
		for(auto it:G[root])min=std::min(min,it.second);
		ans-=min;
	}
	printf("%lld\n",ans);
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  string S;
  cin >> N >> S;
  for (int i = 0; i < (int)S.size(); ++i) {
    char c = S[i];
    cout << (char)(((c - 'A') + N) % 26 + 'A');
  }
  cout << endl;
}


Measured memory_bytes: 892
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string>
using namespace std;


int main(){
    int L,R;

    int l,r;
    scanf("%d %d", &L, &R);
    if((R-L)>=2019){
        printf("0");
        return 0;
    }

    l = L%2019;
    r = R%2019;

    if((l-r)>=0){
        printf("0");
        return 0;
    }
    
    int min = 2018;
    int cal;
    for(int i=l; i<=r-1; i++){
        for(int j=l+1; j<=r; j++){
            cal = (i*j)%2019;
            if (min > cal){
                min = cal;
            }
        }
    }
    printf("%d",min);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int price,disnumber,answer,test_n;
char str[6];
int dislike [9];

int testing (void){//ifに直接突っ込め
    int i,j;
    int use_dis = 0;
    for (i=6;i>=0;i--){
        test_n = str[i]-'0';
        for (j=0;j<disnumber;j++){
            if (test_n == dislike[j]){
                use_dis++;
                break;
            }
        }
    }
    if (use_dis){return 0;}
    else {return 1;}
}

int main (void){
//入力区画
    int a;
    scanf("%d %d",&price ,&disnumber);
    for(a=0;a< disnumber;a++){
        scanf("%d",&dislike[a]);
    }
//処理区画
    answer = price;
    sprintf (str,"%d",answer);
    while(1){
        if(testing()){
            printf("%d\n",answer);
            break;
        }else{
            answer++;
            sprintf (str,"%d",answer);
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define eps 1e-9
using namespace std;

int main()
{
    ll t,n,mi,mx,f,c,a,b,x,m,y,q,k;


    cin>>n;

    ll arr[n+1]={0};

    for(int i=1;i<n;i++)
    {
        cin>>f;
        arr[f]++;
    }

    for(int i=1;i<=n;i++)
    {
        cout<<arr[i]<<endl;
    }
}


Measured memory_bytes: 5184
using System;
using System.Linq;
using System.Collections.Generic;




namespace ConsoleApplication1 {

    

    class ClassMain {



        public static void Main(String[] args) {
           //string line;

            int[] uriage = new int[5];
           for (int i = 0; i < 4; i++) {
               int[] ints = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
               if(ints[0]==1){
                   uriage[1] += 6000 * ints[1];
               }
               if (ints[0] == 2) {
                   uriage[2] += 4000 * ints[1];
               }
               if (ints[0] == 3) {
                   uriage[3] += 3000 * ints[1];
               }
               if (ints[0] == 4) {
                   uriage[4] += 2000 * ints[1];
               }
               Console.WriteLine(uriage[ints[0]]);
           }
           /*while ((line = Console.ReadLine()) != null) {
                int[] ints = line.Split(' ').Select(int.Parse).ToArray();
                int n = ints[0];
                //int n = int.Parse(line);                
                if (n == 0) { break; }
                int m = ints[1];

                Console.WriteLine(n - m);
                int k = 6;
                while (k-- > 0) {
                    ints = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                    n = ints[0];
                    m = ints[1];
                    Console.WriteLine(n - m);
                }
                break;
                
 

            }*/
        }

    }

    


}

Measured memory_bytes: 12040
#include <cstdio>
using namespace std;
int f[100],eda[100],edb[100];
inline void init(){
	for(int i=0;i<100;i++) f[i]=i;
}
int ff(int n){return n==f[n]?n:ff(f[n]);}
inline void mg(int a,int b){f[ff(a)]=ff(b);}
int main(){
	int n,m,cnt,ans=0;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&eda[i],&edb[i]);
	}
	for(int i=0;i<m;i++){
		cnt=n-1;
		init();
		for(int j=0;j<m;j++){
			if(j!=i&&ff(eda[j])!=ff(edb[j])){
				mg(eda[j],edb[j]);
				cnt--;
			}
		}
		if(cnt) ans++;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;


int main() {
    ll x,a,b;
    cin >> x >> a >> b;
    if (a >= b) cout << "delicious" << endl;
    else if ((b-a) <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
      



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N,M;
  cin>>N>>M;
  
  vector<vector<int>> vec(M,vector<int> (2));
  for(int i=0;i<M;i++){
    cin>>vec[i][0]>>vec[i][1];
  }
  
  vector<int> A(M);
  for(int i=0;i<M;i++){
    A[i]=vec[i][0];
  }
  
  vector<int> B(M);
  for(int i=0;i<M;i++){
    B[i]=vec[i][1];
  }
  
  int max_1=-1;
  
  int min_1=10000000;
  
  for(int i=0;i<M;i++){
    max_1=max(max_1,A[i]);
    
    min_1=min(min_1,B[i]);
  }
  
  
  int x=(min_1)-(max_1)+1;
  
  if(x>=0){
    cout<<x<<endl;
  }
  else{
    cout<<0<<endl;
  }
}
  

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main(){
	int n;
	cin >> n;
	ll a[n];
	for(int i=0;i<n;i++) cin >> a[i];
	ll sum = 0;
	for(int i=0;i<n;i++){
		sum ^= a[i];
	}
	for(int i=0;i<n;i++){
		ll ans = sum^a[i];
		cout << ans << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 5148
#include <stdio.h>

int yakusuu(int a, int b)
{
  while(1) {
    if (a > b) {
      a %= b;
      if (a == 0) {
	return b;
        break;
      }
    } else {
      b %= a;
      if (b == 0) {
	return a;
        break;
      }
    }
  }
}

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

  int a[n];
  for (int i = 0; i < n; i++)
    scanf("%d", &a[i]);

  int min = yakusuu(a[0], a[1]);
  for (int i = 2; i < n; i++) 
    min = yakusuu(a[i], min);
    
  printf("%d\n", min);

  return 0;
}
    


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = ((B)-1); I >= (A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll a,b;
	cin >> a >> b;
	char ans[100][100];
	FOR(i,0,100){
		FOR(j,0,100){
			if(i<50)ans[i][j] = '.';
			else ans[i][j] = '#';
		}
	}
	// a w .
	// b b #
	a--;
	b--;
	ll i = 0;
	ll j = 0;
	while(b--){
		ans[i][j] = '#';
		j += 2;
		if(j>=49){
			j = 0;
			i += 2;
		}
	}
	i = 51;
	j = 0;
	while(a--){
		ans[i][j] = '.';
		j += 2;
		if(j>=49){
			j = 0;
			i += 2;
		}
	}
	cout << 100 << " " << 100 << endl;
	FOR(i,0,100){
		FOR(j,0,100){
			cout << ans[i][j];
		}
		cout << endl;
	}

}

Measured memory_bytes: 256
import Control.Arrow
import Control.Monad
import Data.Bits
import Data.Char
import Data.List

main :: IO ()
main = do
  [_, _, x] <- getInts
  as <- getInts
  print . uncurry min . (length *** length) . span (< x) $ as

getInts :: IO [Int]
getInts = map read . words <$> getLine


Measured memory_bytes: 892
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
#from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
a=I()
if n%500<=a:
    print("Yes")
else:
    print("No")

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

int main() {
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k & 1) {
        if (b - a > 1e18) {
            puts("Unfair");
        } else {
            cout << b - a << endl;
        }
    } else {
        if (a - b > 1e18) {
            puts("Unfair");
        } else {
            cout << a - b << endl;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int in_data;
	int h, m, s;

	cin >> in_data;

	h = in_data / 3600;
	in_data %= 3600;
	m = in_data / 60;
	in_data %= 60;
	s = in_data;

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return ('0' <= c && c <= '9')?(c - '0'):-1;}

// TODO: write
int main() {
  int n;cin>>n;
  vector<ll> b(n+1,INFL);rep(i,n-1)cin>>b[i+1];
  
  ll ans = 0;
  rep(i,n){
    ans += min(b[i],b[i+1]);
  }

  print(ans);
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

void input(int *N, int *M, int *s, int *c);
	void get2Num(int *, int*);
int iCalc(int *N, int *M, int *s, int *c);
	int iPow(int a, int b);

int main() {
	int N, M, s[5], c[5];
	input(&N, &M, &s[0], &c[0]);

	int ans = iCalc(&N, &M, &s[0], &c[0]);
	
	printf("%d\n", ans);
	
	return 0;
}

void input(int *N, int *M, int *s, int *c) {
	get2Num(N, M);
	for (int i = 0; i < *M; i++)
		get2Num(&s[i], &c[i]);
	return;
}

void get2Num(int *a, int *b) {
	scanf("%d %d", a, b);
	return;
}

int iCalc(int *N, int *M, int *s, int *c) {
	if (*M == 0) {
		switch (*N) {
		case 1:
			return 0;
		case 2:
			return 10;
		case 3:
			return 100;
		}
	}

	bool bAlready[*N + 1];
	for (int i = 0; i < *N; i++)
		bAlready[i + 1] = false; 
	int iRet = 0, digit, iVal[*N + 1];
	
	for (int i = 0; i < *M; i++) {
		if (s[i] == 1 && c[i] == 0 && *N != 1)
			return -1;

		if (!bAlready[s[i]]) {
			digit = *N - s[i];
			iRet +=  iPow(10, digit) * c[i];
			bAlready[s[i]] = true;
			iVal[s[i]] = c[i];
		} else if (iVal[s[i]] != c[i])
			return -1;
	}
	if (!bAlready[1])
		iRet += iPow(10, *N - 1);

	return iRet;
}

int iPow(int a, int b) {
	int iRet = 1;
	for (int i = 0; i < b; i++)
		iRet *= a;
	if (b == 0)
		iRet = 1;
	return iRet;
} 


Measured memory_bytes: 128
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  map<string,ll> mp;
  rep(i,n){
    string tmp;
    cin>>tmp;
    mp[tmp]++;
  }
  ll k;
  cin>>k;
  rep(i,k){
    string tmp;
    cin>>tmp;
    mp[tmp]--;
  }
  ll ans=0;
  for(auto c:mp){
    chmax(ans,c.second);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
use io::*;

fn main() {
    let input = read_string();
    let mut sc = Scanner::new(&input);
    let n: usize = sc.next();
    let k: usize = sc.next();
    if n % k == 0 {
        println!("0");

    } else {
        println!("1");
    }
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }

        pub fn next_mat<T: FromStr>(&mut self, w: usize, h: usize) -> Vec<Vec<T>> {
            (0..h).map(|_| self.next_vec(w)).collect()
        }

        pub fn next_vec_char(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }

        pub fn next_mat_char(&mut self, n: usize) -> Vec<Vec<char>> {
            (0..n).map(|_| self.next_vec_char()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
#define LEN 100005

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

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

void enqueue(P);

P dequeue();

int main() {
  int elaps = 0;
  int c,i,q;
  P u;

  scanf("%d%d",&n,&q);
  head = 1;
  tail = n + 1;

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

  while(head != tail) {
    u = dequeue();
    if(q > u.t) {
      c = u.t;
    }else{
      c = q;
    }

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

  return 0;
}

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

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



Measured memory_bytes: 11900
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();

        BigInteger[] a = new BigInteger[n];
        for (int i = 0; i < n; i++) {

            a[i] = BigInteger.valueOf(Long.valueOf(sc.next()));
            if(a[i] == BigInteger.ZERO) {
                System.out.println("0");
                return;
            }
        }

        BigInteger total = BigInteger.ONE;
        BigInteger limit = BigInteger.valueOf(1000000000000000000L);

        for (BigInteger i : a) {
            total = total.multiply(i);
            if(total.compareTo(limit) > 0) {
                System.out.println("-1");
                return;
            }
        }
        System.out.println(total);
    }
}

Measured memory_bytes: 56804
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define vpii vector<pii>
#define gr vector<vpii>
#define str string
#define mask vector<bool>
#define vs vector<str>
#define pq priority_queue
#define ordered_set_of(T) tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
#define fi first
#define se second
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define nub(x) x.resize(unique(all(x)) - x.begin())
#define TWO class T1, class T2
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define MOD 998244353LL
#define MAXN (int)2E5
#define GAME_OVER return 0
using namespace std;
using namespace __gnu_pbds;
char _$ = ' ';
struct sep {sep(char c) {_$ = c;}};
ostream& operator<<(ostream& o, sep s) {return o;}
template<TWO> ostream& operator<<(ostream& o, pair<T1, T2> x) {return o << x.fi << ' ' << x.se;}
template<TWO> istream& operator>>(istream& i, pair<T1, T2>& x) {return i >> x.fi >> x.se;}
template<class T> ostream& operator<<(ostream& o, vector<T> x) {for (auto it : x) o << it << _$; return o;}
template<class T> istream& operator>>(istream& i, vector<T>& x) {for (auto& it : x) i >> it; return i;}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    n %= 10;
    if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9)
        cout << "hon" << endl;
    else if (n == 0 || n == 1 || n == 6 || n == 8)
        cout << "pon" << endl;
    else
        cout << "bon" << endl;
    GAME_OVER;
}

Measured memory_bytes: 3640
/*
  Amazing Mazes
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1166&lang=jp
*/

#include <iostream>
#include <queue>

using namespace std;

int main(void){
  while(1){
    int isPassed[30][30]; // ??¢?´¢?????????????????????????????? 0????????¢?´¢???1?????¢?´¢???
    int vwalls[30][30];   // ?????????????£??????????
    int hwalls[30][30];   // ?¨???????????£??????????
    int height = 0;
    int width = 0;
    int min[30][30];
    queue< pair<int,int> > q;

    int x = 0;
    int y = 0;
    bool noans = false;
    int ans = 1;

    cin >> width;
    cin >> height;

    if(height == 0 && width == 0) return 0;

    for(int i = 0 ; i < 30 ; i++){
      for(int j = 0 ; j < 30 ; j++){
        isPassed[i][j] = 0;
        vwalls[i][j] = 0;
        hwalls[i][j] = 0;
      }
    }

    for(int j = 0 ; j < width - 1 ; j++){
      cin >> vwalls[0][j];
    }

    for(int i = 1 ; i < height ; i++){
      for(int j = 0 ; j < width ; j++){
        cin  >> hwalls[i-1][j];
      }

      for(int j = 0 ; j < width - 1 ; j++){
        cin >> vwalls[i][j];
      }
    }

    isPassed[0][0] = 1;
    min[0][0] = 0;
    x = 0; y = 0;
    ans = 1;

    while(!(y == width - 1 && x == height - 1) && noans == false){

      // ???????§????
      if(y < width - 1 && vwalls[x][y] == 0 && isPassed[x][y+1] == 0){
        q.push(make_pair(x, y+1));
        isPassed[x][y+1] = 1;
        min[x][y+1] = min[x][y] + 1;
      }

      // ???????§????
      if(y > 0 && vwalls[x][y-1] == 0 && isPassed[x][y-1] == 0){
        q.push(make_pair(x, y-1));
        isPassed[x][y-1] = 1;
        min[x][y-1] = min[x][y] + 1;
      }

      // ???????§????
      if(x > 0 && hwalls[x-1][y] == 0 && isPassed[x-1][y] == 0){
        q.push(make_pair(x-1, y));
        isPassed[x-1][y] = 1;
        min[x-1][y] = min[x][y] + 1;
      }

      // ???????§????
      if(x < height - 1 && hwalls[x][y] == 0 && isPassed[x+1][y] == 0){
        q.push(make_pair(x+1, y));
        isPassed[x+1][y] = 1;
        min[x+1][y] = min[x][y] + 1;
      }

      if(q.empty() == true){
        noans = true;
      }else{
        pair<int,int> tmppair;
        x = q.front().first;
        y = q.front().second;
        q.pop();
      }

    }

    if(noans == false){
      cout << min[height-1][width-1] + 1 << endl;
    }else{
      cout << 0 << endl;
    }
  }
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
void normalize(vector<P> &num)
{
    if(num.size() > 1)
    {
        if(num.back().first == num[num.size()-2].first)
        {
            num[num.size()-2].second += num.back().second;
            num.pop_back();
        }
    }
}
void inc(vector<P> &num)
{
    if(num.back().second == 1)
    {
        num.back().first++;
    }
    else
    {
        num.back().second--;
        num.push_back(P(num.back().first+1, 1));
    }
    normalize(num);
}

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll low = 0;
    ll high = n + 1;
    while(high - low > 1)
    {
        ll mid = (low + high) >> 1;
        bool ok = true;
        vector<P> num;
        num.push_back(P(0, a[0]));
        for(int i = 1; i < n; i++)
        {
            if(a[i] > a[i-1])
            {
                num.push_back(P(0, a[i]-a[i-1]));
            }
            else
            {
                ll sum = 0;
                while(sum + num.back().second <= a[i-1]-a[i])
                {
                    sum += num.back().second;
                    num.pop_back();
                }
                num.back().second -= a[i-1] - a[i] - sum;
                if(num.back().first == mid - 1)
                {
                    if(num.size() == 1)
                    {
                        ok = false;
                        break;
                    }
                    else
                    {
                        ll tmp = num.back().second;
                        num.pop_back();
                        inc(num);
                        num.push_back(P(0, tmp));
                    }
                }
                else
                {
                    inc(num);
                }
            }
            normalize(num);
        }
        if(ok) high = mid;
        else low = mid;
    }
    cout << high << endl;
}


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

int main(){
	int a,b,c,x;
	string out="NO";
	cin >> a >> b >> c;
	map<int,bool> mp;
	auto i=1;
	while(1){
		x=(a*i)%b;
		if(x==c) {
			out="YES";
			break;
		}
		if(mp[x]) break;
		mp[x]=true;
		i++;
	}
	cout << out << endl;
}

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

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	bool sabori[30];
	fill(sabori, sabori + 30, true);
	for (int i = 0; i < 28; ++i)
	{
		int t;
		scanf("%d", &t);
		sabori[t-1] = false;
	}
	for (int i = 0; i < 30; ++i)
		if (sabori[i])
			printf("%d\n", i+1);
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
typedef long long lint;
typedef vector<lint> LIV;
#define rep(i,n) for(int i=0;i<n;++i)
#define MAXN 100010
#define MAXM 1100000
#define all(v) v.begin(),v.end()
#define inf 2147483647
#define linf 1152921504606846976

lint digs(lint a){//各桁の和
	lint re=0;
	while(a)re+=a%10,a/=10;
	return re;
}

int main(){
	lint n;cin>>n;
	cout<<(n%10?digs(n):10);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){

    string O,E,ans="";

    cin>>O>>E;

    for(int i=0;i<E.length();i++){
        ans+=O[i];
        ans+=E[i];
    }

    if(O.length()!=E.length())ans+=O[O.length()-1];

    cout<<ans<<endl;

    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n+1);
  rep(i, n) cin >> a[i+1];

  int r = k+1;
  int l = 1;
  while(r <= n) {
    if(a[l] < a[r]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    r++;
    l++;
  }
  return 0;
}


Measured memory_bytes: 4020
#include <stdio.h>
#include <algorithm>
using namespace std;

struct intv{
	long long l, r, d;
	bool operator <(const intv &t) const{
		return d > t.d;
	}
} I[5050];

long long d[2555][2555][2];

void mn(long long &a, long long b)
{
	if (a > b)
		a = b;
}

int main()
{
	int N; scanf ("%d", &N);
	for (int i = 0; i < N; i++){
		scanf ("%lld %lld", &I[i].l, &I[i].r);
		I[i].d = I[i].l + I[i].r;
	}
	sort(I, I + N);

	int s = N / 2;
	for (int i = 0; i <= s; i++) for (int j = 0; j <= s; j++) d[i][j][0] = d[i][j][1] = 1e18;
	d[0][0][0] = 0;

	for (int i = 0; i <= s; i++) for (int j = 0; j <= s; j++) for (int k = 0; k <= 1; k++) if (i + j + k < N){
		auto &t = I[i + j + k];
		if (i < s) mn(d[i + 1][j][k], d[i][j][k] + t.r + i * t.d);
		if (j < s) mn(d[i][j + 1][k], d[i][j][k] + t.l + j * t.d);
		if (k < 1) mn(d[i][j][k + 1], d[i][j][k] + s * t.d);
	}

	printf ("%lld\n", d[s][s][N%2]);

	return 0;
}

Measured memory_bytes: 100608
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  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^(int b) {mint res = 1;while(b > 0) {if(b&1) {res = (res*(*this));}*this=(*this)*(*this);b>>=1;} return res;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};

void dfs(vv(mint) &dp,vvi &G,int v,int p) {
  mint w = 1;
  mint b = 1;
  rep(i,sz(G[v])) {
    int s = G[v][i];
    if(s==p) continue;
    dfs(dp,G,s,v);
    w *= dp[0][s] + dp[1][s];
    b *= dp[0][s];
  }
  dp[0][v] = w;
  dp[1][v] = b;
}
  
int main() {
  int N;
  cin >> N;
  vvi G(N);
  rep(i,N-1) {
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  vv(mint) dp(2,v(mint)(N,0));
  dfs(dp,G,0,-1);
  mint ans = dp[0][0] + dp[1][0];
  cout << ans.x << endl;
  return 0;
}

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

int main() {
    long long n,m,i,a,b;
    cin>>n>>m;
    cin>>a>>b;
    m--;
    int min=a,max=b;
    while(m--){
        cin>>a>>b;
        if(a>min)min=a;
        if(b<max)max=b;
    }
    if(max>=min){
    cout<<max-min+1;}
    else cout<<"0";
	// your code goes here
	return 0;
}


Measured memory_bytes: 256
#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)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;
// const int INF = 1e9;

int N;
string S;
vector<int> a,b;

int main()
{
  cin >> N >> S;
  a.resize(N+1);
  b.resize(N+1);
  // a[i+1]: i個目までの#の個数
  a[0] = 0;
  REP(i,0,N) {
    if(S[i] == '#') a[i+1] = a[i] + 1;
    else a[i+1] = a[i];
  }

  // b[i]: i個目以降の.の数
  b[N] = 0;
  RREP(i,N,0) {
    if(S[i] == '.') b[i] = b[i+1] + 1;
    else b[i] = b[i+1];
  }

  // 色を変更する必要のある石の個数の最小値
  int ans = b[0]; //すべて#に
  REP(i,0,N) {
    //i番目まで.で，i+1番目以降を#にする
    chmin(ans, a[i+1] + b[i+1]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2180
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N, K, C;
	cin >> N >> K >> C;
	string S;
	cin >> S;

	int dp1[200010][2];
	int dp2[200010][2];
	dp1[0][0] = -1e9;
	dp1[0][1] = 0;
	rep1(i, N) {
		if (dp1[i - 1][0] + C < i && S[i - 1] == 'o') {
			dp1[i][0] = i;
			dp1[i][1] = dp1[i - 1][1] + 1;
		}
		else {
			dp1[i][0] = dp1[i - 1][0];
			dp1[i][1] = dp1[i - 1][1];
		}
	}
	dp2[N + 1][0] = 1e9;
	dp2[N + 1][1] = 0;
	for (int i = N; i > 0; i--) {
		if (dp2[i + 1][0] - C > i && S[i - 1] == 'o') {
			dp2[i][0] = i;
			dp2[i][1] = dp2[i + 1][1] + 1;
		}
		else {
			dp2[i][0] = dp2[i + 1][0];
			dp2[i][1] = dp2[i + 1][1];
		}
	}

	rep1(i, N) {
		if (S[i - 1] == 'o') {
			int mae = dp1[i - 1][0];
			int ato = dp2[i + 1][0];
			int kazu = dp1[i - 1][1] + dp2[i + 1][1] - (mae + C >= ato);
			if (kazu < K) co(i);
		}
	}


	Would you please return 0;
}

Measured memory_bytes: 5012
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math
import re

sys.setrecursionlimit(1000000)

n, m = map(int, raw_input().split())
a = map(int, raw_input().split())

a_pre = a[0]
d1 = [0] * (m + 2)
d0 = [0] * (m + 2)
ans = 0
for i in range(1, n):
    a_cur = a[i]
    ans += (a_cur - a_pre) % m
    if a_pre < a_cur:
        d1[a_pre + 1] += 1
        d1[a_cur + 1] -= 1
        d0[a_pre + 1] -= a_pre + 1
        d0[a_cur + 1] += a_pre + 1
    else:
        d1[a_pre + 1] += 1
        d0[a_pre + 1] -= a_pre + 1
        d1[1] += 1
        d1[a_cur + 1] -= 1
        d0[1] += m - a_pre - 1
        d0[a_cur + 1] -= m - a_pre - 1
    a_pre = a[i]

for i in range(1, m + 1):
    d1[i] += d1[i - 1]
    d0[i] += d0[i - 1]

dec = [d1[i] * i + d0[i] for i in range(m + 1)]
print ans - max(dec)

Measured memory_bytes: 19168
#include <iostream>
using namespace std;;
int main()
{
	int a,b,c,i,j(0);
	cin>>a>>b>>c;
    for(i=a;i<=b;i++){
        if(c%i==0){
            j=j+1;
        }
    }cout<<j<<endl;
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string res = "";
    for (int i = 0; i < n; ++i) {
        res += s[i];
        res += t[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 3588