akhauriyash/Code-Regression huggingface dataset:
n = int(input())
A = [*map(int, input().split())]
def solve():
    MAX_A = 10**6 + 1
    C = [0] * MAX_A
    for a in A: C[a] += 1
    pairwise = True
    for i in range(2, MAX_A):
        if sum(C[i::i]) > 1: pairwise = False
    if pairwise: return 'pairwise'
    from math import gcd
    g = 0
    for a in A: g = gcd(g, a)
    if g == 1: return 'setwise'
    return 'not'
print(solve(), 'coprime')


Measured memory_bytes: 126812
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, M;
	cin >> N >> M;

	vector<VI> G(N);
	map<int, int>mp;
	VI ans(N);



	REP(i, N + M-1) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		G[a].push_back(b);
		mp[b]++;
	}

	queue<int> tmp;

	REP(i, N) {
		if (mp[i] == 0) {
			ans[i] = 0;
			tmp.push(i);
			break;
		}
	}
	while (!tmp.empty()) {
		int res = tmp.front();
		tmp.pop();
		//cout << res << endl;
		REP(i, G[res].size()) {
			mp[G[res][i]]--;
			if (mp[G[res][i]] == 0) {
				ans[G[res][i]] = res+1;
				tmp.push(G[res][i]);
			}
		}
	}
	//cout << endl;
	REP(i, ans.size()) {
		cout << ans[i] << endl;
	}

	return 0;
}



Measured memory_bytes: 13312
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    	String befId = sc.next();
    	String aftId = sc.next();
    
     String modId = aftId.substring(0, aftId.length()-1);
   	/* modId.setLength(aftId.length()-1);*/
    
    if(befId.equals(modId)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 35696
/* Coached by Dukkha */
#include <stdio.h>
#include <string.h>

#define N 100000
#define INF 0x3f3f3f3f

int main() {
	static int dp[N + 1];
	int n, a, p, e;

	scanf("%d", &n);
	memset(dp, 0x3f, sizeof dp);
	dp[0] = 0;
	for (a = 0; a <= n; a++)
		if (dp[a] != INF)
			for (e = 6; e <= 9; e += 3)
				for (p = 1; a + p <= n; p *= e)
					if (dp[a + p] > dp[a] + 1)
						dp[a + p] = dp[a] + 1;
	printf("%d\n", dp[n]);
	return 0;
}


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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int H, N;
	cin >> H >> N;
	vector<int>A(N);
	int sum = 0;
	for (int i = 0; i < N; i++){
		cin >> A[i];
		sum += A[i];
	}
	cout << (sum >= H ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mid (l+r)/2
#define int ll
const int mod=1e9+7,inf=0x3f3f3f3f,maxn=3e5+5;
int n,m,Q,K;

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-'0';c=getchar();}
    return x*f;
}
int a[maxn],ton[70];
int ans=0;
int mmax(int x,int y){
    if(x>=y)return x;
    return y;
}
signed main(){
//  freopen("a.in","r",stdin);
//  freopen("a.out","w",stdout);
    n=read();
    int maxs=0;
    for(int i=1;i<=n;i++){
        a[i]=read();maxs=max(maxs,a[i]);
        //for(int j=0;(1<<j)<=a[i];++j)cout<<((a[i]>>j)&1);cout<<endl;
    }/*
    for(int i=n;i>=1;--i){
        for(int j=0;(1ll<<j)<=maxs;++j){
            //cout<<j<<" "<<ton[j]<<" "<<((a[i]>>j)&1)<<endl;
            if(((a[i]>>j)&1)==0)ans=(ans+(1ll<<j)%mod*ton[j])%mod;
            else ans=(ans+(1ll<<j)%mod*mmax(0,(n-i-ton[j])))%mod;
            //cout<<ans<<endl;
        }//cout<<endl;
        for(int j=0;(1ll<<j)<=maxs;++j){
            ton[j]+=((a[i]>>j)&1);
        }
    }*/
    for(int i=0;i<=63;++i){
        ton[0]=ton[1]=0;
        for(int j=n;j>=1;j--){
            ton[(a[j]>>i)&1]++;
            ans=(ans+(1ll<<i)%mod*ton[((a[j]>>i)&1)^1])%mod;
        }
    }
    /*
    rep(i, 0, 61) {
		ton[0] = ton[1] = 0;
		int sum = 0;
		drep(j, 1, n) ton[(a[j] >> i) & 1] ++, Ans = inc(Ans, mul((1ll << i) % mod, ton[((a[j] >> i) & 1) ^ 1]));
	}
    */
    printf("%lld\n",ans);



    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int change(int *a,int *b)
{
    int temp;

    if(*a > *b){
        temp = *a;
        *a = *b;
        *b = temp;
    }

    return 0;
}

int main(void)
{
    int i,j,x,y;
    int a[3000][2];

    for(i=0;;i++){
        scanf("%d %d",&x,&y);

        if(x==0 && y==0){
            break;
        }

    a[i][0]=x;
    a[i][1]=y;
    }

    for(j=0;j<i;j++){
        x=a[j][0];
        y=a[j][1];
        change(&x,&y);
        printf("%d %d\n",x,y);
    }

    return 0;
}


Measured memory_bytes: 2596
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

		try {
			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			int a = Integer.parseInt(buf);
			
			if(0 <= a || a < 86400){
				int hour = a /3600;
				int min = (a% 3600) / 60;
				int sec = (a% 3600) % 60;
				
			System.out.println(hour+":" + min + ":" + sec);
			}
		} catch(IOException e) {
			System.err.println(e);
		}
	}

}

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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++)
  {
    cin >> h[i];
  }
  const int INF = 1e9+10;

  vector<int> dp(n,INF);
  dp[0]=0;
  for (int i = 0; i < n; i++)
  {
    for (int j = i+1; j <= min(n-1,i+k); j++)
    {
      dp[j] = min(dp[j],dp[i]+abs(h[j]-h[i]));
    }
  }
  cout << dp[n-1] << endl;  
}

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

