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

using namespace std;

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

    string x = "abc";

    for(int i = 0; i < 3; i++){
        int tmp = count(s.begin(),s.end(),x[i]);
        if(tmp > 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#define int long 
using namespace std;

signed main() {
	int X;
	cin >> X;
	if(X < 1200) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ARC" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int mask[5][5][6][6];
unsigned char memo[1<<20];

int rec(int S, int x, int cnt) {
  if (S>>20==0) return cnt + memo[S];
  if (x>=5) return INF;
  int res = INF;
  if ((S>>20+x)&1) {
    REP(i,5) {
      for (int w=1; w<=5-x; ++w) {
        res = min(res, rec(S ^ mask[i][x][5-i][w], x+1, cnt+1));
      }
    }
  } else {
    res = rec(S, x+1, cnt);
  }
  return res;
}


int main() {
  REP(i, 5) REP(j, 5)
    for (int h=1; h<=5-i; ++h)
      for (int w=1; w<=5-j; ++w) {
        int m = (1<<w)-1;
        REP(k,h) mask[i][j][h][w] ^= m<<(i+k)*5+j;
      }
  memset(memo, -1, sizeof(memo));
  queue<int> Q;
  Q.push(0);
  memo[0] = 0;
  while(!Q.empty()) {
    int S = Q.front();
    Q.pop();
    int c = memo[S] + 1;
//    cout << c << endl;
    REP(i, 4) {
      REP(j, 5) {
        for (int h=1; h<=4-i; ++h) {
          for (int w=1; w<=5-j; ++w) {
            // i+h, j+w
            int tmp = S^mask[i][j][h][w];
            if (memo[tmp] > c) {
              memo[tmp] = c;
              Q.push(tmp);
            }
          }
        }
      }
    }
  }
  // cout << (int)memo[473536] << endl;
  // cout << "OK" << endl;
  
  int n;
  while(cin >> n, n) {
    int SS = 0;
    REP(i,n) {
      REP(j,n) {
        bool a;
        cin >> a;
        if (a)
          SS |= 1<<i*5+j;
      }
    }
//    cout << bitset<25>(SS) << endl;
    int res;
    if (n<5) {
      res = memo[SS];
    } else
      res = rec(SS, 0, 0);
    
    REP(i,res)
      cout << "myon";
    cout << endl;
  }
}

Measured memory_bytes: 4464
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<string>
#include<map>
#include<set>
#include<math.h>

using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 1e9
#define eps 1e-6
#define PI acos(-1.0)
#define M 10010
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef pair<int, int>P;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;

ll n,x;
ll a[110];
ll sum[110];

int main() {
    IOS;
  //freopen("in.txt", "r", stdin);
  //freopen("out.txt","w",stdout);
  cin >> n >> x;
  for(int i = 1 ; i <= n; ++i){
     cin >> a[i];
  }
  sort(a+1,a+1+n);
  for(int i = 1; i <= n; ++i)
    sum[i] = sum[i-1] + a[i];
  if(sum[n] < x){
      cout << n-1 <<endl;
  }
  else if(sum[n] == x){
        cout << n << endl;
  }
  else{
     int pos = upper_bound(sum+1,sum+n+1,x)-sum-1;
     cout << pos << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> list(m);
  for(int i=0; i<m; i++) {
    cin >> list.at(i);
  }
  int x,y,ans=0;
  for(int i=0; i<n; i++) {
    x = c;
    for(int j=0; j<m; j++) {
      cin >> y;
      x += y*list.at(j);
    }
    if(x > 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    int a[N], b[N], c[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    long long INF = 1e+10;
    long long dp[N + 10][3];
    for (int i = 0; i < N + 10; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            dp[i][j] = 0;
        }
    }
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for (int i = 0; i < N - 1; i++)
    {
        dp[i + 1][0] = max({dp[i][1] + a[i + 1], dp[i][2] + a[i + 1], dp[i + 1][0]});
        dp[i + 1][1] = max({dp[i][0] + b[i + 1], dp[i][2] + b[i + 1], dp[i + 1][1]});
        dp[i + 1][2] = max({dp[i][0] + c[i + 1], dp[i][1] + c[i + 1], dp[i + 1][2]});
    }
    long long ans = max({dp[N - 1][0], dp[N - 1][1], dp[N - 1][2]});
    cout << ans << endl;
}


Measured memory_bytes: 3712
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

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



Measured memory_bytes: 3512
#include<iostream>
using namespace std;
int n, a, b, c, d, e, f, g, h;
int main() {
	while (true) {
		cin >> n; if (!n) { break; }
		for (int i = 0; i < n; i++) {
			cin >> a >> b >> c >> d >> e >> f >> g >> h;
			cout << a*e - b*f - c*g - d*h << ' ' << b*e + a*f + c*h - d*g << ' ' << c*e + a*g + d*f - b*h << ' ' << d*e + b*g + a*h - c*f << endl;
		}
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    int min_d = min(abs(a-x), abs(b-x));

    if(abs(a-x)==min_d) out("A");
    else out("B");
}


Measured memory_bytes: 256
void main()
{
    long[] tmp = rdRow;
    long n = tmp[0], p = tmp[1];
    long[] a = rdRow;

    long odd = a.count!(x => (x & 1) == 1);
    long even = n - odd;

    if (odd == 0) writeln(p ? 0 : 1L << even);
    else writeln(1L << (n - 1));
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
"use strict";
function Main(input){
	let xs = input.trim().split(' ')
    //console.log(xs[0],xs[1]);
    if(xs[0]=='D' && xs[1]=='D' || xs[0]=='H' && xs[1]=='H'){
    	console.log('H'); 
    } else {
    	console.log('D');
    }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long int ll;

const ll mod=1e9+7;

ll N,K;

ll fact[500005];
ll fact_inv[500005];

ll modPow(ll a, ll n) {
    if(n==1)return a%mod;
    if (n%2==1)return(a*modPow(a,n-1))%mod;
    ll t=modPow(a,n/2);
    return (t*t)%mod;
}

ll comb(ll n,ll r){
    return (((fact[n]*fact_inv[r])%mod)*fact_inv[n-r])%mod;
}

int main(){
    cin>>N>>K;
    fact[0]=1;
    fact_inv[0]=1;
    for(int i=1;i<=N;++i){
        fact[i]=fact[i-1]*i%mod;
        fact_inv[i]=modPow(fact[i],mod-2);
    }
    ll ans=0;
    for(int i=0;i<=min(N-1,K);++i){
        if(i==0)ans+=1;
        else ans+=comb(N-1,i)*comb(N,i)%mod;
        ans%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5888
#include <cstdio>
#include <algorithm>

struct T
{
  long long size;
  long long cost;
};

constexpr long long INF = 1e12;

int main()
{
  long long n;
  T tea[4];
  tea[0].size = 1, tea[1].size = 2, tea[2].size = 4, tea[3].size = 8;
  scanf("%lld%lld%lld%lld%lld", &tea[0].cost, &tea[1].cost, &tea[2].cost, &tea[3].cost, &n);
  long long dp[9] = {0, tea[0].cost, tea[1].cost, INF, tea[2].cost, INF, INF, INF, tea[3].cost};
  for (int i = 0; i < 4; ++i)
  {
    for (int j = 1; j <= 8; ++j)
    {
      if (j - tea[i].size >= 0)
      {
        dp[j] = std::min(dp[j], dp[j - tea[i].size] + tea[i].cost);
      }
    }
  }
  printf("%lld\n", dp[(n * 4) % 8] + dp[8] * ((n * 4) / 8));  
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>

int main() {
  int n, d, x;
  scanf("%d %d %d", &n, &d, &x);

  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    x += (d+a-1) / a;
  }
  printf("%d\n", x);
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

int main()
{
    int n;
    cin >> n;
    map<string, int> map;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;

        auto iter = map.find(s);
        if (iter != end(map))
        {
            map[s]++;
        }
        else
        {
            map[s] = 1;
        }
    }

    int m;
    cin >> m;
    
    for (int i = 0; i < m; i++)
    {
        string s;
        cin >> s;

        auto iter = map.find(s);
        if (iter != end(map))
        {
            int num = iter->second;
            map[s] = num-1;
        }
    }

    int maxNum = 0;
    for (auto iter = map.begin(); iter != map.end(); iter++)
    {
        maxNum = max(iter->second, maxNum);
    }
    
    cout << maxNum << endl;
}

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

int sumDigits(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

// main
int main(){
    int N; cin >> N;
    int min = 1e6;
    rep(a, N){
        int b = N - a;
        int ab = sumDigits(a) + sumDigits(b);
        if(min > ab) min = ab;
    }
    cout << min << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}*/


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

	char b;
	cin >> b;

	if (b == 'A') {
		cout << 'T' << endl;
	}
	else if (b == 'T') {
		cout << 'A' << endl;
	}
	else if (b == 'C') {
		cout << 'G' << endl;
	}
	else if (b == 'G') {
		cout << 'C' << endl;
 	}

	return 0;
}

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

int main() {
    int a,b;
    cin >> a >> b;
    if (a > b) {
        cout << "a > b";
    }else if (a < b) {
        cout << "a < b";
    } else if (a == b) {
        cout << "a == b";
    }
    cout << endl;
    
    return 0;

}

Measured memory_bytes: 1156
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long
const int mod=1000000007;
int f[310][310][310];
struct node{
	int l,x;
};
int n,m,l,r,x,ans;
vector<node>v[310];
bool check(int a,int b,int c){
	int r=max(max(a,b),c);
	for(int i=0;i<v[r].size();i++){
        int l=v[r][i].l,x=v[r][i].x,s=0;
        s=(a>=l)+(b>=l)+(c>=l);
        if(s!=x)return false;
    }
	return true;	
}
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%lld%lld%lld",&l,&r,&x);
		v[r].push_back((node){l,x});
	}
	f[0][0][0]=1;
	for(int i=0;i<=n;i++)
		for(int j=0;j<=n;j++)
			for(int k=0;k<=n;k++){
				r=max(max(i,j),k);
				if(i&&j&&i==j||i&&k&&i==k||j&&k&&j==k)continue;
				if(!check(i,j,k))f[i][j][k]=0;
				if(!f[i][j][k])continue;
				if(r==n){
					(ans+=f[i][j][k])%=mod;
					continue;
				}
				(f[r+1][j][k]+=f[i][j][k])%=mod;
				(f[i][r+1][k]+=f[i][j][k])%=mod;
				(f[i][j][r+1]+=f[i][j][k])%=mod;
			}
	printf("%lld\n",ans);
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using Graph = vector<vector<int>>;

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

    ll ans = 1000000000001;
    for(ll i = 1; i <= floor(sqrt(N)); i++)
    {
        if(N % i == 0)
        {
            ll j = N / i;
            ans = min(ans, i + j);
        }
    }
    cout << ans - 2 << endl;
}

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

int main(){
    int N,T;cin>>N>>T;
    vector<int> a(N);
    for(int i=0;i<N;i++)cin>>a.at(i);

    int ans=0;
    for(int i=0;i<N-1;i++){
        if(a.at(i+1)-a.at(i)<T)ans+=a.at(i+1)-a.at(i);
        else ans+=T;
    }

    cout<<ans+T<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#define FOR(i,n) for(int i=0;i<n;i++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define INI(n) scanf("%d",&n)
#define INL(n) scanf("%lld",&n)
#define INF 10000000000
#define mod 1000000007
#define X 100000
#define N 20
#define M 46
typedef long long int ll;
ll finv[X];
ll fac[X];
ll inv[X];
ll usort(const void *a, const void *b){return *(ll*)a-*(ll*)b;}
ll dsort(const void *a, const void *b){return *(ll*)b-*(ll*)a;}
ll ssort(const void *a, const void *b){return strcmp((char*)a,(char*)b);}
ll min(ll a,ll b){
  if(a>b)return b;
  return a;
}
ll max(ll a,ll b){
  if(a>b)return a;
  return b;
}
ll z(ll a){return max(a,-a);}
ll gcd(ll a,ll b){if(!b){return a;}else{return gcd(b,a%b);}}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
ll kt(ll a){
  ll sum=0;
  while(a){
    a/=10;
    sum++;
  }
  return sum;
}
ll ks(ll a){
  ll sum=0;
  while(a){
    sum+=a%10;
    a/=10;
  }
  return sum;
}
void nCrReady(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for (ll i=2;i<X;i++){
    fac[i]=fac[i-1]*i%mod;
    inv[i]=mod-inv[mod%i]*(mod/i)%mod;
    finv[i]=finv[i-1]*inv[i]%mod;
  }
}
ll nCr(ll n,ll k){return fac[n]*(finv[k]*finv[n-k]%mod)%mod;}

ll x[200001];
int main(void){
  ll x;
  scanf("%lld",&x);
  PRL(x/500*1000+x%500/5*5);
  return 0;
}

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

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>

using namespace std;


//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/*int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
    return power((a*a)%mod,n/2)%mod;
}*/
//const int md = 998244353;

signed main()
{
    showoff;
    int k,a,b;
    cin >> k >> a >> b;
    if(k <= a-1){
        cout << a;
        return 0;
    }
    if(b <= a+2 || k-a+1 < 2){
        cout << k+1;
        return 0;
    }
    int ol = k-a-1;
    cout << b*(ol/2+1)-(ol/2)*a+ol%2 << "\n";
    
    
}
//*->for large size of matrix take int not long long if possible......

Measured memory_bytes: 256
N = int(input())

count = 0
for i in range(1, N + 1):
    str_i = str(i)

    # 末尾が0の時は何もしない
    if int(str_i[-1]) == 0:
        continue

    # 1桁のとき
    if len(str_i) == 1:
        count += 1
        continue

    # 2桁のとき
    if len(str_i) == 2:
        if int(str_i[0]) > int(str_i[-1]):
            count += 2 # (例：21のとき (12, 21)と(21, 12))
        # 先頭と末尾の数字が等しい時
        if int(str_i[0]) == int(str_i[-1]):
            count += 3  # (例：77のとき (77, 77)と(7, 77)と(77,7))
        continue

    # 自分と同じ桁でひっくりかえしたとき
    # 例：3421のとき、 1**3  (**は00~99)
    if int(str_i[0]) > int(str_i[-1]):
        count += (10 ** (len(str_i) - 2)) * 2

    # 先頭と末尾の数字が等しい時
    # 例：2432のとき、2**2 (**は00~42と43)
    if int(str_i[0]) == int(str_i[-1]):
        count += (int(str_i[1:-1])) * 2 + 1
        count += 2  # 例：121のとき、1

    # 自分より少ない桁でひっくり返した時
    # 例：3431のとき、1*3と13
    for j in range(len(str_i) - 2):
        count += (10 ** j) * 2

print(count)


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[]str = Console.ReadLine().Split();
		int N = int.Parse(str[0]);
		int K = int.Parse(str[1]);
		string[]str2 = Console.ReadLine().Split();
		int R = int.Parse(str2[0]);
		int S = int.Parse(str2[1]);
		int P = int.Parse(str2[2]);
		string T = Console.ReadLine();
		long[,]A = new long[N+K+1,2];
		for(var i=0;i<K;i++){
			int i1 = i;
			while(true){
			string s1 = T.Substring(i1,1);
			int p1 = 0;
			if(s1=="r"){
				p1 = P;
			} else if(s1=="s"){
				p1 = R;
			} else {
				p1 = S;
			}
			if(i1>=K && T.Substring(i1-K,1)==s1){
				A[i1+K,0] = A[i1,1]+p1;
				A[i1+K,1] = A[i1,0];
			} else {
				A[i1+K,0] = A[i1,0]+p1;
				A[i1+K,1] = A[i1,0];
			}
			i1 += K;
			if(i1 >= N){
				break;
			}
            }
		}
		long ans = 0;
		for(var i=N-1;i>=N-K;i--){
			ans += A[i+K,0];
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 17316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;

long long dp[200005];
int samechar[30]; 
int main(){

	string s;
	int len;
	cin>>s;	
	len=s.length();
	dp[0]=1;
	samechar[s[0]-'a']++; 
	rep(i,1,len)
	{	
		dp[i]=dp[i-1]+i-samechar[s[i]-'a']; 
		samechar[s[i]-'a']++; 
	}
	cout<<dp[len-1]<<endl;
    return 0;
    
    
    
}


Measured memory_bytes: 2180
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#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 iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

int main(){
    
    int N; cin>>N;
    vector<ll> a(N);
    REP(i,N)cin>>a[i];
    
    map<ll,ll> table;
    REP(i,N)table[a[i]]=i+1;
    
    set<ll> used;
    used.insert(table[1]);
    ll ans=table[1]*(N-table[1]+1);
    for(ll i=2;i<=N;i++){
        used.insert(table[i]);
        auto itr=used.find(table[i]);
        if(itr==used.begin()){
            itr++;
            ans+=i*(table[i])*(*itr-table[i]);
        }else{
            auto litr=itr; litr--;
            itr++;
            if(itr==used.end()){
                ans+=i*(N-table[i]+1)*(table[i]-*litr);
            }else{
                ans+=i*(*itr-table[i])*(table[i]-*litr);
            }
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 23680
#include <stdio.h>
int main() 
{
  int m1, m2, d1, d2;
  scanf("%d %d", &m1, &d1);
  scanf("%d %d", &m2, &d2);
  
  m1 += 1;
  if (m2 == m1 && d2 == 1) {
  	printf("%d\n", 1);
  }
  else {
  	printf("%d\n", 0);
  }
  
  return 0;
}

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

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

int main() {
  string sa, sb, sc;
  cin >> sa >> sb >> sc;
  char next='a';
  int na=0, nb=0, nc=0;
  while(true) {
    if(next=='a') {
      if(na==sa.size()) {
        na++;
        break;
      }
      next=sa[na];
      na++;
    }
    else if(next=='b') {
      if(nb==sb.size()) {
        nb++;
        break;
      }
      next=sb[nb];
      nb++;
    }
    else {
      if(nc==sc.size()) {
        nc++;
        break;
      }
      next=sc[nc];
      nc++;
    }
  }
  if(na==sa.size()+1)
    cout << 'A' << endl;
  else if(nb==sb.size()+1)
    cout << 'B' << endl;
  else
    cout << 'C' << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    ll X;
    in(X);

    ll MIN = -1000;
    ll MAX = 1000;
    for (ll i=MIN; i<MAX-1; i++) {
        for (ll j=i+1; j<MAX; j++) {
            ll i5 = i*i*i*i*i;
            ll j5 = j*j*j*j*j;
            if (i5 - j5 == X) {
                out(i << ' ' << j);
                exit(0);
            }
            else if (i5 + j5 == X) {
                out(i << ' ' << -j);
                exit(0);
            }
            else if (i5 - j5 == -X) {
                out(-i << ' ' << -j);
                exit(0);
            }
            else if (i5 + j5 == -X) {
                out(-i << ' ' << j);
                exit(0);
            }
        }
    }

	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}

const int M = 2005;

bool match(char x, char y) {
  return (x == y) || (x == '?') || (y == '?');
} 

int main() {
  string a, b, c; cin >> a >> b >> c;
  int la = a.size();
  int lb = b.size();
  int lc = c.size();

  vector<bool> ab(4*M+5, true);
  vector<bool> bc(4*M+5, true);
  vector<bool> ca(4*M+5, true);

  rep(i, la) rep(j, lb) if (!match(a[i], b[j])) ab[2*M+i-j] = false;
  rep(i, lb) rep(j, lc) if (!match(b[i], c[j])) bc[2*M+i-j] = false;
  rep(i, lc) rep(j, la) if (!match(c[i], a[j])) ca[2*M+i-j] = false;

  int ans = INF;
  rep2(i, -2*M, 2*M) rep2(j, -2*M, 2*M) {
    if (j-i <= 2*M && j-i >= -2*M && ab[2*M+i] && bc[2*M+j-i] && ca[2*M-j]) {
      chmin(ans, max({la, i+lb, j+lc}) - min({0, i, j}));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n, m, v, p = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort()
a = a[::-1]

ans = p

b = a[p:]
b_cumsum = [a[p - 1]]
for i in b:
    b_cumsum.append(b_cumsum[-1] + i)

for i in range(len(b)):
    vote_cnt = max(0, (v - p - (len(b) - (i + 1)))) # 上位p-1問と自分と自分より小さい問題にmずつ加算して余った回数
    if b_cumsum[i] + m * vote_cnt <= (b[i] + m) * (i + 1) and a[p - 1] <= b[i] + m: # 余った回数は好きな問題に分けて平均を取ると考える、そもそもp問目に追い付けないとアウト
        ans += 1
    else:
        break

print(ans)

Measured memory_bytes: 61336
/*
 * atcoder/abc128/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

int N, K;
vector<ll> J;

void solve() {
  cin >> N >> K;
  J.resize(N);
  loop(n,0,N) cin >> J[n];

  ll max_ = 0;
  for (int a=0; a<=N; a++) {
    for (int b=0; b<=N; b++) {
      if (a+b > min(N,K)) break;
      // cout << "a = " << a << " b = " << b << " J+a = " << *(J.begin()+a) << " J+(N-b) = " << *(J.begin()+(N-b)) << endl;
      vector<ll> v;
      v.insert(v.end(), J.begin(), J.begin()+a);
      v.insert(v.end(), J.begin()+(N-b), J.end());
      sort(v.begin(), v.end());
      int d = K-(a+b);
      int idx = 0;
      while (d>0 and idx < v.size() and v[idx] < 0) {
        d--; idx++;
      }
      ll total = 0;
      for (;idx<v.size(); idx++) total += v[idx];
      chmax(max_, total);
    }
  }
  cout << max_ << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 256
/**
 *    author:  math2do
 *    created: 05.09.2020 12:34:24
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector <int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  } 
  vector <bool> dp(k + 1, false);
  dp[0] = false;
  // dp[i] = true if i remaining stones are present
  for (int s = 0; s <= k; s++) {
    for (int i = 0; i < n; i++) {
      if (arr[i] <= s && dp[s - arr[i]] == false) {
        dp[s] = true;
      } 
    } 
  }

  puts(dp[k] ? "First" : "Second");
  return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
const int B = 300000+10;
const int N = 10000+10;
const int P = 26    +100;
#define LL long long int
char a[B];

int main()
{

    int n;
    map<int,int>Map;
    while(scanf("%d",&n)==1)
    {
        Map.clear();
        for(int i=1;i<=n;i++)
        {
            int x;
            scanf("%d",&x);
            Map[x]++;
        }
        vector<int>vect;
        LL maxn=0;
        for(map<int,int>::iterator it = Map.begin();it!=Map.end();it++)
        {
            if(it->second>=2)
            {
                vect.push_back(it->first);

                if(it->second>=4)
                {
                    maxn=max(maxn,(LL)it->first*it->first);
                }
            }
        }
        sort(vect.begin(),vect.end());
        if(vect.empty())
        {
            printf("0\n");
            continue;
        }
        if(vect.size()==1)
        {
            printf("%lld\n",maxn);
            continue;
        }


            LL s=(LL)vect[vect.size()-1];
            LL t=(LL)vect[vect.size()-2];
            printf("%lld\n",max(maxn,s*t));

    }
return 0;
}


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

int dp[223456][3];
bool used[223445][3];
int n, a[312312], b[312312], c[312312];
int mx;
vector <int> v[5];
int mn = 50102031;

string s;
int main() {
    cin >> s;
    int bal = 0;
    int ans = 0;
    for(int i = 0; i < s.size(); i++) {
    	if(s[i] == 'p') if(bal) bal--;
    	else ans--;
    	else
    		bal++;
    }
    ans += bal / 2;
    cout << ans;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
unsigned int conv1(string S){
  unsigned int ans = 0;
  for (int i = 0; i < 8; i++){
    ans <<= 4;
    if ('0' <= S[i] && S[i] <= '9'){
      ans += S[i] - '0';
    } else {
      ans += S[i] - 'a' + 10;
    }
  }
  return ans;
}
string conv2(unsigned int x){
  string ans;
  for (int i = 0; i < 8; i++){
    int d = x % 16;
    if (d < 10){
      ans += '0' + d;
    } else {
      ans += 'a' + d - 10;
    }
    x >>= 4;
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
int main(){
  int S;
  cin >> S;
  for (int i = 0; i < S; i++){
    vector<string> h(9);
    for (int j = 0; j < 9; j++){
      cin >> h[j];
      while (h[j].size() < 8){
        h[j] = '0' + h[j];
      }
    }
    vector<unsigned int> N(9);
    for (int j = 0; j < 9; j++){
      N[j] = conv1(h[j]);
    }
    unsigned int K = 0;
    for (int j = 0; j < 32; j++){
      unsigned int sum = 0;
      for (int k = 0; k < 8; k++){
        sum += N[k] ^ K;
      }
      unsigned int check = N[8] ^ K;
      unsigned int bit = (unsigned int) 1 << j;
      if ((sum & bit) != (check & bit)){
        K |= bit;
      }
    }
    string ans = conv2(K);
    while (ans[0] == '0' && ans.size() > 1){
      ans.erase(ans.begin());
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 3144
n = int(input())
a = list(map(int, input().split()))
f = [0 for i in range(100005)]
for x in a:
    f[x + 1] += 1
maks = 0
for i in range(1, 100002):
    maks = max(maks, f[i - 1] + f[i] + f[i + 1])
print(maks)

Measured memory_bytes: 14092
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>//辞書順はnext_permutation
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<utility>//swap(数値交換)
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define rt "\n"
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define please return
#define AC 0

int main() {
	int n, sum = 0;
	cin >> n;
	vint t(n);
	vstr s(n);
	string x;
	rep(i, n) {
		cin >> s[i] >> t[i];
		sum += t[i];
	}
	cin >> x;
	int i = 0;
	while(true) {
		if (s[i] != x) {
			sum -= t[i];
		}
		if (s[i] == x) {
			sum -= t[i];
			break;
		}
		i++;
	}
	cout << sum << rt;
	please AC;
}

// abc : 141 , aoj : ITP1_6_D
//sort, abs, swap, reverse, max, min
//__gcd, substring, erase, push_back,stoll、stoi

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

using namespace std;

int main(int argc, char const *argv[]) {
    int n, m;
    int first, year, ver, fee;
    double rate;
    int result = 0;
    vector<int> results;

    cin>>m;
    for (int i = 0; i < m; i++) {
        cin>>first;
        cin>>year;
        cin>>n;
        int temp;
        result = 0;
        for(int j = 0; j < n; j++){
            cin>>ver>>rate>>fee;
            temp = 0;
            if(ver){
                temp = first;
                for(int k = 0; k < year; k++){
                    temp += int(temp*rate) - fee;
                }
            }
            else{
                int first_temp = first;
                for(int k = 0; k < year; k++){
                    temp += int(first_temp*rate);
                    first_temp -= fee;
                    if(k == year-1){
                        temp += first_temp;
                    }
                }
            }
            if(result < temp){
                result = temp;
            }
        }
        results.push_back(result);
    }

    for(auto it = results.begin(); it != results.end(); it++){
        cout<<*it<<endl;
    }
    return 0;
}

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    int zei8,zei10;
    cin >> zei8 >> zei10;
//    cout << zei8 << " "<< zei10 << endl;
    int ans8,ans10;
    ans8  = ceil(zei8  / 0.08);
    ans10 = ceil(zei10 / 0.1);
//    cout << ans8 << " " << ans10 << endl;
    int ans = max(ans8,ans10);
//    cout << ans << endl;
//    cout << (ans*8/100) << " " << (ans*10/100) << endl;
//    if(zei8 == (ans*8/100) && zei10 == (ans*10/100)){
    if(zei8 == (floor(ans*0.08)) && zei10 == (floor(ans*0.1))){
        cout << ans << endl;
    }else{
        cout << -1 << endl;
    }

}


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

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

    int K; cin >> K;
    ll s = 0;
    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                s += __gcd(i,__gcd(j,k));
            }
        }
    }
    cout << s;

    return 0;
}


Measured memory_bytes: 3652
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    
    if op == "?":
        break
    
    if op == "+":
        print(a + b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a //b)


Measured memory_bytes: 5592
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, K;
	long double ans = 0;
	
	cin>>N>>K;
	
	for(int i = 1; i <= N; i++){
		// ans += 1.0/N*pow(0.5,(K+i-1)/i);
		int con = 0;
		
		for(int num = i; num < K ; num *= 2){
			con++;
			// if(num >= K) break;
		}
		// cout<<con<<endl;
		ans += pow(0.5,con);
	}
	
	
	ans /= N;
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define p 1000000007
#define pb push_back
double dp[3000][3000];

double probability(int n,int x,vector<double> &v)
{
    // probability of getting atleast x heads when n coins are tossed up...
    //cout<<n<<" "<<x<<"\n";
    if(n==0)
    {
        //cout<<"ye chala hoga"<<"\n";
        return dp[n][x]=(x==0?1:0);
    }
    else if(x==0)
    {
        return dp[n][x]=1;
    }
    else
    {
        if(dp[n][x]>-0.9)
        {
            return dp[n][x];
        }
            return dp[n][x]=(v.at(n)*probability(n-1,x-1,v)+(1-v.at(n))*probability(n-1,x,v));
    }
}


double solve(int n,vector<double> &v)
{
    memset(dp,-1,sizeof(dp));
    int x=(n+1)/2;
    // atleast x heads tu aane he chahiye.......
    return probability(n,x,v);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n;
    cin>>n;
    
    vector<double> v(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>v.at(i);
    }
    cout<<fixed<<setprecision(12)<<solve(n,v);
    return 0;
}





Measured memory_bytes: 70912
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

class Data {
    final int id;
    final int solved;
    int rank = 0;
    public Data(int id, int solved) {
        this.id = id;
        this.solved = solved;
    }
}

class Main {
    private static void solve() {
        final Scanner scanner = new Scanner(System.in).useDelimiter("[,\\s]+");

        final List<Data> result = new ArrayList<Data>();
        while (true) {
            final int id = scanner.nextInt();
            final int solved = scanner.nextInt();
            if (id == 0 && solved == 0) {
                break;
            }
            result.add(new Data(id, solved));
        }
        Collections.sort(result, new Comparator<Data>() {
            public int compare(Data o1, Data o2) {
                return o1.solved == o2.solved ? 0 : (o1.solved > o2.solved ? -1 : 1);
            }
        });
        int rank = 0;
        int solved = 0;
        for (Data data: result) {
            if (data.solved != solved) {
                rank++;
                solved = data.solved;
            }
            data.rank = rank;
        }
        Collections.sort(result, new Comparator<Data>() {
            public int compare(Data o1, Data o2) {
                return o1.id == o2.id ? 0 : (o1.id > o2.id ? 1 : -1);
            }
        });
        while (scanner.hasNextInt()) {
            System.out.println(result.get(scanner.nextInt() - 1).rank);
        }
    }

    public static void main(String... args) {
        solve();
    }
}

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

#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pb2 pop_back
#define pf push_front
#define pf2 pop_front
#define line printf("\n")
#define rep(k,i,j) for(int k = (int)i;k<(int) j;k++)
#define repd(k,i,j) for(int k = i;k>=(int)j;k--)
#define ll long long
#define pq priority_queue

int dirx[8] = {0,1,0,-1,1,1,-1,-1};
int diry[8] = {1,0,-1,0,1,-1,1,-1};

const int INF = 1e9+7;
const ll INFLL = 1e16;
const double EPS = 1e-6;

using namespace std;

const int maxn = 1e5+5;
int n, lv[maxn], id[maxn], par[maxn], vis[maxn];
vector<int> adj[maxn];

void dfs(int now, int pr, int l) {
	lv[now] = l; par[now] = pr;
	for (auto nx : adj[now]) {
		if (nx==pr) continue;
		dfs(nx,now,l+1);
	}
	return;	
}

bool cmp(int a, int b) { return lv[a]>lv[b]; }

int main(){
	scanf("%d",&n);
	
	rep(k,1,n){
		int a,b;
		cin>>a>>b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	
	int ada = 0,chain = 1;
	
	dfs(1,-1,0);
	rep(i,1,n+1) id[i] = i;
	sort(id+1, id+1+n, cmp);
	memset(vis, 0, sizeof(vis));
	for (int i=1; i<=n; i++) {
		int no = id[i];
		if (vis[no]) continue;
	//	printf ("i = %d, par = %d\n", i, par[i]);
		if (par[no]<0 || vis[par[no]]) {
			ada = 1; break;
		}
		vis[no] = vis[par[no]] = 1;
	}
	
	if(ada)puts("First");
	else puts("Second");
	
	return 0;
}

Measured memory_bytes: 7424
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

string s;
bool isYaki(){
  if (s.size()<4)return false;
  return s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I';
    
}

int main(){ _;
  cin>>s;
  cout<<(isYaki()?"Yes":"No")<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define int long long
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define inf 1000000000000000007
#define f first
#define s second
#define mini(c,a,b) *min_element(c+a,c+b)
#define maxi(c,a,b) *max_element(c+a,c+b)
//printf("%.12Lf\n",c);
int keta(int x){
	rep(0,i,30){
		if(x<10){
			return i+1;
		}
		x=x/10;
	}
}
int gcd(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return bb;
		}	
		bb=bb%aa;
		if(bb==0){
			return aa;
		}
	}
}	
int lcm(int x,int y){
	int aa=x,bb=y;
	rep(0,i,1000){
		aa=aa%bb;
		if(aa==0){
			return x/bb*y;
		}	
		bb=bb%aa;
		if(bb==0){
			return x/aa*y;
		}
	}
}
bool p(int x){
	if(x==1)return false;
	rep(2,i,sqrt(x)+1){
		if(x%i==0&&x!=i){
			return false;
		}
	}	
	return true;
}
int max(int a,int b){
	if(a>=b)return a;
	else return b;
}
int min(int a,int b){
	if(a>=b)return b;
	else return a;
}	
int n2[41];		
int nis[41]; 
int nia[41];
int mody[41];
int nn;
int com(int n,int y){
	int ni=1;
	for(int i=0;i<41;i++){
		n2[i]=ni;
		ni*=2;
	}
	int bunsi=1,bunbo=1;
	rep(0,i,y)bunsi=(bunsi*(n-i))%mod;
	rep(0,i,y)bunbo=(bunbo*(i+1))%mod;
	mody[0]=bunbo;
	rep(1,i,41){
		bunbo=(bunbo*bunbo)%mod;
		mody[i]=bunbo;
	}
	rep(0,i,41)nis[i]=0;
	nn=mod-2;
	for(int i=40;i>=0;i-=1){
		if(nn>n2[i]){
			nis[i]++;
			nn-=n2[i];
		}
	}
	nis[0]++;
	rep(0,i,41){
		if(nis[i]==1){
			bunsi=(bunsi*mody[i])%mod;
		}
	}
	return bunsi;
}
int yakuwa(int n){
	int sum=0;
	rep(1,i,sqrt(n+1)){
		if(n%i==0)sum+=i+n/i;
		if(i*i==n)sum-=i;
	}
	return sum;
}	
bool hei(int n){
	rep(0,i,100){
		if(i*i==n){
			return true;
		}
	}
	return false;
}		
int a[114514],b[114514];
string ss[114514];
signed main(){
	ic(n)
	c((n+1)/2)
}

Measured memory_bytes: 1152
#include <iostream>
using namespace std;
#define LEN 200005

class pp{
public:
	string name;
	int t;
};

pp Q[LEN+1];
int head=0, tail = -1, n;

void enqueue(pp x){
	tail++;
	tail %= LEN;
	Q[tail].name = x.name;
	Q[tail].t = x.t;
	//cout << "enqueue(" << x.name << "," << x.t << ")" << endl; 
}

pp dequeue(){
	pp res;
	res.name = Q[head % LEN].name;
	res.t = Q[head % LEN].t;
	head++;
	head %= LEN;

	//cout << "dequeue(" << res.name << "," << res.t << ")" << endl; 
	return res;
}

int main(){
	int elaps = 0, c;
	int i, q, n;

	pp u;

	cin >> n >> q;
	for(i = 1; i <= n; i++){
		cin >> u.name >> u.t;
		enqueue(u);
	}

	for(i = 0; i <LEN; i++){
		u = dequeue();
		u.t -= q;
		if(u.t > 0){
			enqueue(u);
			elaps += q;
		}else{
			elaps += (q + u.t);
			cout << u.name << " " << elaps << endl;
		}
		if(tail - head == -1 || (tail == 0 && head == LEN)){
			break;
		}
	}

	return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll X, N; cin >> X >> N;
  set<ll> s; rep(i,N) { ll p; cin >> p; s.insert(p); }
  ll result = -1, diff = 0;
  while (result==-1) {
    if (X-diff>=0&&!s.count(X-diff)) result = X-diff;
    else if (!s.count(X+diff)) result = X+diff;
    diff++;
  }
  cout << result << endl;
  return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
#define ll long long
typedef pair<int, int> P;

inline UINT lcm(UINT x, UINT y);
inline UINT gcd(UINT x, UINT y);

int main()
{
	UINT n;
	UINT a[15];
	UINT ans=1;
	cin >> n;
	REP(i, n)cin >> a[i];
	REP(i, n)
	{
		ans = lcm(a[i], ans);
	}
	cout << ans << endl;
	return 0;
}

inline UINT lcm(UINT x, UINT y)
{
	return x*y / gcd(x, y);
}
inline UINT gcd(UINT x, UINT y)
{
	UINT r;
	while (y != 0)
	{
		r = x%y;
		x = y;
		y = r;
	}
	return x;
}

Measured memory_bytes: 1156
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll MOD=1e9+7;
static const int MAX = 100;
static const int INF = (1<<23);
template<class T> T gcd(T a, T b){return b? gcd(b,a%b) : a;}
template<class T> T lcm(T a,T b){return a / gcd(a,b)*b;}

int main(){
    ll x;
    cin>>x;
    if(x<100){
        cout<<0<<endl;
        return 0;
    }
    ll need = x/100;
    ll no = x-(need*100);


    if(no/need>=6||(no/need==5&&no%5!=0)){
        cout<<0<<endl;
    }else{
        cout<<1<<endl;
    }




return 0;
}


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

int n,ans,sum,a[300010],l,r,mid,an,nw;

bool check(int mid)
{
	int nw=0;
	for (int i=1; i<=n; i++) 
		if (i&1) nw+=2*a[i]; else
		{
			if (nw>=mid) 
			{
				if (nw-2*a[i]<0) nw=0;
				else nw-=2*a[i];
			} else nw-=2*a[i];
		}
	return nw>=mid;
}

int main()
{
	scanf("%d",&n);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]),sum+=a[i];
	for (int i=1; i<=n; i+=2) ans+=a[i];
	ans=max(ans,sum-ans);
	if (!(n&1)) return printf("%d %d\n",ans,sum-ans),0;
	for (int i=1; i<=n; i++) nw+=(a[i]*((i&1)?-1:1));
	l=ans-(sum-ans)+1,r=sum,ans=ans-(sum-ans);
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid-nw)) l=mid+1,ans=mid; else r=mid-1;
	}
	printf("%d %d\n",(sum+ans)/2,(sum-ans)/2);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){

int m,w[10];

while(cin>>m){
	int k=0;
	for(int i=0;i<10;i++)w[i]=0;
	
	for(int i=9;i>=0;i--)if(m>=pow(2,i)){w[i]=1;m-=pow(2,i);}
	
	for(int i=0;i<10;i++){
		if(w[i]==1&&k==0){cout<<pow(2,i);k=1;}
		else if(w[i]==1)cout<<" "<<pow(2,i);
	}
	cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 592