akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int N;
int a[200000];

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

  int found = 0;
  for(int i = 0; i < N; i++){
    if(a[i] == found + 1){
      found++;
    }
  }
  if(found == 0){
    cout << -1 << endl;
    return 0;
  }
  cout << N - found << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char ch;
    while(cin>>ch)
    {
        if(ch>='A' && ch<='Z')
        {
            cout<<"A"<<endl;
        }
        else
        {
            cout<<"a"<<endl;
        }
    }
}


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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

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

int dy[4]={-1,1,0,0};
int dx[4]={0,0,1,-1};

#define MAX_N 100009

int N, T;
int A[MAX_N];
int min_A[MAX_N];
int max_A[MAX_N];
map<int, vector<p> > ans;
unordered_map<int, int> cnt;
int main(){
    ios::sync_with_stdio(false);
    cin >> N >> T;
    REP(i,N) cin >> A[i];
    int min_a = INF;
    int max_a = 0;
    REP(i,N) {
        min_a = min(min_a,A[i]);
        max_a = max(max_a,A[i]);
        min_A[i] = min_a;
        max_A[i] = max_a;
    }
    REP(i,N) {
        ans[A[i]-min_A[i]].pb( p(i,min_A[i]) );
    }
    
    auto itr = ans.end();
    cout << (--itr)->second.size() << endl;
    
    return 0;
}

Measured memory_bytes: 12416
#include<stdio.h>
int p[100010],a[100010],pos[100010],c[100010];
bool us[100010];
int main(){
	int n,m,q,i,N;
	scanf("%d%d%d",&n,&m,&q);
	for(i=1;i<=q;i++)scanf("%d",p+i);
	N=0;
	for(i=q;i>0;i--){
		if(!us[p[i]])us[a[++N]=p[i]]=1;
	}
	for(i=1;i<=m;i++){
		if(!us[i])a[++N]=i;
	}
	for(i=1;i<=m;i++)pos[a[i]]=i;
	#define wa {puts("No");return 0;}
	c[0]=n;
	for(i=q;i>0;i--){
		if(c[pos[p[i]]-1]){
			c[pos[p[i]]-1]--;
			c[pos[p[i]]]++;
		}
	}
	for(i=0;!c[i];i++);
	for(i++;i<m;i++){
		if(a[i]>a[i+1])wa
	}
	puts("Yes");
}

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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, start, end) for(int i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define INFL (1e18)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

template<typename A, size_t N, typename T>
void array_fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int n, k;
    cin >> n;
    string s;
    cin >> s;
    cin >> k;

    char tmp = s[k-1];
    rep(i, n){
        if(s[i] != tmp) cout << "*";
        else cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
dr ="dream" 
dre = "dreamer" 
er ="erase" 
ere = "eraser" 
a = input()
ret = "YES"
while len(a) != 0:
    if (a.endswith(dr) or a.endswith(er)):
        a = a[:len(a)-5]
    elif(a.endswith(dre)):
        a = a[:len(a)-7]
    elif(a.endswith(ere)):
        a = a[:len(a)-6]
    else:
        ret = "NO"
        break
        
print(ret)


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

#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

#define int long long
using namespace std;
const int INF = 2e16;
const int MOD = 1e9 + 7;
const int MB = 20;

void solve() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (!i || s[i] != s[i - 1]) ans++;
	}
	cout << ans;
}
	

signed main() {
	/*
	freopen("search.in", "r", stdin);
	freopen("search.out", "w", stdout);
	*/
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout << fixed;
	cout.precision(12);
	solve();
}

Measured memory_bytes: 512
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner seer = new Scanner(System.in);
		long r = seer.nextInt();
		long d = seer.nextInt();
		long x = seer.nextInt();
		for(int i = 1; i <= 10; i++){
			x = r*x - d;
			System.out.println(x);
		}
	}

}


Measured memory_bytes: 21844
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    n = int(input())
    edge = [dict() for _ in range(n)]
    dist = [0]*n
    for _ in range(n-1):
        u, v, w = map(int, input().split())
        edge[u-1].update({v-1: w})
        edge[v-1].update({u-1: w})

    def dfs(i, pre, d):
        dist[i] = d
        for v in edge[i].keys():
            if v == pre:
                continue
            dfs(v, i, d+edge[i][v])

    dfs(0, -1, 0)
    # print(dist)

    for i in dist:
        if i % 2 == 0:
            print(0)
        else:
            print(1)


if __name__ == '__main__':
    main()

Measured memory_bytes: 99432
s = gets.chomp

(0..(s.length-1)).each do |i|
  if i % 2 == 0
    if s[i] == 'L'
      puts 'No'
      exit
    end
  else
    if s[i] == 'R'
      puts 'No'
      exit
    end
  end
end
puts 'Yes'

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

