akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main() {
  int N;
  cin >> N;
  string s = to_string(N);
  int ans = 0;
  for(int i = 1; i <= s.length() - 1; i += 2) {
    ans += 9 * pow(10, i - 1);
  }
  if(s.length() % 2 == 1) {
    ans += N - pow(10, s.length() - 1) + 1;
  }
  cout << ans << endl;
}


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

typedef pair<int, int> P;

int bfs(int k)
{
  int c = 1;
  deque<P> q;
  bool isReached[k];
  for (int i = 0; i < k; i++)
    isReached[i] = false;

  q.push_front(make_pair(1, 1));
  while (q.size() > 0)
  {
    auto p = *(q.begin());
    auto n = p.first;
    auto c = p.second;
    q.pop_front();
    isReached[n] = true;

    if (n % k == 0)
      return c;

    if (!isReached[(n * 10) % k])
      q.push_front(make_pair((n * 10) % k, c));

    if (!isReached[(n + 1) % k])
      q.push_back(make_pair((n + 1) % k, c + 1));
  }

  return -1;
}

int main()
{
  long k;
  cin >> k;
  auto ans = bfs(k);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

int main(){
    ll n;
    cin >> n;
    ll red = 0;
    set<ll> st;
    rep(i, 0, n){
        ll a;
        cin >> a;
        if(a >= 3200) red++;
        else st.insert(a / 400);
    }
    cout << max(1LL, (ll)st.size()) << " ";
    cout << st.size() + red << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>

using namespace std;

int main()
{
    char s[4];
    cin >> s;
    for(int i=1; i<4; i++){
        if(s[i-1] == s[i]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
import math

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def euclid(y,z,d):
	result=0
	for i in range(d):
		result+=(y[i]-z[i])**2
	return math.sqrt(result)


n,d=input2()
X=[input_array() for _ in range(n)]

count=0
for i in range(n):
	for j in range(i+1,n):
		distance=euclid(X[i],X[j],d)
		if (distance%1) == 0:
			count+=1
print(count)

Measured memory_bytes: 9204
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  int n; readV(n);
  int[] a; readA(n, a);

  auto mi = a.reduce!min, ma = a.reduce!max;
  auto b = mi.abs > ma.abs ? mi : ma, i = a.countUntil(b);

  if (b == 0) {
    writeln(0);
  } else if (b > 0) {
    writeln(n*2-2);
    writeln(i+1, " ", 2);
    writeln(i+1, " ", 2);
    foreach (j; 2..n) {
      writeln(j, " ", j+1);
      writeln(j, " ", j+1);
    }
  } else {
    writeln(n*2-2);
    writeln(i+1, " ", n-1);
    writeln(i+1, " ", n-1);
    foreach_reverse (j; 0..n-2) {
      writeln(j+2, " ", j+1);
      writeln(j+2, " ", j+1);
    }
  }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int k,s;
  cin>>k>>s;
  int cnt=0;
  for(int x=0;x<=k;x++){
    for(int y=0;y<=k;y++){
      if(s-(x+y)>=0 && s-(x+y)<=k)cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 256
// AOJ 2897: Right triangle
// 2019.2.19 bal4u
 
#include <stdio.h>

int main()
{
	int A, B;

	scanf("%d%d", &A, &B);
	printf("%lf\n", 4.0/3*3.1415926535897932384626433832795*B*B*B);
	return 0;
}


Measured memory_bytes: 2056
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
////////////

int const N = 541;
int const INF = 1e9 + 41;

int ma[N][N], bit[N];
int n;


void solve(){
	cin >> n;
	fi(0, n){
		string s;
		cin >> s;
		fj(0, n){
			ma[i][j] = (s[j] == '#' ? 1 : 0);
			if(ma[i][j]){
				++bit[j];
			}
		}
	}

	int all = 0;
	fi(0, n) fj(0, n) all += ma[i][j];
	if(all == 0){
		printf("-1\n");
		return;
	}

	int ans = INF;
	int allB = 0;
	fi(0, n){
		int cnt = 0;
		fj(0, n){
			cnt += ma[j][i];		
		}
		if(cnt == n) ++allB;
	}


	fi(0, n){
		int pans = 0;
		int add = 0;
		if(bit[i] == 0) add = 1;
		fj(0, n){
			if(ma[i][j] == 0){
				++pans;
			}
		}

		pans += add + (n - allB);
		ans = min(ans, pans);
	}

	printf("%d\n",ans);
}



int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define mod 1000000007

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  int i,N,K,a[200000];
  cin>>N>>K>>i;
  N=K*10+i;
  if(N%4){
  cout<<"NO"<<endl;
  }else{
    cout<<"YES";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
#define rep(i,n) for(i=0;i<n;++i)

int main() {
	int N;
	cin >> N;
	N = N % 10;
	if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9) {
		cout << "hon";
	}
	else if (N == 0 || N == 1 || N == 6 || N == 8) {
		cout << "pon";
	}
	else {
		cout << "bon";
	}
	return 0;
}

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

#define ll long long
#define pb push_back
#define vi vector<int>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define sizeOf(A) (sizeof(A))/(sizeof(A[0]))
#define odd(x) ((x) % (2))
#define fastio ios_base::sync_with_stdio(false), cin.tie(0);

int main() {
    fastio;

    int n;
    cin >> n;
    bool colors[8] = {};
    int others = 0;
    FOR(i, 0, n) {
        int x;
        cin >> x;
        if (x >= 1 && x <= 399) {
            colors[0] = true;
        } else if (x >= 400 && x <= 799) {
            colors[1] = true;
        } else if (x >= 800 && x <= 1199) {
            colors[2] = true;
        } else if (x >= 1200 && x <= 1599) {
            colors[3] = true;
        } else if (x >= 1600 && x <= 1999) {
            colors[4] = true;
        } else if (x >= 2000 && x <= 2399) {
            colors[5] = true;
        } else if (x >= 2400 && x <= 2799) {
            colors[6] = true;
        } else if (x >= 2800 && x <= 3199) {
            colors[7] = true;
        } else if (x >= 3200) {
            others++;
        }
    }
    int diffColors = 0;
    FOR(i, 0, 8) {
        if (colors[i]) {diffColors++;}
    }
    cout << max(1, diffColors) << " " << diffColors + others << "\n";
    return 0;
}


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

using namespace std;

int ans(int n, int m, int x);

int main()
{
    int n, m;
    while (cin >> n >> m, n!=0) {
        cout << ans(n, m, 0) << endl;
    }
    return 0;
}

int ans(int n, int m, int x)
{
    int a = 0;
    if (n == 0 && m == 0) {
        return 1;
    } 
    for (int i = x; i < 10; i++) {
        if (m-i >= 0) {
            a += ans(n-1, m-i, i+1);
        }
    }
    return a;
}

Measured memory_bytes: 3072
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>


int main(){

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

	for (i = 1; i <= sqrt(n); i++){
		if (i*i <= n)
			box = i* i;
	}

	printf("%d", box);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>

using ll = long long;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, x) for(int i=1;i<=(int)(x);i++)
#define rrep(i, x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i, x) for(int i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007
#define put2darr(arr, row, col) rep(i, row) { rep(j, col) { printf("%18d", arr[i][j]); } cout << endl; }

using namespace std;

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; }

/* 1..10
 * rep:   0 1 2 3 4 5 6 7 8 9
 * reps:  1 2 3 4 5 6 7 8 9 10
 * rrep:  9 8 7 6 5 4 3 2 1 0
 * rreps: 10 9 8 7 6 5 4 3 2 1
 */

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


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

string S, T;

int main(int argc, const char * argv[]) {
    cin >> S >> T;
    int ans = 0;
    rep(i, 3) {
        if (S[i] == T[i]) ans++;
    }

    output(ans);

    return 0;
}

Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {

            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            double h = int.Parse(Console.ReadLine());

            double S =AreaDaikei(a, b, h);

            Console.WriteLine(S);

        }

        public static double AreaDaikei(int a, int b, double h)
        {
            return (a + b) * h / 2;
        }
    }
}


Measured memory_bytes: 13140
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            this.cin = new CommonInput();

            List<int> x = new List<int>();

            for (int i = 0; i < 3; i++)
                x.Add(cin.GetInt());

            x = x.OrderBy(y => y).ToList();

            Console.WriteLine("{0} {1} {2}", x[0], x[1], x[2]);
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public string GetLine()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            string line;
            this._i = 0;
            do
            {
                line = Console.ReadLine();
            } while (line == "");

            this._s = line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);

            return this._s[this._i++];
        }

        public int GetInt()
        {
            return int.Parse(this.GetLine());
        }

        public long GetLong()
        {
            return long.Parse(this.GetLine());
        }

        public double GetDouble()
        {
            return double.Parse(this.GetLine());
        }
    }
}

