akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  string s;
  cin>>n>>s;
  vector<int> r;
  vector<int> g;
  vector<int> b;
  rep(i,0,n){
    if(s[i]=='R'){
      r.push_back(i);
    }
    else if(s[i]=='G'){
      g.push_back(i);
    }
    else{
      b.push_back(i);
    }
  }
  ll ans=0;
  rep(i,0,n-1){
    rep(j,i+1,n){
      if(s[i]!=s[j]){
        if(s[i]!='R' && s[j]!='R'){
          ans+=r.size()-(lower_bound(r.begin(),r.end(),j)-r.begin());
          if(2*j-i<n && s[2*j-i]=='R') ans--;
        }
        else if(s[i]!='G' && s[j]!='G'){
          ans+=g.size()-(lower_bound(g.begin(),g.end(),j)-g.begin());
          if(2*j-i<n && s[2*j-i]=='G') ans--;
        }
        else{
          ans+=b.size()-(lower_bound(b.begin(),b.end(),j)-b.begin());
          if(2*j-i<n && s[2*j-i]=='B') ans--;
        }
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

int main(void){
int N,A; 
int test = 0;
scanf("%d%d",&N,&A);

test = N % 500 ;
test = test - A;
if (test <= 0) {
  printf("Yes");
} else {
  printf("No");
}
     
}

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

int dp[100000];

int main(){
int N,h[100000];
cin >>N;
for(int i=0;i<N;i++){
cin>>h[i];
}
dp[0]=0;
dp[1]=abs(h[1]-h[0]);
for(int i=2;i<N;i++){
dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
}
cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 1024
//My life was going great until I stumble upon this question ); ):

#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

long long MOD = 1000000007; //1e9+7
long long INF = 1e18;
typedef long long ll;
typedef long double ld;
#define pii		pair<int, int>
#define pll		pair<long long, long long>
#define fi 		first
#define se 		second
#define fr(i,a,b) 	for(int i=a;i<b;i++)
#define out2(a,b) 	cout<<a<<" "<<b<<"\n";
#define all(v) 		v.begin(), v.end()
#define pb          	emplace_back

void solve()
{string str;
    cin>>str;
    if(str[str.size()-1]=='s'){
        str+="es";
    }
    else{
        str+="s";
    }
    cout<<str;

}

int main() {
	FIO;
	//freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	int test;
	//cin>>test;
	test=1;
	for(int t=1;t<=test;t++){
        //cout<<"Case #"<<t<<": ";
        solve();
        //cout<<ans<<"\n";
	}
	return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
    int X, t;
    
    printf(" ");
    scanf("%d", &X);
    
    printf(" ");
    scanf("%d", &t);
    
    if(1<=X&&X<=1000000000)
    {
        if(1<=t&&t<=1000000000)
        {
            if(t<X)
            {
                printf("%d", X-t);
            }
            else if(X<=t)
            {
                printf("%d", 0);
            }
        }
        else
        {
           printf("error");
        }
    }
    else
    {
        printf("error");
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

void trace(int A[], int N) {
	int i;
	for (i = 0; i < N; i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void insertionSort(int A[], int N) {
	int i, j, v;
	for ( i = 1; i < N; i++) {
		v = A[i];
		j = i - 1;
		while (j >= 0 && A[j] > v) {
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;
		trace(A, N);
	}
}

int main() {
	int N, i, j;
	int A[100];

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

	trace(A, N);
	insertionSort(A, N);

	return 0;
}


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

int n, a[100005];
long long ans = 0;
int main() {
    scanf("%d", &n);
    for (int i = 0; i <= n; ++i) scanf("%d", a + i);
    for (int i = 1; i <= n; ++i) {
        int b;
        scanf("%d", &b);
        ans += min(b, a[i - 1]);
        b -= min(b, a[i - 1]);
        ans += min(b, a[i]);
        a[i] -= min(b, a[i]);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define ini(x, y) memset(x, y, sizeof(x))
#define endl '\n'
#define fastio cin.sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1e9 + 7;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

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

	int n = sz(s);
	for (int i = 0; i < n / 2; ++i) if (s[i] != s[n / 2 - 1 - i]) return cout << "No", 0;
	for (int i = 0; i < n / 2; ++i) if (s[n - 1 - i] != s[n / 2 + 1 + i]) return cout << "No", 0;
	for (int i = 0; i < n; ++i) if (s[n - 1 - i] != s[i]) return cout << "No", 0;

	cout << "Yes";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<numeric>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 993244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

char field[6600];

string calc(vector<int> &tmpas, vector<int> &tmpbs){
    string res;
    if(tmpas.back() < tmpbs.back()){
        int now = -1;
        for(int p = 0;p < tmpas.size();p++){
            if(tmpas[p] < now)continue;
            res += "ab";
            now = tmpbs[p];
        }
    }
    else{
        for(int i = 0;i < tmpas.size();i++){
            string tmp;
            for(int j = i;j < tmpas.size();j++){
                field[tmpas[j]] = 'a';
                field[tmpbs[j]] = 'b';
            }
            for(int j = min(tmpas[i], tmpbs[i]); j <= max(tmpas.back(), tmpbs.back());j++){
                if(field[j])tmp.push_back(field[j]);
                field[j] = 0;
            }
            res = max(res, tmp);
        }        
    }
    return res;
}

int main(){
    int n;
    string str;
    vector<string> strs;
    vector<int> as, bs, tmpas, tmpbs;
    cin >> n;
    cin >> str;
    for(int i = 0;i < 2*n;i++){
        if(str[i] == 'a')as.push_back(i);
        else bs.push_back(i);
    }
    for(int i = 0;i < n;i++){
        tmpas.push_back(as[i]);
        tmpbs.push_back(bs[i]);
        if(max(as[i], bs[i]) == i * 2 + 1){
            string tmp = calc(tmpas, tmpbs);
            int pos = 0;
            if(tmp[0] == 'a')pos = strs.size();
            while(pos < strs.size() && strs[pos] >= tmp)pos++;
            if(pos == strs.size())strs.push_back(tmp);
            else{
                strs[pos] = tmp;
                while(strs.size() > pos+1)strs.pop_back();
            }
            tmpas.clear();tmpbs.clear();
        }
    }
    cout << accumulate(strs.begin(), strs.end(), string()) << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <bits/stdc++.h>
#define int long long
using namespace std;
int INF = 1e18;
main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> v(n+2);
    v[0] = 0;
    for (int i=1; i <= n; i++) cin>> v[i];
    v[n+1] = n+1;
    if (a > b){
        for (int i=0;i<n+2;i++) v[i] = n+1-v[i];
        reverse(v.begin(), v.end());
        swap(a, b);
    }
    vector<int> pos(n+2);
    for (int i=0; i < n+2;i++) pos[v[i]] = i;
    int dp[n+2];
    dp[0] = 0;
    for (int i=1; i < n+2; i++){
        dp[i] = INF;
        int value = v[i];
        int more = 0;
        for (int j=value-1; j >= 0; j--){
            if (pos[j] > i){
                more++;
                continue;
            }
            int total = value - j - 1;
            dp[i] = min(dp[i], dp[pos[j]] + more*b + (total-more)*a);
        }
    }
    cout << dp[n+1];
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define fint register int
#define h 5001
#define p 1437984
using namespace std;
int a[p],c[p];
inline void fj(int x);
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int maxxs=0;
	for(fint i=1;i<=n;i++)
	cin>>a[i],maxxs=max(a[i],maxxs);
	int now=a[1];
	for(fint i=2;i<=n;i++)
	now=__gcd(now,a[i]);
	bool s_c=0;
	if(now==1)
	s_c=1;
	for(fint i=1;i<=n;i++)
	fj(a[i]);
	bool p_c=1;
	for(fint i=1;i<=maxxs;i++)
	if(c[i]>1)
	p_c=0;
	if(p_c&&s_c)
	cout<<"pairwise coprime";
	else
	if(s_c&&!p_c)
	cout<<"setwise coprime";
	else
	cout<<"not coprime";
	return 0;
}

inline void fj(int x)
{
	int i=2;
	while(i*i<=x)
	{
		if(x%i==0)
		{
			c[i]++;
			while(x%i==0)
			x/=i;
		}
		i++;
	}
	if(x>1)
	c[x]++;
	return ;
}

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

int n;
pair<int, int> dyx[4] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int cost[500][500], exist[500][500];
void update(int sy, int sx) {
  queue<pair<int, int>> q;
  q.push(make_pair(sy, sx));
  while (!q.empty()) {
    pair<int, int> front = q.front();
    q.pop();
    int y = front.first;
    int x = front.second;
    for (int i=0; i<4; i++) {
      int y2 = y + dyx[i].first;
      int x2 = x + dyx[i].second;
      if (y2 < 0 || y2 >= n || x2 < 0 || x2 >= n) {
        continue;
      }
      if (cost[y][x] + exist[y][x] < cost[y2][x2]) {
        cost[y2][x2] = cost[y][x] + exist[y][x];
        q.push(make_pair(y2, x2));
      }
    }
  }
}
int main() {
  cin>>n;
  int p[n*n];
  for (int i=0; i<n*n; i++) cin>>p[i];
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      cost[i][j] = min(min(i, n-1-i), min(j, n-1-j));
      exist[i][j] = 1;
    }
  }
  long long ans = 0;
  for (int pi: p) {
    --pi;
    int y = pi / n;
    int x = pi % n;
    ans += cost[y][x];
    --exist[y][x];
    update(y, x);
  //   cout<<"---"<<endl;
  //   printf("pi: %d y: %d x: %d\n", pi+1, y, x);
  //   for (int i=0; i<n; i++) {
  //     for (int j=0; j<n; j++) {
  //       printf("%2d ", cost[i][j]);
  //     }
  //     cout<<endl;
  //   }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 6552
n = int(input())
lsn=[(input()) for i in range(n)]
m = int(input())
lsm=[(input()) for i in range(m)]
ls = []
for i in range(n):
  ls.append(lsn.count(lsn[i])-lsm.count(lsn[i]))
if max(ls) <= 0:
  print(0)
else:
  print(max(ls))


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int a[n+1];
  a[0] = 0;
  for (size_t i = 1; i < n+1; i++) cin >> a[i];
  int ans = 1, a1 = 0, btn = a[1];
  while (true) {
    if (btn == 2) break;
    else if (btn == 1) {
      ans = -1;
      break;
    }
    else btn = a[btn];
    ans++;
    if (ans >= n) {
      ans = -1;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;


int main(){
    long long int a,b,k;
    cin>>a>>b>>k;
    
    auto temp=min(a,k);
    a-=temp;
    k-=temp;
    
    temp=min(b,k);
    b-=temp;
    k-=temp;
    
    cout<<a<<" "<<b;
    
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for B - Training Camp
	var N int
	fmt.Scanf("%d", &N)

	var ans int = 1
	for i := 1; i <= N; i++ {
		ans = (i * ans) % (int(math.Pow10(9) + 7))
	}
	fmt.Println(ans)
}


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

using namespace std;

#define ll long long

const int mxN = 1e5 + 3;

int h[mxN] = {0};
int n;
int ans[mxN] = {0};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    ans[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; i++) {
        ans[i] = min(ans[i - 1] + abs(h[i] - h[i - 1]), ans[i - 2] + abs(h[i] - h[i - 2]));
    }
    cout << ans[n - 1] << endl;
}


Measured memory_bytes: 1024
// C++ program to Find Number of digits  
// in base b. 
#include <iostream> 
#include <math.h>  

using namespace std; 

  
// function to print number of 
// digits 

void findNumberOfDigits(long n, int base) 
{ 

    // Calculating log using base 

    // changing property and then 

    // taking it floor and then  

    // adding 1. 

    int dig = (int)(floor( log(n) /  

                         log(base)) + 1);  

      

    // printing output 

 //   cout << "The Number of digits of "

   //      << "Number " << n << " in base "

     //    << base << " is " << dig; 
     cout<<dig<<endl;
} 

  
// Driver method  

int main() 
{ 

    // taking inputs 

    long n; 

    int base; 

      

    // calling the method 
    cin>>n>>base;

    findNumberOfDigits(n, base); 

    return 0; 
} 


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>

using namespace std;

typedef long long li;

const int size = 100;

int main() {
    li a, b;  // a: white ., b: black #
    cin >> a >> b;

    vector<string> ans;
    for (int i = 0; i < size / 2; ++i) {
        ans.push_back(string(size, '#'));
    }
    for (int i = 0; i < size / 2; ++i) {
        ans.push_back(string(size, '.'));
    }

    a--; b--;

    for (int i = 0; i < size / 2 && a > 0; i += 2) {
        for (int j = 0; j < size && a > 0; j += 2) {
            ans[i][j] = '.';
            a--;
        }
    }


    for (int i = 0; i < size / 2 && b > 0; i += 2) {
        for (int j = 0; j < size && b > 0; j += 2) {
            ans[i + size / 2 + 1][j] = '#';
            b--;
        }
    }

    cout << size << " " << size << endl;
    for (int i = 0; i < size; ++i) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M = map(int, readline().split())
    A = [0] * N
    for i in range(N):
        A[i] = readline().strip()
    B = [0] * M
    for i in range(M):
        B[i] = readline().strip()

    for i in range(N - M + 1):
        for j in range(N - M + 1):
            ok = True
            for x in range(M):
                for y in range(M):
                    if A[i + x][j + y] != B[x][y]:
                        ok = False
                        break
                if not ok:
                    break
            if ok:
                print('Yes')
                return

    print('No')
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
#define endl "\n"
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 
// ========================================================
signed main(){
  #ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  #endif
  fio;
    char ch;
    ll div = 0;
    while(cin>>ch){
        div += ch - '0';
    }
    if(div%9 == 0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
  rr;
}



Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define INF 10000000
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int N,M;
    cin>>N>>M;
    vector<vector<int>> work(10e5+10);
    rep(i,N){
        int a,b;
        cin>>a>>b;
        work.at(a).push_back(b);
    }

    ll ans=0;
    priority_queue<int> q;
    for(int day=0; day<=M; day++){
        for(int i:work.at(day)){
            q.push(i);
        }
        if(q.size()!=0){
            ans+=q.top();
            q.pop();
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 26752
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int):
    print(YES if (N//100 == 7 or (N//10)%10 == 7 or N%10 == 7) else NO)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()



Measured memory_bytes: 9184
#include <iostream>
#include <climits>
using namespace std;
int main(){
	double n;
	double maxN = -(1<<30), minN = 1<<30;
	while(cin >> n){
		maxN = max(maxN, n);
		minN = min(minN, n);
	}
	cout << maxN - minN << endl;
	return 0;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n;cin>>n;
    ll l[n+1];
    l[0]=2;l[1]=1;
    for(int i=2;i<n+1;i++){
        l[i]=l[i-2]+l[i-1];
    }
    cout<<l[n]<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main()
{
	long long  n;
	cin>>n;
	long long  arr[n];
	long long  sum =0;
	for(long long  i=0;i<n;i++)
	{
		cin>>arr[i];
		sum += arr[i];
	}
	cout<<sum-n<<endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 1000001;
const int MOD = 1000000007;
   
        signed main() {
           int n,k;
           cin>>n>>k;
           int h[n];
           for(int i=0;i<n;i++)cin>>h[i];
           sort(h,h+n);
            int ans=0;
            for(int i=0;i<n-k;i++)ans+=h[i];
            cout<<ans;
           return 0;

        }


Measured memory_bytes: 1792
#pragma GCC optimize("O3")

#include <bits/stdc++.h>

using namespace std;

#define fst first
#define snd second

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int main(){
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(17);

  int n, k;
  cin >> n >> k;
  if(n % k == 0) cout << "0\n";
  else cout << "1\n";

  return 0;
}



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

#include <math.h>
#include <stdlib.h>


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

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 int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    vector<int> a(3);
    for(int i = 0; i < 3; i++) cin >> a[i];
    sort(a.begin(), a.end());
    cout << a[0]+ a[1] << endl;

    return 0;
}


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


bool is_prime(long long n){
    for(long long i = 2; i*i <= n ; i++){
        if(n%i == 0)return false;
    }
    return n != 1;
}

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

int main(){ 
  ll a, b;
  cin >> a >> b;
  ll g = gcd(a, b);
  ll res = 0;
  for (ll i = 1; i * i <= g; i++) {
    if (g % i == 0) {
      if (is_prime(i)) res++;
      ll tmp = g / i;
      if (tmp != i && is_prime(tmp)) res++;
    }
  }
  cout << res + 1 << endl;
  return 0; 
} 

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

using namespace std;

int main() {

	int mae = 0, usiro = 0;
	string str;

	cin >> str;

	int index = 0;

	while (str[index] != 'A') {
		index++;
	}

	mae = index;
	index = str.length();

	while (str[index - 1] != 'Z') {
		index--;
	}

	usiro = str.length() - index;

	int ans = str.length() - mae - usiro;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#define H 252
int main(){
  int i,n,T[H];
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&T[i]);
  }
  for(i=1;i<=n;i++){
    printf("node %d: key = %d, ",i,T[i]);
    if(i==1){
      printf("left key = %d, right key = %d, \n",T[2*i],T[2*i+1]);
    }
    else if(2*i<n){
      printf("parent key = %d, left key = %d, right key = %d, \n",T[i/2],T[2*i],T[2*i+1]);
    }
    else if(2*i==n){
      printf("parent key = %d, left key = %d, \n",T[i/2],T[2*i]);
    }
    else{
      printf("parent key = %d, \n",T[i/2]);
    }
  }
  return 0;
}



Measured memory_bytes: 2048
import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`).next()

    val atcg = listOf('A', 'T', 'C', 'G')
    var max = 0
    var cur = 0
    s.forEach { c ->
        if (atcg.contains(c)) {
            cur++
        } else {
            cur = 0
        }
        max = Math.max(max, cur)
    }

    println(max)
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int64_t n;
	std::cin >> n;
	if (n & 1 || n <= 2) {
		std::cout << 0 << std::endl;
		return 0;
	}
	int64_t num2 = 0, num5 = 0;
	for (int64_t i = 2; i <= n; i <<= 1)
		num2 += n / i;
	for (int64_t i = 10; i <= n; i *= 5)
		num5 += n / i;
	std::cout << std::min(num2, num5) << std::endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
using namespace std;
int n,m,i,j,s;
int main()
{
	scanf("%d%d",&n,&m);
	fz1(i,n)fz1(j,m)if(j/10>=2&&j%10>=2){
		if((j/10)*(j%10)==i){
			s++;
//			cerr<<i<<' '<<j<<endl;
		}
	}
	cout<<s<<endl;
	return 0;
}

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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	int m;
	int j;
	if(a<b&&b<c)m=c,j=a+b;
	else if(b<a&&a<c)m=c,j=a+b;
	else if(c<a&&a<b)m=b,j=a+c;
	else if(a<c&&c<b)m=b,j=a+c;
	else if(c<b&&b<a)m=a,j=b+c;
	else if(b<c&&c<a)m=a,j=b+c;
	else if(a==b&&b==c)m=c,j=a+b;
	else if(a==b&&b<c)m=c,j=a+b;
	else if(a==c&&c<b)m=b,j=a+c;
	else if(b==c&&c<a)m=a,j=b+c;
	else if(a==b&&b>c)m=b,j=a+c;
	else if(a==c&&c>b)m=c,j=a+b;
	else if(b==c&&c>a)m=c,j=b+a;
	for(int i=0;i<k;i++){
		m*=2;
		}
		cout<<m+j<<endl;
  return 0;
  }


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define maxn 201000

LL myabs(LL x){return (x<0)?-x:x;}
LL mymin(LL x,LL y){return (x<y)?x:y;}
LL a[maxn];
int main()
{
	int n,i;LL m1,m2,m3,a1,a2,a3;
	scanf("%d",&n);
	a1=a2=a3=0;
	for (i=1;i<=n;i++) 
	{
		scanf("%d",&a[i]);
		a[i]-=i;
	}
	sort(a+1,a+1+n);
	m1=a[n/2],m2=a[n/2-1],m3=a[n/2+1];
	for (i=1;i<=n;i++)
	{
		a1+=myabs(a[i]-m1);
		a2+=myabs(a[i]-m2);
		a3+=myabs(a[i]-m3);
	}
	printf("%lld\n",mymin(mymin(a1,a2),a3));
	return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<string> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
        sort(v[i].begin(), v[i].end());
    }
    sort(v.begin(), v.end());
    int i = 0;
    ll ans = 0;
    while(i < n){
        int r = upper_bound(v.begin(), v.end(), v[i])-v.begin();
        ans += (ll)(r-i)*(r-i-1)/2;
        i = r;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7296
package main

import "fmt"

var ans = 0
var ss = []string{"M", "A", "R", "C", "H"}

func main() {
	var n int
	fmt.Scan(&n)
	mp := map[string]int{}
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		v := string(s[0])
		if v == "M" || v == "A" || v == "R" || v == "C" || v == "H" {
			mp[v]++
		}
	}
	f(0, 0, 1, mp)
	fmt.Println(ans)
}

func f(n, d, sum int, mp map[string]int) {
	if n == 3 {
		ans += sum
		return
	}
	for i := d; i < 5; i++ {
		f(n+1, i+1, sum*mp[ss[i]], mp)
	}
}


Measured memory_bytes: 5504
import java.util.Scanner;

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

		//入力
		int [][]bingo = new int[3][3];
		for (int y = 0; y < 3; y++) {
			for (int x = 0; x < 3; x++) {
				bingo[x][y] = Integer.parseInt(sc.next());
			}
		}
		int n = Integer.parseInt(sc.next());
		for (int i = 0; i < n; i++) {
			int b = Integer.parseInt(sc.next());
			for (int y = 0; y < 3; y++) {
				for (int x = 0; x < 3; x++) {
					if (bingo[x][y] == b) bingo[x][y] = opened;
				}
			}
		}

		//条件チェック
		boolean is_bingo = false;
		//縦
		for (int y = 0; y < 3; y++) {
			boolean width = true;
			for (int x = 0; x < 3; x++) {
				if (bingo[x][y] != opened) {
					width = false;
					break;
				}
			}
			if (width) is_bingo = true;
		}
		//横
		for (int x = 0; x < 3; x++) {
			boolean height = true;
			for (int y = 0; y < 3; y++) {
				if (bingo[x][y] != opened) {
					height = false;
					break;
				}
			}
			if (height) is_bingo = true;
		}
		//斜め
		if (bingo[2][0] == opened && bingo[1][1] == opened && bingo[0][2] == opened) {
			is_bingo = true;
		}
		if (bingo[0][0] == opened && bingo[1][1] == opened && bingo[2][2] == opened) {
			is_bingo = true;
		}

		if (is_bingo) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		/*for (int y = 0; y < 3; y++) {
			for (int x = 0; x < 3; x++) {
				System.out.print(bingo[x][y] + " ");
			}
			System.out.println();
		}*/
	}
}

Measured memory_bytes: 35664
def main():
    n = [int(i) for i in input().split()]
    a2, b2, c2 = [i**2 for i in n]
    a, b, c = n
    # print(a,b,c)
    # print(a2,b2,c2)
    ans = 0
    if a2+b2 == c2:
        ans = a * b
    elif b2+c2 == a2:
        ans = b * c
    elif a2+c2 == b2:
        ans == a * c
    print(int(ans/2))

main()


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
  int N;
  cin>>N;
  double ans = 0;
  for(int i = 0;i < N;i++){
    double x;
    cin>>x;
    string n;
    cin>>n;
    //cout<<x<<n<<endl;
    if(n[0] == 'J'){
      ans += x;
    }else{
     ans += x * 380000.0;
    }
    
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 256
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int a;
   cin >> a;
   cout << a+a*a+a*a*a << '\n';
   return 0;
} 

Measured memory_bytes: 3632
package main

import (
    "bufio"
    "fmt"
    "os"
)

var r = bufio.NewReader(os.Stdin)

func main() {
    var a, b int
    fmt.Fscan(r, &a, &b)
    c := a*b
    d :=(a+b)*2
    fmt.Printf("%v %v\n" ,c,d)
}



Measured memory_bytes: 1144
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define mem(a,s) memset(a,s,sizeof(a))
typedef long long LL;
const int N=1e5+10;
int n;
pair<int, int> a[N];
int main(){
    //freopen("in.txt","r",stdin);
    cin>>n;
    rep(i,1,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a + 1, a + n + 1);
    cout << a[1].second;
    rep(i,2,n){
        cout << ' ' << a[i].second;
    }
    return 0;
}

Measured memory_bytes: 1664
# -*- coding: utf-8 -*-
"""
Created on Thu Jan  3 10:20:42 2019

@author: Yamazaki Kenichi
"""

N = int(input())

prime = [2]
for j in range(3,100):
    if all(j % i != 0 for i in prime) :
        prime.append(j)

N1 = 1
for i in range(1,N+1):
    N1 *= i 

prime1 = []
a02,a04,a14,a24,a74 =0,0,0,0,0
for j in prime:
    temp = 0
    while N1 % pow(j,temp) ==0:
        temp += 1
    a02 += 1 if temp > 2 else 0
    a04 += 1 if temp > 4 else 0
    a14 += 1 if temp > 14 else 0
    a24 += 1 if temp > 24 else 0
    a74 += 1 if temp > 74 else 0    
    prime1.append(temp)

ans = a74 +a24*(a02-1) +a14*(a04-1) +a04*(a04-1)//2*(a02-2)



print(ans)


Measured memory_bytes: 3064
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);

#ifdef BUGGY
	bool DEBUG = 1;
#endif
#ifndef BUGGY
	bool DEBUG = 0;
#endif



int main()
{
	int a;
	cin >> a;
	cout << 24 - a + 24;

	return 0;
}
/*
	Powered by Buggy Plugin
*/

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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int n; cin >> n;
    vl dp(n+1);
    dp[0] = 2;
    dp[1] = 1;
    for(int i=2;i<=n;i++){
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[n] << endl;
}


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

char tolower(char ch){
  if( 'A' <= ch && ch <= 'Z' ){
    return ch-'A'+'a';
  }else{
    return ch;
  }
}

int main(){
  int count=0;
  string W;
  cin>>W;
  string str;
  while(1){
    cin>>str;
    if(str=="END_OF_TEXT")break;
    for(int i=0;i<(int)str.size();i++){
      str[i]=tolower(str[i]);
    }
    if(str==W){
      count++;
    }
  }
  cout<<count<<endl;
  return 0;
}


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

int main()
{
    long long int sum=0,n,i; cin >> n;
    for(i=1;i<=n;i++){
        if(i%3==0) continue;
        if(i%5==0) continue;
        if(i%3==0 and i%5==0) continue;
        sum+=i;
    }
    cout << sum;
}


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

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

#define mod 1'000'000'007
typedef long long ll;

template<typename T>
void deb(initializer_list<T> l)
{
	for (auto &e : l)
		cout << e << ' ';
	cout << endl;
}

void solve()
{
	int x, n;
	cin >> x >> n;
	vector<int> f(200, 0);
	while (n--)
	{
		int a;
		cin >> a;
		++f[a];
	}

	int mndiff = 2000, ans;
	for (int i = -1; i <= 200; ++i)
	{
		if (abs(x - i) < mndiff && f[i] == 0)
		{
			mndiff = abs(x - i);
			ans = i;
		}
	}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int t = 1;
	// cin >> t;
	while (t--)
		solve();

	return 0;
}


Measured memory_bytes: 3656
#include<stdio.h>

int main(void){
  int n,k,p;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d %d",&k,&p);
    if(k%p==0) printf("%d\n",p);
    else printf("%d\n",k%p);
  }
  return 0;
}



Measured memory_bytes: 2056
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq

YES = "POSSIBLE"  # type: str
NO = "IMPOSSIBLE"  # type: str

def solve(N: int, K: int, A: "List[int]"):
    if K > max(A):
        print(NO)
        return
    g = A[-1]
    for a in A[:-1]:
        g = fractions.gcd(g, a)
    if K % g == 0:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.4 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()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 18260
// AOJ ITP2_1_B: Deque
// 2018.6.24 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char Q[800005][13];
#define BASE 400002
int top = BASE;
int end = BASE;
char a[30];

int main()
{
	int q;
	
	fgets(a, 30, stdin), q = atoi(a);
	while (q--) {
		fgets(a, 30, stdin);
		if (a[0] == '0') { // pushBack
			if (a[2] == '0') strcpy(Q[--top], a+4);
			else             strcpy(Q[end++], a+4);
		}
		else if (a[0] == '1') printf(Q[top+atoi(a+2)]); // randomAccess
		else { // popBack
			if (a[2] == '0') top++;
			else             --end;
		}
	}
	return 0;
}


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

using namespace std;
using ll = long long;

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

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

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

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数

// デフォルト変数定義
int n,m,a,b,c,d,x,y,z;
string s,t;
//

signed main() {
  RAPID;
  IN2(a,b);
  if(a+b>=10) OUT("error");
  else OUT(a+b);
}

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

int main() {
	int n;
	cin >> n;
	vector<int>d(n);
	for (int i = 0; i < n; i++)cin >> d.at(i);
	if (d.at(0) != 0) {
		cout << 0 << endl;
		return 0;
	}
	sort(d.begin(), d.end());
	vector<int>ds(d.at(n - 1) + 1, 0);
	for (int i = 0; i < n; i++)ds.at(d.at(i))++;
	//0排除
	if (ds.at(0) != 1) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 0; i < ds.size() - 1; i++) {
		if (ds.at(i) == 0 && ds.at(i + 1) != 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	ll ans = 1;
	for (int i = 2; i < ds.size(); i++) {
		ans %= 998244353;
		for (int j = 0; j < ds.at(i); j++) {
			ans *= ds.at(i - 1);
			ans %= 998244353;
		}
		ans %= 998244353;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  string o,e;cin>>o>>e;
  int n=o.size();
  int m=e.size();
  string ans="";
  rep(i,m){
    ans+=o[i];
    ans+=e[i];
  }
  if(n!=m)ans+=o[n-1];
  cout(ans);
  return 0;
}

Measured memory_bytes: 256
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    a, b, c = MII()
    if a%2 != 0 or b%2 != 0 or c%2 != 0:
        print(0)
        return None
    # 無限の場合
    if a == b == c:
        print(-1)
        return None
    cnt = 0
    while a%2==0 and b%2==0 and c%2==0:
        x = b//2 + c//2
        y = a//2 + c//2
        z = a//2 + b//2
        a, b, c = x, y, z
        cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define my_max(a, b) ((a) > (b) ? (a) : (b))
#define my_min(a, b) ((a) < (b) ? (a) : (b))
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i, s, t) for(int i = (int)(s); i <= (int)(t); i++)
#define rev(i, t, s) for(int i = (int)(t); i >= (int)(s); i--)
#define lson rt << 1
#define rson rt << 1 | 1
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double lb;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<int> VI;
typedef std::vector<ll> VL;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> rbtree;
ll gcd(ll x, ll y){ return y % x == 0 ? x : gcd(y % x, x); }
template<class T>T my_abs(T a){ if(a < 0) a = -a; return a; }
inline ll read(){
    ll ret = 0, sign = 1;
    char c = getchar();
    while(c < '0' || c > '9'){ if(c == '-') sign = -1; c = getchar();}
    while(c >= '0' && c <= '9'){ ret = ret * 10 + c - '0'; c = getchar(); }
    return ret * sign;
}
inline void write(ll x){
    if(x < 0){
        putchar('-');
        x = -x;
    }
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

//void expand_stack_space(){
//    int size = 256 << 20; // 256MB
//    char *p = (char*)malloc(size) + size;
//    __asm__("movl %0, %%esp\n" :: "r"(p));
//}
const int maxn = 12 + 7, inf = 0x3f3f3f3f;
int n, m, x;
int a[maxn][maxn], val[maxn], learn[maxn];
int main(){
#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    scanf("%d%d%d", &n, &m, &x);
    for(int i = 0; i < n; ++i) {
        scanf("%d", val + i);
        for(int j = 0; j < m; ++j) {
            scanf("%d", &a[i][j]);
        }
    }
    int ans = inf;
    for(int i = 0; i < (1 << n); ++i) {
        int tans = 0;
        for(int j = 0; j < m; ++j) learn[j] = 0;
        for(int j = 0; j < n; ++j) {
            if((i >> j) & 1) {
                tans += val[j];
                for(int k = 0; k < m; ++k) learn[k] += a[j][k];
            }
        }
        bool flag = true;
        for(int j = 0; j < m; ++j) if(learn[j] < x) flag = false;
        if(flag) ans = min(ans, tans);
    }
    if(ans == inf) ans = -1;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
//long long a[200005];
int main ()
{
    ///without test case
    long long int a,b,c,d,t,n,i,j;
    cin >>n;
    if(n%2==0)
    {
        cout<< n/2<<"\n";
    }
    else
    {
        cout<<(n/2)+1<<"\n";
    }
}



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

using namespace std;

typedef long long ll;
const ll mod = 1000000007;
ll dp[2][100010];

int main() {
  string s;
  cin>>s;
  dp[0][0] = 1;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      dp[1][i + 1] = dp[1][i] * 3 % mod;
      dp[0][i + 1] = dp[0][i];
    } else {
      dp[1][i + 1] = (dp[1][i] * 3 + dp[0][i]) % mod;
      dp[0][i + 1] = 2 * dp[0][i] % mod;
    }
  }
  ll ans = (dp[0][s.size()] + dp[1][s.size()]) % mod;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 2048
#include <ctype.h>
#include <iostream>
#include <string>
using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int a = n / 100;
  int b = n % 100;
  if (a and a <= 12 and b and b <= 12) {
    cout << "AMBIGUOUS" << endl;
  } else if (a and a <= 12) {
    cout << "MMYY" << endl;
  } else if (b and b <= 12) {
    cout << "YYMM" << endl;
  } else {
    cout << "NA" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
# stdin
INPUT_SENTENCES = 1
N = int([input() for i in range(INPUT_SENTENCES)][0])
INPUT_SENTENCES = N
ss = [input() for i in range(INPUT_SENTENCES)]
SP = list(map(lambda x: [x[0], int(x[1])], [[i for i in s.split(" ")] for s in ss]))
spm = {city: map(lambda v: v[1], sorted(list(filter(lambda x: x[0] == city, SP)))) for city in map(lambda v: v[0], SP)}
[[print(SP.index([k,v])+1) for v in sorted(spm[k], reverse=True)] for k in sorted(spm.keys())]

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B,K;
	cin >> A >> B >> K;
	for (int i = A; i <= B; ++i){
		if (i < A+K||i > B-K){
			cout << i << endl;
		}
	}
}

Measured memory_bytes: 256
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    int x;cin>>x;
    if(x>=1800){
        cout<<1<<endl;
        return;
    }
    else if(x>=1600){
        cout<<2<<endl;
        return;
    }
    else if(x>=1400){
        cout<<3<<endl;
        return;
    }
    else if(x>=1200){
        cout<<4<<endl;
        return;
    }
    else if(x>=1000){
        cout<<5<<endl;
        return;
    }
    else if(x>=800){
        cout<<6<<endl;
        return;
    }
    else if(x>=600){
        cout<<7<<endl;
        return;
    }
    else {
        cout<<8<<endl;
        return;
    }
    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 3640
/*
@author: sharrad99
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int k;
	cin >> k;

	string s;
	cin >> s;

	if(k >= (int)s.length()) {
		cout << s << '\n';
	} else {
		string res = s.substr(0, k);
		res += "...";
		cout << res << '\n';
	}
}

Measured memory_bytes: 3628