akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
int main()
{
    char c=getchar();
    int x=0;
    while(c<'0'||c>'9') c=getchar();
    while(c>='0'&&c<='9') x*=10,x+=c-'0',c=getchar();
    c=getchar();
    while(c>='0'&&c<='9') x*=10,x+=c-'0',c=getchar();
    for(int i=1;i<=10000;i++)
        if(i*i==x)
        {
            printf("Yes");
            return 0;
        }
    printf("No");
}//hahahaa

Measured memory_bytes: 128
def iread():
    return int(input())


def sread():
    return input()


def aread_int():
    tmp = input().split()
    ret = [int(i) for i in tmp]
    return ret


def aread_str():
    return input().split()

if __name__ == '__main__':
    n, x = map(int, input().split())
    l = aread_int()
    current = 0
    cnt = 0
    while cnt < n and current + l[cnt] <= x :
        current += l[cnt]
        cnt += 1
    
    print(cnt + 1)

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

int main() {
	long N, K, R, S, P,binder=0;
	long score = 0;
	string T;
	cin >> N >> K >> R >> S >> P >> T;
	vector<string> A(K);
	
	
	for (size_t i = 0; i < N; i++)
	{
		A.at(i % K) += T.at(i);
	}
	for (size_t i = 0; i < K; i++)
	{
		for (size_t j = 0; j < A.at(i).size(); j++)
		{
			if (A.at(i).at(j)=='r')
			{
				if (j>=1&&A.at(i).at(j-1)=='r')
				{
					binder++;
					if (binder%2==0)
					{
						score += P;
						
					}
				}
				else
				{
					binder = 0;
					score += P;
				}
			}
			if (A.at(i).at(j) == 's')
			{
				if (j >= 1 && A.at(i).at(j - 1) == 's')
				{

					binder += 1;
					if (binder % 2 == 0)
					{
						score += R;
					}
				}
				else
				{
					score += R;
					binder = 0;
				}
			}
			if (A.at(i).at(j) == 'p')
			{
				if (j >= 1 && A.at(i).at(j - 1) == 'p')
				{

					binder += 1;
					if (binder % 2 == 0)
					{
						score += S;
					}
				}
				else
				{
					score += S;
					binder = 0;
				}
			}
		}
	}
	cout << score;
	
}

Measured memory_bytes: 5120
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
       mut b:[i64;n],
    }
    let mut a = vec![0];
    a.append(&mut b);
    let mut anss = vec![false; n + 1];
    let mut z = vec![];
    for i in (1..=n).rev() {
        let j = divisor(i);
        if ((a[i] == 1) ^ anss[i]) {
            for divs in j {
                anss[divs] = !anss[divs];
            }
            z.push(i);
        }
    }
    println!("{}", z.len());
    for &x in z.iter() {
        println!("{}", x);
    }
}
pub fn divisor(n: usize) -> Vec<usize> {
    let mut res = Vec::new();
    for i in (1..).take_while(|x| x * x <= n) {
        if n % i == 0 {
            res.push(i);
            if i != n / i {
                res.push(n / i);
            }
        }
    }
    res.sort();
    res
}


Measured memory_bytes: 6748
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define int long long
using namespace std;

signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	for (int d = 1; d < a; d++) {
		int e, f;
		cin >> e >> f;
		int g, h; g = h = 0;
	g=(b%e) ? (b/e+1) : (b/e);
	h=(c%f) ? (c/f+1) : (c/f);
	b = e*max(g, h);
	c = f*max(g, h);
	}
	cout << b + c << endl;
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const int oo = 1e6;
int n, k;
int arr[100007];

int main() {
int a, b;
char c;
cin >> a >> c >> b;
if(c == '-'){
  cout << a - b;
}else{
  cout << a + b;
}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll mod = 1e9 + 7;

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

  ll x, y;
  cin >> x >> y;
  if(x % y == 0){
    cout << -1 << endl;
    return 0;
  }
  cout << x << endl;
  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[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		int index = partition(nums,0,nums.length-1);
		for(int i=0;i<n;i++){
			if(i!=index){
				if(i!=0)System.out.print(" "+nums[i]);
				else System.out.print(nums[i]);
			}else{
				System.out.print(" ["+nums[i]+"]");
			}
		}
		System.out.println();
	}
	public static int partition(int[] A,int l,int r){
		int pivot = A[r];
		int left = l; 
		while(l<r){
			if(A[l]<=pivot){
				swap(A,l,left);
				left++;
			}
			l++;
		}
		swap(A,r,left);
		return left ;
		
	}
	public static  void swap(int[] A,int i,int j){
		int tmp = A[i];
		A[i] = A[j];
		A[j] = tmp; 
	}
}

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

int main(){
    ll n;
    cin>>n;
    ll a[n];for(int i=0;i<n;++i)cin>>a[i];
    ll b[n];
    ll summ=0;
    for(int i=n-1;i>=0;--i){
        summ = (summ + a[i])%mod;
        b[i] = summ;
    }
    ll ans = 0;
    for(int i=0;i<=n-2;++i){
        ans = (ans + a[i]*b[i+1])%mod;
    }
    cout<<ans;










    return 0;
}

Measured memory_bytes: 6744
#include <iostream>
// B - ABC

using namespace std;

