akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, k, A[N];
int PL, MI;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> k;
  FOR(i, 0, n){
    cin >> A[i];
    if(A[i]>0) PL++;
    if(A[i]<0) MI++;
  }
  sort(A, A+n, [&](int i, int j){return abs(i) < abs(j);});
  ll ans = 1;
  if(min(k, MI)/2*2 + PL < k){
    FOR(i, 0, k) ans = ans*A[i]%MOD;
    cout << (ans+MOD)%MOD << endl;
    return 0;
  }
  reverse(A, A+n);
  ll mipl=0, mimi=0, mapl=0, mami=0;
  FOR(i, 0, k){
    ans = ans*A[i]%MOD;
    if(A[i] > 0) mipl = A[i];
    if(A[i] < 0) mimi = A[i];
  }
  if(ans > 0){
    cout << ans << endl;
    return 0;
  }
  FOR(i, k, n) if(A[i]>0){
    mapl = A[i];
    break;
  }
  FOR(i, k, n) if(A[i]<0){
    mami = A[i];
    break;
  }
  ll ans1=0, ans2=0;
  if(mimi && mapl) ans1 = (-ans)*modInv(-mimi)%MOD*mapl%MOD;
  if(mipl && mami) ans2 = ( ans)*modInv( mipl)%MOD*mami%MOD;
  if(!ans1 || !ans2){
    cout << max(ans1, ans2) << endl;
    return 0;
  }
  cout << ((mapl*mipl>mami*mimi) ? ans1 : ans2) << endl;
}

Measured memory_bytes: 4416
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <climits>
#include <cstring>
#include <functional>
#include <iomanip>

using namespace std;

//using ll = long long;
#define rep(i, N) for(int i = 0;i < (int)N;i++)
#define LARGE INT_MAX / 2
#define PI 3.1415926535897932384626433832795

string s, t;

bool flag1[2000000];
bool flag2[2000000];

