akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
  int key;
  struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

Node * treeMinimum(Node *x) {
  while(x->left != NIL)
    x = x->left;
  return x;
}

Node * find(Node *u, int k) {
  while(u != NIL && k != u->key) {
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node * treeSuccessor(Node *x) {
  if(x->right != NIL) return treeMinimum(x->right);
  Node *y = x->parent;
  while(y != NIL && x == y->right) {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y; 
  Node *x; 

  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  if(y->left != NIL) {
    x = y->left;
  } else {
    x = y->right;
  }

  if(x != NIL) {
    x->parent = y->parent;
  }

  if(y->parent == NIL) {
    root = x;
  } else {
    if(y == y->parent->left) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }

  if(y != z) {
    z->key = y->key;
  }
}

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key   = k;
  z->left  = NIL;
  z->right = NIL;
  
  while(x != NIL) {
    y = x;
    if(z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if(y == NIL) {
    root = z;
  } else {
    if( z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
  
int main(void) {
  int n, i, x;
  char com[16];
  scanf("%d",&n);
  
  for(i=0;i<n;i++) {
    scanf("%s",com);
    if(!strcmp(com,"find")) {
      scanf("%d",&x);
      Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    } else if(!strcmp(com,"insert")) {
      scanf("%d",&x);
      insert(x);
    } else if(!strcmp(com,"print")) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if(!strcmp(com,"delete")) {
      scanf("%d",&x);
      treeDelete(find(root,x));
    }
  }

  return 0;
}


Measured memory_bytes: 20500
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(void){
	int all=0;
  	int a[5]={0},b=0,c=10;
    for(int i=0;i<5;i++){
    	cin>>a[i];
	if(a[i]%10!=0){all+=10;}
      	b=a[i]/10;
	all+=b*10;
	if(a[i]-b*10<c&&a[i]%10!=0){c=min(c,a[i]-b*10);}
    }
  	cout<<all-(10-c)<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int debt = 100000, n, i, t;

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    debt = debt * 105 / 100;
    t = debt % 1000;
    if (t != 0)
      debt += (1000 - t);
  }

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

  return 0;
}

Measured memory_bytes: 592
/* Simplicity and Goodness */
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
using namespace std;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//             tree_order_statistics_node_update> indexed_set;

void my_dbg() { cout << endl; }
template<typename Arg, typename... Args> void my_dbg(Arg A, Args... B) 
{ cout << ' ' << A; my_dbg(B...); }
#define dbg(...)  cout << "(" << #__VA_ARGS__ << "):", my_dbg(__VA_ARGS__)

#define scn(n) scanf("%d", &n)
#define lscn(n) scanf("%lld", &n)
#define pri(n) printf("%d ", (int)(n))
#define prin(n) printf("%d\n", (int)(n))
#define lpri(n) printf("%lld ", n)
#define lprin(n) printf("%lld\n", n)
#define rep(i,a,b) for(int i=(int)(a); i<(int)(b); i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;

const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 1e9+7;
const int N = 2e5+2;
    

void solve()
{   
    int n, k;
    scn(n); scn(k);

    ll c1 = 0, c2 = 0;

    for(int i=1; i<=n; i++) {
        if(i % k == 0)
            c1 ++;
        else if(k % 2 == 0 and i % (k / 2) == 0)
            c2 ++;
    }

    lprin(c1 * c1 * c1 + c2 * c2 * c2);
}

int main()
{
    int t = 1;
    // scn(t);

    while(t --) {
        solve();
    }
    return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vector<double> p(n);

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

  vector<vector<double>> dp(n+1, vector<double>(6001, -1));
  dp[0][3000] = 1;
  for(int i=0;i<n;++i) {
    for(int j=0;j<6001;++j) {
      if(dp[i][j] == -1) continue;
      if(j+1 < 6001) dp[i+1][j+1] = max(0.0, dp[i+1][j+1]) + dp[i][j] * p[i];
      if(0 <= j-1) dp[i+1][j-1] = max(0.0, dp[i+1][j-1]) + dp[i][j] * (1 - p[i]);
    }
  }

  double ans = 0;
  for(int i=3001;i<6001;++i) {
    if(dp[n][i] != -1) ans += dp[n][i];
  }
  cout << ans << endl;

}


Measured memory_bytes: 141056
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b;
  cin >> a >> b;
  ll res = (b - 1) / (a - 1);
  if((b - 1) % (a - 1) != 0)res++;
  if(b == 1)cout << 0 << endl;
  else cout << res << endl;
}


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

int main() {
  string s;
  cin >> s;
  s.at(3) = '0'+8;
  cout << s << endl;
  
}

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

int main() {
  ll a, b, x, ans;
  cin >> a >> b >> x;
  if (a == 0)
    ans = b/x+1;
  else
    ans = b/x - (a-1)/x;
  cout << ans << endl;;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


int main() {
    string s; cin >> s;
    bool flag = true;
    char c = s[0];
    rep(i,2) {
        if (s[i+1] != c) {
            flag = false;
            break;
        }
    }
    if (flag) cout << "No" << endl;
    else cout << "Yes" << endl;
} 

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

int main()
{
	int Ans = 0;
	int W, H, N;
	cin >> W >> H >> N;
	int X[10000];
	int Y[10000];
	for (int y = 0; y < N; y++)
	{
		cin >> X[y]>>Y[y];
	}
	for (int u = 0; u < (N-1); u++)
	{
		int x = X[u + 1] - X[u];
		int y = Y[u + 1] - Y[u];
		if (x >= 0)
		{
			if (y >= 0)
			{
				if ((x - y) >= 0)
				{
					Ans += x;
				}
				else
				{
					Ans += y;
				}
			}
			else
			{
				Ans += (x - y);
			}
		}
		else
		{
			if (y >= 0)
			{
				Ans += (y - x);
			}
			else
			{
				if ((x - y) >= 0)
				{
					Ans += -y;
				}
				else
				{
					Ans += -x;
				}
			}
		}
	}
	cout << Ans << endl;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define forr(i,n,a) for(ll i=n-1;i>=a;i--)
#define scan(arr,a,n) for(int i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(int i=(a);i<(n);i++)cout<<(arr)[i]<<' ';

const ll inf = 1e18;
const ll N = 1e5+3;

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}

int main(){
    fast;
    ll n;
    cin>>n;
    ll a[n], c[N] = {}, ans = 0;
    forn(i, 0, n){
        cin>>a[i];
        c[a[i]+1]++;
    }
    forn(i, 1, N-2){
        ans = max(c[i-1]+c[i]+c[i+1], ans);
    }
    cout<<ans<<endl;

}

Measured memory_bytes: 5132
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(long[][] a) {
    a.sort!"a[1] < b[1]";

    long t = 0;
    foreach (e; a) {
        t += e[0];
        if (t > e[1]) return false;
    }
    return true;
}

void main() {
    int n = readint;
    long[][] a;
    for (int i = 0; i < n; i++) {
        a ~= reads!long;
    }
    writeln(calc(a) ? "Yes" : "No");
}


Measured memory_bytes: 29692
#include <bits/stdc++.h>
#define forna(i,a,n) for(int i=a;i<n;i++)
typedef long long int lli;
using namespace std;
// int fastexpo(int b, int exp){
//     if(exp == 0) return 1;
//     if(exp == 1) return b;
//     int ans = (fastexpo(b,exp/2) % MOD);
//     ans *= ans;
//     ans %= MOD;
//     if(exp % 2 == 1){
//         ans *= b;
//     }
//     ans %= MOD;
//     return ans;
// }
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n,m;string s;
// cin>>t;
// while(t--){
cin>>n;
int mat[n][2];
forna(i,0,n) cin>>mat[i][0]>>mat[i][1];
forna(i,0,n-2){
  forna(j,0,n-1){
    forna(k,0,n){
      if(mat[i][0]==mat[i][1]&&mat[j][0]==mat[j][1]&&mat[k][0]==mat[k][1]&&i+1==j&&j+1==k){cout<<"Yes\n";return 0;}
    }
  }
}
cout<<"No\n";return 0;}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef vector<ll> Vl;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;


int h, w, k, ans = inf;
int s[10][10005];

int numofbits5(int bits)
{
	bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
	bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
	bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
	bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
	return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
}

int main() {

	cin >> h >> w >> k;

	rep(i, h)rep(j, w) {
		char c;
		cin >> c;
		s[i][j] = c - '0';
	}

	rep(bit, (1 << (h - 1))) {
		int area[15], arcnt[15] = {}, tmp = 0;
		bool psbl = true;
		area[0] = 0;
		rep(i, h - 1) {
			if (bit & (1 << i)) { area[i + 1] = area[i] + 1; tmp++; }
			else area[i + 1] = area[i];
		}

		rep(j, w) {
			int narcnt[15] = {};
			bool flg = true;
			rep(i, h) {
				narcnt[area[i]] += s[i][j];
				if (narcnt[area[i]] > k) { psbl = false; break; }
				else if (arcnt[area[i]] + narcnt[area[i]] > k)flg = false;
			}

			if (!psbl) break;
			if (flg)rep(i, area[h - 1] + 1)arcnt[i] += narcnt[i];
			else {
				tmp++;
				rep(i, area[h - 1] + 1)arcnt[i] = narcnt[i];
			}
		}

		if (!psbl)continue;
		ans = min(ans, tmp);
	}

	cout << ans << endl;

	return 0;
}

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

#define int long long
using namespace std; 
int res[5001],f[5000],t[5000],c[5000],d[5000];
int N,M;
signed main(void){
    // Your code here!
    cin>>N>>M;
    for(int i = 0 ; i < M ; i ++){
        cin>>f[i]>>t[i]>>c[i];
        f[i]--,t[i]--,c[i]*=-1;
    }
    int INF =1LL<<60;
    for(int i = 0 ; i < 5000 ; i ++){
        d[i] = INF;
    }
    d[0] = 0;
    for(int i = 0 ; i < 5001 ; i ++){
        for(int m = 0 ; m <M ; m ++){
            if(d[f[m]]!=INF){
                d[t[m]] = min(d[t[m]],d[f[m]]+c[m]);
                
            }
        }
        res[i] = d[N-1];
    }
    if(res[3000]>res[5000]){
        std::cout << "inf" << std::endl;
    }else{
        std::cout << -res[5000] << std::endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int32_t main(){
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vi a(n);
    vi b(100005,0);
    REP(i,0,n){
        cin>>a[i];
        b[a[i]]++;
    }
    set<int>eve,odd;
    for(int i=0;i<100005;i++){
        if(b[i]!=0){
            if(b[i]%2){
                odd.insert(i);
                b[i]=1;
            }
            else{
                eve.insert(i);
                b[i]=2;
            }
        }
    }
    int ans=0;
    ans+=odd.size();
    if(eve.size()%2==0){
        ans+=(eve.size());
    }
    else{
        ans+=(eve.size());
        ans--;
    }
    cout<<ans<<"\n";




    return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
using lint = int64_t;

int main() {
    int N;
    cin >> N;
    vector<lint> a(N);
    rep(i, N) cin >> a[i];
    vector<lint> sum(N + 1, 0);
    rep(i, N) sum[i + 1] = sum[i] + a[i];
    lint ans = 1000000000000000000;
    for (int i = 1; i <= N - 1; ++i) {
        ans = min(ans, abs(sum[N] - sum[i] - sum[i]));
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
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; }

int main(){
    int n; cin>>n;
    string s; cin>>s;
    int ans=1;
    rep(i,n-1){
        if(s[i]!=s[i+1]) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
n,m=map(int,input().split())
a=list(map(int,input().split()))
arr=[]

for i in range(m):
    b,c=map(int,input().split())
    arr.append((b,c))

a=sorted(a)
arr=sorted(arr,key=lambda x:-x[1])

flag=0
left=0
for tup in arr:
    for i in range(left,min(left+tup[0],n)):
        if tup[1]>a[i]:
            a[i]=tup[1]
        else:
            flag=-1
            break
        if i==n-1:
            flag=-1
            break
    left+=tup[0]
    if flag==-1:
        break

print(sum(a))

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

void ti(){
  #ifndef ONLINE_JUDGE
    freopen("in.txt", "r+", stdin);
    freopen("out.txt", "w", stdout);
  #endif
}

typedef long long ll;

int main(){

  // ti();
  int n; cin>>n;
  cout<<ceil(n/1000.0)*1000 - n<<endl;

  return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
#define anuj ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define ll long long int
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%I64d",&x)
#define ss(s)	scanf("%s",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define endl '\n'
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;
const int N = 2e5;
const int LG = 20;
int a[N],vis[N],dp[N];
vi g[N];

void dfs(int u){
	vis[u]=1;
	dp[u]=1;

	for(int v:g[u]){
		if(!vis[v])
			dfs(v);
		dp[u]=max(dp[u],1+dp[v]);
	}
}

int main(){
	anuj;

	int n,m,u,v;
	cin >> n >> m;

	while(m--){
		cin >> u >> v;
		g[u].pb(v);
	}

	Fo(i,1,n+1){
		if(!vis[i])
			dfs(i);
	}

	int mx=INT_MIN;
	Fo(i,1,n+1)
	 	mx=max(mx,dp[i]);

	 cout << mx-1;	
}


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

#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,lessl<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define int long long
#define double long double

#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()

#define ff first
#define ss second
#define mp make_pair

#define pb push_back
#define endl "\n"

#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)

#define bp __builtin_popcountll
#define inf 1e18

const int N = 1e6 + 5;
const int M = 1e9 + 7;

void solve()
{
	int n;
	cin>>n;
	int a[n];
	int gc=0;
	int f[N]={0};
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		f[a[i]]++;
		gc=__gcd(gc,a[i]);
	}
	if(gc!=1)
	{
		cout<<"not coprime"<<endl;
		return;
	}
	int pr[N]={0};
	for(int i=2;i<N;i++)
		pr[i]=1;
	for(int i=2;i<N;i++)
	{
		if(pr[i])
		{
			int cnt=0;
			for(int j=i;j<N;j+=i)
			{
				pr[j]=0;
				cnt+=f[j];
			}
			if(cnt>=2)
			{
				cout<<"setwise coprime"<<endl;
				return;
			}
		}
		
	}
	cout<<"pairwise coprime"<<endl;
}

signed main()
{
	FAST


	int t = 1;
	// cin>>t;
	for (int tc = 1; tc <= t; tc++)
	{
		// cout<<"Case #"<<tc<<": ";
		solve();
	}

}


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

char field[505][505];

typedef vector<vector<int> > Graph;

int search(int x, int y, int lx, int ly)
{
	int res = 0;
	for(int i=y; i<=ly; i++) 
	for(int j=x; j<=lx; j++) {
		if(field[i][j] == '.') continue;
		int a = field[i][j] - 'A';
		res |= (1<<a);
	}

	return res;
}

int main()
{
	int M,N;
	while(cin >> N >> M) {

		vector<vector<pair<int, int> > > pos(26);
		for(int i=0; i<N; i++)
			cin >> field[i];

		for(int i=0; i<N; i++) 
		for(int j=0; j<M; j++) {
			if(field[i][j] == '.') continue;
			int a = field[i][j] - 'A';
			pos[a].push_back(make_pair(j,i));
		}

		Graph graph(26);
		for(int i=0; i<26; i++) {
			if(pos[i].size() == 0) continue;

			int x = pos[i][0].first;
			int y = pos[i][0].second;

			int a = pos[i][1].first;
			int b = pos[i][1].second;

			if(x == a) {
				if(y > b) swap(y, b);
				if(b - y == 1) continue;

				int hoge = search(x, y+1, a, b-1);
				graph[i].push_back(hoge);

			}
			else if(y == b) {
				if(x > a) swap(x, a);
				if(a - x == 1) continue;

				int hoge = search(x+1, y, a-1, b);
				graph[i].push_back(hoge);
			}
			else {
				int l = min(x, a);
				int r = min(y, b);

				int c = max(x, a);
				int d = max(y, b);
				// /

				if( l != x) {
					int hoge = 0;
					hoge |= search(l, r, c-1, r);
					hoge |= search(l, r, l, d-1);

					graph[i].push_back(hoge);

					hoge = 0;
					hoge |= search(l+1, d, c, d);
					hoge |= search(c, r+1, c, d);

					graph[i].push_back(hoge);
				}
				else {
					int hoge = 0;
					hoge |= search(l+1, r, c, r);
					hoge |= search(c, r, c, d-1);

					graph[i].push_back(hoge);

					hoge = 0;
					hoge |= search(l, d, c-1, d);
					hoge |= search(l, r+1, l, d);

					graph[i].push_back(hoge);
				}
			}
		}

		int piyo = 0, res = 0;
		for(int i=0; i<26; i++) 
		for(int j=0; j<26; j++) 
		for(int k=0; k<graph[j].size(); k++) {
			if((piyo & graph[j][k]) == graph[j][k]) {
				if((piyo >> j & 1) == 0) {
					piyo |= (1<<j);
					res++;
				}
			}
		}

		cout << res * 2 << endl;
	}
}

Measured memory_bytes: 0
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int n;
vector<int> a, b;
lint result;

void apply(int i) {
  int prev = i > 0 ? i - 1 : n - 1;
  int next = i + 1 < n ? i + 1 : 0;
  while (b[prev] > b[i] || b[next] > b[i]) {
    if (b[prev] > b[i])
      apply(prev);
    if (b[next] > b[i])
      apply(next);
  }
  int delta = b[prev] + b[next];
  int step_count = (b[i] - a[i]) / delta;
  if (step_count <= 0) {
    printf("-1\n");
    exit(0);
  }
  result += step_count;
  b[i] -= step_count * delta;
}

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

  result = 0;
  for (int i = 0; i < n; ++i)
    while (a[i] < b[i])
      apply(i);

  printf("%lld\n", result);

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
using namespace std;

#define N 1
#define EPS 1e-9
#define PI 3.14159265358979323846264338327950


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

	int n;
	set<string> S;
	string e;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> e;
		S.insert(e);
	}

	cout << S.size() << '\n';
}


Measured memory_bytes: 19136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " = " << x << endl
#define print(x) cout << x << endl;
const ll MOD = 1000000007;

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> cumalative(N);

    rep(i, N + 1)
    {
        if (i == 0)
        {
            cumalative[i] = 0;
        }
        else
        {
            cumalative[i] = cumalative[i - 1] + i;
            cumalative[i] = cumalative[i] % MOD;
        }
    }

    ll ans = 0;
    for (int i = K; i <= N + 1; i++)
    {
        ans += cumalative[N] - cumalative[N - i] - cumalative[i - 1] + 1;
        ans = ans % MOD;
    }

    if (ans < 0)
    {
        ans += MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3976
#include<bits/stdc++.h>
using namespace std;
#define el '\n'
#define ull unsigned long long
#define ui unsigned int
#define ll long long
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d",n)
int main()
{
    ll lim=INT_MAX;
    ll mx=-1*lim;
    ll mn=lim;
    ll n,m;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>m;
        if(m<mn)
            mn=m;
        if(m>mx)
            mx=m;
    }
    cout<<abs(mx-mn)<<el;


    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char str[4005];

void solve()
{
    int n;
    scanf("%d%s", &n, str);
    int i,j,k;
    int cnt[3] = { 0 };
    for (i = 0; i < n; i++) {
        if (str[i] == 'R') {
            cnt[0]++;
        }
        else if (str[i] == 'G') {
            cnt[1]++;
        }
        else {
            cnt[2]++;
        }
    }
    ll ans = (ll)cnt[0] * cnt[1] * cnt[2];
    for (i = 0; i < n; i++) {
        for (j = i+1; j < n; j++) {
            int k = (j - i) * 2 + i;
            if (k < n) {
                if (str[i] != str[j] && str[j] != str[k] && str[k] != str[i])
                    ans--;
            }
        }
    }
    printf("%lld\n", ans);
    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1234567;
const ll INF=1000000010;
const ll LINF=1000000000000000010LL;
const int MAX=10000010;
const double EPS=1e-3;
int dx[4]={0,1,0,1};
int dy[4]={0,0,1,1};
int dp[1010][1010];
int main(){
	int W;
	int c=1;
	while(cin>>W,W){
		int n;cin>>n;
		int v[1010],w[1010];
		memset(dp,0,sizeof(dp));
		for(int i=0;i<n;i++)scanf("%d,%d",&v[i],&w[i]);
		for(int i=0;i<=n;i++)for(int j=0;j<=W;j++)dp[i][j]=-INF;
		for(int i=0;i<=n;i++)dp[i][0]=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<=W;j++){
				dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
				if(j+w[i]<=W){
					dp[i+1][j+w[i]]=max(dp[i+1][j+w[i]],dp[i][j]+v[i]);
				}
			}
		}
		int ans=0;
		int m=0;
		for(int i=0;i<=W;i++){
			if(ans<dp[n][i]){
				ans=dp[n][i];
				m=i;
			}
		}
		cout<<"Case "<<c<<":"<<endl;
		cout<<ans<<endl;
		cout<<m<<endl;
		c++;
	}
}



Measured memory_bytes: 7192
n = int(input())
li = []
pre_t = 0
pre_x = 0
pre_y = 0
flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if (t-pre_t)%2 == (x-pre_x+y-pre_y)%2 and (t-pre_t) >= (x-pre_x + y-pre_y):
        pre_t = t
        pre_x = x
        pre_y = y
    else:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq  priority_queue<double, std::vector<double>, std::greater<double>>

int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};




int main(){
    string S;
    cin >> S;
    ll ans = 9999;
    for (int i = 0; i < S.size() - 2; i++)
    {
        int num = 100 * (S[i] - '0') + 10 * (S[i + 1] - '0') + S[i + 2] - '0';
        if (abs(753 - num) < ans)
        {
            ans = abs(753 - num);
        }

    }
    cout << abs(ans) << endl;
}


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

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}

int main() {
int n;
	cin >> n;
	for (int i = 31; i <= 55555; i += 5) {
		if (isprime(i) == true) {
			if (i != 31) cout << " ";
			cout << i; n--;
		}
		if (n == 0) break;
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

int main(void)
{
    int64_t n, m, c;
    std::cin >> n >> m >> c;
    std::vector<int64_t> b_list(m, 0);

    for (auto& b : b_list) {
        std::cin >> b;
    }

    std::vector<std::vector<int64_t>> a_lists(n);
    for (auto& a_list : a_lists) {
        a_list.resize(m);
        for (auto& a : a_list) {
            std::cin >> a;
        }
    }

    int64_t count = 0;
    for (auto& a_list : a_lists) {
        int64_t sum = 0;
        for (int64_t i=0; i<m; ++i) {
            sum += a_list.at(i) * b_list.at(i);
        }
        sum += c;
        if (sum > 0) count++;
    }

    std::cout << count << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fort(i,n) for (int i = 1; i <= n; ++i)
#define pi pair<int,int>
#define vi vector<int>
#define pb push_back
#define sz size()
#define er erase
#define fr first
#define sc second
#define rc(x) return cout << x, 0
using namespace std;

int h,w,dp[1005][1005];
char a[1005][1005];

int32_t main()
{
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> h >> w;
    int mod=1000000007;
    fort (i,h)
        fort (j,w)
            cin >> a[i][j];
    dp[1][1]=1;
    fort (i,h)
        fort (j,w)
        {
            if (a[i][j]!='#')
            {
                if (a[i][j-1]!='#') dp[i][j]+=dp[i][j-1]%mod;
                if (a[i-1][j]!='#') dp[i][j]+=dp[i-1][j]%mod;
            }
        }
    cout << dp[h][w]%mod;
}


Measured memory_bytes: 5120
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    n,k = i_map()

    cnt = 0
    l = []
    for _ in range(n):
        a,b = i_map()
        l.append([a,b])

    l.sort()
    for i,j in l:
        cnt += j
        if cnt >= k:
            print(i)
            break

if __name__=="__main__":
    main()


Measured memory_bytes: 25292
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(void) {

    int n;
    scanf("%d", &n);

    int *arr = static_cast<int*>(malloc(sizeof(int)*n));
    for (int i = 0; i < n; ++i) {
        scanf("%d", &arr[i]);
    }

    int m = 1;
    for (int f = 4; m < 100; ++m, f<<=1) {
        if (n / f == 0)
            break;
    }

    int *G = static_cast<int*>(malloc(sizeof(int)*m));
    G[m-1] = 1;
    for (int i = m - 2, f = 4; i >= 0; --i, f<<=1) {
        G[i] = f;
    }

    int count = 0;
    for (int i = 0; i < m; ++i) {
        int g = G[i];
        for (int j = g; j < n; ++j) {
            int k, key = arr[j];
            for (k = j - g; k >= 0 && arr[k] > key; k-=g, ++count) {
                arr[k + g] = arr[k];
            }
            arr[k+g] = key;
        }
    }

    printf("%d\n", m);
    for (int i = 0; i < m - 1; ++i) {
        printf("%d ", G[i]);
    }
    printf("%d\n", G[m - 1]);
    printf("%d\n", count);
    for (int i = 0; i < n; ++i) {
        printf("%d\n", arr[i]);
    }

    free(arr);
    free(G);

    return 0;
}

Measured memory_bytes: 4896
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
 long long a,b,c,k;
 scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
 long long ans=0;
 long long cnt=k;
 if(a>=cnt){
  printf("%lld\n",cnt);return 0;}
  
 else{
  ans+=a;
  cnt-=a;
  if(b>=cnt){
   printf("%lld\n",ans);return 0;}
  else{
   printf("%lld\n",ans-cnt+b);return 0;}
 }
  
  
return 0;}

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

#define ll long long 
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
ll inf = 1e18+7;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n,m,s; cin >> n >> m >> s;
    vector<vector<tuple<ll,ll,ll>>> graph(n); //time_cost,add_money,locate
    vector<ll> c(n); //get_money
    vector<ll> d(n); //time_cost
    rep(i,0,m){
        int a,b,q,w;
        cin >> a >> b >> q >> w;
        a--;b--;
        graph[a].push_back(make_tuple(w,q,b));
        graph[b].push_back(make_tuple(w,q,a));
    }
    rep(i,0,n) cin >> c[i] >> d[i];
    priority_queue<
        tuple<ll,ll,ll>,
        vector<tuple<ll,ll,ll>>,
        greater<tuple<ll,ll,ll>> //time,money,next
    > que;
    int money = (s<2500 ? s : 2500);
    que.push(make_tuple(0,money,0));
    ll dist[51][2510];//答えのメモ
    rep(i,0,51)rep(j,0,2505) dist[i][j] = inf;
    rep(i,0,money+1) dist[0][i] = 0; //startは0

    //dijkstra
    while(!que.empty()){
        ll locate = get<2>(que.top());
        ll money = get<1>(que.top()); //graph本体はlocateとmoneyで定まる
        ll time = get<0>(que.top());
        que.pop();
        if(dist[locate][money]<time) continue;
        else dist[locate][money] = time;
        if(money<2500){ // お金を増やす側の移動を行うフェイズ
            ll add_money = c[locate]+money;
            if(add_money>2500) add_money = 2500;
            ll add_time = time + d[locate];
            if(dist[locate][add_money] > add_time){
                dist[locate][add_money] = add_time;
                que.push(make_tuple(add_time,add_money,locate)); //時間とお金のみ増
            }
        }
        // 駅を移動するフェイズ
        rep(i,0,graph[locate].size()){
            tuple<ll,ll,ll> next = graph[locate][i]; //time,money,locate
            int next_locate = get<2>(next);
            ll next_money = money - get<1>(next);
            ll next_time = time + get<0>(next);
            if(next_money<0) continue;
            // dist更新
            if(dist[next_locate][next_money] > next_time){
                dist[next_locate][next_money] = next_time;
                que.push(make_tuple(next_time,next_money,next_locate));
            }
        }
    }
    rep(i,1,n){
        ll ans=inf;
        rep(j,0,2501){
            //if(ans>dist[i][j])cout <<i<<" "<<j<<" "<< dist[i][j] << endl;
            ans = min(ans,dist[i][j]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 7328
import java.util.Scanner;

// https://atcoder.jp/contests/abc138/tasks/abc138_b
public class Main {

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

		int[] arrayA = new int[N];
		for(int i=0;i<arrayA.length;i++) {
			arrayA[i] = sc.nextInt();
		}
		sc.close();


		double seki = 1.0;
		for(int a:arrayA) {
			seki = seki * a;
		}

		double wa = 0.0;
		for(int i=0;i<arrayA.length;i++) {
			wa = seki/arrayA[i] + wa;
		}

		System.out.println(seki/wa);

	}
}


Measured memory_bytes: 19924
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m;i>n;i--)
#define pb(n) push_back(n)
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(20) << S << endl
#define Vecpr(K,L1,L2,N) vector<pair<L1,L2>> K(N)
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,R) vector<vector<L>> K(N, vector<L>(M,R))
#define mod 1000000007
#define MAX 510000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  lli A=INF,B=0,C=INF,D=INF,E,F,N,M,K,sum=0,num=0,cnt=1,next=0;
  cin >> N >> M;
  rep(i,0,INF){
    if(cnt>=M){
      Out(sum);
      break;
    }
    cnt--;
    cnt+=N;
    sum++;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9);
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		Map<String, String> map = new HashMap<>();
		map.put("Sunny", "Cloudy");
		map.put("Cloudy", "Rainy");
		map.put("Rainy", "Sunny");
		String s = sc.next();
		System.out.println(map.get(s));
		
	}
	
	static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	      br = new BufferedReader(new InputStreamReader(System.in));
	    }
	  
	    String next() { 
	      while (st == null || !st.hasMoreElements()) {
	        try {
	          st = new StringTokenizer(br.readLine());
	        } catch (IOException  e) {
	          e.printStackTrace();
	        }
	      }
	      return st.nextToken();
	    }
	
	    int nextInt() {
	      return Integer.parseInt(next());
	    }
	
	    long nextLong() {
	      return Long.parseLong(next());
	    }
	
	    double nextDouble() { 
	      return Double.parseDouble(next());
	    }
	
	    String nextLine() {
	      String str = "";
	        try{
	            str = br.readLine();
	        } catch (IOException e) {
	            e.printStackTrace();
	        }
	        return str;
	      }
	  }
}


Measured memory_bytes: 19284
#include<stdio.h>
#include<string.h>
char a[55],b[55];
int len,n;

int main(){
	scanf("%s %s",&a,&b);
	len=strlen(a);
	for(int i=0;i<len;i++){
		printf("%c",a[i]);
		if(!b[i]=='\0')printf("%c",b[i]);
	}
	
			
}



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

using namespace std;

#define fto(i, s, e) for(int i = s; i <= e; ++i)
#define fto1(i, s, e) for(int i = s; i < e; ++i)
#define fdto(i, s, e) for(int i = s; i >= e; --i)
#define fit(var, it) for(__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define frit(var, it) for(__typeof(var.rbegin()) it = var.rbegin(); it != var.rend(); ++it)

#define newl '\n'
#define debugt cerr << 0.001*clock() << newl
#define debug1(x, i) cout << #x << '[' << i << "] = " << x[i] << newl
#define debug(v, l, r) fto(_i, l, r) debug1(v, _i)
#define debug2(x, i, j) cout << #x << '[' << i << "][" << j << "] = " << x[i][j] << newl
#define debug3(x, i, j, k) cout << #x << '[' << i << "][" << j << "][" << k << "] = " << x[i][j][k] << newl

#define ll long long
#define ii pair<int, int>
#define ff first
#define ss second
#define pb push_back
#define glen(v) int((v).size())

template<typename T1, typename T2> ostream& operator<< (ostream &os, pair<T1, T2> const &v) {
	return os << '(' << v.ff << ", " << v.ss << ')';
}

#define eps 1e-15
#define oo 1000000007
#define OO 1000000000000000003LL
#define maxn 103

int n, w;
int a[maxn], b[maxn];
ll f[maxn][100003];

int main() {
	#ifndef ONLINE_JUDGE
		//freopen("main.inp", "r", stdin);
		//freopen("main.out", "w", stdout);
	#endif
	//ios_base::sync_with_stdio(0); cin.tie(0);

	scanf("%d%d", &n, &w);

	fto (i, 1, n) scanf("%d%d", &a[i], &b[i]);

	fto (i, 0, n) fto (j, 1, w) f[i][j] = -OO;

	fto (i, 1, n) {
		fto (j, 1, w) {
			f[i][j] = max(f[i-1][j], f[i][j-1]);
			if (j >= a[i]) f[i][j] = max(f[i][j], f[i-1][j-a[i]] + b[i]);
		}
	}

	cout << f[n][w] << newl;

	return 0;
}


Measured memory_bytes: 80256
//Solution for aoj 0568:Pasta
#include <iostream>
using namespace std;
const int surplus = 10000;
int n, k, a, b, ans;
int pasta[101][4][2], save[101];
void dp(int day){
	if (day > n)
		return;
	if (save[day]){
		for (int i = 1; i <= 3; i++){
			if (save[day] != i)
				pasta[day][save[day]][0] += pasta[day - 1][i][0] + pasta[day - 1][i][1];
			else
				pasta[day][i][1] += pasta[day - 1][i][0];
		}
		pasta[day][save[day]][0] %= surplus;
		pasta[day][save[day]][1] %= surplus;
	}
	else{
		for (int i = 1; i <= 3; i++){
			for (int j = 1; j <= 3; j++){
				if (i != j){
					pasta[day][i][0] += pasta[day - 1][j][0] + pasta[day - 1][j][1];
				}
				else{
					pasta[day][i][1] += pasta[day - 1][j][0];
				}
			}
			pasta[day][i][0] %= surplus;
			pasta[day][i][1] %= surplus;
		}
	}
	dp(day + 1);
}
int main(){
	cin >> n >> k;
	for (int i = 0; i < k; i++){
		cin >> a >> b;
		save[a] = b;
	}
	if (save[1])
		pasta[1][save[1]][0] = 1;
	else{
		for (int i = 1; i <= 3; i++){
			pasta[1][i][0] = 1;
		}
	}
	dp(2);
	for (int i = 1; i <= 3; i++){
		ans += pasta[n][i][0] + pasta[n][i][1];
	}
	ans %= surplus;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll n;
  cin >> n;
  string s,t;
  string ans;
  ans = "";
  cin >> s >> t;
  rep(i,n){
    ans = ans + s[i];
    ans = ans + t[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <time.h>
using namespace std;

/* ?????????????????°???????´? */
void trace(int arr[], int n) {
    int i;
    for (i = 0; i < n; i++ ) {
        if(i > 0) {
            printf(" ");
        }
        printf("%d", arr[i]);
    }
    printf("\n");
}

int selectionSort(int arr[],int n){
    int count = 0;
    for(int i = 0;i<n;i++){
        int min = i;
        for(int j = i + 1;j<n;j++){
            if(arr[j] < arr[min]){
                min = j;
            }
        }
        if(min != i){
            swap(arr[min],arr[i]);
            count++;
        }

    }
    return count;
}





int main(){
    int n;
    int arr[110];
    cin>>n;
    for (int i = 0; i < n;i++) {
        cin>>arr[i];
    }

    int count = selectionSort(arr,n);
    trace(arr,n);
    cout<<count<<endl;
}

Measured memory_bytes: 3236
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int[] b = new int[a];
		for (int i = 0; i < a; i++)
			b[i] = scanner.nextInt();
		for (int i = b.length - 1; i >= 0; i--) {
			if (i == b.length - 1)
				System.out.print(b[i]);
			else
				System.out.print(" " + b[i]);
		}
		System.out.println();
	}
}



Measured memory_bytes: 26292
#include <iostream>

int main() {
    int a;
    std::cin >> a;
    
    int h = a / 3600;
    int m = a % 3600 / 60;
    int s = a % 3600 % 60;
    std::cout << h << ":" << m << ":" << s << std::endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

int main(){
  ll X,N;
  ll p[111];
  cin >> X >> N;
  ll i;
  for(i=0;i<=N-1;i++)
    cin >> p[i];
  ll count[1111] = {0};
  for(i=0;i<=N-1;i++)
    count[p[i] + 111]++;
  for(i=0;i<=1111;i++){
    if(count[X+111-i]==0){cout << X-i; break;}
    if(count[X+111+i]==0){cout << X+i; break;}
    }
}



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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007)
#define IINF (1<<28)
#define LINF (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"

namespace solver {
  using namespace std;
  typedef long long ll;

  int N, M;
  vector<tuple<int, int, int, int> > vec;

  void init() {
    cin >> N >> M;
    int P, Y;
    rep(i, M) {
      cin >> P >> Y;
      vec.push_back(make_tuple(P, Y, i, 0));
    }
  }

  void solve() {
    sort(vec.begin(), vec.end());
    int past = 0, cur = 0;
    for(auto& v : vec) {
      if(past < get<0>(v)) {
        past = get<0>(v);
        cur = 1;
      } else {
        cur++;
      }
      get<3>(v) = cur;
    }
    sort(vec.begin(), vec.end(), [](const auto& lhs, const auto& rhs) { return get<2>(lhs) < get<2>(rhs); });
    cout << setfill('0') << right;
    for(auto& v : vec) {
      cout << setw(6) << get<0>(v) << setw(6) << get<3>(v) << "\n";
    }
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 3184
def rec(s, l, now=0):
    if s[now].isdigit():
        res = ''
        while now < l and s[now] != ']':
            res += s[now]
            now += 1
        return int(res) // 2 + 1, now + 1
    else:
        g = []
        while now < l and s[now] == '[':
            res, now = rec(s, l, now + 1)
            g.append(res)
        g.sort()
        return sum(g[:len(g) // 2 + 1]), now + 1


for _ in range(int(input())):
    s = input()
    l = len(s)
    print(rec(s, l)[0])


Measured memory_bytes: 5676
c = [list(map(int, input().split())) for _ in range(3)]
d = [c[0][0] - c[0][1], c[0][1] - c[0][2]]
for i in range(1, 3):
    if c[i][0] - c[i][1] != d[0] or c[i][1] - c[i][2] != d[1]:
        print('No')
        exit()
d = [c[0][0] - c[1][0], c[1][0] - c[2][0]]
for i in range(1, 3):
    if c[0][i] - c[1][i] != d[0] or c[1][i] - c[2][i] != d[1]:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 3064