int main(){
  int h1, h2, k1, k2, a, b, c, d, H, K;

  cin >> h1 >> h2 >> k1 >> k2 >> a >> b >> c >> d;
  H = h1*a + (h1/10)*c + h2*b + (h2/20)*d;
  K = k1*a + (k1/10)*c + k2*b + (k2/20)*d;

  if ( H > K ) cout << "hiroshi" << endl;
  else if ( H < K ) cout << "kenjiro" << endl;
  else cout << "even" << endl;

  return 0;
}


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

inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;
int cnt = 0;
int main()
{
    string s;
    cin >> s;
    cout << s[0] << (s.length() - 2) << s[s.length() - 1] << endl;

    return 0;
}


Measured memory_bytes: 3560
import itertools
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

n,m = map(int,input().split())
ans = 0
if n != 1 and n != 0:
    ans += cmb(n,2)
if m != 1 and m != 0:
    ans += cmb(m,2)
print(ans)


Measured memory_bytes: 3064
[k,n]=list(map(int,input().split()))
alist=list(map(int,input().split()))
far=alist[0]+k-alist[-1]
for i in range(1,n):
       if far<alist[i]-alist[i-1]:
            far=alist[i]-alist[i-1]
ans=k-far
print(ans)


Measured memory_bytes: 26444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
const int mo = 1e9 + 7;
int d[3][3];
void solve()
{
    rep(i,3)rep(j,3)cin>>d[i][j];
    int a=d[0][2]-d[0][1],b=d[1][2]-d[1][1],c=d[2][2]-d[2][1];
    if(a!=b||b!=c){puts("No");return;}
    a=d[0][1]-d[0][0],b=d[1][1]-d[1][0],c=d[2][1]-d[2][0];
    if(a!=b||b!=c){puts("No");return;}
    a=d[2][2]-d[1][2],b=d[2][1]-d[1][1],c=d[2][0]-d[1][0];
    if(a!=b||b!=c){puts("No");return;}
    a=d[1][2]-d[0][2],b=d[1][1]-d[0][1],c=d[1][0]-d[0][0];
    if(a!=b||b!=c){puts("No");return;}
    puts("Yes");
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  string s;
  set<char> st;
  cin >> s;
  for(char c:s){
    if(st.find(c)!=st.end()){
      cout <<"no\n";
      return 0;
    }
    st.insert(c);
  }
  cout <<"yes\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define con continue
#define bk break
#define LL long long
#define db double
#define pt cout<<'\n'
#define ms(a, b) memset((a), (b), sizeof(a))
#define mp make_pair
#define endl '\n'
int inf=2147483647;const long long ll =9223372036854775807,ninf=1000000000;const double eps = 1e-6; const long long nll =223372036854775807;
#define sz size()
#define len(X) strlen(X)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ULL unsigned long long
#define de cout<<"test"<<endl;
#define st system("pause");
#define M_PI 3.1415926
int main()
{
LL a,b;
while(cin>>a>>b){
    LL ans=ll;
    for(int i=1;i<a;i++){
            LL t1=i*b,t2,t3;
        LL h=a-i;
        LL w=b;
        t2=(h/2)*b,t3= (h-(h/2) )*b;
    LL maxr=0,minr=ll;
    maxr=max(t1,max(t2,t3));
    minr=min(t1,min(t2,t3));
    ans=min(ans,maxr-minr);
    maxr=0,minr=ll;
    t2=h* (b/2),t3=h* (b- (b/2) );
       maxr=max(t1,max(t2,t3));
    minr=min(t1,min(t2,t3));
    ans=min(ans,maxr-minr);
    }
    for(int i=1;i<b;i++){
               LL t1=i*a,t2,t3;
        LL h=a;
        LL w=b-i;
        t2=(h/2)*w,t3= (h-(h/2) )*w;
    LL maxr=0,minr=ll;
    maxr=max(t1,max(t2,t3));
    minr=min(t1,min(t2,t3));
    ans=min(ans,maxr-minr);
    maxr=0,minr=ll;
    t2=h* (w/2),t3=h* (w- (w/2) );
       maxr=max(t1,max(t2,t3));
    minr=min(t1,min(t2,t3));
    ans=min(ans,maxr-minr);
    }
    cout<<ans<<endl;
}
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;  cin>>N;
vector<string> s(N);
for(int i=0;i<N;i++)
{
 cin >>s[i];

}
int M;  cin>>M;
vector<string> t(M);
for(int i=0;i<M;i++)
{
 cin >>t[i];

}
int cnt=0;
int scr =0;
string st1;
for(int i=0;i<N;i++)
{
scr=0;
st1=s[i];
for(int j=0;j<N;j++)
{
if(st1==s[j]) scr++;
}
for(int j=0;j<M;j++)
{
if(st1==t[j]) scr--;
}

if(scr>cnt) cnt=scr;
}
cout <<cnt;


}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string Sd, T;
  cin >> Sd >> T;

  vector<int> vec_ind_replace;

  for(int i = 0; i < Sd.length(); i++){
    bool ok = true;
    for(int j = 0; j < T.length(); j++){
      if(i+j >= Sd.length()){
        ok = false;
        break;
      }
      if(Sd[i+j] == T[j] || Sd[i+j] == '?'){
        continue;
      }else{
        ok = false;
      }
    }
    if(ok){
      vec_ind_replace.push_back(i);
    }
  }

  vector<string> ans;

  for(int i = 0; i < vec_ind_replace.size(); i++){
    string S = Sd;
    for(int j = 0; j < T.length(); j++){
      S[vec_ind_replace[i]+j] = T[j];
    }
    for(int j = 0; j < S.length(); j++){
      if(S[j] == '?') S[j] = 'a';
    }
    ans.push_back(S);
  }

  if(ans.size() == 0){
    cout << "UNRESTORABLE" << endl;
  }else{
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;
  }

  return 0;
}


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