int main() {
	cin >> s >> t;
	rep(i, s.length()) {
		if (s[i] != t[i] && !flag1[i]) {
			for (int j = i; j < s.length(); j++) {
				if (s[i] == s[j]) {
					if (t[i] != t[j]) {
						cout << "No" << endl;
						return 0;
					}
					flag1[j] = true;
				}
			}
		}
	}
	swap(s, t);
	rep(i, s.length()) {
		if (s[i] != t[i] && !flag2[i]) {
			for (int j = i; j < s.length(); j++) {
				if (s[i] == s[j]) {
					if (t[i] != t[j]) {
						cout << "No" << endl;
						return 0;
					}
					flag2[j] = true;
				}
			}
		}
	}
		cout << "Yes" << endl;
	

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int inf=1e9;
int main(){
	int N;cin>>N;
	long a;long cnt[60][2]={};
	rep(i,0,N){
		cin>>a;
		rep(j,0,60){
			if(a&(1l<<j)) cnt[j][1]++;
			else cnt[j][0]++;
		}
	}
	long ans=0; long temp;
	rep(i,0,60){
		temp=(cnt[i][0]*cnt[i][1])%mod;
        rep(j,0,i) (temp*=2)%=mod;
        (ans+=temp)%=mod;
	}cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define sort(a) sort((a).begin(),(a).end())
#define rev(a) reverse((a).begin(),(a).end())
using db = double;
using namespace std;
typedef long long ll;

int main() {
  string n;
  cin >> n;
  if (n[0] == '9' || n[1] == '9') cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
# INPUT
input = list(map(float, input().split()))

takahashi = input[0]
aoki = input[1]
num = input[2]

a = takahashi - num
b = 0
if a < 0:
  b = aoki + a
  a = 0
  if b < 0:
    b = 0
else:
  b = aoki

print("{0} {1}".format(int(a),int(b)))

Measured memory_bytes: 3064
using LIB;
using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        double[] n = io.r<double>(' ');
        io.w(Math.Sqrt(Math.Pow(n[2] - n[0], 2) + Math.Pow(n[3] - n[1], 2)));
        io.wflush();
    }
}

namespace LIB
{
    public class io
    {
        private const int WMAX = 1000;
        private static StringBuilder S = new StringBuilder();
        public static T r<T>() { return util.parse<T>(r()); }
        public static T[] r<T>(char s = ' ') { return r().Split(s).Select(util.parse<T>).ToArray(); }
        public static T[] r<T>(int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = r<T>(); } return r; }
        public static T[][] r<T>(int l, char s = ' ') { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = r<T>(s); } return r; }
        private static string r() { return Console.ReadLine(); }
        public static void w(object v, bool lf = true) { S.Append(util.parse<string>(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { wflush(); } }
        public static void wflush() { Console.Write(S.ToString()); S.Length = 0; }
    }
    public class util
    {
        public static T parse<T>(object value) { return (T)(Convert.ChangeType(value, typeof(T))); }
    }
    public class memo<Key, Result>
    {
        private Dictionary<Key, Result> R;
        public memo() { R = new Dictionary<Key, Result>(); }
        public Result exec(Key k, Func<Key, Result> f) { Result r; if (R.ContainsKey(k)) { r = R[k]; } else { r = f(k); R.Add(k, r); } return r; }
    }
}

Measured memory_bytes: 9948
#include<bits/stdc++.h>
using namespace std;
void swap(int &, int &);

int main()
{
  int A, B, C;
  cin>>A>>B>>C;
  swap(A, B);
  swap(A, C);
  cout<<A<<" "<<B<<" "<<C;
  return 0;
}
void swap(int &x, int &y)
{
  int z;
  z=x;
  x=y;
  y=z;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.math;
 
void main() {
    auto input = getStdin!(real[])[0];
    auto area = input * input * PI;
    auto diameter = input * PI * 2.0;
    writefln("%.6f %.6f", area, diameter);
}
 
T getStdin(T)() {
    string[] cmd;
    string line;
    while ((line = chomp(stdin.readln())) != "") cmd ~= line;
    return to!(T)(cmd);
}

Measured memory_bytes: 2568
from collections import deque

N, Q = map(int, input().split())

edges = [[] for _ in range(N)]

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

counter = [0] * N
checked = [False] * N

for i in range(Q):
    p, x = map(int, input().split())
    counter[p - 1] += x

queue = deque()
queue.append(0)

while queue:
    root = queue.pop()
    checked[root] = True
    for e in edges[root]:
        if checked[e] == False:
            queue.append(e)
            counter[e] += counter[root]

print(" ".join(map(str, counter)))

Measured memory_bytes: 67200
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		String[] a = new String[n];
		String[] b = new String[m];
		boolean matched = false;
		for(int i = 0; i < n; i++) {
			a[i] = sc.next();
		}
		for(int i = 0; i < m; i++) {
			b[i] = sc.next();
		}
		out:
		for(int y = 0; y < n - m + 1; y++) {
			for(int x = 0; x < n - m + 1; x++) {
				for(int k = 0; k < m; k++) {
					if(!(a[y + k].substring(x, x + m).equals(b[k]))) break;
					if(k == m - 1) {
						matched = true;
						break out;
					}
				}
			}
		}
		if(matched) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 23764
package main

import "fmt"

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	var r float64
	for i := 1; i <= N; i++ {
		x, c := i, 1.0
		for K > x {
			x *= 2
			c /= 2
		}
		r += c / float64(N)
	}

	fmt.Printf("%.12f\n", r)
}


Measured memory_bytes: 1832
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
    int n;
    cin >> n;
    P(n/3);
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define inf 1013161010
#define ninf -1013161010
#define mod 1000000007
#define ll long long
#define lf long double
#define in(x) scanf("%d",&x);
#define sz(x) ((int)x.size())
#define lld l64d
#define rep(i,n) for(i=0;i<n;i++)
#define rrep(i,n) for(i=n-1;i>=0;i--)
#define rep1(i,a,b) for(i=a;i<=b;i++)
#define rrep1(i,a,b) for(i=a;i>=b;i--)
#define stlfor(i,t) for(auto i =t.begin();i!=t.end();i++)
#define fr freopen("x.txt","r",stdin)
#define frc freopen("y.txt","w",stdout)
#define all(x) x.begin(),x.end()
#define set0(x) memset(x,0,sizeof(x))
#define dbg cout<<"yo "<<endl;
#define pset(n) fixed<<showpoint<<setprecision(n)

#define pii pair<int,int>
#define pll pair<ll,ll>
#define min_pq priority_queue<pll, vector<pll>, greater<pll> >
#define vpii vector<pair<int,int> >
#define vll vector<ll>
#define vpll vector<pair<ll,ll> >
#define si set<int>
#define mii map<int,int>
#define umii unordered_map<int,int>
#define vi vector<int>
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define modulo %
#define moduloe %=

typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> OST;

ll toint(const string &s) { stringstream ss; ss << s; ll x; ss >> x; return x; }
ll add(ll a, ll b) {a+=b; while(a >= mod) a-= mod; while(a<0) a+= mod;}
ll mul(ll a, ll b) {return (a * 1LL *b % mod);}
string tostring ( ll number ){  stringstream ss; ss<< number; return ss.str();}

const lf pi = 2*acos(0);
const int nn = 500006;
const lf EPS = 0.000000001;

ll gcd(ll a,ll b){return (b==0)? a:gcd(b,a%b); }
void nope(int num = 0){ if(num==0) cout<<"NO"; else cout<<"-1"; exit(0); }

ll ans[nn][3];
vi g[nn];

void dfs(int node, int par)
{
    ans[node][0] = ans[node][1] = 1LL;
    for(auto u : g[node])
    {
        if(u != par)
        {
            dfs(u, node);
            ans[node][0] *= ans[u][1];
            ans[node][0] moduloe mod;
            ans[node][1] *= ans[u][2];
            ans[node][1] moduloe mod;
        }
    }
    ans[node][2] = ans[node][0] + ans[node][1];
    ans[node][2] moduloe mod;
}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll i,j,n,tt;
    tt=1;
    //cin>>tt;
    while(tt--)
    {
        cin>>n;
        int x, y;
        rep(i, n-1)
        {
            cin>>x>>y;
            g[x].pb(y);
            g[y].pb(x);
        }

        dfs(1, -1);
        cout<<ans[1][2]<<endl;

    }
    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC153E()
{
	int H, N;
	cin >> H >> N;
	vi A(N), B(N);
	for (int i = 0; i < N; ++i)
		cin >> A[i] >> B[i];
	vvi dp(N, vi(H + 1));
	for (int j = 1; j <= H; ++j)
	{
		int x = j / A[0];
		if (j % A[0] != 0)
			++x;
		dp[0][j] = x * B[0];
	}
	for (int i = 1; i < N; ++i)
	{
		for (int j = 1; j <= H; ++j)
		{
			dp[i][j] = min(dp[i - 1][j], dp[i][max(0,j - A[i])] + B[i]);
		}
	}
	cout << dp[N - 1][H] << endl;

}

int main()
{
	ABC153E();
	return 0;
}


Measured memory_bytes: 39424
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
     ll a,b,c,k;
     cin>>a>>b>>c>>k;
     ll ans=0,k1=k;
     ans+=min(a,k);
     k-=min(a,k);
     if(k>0)
     k-=b;
     if(k>0)
     {ans-=min(c,k);
     k-=min(k,c);
     }
     cout<<ans<<e;
}


