akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    int n; cin>>n;
    if(n<105){
        cout<<0<<endl;
    }else if(n<135){
        cout<<1<<endl;
    }else if(n<165){
        cout<<2<<endl;
    }else if(n<189){
        cout<<3<<endl;
    }else if(n<195){
        cout<<4<<endl;
    }else{
        cout<<5<<endl;
    }
    
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0 ; i < n ; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }
        double sum = 0;

        for (int i = 0 ; i < n ; i++) {
            for (int j = i ; j < n ; j++) {
                sum += Math.sqrt(Math.pow(x[i] - x[j], 2) + Math.pow(y[i] - y[j], 2));
            }
        }


        System.out.println((double) sum * 2 / n);
    }

}


Measured memory_bytes: 23124
A, B = map(int, input().split())
S = input()

for i in range(A):
    if 48 > ord(S[i]) or ord(S[i]) > 57:
        print('No')
        exit(0)
if S[A] != '-':
    print('No')
    exit(0)
for i in range(A + 1, len(S)):
    if 48 > ord(S[i]) or ord(S[i]) > 57:
        print('No')
        exit(0)
print('Yes')

Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int A[200000+100];
int B[200000+100];

int main()
{
    int n, ans;
    ans = 0;
    
    cin>>n;

    for(int i=1;i<=n;i++)
        cin>>A[i];
    for(int i=n;i>0;i--)
    {
        int sum = 0;
        for(int j=i*2;j<=n;j+=i)
            sum += B[j];
        if(sum%2 == A[i])
            continue;
        else
        {
            B[i] = 1;
            ans++;
        }
    }
    cout<<ans<<endl;
    for(int i=1;i<=n;i++)
        if(B[i] == 1)
            cout<<i<<" ";
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 999999999999 //10^13-1
#define P pair<int,int>
#define prique priority_queue
int n;
int t[200000],x[200000],y[200000];
bool ans=true;
signed main(){
	cin>>n;
	rep(i,n){
		cin>>t[i]>>x[i]>>y[i];
	}
	rep(i,n){
		if(i==0){
			if(x[i]+y[i]>t[i])ans=false;
		}
		else{
			if(abs(x[i]-x[i-1])+abs(y[i]-y[i-1])>t[i]-t[i-1])ans=false;
			if((abs(x[i]-x[i-1])+abs(y[i]-y[i-1])-(t[i]-t[i-1]))%2)ans=false;
		}
	}
	if(ans)puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 3584
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
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;}

int A,B,C;
inline void solve(){
  IN2(A,B);
  OUT(A%2==0||B%2==0?"No":"Yes");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())



int N, W;
int w[100], v[100];

long long dp[100001];


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


	cin >> N >> W;
	rep(i, N)cin >> w[i] >> v[i];

	memset(dp, -1, sizeof(dp));

	dp[0] = 0;
	rep(i,N) {
		for (int j = W - w[i]; j >= 0;j--) if(dp[j]!=-1){
			dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i]);
		}
	}

	cout << *max_element(dp, dp + W + 1) << endl;


	return 0;
}


Measured memory_bytes: 1024
<?php

// define('DEBUG', true);
define('DEBUG', false);

fscanf(STDIN, "%s", $s);

$c1 = substr($s, 0, 1);
$c2 = strval(strlen($s) - 2);
$c3 = substr($s, -1);

echo $c1, $c2, $c3, PHP_EOL;


Measured memory_bytes: 4604
#include<iostream>
#define int long long
using namespace std;
int bigmod(int b,int p,int m){
    if(p==0)return 1%m;
    int r=bigmod(b,p/2,m);
    if(p%2==1){
        return (((r*r)%m)*b)%m;
    }
    else{
        return (r*r)%m;
    }
}
signed main(){
    int n;
    cin >> n;
    int ans=(10000000070ll+bigmod(10,n,1000000007)-2*bigmod(9,n,1000000007)+bigmod(8,n,1000000007))%1000000007;
    cout << ans;
}

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

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second

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

    ll n;
    cin>>n;

    pair<ll,ll> p[n];

    for(ll i = 0 ; i < n ; i++)
    {
    	cin>>p[i].ss;
    	cin>>p[i].ff;
    }

    sort(p,p+n);

    ll pre = 0;

    for(ll i = 0 ; i < n ; i++)
    {
    	if(pre + p[i].ss > p[i].ff)
    	{
    		cout<<"No"<<endl;
    		return 0;
    	}
    	else
    	{
    		pre += p[i].ss;
    	}
    }

    cout<<"Yes"<<endl;

}

Measured memory_bytes: 3328
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    w = [ input() for i in range(n)]

    ok = True
    if len(set(w))!= n:
        ok = False
    for i in range(1,n):
        if w[i][0]!= w[i-1][-1]:
            ok =False
    
    if ok:
        print('Yes')
    else:
        print('No')

    

solve()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstdlib> //func147bでインクルード
 
using namespace std;
 
