akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  
  if(N<105){
    cout << 0 << endl;
  }
  
  else if(N<135){
    cout << 1 << endl;
  }
  
  else if(N<165){
    cout << 2 << endl;
  }
  
  else if(N<189){
    cout << 3 << endl;
  }
  else if(N<195){
    cout << 4 << endl;
  }
  else{
    cout << 5 << endl;
  }
}



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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	
	cout << n*n*n + n*n +n <<"\n";
	return 0;
}


Measured memory_bytes: 3652
//ALDS1_7D
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int n,pos;
vector<int> pre,in,post;

void rec(int l,int r){
 if(l>=r) return;
 int root=pre[pos++];
 int m=distance(in.begin(),find(in.begin(),in.end(),root));
 rec(l,m);
 rec(m+1,r);
 post.push_back(root);
}

void solve(){
 pos=0;
 rec(0,pre.size());
 for(int i=0;i<n;i++){
  if(i) cout<<" ";
  cout<<post[i];
 }
 cout<<endl;
}

int main(){
 int k;
 cin>>n;
 for(int i=0;i<n;i++){
  cin>>k;
  pre.push_back(k);
 }
 for(int i=0;i<n;i++){
  cin>>k;
  in.push_back(k);
 }
 solve();
 return 0;
}

Measured memory_bytes: 1220
import Control.Applicative
import Data.Char
 
main :: IO ()
main = do
    ns <- getLine
    putStrLn $ solve (map digitToInt ns)

solve :: [Int] -> String
solve ns = if ns !! 0 == ns !! 1 || ns !! 1 == ns !! 2 || ns !! 2 == ns !! 3 
           then "Bad"
           else "Good"

Measured memory_bytes: 380
x, y = [int(s) for s in input().split()]

a, a_mod = divmod(2 * y - x, 3)
b, b_mod = divmod(2 * x - y, 3)
if a < 0 or a_mod != 0 or b < 0 or b_mod != 0:
    print(0)
    exit()

mod = 10 ** 9 + 7

n = a + b
temp_list = [1] * (n + 1)
for i in range(1, n + 1):
    temp_list[i] = i * temp_list[i - 1] % mod

stop = a if a < b else b
i_temp_list = [1] * (n + 1)
i_temp_list[-1] = pow(temp_list[-1], mod - 2, mod)
for i in range(n, stop, -1):
    i_temp_list[i - 1] = i_temp_list[i] * i % mod

ans = temp_list[n] * i_temp_list[a] * i_temp_list[b] % mod
print(ans)

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((100 * a + 10 * b + c) % 4 == 0 ) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	int c=b;
	if(c%10==0)c++;
	while(c>0)
	{
		c/=10;
		a*=10;
	}
	a+=b;
	int d=sqrt(a);
	if(d*d==a)cout<<"Yes";
	else cout<<"No";
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    int a, b;

    cin >> a >> b;

    cout << (a-1) + (a <= b) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(c==-1 || d==-1){
		if(a<b)cout<<"Alice"<<endl;
		else if(a>b)cout<<"Bob"<<endl;
		else cout<<"Draw"<<endl;
		return 0;
	}
	if(c>d)cout<<"Alice"<<endl;
	else if(c<d)cout<<"Bob"<<endl;
	else cout<<"Draw"<<endl;
}


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

int64_t factmod(int64_t n, int64_t m){
	int64_t r = 1;
	for(int64_t i = 1; i <= n; i++) (r *= i) %= m;
	return r;
}