Measured memory_bytes: 3636
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String w = sc.nextLine();
        int count = 0;
        String t;
        while (!((t = sc.next()).equals("END_OF_TEXT"))) {
            if(t.toLowerCase().equals(w))
                count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26468
import java.util.*;


public class Main {

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a < b) {
            for (int i = 0; i < b; i++) {
                System.out.print(a);
            }
        } else {
            for (int i = 0; i < a; i++) {
                System.out.print(b);
            }
        }
    }


}






Measured memory_bytes: 23636
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    string ss; cin >> ss;
    int a[10];
    for (int i = 0; ss[i]; i++) {
        a[i] = (ss[i] + 2 ) % 10;
        //"0"=48だから"0"+2=50. %10で0
    }
    int n = (int)ss.length();
    int ans = a[n-3]*100 + a[n-2]*10 + a[n-1];
    for (int i = 1; i < n - 2; i++) {
        int b = a[n - 1 - i] + a[n - 1 - i - 1] * 10 + a[n - 1 - i -2] * 100;
        if (fabs(ans - 753) > fabs(b - 753) ) ans = b;
    }
    cout << fabs(ans - 753) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int64_t a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  if(v>w && abs(b-a) <=t*(v-w))cout<<"YES"<<endl;
  else cout <<"NO"<<endl;
  
}

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

