akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

class node {
public:
	int parent,children[2],sib,val;
	node() {
		parent = -1;
		children[0] = -1;
		children[1] = -1;
		sib = -1;
		val = -1;
	}
	int deg() {
		int c = 0;
		for(int i=0;i<2;i++)if(children[i]!=-1)c++;
		return c;
	}
	string typ() {
		if(parent == -1)return "root";
		else if(deg() == 0)return "leaf";
		else return "internal node";
	}
};

int n = 0,c = 0;
node d[600000];

void pre(int i) {
	cout << " " << d[i].val;
	if(d[i].children[0] != -1) pre(d[i].children[0]);
	if(d[i].children[1] != -1) pre(d[i].children[1]);
}

void ino(int i) {
	if(d[i].children[0] != -1)ino(d[i].children[0]);
	cout << " " << d[i].val;
	if(d[i].children[1] != -1)ino(d[i].children[1]);
}

void pos(int i) {
	if(d[i].children[0] != -1)pos(d[i].children[0]);
	if(d[i].children[1] != -1)pos(d[i].children[1]);
	cout << " " << d[i].val;
}

void ins(int v) {
	d[c].val = v;
	if(c == 0){c++;return;}
	int h = 0;
	while(1) {
		int g;
		if(d[h].val < v) {
			g = d[h].children[1];
			if(g == -1) {
				d[h].children[1] = c;
				break;
			} else {
				h = g;
			}
		} else {
			g = d[h].children[0];
			if(g == -1) {
				d[h].children[0] = c;
				break;
			} else {
				h = g;
			}
		}
	}
	c++;
}

void find(int v) {
	int h = 0;
	while(1) {
		int g;
		if(h == -1) {
			cout << "no" << endl;
			return;
		}
		if(d[h].val < v) {
			h = d[h].children[1];
		} else if (d[h].val > v){
			h = d[h].children[0];
		} else {
			cout << "yes" << endl;
			return;
		}
	}
}

int main(void) {
	cin >> n;
	string s;
	int t;
	for(int i = 0;i < n;i++) {
		cin >> s;
		if(s == "insert") {cin >> t;ins(t);}
		else if(s == "find"){cin >> t;find(t);}
		else {ino(0);cout << endl;pre(0);cout << endl;}
	}
}



Measured memory_bytes: 14872
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
  char b;
  cin >> b;
  if(b == 'A') cout << 'T' << endl;
  if(b == 'T') cout << 'A' << endl;
  if(b == 'C') cout << 'G' << endl;
  if(b == 'G') cout << 'C' << endl;
}

Measured memory_bytes: 3568
from heapq import heappush, heappop
INF = 10 ** 20

def main():
  n, m, x = map(int, input().split())
  tlst = [int(input()) for _ in range(n)]
  edges = [[] for _ in range(n)]
  for _ in range(m):
    a, b, d = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append((b, d))
    edges[b].append((a, d))
  
  que = []
  heappush(que, (0, x, 0, 0)) #道のり、寒さ、暑さ、部屋番号
  dic = {}
  dic[(x, 0, 0)] = 0
  while que:
    total, ct, ht, node = heappop(que)
    for to, dist in edges[node]:
      new_ct = max(0, ct - dist)
      new_ht = max(0, ht - dist)
      t = tlst[to]
      if t == 1 or (t == 0 and new_ht == 0) or (t == 2 and new_ct == 0):
        new_total = total + dist
        if t == 0: new_ct = x
        if t == 2: new_ht = x
        if (new_ct, new_ht, to) not in dic or dic[(new_ct, new_ht, to)] > new_total:
          dic[(new_ct, new_ht, to)] = new_total
          heappush(que, (new_total, new_ct, new_ht, to))
  
  print(min([dic[(ct, ht, n - 1)] if (ct, ht, n - 1) in dic else INF for ct in range(x + 1) for ht in range(x + 1)]))

main()