Measured memory_bytes: 6380
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
	int a,b,c,d,e,f;
		cin>>a>>b>>c>>d>>e>>f;
		a=a*1;
		b=b*5;
		c=c*10;
		d=d*50;
		e=e*100;
		f=f*500;
		if(a+b+c+d+e+f>=1000){
			cout<<"1"<<endl;
		}else{
			cout<<"0"<<endl;
		}
		
	return 0;
}

Measured memory_bytes: 1156
n = int(input())

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table

_, t = sieve(100003)
t = [i for i in t if i>=n]

print(t[0])


Measured memory_bytes: 44784
fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val line = readLine()!!.split(" ").map { it.toInt() }
    val list = Array<Int>(n){it*0}
    for(i in 0..n-2){
        list.set(line[i]-1,list.get(line[i]-1)+1)
    }
    list.map { println(it) }
}

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

int main(){
        int n, i=1;
        long long  max = -1000000, min = 1000000, sum = 0, d;
        cin >> n;
        while (i <= n){
        i++;
        cin >> d;
        min = (d < min)?d:min;
        max = (d > max)?d:max;
        sum = sum + d;
}
        cout << min << " " << max << " " << sum << endl;

        return 0;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

map<string, int> city2num;
set<int> LPG;

vector<pair<int, int>> G[6010];
int dist[6010][2010]; // dist[i][j] := ??????i?????§??????LPG???j??§??\????????????????????¢
using tup = tuple<int, int, int>;

void dijkstra(int start, int cap){
	rep(i, 6010)rep(j, 2010) dist[i][j] = INF;
	cap *= 10;
	dist[start][cap] = 0;
	priority_queue<tup, vector<tup>, greater<tup> >  que; // ?????¢ ?????? ?????????LPG
	que.push(make_tuple(0, start, cap));
	while(!que.empty()){
		int cost, u, lpg;
		tie(cost, u, lpg) = que.top(); que.pop();
		// if(u == goal) dist[u][lpg];
		// printf("cost %d u %d lpg %d\n", cost, u, lpg);
		if(dist[u][lpg] < cost) continue;
		for (auto& tmp : G[u]){
			int v = tmp.first, di = tmp.second;
			int nlpg = lpg - di;
			int ncost = cost + di;
			// printf("v %d di %d nlpg %d ncost %d\n", v, di, nlpg, ncost);
			if(nlpg < 0) continue;
			if(LPG.count(v)) {
				
				/*
				for (int i = nlpg; i <= cap; ++i){
					if(dist[v][i] > ncost) {
						dist[v][i] = ncost;
						que.push(make_tuple(ncost, v, i));
					}
				}
				*/
				

				if(dist[v][cap] > ncost) {
					dist[v][cap] = ncost;
					// printf("dist[%d][%d] = %d\n", v, cap, ncost);
					que.push(make_tuple(ncost, v, cap));
				}
				
			}else{
				if(dist[v][nlpg] > ncost) {
					dist[v][nlpg] = ncost;
					// printf("dist[%d][%d] = %d\n", v, nlpg, ncost);
					que.push(make_tuple(ncost, v, nlpg));
				}
			}
		}
	}
}


string c1[6010], c2[6010];
int d[6010];
string s[6010];
int main(void) {
	while(1){
		city2num.clear(); LPG.clear();
		rep(i, 6010) G[i].clear();

		int N, M, cap; scanf("%d %d %d", &N, &M, &cap);
		if(N == 0 && M == 0 && cap == 0) break;
		string src, dest; cin >> src >> dest;

		rep(i, N) cin >> c1[i] >> c2[i] >> d[i];
		rep(i, M) cin >> s[i];

		set<string> city;
		rep(i, N) city.insert(c1[i]), city.insert(c2[i]);
		int cnt = 0;
		for(auto& u : city) {
			city2num[u] = cnt++;
		}
		rep(i, M) LPG.insert(city2num[s[i]]);

		rep(i, N) G[city2num[c1[i]]].pb(mp(city2num[c2[i]], d[i])), G[city2num[c2[i]]].pb(mp(city2num[c1[i]], d[i]));
		int ns = city2num[src], nd = city2num[dest];

		dijkstra(ns, cap);
		ll ans = INF;
		rep(i, cap * 10 + 1) chmin(ans, dist[nd][i]);
		if(ans != INF)printf("%lld\n", ans);
		else printf("-1\n");
	}
	return 0;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#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 all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
//const ll INF = 1e18;
const double EPS = 1e-10;
const int MOD = 1e9+7;
const double PI = acos(-1.0);

int main()
{
	int H,W,h,w;
	cin >> H >> W >> h >> w;
	H -= h, W -= w;
	cout << W*H << endl;
	return 0;
}

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    long int sum=0;

    sort(a.begin(), a.end());

    for(int i=0; i<n-k; i++){
        sum += a[i];
    }

    cout << sum << endl;
}

Measured memory_bytes: 1024
/* Coached by Dukkha */
#include <stdio.h>
#include <stdlib.h>

#define N 100000

int compare(const void *a, const void *b) {
	int ia = *(int *) a;
	int ib = *(int *) b;

	return ia - ib;
}

int main() {
	static int aa[N], bb[N], cc[N];
	static long long pp[N];
	int n, i, j;
	long long ans;

	scanf("%d", &n);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	for (i = 0; i < n; i++)
		scanf("%d", &bb[i]);
	for (i = 0; i < n; i++)
		scanf("%d", &cc[i]);
	qsort(aa, n, sizeof *aa, compare);
	qsort(bb, n, sizeof *bb, compare);
	qsort(cc, n, sizeof *cc, compare);
	for (i = j = 0; j < n; j++) {
		while (i < n && aa[i] < bb[j])
			i++;
		pp[j] = i;
	}
	for (i = 1; i < n; i++)
		pp[i] += pp[i - 1];
	ans = 0;
	for (i = j = 0; j < n; j++) {
		while (i < n && bb[i] < cc[j])
			i++;
		if (i > 0)
			ans += pp[i - 1];
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 2548
#include <iostream>
using namespace std; 
int main() {
    int s; cin >> s;
    int h = s / 3600, m = (s / 60) % 60;
    s %= 3600;
    s %= 60;
    cout << h << ':' << m << ':' << s << '\n';
    return 0;
}


Measured memory_bytes: 3096
// https://atcoder.jp/contests/abc122/tasks/abc122_d

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 100;
const int MOD = 1e9+7;

int N;

const int A = 0;
const int C = 1;
const int G = 2;
const int T = 3;

int dp[N_MAX + 1][4][4][4];

void solve() {
  dp[0][T][T][T] = 1;
  REP(i, N) REP(c1, 4) REP(c2, 4) REP(c3, 4) REP(c4, 4) {
    if (c2 == A && c3 == G && c4 == C) continue;
    if (c2 == A && c3 == C && c4 == G) continue;
    if (c2 == G && c3 == A && c4 == C) continue;
    if (c1 == A && c3 == G && c4 == C) continue;
    if (c1 == A && c2 == G && c4 == C) continue;
    dp[i + 1][c2][c3][c4] = (dp[i + 1][c2][c3][c4] + dp[i][c1][c2][c3]) % MOD;
  }

  // REP(i, 4) { DUMP2D(dp[N][i], 4, 4); puts(""); }

  int ans = 0;
  REP(c1, 4) REP(c2, 4) REP(c3, 4) ans = (ans + dp[N][c1][c2][c3]) % MOD;
  printf("%d\n", ans);
}

void input() {
  scanf("%d", &N);
}

int main() {
  input();
  solve();
  return 0;
}


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

using namespace std;

/* alias */
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pii>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

/* repetition */
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)

int main() {
    ll N;
    cin >> N;
    cout << N * (N - 1) / 2ll << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
#define pll pair<ll, ll>

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

    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    vector<ll> nums = {A, B, C};
    if (K == 0) {
        cout << A - B << endl;
        return 0;
    }

    ll na = nums[1] + nums[2];
    ll nb = nums[0] + nums[2];
    ll nc = nums[0] + nums[1];
    nums[0] = na;
    nums[1] = nb;
    nums[2] = nc;
    if (abs(nums[0] - nums[1]) > (ll)pow(10, 18))
        cout << "Unfair" << endl;
    else {
        if (K % 2 == 1)
            cout << nums[0] - nums[1] << endl;
        else
            cout << nums[1] - nums[0] << endl;
    }
}

Measured memory_bytes: 3528
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

set<int> party;

void DFS(int depth, int sum, vector<int>& a)
{
	if (depth == a.size())
	{
		party.insert(sum);
		return;
	}
	DFS(depth + 1, sum, a);
	DFS(depth + 1, sum + a[depth], a);
}

void solve()
{
	int n;
	while (cin >> n, n)
	{
		party.clear();
		int sum = 0;
		vector<int> a(n);
		for (int i = 0; i < n; ++i)
		{
			cin >> a[i];
			sum += a[i];
		}
		DFS(0, 0, a);
		int minV = 1e9;
		set<int>::iterator it = party.begin();
		while (it != party.end())
		{
			minV = min(minV, abs(sum - *it * 2));
			++it;
		}
		cout << minV << endl;
	}
}

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

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

int main(){
  int a, b;
  cin >> a >> b;
  int c = b - a;
  cout << c * (c+1) / 2 - b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;
typedef pair<int, int> P;

int ans = 0;
string s;

void dfs(int k, int sum, int now){
    if(k == s.size()){
        ans += sum + now;
        return;
    }
    int d = s[k] - '0';
    dfs(k + 1, sum + now, d);
    dfs(k + 1, sum, now * 10 + d);
}

signed main(){
    cin >> s;
    dfs(1, 0, s[0] - '0');
    cout << ans << endl;
}

Measured memory_bytes: 380
#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 fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int n, m;
    cin >> n >> m;
    vector<int> ac(n), wa(n);
    int pena = 0;
    rep(i, m) {
        int p; string s;
        cin >> p >> s;
        p--;
        if (s == "AC") {
            if (!ac[p]) {
                ac[p] = 1;
                pena += wa[p];
            }
        } else {
            wa[p]++;
        }
    }
    cout << accumulate(all(ac), 0) << " " << pena << endl;
    
}


Measured memory_bytes: 3952
#include <iostream>
#include <cstdio>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
 
ll a, b;
ll n, h;
ll a_max = 0;
ll ans = 0;
priority_queue<ll> p_que;
 
int main()
{
    cin >> n >> h;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
 
        a_max = max(a, a_max);
        p_que.push(b);
    }
 
    while (!p_que.empty() && p_que.top() > a_max && h > 0) {
        h = h - p_que.top();
        p_que.pop();
        ans++;
    }
 
    if (h > 0) {
        ans += (h + a_max - 1) / a_max;
    }
    
    cout << ans << endl;
 
    return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


ll dp[200][200000];

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, w;
  cin >> n >> w;
  vector<p> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }

  for (int i = 0; i < 200; i++) {
    for (int j = 0; j < 200000; j++) {
      dp[i][j] = 0;
    }
  }
  // i番目までのもので重さj以下価値最大

  for (int i = 1; i <= n; i++) {
    int weight = v[i-1].first;
    int val = v[i-1].second;
    for (int j = 0; j <= w; j++) {
      if(j - weight >= 0)
        dp[i][j] = max(dp[i-1][j], dp[i-1][j-weight] + val);
      else
        dp[i][j] = dp[i-1][j];
    }
  }

  cout << dp[n][w] << endl;
}