size_t length(const string& str) {
    return str.length();
}
void func147b()
{
 
    string s;
    int hug = 0;
    cin >> s;
    
    for (int i = 0; i < length(s)/2; ++i) {
        if (s[i] != s[length(s) - 1 - i]) hug++;
    }
    cout << hug << endl;
}
 
int main()
{
  func147b();
  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  double n;
  cin >> n;
  double t, a;
  cin >> t >> a;
  vector<int> h(n);
  rep(i, n) {
    double num;
    cin >> num;
    h.at(i) = num;
  }
  double min = 10000000;
  int min_num = 0;
  rep(i, n) {
    double temp = t - 0.006*h.at(i);
    if (abs(temp - a) < min) {
      min = abs(temp - a);
      min_num = i+1;
    }
  }
  cout << min_num << endl;
}


Measured memory_bytes: 3732
#include <stdio.h>
int main(void) {
    int i,n,m;
    scanf("%d %d",&n,&m);
    int a,b,min = 0,max = n;
    for(i=0; i < m; i++) {
        scanf("%d %d",&a,&b);
        if(min < a) min = a;
        if(max > b) max = b;
    }
    if(min <= max) {
        printf("%d\n",max-min+1);
    } else {
        printf("%d\n",0);
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,f;
ll cnt[5][4010],ans=0;
char s[4010],x;
int main()
{
	scanf("%d",&n);
	scanf("%s",s);
	for(int i=1;i<=n;++i) {
		for(int j=1;j<=3;++j) cnt[j][i]=cnt[j][i-1];
		if(s[i-1]=='R') cnt[1][i]+=ll(1);
		else if(s[i-1]=='G') cnt[2][i]+=ll(1);
		else cnt[3][i]+=ll(1);
	}
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j) 
			if(s[i-1]!=s[j-1]) {
				x='R'+'G'+'B'-s[i-1]-s[j-1];
				f=0;
				if(x=='R') f=1;
				else if(x=='G') f=2;
				else f=3;
				ll tmp=cnt[f][n]-cnt[f][j];
				if(j+(j-i)<=n&&s[j+(j-i)-1]==x) tmp-=ll(1);
				ans+=tmp;
//				printf("%d %d %lld ",i,j,tmp);
//				cout<<x<<endl;
	//			printf("%d %d %s %lld\n",i,j,x,tmp);
			}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3868
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c[55],v[55],b[55],sum=0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>v[i];
    }
    for(int i=0;i<n;i++)
    {
        cin>>c[i];
    }
    for(int i=0;i<n;i++)
    {
        b[i]=v[i]-c[i];
    }
    for(int i=0;i<n;i++)
    {
        if(b[i]>0)
        {
            sum+=b[i];
        }
    }
    cout<<sum;
    return 0;
}


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

int main() {
    string S;
    cin >> S;

    if (S.at(S.size() - 1) == 's') {
        S = S + "es";
    }
    else {
        S = S + "s";
    }

    cout << S << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
const int M=2e5;
using namespace std;
map<int,int>m;
int main()
{
   int n,mx=-1;
   cin>>n;
   for(int i=0;i<n;i++)
   {
   	int x;
   	cin>>x;
   	m[x-1]++;
   	m[x]++;
   	m[x+1]++;
   }
   for(auto& p:m)
   mx=max(mx,p.second);
   cout<<mx;
   return 0;
}

Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        int l = s.length();
        if (l % 2 == 0) {
            s = s.substring(0, s.length() - 2);
        } else {
            s = s.substring(0, s.length() - 1);
        }
        while (s.length() > 0) {
            int half = s.length() / 2;
            String str1 = s.substring(0, half);
            String str2 = s.substring(half, s.length());
            if (str1.equals(str2)) {
                System.out.println(str1.length() * 2);
                return ;
            }

            s = s.substring(0, s.length() - 2);
        }

        System.out.println(0);
    }

}

Measured memory_bytes: 21332
#include<stdio.h>

int main(void){

	int a,b;
	
	while(1){
		scanf("%d %d",&a,&b);
		
		if(a == 0 && b == 0){
			break;
		}
		else{
			if(a<b){
				printf("%d %d\n",a,b);
			}
			else if(a>b){
				printf("%d %d\n",b,a);
			}
			else{
				printf("%d %d\n",a,b);
			}
		}
	}
return 0;
}

Measured memory_bytes: 600
n, m = map(int, input().split())
ls, rs = [], []
for _ in range(m):
    l, r = map(int, input().split())
    ls.append(l)
    rs.append(r)
l_max = max(ls)
r_min = min(rs)
print(max(r_min - l_max + 1, 0))

Measured memory_bytes: 10996
#include<stdio.h>
#include<math.h>

int isprime(int);
int main() {
  int i, n, k, count = 0;
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%d", &k);
    if (isprime(k) == 1) count++;
  }
  printf("%d\n", count);
  return 0;
}

int isprime(int x) {
  if (x == 2) return 1;
  if (x < 2 || x % 2 == 0) return 0;

  int i = 3;
  while (i <= (int)sqrt((double)x)) {
	 if (x % i == 0) return 0;
	 i = i + 2;
    }
	 return 1;
	   }