Measured memory_bytes: 43612
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 1 ; i <=100 ; i++) {
            if (a % i == 0 && b % i == 0) {
                list.add(i);
            }
        }
        System.out.println(list.get(list.size() - k));
    }

}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int x,t; cin >> x >> t;

  int ans = x>t ? x-t:0;

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {
    
    ll n,x;
    cin >> n >> x;
    ll d = 0;
    ll ans = 1;
    for(ll i=0;i<n;i++){
        ll tmp;
        cin >> tmp;
        d += tmp;
        if(d <= x){
            ans++;
        }
    }
    cout << ans << endl;


}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	static boolean[] isPrime = new boolean[300001];
	
	static void prime(int n) {
		for(int i=2; i*n<300000; i++) {
			isPrime[n*i] = false;
		}
	}
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)) {
			int[] numprime = new int[300000];
			int k = 0;
			for(int i=2; i<300000; i++) {
				isPrime[i] = true;
			}
			for(int i=2; i<300000; i++) {
				if(isPrime[i]) {
					if(i%7 == 1 || i%7 == 6) {
						numprime[k] = i;
						k++;
						prime(i);
					}
					else {
						isPrime[i] = false; 
					}
				}
			}
			
			while(sc.hasNext()) {
				int N = sc.nextInt();
				if(N == 1) break;
				
				int cnt = 0;
				for(int i=0; i<k; i++) {
					if(numprime[i] <= N && N % numprime[i] == 0) {
						if(cnt == 0) {
							System.out.printf("%d: %d", N, numprime[i]);
							cnt++;
						}
						else {
							System.out.printf(" %d", numprime[i]);
						}
					}
				}
				System.out.println();
			}
		}
	}
}


Measured memory_bytes: 38480
n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 10**18
for i in range(n-k+1):
    l = x[i]
    r = x[i+k-1]
    if r<=0:
        ans = min(ans,abs(l))
    if l*r<0:
        ans = min(ans,min(abs(l),abs(r))+r-l)
    if l>=0:
        ans = min(ans,r)
print(ans)

Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int64_t INF = 1LL << 60;

pair<int,int> func(int x){
  int a=x%10;
  int b;
  while(x>0){
    b=x%10;
    x/=10;
  }
  return pair<int,int>(a,b);
}

int main() {
 int N;
 cin>>N;
 map<pair<int,int>,int>k;
 for(int A=1;A<=N;A++){
   k[func(A)]++;
 }
int ans=0;
 for(int B=1;B<=N;B++){
   pair<int,int>t=func(B);
  ans+= k[pair<int,int>(t.second,t.first)];
 }
 cout<<ans<<endl;
return 0;
} 

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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