int main()
{
    char s[101] = {0};
    char s2[201] = {0};
    char p[101] = {0};
    
    scanf("%s", s);
    scanf("%s", p);
    
    strcat(s2, s);
    strcat(s2, s);
    
    strstr(s2, p)? printf("Yes\n") : printf("No\n");
    
    return 0;
}

Measured memory_bytes: 532
numbers = []
numbers.extend(list(map(int, input().split(' '))))
numbers.extend(list(map(int, input().split(' '))))
numbers.extend(list(map(int, input().split(' '))))
N = int(input())
answers = set()
for _ in range(N):
    answers.add(int(input()))

results = [False] * 9

for i in range(len(numbers)):
    if numbers[i] in answers:
        results[i] = True

if all(results[0:3]) or all(results[3:6]) or all(results[6:9]):
    print('Yes')
elif all(results[0::3]) or all(results[1::3]) or all(results[2::3]):
    print('Yes')
elif all((results[0], results[4], results[8])) or all((results[2], results[4], results[6])):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
/**
 *  author:   TakeruOkuyama
 *  created:  2020-04-15 11:17:28
**/
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int INF = 999999999;

int main(){
    vector<int> time1(5);
    vector<int> time2(5);
    rep(i, 5){
        cin >> time1[i];
        if(time1[i] % 10 != 0)time2[i] = time1[i] + (10 - time1[i] % 10);
        else time2[i] = time1[i];
        //cout << time1[i] << " ";
    }
    //cout << endl;
    /*rep(i, 5){
        cout << time2[i] << " ";
        cout << endl;
    }*/
    int max = 0;
    int max_num = 0;
    rep(i, 5){
        if(abs(time2[i] - time1[i]) > max){
            max = abs(time2[i] - time1[i]);
            max_num = i;
        }
    }
    time2[max_num] = time1[max_num];
    int ans = 0;
    rep(i,5){
        //cout << time2[i] << " ";
        ans += time2[i];
    }
    cout << ans << endl;
return 0;
}
/**
 * g++ code.cpp
 * ./a.out
 * shift + ctrl + i
**/ 

Measured memory_bytes: 384
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void b_mix_juice(void) {
	int n, k;
	cin >> n >> k;

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

	sort(a.begin(), a.end());

	int sum = 0;
	for (int i = 0; i < k; i++) sum += a[i];
	cout << sum << endl;
}

int main()
{
    b_mix_juice();
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define ll long long

int main(void)
{
	int x;
	cin >> x;
	int ans = 1;
	while(1) {
		if (ans * (ans + 1) / 2 >= x) {
			cout << ans << endl;
			return 0;
		}
		ans++;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'

using namespace std;

const int lim = 1e5 + 5;

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

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include "unistd.h"
using namespace std;
#define WA cout<<"char134217728";exit(0)
#define RE throw
#define TLE sleep(1000)
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end());
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int ans = IINF;
int n, a[3], l[8], t[4], c[4];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, 3) cin >> a[i];
  FOR(i, 0, n) cin >> l[i];
  FOR(_i, 0, bit(n*2)){
    memset(t, 0, sizeof t);
    memset(c, 0, sizeof c);
    int i = _i;
    FOR(j, 0, n){
      t[i&3] += l[j];
      c[i&3]++;
      i >>= 2;
    }
    int s = 0;
    FOR(j, 0, 3) if(!c[j]) goto bad;
    FOR(j, 0, 3) s += abs(a[j]-t[j])+(c[j]-1)*10;
    mins(ans, s);
bad:;
  }
  cout << ans << endl;
}

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

