akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define in (void)scanf
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
//#define Rep(i,a,n)for(LL i=(LL)(a);i<(LL)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Repp(i,l,r,k)for(int i=(int)(l);i<(int)(r);i+=(int)(k))
//#define Repp(i,l,r,k)for(LL i=(LL)(l);i<(LL)(r);i+=(LL)(k))
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define MOD 1000000007//998244353,1000000007,1000000009,4999999999999997
int upi(const void* a, const void* b) { return*(int*)a<*(int*)b ? -1 : *(int*)a> * (int*)b ? 1 : 0; }
int downi(const void* a, const void* b) { return*(int*)a<*(int*)b ? 1 : *(int*)a> * (int*)b ? -1 : 0; }
void sortupi(int* a, int n) { qsort(a, n, sizeof(int), upi); } //1,2,3,4,...
void sortdowni(int* a, int n) { qsort(a, n, sizeof(int), downi); }
int upLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? -1 : *(LL*)a> * (LL*)b ? 1 : 0; }
int downLL(const void* a, const void* b) { return*(LL*)a<*(LL*)b ? 1 : *(LL*)a> * (LL*)b ? -1 : 0; }
void sortupLL(LL* a, int n) { qsort(a, n, sizeof(LL), upLL); }
void sortdownLL(LL* a, int n) { qsort(a, n, sizeof(LL), downLL); }
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; } // a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); } // aaa,aab
LL gcd(LL p, LL q) { while (q) { LL t = p % q; p = q; q = t; }return p; }
LL modpow(LL a,LL n,int m){LL x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
#define invmodpow(b,p)modpow(b,p-2,p)// a/b≡a*b^{-1}(mod p)...return b^{-1}(mod p)
//typedef struct fac { LL n, exp; }F;
//LL fact(LL n,F*a){LL x=n,i,j,c=0;for(i=2;i*i<=x;i++){for(j=1;x%i==0;j++)x/=i;if(j>1){a[c].n=i;a[c++].exp=j-1;}}if(x-1){a[c].n=x;a[c++].exp=1;}return c;}
LL nibtan(LL* a,LL n,LL x){LL p=0,q=n/2,r=n-1;while(r-p>1){if(x>=a[q])p=q;if(x<=a[q])r=q;q=(p+r)/2;}return a[p]==x?p:r;}
//snippet

#define N 300009

void run(void) {
	int n, x, t;
	in("%d%d%d", &n, &x, &t);
	printf("%d", (int)ceill((Lf)n / (Lf)x) * t);
}

int main(void) {
	int test = 1;
//	in("%d", &test);
	while (test--) {
		run();
		fflush(stdout);
	}
	return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.at(0)==s.at(1)||s.at(1)==s.at(2)||s.at(2)==s.at(3)){
    cout<<"Bad"<<endl;
  }
  else{
    cout<<"Good"<<endl;
  }
}


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

typedef unsigned long long ll;
typedef std::pair<int, int> P;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define All(i, x) for(typeof(x.begin()) i = x.begin(); i != x.end(); i++)
#define ReAll(i, x) for(typeof(x.end()) i = x.end(); i != x.begin(); i--)
#define pb push_back

const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int MAX = 100000;
const int INF = 1e9;
const int MOD = 1000000007;
const string END = "\n";

void solve(){
	int n, t;
	cin >> n >> t;
	bool flag = false;
	int ans = INF;
	Rep(i, n){
		int a, b;
		cin >> a >> b;
		if(b <= t){
			ans = min(a, ans);
			flag = true;
		}
	}
	if(flag){
		cout << ans << END;
	}else{
		cout << "TLE" << END;
	}
}

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


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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

int main(){
    int n;
    cin>>n;
    vector<int>a1(n),a2(n),A1(n),A2(n);

    rep(i,n)cin>>a1[i];
    rep(i,n)cin>>a2[i];

    A1[0]=a1[0];
    A2[n-1]=a2[n-1];


    rep2(i,1,n-1)A1[i]=a1[i]+A1[i-1];
    repr(i,n-2,0)A2[i]=a2[i]+A2[i+1];

    int ans=0;

    rep(i,n)ans=max(ans,A1[i]+A2[i]);

    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
 
template <class T> using V = vector<T>;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll a,b,c;
  	ci(a>>b>>c);
  if(a<=c&&c<=b) co("Yes")
    else co("No")
    }

Measured memory_bytes: 256
r,c = [int(x) for x in input().split()]
sheet =[[int(x) for x in input().split()] for y in range(r)]
col_sum = [0]*c
for i in sheet:
    print(" ".join(map(str,i))+" "+str(sum(i)))
    for j in range(c):
        col_sum[j] += i[j]

print(" ".join(map(str,col_sum))+" "+str(sum(col_sum)))