signed main(){
	int n=read();
	vi a(n);
	REP(i,n)a[i]=read();
	int ans=0,last=n;
	for(int i=n-1;i>=0;i--){
		int j=i-a[i];
		if(j<0||last<j){
			cout<<-1<<endl;
			return 0;
		}
		if(j<last){
			ans+=a[i];
		}
		last=j;
	}
	print(ans);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

Measured memory_bytes: 3788
#include<iostream>
#include<cstdio>
using namespace std;
#define nMAX 10000

int main(void)
{ 
    int n;
    int i = 1;

    do{
        cin >> n;
    }while(n < 3 || n > nMAX);

    do{

        if(i % 3 == 0) cout << " " << i;

        else{
            int x = i;
            while(x > 0){
                if(x % 10 == 3){
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }   
    }while(i++ != n);

    cout << endl;
    
    return 0;
}

    

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

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

  int A, B, C;
  cin >> A >> B >> C;

  int mh = 0, mw = 0;
  vector<int> H(A), W(B);
  vector<pair<int, int>> V;
  for (int h, w; cin >> h >> w;) {
    mh = max(mh, ++H.at(--h)), mw = max(mw, ++W.at(--w));
    V.push_back({h, w});
  }

  int cnt = 0;
  for (auto [h, w] : V) {
    if (H.at(h) == mh && W.at(w) == mw) cnt++;
  }
  int can = count(H.begin(), H.end(), mh) * count(W.begin(), W.end(), mw);
  cout << mh + mw - (cnt == can) << "\n";
}

Measured memory_bytes: 9752
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
using namespace std;
int main()
{
  long long ans=0,n,k;
  cin>>n>>k;
  for(int i=k+1;i<=n;i++){
    ans+=(i-k)*(n/i);
    if(n%i!=0){
      long long a;
      if(k==0)
        a=1;
      else
        a=k;
      long long c=n+1-(n/i*i+a);
      if(c>0)
        ans+=c;
    }
  }
  cout<<ans;
  return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXM 16

ll dp[2][256];

ll makein(ll n){
  if(n<0)return 0;
  if(n>255)return 255;
  return n;
}

void solve(ll n, ll m){
  ll *now=dp[0];
  ll *nex=dp[1];
  
  rep(i, 256)nex[i]=now[i]=INF;
  now[128]=0;

  vector<ll> c(m);
  rep(i, m)cin>>c[i];

  vector<ll> x(n);
  rep(i, n)cin>>x[i];

  rep(i, n){
    rep(i, 256)nex[i]=INF;

    rep(from, 256)for(auto code: c){
      ll coded = makein(from+code);
      ll sq = (coded - x[i])*(coded - x[i]);
      nex[coded]=min(nex[coded],now[from]+sq);
    }
    swap(nex, now);
  }
  ll result = INF;
  rep(i, 256)result = min(result, now[i]);
  cout<<result<<endl;
}

int main(){
  while(true){
    ll n,m;cin>>n>>m;
    if(n==0)break;
    solve(n, m);
  }

  return 0;
}



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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (1)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if (a <= 0)
        {
            cout << "No" << endl;
            return 0;
        }
    }
}

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

class RMQ {
  static const int MAXN=1<<17;
  static const int inf=INT_MAX;
private:
  int n;
  int dat[2*MAXN-1];
public:
  RMQ (int N) {
    init(N);
  }
  void init(int N) {
    n=1;
    while (n<N) {
      n*=2;
    }
    for (int i=0; i<2*n-1; i++) {
      dat[i]=inf;
    }
  }
  void update(int i,int x) {
    i+=n-1;
    dat[i]=x;
    while (i) {
      i=(i-1)/2;
      dat[i]=min(dat[2*i+1],dat[2*i+2]);
    }
  }
  int find(int s,int t,int k,int l,int r) {
    if (r<=s || t<=l) {
      return inf;
    }
    if (s<=l && r<=t) {
      return dat[k];
    } else {
      int m=(l+r)/2;
      int vl=find(s,t,k*2+1,l,m);
      int vr=find(s,t,k*2+2,m,r);
      return min(vl,vr);
    }
  }
  int find(int s,int t) {
    return find(s,t,0,0,n);
  }
};
int main() {
  int n, q;
  cin >> n >> q;
  RMQ rmq(n);
  while (q--) {
    int com, x, y;
    cin >> com >> x >> y;
    if (com) {
      printf("%d\n",rmq.find(x,y+1));
    } else {
      rmq.update(x,y);
    }
  }
  return 0;
}

Measured memory_bytes: 4176
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;

 
void solve(){
    int n, m, x, y;
    cin >> n >> m >> x >> y;
    int lz = -200, rz = 200;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        lz = max(lz, x);
    }
    lz += 1;
    for(int i = 0; i < m; i++){
        int x;
        cin >> x;
        rz = min(x, rz);
    }
    if(rz <= y && lz > x && lz <= rz) cout << "No War";
    else cout << "War";
    
}

 
int main() {
    barsik;
    int q = 1;
    //cin >> q;
    while(q--) solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,g[15][15],dp[1<<15][15],cost[1<<15],sum;
int main() {
	memset(dp,-1,sizeof(dp));
	memset(g,-1,sizeof(g));
	scanf("%d%d",&n,&m);
	while(m--) {
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		g[a-1][b-1]=g[b-1][a-1]=c;
		sum+=c;
	}
	for(int i=1;i<(1<<n);i++)
		for(int j=0;j<n;j++)
			if((1<<j)&i)
				for(int k=j+1;k<n;k++)
					if((1<<k)&i&&g[j][k]>-1)
						cost[i]+=g[j][k];
	for(int i=1;i<1<<n;i+=2) dp[i][0]=cost[i];
	for(int i=1;i<(1<<n);i+=2)
		for(int j=0;j<n;j++)
			if(dp[i][j]>-1)
				for(int k=(1<<n)-1-i;k;k=(k-1)&(1<<n)-1-i)
					for(int l=0;l<n;l++)
						if(1<<l&k&&g[j][l]>-1)
							dp[i|k][l]=max(dp[i|k][l],dp[i][j]+g[j][l]+cost[k]);
	printf("%d\n",sum-dp[(1<<n)-1][n-1]);
	return 0;
}

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

int main() {

	int n, m; ll k; cin >> n >> m >> k;
	vector<ll> accum_a(n + 1, 0), accum_b(m + 1, 0);
	for (int i = 0; i < n; i++) {
		ll a; cin >> a;
		accum_a[i + 1] += a;
		accum_a[i + 1] += accum_a[i];
	}
	for (int i = 0; i < m; i++) {
		ll b; cin >> b;
		accum_b[i + 1] += b;
		accum_b[i + 1] += accum_b[i];
	}
	ll ans = 0;
	for (int i = 0; i <= n; i++) {
		ll tmpAns = i;
		if (k < accum_a[i]) continue;
		ll diff = k - accum_a[i];
		auto it = upper_bound(accum_b.begin(), accum_b.end(), diff);
		tmpAns += it - accum_b.begin() - 1;
		ans = max(ans, tmpAns);
	}
	cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int64_t A[N];
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64_t sum = 0;
  for(int i = 0; i < N; i++) {
    sum += A[i];
  }
  int64_t sum1 = 0; 
  int D = 0;
  for(int j = 0; j < (N+1)/2; j++) {
    sum1 += A[D];
    D += 2;
  }
  int64_t x1 = 2 * sum1 - sum;
  cout << x1 << endl;
  for(int i = 0; i < N - 1; i++) {
    x1 = 2 * A[i] - x1;
    cout << x1 << endl;
  }
  cout << endl;
}

Measured memory_bytes: 2048
#if _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#ifndef ONLINE_JUDGE 
const bool DEBUG = true;
#else
const bool DEBUG = false;
#endif

// Reads a 1D vector
template <class T>
void read1d(vector<T> & arg) {
	const int l = arg.size();
	for (int i = 0; i < l; ++i) cin >> arg[i];
}

void read() {}
// Reads arbitrary values
template <class T1, class... T2>
void read(T1& var1, T2&... var2) { cin >> var1; read(var2...); }



void pln() { cout << (DEBUG ? "]\n" : "\n"); }
template <class T1, class... T2>
void pln(const T1& var1, const T2& ... var2) { cout << var1 << " "; pln(var2...); }

// Prints arbitrary values and goes to next line
template <class T1, class... T2>
constexpr void print(const T1& var1, const T2& ... var2) { cout << (DEBUG ? " [ " : ""); pln(var1, var2...); }

// Prints arbitrary values and goes to next line ONLY IF IN DEBUG MODE
template <class T1, class... T2>
constexpr void debug(const T1& var1, const T2& ... var2) { if (!DEBUG) return;  cout << " debug : [ "; pln(var1, var2...); }





using ll = long long;
using ull = unsigned long long;


#define all(x) begin(x), end(x)

const bool MULTIPLE_TEST_CASES = 0;


void exec() 
{
	int d, t, s;
	cin >> d >> t >> s;

	if (s * t >= d) cout << "Yes";
	else cout << "No";
}

















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

	if (!MULTIPLE_TEST_CASES)
		exec();
	else {
		int n;
		cin >> n;

		while (n--)
			exec();
	}

    return 0;
}

