akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int a,b,c[52][52]={0};char x;
int main()
{
    cin>>a>>b;
    for(int i=1;i<=a;i++)
    {
        for(int j=1;j<=b;j++)
        {
            cin>>x;
            if(x=='#')
			{
				c[i][j]=-666;
				c[i-1][j-1]++;
                c[i][j-1]++;
                c[i+1][j-1]++;
                c[i-1][j]++;
                c[i+1][j]++;
                c[i-1][j+1]++;
                c[i][j+1]++;
                c[i+1][j+1]++;
			}
        }
    }
    for(int i=1;i<=a;i++)
    {
        for(int j=1;j<=b;j++)
        {
            if(c[i][j]>=0)cout<<c[i][j];
            else cout<<'#';
        }
        cout<<endl;
    }
}

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

namespace ziyuutyou
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = Console.ReadLine();

            if (a == "A")
            {
                Console.WriteLine("T");
            }
            else if(a == "T")
            {
                Console.WriteLine("A");
            }
            else if(a == "G")
            {
                Console.WriteLine("C");
            }
            else
            {
                Console.WriteLine("G");
            }

        }
    }
}


Measured memory_bytes: 13140
import math

#n = int(input())
#a, b, c = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]
#table = [list(input()) for n in range(h)]
#list = [int(i) for i in input().split()]
#num = [int(i) for i in range(n)]
#s = [input() for i in range(n)]
s = input()
#list = list(s)
#temp = [[0 for _ in range(13)] for _ in range(13)]

n = len(s)
ans = [0 for i in range(n)]
ans2 = [0 for i in range(n)]

for i in range(n) :
    if(s[i] == "L") :
        if(s[i-1] == "R") :
            ans[i] = i
            ans2[i] += 1
        elif(s[i-2] == "L") :
            ans[i] = ans[i-2]
            ans2[ans[i]] += 1
        else:
            ans[i] = i-2
            ans2[ans[i]] += 1

for i in range(n-1, -1 ,-1) :
    if(s[i] == "R") :
        if(s[i+1] == "L") :
            ans[i] = i
            ans2[i] += 1
        elif (s[i+2] == "R"):
            ans[i] = ans[i+2]
            ans2[ans[i]] += 1
        else:
            ans[i] = i + 2
            ans2[ans[i]] += 1


print(*ans2)

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

vector<int> e[100001];

struct DSU{
	vector<int> p,sz;
	void init(int n){
		p.resize(n+1);sz.resize(n+1);
		for(int i=1;i<=n;i++)
			sz[p[i]=i]=1;
	}
	int F(int x){
		return x==p[x]?x:p[x]=F(p[x]);
	}
	bool U(int x,int y){
		x=F(x),y=F(y);
		if(x==y)	return false;
		if(sz[x]<sz[y])	swap(x,y);
		sz[x]+=sz[y];
		p[y]=x;
		return true;
	}
};
int dep[100001],dp[100001],f[100001];
void dfs(int x,int p){
	f[x]=p;
	dp[x]=((dep[x]&1)?-1:1);
	for(int it:e[x])
		if(it!=p){
			dep[it]=dep[x]+1;
			dfs(it,x);
			dp[x]+=dp[it];
		}
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n,m,a,b;
	int ans=0;
	cin>>n>>m;
	DSU D;
	D.init(n);
	for(int i=1,u,v;i<=m;i++){
		cin>>u>>v;
		if(D.U(u,v)){
			e[u].emplace_back(v);
			e[v].emplace_back(u);
		}
		else
			a=u,b=v;
	}
	if(n==m+1){
		dfs(1,0);
		if(dp[1]!=0){
			cout<<-1<<endl;
			return 0;
		}
	}
	else{
		dfs(a,0);
		if(dep[b]&1){
			if(dp[a]){
				cout<<-1<<endl;
				return 0;
			}
			vector<int> v(1,0);
			for(int i=b;i!=a;i=f[i])
				v.emplace_back(dp[i]);
			sort(v.begin(),v.end());
			ans=abs(v[v.size()/2]);
			for(int i=b;i!=a;i=f[i])
				dp[i]-=v[v.size()/2];
		}
		else{
			if(dp[a]&1){
				cout<<-1<<endl;
				return 0;
			}
			int x=dp[a]/2;
			ans=abs(x);
			dp[a]=0;
			for(int i=b;i!=a;i=f[i])
				dp[i]-=x;
		}
	}
	for(int i=1;i<=n;i++)
		ans+=abs(dp[i]);
	cout<<ans<<endl;
}


Measured memory_bytes: 14588
a, b, c, x, y = map(int, input().split())
ans = 0
if a + b <= 2 * c:
    ans = (a + b) * min(x,y)
else:
    ans = 2 * c * min(x,y)

if x > y:
    if a <= 2 * c:
        ans += a * (x - y)
    else:
        ans += c * 2 *( x - y)