Measured memory_bytes: 312704
n = int(raw_input())
s = raw_input()
ct = 0
mn = 0
for c in s:
    if c == '(':
        ct += 1
    else:
        ct -= 1
    mn = min(mn,ct)
s = '('*abs(mn) + s
ct = 0
for c in s:
    if c == '(':
        ct += 1
    else:
        ct -= 1
s = s + ')'*ct
print s


Measured memory_bytes: 2576
package main

import (
	"fmt"
)

func main() {
	var N int

	fmt.Scanf("%d", &N)

	set := make(map[int]int, N)
	for i := 0; i < N; i++ {
		var d int
		fmt.Scanf("%d", &d)
		set[d]++
	}

	fmt.Println(len(set))
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

typedef long long ll;
ll c[51][51];

void initC();
ll calcc(int, int, int, ll*);
int main(){
  int n; cin >> n;
  int a, b; cin >> a >> b;
  ll v[n+1];
  for(int i=1; i<=n; i++) cin >> v[i];

  sort(v+1, v+n+1);

  double d=0;
  for(int i=n; i>n-a; i--){
    d += v[i];
  }

  printf("%lf\n", d/a);

  initC();
  printf("%lld\n", calcc(n, a, b, v));

  return 0;
}

void initC(){
  for(int i=1; i<=50; i++){
    c[i][0] = 1;
    c[i][i] = 1;
  }

  for(int i=2; i<=50; i++){
    for(int j=0; j<=i; j++){
      if(j==0) c[i][j] = c[i-1][j];
      else if(j==i) c[i][j] = c[i-1][j-1];
      else c[i][j] = c[i-1][j-1]+c[i-1][j];
    }
  }
}

ll calcc(int n, int a, int b, ll* v){
  ll ans=0;
  if(v[n]==v[n-a+1]){
    for(int i=a; i<=b; i++){
      int x = upper_bound(v+1, v+n+1, v[n-a+1])-lower_bound(v+1, v+n+1, v[n-a+1]);
      ans += c[x][i];
    }
  }
  else{
    int x = upper_bound(v+1, v+n+1, v[n-a+1])-lower_bound(v+1, v+n+1, v[n-a+1]);
    int y = a-(v+n-upper_bound(v+1, v+n+1, v[n-a+1]))-1;
    ans = c[x][y];
  }
  return ans;
}


Measured memory_bytes: 256
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
s = sum(A)
Q = int(input())
c = Counter(A)
for _ in range(Q):
    B,C = map(int,input().split())
    s -= B*c[B]
    s += C*c[B]
    c[C] += c[B]
    c[B] = 0
    print(s)

Measured memory_bytes: 24016
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  string T;
  string U;
  int A;
  int B;
  cin >> S >> T;
  cin >> A >> B;
  cin >> U;
  if (U == S){
    cout << A-1 << " " << B << endl;
  }
  else{
    cout << A << " " << B-1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define fi first
#define se second
#define vi vector<int> 
#define pii pair<int,int>
const int N = 2e5 +5;
main(){
	ios::sync_with_stdio(0);  
	cin.tie(0);
	int n,cnt = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int x; cin >> x;
		if (i % 2 == 1 && x%2 == 1) 
		cnt++;
	}
	cout << cnt;
}

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

using namespace std;

const int Maxn = 100;

char S[Maxn];
int A[Maxn], N;

int main()
{
#ifdef hk_cnyali
	freopen("A.in", "r", stdin);
	freopen("A.out", "w", stdout);
#endif
	scanf("%s", S);
	N = strlen(S);
	int ans = 0;
	for (int i = 1; i <= N; ++i) A[i] = S[i - 1] - '0', ans += A[i];
	int sum = 9 * N;
	for (int i = 1; i <= N; ++i)
	{
		ans = max(ans, sum - 9 + A[i] - 1);
		sum = sum - 9 + A[i] - 1;
	}
	cout<<ans<<endl;
	return 0;
}

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

int n, m;
vector<int> graph[100001], dp;
void DFS( int u)
{
	int ans = 0;
	int flag = 0;
	for(int &v : graph[u]) {
		flag=1;
		if (!dp[v]) {
			DFS(v);
			ans = max(ans, dp[v]);
		}
		else ans = max(ans, dp[v]);
	}
	if (flag==0) dp[u] = 1;
	else dp[u] = 1 + ans;
}
 
int main()
{
	int u, v;
	cin>>n>>m;
	dp.resize(n + 1, 0);
	for(int i=0;i<m;i++) {
	    cin>>u>>v;
		graph[u].pb(v);
	}
	for(int i=1;i<=n;i++) if (!dp[i]) DFS(i);
	int result=dp[0];
	for(int i=0;i<dp.size();i++){
		if(dp[i]>result) result=dp[i];
	}
	cout<<result-1;
	return 0;
}

Measured memory_bytes: 8832
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int a=sc.nextInt();
    String s=sc.next();
    if(a>=3200){
      System.out.println(s);
    }else{
      System.out.println("red");
    }
  }
}