Measured memory_bytes: 3560
n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))

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

using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/

#define ull            unsigned long long
#define ll             long long
#define vi             vector<int>
#define pb             push_back
#define mp             make_pair
#define pii            pair<int,int>
#define vit            vector<int> :: iterator
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second

#define what_is(x)     cerr << #x << " is " << x << endl;

///*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout << endl ;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

int dx[8] = {1, 0, -1, 0, -1, -1, 1, 1};
int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
int ini()
{
    int x;
    scanf("%d", &x);
    return x;
}
long long inl()
{
    long long x;
    scanf("%lld", &x);
    return x;
}

const int N = (int) 150;
const ll inf = (ll) 1e18 + 7;
const double pi = 2 * acos(0.0);

int main()
{
    int n;
    ll W;
    n = ini(), W = inl();

    std::vector<int> w(n+2),v(n+2);
    int sum_val=0;
    for (int i = 1; i <= n; i++)
    {
        cin >> w[i] >> v[i];
        sum_val+=v[i];
    }
    std::vector<ll> dp(sum_val + 2,inf);

    dp[0] = 0;                                                                                                 
    for (int i = 1; i <= n; i++) {
        for (int j = sum_val - v[i]; j >= 0; j--) {
                dp[j+v[i]] = min(dp[j + v[i]], dp[j]+w[i]);
        }
    }
    int ans=0;
    for(int i=0;i<=sum_val;++i){
      //  error(i,dp[i]);
        if(dp[i]<=W){
            ans = i;
        }
    }

    cout << ans << endl;
    return 0;
}









Measured memory_bytes: 4080
//解説見た
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int main() {
    int n,k; cin >> n >> k;
    int v[50];
    rep(i,n) cin >> v[i];
    int ans = 0;
    rep(a, min(n,k)+1) {
        rep(b, min(n,k)-a+1) {
            int va = 0;
            vector<int> stone;
            for (int i=0; i<a; i++) {
                stone.push_back(v[i]);
                va += v[i];
            }
            for (int i=n-1; i>n-b-1; i--) {
                stone.push_back(v[i]);
                va += v[i];
            }
            sort(stone.begin(), stone.end());
            int s = stone.size();
            rep(i, min(k-(a+b), s ) ) {
                if (stone[i] >= 0) break;
                va -= stone[i];
            }
            ans = max(ans,va);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
  int n;
  cin>>n;
  vector<int> dp(3);
  for (int day = 0; day < n; day++)
  {
    vector<int> ne(3,0);
    vector<int> temp(3);
    cin>>temp[0]>>temp[1]>>temp[2];

    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
        if(i!=j){
          ne[j] = max(ne[j],dp[i]+temp[j]);
        }
      }
    }
    dp=ne;
  }
  cout<<max({dp[0],dp[1],dp[2]})<<endl;
}