Measured memory_bytes: 2064
#define pb push_back
#define vi vector<int>
#include<bits/stdc++.h>
using namespace std;
const int N = 300000;
int pro[300000], n;
string v1[N], v2[N], v3[N];
map<int, vector<char> > mp1, mp2, mp3;
void solve(){
	cin >> n;
	string rs1 = "Stable", rs2 = "Stable";
	for(int i = 0; i < n; i++){
		cin >> v1[i];
		v2[i] = v1[i];
		v3[i] = v2[i];
		mp3[v3[i][1] - '0'].pb(v3[i][0]);
	}
	//bubble
	for(int i = 0; i < n; i++){
		for(int j = n - 1; j >= i + 1; j--){
			if(v1[j][1] - '0' < v1[j - 1][1] - '0'){
				swap(v1[j], v1[j - 1]);
			}
		}
	}
	for(int i = 0; i < n; i++){
		if(i) cout << " ";
		cout << v1[i];
		int idx = v1[i][1] - '0';
		mp1[idx].pb(v1[i][0]);
	}
	for(int i = 1; i <= 9; i++){
		for(int j = 0; j < mp1[i].size(); j++){
			if(mp1[i][j] != mp3[i][j]){
				rs1 = "Not stable"; break;
			}
		}
	}
	cout << "\n" << rs1 << endl;
	
	for(int i = 0; i < n; i++){
		int mini = i;
		for(int j = i; j < n; j++){
			if(v2[j][1] - '0' < v2[mini][1] - '0'){
				mini = j;
			}
		}
		swap(v2[mini], v2[i]);
	}
	for(int i = 0; i < n; i++){
		if(i) cout << " ";
		cout << v2[i];
		int idx = v2[i][1] - '0';
		mp2[idx].pb(v2[i][0]);
	}
	for(int i = 1; i <= 9; i++){
		for(int j = 0; j < mp2[i].size(); j++){
			if(mp2[i][j] != mp3[i][j]){
				rs2 = "Not stable"; break;
			}
		}
	}
	cout << "\n" << rs2 << endl;
}
int main(void){
	solve();
	return 0;
}


Measured memory_bytes: 10244
#include<iostream>

using namespace std;

int main(){
	int n,q;
	long long s=0;
	cin>>n;

	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];

	cin>>q;

	int p[100005]={0};

	for(int i=0;i<n;i++){
		s+=a[i];
		p[a[i]]++;
	}
	for(int i=0;i<q;i++){
		int b,c;
		cin>>b>>c;

		s+=(c-b)*p[b];
		p[c]+=p[b];
		p[b]=0;

		cout<<s<<endl;
	}
	return 0;
}

	

Measured memory_bytes: 4352
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, m = [int(x) for x in input().split()]
    g = defaultdict(list)
    cnt = [1] * (n + 1)
    w = [0] * (n + 1)
    w[1] = 1
    for _ in range(m):
        a, b = [int(x) for x in input().split()]
        g[a].append(b)
        cnt[a] -= 1
        cnt[b] += 1
        if w[a]:
            if cnt[a] == 0:
                w[a] = 0
            w[b] = 1
    
    ans = 0
    for i in range(1, n+1):
        if cnt[i] and w[i]:
            ans += 1
    print(ans)
    

        
    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

R s
S p
P r