using namespace std;


int main() {

    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int q,f;
    int r,t;
    string s,tmp;
    char c;
    s = "";
    tmp = "";
    r = 0;
    cin>>s>>q;

    for(int i=0;i<q;i++){

        cin>>t;
        if(t==1) r++;
        else{
            cin>>f>>c;

            if(f==1){
                // begin
                if(r%2==0){
                    // string not change
                    tmp += c;
                }else{
                    // string is reversed
                    s += c;
                }

            }else{
                // end;

                if(r%2==0){
                    // string not change
                    s += c;
                }else{
                    // string is reversed
                    tmp += c;
                }
            }
        }
    }



    if(r%2==0){
        reverse(tmp.begin(),tmp.end());
        cout<<tmp<<s<<endl;
    }else{
        reverse(s.begin(),s.end());
        cout<<s<<tmp<<endl;
    }


    return 0;
}


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

int main()
{
    int n, a[3];
    cin >> n >> a[0] >> a[1] >> a[2];
    string s[100005];
    for(int i = 0; i < n; i++) cin >> s[i];
    if(a[s[0][0] - 'A'] == 0 && a[s[0][1] - 'A'] == 0){
        cout << "No" << endl;
        return 0;
    }
    if(a[0] + a[1] + a[2] >= 3){
        cout << "Yes" << endl;
        for(int i = 0; i < n; i++){
            if(a[s[i][0] - 'A'] >= a[s[i][1] - 'A']){
                a[s[i][0] - 'A']--;
                a[s[i][1] - 'A']++;
                cout << s[i][1] << endl;
            }
            else{
                a[s[i][0] - 'A']++;
                a[s[i][1] - 'A']--;
                cout << s[i][0] << endl;
            }
        }
        return 0;
    }
    if(a[0] + a[1] + a[2] <= 1){
        int ans[100005];
        for(int i = 0; i < n; i++){
            if(a[s[i][0] - 'A'] == 0 && a[s[i][1] - 'A'] == 0){
                cout << "No" << endl;
                return 0;
            }
            if(a[s[i][0] - 'A'] == 0){
                a[s[i][0] - 'A'] = 1;
                a[s[i][1] - 'A'] = 0;
                ans[i] = s[i][0] - 'A';
            }
            else{
                a[s[i][0] - 'A'] = 0;
                a[s[i][1] - 'A'] = 1;
                ans[i] = s[i][1] - 'A';
            }
        }
        cout << "Yes" << endl;
        for(int i = 0; i < n; i++) cout << char(ans[i] + 'A') << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for(int i = 0; i < n; i++){
        if(a[s[i][0] - 'A'] == 0){
            a[s[i][0] - 'A']++;
            a[s[i][1] - 'A']--;
            cout << s[i][0] << endl;
        }
        else if(a[s[i][1] - 'A'] == 0){
            a[s[i][0] - 'A']--;
            a[s[i][1] - 'A']++;
            cout << s[i][1] << endl;
        }
        else if(i == n - 1){
            a[s[i][0] - 'A']--;
            a[s[i][1] - 'A']++;
            cout << s[i][1] << endl;
        }
        else{
            if(s[i + 1][0] == s[i][0] || s[i + 1][1] == s[i][0]){
                a[s[i][0] - 'A']++;
                a[s[i][1] - 'A']--;
                cout << s[i][0] << endl;
            }
            else{
                a[s[i][0] - 'A']--;
                a[s[i][1] - 'A']++;
                cout << s[i][1] << endl;
            }
        }
    }
}


Measured memory_bytes: 7140
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from functools import reduce

N = int(input())

A = [int(x) for x in sys.stdin.read().split()]

xor = reduce(lambda x,y: x^y,A)

can_change = set(x^(x-1) for x in A)

arr = []
while xor:
    x = (1<<xor.bit_length())-1
    arr.append(x)
    xor ^= x

answer = 0
for x in arr:
    if x in can_change:
        answer += 1
    else:
        answer = -1
        break

print(answer)

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

using namespace std;

int main()
{
    char x[4];
    int i;
    bool ans = false;

    for(i = 0; i < 4; i++){
        cin >> x[i];
        if(i > 0  && x[i] == x[i-1]){
            ans = true;
        }
    }

    if(ans){ cout << "Bad" << endl; }
    else { cout << "Good" << endl; }

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>>m(n);
  for(int i=0;i<n;i++)
    cin >> m.at(i).first >> m.at(i).second;
  double ans=0,b;
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i!=j){
        b=sqrt(pow(m.at(i).first-m.at(j).first,2)+pow(m.at(i).second-m.at(j).second,2));
        ans+=b/n;
      }
    }
  }
  cout << setprecision(9);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3848
#include <stdio.h>
#include<string.h>



void change(char *str){
  int len=strlen(str);
  int i;
  for(i=0;i<len;i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i]-=32;
    }
  }
}