Measured memory_bytes: 256
import math

K = int(input())

S=0

for a in range(1,K+1):
    p=a
    for b in range(p+1,K+1):
        q=b
        for c in range(q+1,K+1):
            g=math.gcd(a,b)
            g=math.gcd(g,c)
            S=S+6*g
for a in range(1,K+1):
    p=a
    for b in range(p+1,K+1):
        g=math.gcd(a,b)
        S=S+6*g
for a in range(1,K+1):
    S=S+a
print(S)

Measured memory_bytes: 9140
/*
   AUTHOR :- Gaurang_Kothiya
   
   Quote:-" Great things never come from comfort zones."                                                                                                                
*/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#include <bitset>
#include <cstdint>
#include <initializer_list>
 
using namespace std;
using namespace __gnu_pbds;  

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> data_set; 
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long  
#define ld long double
#define f(i,x,n) for(ll i=x;i<=n;i++)
#define fe(x,v)   for(auto &x :v)
#define nf(i,x,n) for(ll i=n;i>=x;i--)
#define all(a)   a.begin(),a.end()
#define b_s(a,b)   binary_search( all(a),b)
#define lb(v,n)  lower_bound(all(v) ,n )
#define ub(v,n)  upper_bound( all(v) , n)
#define gcd(a,b) __gcd(a,b)
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define B begin()
#define E end()
#define acc(v, x) accumulate(all(v), x)
#define p(a,b) pair<a,b>
#define F first
#define S second
#define sz size()
#define v(x) vector<x>
#define m(a,b) map<a,b>
#define u_m(a,b) unordered_map<a,b>
#define mm(a,b) multimap<a,b>
#define s(a) set<a>
#define us(a) unordered_set<a>
#define ms(a) multiset<a>
#define maxy __LONG_LONG_MAX__
#define miny INT_MIN
#define PI 3.14159265358979323846
#define MOD 1000000007



void Solve()
{
	int n;
	cin>>n;
	ll sum=0;
	f(i,1,n)
	{
		f(j,1,n)
		{
			f(k,1,n)
			{
				sum += gcd(i,gcd(j,k));
			}
		}
	}
	cout<<sum;
}


signed main() 
{
	speed		
		
	ll q=1;	
	//cin>>q;	
	
	while(q--)	
	Solve();	
	
	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}

 
 

Measured memory_bytes: 3640
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

S = input()
T = input()

flag = True
for i in range(len(S)):
    if S[i] != T[i]:
        flag = False

YesNo(flag)


Measured memory_bytes: 67204
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }

vec<int> memo;

int rec(int N) {
	if (memo[N] != -1)return memo[N];
	if (N == 0) return 0;
	int res = N;
	for (int i = 6; i <= N; i *= 6) {
		if (N - i < 0)continue;
		res = min(res, rec(N - i) + 1);
	}
	for (int i = 9; i <= N; i *= 9) {
		if (N - i < 0)continue;
		res = min(res, rec(N - i) + 1);
	}
	return memo[N] = res;
}

int main(void) {
	int N;
	cin >> N;
	memo.resize(N + 1, -1);
	cout << rec(N) << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  vector<int> rgb={0,0,0};
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='R')
      rgb.at(0)++;
    if(s.at(i)=='G')
      rgb.at(1)++;
    if(s.at(i)=='B')
      rgb.at(2)++;
  }
  int64_t m=0;
  for(int i=0;i<s.size();i++)
    for(int j=1;i+j*2<s.size();j++)
      if(s.at(i)!=s.at(i+j)&&s.at(i+j)!=s.at(i+j*2)&&s.at(i+j*2)!=s.at(i))
        m++;
  cout<<(int64_t)rgb.at(0)*rgb.at(1)*rgb.at(2)-m<<endl;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define def(x) cerr << #x << " is " << x << endl;
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(a) a.begin(),a.end()
const int NUM = 2e5 + 5;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
int main(){
    ios
    int num_tests=1; 
    //cin>>num_tests;
    while(num_tests-->0){
       int h1,m1,h2,m2,k; cin>>h1>>m1>>h2>>m2>>k;
       int min = h2-h1;
       min*=60;
       min+=(m2-m1);
       cout<<min-k;
    }   
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int cc=n*100/108;
if((int)(cc*(1.08))==n)
cout<<cc;
else if((int)((cc+1)*(1.08))==n)
cout<<cc+1;
else
cout<<":(";
}


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


using namespace std;

int main()
{
    int a,b,c,x;

    cin>>a>>b>>c;

    x=a-b;

    if(x<=c){
        cout<<c-x<<endl;
    }
    else if(x>c){
        cout<<"0"<<endl;

    }
    else{
        cout<<c<<endl;
    }

    return 0;
}


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