Measured memory_bytes: 20820
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int read(){
    int c=0,nx,sign=1;
    do{
        nx=getchar()-'0';
        if(nx=='-'-'0')
            sign=-1;
    }while(nx<0 or nx>9);
    while(nx>=0 and nx<=9){
        c=c*10+nx;
        nx=getchar()-'0';
    }
    return sign*c;
}
template<typename T>
void write(T x){
	if(x<0)
		putchar('-'),x=-x;
	if(x>9)
		write(x/10);
	putchar(x%10+48);
}
const int  N=5e5+100,M=6*N;
int head[N],next[M],ver[M];
inline void addEdge(int u,int v){
    static int now=1;
    ++now;
    next[now]=head[u];
    ver[now]=v;
    head[u]=now;
}
int n;
int cnt[N];
int fa[N],vis[N];
int ans[N];
int c[M],top;
int s[M][2],t;

void dfs(int u){
	s[++t][0]=u;
	s[t][1]=1;
	while(t){
		u=s[t][0];
		int flag=1;
		switch(s[t][1]){
			case 1:
				for(int i=head[u];i;i=next[i]){
			        if(vis[i])
			            continue;
			        vis[i]=vis[i^1]=1;
			        head[u]=next[i];
			        flag=0;
			        s[++t][0]=ver[i];
					s[t][1]=1;
			        break;
			    }
			    if(flag)
			    	s[t][1]=2;
			    break;
			case 2:
				c[top++]=u;
				--t;
				break;
		}
//		for(int i=1;i<=t;i++)
//			cout<<s[i][0]<<' '<<s[i][1]<<endl;
//		cout<<endl;
	}
}

