akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
using namespace std;
int a[100002],b[100002]={0};
int main(){
	int n;
	cin>>n;
	int i;
	for(i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]==i){
			b[i]=1;
		}
	}
	int sum=0,k=0,flag=0;
	for(i=1;i<=n+1;i++){
		if(b[i]==1){
			k++;
			flag=1;
		}else{
			if(flag==1){
				sum=sum+(k+1)/2;
				k=0;
				flag=0;
			}	
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 1024
def calc_divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

n=int(input())
d=calc_divisore(n)
if len(d)%2==0:
    print((d[len(d)//2]+d[(len(d)//2)-1]-2))
else:
    print((d[len(d)//2]*2)-2)

Measured memory_bytes: 3264
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		ArrayList<String> al = new ArrayList<String>();
		while(sc.hasNext()) {
			String s = sc.next();
			if(s.contains("apple")) {
				al.add(s.replace("apple", "peach"));
			} else if(s.contains("peach")) {
				al.add(s.replace("peach", "apple"));
			} else {
				al.add(s);
			}
		}
		System.out.print(al.get(0));
		for(int i = 1, n = al.size(); i < n; i++) {
			System.out.print(" " + al.get(i));
		}
		System.out.println();
	}
}

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

int main() {
    map<string,int> mp;
    int n,m;
    cin >> n;
    string s;
    rep(i,n){
        cin >> s;
        mp[s]++;
    }
    cin >> m;
    rep(i,m){
        cin >> s;
        mp[s]--;
    }
    int ans=0;
    for(auto i : mp){
        ans = max(ans,i.second);
    }
    cout << ans << endl;  
}

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

int main(){
    int N;
    cin >> N;
    
    int a;
    for(int i = 0; i < N; ++i){
        cin >> a;
        if(a%2 == 0){
            if(a%3 == 0 || a%5 == 0){

            }else{
                cout << "DENIED" << endl;
                return 0;
            }
        }
    }

    cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 10000000007


ll dp1[300][300],dp2[300][300];
int main() {
	ll n,m,l;
	cin>>n>>m>>l;
	for(ll i=0;i<300;i++){
		for(ll j=0;j<300;j++){
			dp1[i][j]=dp2[i][j]=inf;
		}
	}
	for(ll i=0;i<m;i++){
		ll x,y,c;
		cin>>x>>y>>c;
		x--;y--;
		dp1[x][y]=c;
		dp1[y][x]=c;
	}	
	for(ll k=0;k<n;k++){
		for(ll i=0;i<n;i++){
			for(ll j=0;j<n;j++){
				dp1[i][j]=min(dp1[i][j],dp1[i][k]+dp1[k][j]);
			}
		}
	}
	for(ll i=0;i<n;i++){
		for(ll j=0;j<n;j++){
			if(i==j){
				continue;
			}
			if(dp1[i][j]<=l){
				dp2[i][j]=1;
			}
		}
	}
	for(ll k=0;k<n;k++){
		for(ll i=0;i<n;i++){
			for(ll j=0;j<n;j++){
				dp2[i][j]=min(dp2[i][j],dp2[i][k]+dp2[k][j]);
			}
		}
	}
	ll q;
	cin>>q;
	for(ll i=0;i<q;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
	//	cout << x<<y;
	if(dp2[x][y]==inf){
		cout << -1<<endl;
	}
	else{
		cout <<dp2[x][y]-1<<endl;
	}
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 1920
#include <iostream>

using namespace std;
int main()
{
    int b=0;
    int total=0;
    int bigest = -1;
    int a[100]={};
    cin>>b;
    for (int i=0; i<b; i++)
    {
        cin>>a[i];
        if (a[i]>bigest)
        {
            bigest=a[i];
        }
        total=total+a[i];
    }
    if (bigest*2<total)
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
    
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using v = vector<T>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
void dump_debug(T list) {
#ifdef MY_DEBUG
    each(e, list) cout << e << " ";
    printf("\n");
#endif
}

inline ll inl() {
    ll x;
    cin >> x;
    return x;
}

inline string ins() {
    string x;
    cin >> x;
    return x;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

class BinarySearch {
private:
    vector<int> data;
public:
    void add(int a) {
        data.emplace_back(a);
    }

    int find(int a) {
        int s = 0;
        int e = data.size() - 1;
        while (e - s > 1) {
            int m = (s + e) / 2;
            if (data[m] == a) {
                return m;
            } else {
                if (data[m] > a) {
                    s = m;
                } else {
                    e = m;
                }
            }
        }
        return -1;
    }
};


int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        long double s;
        cin >> s;
        ll x1 = 0, y1 = 0;
        ll x2 = 0, y2 = 0;
        ll x3 = 0, y3 = 0;

        ll now = abs(x2 * y3 - x3 * y2);

        x2 = ll(ceil(sqrt(s))), y3 = ll(ceil(sqrt(s)));
        x3 = x2 * y3 - ll(s);
        y2 = 1;

        cout << x1 << " " << y1 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll k;
ll a[200001];
ll dat[1<<21];
int n_=1<<19;
ll sum[200001];
vector<ll> va;

void update(int k,int a){
	k+=n_-1;
	dat[k]+=a;
	while(k>0){
		k=(k-1)/2;
		dat[k]=dat[k*2+1]+dat[k*2+2];
	}
}

ll query(int a,int b,int k=0,int l=0,int r=n_){
	if(r<=a || b<=l)return 0;
	if(a<=l && r<=b)return dat[k];
	ll vl=query(a,b,k*2+1,l,(l+r)/2);
	ll vr=query(a,b,k*2+2,(l+r)/2,r);
	return vl+vr;
}

int main(void){
	scanf("%d%lld",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%lld",&a[i]);
		a[i]-=k;
		sum[i+1]=sum[i]+a[i];
	}
	for(int i=1;i<=n;i++){
		va.push_back(sum[i]);
	}
	sort(va.begin(),va.end());
	va.erase(unique(va.begin(),va.end()),va.end());
	for(int i=1;i<=n;i++){
		sum[i]=lower_bound(va.begin(),va.end(),sum[i])-va.begin();
		update(sum[i],1);
	}
	ll res=0;
	ll now=0;
	for(int i=0;i<n;i++){
		int le=lower_bound(va.begin(),va.end(),now)-va.begin();
		res+=query(le,va.size());
		now+=a[i];
		int mn=lower_bound(va.begin(),va.end(),now)-va.begin();
		update(mn,-1);
	}
	printf("%lld\n",res);
	return 0;
}


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

using namespace std;
int main()
{
    int N, X;
    cin >> N >> X;
    int m[N];
    int sum=0;
    int ans=0;
    for(int i=0; i<N; i++){
        cin >> m[i];
        sum+=m[i];
    }
    sort(m, m+N);
    ans = (X-sum)/m[0] + N;

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
int a[1000],i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=n-1;i>=1;i--)
{
printf("%d ",a[i]);
}
printf("%d\n",a[0]);
return 0;
}


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

int main() {
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d) cout<<"Left"<<endl;
    if(a+b==c+d) cout<<"Balanced"<<endl;
    if(a+b<c+d) cout<<"Right"<<endl;
}


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

int main() {
  long long X;
  cin >> X;
  
    for(long long i = 2; i < 1000000; i++){
      if(X == i) {
      	cout << X << endl;
        return 0;
      }
      if(X % i == 0){
    	  X++;
          i = 1;
      }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void join(const Type &a){for(auto elem:a)cout<<elem<<' ';cout<<endl;}

int p(int x){
	if(x==1) return 1;
	return x*p(x-1);
}

int main(){
	int n;
	cin>>n;
	
	vector<double> x(n),y(n);
	REP(i,n) cin>>x[i]>>y[i];
	
	vector<vector<double> > l(n,vector<double>(n));
	REP(i,n)REP(j,n){
		l[i][j]=l[j][i]=sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
	}
	
	double sum=0;
	REP(i,n-1)for(int j=i+1;j<n;++j){
		sum+=l[i][j]*(p(n)/n*2);
	}
	
	
	printf("%.10f\n",sum/p(n));
}


Measured memory_bytes: 256
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] d = new int[k];
        for (int i = 0; i < k; i++) {
            d[i] = sc.nextInt();
        }

        abc042cIrohasObsessionSolve(n,k,d);

        sc.close();
    }

    public static void abc042cIrohasObsessionSolve(int n,int k,int[] d) {
        boolean bool = true;
        int boolcount = 0;
        while (bool) {
            for (int i = 0; i < k; i++) {
                if (Integer.toString(n).contains(Integer.toString(d[i]))){
                    boolcount++;
                }
            }
            if (boolcount == 0) {
                System.out.println(n);
                bool = false;
            }else{
                boolcount = 0;
            }
            n++;
        }
    }
    
}





Measured memory_bytes: 53592
N,A,B,C,D =list(map(int,input().split()))
s = input()
flag = 0
if C<D:
    if s[B-1:D].count('##') == 0 and s[A-1:C].count('##') == 0:
        print('Yes')
    else:
        print('No')
else:
    if (s[B-2:D+1].count('...')>=1) and (s[A-1:C].count('##') == 0 ):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 9404
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int h, w;
    cin >> h >> w;
    int ih, iw;
    cin >> ih >> iw;

    int ans = (h-ih)*(w-iw);
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    int N, M, all = 0, count = 0;
    cin >> N >> M;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        all += A[i];
    }
    for (int i = 0; i < N; i++) {
        if (4 * M * A[i] >= all) {
            count++;
        }
    }
    if (count >= M) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

const int N = 100005;
LL a[N], cnt[2*N], cnt2[2*N];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	REP(i, n)scanf("%lld", &a[i]);
	LL bias = 0;
	REP(i, n - 1) {
		int p = a[i];
		int q = a[i + 1];
		if (q < p)q += m;
		bias += q - p;
		if (q >= p + 2) {
			cnt[p + 2]++;
			cnt[q + 1]--;
			cnt2[q + 1] -= q - p - 1;
		}
	}
	FOR(i, 1, 2 * m + 2)cnt[i] += cnt[i - 1];
	FOR(i, 1, 2 * m + 2)cnt[i] += cnt2[i];
	FOR(i, 1, 2 * m + 2)cnt[i] += cnt[i - 1];
	LL ans = bias;
	FOR(i, 1, m+1) {
		ans = min(ans, bias - cnt[i] - cnt[i + m]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#define MAXN 100005
#define ll long long
using namespace std;
ll a[MAXN], s1, s2;
int n;
bool cmp(ll x, ll y) {
	return x > y;
}
int main() {
	ios::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; i++) 
		cin >> a[i];
	sort(a+1, a+1+n, cmp);
	for(int i = 1; i < n; i++) {
		if(!s2 && s1 && a[i] == a[i+1])
			s2 = a[i];
		if(!s2 && a[i] == a[i+1]) 
			s1 = a[i++];
	}
	if(s1 && s2) cout << s1*s2 << "\n";
	else cout << "0\n"; 
	return 0;
}

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

typedef vector<int> vi;
const int maxn = 100010;
#define pb push_back

vi g[maxn];

int c[maxn];
int bt[1024 + 2];

int low_bit(int x) { return x & -x; }
int lg(int x) { return x > 1024 ? 10 + lg(x >> 10) : bt[x]; }

int dfs(int u,int par) {
	int val = 0, lim = 0;
	for(auto v: g[u]) if(v != par) {
		int r = dfs(v, u);
		lim |= r & val;
		val |= r;
	}
	c[u] = 0;
	while((1 << c[u]) <= lim || (val >> c[u] & 1) > 0) ++c[u];
	val ^= val & ((1<<c[u]) - 1);
	val |= 1 << c[u];
	return val;
}

int main() {
	for(int i = 0; i <= 10; ++i) bt[1 << i] = i;
	int n; scanf("%d", &n);
	for(int i = 1; i < n; ++i) {
		int u, v; scanf("%d%d", &u, &v);
		g[u].pb(v); g[v].pb(u);
	}
	dfs(1, 0);
	cout << *max_element(c + 1, c + n + 1) << endl;
	return 0;
}


Measured memory_bytes: 11776
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    string str;
    int count=0;
    int max=0;
    cin>>str;
    for(int i=0;i<str.length();i++)
    {
        if(str[i]=='A' || str[i]=='G' || str[i]=='C' || str[i]=='T')
        {
            count=1;
            int j=i+1;
            while(j<str.length() && (str[j]=='A' || str[j]=='G' || str[j]=='C' || str[j]=='T'))
            {
                count++;
                j++;
            }
            
            if(count>max) max=count;
          
        }
        
        
    }
    
    cout<<max<<endl;
    return  0;
}

Measured memory_bytes: 256
n = int(input())
h = [int(x) for x in input().split()]
can = True
for i in range(n):
    if i == 0:
        h[i] -= 1
    else:
        if h[i - 1] < h[i]:
            h[i] -= 1
        elif h[i - 1] == h[i]:
            continue
        else:
            can = False
print('Yes' if can else 'No')


Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    LL a,b,c,d,e,f;
    void solve(){
        cin >> a >>b >> c >> d >> e >> f;
        vector<int> s(3001),w(31);
        s[0]=1;
        w[0]=1;
        for(int i=1; i<=3000; ++i){
            if((i-c>=0 and s[i-c]>0)or(i-d>=0 and s[i-d]>0))s[i]=1;
        }
        for(int i=1; i<=30; ++i){
            if((i-a>=0 and w[i-a]>0)or(i-b>=0 and w[i-b]>0))w[i]=1;
        }
        pair<LL,LL> ans={100*a,0};
        for(int i=0; i<=3000; ++i){
            for(int j=0; j<=30; ++j){
                if(s[i]>0 and w[j]>0 and i+j*100<=f and j*e>=i and ans.first*i>ans.second*j*100) ans={100*j,i};
            }
        }
        cout << ans.first+ans.second << ' ' << ans.second<<"\n";
    }
};

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

    Problem p;
    p.solve();
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

bool bit(long long n, int k) { return (n >> k) & 1LL; }


long long a,b,c;
long long dfs(int i, long long x) {
    long long m = 1LL << 62;
    if (a <= x) return m;
    if (i == 41) {
        if ((a - x) ^ (b + x) == c, i) {
            return x;
        } else {
            return m;
        }
    }

    auto y = x;
    if (bit((a - x) ^ (b + x), i) == bit(c, i)) {
        m = min(m, dfs(i + 1, x));
    }
    y = x | (1LL << i);
    if (bit((a - y) ^ (b + y), i) == bit(c, i)) {
        m = min(m, dfs(i + 1, y));
    }
    return m;
}

void solve(long long N, std::vector<long long> A) {
    a = A[0];
    b = A[1];
    c = 0;
    loop(i, 2, N) c ^= A[i];
    long long x = dfs(0, 0);
    if (x < a && (a - x) ^ (b + x) == c) {
        cout << x << endl;
    } else {
        cout << -1 << endl;
    }
}

int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

double N,M;
long long ans = 0;

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

  if(N > 1){
    ans += N*(N-1)/2;
  }
  if(M > 1){
    ans += M*(M-1)/2;
  }

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


Measured memory_bytes: 256
#include "iostream"
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
using namespace std;
using ll=long long;
#define mod = 1000000007
int main(int argc, char const *argv[]) {
  string a,b;
  std::cin >> a >>b;

  if(a.size()>b.size()){printf("GREATER"); return 0;}
  else if(a.size()<b.size()){ printf("LESS"); return 0;}
  else{

    for(int i=0; i<a.size(); i++){
      if(a[i]>b[i]) {printf("GREATER"); return 0;}
      else if(a[i]<b[i]){printf("LESS"); return 0;}
    }

  }

  printf("EQUAL");
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-05-02 20:53:09 +0900
# LastModified: 2020-05-02 21:22:27 +0900
#


import os
import sys


def main():
    x=int(input())
    y=100
    for ans in range(1,3761):
        y = y + int(y*0.01)
        if y>=x:
            print(ans)
            return
    


if __name__ == "__main__":
    main()


Measured memory_bytes: 9164
#include<bits/stdc++.h>
#define N 2050
#define int long long
#define pb push_back
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define coffee prince
#define sz(a) (int)a.size()
using namespace std;
int n,x,y;
int ans[N];
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>x>>y;
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            ans[min(j-i,min(abs(i-x)+1ll+abs(y-j), abs(i-y)+1ll+abs(j-x)))]++;
        }
    }
    for(int i=1;i<n;i++)
        cout<<ans[i]<<" ";
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
 
int main() {
    long long int n,ans;cin >> n;
    vector<long long int> a(6);
    for(int i=0;i<5;i++){
        cin >> a[i];
    }


    sort(a.begin(),a.end());
    if(n%a[1] != 0){
        ans = n/a[1] + 1;
    }else{
        ans = n/a[1];
    }

    cout << ans + 4 << endl;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
	char str[1001];
	char com[8];
	int l = 0;
	int a, b;
	int q;
	char c;
	scanf("%s", &str);
	
	scanf("%d", &q);

	for(int i = 0; i < q ; i++){
		scanf("%s %d %d", &com, &a, &b);
		if(com[2] == 'i'){
			for(int i = a; i <= b; i++){
				printf("%c", str[i]);
			}
			printf("\n");
		}else if(com[2] == 'v'){
			char t;
			for(int i = 0; i < ((b - a + 1) / 2); i++){
				t = str[a + i];
				str[a + i] = str[b - i];
				str[b - i] = t;
			}
		}else{
			char r[1001];
			scanf("%s", &r);
			for(int j = a; j <= b; j++){
				str[j] = r[j - a];
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1000
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cassert>
#define ll long long
using namespace std;
inline int read(){
	int re=0,flag=1;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-') flag=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9') re=(re<<1)+(re<<3)+ch-'0',ch=getchar();
	return re*flag;
}
int X,n,rev[100010],val[100010],l[100010],r[100010],ans0[100010],ans1[100010],ch[100010];
int main(){
	X=read();n=read();int i,tmp=1,t,a,ans,pos;
	val[i]=0;
	for(i=1;i<=n;i++){
		rev[i]=read();
		ch[i]=tmp*(rev[i]-rev[i-1]);
		val[i]=val[i-1]-ch[i];
		tmp=-tmp;
//		cout<<i<<' '<<val[i]<<'\n';
	}
	rev[n+1]=2e9; 
	l[0]=0;r[0]=X;
	for(i=1;i<=n;i++){
		l[i]=max(l[i-1],-val[i]);
		r[i]=min(r[i-1],X-val[i]);
//		cout<<i<<' '<<l[i]<<' '<<r[i]<<'\n';
	}
	ans0[0]=0;ans1[0]=X;
	for(i=1;i<=n;i++){
		ans0[i]=min(X,max(0,ans0[i-1]-ch[i]));
		ans1[i]=max(0,min(X,ans1[i-1]-ch[i]));
//		cout<<i<<' '<<ans0[i]<<' '<<ans1[i]<<'\n';
	}
	int Q=read();
	while(Q--){
		t=read();a=read();
		pos=lower_bound(rev+1,rev+n+1,t)-rev;
		if(rev[pos]>t) pos--;
//		cout<<"query "<<t<<' '<<a<<' '<<pos<<' '<<rev[pos]<<' '<<l[pos]<<' '<<r[pos]<<' '<<ans0[pos]<<' '<<ans1[pos]<<'\n'; 
		if(a<l[pos]) ans=ans0[pos];
		if(a>r[pos]) ans=ans1[pos];
		if(a>=l[pos]&&a<=r[pos]) ans=a+val[pos];
//		cout<<"tmpquery "<<t<<' '<<rev[pos]<<' '<<ans<<'\n'; 
		ans+=(t-rev[pos])*((pos&1)?1:-1);
		printf("%d\n",min(X,max(ans,0)));
	}
} 

Measured memory_bytes: 3968
from itertools import accumulate
from bisect import bisect

n, x = map(int, input().split())
arr = list(map(int, input().split()))

arr.sort()
sum_arr = list(accumulate(arr))

idx = bisect(sum_arr, x)

if idx == n and sum_arr[n - 1] != x:
    idx -= 1

print(idx)


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

int main(){
    int n;
    char buf[30];

    fgets(buf, sizeof(buf), stdin);

    n = atoi(buf) + (atoi(buf) * atoi(buf)) + (atoi(buf) * atoi(buf) * atoi(buf));

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

Measured memory_bytes: 1668
main(){
	float t0,t1;
	float b[7][2]={
		{35.5, 71.0},
		{37.5, 77.0},
		{40.0, 83.0},
		{43.0, 89.0},
		{50.0, 105.0},
		{55.0, 116.0},
		{70.0, 148.0},
	};
	char*C[7]={"AAA","AA","A","B","C","D","E"};
	int i;
	for(;~scanf("%f%f",&t0,&t1);){
		for(i=0;i<7;i++){
			if(t0<b[i][0]&&t1<b[i][1]){
				puts(C[i]);
				break;
			}
		}
		if(i==7)
			puts("NA");
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

vector<int> a;
int n, s;

ll dp[3001][3001];

#define MOD 998244353LL

int main()
{
  int i, j;

  cin >> n >> s;

  dp[0][0]=1;

  a.resize(n);
  for (i=0; i<n; i++) {
    cin >> a[i];
  }

  for (i=0; i<n; i++) {
    for (j=0; j<s+1; j++) {
//printf("dp[%d][%d] = %lld\n", i, j, dp[i][j]); 
      dp[i+1][j] +=2 * dp[i][j];
      dp[i+1][j] %= MOD;
      if (j+a[i] <= s) {
        dp[i+1][j+a[i]] += dp[i][j];
        dp[i+1][j+a[i]] %= MOD;
      }
    }
  }
  cout << dp[n][s] << endl;
  return 0;
}


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


int main() {
	int X, Y;
	cin >> X >> Y;
	int a, b;

	int b_2 = Y - 2 * X;
	if (b_2 % 2 != 0 || b_2 < 0) {
		cout << "No" << endl;
		return 0;
	}
	b = b_2 / 2;
	a = X - b;
	if (a < 0) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;


}

Measured memory_bytes: 3628
def main():
    n,k = map(int,input().split())
    ans = 0
    cnt = 0
    mod = 10 ** 9 + 7
    for i in range(k,n+1):
        s = (i-1) * i // 2
        e = i * (2 * (n-i+1) + i - 1) // 2
        ans += e - s + 1
        ans %= mod
        cnt += 1
        # print(e-s+1)
    print((ans+1)%mod)
if __name__=='__main__':
    main()


Measured memory_bytes: 9128
import java.util.*;

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

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

    private void run() {
        int n = sc.nextInt();
        if (n % 2 == 1) {
            System.out.println("No");
            return;
        }
        String s = sc.next();
        int l = (int) (n / 2);
        for (int i = 0; i < l; i++) {
            if (s.charAt(i) != s.charAt(l+i)) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define mayu return 0;
int main() {
  string S, T;
  cin >> S >> T;
  int N = S.size();
  for(int i = 0; i < N; i++) {
    if(S == T) {
      cout << "Yes" << endl;
      break;
    }
    for(int j = 0; j < N - 1; j++) {
      swap(S[j], S[j+1]);
    }
    if(i == N - 1) {
      cout << "No" << endl;
    }
  }
  mayu;
}

Measured memory_bytes: 3604
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

int main() {
  int n, m, r = 0;
  cin >> n;
  vector<string> s(n);
  cin >> s >> m;
  vector<string> t(m);
  cin >> t;
  for (const auto& z : s) {
    int a = 0;
    for (const auto& x : s) {
      if (x == z) ++a;
    }
    for (const auto& y : t) {
      if (y == z) --a;
    }
    r = max(r, a);
  }
  cout << r << endl;
}



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

using namespace std;

int main() {
  int n,k;
  cin>>n>>k;
  int ans=1;
  rep(i,n){
    if(ans*2<=ans+k)ans=ans*2;
    else ans=ans+k;
  }
  cout<<ans<<endl;
}

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

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

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

	string s;
	cin >> s;

	ll ans = 0;

	int R = 0;
	int G = 0;
	int B = 0;

	for (int i = 0; i < n; i++) {
		if (s[i] == 'R')
			R++;
		else if (s[i] == 'G')
			G++;
		else
			B++;
	}

	ans = (ll)R * G * B;


	for (int j = 1; j < n / 2 + 1; j++) {
		for (int i = 0; i < n; i++) {
			if (i + 2 * j >= n)
				continue;

			if (s[i] == s[i + j] || s[i + j] == s[i + 2 * j] || s[i] == s[i + 2 * j])
				continue;

			ans--;
		}
	}

	cout << ans << endl;

	return 0;
}

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



int32_t main()
{
    int n;
    cin>>n;
    string s;
    map<string , int> mp;
    mp["AC"]=0;
    mp["WA"]=0;
    mp["TLE"]=0;
    mp["RE"]=0;
    for(int i=0 ; i<n  ; ++i)
    {
        cin>>s;
        if(mp.find(s)!=mp.end())
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;


    return 0;
}

Measured memory_bytes: 3564
def main():
    N = int(input())
    A = list(map(int, input().split()))

    B = sum(A)
    answer = 0
    for i in range(0, N):
        answer += A[i] * (B - A[i])
        B -= A[i]

    answer %= (10 ** 9 + 7)

    print(answer)


if __name__ == "__main__":
    main()

# A1*A2 + A1*A3 + ... + A1*AN = A1 * (A2 + A3 + ... + AN)
# +
# A2*A3 + A2*A4 + ... +| A2*AN = A2 * (A3 + A4 + ... + AN)


Measured memory_bytes: 94116
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int N,K;
  cin>>N>>K;
  long long int A[N];
  for(int i=0;i<N;i++)
    cin>>A[i];
  sort(A,A+N);
  
  if(K>=N)
    cout<<0<<endl;
  else
  {long long int ans=0;
    for(int i=0;i<=(N-1-K);i++)
      ans+=A[i];
   cout<<ans<<endl;
  }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };

int n, m, a;
vector<pair<int, PII> > ar;

int main() {
	while ( ~scanf( "%d %d %d", &n, &m, &a ) && n && m && a ) {
		ar.resize( m );
		for ( int i = 0; i < m; i++ ) {
			int b, c, d;
			scanf( "%d %d %d", &b, &c, &d );
			ar[ i ].first = b;
			ar[ i ].second.first = c;
			ar[ i ].second.second = d;
		}
		sort( ar.rbegin(), ar.rend() );
		for ( int i = 0; i < m; i++ ) {
			if ( a == ar[ i ].second.first ) {
				a = ar[ i ].second.second;
			}
			else if ( a == ar[ i ].second.second ) {
				a = ar[ i ].second.first;
			}
		}
		printf( "%d\n", a );
	}
	return 0;
}

Measured memory_bytes: 1204
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;

class Program
{
    static void Main()
    {
        Scanner cin = new Scanner();
        //Random rnd = new Random();
        //Stopwatch sw = new Stopwatch();

        int N;
        int M;

        N = cin.Nextint;
        M = cin.Nextint;

        int[] A = new int[M];
        int[] B = new int[M];


        for(int i=0; i<M; i++)
        {
            A[i] = cin.Nextint;
            B[i] = cin.Nextint;
        }

        int[] result = new int[N+1];
        for(int i=0; i<M; i++)
        {
            result[A[i]] += 1;
            result[B[i]] += 1;
        }

        for(int i=1; i<=N; i++)
        {
            Console.WriteLine(result[i]);
        }

        /*
        int A = cin.Nextint;
        int B = cin.Nextint;
        int C = cin.Nextint;
        */


        /** ここに記述 */

        //Console.WriteLine(result ? "Yes" : "No");
        Console.Out.Flush();
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return Console.ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length)
            {
                return s[i++];
            }
            string st = Console.ReadLine();
            while (st == "")
            {
                st = Console.ReadLine();
            }

            s 
            = st.
                Split
                (cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int nums;

struct node{
	int l,r;
};

bool emp(node a,node b){
	return a.r<b.r;
}

int main(){
	scanf("%d",&nums);
	node arr[nums];
	for(int i=0;i<nums;i++){
		cin>>arr[i].l>>arr[i].r;
	}
	sort(arr,arr+nums,emp);
	int alltimes=0;
	bool isOK=true;
	for(int i=0;i<nums;i++){
		alltimes+=arr[i].l;
		//printf("%d\t%d\n",alltimes,arr[i].r);
		if(alltimes>arr[i].r){
			isOK=false;
			break;
		}
	}
	if(isOK){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	
	return 0;
}



//12 40---28/6=4
//16 40---24=3
/*

*/












Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner out = new Scanner(System.in);

        String str =out.nextLine();
        String[] sss=str.split(" ");
        int a= Integer.parseInt(sss[0]);
        int b= Integer.parseInt(sss[1]);
        int c= Integer.parseInt(sss[2]);

        int t;
        if(a>b) {t=a;a=b;b=t;}
        if(b>c) {t=b;b=c;c=t;}
        if(a>b) {t=a;a=b;b=t;}

        System.out.println(a+" "+b+" "+c);

    }
}

Measured memory_bytes: 26092
#include<cstdio>
#include<cctype>
#include<map>
#include<algorithm>
using namespace std;
const int maxn=1e5+7;
int a[maxn],b[maxn];
inline int read() {
    int f = 1, num = 0;
    char ch = getchar();
    while(0 == isdigit(ch)) {
        if(ch == '-')f = -1;
        ch = getchar();
    }
    while(0 != isdigit(ch)) num = (num << 1) + (num << 3) + ch - '0', ch = getchar();
    return num * f;
}
map<int,int> rankx;
int main() {
    int n=read();
    for(int i=1;i<=n;i++){
    	a[i]=read();
    	b[i]=a[i];
    }
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++)
    	rankx[a[i]]=i;
    for(int i=1;i<=n;i++)
    	b[i]=rankx[b[i]];
    int ans=0;
    for(int i=1;i<=n;i++){
    	if(b[i]%2!=i%2) ans++;
    }
    printf("%d",ans>>1);
}

Measured memory_bytes: 5760
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        //sc.nextLine();
        //sc.close();
        String[] n  = str.split(" ");
        int r = Integer.parseInt(n[0]);
        int d = Integer.parseInt(n[1]);
        int x2000 = Integer.parseInt(n[2]);
        
        int ans = 0;
        for ( int i = 0; i < 10; i++ ){
            ans = r * x2000 - d;
            System.out.println(ans);
            x2000 = ans;
        }
    } 
} 

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

int main() {
    double r;
    cin >> r;
    cout << 2*r * acos(-1) << endl;
    return 0;
}

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

int main() {

  int a;
  cin >> a;
  
  int ans = 0;
  
  rep(i,a + 1) {
    if(i > 0 && i < 10) ans++;
    if(i > 99 && i < 1000) ans++;
    if(i > 9999 && i < 100000) ans++;
  }
  
  cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
using lint=long long;
int main(){
  lint N,T; cin>>N>>T;
  lint dup=0;
  lint t[200000];
  for(int i=0;i<N;i++)
    cin>>t[i];
  for(int i=1;i<N;i++){
    lint dif=t[i]-t[i-1];
    if(dif<T) dup+=T-dif;
  }
  cout<<N*T-dup<<endl;
  return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(lli i=s;i<n;i++)
#define RREP(i,s,n) for(lli i=s;i>=n;i--)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli n;

	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	cin>>n;

	vector<vector<lli>> v(n);

	REP(i,0,n){
		REP(j,0,n-1){
			lli a;
			cin>>a;
			v[i].emplace_back(a-1);
		}
	}

	lli cnt=0;

	vector<lli> cntV(n,0);

	while(1){
		map<pair<lli,lli>,lli> d;
		bool update=false;
		REP(i,0,n){
			if(cntV[i]>=n-1)continue;
			update = true;
			lli target = v[i][cntV[i]];
			
			if(v[target][cntV[target]] == i){
				d[make_pair(min(i,target),max(i,target))]++;
			}
		}
		if(!update)break;

		bool ok=false;
		for(auto e:d){
			//if(e.second==2){
				cntV[e.first.first]++;
				cntV[e.first.second]++;
				ok = true;
			//}
		}
		if(!ok){
			cout<<-1<<endl;
			return 0;
		}
		cnt++;
	}

	cout<<cnt<<endl;


	return 0;
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var seqA = new int[n + 1][];
        for (int i = 1; i < seqA.Length; ++i)
        {
            seqA[i] = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        }

        var numGames = (n * (n - 1)) / 2;
        var adjList = new int[numGames + 1][];
        for (int i = 1; i < adjList.Length; ++i)
        {
            adjList[i] = new int[2];
        }

        Func<int, int, int> gameId = (_x, _y) => 0;
        gameId = (x, y) => x < y ? y - x + numGames - (n - x + 1) * (n - x) / 2 : gameId(y, x);

        var playableAtFirstDay = new List<int>();
        for (int i = 1; i < seqA.Length; ++i)
        {
            for (int j = 1; j < seqA[i].Length; ++j)
            {
                int h = gameId(i, seqA[i][j]);
                int t = gameId(i, seqA[i][j - 1]);
                playableAtFirstDay.Add(h);
                for (int k = 0; k < adjList[t].Length; ++k)
                {
                    if (adjList[t][k] > 0)
                    {
                        continue;
                    }

                    adjList[t][k] = h;
                    break;
                }
            }
        }
        adjList[0] = playableAtFirstDay.ToArray();

        var memo = E.Repeat(int.MinValue, adjList.Length).ToArray();
        var day = adjList[0].Length > 0 ? Dfs(memo, adjList, new bool[adjList.Length], 0) : -1;
        Console.WriteLine(day);
    }

    static int Dfs(int[] memo, int[][] adjList, bool[] path, int t)
    {
        if (path[t])
        {
            return memo[t] = -1;
        }
        if (memo[t] != int.MinValue)
        {
            return memo[t];
        }

        var r = 1;
        path[t] = true;
        for (int i = 0; i < adjList[t].Length; ++i)
        {
            int h = adjList[t][i];
            if (h < 1)
            {
                break;
            }
            
            var rr = Dfs(memo, adjList, path, h);
            if (rr < 0)
            {
                r = rr;
                break;
            }
            r = Math.Max(r, rr + 1);
        }
        path[t] = false;

        return memo[t] = r;
    }
}


Measured memory_bytes: 61404
#include <iostream>
#include <cstdint>
#include <bitset>
#include <vector>
#include <thread>
#include <stack>



int main()
{
	int n;
	int ans = 0;
	std::cin >> n;
	while (ans < n) {
		ans += 1000;
	}
	std::cout << ans - n;
}

Measured memory_bytes: 3196
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int a,b;
	cin >> a >> b;
	if(a+b == 15)
		cout << "+" << endl;
	else if(a*b == 15)
		cout << "*" << endl;
	else
		cout << "x" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef double db;
typedef vector <ll> vll;
typedef pair <ll, ll> pll;
#define pb push_back
#define mp make_pair
#define MAX 1000000
#define mod 1000000007
#define all(_) _.begin(), _.end()
#define F first
#define S second
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
	ios_base :: sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	ll n, i, j;
	vll m(82, 0);
	for(i = 1; i <= 9; i++)
		for(j = 1; j <= 9; j++)
			m[i * j] = 1;
	cin >> n;
	cout << (m[n] > 0 ? "Yes" : "No") << endl;
	return 0;
}

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

#define pb push_back
#define mp make_pair

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef unsigned long long ull;
typedef long long ll;

int main() {
  map<string, vii> ct;

  int n;
  cin >> n;

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

    int rate;
    cin >> rate;

    ct[s].pb(mp(rate, i+1));
  }
  

  for (auto &p : ct) {
    sort(p.second.begin(), p.second.end());

    for (int i = p.second.size()-1; i >= 0; --i) {
      cout << p.second.at(i).second << endl;
    }
  }

  return 0;
}


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

int main()
{
    ll n;
    cin>>n;
    ll k;
    cin>>k;
    if(!k)return cout<<n*n,0;
    ll ans=0;
    for(ll b=1+k;b<=n;b++)
    {
        ll q=(n-k)/b;
        ans+=q*(b-k);
        ans+=min(n-(k+q*b)+1,b-k);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vi vector<ll> 
#define pb push_back
#define For(i,n) for(ll i=0;i<n;i++)
#define MOD 1000000007
#define MAX 100005
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	// freopen("output1.txt", "w", stdout);
	#endif
	int n,cnt=0;
	cin>>n;
	int x,y;
	while(n--){
		cin>>x>>y;
		if(x==y){
			cnt++;
		}
		else{
			cnt=0;
		}
		if(cnt>=3){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
}

Measured memory_bytes: 3644
#include<stdio.h>
long long int modpow(long long int a, long long int n, long long int p)
{
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
long long int fact[500005];
long long int comb(long long int n, long long int r, long long int p)
{
	long long int res = fact[n];
	res = res * modpow(fact[r], p - 2, p) % p;
	res = res * modpow(fact[n - r], p - 2, p) % p;
	return res;
}
int main()
{
	long long int n, m;
	scanf("%lld %lld", &n, &m);
	long long int p = 1000000007;
	long long int i;
	fact[0] = 1;
	for (i = 1; i <= m; i++)
		fact[i] = fact[i - 1] * i % p;
	long long int ans = fact[m] * modpow(fact[m - n], p - 2, p) % p;
	long long int s;
	for (i = 0; i < n; i++)
	{
		s = comb(n, i + 1, p);
		s = s * fact[m - i - 1] % p * modpow(fact[m - n], p - 2, p) % p;
		if (i % 2 > 0)
			ans = (ans + s) % p;
		else
			ans = (ans - s + p) % p;
	}
	s = fact[m] * modpow(fact[m - n], p - 2, p) % p;
	ans = ans * s % p;
	printf("%lld\n", ans);
	return 0;
}

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


void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;

  cout << endl;
}

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


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

//A
/*
int main() {
    int N, odd, eve;
    double ans;
    std::cin >> N;
    eve = N/2;
    odd = N - eve;
    ans = (double) odd/N;

    std::cout << ans << std::endl;

    return 0;
}
 */
/*
int main() {
    int N, K;
    std::cin >> N >> K;
    int h[N];
    int mem = 0;
    for(int i=0; i<N; i++){
        std::cin >> h[i];
        if(h[i]>=K){
            mem ++;
        }
    }

    std::cout << mem << std::endl;
    return 0;
}
*/

struct student{
    int prev;
    int id;
};
int main() {
    int N;
    std::cin >> N;
    student stu;
    int a[N];
    vector<student> students;
    for(int i=0; i<N; i++){
        std::cin >> a[i];
        stu.id=i+1;
        stu.prev=a[i];
        students.push_back(stu);
    }

    sort(students.begin(), students.end(),
         [](const student& x, const student& y) { return x.prev < y.prev;});

    for (int i = 0; i < students.size(); i++)
    {
        std::cout << students[i].id << std::endl;
    }
    /*
    for(int i=0; i<N; i++){
        int point = i;
        int num = a[i];
        int tmp;
        while(point!=0){
            if(num<a[point-1]){
                tmp=a[point-1];
                a[point-1]=a[point];
                a[point]=tmp;
                tmp=b[point-1];
                b[point-1]=b[point];
                b[point]=tmp;
                point--;
            }
            else{
                break;
            }
        }
    }
     */

    return 0;
}

Measured memory_bytes: 2164
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=[]
ch=[0]*(n+1)
co=0
for i in a:
  ch[i]+=1
for i in ch:
  if i !=0:
    co+=1
    x.append(i)
x.sort()

print(max(sum(x[:len(x)-k]),0))


Measured memory_bytes: 32168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const long double PI = (acos(-1));
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)

bool check(vector<int> x, vector<int> y){
    bool res = true;
    rep(i, 0, x.size()){
        if (x[i] != y[i]) res = false;
    }
    return res;
}

int main(){
    int n, a = 1, b = 1, cnt = 1; sc(n);
    vector<int> p(n), q(n), x;
    rep(i, 0, n) sc(p[i]);
    rep(i, 0, n) sc(q[i]);
    rep(i, 0, n) x.push_back(i+1);
    while (next_permutation(x.begin(), x.end())){
        cnt++;
        if (check(x, p)) a = cnt;
        if (check(x, q)) b = cnt;
    }
    cout << abs(a-b) << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
ans = [0]*M
for i in range(N):
    A = list(map(int, input().split()))
    for j in range(1, len(A)):
        ans[A[j]-1] += 1
cnt = 0
for i in ans:
    if i == N:
        cnt += 1
print(cnt)

Measured memory_bytes: 3064