akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main(){
  vector<int> vec(3); cin>>vec[0]>>vec[1]>>vec[2];
  int ans;
  ans = *max_element(vec.begin(),vec.end()) - *min_element(vec.begin(),vec.end());
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 256
N, M, K = map(int, input().split())
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    F[a].append(b)
    F[b].append(a)

for _ in range(K):
    c, d = map(int, input().split())
    c, d = c - 1, d - 1
    B[c].append(d)
    B[d].append(c)


D = {}
parent = [-1] * N
visited = [False] * N
for root in range(N):
    if visited[root]:
        continue

    D[root] = set([root])
    stack = [root]
    while stack:
        n = stack.pop()
        visited[n] = True
        parent[n] = root

        for to in F[n]:
            if visited[to]:
                continue
            D[root].add(to)
            stack.append(to)

ans = [0] * N
for iam in range(N):
    group = D[parent[iam]]
    tmp_ans = len(group) - len(F[iam]) - 1
    for block in B[iam]:
        if block in group:
            tmp_ans -= 1
    ans[iam] = tmp_ans

print(*ans, sep=' ')

Measured memory_bytes: 125580
fun main(args: Array<String>) {
	val n = readLine()!!.toInt()
	val s = readLine()!!

	var cnt = 0
	var ans = 0

	for (i in 0 until n) {
		cnt += int(s[i] == 'I')
		cnt -= int(s[i] == 'D')
		ans = Math.max(ans, cnt)
	}
	println(ans)
}

fun int(ok: Boolean): Int {
	if (ok) {
		return 1
	}
	return 0
}


Measured memory_bytes: 31780
s = input()
K = int(input())
N = len(s)
dp = [[[0 for _ in range(2)] for _ in range(4)] for _ in range(105)]
dp[0][0][0] = 1
for i in range(N):
    for j in range(4):
        for k in range(2):
            nd = ord(s[i]) - ord('0')
            for d in range(10):
                ni, nj, nk = i + 1, j, k
                if d != 0:
                    nj += 1
                if nj > K:
                    continue
                if k == 0:
                    if d > nd:
                        continue
                    if d < nd:
                        nk = 1
                dp[ni][nj][nk] += dp[i][j][k]
ans = dp[N][K][0] + dp[N][K][1]
print(ans)


Measured memory_bytes: 3188
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
int n;
vector<int> dp, h;
int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    h.assign(n, 0);
    dp.assign(n, 0);
    F0R(i, n) cin >> h[i];
    FOR(i, 1, n)
    {
        dp[i] = dp[i - 1] + abs(h[i - 1] - h[i]);
        if(i > 1) dp[i] = min(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]));
    }
    cout << dp[n - 1];
    return 0;
}

Measured memory_bytes: 1024
// --------------
// Tejas Pandey  |
// 14 - 06 - 20  |
// Atcoder BC 170|
// --------------

#include <bits/stdc++.h>
using namespace std;
     
#define mod 1000000007
#define maxn 1000007
#define vi vector<int>
typedef long long int ll;

int cnt[maxn],good[maxn];
     
int main (void){
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int a[n];
  for(int i = 0;i < n;i++) cin >> a[i],cnt[a[i]]++;
  ll tot = 0;
  for(int i = 1;i < maxn;i++){
	  if(!good[i] && cnt[i] == 1) tot += cnt[i];
	  if(cnt[i]){
		for(int j = i + i;j < maxn;j+=i)
			good[j] = 1;
		}
	}
	cout << tot << "\n";	
}


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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int UF_MAX = 401*401;

class UF{
	int x[UF_MAX];
	int co;
	
public:
	
	UF(){
		fill(x,x+UF_MAX,-1);
		co = 0;
	}
	
	int boss(int a){
		int s = a;
		while(x[s] > -1) s = x[s];
		if(s != a) x[a] = s;
		return s;
	}
	
	void uni(int a , int b){
		int s = boss(a);
		int t = boss(b);
		if(s != t){
			++co;
			if(x[s] < x[t]){
				x[s] += x[t];
				x[t] = s;
			} else {
				x[t] += x[s];
				x[s] = t;
			}
		}
	}
	
	bool find(int a , int b){
		return boss(a) == boss(b);
	}
	
	int count(){
		return co;
	}
	
	int member(int a){
		return -x[boss(a)];
	}
} uf;


