akhauriyash/Code-Regression huggingface dataset:
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename T> ll min(ll a, const T&& b) { return a < b ? a : b; }
template<typename T> ll min(const T&& a, ll b) { return a < b ? a : b; }
template<typename T> ll max(ll a, const T&& b) { return a > b ? a : b; }
template<typename T> ll max(const T&& a, ll b) { return a > b ? a : b; }
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
bool solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  cout << solve() << endl;
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

bool solve() {
  ll n; cin >> n;
  ll s1, s2, t1, t2; cin >> s1 >> s2 >> t1 >> t2; --s1, --s2, --t1, --t2;
  string s; cin >> s;
  if (t1 < t2) {
    swap(s1, s2);
    swap(t1, t2);
  }
  assert(t1 > t2);
  ll pos = s1, mode = 0;
  while (pos < t1) {
    if (pos == s2) {
      mode = 1;
    }
    if (pos == t2 && mode == 1) return false;
    if (s[pos+1] == '#') {
      if (s[pos+2] == '#') {
        return false;
      }
      pos = pos+2;
    }
    else {
      if (mode == 1 && pos+2 < n && s[pos+1] == '.' && s[pos+2] == '.') {
        mode = 2;
      }
      if (mode == 0 && pos+1 == s2 && pos+2 < n && s[pos+2] == '.') {
        pos += 2;
      }
      else {
        ++pos;
      }
    }
  }
  pos = s2;
  while (pos < t2) {
    if (s[pos+1] == '#') {
      if (s[pos+2] == '#') return false;
      pos = pos + 2;
    }
    else {
      ++pos;
    }
  }
  return true;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <x86intrin.h>
int main(int argc, char *argv[])
{
    using namespace std;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int max_ = (max(max(a, b), c));

    for (auto i : {a, b, c})
        if (max_ == i)
        {
            cout << a + b + c - i + (max_ << k) << "\n";
          break;
        }
    return 0;
}

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

 
int main () 
{
  int i,a,r,t;
 while(cin>>a,a>0)
 {
  for(i=0;i<9;i++)
  {
   cin>>r;
   a=a-r;
  }
  cout<<a<<'\n';
  if(a==0)
     break;
}
   
  return 0;
}
 

Measured memory_bytes: 1160
import heapq

N,M=map(int,input().split())
A=list(map(int,input().split()))
q = []
for x in A:
    heapq.heappush(q, -x)
for m in range(M):
    x = heapq.heappop(q)
    x /= 2
    heapq.heappush(q, x)
ans = 0
for x in q:
    ans += int(-x)
print(ans)

Measured memory_bytes: 14180
#include <bits/stdc++.h>
#define llong long long
#define mp make_pair
#define f first
#define s second

using namespace::std;

int main()
{
    ios::sync_with_stdio(false);
    ifstream fin("input.txt");

    int POS = 1e8;
    int NEG = -1e8 -1;

    int H, W, h, w;
    cin >> H >> W >> h >> w;
    int pos = ((H + h - 1) / h) * ((W + w - 1) / w);
    int neg = ((H / h) * (W / w));
    if (pos > neg) {
        cout << "Yes\n";

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i % h == 0 && j % w == 0) {
                    cout << POS << " ";
                }
                else if (i % h == h - 1 && j % w == w - 1) {
                    cout << NEG << " ";
                }
                else {
                    cout << "0 ";
                }
            }
            cout << "\n";
        }
    }
    else {
        cout << "No\n";
    }
}


Measured memory_bytes: 2816
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> k(n);
	REP(i, n) cin >> a[i] >> k[i];
	vector<ll> grundy(n);
	REP(i, n) {
		ll the = a[i] / k[i];
		if(the == 0) {
			grundy[i] = 0;
			continue;
		}
		ll tmp = a[i];
		if(the <= 1000000) {
			while(1) {
				ll diff = tmp - (tmp / k[i] * k[i]);
				ll dec = tmp / k[i] + 1;
				if(diff % dec == 0) {
					grundy[i] = tmp / k[i];
					break;
				} else {
					tmp -= (diff / dec + 1) * dec;
				}
			}
		} else {
			while(tmp % k[i]) {
				tmp -= tmp / k[i] + 1;
			}
			grundy[i] = tmp / k[i];
		}
	}
	ll nim_prod = 0;
	REP(i, n) nim_prod ^= grundy[i];
	if(nim_prod) cout << "Takahashi" << endl;
	else cout << "Aoki" << endl;
	return 0;
}

/* --------------------------------------- */


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