"""


Measured memory_bytes: 32092
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        
        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
        
    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    N, M, K = map(int, input().split())
    friend = UnionFind(N)
    direct_friend = [0] * N
    block = [0] * N

    for _ in range(M):
        a, b = map(int, input().split())
        friend.union(a-1, b-1)
        direct_friend[a-1] += 1
        direct_friend[b-1] += 1
    
    for _ in range(K):
        c, d = map(int, input().split())
        if friend.same(c-1, d-1):
            block[c-1] += 1
            block[d-1] += 1

    for i in range(N):
        print(friend.size(i) - direct_friend[i] - block[i] - 1, end=" ")

if __name__ == "__main__":
    main()

Measured memory_bytes: 80352
# C
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
def db(x): 
    global debug
    if debug: print(x)
debug = False
N,M = getIntList()
A = getIntList()
db((N,M))
db(A)
A.sort()
db(A)
b = zeros(M-1)
for i in range(M-1):
    b[i] = A[i+1] - A[i]
db(b)
b.sort()
b.reverse()
db(b)
sm = 0
for i in range(N-1,M-1):
    sm += b[i]
print(sm)

Measured memory_bytes: 13832
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////

void solve() {
	int A, B,K;
	cin >> A >> B>>K;
	vector<LL> ans;
	for (int i = 0; i < K; ++i) {
		if (A + i > B)break;
		ans.push_back(A + i);
	}
	for (int i = 0; i < K; ++i) {
		if (A > B - i) break;
		ans.push_back(B - i);
	}
	SO(ans);
	ans.erase(unique(ans.begin(), ans.end()), ans.end());
	int N = ans.size();
	for (int i = 0; i < N; ++i) {
		cout << ans[i] << endl;
	}
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 256
let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let rec inner (dict : string list) (i : int) =
    match (i < n) with
    | false -> true
    | true ->
      Scanf.scanf "%s\n" (fun str ->
          (match dict with
           | [] -> inner [str] (i + 1)
           | x :: xl -> (match (x.[(String.length x) - 1]) = str.[0] with
               | false -> false
               | true  -> (match (List.mem str dict) with
                   | true -> false
                   | false -> inner (str :: dict) (i + 1)))))
  in
  match inner [] 0 with
  | true -> print_endline "Yes"
  | false -> print_endline "No"

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

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

int main() {
  int M, N; cin >> M >> N;
  int ans = 0;
  REP(m, M) {
      int t = 0;
      REP(n, N) {
          int a; cin >> a;
          t += a;
      }
      ans = max(ans, t);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int validate[31000];

int main(){
  int n;  cin >> n;
  if (n == 3){
    cout << 2 << " " << 3 << " " << 25 << endl;
    return 0;
  }
  if (n == 4){
    cout << 2 << " " << 3 << " " << 4 << " " << 9 << endl;
    return 0;
  }

  fill(validate, validate+30500, 0);

  int s = 2;
  int t = 3;
  while(n > 2){
    if(s < t){
      cout << s << " ";
      validate[s] += 1;
      s += 2;
      n--;
    }
    else{
      cout << t << " " << t+6 << " ";
      validate[t] += 1;
      validate[t+6] += 1;

      t += 12;
      n -= 2;
    }
  }

  int x = (2+(s-2))*((s-2)/2)/2;
  if(x % 6 == 2){
    if(n == 2){
      validate[30000] += 1;
      cout << 30000 << " ";
    }
    validate[29998] += 1;
    cout << 29998 << endl;
  }
  else if(x % 6 == 4){
    if(n == 2){
      validate[30000] += 1;
      cout << 30000 << " ";
    }
    validate[29996] += 1;
    cout << 29996 << endl;
  }
  else{
    if(n == 2){
      validate[29996] += 1;
      cout << 29996 << " ";
      validate[29998] += 1;
      cout << 29998 << endl;
    }
    else{
      validate[30000] += 1;
      cout << 30000 << endl;
    }
  }

  for(int i = 2; i <= 30500; i++){
    if(validate[i] >= 2){
      cout << i << endl;
    }
    else if(validate[i] >= 1 && i > 30000){
      cout << i << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
using namespace std;

class ICoins {
 public:
  void solve(std::istream &in, std::ostream &out) {
    int n;
    in >> n;

    vector<double> dp(n + 1);
    dp[0] = 1;

    forn(c, n) {
      double p_heads;
      in >> p_heads;

      ford(i, c + 2) {
        dp[i] = (i == 0 ? 0 : dp[i - 1] * p_heads) + dp[i] * (1 - p_heads);
      }
    }
    double ans = 0;
    for (int heads = 0; heads <= n; ++heads) {
      if (heads * 2 > n)ans += dp[heads];
    }
    out << setprecision(10) << ans << endl;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ICoins solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main(){
	int z;
	while(cin>>z&&z){
		int ans = 1<<30;
		z*=z*z;
		for(int x=1;x*x*x<=z;x++){
			for(int y=1;x*x*x+y*y*y<=z;y++){
				ans = min(ans,z-x*x*x-y*y*y);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

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

  int ans = 0;
  int keta = (int)log10(N);
  REP(i, 0, keta+1){
    if ( (i % 2) == 1 )
      continue;
    if (i == keta)
      ans += (N - pow(10, i) + 1);
    else
      ans += (pow(10, i+1) - pow(10, i));
  }

  cout << ans << endl;

  return 0;
}


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

int c;
string a, b;
int main()
{
	int i;
	cin >> a >> b;
	for (i = 0; i < 3; i++) if (a[i] == b[i]) c++;
    cout << c << endl;
    return 0;
}

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

int main(){
  
  int n,k,a;
  cin >> n >>k;
  int cnt = 0;
  
  
  for(int i = 0; i < n; i++){
     cin >> a;
     if(a < k -a )
       cnt += 2*a;
     else
       cnt += 2*(k-a);
  }
    cout << cnt << endl;

}
    

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

char buf[110];
int n;
ll memo[110][5][2];
ll solve(int pos, int k, int eq) {
  ll &res = memo[pos][k][eq];
  if(res < 0) {
    if(pos == n) {
      res = k == 0 ? 1 : 0;
    } else if(eq) {
      res = solve(pos+1, k, buf[pos] == '0');
      if(k > 0) {
        for(int d = 1; d <= buf[pos]-'0'; ++d) {
          res += solve(pos+1, k-1, buf[pos] == '0' + d);
        }
      }
    } else {
      res = solve(pos+1, k, false);
      if(k > 0) {
        for(int d = 1; d <= 9; ++d) {
          res += solve(pos+1, k-1, false);
        }
      }
    }
    // cerr << "> " << pos << " " << k << " " << eq << ": " << res << endl;
  }
  return res;
}

int main(void) {
  int k;
  scanf("%s%d", buf, &k);
  n = strlen(buf);
  memset(memo, -1, sizeof memo);
  ll res = solve(0, k, true);
  printf("%lld\n", res);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
const lint mod=1e9+7;


int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  string res;
  while(1){
    c -= b;
    if(c < 1){
      res = "Yes";
      break;
    }
    a -= d;
    if(a < 1){
      res = "No";
      break;
    }
  }

  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 3652
inpl = lambda: list(map(int,input().split()))
A, B, M = inpl()
a = inpl()
b = inpl()
ans = min(a) + min(b)
for _ in range(M):
    x, y, c = inpl()
    x -= 1
    y -= 1
    p = a[x] + b[y] - c
    if p < ans:
        ans = p
print(ans)

Measured memory_bytes: 72452
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
 
using namespace std;
 
int H, W;
char grid[110][110];
 
int const dx[4] = {-1,1,0,0};
int const dy[4] = {0,0,-1,1};
 
int memo[101][101];
 
inline bool IN(int x, int y) {
  return 0<=x && x<W && 0<=y && y<H;
}
 
int const INF = 1<<29;
 
int main() {
   
  while(cin >> W >> H && W) {
     
    int sx, sy;
     
    for(int i=0; i<H; i++) {
      for(int j=0; j<W; j++) {
        cin >> grid[i][j];
        if(grid[i][j] == '&') {
          sx = j, sy = i;
        }
      }
    }
     
    int ans = 1<<29;
     
    memset(memo, -1, sizeof(memo));
    typedef pair<int, int> Pii;
    typedef pair<int, Pii> Piii;
     
    priority_queue<Piii> Q;
    Q.push(Piii(0, Pii(sx, sy)));
    while(!Q.empty()) {
      Piii piii = Q.top(); Q.pop();
      int const x = piii.second.first;
      int const y = piii.second.second;
      int const cost = -piii.first;
       
      bool ok = 0;
       
      for(int k=0; k<4; k++) {
        int nx = x + dx[k], ny = y + dy[k];
        if(IN(nx, ny)) {
          int ncost = cost + ((grid[y][x] == '.' || grid[y][x] == '&') && grid[ny][nx] == '#');
          if(memo[ny][nx] == -1 || memo[ny][nx] > ncost) {
            memo[ny][nx] = ncost;
            Q.push(Piii(-ncost, Pii(nx, ny)));
          }
        }
        else {
          cout << cost << endl;
          ok = 1;
          break;
        }
      }
      if(ok) break;
    }
     
  }
   
  return 0;
}

Measured memory_bytes: 1388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int main(){
    ll n; cin >> n;
    ll u = 1, a = 1, b = 1;
    for(ll i=0; i<n; ++i){
        u = u*10%mod; 
        a = a*9%mod;
        b = b*8%mod; //cout << u << "," << a << ", " << b << endl;
    }
    u %= mod; a %= mod; b %= mod;
    ll res = (u - a - a + b)%mod;
    res %= mod;
    if(res<0){res += mod;}
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3564
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <cassert>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

typedef std::pair <int, int> pii;
typedef long long ll;
typedef std::vector <ll> vll;

using namespace std;

vector <int> vec;
int n;
int l;

int main() {
	cin >> l;
	if (l == 1) {
		cout << "2 1" << endl << "1 2 0" << endl;
		return 0;
	}
	int last = 0;
	while ((1LL << last) <= l) last++;
	last--;
	cout << last + 1 << " " << (last * 2) + __builtin_popcount(l) - 1 << endl;
	n = last + 1;
	for (int i = 0; i < n - 1; i++) {
		cout << i + 1 << " " << i + 2 << " " << 0 << endl;
		cout << i + 1 << " " << i + 2 << " " << (1 << (n - 2 - i)) << endl;
	}
	l -= (1 << last);
	int maxi = (1 << (n - 1));
	for (int i = 0; i < last; i++) {
		if ((1 << i) & l) {
			if (i == 0) {
				cout << "1 " << n - i << " " << maxi << endl;
				maxi++;
			}
			else {
				cout << "1 " << n - i << " " << maxi << endl;	
				maxi += (1 << i);
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  std::vector<queue<int> > v(n);
  while (q--) {
    int op;
    cin >> op;
    if (op == 0) {
      int t, x;
      cin >> t >> x;
      v[t].push(x);
    } else if (op == 1) {
      int t;
      cin >> t;
      if (v[t].size())
        cout << v[t].front() << endl;
    } else {
      int t;
      cin >> t;
      if (v[t].size()) {
        v[t].pop();
      }
    }
  }
}


Measured memory_bytes: 4392
N = int(input())
h_list = list(map(int, input().split()))

dp = [float("inf") for _ in range(N + 1)]
dp[1] = 0
for i in range(2, N + 1):
    if i == 2:
        dp[2] = abs(h_list[1] - h_list[0])
    else:
        dp[i] = min(dp[i - 1] + abs(h_list[i-1] - h_list[i - 2]), dp[i - 2] + abs(h_list[i-1] - h_list[i - 3]))
print(dp[N])


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

bool ch[302][302];
bool a[302];
ll ans[302][302];
int main() {
	ll h,w,k;
	cin>>h>>w>>k;
	for(ll i=0;i<h;i++){
		bool b=false;
		for(ll j=0;j<w;j++){
			char now;
			cin>>now;
			if(now=='#'){
				ch[i][j]=true;
				b=true;
			}
		}
		if(b!=true){
			a[i]=true;// a[i]=trueでイチゴ無し
		}
	}
	ll cnt=1;
	for(ll i=0;i<h;i++){
		if(a[i]==true){
			continue;
		}
		bool itigo=false;
		for(ll j=0;j<w;j++){
			if(ch[i][j]==true){
				if(itigo){
					cnt++;
				}
				itigo=true;
			}
			ans[i][j]=cnt;
		}
		if(itigo){
			cnt++;
		}
	}
	for(ll i=0;i<h-1;i++){
		if(ans[i+1][0]!=0){
			continue;
		}
		if(ans[i][0]==0){
			continue;
		}
		for(ll j=0;j<w;j++){
			ans[i+1][j]=ans[i][j];
		}
	}
	for(ll i=h-1;i>=1;i--){
		if(ans[i-1][0]!=0){
			continue;
		}
		if(ans[i][0]==0){
			continue;
		}
		for(ll j=0;j<w;j++){
			ans[i-1][j]=ans[i][j];
		}
	}
	for(ll i=0;i<h;i++){
		for(ll j=0;j<w;j++){
			cout << ans[i][j];
			if(j!=w-1){
				cout << " ";
			}
		}
		cout <<endl;
	}
	// your code goes here
	return 0;
}

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

int N;


void solve(string s,string t){
  vector<vector<int >> dp(1001, vector<int>(1001));
  int S=s.size();
  int T=t.size();
  for(int i=0;i<S;i++){
    for(int j=0;j<T;j++){
      if(s[i]==t[j]) dp[i+1][j+1]=dp[i][j]+1;
      else dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
    }
  }
  cout<<dp[S][T]<<endl;
}

int main() {

cin>>N;

for(int i=0;i<N;i++){
  string s,t;
  cin>>s>>t;
  solve(s,t);
}

}



Measured memory_bytes: 6928
s=input()
s1=list(s)
s2=set(s1)
az="abcdefghijklmnopqrstuvwxyz"
az1=list(az)
az2=set(az1)
ans=az2-s2
ans1=list(ans)
ans1.sort()
if len(ans1)!=0:
    print(ans1[0])
else:
    print("None")



Measured memory_bytes: 3956
s = gets.chomp
K = 'keyence'
if (0..5).any? { |i| s.start_with?(K[0..i]) && s.end_with?(K[(i + 1)..6]) }
  puts('YES')
elsif s.start_with?(K) || s.end_with?(K)
  puts('YES')
else
  puts('NO')
end


Measured memory_bytes: 1788
#include <cstdio>

int main(){
    long long int n, a, min = 10000000, max = -10000000, sum = 0;
    scanf("%lld", &n);
    for(int i = 0; i < n; i++){
        scanf("%lld", &a);
        if(a < min){
            min = a;
        }
        if(max < a){
            max = a;
        }
        sum += a;
    }
    printf("%lld %lld %lld\n", min, max, sum);
    return 0;
}


Measured memory_bytes: 2756
//package com.company;


import java.io.*;
import java.util.*;


public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String first = sc.next();
        String pat = sc.next();
        String possible = "";
        for (int i = 0; i < first.length(); i++) {
            if (fitAtidx(first, pat, i)){
                String sss = change(first, pat, i);
                if (possible.equals("")) possible = sss;
                else if (lexSmall(sss, possible)){
                    possible = sss;
                }
            }
        }
        if (possible.equals("")){
            System.out.println("UNRESTORABLE");
        } else {
            System.out.println(possible);
        }

    }

    public static boolean fitAtidx(String a, String b, int idx){
        if (idx == 2){
            int we = 1;
        }
        if (a.length() - idx < b.length()) return false;
        for (int i = idx; i < idx + b.length(); i++) {
            if (a.charAt(i) == b.charAt(i - idx)) continue;
            if (a.charAt(i) == '?') continue;
            return false;
        }
        return true;
    }
    public static String change(String a, String b, int idx){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < a.length(); i++) {
            if (i < idx || i >= idx + b.length()){
                if (a.charAt(i) == '?'){
                    sb.append('a');
                } else {
                    sb.append(a.charAt(i));
                }
            } else {
                sb.append(b.charAt(i - idx));
            }
        }
        return sb.toString();
    }
    public static boolean lexSmall(String a, String b){
        for (int i = 0; i < a.length(); i++) {
            if (a.charAt(i) < b.charAt(i)) return true;
            if (a.charAt(i) > b.charAt(i)) return false;
        }
        return false;
    }
    static class MyScanner {
        StringTokenizer st;
        BufferedReader br;

        public MyScanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public MyScanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}

        public long nextLong() throws IOException {return Long.parseLong(next());}

        public String nextLine() throws IOException {return br.readLine();}

        public double nextDouble() throws IOException { return Double.parseDouble(next()); }

        public boolean ready() throws IOException {return br.ready();}
    }
}


Measured memory_bytes: 21844
/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX   XXXXXXXXX  XXXXXXXXXXXXXXXX  XXXXXXXXXXXXXXXXXXXXXXXXX X
X XXX XX   XXXX XXXX    X XXX XXX XXXX   XXXX XXXX   XXXXXX X
X XXXXXXXXX XXX XXX XXXXX XXX XXX XXXXXXX XX   XX XXX XX    X
X XXXXX     XXX XXX XXXXX XXX XXX XXX     XXX XXX     X XXX X
X XXX X XXX XXX XXX XXXXX XXX XXX XXX XXX XXX XXX XXXXX XXX X
XX   XXX    XX   XXX    XX    XX   XXX    XXX  XXX    XX    X
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXXX   XXXX   XX  X XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXX XXX XXXXXX X X X XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXX     XX     X X X XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXX XXXXXX XXX X XXX XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XXXXX    XXX    X XXX XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <chrono>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <array>
#include <set>
#include <list>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>
#include <map>
#include <iterator>
#include <cstring>
using namespace std;

#define loop(i,start,end) for(auto i = start; i < end; i++)
#define loopi(end) loop(i,0,end)
#define loopj(end) loop(j,0,end)
#define loopk(end) loop(k,0,end)
#define get_i(n) int n; cin >> n;
#define get_ch(n) char x; cin >> x;
#define get_doub(n) double n; cin >> n;
#define pb push_back
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vb vector<bool>
#define vi vector<int>
#define vpi vector<pii>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define clear(a) memset(a, 0, sizeof(a))
#define all(a) (a).begin(), (a).end()
const long long modulo = 1e18+3;
const ll INF = 1e18;
const int inf = 2e9;
const double PI = 3.141592653589793238463;

//#define FILE "substrcmp"
#define FAST_IO
#define FSOL

#ifdef FSOL
void solve() {
	get_i(n); get_i(k);
	vi h(n); loopi(n) cin >> h[i];
	vi dp(n, inf);
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int i = 2; i < n; i++)
		if (i < k) loopj(i) dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
		else loopj(k + 1) dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
	
	cout << dp[n - 1];
}
#else 
void solve() {
	
}
#endif

int main() {
#ifdef FAST_IO
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
#endif
#ifdef DEBUG
	freopen("debug.in", "r", stdin);
	auto timestamp = std::chrono::system_clock::now();
#else 
#ifdef FILE
	freopen(FILE".in", "r", stdin);
	freopen(FILE".out", "w", stdout);
#endif
#endif
	solve();
#ifdef DEBUG 
	cout << endl << "Time elapsed: " << chrono::duration_cast<chrono::milliseconds>(std::chrono::system_clock::now() - timestamp).count() << " ms" << endl;
#endif
	return 0;
}

Measured memory_bytes: 1024
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.util.function.*;
import java.util.stream.Collectors.*;
public class Main {

    public static void main(String[] args) { new Main().stream(); }
    final IO io = new IO();
    final PrintWriter out = new PrintWriter(System.out);
    final int INF = Integer.MAX_VALUE/2;
    void stream(){ solve(); out.flush(); }
    /// ********** 本体 ********** ///

    void solve() {
        int D = io.Int();
        int N = io.Int();
        int ans = N != 100 ? (int)Math.pow(100, D) * N : (int)Math.pow(100, D) * (N+1) ;
        out.println(ans);
    }
    void FOR(int a, int b, Consumer<Integer>act) { for(int i = a; i < b; ++i) act.accept(i); }
    void REP(int a, Consumer<Integer>act) { FOR(0, a, act); }
}
/// ********** その他 ********** ///


/// ********** その他 ********** ///

class IO{
    private final InputStream in = System.in;
    private final byte[] buffer  = new byte[1<<12];
    private int   ptr = 0, buffLen = 0;
    private boolean hasNextByte()          {
        if(ptr < buffLen) return true;
        ptr = 0;
        try{ buffLen = in.read(buffer); } catch (IOException e){ e.printStackTrace(); }
        return buffLen > 0;
    }
    private int     readByte()             { return hasNextByte()? buffer[ptr++] : -1; }
    private boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } //ASCII
    private void    skipUnprintable()      { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; }
    private boolean hasNext()              { skipUnprintable(); return hasNextByte();}
    private String  next()                 {
        if(!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)){ sb.appendCodePoint(b); b = readByte(); }
        return sb.toString();
    }
    public String String() { return next(); }
    public char   Char()   { return next().charAt(0);}
    public int    Int()    { return Integer.parseInt(next());}
    public long   Long()   { return Long.parseLong(next());}
    public double Double() { return Double.parseDouble(next());}
    public String[] StringArr (final int n) { final String[] arr = new String[n]; for(int i = 0; i < n; ++i) arr[i] = String(); return arr; }
    public char[]   CharArr   (final int n) { final char[]   arr = new char[n];   for(int i = 0; i < n; ++i) arr[i] = Char();   return arr; }
    public int[]    IntArr    (final int n) { final int[]    arr = new int[n];    for(int i = 0; i < n; ++i) arr[i] = Int();    return arr; }
    public long[]   LongArr   (final int n) { final long[]   arr = new long[n];   for(int i = 0; i < n; ++i) arr[i] = Long();   return arr; }
    public double[] DoubleArr (final int n) { final double[] arr = new double[n]; for(int i = 0; i < n; ++i) arr[i] = Double(); return arr; }
}


Measured memory_bytes: 21204
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

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

    vector<int> a(m), b(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
    }

    int res = 0;
    for (int i = 0; i < m; i++) {
        vector<vector<int>> edge(n, vector<int>(0));
        for (int j = 0; j < m; j++) {
            if (i != j) {
                edge[a[j] - 1].push_back(b[j] - 1);
                edge[b[j] - 1].push_back(a[j] - 1);
            }
        }

        vector<bool> node(n, false);
        node[0] = true;

        queue<int> que;
        que.push(0);
        while (!que.empty()) {
            int q = que.front();
            que.pop();

            for (int j = 0; j < static_cast<int>(edge[q].size()); j++) {
                if (!node[edge[q][j]]) {
                    node[edge[q][j]] = true;
                    que.push(edge[q][j]);
                }
            }
        }

        for (int j = 0; j < n; j++) {
            if (!node[j]) {
                res++;
                break;
            }
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      int n[] = new int[3];
      for(int i=0;i<3;i++){
        n[i]=Integer.parseInt(scan.next());
      }
      if(n[0]+n[1]==n[2]||n[0]+n[2]==n[1]||n[1]+n[2]==n[0]){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e6 + 10;

signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int n, m;
	cin >> n >> m;
	int ans = (n * (n - 1) / 2) + (m * (m - 1) / 2);
	cout << ans;

	return 0;
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
const int MOD = 1000000007;
const ll INF = 1LL << 60;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    REP(i, N) { cin >> H[i]; }
    vector<ll> dp(N, INF);
    dp[0] = 0LL;
    dp[1] = abs(H[1] - H[0]);
    for (int i = 2; i < N; ++i) {
        for (int j = i - 1; j >= 0 && i - j <= K; --j) {
            dp[i] = min(dp[i], abs(H[j] - H[i]) + dp[j]);
        }
    }
    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
int main(void)
{
    int a, b, c, d;
    scanf("%d %d %d", &a, &b, &c);
    if(a > b)
    {
        d = a;
        a = b;
        b = d;
    }
    if(b > c)
    {
        d = b;
        b = c;
        c = d;
    }
     if(a > b)
    {
        d = a;
        a = b;
        b = d;
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}


Measured memory_bytes: 2108
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();
        
        if((B-A)%2 == 0){
            System.out.println("Alice");
        }else{
            System.out.println("Borys");
        }
        //System.out.println("");
    }
}

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

using pii = pair<int,int>;
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= 0; i--)

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  	int n; cin >> n;
  	map<int,int> freq;
  	f(i,0,n) {
    	int x; cin >> x;
      	freq[x]++;
    }
  	int cnt = 0;
  	fr(i,0,31) {
   		int sum = 1<<i;
      	for (pii pp : freq) if (pp.second) {
          	if (pp.first*2 == sum) cnt += pp.second/2, freq[pp.first] &= 1;
            else if (freq.count(sum-pp.first) && freq[sum-pp.first]) {
            	int x = min(pp.second,freq[sum-pp.first]);
              	freq[pp.first] -= x; freq[sum-pp.first] -= x; cnt += x;
            }
        }
    }
  	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 9600
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


sx,sy,tx,ty = map(int, input().split())
wx = tx-sx
wy = ty-sy
ans = "U"*wy + "R"*wx + "D"*wy + "L"*wx + ("L"*1 + "U"*(wy+1) + "R"*(wx+1) + "D"*1) + ("R"*1 + "D"*(wy+1) + "L"*(wx+1) + "U"*1)
print(ans)

Measured memory_bytes: 61976
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n; cin>>n;
	int d,ans; cin>>d>>ans;
	int t;
	For(i,0,n-1){
		cin>>t;
		ans+=(d-1)/t+1;
	}
	cout<<ans<<'\n';
	return 0;
}





























Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = 1'000'000'007;
// const ll MOD = 998244353;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, X, T;
    cin >> N >> X >> T;
    cout << (N + X - 1) / X * T << endl;
}


Measured memory_bytes: 3644