int main(){
	int H,W; cin >> H >> W;
	vector<string> S(H);
	repp(i,0,H) cin >> S[i];
	repp(i,0,H) repp(j,1,W) if(S[i][j-1] != S[i][j]) uf.uni(i*W+j-1,i*W+j);
	repp(i,1,H) repp(j,0,W) if(S[i-1][j] != S[i][j]) uf.uni((i-1)*W+j,i*W+j);
	vector<LL> c(H*W,0);
	repp(i,0,H) repp(j,0,W) if(S[i][j] == '#') ++c[uf.boss(i*W+j)];
	LL ans = 0;
	repp(i,0,H) repp(j,0,W) if(i*W+j == uf.boss(i*W+j)) ans += c[i*W+j]*(uf.member(i*W+j)-c[i*W+j]);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 2304
N,M=map(int,input().split())
a = [int(input()) for _ in range(M)]
dp = [0]*(N+1)
j = 0
dp[0] = 1
mod = 10**9+7
for i in range(1, N+1):
    if j < M and i == a[j]:
        j += 1
    elif i == 1:
        dp[i] = 1
    else:
        dp[i] = (dp[i-1]+dp[i-2]) % mod
print(dp[N])

Measured memory_bytes: 7848
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

def main():
    n,k = readInt()
    poss = set()
    for i in range(k):
        d = int(input())
        a = readInt()
        for x in a:
            poss.add(x)
    ans = 0
    for i in range(1,n+1):
        if i not in poss:
            ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 9224
#include <string>
#include <map>
#include <vector>
#include <iostream>
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long a, b;
    cin >> a >> b;
    long long ans;
    if (a % 2 == 0) {
        if ((b - a) % 4 == 0)
            ans = b;
        if ((b - a) % 4 == 1)
            ans = 1;
        if ((b - a) % 4 == 2)
            ans = b + 1;
        if ((b - a) % 4 == 3) 
            ans = 0;
        
    } else {
        ans = a;
        if ((b - a - 1) % 4 == 0)
            ans ^= b;
        if ((b - a - 1) % 4 == 1)
            ans ^= 1;
        if ((b - a - 1) % 4 == 2)
            ans ^= b + 1;
        if ((b - a - 1) % 4 == 3) 
            ans = ans;
    }

    cout << ans;
}   


Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
using namespace std;
#define REP(i,b,e) for(int i=(int)b;i<(int)e;i++)
#define rep0(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
typedef long long ll;
ll longinf=1ll<<60;