else:
    if b <= 2 * c:
        ans += b * (y - x)
    else:
        ans += c * 2 *( y - x)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int n, m, x, y;
	cin >> n >> m >> x >> y;

	int mn = y, mx = x;
	int t;
	for (int i = 0; i < n; i++) {
		cin >> t;
		mx = max(mx, t);
	}
	for (int i = 0; i < m; i++) {
		cin >> t;
		mn = min(mn, t);
	}
	
	if (mx < mn) {
		cout << "No War" << endl;
	}
	else {
		cout << "War" << endl;
	}

	return 0;
}

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

int main() {
  ll X;
  cin >> X;
  
  ll A, B;
  for (ll A = 120; A > -120; A--)
  {
    for (ll B = A; B > -120; B--)
    {
      ll temp = (ll)pow(A, 5) - (ll)pow(B, 5);
      if (temp == X)
      {
        cout << A << " " << B << endl;
        return 0;
      }
      if (temp > X)
      {
        break;
      }  
    }
    
  }
  
  return 0;
}


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

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

int main()
{
  int n;
  while (cin >> n, n){
    while (n--){
      double a, b, c;
      cin >> a >> b >> c;
      if (a == 100 or b == 100 or c == 100) cout << "A";
      else if ((a + b) / 2 >= 90) cout << "A";
      else if ((a + b + c) / 3 >= 80) cout << "A";
      else if ((a + b + c) / 3 >= 70) cout << "B";
      else if ((a + b + c) / 3 >= 50 && (a >= 80 or b >= 80)) cout << "B";
      else cout << "C";
      cout << endl;
    }
  }
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int Z = sc.nextInt();
		
		int max = ((X - Z) - (X - Z) % (Y + Z)) / (Y + Z);
		
		System.out.println(max);
		
	}
}


Measured memory_bytes: 22612
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

S = sys.stdin.readline().rstrip()
i = 2
while len(S) - i > 0:
    l = len(S) - i
    if S[:l // 2] == S[l // 2:l]:
        print(l)
        break
    i += 2


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

int main() {
  
  long A,B;
  cin >> A >> B;
  
  int count = 1;
  
  while ( count <= B ){
    if ( ( A * count ) % B == 0 ){
      break;
    }  
    count ++;
  }
  
  cout << A * count << endl;
  
}


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

int main() {
  int n, m, x, y;
  cin >> n >> m >> x >> y;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    x = max(x, a);
  }
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    y = min(y, a);
  }
  if (x >= y) puts("War");
  else puts("No War");
  return 0;
}


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

typedef long long ll;

vector<pair<ll,ll> >g[100005]; 
bool color[100005];
ll dis[100005];

void bfs(ll start)
{
	for(int i=0;i<100005;i++) color[i]=false,dis[i]=0;
	
	color[start]=1;
	queue<ll>q;
	
	ll u;
	
	q.push(start);
	
	while(!q.empty())
	{
		u=q.front();
		q.pop();
		
		for(int i=0;i<g[u].size();i++)
		{
			ll adj=g[u][i].second;
			ll d=g[u][i].first;
			if(!color[adj])
			{
				color[adj]=1;
				dis[adj]=dis[u]+d;
				q.push(adj);
			}
		}
	}
}


int main()
{    
    int n;
    cin>>n;
    
    pair<ll,ll>p;
    
    for(int i=1;i<n;i++)
    {
    	ll a,b,c;
    	cin>>a>>b>>c;
    	p.first=c;
    	p.second=b;
    	g[a].push_back(p);
    	
    	p.second=a;
    	g[b].push_back(p);
    }
    
    ll q,k;
    cin>>q>>k;
    
    bfs(k);
    
    while(q--)
    {
    	ll a,b;
    	cin>>a>>b;
    	cout<<dis[a]+dis[b]<<endl;
    }
        
    return 0;

}

Measured memory_bytes: 10112
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

# n = int(input())
# a, 
# s = input()

N, M, X = list(map(int, input().split()))
C = [0]*(N+1)
A = makelist(N+1, M+1)
for i in range(1, N+1):
    h = list(map(int, input().split()))
    C[i] = h[0]
    A[i] = h[1:]

ma = int(1e18)
ans = ma
for b in range(1 << N):
    ind = 1
    dp = [0]*M
    res = 0
    while b > 0:
        if b % 2 == 1:
            c = C[ind]
            l = A[ind]
            for i in range(M):
                dp[i] += l[i]
            res += c
            
        b //= 2
        ind += 1
    if all([e >= X for e in dp]):
        ans = min(ans, res)