int main(){
    string T;
    cin >> T;
    int ret=0;
    int ret_temp=0;
    for(size_t i = 0; i < T.length(); i++)
    {
        string t = T.substr(i, 1);
        if(t == "A" || t == "T" || t == "G" || t == "C"){
            ret_temp++;
            if(ret_temp > ret)
                ret = ret_temp;
        }
        else{
            ret_temp = 0;
        }
    }
    cout << ret << endl;
    return 0;
}

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

int main() {
  long long a, b, k;
  cin >> a >> b >> k;
  if(a <= k){
    k -= a;
    a = 0;
    if(b - k > 0){
      b -= k;
    }else{
      b = 0;
    }
  }else{
    a -= k;
  }
  cout << a << " " << b;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main()  {
	var s string
	fmt.Scan(&s)
	first := '0'
	firstCount := 0
	second := '1'
	secondCount := 0
	//fmt.Println(len(s))
	for _, v := range s {
		switch v {
		case first:
			firstCount++
		case second:
			secondCount++
		}
		//fmt.Println(firstCount, secondCount)
		first, second = second, first
	}
	fmt.Println(math.Min(float64(firstCount), float64(secondCount)))
}

Measured memory_bytes: 1280
n, m, Q = map(int, input().split())
LR = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-1] += 1

# 二次元累積和の作成
LR_rui = [[0 for _ in range(n+1)] for _ in range(n+1)]
# 各Lについての累積
for i in range(n):
    for j in range(n):
        LR_rui[i+1][j+1] = LR_rui[i+1][j]+LR[i][j]
# 各Rについての累積:
for i in range(n):
    for j in range(n):
        LR_rui[i+1][j+1] = LR_rui[i+1][j+1] + LR_rui[i][j+1]

for _ in range(Q):
    p, q = map(int, input().split())
    ans = LR_rui[q][q] - LR_rui[p-1][q] - LR_rui[q][p-1] + LR_rui[p-1][p-1]
    print(ans)

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

int n, k;
vector<int> w;

int f(int P) {
  int res = 0;
  for (int j = 0; j < k; ++j) {
    int t = 0;
    while (res < n && t + w[res] <= P) {
      t += w[res];
      ++res;
    }
  }
  return res;
}

int solve() {
  int l = 0, r = 100000 * 10000, mid;
  while (r - l > 1) {
    mid = (l + r) / 2;
    if (f(mid) >= n) {
      r = mid;
    } else {
      l = mid;
    }
  }
  return r;
}

int main() {
  cin >> n >> k;
  w.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> w[i];
  }
  cout << solve() << endl;
}


Measured memory_bytes: 3112
#69 C

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

nums = [0, 0, 0]

for tmp in a:
	if tmp%4 == 0:
		nums[0] += 1
	elif tmp%2 == 0:
		nums[1] += 1
	else:
		nums[2] += 1
		
if nums[1] > 0:
	pass
else:
	nums[2] -= 1