string s;
int n;
string ans;
int main(){
    cin>>s>>n;
    rep0(i,s.size()){
        if(i%n==0){
            ans+=s[i];
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

int dp[1001];

int main(){
	int m, a, b, g, n;
	while(scanf("%d", &m), m){
		dp[0] = 1;
		for(int i = 1; i <= 1000; ++i){
			dp[i] = 0;
		}

		for(int i = 0; i < m; ++i){
			scanf("%d%d", &a, &b);
			for(int j = 1000; j >= a; --j){
				for(int k = 1; k <= b && j - k * a >= 0; ++k){
					dp[j] += dp[j - k * a];
				}
			}
		}

		scanf("%d", &g);
		for(int i = 0; i < g; ++i){
			scanf("%d", &n);
			printf("%d\n", dp[n]);
		}
	}
}

Measured memory_bytes: 1032
#include <stdio.h>

int main(void) {

	int P;
	int Q;
    int R;

	scanf("%d", &P);
	scanf("%d", &Q);     
    scanf("%d", &R);
  
    int num1 = P + Q;
    int num2 = P + R;
    int num3 = Q + R;
  
    if(num1 <= num2 && num1 <= num3){
      printf("%d",num1);
    }
    else if(num2 <= num1 && num2 <= num3){
      printf("%d",num2);
    }
    else if(num3 <= num1 && num3 <= num2){
      printf("%d",num3);
    }

      
  
	return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <map>
using namespace std;
int main(){
	int x,y;
	int tx,ty,kx,ky;
	int Tx,Ty,Kx,Ky;
	int Px[4]={0,1,0,-1},Py[4]={1,0,-1,0};
	int Qx[4]={0,-1,0,1},Qy[4]={-1,0,1,0};
	int date[55][55];
	int beta;
	while(cin>>x>>y,x){
		cin>>tx>>ty>>kx>>ky;
		for(int i=1;i<=y;i++)for(int j=1;j<=x;j++)cin>>date[j][i];
		for(int i=1;i<=x;i++)date[i][0]=date[i][y+1]=1;
		for(int i=1;i<=y;i++)date[0][i]=date[x+1][i]=1;
		queue<int>name;
		map<int ,int>time;
		name.push(tx*1000000+ty*10000+kx*100+ky);
		time[tx*1000000+ty*10000+kx*100+ky]=0;
		beta=tx*1000000+ty*10000+kx*100+ky;
		int flag=1;
		while(name.empty()==0){
			if(name.front()/10000==name.front()%10000&&time[name.front()]<100){
				cout<<time[name.front()]<<endl;
				flag=0;
				break;
			}
			else if(time[name.front()]<100){
				tx=name.front()/1000000%100;
				ty=name.front()/10000%100;
				kx=name.front()/100%100;
				ky=name.front()/1%100;
				
				for(int i=0;i<4;i++){
					Tx=tx+Px[i];
					Ty=ty+Py[i];
					Kx=kx+Qx[i];
					Ky=ky+Qy[i];
					if(date[Tx][Ty]){
						Tx=tx;
						Ty=ty;
					}
					if(date[Kx][Ky]){
						Kx=kx;
						Ky=ky;
					}
					if(time[Tx*1000000+Ty*10000+Kx*100+Ky]==0&&beta!=Tx*1000000+Ty*10000+Kx*100+Ky){
						time[Tx*1000000+Ty*10000+Kx*100+Ky]=time[name.front()]+1;
						name.push(Tx*1000000+Ty*10000+Kx*100+Ky);
					}
				}
			}
			name.pop();
		}
		if(flag)cout<<"NA"<<endl;
	}
	return 0;
}


Measured memory_bytes: 9544
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=3e5+9;
ll arr[maxn];
int main(){
    ll a,b,c,d,e,f,g,h;
    while(cin>>a){
        for(int i=0;i<a*3;i++){
            cin>>arr[i];
        }
        sort(arr,arr+a*3);
        g=0;
        e=0;f=3*a-1;
        while(a--){
            e++;
            f--;
            g+=arr[f--];
        }
        cout<<g<<endl;
    }
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>

//関数の宣言
//bool input(int mid, int fin, int re);
void func(int mid, int fin, int re, char& result);


int main(){

	int mid = 0;
	int fin = 0;
	int re = 0;
	char result = 'x';

	while (true){

		std::cin >> mid >> fin >> re;

		if (mid == -1 && fin == -1 && re == -1){
			break;
		}

		func(mid, fin, re, result);

		std::cout << result << std::endl;

	}
	return 0;
}

//関数の定義
//bool input(int mid, int fin, int re){
//	if (mid == -1 && fin == -1 && re == -1){
//		return false;
//	}
//	else{
//		return true;
//	}
//}

void func(int mid, int fin, int re, char& result){
	if (mid == -1 || fin == -1){
		result = 'F';
	}
	else if (80 <= mid + fin){
		result = 'A';
	}
	else if (65 <= mid + fin&&mid + fin < 80){
		result = 'B';
	}
	else if (50 <= mid + fin&&mid + fin < 65){
		result = 'C';
	}
	else if (30 <= mid + fin&&mid + fin < 50){
		if (50 <= re){
			result = 'C';
		}
		else{
			result = 'D';
		}
	}
	else{
		result = 'F';
	}
}


Measured memory_bytes: 3064
import java.util.Scanner;
import java.util.Stack;
 
public class Main {
    static int cnt;

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

        Stack<Integer> g = new Stack<>();
        int gi = 1;
        if(n == 1) g.push(1);
        while(gi < n) {
            g.push(gi);
            gi = gi * 3 + 1;
        }
        System.out.println(g.size());
    
        cnt = 0;
        StringBuilder sb = new StringBuilder();
        while(true) {
            gi = g.pop();
            sb.append(gi);
            insertionSort(a, n, gi);
            if(g.isEmpty()) break;
            sb.append(" ");
        }
        System.out.println(sb);
        System.out.println(cnt);

        for(int ai : a) {
            System.out.println(ai);
        }

        sc.close();
    }

    private static void insertionSort(int[] a, int n, int gi) {
        for(int i = gi; i < n; i++) {
            int v = a[i];
            int j = i - gi;
            while(j >= 0 && a[j] > v) {
                a[j + gi] = a[j];
                j -= gi;
                cnt++;
            }
            a[j + gi] = v;
        }
    }
}


Measured memory_bytes: 300096
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define int long long
#define P pair<long,long>
#define all(a) a.begin(),a.end()
using namespace std;
signed main(){
    int a,b; cin>>a>>b;
    if(a*b<=0)cout<<"Zero"<<endl;
    else if(b<0){
        cout<<((b-a+1)%2==0?"Positive":"Negative")<<endl;
    }else{
        cout<<"Positive"<<endl;
    }
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n = int(input())
    while True:
        if len(set(str(n))) == 1:
            break
        n += 1
    print(n)
if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

//各桁の和を求める.
int keta(int );





int main(){

    int N,A,B;
    int sum=0;
    int final_ans=0;
    vector<int> sumans;

    cin >> N >> A >> B;

    for(int i=1 ;i<=N;i++){
        sum = keta(i);
        if(A <= sum && sum <= B)sumans.push_back(i);
    }

   // for(int i=0;i<sumans.size();i++){
     //   cout << sumans[i] << " ";
    //}
    
    for(int i=0;i<sumans.size();i++){
        final_ans += sumans[i];
    }

    cout << final_ans ;

    return 0;
}


int keta(int x){
    int y;
    int sum=0;

    while(1){
        if(x == 0) break;
        y = x%10;
        sum +=y;
        x = x/10;
        
    }
    return sum;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long lt;
typedef double dd;
#define eps 1e-6
#define sqr(x) ((x)*(x))
 
int read()
{
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}
 
const int maxn=1000010;
int n;
struct point{dd x,y;}p[maxn],O;
dd R;
 
dd getd(point a,point b){ return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
point getO(point p1,point p2,point p3)
{
    point res;
    dd a=p2.x-p1.x,b=p2.y-p1.y,c=p3.x-p2.x,d=p3.y-p2.y;
    dd e=sqr(p2.x)+sqr(p2.y)-sqr(p1.x)-sqr(p1.y);
    dd f=sqr(p3.x)+sqr(p3.y)-sqr(p2.x)-sqr(p2.y);
    res.x=(f*b-e*d)/(c*b-a*d)/2.0; 
    res.y=(a*f-e*c)/(a*d-b*c)/2.0;
    return res;
}
 
void mincir()
{
    O=p[1]; R=0;
    for(int i=1;i<=n;++i)
    if(getd(p[i],O)-R>eps)
    {
        O=p[i]; R=0;
        for(int j=1;j<i;j++)
        if(getd(p[j],O)-R>eps)
        {
            O=(point){(p[i].x+p[j].x)/2.0,(p[i].y+p[j].y)/2.0};
            R=getd(p[i],p[j])/2.0;
    
            for(int k=1;k<j;++k)
            if(getd(p[k],O)-R>eps)
            {
                O=getO(p[i],p[j],p[k]);
                R=getd(p[i],O);
            }
        }
    }
} 
 
int main()
{
    n=read();
    for(int i=1;i<=n;++i)
    scanf("%lf%lf",&p[i].x,&p[i].y);
    
    random_shuffle(p+1,p+1+n);
    
    mincir();
    printf("%.7lf",R);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int x,y,M[50][50],D[50][50],i,j,r;
main(){
        for(;;){
                scanf("%d%d",&x,&y);
                if(x==0)exit(0);
                for(i=0;i<289;i++) {M[i%17][i/17]=1;D[i%17][i/17]=0;}
                for(i=0;i<y;i++)
                        for(j=0;j<x;j++)
                                scanf("%d",&M[j+1][i]);
                for(j=1;j<=x;j++){if(M[j][y-1]!=1)D[j][y-1]=1;D[j][y]=1;}
                for(j=y-2;j>=0;j--){
                        for(i=1;i<=x;i++){
                                if(M[i][j]==0) {
                                        D[i][j]=D[i][j+1];
                                        if(M[i+1][j+1]!=2) D[i][j]+=D[i+1][j+1];
                                        if(M[i-1][j+1]!=2) D[i][j]+=D[i-1][j+1];
                                }
                                if(M[i][j]==2) D[i][j]=D[i][j+2];
                        }
                }
                r=0;
                for(i=1;i<=x;i++){
                        r+=D[i][0];
                }
                printf("%d\n",r);
        }
}

Measured memory_bytes: 0
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

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

    void run() {

        char[] arr = sc.next().toCharArray();

        int cnt1 = 0;
        int cnt0 = 0;

        for (int i=0; i<arr.length; i++) {
            if (arr[i]=='1') cnt1++;
            if (arr[i]=='0') cnt0++;
        }

        int ans = arr.length;

        int diff = Math.abs(cnt0-cnt1);

        System.out.println(ans-diff);
    }

}


Measured memory_bytes: 25684
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
int keta(ll n) {
	int i = 0;
	while (n > 0) {
		n /= 10;
		i++;
	}
	return i;
}
int F(ll x, ll y) {
	return max(keta(x), keta(y));
}
int main() {
	ll N;
	cin >> N;
	ll n = sqrt(N);
	int res = F(1, N);
	for (int i = 2;i <= n;i++) {
		int temp;
		if (N%i == 0) {
			temp = F(i, N / i);
			if (res > temp) res = temp;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int S[100000];

int main(void) {

    int n;
    cin >> n;

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

    int q, total = 0;
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int t;
        cin >> t;
        int left = 0, right = n - 1, mid = 0;
        while (left <= right) {     // '<' ?????¨?????¨??§?????????
            mid = (left + right) / 2;
            if (t == S[mid]) {
                ++total;
                break;
            }
            if (t > S[mid]) {
                left = mid + 1;
            }
            else {
                right = mid - 1;
            }
        }
    }

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

    return 0;
}

Measured memory_bytes: 1532
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int main() {
    int n;
    cin >> n;
    for (int i = 0; i * 4 <= n; i++) {
        if ((n - 4 * i) % 7 == 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
const int maxn=1e5+5;
int n,n1,n2;
vector<int> bfs(vector<vector<int> > &v,int x)
{
	vector<int> d(n+5,maxn);
	d[x]=0;
	queue<int>q;
	q.push(x);
	while(q.size())
	{
		int t=q.front();
		q.pop();
		for(int i=0;i<v[t].size();i++)
		{
			int a=v[t][i];
			if(d[a]>d[t]+1)
			{
				d[a]=d[t]+1;
				q.push(a);
			}
		}
	}
	return d;
}
int main()
{
	cin>>n;
	vector<vector<int> >v(n+5);
	for(int i=1;i<n;i++)
	{
		int x,y;
		cin>>x>>y;
	    v[x].push_back(y);
		v[y].push_back(x);
	}
	vector<int> v1=bfs(v,1),v2=bfs(v,n);
	for(int i=1;i<=n;i++)
	if(v1[i]<=v2[i])n1++;
	else n2++;
	if(n1>n2)
	puts("Fennec");
	else puts("Snuke");
	return 0;
}

Measured memory_bytes: 6528
var lines = [];
var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var N = Number(lines[0].split(" ")[0])
    var M = Number(lines[0].split(" ")[1])

    console.log(Math.pow(2, M) * (1900 * M + 100 * (N - M)))
});

Measured memory_bytes: 11596
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;

#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
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<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}



signed main(){
	//IOS();
	vector<int>ans;
	while(1){
		int n,l,r;
		cin>>n>>l>>r;
		if(n+l+r==0)break;
		vector<int>a(n);
		REP(i,n)cin>>a[i];
		int cnt = 0;
		rep(i,l,r+1){
			int isuruu = -1;
			rep(j,0,n){
				if(i%a[j])continue;
				if(j%2==0)isuruu = 1;
				else isuruu = 0;
				break;
			}
			if(isuruu==-1){
				if(n%2)isuruu = 0;
				else isuruu = 1;
			}
			if(isuruu)cnt++;
		}
		ans.push_back(cnt);
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}


Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int N,M,Q;
  cin>>N>>M>>Q;
  VS S(N);
  rep(i,N) cin>>S[i];
  VI X(Q),Y(Q),Z(Q),W(Q);
  rep(i,Q) cin>>X[i]>>Y[i]>>Z[i]>>W[i];
  VVI A(N+1,VI(M+1));
  rep(i,N) rep(j,M) if(i and S[i][j]=='1' and S[i-1][j]=='1') A[i][j+1]++;
  rep(i,N+1) rep(j,M+1){
    if(i) A[i][j]+=A[i-1][j];
    if(j) A[i][j]+=A[i][j-1];
    if(i and j) A[i][j]-=A[i-1][j-1];
  }
  VVI A2(N+1,VI(M+1));
  rep(i,N) rep(j,M) if(j and S[i][j]=='1' and S[i][j-1]=='1') A2[i+1][j]++;
  rep(i,N+1) rep(j,M+1){
    if(i) A2[i][j]+=A2[i-1][j];
    if(j) A2[i][j]+=A2[i][j-1];
    if(i and j) A2[i][j]-=A2[i-1][j-1];
  }
  VVI B(N+1,VI(M+1));
  rep(i,N) rep(j,M) if(S[i][j]=='1') B[i+1][j+1]++;
  rep(i,N+1) rep(j,M+1){
    if(i) B[i][j]+=B[i-1][j];
    if(j) B[i][j]+=B[i][j-1];
    if(i and j) B[i][j]-=B[i-1][j-1];
  }
  rep(i,Q){
    int C=A[Z[i]-1][W[i]]-A[X[i]-1][W[i]]-A[Z[i]-1][Y[i]-1]+A[X[i]-1][Y[i]-1];
    int C2=A2[Z[i]][W[i]-1]-A2[X[i]-1][W[i]-1]-A2[Z[i]][Y[i]-1]+A2[X[i]-1][Y[i]-1];
    int D=B[Z[i]][W[i]]-B[X[i]-1][W[i]]-B[Z[i]][Y[i]-1]+B[X[i]-1][Y[i]-1];
    cout<<D-C-C2<<endl;
  }
}


Measured memory_bytes: 57344
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
sm_l = [0]
#sm_r = [0]
for i in range(n):
	sm_l.append(sm_l[-1] + p[i])
	#sm_r.append(sm_r[-1] + p[-i-1])
ans = 0
for i in range(n-k+1):
	ans = max(ans,sm_l[i+k]-sm_l[i])
print(ans)


Measured memory_bytes: 23524
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Deque<Integer>[] A = new Deque[N];
		for(int i = 0; i < N; i++) {
			A[i] = new ArrayDeque<>();
			for(int j = 0; j < N-1; j++) {
				A[i].push(sc.nextInt()-1);
			}
		}
		int[] depth = new int[N];
		Deque<Integer> d = new ArrayDeque<>();
		int[] w = new int[N];
		Arrays.fill(w, -1);
		for(int i = 0; i < N; i++)
			d.push(i);
		while(d.size() > 0) {
			int x = d.poll();
			Deque<Integer> m = A[x];
			if(m.size() == 0)
				continue;
			int y = m.pop();
			if(w[y] == x) {
				depth[x] = depth[y] = Math.max(depth[x], depth[y])+1;
				d.push(x);
				d.push(y);
			}
			else
				w[x] = y;
		}
		for(int i = 0; i < N; i++) {
			if(A[i].size() != 0) {
				System.out.println(-1);
				return;
			}
		}
		System.out.println(Arrays.stream(depth).max().getAsInt());

	}

}


Measured memory_bytes: 241872
#include<cstdio>
#include<cstring>
#include<algorithm>
const int mod=1e9+7,maxn=(1<<16)+5;
typedef long long ll;
using namespace std; 
inline int read(){
	int x=0,f=1;char c=getchar();
	for(;c<'0'||c>'9';f=c=='-'?-1:1,c=getchar());
	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0',c=getchar());
	return x*f;
}
bool cmp(int a,int b){return a>b;}
int n,m,a[20];
ll fac[maxn],f[2][maxn],p[maxn];
ll qpow(ll x,int y){ll res=1;while(y){if(y&1)res=res*x%mod;x=x*x%mod;y>>=1;}return res;}
ll C(int x,int y){return x<y?0:fac[x]*p[y]%mod*p[x-y]%mod;}
int cnt(int x){int res=0;while(x)res+=x&1,x>>=1;return res&1;}
int main(){
	n=read();m=read();
	for(int i=1;i<=m;i++)a[i]=read();
	sort(a+1,a+1+m,cmp);fac[0]=1;
	for(int i=1;i<(1<<n);i++)fac[i]=(fac[i-1]*1ll*i)%mod;
	p[(1<<n)-1]=qpow(fac[(1<<n)-1],mod-2);
	for(int i=(1<<n)-1;i;i--)p[i-1]=(p[i]*1ll*i)%mod;
	int pos=0;f[0][0]=1;
	for(int i=1;i<=m;i++){
		pos^=1;
		for(int j=0;j<(1<<n);j++){
			if(!f[pos^1][j])continue;
			f[pos][j]=(f[pos][j]+f[pos^1][j])%mod;
			int Cj=(1<<n)-1-j;
			for(int k=0;k<n;k++)
				if(!(j&(1<<k))){
					f[pos][j|(1<<k)]+=C(Cj-a[i]+1,(1<<k)-1)*f[pos^1][j]%mod*fac[1<<k]%mod;
					f[pos][j|(1<<k)]%=mod;
				}
		}
		memset(f[pos^1],0,sizeof(f[pos^1]));
	}
	ll ans=0;
	for(int i=0;i<(1<<n);i++){
		if(!f[pos][i])continue;
		f[pos][i]=f[pos][i]*fac[(1<<n)-i-1]%mod;
		ans=(ans+f[pos][i]*(cnt(i)?-1:1))%mod;
	}
    ans<<=n;ans%=mod;
	printf("%lld\n",(ans+mod)%mod);
    return 0;
}

Measured memory_bytes: 2304
import math

n = int(input())

total1 = 0
for i in range(1, n + 1):
    for j in range(i+1, n + 1):
        for k in range(j+1, n + 1):
            total1 += math.gcd(i, math.gcd(j, k))
total1 = 6*total1

total2 = 0
for i in range(1, n + 1):
    for j in range(i+1, n + 1):
        total2 += math.gcd(i, j)
total2 = 6*total2

total3 = 0
for i in range(1, n + 1):
    total3 += i

print(total1 + total2 + total3)

Measured memory_bytes: 9216
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::cmp;

#[allow(dead_code)]
fn getline() -> Vec<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s.split(' ').map(|x| x.trim().to_string()).collect::<Vec<String>>()
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>(s: &String) -> T {
    s.parse().ok().unwrap()
}

fn main() {
    let o = getline();
    let o: Vec<char> = o[0].chars().collect();
    let e = getline();
    let e: Vec<char> = e[0].chars().collect();
    for i in 0..e.len() {
        print!("{}{}", o[i], e[i]);
    }
    if e.len() < o.len() {
        print!("{}", o.last().unwrap());
    }
    println!("");
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {
		public static void main(String[] args) {
		
	   Scanner sc = new Scanner(System.in);
	   
	   int r = sc.nextInt();
	   
	   int s = 1 * 1 * 3;
	   int S = r * r * 3;
	   
	   int ans = S / s;
	   
	   System.out.println(ans);
		}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
using namespace std;
typedef long long int ll;


int main() {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  if (w >= v) {
    cout << "NO" << endl;
    return 0;
  }
  ll dis = max(a-b, b-a);
  ll sp = v-w;
  ll tt = (dis + sp - 1) / sp;
  if (tt > t) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, m;
  cin >> n >> m;
  vi p(m), y(m);
  rep(i, m) cin >> p[i] >> y[i], p[i]--;
  vector<vi> pres(n);
  rep(i, m) pres[p[i]].push_back(y[i]);
  rep(i, n) sort(all(pres[i]));
  rep(i, m) {
    int cid = lower_bound(all(pres[p[i]]), y[i]) - pres[p[i]].begin();
    printf("%06d%06d\n", p[i] + 1, cid + 1);
  }
}

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

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

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
int main(){
  long K,M=9;
  cin >> K;
  long long ans[(K>9)?K:9]={1,2,3,4,5,6,7,8,9};
  long long *adr=ans;
  while(M<K){
    for(int i=-1;i<=1;i++){
      if(*adr%10+i>9||*adr%10+i<0)
        continue;
      ans[M++]=*adr*10+*adr%10+i;
    }
    adr++;
  }
  cout << ans[K-1] << endl;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

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

	static void solve() {
		int p = in.nextInt();
		int q = in.nextInt();
		p = q / gcd(p, q);
		long ans = 1;
		for (int i=2; i*i<=p; i++) {
			if (p%i == 0) {
				ans *= i;
				while (p%i == 0) p /= i;
			}
		}
		if (p != 1) ans *= p;
		out.println(ans);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		solve();
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

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

int main() {
  string S, T;
  cin >> S >> T;
  int num = 0;
  for (int i = 0; i < 3; i++) {
    if (S.at(i) == T.at(i)) {
      num++;
    }
  }
  cout << num << endl;
}

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

int main(){

	int S , h , m , s;
	cin >> S;
	h = S / 3600;
	m =( S - h * 3600 ) / 60;
	s = S - h * 3600 - m * 60;

	cout << h << ":" << m << ":" << s << endl;
	return 0;
}



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

using namespace std;

#define int long long
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fr(i,j,k) for(i = j; i < (k); i++)
#define all(x) x.begin(), x.end()
#define el '\n'
#define remax(a,b) a = max(a, b)
#define remin(a,b) a = min(a, b)
#define sz(x) int32_t(x.size())

typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpi;
// --------------------------------------------------------------------

const pii dxy[] = { {-1, 0}, {1, 0}, {0, 1}, {0, -1} };
const int mod = 1e9 + 7;
const int inf = 2e18;
const ld eps = 1e-9;
const int NN = 2e5 + 2;

vvi g(NN);


void solve() {
	int i = 0, j = 0, k = 0, n = 0, m = 0;
	vi d(4);
	fr(i, 0, 4) cin >> d[i];
	i = 1;
	while(d[0] > 0 and d[2] > 0) {
		if(i & 1) d[2] -= d[1];
		else d[0] -= d[3];
		i++;
	}

	if(d[0] > 0) cout << "Yes";
	else cout << "No";
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int T = 1;
	// cin >> T;
	for(int tc = 1; tc <= T; tc++) {
		solve();
	}

	return 0;
}

Measured memory_bytes: 7768
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;


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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve(){
	int h,w,k;
	cin>>h>>w>>k;
	vector<string>s(h);
	rep(i,h)cin>>s[i];
	vector<vector<int>>ans(h,vector<int>(w));
	int cnt=0;
	rep(i,h){
		int r=0;
		int val=cnt+1;
		if(val>k)break;
		while(r<w){
			if(s[i][r]=='#'){
				ans[i][r]=++cnt;
				++r;
				while(r<w&&s[i][r]!='#'){
					ans[i][r]=cnt;
					++r;
				}
			}
			else{
				++r;
			}
		}
		if(val==cnt+1)continue;
		rep(j,w){
			if(ans[i][j]==0){
				ans[i][j]=val;
			}
		}
	}
	rep(i,h){
		if(ans[i][0]==0){
			REP(j,i+1,h){
				if(ans[j][0]!=0){
					rep(x,w){
						ans[i][x]=ans[j][x];
					}
					break;
				}
			}
			if(ans[i][0]==0){
				for(int j=i-1;j>=0;--j){
					if(ans[j][0]!=0){
						rep(x,w){
							ans[i][x]=ans[j][x];
						}
						break;
					}
				}
			}
		}
	}
	rep(i,h){
		rep(j,w){
			if(j)cout<<" ";
			cout<<ans[i][j];
		}
		cout<<"\n";
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


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

using namespace std;

using ll = long long;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    ll m = n - 1;
    ll ans = 0;
    for (int mask = 0; mask < (1 << m); mask++) {
        ll sum = 0;
        int idx = 0;
        string chunk;
        chunk += s[0];
        for (int i = m - 1; i >= 0; i--) {
            if ((mask & (1LL << i)) != 0) {
                idx++;
                ll x = atoll(chunk.c_str());
                sum += x;
                chunk = s[idx];
            } else {
                idx++;
                chunk += s[idx];
            }
        }
        if (!chunk.empty()) {
            ans += atoll(chunk.c_str());
        }
        ans += sum;
    }
    cout << ans;
    return 0;
}


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

#define ran 202202

int n;
char s[ran];
int sum[ran];

int main() {
	scanf("%d%s", &n, s);
	
	sum[0] = 0;
	for(int i=0;i<n;i++)
		sum[i+1] = sum[i] + (s[i]=='#');
	
	int ans = n;
	for(int i=0;i<=n;i++)
		ans = min(ans, sum[i] + (n-i)-(sum[n]-sum[i]));
	printf("%d\n", ans);
	
	return 0;
}

Measured memory_bytes: 1152
N, M = map(int, input().split())
edge = [set() for _ in range(N + 1)]
for _ in range(M):
    l, r, d = map(int, input().split())
    edge[l].add((r, d))
    edge[r].add((l, -d))

loc = {}
for i in range(1, N + 1):
    stack = []
    if i not in loc:
        loc[i] = 0
        stack.append(i)
    while stack:
        s = stack.pop()
        for t, d in edge[s]:
            if t not in loc:
                loc[t] = loc[s] + d
                stack.append(t)
            elif loc[t] != loc[s] + d:
                print('No')
                exit()

# 同じ座標に２人いることもある
print('Yes')

Measured memory_bytes: 92324
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int sum = 0;
    int mn = inf;
    for(int i=0; i<3; i++){
        int a;
        cin >> a;
        chmin(mn,a);
    }
    sum += mn;
    mn = inf;
    for(int i=0; i<2; i++){
        int a;
        cin >> a;
        chmin(mn,a);
    }
    sum += mn;
    cout << sum - 50 << enld;
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        string input = Console.ReadLine();
        long n = long.Parse(input);
        long[] capacity = new long[5];
        input = Console.ReadLine();
        capacity[0] = long.Parse(input);
        input = Console.ReadLine();
        capacity[1] = long.Parse(input);
        input = Console.ReadLine();
        capacity[2] = long.Parse(input);
        input = Console.ReadLine();
        capacity[3] = long.Parse(input);
        input = Console.ReadLine();
        capacity[4] = long.Parse(input);
        Array.Sort(capacity);
        if (n <= capacity[0]) { Console.WriteLine("5"); }
        else { if (n % capacity[0] != 0) { Console.WriteLine(5 + ((n-n % capacity[0]) / capacity[0])); }
        else { Console.WriteLine(4 + (n / capacity[0])); }
        }
    }
}


Measured memory_bytes: 13268
# -*- coding: utf-8 -*-
"""
Microwave
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0630

"""
import sys


def solve(a, b, c, d, e):
    ans = 0
    while a < b:
        if a < 0:
            a += 1
            ans += c
        elif a == 0:
            a += 1
            ans += (d + e)
        else:
            a += 1
            ans += e
    return ans


def main(args):
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    ans = solve(a, b, c, d, e)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])



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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

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

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001LL;
//constexpr double INF = 1e10;
constexpr double EPS = 1e-10;
using number = long long;

int main() {
    ll n; cin >> n;
    ll ans = 1 + n;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) ans = i + (n / i);
    }
    cout << ans - 2 << endl;
}


Measured memory_bytes: 256
import Data.List
import Control.Monad

dist2 :: [Integer] -> [Integer] -> Integer
dist2 x y = foldl (+) 0 (zipWith (\a b -> (a-b)^2) x y)

dist :: [Integer] -> [Integer] -> Integer
dist x y = floor $ sqrt . fromIntegral $ dist2 x y

count :: [[Integer]] -> Int
count [] = 0
count (x:xs) = countStep x xs + count xs
    where countStep x [] = 0
          countStep x (y:ys) = (if (dist x y)^2 == dist2 x y then 1 else 0) + countStep x ys

main = do
  n:d:_ <- map read . words <$> getLine :: IO [Int]
  xs <- replicateM n (map read . words <$> getLine) :: IO [[Integer]]
  putStrLn . show $ count xs


Measured memory_bytes: 1020
package main

import "fmt"

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	for i := 0; i < len(s); i++ {
		if s == t {
			fmt.Println("Yes")
			return
		}
		s = s[1:] + s[:1]
	}
	fmt.Println("No")
}


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

const int n_day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
struct Date {
  // year, month[1,12], day(1 origin), a day of the week[0,6]
  int y, m, d, e;
  Date() {}
  Date(int y, int m, int d, int e = -1) : y(y), m(m), d(d), e(e) {}
 
  bool operator < (const Date &o) const {
    if(y != o.y) return y < o.y;
    if(m != o.m) return m < o.m;
    return d < o.d;
  }
 
  bool isLeapYear() {
    if(y % 400 == 0) return true;
    if(y % 100 == 0) return false;
    if(y % 4 == 0) return true;
    return false;
  }

  int getDays() {
    int nd = n_day[m];
    if(m == 2) nd += isLeapYear();
    return nd;
  }

  void next() {
    e = (e+1)%7;
    if(d == getDays()) {
      d = 1;
      if(m == 12) {
        m = 1;
        ++y;
      } else {
        ++m;
      }
    } else {
      ++d;
    }
  }
 
  void back() {
    e = (e+6)%7;
    if(d == 1) {
      if(m == 1) {
        m = 12;
        --y;
      } else {
        --m;
      }
      d = getDays();
    } else {
      --d;
    }
  }
};

// AOJ 0125
int main() {
  int y1, m1, d1, y2, m2, d2;
  while(cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2) {
    if(y1 < 0 || m1 < 0 || d1 < 0 || y2 < 0 || m2 < 0 || d2 < 0)
      break;
    Date d(y1,m1,d1), end(y2,m2,d2);
    int res = 0;
    while(d < end) {
      ++res;
      d.next();
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

int main(){
    string s;
    cin >> s;
    string ans;
    int n = s.size();
    for(int i=0;i<n;i=i+2){
        ans += s[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner s = new Scanner(System.in);
        
        String S = s.next();
        int a = Integer.parseInt(S.substring(0,2));
        int b = Integer.parseInt(S.substring(2,4));
        
        boolean a1 = (a > 12 || a == 0) ? false : true;
        boolean b1 = (b > 12 || b == 0) ? false : true;
        
        String res = a1 ? (b1 ? "AMBIGUOUS" : "MMYY") : (b1 ? "YYMM" : "NA");
        
        System.out.println(res);

    }
}


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

using namespace std;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}

int MAXN = 100001;
bitset<100002> isPrime;

int psa[100002];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

    int q;
    cin >> q;

    isPrime[1] = 1;

    for(int i = 2; i < MAXN; ++i){
        psa[i] = psa[i - 1];
        if(!isPrime[i]){
            if(!isPrime[(i + 1) >> 1])
                ++psa[i];
            for(int j = i + i; j < MAXN; j += i)
                isPrime[j] = 1;
        }
    }

    int left, right;

    while(q--){
        cin >> left >> right;
        cout << psa[right] - psa[left - 1] << "\n";
    }

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int gcd(int n, int m) {
    if (n < m) swap(n, m);
    while (m != 0) {
        int r = n % m;
        n = m;
        m = r;
    }
    return n;
}

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

    int n;
    cin >> n;

    int r = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        r = gcd(r, a);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){

  int N,L,sum,absmin = 10000,min,num;
  int i;

  scanf("%d",&N);
  scanf("%d",&L);

  sum = L*N+(N+1)*N/2-N;

  for(i = 1; i<=N; i++){
    num = L+i-1;
    if(abs(num) < absmin){
      absmin = abs(num);
      min = num;
    }
  }
  printf("%d\n",sum-min);
  return 0;
}


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

public class Main {

  public static void main(String[] args) {

    int n = 0;
    int k = 0;
    char[] s = null;
    
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      String[] nk = br.readLine().split("\\s");
      n = Integer.parseInt(nk[0]);
      k = Integer.parseInt(nk[1]);
      s = br.readLine().toCharArray();
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(1);
    }

    s[k-1] = Character.toLowerCase(s[k-1]);
    System.out.print(String.valueOf(s));
  }
}

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

int main(){
    int N;
    bool judge=false;
    cin>>N;
        for(int a=0;a<=N/4;++a){
            for(int b=0;b<=N/7;++b){
                    if(4*a+7*b==N){
                         judge=true;
                        break;
                    }

            }
        }
        if(judge==false){cout<<"No";
        }
            else{
                cout<<"Yes";
            }
}

Measured memory_bytes: 3136
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
//ll a[Max];
ll n;
void solve(){
	ll a,b,c;
	cin>>a>>b>>c;
	a-=b;
	cout<<max(0LL,c-a);
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 256