Measured memory_bytes: 7784
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int A = sc.nextInt();
			final int B = sc.nextInt();
			final int C = sc.nextInt();
			
			System.out.println(Math.max(0, C - Math.max(0, A - B)));
			
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 23124
#from queue import Queue

inf = 10 ** 20

def bfs(H, W, s):
    d = [[inf for i in range(W)] for j in range(H)]
    q = []

    d[0][0] = 1
    q.append([0, 0])

    dx = (0, -1, 1, 0)
    dy = (-1, 0, 0, 1)

    while q:
        p = q.pop()
        x, y = p[0], p[1]
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if(nx >= 0 and nx < H and ny >= 0 and ny < W):
                if(s[nx][ny] == '.' and d[x][y] + 1 < d[nx][ny]):
                    d[nx][ny] = d[x][y] + 1
                    q.append([nx, ny])

    return d[H-1][W-1]

H, W = map(int, input().split())
s = []
wnum = 0
for i in range(H):
    s.append(input())
    for j in range(W):
        if(s[i][j] == "."):
            wnum += 1
d = bfs(H, W, s)
if(d == inf):
    print("-1")
else:
    print(wnum - d)


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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define x first
#define y second
#define pb push_back

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

const int N = 2e6 + 1;
const int INF = 1e9 + 9;
const int B = 1e9 + 7;

string slow(string s) {
    vi id(s.size());
    int ca = 0, cb = 0;
    forn(i, 0, s.size() - 1) {
        if (s[i] == 'a') id[i] = ca++;
        if (s[i] == 'b') id[i] = cb++;
    }
    string ans;
    forn(mask, 0, (1 << s.size()) - 1) {
        vi cnt(s.size() / 2);
        string cur;
        forn(i, 0, s.size() - 1)
            if (mask & (1 << i))
                ++cnt[id[i]], cur.pb(s[i]);
        bool shit = 0;
        for (auto x : cnt)
            if (x == 1) shit = 1;
        if (shit) continue;
        ans = max(ans, cur);
    }
    cerr << "opt = " << ans << "\n";
    return ans;
}

int n, a[N];
int bal[N];
string str[N], sx[N];

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    forn(i, 1, n * 2)
        bal[i] = 0, str[i] = sx[i] = "";
    string given;
    int ga = n, gb = n;
    forn(i, 1, n * 2) {
        char c;
//        c = rand() % 2 + 'a';
//        if (ga == 0) c = 'b';
//        if (gb == 0) c = 'a';
//        if (c == 'a') --ga;
//        if (c == 'b') --gb;
        cin >> c;
        given.pb(c);
        a[i] = c - 'a';
    }

    vi p, s;
    int b = 0;
    p.pb(1);
    int lst = -1;
    forn(i, 1, n * 2) {
        bal[i] = bal[i - 1] + (a[i] ? 1 : -1);
        if (bal[i] == 0) {
            if (a[i] == 0) lst = s.size();
            s.pb(a[i] ? -1 : 1);
            p.pb(i + 1);
        }
    }

    string ans;
    forn(i, 0, p.size() - 2) {
        if (s[i] == 1) {
            string cans;
            string cur;
            for1(j, p[i + 1] - 1, p[i]) {
                cur = string(1, 'a' + a[j]) + cur;
                cans = max(cans, string(bal[j - 1], 'b') + cur);
            }
            str[i] = cans;
        }
        else {
            string cur;
            vi pa, pb;
            forn(j, p[i], p[i + 1] - 1) {
                if (!a[j]) pa.pb(j);
                if (a[j]) pb.pb(j);
            }
            int prv = 0;
            forn(i, 0, pa.size() - 1)
                if (pa[i] > prv)
                    cur = cur + "ab", prv = pb[i];
            str[i] = cur;
        }
    }
    for1(i, p.size() - 2, 0)
        sx[i] = max(sx[i + 1], str[i]);
    forn(i, 0, p.size() - 2)
        if (s[i] == 1 && str[i] == sx[i])
            ans = ans + str[i];
    forn(i, 0, p.size() - 2)
        if (i > lst && s[i] == -1)
            ans = ans + str[i];
    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 35328
#include <stdio.h>

