akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

ll calc(ll n, ll x, ll m) {
    ll ansh = 0;
    vector<ll> a(n);
    a[0] = x;
    rep(i,n) a[i+1] = (a[i]*a[i])%m;
    rep(i,n) ansh += a[i];
    return ansh;
}

int main(int argc, char const *argv[]) {
    ll n,x,m; cin>>n>>x>>m;

    if (n < 20000001) {
        cout << calc(n,x,m) << '\n';
        return 0;
    }

    vector<ll> a(2000001);
    vector<int> cnt(200001, -1);
    vector<ll> c;
    ll start = 0;
    a[0] = x;
    for (int i = 0; i < 2000001; ++i) {
        a[i+1] = (a[i]*a[i])%m;
        if (cnt[a[i]] != -1) {
            start = cnt[a[i]];
            for (int j = cnt[a[i]]; j < i; ++j) {
                c.push_back(a[j]);
            }
            break;
        }
        cnt[a[i]] = i;
    }

    ll ans = 0;
    ll tmp = 0;
    ll cy = c.size();
    for (auto &&e: c) tmp += e;
    ll nn = n-start;
    ll beet = nn/cy;
    ans += tmp*beet;
    ll usi = nn%cy;
    for (int i = 0; i < usi; ++i) ans += c[i];
    for (int i = 0; i < start; ++i) ans += a[i];
    cout << ans << '\n';

    return 0;
}

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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

string query(int i) {
    cout << i << endl << flush;
    string s;
    cin >> s;
    return s;
}

int main() {
    int N;
    cin >> N;
    int s = 0, t = N;
    string ss = query(s);
    bool ok = false;
    rep(i, 18) {
        // cout << t << ", " << s << endl;
        int m = (t + s) / 2;
        auto ms = query(m);
        if (ms == "Vacant") {
            ok = true;
            break;
        }
        if ((s % 2 == m % 2) ^ (ms == ss)) {
            t = m;
        } else {
            s = m;
            ss = ms;
        }
    }
    // assert(!ok);
    if (!ok) query(t);

    return 0;
}


Measured memory_bytes: 852
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int ok(int n){
	if(n < 2)return 0;
	for(int i = 2 ; i*i <= n ; i++){
		if(n % i == 0) return 0;
	}
	return 1;
}
int main(){
	int n;
	while(cin >> n,n){
		set<int> r;
		for(int i = 1 ; i < n ; i++) r.insert((i*i)%n);
		vector<int> wow;
		for(set<int>::iterator it = r.begin() ; it != r.end() ; ++it)
			wow.push_back(*it);
		int mp[10001]={0};
		for(int i = 0 ; i < wow.size() ; i++){
			for(int j = 0 ; j < wow.size() ; j++){
				if( i == j) continue;
				int g = wow[i] - wow[j];
				if(g < 0) g += n;
				if(g > (n-1)/2) g = n - g;
				mp[g]++;
			}
		}
		for(int i = 1 ; i <= (n-1)/2 ; i++)
			cout << mp[i] << endl;
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h, w;
    cin >> h >> w;
    string s[h], a[h], b[h];
    for(int i=0;i<h;i++){
    	cin >> s[i];
    	a[i] = "";
    	b[i] = "";
    	for(int j=0;j<w;j++) a[i] += ".", b[i] += ".";
    }
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		if(j == 0){
    			a[i][j] = '#';
    		}else if(j == w - 1){
    			b[i][j] = '#';
    		}else if(i&1){
    			b[i][j] = '#';
    		}else{
    			a[i][j] = '#';
    		}
    	}
    }
    for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
    		if(s[i][j] == '#') a[i][j] = b[i][j] = '#';
    	}
    }
    for(int i=0;i<h;i++){
    	cout << a[i] << endl;
    }
    cout << endl;
    for(int i=0;i<h;i++){
    	cout << b[i] << endl;
    }
    return 0;
}


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

using namespace std;

int main()
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    string ans;
    ans+= "A";
    ans+= s2[0];
    ans+= "C";
    cout << ans;
    return 0;
}


Measured memory_bytes: 3624
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int t = Integer.parseInt(bf.readLine());
 		out.println((double)(t)*2*Math.PI);
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 25464
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

string ULtoD(string s){
  stringstream ss;
  ss << (char)tolower(s[0]);
  FOR(i, 1, s.length()){
    if(isupper(s[i])) ss << '_' << (char)tolower(s[i]);
    else ss << (char)tolower(s[i]);
  }
  return ss.str();
}

string DtoUL(string s, char t){
  stringstream ss;
  ss << (char)(t == 'U' ? toupper(s[0]) : s[0]);
  FOR(i, 1, s.length()){
    if(s[i] == '_') ss << (char)toupper(s[++i]);
    else ss << s[i];
  }
  return ss.str();
}