//void dfs(int u){
//    for(int i=head[u];i;i=next[i]){
//        if(vis[i])
//            continue;
//        vis[i]=vis[i^1]=1;
//        head[u]=next[i];
//        dfs(ver[i]);
//    }
//    c[top++]=u;
//}

int main(){
    n=read();
    int u,v,s=2*n+1;
    for(int i=1;i<=n;i++){
        u=read();
        if(u==-1)
            u=s;
        cnt[u]++;
        addEdge(u,i);
        addEdge(i,u);
    }
    for(int i=1;i<=n;i++){
        u=read();
        if(u==-1)
            u=s;
        else
            u=s-u;
        ++cnt[u];
        v=s-i;
        addEdge(u,v);
        addEdge(v,u);
    }
    
    for(int i=1;i<=2*n;i++)
        cnt[i]=!(cnt[i]&1);
    cnt[s]=0;
    
    for(int i=1;i<=n;i++){
        if(cnt[i]^cnt[s-i]){
            puts("IMPOSSIBLE");
            return 0;
        }
        if(cnt[i])
            addEdge(i,s-i),addEdge(s-i,i);
    }
    
    dfs(1);
    for(int i=top-1;i>=1;i--){
    	if(c[i]==s-c[i-1]){
    		int u=c[i];
    		if(u<=n)
    			ans[u]=1;
    		else
    			ans[s-u]=-1;
        }
    }
    
    puts("POSSIBLE");
    for(int i=1;i<=n;i++)
        write(ans[i]),putchar(' ');
    putchar('\n');
}