int main(void){
    long long int n;
    scanf("%lld",&n);
    long long int a;
    scanf("%llu",&a);
    long long int ans = a;
    long long int ai[n-1];
    long long int i=0;
    if(ans == 0) {
        printf("0\n");
        return 0;
    }
    for(i = 0;i<n-1;i++){
        scanf("%llu",&ai[i]);
        if(ai[i] == 0) {
            printf("0\n");
            return 0;
        }
        if(ai[i] > 1000000000000000000){
            printf("-1\n");
            return 0;           
        }
    }

    for(i = 0;i<n-1;i++){
        if(ans>(ans*ai[i])){
            printf("-1\n");
            return 0;
        }
        ans *= ai[i];
        if(ans>1000000000000000000) {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 2508
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <tuple>
#include <math.h>
#include <set>
#include <map>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
using vb = vector<bool> ;
using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end() 
const ll INF = 1e18 ;
const ll mod = 1e9+7 ;
const double pie = acos(-1); 
vll dx4 = {-1,0,1,0} ;
vll dy4 = {0,-1,0,1} ;
vll dx8 = {-1,0,1,1,1,0,-1,-1} ;
vll dy8 = {-1,-1,-1,0,1,1,1,0} ; 

void fix_cout(){cout << fixed << setprecision(20) ; }
ll gcd(ll a,ll b){if(b==0) return a ; return gcd(b,a%b) ; }
ll lcm(ll a,ll b){return a/gcd(a,b)*b ; }
void chmax(ll &a,ll b){if(a<b) a = b ; }
void chmin(ll &a,ll b){if(a>b) a = b ; }

int main(){
	ll n ; cin >> n ;
	ll m ; cin >> m ;
	vll a(n) ;
	for(int i=0;i<n;i++){
		cin >> a.at(i) ;
	}
	for(int i=1;i<n;i++){
		if(a.at(i)+a.at(i-1)>=m){
			cout << "Possible\n" ;
			for(int j=1;j<=i-1;j++) cout << j << endl ;
			for(int j=n-1;j>=i+1;j--) cout << j << endl ;
			cout << i << endl ;
			return 0 ;
		}
	}
	cout << "Impossible\n" ;
}




Measured memory_bytes: 1664
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
//typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	vi t=in;
	sort(all(t));
	int a=t[n/2-1],b=t[n/2];
	rep(i,n){
		if(in[i]<=a)cout<<b<<endl;
		else cout<<a<<endl;
	}
}












Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define INF 987654321
#define N 1000050
using namespace std;
struct A{
    int num,lef,rig;
} s[N];
vector<int> V[N];
int n,m,ai[N],bi[N],visit[N],visit2[N];
void dfs(int from)
{
    int to,i,st,ed;
    st=-INF;
    ed=INF;
    visit[from]=1;
    for(i=0;i<V[from].size();i++){
        to=V[from][i];
        if(visit[to]==1)
            continue;
        dfs(to);
        if(s[to].rig!=INF){

            if(ed!=INF && (st-s[to].rig)%2==0){
                printf("No");
                exit(0);
            }
            if((ed<s[to].lef-1 || s[to].rig+1<st)){
                printf("No");
                exit(0);
            }
            st=max(st,s[to].lef-1);
            ed=min(ed,s[to].rig+1);
        }
    }
    if(s[from].num!=INF){
        if(st<=s[from].num && s[from].num<=ed){
            s[from].lef=s[from].num;
            s[from].rig=s[from].num;
        }
        else{
            printf("No");
            exit(0);
        }
    }
    else{
        s[from].lef=st;
        s[from].rig=ed;
    }
}
void dfs2(int from,int num)
{
    int i,to;
    visit2[from]=1;
    if(s[from].lef<=num-1 && num-1<=s[from].rig){
        s[from].num=num-1;
    }
    else
        s[from].num=num+1;
    for(i=0;i<V[from].size();i++){
        to=V[from][i];
        if(visit2[to]==0){
            dfs2(to,s[from].num);
        }
    }
}
int main()
{
  //  freopen("input.txt","r",stdin);
    scanf("%d",&n);
    int i,v,p;
    for(i=1;i<n;i++){
        scanf("%d%d",&ai[i],&bi[i]);
        s[i].lef=-INF;
        s[i].rig=s[i].num=INF;
        V[ai[i]].push_back(bi[i]);
        V[bi[i]].push_back(ai[i]);
    }
    s[n].lef=-INF;
    s[n].rig=s[n].num=INF;
    scanf("%d",&m);
    for(i=1;i<=m;i++){
        scanf("%d%d",&v,&p);
        s[v].lef=p;
        s[v].rig=p;
        s[v].num=p;
    }
    dfs(1);
    dfs2(1,s[1].rig==INF ? 0: s[1].rig+1);
    printf("Yes\n");
    for(i=1;i<=n;i++)
        printf("%d\n",s[i].num);
}


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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n; cin >> n;
    cout << (n - 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ff first
#define ss second
#define INF (ll) 1e9
#define tt ll testcase; cin>>testcase; while(testcase--)
 
int main(){
	fast;
	int n;
	cin >> n;
	int h[n+1]={0};
	for(int i = 1; i <= n; i++){
		cin >> h[i];
	}
	int dp[n+1];
	dp[0] = dp[1] = 0;
	dp[2] = abs(h[2]-h[1]);
	for(int i = 3; i <= n; i++){
		dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
	}
	cout<<dp[n];
}

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

int main() {
	int a, b, c, k;
	scanf("%d%d%d%d", &a, &b, &c, &k);
	
	int ans = 0;
	if(k<=a) ans = k;
	else
	if(k<=a+b) ans = a;
	else ans = a - (k-a-b);
	
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 3772
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define NP next_permutation
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;

template<class T> bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T> void decimal(T a){cout<<fixed<<setprecision(a);}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}

void YesNo(bool a){if(a) out("Yes"); else out("No");}
void yesno(bool a){if(a) out("yes"); else out("no");}
void YESNO(bool a){if(a) out("YES"); else out("NO");}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){ll c=1; while(b>0){if(b&1){c=a*c %mod;}a=a*a %mod;b>>=1;}return c;}
vi calc(ll x){vi res; while(x>0){res.eb(x%10);x/=10;}reverse(all(res)); return res;}

void solve() {
  int k;
  cin>>k;
  vi a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  out(a[k-1]);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 256
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	LL h,w;
	cin>>h>>w;
	if(h>w) swap(h,w);
	if(h==1){
		cout<<1<<endl;
		return 0; 
	}
	LL f,t;
	f=(h+1)/2;
	t=h-f;
	cout<<(w/2)*h+(w%2)*f;
	return 0;
}


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

int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> deta(H+2,vector<char>(W+2));
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
        if(j==0){
            deta.at(i).at(j) = '#';
            cout << deta.at(i).at(j); 
        }
        else if(j==W+1){
          deta.at(i).at(j) = '#';
          cout << deta.at(i).at(j) << endl;
        }
        else if(i==0){
          deta.at(i).at(j) = '#';
          cout << deta.at(i).at(j);
        }
         else if(i==H+1){
          deta.at(i).at(j) = '#';
          cout << deta.at(i).at(j);
        }
        else{
          cin >> deta.at(i).at(j);
          cout << deta.at(i).at(j);
          }
        }
     }
   }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, m;std::cin >> n >> m;
  ll a;
  string b;
  vll ok(n+1, 0), pena(n+1, 0);
  re(i, m){
    std::cin >> a >> b;
    if(b=="AC") ok[a] = 1;
    else if(ok[a]==0) pena[a]++;
  }
  ll ac = 0, p = 0;
  re(i, n+1){
    if(ok[i]==1){
      ac++, p+=pena[i];
    }
  }
  std::cout << ac << " " << p << '\n';
  return 0;
}