int main() {
  string s; char t;
  while(cin >>s >>t && t != 'X'){
    char bt;
    if(isupper(s[0])) bt = 'U';
    else if(s.find('_') != string::npos) bt = 'D';
    else bt = 'L';
    if(bt == 'U'){
      if(t == 'L') s[0] = tolower(s[0]);
      if(t == 'D') s = ULtoD(s);
    } else if(bt == 'L'){
      if(t == 'U') s[0] = toupper(s[0]);
      if(t == 'D') s = ULtoD(s);
    } else if(t != 'D') s = DtoUL(s, t);
    cout <<s <<endl;
  }
  return 0;
}

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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef long long lli;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<ll, str>> vpls;
typedef vector<tuple<str, ll, ll>> vtsl;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//実行部
void Main()
{
  ll n, k; cin >> n >> k;
  ll ans = 1;
  for(ll i = 0;i < n;i++)
  {
    ans = min(ans + k, ans * 2);
  }
  fin(ans)
}

//前処理
int main()
{
  //ios::sync_with_stdio(false);
  //cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}


Measured memory_bytes: 256
N, L = map(int, input().split())

zero_apple = 100000
for i in range(1, N + 1):
    if abs(L + i - 1) < zero_apple:
        zero_apple = abs(L + i - 1)
        ind = i

taste = 0
for k in range(1, N + 1):
    if k != ind:
        taste += L + k - 1
print(taste)

Measured memory_bytes: 38384
from itertools import accumulate


def solve(n, k, ppp, ccc):
    NINF = -(10 ** 18)
    ans = NINF

    checked = [False] * n
    for s in range(n):
        if checked[s] == True:
            continue
        checked[s] = True
        scores = [ccc[ppp[s]]]
        starts = [s]
        v = ppp[s]
        while v != s:
            scores.append(ccc[ppp[v]])
            starts.append(v)
            checked[v] = True
            v = ppp[v]

        l = len(scores)
        d, m = divmod(k, l)
        loop = sum(scores)

        if d > 0:
            d -= 1
            m += l

        base = max(0, loop * d)

        for s in starts:
            v = ppp[s]
            score = base + ccc[ppp[s]]
            best_score = score
            for _ in range(m - 1):
                score += ccc[ppp[v]]
                v = ppp[v]
                best_score = max(best_score, score)
            ans = max(ans, best_score)

    return ans


n, k = map(int, input().split())
ppp = list(map(int, input().split()))
ppp = [p - 1 for p in ppp]
ccc = list(map(int, input().split()))

print(solve(n, k, ppp, ccc))


Measured memory_bytes: 74584
//
//  main.cpp
//  At_coder
//
//  Created by 坂本吉 on 2018/09/03.
//  Copyright © 2018年 坂本吉. All rights reserved.
//  contest 9/1 A-Pair

#include <iostream>

using namespace std;
int K;//入力

int n;

int N;//出力

int main() {
    
    cin>>K;
    
    if (K%2==0){
        n=(K/2);
        
        N=n*n;
    }
    else {
        n=(K-1)/2;
        N=n*(n+1);
    }
    
    std::cout <<N<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int m;
	cin>>s;
	for(int i=1;i<s.size();i++){
		m=s.size()-2*i;
		for(int j=0;j<m/2;j++){
			if(j==(m/2)-1){
					cout<<m<<endl;
					return 0;
				}
			if(s.at(j)==s.at((m/2)+j)){
				continue;
			}
			break;
		}
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int count = 0;
	char S[3], T[3];
	cin >> S[0] >> S[1] >> S[2];
	cin >> T[0] >> T[1] >> T[2];
	for (int i = 0; i < 3; i++) {
		if (S[i] == T[i]) count++;
	}

	cout << count;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long ll;

int main(){
  int N, C, D[30][30], c[500][500];
  int mod[3][30];
  scanf("%d%d", &N, &C);
  for (int i = 0; i < C; i++)
    for (int j = 0; j < C; j++)
      scanf("%d", &D[i][j]);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      scanf("%d", &c[i][j]);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++)
      mod[(i+j)%3][c[i][j]-1]++;
  int ans = 1000000000;
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      if (i == j) continue;
      for (int k = 0; k < C; k++) {
        if (i == k || j == k) continue;
        int temp = 0;
        for (int x = 0; x < C; x++) temp += D[x][i] * mod[0][x];
        for (int x = 0; x < C; x++) temp += D[x][j] * mod[1][x];
        for (int x = 0; x < C; x++) temp += D[x][k] * mod[2][x];
        ans = min(ans, temp);
      }
    }
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 1152
// abc141_e
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;


template <typename T=long long, T base1=1009, T base2=1007, T mod1=1000000007, T mod2=1000000009>
struct RollingHash {
    using hash_type = pair<T,T>;
    vector<T> hash1, hash2;
    vector<T> pow1, pow2;

    explicit RollingHash(const string &s) {
        auto n = (int)s.size();

        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        pow1.assign(n+1,1);
        pow2.assign(n+1,1);

        for(int i=0;i<n;i++) {
            hash1[i+1] = (hash1[i] * base1 + s[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + s[i]) % mod2;
            pow1[i+1] = pow1[i] * base1 % mod1;
            pow2[i+1] = pow2[i] * base2 % mod2;
        }
    }

    hash_type get(int l,int r) {
        T t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
        T t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
        return make_pair(t1, t2);
    }

    // ハッシュ値がh1の文字列の末尾に、長さh2_lenでハッシュ値がh2をくっつけた文字列のハッシュ値
    hash_type concat(hash_type h1, hash_type h2, int h2_len) {
        assert(h2_len < pow1.size());
        T t1 = (h1.first * pow1[h2_len] + h2.first) % mod1;
        T t2 = (h2.first * pow2[h2_len] + h2.first) % mod2;
        return make_pair(t1, t2);
    }
};


bool is_valid(int len, int N, RollingHash<>& rHash){

    REP(i, N-2*len+1) REPN(j, i+len, N-len+1){
        if (rHash.get(i, i+len) == rHash.get(j, j+len)){
            return true;
        }
    }
    return false;
}

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    string S;
    cin >> S;

    auto rHash = RollingHash<>(S);

    int ok = 0;
    int ng = N;
    while (ng - ok > 1){

        int len = (ok + ng) / 2;

        if (is_valid(len, N, rHash)){
            ok = len;
        } else {
            ng = len;
        }
    }
    print(ok);

    return 0;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  long long k, a, b;
  cin >> k >> a >> b;
  if (a >= k) {
    cout << 1 << '\n';
  } else {
    if (a > b) {
      cout << (k - a + (a - b) - 1) / (a - b) * 2 + 1 << '\n';
    } else {
      cout << -1 << '\n';
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back

#define ll __int64
#define P pair<ll,ll>
//#define __int64 long long

int n;
int p[111111];
bool ok[111111];
int ans;
int main(){	
	cin>>n;
	rep(i,n)cin>>p[i];
	rep(i,n)p[i]--;

	rep(i,n-1){
		if(i==p[i]&&i+1==p[i+1]&&!ok[i]&&!ok[i+1])ok[i]=ok[i+1]=1,ans++;
	}

	rep(i,n){
		if(p[i]==i&&!ok[i])ans++;
	}
	cout<<ans<<endl;
	return 0;
}


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

set <int> S;

int main()
{
    int n,x;
    cin >> n;
    for(int i = 0 ; i < n ; i++)
    {
        cin >> x;
        S.insert(x);
    }
    cout << S.size() + S.size()%2 -1 << endl;
    return 0;
}


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

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto X = RD;
	auto A = RD;
	auto B = RD;

	writeln(B <= A ? "delicious" : B - A <= X ? "safe" : "dangerous");
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
/* Accepted. */
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;
#define MAXN 106
int n , m;
int cur , old , ans , last;
int main() {
	//freopen("input","r",stdin);
	cin >> n;
	for( int i = 0 ; i < n ; ++ i ) {
		scanf("%d",&cur);
		if( cur == old ) ++ last;
		else ans += last / 2 , last = 1;
		old = cur;
	}
	ans += last / 2;
	cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;

const ll mod = 1000000007;
const int N = 5e5+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
bool is_prime[N];
void sieve(int n)  //埃氏筛，筛出小于等于n的所有素数并返回个数
{
    int p=0;  //记录个数
    for(int i=0;i<=n;i++)
        is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    
    for(int i=2;i<=n;i++)
    {
        if(is_prime[i])
        {
            for(int j=2*i;j<=n;j+=i)
                is_prime[j]=false;
        }
    }
}
int n;
int main() {
	sieve(N-1);
	while(~scanf("%d", &n)) {
		rep(i, n, N) if(is_prime[i]) {
			printf("%d\n",i);
			break;
		}
	}
    return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)

typedef struct {
	int L;
	int R;
}pair;

signed compair(const void *a, const void *b){
	int sub = (((pair *)a)->L + ((pair *)a)->R) - (((pair *)b)->L + ((pair *)b)->R);
	if(sub > 0){
		return -1;
	}
	else if(sub == 0){
		return 0;
	}
	else{
		return 1;
	}
}

int min(int a, int b){
	return a <= b ? a : b;
}

signed main(){
	int N, i, j, k, l;
	scanf("%lld", &N);
	pair *ps = (pair *)malloc(sizeof(pair) * N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &ps[i].L, &ps[i].R);
	}
	qsort(ps, N, sizeof(pair), compair);
	int ***dp = (int ***)malloc(sizeof(int **) * (N / 2 + 2));
	for(i = 0; i <= N / 2 + 1; i++){
		dp[i] = (int **)malloc(sizeof(int *) * (N / 2 + 2));
		for(j = 0; j <= N / 2 + 1; j++){
			dp[i][j] = (int *)malloc(sizeof(int) * (N % 2 + 1));
			for(k = 0; k <= N % 2; k++){
				dp[i][j][k] = inf;
			}
		}
	}
	dp[0][0][0] = 0;
	for(i = 0; i <= N / 2; i++){
		for(j = 0; j <= N / 2; j++){
			for(k = 0; k <= N % 2; k++){
//				printf("(i, j, k) = (%lld, %lld, %lld)\n", i, j, k);
//				printf("dp = %lld\n", dp[i][j][k]);
				l = i + j + k;
				if(l >= N){
					continue;
				}
				dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k] + i * (ps[l].L + ps[l].R) + ps[l].R);
//				printf("test\n");
				dp[i][j + 1][k] = min(dp[i][j + 1][k], dp[i][j][k] + j * (ps[l].L + ps[l].R) + ps[l].L);
//				printf("dp2 = %lld\n", dp[i][j + 1][k]);
				if(k == 0 && N % 2 == 1 && l < N){
					dp[i][j][1] = min(dp[i][j][1], dp[i][j][0] + (N / 2) * (ps[l].L + ps[l].R));
//					printf("dp3 = %lld\n", dp[i][j][1]);
				}
			}
		}
	}
/*	for(i = 0; i < N; i++){
		for(j = 0; j < N; j++){
			for(k = 0; k <= N % 2; k++){
				printf("dp[%lld][%lld][%lld] = %lld\n", i, j, k, dp[i][j][k]);
			}
		}
	}
*/	printf("%lld\n", dp[N / 2][N / 2][N % 2]);
	return 0;
}

Measured memory_bytes: 244860
// デバッグ実行：Ctrl+F5

using System;

class Program
{
    static void Main(string[] args)
    {
        String line;
        line = Console.ReadLine();
        String[] words = line.Split(' ');
        int N, M;
        N = int.Parse(words[0]);
        M = int.Parse(words[1]);
        int max = M / N;
        for (int i = max; i > 0; i--)
        {
            if (M % i == 0 && M / i >= N)
            {
                Console.WriteLine(i);
                break;
            }
        }

    }
}

Measured memory_bytes: 13140
#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++)
typedef int64_t Int;

int main(){ 
  Int N, K;
  cin >> N >> K;
  
  Int ans = K;
  rep(i, N-1) {
    ans *= (K-1);
  }
  
  cout << ans << endl;

}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	
    public static void main(String[] args) {
    	FastScanner sc = new FastScanner();
    	String a = sc.next();
    	int count = 0;
    	for(char x:a.toCharArray()){
    		if(x=='1'){
    			count += 1;
    		}
    	}
    	System.out.println(count);
    }
    
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public 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 long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 20564
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;
#define EPS 1e-10
#define equals(a,b) (fabs((a)-(b)) < EPS)
//???
class Point{
	public:	
		double x,y;
		Point(double x = 0,double y = 0):x(x),y(y){}
		//?????????
		Point operator + (Point p) { return Point(x + p.x,y + p.y);}
		Point operator - (Point p) { return Point(x - p.x,y - p.y);}
		Point operator * (double a) { return Point(x*a,y*a);}
		Point operator / (double a) { return Point(x/a,y/a);}
		//???????????¨??§??????
		double abs() {return sqrt(norm());}
		double norm() {return x*x+y*y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}
		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};
//??????
struct Segment{Point p1,p2;};
//????????????
typedef Point Vector;
//??´???
typedef Segment Line;
//???
class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(),double r = 0.0): c(c),r(r){}
};
//????§???¢
//typedef Vector<Point> Polygon;
//????????¨??????
double dot(Vector a,Vector b){
	return a.x*b.x + a.y*b.y;
}
double cross(Vector a,Vector b){
	return a.x*b.y - a.y*b.x;
}

bool isOrtho(Vector a,Vector b){
	return equals(dot(a,b),0.0);
}

bool isPara(Vector a,Vector b){
	return equals(cross(a,b),0.0);
}

int main(){
	int n;
	cin >> n;
	int x0,y0,x1,y1,x2,y2,x3,y3;
	for(int i = 0;i < n;i++){
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		Vector a(x1-x0,y1-y0);
		Vector b(x3-x2,y3-y2);
		if(isOrtho(a,b)){
			cout << 1 << endl;
		}else if(isPara(a,b)){
			cout << 2 << endl;
		}else{
			cout << 0 << endl;
		}
	}
	return 0;
}

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

int MAX = 100001;
int MOD = 1000000007;
vector<long long> fac(MAX), finv(MAX), inv(MAX);

void COMinit() {
  fac.at(0) = fac.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inv.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fac.at(i) = fac.at(i-1) * i % MOD;
    inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i-1) * inv.at(i) % MOD;
  }
}