int main() {
    string s;
    int i,j,k,l,a,add;
    long long ans;

    cin >> s;

    i = 0;
    a = 0;
    ans = 0;
    while (i < s.size()) {
        j = i;
        add = 0;
        while (j < s.size()) {
            if (j + 2 < s.size() && s[j] == 'A' && s[j + 1] == 'B' && s[j + 2] == 'C') {
                add++;
                j += 3;
            }
            else
                break;
        }
        while (j < s.size()) {
            if (j + 1 < s.size() && s[j] == 'B' && s[j + 1] == 'C')
                j += 2;
            else
                break;
        }

        ans += (1LL * a * ((j - i - add) >> 1));

        l = 0;
        for (k = j - 1;k >= i;k--) {
            if (s[k] == 'A') {
                ans += ((j - k - l) >> 1);
                l++;
            }
        }
        
        if (i == j) {
            if (s[i] == 'A')
                a++;
            else
                a = 0;

            i++;
        }
        else {
            i = j;
            a += add;
        }
    }

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

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
int main(){
  ll n;
  cin>>n;
  vector<ll> a(n),s(n+1);
  rep(i,n){cin>>a[i];}
  rep(i,n){
    s[i+1]=s[i]+a[i];}
  map<ll,ll> t;
  rep(i,n+1){
    if(t.count(s[i])){t[s[i]]++;} else{t[s[i]]=1;}}
  ll l=0;
  for(auto x:t){l+=(x.second)*(x.second-1)/2;}
  cout<<l<<endl;
}

Measured memory_bytes: 15872
import sys
input = sys.stdin.readline
a, b = (int(i) for i in input().split()) 
c, d= (int(i) for i in input().split()) 
#a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 
#print(a,b,c,d)
if a != c:
    print(1)
else:
    print(0)


Measured memory_bytes: 38384
n, m = [int(i) for i in input().split()]

path = [0 for i in range(n)]

for i in range(m):
    a, b = [int(i) for i in input().split()]
    path[a-1] += 1
    path[b-1] += 1

for i in range(n):
    print(path[i])

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

int water(vector<int> &h,int i,int n){
  if(n==1){
    return h.at(i);
  }else if(n<=0){
    return 0;
  }
  int x=i;
  for(int j=i;j<i+n;j++){
    if(h.at(x)>h.at(j)){
      x=j;
    }
  }
  int y=h.at(x);
  for(int j=i;j<i+n;j++){
    h.at(j)=h.at(j)-y;
  }
  if(x==i+n-1){
    return y+water(h,i,x-i);
  }
  return y+water(h,i,x-i)+water(h,x+1,n-x+i-1);
}
  

int main(){
  int N;
  cin>>N;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin>>h.at(i);
  }
  
  cout<<water(h,0,N)<<endl;
}

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

int main() {
  int N,i;
  cin >> N;
  vector<int> A(N);
  for(i=0;i<N;i++) cin >> A.at(i);
  sort(A.begin(),A.end());
  cout << A.at(N-1) - A.at(0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define here(x) cout << #x << " = " << x << endl;
#define show(x) {for( auto ii : x) cout << ii << setw(6); cout << endl;}
#define shop(n, x) {for(int i = 0; i < n; i++) cout << x << setw(6); cout << endl;}
#define ff first
#define ss second
#define endl '\n'
#define en " "
#define pb push_back
#define mpair make_pair
ll mod = 1000000007;
ll inf = LLONG_MAX;
long double pi = 3.1415926536;
int main()
{
	fastio();
	int tt = 1;
	//cin >> tt;
	while(tt--)
	{
		// 		j NOT i 		check		//		CHECK -> if()   else if()
		ll n, x = 0, m = 0, y = 0, k = inf;
		cin >> n;
		ll a[n], s[n] = {};
		for(ll i = 0; i < n; i++)
		{
			cin >> a[i];
			if(i) s[i] = s[i - 1] + a[i];
			else s[0] = a[0];
		}
		ll dp[n + 1][n + 1] = {};

		for(ll p = 1; p < n; p++)
		{
			ll i = 0, j = p;
			while(j < n)
			{
				dp[i][j] = inf;
				ll se;
				if(i)	se = s[j] - s[i - 1];
				else 	se = s[j];
				for(ll r = 0; r < j - i; r++)
				{
					dp[i][j] = min(dp[i][j], dp[i][r + i] + dp[r + i + 1][j] + se);
				}
				i++; j++;
			}
		}
		cout << dp[0][n - 1] << endl;
	}
}

Measured memory_bytes: 1536
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<utility>
#include<vector>
using namespace std;
typedef pair<unsigned,unsigned> PUU;
const int MXN=100010;

int w,h;
unsigned p[MXN],q[MXN];
vector<PUU> d;

int main()
{
  cin>>w>>h;
  for(int i=0;i!=w;++i)
    {
      cin>>p[i];
      d.push_back(PUU(p[i],0));
    }
  for(int i=0;i!=h;++i)
    {
      cin>>q[i];
      d.push_back(PUU(q[i],1));
    }
  sort(d.begin(),d.end());
  unsigned long long res=0;

  for(int i=0;i!=d.size();++i)
    if(d[i].second==0) //in p
      {
	--w;
	res+=(unsigned long long)d[i].first*(h+1);
      }
    else
      {
	--h;
	res+=(unsigned long long)d[i].first*(w+1);
      }
  cout<<res<<endl;
}


Measured memory_bytes: 3060
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

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

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

llong N, K;
vvecllong memo(0, vecllong(0, -1));
vecllong A(0, -1);

llong search(llong child, llong candy) {
    if(candy == 0) return 1;
    if(candy < 0) return 0;
    if(child == -1) return 0;
    if(memo[child][candy] != -1) return memo[child][candy];

    llong ret = 0;
    ret = (search(child - 1, candy) + search(child, candy - 1)) % MOD;
    ret = (ret - search(child - 1, candy - A[child] - 1)) % MOD;
    if(ret < 0) {
        ret += MOD;
    }
    memo[child][candy] = ret % MOD;
    return memo[child][candy];
};

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

    cin >> N >> K;

    memo.resize(N + 1, vecllong(K + 1, -1));
    A.resize(N, -1);

    FOR(i, N) {
        cin >> A[i];
    }

    llong ans = search(N - 1, K) % MOD;
    cout << ans << endl;

    return 0;
}

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

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];

    long long res = 0;
    for (int d = 60; d >= -1; --d) { // d = -1 は X = K の場合
        if (d != -1 && !(K & (1LL<<d))) continue;

        long long tmp = 0;
        for (int e = 60; e >= 0; --e) {
            long long mask = 1LL<<e;
            int num = 0;
            for (int i = 0; i < N; ++i) if (A[i] & mask) ++num;

            if (e > d) {
                if (K & mask) tmp += mask * (N - num);
                else tmp += mask * num;
            }
            else if (e == d) {
                tmp += mask * num;
            }
            else {
                tmp += mask * max(num, N - num);
            }
        }
        res = max(res, tmp);
    }
    cout << res << endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Math;