int main()
{
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	int a1 = a, b1 = b, c1 = c, d1 = d, e1 = e, f1 = f;
	string command;
	cin >> command;
	for (int i = 0; i < command.size(); i++)
	{
		if (command[i] == 'N')
		{
			e = a1; f = e1; b = f1; a = b1;
		}
		if (command[i] == 'S')
		{
			a = e1; b = a1; f = b1; e = f1;
		}
		if (command[i] == 'E')
		{
			a = d1; c = a1; d = f1; f = c1;
		}
		if (command[i] == 'W')
		{
			a = c1; d = a1; f = d1; c = f1;
		}
		a1 = a; b1 = b; c1 = c; d1 = d; e1 = e; f1 = f;
	}
	cout << a << endl;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,m,q;
	int ans=0;
	cin >>n>>m>>q;
	/*
	data:[begin][end]: 
	*/
	vector<vector<int>>data(n+4,vector<int>(n+4,0));//start,end
	int l,r;
	rep(i,m){
		cin>>l>>r;
		data[l][r]++;
	}
	for(int i=n+1;i>=0;i--){
		rep(j,n+1){
			data[i][j]+=data[i+1][j];
		}
	}
	rep(i,n+1){
		rep(j,n+1){
			data[i][j+1]+=data[i][j];
		}
	}
	rep(i,q){
		cin>>l>>r;
		cout<<data[l][r]<<endl;
	}
//	cout<<ans<<endl;
}

Measured memory_bytes: 1920
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

#define N_MAX 100000
#define MOD 1000000007

int N, K;
vector<int> edge[N_MAX];

lli dfs(int index, int par)
{
	lli ret = 1, cnt = K - 2;
	for (int i = 0; i < edge[index].size(); i++){
		if (par == edge[index][i]){
			continue;
		}
		ret = (((ret*cnt)%MOD)*dfs(edge[index][i], index)) % MOD;
		cnt--;
	}
	return ret;
}

void solv()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N - 1; i++){
		int a, b; scanf("%d%d", &a, &b);
		a--; b--;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}

	lli ret = K, cnt = K - 1;
	for (int i = 0; i < edge[0].size(); i++){
		ret = (((ret*cnt)%MOD)*dfs(edge[0][i], 0)) % MOD;
		cnt--;
	}

	printf("%lld", ret);

}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 11520
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define gc getchar
#define pc putchar
#define cs const

cs ll mod=1000000007;

ll fac[1000001]={1,1},inv[1000001]={1,1},ifac[1000001]={1,1};

inline
ll C(int n,int m){
	return fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}

int n,m,k,maxn;

signed main(){
	
	for(int re i=2;i<=1000000;++i)
	fac[i]=fac[i-1]*i%mod,
	inv[i]=(mod-mod/i)*inv[mod%i]%mod,
	ifac[i]=ifac[i-1]*inv[i]%mod;
	
	scanf("%d%d%d",&n,&m,&k);
	--n;
	maxn=max(n,m+k);
	ll sum=1,ans=1;
	for(int re i=1;i<=m+k;++i){
		sum=(sum*2+mod)%mod;
		if(i>m)sum=(sum+mod-C(i-1,m))%mod;
		if(i>k)sum=(sum+mod-C(i-1,k))%mod;
		ans=ans*3%mod;
		ans=(ans+C(n+i,i)*sum%mod)%mod;
	}
	cout<<(ans%mod+mod)%mod;
	return 0;
}

Measured memory_bytes: 23680
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		long a[] = new long[n];

		for (int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}

		int index = 0;
		long money = 1000;

		while (index < n){

			long motone = a[index];
			long urine = 0;

			for (int i=index+1; i<n; i++){
				motone = Math.min(motone, a[i]);
				urine = Math.max(urine, a[i]);
				index = i;
				if (i < n-1 && a[i] > a[i+1]){
					break;
				}
			}

			if (motone < urine){
				long kabu = money / motone;
				money = money % motone;
				money += kabu * urine;
			}

			index++;
		}
		System.out.println(money);
	}


}