int main()
{
    int d,N;
    cin>>N;
    d=N/1000;
    if(N%1000==0){
        cout<<'0'<<endl;
    }
    else{
        cout<<((d+1)*1000)-N<<endl;
    }
    return 0;
}

Measured memory_bytes: 3580
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n, d = map(int, input().split())
x = list()
for i in range(n):
    x.append(list(map(int, input().split())))

ok = 0
for i in range(0, n - 1):
    for j in range(i + 1, n):
        s = 0
        for k in range(d):
            s += (x[j][k] - x[i][k]) ** 2
        f = s ** (1/2)
        if f == int(f):
            ok += 1

print(ok)


Measured memory_bytes: 3188
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

template<class T,class F>
bool _mysort(pair<T, F> a, pair<T, F> b) {
    if (a.second != b.second)
        return a.second < b.second;
    else {
        return a.first < b.first;
    }
}

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cins(X);
    int sCount=0;
    int eliminateLength=0;
    rep(i,X.length()){
        if(X[i]=='S') sCount++;
        else{
            if(sCount>0){
                eliminateLength+=2;
                sCount--;
            }
        }
    }
    cout << X.length() - eliminateLength << nn;
    return 0;
}

Measured memory_bytes: 720
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        S_DigitSum solver = new S_DigitSum();
        solver.solve(1, in, out);
        out.close();
    }

    static class S_DigitSum {
        long mod = (int) 1e9 + 7;
        long[][] dp;
        int d;

        private long calc(String num) {
            int n = num.length();
            long ans = 0;
            int pref = 0;

            for (int i = 0; i < n; i++) {
                int x = num.charAt(i) - '0';
                for (int dig = 0; dig < x; dig++) {
                    int rem = (d - (pref + dig) % d) % d;
                    ans = (ans + dp[n - 1 - i][rem]) % mod;
                }
                pref += x;
            }
            if (pref % d == 0)
                ans++;
            return ans - 1 + mod;
        }

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            String K = in.ns();
            int n = K.length();

            d = in.ni();
            dp = new long[n + 1][d];
            dp[0][0] = 1;

            for (int i = 0; i < n; i++) {
                for (int r = 0; r < d; r++) {
                    for (int a = 0; a <= 9; a++) {
                        int rem = (r + a) % d;
                        dp[i + 1][rem] = (dp[i + 1][rem] + dp[i][r]) % mod;
                    }
                }
            }
            out.println(calc(K) % mod);
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}



Measured memory_bytes: 31444
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
    ($line:expr,$name:ident,$t:tt) => {
        let $name=value!($line,$t);
    };
    }

    macro_rules! values_def {
    ($lines:expr,$n:expr,$name:ident,$t:tt) => {
        let $name={
        let mut vec=Vec::new();
        for i in 0..$n{
            let mut next=$lines.next().unwrap().split_whitespace();
            vec.push(value!(next,$t));
        }
        vec
        };
    };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(a:i64 b:i64 k:i64));
    let mut res = Vec::new();
    for i in a..b + 1 {
        if i - a < k || b - i < k {
            res.push(i.to_string());
        }
    }

    res.join("\n")
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3 8 2" => "3\n4\n7\n8",
    test2: "4 8 3" => "4\n5\n6\n7\n8",
    test3: "2 9 100" => "2\n3\n4\n5\n6\n7\n8\n9",
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>

typedef long long LL;

const long long INF = 1LL << 60;

using namespace std;