class Program{
    static void Main(){
        string[] s = Console.ReadLine().Split();
        int m = int.Parse(s[0]);
        int k = int.Parse(s[1]);

        if (m == 1){
            if (k >= 1){
                Console.WriteLine(-1);
                return;
            }
            Console.WriteLine("0 0 1 1");
            return;
        }

        if (k >= (int)Pow(2,m)){
            Console.WriteLine(-1);
            return;
        }
        int M = (int)Pow(2,m);
        for (int i = 0;i < M;i++){
            if (i == k) continue;
            Console.Write("{0} ",i);
        }
        Console.Write(k);
        for (int i = M - 1;i >= 0;i--){
            if (i == k) continue;
            Console.Write(" {0}",i);
        }
        Console.WriteLine(" {0}",k);
    }
}

Measured memory_bytes: 16828
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
 
int main() {
    int N,M;
    cin >> N >> M;
    vector <int> k(M);
    vector < vector <int>> s(M,vector<int>(100));
    for(int i=0;i<M;i++){
        cin >> k[i];
        for(int j = 0; j<k[i];j++){
            cin >> s[i][j];
        }
    }
    vector <int> p(M);
    for(int i = 0;i<M;i++){
        cin >> p[i];
    }
    int ans = 0;
    bool swi=true;
    for(int bit=0; bit< (1<<N);bit++){
        bitset<10> bi(bit); //onなら１、offなら0
        //bi = "~~00"のとき
        //電球0のon数＝bi.test(s[0][0])+bi.test(s[0][1])=0
        //電球1のon数=bi.test(s[1][0])=0
        swi = true;
        vector <int> on(M);
    
        for(int i = 0;i<M;i++){
            for(int j = 0;j<k[i];j++){
                on[i] += bi.test(s[i][j]-1);
            }
            on[i] = on[i]%2;
        }
        
        for(int i = 0;i<M;i++){
            if(on[i]!=p[i]){
                swi = false;
            }

            //cout << "on[" <<i<<"]="<<on[i]<<endl; 
        }
        if(swi){
            ans++;
        }
        
    }
    cout << ans <<endl;
}


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

#define inf  1000000007
#define ll long long
#define PA pair<int,int>
#define PPAP pair<int,pa>
#define  MP make_pair
#define  PB push_back
#define VI vector<int>

using namespace std;
long long  mod = 1000000007;