if ans < ma:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 68648
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#define Max 200005
using namespace std;
typedef long long LL;
int main() {
    int n;
    int a[Max];
    LL sum[Max] = {0};
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++) {
        scanf("%d",&a[i]);
        sum[i] = sum[i - 1] + a[i];
    }
    LL ans = sum[n];
    int l = 1,r = 3;
    for(int i = 2;i <= n - 2;i ++) {
        LL last = sum[n];
        while(l < i) {
            LL d = abs(sum[i] - sum[l] * 2);
            if(d > last) break;
            else last = d;
            l ++;
        }
        l --;
        last = sum[n];
        while(r < n) {
            LL d = abs(sum[n] + sum[i] - sum[r] * 2);
            if(d > last) break;
            else last = d;
            r ++;
        }
        r --;
        LL up = max(max(max(sum[l],sum[i] - sum[l]),sum[r] - sum[i]),sum[n] - sum[r]);
        LL down = min(min(min(sum[l],sum[i] - sum[l]),sum[r] - sum[i]),sum[n] - sum[r]);
        ans = min(ans,up - down);
    }
    printf("%lld",ans);
}

Measured memory_bytes: 2560
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let[a,b]=nrin(2)
  out(a+b>23?a+b-24:a+b)
}
main()

Measured memory_bytes: 7372
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;
 
signed main() {
	IOS;
	int a, b, c;
	cin >> a>> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << " " << b << " " << c;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch DecreaseContestantVer | diff DecreaseContestantVer.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address DecreaseContestantVer.cpp && ./a.out

/*

 7/9/2020

 8:46-10:49 give up

 7/10/2020

 9:05-

 https://docs.google.com/document/d/1Yq384PEooRVsmlzB103YMLWwE_JhPN8AbxZagNrF_vY/edit#bookmark=id.u2wjkx1q9tt
 https://docs.google.com/document/d/1Yq384PEooRVsmlzB103YMLWwE_JhPN8AbxZagNrF_vY/edit#bookmark=id.mjvfqx5ysajl


 */

LL K;

int sim(int a, int N, int K) {
  VI A(N,a);
  REP(k,K) A[k]=0;
  int cnt=0;
  while(*max_element(ALL(A))>N-1) {
    int k=max_element(ALL(A))-A.begin();
    REP(i,N) {
      if(i==k) A[i]-=N;
      else A[i]++;
    }
    cnt++;
  }
  return cnt;
}

void solve() {
  /*
  REP(a,20)FOR(n,2,10)REP(k,n) {
    int cnt=sim(a,n,k);
    dump(a,n,k,cnt);
  }*/

  int N=50;
  LL base=K/N;
  vector<LL> A(N); iota(ALL(A), base);
  LL rem=K%N;
  while(rem--) {
    REP(i,N) {
      if(i==0) A[i]+=N;
      else A[i]-=1;
    }
    sort(ALL(A));
  }
  cout<<SZ(A)<<endl;
  REP(i,N) cout<<A[i]<<" ";
  cout<<endl;
}

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

  cin>>K;
  solve();

  return 0;
}


Measured memory_bytes: 3624
#include <cmath>
#include <cstdio>
using namespace std;
int n,l,min=0x6f6f6f6f,tot;
int main(){
	scanf("%d %d",&n,&l);
	for(int i=0;i<n;i++){
		tot+=(l+i);
		if(abs(l+i)<abs(min))	min=l+i;
	}
	printf("%d",tot-min);
	return 0;
}

Measured memory_bytes: 128
public class Main {
    public static void main(String[] args){
    	int k;
    	for(int i = 1;i <= 9;i++){
    		for(int j = 1;j <= 9;j++){
    			k = i * j;
    			System.out.println(i + "x" + j + "=" + k);
    		}
    	}
    }
}

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

int main() {
  int N, M, X; cin >> N >> M >> X;
  int C[N], A[N][M];
  for (int i = 0; i < N; i++) {
    cin >> C[i];
    for (int j = 0; j < M; j++) cin >> A[i][j];
  }
  bool achievable = false; int min_money = 1e+9;
  for (int b = 0; b < (1<<N); b++) {
    int c_sum = 0;
    int S[M]; for (int j = 0; j < M; j++) S[j] = 0;
    for (int i = 0; i < N; i++) {
      if (b & (1<<i)) {
        c_sum += C[i];
        for (int j = 0; j < M; j++) {
          S[j] += A[i][j];
        }
      }
    }
    int achieved = true;
    for (int j = 0; j < M; j++) {
      if (S[j] < X) achieved = false;
    }
    if (achieved) {
      achievable = true;
      min_money = min(min_money, c_sum);
    }
  }
  if (achievable) cout << min_money << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;    

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))    
#define OUT(P) cout << (P) << endl    
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl    
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;    
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)    
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)    
#define rep(i, n) for(int i=0; i<(n); i++)
typedef long long ll;    

int sum_digits(int num);    
template <class T>    
vector<T> copy_vector(vector<T> vec);    
int gcd(int a, int b);    

int main() {    
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    vector<pair<int, int>> steps;
    for(int i=1; i<n-1; i++) {
        int ca = a[i];
        if(ca > 0) {
            steps.push_back(make_pair(a[0], ca));
            a[0] -= ca;
        } else { // < 0
            steps.push_back(make_pair(a[n-1], ca));
            a[n-1] -= ca;
        }
    }
    steps.push_back(make_pair(a[n-1], a[0]));
    int ans = a[n-1] - a[0];

    cout << ans << endl;
    for(int i=0; i<steps.size(); i++) {
        cout << steps[i].first << " " << steps[i].second << endl;
    }

    
    
    return 0;    
}    