int main()
{
    LL A;
    cin >> A;

    double B;
    cin >> B;

    int C = B * 100 + 0.5;

    A *= C;
    A /= 100;

    cout << A << endl;

    return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main(){
  int X;
  cin>>X;
  while(1){
    bool t = 0;
    for(int k = 2;k<=sqrt(X);k++){
      if(X%k == 0){
        t = 1;
      }
    }
    if(t == 0){
      cout << X << endl;
      break;
    }
    X++;
  }
  return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

immutable long inf = 10L^^15;

void main() {
    int n;
    scan(n);
    auto a = readln.split.to!(int[]);

    auto m = 1<<n;
    auto dp = new int[][](m, 2);
    foreach (i ; 0 .. m) {
        dp[i][0] = i;
        dp[i][1] = -1;
    }

    debug {
        writeln(dp);
    }

    foreach (s ; 0 .. m) {
        foreach (j ; 0 .. 20) {
            if ((s >> j) & 1) {
                int sb = s ^ (1 << j);
                foreach (r ; 0 .. 2) {
                    if (dp[sb][r] == -1) continue;
                    if (a[dp[sb][r]] > a[dp[s][0]]) {
                        dp[s][1] = dp[s][0];
                        dp[s][0] = dp[sb][r];
                    }
                    else if ((dp[s][1] == -1 || a[dp[sb][r]] > a[dp[s][1]]) && dp[s][0] != dp[sb][r]) {
                        dp[s][1] = dp[sb][r];
                    }
                }
            }
        }
    }

    debug {
        writeln(dp);
    }

    auto ans = new long[](m + 1);

    foreach (i ; 1 .. m) {
        ans[i] = max(ans[i-1], a[dp[i][0]]+ a[dp[i][1]]);
        writeln(ans[i]);
    }

}




































void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


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

int main()
{

	while(true){

		int t;
		int count = 0;

		cin >> t;
		if(t==0)
			break;

		t = 1000-t;

		count += t/500;
		t = t-500*(t/500);

		count += t/100;
		t = t-100*(t/100);

		count += t/50;
		t = t-50*(t/50);

		count += t/10;
		t = t-10*(t/10);

		count += t/5;
		t = t-5*(t/5);

		count += t;

		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
    int a[4], b[4];
    while (scanf("%d", a) != EOF) {
        rep (i, 3) scanf("%d", a+i+1);
        rep (i, 4) scanf("%d", b+i);
        int h = 0, k = 0;
        rep (i, 4) if (a[i] == b[i]) h++;
        rep (i, 4) rep (j, 4) if (a[i] == b[j]) k++;
        printf("%d %d\n", h, k-h);
    }
    return 0;
}

Measured memory_bytes: 0
n, k = map(int, input().split())
r, s, p = map(int, input().split())
score = {'r': p, 's': r, 'p': s}
t = list(input())

ans = 0
for i in range(k):
    # print(i, score[t[i]], ans)
    ans += score[t[i]]
    j = i + k
    f = 0
    while j < n:
        if t[j] != t[j - k]:
            ans += score[t[j]]
            # print(j, score[t[j]], ans)
        else:
            t[j] = '-'
        j += k
    # print(ans)

print(ans)


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

int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0; i<n;i++) cin>>a[i];
  sort(a.begin(),a.end());
  int count = 0;
  for(int i=0; i<n;i++)
  {
    for(int j=i+1; j<n;j++)
    {
      for(int k=j+1; k<n; k++)
      {
        if(a[i] + a[j] > a[k]) count++;
      }
    }
  }
  cout<<count;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
#define R(i,n) for(int i = 1; i<=n; i++)
typedef long long ll;
using namespace std;

int main(){
  int n,m,x,count=0;
  cin >> n >> m >> x;
  vector<int> v(m,0);
  r(i,m){
    cin >> v.at(i);
    if(v.at(i)<x)count++;
  }
  cout << min(count,m-count)<<endl;  
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){

  int a;
  cin >> a;
  while(a != 0){
    
    int coin = 0;
    a = 1000-a;

    if(a>=500){
      coin++;
      a-=500;
    }
    while(a>=100){
      coin++;
      a -= 100;
    }
    if(a>=50){
      coin++;
      a-=50;
    }
    while(a>=10){
      coin++;
      a-=10;
    }
    if(a>=5){
      coin++;
      a-=5;
    }
    cout << coin+a << endl;
    cin >> a;
  }

  return (0);
}

Measured memory_bytes: 2976
using System;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int N = sc.NextInt();
        int M = sc.NextInt();
        int[] C = sc.IntArray();
        var dp = new int[N + 1];
        Array.Sort(C);
        for (int i = 1; i <= N; i++)
        {
            dp[i] = int.MaxValue;
        }

        foreach (int i in C)
        {
            for (int j = 0; j + i <= N; j++)
            {
                dp[j + i] = Math.Min(dp[j + i], dp[j] + 1);
            }
        }
        Console.WriteLine(dp[N]);
    }


    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}