int main(){
	int n;
	bool flag=0;
	cin >> n;
	vector<vector<int> > v(n+1);
	VI p(n+1);
	VI x(n+1);
	VI q(n+1);
	for(int i=2;i<=n;i++){
		cin >> p[i];
		v[p[i]].push_back(i);
	}
	for(int i=1;i<=n;i++){
		cin >> x[i];
	}
	for(int i=n;i>=1;i--){
		vector<vector<int> > c(v[i].size()+1,vector<int>(x[i]+1,inf));
		if(v[i].size()==0){
			q[i] = 0;
		}else{
			bool breakflag=0;
			c[0][0]=0;
			for(int j=1;j<v[i].size()+1;j++){
				int tar = v[i][j-1];
				for(int k=0;k<=x[i];k++){
					if(c[j-1][k]!=inf){
						if(k+x[tar]<=x[i]){
							c[j][k+x[tar]] = min(c[j][k+x[tar]],c[j-1][k]+q[tar]);
						}
						if(k+q[tar]<=x[i]){
							c[j][k+q[tar]] = min(c[j][k+q[tar]],c[j-1][k]+x[tar]);
						}
					}
				}
			}
			int mi=inf;
			for(int k=0;k<=x[i];k++){
				mi = min(mi,c[v[i].size()][k]);
			}
			q[i]=mi;
			if(mi==inf){
				flag=1;
				break;
			}
		}
	}
	if(flag){
		cout << "IMPOSSIBLE" << endl;
	}else{
		cout << "POSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 1308
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
typedef vector<ll>vec;
typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
//const ll MOD = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    ll N = S.size() + 1;
    vector<ll> a(N);
    REP(i,N-1) if(S[i] == '<') chmax(a[i+1], a[i] + 1);
    for(int i=N-1;i>=0;i--) if(S[i] == '>') chmax(a[i], a[i+1] + 1);
    cout << accumulate(a.begin(), a.end(), 0LL) << endl;
}


Measured memory_bytes: 4764
N = int(input())
G = []
for i in range(0,N):
    S,P= (x for x in input().split(' '))
    G.append([S,int(P)])
G_sort=sorted(G,key=lambda x: (x[0],-x[1]))
for j in range(0,N):
    print(G.index(G_sort[j]) +1) 

Measured memory_bytes: 3060
def main():
    h, w, n = map(int, input().split())
    y, x = map(int, input().split())
    s, t = input(), input()

    u, d, l, r = 1, h, 1, w

    for ss, tt in zip(s[::-1], t[::-1]):
        if tt == 'U':
            d = min(d + 1, h)
        elif tt == 'D':
            u = max(u - 1, 1)
        elif tt == 'L':
            r = min(r + 1, w)
        else:
            l = max(l - 1, 1)  # tt == 'R'

        if ss == 'U':
            u += 1
        elif ss == 'D':
            d -= 1
        elif ss == 'L':
            l += 1
        else:
            r -= 1  # ss == 'R'

        if l > r or u > d:
            print('NO')
            return

    if l <= x <= r and u <= y <= d:
        print('YES')
        return
    else:
        print('NO')
        return


if __name__ == '__main__':
    main()

Measured memory_bytes: 4024
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

// dp[i][k][sum] := 先頭からi番目までの数字から k 枚選んだとき,
// 選んだ数字の総和を s にできる場合の数
long long dp[55][55][2550] = {0};

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

  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }

  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < n; k++) {
      for (int sum = 0; sum <= 2500; sum++) {
        dp[i + 1][k][sum] += dp[i][k][sum];
        dp[i + 1][k + 1][sum + x[i]] += dp[i][k][sum];
      }
    }
  }

  long long ans = 0;
  for (int k = 1; k <= n; k++) {
    ans += dp[n][k][k * a];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 56448
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func newPlayer(num int, order []int) player {
	return player{num: num, nowIndex: 0, order: order}
}
func newPlayers(ps ...player) players {
	players := make(players, len(ps))
	for i := range ps {
		players[i+1] = &ps[i]
	}
	return players
}

type player struct {
	num      int
	nowIndex int
	order    []int
}

func (p *player) next() {
	p.nowIndex++
}
func (p *player) isFinished() bool {
	return p.nowIndex >= len(p.order)
}
func (p *player) getOppNum() int {
	return p.order[p.nowIndex]
}

func (p *player) String() string {
	return fmt.Sprintf("{%v,%v,%v}", p.num, p.nowIndex, p.order)
}

type players map[int]*player

type matchSet map[int]struct{}

func (ms *matchSet) add(i int) {
	(*ms)[i] = struct{}{}
}
func (ms *matchSet) isEmpty() bool {
	return len(*ms) == 0
}
func (ms *matchSet) contains(i int) bool {
	_, ok := (*ms)[i]
	return ok
}

func decide(n int, players players) int {
	matchCount := (n * (n - 1)) / 2
	days := 0

	mainQueue := make([]int, 0, n)
	for i := 0; i < n; i++ {
		mainQueue = append(mainQueue, i)
	}

	for len(mainQueue) > 0 {
		queue := mainQueue
		mainQueue = nil

		days++

		isMatched := false
		visited := matchSet{}

		for _, i := range queue {
			p, ok := players[i]
			if !ok {
				continue
			}
			if visited.contains(p.num) {
				continue
			}
			visited.add(i)
			popp, ok := players[p.getOppNum()]
			if !ok {
				continue
			}
			if visited.contains(popp.num) {
				continue
			}
			if p.num != popp.getOppNum() {
				continue
			}
			p.next()
			popp.next()

			visited.add(popp.num)
			matchCount--
			isMatched = true

			if !p.isFinished() {
				mainQueue = append(mainQueue, p.num)
			}
			if !popp.isFinished() {
				mainQueue = append(mainQueue, popp.num)
			}
		}
		if !isMatched { //空なら失敗
			return -1
		}
	}
	return days
}

func main() {
	n := nextInt()
	mp := make(players, n)
	for i := 1; i < n+1; i++ {
		p := newPlayer(i, nextInts(n-1))
		mp[i] = &p
	}
	// fmt.Println(mp)
	r := decide(n, mp)
	fmt.Println(r)
}


Measured memory_bytes: 18304
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

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


template<typename T, typename E>
struct SkewHeap{
  typedef function<T(T, E)> F;
  typedef function<E(E, E)> G;
  typedef function<bool(T,T)> C;
  F f;
  G g;
  C c;
  E e;
  SkewHeap(F f,G g,C c,E e):f(f),g(g),c(c),e(e){}

  struct Node{
    Node *l,*r;
    T val;
    E add;
    Node(T val,E add):val(val),add(add){l=r=NULL;}
  };

  void eval(Node *a){
    if(a->add==e) return;
    if(a->l) a->l->add=g(a->l->add,a->add);
    if(a->r) a->r->add=g(a->r->add,a->add);
    a->val=f(a->val,a->add);
    a->add=e;
  }
  
  T top(Node *a){
    return f(a->val,a->add);
  }
  
  Node* push(T v){
    return new Node(v,e);
  }
  
  Node* meld(Node *a,Node *b){
    if(!a) return b;
    if(!b) return a;
    if(c(top(a),top(b))) swap(a,b);
    eval(a);
    a->r=meld(a->r,b);
    swap(a->l,a->r);
    return a;
  }
  
  Node* pop(Node* a){
    eval(a);
    auto res=meld(a->l,a->r);
    free(a);
    return res;
  }
  
};

//INSERT ABOVE HERE
signed main(){
  using Heap = SkewHeap<Int, Int>;
  Int n,m;
  cin>>n>>m;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  
  Heap::F f=[](auto a,auto b){return a+b;};
  Heap::G g=[](auto a,auto b){return a+b;};
  Heap::C c=[](auto a,auto b){return a>b;};
  
  Heap heap(f,g,c,0);
  vector<Heap::Node*> v(n);
  for(Int i=0;i<n;i++) v[i]=heap.push(a[i]);
  
  UnionFind uf(n);
  for(Int i=0;i<m;i++){
    Int x,y;
    cin>>x>>y;
    x=uf.find(x);y=uf.find(y);
    uf.unite(x,y);
    if(uf.find(x)!=x) swap(x,y);
    v[x]=heap.meld(v[x],v[y]);
    v[y]=NULL;
  }
  
  if(m==n-1){
    cout<<0<<endl;
    return 0;
  }

  Heap::Node* base=NULL;
  
  Int ans=0,cnt=0;
  for(Int i=0;i<n;i++){
    if(uf.find(i)==i){
      ans+=heap.top(v[i]);
      v[i]=heap.pop(v[i]);
      base=heap.meld(base,v[i]);
      cnt++;
    }
  }
  
  while(m*2+cnt<(n-1)*2){
    if(base==NULL){
      cout<<"Impossible"<<endl;
      return 0;
    }
    ans+=heap.top(base);
    base=heap.pop(base);
    cnt++;
  }
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 9344
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		vi a(n);

		for(int i=0;i<n;i++) scanf("%d", &a[i]);

		double ans_=0.0;
		for(int i=0;i<n;i++) ans_+=1.0/a[i];

		double ans=1.0/ans_;
		printf("%.8f\n", ans);
	}
	return 0;
}