Measured memory_bytes: 35860
#include <iostream>
using namespace std;
int sum,h,w,a,b;
int main(){
	while(1){
		cin >> h>>w;
		if(!(h||w))break;
		sum=h*h+w*w;
		a=h+1;
		while(1){
			while(a*a<sum){
				b=a+1;
				while(a*a+b*b<=sum){
					if(a*a+b*b==sum)goto END;
					b++;
				}
				a++;
			}
			sum++;
			a=1;
		}
		END:;
		cout <<a <<" " <<b <<endl;
	}
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("Ofast")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

int main() {
    cin>>N;
    ll res(0);
    reps(i, 1, N){
        res += (N - 1) / i;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 3628
(princ
 (loop :repeat (read)
       :with result = 1 :and max = (expt 10 18)
       :with bool = t :and x = 1
       :do (setf x (read))
       :when bool
         :do (setf result (* result x))
       :if (> result max)
         :do (setf bool nil
                   result -1)
       :else
         :if (zerop x)
           :do (setf result 0)
       :finally (return result)))

Measured memory_bytes: 76952
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "queue"

using namespace std;
typedef long long ll;

int main()
{
  int n, a, b;
  cin >> n >> a >> b;
  cout << min({a, b}) << " " << max({0, a + b - n}) << "\n";
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll INF=1e9+7;

int main()
{
    ll n,m;
    cin >> n >> m;
    if(n==1 && m==0){
        cout << 0 << endl;
        return 0;
    }
    vector<ll> s(n,-1);
    bool flag=true;
    rep(i,m){
        ll p,q;
        cin >> p >> q;
        p--;
        if(s[p]!=-1 && s[p]!=q){
            flag=false;
            break;
        }
        else{
            s[p]=q;
        }
    }
    if(s[0]==0 && n>=2){
        flag=false;
    }
    if(!flag){
        cout << -1 << endl;
        return 0;
    }
    rep(i,n){
        if(i==0){
            if(s[i]==-1){
                cout << 1;
                continue;
            }
        }
        if(s[i]==-1 && i>=1){
            cout << 0;
        }
        else{
            cout << s[i];
        }
    }
    cout << endl;
    
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  int n; cin>>n;
  int ans;
  if(n<10){ans=n;}
  else if(n<100){ans=9;}
  else if(n<1000){ans=9+n-100+1;}
  else if(n<10000){ans=9+900;}
  else if(n<100000){ans=9+900+n-10000+1;}
  else{ans=9+900+90000;}
  cout<<ans;
}



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

public class Main {

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

			double cx1, cy1, r1;
			double cx2, cy2, r2;
			
			//if(args.length != 0){
				cx1 = scan.nextDouble();
				cy1 = scan.nextDouble();
				r1 = scan.nextDouble();
				cx2 = scan.nextDouble();
				cy2 = scan.nextDouble();
				r2 = scan.nextDouble();
				
				double l = (Math.pow(cx1 - cx2, 2) + Math.pow(cy1 - cy2, 2));
				double rlen = r1+r2;
				double revlen = r1 - r2;
				if(l > rlen*rlen) 
					System.out.println("4");
				else if(l == rlen*rlen) 
					System.out.println("3");
				else if(l < rlen*rlen) {
					if(l > revlen*revlen)
						System.out.println("2");
					else if(l == revlen*revlen)
						System.out.println("1");
					else if(l < revlen*revlen)
						System.out.println("0");
				}
			//}
				scan.close();
			//else System.out.println("Input doesn't be exist");
		}	
	}


Measured memory_bytes: 28100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {
        String[] line = Io.read();
        int n = Integer.parseInt(line[0]);
        long[] a = parse(line[1]);

        int answer = Counter.count(n, a);

        Io.write(answer);
    }

    private static long[] parse (String line) {
        String[] split = line.split(" ");

        long[] parsed = new long[split.length];

        for (int i = 0; i < split.length; i++) {
            parsed[i] = Integer.parseInt(split[i]);
        }
        return parsed;
    }
}

class Counter {

    public static int count(int n, long[] a) {
        return Arrays.stream(a).limit(n).mapToInt(Counter::calcNTZ).sum();
    }

    private static int calcNTZ(long x) { return Long.bitCount((x & (-x)) - 1); }
}

class Io {

    /**
     * 標準入力から1行ずつ受け取る
     * @return
     * @throws IOException
     */
    public static String[] read() throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        List<String> inputs = new ArrayList<>();
        String line;
        while ((line = br.readLine()) != null) {
            if (line.equals(""))
                break;

            inputs.add(line);
        }
        br.close();
        return inputs.toArray(new String[0]);
    }

    /**
     * 標準出力
     * @param answer
     */
    public static void write(long answer)
    {
        System.out.println(answer);
    }
}

Measured memory_bytes: 27092
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=1e18;

int main(){

  ll n;
  cin >> n;
  set<ll> v;

  for(ll i=0;i<n;i++){
    ll a;
    cin >> a;
    v.insert(a);
  }

  if(v.size()==n)cout << "YES" << endl;
  else cout << "NO" << endl;

}

Measured memory_bytes: 12988
import math
N,K = map(int,input().split(" "))
p = 0.0

for i in range(1,N+1):
    if (i > K):
        p += 1/N
    else:
        c = math.ceil(math.log2(float(K/i)))
        p += (1/2**c)/N

print(p)

Measured memory_bytes: 3060
N = int(input())
h = list(map(int,input().split()))

high = []

for i in range(N-1):
	if h[i] < h[i+1]:
		high.append(i+1)
ans = 0
temp = 0
if len(high) == 0:
	print(len(h)-1)
	exit()

for i in high:
	ans = max(i-temp-1,ans)
	temp = i
temp = N
ans = max(N-high[-1]-1,ans)
print(ans)

Measured memory_bytes: 14224
n, k, s = map(int, input().strip().split())

if s==10**9:
    [print(s,end=" ") for _ in range(k)]
    [print(1,end=" ") for _ in range(n-k)]
else:
    [print(s,end=" ") for _ in range(k)]
    [print(s+1,end=" ") for _ in range(n-k)]

Measured memory_bytes: 4968
import itertools
import math
##print(ord("A"))
n = int(input())
#n,k,q = map(int,input().split())
#h = list(map(int,input().split()))	
s =[]
for i in range(n):
    for j in range(n):
        for k in range(n):
            t= (i,j,k)
            s.append(t)
print(len(s))



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

const int MAX_N = 1299709;
vector<int> prime;
void setPrime(int n) {
    vector<bool> alive(n, true);
    alive[0] = alive[1] = false;
    rep2(i, 2, n + 1) {
        if (alive[i]) {
            prime.emplace_back(i);
            for (int j = 2 * i; j <= n; j += i) {
                alive[j] = false;
            }
        }
    }
}

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

    setPrime(MAX_N);

    int n;
    while (cin >> n, n) {
        auto it = lower_bound(all(prime), n);
        if (*it == n) {
            cout << 0 << endl;
        } else {
            cout << *it - *(it - 1) << endl;
        }
    }

}