class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}


Measured memory_bytes: 15984
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <functional>
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using namespace std;
int main() {
	ll n, m, ans = 0, A[10101];
	cin >> n >> m;
	if (n > 8 || m > 8)
		cout << ":(" << endl;
	else
		cout << "Yay!" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    cin>>n;
    int i,j,ar[n][3];
    for(i=0;i<n;i++)
    {
        cin>>ar[i][0]>>ar[i][1]>>ar[i][2];
        if(i==0)
        {
            continue;
        }
        ar[i][0]+=max(ar[i-1][1],ar[i-1][2]);
        ar[i][1]+=max(ar[i-1][0],ar[i-1][2]);
        ar[i][2]+=max(ar[i-1][0],ar[i-1][1]);
    }
    cout<<max(ar[n-1][0],max(ar[n-1][1],ar[n-1][2]));
	return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>
int main(){
	int d,n,i,c,catX,catY,campusX,campusY,campusW,campusH;
	scanf("%d",&d);
	for(;d>0&&scanf("%d %d %d %d",&campusX,&campusY,&campusW,&campusH);d--){
		c=0;
		scanf("%d",&n);
		for(i=0;i<n&&scanf("%d %d",&catX,&catY);i++){
			if((campusX<=catX&&campusX+campusW>=catX)
					&&(campusY<=catY&&campusY+campusH>=catY)){
				c++;
			}
		}
		printf("%d\n",c);
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin >> s;
    if (s.length() == 2 && s[0] == s[1]) {
        cout << "1 2";
        return 0;
    }
    for (int i = 0; i + 2 < s.length(); ++i) {
        if (s[i] == s[i + 1] || s[i + 1] == s[i + 2] || s[i] == s[i + 2]) {
            cout << i + 1 << ' ' << i + 3;
            return 0;
        }
    }
    cout << "-1 -1";
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define ALL(v) (v).begin(),(v).end()
#define REP(i, x, n) for(ll (i)=(x); (i)<(n); (i)++)
#define RREP(i, x, n) for(ll (i)=(n)-1; (i)>=x; (i)--)
#define FOR(i, n) for(ll (i)=0; (i)<(n); (i)++)
#define RFOR(i, n) for(ll (i)=(n)-1; (i)>=0; (i)--)

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

        ll X, Y;
        cin >> X >> Y;
        if (Y % 2 == 0 && 0 <= Y / 2 - X && 0 <= 2 * X - Y / 2) cout << "Yes" << endl;
        else cout << "No" << endl;

        return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define vi vector <int>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin>>n;
	if(n<600) cout<<8;
	else if(n<800) cout<<7;
	else if(n<1000) cout<<6;
	else if(n<1200) cout<<5;
	else if(n<1400) cout<<4;
	else if(n<1600) cout<<3;
	else if(n<1800) cout<<2;
	else cout<<1;


	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;
int m, a, b, tp[50000];
vi p;
int getPrime(int sp){
  int k[3] = {100, 10, 1};
  int w = 0;
  rep(i, 3){
    for(int j = w; j < (int)p.size(); j+=k[i]){
      if(sp < p[j]) break;
      if(p[j]*sp <= m) w = j;
      else break;
    }
  }
  return p[w];
}
int main(){
  tp[0] = tp[1] = 1;
  REP(i, 2, 50000){
    if(tp[i]) continue;
    for(int j = i+i; j < 50000; j += i) tp[j] = 1;
  }
  rep(i, 50000){
    if(tp[i]) continue;
    p.PB(i);
  }
  while(scanf("%d%d%d", &m, &a, &b) && m){
    int resq = 0, resp = 0;
    for(int i = 0; i < p.size() && p[i] * 2 <= m; i++){
      int tq = p[i];
      int tp = getPrime(tq);
      if((double)a/(double)b > (double)tp/(double)tq) continue;
      if(resq * resp > tp * tq) continue;
      resq = tq;
      resp = tp;
    }
    printf("%d %d\n", resp, resq);
  }
}


Measured memory_bytes: 3456
#include <iostream>
#include <sstream>
#include <vector>
using namespace std;
int main(void){
  int a, b, n;
  bool sim = false;
  string s;
  cin >> s;
  
  if(s.at(2) == s.at(3) && s.at(4) == s.at(5)) sim = true;
  
  if(sim) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1};
int dy[8] = {1, 0, -1, 1, -1, 1 ,0 ,-1};
lli repow(lli n,lli k,lli m){
  if(k==0)return 1;
  if(m==0)return 0;
  else if(k%2==1)return repow(n,k-1,m)*n%m;
  else{
    lli temp=repow(n,k/2,m);
    return temp*temp%m;
  }
}
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N;
  HpOut(M_PI*2*N);
}

Measured memory_bytes: 3840
import sys
input = sys.stdin.readline
A, B, C = [int(x) for x in input().split()]
AmodB = A % B
if AmodB == 0:
    if C == 0:
        print("YES")
        sys.exit()
    else:
        print("NO")
        sys.exit()

mod = [AmodB]
i = AmodB
while True:
    if C in mod:
        print("YES")
        sys.exit()
    i += AmodB
    i %= B
    if i in mod:
        print("NO")
        sys.exit()
    else:
        mod.append(i)

Measured memory_bytes: 3064
N, Y = map(int, input().split())
Y /= 1000
x = 10
y = 5
z = 1
for i in range(N+1):
    for j in range(N+1):
        if x*i+y*j+(N-i-j) == Y and i+j <= N:
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = Integer.parseInt(sc.next());
        switch (d){
            case 22:
                System.out.println("Christmas Eve Eve Eve");
                break;
            case 23:
                System.out.println("Christmas Eve Eve");
                break;
            case 24:
                System.out.println("Christmas Eve");
                break;
            case 25:
                System.out.println("Christmas");
                break;
        }
    }
}

