akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

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


int main(){
	string s;
	int in[3]={0};
	in[0]=1;
	in[1]=2;
	in[2]=3;
	
	while(cin>>s){
		char a = s[0];
		char b = s[2];
		if(a=='#')break;
		int m[333];
		m['A']=0;
		m['B']=1;
		m['C']=2;
		
		swap(in[m[a]], in[m[b]]);
	}
	
	rep(i,3){
		if(in[i]==1){
			if(i==0)puts("A");
			if(i==1)puts("B");
			if(i==2)puts("C");
		}
	}
}

Measured memory_bytes: 1144
n = int(input())
if n % 2 == 1:
  print(0)
  exit()
d = list(map(int, input().split()))
d = sorted(d)
if d[n//2] - d[n//2-1] == 0:
  print(0)
  exit()
print(d[n//2] - d[n//2-1])

Measured memory_bytes: 14396
/*Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define debug(x) cout << #x << " " << x <<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef priority_queue<int, vector<int>, function<bool(int, int)>> pq_func;
/*---------------------------------------------------------------------------------------------------------------------------*/
int gcd(int a, int b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
/*--------------------------------------------------------------------------------------------------------------------------*/
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	ll* dp = new ll[2019]();
	string s;
	cin >> s;
	int p = s[0] - '0';
	dp[p]++;
	ll ans = 0;
	for (int i = 1; i < s.length(); i++)
	{
		int p = s[i] - '0';
		ll* temp_dp = new ll[2019]();
		temp_dp[p] = 1;
		for (int j = 0; j < 2019; j++)
		{
			int x = (10 * j + p) % 2019;
			temp_dp[x] += dp[j];
			if (x == 0)
				ans += dp[j];
		}
		for (int j = 0; j < 2019; j++)
			dp[j] = temp_dp[j];
		delete[] temp_dp;
	}
	delete[] dp;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3756
#include<stdio.h>
int main(void)
{
	int i,j,q,x,box[1000],jadge;
	scanf("%d",&i);
	for (j = 0; j < i; j++)
	{
		scanf("%d", &box[j]);
	}

	for (j = 0; j < i; j++)
	{
		x=0;
		for (q = j+1; q < i; q++)
		{
			jadge = box[x];
			box[x] = box[x+1];
			box[x+1] = jadge;
			x++;
		}
	}
	for (j = 0; j < i-1; j++)
	{
		printf("%d ",box[j]);
	}
	printf("%d\n",box[i-1]);
	return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N;
int main(){
    cin>>N;
    ll ans=0;
    for(ll i=1;i<=N;i++){
        ans+=i*(N/i)*(1+N/i)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<iomanip>
#include<sstream>
#include<cmath>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
typedef long long int ll;
typedef long double ld;
const int inf = (1 << 30);
const int MOD = 1000000007;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
int main() {
    int a, b, k;
    cin >> k >> a >> b;
    for (int i = a; i <= b; i++) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3624
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func main() {
	scanner.Split(bufio.ScanWords)
	startTemp, _ := nextInt()
	targetTemp, _ := nextInt()
	deltaFrozen, _ := nextInt()
	deltaZero, _ := nextInt()
	deltaNotFrozen, _ := nextInt()

	requiredTime := 0

	if startTemp < 0 {
		requiredTime += -startTemp * deltaFrozen
	}
	if startTemp <= 0 {
		requiredTime += deltaZero
	}
	if startTemp <= 0 {
		requiredTime += targetTemp * deltaNotFrozen
	} else {
		requiredTime += (targetTemp - startTemp) * deltaNotFrozen
	}

	fmt.Println(requiredTime)
}



Measured memory_bytes: 1120
#include<bits/stdc++.h>
#define LLI long long int
#define ULTRA 2134567890

using namespace std;

int main()
{
    int i,j;
    int k,x;

    scanf("%d %d",&k,&x);

    for( i=x-k+1; i<= x+k-1; i++)
    {
        printf("%d ",i);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 256
package main

import(
    "fmt"
)



func main() {
    var a int
    fmt.Scan(&a)
    fmt.Println(a*(a+1)/2)
}





func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

count = 0
edge = []

i = 0
for _ in range(n-1):
    if a[i] == a[i+1]:
        count = count + 1
        edge.append(a[i])
        i = i + 1
        if count == 2:
            break
    i = i + 1

s = edge[0]*edge[1] if count == 2 else 0
print(s)

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

using namespace std;

typedef long long int64;

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

  B -= A;
  A -= A;

  for(int i = 0; i < N; i++) { // AからCを足す回数
    int64 small1 = C * i;
    int64 large1 = D * i;
    int64 small2 = C * (N - i - 1);
    int64 large2 = D * (N - i - 1);
    if(small1 - large2 <= B && B <= large1 - small2) {
      cout << "YES" << endl;
      return (0);
    }
  }
  cout << "NO" << endl;
}


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

typedef long long ll;

const int N = 2000006;

int a[N];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n,k;
	cin>>n>>k;
	
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	
	long double x = 0.0;
	for(int i=1;i<=k;i++){
		x += log(a[i]);
	}
	
	long double y = x;
	for(int i=k+1;i<=n;i++){
		y -= log(a[i-k]);
		y += log(a[i]);
		if(y > x){
			cout<<"Yes"<<endl;
		}
		else{
			cout<<"No"<<endl;
		}
		x = y;
	}
	
	return 0;
}


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

int main() {
  int K;
  cin >> K;
  if ( K == 1 || K == 2 || K == 3 || K == 5 || K == 7 || K == 11
      || K == 13 || K == 15 || K == 17 || K == 19 || K == 23 
      || K == 29 || K == 31 ) {
    cout << 1;
  }
  else if ( K == 4 || K == 6 || K == 9 || K == 10 || K == 14 || K == 21
           || K == 22 || K == 25 || K == 26 ) {
    cout << 2;
  }
  else if ( K == 8 || K == 12 || K == 18 || K == 20 || K == 27 ) {
    cout << 5;
  }
  else if ( K == 28 || K == 30 ) {
  cout << 4;
  }
  else if ( K == 16 ) {
    cout << 14;
  }
  else if ( K == 24 ) {
    cout << 15;
  }
  else {
    cout << 51;
  }
}



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

int main() {
  int N,res;
  cin>>N;
  vector<int> c(N); 
  for(int i=0;i<N;i++){
    cin>> c.at(i);
  }
  res=0;
  int i,j;
  i=0;
  while(1){
    if(c.at(i)==-1){
      res=-1;
      break;}
    else{
      j=i;
      i=c.at(i)-1;
      res++;
      if(i==1){break;}
      c.at(j)=-1;}
  }
      cout<<res<<endl;  
}

Measured memory_bytes: 640
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    s = [int(c) for c in S()]
    t = [0] * 2019
    r = 0
    for c in s:
        u = [0] * 2019
        u[c] = 1
        for i in range(2019):
            u[(i*10+c) % 2019] += t[i]
        t = u
        r += t[0]

    return r

print(main())





Measured memory_bytes: 93436
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define db double
using namespace std;
const int N=3005;
int n,t[N];
db x,y,z,l,h;
int main(){
	cin>>n>>l;
	fo(i,1,n)cin>>t[i];
	h=l;
	l=acos(-1)/l;
	fo(i,1,n)fo(j,i+1,n)
		x+=cos(l*(t[i]+t[j]))*(i-1+n-j)+cos(l*(t[i]+t[j]+h))*(j-i-1),
		y+=sin(l*(t[i]+t[j]))*(i-1+n-j)+sin(l*(t[i]+t[j]+h))*(j-i-1);
	z=(db)n*(n-1)*(n-2)/6;
	printf("%.10lf %.10lf\n",x/z,y/z);
}

Measured memory_bytes: 512
D = int(input())
C = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(D)]

tL = []
for i in range(D):
    tL.append(S[i].index(max(S[i])) + 1)

for t in tL:
    print(t)

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

int main() {
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	
	int a = x2 - x1;
	int b = y2 - y1;
	cout << x2 - b << " ";
	cout << y2 + a << " ";
	cout << x1 - b << " ";
	cout << y1 + a << endl;
}


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();
        long ans = 0;
        for (int i=1;i<=n;i++){
            ans+=((n/i)*(long)(n/i+1)*i)/2;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35848
#include<cstdio>
#include<vector>
using namespace std;
main()
{
    int n,k;
    while(~scanf("%d%d",&n,&k))
    {
        int ma=(n-1)*(n-2)/2;
        if(ma<k)puts("-1");
        else
        {
            vector<pair<int,int> >res;
            for(int i=1;i<=n-1;i++)res.emplace_back(pair<int,int>(i,n));

            int rem=ma-k;
            int ci=1,cj=2;
            for(int _=0;_<rem;_++)
            {
                res.emplace_back(pair<int,int>(ci,cj));

                ++cj;
                if(cj==n)
                {
                    ci++;
                    cj=ci+1;
                }
            }
            printf("%d\n",(int)res.size());
            for(auto p:res)printf("%d %d\n",p.first,p.second);
        }
        
    }
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a < b && b < c)
	{
		printf("Yes\n");

	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 1972
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

//		long ans2 = 0;
//		long ans = 0;

		Scanner sc = new Scanner(System.in);


//		int n = sc.nextInt();

//		String string = sc.next();
//		StringBuilder s = new StringBuilder(string);

//		boolean f = true;
//
//		int[] a = new int[n];
//		int[] b = new int[n];
//		int[] aa = new int[n];
//		int[] bb = new int[n];
//		for (int i = 0; i < n; i++) {
//			a[i] = sc.nextInt();
//		}
//		for (int i = 0; i < n; i++) {
//			b[i] = sc.nextInt();
//			bb[i] = b[i];
//		}

		int x = sc.nextInt();
		int y = sc.nextInt();
		int ans  = 0;
		if(x == 1) {
			ans += 300000;
		} else if(x == 2){
			ans += 200000;
		}else if(x == 3) {
			ans += 100000;
		}
		if(y == 1) {
			ans += 300000;
		} else if(y == 2){
			ans += 200000;
		}else if(y == 3) {
			ans += 100000;
		}
		if(y == 1 && x == 1) {
			ans += 400000;
		}


		System.out.println(ans);

		sc.close();
	}
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int W[105];
    int sum[105];
    sum[0] = 0;
    for(int i = 1; i <= N; i++) {
        cin >> W[i];
        sum[i] = sum[i-1] + W[i];
    }
    int ans = 1e9;
    for(int i = 1; i < N; i++) {
        chmin(ans, abs(sum[i] - (sum[N] - sum[i])));
    }
    cout << ans << endl;
    return 0;
}


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

const int N = 1e6 + 5;

#define st first
#define nd second
#define make(a,b) make_pair(a,b)

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

int main() {
	int n;
	scanf("%d", &n);
	int a4 = 0, a2 = 0;
	for (int i = 0; i < n; i ++) {
		int a;
		scanf("%d", &a);
		if (a % 4 == 0) a4 ++;
		else if (a % 2 == 0) a2 ++;
	}
	if (a4 * 2 + 1 >= n || 2 * a4 + a2 >= n) {
		printf("Yes\n");
	} else printf("No\n");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    //--<for debugging>
    #define whatis(x) cout << #x << " is " << x<<" ";
    #define whatisl(x) cout << #x << " is " << x<<"\n";
    #define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
    #define lline cout<<"\n";
    #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
     
    void err(istream_iterator<string> it) {}
    template<typename T, typename... Args>
    void err(istream_iterator<string> it, T a, Args... args) {
    	cout << *it << " = " << a <<" , ";
    	err(++it, args...);
    }
    //--</for debugging> 
    #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
    #define testcase ll tt; cin >> tt; while(tt--)
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
    #define pb push_back 
    #define vars ll h,i,j,k,d,l,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
    #define vll vector<ll>
    #define pll pair<ll,ll>
    #define sll set<ll>
    #define pint pair<int,int>
    const ll INF=1e9+7;
    const ll MOD=1e9+7;
    int main()
    {
        boost vars 
        cin>>x>>y>>z;
        cout<<z<<" "<<x<<" "<<y;
    }

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
s = set()
for i in a:
    if i==1:
        continue
    ns = set()
    for j in range(2, 10**3):
        if i%j!=0:
            continue
        while i%j==0:
            i//=j
        ns.add(j)
        if i==1:
            break
    else:
        ns.add(i)
    if len(ns&s)>0:
        break
    s |= ns
else:
    print('pairwise coprime')
    exit(0)

def gcd_base(a, b):
    while b!=0:
        a, b = b, a%b
    return a

def gcd(num_list):
    ans = 0
    for i in num_list:
        ans = gcd_base(ans, i)
    return ans

if gcd(a)==1:
    print('setwise coprime')
else:
    print('not coprime')

Measured memory_bytes: 197296
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    bool dp[150]={};
    dp[0]=true;
    int N;
    cin >> N;
    rep(i,N+1) if(dp[i]==true) dp[i+4]=true,dp[i+7]=true;
    if(dp[N]) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
a-=1
if a%2==0:
	x=((a//2)%2)^a
else:
	x=(a+1)//2%2
if b%2==0:
	y=((b//2)%2)^b
else:
	y=(b+1)//2%2
print(x^y)


Measured memory_bytes: 3060
import math
def divisor(n):
    a = set()
    for i in range(1, math.ceil(n**0.5) + 1):
        if n % i == 0:
            a.add(i)
            a.add(n // i)
    return a

n = int(input())

ans = 0
for i in range(1, n+1, 2):
    if len(divisor(i)) == 8:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
double mn,mx;
struct num{int A,B;}a[1000009];
bool cmp1(const num&a,const num&b){return a.A<b.A;}
bool cmp2(const num&a,const num&b){return a.B<b.B;}
int main(){
	int n; scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i].A,&a[i].B);
	sort(a+1,a+n+1,cmp1); mn=(a[(n+1)/2].A+a[(n+2)/2].A)/2.;
	sort(a+1,a+n+1,cmp2); mx=(a[(n+1)/2].B+a[(n+2)/2].B)/2.;
	if(n&1) printf("%d",(int)(mx-mn+1));
	else printf("%d",(int)(2*(mx-mn+0.5)));
	return 0;
} 

Measured memory_bytes: 5320
#include <iostream>
#include <cmath>

using namespace std;

class B {
	int N, ans;
	double A, T, H;
public:
	void solve()
	{
		cin >> N >> T >> A;

		double minDiff{ 999999 };
		double tmpDiff;

		for (int i{ 1 }; i <= N; i++)
		{
			cin >> H;
			tmpDiff = abs((A - (T - 0.006 * H)));
			if (tmpDiff < minDiff)
			{
				ans = i;
				minDiff = tmpDiff;
			}

		}

		cout << ans << endl;
	}
};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
	int X;
	cin >> X;
   
	int i = 400;
	while (true)
	{
		if (i <= X && i + 200 > X) {
			cout << 10 - (i / 200);
			return 0;
		}
		i += 200;
	}

	return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <cstdlib>

using namespace std;



int main() {
  int n;
  scanf("%d", &n);
  long a[200000];
  for(int i=0; i<n; ++i) {
    scanf("%ld", &(a[i]));
  }

  unordered_map<long, long> part_sums;
  part_sums[0] = 1;
  long sum = 0;
  long count = 0;
  for(int i=0; i<n; ++i) {
    sum += a[i];
    auto it = part_sums.find(sum);
    if(it == part_sums.end()) {
      part_sums[sum] = 1;
    } else {
      count += (*it).second;
      ((*it).second)++;
    }
  }
  printf("%ld\n", count);
}


Measured memory_bytes: 10056
#include <iostream>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
using namespace std;
typedef long long ll;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
VI findAll(string S,string pattern){VI P;ll pos=(ll)S.find(pattern);
while(pos!=string::npos){P.push_back(pos);pos=(ll)S.find(pattern,pos+1);}return P;}
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
bool is_prime(ll n){if(n<2)return 0;for(int i=2;i*i<n;i++)if(n%i==0)return 0;return 1;}
inline void eratosthenes(VB& p){rep(i,SZ(p))p[i]=1;p[0]=p[1]=0;
rep(i,SZ(p)/2+1){if(p[i])for(ll j=i+i;j<SZ(p);j+=i)p[j]=0;}}
inline ll mod_add(ll a,ll b){return (a+b)%MOD;}
inline ll mod_sub(ll a,ll b){return (a+MOD-b)%MOD;}
inline ll mod_mul(ll a,ll b){return ((a%MOD)*(b%MOD))%MOD;}
inline ll mod_pow(ll x,ll n,ll mod=(ll)MOD){ll res=1;while(n>0){
if(n&1)res=res*x%mod;x=x*x%mod;n>>=1;}return res;}
inline ll mod_inv(ll x){return mod_pow(x,MOD-2);}
inline ll mod_div(ll a, ll b){return mod_mul(a,mod_inv(b));}
using Graph=vector<vector<int> >;//int と P

int main(){
    string s;cin>>s;
    ll sum=0;
    rep(i,s.length()){
        if(i%2==0 && s[i]=='p')sum-=1;
        if(i%2==1 && s[i]=='g')sum+=1;
    }
    cout<<sum<<endl;

}

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

struct info{
    int digit;
    int last;
    int num;
};

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    vector<int> B = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    for(int i = 0; i < M; i++) cin >> A[i];
    sort(A.rbegin(), A.rend());

    const int INF = 1e9;
    vector<int> dp(N+1, -INF);
    vector<pair<int,int>> dp_back(N+1, {-INF, -1});
    dp[0] = 0;
    dp_back[0] = {-1, -1};
    for(int i = 0; i <= N; i++){
        for(int j = 0; j < M; j++){
            int k = i - B[ A[j] ];
            if(k < 0) continue;
            if(dp[k] == -INF) continue;
            
            if(dp[i] < dp[k] + 1){
                dp[i] = dp[k] + 1;
                dp_back[i] = {k, A[j]};
            } 
        }
    }

    pair<int,int> p = dp_back[N];
    string ans = "";
    while(p.first != -1){
        ans += (p.second + '0');
        p = dp_back[p.first];
    }

    sort(ans.rbegin(), ans.rend());

    cout << ans << endl;
}

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

const int maxn=2e5+10;
int n,q,a[maxn],dp[maxn];
int st[maxn<<2];
vector<int> g[maxn];

inline int read(){
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	x=c-48;
	while((c=getchar())>='0'&&c<='9')x=x*10+c-48;
	return x;
}
inline void chkmin(int&a,int b){
	if(a>b)a=b;
}
inline int min_(int a,int b){
	return a<=b?a:b;
}
inline void push_up(int rt){
	st[rt]=min_(st[rt<<1],st[rt<<1|1]);
}
void build(int rt,int l,int r){
	if(l==r){
		st[rt]=dp[l]-a[l];
		return;
	}
	int mid=l+r>>1;
	build(rt<<1,l,mid);
	build(rt<<1|1,mid+1,r);
	push_up(rt);
}
void modify(int rt,int l,int r,int pos){
	if(l==r){
		st[rt]=dp[pos]-a[pos];
		return;
	}
	int mid=l+r>>1;
	if(pos<=mid)
		modify(rt<<1,l,mid,pos);
	else
		modify(rt<<1|1,mid+1,r,pos);
	push_up(rt);
}
int query(int rt,int l,int r,int x,int y){
	if(l==x&&r==y)
		return st[rt];
	int mid=l+r>>1;
	if(y<=mid)
		return query(rt<<1,l,mid,x,y);
	else if(x>mid)
		return query(rt<<1|1,mid+1,r,x,y);
	else
		return min_(query(rt<<1,l,mid,x,mid),query(rt<<1|1,mid+1,r,mid+1,y));
}

int main(){
	n=read();
	for(int i=1;i<=n;++i)
		a[i]=a[i-1]+(read()^1);
	q=read();
	for(int i=1,l,r;i<=q;++i){
		l=read();r=read();
		g[l-1].push_back(r);
	}
	for(int i=1;i<=n;++i)
		dp[i]=2e9;
	build(1,0,n);
	for(int i=0;i<n;++i){
		for(int j=0;j<g[i].size();++j){
			chkmin(dp[g[i][j]],query(1,0,n,i,g[i][j]-1)+a[g[i][j]]);
			modify(1,0,n,g[i][j]);
		}
		chkmin(dp[i+1],dp[i]+(a[i+1]-a[i]^1));
		modify(1,0,n,i+1);
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 13696
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
// #define mod 1000000007
// #define mod 163577857 
#define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    int fact[500010], factinv[500010] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,500010)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

void solve();
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    // cin >> t; 
    while(t--)
        solve();
} 

void solve()            
{
    int n , m;
    string s;
    cin >> n >> m;
    cout << n*m << endl;   
}

Measured memory_bytes: 3620
#define _USE_MATH_DEFINES

#include <iostream>	//cin, cout
#include <vector>	//vector
#include <algorithm> //sort,min,max,count
#include <string>	//string,getline, to_string
#include <ios>		//fixed
#include <iomanip>	//setprecision
#include <utility> //swap, pair
#include <cstdlib>	//abs(int)
#include <cmath>	//sqrt,ceil,M_PI, pow, sin
#include <sstream>	//stringstream,getline
#include <numeric>	//gcd, accumlate
#include <deque>	//deque
#include <random>	//randam_device

using namespace std;
constexpr long long int D_MOD = 1000000007;

int main() {

	int A, B, T;
	cin >> A >> B >> T;

	int temp = T / A;
	cout << B * temp << endl;

	return 0;

}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>

using namespace std;

#define Getsign(n) ((n > 0) - (n < 0))

typedef vector<int> Ivec;
typedef pair<int, int> pii;
const pii eight_Dir[4] = { //?????????
	{ 0 ,1 },
	{ -1 ,0 },{ 1 ,0 },
	{ 0 ,-1 }
};
//pii operator+ (pii a, pii b){return { a.first + b.first, a.second + b.second };}
//pii operator- (pii a, pii b) { return { a.first - b.first, a.second - b.second }; }
//pii operator* (pii a, pii b) { return{ a.first * b.first, a.second * b.second }; }
//pii operator/ (pii a, pii b) { return{ a.first / b.first, a.second / b.second }; }
//pii operator% (pii a, pii b) { return{ a.first % b.first, a.second % b.second }; }

int main() {
	int w, h;

	while (scanf("%d %d", &w, &h)) {
		if (w == 0)
			return 0;

		array<array<bool, 22>, 22> map = {}, al = {};
		queue<pii> que;
		for (int i = 1; h >= i; i++) {
			scanf("%*c");
			for (int j = 1; w >= j; j++) {
				char a;
				scanf("%c", &a);

				if (a == '@') {
					que.push({j,i});
					al[j][i] = true;
					map[j][i] = true;
				}
				else if (a == '.') {
					map[j][i] = true;
				}
			}
		}
		int cou = 0;
		while (!que.empty()) {
			pii pos = que.front();
			que.pop();
			cou++;
			for (int i = 0; 4 > i; i++) {
				if (!al[pos.first + eight_Dir[i].first][pos.second + eight_Dir[i].second] && map[pos.first + eight_Dir[i].first][pos.second + eight_Dir[i].second]) {
					al[pos.first + eight_Dir[i].first][pos.second + eight_Dir[i].second] = true;
					que.push({ pos.first + eight_Dir[i].first,pos.second + eight_Dir[i].second});
				}
			}

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

	return 0;
}

Measured memory_bytes: 3268
#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>;

const int INF = 1001001001;

int main() {
    //入力
    int d, g;
    cin >> d >> g;
    vector<int> p(11);
    vector<int> c(11);
    rep(i, d) {
        cin >> p[i] >> c[i];
    }

    //bit全探索
    int ans = INF; //求める答え 最小値を比較していくので初期値はINF
    for (int bit = 0; bit < (1 << d); bit++) {
        int sum = 0; //現在の得点
        int num = 0; //解けた点数
        rep(i, d) {
            if (bit & (1<<i)) { // bit に i 番目のフラグが立っているか
                //i番目のフラグが立っていれば、その難易度の問題を全部解いた事にする
                sum += c[i] + p[i] * 100 * (i+1);
                num += p[i];
            }
        }
        // 自分の得点が g 点以上の場合、問題数が最小値か更新する
        if (sum >= g) {
            ans = min(ans, num);
        // 得点が得点が g 点より小さい場合、得点が高い問題から解く
        } else {
            for (int i = d-1; i >=0; i--) {
                if (bit & (1<<i)) continue; //i番目は上記で解いているので飛ばす
                rep(j, p[i]) {
                    if (sum >= g) break;// 自分の得点が g 点以上の場合z
                    sum += 100 * (i + 1);
                    num++;
                }
            }
            ans = min(ans, num);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
/*
_____________________$$o____________________o$$$$$o__
___________________o$o_$$o____oo$$$$$$$oo______o$$$$o
______________$o________o$$$$$o___oo$$$$$$$o______$$$
______________$$$ooo________o$$$$o______o$$$$$o_____o
____________oo_____oo_____oo___o$$$$$______$$$$$$____
_________ooooo___$$o_$___oooooo___o$$$$o__o__o$$$$___
_______ooo__ooo$$$$o_$$ooooooooooo__o$$$o__oo_oo$$$o_
______oo_o$$o_$$_o$o_o$o__oooooooooo__o$$$o_oo__o$$$o
____oooooo$$$$o___oo__$$o_ooo_oooooooo__o$$o_ooo_o$$$
___ooooooo__o___oooo__$$ooooo$_oooooooo__o$$__ooo_$$$
_$$o_ooooo___o$$$$$o__o$o__o_$o__oooooooo_o$$o_oo__$$
_$$$o_ooo_________o$$_$$o____$$o_ooooooooo_$$$o_oo_$$
__oo________o$$o____o_$$o____o$ooooooooooo_o$$o_oo_o$
___o$$$$$$$$$$$$$o___$$$o____$$o_oooooooooo_$$$o_o_o$
________o__oo$$$$$o__$$$o____$$o____oooooo__$$$o_o_o$
_________$$$$$$$$$o__$$_____$$$o___________$$$oooooo_
__________o$$$$$$$o_________$$___________o$o___oooooo
___________o$$$$o_______________ooooo__oo$__ooo__oooo
________________________________ooo_$$oo___oooo$o____
________________________________oooo_$$$$$o___oo$$$o_
________________________________ooooo_o$$$$$o_____$$$
________________________________oooooo_o$$$$$$ooo___o
________________________________ooooooo__o$$$$$o_____
*/
#include<bits/stdc++.h>
#define ll long long
#define ft first
#define sd second
#define HageBaIO_KPOCCbI int LOL;scanf("%d", &LOL);for(int i = 0; i < LOL; i++)
#define Terrorist ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
//BY |3 |<
const int dx[] = {1, 0, -1,  0};
const int dy[] = {0, 1,  0, -1};
//Where I am?
const ll N = 2e5 + 5;
const ll NN = 1e3 + 3;
const ll MOD = (1e9 + 7);
const ll MOD1 = 998244353;
const double PI = 3.14159265;
const int INF32 = 2e9;
const ll INF64 = 2e18;
//Don`t believe!!!//
ll m, n, arr[N], mx, sum;
void KEK(){
	cin>>m>>n;
	arr[0] = 0;
	arr[n + 1] = m;
	for(int i = 1; i <= n; i++){
		cin>>arr[i];
	}
	sort(arr, arr + n);
	for(int i = 1; i <= n + 1; i++){
		sum += arr[i] - arr[i - 1];
		if(i > 1 && i <= n)mx = max(mx, arr[i] - arr[i - 1]);
	}
	mx = max(mx, arr[1] + m - arr[n]);
	cout<<sum - mx;
}
int main(){
	Terrorist
	//HageBaIO_KPOCCbI
	KEK();
	return 0;
}
//TAUMAC, 9| BbIWEJI 3A TObOU!!!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 1792
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val cards = readLine()!!.split(' ')

    val bubbleSorted = bubbleSort(cards)
    val selectionSorted = selectionSort(cards)

    println(bubbleSorted.joinToString(" "))
    println("Stable")
    println(selectionSorted.joinToString(" "))

    (0 until n).all {
        bubbleSorted[it] == selectionSorted[it]
    }.run {
        println(if (this) "Stable" else "Not stable")
    }
}

private fun bubbleSort(cards: List<String>): List<String> {
    val n = cards.size
    val xs = cards.toMutableList()

    for (i in 0 until n) {
        for (j in n - 1 downTo i + 1) {
            val v1 = xs[j][1].toInt()
            val v2 = xs[j - 1][1].toInt()
            if (v1 < v2) {
                val t = xs[j]
                xs[j] = xs[j - 1]
                xs[j- 1] = t
            }
        }
    }

    return xs
}

private fun selectionSort(cards: List<String>): List<String> {
    val n = cards.size
    val xs = cards.toMutableList()

    for (i in 0 until n) {
        var mini = i
        for (j in i until n) {
            val v1 = xs[j][1].toInt()
            val v2 = xs[mini][1].toInt()
            if (v1 < v2) {
                mini = j
            }
        }
        if (mini > i) {
            val t = xs[i]
            xs[i] = xs[mini]
            xs[mini] = t
        }
    }

    return xs
}


Measured memory_bytes: 32628
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
9
0 1 4
1 2 3
2 -1 -1
3 -1 -1
4 5 8
5 6 7
6 -1 -1
7 -1 -1
8 -1 -1

output:
Preorder
 0 1 2 3 4 5 6 7 8
Inorder
 2 1 3 0 6 5 7 4 8
Postorder
 2 3 1 6 7 5 8 4 0
"""

import sys


class Node(object):
    def __init__(self):
        # init node as a single leaf node.
        self.parent = -1
        self.children = []
        self.index = -1


def pre_parse(v):
    print(' ' + str(v.index), end='')
    if not v.children:
        return None
    left_child_idx = v.children[0]
    right_child_idx = v.children[1]

    if left_child_idx != -1:
        pre_parse(node_list[left_child_idx])

    if right_child_idx != -1:
        pre_parse(node_list[right_child_idx])

    return None


def in_parse(v):
    if not v.children:
        return None
    left_child_idx = v.children[0]
    right_child_idx = v.children[1]

    if left_child_idx != -1:
        in_parse(node_list[left_child_idx])

    print(' ' + str(v.index), end='')

    if right_child_idx != -1:
        in_parse(node_list[right_child_idx])

    return None


def post_parse(v):
    if not v.children:
        return None
    left_child_idx = v.children[0]
    right_child_idx = v.children[1]

    if left_child_idx != -1:
        post_parse(node_list[left_child_idx])

    if right_child_idx != -1:
        post_parse(node_list[right_child_idx])

    print(' ' + str(v.index), end='')

    return None


def generate_tree(_array):
    # add info of each node of a ordered tree
    for each in _array:
        idx, *children = [int(x) for x in each]
        # assert len(children) == 2 and idx >= 0
        node_list[idx].index = idx
        node_list[idx].children = children

        for child_idx in children:
            # non-existent node: no parent
            if child_idx == -1:
                continue
            node_list[child_idx].parent = idx

    # find root node
    root_idx = [x.index for x in node_list if x.parent == -1][0]

    # tree walk in 3 ways
    print('Preorder')
    pre_parse(node_list[root_idx])
    print('\n' + 'Inorder')
    in_parse(node_list[root_idx])
    print('\n' + 'Postorder')
    post_parse(node_list[root_idx])
    print('')

    return node_list


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    array_length = int(_input[0])
    array = list(map(lambda x: x.split(), _input[1:]))
    # assert len(array) == array_length

    node_list = [Node() for _ in range(array_length)]
    ans = generate_tree(_array=array)

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define INF INT_MAX/3

int main(){
  cin.sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  char ss[s.size()], tt[t.size()];
  s.copy(ss, s.size());
  t.copy(tt, t.size());
  sort(ss, ss + s.size());
  sort(tt, tt + t.size()); reverse(tt, tt + t.size());
  string sss(ss, s.size()), ttt(tt, t.size());
  if (sss < ttt) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define debug(var) do{cout << #var << " : "; print(var); } while(0)
using namespace std;
typedef long long ll;
void print() { cout << endl; }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); }
template <class T> void print(vector<T> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec); } }
const int INF = 1e9;
const int MOD = 1e9+7;

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

	const vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

	int k; cin >> k;
	k--;
	cout << vec[k] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
vector<ll> dp(2001,-1);
ll val(ll i){
    if(dp[i]!=-1)
    return dp[i];
    
    if(i<3) 
    return 0;
    
    ll ans=1;
    for(int j=3;j<=i;j++)
    ans=(ans+val(i-j))%mod;
    
    return dp[i]=ans%mod;
}

int main() {
    fastio
	ll n,t,i,j,x,k;
    cin>>n;
    
    dp[3]=1;
    cout<<val(n);
    
	return 0;
}

Measured memory_bytes: 3696
from sys import stdin


def get_result(data):
    K = data[0][0]
    A, B = data[1]
    if A % K == 0 or B % K == 0:
        return 'OK'
    else:
        if (A // K) == (B // K):
            return 'NG'
        else:
            return 'OK'


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)


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

int main() {
  int N;
  int ans = 0;  
  int temp = 0;
  
  cin >> N;

  vector<int> score(N);
  
  for(int i=0;i<N;i++)
  {
    cin >> score[i];
  }
  
  for(int i=0;i<N;i++)
  {
    for(int j = N-1;j>i;j--)
    {
      if(score[j] < score[j-1])
      {
        temp = score[j];
        score[j] = score[j-1];
        score[j-1] = temp;
      }     
    }
  } 
  
    for(int i= N-1;i>=0;i--)
    {
      if (score[i] != score[i-1])
      {
        ans++;
      }
    }
  cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

int main(int argc, char** argv) {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, X, T;
	cin >> N >> X >> T;
	cout << (N + X - 1) / X * T << '\n';
	return 0;
}


Measured memory_bytes: 3540
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=(b);i>=(a);i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX


int main(void){
	int m;
	scanf("%d",&m);
	rep(i,m){
		vector<int> ans[105];
		vector<mp> sta;
		int n=0;
		sta.push_back(mp(10000,-1));
		while(1){
			/*
			rep(i,sta.size()){
				printf("(%d %d)\n",sta[i].sec+1,sta[i].fir);
			}
			printf("\n");*/
			int a;
			scanf("%d",&a);
			if(a==0)break;
			
			while(sta.back().fir==0)sta.pop_back();
			sta.back().fir--;
			if(a>0){
				int no = n;
				int to = sta.back().sec;
				if(to!=-1){
					ans[to].push_back(no);
					ans[no].push_back(to);
				}
				else a++;
				sta.push_back(mp(a-1,no));
				n++;
			}
			else{
				int no = sta.back().sec;
				int to = sta[sta.size()-1 + a].sec;
				sta[sta.size()-1+a].fir--;
				ans[to].push_back(no);
				ans[no].push_back(to);
			}
		}
		
		rep(i,n){
			sort(ans[i].begin(),ans[i].end());
			printf("%d ",i+1);
			rep(j,ans[i].size()){
				printf("%d%c",ans[i][j]+1,j+1==ans[i].size()?'\n':' ');
			}
		}
	}
		
	return 0;
}

Measured memory_bytes: 1072
from collections import deque

s = input()
n = int(input())
d = deque()
#initial 
for ele in s:
  d.append(ele)
#print(d)

rev = 1

for i in range(n):
  cs = input().split()
  #print( cs )
  if( cs[0] == '1' ) :
    rev *= -1
  else:
    cf = cs[1]
    cfs = cs[2]
    if rev == 1 :
      if cf == '1' :
        #s =  cfs + s 
        d.appendleft(cfs)
      else:
        #s =  s + cfs
        d.append( cfs )
    else: #rev == -1 :
      if cf == '1' :
        #s =  s + cfs
        d.append( cfs )
      else:
        #s =  cfs + s 
        d.appendleft(cfs)

      
if rev == 1 :
 print( ''.join(list(d)) )
else:
 res = ''.join(list(reversed( d )))
 print (res)
  
  

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

#define all(x) begin(x), end(x)
#define cina(s, n, a) for(int quer = s; quer < n; quer++) cin >> a[quer]
#define mod(a, b) (abs(b) + (a % abs(b))) % abs(b)
#define setp(x) fixed << setprecision(x)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll MOD = 1e9 + 7;
const int N = 200500; // are you sure?
void solve(){
    double l;
    cin >> l;
    cout << setp(16) << pow(l / 3, 3);
}

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for (int i = 1; i <= q; i++) {
        solve();
    }
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    if(n%k==0){
      System.out.println(0);
    }else{
      System.out.println(1);
    }
    
  }
  

  
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 20
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P; 
#define INF 100000000
const int MAX = 1000000;
const int MOD = 1000000007;

int main(){
    int k,x;
    cin>>k>>x;
    if(k*500>=x) OUT("Yes");
    else OUT("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;

signed _main(){
  int K,N; cin >> K >> N;
  int ans=INF;
  v<int> A(2*N);
  rep(i,N){
    cin >> A[i];
    A[N+i]=K+A[i];
  }
  rep(i,N){
    //int tmp=min(,K-(A[N-1+i]-A[i]));
    chmin(ans,A[N-1+i]-A[i]);
  }
  cout << ans << endl;
}


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

int n,m[101][101];
int d[101],f[101],t=0,vis[101];

void dfs(int u){
    if(vis[u]) return;
    vis[u] = 1;
    d[u] = ++t;
    for( int i = 1; i <= n; i++ ){
        if( vis[i]==0 && m[u][i] ){
            dfs(i);
        }
    }
    f[u] = ++t;
}

int main(){
    int i,j,k,u,v,du;
    scanf("%d",&n);
    k = n;
    while(k--){
        scanf("%d",&u);
        scanf("%d",&du);
        while(du--){
            scanf("%d",&v);
            m[u][v]  = 1;
        }
    }
    for( i = 1; i <= n; i++ ){
        dfs(i);
        cout << i << " " << d[i] << " " << f[i] << endl;
    }
}



Measured memory_bytes: 3236
import java.util.Scanner;

public class Main {
    static int n;
    static int k;
    static int[] a;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        k = sc.nextInt();
        a = new int[k];
        for (int i = 0; i < k; i++) {
            a[i] = sc.nextInt();
        }
        System.out.println(dfs(n));
    }
    static int dfs(int i) {
        String str = String.valueOf(i);
        boolean bl = true;
        for (int j = 0; j < k; j++) {
            if (str.contains(String.valueOf(a[j]))) {
                bl = false;
                break;
            }
        }
        if (bl) {
            return i;
        } else {
            return dfs(i+1);
        }
    }
}

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

#define v short
const char nl = '\n';
#define loop(i, n) for (v i = 1; i <= n; i++)

v rasch (v &x, v &y, v &z) {
    v res = x * x + y * y + z * z;
    res += x * y + x * z + y * z;
    return res; 
}
int main () {
    ios_base::sync_with_stdio(false);

    v n;
    cin >> n;
    multiset <v> s;
    for (v x = 1; x * (x - 2) <= n - 3; x++) {
        for (v y = 1; y * (y - 2) <= n - 3; y++) {
            for (v z = 1; z * (z - 2) <= n - 3; z++) {
                v res = rasch(x, y, z);
                s.insert (res);
            }
        }
    }
    loop (i, n) {
        v tmp = s.count (i);
        cout << tmp << nl;
    }
    return 0;
}

Measured memory_bytes: 50484