/******************************/    
/***** DECRARED FUNCTIONS *****/    
/******************************/    

int sum_digits(int num) {    
    int rtn = 0;    
    while(num != 0) {    
        int tmp = num % 10;    
        rtn += tmp;    
        num /= 10;    
    }    
    return rtn;    
}    

// vectorのコピー    
template <class T>    
vector<T> copy_vector(vector<T> vec) {    
    vector<T> rtn;    
    rtn.reserve(vec.size());    
    copy(vec.begin(), vec.end(), back_inserter(rtn));    
    return rtn;    
}    

// ユークリウッドの互除法    
int gcd(int a, int b) {    
    if(b==0) return a;    
    else return gcd(b, a % b);    
}


Measured memory_bytes: 3188
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

const int MOD = 1000000007;

int cmb[4010][4010];



inline ll calcCmb(int n, int k) {
  if(k < 0 || n < k) return 0;
  return cmb[n][k];
}

inline ll calcH(int n, int k) {
  return calcCmb(n+k-1, k);
}

int main(void) {
  ll n, k;
  cin >> n >> k;
  REP(i, 4005) {
    cmb[i][0] = 1;
    for(int j = 1; j <= i; ++j) {
      cmb[i][j] = (cmb[i-1][j] + cmb[i-1][j-1]) % MOD;
    }
  }
  for(int i = 1; i <= k; ++i) {
    cout << calcH(i+1, n-k-(i-1)) * calcCmb(k-1, i-1) % MOD << endl;
  }
  return 0;
}


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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    int a, b, c;
    cin >> a >> b >> c;

    if ( a == b and b == c and !(a & 1) ) {
        cout << -1 << endl;
        return 0;
    }

    int cont = 0;
    while ( !(a & 1) and !(b & 1) and !(c & 1) ) {
        int ma = a / 2, mb = b / 2, mc = c / 2;
        a = mb + mc;
        b = ma + mc;
        c = ma + mb;
        cont++;
    }

    cout << cont << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>

const int MAXN = 100 + 10;
char s[MAXN], t[MAXN];

int main()
{
    int n;
    scanf("%d", &n);
    getchar();
    scanf("%s %s", s, t);
    for (int i = 0; i < n;i++)
        printf("%c%c", s[i], t[i]);
    return 0;
}

Measured memory_bytes: 1680
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
	private static int h;
	private static int w;
	private static int ch;
	private static int cw;
	private static int dh;
	private static int dw;
	private static String[] s;
	private static Integer[][] res;

	private static class Point {
		final int h;
		final int w;

		Point(int inh, int inw) {
			h = inh;
			w = inw;
		}
	}
	private static Deque<Point> nxtLst = new ArrayDeque<Point>();

	private static Deque<Point> wpLst = new ArrayDeque<Point>();

	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		h = sc.nextInt();
		w = sc.nextInt();
		ch = sc.nextInt() - 1;
		cw = sc.nextInt() - 1;
		dh = sc.nextInt() - 1;
		dw = sc.nextInt() - 1;
		s = new String[h];
		res = new Integer[h][];
		for (int i = 0; i < h; i++) {
			s[i] = sc.next();
		}
		for (int i = 0; i < h; i++) {
			res[i] = new Integer[w];
			for (int j = 0; j < w; j++) {
				if (s[i].charAt(j) == '#') {
					res[i][j] = -1;
				}
			}
		}

		nxtLst.add(new Point(ch, cw));
		for (int pt = 0;; pt++) {
			if (nxtLst.size() <= 0) {
				System.out.println(-1);
				return;
			}
			for (Point e : nxtLst) {
				find(e.h, e.w, pt);
				Integer rtn = res[dh][dw];
				if (rtn != null && rtn >= 0) {
					System.out.println(rtn);
					return;
				}
			}
			nxtLst.clear();
			for (Point e : wpLst) {
				for (int i = -2; i <= 2; i++) {
					for (int j = -2; j <= 2; j++) {
						if (i == 0 && j == 0) {
							continue;
						}
						int wpH = e.h + i;
						int wpW = e.w + j;
						if (wpH < 0 || wpH >= h || wpW < 0 || wpW >= w) {
							continue;
						}
						if (res[wpH][wpW] != null) {
							continue;
						}
						res[wpH][wpW] = -2;
						nxtLst.add(new Point(wpH, wpW));
					}
				}
			}
			wpLst.clear();
		}

	}

	public static Integer find(int targetH, int targetW, int pt) {
		if (targetH < 0 || targetH >= h || targetW < 0 || targetW >= w) {
			return -1;
		}
		if (res[targetH][targetW] != null) {
			if (res[targetH][targetW] == -1) {
				return -2;
			}
			if (res[targetH][targetW] >= 0) {
				return res[targetH][targetW];
			}
		}
		res[targetH][targetW] = pt;
		boolean wpflg = false;
		if (find(targetH + 1, targetW, pt) == -2) {
			wpflg = true;
		}
		if (find(targetH - 1, targetW, pt) == -2) {
			wpflg = true;
		}
		if (find(targetH, targetW + 1, pt) == -2) {
			wpflg = true;
		}
		if (find(targetH, targetW - 1, pt) == -2) {
			wpflg = true;
		}
		if (wpflg) {
			wpLst.push(new Point(targetH, targetW));
		}
		return 0;
	}

}