if nums[0] >= nums[2]:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
long long n,x[111111],p[111111],y[111111],siz[111111],cir[111111],m,k,sum;
bool vis[111111];
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&x[i]),p[i]=i;
	for(int i=1;i<=n;i++)y[i]=x[i]-x[i-1];
	scanf("%lld%lld",&m,&k);
	for(int i=1,a;i<=m;i++)scanf("%lld",&a),swap(p[a],p[a+1]);
	for(int i=1,c,pos,cnt=0;i<=n;i++)if(!vis[i]){
		++cnt,c=0,pos=i;
		while(!vis[pos])vis[pos]=1,cir[pos]=cnt,++c,pos=p[pos];
		siz[cnt]=c;
	}
	for(int i=1;i<=n;i++){
		int t=k%siz[cir[i]],pos=i;
		while(t--)pos=p[pos];
		printf("%lld.0\n",y[pos]+sum),sum+=y[pos];
	}
}

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n; scanf("%d",&n);
    vector<int> a(n);
    rep(i,0,n)scanf("%d",&a[i]);
    sort(ALL(a));
    double ans=a[0];
    rep(i,0,n-1){
        ans=(ans+a[i+1])/2.0;
    }
    printf("%.12f",ans);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc = new Scanner(System.in);

	public String getClass(double w){
		if(w<=48)return "light fly";
		if(w<=51)return "fly";
		if(w<=54)return "bantam";
		if(w<=57)return "feather";
		if(w<=60)return "light";
		if(w<=64)return "light welter";
		if(w<=69)return "welter";
		if(w<=75)return "light middle";
		if(w<=81)return "middle";
		if(w<=91)return "light heavy";
		return "heavy";
	}

	public void run() {
		while(sc.hasNext()) {
			double w=sc.nextDouble();
			ln(getClass(w));
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

int X, N;
unordered_set<int> p;

int main(int argc, char* argv[]) {
  cin >> X >> N;
  for (size_t i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    p.insert(tmp);
  }

  if (p.find(X) == p.end()) {
    cout << X << endl;
    return 0;
  }

  for (int i = 1;; i++) {
    if (p.find(X - i) == p.end()) {
      cout << X - i << endl;
      return 0;
    }
    if (p.find(X + i) == p.end()) {
      cout << X + i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3640
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=sum(B)
for i in range(N-1):
    if A[i+1]-A[i]==1:
        ans+=C[A[i]-1]
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
 #define f first
 #define s second
 #define endl '\n'
 #define LL long long
 #define pb push_back
 #define sz(a) (int)a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define debug(x) cerr << #x << " is " << x << endl;
 using namespace std;
 int const MAXN = 2e6 + 9;
 int main(){
    ios_base::sync_with_stdio (0),cin.tie(0);
    int n;
    cin >> n;
    int ans = 0;
    int AB = 0, A = 0, B = 0;
    for (int i = 0; i < n; i++){
        string s;
        cin >> s;
        for (int j = 0; j < sz(s) - 1; j++){
            if (s[j] == 'A' && s[j+1] == 'B') ans++;
        }
        if (s[0] == 'B' && s[sz(s) - 1]  == 'A') AB++;
        else if (s[0] == 'B') B++;
        else if (s[sz(s) - 1] == 'A') A++;
    }
    if(A == 0 && AB) A = 1, AB--;
    ans+= min(A,B)+ AB;
    cout << ans;
 }


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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  if(n%2) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  int div = 10;
  while(n >= div) {
    ans += n / div;
    div *= 5;
  }
  cout << ans;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n; cin >> n;
	vint x(n); vinput(x);

	ans = INF;
	for(int i=1; i<100; i++){
		ll sum = 0;
		for(int j=0; j<n; j++){
			sum += (i-x[j]) * (i-x[j]);
		}
		ans = min(ans, sum);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1e18
#define INFLL 1000000000000000007LL
#define SIZE 200105
#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()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define PI (acos(-1))
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
int N,D;
bool issq(int hoge){
	bool ret =false;
	for(int i=0;i*i<=hoge;i++){
		if(i*i==hoge)ret=true;
	}
	return ret;
	
}
int data[20][20];
int main(){
	cin>>N>>D;
	rep(i,N){
		rep(j,D){
			cin>>data[i][j];
		}
	}
	int ans=0;
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			int dist=0;
			for(int k=0;k<D;k++){
				dist+=(data[i][k]-data[j][k])*(data[i][k]-data[j][k]);
			}
			if(issq(dist))ans++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a, b, cnt = 0;
int main () {
	cin >> a >> b;
	if(a < b) {
		cout << 1;
	}
	else if(a % b == 0) {
		cout << a / b;
	}
	else {
		cout << a / b + 1;
	}
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), t(n);
  for(int i = 0; i < n; i++)
    cin >> a.at(i);
  t = a;
  sort(t.begin(), t.end(), greater<int>());
  for(int i = 0; i < n; i++)
    if(a.at(i) == t.at(0))
      cout << t.at(1) << endl;
    else
      cout << t.at(0) << endl;
}

Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

llint n;
vector<llint> G[200005];

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	llint p;
	for(int i = 2; i <= n; i++){
		cin >> p;
		G[p].push_back(i);
	}
	
for(int i = 1; i <= n; i++) cout << (int)G[i].size() << endl;
	
	return 0;
}

Measured memory_bytes: 14588
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){

	int n;
	ull T;
	ull ans = 0;
	ull st = 0, et = 0;
	cin >> n >> T;

	rep(i, 0, n) {
		ull subs;
		cin >> subs;
		if (i == 0) {
			st = subs;
			et = subs + T;
		}
		else {
			if (st <= subs && subs <= et) {
				et = subs + T;
			}
			else if (et < subs) {
				ans += et - st;
				st = subs;
				et = subs + T;
			}
		}
	}

	ans += et - st;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<ll,int> pint;
const int inf=1e9+7;
const ll longinf=1LL<<60;
const ll mod=1e9+7;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1};

ll r[101010], p[101010], par[101010];

int find(int x){
    if(par[x]==x)
        return x;
    int y = find(par[x]);
    r[x] += r[par[x]];
    return par[x] = y;
}

ll weight(int x){
    find(x);
    return r[x] + p[x];
}

void unite(int x, int y, int c){
    p[x] += c;
    p[y] += c;
    c -= weight(y);
    c += weight(x);
    x = find(x);
    y = find(y);
    if(x!=y){
        par[x] = y;
        r[x] = -c;
    }
}
int main(){
    int n, q;
    cin >> n >> q;
    rep(i, n) par[i] = i;
    rep(i,q){
        string s;
        cin >> s;
        if(s=="COMPARE"){
            int x, y;
            cin >> x >> y;
            if(find(x-1)!=find(y-1))
                cout << "WARNING" << "\n";
            else cout << weight(y - 1) - weight(x - 1) << "\n";
        }
        else{
            int x, y, c;
            cin >> x >> y >> c;
            unite(x - 1, y - 1, c);
        }
    }
    return 0;
}


Measured memory_bytes: 5372
#include<stdio.h>
#define N 100000

typedef struct{
  int parent,left,right;
}Node;

Node Tree[N];
void Print(int);
int depth(int);
int PrintChild(int);

main(){

  int i,n,id,k,c,q,j;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    Tree[i].parent=-1;
    Tree[i].left=-1;
    Tree[i].right=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&id,&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      Tree[c].parent=id;
      if(j==0) Tree[id].left=c;
      else Tree[q].right=c;
      q=c;
    }
  }
  for(i=0;i<n;i++){
    Print(i);
  }
  return 0;
}

void Print(int u){
  int i;
  printf("node %d: parent = %d, depth = %d, ",u,Tree[u].parent,depth(u));
  if(Tree[u].parent==-1) printf("root, [");
  else if(Tree[u].left==-1) printf("leaf, [");
  else printf("internal node, [");
  PrintChild(Tree[u].left);
  printf("]\n");
}

int PrintChild(int o){
  if(o==-1) return 0;
  if(Tree[o].right==-1) printf("%d",o);
  else {
    printf("%d, ",o);
    PrintChild(Tree[o].right);
  }
  return 0;
}
int depth(int o){
  if(Tree[o].parent==-1) return 0;
  return 1+depth(Tree[o].parent);
}

Measured memory_bytes: 3348
n, m = map(int, input().split())

city_list = []
for i in range(m):
    p, y = map(int, input().split())
    city_list.append([p, y, i])

city_list.sort(key=lambda x: (x[0], x[1]))

#print(city_list)

tmp_list = [0]*m
tmp_num = 1
for num,j in enumerate(city_list):
    if num == 0:
        tmp_list[j[2]] = str(j[0]).zfill(6)+str(tmp_num).zfill(6)
        j_tmp = j[0]
        tmp_num += 1
    else:
        if j[0] != j_tmp:
            j_tmp = j[0]
            tmp_num = 1
            tmp_list[j[2]] = str(j[0]).zfill(6)+str(tmp_num).zfill(6)
            tmp_num += 1
        else:
            tmp_list[j[2]] = str(j[0]).zfill(6)+str(tmp_num).zfill(6)
            tmp_num += 1

for k in tmp_list:
    print(k)

Measured memory_bytes: 31440
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int w1[26],w2[26];
int main() {
	string s;
	cin>>s;
	if(s[0]!='A') cout<<"WA"<<endl;
	else{
		for(int i=0;i<s.size();i++){
			if(s[i]>='a' && s[i]<='z') w1[s[i]-'a']++;
			else w2[s[i]-'A']++;
		}
		w2[0]--;
		w2[2]--;
		for(int i=0;i<26;i++)
		if(w2[i]){
			cout<<"WA"<<endl;
			return 0;
		}
		for(int i=2;i<=s.size()-2;i++){
			if(s[i]=='C'){
				cout<<"AC"<<endl;
				return 0;
			}
	    }
	    cout<<"WA"<<endl;
	}
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

const static long long MOD = 1000000007;

vector<long long> pow2;
vector<long long> F;
vector<long long> IF;

long long norm(long long a) {
    a %= MOD;
    if (a < 0) {
        a += MOD;
    }
    return a;
}

long long inverse(long long a) {
    long long b = MOD;
    long long u = 0, v = 1;
    a = norm(a);
    while (a != 0) {
        long long d = b / a;
        b -= d * a;
        u -= d * v;
        swap(a, b);
        swap(u, v);
    }
    return norm(u);
}

long long powM(long long x, long long e) {
    long long res = 1;
    while (e > 0) {
        if (e & 1) {
            res = res * x % MOD;
        }
        x = x * x % MOD;
        e >>= 1;
    }
    return res;
}

void init(int n) {
    F.clear();
    F.resize(n + 1, 1);
    IF = F;
    pow2.clear();
    pow2.resize(n + 1, 1);
    for (int i = 1; i <= n; ++i) {
        pow2[i] = pow2[i - 1] * 2 % MOD;
    }

    for (int i = 1; i <= n; ++i) {
        F[i] = F[i - 1] * i % MOD;
    }
    IF[n] = inverse(F[n]);
    for (int i = n - 1; i > 0; --i) {
        IF[i] = IF[i + 1] * (i + 1) % MOD;
    }
}

long long nCr(int n, int r) {
    if (r < 0 || r > n) {
        return 0;
    }
    long long res = F[n] * IF[r] % MOD * IF[n - r] % MOD;
    return res;
}

long long gcd(long long a, long long b) {
    while (a != 0) {
        b %= a;
        swap(a, b);
    }
    return b;
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    long long h, w, t;
    cin >> h >> w >> t;

    auto gh = gcd(h, t);
    auto gw = gcd(w, t);

    long long res = powM(2, h / gh) + powM(2, w / gw) + powM(2, gcd(h / gh, w / gw)) - 3;
    res = norm(res);
    res = powM(res, gh * gw);

    cout << res << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
vector<ll> A;
ll N;
int main(){ //srand((unsigned)time(NULL));
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int n = 0; n < N; n++) {
    cout << A[n] << (n != N-1 ? " " : "");
  }
  cout << endl;
  for (int i = 1; i < N; i++) {
    ll v = A[i];
    ll j = i-1;
    while(j>=0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for (int n = 0; n < N; n++) {
      cout << A[n] << (n != N-1 ? " " : "");
    }
    cout << endl;
  }
}



Measured memory_bytes: 3104
/*
ID: wangjun30
LANG: C++11
TASK:
*/
#include<iostream>
#include<algorithm>
#include<array>
#include<unordered_map>
#include<map>
#include<set>
#include<list>
#include<unordered_set>
#include<vector>
#include<bitset>
#include<queue>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
//#include<fstream>
#define int long long
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
const double precision=1e-6;
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	double a,b;
	cin>>a>>b;
	for(int i=1;i<=1300;i++){
		double di=i;
		double A=floor(di*0.08);
		double B=floor(di*0.1);
		if(fabs(A-a)<=precision && fabs(B-b)<=precision){
			cout<<i;
			return 0;
		}
	}
	cout<<-1;
	return 0;
}

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

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

#define rep(i, j, k) for(int i = (int) j; i < (int) k; ++i)
#define sz(x) ((int) (x).size())
#define ll long long
#define mp make_pair
#define pii pair<int, int >
#define fi first
#define se second
#define pb push_back
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define zero(x) memset((x), (0), sizeof (x))
#define zerox(x, y) memset((x), (y), sizeof (x))

using namespace std;

int main()
{
#ifdef PIT
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
#endif //PIT

	ios_base::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	int x, y, z;
	for (x = 1; x <= 3500; ++x) {
		for (y = x; y <= 3500; ++y) {
			int u = 4 * x * y - n * x - n * y;
			if(u <= 0) continue;
			ll v = 1LL * n * x * y;
			if(v % u) continue;
			z = (int)(v / u);
			cout << x << " " << y << " " << z << endl;
			return 0;
		}
	}
	
#ifdef PIT
flush(cout);
cerr << endl << "Time: " << (clock() / double(CLOCKS_PER_SEC)) << endl;
#endif //PIT
	return 0;
}


Measured memory_bytes: 256
def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

def phi_pk(p,k):
    return (p-1)*p**(k-1)

def pkcounter(ls):
    dic={}
    for i in ls:
        dic[i]=dic.get(i,0)
        dic[i]+=1
    return dic

n = int(raw_input())
table = prime_decomposition(n)
dic = pkcounter(table)
ans=1
for k,v in dic.items():
    ans *= phi_pk(k,v)
print ans

Measured memory_bytes: 4236
#include <bits/stdc++.h>
//#include <ext/numeric>


using namespace std;
//using namespace __gnu_cxx;

const int MAXN = 300005;
int n, l;
int arr[MAXN];
vector<int> adjList[MAXN];

void build() {
    int j = n - 1;
    for (int i = n - 1; ~i; --i) {
        while (arr[j] - arr[i] > l)
            --j;
        adjList[j].push_back(i);
    }
}

int timer;
vector<int> tin, tout;
vector<vector<int>> up;
void dfs(int v, int p) {
    tin[v] = ++timer;
    up[v][0] = p;
    for (int i = 1; i <= l; ++i)
        up[v][i] = up[up[v][i - 1]][i - 1];

    for (int u : adjList[v]) {
        if (u != p)
            dfs(u, v);
    }

    tout[v] = ++timer;
}

void preprocess(int root) {
    tin.resize(n);
    tout.resize(n);
    timer = 0;
    l = ceil(log2(n));
    up.assign(n, vector<int>(l + 1));
    dfs(root, root);
}


int ans(int u, int v) {
    int ret = 0;
    for (int i = l; i >= 0; --i) {
        if (up[u][i] < v) {
            ret += (1 << i);
            u = up[u][i];
        }
    }
    return ret + 1;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
//    freopen("fence.out", "w", stdout);
#endif

    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> arr[i];
    cin >> l;
    build();
    preprocess(n - 1);
    int q;
    cin >> q;
    while(q--) {
//        cout << 1 << endl;
        int u, v;
        cin >> u >> v;
        if (u > v)
            swap(u, v);
        --u;
        --v;
        cout << ans(u, v) << '\n';
    }


    return 0;
}

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

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for (int i=0; i<n; ++i){
    	cin>>a[i];
    }
    vector<bool> dp(k+1);
    for (int i=1; i<=k; ++i){
    	for (auto &x: a){
    		if (i-x<0) break;
    		if (!dp[i-x]){
    			dp[i]=1;
    		}
    	}
    }
    cout<<(dp[k]?"First":"Second");
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = k; i < n; i++)  
#define repp(i,k,n) for(int i = k; i <= n; i++) 
#define per(i,k,n) for(int i = k; i >= n; i--)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii; 
typedef vector<ii> vii;
typedef vector<char> vchar;
typedef vector<int> vi;
#define ff first
#define ss second

#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));

#define INF 1000000000
//#define mod 998244353
#define mod 1000000007
#define endl "\n"


   //=\/=\/=\/=\/=\/=\/=\/=\/=\/=\        Jai Hind Dosto        /=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\
  //=\/=\/=\/=\                    ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿                             /=\/=\/=\/=\\
 //=\/=\/=\/=\                                                                               /=\/=\/=\/=\\
//=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\



int modPow(int a, int b);           

                
void solve(int n){
    //int n;
    //cin >> n ;
    if(n==0)return;
   // if(n<=26){
     //   cout << (char)('a'+n-1);
       // return;
    //}
   // n--;
    vchar xx;
    while(n){
        n--;
        xx.pb('a'+n%26);
        n/=26;
        //n--
    }
    reverse(all(xx));
    for(char i : xx){
        cout << i;
    }

}






signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(6);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
   
   // int test=1; cin >> test; while(test--)
   int n; cin >> n;
    solve(n);
}

int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}