Measured memory_bytes: 1792
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	n := len(s)

	boundary := make([]int, 0)
	for i := 0; i < n-1; i++ {
		if string(s[i]) == "L" && string(s[i+1]) == "R" {
			boundary = append(boundary, i)
		}
	}
	boundary = append(boundary, n-1)

	l := 0
	ans := make([]int, n)
	middle := 0
	for _, r := range boundary {
		tmp := []int{0, 0}
		for i := l; i < r+1; i++ {
			tmp[i%2] += 1
			if string(s[i]) == "R" && string(s[i+1]) == "L" {
				middle = i
			}
		}
		ans[middle] = tmp[middle%2]
		ans[middle+1] = tmp[1-middle%2]
		l = r + 1
	}

	a := make([]string, 0)
	for _, i := range ans {
		a = append(a, strconv.Itoa(i))
	}

	fmt.Println(strings.Join(a, " "))
}


Measured memory_bytes: 10880
// by syu
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	in := NewScanner(os.Stdin, 0)
	n, _ := in.Int(), in.Int()
	s := in.ArrayString(n)

	sort.Strings(s)
	fmt.Println(strings.Join(s, ""))
}

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if max <= 0 {
		max = 100000
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}

func (s *Scanner) String() string {
	s.Scan()
	return s.Text()
}

func (s *Scanner) UInt() uint64 {
	s.Scan()
	i, e := strconv.ParseUint(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) Double() float64 {
	s.Scan()
	i, e := strconv.ParseFloat(s.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) Float() float32 {
	return float32(s.Double())
}

func (s *Scanner) Int() int {
	return int(s.UInt())
}

func (s *Scanner) Int32() int32 {
	return int32(s.UInt())
}

func (s *Scanner) UInt32() uint32 {
	return uint32(s.UInt())
}

func (s *Scanner) ArrayString(n int) (r []string) {
	for i := 0; i < n; i++ {
		r = append(r, s.String())
	}
	return
}

func (s *Scanner) ArrayUInt(n int) (r []uint64) {
	for i := 0; i < n; i++ {
		r = append(r, s.UInt())
	}
	return
}

func (s *Scanner) ArrayInt(n int) (r []int) {
	for i := 0; i < n; i++ {
		r = append(r, s.Int())
	}
	return
}

func (s *Scanner) ArrayUInt32(n int) (r []uint32) {
	for i := 0; i < n; i++ {
		r = append(r, s.UInt32())
	}
	return
}

func (s *Scanner) ArrayInt32(n int) (r []int32) {
	for i := 0; i < n; i++ {
		r = append(r, s.Int32())
	}
	return
}

func (s *Scanner) ArrayDouble(n int) (r []float64) {
	for i := 0; i < n; i++ {
		r = append(r, s.Double())
	}
	return
}

func (s *Scanner) ArrayFloat(n int) (r []float32) {
	for i := 0; i < n; i++ {
		r = append(r, s.Float())
	}
	return
}

func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}

func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i + 1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}