Measured memory_bytes: 65168
#include <bits/stdc++.h>
#define INF 1e18
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << x << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<ll> A(N+1);
    vector<ll> B(N);

    REP(i, N+1) cin >> A.at(i);
    REP(i, N) cin >> B.at(i);

    ll ans = 0;
    REPD(i, N) {
        // i+1
        if (B.at(i) > A.at(i+1)) {
            ans += A.at(i+1);
            B.at(i) -= A.at(i+1);
            A.at(i+1) = 0;
        } else {
            ans += B.at(i);
            B.at(i) = 0;
        }
        // i
        if (B.at(i) != 0) {
            if (B.at(i) > A.at(i)) {
                ans += A.at(i);
                A.at(i) = 0;
            } else {
                ans += B.at(i);
                A.at(i) -= B.at(i);
            }
        }
    }

    print(ans);

}

int main()
{
    solve();

    return 0;
}


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

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())

ll a,b;
signed main(){
	cin>>a>>b;
	cout<<(a+b+1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void)
{
    int n,m,l,r,cnt=0,lmx=0,rmn=1e9;
    cin >> n >> m;
    for(int i=1;i<=m;i++)
    {
        cin >> l >> r;
        lmx=max(lmx,l);
        rmn=min(rmn,r);
    }
    cout << max(0,rmn-lmx+1);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
#define FOR(i,x,y) for(int i=(x);i<=(y);i++)
#define DOR(i,x,y) for(int i=(x);i>=(y);i--)
#define M 200005
#define N 100005
struct node{
	char op[3];
	int x;
}Q[M];
bool mark[N];
int Fa[N],fa[N],ans[M];
int find(int x){return x==Fa[x]?x:Fa[x]=find(Fa[x]);}

int main(){
	int n,q;
	fa[1]=1;
	while(~scanf("%d%d",&n,&q)&&(n||q)){
		memset(mark,0,sizeof mark);
		FOR(i,2,n)scanf("%d",&fa[i]);
		FOR(i,1,n)Fa[i]=i;
		FOR(i,1,q){
			scanf("%s%d",Q[i].op,&Q[i].x);
			if(Q[i].op[0]=='M'){
				if(!mark[Q[i].x])mark[Q[i].x]=1;
				else Q[i].x=0;
			}
		}
		FOR(i,1,n)if(!mark[i])Q[++q].op[0]='M',Q[q].x=i;
		
		memset(mark,0,sizeof mark);
		DOR(i,q,1){
			int x=Q[i].x;
			if(Q[i].op[0]=='M'){
				if(Q[i].x!=0)Fa[x]=find(fa[Fa[x]]);	
			}
			else ans[i]=find(x);
		}
		
		long long tmp=0;
		FOR(i,1,q)if(Q[i].op[0]=='Q')tmp+=ans[i];
		printf("%lld\n",tmp);
	}
	return 0;
}


Measured memory_bytes: 5196
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};

int x[2][55], y[2][55], z[2][55];
vector<int> X, Y, Z;

signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int N, K;
	cin >> N >> K;
	rep(i, N) {
		rep(j, 2) {
			cin >> x[j][i] >> y[j][i] >> z[j][i];
			X.push_back(x[j][i]);
			Y.push_back(y[j][i]);
			Z.push_back(z[j][i]);
		}
	}
	sort(all(X));
	sort(all(Y));
	sort(all(Z));

	int ans = 0;
	rep(i, 2 * N - 1) {
		rep(j, 2 * N - 1) {
			rep(k, 2 * N - 1) {
				int cnt = 0;
				rep(l, N) {
					if(x[0][l] <= X[i] && X[i] < x[1][l] && y[0][l] <= Y[j] && Y[j] < y[1][l] && z[0][l] <= Z[k] && Z[k] < z[1][l]) {
						cnt++;
					}
				}
				if(K <= cnt) {
					int dx = X[i+1] - X[i];
					int dy = Y[j+1] - Y[j];
					int dz = Z[k+1] - Z[k];
					ans += dx * dy * dz;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int g = n, p = 0, ans = 0;
    for(int i=0;i<n;++i)
        if(s[i] == 'p')ans--;

    for(int i=n-1;i>=0;--i){
        if(g - 1 >= p + 1 && s[i] == 'g'){
            g--;
            p++;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    cout << (n * n * n) << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void c_takahashis_information(void) {
	int c[3][3];
	for (int j = 0; j < 3; j++) {
		for (int i = 0; i < 3; i++) {
			cin >> c[j][i];
		}
	}
	int a[3], b[3];
	for (int i = 0; i <= 100; i++) {
		a[0] = i;
		b[0] = c[0][0] - a[0];
		b[1] = c[0][1] - a[0];
		b[2] = c[0][2] - a[0];

		//a1
		int a1_1 = c[1][0] - b[0];
		int a1_2 = c[1][1] - b[1];
		int a1_3 = c[1][2] - b[2];
		if ((a1_1 != a1_2) || (a1_2 != a1_3) || (a1_3 != a1_1)) continue;
		//a2
		int a2_1 = c[2][0] - b[0];
		int a2_2 = c[2][1] - b[1];
		int a2_3 = c[2][2] - b[2];
		if ((a2_1 != a2_2) || (a2_2 != a2_3) || (a2_3 != a2_1)) continue;

		cout << "Yes" << endl;
		return;
	}
	cout << "No" << endl;
}

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


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define mp make_pair
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

const ll INF=1e17;
ll n,m,a,b,c,d[1010];
struct edge{ll a,b,c;};
edge es[2010];
bool bf(int s){
  bool f=0;
  Fr(i,n) d[i]=INF;
  d[s]=0;
  fr(cnt,n+1){
    bool ud=0,udn=0;
    Fr(i,m){
      edge e=es[i];
      if(d[e.a]!=INF&&d[e.b]>d[e.a]+e.c){
        d[e.b]=d[e.a]+e.c;
        ud=1;
        if(e.a==n||e.b==n) udn=1;
      }
    }
    if(!ud) break;
    if(cnt==n){f=udn;break;}
  }
  return f;
}

int main(){
  cin>>n>>m;
  Fr(i,m){
    cin>>a>>b>>c;
    es[i]=(edge){a,b,-c};
  }
  if(bf(1)) cout<<"inf";
  else cout<<-d[n];
  cout<<endl;
}

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

int main(){

  int W, H, x, y, r;

  cin >> W >> H >> x >> y >> r;

  if(x <= 0 || y <= 0 || x > W - r || y > H - r)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 3100
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#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;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

  int n;
  cin >> n;
  int a[n+1];
  int ans = 0;
  for(int i=1;i<=n;i++){
    cin >> a[i];
    for(int j=1;j<i;j++){
      ans = max(ans,abs(a[i]-a[j]));
    }
  }
  cout << ans << endl;

return 0;
}
///....


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


int main (int argc, char const *argv[])
{
    int a,b;
    cin>>a>>b;
    
    if (a%3==0||b%3==0||(a+b)%3==0) {
        cout<<"Possible"<<endl;
    }
    else
    {
        cout<<"Impossible"<<endl;
    }
    
    

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static public void main(String[] args) {

        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int[] a = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = s.nextInt();
        }

        for (int I = (n - 1); I >= 0; I--) {
            System.out.print(a[I]);
            if (I == 0) {
                break;            
            }
            System.out.print(" ");
        }
        System.out.println("");
    }
}



Measured memory_bytes: 26440
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){

    int n;
    cin >> n;

    rep(i,0,70000){
	if((int)(i * 1.08) == n){
	    P(i);
	    ret 0;
	}
    }
    P(":(");
    return  0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  long N, M;
  cin >> N >> M;
  map<long, long> mp;
  rep (i, N) {
    long K;
    cin >> K;
    rep (k, K) {
      long A;
      cin >> A;
      mp[A]++;
    }
  }
  long ans = 0;
  for (auto it: mp) if (it.second == N) ans++;
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <string.h>
#include<stdio.h>
#include <math.h>

using namespace std;

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int main(){
	int N, M,A[10000];
	cin >> N >> M;

	long long int counter = 0;
	for (int i = 0; i < M; i++) {
		cin >> A[i];
		counter += A[i];
	}
	if (counter <= N)cout << N - counter << endl;
	else cout << -1 << endl;


return 0;

}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

long long dp[105][2][5];
//dp[決定した桁数][N以下が決定したかどうか][非0を用いた個数]:=総数
int K;

long long solve(string s){

    fill((long long*)dp,(long long*)dp+sizeof(dp)/sizeof(long long),0);

    const int L=s.size();

    dp[0][0][0]=1;

    for(int i=0;i<L;i++)
    {
        int D=s[i]-'0';
        rep(j,2)
        {
            rep(k,K+1)
            {
                for(int d=0;d<=(j?9:D);d++)
                {
                    if(d==0)dp[i+1][j ||(d<D)][k]+=dp[i][j][k];

                    else
                    {
                        dp[i+1][j ||(d<D)][k+1]+=dp[i][j][k];
                    }
                }
            }
        }
    }
    return dp[L][0][K]+dp[L][1][K];

}

int main(){

    string s;
    cin>>s;
    cin>>K;

    cout<<solve(s)<<endl;

    return 0;

}
/*


*/


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

#ifdef _DEBUG
#define dout cout
#define debug() if (true)
#define dvout(v) vout(v)
#else
#define dout if (false) cout
#define debug() if (false)
#define dvout(v) if(false) vout(v)
#endif

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define vout(v)           \
	for (auto &i : v)     \
	{                     \
		cout << i << " "; \
	}                     \
	cout << "\n"; //配列出力
#define vec(v, n) vector<int> v(n, 0);
#define vin(v)        \
	for (auto &i : v) \
		cin >> i; //配列入力

#define mod (int)(1e9+7)
typedef long long ll;
typedef unsigned long long ull;
#define next asdnext
#define prev asdprev
#define _n "\n"
#define _n2 "\n\n"
#define _t "\t"



void Main()
{
	int A,B;
	cin>>A>>B;
	cout<<A*B<<_n;
}



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


Measured memory_bytes: 3636
main(){
  int c,i;
  while(scanf("%d",&c)!=-1){
  int a[10]={512,256,128,64,32,16,8,4,2,1};
    for(i=0;i<10;i++)
      if(a[i]<=c)
	c-=a[i];
      else
	a[i]=0;
    for(i=9;i>=0;i--)
      if(a[i]){
	printf("%d",a[i]);
	break;
      }
    for(i--;i>=0;i--)
      if(a[i])
	printf(" %d",a[i]);
    puts("");
  }
  return 0;
}

Measured memory_bytes: 0
n = int(input())
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]

b.append(0)
cnt = 0
y = 0

for c in range(n+1) :
    if(b[c] + y > a[c]):
        cnt += a[c]
        if(y>a[c]) :
            y = b[c]
        else :
            y = b[c] + y - a[c]
    else :
        cnt += b[c] + y
        y = 0
        

print(cnt)

Measured memory_bytes: 18624
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		long H = scan.nextLong();
		long count = 0;
		long sum = 1;

		while(H > 0) {

			H /= 2;
			count += sum;
			sum *= 2;
		}
		System.out.println(count);
	}
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define inv(n, a) for(int i = 0; i < n; i++) cin >> a[i]
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
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; }
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
	int h, w, n;
	cin >> h >> w >> n;
	vector<int> a(n);
	inv(n, a);

	int color = 1;
	int cnt = 0;
	Graph ans(h, vector<int>(w));
	rep(i, h){
		if (i % 2){
			for(int j = 0; j < w; j++){
				ans[i][j] = color;
				cnt++;
				if (cnt == a[color - 1]){
					cnt = 0;
					color++;
				}
			}
		}else{
			for(int j = w-1; j >= 0; j--){
				ans[i][j] = color;
				cnt++;
				if (cnt == a[color - 1]){
					cnt = 0;
					color++;
				}
			}
		}
	}
	rep(i, h){
		rep(j, w){
			cout << ans[i][j];
			if(j != w-1)
				cout << " ";
		}
		cout << endl;
	}
}


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

#define REP(i,n) for(decltype(n) i=0; i<(n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define st first
#define nd second
#define pb push_back

typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef long long ll;

void solve(){
    string s;
    cin>>s;
    cout << (s.find("YAKI") == 0 ? "Yes\n" : "No\n");
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int a[N], K = 0;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        K = max(K, a[i]);
    }

    int cnt[K + 1];
    fill(cnt, cnt + K + 1, 0);
    for (int i = 0; i < N; ++i) {
        ++cnt[a[i]];
    }

    for (int k = 0; k < K; ++k) {
        cnt[k + 1] += cnt[k];
    }

    int b[N];
    for (int i = 0; i < N; ++i) {
        b[cnt[a[i]] - 1] = a[i];
        --cnt[a[i]];
    }

    for (int i = 0; i < N; ++i) {
        cout << b[i] << (i < N - 1 ? " " : "");
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 18760
#include<stdio.h>

int main(void)
{
	int m,f,r,i,j;
	char scor[10000] = {};

	for(i = 0;;i++){
		scanf("%d %d %d",&m, &f, &r);
		if((m == -1) && (f == -1) && (r == -1))break;
		else if(m == -1 || f == -1){scor[i] = 'F';}
		else if(m + f >= 80){scor[i] = 'A';}
		else if(m + f >= 65 && m + f < 80){scor[i] = 'B';}
		else if(m + f >= 50 && m + f < 65){scor[i] = 'C';}
		else if(m + f >= 30 && m + f < 50){
			if(r >= 50){
				scor[i] = 'C';
			}else{scor[i] = 'D';}
		}
		else{
			scor[i] = 'F';
		}
	}
	for(j = 0;j < i;j++){
		printf("%c\n",scor[j]);
	}
	return 0;
}

Measured memory_bytes: 616
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	int k;
	cin>>k;
	while(a>=b)
	{
		b*=2;
		k--;
	}
	while(b>=c)
	{
		c*=2;
		k--;
	}
	if(k<0)
	cout<<"No";
	else
	cout<<"Yes";
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  string S, T;
  cin >> S >> T;
  int cnt = 0;
  for (int i = 0; i < 3; ++i) {
    if (S[i] == T[i]) ++cnt;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
//created by pyoxiao on 2020/04/19
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define CL(a, b) memset(a, b, sizeof(a))
using namespace std;
const int mod = 1e9 + 7;
LL fpow(LL a, LL b, LL p = mod){LL ans = 1; a %= p; while(b) {if(b & 1) ans = ans * a % p; b >>= 1; a = a * a % p;} return ans;}
LL gcd(LL a, LL b){return b == 0 ? a : gcd(b, a % b);}
const double PI = acos(-1.0);
void solve() {
    double r;
    scanf("%lf", &r);
    printf("%.10f\n", 2 * PI * r);
}
int main() {
    int T = 1;
    // scanf("%d", &T);
    while(T --) 
        solve();
    return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll W, H, C;
    cin >> W >> H >> C;
    ll s = W * H;
    ll ans = W * H * C;
    for (ll i = 2; i <= min(W, H); i++) {
        ll t = i * i;
        if (t > s) break;
        if (W % i == 0 && H % i == 0) {
            ans = W / i * H / i * C;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3100
from collections import Counter

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

def main():
    a, b = map(int, input().split())
    print(len(Counter(pf(gcd(a,b))))+1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9444
N,K = $stdin.gets.chomp.split(" ").map{ |a| a.to_i }
pts = (0...N).map{ |i| { i: i, c: $stdin.gets.chomp.split(" ").map{ |a| a.to_i } } }

XS = pts.sort_by{ |pt| pt[:c][0] }

ans = 1000000000*1000000000*4

(0...XS.size-K+1).each { |xs|
  (xs+K-1...XS.size).each{ |xt|
    px = XS[xs..xt].sort_by{ |pt| pt[:c][1] }
    (0...px.size-K+1).each { |ys|
      (ys+K-1...px.size).each{ |yt|
        py = px[ys..yt]
        xx = py.map{ |p| p[:c][0] }
        x = xx.max - xx.min
        y = py[-1][:c][1] - py[0][:c][1]
        ans = [ans, x*y].min
      }
    }
  }
}

puts ans




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

void solve(long long N, long long T, std::vector<long long> t){
    ll ans = 0;
    for(ll i = 1; i < N; ++i){
        ans = ans + min(T, t[i] - t[i-1]);
    }
    cout << ans + T << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long T;
    scanf("%lld",&T);
    std::vector<long long> t(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&t[i]);
    }
    solve(N, T, std::move(t));
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,m, count=0;
  cin>>N>>m;
  vector<int>V(m);
  for(int i=0;i<N;i++){
      int k;cin>>k;
      	for(int l=0;l<k;l++){
          int a;cin >>a;
          V.at(a-1)++;
        }
  }
  for(int i=0;i<m;i++){
    if(V.at(i)==N){
      count++;
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 3e5 + 5;

ll a[N], b[N];

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

	ll ans = 0;
	for (int i = 0; i < n; ++i)
		cin >> a[i] >> b[i];

	for (int i = n-1; i >= 0; --i)
	{
		a[i] += ans;
		if (a[i] % b[i] == 0)
			continue;

		ans += b[i] - (a[i] % b[i]);
	}

	cout << ans;
}

Measured memory_bytes: 1920
import java.util.*;

public class Main {
	
	static int Data[][];
	
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int N=in.nextInt(),W=in.nextInt();
		Data=new int[N][2];
		
		for(int i=0;i<N;i++) {
			Data[i][0]=in.nextInt();
			Data[i][1]=in.nextInt();
		}		
		System.out.println(DP(W));
	}
	
	static int DP(int limit) {
		int dp[][]=new int[Data.length+1][limit+1];
		
		for(int i=1;i<=Data.length;i++) {
			for(int j=0;j<=limit;j++) {
				if(j-Data[i-1][1]<0)dp[i][j]=dp[i-1][j];
				else dp[i][j]=Math.max(dp[i-1][j], dp[i-1][j-Data[i-1][1]]+Data[i-1][0]);
			}
		}
		
		int max=0;
		for(int i=0;i<=limit;i++)max=Math.max(max, dp[Data.length][i]);

		return max;
	}

}



Measured memory_bytes: 31128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y,i,j,ans=0;
	cin>>x>>y;
	for(i=0;i<=100;i++)
	{
		for(j=0;j<=100;j++)
		{
			if((4*i+2*j)==y and (i+j)==x)
			{
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define endl '\n'
 
signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int n, m; cin >> n >> m;
    vector<int> a(n);
    for (auto &i: a)    cin >> i, i /= 2;
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()), a.end());
    int lcm = 1;
    for (auto &i: a) {
        lcm = lcm * i / __gcd(lcm, i);
        if (lcm > m) {
            cout << 0;
            return 0;
        }
    }
    for (auto &i: a) {
        int mult = lcm / i;
        if (mult % 2 == 0) {
            cout << 0;
            return 0;
        }
    }
    int tot = m / lcm;
    tot -= tot / 2;
    cout << tot;
}

Measured memory_bytes: 1024