Measured memory_bytes: 384
sx, sy, tx, ty = map(int, input().split())

dx = tx - sx
dy = ty - sy

for _ in range(dx):
    print('R', end='')
for _ in range(dy):
    print('U', end='')
for _ in range(dx):
    print('L', end='')
for _ in range(dy):
    print('D', end='')

print('L', end='')
for _ in range(dy+1):
    print('U', end='')
for _ in range(dx+1):
    print('R', end='')
print('DR', end='')
for _ in range(dy+1):
    print('D', end='')
for _ in range(dx+1):
    print('L', end='')
print('U', end='')

Measured memory_bytes: 4468
def resolve():
    S = list(input())
    mindiff = float("inf")
    for i in range(len(S)-2):
        val = int(S[i]+S[i+1]+S[i+2])
        mindiff = min(mindiff, abs(753-val))
    print(mindiff)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 61888
n = int(input())
a = sorted(map(int, input().split()))
b = [0] * (10 ** 6 + 1)
c = [False] * (10 ** 6 + 1)
for i in a:
    b[i] += 1
ans = 0
for i in range(1, 10 ** 6 + 1):
    if not b[i]:
        continue
    if b[i] == 1 and not c[i]:
        ans += 1
    for j in range(1, 10 ** 6 + 1):
        if i * j > 10 ** 6:
            break
        c[i * j] = True
print(ans)

Measured memory_bytes: 125068
#include <iostream>
#include <vector>
using namespace std;
#include <cmath>
int main() {
	int N;
	int D;
	cin >> N >> D;
	vector<vector<int> > X(N, vector<int>(D));
	for(auto& r: X)
		for(auto& c: r)
			cin >> c;

	int out = 0;
	for(int i = 0; i < N; i++) {
		for(int j = i + 1; j < N; j++) {
			int s = 0;
			for(int k = 0; k < D; k++) {
				s += pow(X[i][k] - X[j][k], 2);
			}
			double r = sqrt(s);
			if(ceil(r) == floor(r)) out++;
		}
	}

	cout << out << endl;
}


Measured memory_bytes: 888
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int gcd(int x,int y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
int main()
{
    string a,b;
    cin>>a>>b;
    int lena=a.size();
    int lenb=b.size();
    if(lena>lenb)
    {
        cout << "GREATER" <<endl;
    }
    else if(lena<lenb)
    {
        cout << "LESS" <<endl;
    }
    else
    {
        if(a>b)
            cout << "GREATER" <<endl;
        else if(a<b)
            cout << "LESS" <<endl;
        else if(a==b)
            cout << "EQUAL" <<endl;
    }

    return 0;
}


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

using namespace std;

int main()
{
    int e,v,a,b;
    cin >> v >> e;
    pair<int, pair<int,int> > hrany[e];
    int vrcholy[v];
    for(int i=0; i<e; i++){
        cin>> hrany[i].second.first >> hrany[i].second.second >> hrany[i].first;
    }
    vector< vector <int> > komp;
    int vaha=0;
    komp.resize(v);
    for(int i=0; i<v; i++){
        vrcholy[i]=i;
        komp[i].resize(1);
        komp[i][0]=i;
    }
    sort(hrany, hrany+e);
    for(int i=0; i<e; i++){
        a=hrany[i].second.first;
        b=hrany[i].second.second;
        if(vrcholy[a]!=vrcholy[b]){
            vaha+=hrany[i].first;
            int x=vrcholy[a];
            int y=vrcholy[b];
            if(komp[x].size()<komp[y].size()){
                for(int j=0; j<komp[x].size(); j++){
                    vrcholy[komp[x][j]]=y;
                    komp[y].push_back(komp[x][j]);
                }
            }
            else{
                for(int j=0; j<komp[y].size(); j++){
                    vrcholy[ komp [y] [j] ]=x;
                    komp[x].push_back(komp[y][j]);
                }
            }
        }
    }
    cout<< vaha << endl;
    return 0;
}



Measured memory_bytes: 4856
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  int *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(int)*n+1);
  B = malloc(sizeof(int)*n+1);

  for(i = 1; i <= n; i++){
    scanf("%d", &A[i]);
  }

  for(i = 0; i <= VMAX; i++){
    C[i] = 0;
  }

  for(j = 1; j <= n; j++){
    C[A[j]]++;
  }

  for(i = 1; i <= VMAX; i++){
    C[i] = C[i] + C[i-1];
  }

  for(j = n; j >= 1; j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i = 1; i <= n; i++){
    printf("%d", B[i]);
    if(i != n) printf(" ");
    else printf("\n");
  }

  return 0;
}