func ArrayIntToArrayString(arr []int) (r []string) {
	for _, v := range arr {
		r = append(r, fmt.Sprintf("%d", v))
	}
	return
}

func ArrayStringToArrayInt(arr []string) (r []int) {
	for _, v := range arr {
		i, e := strconv.ParseInt(v, 10, 64)
		if e != nil {
			panic(e)
		}
		r = append(r, int(i))
	}
	return
}

func Sum(arr ...int) (sum int) {
	for _, x := range arr {
		sum += x
	}
	return
}

func Rappend(a int, arr []int) []int {
	return append(arr, a)
}

func AllInt(vs []int, f func(int) bool) bool {
	for _, v := range vs {
		if !f(v) {
			return false
		}
	}
	return true
}

func Abs(n int) int {
	y := n >> 63
	return (n ^ y) - y
}


Measured memory_bytes: 640
import java.util.Scanner;

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

    void solve(Scanner sc) {
        int n = sc.nextInt();
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            while (a % 2 == 0 && a >= 2) {
                count++;
                a /= 2;
            }
        }
        System.out.println(count);
    }
}

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

using namespace std;

vector<int> l;

int main() {
	int N;
	cin >> N;
        for (int i = 0; i < 2*N; ++i) {
            int t;
            cin >> t;
            l.push_back(t);
        }
        sort(l.begin(), l.end());
        int sum = 0;
        for (int i = 0; i < 2*N; i+=2) {
            sum+=l[i];
        }
        cout << sum << endl;
        return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <tuple>
#include <forward_list>
using namespace std;

bool comp0(tuple<int, int, int, string> lh, tuple<int, int, int, string> rh) {
	return get<0>(lh) < get<0>(rh);
}

bool comp2(tuple<int, int, int, string> lh, tuple<int, int, int, string> rh) {
	return get<2>(lh) < get<2>(rh);
}

int main() {
	int N, M, dummy;
	dummy = scanf("%d %d", &N, &M);

	// 入力順Index、県番号、生まれた年、表示する文字列
	vector<tuple<int, int, int, string>> vt;

	// 入力受付
	int tmp1, tmp2;
	for (int i = 0; i < M; i++) {
		dummy = scanf("%d %d", &tmp1, &tmp2);
		vt.push_back(make_tuple(i, tmp1, tmp2, ""));
	}

	// 生まれた年順に昇順ソート
	sort(vt.begin(), vt.end(), comp2);

	// 表示する文字列を生成
	auto itr = vt.begin();
	map<int, int> m;
	for (auto end = vt.end(); itr != end; itr++) {
		int ken = get<1>(*itr);
		m[ken]++;
		char ss[16];
		sprintf(ss, "%06d%06d", ken, m[ken]);
		get<3>(*itr) = ss;
	}

	// 入力順に昇順ソート（並び順を元に戻す）
	sort(vt.begin(), vt.end(), comp0);

	// 表示
	itr = vt.begin();
	for (auto end = vt.end(); itr != end; itr++) {
		printf("%s\n", get<3>(*itr).c_str());
	}

	return 0;
}


Measured memory_bytes: 13808
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

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

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

	ll ans = 0;

	for (int a = 1; a <= k; a++) {
		for (int b = 1; b <= k; b++) {
			for (int c = 1; c <= k; c++) {
				ans += gcd(gcd(a, b), c);
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

const int MAXN = 202;
const int MAXR = 1002;
const int INF = 1<<28;

int N, M;
int land[MAXN][MAXN], sea[MAXN][MAXN];
int R;
int Z[MAXR];

int dp[MAXR][MAXN];

void warshallFloyd(int n, int g[MAXN][MAXN]) {
  for(int k = 0; k < n; ++k) {
    for(int i = 0; i < n; ++i) {
      for(int j = 0; j < n; ++j) {
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }
}

int main() {
  while(cin >> N >> M && (N|M)) {
    for(int i = 0; i < MAXN; ++i) {
      for(int j = 0; j < MAXN; ++j) {
        land[i][j] = sea[i][j] = (i == j) ? 0 : INF;
      }
    }
    for(int i = 0; i < M; ++i) {
      int x, y, t;
      char sl;
      cin >> x >> y >> t >> sl;
      --x; --y;
      if(sl == 'L') {
        land[x][y] = land[y][x] = min(land[x][y], t);
      } else {
        sea[x][y] = sea[y][x] = min(sea[x][y], t);
      }
    }
    cin >> R;
    for(int i = 0; i < R; ++i) {
      cin >> Z[i];
      --Z[i];
    }

    warshallFloyd(N, land);
    warshallFloyd(N, sea);

    fill(dp[0], dp[MAXR], INF);
    dp[0][Z[0]] = 0;
    for(int i = 0; i+1 < R; ++i) {
      for(int j = 0; j < N; ++j) {
        if(dp[i][j] == INF) continue;
        int a = Z[i];
        int b = Z[i+1];
        dp[i+1][j] = min(dp[i+1][j], dp[i][j] + land[a][b]);
        for(int k = 0; k < N; ++k) {
          dp[i+1][k] = min(dp[i+1][k],
                           dp[i][j] + land[a][j] + sea[j][k] + land[k][b]);
        }
      }
    }

    int res = INF;
    for(int j = 0; j < N; ++j) {
      res = min(res, dp[R-1][j]);
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 2272
#include <stdio.h>
int main(void){
    long long n,a,b,ans=0;
    scanf("%lld%lld%lld",&n,&a,&b);
    long long x[n];
    for (int i=0; i<n; i++){
        scanf("%lld",&x[i]);
    }
    for (int i=0; i<n-1; i++){
        if ((x[i+1]-x[i])*a<b){
            ans+=(x[i+1]-x[i])*a;
        } else {
            ans+=b;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.ABC_125
{
    class A
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int[] abt = ReadInts();
            int cnt = abt[2] / abt[0];
            WriteLine(cnt * abt[1]);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
//#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

int N, T, A[3003],  B[3003], C[3003][6006], idx[3003];
int cmp(const void *a, const void *b){
	int i = *(int*)a, j = *(int*)b;
	if(A[i] < A[j])return -1;
	if(A[i] > A[j])return 1;
	return 0;
}
int main(){
	scanf("%d%d", &N, &T);
	for(int i=0; i<N; i++){
		scanf("%d%d", A+i, B+i);
		idx[i] = i;
	}
	qsort(idx, N, 4, cmp);
	for(int i=0; i<N; i++){
		for(int j=0; j<6000; j++)C[i+1][j] = C[i][j];
		for(int j=0; j<T; j++){
			C[i+1][j+A[idx[i]]] = max(C[i+1][j+A[idx[i]]], C[i][j] + B[idx[i]]);
		}
	}
	int ans = 0;
	for(int i=0; i<6000; i++)ans = max(ans, C[N][i]);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 72132
# 23:59
import copy
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_sort = copy.deepcopy(a)
a_sort.sort()
max = a_sort[n-1]
max_next = a_sort[n-2]
for i in range(n):
    if a[i] == max:
        print(max_next)
    else:
        print(max)


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

int main()
{
	int n;cin>>n;
	vector<int> l(n);
	for(int i=0;i<n;i++)cin>>l[i];
	int ans=0;
	sort(l.begin(),l.end(),greater<int>());
	for(int i=0;i<n;++i)
	{
		for(int j=i+1;j<n;++j)
		{
			for(int k=j+1;k<n;++k){
				if(l[i]<(l[j]+l[k]))ans++;
				//cout<<l[i]<<l[j]<<l[k]<<endl;
			}
		}
	}
	cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    sort(h,h+n);
    ll ans=0;
    for(int i=0;i<n-k;i++){
        ans+=h[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define F first
#define S second
#define PQ pq.top()
using namespace std;
int a,b,n,k,pas,pss,dd,pss1;
long long ans;
bool p=false;
bitset<100005>BIT;
priority_queue<pair<int,pair<int,int> > >pq;
int main()
{
	//freopen("subtask01-05.txt","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d %d",&a,&b),pq.push({-a,{0,i}}),pq.push({-b,{1,i}});
	for(int i=1;i<=n;i++)
	{
		if(i==n-1)dd=PQ.F;
		if(i==n)pas=PQ.F,pss=PQ.S.S;
		ans-=PQ.F;
		if(PQ.S.F==0)k++;
		if(BIT[PQ.S.S])p=true;
		BIT[PQ.S.S]=true;
		pq.pop();
	}
	if(k==0||k==n||p)
	{
		printf("%lld",ans);
	}
	else if(pss==PQ.S.S)
	{
		if(k==1&&PQ.S.F==0)
		{
			printf("%lld",ans+pas-PQ.F);
		}
		else if(k==n-1&&PQ.S.F==1)
		{
			printf("%lld",ans+pas-PQ.F);
		}
		else
		{
			pss1=PQ.F;
			//printf("%lld\n",ans+dd-PQ.F);
			pq.pop();
			printf("%lld",min(ans-pss1+dd,ans-PQ.F+pas));
		}
	}
	else
	{
		printf("%lld",ans+pas-PQ.F);
	}
}


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

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
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;}
constexpr int INF = 1e18;


signed main(){
	int N;
	cin >> N;
	vector<vector<int>>g(N);
	int ans = 0;
	REP(i, N) {
		ans += (i + 1) * (N - i);
	}
	REP(i, N - 1) {
		int a, b;
		cin >> a >> b;
		a--;b--;
		ans -= (min(a, b) + 1) * (N - max(a, b));
	}
	out(ans);
}

Measured memory_bytes: 8024
// 2011/06/22 Tazoe

#include <iostream>
using namespace std;

void hamming(bool is_hamming[], int n)
{
	for(int i=0; i<n; i++)
		is_hamming[i] = false;

	for(int i=1; i<n; i*=2)
		for(int j=i; j<n; j*=3)
			for(int k=j; k<n; k*=5)
				is_hamming[k] = true;
}

int main()
{
	bool is_hamming[1000001];
	hamming(is_hamming, 1000001);

	while(true){
		int m;
		cin >> m;
		if(m==0)
			break;
		int n;
		cin >> n;

		int cnt = 0;
		for(int i=m; i<=n; i++)
			if(is_hamming[i])
				cnt++;

		cout << cnt << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
#define ll long long 
#define rep(i,a,b) for(signed i=a;i<(b);++i)
#define erep(i,a,b) for(signed i=a;i<=(b);++i)
#define per(i,a,b) for(signed i=(a);i>(b);--i)
#define eper(i,a,b) for(signed i=(a);i>=b;--i)
#define fore(i, x, a) for(auto &&x:a) 
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define pb emplace_back
#define mp make_pair
#define ALL(x) begin(x),end(x)
#define F first
#define S second
#define debug(x)  cout << #x << ": " << (x) << '\n';
const long long INF=1001001001001001001;
const int MOD=(int)1e9 + 7;
const double EPS=1e-9;
using namespace std;
using Pii = pair<int,int>;
using vii = vector<int>;
template<class T>using  PS_queue = priority_queue<T, vector<T>, greater<T> >;
template<class T>using vv = vector<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> ostream& operator<<(ostream &os,const vector<vector<T> > &v) {
    ITR(u,begin(v),end(v))ITR(w,begin(*u),end(*u))os<<*w<<(w==end(*u)-1?"\n":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct edge { int from, to, cost; };
int dy[]={0, 1, -1, 0}; int dx[]={1, 0, 0, -1};
// cout << fixed << setprecision(10) << val;

string L;

int mod_pow(int x, int y) {
  ll res = 1LL;
  while (y > 0) {
    if ((y & 1))
      res = res * x % MOD;
    x = x * x % MOD;
    y >>= 1;
  }
  return res;
}

signed main() {
 cin.tie(0);
 ios::sync_with_stdio(false);
  cin >> L;
  int ans = 0, m = 0;
  rep(i, 0, L.size()) {
    int rest = L.size() - i - 1;
    if (L[i] == '1') {
      ans += mod_pow(2, m) * mod_pow(3, rest) % MOD;
      m++;
    }
  }
  ans += mod_pow(2, m) % MOD;
  cout << ans % MOD << endl;
  return 0;
}




Measured memory_bytes: 512
import sys
import os

MOD = 10 ** 9 + 7


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

    b = sys.stdin.buffer.readline().decode().rstrip()
    print('A' if b == 'T' else 'T' if b == 'A' else 'C' if b == 'G' else 'G')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"Sunny", "Cloudy", "Rainy"};

int main(){
    int a, b;
    cin >> a >> b;
    cout << a * b / 2 << endl;
}


Measured memory_bytes: 256
h, w = map(int,input().split())
n = int(input())
A = list(map(int,input().split()))

color_row = []
for i,a in enumerate(A):
    color_row += [i+1 for _ in range(a)]


for i in range(h):
    if i%2 == 0:
        print(*color_row[w*i:w*i+w])
    else:
        print(*reversed(color_row[w*i:w*i+w]))
    

Measured memory_bytes: 9400
import fractions

n = int(input())
a = list(map(int, input().split()))
b = a[::-1]

left = [0, a[0]]
right = [0, b[0]]
l = a[0]
r = b[0]
for i in range(1, n):
    l = fractions.gcd(l, a[i])
    r = fractions.gcd(r, b[i])
    left.append(l)
    right.append(r)

gcd_max = 0
for i in range(n+1):
    gcd_tmp = fractions.gcd(left[i], right[n-i-1])
    if gcd_tmp > gcd_max:
        gcd_max = gcd_tmp

print(gcd_max)


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

int main () {
    char b,c[128];
    c['A'] ='T';
    c['C'] ='G';
    c['G'] ='C';
    c['T'] ='A';
    
    cin >> b;
    cout << c[(int)b] << endl;
}

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

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

    long long ans = 0;
    rep(i,s.size()) {
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;

}

Measured memory_bytes: 3900
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define MAXN 100005
using namespace std ;

int h[3],len;
char s[MAXN];

inline int red(){
	int Res; char ch; bool flg; Res=flg=0;
	while (ch=getchar(),ch<48||57<ch) flg^=!(ch^'-'); Res=(ch&15);
	while (ch=getchar(),47<ch&&ch<58) Res=(Res<<1)+(Res<<3)+(ch&15);
	if (flg) return -Res; return Res;
}

int main(){
	scanf("%s",s); len=strlen(s);
	for (int i=0;s[i];i++){
		h[s[i]-'a']++;
	}
	sort(h,h+3);
	if ((h[1]==h[2]&&(h[0]==h[1]||h[0]+1==h[1]))||
		(h[1]+1==h[2])&&(h[0]==h[1])) puts("YES");
	else puts("NO");
	return 0 ;
}

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

using Result = string;
static const Result PAIRWISE{"pairwise coprime"};
static const Result SETWISE{"setwise coprime"};
static const Result NEITHER{"not coprime"};
static constexpr int N_MAX = 1e6;
static constexpr int PRIMES_COUNT_UP_TO_N_MAX = 78498;

vector<bool> sieve(const int n) {
    vector<bool> ans(n + 1, true);
    ans[0] = false;
    if (n) ans[1] = false;

    const int sq = sqrt(n);
    for (int i = 2; i <= sq; ++i) {
        if (!ans[i]) continue;
        for (int j = i * i; j <= n; j += i) ans[j] = false;
    }

    return ans;
}

vector<int> seq_of(const vector<bool> &xs, const int expected_count) {
    vector<int> ans;
    ans.reserve(expected_count);

    for (auto i = 0U; i < xs.size(); ++i) {
        if (xs[i]) ans.push_back(i);
    }

    return ans;
}

vector<int> prime_factors(const vector<bool> &primes,
                          const vector<int> &primes_seq, const int x) {
    if (primes[x]) return {x};

    const int sq = sqrt(x);
    vector<int> ans;

    for (const auto p : primes_seq) {
        if (p > sq) break;
        if (x % p) continue;

        ans.push_back(p);
        const int q = x / p;
        if (q > sq && primes[q]) ans.push_back(q);
    }

    return ans;
}

bool all_ones(const unordered_map<int, int> &cs) {
    for (const auto [k, v] : cs) {
        if (v != 1) return false;
    }

    return true;
}

Result solve(vector<int> xs) {
    const auto primes = sieve(N_MAX);
    const auto primes_seq = seq_of(primes, PRIMES_COUNT_UP_TO_N_MAX);
    assert(primes_seq.size() == PRIMES_COUNT_UP_TO_N_MAX);
    assert(primes_seq.back() == 999983);

    // Ho many times a prime is a factor of one of the xs
    unordered_map<int, int> cs;

    for (const auto x : xs) {
        for (const int p : prime_factors(primes, primes_seq, x)) ++cs[p];
    }

    if (all_ones(cs)) return PAIRWISE;

    return reduce(cbegin(xs) + 1, cend(xs), xs[0],
                  [](const int a, const int b) { return gcd(a, b); }) == 1
               ? SETWISE
               : NEITHER;
}

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

    int n;
    cin >> n;
    vector<int> xs(n, 0);
    for (auto &x : xs) cin >> x;

    cout << solve(xs) << '\n';
    return 0;
}


Measured memory_bytes: 14904
from collections import defaultdict, deque

N, X, Y = map(int, input().split())
X -= 1
Y -= 1
mp = defaultdict(list)
ans = defaultdict(int)
for i in range(N - 1):
    mp[i].append(i + 1)
    mp[i + 1].append(i)
mp[X].append(Y)
mp[Y].append(X)

dist = [[-1 for _ in range(N)] for _ in range(N)]


def bfs(st):
    q = deque()
    q.append(st)
    dist[st][st] = 0
    while q:
        now = q.popleft()
        for new in mp[now]:
            if dist[st][new] != -1:
                continue
            q.append(new)
            dist[st][new] = dist[st][now] + 1


for i in range(N):
    bfs(i)

for i in range(N):
    for j in range(N):
        if j >= i:
            continue
        d = dist[i][j]
        ans[d] += 1

for i in range(1, N):
    print(ans[i])

Measured memory_bytes: 83164