Measured memory_bytes: 27136
from collections import Counter
S = input()
L = len(list(S))
dp = [0] * L
dp[0] = 1
T = [0] * L
T[0] = int(S[-1])
for i in range(1, L):
    dp[i] =  dp[i - 1] * 10
    dp[i] %= 2019
    T[i] = int(S[-(i+1)]) * dp[i] + T[i - 1]
    T[i] %= 2019
ans = 0
for k, v in Counter(T).items():
    if k == 0:
        ans += v
        ans += v * (v - 1) // 2
    else:
        ans += v * (v - 1) // 2
print(ans)


Measured memory_bytes: 23508
#include<stdio.h>
int main(void)
{
    int a,b;
    scanf("%d %d",&a, &b);
    if(a<b){
    printf("a < b\n");
    }else if(a>b){
    printf("a > b\n");
    }else{printf("a == b\n");
    }
    return 0;
}

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

int main(){
  string s;
  cin>>s;
    int y, m, d;
    y= stoi(s.substr(0,4));
    m=stoi(s.substr(5,2));
    d=stoi(s.substr(8,2));
    if(y<2019 || (y<=2019 && m<4) || (y<=2019 && m<=4 && d<30) )printf("Heisei\n");
    else if(y>2019 || (y>=2019 && m>4) || (y>=2019 && m>=4 && d>30) )printf("TBD\n");
    else printf("Heisei\n");


  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1000000007;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
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<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define fs first
#define sc second
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

const int INF = 1e9;
const ll LLINF = 1e16;
 
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
 
template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

// 割り算の切り上げ処理
template<typename T>
T round_up(T a, T b) {
  return (a + b - 1) / b;
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll a,b;
    cin >> a >> b;
    ll tmp = 0;
    ll tmp2 = b - a;
    REP(i, 1, 1000){
      if(tmp2 == i) break;
      tmp += i;
    }
    ll tmp3 = tmp + tmp2;
    ll ans = tmp3 - b;
    print(ans);
}


Measured memory_bytes: 256
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <string.h>
#include <stdio.h>

const char main_[] = {
	0x48, 0xc7, 0xc0, 0x00, 0x00, 0x00, 0x80,
	0x48, 0x83, 0xef, 0x01,
	0x48, 0x8b, 0x0c, 0xbe,
	0x48, 0xc7, 0xc2, 0x00, 0x00, 0x00, 0x00,
	0x48, 0x29, 0xca,
	0x48, 0x21, 0xd1,
	0x48, 0x39, 0xc1,
	0x73, 0x03,
	0x48, 0x89, 0xc8,
	0x48, 0x83, 0xff, 0x00,
	0x75, 0xdd,
	0x48, 0x83, 0xe8, 0x01,
	0xf3, 0x48, 0x0f, 0xb8, 0xc0,
	0xc3
};

int main(void){
	int fd = open("/dev/zero", O_RDONLY);
	int (*solve)(int, int[]) = mmap(NULL, sizeof main_, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
	memcpy(solve, main_, sizeof main_);

	int n, a[210];
	scanf("%d", &n);
	for(int i = 0; i < n; ++i) scanf("%d", a + i);
	printf("%d\n", solve(n, a));

	close(fd);
	munmap(solve, sizeof main_);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)



int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int q,c,x;
	string key,L,R;
	cin >> q;
	multimap<string,int> ma;
	while(q--){
		cin >> c >> key;
		if(c==0){
			cin >> x;
			ma.insert({key,x});
		}else if(c==1){
			using iterator = decltype(ma)::iterator;
			pair<iterator,iterator> ret = ma.equal_range(key);
			for (auto it = ret.first; it != ret.second; ++it) {
				cout << it->second << "\n";
			}
		}else if(c==2){
			ma.erase(key);
		}else if(c==3){
			L = key;
			cin >> R;
			using iterator = decltype(ma)::iterator;
			pair<iterator,iterator> ret1 = ma.equal_range(L);
			pair<iterator,iterator> ret2 = ma.equal_range(R);
			for (auto it = ret1.first; it != ret2.second; ++it) {
				cout << it->first << " " << it->second << "\n";
			}
		}
	}
}


Measured memory_bytes: 24876
#include <iostream>

#define SIZE 100000

int n;
int a[SIZE];

int main() {
    std::cin >> n;
    for (int i=0; i<n; ++i) {
        std::cin >> a[i];
        --a[i];
    }
    int counter = 1;
    int b = a[0];
    a[0] = -1;
    while (true) {
        if (b == -1) {
            counter = -1;
            break;
        }
        if (b == 1) break;
        int tmp = a[b];
        a[b] = 0;
        b = tmp;
        ++counter;
    }
    std::cout << counter << std::endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <queue>
#include <map>
#include <set>
using namespace std;
using Int = int64_t;
using P = pair<Int, Int>;
const Int INF = 1<<30;
const Int MOD = (Int)1e9 + 7;
const Int MAX_N = (Int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
#define debug2(x, y) cout << #x << ": " << x << ", " << #y << ": " << y << endl;
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

vector<int> used;
int ans = INF;
void dfs(int idx, const vector<int> &a, int cnt)
{
    if(used[1])
    {
        ans = min(ans, cnt);
        return;
    }
    if(used[idx]) return;
    used[idx] = 1;
    int v = a[idx];
    dfs(v, a, cnt + 1);
}

void solve()
{
    int n; cin >> n;
    used.resize(n, 0);
    vector<int> a(n);
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        a[i]--;
    }
    dfs(0, a, -1);
    if(ans == INF)
    {
        cout << -1 << endl;
        return;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 3944
s = input()
def check(str):
    a1 = str[:len(str)//2]
    a2 = str[len(str)//2:]
    return 1 if a1==a2 else 0
ls = len(s)
for i in range(2,ls,2):
    str = s[:ls-i]
    if check(str):
        print(len(str))
        break

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(x) for(auto it=(x).begin();it!=(x).end();it++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
//#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

template <typename T>
struct Combination {
	vector<T> fc,ifc;
	T MOD;
	int sz;
 
	Combination(T MOD,T sz):fc(sz+1),ifc(sz+1),MOD(MOD),sz(sz) {}
 
	void init() {
		fc[0]=1;
		for(int i=1;i<=sz;i++) fc[i]=fc[i-1]*i%MOD;
		ifc[sz]=inv(fc[sz]);
		for(int i=sz-1;i>=0;i--) ifc[i]=ifc[i+1]*(i+1)%MOD;
	}
 
	// 階乗
	T fact(int n) {
		return fc[n];
	}
	// 階乗の逆元
	T inv_fact(int n) {
		return ifc[n];
	}
	//逆元
	T inv(int n) {
		return pow(n,MOD-2);
	}
	// 冪乗
	T pow(T n,int a) {
		T res=1;
		while(a>0) {
			if(a&1) (res*=n)%=MOD;
			(n*=n)%=MOD;
			a>>=1;
		}
		return res;
	}
	// 順列
	T perm(T n,T r) {
		if(r<0||n<r) return 0;
		return fc[n]*ifc[n-r]%MOD;
	}
	// 組み合わせ
	T comb(T n,T r) {
		if(n<0||r<0||n<r) return 0;
		return fc[n]*ifc[r]%MOD*ifc[n-r]%MOD;
	}
	// 重複組み合わせ
	T multi_comb(T n,T r) {
		if(n<0||r<0) return 0;
		return r==0?1:comb(n+r-1,r);
	}
};

//使い方
//Combination<ll> 変数(MOD,1e6*2+10);
//Combination<ll> C((int)1e9+7,(int)1e6*2+10);
//C.init();

int main(){
    Combination<ll> C((int)1e9+7,(int)1e6*2+10);
    C.init();
    
    ll m,n;
    cin>>m>>n;
    cout<<C.pow(m,n)<<endl;
    
    
    
    
    
    return 0;
}



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

int a[2][105];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,2)rep(j,n) cin >> a[i][j];
    int ans = 0;
    rep(i,n){
        int cnt = 0;
        for(int j = 0; j <= i; j++){
            cnt += a[0][j];
        }
        for(int j = i; j < n; j++){
            cnt += a[1][j];
        }
        chmax(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k,x;
    cin>>k>>x;
    if(500*k>=x){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9+7);
const double pi = acos(-1);
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")
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; }
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll factorial(ll n){
    ll ans = 1;
    rep1(i, n){
        ans *= i;
        ans %= mod;
    }
    return ans;
}

ll power(ll a, ll b){
    ll ans = 1;
    a %= mod;
    while(b) {
        if(b & 1LL) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ans % mod;
}

ll f(ll n){
    if(n % 2 == 1){
        if(((n + 1) / 2) % 2 == 1)return 1;
        else return 0;
    }else{
        if(n / 2 % 2 == 1)return n ^ 1;
        else return n;
    }
}

//modの値の確認をすること
int main(){
    ll a,b;
    cin >> a >> b;
    pf(f(a - (a > 0? 1:0)) ^ f(b));
    return 0;
}


Measured memory_bytes: 256