int main(){
  char t[10000];
  char key[10000];
  char eofstr[]={"END_OF_TEXT"};
  int ans=0;

  scanf("%s",key);
  change(key);

  while(1){
    scanf("%s",t);
    if(strcmp(t,eofstr)==0){
      break;
    }
    change(t);
    if(strcmp(t,key)==0){
      ans++;
    }
  }

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


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

using namespace std;

class DisjointSet {
public:
    vector<int> rank, p;

    DisjointSet() {}
    DisjointSet(int size) {
        rank.resize(size, 0);
        p.resize(size, 0);
        for (int i = 0; i < size; i++) makeSet(i);
    }
    
    void makeSet(int x) {
        p[x] = x;
        rank[x] = 0;
    }

    bool same(int x, int y) {
        return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
        link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
        if (rank[x] > rank[y]) {
            p[y] = x;
        } else {
            p[x] = y;
            if (rank[x] == rank[y])
                rank[y]++;
        }
    }

    int findSet(int x) {
        if (x != p[x]) {
            p[x] = findSet(p[x]);
        }
        return p[x];
    }
};

int main(void) {
    int n, a, b, q;
    int t;

    cin >> n >> q;
    DisjointSet ds(n);
    for (int i = 0; i < q; i++) {
        cin >> t >> a >> b;
        if (t == 0) ds.unite(a, b);
        else if (t == 1) {
            if (ds.same(a, b)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3164
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int A[5];
	int N;
	int n = 4;
	for (int i = 0; i < n; i++) cin >> A[i];
	cin >> N;
	int sum = A[0];
	for (int i = 1; i < n - 1; i++) {
		sum = min(sum * 2, A[i]);
	}
	ll ans = 0;
	ans += (ll)N / 2 * min(sum * 2, A[n - 1]);
	ans += (ll)(N % 2) * sum;
	cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

void solve(long long N, long long A, long long B){
    if (N < A+B-1 || N > A*B) {
        std::cout << -1 << std::endl;
        return;
    } else {
        vector<int> ret(N);
        int i = 0;
        for (int j = 0; j < A; j++) {
            ret[i] = N - A + j + 1;
            i++;
        }
        if (A == N) {
            for (int j = 0; j < N-1; j++) {
                std::cout << ret[j] << ' ';
            }
            std::cout << ret[N-1] << std::endl;
            return;
        }
        for (int j = 0; j < (N - A)/(B-1); j++) {
            int a = (j+1)*(B-1);
            for (int k = 0; k < B-1; k++) {
                ret[i] = a;
                a--;
                i++;
                if (i == N) {
                    break;
                }
            }
        }
        int l = N-i;
        for (int j = 0; j < l; j++) {
            ret[i] = ret[0] - 1 - j;
            i++;
        }
        for (int j = 0; j < N-1; j++) {
            std::cout << ret[j] << ' ';
        }
        std::cout << ret[N-1] << std::endl;
        return;
    }
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long A;
    long long B;
    long long N;
    scanf("%lld",&N);
    scanf("%lld",&A);
    scanf("%lld",&B);
    solve(N, A, B);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();

		int A = sc.nextInt();

		int B = sc.nextInt();

		int trainMoney = A * N;

		if (trainMoney <= B) {
			System.out.println(trainMoney);
		} else {
			System.out.println(B);
		}

	}

}

Measured memory_bytes: 23380
import itertools

n=int(input())

kn=len(str(n))

icnt=0
for kkn in range(3,kn+1):
    for i in itertools.product([3,5,7], repeat=kkn):
        if (3 in i) and (5 in i) and (7 in i):
#            ni=0
#            for ii in i:
#                ni=ni*10+ii
            ni=int("".join(map(str,i)))
#            print("1:",i,ni)
            if ni<=n:
                icnt+=1    
print(icnt)


Measured memory_bytes: 3060
#include <iostream>
#include <atcoder/fenwicktree>

using namespace std;
using namespace atcoder;

using ll = long long;

int main() {
    int N, Q;
    cin >> N >> Q;
    fenwick_tree<ll> fw(N);
    for (int i = 0; i < N; i++) {
        ll a; cin >> a;
        fw.add(i, a);
    }
    for (int _ = 0; _ < Q; _++) {
        int t; cin >> t;
        if (t == 0) {
            int p; ll x; cin >> p >> x;
            fw.add(p, x);
        }
        else {
            int l, r; cin >> l >> r;
            cout << fw.sum(l, r) << "\n";
        }
    }
    return 0;
}

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

using namespace std;

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

int main()
{
  int a,b;
  cin >> a >> b;
  
  rep(x, 1250)
  {
    int a1 = x * 0.08;
    int b1 = x * 0.10;
    
    if(a1 == a && b1 == b)
    {
      cout << x << endl;
      return 0;
    }
  }

    cout << -1 << endl;
  
	return 0;
}

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

int main() {
  int A, B, C;
  cin >> A >> B >> C;

  string ans = "NO";
  int sum = 100 * A + 10 * B + C;

  if (sum == 575 || sum == 755 || sum == 557)
    ans = "YES";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)















int main() {
	ll n;
	cin >> n;
	vector<pair<ll, ll>> v(n);
	REP(i, n) {
		ll x, L;
		cin >> x >> L;
		v[i] = { x - L, x + L };
	}
	sort(v.begin(), v.end(), [](pair<ll, ll> &a, pair<ll, ll> &b) {
		if (a.second != b.second) return a.second < b.second;
		return a.first < b.first;
	});
	ll le = -INF, ans = 0;
	REP(i, n) {
		ll l = v[i].first, r = v[i].second;
		if (le <= l) {
			le = r;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <functional>
#include <bitset>

using namespace std;

int main()
{
	int X, A;
	cin >> X >> A;

	if (X < A) {
		std::cout << 0;
	}
	else {
		std::cout << 10;
	}


	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int[] arr = new int[n];

        for (int i = 0; i<n; i++)
            arr[i] = sc.nextInt();
        
        int ans = 0;

        for (int i=0; i<n; i++)
            for (int j=i+1; j<n; j++)
                for (int k=j+1; k<n; k++)
                    if (isTriangle(arr[i], arr[j], arr[k]))
                        ans++;
        
        System.out.println(ans);
    }

    public static boolean isTriangle(int x, int y, int z)
    {
        if (x == y || y == z || x == z)
            return false;

        if (x>y && x>z)
            return y+z>x;
        else if (y>x && y>z)
            return x+z>y;
        else
            return x+y>z;
    }
}

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

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

  int n;
  cin >> n;

  vector<int> b(n - 1, 0);

  for (int i = 0; i < n - 1; i++) {
    cin >> b.at(i);
  }

  b.push_back(1000000);

  vector<int> a(n, 0);

  a.at(0) = b.at(0);

  for (int i = 1; i < n; i++) {
    int v = min(b.at(i), b.at(i - 1));

    a.at(i) = v;
  }

  int count = 0;
  for (int i = 0; i < n; i++) {
    count += a.at(i);
  }

  cout << count << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
	char S[16];
	int count=0;
	scanf("%s",S);
	int k=strlen(S);
	for(int i=0;i<k;i++){
		if(S[i]=='o')count++;
	}

	if(15-k>=8-count)printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n, k) for(int i=k; i<n; ++i)
using namespace std;
const long long mod=1e9+7;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int ans = min(min(a+b,a+c),b+c);
  cout << ans << endl;
}

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

if 400 <= X <= 599:
    print("8")
if 600 <= X <= 799:
    print("7")
if 800 <= X <= 999:
    print("6")
if 1000 <= X <= 1199:
    print("5")
if 1200 <= X <= 1399:
    print("4")
if 1400 <= X <= 1599:
    print("3")
if 1600 <= X <= 1799:
    print("2")
if 1800 <= X <= 1999:
    print("1")


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

int main(){
    int n, x,a[200],b=0;
    cin >> n >> x;
    rep(i, n) cin >> a[i];
    sort(a, a + n);
    while(x>0){
        if(x<a[b])
            break;
        x -= a[b];
        b++;
        if(x>0&&b==n){
            b = n - 1;
            break;
        }
    }
    cout << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int mod = 1000000007;
int n, a[N];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++ i) scanf("%d", &a[i]);
	sort(a + 1, a + n + 1);
	if (n & 1) {
		if (a[1] != 0) {
			puts("0");
			return 0;
		}
		for (int i = 2; i <= n; i += 2) {
			if (a[i] != i || a[i + 1] != i) {
				puts("0");
				return 0;
			}
		}
	} else {
		for (int i = 1; i <= n; i += 2) {
			if (a[i] != i || a[i + 1] != i) {
				puts("0");
				return 0;
			}
		}
	}
	int ans = 1;
	for (int i = 1; i <= (n >> 1); ++ i) {
		ans = 2ll * ans % mod;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 1e9
#define LINF 1e18
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

/**
 * Usage:
 * 
 * G[from].push_back(Edge(to, weight));
 * using Graph = vector<vector<Edge>>;
 * 
 */ 
struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

template<typename T>
void printv(vector<T>& v) {
  if (v.size() == 0) {
    cout << "\n";
    return;
  }

  Rep(i, v.size()) {
    cout << v[i] << ((i + 1 < v.size()) ? ' ' : '\n');
  }
}



int N;
ll t[1100];
ll a[1100];

int main () {
  cin >> N;

  rep(i, N) cin >> t[i] >> a[i];

  ll t_tmp = t[1];
  ll a_tmp = a[1];

  for (int k=2;k<=N;++k) {
    ll tt = (t_tmp % t[k] == 0) ? (t_tmp / t[k]) : (t_tmp / t[k] + 1);
    ll aa = (a_tmp % a[k] == 0) ? (a_tmp / a[k]) : (a_tmp / a[k] + 1);

    //cout << tt << aa << "\n";

    ll d = max(tt, aa);

    t_tmp = d * t[k];
    a_tmp = d * a[k];
    //cout << t_tmp << a_tmp << "\n";
  }

  cout << (t_tmp + a_tmp) << "\n";
}

Measured memory_bytes: 256
/*
@author: @sancodemonster
*/
 
#include <bits/stdc++.h>
 
#define flash ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define endl '\n'
#define ll long long int
#define ld long double
#define pb push_back 
#define mp make_pair
#define MOD 1000000007
#define f(i,a,b)  for(long long i=a;i<b;i++)
#define all(c) (c).begin(),(c).end() 
using namespace std;

ll happy[100005][3];
ll dp[100005][2][2][2] = {0};
ll rec(ll i,ll n,ll A,ll B,ll C)
{
    if(i>n)
    {
    	return 0;
    }
     
     if (dp[i][A][B][C] !=0)
     	return dp[i][A][B][C];
     
    ll a = INT_MIN;
    ll b = INT_MIN;
    ll c = INT_MIN;

    if(A == 1)
    {
        a = rec(i+1,n,0,1,1) + happy[i][0];
    }

    if(B == 1)
    {
        b = rec(i+1,n,1,0,1) + happy[i][1];
    }

    if(C == 1)
    {
        c = rec(i+1,n,1,1,0) + happy[i][2];
    } 
     ll maxi = max(a,b);
    dp[i][A][B][C] = max(maxi,c);
    return dp[i][A][B][C];
}
int main()
{
 /* #ifndef ONLINE_JUDGE
    freopen("C:\\desktopp\\new coding problems\\in.txt" , "r" , stdin);
    freopen("C:\\desktopp\\new coding problems\\out.txt" , "w" , stdout);
  #endif
*/
     flash;
     /////////////////////////////////////////////////////////////////////////////////////////////////////
      ll n;
      cin>>n;

      ll i,j;
      f(i,1,n+1)
      {
      	f(j,0,3)
      	{
           cin>>happy[i][j];
      	}
      }

       ll ans = rec(1,n,1,1,1);

       cout<<ans;
     /////////////////////////////////////////////////////////////////////////////////////////////////////

     return 0;
}


Measured memory_bytes: 16768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();

		if (n == 0) {
			System.out.println(0);
			return;
		}

		int[] rem = new int[40];
		for (int i = 0; i < rem.length; i++) {
			rem[i] = n % -2;
			n /= -2;
			if (rem[i] == -1) {
				n++;
				rem[i] = 1;
			}
		}

		int i = rem.length - 1;
		for (; i >= 0; i--) {
			if (rem[i] == 1) {
				break;
			}
		}
		for (; i >= 0; i--) {
			System.out.print(rem[i]);
		}
		System.out.println();
	}
}


Measured memory_bytes: 22868
#include <iostream>

using namespace std;

typedef long long ll;

#define min(a, b) ((a) < (b))? (a):(b)
#define max(a, b) ((a) > (b))? (a):(b)
#define abs(a) ((a) < (0)? -(a):(a))
#define rep(i, n) REP(i, 0, (n))
#define REP(i, a, n) for(typeof(n) i=(a); i<(n); i++)

int main() {
	ll N, M; cin >> N >> M;
	ll tmp;
	
	tmp = min(N, M/2);
	cout << tmp + (M-tmp*2)/4 << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int i, N, A[200001];
	long long K;
	scanf("%d %lld", &N, &K);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	
	int j, flag[200001] = {};
	flag[1] = 1;
	for (i = 2, j = 1; flag[A[j]] == 0; i++, j = A[j]) flag[A[j]] = i;
	
	if ((long long)i - 1 > K) {
		for (j = 1; flag[j] <= K; j = A[j]);
		printf("%d\n", j);
		fflush(stdout);
		return 0;
	}
	
	int period = i - flag[A[j]];
	K = (K - flag[A[j]] + 1) % period;
	for (j = A[j], i = 0; i < K; i++, j = A[j]);
	printf("%d\n", j);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 3252
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll r;
  cin >> r;
  cout << 3*r*r;
 return 0;
}


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

int main()
{
    set<int> s;
    int q;
    cin >> q;
    while (q--)
    {
        int x, y;
        cin >> x >> y;
        if (x == 0)
        {
            s.insert(y);
            cout << s.size() << endl;
        }
        if (x == 1)
        {
            cout << s.count(y) << endl;
        }
        if (x == 2)
        {
            s.erase(y);
        }
        if (x == 3)
        {
            int z;
            cin >> z;
            for (auto it = s.lower_bound(y); it != s.upper_bound(z); it++)
            {
                cout << *it << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 12424
import java.util.Scanner;
import java.util.TreeSet;
import java.util.Arrays;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while(true){
           int n,x;
          n=sc.nextInt();
          x=sc.nextInt();
          if(x==0&&n==0)break;
          int count=0;
          for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                for(int k=j+1;k<=n;k++){
                    if(i+j+k==x)count++;
                }
            }   
          }
          System.out.println(count);
}
}
}


Measured memory_bytes: 26672
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;


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

    //Code begins
    int n, m;
    cin>>n>>m;
    vector<int> adj[n];

    int u, v;
    for(int i = 0;i<m;i++)
    {
      cin>>u>>v;
      u--; v--;
      adj[u].push_back(v);
      adj[v].push_back(u);

    }
    int flag = 0;
    for(auto i: adj[0])
    {
      for(auto l: adj[i])
      {
        if(l == n-1)
        flag = 1;
      }
    }
    if(!flag)
    cout<<"IMPOSSIBLE\n";
    else if(flag)
    cout<<"POSSIBLE\n";





    return 0;
}


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

int main(void){
	int a,b,c;
	int i,j,k;

	scanf("%d %d",&a,&b);

	printf("%d\n",(a>=13)?b:(a>=6)?b/2:0);
	return 0;
}

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

int main() {
    int x, a, b;
    cin >> x >> a >> b;

    if ((b - a) >= (x + 1)) {
        cout << "dangerous" << endl;
    } else if ((b - a) <= 0) {
        cout << "delicious" << endl;
    } else {
        cout << "safe" << endl;
    }
    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <iomanip>
#define PI 3.14159265358979323846
using namespace std;

int main()
{
    int n,m,sum=0;
    cin>>n>>m;
    int arr[m];
    for(int i=0;i<m;i++)
        {
            cin>>arr[i];
            sum+=arr[i];
        }
    if(sum > n)
        cout<<"-1";
    else
        cout<<n-sum<<endl;
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,ans=0,temp;
  cin>>n;
  while(n>0){
    temp=n%10;
    if(temp==2){
      ans++;
    }
    n=n/10;
  }
  cout<<ans<<endl;
  return 0;
}

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

const int N = 100010;
const int MOD = 6;
const int INF = 2e9;

int a[N][3];
int f[N][3];

int dp(int n, int cur) {
	if(f[n][cur] != -1) {
		return f[n][cur];
	}
	
	if(n == 0) {
		return (f[n][cur] = a[n][cur]);
	}
	int val[3] = {0, 0, 0};
	for(int i = 0 ; i < 3 ; i++) {
		if(i != cur) {
			// choose 'cur' at index n
			// make (n - 1) choose anything apart from cur
			val[i] = a[n][cur] + dp(n - 1, i);
		}
	}
	int ans = max(val[0], max(val[1], val[2]));
	return (f[n][cur] = ans);
}

int main() {
	for(int i = 0 ; i < N ; i++) {
		for(int j = 0 ; j < 3 ; j++) {
			f[i][j] = -1;
		}
	}
	int n; cin >> n;
	for(int i = 0 ; i < n ; i++) {
		for(int j = 0 ; j < 3 ; j++) {
			cin >> a[i][j];
		}
	}
	for(int i = 0 ; i < 3 ; i++) {
		dp(n - 1, i);
	}
	cout << max(f[n - 1][0], max(f[n - 1][1], f[n - 1][2]));
}


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

using ll = long long;
using namespace std;

int main() {
    int n, k;
    string s;
    cin >> n >> k >> s;
    int border_count = 0;
    char cur = s[0];
    for (auto c: s) {
        if (c != cur) {
            border_count++;
            cur = c;
        }
    }
    if (border_count <= 2 * k) {
        cout << n - 1 << endl;
    } else {
        cout << n - 1 - (border_count - 2 * k) << endl;
    }
    return 0;
}


Measured memory_bytes: 512
<?php
list($N) = sscanf(trim(fgets(STDIN)), "%d");
$ar = [
    "AC" => 0,
    "WA" => 0,
    "TLE" => 0,
    "RE" => 0
];
for ($i = 0; $i < $N; $i++) {
    list($S) = sscanf(trim(fgets(STDIN)), "%s");
    $ar[$S]++;
}
foreach($ar as $key => $value){
    print("{$key} x {$value}\n");
}

Measured memory_bytes: 16268
//Be Name Khoda
/*
tane adami sharifast be jane adamiat
na hamin lebase zibast neshane adamiat
agar adami be cheshmasto dahano goosho bini
che miane naghshe divaro miane adamiat
khoro khabo khashmo shahvat shaghab asto jahlo zolmat
hayavan khabar nadarad ze jahane adamiat
be haghighat adami bash vagarna morgh bashad
ke hami sokhan begooyad be zabane adamiat
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (ll i=a;i<b;++i)
#define Ford(i,a,b) for (ll i=a;i>=b;--i)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); }
#define MKP make_pair
#define RETD(x) { cout << fixed << setprecision(15) << x; } //exit(0); }
#define GEI(x) scanf("%d",&x)
#define GEL(x) scanf("%lld",&x)
#define ALL(x) x.begin(),x.end()
const ll M=700+5,LG=30,SM=1000,inf=1e9+5;
ll mod=1e9+7;
ll pw(ll a,ll n) { return (n==0?1:pw(a*a%mod,n/2)*(n%2?a:1)%mod); }
#define MOK(x) if (x>mod) x-=mod;

ll jad[M][M];
ll n,m;
bitset<2*M> kle;
ll mark[M];
ll t1,t2;
vll v;

void dfs(ll x,ll f){
  mark[x]=f;
  if (f==1) t1++; else t2++;
  For(i,0,n){
    if (jad[x][i]) continue;
    if (mark[i]){
      if (mark[x]==mark[i]) RET(-1);
      continue;
    }
    dfs(i,mark[x]==2?1:2);
  }
}

int main()
{
    ios::sync_with_stdio(0);
    cin >> n >> m;
    For(i,0,m){
      ll x,y;
      cin >> x >> y;
      x--;y--;
      jad[x][y]=jad[y][x]=1;
    }
    For(i,0,n) jad[i][i]=1;
    ll su=0;
    For(i,0,n){
      if (mark[i]) continue;
      t1=t2=0;
      dfs(i,1);
      if (t1>t2) swap(t1,t2);
      su+=t1;
      v.PB(t2-t1);
    }
    kle[0]=1;
    for(ll t:v){
      kle|=kle<<t;
    }
    ll res=inf;
    ll n2az=n*(n-1)/2;
    For(i,0,2*M){
      if (!kle[i]) continue;
      smin(res,n2az-(su+i)*(n-su-i));
    }
    RET(res);
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
    
int main() {
  int a[3];
  for (int i=0; i<3; i++) {
    cin>>a[i];
  }
  sort(a,a+3);
  
  cout<<a[0]+a[1]<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll int64_t
#define ul unsigned long long int
#define vi vector<int>
#define vl vector<int64_t>
#define all(x) x.begin(),x.end()
#define pb push_back
#define fo(x,a,b) for(int x=a; x<b; x++)
#define rfo(x,a,b) for(int x=a; x>=b; x--)
#define fi first
#define sec second
#define mp make_pair
int sgn(int x) { return x>0 ? 1 : ( x<0 ? -1 : 0); }
typedef pair<int,int> pairs;
double pi = 3.14159265358979323846;
ll mod = 1000000007;

void solve()
{
    ll n,d;
  cin>>n>>d;
  int cnt=0;
  while(n--)
  {
    ll x,y;
    cin>>x>>y;
    if(d*d>=x*x+y*y) cnt++;
  }
  cout<<cnt;
    cout<<"\n";
    return;
}
int main()
{
#ifdef _DEBUG
    freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3636
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()

fun main() {
    val blue = Array(int()) {str()}
    val red = Array(int()) {str()}

    val r = blue.map {b->
        blue.count {b==it}-red.count {b==it}
    }.max()!!
    println(max(r,0))
}

Measured memory_bytes: 37024
#include <cmath>
#include <cstdio>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <stdio.h>
#include <functional>
#include <chrono>
using namespace std;

#define rep(i,s,n) for(ll i=s;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
//constexpr ll MOD = (1e9 + 7);
constexpr ll MOD = (998244353);

using vl = vector<ll>;
using vvl = vector<vector<ll>>;

template<class T>
vector<vector<T>> vvt(T init, ll m, ll n) {
	vector<vector<T>> ans = vector<vector<T>>(m, vector<T>(n, init));
	return move(ans);
}

template<class T>
vector<T> vt(T init,ll n) {
	vector<T> ans = vector<T>(n, init);
	return move(ans);
}

template<class T>
T maxVec(vector<T> &v) {
	T ans = -INF;
	rep(i,0, v.size()) {
		ans = max(ans, v[i]);
	}
	return ans;
}

// 素数判定
bool judge(ll n) {
	for (ll i = 2; i * i <= n; i++) if (n %= i)return false;
	return true;
}


template <class C>
void print(const C& c, std::ostream& os = std::cout)
{
	std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, ", "));
	os << std::endl;
}
/*
ll count(ll n,ll r) {
	ll ans = 0,check = 1;
	rep(i,0, r) {
		if ((n & check) > 0) {
			ans++;
		}
		check = check << 1;
	}
	return ans;
}
*/
bool sortreverse(ll a, ll b) {
	return a > b;
}

bool kansu(pll a, pll b) {
	return a.first < b.first;
}

ll kiriage(ll a, ll b) {
	if (a % b == 0)return a / b;
	return a / b + 1;
}

ll n,m,x,y;
vl a, b;

ll modpow(ll n, ll a, ll m) {
	if (a == 0)return 1;
	if (a % 2 == 0) {
		ll b = modpow(n, a / 2, m);
		return (b * b) % m;
	}
	else if (a % 2 == 1) return (n * modpow(n, a - 1, m)) % m;
}

int main() {
	cin >> n;
	vl d(n), count(n+5);
	ll max_val = 0;
	rep(i, 0, n) {
		cin >> d[i];
		count[d[i]] ++;
		max_val = max(max_val, d[i]);
		if (i != 0 && d[i] == 0) {
			printf("0\n");
			exit(0);
		}
	}
	ll ans = count[0];
	rep(i, 1, max_val + 1) {
		ll c = modpow(count[i - 1], count[i], MOD);
		ans %= MOD;
		c %= MOD;
		ans *= c;
		ans %= MOD;
	}
	printf("%lld\n", ans % MOD);
}

Measured memory_bytes: 1792
import math
import sys
sys.setrecursionlimit(int(10**9))

mod = 10**9 + 7

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y/2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def fact(n):
    if n == 1: 
        return 1
    else:
        return (fact(n-1)*n)%mod

def comb(n, k):
    ans = 1
    for i in range(k):
        ans *= (n-i)
        ans //= i+1
    return ans % mod

n, a, b = map(int, input().split())
now = 1
for i in range(a):
    now = (now*(n-i))%mod
cnka = (now * power(math.factorial(a),mod-2) )% mod
for i in range(a,b):
    now = (now*(n-i))%mod
cnkb = (now * power(math.factorial(b),mod-2) )% mod

ans = power(2, n)%mod - cnka - cnkb - 1
print(ans % mod)

Measured memory_bytes: 6916
#include<stdio.h>
int main ()
{
	int n,i,f=0;
	scanf("%d",&n);
	for(i=0;i<=n/7;i++)
	if((n-7*i)%4==0){
		f=1;break;
	} 
	
	if(f)  printf("Yes");
	else printf("No");
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#define N 1000005
#define INF 0x3f3f3f3f
using namespace std;
int main(){
	int min0=INF;
	int ans=0;
	int n;
	cin>>n;
	int a[N];
	for(int i=1;i<=n;i++)
		cin>>a[i];
	for(int i=1;i<=n;i++){
		if(a[i]<min0){
			ans++;
			min0=a[i];
		}
	}
	cout<<ans<<endl;
	return 0; 
}

Measured memory_bytes: 3072
// D - 11
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

#define MAX 100000
ll fac[MAX+1]; // 累乗 n!
ll inv[MAX+1]; // 逆元 1/n
ll finv[MAX+1]; // 逆元の累乗 (n^-1)! = (1/n)!

void init(int n, int p){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	rp(i, 2, n+1){
		fac[i] = fac[i-1] * i % p;
		inv[i] = p - inv[p%i] * (p/i) % p;
		finv[i] = finv[i-1] * inv[i] % p;
	}
}

ll nCk_mod(int n, int k, int m){
	if(n<k || n<0 || k<0) return 0;
	return fac[n] * (finv[n-k] * finv[k] % m) % m;
}

void solve(int N, int d){
	int MOD = 1000000007;
	init(N+1+1, MOD);
	rp(k, 1, N+2){
		ll ans = (nCk_mod(N+1, k, MOD) - nCk_mod(N-d, k-1, MOD)) % MOD;
		if(ans < 0) ans += MOD;
		cout<< ans <<endl;
	}
}

int in(int N){
	int d = 0;
	vi exist(N+1, -1);
	rp(i, 0, N+1){
		int a; cin>>a;
		if(exist[a] >= 0){
			d = i - exist[a];
			break;
		}
		exist[a] = i;
	}
	return d;
}

int main(){
	int N; cin>>N;
	solve(N, in(N));
}

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

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

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

  if (N % findSumOfDigits(N) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535;

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

    if (t.substr(0, s.size()) == s && t.size() == s.size() + 1) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
l = [[[0 for z in range(10)] for y in range(3)] for x in range(4)]
n = int(input())
while n > 0:
  b,f,r,v = map(int,input().split())
  l[b-1][f-1][r-1] += v
  n -= 1
c = 0
for b in l:
  c += 1
  for f in b:
    r_l = [str(r) for r in f]
    print(' '+' '.join(r_l))
  if c < len(l):  
    print('#'*20)

Measured memory_bytes: 7748
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,x,m,ans=0;
  bool aaa=false;
  cin >> n >> x >> m;
  vector<long> a(5000000),aruisekiwa(5000001),syutugen(m,-1);
  syutugen[x]=0;
  a[0]=x;
  aruisekiwa[1]=x;
  ans+=a[0],n--;
  for(long i=1;n!=0;i++) {
    a[i]=a[i-1]*a[i-1]%m;
    aruisekiwa[i+1]=aruisekiwa[i]+a[i];
    if(syutugen[a[i]]==-1||aaa) {
      syutugen[a[i]]=i;
      ans+=a[i],n--;
    } else {
      aaa=true;
      ans+=n/(i-syutugen[a[i]])*(aruisekiwa[i]-aruisekiwa[syutugen[a[i]]]);
      //n=n%(i-syutugen[a[i]]);
      ans+=(aruisekiwa[syutugen[a[i]]+n%(i-syutugen[a[i]])]-aruisekiwa[syutugen[a[i]]]);
      //i=syutugen[a[i]]-1;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 82188
use proconio::{fastout, input};

use rand::prelude::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::time::SystemTime;

#[fastout]

fn calc_score(d: usize, c: &Vec<i64>, s: &Vec<[i64; 27]>, t: &Vec<usize>) -> i64 {
    let mut res = 0;
    let mut last: [usize; 26 + 1] = [0; 26 + 1];
    for day in 1..=d {
        let now_contest = t[day];
        res += s[day][now_contest];
        last[now_contest] = day;
        for contest in 1..=26 {
            res -= c[contest] * (day - last[contest]) as i64;
        }
    }
    res
}

fn get_time(time: SystemTime) -> f64 {
    time.elapsed().unwrap().as_secs_f64()
}

fn main() {
    let time = SystemTime::now();
    let mut rand = rand_pcg::Pcg64Mcg::new(890482);

    // input
    input! {
        d: usize,
        _c: [i64; 26],
        _s: [[i64; 26]; d],
    }

    let mut c = vec![0];
    c.extend(_c.iter());

    let mut s = vec![[0; 26 + 1]; d + 1];
    for day in 1..=d {
        for contest in 1..=26 {
            s[day][contest] = _s[day - 1][contest - 1]
        }
    }

    let mut t = vec![1; d + 1];

    // process
    let mut score = calc_score(d, &c, &s, &t);
    while get_time(time) < 1.95 {
        for _ in 1..=1000 {
            let b = rand.gen_range(0, 1);
            if b == 0 {
                let day = rand.gen_range(1, d + 1);
                let contest = rand.gen_range(1, 26 + 1);

                let tmp = t[day];
                t[day] = contest;
                let next_score = calc_score(d, &c, &s, &t);
                if next_score > score {
                    score = next_score;
                } else {
                    t[day] = tmp;
                }
            } else {
                let day = rand.gen_range(1, d);

                let tmp = t[day];
                t[day] = t[day + 1];
                t[day + 1] = tmp;

                let next_score = calc_score(d, &c, &s, &t);
                if next_score > score {
                    score = next_score;
                } else {
                    t[day + 1] = t[day];
                    t[day] = tmp;
                }
            }
        }
    }

    for i in 1..=d {
        println!("{}", t[i]);
    }
}


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

typedef long long LL;

int main() {
    long long n, a, b;
    cin>>n>>a>>b;

    if (a%2 == b%2) cout<<abs(a-b)/2<<endl;
    else {
        LL x = (a-1 + b-1 + 1)/2;
        LL y = (n-a + n-b + 1)/2;
        cout<<min(x, y)<<endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n, a[21], b[21], c[21];
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    for(int i=1;i<=n;i++){
        cin >> b[i];
    }
    for(int i=1;i<n;i++){
        cin >> c[i];
    }
    
    
    int ans = 0, p = -1;
    for(int i=1;i<=n;i++){
        ans += b[a[i]];
        if(p == a[i] - 1)ans += c[a[i] - 1];
        p = a[i];
    }
    cout << ans << endl;
}


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

int main() {
	int H, W;
	cin >> H >> W;
	string C;
	for (int i = 0;i < H;i ++) {
		cin >> C;
		cout << C << endl << C;
		if (i < H - 1) cout << endl;
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

各行について毎回二度ずつ出力すれば二倍拡大になってます
*/

Measured memory_bytes: 256
import Data.List
import Data.Monoid

notNull = not . null

main :: IO ()
main = do
    [n, y] <- map read . words <$> getLine
    let sets = [(a, b, n - a - b) | a <- [0..n], b <- [0..(n-a)]]
        sets' = filter (\(a, b, c) -> a * 10000 + b * 5000 + c * 1000 == y) sets
    putStrLn $ if notNull sets' then head $ map (\(a, b, c) -> show a <> " " <> show b <> " " <> show c) sets'
                             else "-1 -1 -1"

Measured memory_bytes: 1020