Measured memory_bytes: 3936
#include <cstdio>
using namespace std;
const int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main()
{
	int n;scanf("%d",&n);printf("%d\n",a[n-1]);
	return 0;
}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

template <unsigned long long mod> class modint {
public:
	unsigned long long v;
	modint(const long long x = 0) : v(x % mod) {}
	modint operator+(const modint rhs) { return modint(*this) += rhs; }
	modint operator-(const modint rhs) { return modint(*this) -= rhs; }
	modint operator*(const modint rhs) { return modint(*this) *= rhs; }
	modint operator/(const modint rhs) { return modint(*this) /= rhs; }
	modint operator-() { return modint(mod - this->v); }
	modint& operator+=(const modint rhs) {
		v += rhs.v;
		if (v >= mod) v -= mod;
		return *this;
	}
	modint& operator-=(const modint rhs) {
		if (v < rhs.v) v += mod;
		v -= rhs.v;
		return *this;
	}
	modint& operator*=(const modint rhs) {
		v = v * rhs.v % mod;
		return *this;
	}
	modint inverse(modint a) {
		unsigned long long exp = mod - 2;
		modint ret(1ULL);
		while (exp) {
			if (exp % 2) { ret *= a; }
			a *= a;
			exp >>= 1;
		}
		return ret;
	}
	modint& operator/=(modint rhs) {
		(*this) *= inverse(rhs);
		return *this;
	}
	friend ostream& operator<<(ostream& os, modint& u) {
		os << u.v;
		return (os);
	}
	friend istream& operator>>(istream& is, modint& u) {
		is >> u.v;
		return (is);
	}
};

const int MOD = 1000000007;
using mint = modint<MOD>;

class Solution {
public:
	void solve() {
		int n, x, y, z;
		cin >> n >> x >> y >> z;
		int m = 1 << (x+y+z);
		int mask = m-1;
		vector<vector<mint>> dp(n+1, vector<mint>(m, 0));
		dp[0][0] = 1;
		for(int i=0; i < n; i++){
			for(int j=0; j < m; j++){
				if(dp[i][j].v == 0)continue;
				for(int k=1; k <= 10; k++){
					int t_mask = (((j << 1)|1) << (k-1)) & mask;
					int n_mask = 0;
					if(k != 1){
						n_mask |= ((1 << (k-1)) - 1) << (x);
						n_mask |= ((1 << (k-1)) - 1) << (y+x);
					}
					n_mask = ~n_mask;
					t_mask &= n_mask;
					if(t_mask & (m >> 1))continue;
					dp[i+1][t_mask] += dp[i][j];
				}
			}
		}
		mint ans = 1;
		for(int i=0; i < n; i++)ans *= 10;
		for(int i=0; i < m; i++)ans -= dp[n][i];
		cout << ans << "\n";
		
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 43392
#include <iostream>
#include <string>

using namespace std;

void printCurrent(string ss[], int n) {
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            cout << " ";
        }
        cout << ss[i];
    }
    cout << endl;
}

string* bubbleSort(string ss[], int n) {
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < i; j++) {
            int j1 = stoi(ss[j].substr(1));
            int j2 = stoi(ss[j + 1].substr(1));
            if (j1 > j2) {
                string tmp = ss[j];
                ss[j] = ss[j + 1];
                ss[j + 1] = tmp;
            }
        }
    }
    printCurrent(ss, n);
    return ss;
}

string* selectionSort(string ss[], int n) {
    for (int i = 0; i < n; i++) {
        int minj = i;
        for (int j = i; j < n; j++) {
            int minv = stoi(ss[minj].substr(1));
            int v = stoi(ss[j].substr(1));
            if (v < minv) {
                minj = j;
            }
        }
        if (minj != i) {
            string tmp = ss[i];
            ss[i] = ss[minj];
            ss[minj] = tmp;
        }
    }
    printCurrent(ss, n);
    return ss;
}