int main(){
	int64_t n, m;
	cin >> n >> m;
	if(2 <= abs(n - m)){
		cout << 0 << endl;
		return 0;
	}
	cout << factmod(n, 1e9 + 7) * factmod(m, 1e9 + 7) * (abs(n - m) == 1 ? 1 : 2) % int64_t(1e9 + 7) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef long long ll; 

int x, y, z;

int main() {
    cin >> x >> y >> z;
    cout << x * y / 2 << endl;
    return 0;
}

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

using namespace std;

int main() {
  
  int n;
  cin >> n;
  int ans=0;
  
  vector<int> p(n);
  
  for (int i = 0; i < n; ++i) {
    cin>>p[i];
  }
  int m=n/2;
  sort(p.begin(),p.end());
  ans = p[m]-p[m-1];

  cout << ans << endl;

}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

typedef long long int ll;
#define REP(i, I, N) for (ll i = I; i < N; ++i)
#define rep(i, N) REP(i, 0, N)

int main() {
    ll N, M, ans = 0;
    cin >> N >> M;
    vector<pair<ll, ll>> pairs(N);

    rep(i, N) {
        ll A, B;
        cin >> A >> B;
        pairs[i] = make_pair(A, B); // pairを挿入 price, stock
    }

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

    rep(i, N) {
        ll price, stocks;
        price = pairs[i].first;
        stocks = pairs[i].second;

        if (pairs[i].second < M) {
            M -= stocks;
            ans += price * stocks;
        } else {
            ans += M * price;
            cout << ans << "\n";
            return 0;
        }
    }
}


Measured memory_bytes: 1792
#include <stdio.h>
 
int main() {
  char ch[250]={0};
  char a[250] ={0};
  int h;
  int i,j,k,l,n,m;
 
 
  while(1){
    i=0;
    while(1){
       
      scanf("%c",&ch[i]);
      if(ch[i] == '\n') {    
    break;
      } 
      i++;
    }
    
    if ( i == 1 && ch[0] == '-' ) break;
 
    scanf("%d",&m);
     
    for(j=0;j<m;j++){
      scanf("%d", &h );
       
      for(k=0;k<i-h;k++) {
    a[k] = ch[h+k];
      }
      for(k=0;k<h;k++){
    a[i-h+k] = ch[k];
      }
      for(k=0; k<i; k++){
    ch[k] = a[k];
      }
    }
    for(k=0;k<i;k++) {
      printf("%c",ch[k]);
    }
    printf("\n");
      scanf("%c",&ch[0]);
  }
  return 0;
}


Measured memory_bytes: 2052
/*
AuThOr Gwj
*/
#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)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n,m;
const int MAXN=1<<18;
int tree[MAXN*8],val[MAXN*8];
void increase(int a){
	a+=MAXN-1;
	tree[a]++;
	val[a]=tree[a]-(a-MAXN+1);
	a>>=1;
	while(a){
		tree[a]=tree[a<<1]+tree[(a<<1)+1];
		val[a]=max(val[a<<1],val[(a<<1)+1]+tree[a<<1]);
		a>>=1;
	}
}
int query(int a,int b,int now=1,int l=1,int r=MAXN+1){
	if(r<=a||l>=b){
		return -INF;
	}
	if(r<=b&&l>=a){
		return val[now];
	}
	int mid=(l+r)>>1;
	return max(query(a,b,now<<1,l,mid),query(a,b,(now<<1)+1,mid,r));
}
set<mp> s;
mp sq[200000+2];
bool cmp(mp A,mp B){
	return A.SEC<B.SEC;
}
int main(){
	fastio;
	cin>>n>>m;
	memset(val,-63,sizeof(val));
	rb(i,1,n)
		cin>>sq[i].FIR>>sq[i].SEC,sq[i].FIR++,sq[i].SEC--;
	sort(sq+1,sq+1+n,cmp);
	int it=n;
	int res=n;
	rl(i,m,1){
		while(it&&sq[it].SEC>=i){
			mp now=sq[it--];
			increase(now.FIR);
		}
		res=max(res,query(1,m+1)+i+1);
	}
	res=n+m-res;
	res=min(res,n);
	cout<<n-res<<endl;
	return 0;
}


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

int main()
{
	int a, b, c, n=0, _a, _b, _c;
	cin>>a>>b>>c;
	while(a%2==0 && b%2==0 && c%2==0){
		if(a==b && b==c){
			n=-1;
			break;
		}
		_a = (b+c)/2;
		_b = (a+c)/2;
		_c = (a+b)/2;
		a = _a;
		b = _b;
		c = _c;
		n++;
	}
	cout << n << endl;
}

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

const int INF = 1e8;
int n,m;
int b[55][55];
int memo[2][55][55];

int main(){
  cin >> n;
  while(n--){
    cin >> m;
    rep(i,m)rep(j,m)cin >> b[i][j];
    int s,t;
    cin >> s >> t;

    memset(memo,-1,sizeof(memo));
    rep(i,m)memo[0][i][i] = 0;

    for(;;){
      bool f = false;
      rep(i,m)rep(j,m){
	if(i==j)continue;
	int maxv = memo[1][i][j];
	rep(k,m){
	  if(b[k][i])maxv = max(maxv, memo[1][k][j]);
	}
	maxv++;
	if(maxv>m)maxv = INF;

	if(memo[0][i][j] != maxv){
	  if(memo[0][i][j] == INF)continue;
	  memo[0][i][j] = maxv;
	  f = true;
	}
      }

      rep(i,m)rep(j,m){
	if(i==j)continue;
	int minv = memo[0][i][j];
	rep(k,m){
	  if(b[j][k]){
	    if(memo[0][i][k]>=0 && (minv<0 || minv>memo[0][i][k])){
	      minv = memo[0][i][k];
	    }
	  }
	}
	if(minv>m)minv = INF;

	if(memo[1][i][j] != minv){
	  if(memo[1][i][j] == INF)continue;
	  memo[1][i][j] = minv;
	  f = true;
	}
      }

      if(!f)break;
    }

    if(memo[0][s][t] == INF)cout << "infinity" << endl;
    else cout << memo[0][s][t] << endl;      
  }
}

Measured memory_bytes: 1208
#include <stdio.h>
int main(void){
	int n, i, a, b, c, t;
	for( scanf("%d",&n); n--; ){
		a = b = t = 0;
		for( i = 0; i < 10; i++ ){
			scanf("%d", &c );
			if( a > b ){
				if( c > a )	a = c;
				else if( c > b ) b = c;
				else t = 1;
			}
			else{
				if( c > b ) b = c;
				else if( c > a ) a = c;
				else t = 1;
			}
		}
		puts(t?"NO":"YES");
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 2 - 170;

vector<bool> get_prime(int n) {
    if(n <= 1) return vector<bool>{false, false};
    vector<bool> prime(static_cast<unsigned int>(n + 1), true);
    prime[0] = false; prime[1] = false;
    for(int i = 2; i * i <= n; i++){
        if(prime[i]) for(int j = i << 1; j <= n; j += i) prime[j] = false;
    }
    return(prime);
}

int main() {
    vector<int> v;
    auto a = get_prime(55555);
    for (int i = 11; i <= 55551; i += 10) {
        if(a[i]) v.emplace_back(i);
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        if(i) cout << " ";
        cout << v[i];
    }
    cout << "\n";
    return 0;
}


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

int main() {
  int a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  
  double water, sugar, answ = 100 * a, anss = 0;
  for(int i = 0; i <= 30; i++){
    if(100 * a * i > f) break;
    for(int j = 0; j <= 30; j++){
      if(100 * a * i + 100 * b * j > f) break;
      water = 100 * a * i + 100 * b * j;
      for(int k = 0; k <= 2900; k++){
        if(water + c * k > f || c * k > water / 100 * e) break;
        for(int l = 0; l <= 2900; l++){
          if(water + c * k + d * l > f || c * k + d * l > water / 100 * e) break;
          else{
            sugar = c * k + d * l;
            if(anss / (answ + anss) < sugar / (water + sugar)){
              anss = sugar;
              answ = water;
            }
          }
        }
      }
    }
  }
  
  cout << anss + answ << " " << anss << endl;
}

Measured memory_bytes: 256
S=input()
T=input()
fr=[s for s in S] 
to=[t for t in T]
N=len(fr)
h1=[];h2=[]
error=False
for i in range(N):
    if fr[i]==to[i]:#a,a
        if (fr[i] not in h1) and (to[i] not in h2):
            h1.append(fr[i]);h2.append(to[i])
        elif ((fr[i] in h1) and (to[i] not in h2)) or ((fr[i] not in h1) and (to[i] in h2)):
            error=True
            break;
        else:
            if h1.index(fr[i])==h2.index(to[i]):
                pass
            else:
                error=True
                break;
    else:
        if (fr[i] not in h1) and (to[i] not in h2):
            h1.append(fr[i]);h2.append(to[i])
        elif ((fr[i] in h1) and (to[i] not in h2)) or ((fr[i] not in h1) and (to[i] in h2)):
            error=True
            break;
        else:
            if h1.index(fr[i])==h2.index(to[i]):
                pass
            else:
                error=True
                break;
if error:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 7344
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
template<typename T> class Range {
    class Iterator {
        T val, step, diff;
    public:
        Iterator(T v, T s, T d): val(v), step(s), diff(d) {}
        T operator*() { return val + diff; }
        bool operator!=(const Iterator &itr) { return step > 0 ? val < itr.val : val > itr.val; }
        Iterator operator++() { val += step; return *this; }
    };
    Iterator _begin, _end;
public:
    Range(T b, T e, T s, T d): _begin(b, s, d), _end(e, s, d) {
        if (s < 0) { _begin = Iterator(e - 1, s, d); _end = Iterator(b - 1, s, d); }
    }
    Range(T b, T e, T s): Range(b, e, s, 0) {}
    Range(T b, T e): Range(b, e, 1, 0) {}
    Range(T e): Range(0, e, 1, 0) {}
    Iterator begin() { return _begin; }
    Iterator end() { return _end; }
};
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, m = 1LL << 60;
    cin, n;
    for (int i : Range<int>(5)) {
        ll a;
        cin, a;
        chmin(m, a);
    }
    print((n + m - 1) / m + 4);

    return 0;
}


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

int main(){
  int N,w=0,W;
  cin >> N;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin >> W;
    w+=W;
    vec[i]=w;
  }
  long ans=1000000000,cnt;
  for(int j=0;j<N;j++){
    cnt=max(vec[N-1]-vec[j],vec[j])-min(vec[N-1]-vec[j],vec[j]);
    ans=min(cnt,ans);
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
/*-- ILSH --*/
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define viii vector < vii >
#define vlll vector < vll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=200000+6;
const ll inf=1e18+1e17;
void solve(){
	map< pii, int > m;
	int n;
	cin>>n;
	ll total=0;
	for ( int i=1;i<=n;i++){
		int aa=i;
		int a=aa%10,b;
		while ( aa!=0){
			if ( a<10)
				b=aa%10;
			aa=aa/10;
		}
		total+=2*m[mp(b,a)];
		m[mp(a,b)]++;
		if ( a==b)
			total++;

	}
	cout<<total<<'\n';
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //    freopen ("INPUT.txt" , "r" , stdin);
    //    freopen ("OUTPUT.txt", "w" , stdout);
    // #endif	
    int t=1;
    //cin>>t;
    while ( t-- ){
    	solve();
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
#define INF (1e9)

int main() {
    ll N;
    cin >> N;
    vi A(N), P(N), Q(N);
    for (ll i = 0; i < N; i++) {
        A[i] = i + 1;
    }
    for (ll i = 0; i < N; i++) {
        cin >> P[i];
    }
    for (ll i = 0; i < N; i++) {
        cin >> Q[i];
    }

    ll idxP, idxQ, idx = 0;
    sort(A.begin(), A.end());
    do {
        bool flagP = true, flagQ = true;
        for (ll i = 0; i < N; i++) {
            flagP &= A[i] == P[i];
            flagQ &= A[i] == Q[i];
        }
        if (flagP) idxP = idx;
        if (flagQ) idxQ = idx;
        idx++;
    } while (next_permutation(A.begin(), A.end()));

    cout << abs(idxP - idxQ) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct UF{
    vector<int> par, sz;
    UF(){}
    UF(int n):par(n), sz(n, 1){
        iota(par.begin(), par.end(), 0);
    }
    int find(int x){
        if(x == par[x]) return x;
        return par[x] = find(par[x]);
    }
    void unite(int x, int y){
        x = find(x); y = find(y);
        if(x == y) return;
        if(sz[x] < sz[y]) swap(x, y);
        sz[x] += sz[y];
        par[y] = x;
    }
    bool same(int x, int y){
        return find(x) == find(y);
    }
};

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    rep(i, 0, m){
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    int ans = 0;
    rep(i, 0, m){
        UF uf(n);
        rep(j, 0, m){
            if(i == j) continue;
            uf.unite(a[j], b[j]);
        }
        if(uf.sz[uf.find(0)] != n) ans++;
    }
    cout << ans << endl;
}

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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);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++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

signed solve(){
    int N;
    cin>>N;
    vector<string>S(N),T(N);
    rep(i,N)cin>>S[i];
    rep(i,N)cin>>T[i];
    int A=0,B=0;
    rep(i,N){
        if(S[i]=="kougekida"&&T[i]=="kougekida"){
           if(A>B)return puts("Isono-kun");
           else if(A<B)return puts("Nakajima-kun");
           A=B=0;
        }
        else if(S[i]=="kougekida"){
            if(A==0)return puts("Nakajima-kun");
            if(A==5||T[i]!="mamoru")return puts("Isono-kun");
            A=0;
        }
        else if(T[i]=="kougekida"){
            if(B==0)return puts("Isono-kun");
            if(B==5||S[i]!="mamoru")return puts("Nakajima-kun");
            B=0;
        }
        else{
            if(S[i]=="tameru")A=min(A+1,5ll);
            if(T[i]=="tameru")B=min(B+1,5ll);
        }
    }
    puts("Hikiwake-kun");
    return 0;
}

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

Measured memory_bytes: 3212
#include <iostream>

using namespace std;

int digit(int n) {
  int count = 0;
  while (n > 0) {
    n /= 10;
    count++;
  }
  return count;
}

int powint(int base, int index) {
  int ret = 1;
  for (int i = 0; i < index; i++) {
   ret *= base; 
  }
  return ret;
}

int concat(int a, int b) {
  return a * powint(10, digit(b)) + b;
}

int is_squared(int n) {
  for (int i = 1; i * i <= n; i++) {
    if (i * i == n) {
      return true;
    }
  }
  return false;
}

int main()
{
 int a, b;
  cin >> a >> b;
  int ab = concat(a, b);
  cout << (is_squared(ab) ? "Yes" : "No") << endl;
}

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

#define MAX_N 100

int x[MAX_N];

int mypow(int a){
	return a * a;
}

int main(){
	int n;
	int p, i, sum_x = 0;
	int ans = 0;

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

	p = (int)round((float)sum_x/n);
	for(i=0; i<n; i++){
		ans += mypow(x[i]-p);
	}

	printf("%d", ans);

	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
using namespace std;
int n,x;
int a[2010];
long long ans=1e18;
int mn[2010][2010];
int main()
{
	scanf("%d%d",&n,&x); 
	for(int i=0;i<n;i++)scanf("%d",a+i),mn[i][i]=a[i];
	for(int l=2;l<=n;l++)
	{
		for(int i=0;i+l-1<n;i++)
		{
			int j=i+l-1;
			mn[i][j]=min(mn[i][j-1],a[j]);
		}
	}
	for(int k=0;k<n;k++)
	{
		long long res=1LL*k*x;
		for(int i=0;i<n;i++)
		{
			int l=(i+n-k)%n,r=i;
			if(l<=r)
			{
				res+=mn[l][r];
			}
			else
			{
				res+=min(mn[l][n-1],mn[0][r]);
			}
		}
		ans=min(ans,res);
	}
	printf("%lld",ans);
	return 0;
}

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

int main() {
  int h, w;
  int i, j;
  while (true) {
    cin >> h >> w;
    if (h == 0 && w == 0) {
      break;
    }
    for (i = 0; i < h; i++) {
      if (i % 2 == 0) {
        for (j = 0; j < w; j++) {
          if (j % 2 == 0) {
            cout << "#";
          } else {
            cout << ".";
          }
        }
      } else {
        for (j = 0; j < w; j++) {
          if (j % 2 == 0) {
            cout << ".";
          } else {
            cout << "#";
          }
        }
      }
      cout << endl;
    }
    cout << endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include<iostream>
#include<cstdlib>

using namespace std;

int main(){

  int N,L,a[1000],sum=0,x,j=0,y;

  cin >> N>>L;

  for(int i=0;i<N;i++){
    a[i]=L+i;

  }

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

x=abs(a[0]);

  for(int i=1;i<N;i++){
    x=min(abs(a[i]),x);
    if(x==abs(a[i])){
      j = i;
    }
  }
y = sum - a[j];

cout << y<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
//#include<array>
#include<algorithm>
#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>

using namespace std;
using LLI = long long int;
LLI N;

//vector<int>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//vector<int>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//vector<int>dir_x2 = { 0,0,1,-1 };
//vector<int>dir_y2 = { 1,-1,0,0 };
//vector<char>alp = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI tmp, r;
//	if (x < y) {
//		tmp = x;
//		x = y;
//		y = tmp;
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x,LLI y) {
//	return x / gcd(x,y) * y;
//}

//long nCr(int n,int r) {
//	long ans = 1;
//	for (int i = n; i > n - r;i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1;i++) {
//		ans = ans / i;
//	}
//	return ans;
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

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

Measured memory_bytes: 256
#include<iostream>
#include <string>
#include<algorithm>
#include <set>
#include <cmath>
using namespace std;
typedef long long lint;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep0(i,n) rep(i,0,n)

int main(void){
	ios::sync_with_stdio(false);
	long i, j, k, N, K, Q, res;
	cin >> N >> K >> Q;
	long A[Q], B[N];
	for (i = 0; i < Q; i++) cin >> A[i];
	for (i = 0; i < N; i++) B[i] = 0;
	for (i = 0; i < Q; i++) {
		B[A[i] - 1]++;
	}
	for (i = 0; i < N; i++) {
		if (K - Q + B[i] > 0) {
			cout << "Yes" << endl;

		}
		if (K - Q + B[i] <= 0) {
			cout << "No" << endl;

		}
		//cout << B[i] << endl;
	}
	return 0;
}

////sort Ｎ個の配列a
//sort(a, a + N); //昇順
//sort(a, a + N, greater<int>()); //降順
//
////最大公約数（ユークリッドの互除法利用）
//int gcd(int a, int b) {
//	if (a == 0) return b;
//	if (b == 0) return a;
//	int m = max(a, b);
//	int n = min(a, b);
//	if (m%n == 0) return n;
//	else return gcd(n, m%n);
//
//}
//
////最小公倍数
//int lca(int a, int b) {
//	if (a == 0) return 0;
//	if (b == 0) return 0;
//	return a * b / gcm(a, b);
//}
//
////n^k(整数)
//int pow_int(int n, int k) {
//	int re = 1;
//	for (int i = 0; i < k; i++) re *= n;
//	return re;
//}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
     ll n,k;
  cin>>n>>k;
  ll a,b;
  a=n;
  b=k;
    
  if(n>k)
    n=n%k;
 if(a>=b)
   cout<<min(n,abs(n-k));
  else
    cout<<min(n,abs(n-k));
 
    return 0;
}

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

#define int long long
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 reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int e[4];rep(i,4)cin>>e[i];
    sort(e,e+4);
    if(e[0]==e[1]&&e[2]==e[3])cout<<"yes"<<endl;
    else cout<<"no"<<endl;
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using ui = unsigned int;
const ll MOD = 1000000007;
const ll INF = 9223372036854775807;


//AtCoder Regular Contest 074-C
int main() {
	ll H;
	scanf("%lld", &H);
	ll W;
	scanf("%lld", &W);

	ll result = INF;

	//holizontal cut
	for (ll i = 1; i < H; i++) {
		vector<ll> s;
		s.push_back(W * i);
		ll lastH = H - i;

		if (W * lastH % 2 == 0) {
			s.push_back(W * lastH / 2);
			s.push_back(W * lastH / 2);
		}
		else {
			if (lastH > W) {
				//holizontal cut
				ll cutIndex = lastH / 2;
				s.push_back(W * cutIndex);
				s.push_back(W * (lastH - cutIndex));
			}
			else {
				//vartical cut
				ll cutIndex = W / 2;
				s.push_back(cutIndex * lastH);
				s.push_back((W - cutIndex) * lastH);
			}
		}

		sort(s.begin(), s.end());
		result = min(result, s[2] - s[0]);
	}

	//vartical cut
	for (ll i = 1; i < W; i++) {
		vector<ll> s;
		s.push_back(H * i);
		ll lastW = W - i;

		if (lastW * H % 2 == 0) {
			s.push_back(lastW * H / 2);
			s.push_back(lastW * H / 2);
		}
		else {
			if (lastW > H) {
				//vartical cut
				ll cutIndex = lastW / 2;
				s.push_back(H * cutIndex);
				s.push_back(H * (lastW - cutIndex));
			}
			else {
				//holizontal cut
				ll cutIndex = H / 2;
				s.push_back(cutIndex * lastW);
				s.push_back((H - cutIndex) * lastW);
			}
		}

		sort(s.begin(), s.end());
		result = min(result, s[2] - s[0]);
	}

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


//AtCoder Beginner Contest 045-C
/*
int main() {
	char S[11];
	scanf("%s", S);
	int len = (int)strlen(S);

	ll result = 0;

	for (int i = 0; i < (1 << (len - 1)); i++) {
		ll keta = 1;

		for (int j = 0; j < len; j++) {
			result += (ll)(S[len - j - 1] - '0') * keta;
			if ((i & (1 << j)) == 0) {
				keta *= 10;
			}
			else {
				keta = 1;
			}
		}
	}


	printf("%lld\n", result);
}
*/

//AtCoder Regular Contest 067-D
/*
int main() {
	ll N;
	scanf("%lld", &N);
	ll A;
	scanf("%lld", &A);
	ll B;
	scanf("%lld", &B);

	vector<ll> X(N);
	for (ll i = 0; i < N; i++) {
		scanf("%lld", &X[i]);
	}

	ll result = 0;

	for (ll i = 0; i < N - 1; i++) {
		ll dist = X[i + 1] - X[i];
		result += min(A * dist, B);
	}

	printf("%lld\n", result);
}
*/

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, h[16], w[16], col[3];
char in[4][5];
bool v[1 << 16];
int main(){
	cin >> n;
	rep(i, n) cin >> h[i] >> w[i];
	rep(i, 4){
		cin >> in[i];
		rep(j, 4) rep(k, 3){
			if(in[i][j] == "RGB"[k]) col[k] |= 1 << i * 4 + j;
		}
	}
	
	vi stamp;
	rep(i, n) for(int j = -h[i] + 1; j < 4; j++) for(int k = -w[i] + 1; k < 4; k++){
		int tx = min(max(0, j), 3), TX = min(max(0, j + h[i] - 1), 3);
		int ty = min(max(0, k), 3), TY = min(max(0, k + w[i] - 1), 3);
		
		int bit = 0;
		for(int l = tx; l <= TX; l++) for(int m = ty; m <= TY; m++)
		bit |= 1 << 4 * l + m;
		stamp.pb(bit);
	}
	sort(all(stamp));
	stamp.erase(unique(all(stamp)), stamp.end());
	int m = stamp.size();
	
	queue<pi> q;
	q.push(mp(0, 0));
	v[0] = 1;
	while(!q.empty()){
		int c = q.front().first, bit = q.front().second; q.pop();
		
		rep(i, stamp.size()) rep(j, 3){
			int nxt = bit & ~stamp[i] | stamp[i] & col[j];
			if(v[nxt]) continue;
			v[nxt] = 1;
			if(nxt == (1 << 16) - 1){
				cout << c + 1 << endl;
				return 0;
			}
			q.push(mp(c + 1, nxt));
		}
	}
	
	return 0;
}

Measured memory_bytes: 1476
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,s,e) for(int i=s;i<e;i++)

int main(){
    double n,m,d,ans;
    cin>>n>>m>>d;
    ans=((m-1)*2*(n-d))/(n*n);
    if(d==0)
    ans/=2;
    cout<<fixed<<setprecision(10)<<ans;
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=a; i<=b; i++){
		if(i%k==0){
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
	return 0;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int main(){
    cin.sync_with_stdio(false);
    ll n, k;
    cin >> n >> k;
    ll cnt = 0;
    repl(b, k + 1, n + 1) cnt += (n / b) * (b - k) + max(0LL, n % b - k + 1);
    if (k == 0) cnt -= n;
    cout << cnt << endl;
    return 0;
}

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

int main() {
  int x;
  int a;
  int b;
  int c;
  cin >> x;
  a = x / 100;
  b = (x - a * 100) / 10;
  c = x - a * 100 - b * 10;
  cout << a + b + c << endl;
}

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

int main(int argc, char const *argv[]) {
    int h, w, k;
    cin >> h >> w >> k;

    vector<vector <char> > m(h, vector<char>(w));
    for (size_t i = 0; i < h; i++) for (size_t j = 0; j < w; j++) cin >> m[i][j];

    int res = 0;
    for (int bith = 0; bith < (1<<h); bith++) {
        for (int bitw = 0; bitw < (1<<w); bitw++) {
            int cnt = 0;
            for (size_t i = 0; i < h; i++) {
                for (size_t j = 0; j < w; j++) {
                    if (!(bith & (1<<i)) && !(bitw & (1<<j)) && m[i][j] == '#') ++cnt;
                }
            }
            if (cnt == k) ++res;
        }
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3584
import java.util.Scanner;
public class Main {

	public static void main(String[] args) throws Exception{
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int A = scan.nextInt();
		int amari = N % 500;
		if( amari <= A ){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		scan.close();
	}
}


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

class Program {
    static void Main(string[] args) {
        var n = int.Parse(Console.ReadLine());
        var l = Console.ReadLine().Split(' ')
                .Select(x => int.Parse(x)).ToArray();
        var d = l[0]; var x = l[1];
        var ate = 0;
        for (var i = 0; n > i; i++) {
            var a = int.Parse(Console.ReadLine());
            ate++;
            var td = a + 1;
            var count = 2;
            while (td <= d) {
                ate++;
                td = a * count + 1;
                count++;
            }
        }
        Console.WriteLine(ate + x);
    }
}


Measured memory_bytes: 28088
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, W;
ll w[110];
int v[110];

ll dp[100100];

int solve() {
    fill_n(dp, 100100, 1e18);
    dp[0] = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 100000; j >= v[i-1]; j--) {
            dp[j] = min(dp[j], dp[j-v[i-1]]+w[i-1]);
        }
    }

    int res = 0;
    for (int i = 0; i <= 100000; i++) {
        if (dp[i] <= W) res = i;
    }
    return res;
}

void input() {
    cin >> n >> W;
    for (int i = 0; i < n; i++) cin >> w[i] >> v[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,x,y,z,t,f;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	if(0>a){
		x=0-(a);
		f=x*c;
		y=b*e;
		t=f+y+d;
	}
	else if(0<a){
		x=b-a;
		t=x*e;
	}
	printf("%d\n",t);
	return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

struct Edge{
    int from, to; ll cost;
    Edge(int from, int to, ll cost){
        this->from = from;
        this->to = to;
        this->cost = cost;
    }
    bool operator<(const Edge &e) const{
        return cost < e.cost;
    }
    bool operator>(const Edge &e) const{
        return cost > e.cost;
    }
};

struct Graph{
    int V,E;
    vector<vector< pair<int, ll> > > edges;

    Graph(){
        cin >> V >> E;
        edges.resize(V);
        int s,t; ll w;
        rep(E){
            cin >> s >> t >> w;
            edges[s].emplace_back(t, w);
            edges[t].emplace_back(s, w);
        }
    }

    ll kruskal(){
        ll ret = 0LL;
        priority_queue<Edge, vector<Edge>, greater<Edge> > que;
        vector<bool> used(V, false);

        used[0] = true;
        for(pair<int, ll> e: edges[0])
            que.push(Edge(0, e.first, e.second));

        while(!que.empty()){
            Edge e = que.top(); que.pop();
            while(!que.empty() && used[e.to]){
                e = que.top(); que.pop();
            }
            if(used[e.to]) break;
            ret += e.cost;
            used[e.to] = true;
            for(pair<int, ll> next: edges[e.to])
                if(!used[next.first]) que.push(Edge(e.to, next.first, next.second));
        }
        return ret;
    }
};

int main(){
    Graph g = Graph();
    cout << g.kruskal() << endl;
}


Measured memory_bytes: 10240
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

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

  int A, B, C;
  cin >> A >> B >> C;
  if (A == B) {
    cout << C << endl;
  } else if (B == C) {
    cout << A << endl;
  } else {
    cout << B <<endl;
  }

  return 0;
}


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

int main() {

    int N;
    cin >> N;
    vector<int> numbers(N);
    for (int i=0;i<N;i++){
        cin >> numbers.at(i);
    }
    int recover = 0;
    for (int i=0;i<N-1;i++){
        for (int j=i+1;j<N;j++){
            recover += numbers.at(i) * numbers.at(j);
//            cout << i << j << numbers.at(i) << numbers.at(j) << endl;
        }
    }
    cout << recover;

}

Measured memory_bytes: 256
#include<cstdio>
char ch;
int a[5];
int main()
{
    ch=getchar();a[ch-96]++;
    ch=getchar();a[ch-96]++;
    ch=getchar();a[ch-96]++;
    if (a[1]&&a[2]&&a[3]) puts("Yes");
    else puts("No");
}


Measured memory_bytes: 128
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1001001001;
const ll LONGINF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    int o = 0, e = 0;
    for(int i=1; i<=N; i++) {
        (i % 2 ? o : e)++;
    }

    double ans = 1.0 * o / (o + e);
    printf("%.12f\n", ans);
    return 0;
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  int a; scanf("%d", &a);
  printf("%d", a+a*a+a*a*a);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3808
#include <bits/stdc++.h>
    using namespace std;
    
    typedef long long ll;
    typedef pair<ll , ll> pair_t;
    
    bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
    }
    
    int main(){
        ll n  , a, b , temp ;
        bool flg = true;
        cin >> n;
        vector<pair_t> v;
        for(ll i = 0 ; i < n ; i++){
            cin >> a >> b;
            pair_t t;
            t = make_pair(b , a);
            v.push_back(t);
        }
        sort(v.begin() , v.end() , comp);
        temp = 0;
        for(ll i = 0 ; i < n ; i++){
            pair_t t;
            t = v[i];
            temp += t.second;
            if(temp > t.first){
                flg = false;
                break;
            }
        }
        if(flg){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
        
        return 0;
        
    }

Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int W,a,b;
    scanf("%d %d %d",&W,&a,&b);
    if(a>b) swap(a,b);
    int foo=a+W;
    if(b-foo<=0) puts("0");
    else
    {
        printf("%d\n",b-foo);
    }
    return 0;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int N, s[105]={};
ll ans = 0, score_sum = 0;

void solve(){
    if(score_sum % 10 != 0) ans = score_sum;
    else{
        rep(i,N){
            if((score_sum - s[i]) % 10 != 0) //条件を満たせば更新する
                ans = max(ans, score_sum - s[i]);
        }
    }

    cout << ans << endl;
}

int main(){
    cin >> N;

    rep(i, N){
        cin >> s[i];
        score_sum += s[i];
    }

    solve();
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N, D; cin >> N >> D;
    vector<vector<int>>X(N, vector<int>(D));
    rep(i, N)rep(j, D)cin >> X[i][j];
    int answer = 0;
    rep(i, N) {
        for(int j=i+1;j<N;j++) {
        	long double ans = 0;
            rep(k,D)ans += pow(abs(X[i][k] - X[j][k]), 2);
    	    ans = sqrt(ans);
   	    	if (ans == int(ans))answer++;
        }
    }
    cout << answer << endl;
}

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

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
inline int in() { int x; cin >> x; return x; }

int counte;
vector<bool> seen;
vector<bool> watch;
vector<int> member;
vector<int> F[100100];
vector<int> B[100100];
int answer[100100];
void dfs(int v) {
  if (!seen[v]) {
    counte++;
    member.push_back(v);
  }
  seen[v] = true;
  watch[v] = true;
  for (auto next_v : F[v]) {
    if (seen[next_v]) continue;
    dfs(next_v); // 再帰的に探索
  }
}

int main(){
  int N = in(), M = in(), K = in();
  watch.assign(N,false);
  REP(i,M+K) {
    int a = in()-1, b = in()-1;
    if (i<M) {
      F[a].push_back(b);
      F[b].push_back(a);
    }
    B[a].push_back(b);
    B[b].push_back(a);
  }
  REP(i,N) {
    if (watch[i] == 0) {
      counte = 0;
      seen.assign(N,false);
      member.assign(0,0);
      dfs(i);
      REP(j,member.size()) {
        int counter = 0;
        int mj = member[j];
        REP(l,B[mj].size()){
          if(seen[B[mj][l]] == 1)counter++;
        }
        answer[mj] = counte - counter - 1;
      }
    }
  }
  REP(i,N) cout << answer[i] << endl;
}


Measured memory_bytes: 14584
#include <iostream>

using namespace std;

bool check(int dt, int x1, int y1, int x2, int y2) {
    int dist = abs(x1 - x2) + abs(y1 - y2);
    return (dt >= dist and dt % 2 == dist % 2);
}

int main() {
    int n;
    cin >> n;
    int last_t = 0;
    int x1 = 0, y1 = 0;
    
    bool flag = true;
    
    for (int i = 1; i <= n; i++) {
        int t, x2, y2;
        cin >> t >> x2 >> y2;
        if (!check(t - last_t, x1, y1, x2, y2)) {
            flag = false;
            break;
        }
        last_t = t;
        x1 = x2;
        y1 = y2;
    }
    printf(flag ? "Yes\n" : "No\n");
}

Measured memory_bytes: 256