Measured memory_bytes: 17400
import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def C(a,b): return a>b or abs(a-b)<1e-6
def f(e1):
  tx,ty,sx,sy=e1
  x=[]
  for e2 in WP:
    wx,wy,r=e2
    wt=[tx-wx,ty-wy]; rwt=R(wt)
    sw=[wx-sx,wy-sy]; rsw=R(sw)
    st=[tx-sx,ty-sy]; rst=R(st)
    F=[rwt<r,rsw<r]
    if rst==0: c=1
    elif F==[1,1]: c=1
    elif F==[1,0] or F==[0,1]: c=0
    elif F==[0,0]:
      a=M.pi/2-M.acos(r/rsw)
      b=M.acos(round((sw[0]*st[0]+sw[1]*st[1])/rsw/rst,4))
      if C(a,b) and C(rst**2,rsw**2-r**2): c=0
      else: c=1
    if c==0: return 0
    x.append(c)
  return all(x)

while 1:
  n=input()
  if n==0: break
  WP=I(n)
  P=I(input())
  for e in P: print ["Safe","Danger"][f(e)]

Measured memory_bytes: 4600
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let s: String = sc.read();
    println!("{} {}", &s[0..4], &s[4..12]);
}

// Thanks, kenkoooo(https://kenkoooo.hatenablog.com/entry/2019/05/07/101033)
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n, W;
ll weight[100005];
ll value[100005];
ll dp[101][100005];
ll ans(ll index,ll w){
    if(w > W){
        return 0;
    }
    if(index > n){
        return 0;
    }
    if(dp[index][w] != -1){
        return dp[index][w];
    }
    ll left = INT_MIN;
    if( w + weight[index] <= W){
    left = value[index] + ans(index+1,w+weight[index]);
    }
    ll right = ans(index+1,w);
    return dp[index][w] = max(left,right);
    
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>W;
    memset(dp,-1,sizeof(dp));
    for(ll i=1;i<=n;i++){
        cin>>weight[i]>>value[i];
    }
    cout<<ans(1,0)<<"\n";
}


Measured memory_bytes: 80128
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
using namespace std;