Measured memory_bytes: 3596
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long int ll;

int main() {
  int A,B;
  cin>>A>>B;
  
  cout<<A*B<<endl;
}


Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repd(i, n) for (int i = n; i >= 1; i--)
#define mod 1000000007
#define MOD 998244353
#define inf 1e20
typedef long long int ll;
typedef pair<ll, ll> p;


int main() {
	int a, b;
	cin >> a >> b;
	int s[13] = { 0,1,2,1,3,1,3,1,1,3,1,3,1 };
	if (s[a] == s[b]) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

//Ctrl+Aを使わない

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

class uft {
public:
    uft(int n) {
        v = std::vector<int>(n, 0);
        for (int i = 0; i < n; i++) {
            v[i] = i;
        }
    }

    int root(int i) {
        if (v[i] == i) {
            return i;
        }
        return v[i] = root(v[i]);
    }

    void unite(int i, int j) {
        int ii = root(i);
        int jj = root(j);
        if (ii != jj) {
            v[ii] = jj;
        }
    }

    bool same(int i, int j) {
        return root(i) == root(j);
    }

private:
    std::vector<int> v;
};

int main() {
    int n, m; std::cin >> n >> m;
    uft u(n);
    for (int i = 0; i < m; i++) {
        int x, y, z; std::cin >> x >> y >> z;
        x--; y--;
        u.unite(x, y);
    }

    int ret = 0;
    std::set<int> s;
    for (int i = 0; i < n; i++) {
        int v = u.root(i);
        if (s.find(v) == s.end()) {
            ret++;
        }
        s.insert(v);
    }
    std::cout << ret << std::endl;
    return 0;
}

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

int main(){
    
    int a, b;
    cin>>a>>b;
    for(int i=1; i<=3;i++){
        if(a*b*i%2){
            puts("Yes");
            return 0;
        }
    }
    puts("No");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

using namespace std;

int main(){

  string S;
  cin >> S;

  if(S[0] == 'A' && S[1] == 'A' && S[2] == 'A' ) {
    cout << "No" << endl;
  } else if (S[0] == 'B' && S[1] == 'B' && S[2] == 'B' ){
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}

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

int main(){
	int a,b;
	cin>>a>>b;
	if(a==b){
		cout<<a*2<<endl;
	}else{
		cout<<max(a,b)*2-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <numeric>//int sum = accumulate(v.begin(), v.end(), 0)
#include <math.h>//pow(x,y)=x^y
#include <algorithm>//sort(a.begin(), a.end());reverse(a.begin(), a.end());
#define rep(init,i,n) for (int i=init; i <(n);i++)
#define ll long long
using namespace std;


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

vector<ll> a(n);
vector<ll> b(n);

rep(0,i,n){
    cin >> a.at(i);
}
ll temp_max = 0;
ll index_oldmax = 0;
rep(0,i,n){
    if(a.at(i)>temp_max){
        rep(index_oldmax,j,i){
           b.at(j) = (temp_max-a.at(j));
           a.at(j) = temp_max;
           //cout<<"i="<<i<<endl;//
           //cout<<"j="<<j<<endl;//
           //cout<<"aj"<<a.at(j)<<endl;//
           //cout<<"bj"<<b.at(j)<<endl;//
        }
        temp_max = a.at(i);
        index_oldmax = i;
    }
    if(i==n-1){
            rep(index_oldmax,j,i+1){
           b.at(j) = (temp_max-a.at(j));
           a.at(j) = temp_max;
           //cout<<"i="<<i<<endl;//
           //cout<<"j="<<j<<endl;//
           //cout<<"bj"<<b.at(j)<<endl;//
        }
    }
}
/*rep(0,i,n){
cout<<" a.at(i)="<<a.at(i);//
//
}*/
ll sum = 0;
rep(0,i,n){
    sum += b.at(i);
}
cout<<sum;

}


Measured memory_bytes: 6400
import itertools
n,m,q = map(int,input().split())
l = []
for i in range(q):
  l.append(list(map(int,input().split())))
j = [i for i in range(1,m+1)]
kk = list(itertools.combinations_with_replacement(j,n))
ans = []
for k in kk:
  count = 0
  for i in range(q):
    if k[l[i][1]-1]-k[l[i][0]-1] == l[i][2]:
      count += l[i][3]
  ans.append(count)
print(max(ans))

Measured memory_bytes: 86296
N = int(input())
work = []
for i in range(N):
  work.append(list(map(int,input().split())))
  
work.sort(key = lambda x:x[1])
sumtime = 0
result = 'Yes'
for i in range(N):
  sumtime += work[i][0]
  if sumtime > work[i][1]:
    result = 'No'
    break
print(result)

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

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

const int N = 2e5 + 5;
int n, d, a;
ii xh[N];
int x, h;
ll cnt[N];

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

    cin >> n >> d >> a;
    for (int i = 0; i < n; ++i) {
        cin >> x >> h;
        xh[i] = ii(x, h);
    }
    sort(xh, xh + n);

    ll c = 0; // current damage
    int p = 0;
    ll res = 0;
    for (int i = 0; i < n; ++i) {
        c += cnt[i]; // pre damage
        int health = xh[i].second;
        if (health > c) {
            int need = (health - c + a - 1) / a; // need additional x bombs.
            res += need;
            ll x = 1LL * need * a; // deal x more damage
            c += x;
            // maintain sliding window's right pointer
            while (p < n && xh[p].first - xh[i].first <= d * 2) ++p;
            cnt[p] -= x; // reduce damage if moves out of current window.
        }
    }

    cout << res << endl;

    return 0;
}



Measured memory_bytes: 3328
from itertools import compress, product
 
s = input()
n = len(s)

index_maskss = product((0,1), repeat=n-1)
indicess = ([0]+list(compress(range(1, n), masks))+[n] for masks in index_maskss)
ijss = (zip(indices, indices[1:]) for indices in indicess)
sums = (sum(int(s[i:j]) for i, j in ijs) for ijs in ijss)

print(sum(sums))

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)


def main():
    a, b, c, d = map(int, input().split())
    while(True):
        c -= b
        if c <= 0:
            print('Yes')
            return
        a -= d
        if a <= 0:
            print('No')
            return


main()


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

using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    vector<int> p(N-1,0);
    vector<int> k(N - 1,1);
    int ke = 2;
    for (int i = N - 3; i >= 0;i--){
        k[i] *= ke * k[i + 1];
        ke++;
    }
    for (int i = 0; i < N;i++)
        cin >> P[i];
    for (int i = 0; i < N;i++)
        cin >> Q[i];

    for (int i = 0;i < N-1;i++){
        int t = P[i];
        int e = Q[i];
        for (int j = i + 1; j < N;j++){
            if(t > P[j])
                p[i]++;
            if (e > Q[j])
                p[i]--;
        }
    }
    int ans = 0;
    for (int i = 0; i < N - 1;i++){
        ans += p[i] * k[i];
    }
    if(ans < 0)
        ans = -ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ls = list(map(int, input().split()))
dp = [False] * (k + 1)
for i in range(1, k + 1):
	for j in ls:
		if i - j >= 0 and not dp[i - j]:
			dp[i] = True
if dp[k]:
	print('First')
else:
	print('Second')


Measured memory_bytes: 72484