Measured memory_bytes: 21972
#include <iostream>
using namespace std;
typedef long long ll;

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


int main()
{
    ll nin , h , n , w ;
    cin >> nin;
    ll t1 , t2 , t3;
    for(ll i = 1 ; i <= 3500 ; i++){
        for(ll j = 1 ; j <= 3500 ; j++){
            t1 = nin * i * j ;
            t2 = 4 * i * j - nin * i - nin * j;
            if(t2 > 0 && t1 >= t2){
                if(t1 % t2 == 0){
                    t3 = t1 / t2; 
                    cout << i << " " << j << " " << t3 << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}


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

int main() {
  long long n,a,b;
  cin>>n>>a>>b;
  if((b-a)%2==0){
    cout<<(b-a)/2<<endl;
  }
  else{
    cout<<min(a+(b-a-1)/2,n-b+1+(n-(a+n-b+1))/2)<<endl;
  }
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


int main() {
    int A,B; cin >> A >> B;
    string S; cin >> S;

    REP(i,S.size()){
        if(i==A && S[i]!='-'){
            cout << "No" << endl;
            return 0;
        }
        if(i!=A && S[i]=='-'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;

#define al 26

int main()
{
	ll n;
	cin >> n;

	string s = "";

	ll a = al;
	int cnt = 1;

	while (n - a > 0)
	{
		n -= a;
		cnt++;
		a *= al;
	}

	a /= al;
	n--;

	for (int i = 0; i < cnt; i++)
	{
		char d = (char)(n / a) + 'a';
		s = s + d;
		n %= a;
		a /= al;
	}

	cout << s;
}


Measured memory_bytes: 3600