template<typename T_char>
T_char ToUpper(T_char cX){return toupper(cX);}

int main(){
  ll n, a, b; cin >> n >> a >> b;
  ll dis = b-a;

  ll res = min(a-1, n-b);

  if(dis>1 && dis%2==0){
    cout << dis/2 << endl;
    return 0;
  }
  else{
    cout <<  res + 1 + (dis-1)/2 << endl;
  }

}

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

using namespace std;

using ll = long long;

const ll INF = 1e18L + 5;

void min_self(ll &a, ll b) {
	a = min(a, b);
}


int main() {
	int n, W;
	scanf("%d%d", &n, &W);
	vector<int> weight(n);
	vector<int> value(n);

	for(int i = 0; i < n; i++) {
		scanf("%d %d", &weight[i], &value[i]);
	}

	int sum_total = 0;

	for(int x:value)  sum_total += x;

	vector<ll> dp(sum_total+1, INF);

	dp[0] = 0;
	for(int item = 0; item < n; item++) {
		for(int value_already = sum_total - value[item]; value_already >= 0; value_already--)
			min_self(dp[value_already + value[item]], dp[value_already] + weight[item]);
	}

	ll answer = 0;

	for(int i = 0; i <= sum_total; ++i) {
//		printf("%d ", dp[i]);
		if(dp[i] <= W)
			answer = max(answer, (ll) i);
	}
	printf("%lld\n", answer);
	return 0;
}


Measured memory_bytes: 1024
#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 N, K;
  cin >> N >> K;
  vector<ll> as(N);
  ll index;
  rep(i, N) {
    cin >> as[i];
    if (as[i] == 1) index = i;
  }

  ll ans = (N-1)/(K-1);
  if ((N-1)%(K-1)) ans++;
  cout << ans << endl;
  
}


Measured memory_bytes: 1024
s = input()
if s == 'SUN':
    print(7)
elif s == 'SAT':
    print(1)
elif s == 'MON':
    print(6)
elif s == 'TUE':
    print(5)
elif s == 'WED':
    print(4)
elif s == 'THU':
    print(3)
elif s == 'FRI':
    print(2)


Measured memory_bytes: 2940
n = int(input()); arr = [list(map(int,input().split())) for _ in range(n-1)]
graph = [[] for _ in range(n)]
for a,b in arr:
    graph[a-1].append(b-1);graph[b-1].append(a-1)