long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac.at(n) * (finv.at(k) * finv.at(n-k) % MOD) % MOD;
}

int main() {
  int N, K; cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());

  long long ans = 0;
  COMinit();
  for (int i = N-1; i >= K-1; i--) {
    ans = (ans + COM(i, K-1) * A.at(i) % MOD + MOD) % MOD;
  }
  for (int i = 0; i <= N-K; i++) {
    ans = (ans - COM(N-1-i, K-1) * A.at(i) % MOD + MOD) % MOD;
  }
  cout << ans << endl;
}

Measured memory_bytes: 2944
#include <stdio.h>
#include <stdlib.h>
#define MAX 100005
#define NIL -1

typedef struct{
  int p,l,r;
} Node;

Node T[MAX];
int n,D[MAX];

void print(int);
int rec(int, int);

int main(){
  int i,j,d,v,c,l,r;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    T[i].p=T[i].l=T[i].r=NIL;
  }
  for(i=0; i<n; i++){
    scanf("%d%d", &v, &d);
    for(j=0; j<d; j++){
      scanf("%d", &c);
      if(j==0)T[v].l=c;
      else T[l].r=c;
      l=c;
      T[c].p=v;
    }
  }
  for(i=0; i<n; i++){
    if(T[i].p == NIL)r = i;
  }
  rec(r, 0);
  for(i=0; i<n; i++)print(i);
  return 0;
}