int main()
{
    int N[4];
    cin>>N[0]>>N[1]>>N[2]>>N[3];

    for(int i=0; i<4; i++)
    {
        if(N[i]==1)
        {
            for(int j=0; j<4; j++)
            {
                if(N[j]==9)
                {
                    for(int k=0; k<4; k++)
                    {
                        if(N[k]==7)
                        {
                            for(int l=0; l<4; l++)
                            {
                                if(N[l]==4)
                                {
                                    cout<<"YES"<<endl;
                                    return 0;
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

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

int main() {
    int a, b;
    cin >> a >> b;
    cout << gcd(max(a, b), min(a, b)) << endl;
}

Measured memory_bytes: 1160
using System;


    public static class Program
    {
    static void Main()
    {
        
            while (true)
            {
                var data = Console.ReadLine().Trim().Split(' ');
                var a = int.Parse(data[0]);
                var b = int.Parse(data[1]);
                if (a == 0 && b == 0) break;
                Console.WriteLine("{0} {1}",Math.Min(a,b), Math.Max(a,b));

            }
            
            
        
   
        
       
    }
    }




Measured memory_bytes: 15876
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = solve(n, a)
    print(ans)

def solve(n, a):
    if 0 in a:
        return 0
    lim = 10 ** 18
    ans = 1
    for i in a:
        ans *= i
        #print(f'{ans:}')
        if ans > lim:
            return -1
    return ans

if __name__ == '__main__':
    main()

Measured memory_bytes: 21628
fun main(args : Array<String>) {
    val (n, k) = readLine()!!.split(" ").map { it.toInt() }
    val xx = readLine()!!.split(" ").map { it.toLong() }

    val posCnt = xx.count { it >= 0 }
    val negCnt = n - posCnt

    val startIdx = if (k >= negCnt) 0 else negCnt-k

    var minD = Long.MAX_VALUE

    for (i in startIdx until n) {
        if (i+k > n) break

        val sPos = xx[i]
        val sPosA = Math.abs(sPos)
        val lPos = xx[i+k-1]
        val lPosA = Math.abs(lPos)

        if (sPos >= 0 && lPos >=0) {
            minD = Math.min(minD, lPosA)
        } else if (sPos < 0 && lPos < 0) {
            minD = Math.min(minD, sPosA)
        } else {
            if (sPosA >= lPosA) {
                minD = Math.min(minD, lPosA*2 + sPosA)
            } else {
                minD = Math.min(minD, lPosA + sPosA*2)
            }
        }
    }

    println(minD)
}

Measured memory_bytes: 52500
MOD=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans,rev,sm=0,0,0
for i in range(1,n):
    for j in range(i):
        if a[i]<a[j]: rev+=1
        elif a[i]==a[j]: sm+=1
ans+=rev*k
ans%=MOD
ans+=(n*(n-1)//2-sm)%MOD*(k*(k-1)//2%MOD)
print(ans%(10**9+7))

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> p(M),y(M);
  
  for(int i=0;i<M;i++){
    cin>>p[i]>>y[i];
    p[i]--;
  }

  vector<vector<int>> task(N);//県の数だけ配列を準備
  for(int i=0;i<M;i++){
    task[p[i]].push_back(y[i]);//各県の配列に市を挿入
  }
  for(int i=0;i<N;i++){
    sort(task[i].begin(),task[i].end());
  }
  for(int i=0;i<M;i++){
    cout<<setfill('0')<<right<<setw(6)<<p[i]+1;
    //該当市の含まれる県の配列中の該当市の位置は先頭から何番目か　0オリジンなので出力時に1を足す
    int id=lower_bound(task[p[i]].begin(),task[p[i]].end(),y[i])-task[p[i]].begin();
    cout<<setfill('0')<<right<<setw(6)<<id+1;
    cout<<endl;
  }
   
  return 0;
}


Measured memory_bytes: 7808
#include<stdio.h>
 
typedef struct {
  int left;
  int right;
  int p;
} node;
 
node a[10000];
int b[10000], c[10000], n;
 
void x(int d,int e)
{
  
  if(d==-1) return;
  
  b[d] = e;
  x(a[d].left,e+1);
  x(a[d].right,e+1);
  
}
 
int y(int d)
{
  
  int e, f;

  e = 0;
  f = 0;
  
  if (a[d].left!=-1){
    e = y(a[d].left)+1;
  }
  
  if (a[d].right!=-1) {
    f = y(a[d].right)+1;
  }
  
  return c[d]=(e>f ? e:f);
  
}
 
int z(int d) {
  
  if(a[d].p==-1) return -1;
  
  if(a[a[d].p].left!=d && a[a[d].p].left!=-1) return a[a[d].p].left;
  
  if (a[a[d].p].right!=d && a[a[d].p].right!=-1) return a[a[d].p].right;
  
  return -1;
  
}
 
 
int main()
{
  
  int i, id, l, r, root, deg;

  root = 0;
  
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    a[i].p = -1;
  }
 
  for (i=0;i<n;i++){
    scanf("%d %d %d",&id,&l,&r);
    a[id].left = l;
    a[id].right = r;
    if(l!=-1){
      a[l].p = id;
    }
    if(r!=-1){
      a[r].p = id;
    }
  }
 
  for(i=0;i<n;i++){
    if(a[i].p==-1){
      root = i;
    }
  }
 
  x(root,0);
  y(root);
 
  for(i=0;i<n;i++){
    deg = 0; 
    printf("node %d: ",i);
    printf("parent = %d, ",a[i].p);
    printf("sibling = %d, ",z(i));
    if(a[i].left!=-1){
      deg++;
    }
    if(a[i].right!=-1){
      deg++;
    }
    printf("degree = %d, ",deg);
    printf("depth = %d, ",b[i]);
    printf("height = %d, ",c[i]);
    if(a[i].p==-1){
      printf("root\n");
    }
    else if(a[i].left==-1 && a[i].right==-1){
      printf("leaf\n");
    }
    else{
      printf("internal node\n");
    }
  }

  return 0;
  
}



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

int main(){
  int n;
  cin>>n;
  switch(n%10){
  	case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout<<"hon";
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout<<"pon";
      break;
    default:
      cout<<"bon";
  }
  return 0;
}

Measured memory_bytes: 3604
#line 2 "/Users/kaage/Desktop/ProgrammingWorkspace/library/other/template.hpp"
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
typedef std::pair<lint, lint> LP;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	if (!b)return T(1);
	if (b & 1)return mypow(a, b - 1) * a;
	T memo = mypow(a, b >> 1);
	return memo * memo;
}
lint modpow(lint a, lint b, lint m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	lint memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
#line 2 "main.cpp"
int main(){
	int x;
	std::cin>>x;
	std::cout<<10-x/200<<std::endl;
	return 0;
}


Measured memory_bytes: 3620
#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 x,y;
  cin >>x >>y;
  bool can = false;
  rep(i,x+1){
    int sum = i*2+(x-i)*4;
    if(sum==y) can = true;
  }
  if(can) cout << "Yes" << endl;
  else cout << "No" << endl; 
  return 0;
}

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

namespace Aojx
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                string s = Console.ReadLine();

                if (s == "0 0 0")
                {
                    break;
                }

                var cheese = s.Split(' ').Select(e => double.Parse(e))
                    .OrderBy(e => e).ToArray();

                var len = Math.Sqrt(cheese[0] * cheese[0] +
                                    cheese[1] * cheese[1]);

                var n = int.Parse(Console.ReadLine());

                for (int i = 0; i < n; i++)
                {
                    int r = int.Parse(Console.ReadLine());
                    if (len < r * 2)
                    {
                        Console.WriteLine("OK");
                    }
                    else
                    {
                        Console.WriteLine("NA");
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 6560
n = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
A_card = []
B_card = []
for i in range(n):
        if i%2 == 0:
                A_card.append(A[i])
        else:
                B_card.append(A[i])
print(sum(A_card) - sum(B_card))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll A,B,C;
  cin >> A >> B >> C;
  if(A%2==1||B%2==1||C%2==1)
  {
    cout << 0 << endl;
    return 0;
  }
  if(A==B&&B==C)
  {
    cout << -1 << endl;
    return 0;
  }
  rep(i,10000)
  {
    if(A%4==2||B%4==2||C%4==2)
    {
      cout << i + 1 << endl;
      return 0;
    }
    else
    {
      ll a = A;
      ll b = B;
      ll c = C;
      A = b/2 + c/2;
      B = c/2 + a/2;
      C = a/2 + b/2;
    }
  }
  return 0;
}


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

int main()
{
    string s; cin>>s;
    bool result = true;

    for(int i = 0; i<3; i++)
    {
        if(s.at(i) == s.at(i+1)) result = false;
    }

    if(result == true) cout << "Good" << endl;
    else cout << "Bad" << endl;

    return 0;
}

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

int main()
{
  i64 n, k, q;
  cin >> n >> k >> q;
  vector<i64> p(n);
  for (i64 i = 0; i < q; i++)
  {
    i64 a;
    cin >> a;
    p[a - 1]++;
  }
  for (i64 i = 0; i < n; i++)
    if (0 < p[i] + k - q)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define endl '\n'
#define mod 1000000007
#define pi 3.14159265358979323
 
bool sorttt(const pair<int, pair<char, int> > &a, 
              const pair<int, pair<char, int> > &b) 
{ 
    return (a.first > b.first); 
}
 
int power(int x,int n){
    int res=1;
    while(n>0){
        if(n&1)
            res=res*x;
        x*=x;
        n>>=1;
    }
    return res;
}

int bin(int x,int n){
    int res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}
bool prime(int n){
    if(n==3)return 1;
    repp(i,2,sqrt(n)){
        if(n%i==0)return 0;
    }
    return 1;
}
int chk(int n){
    int mi=100, ma=-1;
    while(n){
        mi=min(mi,n%10);
        ma=max(ma,n%10);
        n/=10;
    }
    return ma*mi;
}
vector<int> adj[200006];
int vis[200006]={0};
void bfs(int s, int p) 
{ 
    list<int> queue; 
  
    vis[s] = p; 
    queue.push_back(s); 
  
    while(!queue.empty()) 
    { 

        s = queue.front(); 
        queue.pop_front(); 
  
        for (auto i: adj[s]) 
        { 
            if (!vis[i]) 
            { 
                vis[i]=s; 
                queue.push_back(i); 
            } 
        } 
    } 
} 
signed main()
{
    fast
    int n, m, f=1, x, y; cin>>n>>m;
	rep(i,0,m){
		cin>>x>>y;
		adj[x].pb(y);
		adj[y].pb(x);
	}
	bfs(1, -1);
	rep(i,1,n+1)if(!vis[i]){f=0; break;}
	if(f==0){cout<<"No"; return 0;}
	else{
		cout<<"Yes"<<endl;
		rep(i,2,n+1)cout<<vis[i]<<endl;
	}

}


Measured memory_bytes: 16972
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main()
{
    string s1,s2;
    while(cin>>s1)
    {
        s2="";
        for(int i=0;i<s1.size();i++)
        {
            if(s1[i]=='0')
            {
                s2+='0';
            }
            if(s1[i]=='1')
            {
                s2+='1';
            }
            if(s1[i]=='B')
            {
                s2=s2.substr(0,s2.size()-1);
            }
        }
        cout<<s2<<endl;
    }
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int N;
vector<int> edge[100010];
int path[100010], profits[100010];


pair<int, int> dfs(int v, int p) {
  path[v] = p;
  if (v == N - 1) return make_pair(0, 1);
  int a = 0, b = 0;
  for (int c : edge[v]) {
    if (c != p) {
      pair<int, int> tmp = dfs(c, v);
      a += tmp.first;
      b += tmp.second;
    }
  }

  //cout << v << ':' << a << ' ' << b << endl;
  profits[v] = a + 1;
  if (b > 0) {
    return make_pair(0, 1);
  } else {
    return make_pair(a + 1, 0);
  }
}

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  cin >> N;
  REP(i, N - 1) {
    int a, b; cin >> a >> b; a--, b--;
    edge[b].emplace_back(a);
    edge[a].emplace_back(b);
  }

  dfs(0, -1);
  vector<int> route;
  int v = N - 1;
  while (v != -1) {
    route.emplace_back(v);
    v = path[v];
  }

  //REP(i, N) cout << profits[i] << (i == N - 1 ? '\n' : ' ');

  vector<bool> used(N, false);
  vector<int> now = {(int)route.size() - 1, 0};
  int money = 0, turn = 0;

  while (true) {
    int v = route[now[turn]];
    //cout << v << ' ' << turn << ' ' << endl;
    if (used[v]) break;
    used[v] = true;
    if (turn == 0) {
      money += profits[v];
      now[turn]--;
    } else {
      now[turn]++;
    }
    turn ^= 1;
  }

  //cout << money << endl;
  cout << (money > N - money ? "Fennec" : "Snuke") << endl;
  return 0;
}


Measured memory_bytes: 14972