mod = 10**9+7
fac = [1]*(n+1)
inv = [1]*(n+1)
ifac = [1]*(n+1)
for i in range(2,n+1):
    fac[i] = fac[i-1] * i % mod
    inv[i] = (- (mod//i)*inv[(mod%i)]) % mod
    ifac[i] = ifac[i-1] * inv[i] % mod

parents = [-1]*n
children = [[] for _ in range(n)]
orders = []
stack = [0]
flags = [True] * n; flags[0] = False
while stack:
    tmp = stack.pop()
    orders.append(tmp)
    for node in graph[tmp]:
        if flags[node]:
            flags[node] = False
            children[tmp].append(node)
            stack.append(node)
            parents[node] = tmp

size = [1] * (n+1)
dp = [1] * (n+1)    
for child in orders[::-1]:
    parent = parents[child]
    size[parent] += size[child]
    dp[child] = dp[child] * fac[size[child]-1] % mod
    dp[parent] = dp[parent] * dp[child] * ifac[size[child]] % mod
_ = size.pop();_ = dp.pop()

size2 = [n-i+1 for i in size]
dp2 = [1] * n
for parent in orders[1:]:
    child = parents[parent]
    dp2[parent] = dp2[parent] * fac[size2[parent]-2] * dp2[child] * ifac[size2[child]-1] * dp[child] * ifac[size[child]-1] * pow(dp[parent], mod-2, mod) * fac[size[parent]] % mod

for i in range(n):
    print(fac[n-1]*dp[i]*ifac[size[i]-1]*dp2[i]*ifac[size2[i]-1] % mod)

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

int main(){
	int n;
	cin >> n;
	
	string s;
	cin >> s;
	
	if(n%2 == 1){
		cout << "No" << endl;
	} else {
		for(int i = 0; i < n/2; i++){
			if(s[i] == s[n/2 + i]){
				continue;
			} else {
				cout << "No" << endl;
				return 0;
			}
		}
		
		cout << "Yes" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

template< typename T, typename Compare = greater< T > >
vector< T > knapsack_limitations(const vl &w, const vl &m, const vector< T > &v,
                                 const ll &W, const T &NG, const Compare &comp = Compare()) {
    const ll N = (ll) w.size();
    vector< T > dp(W + 1, NG), deqv(W + 1);
    dp[0] = T();
    vl deq(W + 1);
    rep(i,N){
        rep(a,w[i]){
            ll s = 0, t = 0;
            for(ll j = 0; w[i] * j + a <= W; j++) {
                if(dp[w[i] * j + a] != NG) {
                    auto val = dp[w[i] * j + a] - j * v[i];
                    while(s < t && comp(val, deqv[t - 1])) --t;
                    deq[t] = j;
                    deqv[t++] = val;
                }
                if(s < t) {
                    dp[j * w[i] + a] = deqv[s] + j * v[i];
                    if(deq[s] == j - m[i]) ++s;
                }
            }
        }
    }
    return dp;
}

signed main() {
    ll N, W;
    cin >> N >> W;
    vl v(N), w(N), m(N);
    rep(i,N){
        cin >> w[i] >> v[i];
        m[i]=1;
    }
    auto ret = knapsack_limitations(w, m, v, W, -1LL);
    cout << *max_element(begin(ret), end(ret)) << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main(void){
  bool flag = true;
  int i = 0;
  while (flag)
  {
    int io_case;
    cin >> io_case;
    i++;
    if (io_case == 0)
    {
      flag = false;
      break;
    }

    cout << "Case " << i << ": " << io_case << "\n";
  }
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define int long long
#define s second
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int>> ppi;
typedef vector<vector<int>> mat;
const ll mod = 1e9+7;
const ll cfmod = 998244353;
const int MAXN = 5 * 1e5+5;

int a, b, c, n, k;
string s1, s2;

int32_t main() {
	char d;
	cin >> d;
	d++;
	cout << char(d) << endl;
	
}


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

typedef struct {
    int x;
    int y;
    int r;
} WALL;

// 内積
#define dotProduct(x1, y1, x2, y2) (( x1 * x2 ) + ( y1 * y2 ))
// 円の中に点があるかどうか
#define inCircle(x1, y1, c) (pow(c.x - x1, 2) + pow(c.y - y1, 2) < c.r * c.r ? 1 : 0)

int judge(WALL w, int tx, int ty, int sx, int sy) {
    //V : 線分始点から終点へのベクトル
    //C : 線分始点から円中心へのベクトル
    int Vx = tx - sx;
    int Vy = ty - sy;
    int Cx = w.x - sx;
    int Cy = w.y - sy;
    int n1, n2, n3;

    int in_t = inCircle(tx, ty, w);
    int in_s = inCircle(sx, sy, w);

    if (in_t && in_s)
	return 0;

    if (in_t || in_s)
	return 1;

    //二つのベクトルの内積を求める
    n1 = dotProduct(Vx, Vy, Cx, Cy);
    n2 = dotProduct(Vx, Vy, Vx, Vy);
    n3 = dotProduct(Cx, Cy, Cx, Cy);

    if (n1 < 0 || n1 > n2) 
	return 0;
    return (n3 - (n1 * n1 / n2) <= pow(w.r, 2)) ? 1 : 0;
}




int main(void) {
    int n;

    while (scanf("%d", &n), n) {
	int i, m;
        WALL w[100];
        for (i = 0; i < n; i++) {
	    scanf("%d%d%d", &w[i].x, &w[i].y, &w[i].r);
	}
	scanf("%d", &m);
        for(i=0; i < m; i++){
            int j, safe = 0;
            int tx, ty, sx, sy;
            scanf("%d%d%d%d", &tx, &ty, &sx, &sy);
 
            for(j = 0 ; j < n; j++)
                if (judge(w[j], tx, ty, sx, sy) == 1) {
                    safe = 1;
                    break;
                }
 
            if (safe)
                printf("Safe\n");
            else
                printf("Danger\n");
        }
    }
 
    return 0;
}

Measured memory_bytes: 580
def m(a, b):
    if a > b:
        a, b = b, a
    while b % a:
        a, b = b % a, a
    return a


N = int(input())
A = list(map(int, input().split()))

if N == 2:
    print(max(A))
else:
    AF = [1] * (N - 1)
    AB = [1] * (N - 1)

    AF[0] = A[0]
    AB[0] = A[-1]

    for i in range(1, N - 1):
        AF[i] = m(AF[i - 1], A[i])
        AB[i] = m(AB[i - 1], A[- (i + 1)])
    L = max(AF[-1], AB[-1], max([m(AF[i], AB[N - 3 - i]) for i in range(N - 2)]))

    print(L)


Measured memory_bytes: 14052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    string s,t;
    cin >> n >> s >> t;
    rep(i,n)
    {
        cout << s[i] << t[i];
    }
    cout << endl;
    
}




Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int n , buf , First = 0 , Second = 0 , Third = 0;
	for(n=1;n<=10;n++){
		scanf("%d" , &buf);
		if(buf>=First){
			Third = Second;
			Second = First;
			First = buf;
		}else if(buf>=Second){
			Third = Second;
			Second = buf;
		}else if(buf>Third){
			Third = buf;
		}
	}
	printf("%d\n%d\n%d\n" , First , Second , Third);
	return 0;
}

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

def solve(K: int):
    result = 0
    for a in range(1, K+1):
        for b in range(1, K+1):
            if math.gcd(a, b) == 1:
                result += K
                continue
            for c in range(1, K+1):
                result += math.gcd(a, math.gcd(b, c))
    print(result)

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

if __name__ == '__main__':
    main()


Measured memory_bytes: 68016
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n;
    cin >> n;
    map<int,int>ma;
    ll ans =0;
    for(int j=0;j<n;j++){
        int z;
        cin >> z;
        int value = j-z;
        if(ma.count(value)){
            ans+=ma.at(value);
        }
        ma[j+z]++;
    }
    cout <<ans<<endl;
}
    



Measured memory_bytes: 12976
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    string s; cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (i%2 == 0) {
            cout << s[i];
        }
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 512
s = input()
t = input()
x = len(s)
n = 0
if s == t:
    n = 1
else:
    for i in range(x):
        s = s[-1] + s[:-1]
        if s == t:
            n = 1
 
if n == 0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

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

signed main() {
  int n,now,sum=0;
  cin >> n;
  Vi a(n+2);
  a[0] = 0;
  
  rep(i,0,n){
    cin >> a[i+1];
    sum += abs(a[i]-a[i+1]);
  }
  a[n+1] = 0;
  sum += abs(a[n]);
  
  rep(i,1,n+1){
    now = sum;
    now -= abs(a[i-1]-a[i]);
    now -= abs(a[i+1]-a[i]);
    now += abs(a[i+1]-a[i-1]);
    cout << now << endl;
  }
}


Measured memory_bytes: 2048
#include<stdio.h>
#include<string.h>
int main()
{
    int N,i,e;
    scanf("%d", &N);
    char s[N];
    scanf("%s", s);
    e=N/2;
    if(N%2!=0){
        printf("No\n");
    }
    else{
        for(i=0;i<e;i++){
            if(s[i]==s[i+e]){
                continue;
            }
            else{
                break;
            }
       }

       if(i==e){
           printf("Yes\n");
       }
       else{
           printf("No\n");
       }
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
	int r,D,x; cin >> r >> D >> x;
	int ans = x;
	rep(i,10){
		ans *= r;
		ans -= D;
		cout << ans << endl;
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    ll arra[a]={0};
    ll arrb[b]={0};
    ll arrc[c]={0};
    
    for(ll i=0;i<a;i++)
    {
        cin>>arra[i];
    }
    for(ll i=0;i<b;i++)
    {
        cin>>arrb[i];
    }
    for(ll i=0;i<c;i++)
    {
        cin>>arrc[i];
    }
    ll hash[x+y+c]={0};
    sort(arra,arra+a);
    sort(arrb,arrb+b);
    ll j=0;
    for(ll i=a-1;i>a-1-x;i--)
    {
        hash[j]=arra[i];
        j++;
    }
    for(ll i=b-1;i>b-1-y;i--)
    {
        hash[j]=arrb[i];
        j++;
    }
    for(ll i=0;i<c;i++)
    {
        hash[j]=arrc[i];
        j++;
    }
    ll sum=0;
    ll l=x+y+c;
    sort(hash,hash+l);
    for(ll i=c;i<x+y+c;i++)
    {
      sum+=hash[i];
    }
    cout<<sum<<endl;
    
    
    return 0;
}


Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define endl "\n"
using namespace std;

int main()
{
 	int n,d;
 	cin>>n>>d;
 	int c=0;
 	for(int i=0;i<n;i++)
 	{
 		int x,y;cin>>x>>y;
 		if(sqrt(pow(x,2)+pow(y,2))<=d) ++c;
	 }
	 cout<<c;
return 0;
}




Measured memory_bytes: 3624
s = input()
sd = int(s)
sl = len(s)
ans = 0
if sl == 1:
    ans += sd
if sl == 2:
    ans += 9
if sl == 3:
    ans += sd - 99 + 9
if sl == 4:
    ans += 900 + 9
if sl == 5:
    ans += sd - 9999 + 900 + 9
if sl == 6:
    ans += 90000 + 900 + 9


print(ans)


Measured memory_bytes: 3060