bool isStable(string ss1[], string ss2[], int n) {
    for (int i = 0; i < n; i++) {
        if (ss1[i] != ss2[i]) {
            return false;
        }
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    string ss1[n];
    string ss2[n];
    for (int i = 0; i < n; i++) {
        cin >> ss1[i];
        ss2[i] = ss1[i];
    }
    string* ss3 = bubbleSort(ss1, n);
    cout << "Stable" << endl;
    string* ss4 = selectionSort(ss2, n);
    if (isStable(ss3, ss4, n)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1000000000000000
#include <iomanip>
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
constexpr int MOD = 1000000007;

int main(){
    int N;cin>>N;
    vector<int> d(N);
    REP(i,N) cin>>d[i];
    set<int> moti;
    REP(i,N) moti.insert(d[i]);
    cout<<moti.size()<<endl;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
-- extension section
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-} 
-- not supported extension
--{-# LANGUAGE Strict, StrictData #-}


module Main where

-- @@@@@@@@@@@@@@@@@--
-- import section   --
-- @@@@@@@@@@@@@@@@@--
--    import A.B.C( function name )  ...
-- or import A.B.C 

--
import Prelude hiding(
  getLine,
  getContents,
  lines,
  words,
  read
  )

--
import Data.Either 
import Control.Monad

-- bytestring


-- containers


-- deepseq


-- regex-posix


-- text
import Data.Text.Lazy.IO as TIO
import Data.Text.Lazy as T
import Data.Text.Lazy.Read as TR
-- unordered-containers


-- vectors
import Data.Vector.Unboxed as UV
import Data.Vector.Unboxed.Mutable as MV

-- mtl
import Control.Monad.ST


-- @@@@@@@@@@@@@@@@@--
-- main section     --
-- @@@@@@@@@@@@@@@@@--

main :: IO ()
main = do
  input <- getInput
  Prelude.putStr . show . getAnswer $ input 
 
-- main :: IO()
-- main = do
--   answer <- getInputandanser
--   putStr . show $ answer


-- @@@@@@@@@@@@@@@@@@@@@--
-- I/O DataType section --
-- @@@@@@@@@@@@@@@@@@@@@--
data Input = I (Int,[Int] )
  deriving(Show)

type Answer = Int

-- instance Show Answer where
--   show = undefined


-- @@@@@@@@@@@@@@@@@--
-- answerSection    --
-- @@@@@@@@@@@@@@@@@--
getInput :: IO Input
getInput = do
  Right (n, _) <- getLine >>= ( return . TR.decimal )
  text2 <- getLine 
  let
    numTexts = fmap textToInt $ words text2 
  return (I (n, numTexts) )
  where 
    textToInt t = case TR.decimal t of
      Right (m , _) -> m

getAnswer :: Input -> Answer 
getAnswer ( I (_ , nums) ) = runST $ do  
  vec <- UV.thaw v
  _ <- Control.Monad.forM_ nums $ \num -> do
    MV.modify vec (+1) (num + 1)
    MV.modify vec (+1) (num-1 + 1)
    MV.modify vec (+1) (num+1 + 1)
    return ()
  returnV <- freeze vec  
  return ( UV.maximum returnV  )
  where v = UV.replicate (100000 + 2)  0 :: UV.Vector Int

getInputAndAnser :: IO Answer
getInputAndAnser = undefined


-- @@@@@@@@@@@@@@@@@@@@@@@@@@--
-- question unique section    --
-- @@@@@@@@@@@@@@@@@@@@@@@@@@--





-- @@@@@@@@@@@@@@@@@--
-- util section     --
-- @@@@@@@@@@@@@@@@@--

-- standard Input Function
gLine :: IO Text
gLine = getLine

gContents :: IO Text
gContents = getContents



Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(k<=a+b){
    if(k<=a) cout << k;
    else cout << a;
  }
  else {
    cout << a-(k-a-b) <<endl;
  }
  return 0;
}

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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	char b;
	cin >> b;
	if(b == 'A'){
		ANS('T');
	}else if(b == 'C'){
		ANS('G');
	}else if(b == 'G'){
		ANS('C');
	}else if(b == 'T'){
		ANS('A');
	}
	return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  string A, B;
  cin >> A >> B;
  if (A.size() > B.size()) {
    cout << "GREATER" << endl;
  } else if (A.size() < B.size()) {
    cout << "LESS" << endl;
  } else {
    if (A < B) {
      cout << "LESS" << endl;
    } else if (A > B) {
      cout << "GREATER" << endl;
    } else {
      cout << "EQUAL" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
S = []
for _ in range(H):
    s = list(input())
    S.append(s)


def q(i, j):
    if not 0 <= i < H or not 0 <= j < W:
        return 0
    return 1 if S[i][j] == "#" else 0


for i in range(H):
    for j in range(W):
        if S[i][j] != ".":
            continue
        c = 0
        c += q(i-1, j-1)
        c += q(i-1, j)
        c += q(i-1, j+1)
        c += q(i, j-1)
        c += q(i, j+1)
        c += q(i+1, j-1)
        c += q(i+1, j)
        c += q(i+1, j+1)
        S[i][j] = str(c)

for s in S:
    print("".join(s))


Measured memory_bytes: 3188
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<pair<string, int> > s;
    for (int i = 0; i < n; i++) {
        string si;
        cin >> si;
        bool is_exist = false;
        for (int j = 0; j < s.size(); j++) {
            if (si == s[j].first) {
                is_exist = true;
                s[j].second++;
                break;
            }
        }
        if (!is_exist) {
            s.push_back(make_pair(si, 1));
        }
    }

    int m;
    cin >> m;
    vector<pair<string, int> > t;
    for (int i = 0; i < m; i++) {
        string ti;
        cin >> ti;
        bool is_exist = false;
        for (int j = 0; j < t.size(); j++) {
            if (ti == t[j].first) {
                is_exist = true;
                t[j].second++;
                break;
            }
        }
        if (!is_exist) {
            t.push_back(make_pair(ti, 1));
        }
    }

    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        int tmp = s[i].second;
        for (int j = 0; j < t.size(); j++) {
            if (s[i].first == t[j].first) {
                tmp -= t[j].second;
                break;
            }
        }
        ans = max(ans, tmp);
    }

    if (ans < 0) {
        cout << "0" << endl;
    } else {
        cout << ans << endl;
    }

    return 0;
}


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

int main() {
  string N;
  cin >>N;
  for(int i=0;i<3;i++){
    if(N.at(i)=='1'){
      N.at(i)='9';
    }
    else{
      N.at(i)='1';
    }
  }
  cout <<N <<endl;
  return 0;
}


Measured memory_bytes: 256
n,w = map(int,input().split())
dp = [[0]*(w+1) for i in range(n+1)]

for i in range(1, n+1) :
    a, v = map(int,input().split())
    for j in range(1, w+1) :
        if j < a :
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])
        else :
            dp[i][j] = max(dp[i-1][j], dp[i][j-1], dp[i-1][j-a]+v)

print(dp[n][w])



Measured memory_bytes: 120300
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define v vector<double>
#define vv vector<v>
#define p pair<ll,ll>
ll inf=1e17;
ll mod=1e9+7;
double func(double r)
{
	double ans=1.0/((1.0-r)*(1.0-r));
	return ans;
}
double func2(double r)
{
	double ans=1.0/(1.0-r);
	return ans;
}
int n;
double solve(int i,int j,int k,vector<vv> &dp)
{
	if (dp[i][j][k]!=-1)
		return dp[i][j][k];
	dp[i][j][k]=0;
	int d=n-i-j-k;
	if (d<0)
		return 0;
	double t1=func(d*1.0/n);
	double t2=func2(d*1.0/n);
	if (i>0)
		dp[i][j][k]+=t2*solve(i-1,j,k,dp)*i*1.0/n+t1*i*1.0/n;
	if (j>0)
		dp[i][j][k]+=t2*solve(i+1,j-1,k,dp)*j*1.0/n+t1*j*1.0/n;
	if (k>0)
		dp[i][j][k]+=t2*solve(i,j+1,k-1,dp)*k*1.0/n+t1*k*1.0/n;
	return dp[i][j][k];
}
int main()
{
	cin>>n;
	v arr(n+1,-1);
	v brr(4,0);
	for (int i=1; i<=n; i++)
	{
		cin>>arr[i];
		brr[arr[i]]++;
	}
	vector<vv> dp(n+1,vv(n+1,v(n+1,-1)));
	cout<<setprecision(20)<<fixed;
	cout<<solve(brr[1],brr[2],brr[3],dp)<<endl;
	return 0;
}

Measured memory_bytes: 216960
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < m; j++)
        {
            if(s[i] == t[j])
            {
                dp[i+1][j+1] = dp[i][j] + 1;
            }
            else
            {
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
            }
        }
    }
    int res = dp[n][m];
    string ans;
    for(int i = n; i >= 1; i--)
    {
        for(int j = m; j >= 1; j--)
        {
            if(s[i-1] == t[j-1] && dp[i-1][j-1] == res-1)
            {
                ans = s[i-1] + ans;
                res--;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
#define rep(i, n) for(int i = 0; i < (n); i++)

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int a,b,c;
  bool flag=false;
  cin>>a>>b>>c;
  for(int i=1;i<=max(a,b);i++){
    if(a*i%b==c){
      flag=true;
    }
  }
  if(flag){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
///////////////////////////

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
#define double /*long*/ double
#define endl '\n'
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vppll vector<pair<pll,pll>>
#define mp make_pair
#define pb push_back
#define mapll map<ll,ll>
#define fir first
#define sec second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0);
#define fo(i,b) for(i=0;i<b;i++)
#define repa(i,a,b) for(i=a;i<b;i++)
#define repb(i,a,b) for(i=a;i>=b;i--)
#define all(x) (x).begin(), (x).end()
#define s(v) v.size()
const long long int MAX = (ll)(1e18+1);
const long long int MIN = (ll)(-1e18-1);
const long long int mod = (ll)(1e9+7);
using namespace std;

ll max(ll a,ll b,ll c) {return max(max(a, b), c);}
ll min(ll a,ll b,ll c) { return min(min(a, b), c);}
ll max(ll a,ll b) {return (a>b) ? a : b;}
ll min(ll a,ll b) {return (a<b) ? a : b;}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power_mod(ll a, ll n, ll mod_){ ll p=1; while(n){ if(n%2){ p=(p*a)%mod_;} n/=2; a=(a*a)%mod_;} return p%mod_;}
                                                 /*Code Begins*/


int main(){
    _cin;
    // cout << setprecision(15);
    ll mn = MAX, mx = MIN;
    ll n, t, m, k, i, j,  sum=0,  prev, flag=0, cnt=0;
    ll x=0, y=0, fx, diff, tot=0, l , r;
    int TC=1;
    // cin >> TC;
while(TC--){
    cin >> n;
    vll a(n), dp(n+1);
    fo(i,n) cin >> a[i];
    dp[0] = 0;
    dp[1] = abs(a[1]-a[0]);
    repa(i,2,n){
        dp[i] = min(dp[i-2] + abs(a[i]-a[i-2]), dp[i-1] + abs(a[i]-a[i-1]));
    }
    // fo(i,n) cout << dp[i] << ' ';
    cout << dp[n-1];
}
 return 0;      
}

Measured memory_bytes: 1792
n = int(input())
grid = [[0 for i in range(3)] for j in range(n)]
dp = [[0 for i in range(3)] for j in range(n)]

for i in range(n):
    grid[i] = list(map(int, input().split(" ")))
    
for i in range(n):
    for j in range(3):
        if i == 0 and j == 0:
            dp[i][j] = grid[0][0]
        elif i == 0:
            dp[i][j] = max(grid[i][j], dp[i][j - 1])
        else:
            if (j == 0):
                dp[i][j] = max(grid[i][j] + dp[i-1][1], grid[i][j] + dp[i-1][2])
            elif (j == 1):
                dp[i][j] = max(grid[i][j] + dp[i-1][0], grid[i][j] + dp[i-1][2])
            else:
                dp[i][j] = max(grid[i][j] + dp[i-1][0], grid[i][j] + dp[i-1][1])
                
        
print(max(dp[n - 1][0], max(dp[n - 1][2], dp[n - 1][1])))

Measured memory_bytes: 82396
#include <stdio.h>


int main(void){
  int i,n = 0;
  char w[11], t[1001];

  scanf("%s", w);

  do{
    scanf("%s",t);
    if(!strcmp(t,"END_OF_TEXT")) break;
      for(i=0;t[i]!='\0';i++)
        if(t[i]<91) t[i] += 32;
    if( !strcmp(w,t) ) n++;
  }while(1);

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

  return 0;
}




  

 



Measured memory_bytes: 2044
use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

fn main() {
    let _n = {
        let buf = read_line();
        buf.trim().parse::<u64>().unwrap()
    };
    let ai:Vec<i64> = {
        let buf = read_line();
        buf.split_whitespace().into_iter().map(|el| el.parse::<i64>().unwrap()).collect()
    };
    println!("{} {} {}", ai.iter().min().unwrap(), ai.iter().max().unwrap(), ai.iter().sum::<i64>());
}


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

int dp[21][21];

int main(){
	int INF = (int)1e9;

	int n, m;
	int a, b, c, d;
	int x1, x2, y1, y2;

	scanf("%d%d", &n, &m);

	for(int i = 0; i <= n; ++i){
		for(int j = 0; j <= n; ++j){
			dp[i][j] = INF;
		}
	}

	for(int i = 0; i < m; ++i){
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		dp[a][b] = c;
		dp[b][a] = d;
	}

	scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);

	for(int k = 1; k <= n; ++k){
		for(int i = 1; i <= n; ++i){
			for(int j = 1; j <= n; ++j){
				dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
			}
		}
	}

	int cost = dp[x1][x2] + dp[x2][x1];
	int ans = y1 - y2 - cost;
	printf("%d\n", ans);
}

Measured memory_bytes: 1028
import java.awt.*;
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
//        double r=sc.nextInt();
        ArrayList<Double> arr=new ArrayList<>();
        System.out.println(2D*(3.14159265358979D)*(sc.nextDouble()));
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 25440
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

int main()
{
    int64_t a,b,c;
    std::cin>> a;
    std::cin>> b;

    c = -1;
    
    if( a < 10
        && b < 10 )
    {
        c = a* b;
    }

    std::cout<< c ;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
class Main {
  	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str1 = br.readLine();
		String str2 = br.readLine();
		int[] x = new int[4];
		LinkedList<Integer> a = new LinkedList<Integer>();
		
		if(str1.indexOf(str2) == -1){
			return;
		}
		if(str1.equals(str2)){
			System.out.println("0");
			return;
		}
		
		
		a.add(str1.indexOf(str2));
		for(int i = 1; i < str1.length(); i++){
			if(str1.indexOf(str2, a.get(i - 1) + 1) == str1.lastIndexOf(str2)){
				a.add(str1.indexOf(str2, a.get(i - 1) + 1));
				break;
			}
			a.add(str1.indexOf(str2, a.get(i - 1) + 1));
		}
		
		for(int i = 0; i < a.size(); i++){
			System.out.println(a.get(i));
		}
	}
}

Measured memory_bytes: 24424
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  int N; cin >> N;
  vector<int> A(N);
  for (auto& a : A) { cin >> a; }

  int itr = 1;
  int res{};
  for (int i = 0; i < N; ++i) {
    if (A[i] == itr) {
      ++res;
      ++itr;
    }
  }
  if (res) {
    cout << (N-res) << CRLF;
  }
  else {
    cout << -1 << CRLF;
  }
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 1024
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
from collections import defaultdict

def resolve():
    it = map(int, sys.stdin.read().split())
    V, E, r = next(it), next(it), next(it)

    inf = float("inf")

    dp = [inf] * V
    dp[r] = 0

    dx = defaultdict(list)
    for si, ti, di in zip(it, it, it):
        dx[si].append((ti, di))

    sx, tx = {r,}, set()
    for i in range(V+1):
        if not sx: break
        for si in sx:
            for ti, di in dx[si]:
                d1 = dp[ti]
                d2 = dp[si] + di
                if d1 > d2:
                    dp[ti] = d2
                    tx.add(ti)
        sx, tx = tx, set()

    if sx:
        print("NEGATIVE CYCLE")
        return

    ans = []
    print(*["INF" if x == inf else x for x in dp], sep="\n")



if __name__ == "__main__":
    resolve()



Measured memory_bytes: 6812
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define int long long

signed main() {
  int k;
  cin >> k;

  vector<int> ans(50,49);
  for (int i = 0; i < 50; i++) {
    ans[i] += (k/50);
  }

  k%=50;
  for (int i = 0; i < k; i++) {
    ans[i] += 50 + 1;
    for (int j = 0; j < 50; j++) ans[j]--;
  }

  cout << 50 << '\n';
  for (auto it : ans) cout << it << " ";
  cout << '\n';

  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main()
{
	char a[10];
	scanf("%s",a);
	int nen=atoi(a);
	int getsu=atoi(a+5);
	int hi=atoi(a+8);
	if(nen>=2020) printf("TBD\n");
	else if(nen==2019&&getsu>=5) printf("TBD\n");
	else printf("Heisei\n");
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int n;
string v;
double ans, x;

int main(void)
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> v;
		if (v == "JPY")
		{
			ans += x;
		}
		else
		{
			ans += x * 380000;
		}
	}
	cout << ans << endl;
}

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

// Initialise the parents of nodes as the nodes itself, and the ranks as 0
struct dis_set
{
    ll parent;
    ll rank;
    ll num;
};

ll find(dis_set s[], ll i)
{
    if(s[i].parent != i)
        s[i].parent = find(s, s[i].parent);

    return s[i].parent;
}

void Union(ll x, ll y, dis_set s[])
{
    ll xroot = find(s, x);
    ll yroot = find(s, y);
    if(s[xroot].rank > s[yroot].rank)
    {
        s[yroot].parent = xroot;
        s[xroot].num = s[xroot].num + s[yroot].num;
    }
    else if(s[yroot].rank > s[xroot].rank)
    {
        s[xroot].parent = yroot;
        s[yroot].num = s[yroot].num + s[xroot].num;
    }
    else
    {
        s[xroot].parent = yroot;
        s[yroot].rank++;
        s[yroot].num = s[yroot].num + s[xroot].num;
    }
}

ll dp[100001];

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

    ll n,m;
    cin >> n >> m;

    pair<ll,ll> p[m];

    rep(i,m)
    {
    	ll x,y;
    	cin >> x >> y;
    	p[i] = mp(x,y);
    }

    dis_set s[n+1];

    fr(i,1,n)
    {
    	s[i].parent = i;
    	s[i].rank = 0;
    	s[i].num = 1;
    }

    dp[m] = ((n)*(n-1))/2;

    frr(i,m-1,0)
    {
    	ll x = p[i].ff;
    	ll y = p[i].ss;

    	if(find(s,x)==find(s,y))
    		dp[i] = dp[i+1];
    	else
    	{
    		dp[i] = dp[i+1];

    		ll xx = find(s,x);
    		ll yy = find(s,y);

    		// cout << s[xx].num << " " << s[yy].num << " " << i << endl;
    		ll aa = s[xx].num*s[yy].num;

    		dp[i] = dp[i] - aa;

    		Union(x,y,s);
    	}
    }

    fr(i,1,m)
    {
    	cout << dp[i] << endl;
    }
}


Measured memory_bytes: 6016