int rec(int u, int p){
  D[u]=p;
  if(T[u].r != NIL)rec(T[u].r,p);
  if(T[u].l != NIL)rec(T[u].l, p+1);
}

void print(int u){
  int i,c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);
  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for(i=0, c=T[u].l; c!=NIL; i++, c=T[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}








Measured memory_bytes: 6420
def affine(s,j,k):
    s1=""
    for c in s:
        if c.isalpha():
            s1+=chr((j*(ord(c)-ord("a"))+k)%26+ord("a"))
        else:
            s1+=c
    return s1

n=input()
for i in range(n):
    s=raw_input()
    this,that="this","that"

    for j in range(26):
        for k in range(26):
            t=affine(s,j,k)
            if (this in t) or (that in t):
                print t
                break

Measured memory_bytes: 4240
import math

mod = 10 ** 9 + 7
N = int(input())

def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]
    
d = {}
P = primes(N + 1)

for p in P:
    d[p] = 0
    k = p
    while k <= N:
        d[p] += N // k
        k *= p

res = 1
for v in d.values():
    res *= v + 1
    
res %= mod
print(res)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main() {
    char *s = (char *)malloc(sizeof(char)*200100);
    fgets(s, 200100, stdin);
    long int len_s = strlen(s);
    if (s[len_s-1] == '\n') {
        len_s--;
    }
    long long int ans = 0;
    long int *count_a = (long int *)malloc(sizeof(long int)*200000);
    for (long int i=0; i<200000; i++) {
        count_a[i] = 0;
    }
    long int now = 0;
    bool flag_b = false, flag_c = false, flag_bc = false;
    for (long int i=0; i<len_s; i++) {
        if (s[i] == 'A') {
            if ((flag_b || flag_c) && (!flag_bc)) {
                for (long int j=0; j<=now; j++) {
                    ans = ans + count_a[j] * (now - j);
                    count_a[j] = 0;
                }
                now = 0;
            }
            count_a[now]++;
            flag_b = flag_c = false;
            flag_bc = false;
        }
        else if (s[i] == 'B') {
            if ((flag_b || flag_c) && (!flag_bc)) {
                for (long int j=0; j<=now; j++) {
                    ans = ans + count_a[j] * (now - j);
                    count_a[j] = 0;
                }
                now = 0;
            }
            flag_b = true;
            flag_c = false;
            flag_bc = false;
        }
        else if (s[i] == 'C') {
            if (flag_b) {
                now++;
                flag_bc = true;
            }
            else {
                for (long int j=0; j<=now; j++) {
                    ans = ans + count_a[j] * (now - j);
                    count_a[j] = 0;
                }
                now = 0;
                flag_bc = false;
            }
            flag_b = false;
            flag_c = true;
        }
    }
    for (long int i=0; i<=now; i++) {
        ans = ans + count_a[i] * (now - i);
    }
    printf("%lld", ans);
    free(s);
    free(count_a);
    return 0;
}


Measured memory_bytes: 1920
N = int(input())
city_list = []
score_list = []
for i in range(N):
    city,score = input().split()
    score = int(score)
    city_list.append(city)
    score_list.append(score)
city_sort = sorted(city_list)
for i in sorted(list(set(city_list))):
    if(city_list.count(i) == 1):
        print(score_list.index(score_list[city_list.index(i)])+1)
    else:
        list_a = []
        len_same_city = city_list.count(i)
        for j in range(len_same_city):
            list_a.append(score_list[city_list.index(i)])
            city_list[city_list.index(i)] = -1
        list_a = sorted(list_a,reverse=True)
        for k in list_a:
            print(score_list.index(k)+1)


Measured memory_bytes: 3064
N = int(input())
A = list(map(int,input().split()))
C = []
D = 0
ans = []

for a in A:
  if a<3200:
    C+=[a//400]
  else:
    D+=1

if D==0:
  ans = [len(set(C)),len(set(C))]
else:
  if len(C)==0:
    ans = [1,D]
  else:
    ans = [len(set(C)),len(set(C))+D]

print(*ans)

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


int main() {
	int N;					// 頂点数
	cin >> N;
	vector<vector<int>> to(N), cost(N);		// グラフ

	for (int i = 0; i < N-1; i++)	{
		// sからtへの辺を張る
		int s, t, w;
		cin >> s >> t >> w;
		s--;
		t--;
		to[s].push_back(t);  cost[s].push_back(w);
		to[t].push_back(s);	 cost[t].push_back(w);  // 無向グラフなので、両方向の辺を張る
	}

	vector<int> ans(N, -1);		// 頂点の色 塗る前:-1, 白:0, 黒:1
	queue<int> q;

	ans[0] = 0;
	q.push(0);

	while (!q.empty())	{
		int v = q.front();
		q.pop();
		for (int i = 0; i < to[v].size(); i++)	{
			int u = to[v][i];
			int w = cost[v][i];
			if (ans[u] != -1)	continue;
			ans[u] = (ans[v] + w) % 2;
			q.push(u);
		}
	}

	for (int i = 0; i < N; i++)
	{
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 11904
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <iostream>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <random>
#include <chrono>
using namespace std;

string s;

int main(){
    cin >> s;
    if(s[2] == s[3] and s[4] == s[5]){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}


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

const int N = 100005;
int n, m, a[N << 1];
int Small (int x, int y, int v) {return a[x] < v && a[y] < v;}
int Great (int x, int y, int v) {return a[x] >= v && a[y] >= v;}

bool exam (int k) {
	if (Small(n, n - 1, k) || Small(n, n + 1, k)) return 0;
	if (Great(n, n - 1, k) || Great(n, n + 1, k)) return 1;
	for (int i = 1; i < n - 1; ++i) {
		if (Small(n - i, n - i - 1, k) || Small(n + i, n + i + 1, k)) return 0;
		if (Great(n - i, n - i - 1, k) || Great(n + i, n + i + 1, k)) return 1;
	}
	return Great(1, 1, k);
}

int main () {
	cin >> n, m = (n << 1) - 1;
	for (int i = 1; i <= m; ++i) scanf("%d", &a[i]);
	int l = 1, r = m, mid, ans;
	while (l <= r) {
		mid = l + r >> 1;
		if (exam(mid)) ans = mid, l = mid + 1;
		else r = mid - 1;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1001001001;

int main(){
    int x, y;
    cin >> x >> y;
    
    int res = INF;
    for(int i = 0; i < 1 << 2; ++i){
        int tx = x;
        int ty = y;
        
        int temp = 0;
        if(i & 1){
            tx = -tx;
            temp++;
        }
        if((i >> 1) & 1){
            ty = -ty;
            temp++;
        }
        
        if(tx > ty)       continue;
        temp += ty - tx;
        res = min(res, temp);
    }
    
    cout << res << endl;
}

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

using namespace std;

int main() {
	int N, x, a[110] = {}, max=0;

	cin >> N >> x;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a, a + N);

	for (int i = 0; i < N; i++) {
		x -= a[i];
		if (x < 0) {
			max = i;
			break;
		}
		else if (x == 0) {
			max = i + 1;
		}
		else {
			max = i;
		}
	}
	cout << max << endl;
	return 0;
}

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

/* Following function is needed for library function
qsort(). Refer
http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/ */
int comp(const void* a, const void* b)
{ return *(int*)a > *(int*)b ; }

// Function to count all possible triangles with arr[]
// elements
int findNumberOfTriangles(int arr[], int n)
{
    // Sort the array elements in non-decreasing order
    qsort(arr, n, sizeof( arr[0] ), comp);

    // Initialize count of triangles
    int count = 0;

    // Fix the first element. We need to run till n-3
    // as the other two elements are selected from
    // arr[i+1...n-1]
    for (int i = 0; i < n - 2; ++i)
    {
        // Initialize index of the rightmost third
        // element
        int k = i + 2;

        // Fix the second element
        for (int j = i + 1; j < n; ++j)
        {
            // Find the rightmost element which is
            // smaller than the sum of two fixed elements
            // The important thing to note here is, we
            // use the previous value of k. If value of
            // arr[i] + arr[j-1] was greater than arr[k],
            // then arr[i] + arr[j] must be greater than k,
            // because the array is sorted.
            while (k < n && arr[i] + arr[j] > arr[k])
            ++k;

            // Total number of possible triangles that can
            // be formed with the two fixed elements is
            // k - j - 1. The two fixed elements are arr[i]
            // and arr[j]. All elements between arr[j+1]/ to
            // arr[k-1] can form a triangle with arr[i] and arr[j].
            // One is subtracted from k because k is incremented
            // one extra in above while loop.
            // k will always be greater than j. If j becomes equal
            // to k, then above loop will increment k, because arr[k]
            // + arr[i] is always greater than arr[k]
            if(k > j)
            count += k - j - 1;
        }
    }

    return count;
}

// Driver code
int main()
{
    int arr[200005],a;
    //int size = sizeof( arr ) / sizeof( arr[0] );
  cin>>a;
  for(int i=0; i<a; i++)
  {
      cin>>arr[i];
  }
    cout<<findNumberOfTriangles( arr, a )<<endl;

    return 0;
}


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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

ll s[100000];
ll t[100000];
ll ans[100000];

ll solve(ll value, ll * target, ll * oppo, int size)
{
	ll sum = 0;
	ll* n_left, * n_right;
	ll fvisit = *target;

	sum = abs(value - fvisit);

	n_right = lower_bound(oppo, oppo + size, fvisit);
	if (n_right != oppo) {
		n_left = n_right - 1;
		sum += min(abs(*n_right - fvisit), abs(fvisit - *n_left));
	}
	else sum += abs(oppo[0] - fvisit);

	return sum;
}

int main()
{
	int A, B, Q;

	cin >> A >> B >> Q;
	rep(i, A) cin >> s[i];
	rep(i, B) cin >> t[i];
	rep(i, Q) {
		ll x, tmp = (ll)1e15;
		ll* s_left, * s_right;
		ll* t_left, * t_right;

		cin >> x;

		s_right = lower_bound(s, s + A, x);
		if (s_right != s) s_left = s_right - 1;

		t_right = lower_bound(t, t + B, x);
		if (t_right != t) t_left = t_right - 1;

		if (s_right != s) tmp = min(tmp, solve(x, s_left, t, B));
		if (s_right != s + A) tmp = min(tmp, solve(x, s_right, t, B));
		if (t_right != t) tmp = min(tmp, solve(x, t_left, s, A));
		if (t_right != t + B) tmp = min(tmp, solve(x, t_right, s, A));

		ans[i] = tmp;
	}

	rep(i, Q) cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 3712
n,y=list(map(int,input().split()))
q=-1
w=-1
e=-1
for i in range(n+1):
    for u in range(n+1):
        o=n-i-u
        if o>=0 and (10*i+5*u+1*o)==y/1000:
            q=i
            w=u
            e=o
print(q," ",w," ",e)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[][] pos = new int[n][2];
		for(int i=0; i<n; i++) {
			pos[i][0] = sc.nextInt();
			pos[i][1] = sc.nextInt();
		}
		double sum = 0;
		int branch = 0;
		
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				sum += calcLength(pos[i], pos[j]);
				branch ++;
			}
		}
		
		System.out.println(sum/branch * (n-1));
		
	}
	
	public static double calcLength(int[] from, int[] to) {
		return Math.sqrt(Math.pow(from[0]-to[0], 2) + Math.pow(from[1]-to[1], 2));
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define sort_u(x) sort((x).begin(),(x).end())
#define sort_d(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
#define INF ((1LL<<62)-(1LL<<31))  // 浮動小数点型
#define bit(n,m)(((n)>>(m))&1)  // nのmビット目が1
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main() {
    string s; cin >> s;
    ll sum = 0;
    for(char c : s){
        sum += c - '0';
    }
//    cout << sum << endl;
    if(sum % 9 == 0 || sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


/*
g++ b.cpp
./a.out

oj d
oj t
*/


Measured memory_bytes: 3736
package main

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

// define
var (
	sc = bufio.NewScanner(os.Stdin)
)

func bordersInt(in_map [][]int, invalid int) [][]int{
	H, W := len(in_map), len(in_map[0])
	out_map := make([][]int, H+2)
	for h:=0; h<H+2; h++ {
		out_map[h] = make([]int, W+2)
		for w:=0; w<W+2; w++ {
			out_map[h][w] = invalid
		}
	}
	for h:=0; h<H; h++{
		for w:=0; w<W; w++{
			out_map[h+1][w+1] = in_map[h][w] 
		}
	}
	return out_map
}

func bordersString(in_map [][]string, invalid string) [][]string{
	H, W := len(in_map), len(in_map[0])
	out_map := make([][]string, H+2)
	for h:=0; h<H+2; h++ {
		out_map[h] = make([]string, W+2)
		for w:=0; w<W+2; w++ {
			out_map[h][w] = invalid
		}
	}
	for h:=0; h<H; h++{
		for w:=0; w<W; w++{
			out_map[h+1][w+1] = in_map[h][w] 
		}
	}
	return out_map
}

func scanIntLine(len int) []int{
	arr := make([]int, len)
	for i:=0; i<len; i++{
		sc.Scan()
		tmp, err := strconv.Atoi(sc.Text())
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func scanStringLine(len int) []string{
	arr := make([]string, len)
	for i:=0; i<len; i++{
		sc.Scan()
		arr[i] = sc.Text()
	}
	return arr
}

func scanIntSplit(len int) []int{
	arr := make([]int, len)
	sc.Scan()
	for i, v := range strings.Split(sc.Text(), " "){
		tmp, err := strconv.Atoi(v)
		if err == nil{
			arr[i] = tmp
		}
	}
	return arr
}

func main(){
	var S, T string
	fmt.Scan(&S)
	fmt.Scan(&T)
	lenS, lenT := len(S), len(T)
	ans_arr := make([]string, lenS)
	first := -1
	for i:=0; i<=lenS-lenT; i++ {
		cnt := 0
		for j:=0; j<lenT; j++ {
			if S[i+j] == T[j]  || S[i+j] == '?' {
				cnt++
			} else {
				break
			}
		}
		if cnt == lenT {
			first = i
		}
	}
	if first == -1 {
		fmt.Println("UNRESTORABLE")
	} else {
		for i:=0; i<lenS; i++ {
			if first <= i && i < first+lenT {
				ans_arr[i] = string(T[i-first])
			} else {
				if S[i] == '?' {
					ans_arr[i] = "a"
				} else {
					ans_arr[i] = string(S[i])	
				}
			}
			
		}
		fmt.Println(strings.Join(ans_arr, ""))
	}
}

Measured memory_bytes: 640
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    print(chr(ord(input())+1))
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38256
// https://atcoder.jp/contests/nomura2020/tasks/nomura2020_a

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll H1, M1, H2, M2, K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;

  ll res = (H2 - H1) * 60 + (M2 - M1) - K;
  cout << res << "\n";
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
string s[12],t;
int r1[100],r2[100],n,x[10],ans,tt;
bool ng[100],used[12];
int ch(){
  int res1=0,res2=0;
  r(i,t.size())res1+=r1[t[i]]*x[i];
  r(i,t.size())res2+=r2[t[i]]*x[i];
  return res1==res2?1:0;
}
int dfs(int d){
  int res=0;
  if(d==tt)return ch();
  r(i,10)if(!used[i]){
    if(!i&&ng[t[d]])continue;
    x[d]=i;
    used[i]=1;
    res+=dfs(d+1);
    used[i]=0;
  }
  return res;
}
int main(){
  while(cin>>n,n){
    memset(used,0,sizeof(used));
    t="";ans=0;
    set<char>se;
    memset(ng,0,sizeof(ng));
    memset(r1,0,sizeof(r1));
    memset(r2,0,sizeof(r2));
    r(i,n)cin>>s[i];
    r(i,10)x[i]=i;
    r(i,n)r(j,s[i].size())if(!se.count(s[i][j]))se.insert(s[i][j]),t+=s[i][j];
    r(i,n)if(s[i].size()>1)ng[s[i][0]]=1;
    r(i,n-1)for(int j=s[i].size()-1,k=0;j>=0;j--,k++)
      r1[s[i][j]]+=pow(10,k);
    for(int j=s[n-1].size()-1,k=0;j>=0;j--,k++)
      r2[s[n-1][j]]+=pow(10,k);
    tt=se.size();
    cout<<dfs(0)<<endl;
  }
}

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

int main()
{
  int a=0,b=0,c=0;
  string s[3];
  cin >> s[0] >> s[1] >> s[2];
  // =====================

  char win;
  char select = 0;
  while (1) {
    if (a > s[0].length()) { win = 'A'; break; }
    else if (b > s[1].length()) { win = 'B'; break; }
    else if (c > s[2].length()) { win = 'C'; break; }
    
    if (select == 0) { select = ((s[0])[a] - 'a'); ++a; }
    else if (select == 1) { select = ((s[1])[b] - 'a'); ++b; }
    else if (select == 2) { select = ((s[2])[c] - 'a'); ++c; }
  }
  
  cout << win << endl;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict, deque


def main():
    N, K, Q = map(int, input().split())
    Score = [0] * N

    for i in range(Q):
        A = int(input())
        Score[A-1] += 1

    for i in range(N):
        if Score[i] > Q - K:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 4956
#include "cstdio"
#include "algorithm"
using namespace std;
int main(){
    int n; scanf("%d",&n);
    int maxx=0,minn=100000;
    for(int i=1;i<=n;i++){
        int a; scanf("%d",&a);
        minn=min(minn,a); maxx=max(maxx,a);
    }
    printf("%d\n",maxx-minn);
    return 0;
}


Measured memory_bytes: 128