akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll s; cin >> s;
  ll l = 0, r = 1000000000000000000;
  ll lcnt = 0;
  while(r - l > 1) {
    ll mid = (l+r) / 2;
    ll cnt = 0;
    cnt += mid / 3 * 4;
    cnt += mid / 5 * 4;
    ll pos = 9;
    ll pre = 0;
    ll now = 1;
    while(mid >= pos) {
      cnt += now * (pos - pre);
      pre = pos;
      pos *= 10;
      pos += 9;
      now++;
    }
    cnt += now * (mid - pre);
    pos = 9;
    pre = 0;
    now = 1;
    while(mid >= pos) {
      cnt -= now * (pos / 3 - pre / 3);
      pre = pos;
      pos *= 10;
      pos += 9;
      now++;
    }
    cnt -= now * (mid / 3 - pre / 3);
    pos = 9;
    pre = 0;
    now = 1;
    while(mid >= pos) {
      cnt -= now * (pos / 5 - pre / 5);
      pre = pos;
      pos *= 10;
      pos += 9;
      now++;
    }
    cnt -= now * (mid / 5 - pre / 5);
    pos = 9;
    pre = 0;
    now = 1;
    while(mid >= pos) {
      cnt += now * (pos / 15 - pre / 15);
      pre = pos;
      pos *= 10;
      pos += 9;
      now++;
    }
    cnt += now * (mid / 15 - pre / 15);
    if(cnt < s) {
      lcnt = cnt;
      l = mid;
    } else {
      r = mid;
    }
  }
  if(l == 0) {
    lcnt = 0;
  }
  string ans = "";
  l++;
  while((int)(ans.size()) < 40) {
    if(l % 3 == 0 && l % 5 == 0) {
      ans += "FizzBuzz";
    } else if(l % 3 == 0) {
      ans += "Fizz";
    } else if(l % 5 == 0) {
      ans += "Buzz";
    } else {
      ans += to_string(l);
    }
    l++;
  }
  for(int i=s-lcnt-1;i<(s-lcnt)+20-1;++i) {
    cout << ans[i];
  }
  cout << endl;
}



Measured memory_bytes: 3296
// Why am I so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e5 + 5;

bool can[MAXN];

int cnt[MAXN];

int n, m, ans;

void solve() {                   
	scanf("%d %d", &n, &m);

	can[1] = 1;

    for (int i = 1; i <= n; ++i) {
    	cnt[i] = 1;
    }

    for (int i = 1, x, y; i <= m; ++i) {
		scanf("%d %d", &x, &y);    

		if (can[x]) {
			can[y] = 1;

			if (cnt[x] == 1) {
				can[x] = 0;				
			}
		}   

		--cnt[x];
		++cnt[y];
    }

    for (int i = 1; i <= n; ++i) {
    	ans += can[i];
    }

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

int main() {    
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 768
S = input()
T = input()

values = [[] for a in range(len(T))]
for i, s in enumerate(S):
    for n, v in enumerate(T):
        if v == s:
            values[n].append(i)

maxR = 0
for ni, val in enumerate(values):
    current_i = 1 + ni
    for i in val:
        if i < ni or len(S) - (i+1) < len(T) - (ni+1):
            continue
        current = 1
        for j in range(len(T) - current_i):
            s_index = i + j + 1
            if s_index >= len(S):
                break
            if S[s_index] == T[j+current_i]:
                current += 1
        maxR = max(current, maxR)

print(len(T) - maxR)

Measured memory_bytes: 117084
n,q=map(int,input().split())
ab=[]
for i in range(n-1):
	x,y=map(int,input().split())
	ab.append([x,y])
ab.sort()
ans=[0]*n
cnt=[0]*n
for i in range(q):
	x,y=map(int,input().split())
	ans[x-1]+=y
for i in range(n-1):
	ans[ab[i][1]-1]+=ans[ab[i][0]-1]
print(*ans)





Measured memory_bytes: 52696
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B = mi()

if B % A:
    print(B-A)
else:
    print(A+B)


Measured memory_bytes: 9172
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	long int a, b, c, k, i, sum=0;
	scanf("%ld %ld %ld %ld", &a, &b, &c, &k);
	
	for(i=0; i<k; i++){
		if(a!=0){ sum+=1; a--; }
		else{
			if(b!=0){ sum+=0; b--; }
			else{
				if(c!=0){ sum+=-1; c--; }
				else{ printf("%ld", sum); return 0; }
			}
		}
	}
	
	printf("%ld", sum);
	
return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n,k;cin >> n >> k;
	vector<int> cv;
	for(int i = 0; i < n;i++){
		int c; cin >> c;
		cv.push_back(c);
	}

	int cost = abs(cv[k-1]- cv[0]);
	if(cv[0] < 0 && cv[k-1] > 0)cost += min(abs(cv[0]),abs(cv[k-1]));
	int ans = cost;

	for(int i = k; i < n; i++){
			int n_cost = abs(cv[i-k+1]- cv[i]);
			if(cv[i-k+1] < 0 && cv[i] > 0)n_cost += min(abs(cv[i-k+1]),abs(cv[i]));
			ans = min(n_cost, ans);
	}
	if(cv[0] >= 0)ans = cv[k-1];
	if(cv[n-1] < 0)ans = abs(cv[n-k]);

	cout << ans << endl;
}

Measured memory_bytes: 892
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main() {
    int N;
    cin>>N;
    double x[N], y[N];
    for(int i=0;i<N;++i){
        cin>>x[i]>>y[i];
    }
    double sum = 0;
    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            if(i==j)continue;
            sum += sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
        }
    }
    sum /= 2;
    cout<<setprecision(20)<<sum*(N-1)/(N*(N-1)/2)<<endl;
}


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

int main()
{
    int n;
    double n2;

    cin >> n;

    n2 = n;
    int bit[n];
    int selection[n];

    for( int i = 0; i < n; i++ )
    {
        bit[i] = i;
        selection[i] = 0;
    }
    
    for( int i = 0; i < pow( 2, n2 ); i++ )
    {
        int x = i;
        int j = 0;
        while( x > 1 )
        {
            selection[j] = x % 2;
            j++;
            x = x / 2;
        }
        selection[j] = x;

        cout << i << ":";
        for( int k = 0; k < n; k++ )
            if( selection[k] == 1 )
                cout << " " << bit[k];
        cout<< endl;
    }
    return 0;
}



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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

struct Solution
{
    Solution() {}
    void solveCase();
};

void Solution::solveCase()
{
    int d, t, s;
    cin >> d >> t >> s;
    if (d <= t * s)
        cout << "Yes\n";
    else
    {
        cout << "No\n";
    }
}

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 3608
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

int main() {

    ll N;
    cin >> N;
    string S;
    ll s[5] = {0};
    rep(i,N){
        cin >> S;
        if(S[0]=='M') s[0]++;
        else if(S[0]=='A') s[1]++;
        else if(S[0]=='R') s[2]++;
        else if(S[0]=='C') s[3]++;
        else if(S[0]=='H') s[4]++;
    }
    ll out = 0;
    rep(i,3){
        for(ll j=i+1;j<4;j++){
            for(ll k=j+1;k<5;k++){
                if(s[i]>0&&s[j]>0&&s[k]>0) out += s[i]*s[j]*s[k];
            }
        }
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// Welcome to my source code!

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

int main() {
    int n;
    cin >> n;
    ll ans = 1, t;
    for (int i = 0; i < n; i++) {
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		if (n / 100 == 7) {
			System.out.println("Yes");
		} else if ((n % 100) / 10 == 7) {
			System.out.println("Yes");
		} else if ((n % 10) == 7){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		s.close();
	}
}


Measured memory_bytes: 35616
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

from math import cos,radians

a,b,h,m = map(int,input().split())

long_ = (30*h) + (0.5*m)
short_ = 6*m
difference = min([abs(long_-short_),abs(long_-short_-360)])
temp = a**2+b**2 - (2*a*b*cos(radians(difference)))
print(temp**0.5)

Measured memory_bytes: 9516
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1;
#define cni cin
#define asn ans

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
//typedef unsigned int uint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int np(int n){
    if (n <= 0) return 0;
    if ((n & (n - 1)) == 0) return (int)n;
    int ret = 1;
    while (n > 0) { ret <<= 1; n >>= 1; }
    return ret;
}

int n,k,st=INT_MAX,l,r,rl,ans,tmp;

main(){
    int n;
    cin>>n;
    vector<int>a;
    rep(i,n){
        int t;
        cin>>t;
        a.pb(t);
    }
    sort(rall(a));
    map<int,int>m;
    for(int x:a){
        if(m.count(x)&&m[x]>0)m[x]--,ans++;
        //else m[np(x)-x]++;
        else m[(1<<(32-__builtin_clz(x)))-x]++;
    }
    cout<<ans<<endl;
}



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

int main() {

string S;
cin>>S;

bool n=false,s=false,e=false,w=false, flg=true;

for(int i=0;i<S.size();i++){
  char tmp=S[i];
  if(tmp=='N') n=true;
  if(tmp=='S') s=true;
  if(tmp=='E') e=true;
  if(tmp=='W') w=true;
}
if(n) if(!s) flg=false;
if(s) if(!n) flg=false;
if(e) if(!w) flg=false;
if(w) if(!e) flg=false;
if(flg) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}


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

int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  set<int> X, Y;
  for (int i = 0; i <= F; i++) {
    for (int j = 0; j <= F; j++) {
      int x = 100*A*i + 100*B*j;
      if (x <= F) X.insert(x);
      int y = C*i + D*j;
      if (y <= F) Y.insert(y);
    }
  }

  int best_x = 0, best_y = 0;
  for (int x : X) {
    for (int y : Y) {
      if (F < x + y || x*E < 100*y) continue;
      if (best_x == 0) best_x = x;
      if (best_y == 0) best_y = y;
      if (best_y*(x+y) < y*(best_x+best_y)) {
        best_x = x;
        best_y = y;
      }
    }
  }
  cout << best_x + best_y << ' ' << best_y << endl;
}

Measured memory_bytes: 384
#include<cstdio>
int main(){
    int h,w;
    char s[6], t[6]="snuke";
    scanf("%d%d",&h,&w);
    for(int i=0;i<h*w;i++){
        scanf("%s",s);
        int j;
        for(j=0;j<5;j++){
            if(s[j]!=t[j])break;
        }
        if(j==5){
            printf("%c%d",'A'+(i%w),i/w+1);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;


int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<ll>> AB(N, vector<ll>(2));
  for (int i = 0; i < N; ++i) {
    cin >> AB[i][0] >> AB[i][1];
  }
  sort(AB.begin(), AB.end());
  ll result = 0;
  ll rem = M;
  for (int i = 0; i < N; ++i) {
    result += AB[i][0] * min(rem, AB[i][1]);
    rem -= min(rem, AB[i][1]);
  }
  cout << result << endl;
}

Measured memory_bytes: 5760
S=input()
N=len(S)
def isKaibun(S):
  #print(S,S[::-1])
  if S==S[::-1]:
    return True
  return False
if isKaibun(S) and isKaibun(S[:(N-1)//2]) and isKaibun(S[(N+3)//2-1:]):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9044
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register int
#define db double
#define in inline
namespace fast_io
{
	char buf[1<<12],*p1=buf,*p2=buf,sr[1<<23],z[23],nc;int C=-1,Z=0,Bi=0;
	in char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
	in ll read()
	{
		ll x=0,y=1;while(nc=gc(),(nc<48||nc>57)&&nc!=-1)if(nc==45)y=-1;Bi=1;
		x=nc-48;while(nc=gc(),47<nc&&nc<58)x=(x<<3)+(x<<1)+(nc^48),Bi++;return x*y;
	}
	in db gf() {re a=read(),b=(nc!='.')?0:read();return (b?a+(db)b/pow(10,Bi):a);}
	in int gs(char *s) {char c,*t=s;while(c=gc(),c<32);*s++=c;while(c=gc(),c>32)*s++=c;return s-t;}
	in void ot() {fwrite(sr,1,C+1,stdout);C=-1;}
	in void flush() {if(C>1<<22) ot();}
	template <typename T>
	in void write(T x,char t)
	{
		re y=0;if(x<0)y=1,x=-x;while(z[++Z]=x%10+48,x/=10);
		if(y)z[++Z]='-';while(sr[++C]=z[Z],--Z);sr[++C]=t;flush();
	}
	in void write(char *s) {re l=strlen(s);for(re i=0;i<l;i++)sr[++C]=*s++;sr[++C]='\n';flush();}
}
using namespace fast_io;
ll n,a,b; 
int main()
{
	n=read();a=read();b=read();
	if((b-a)%2==0) write(abs(b-a)/2,'\n');
	else
	{
		ll s1=min(a,b)-1,s2=n-max(a,b),ans1=0,ans2=0;
		write(min(s1+(abs(b-a)+1)/2,s2+(abs(b-a)+1)/2),'\n');
	}
	return ot(),0;
}
//Author: disangan233
//In my dream's scene,I can see the everything that in Cyaegha.

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <queue>
#include <map>

using namespace std;

int ans;
const int MAX_COUNT = 1000;
char color[3] = {'r', 'g', 'b'};
set<string> mSet;

typedef pair<string, int> PSI;

bool solve(string str)
{
	queue<PSI> que;
	que.push(PSI(str, 0));
	
	while(!que.empty())
	{
		PSI current = que.front();
		que.pop();

		bool is_solved = true;
		for(int i=0; i<current.first.size()-1; i++)
		{
			if(current.first[i] != current.first[i+1])
			{
				is_solved = false;
				break;
			}
		}

		if(is_solved)
		{
			ans = current.second;
			return true;
		}

		if(mSet.find(current.first) == mSet.end())
		{
			mSet.insert(current.first);
		}
		else
		{
			continue;
		}

 		for(int i=0; i<current.first.size()-1; i++)
		{
			if(current.first[i] != current.first[i+1])
			{
				for(int k=0; k<3; k++)
		   		{
	   				if(current.first[i] != color[k] && current.first[i+1] != color[k])
   					{
				   		string new_str = string(current.first.begin(), current.first.end());
			   			new_str[i] = color[k];
		  				new_str[i+1] = color[k];
						que.push(PSI(new_str, current.second+1));
					}
				}
			}
		}
	}

	return false;
}

int main()
{
	string str;
	while( 1 )
	{
		cin >> str;
		if(str == "0") break;

		ans = MAX_COUNT;
		mSet.clear();

		if(!solve(str))
		{
			printf("NA\n");
		}
		else
		{
			printf("%d\n", ans);
		}
	}
}

Measured memory_bytes: 2124
n = int(input())
h = list(map(int, input().split()))
reverse_h = list(reversed(h))

for i in range(n-1):
    if reverse_h[i] < reverse_h[i+1]:
        reverse_h[i+1] -= 1
        if reverse_h[i] < reverse_h[i+1]:
            print("No")
            exit()
else:
    print("Yes")

Measured memory_bytes: 63856
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#include <fstream>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
#define INF 4e18
using namespace std;
 
typedef tree<ll, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    ordered_set; 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset;

ll prck(ll n)
{
    ll f=1;
    if(n==1)
        f=0;
    else if(n==2)
        f=1;
    else if(n%2==0)
        f=0;
    else
    {
        ll i;
        for(i=3;(i*i<=n) && (f==1);i+=2)
        {
            if(n%i==0)
                f=0;
        }
    }
    return f;
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    /*ll t,tcitr;
    cin>>t;
    tcitr=0;
    while(tcitr<t)
    {*/
        ll n,i,j,x,m;
        cin>>n>>x>>m;
        vector<ll> sm;
        map<ll,ll> mp;
        bool printed=false;
        sm.push_back(0LL);
        for(i=1;i<=n;i++)
        {
            sm.push_back(x);
            
            if(i)sm[i]+=sm[i-1];
            if(mp.count(x))
            {
                ll repeat=mp[x];
                //0  to repeat-1
                ll ans=sm[repeat-1];

                ll pattern=sm[i-1]-sm[repeat-1];

                ll block=i-1-repeat+1;

                ans+=((n-repeat+1)/block)*pattern;
                ll rem=(n-repeat+1)%block;
                ans+=sm[repeat-1+rem]-sm[repeat-1];
                cout<<ans<<"\n";
                printed=true;
                break;
            }
            else
            {
                mp[x]=i;
                x=(x*x)%m;
            }
        }
        if(!printed)cout<<sm[n]<<"\n";
        /*tcitr++;
    }*/
    return 0;
}

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

using namespace std;

int main(){
    int x, a, b;
    scanf("%d %d %d", &x, &a, &b);
    int minCake = x - a;
    int cntDough = minCake / b;
    printf("%d", x - a - cntDough * b);
}


Measured memory_bytes: 256
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B);}
#define endl "\n"

const ll MOD = 1000000007;
const int MX = 3e5 + 5;

vector<int> v[MX], u[MX];
bool vis[MX];
set<int> C1[MX], C2[MX];
int f = 0;
int res[MX];
int n, n1, n2;
int com[MX];

void dfs1(int s){
    vis[s] = 1;
    for(auto i : v[s]) if(!vis[i]) dfs1(i);
    C1[f].insert(s);
}

void dfs2(int s){
    vis[s] = 1;
    for(auto i : u[s]) if(!vis[i]) dfs2(i);
    com[s] = f;
}

void input(){
    cin >> n >> n1 >> n2;
    repp(i, 1, n1){
        int a, b;
        cin >> a >> b;
        v[a].pb(b), v[b].pb(a);
    }
    repp(i, 1, n2){
        int a, b;
        cin >> a >> b;
        u[a].pb(b), u[b].pb(a);
    }
}
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    input();

    repp(i, 1, n) if(!vis[i]) ++f, dfs1(i);
    f = 0;
    mem0(vis);
    repp(i, 1, n) if(!vis[i]) ++f, dfs2(i);


    repp(i, 1, n){
        if(C1[i].size() == 0) break;
        vector<int> temp;
        for(auto j : C1[i]) temp.pb(j);
        for(auto j : temp) C2[com[j]].insert(j);
        for(auto j : temp) res[j] += C2[com[j]].size() - 1;
        for(auto j : temp) C2[com[j]].clear();
    }

    repp(i, 1, n) cout << res[i] + 1 << " ";
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 66228
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<queue>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<cstdlib>
#define lson l,mid,o<<1
#define rson mid + 1,r,o<<1|1
#define sc(x) scanf("%d",&x);
#define For(i,a,b)  for(i = a; i <= b; i++)
typedef long long LL;
typedef unsigned long long uLL;
const int INF = 0x3f3f3f3f;
const LL MAX_N = 1e5 + 5;
const LL mod = 1e9 + 7;
const double PI = acos(-1);
using namespace std;

int main()
{
    LL n;
    cin>>n;
    LL x=sqrt((double)n);
    int ans;
    LL g;
    for(LL i=1;i<=x;++i){
        if(n%i==0){
            ans=0;
            g=n/i;
            while(g){
                ans++;
                g/=10;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
#define endl '\n'
#define F first
#define S second
const int MAX_N=1e2+2;
const int MAX_V=(1e3+3)*MAX_N;
const int MAX_W=1e9+9;

int n,W;
int w[MAX_N], v[MAX_N];
int dp[MAX_N][MAX_V];
int ans;

int main()
{
	for(int i=0;i<MAX_N;i++) for(int j=0;j<MAX_V;j++) dp[i][j]=MAX_W;
	scanf("%d%d",&n,&W);
	for(int i=1;i<=n;i++) scanf("%d%d",&w[i],&v[i]);
	dp[0][0]=0;
	for(int i=1;i<=n;i++) for(int j=0;j<MAX_V;j++)
		if(j-v[i]>=0)
			dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
		else dp[i][j]=dp[i-1][j];
	for(int i=0;i<MAX_V;i++) if(dp[n][i]<=W)
		ans=i;
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 40960
def cal():
    snukes, snacks = input().split(" ")
    list1 = []
    for i in range(int(snacks)):
        num = int(input())
        str1 = input()
        list1.extend(str1.split(" "))

    count = 0

    for i in range(1, int(snukes) + 1):
        if str(i) not in list1:
            count += 1
    print(count)


cal()




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

using namespace std;
typedef long long ll;
typedef long double ld;

const int maxn = 2e5 + 10;

int a[maxn], pre[maxn], nex[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];
	stack<int> st;
	st.push(0);
	for (int i = 1; i <= n; i++){
		while (a[i] < a[st.top()])
			st.pop();
		pre[i] = st.top();
		st.push(i);
	}
	while (!st.empty())
		st.pop();
	st.push(n + 1);
	for (int i = n; i >= 1; i--){
		while (a[i] < a[st.top()])
			st.pop();
		nex[i] = st.top();
		st.push(i);
	}
	ll answer = 0;
	for (int i = 1; i <= n; i++)
		answer += 1ll * (nex[i] - i) * (i - pre[i]) * a[i];
	cout << answer << endl;
}


Measured memory_bytes: 3456
/*
*/

//#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int n;
vector<pair<int,int> > g[N];
vector<int> sons[N];
int val[N];
int used[N];
int orig_val[N];

void dfs(int v,int par_cost=0){
	used[v]=1;
	for (int i=0;i<g[v].size();i++){
		int to=g[v][i].first;
		if (used[to])
			continue;
		int cost=g[v][i].second;
		sons[v].push_back(to);
		dfs(to,cost);
	}

	for (int i=0;i<sons[v].size();i++){
		int to=sons[v][i];
		val[v]^=orig_val[to];
	}
	val[v]^=par_cost;
	orig_val[v]=par_cost;
}

int ans;
int cnt[N];
int pcount[N];
int dp[N];
int mem_xor[N];

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>n;
	for (int i=1;i<n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		g[a].push_back(make_pair(b,c));
		g[b].push_back(make_pair(a,c));
	}

	for (int i=1;i<(1<<16);i++){
		pcount[i]=pcount[i/2]+i%2;
	}

	for (int mask=0;mask<(1<<16);mask++){
		int here=0;
		for (int i=0;i<16;i++){
			if (mask&(1<<i))
				here^=i;
		}
		mem_xor[mask]=here;
	}

	dfs(0);

	for (int i=1;i<n;i++){
		//cout<<val[i]<<endl;
		cnt[val[i]]++;
	}

	for (int i=0;i<16;i++){
		if (i!=0)
			ans+=cnt[i]/2;
		cnt[i]%=2;
	}

	/*for (int i=0;i<16;i++){
		cout<<i<<" "<<cnt[i]<<endl;
	}*/

	dp[0]=0;

	for (int mask=1;mask<(1<<16);mask++){
		int smask=mask;
		dp[mask]=1e9;
		while (true){
			if (smask==0)
				break;
			int here=pcount[smask];
			int is_good=mem_xor[smask];
			if (is_good==0)
				here--;
			dp[mask]=min(dp[mask],dp[mask^smask]+here);
			dp[mask]=min(dp[mask],dp[mask^smask]+dp[smask]);
			smask=(smask-1);
			smask&=mask;
		}
	}

	long long s=0;
	for (int i=0;i<(1<<16);i++){
		s+=dp[i];
	}
//	cout<<s<<endl;

	int interesting=0;
	for (int i=0;i<16;i++){
		if (cnt[i])
			interesting|=(1<<i);
	}
	cout<<ans+dp[interesting]<<endl;

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 58240
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 2*acos(0.0)
#define f first
#define s second
#define pb push_back
#define gap ' '
#define fastio {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mod 998244353
#define N 100005
int n;
int ara[N][4];
int dp[N][4];
int max(int a,int b,int c)
{
    return max(a,max(b,c));
}
int solve(int i,int j)
{
    if(i==n) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    if(j==0)
    {
        return dp[i][j]=ara[i][j]+max(solve(i+1,1),solve(i+1,2));
    }
    else if(j==1)
    {
        return dp[i][j]=ara[i][j]+max(solve(i+1,2),solve(i+1,0));
    }
    else if(j==2)
    {
        return dp[i][j]=ara[i][j]+max(solve(i+1,0),solve(i+1,1));
    }
}
int  main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++) cin>>ara[i][j];
    }
    memset(dp,-1,sizeof dp);
    cout<< max(solve(0,0),solve(0,1),solve(0,2))<<endl;
}


Measured memory_bytes: 8064
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	static Scanner sc = new Scanner(System.in);

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		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());
		}
	}

	public static void main(String[] args){

		solve_abc161_a();
	}
  
  	public static void solve_abc161_a(){

		FastScanner sc = new FastScanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		System.out.println(c + " " + a + " " + b);

	}
}

Measured memory_bytes: 23252
#[allow(unused_imports)]
use std::io::Write;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(non_snake_case)]
fn main() {
    input![a: f32, b: f32];
    let ans: usize = (0.5 + (a + b) / 2.0) as usize;
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main() {
    int n;
    cin >> n;
    double a = n / (1.08);
    for (int i = int(a - 1); i <= int(a + 1); ++i) {
        if (int(i * 1.08) == n) {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();

        if (a == b && a == c && b == c) {
            System.out.println(1);
        } else if (a != b && a == c && b == c) {
            System.out.println(2);
        } else if (a == b && a != c && b == c) {
            System.out.println(2);
        } else if (a == b && a == c && b != c) {
            System.out.println(2);
        } else if (a != b && a != c && b == c) {
            System.out.println(2);
        } else if (a != b && a == c && b != c) {
            System.out.println(2);
        } else if (a == b && a != c && b != c) {
            System.out.println(2);
        } else if (a != b && a != c && b != c) {
            System.out.println(3);
        }
        

        sc.close();
    }
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#define sanyes ios_base::sync_with_stdio(0), cout.tie(0); cin.tie(0);
#define llong long long
#define pb push_back
#define bpc __builtin_popcount

const llong mxn = 1e5 + 7;
const llong mod = 998244353;
const llong inf = 1e18 + 9;

using namespace std;

llong n, l, dp[mxn][3], a[mxn], b[mxn], c[mxn], mx = -inf;

int main (){
    cin >> n;
    for (int i = 1; i <= n; i ++){
        cin >> a[i] >> b[i] >> c[i];
    }for (int i = 1; i <= n; i ++){
        dp[i][1] = max(dp[i - 1][2], dp[i - 1][3]) + a[i];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][3]) + b[i];
        dp[i][3] = max(dp[i - 1][1], dp[i - 1][2]) + c[i];
    }mx = max(dp[n][1], max(dp[n][2], dp[n][3]));
    cout << mx;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;

	sort(s.begin(), s.end());
	sort(t.begin(), t.end(),greater<char>());

	//cout << t << endl;

	if (s < t) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <boost/unordered_set.hpp>

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int extgcd(int a, int b, int &x, int &y) { int g = a; x = 1; y = 0; if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x; return g; }

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

const int MAX_N = 5005;
int N;
string S;

unordered_map<int, int> MAP;
boost::unordered_set<int> SET[3];

class RollingHash {
public:
  RollingHash(string& _S) {
    makeHashTable(_S);
  }

  void makeHashTable(string& _S) {
    S = _S; N = S.size();
    for(int h = 0; h < HASH_TABLE_SIZE; h++) {
      hashTable[h].clear(); hashTable[h].resize(N+1);
      sumRollA[h].clear(); sumRollA[h].resize(N+1);
      sumRollA[h][0] = 1;
      for(int n = 0; n < N; n++) {
        sumRollA[h][n+1] = (sumRollA[h][n] * rollA[h]) % rollB[h];
        hashTable[h][n+1] = (hashTable[h][n]*rollA[h] + S[n]) % rollB[h];
      }
    }
  }

  LL getHash(int l, int r, int h = 0) {
    return (int)((hashTable[h][r] + rollB[h]) - (int)((sumRollA[h][r-l]*hashTable[h][l])%rollB[h])) % rollB[h];
  }

private:
  string S;
  int N;
  static const int HASH_TABLE_SIZE = 3;
  vector<LL> hashTable[HASH_TABLE_SIZE];
  LL rollA[HASH_TABLE_SIZE] = {53,107,109};
  LL rollB[HASH_TABLE_SIZE] = {1000000007, 1000000009, 1000000019};
  vector<LL> sumRollA[HASH_TABLE_SIZE];
};

signed main()
{
  cin >> N;
  cin >> S;
  RollingHash rh(S);

  int ans = 0;
  int lLen = 0, rLen = S.size();
  while(rLen-lLen > 1) {

    int len = (rLen + lLen)/2;

    bool check = false;
    for(int r = S.size(); 1 <= r; r--) {
      int l = r-len;
      if(0 <= l) {
        int cnt = 0;
        REP(n,3) {
          if(SET[n].find(rh.getHash(l,r,n)) != SET[n].end()) {
            cnt++;
          }
        }
        if(cnt == 3) {
          check = true;
        }
      }
      int rr = r-1+len;
      if(rr <= S.size()) {
        REP(n,3) {
          SET[n].insert(rh.getHash(r-1,rr,n));
        }
      }
    }

    REP(n,3) {
      SET[n].clear();
    }

    if(check) {
      lLen = len;
    } else {
      rLen = len;
    }
  }
  
  cout << lLen << endl; 

  return 0;
}


Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll p=1000000007ll;
const int N=200005;
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
int a[N],b[N],n,u,s;
inline void solve(int x){
//	printf("solve %d\n",x);
	int i,t,s2=0;u=0;
	for(i=1;i<=n;++i)s2+=(b[i]=a[i]%x);
	sort(b+1,b+n+1);
	t=n-s2/x;
	for(i=1;i<=t;++i)u+=b[i];
}
int main(){
	int i,t,k,ans=0;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;++i){scanf("%d",&a[i]);s+=a[i];}
//	printf("sum=%d\n",s);
	t=sqrt(s);
	for(i=1;i<=t;++i)if(!(s%i)){
		solve(  i);if(u<=k)cmax(ans,  i);
		solve(s/i);if(u<=k)cmax(ans,s/i);
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;

int p[1000000];
int pt[1000000];
int pn;

int dp[1000001];

void init(){
  memset(p,1,sizeof(int)*1000000);
  memset(pt,0,sizeof(int)*1000000);
  memset(dp,0,sizeof(int)*1000001);
  p[0] = p[1]  = 0;
  for(int i =0; i < 1000; i++){
    if(p[i]){
      for(int j = i +i;j < 1000000;j +=i){
	p[j] = 0;
      }
    }
  }
  pn =0;
  for(int i = 0; i < 1000000;i++){
    if(p[i]){
      pt[pn] = i;
      pn++;
    }
  }
}

int solve(int t){
  int res = 0;  
  for(int i =0 ;pt[i]<=t/2;i++){
    if(p[t-pt[i]]){
      res++;
    }
  }
  return res;
}


int main(){
  int in;
  init();
  while(1){
    cin>>in;
    if(!in){
      break;
    }
    cout << solve(in) << endl;
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>

using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using ll = long long;
using P = pair<ll,ll>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n,l;
cin >> n >> l;
vector<ll> a(n);
rep(i,n) {
    cin >> a[i];
}
ll ind = -1;
rep(i,n - 1){
    if(a[i] + a[i + 1] >= l)
        ind = i + 1;
}
if(ind == -1){
    cout << "Impossible" << endl;
    return 0;
}
cout << "Possible" << endl;
for(int i = 1; i < n; i++){
    if(i == ind)break;
    cout << i << endl;
}
for(int i = n - 1; 0 < i; i--){
    if(i == ind)break;
    cout << i << endl;
}
cout << ind << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define MAXN maxn

using namespace std;

long long X, Y;
int res;

signed main()
{
  IO;
  cin >> X >> Y;
  while (X <= Y) {
    X <<= 1;
    res++;
  }
  cout << res << endl;
  return 0;
}



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

int main()
{
  int X;
  cin >> X;
  vector<bool> expo(X + 1);
  expo[1] = 1;
  for (int b = 2; b <= X; b++)
  {
    int v = b * b;
    while (v <= X)
    {
      expo[v] = 1;
      v *= b;
    }
  }
  for (int i = X; i >= 1; i--)
    if (expo[i])
    {
      cout << i << endl;
      return 0;
    }
}


Measured memory_bytes: 3608
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.Arrays;
import java.lang.Math;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        StringBuilder ans = new StringBuilder();
        while (n>0) {
            n--;
            ans.append((char)('a'+n%26));
            n=n/26;
        }
        System.out.println(ans.reverse());







    }
    public static String convertFromBaseToBase(String str, int fromBase, int toBase) {
        return Integer.toString(Integer.parseInt(str, fromBase), toBase);
    }


    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");

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

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

        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
    }

}



Measured memory_bytes: 35824
#include <bits/stdc++.h>
#define REP(i,a,b) for(int(i)=(a);(i)<(b);++(i))
#define RREP(i,a,b) for(int(i)=(a)-1;(i)>=(b);--(i))
#define ALL(x) (x).begin(),(x).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
using namespace std;
typedef long long ll;

int main()
{
  string S;
  cin >> S;
  // 入力しづらい (連続がある)
  bool ans = (S[0] == S[1]) || (S[1] == S[2]) || (S[2] == S[3]);
  cout << (ans ? "Bad" : "Good") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int a, b, c , e;
  cin >> a >> b >> c;

  if (a > b)
  {
  	e = a;
  	a = b;
  	b = e;
  }
  if (b > c)
  {
  	e = b;
  	b = c;
  	c = e;
  } 
  if (a > b)
  {
  	e = a;
  	a = b;
  	b = e;
  }

  	cout << a << " "<< b << " "<< c << endl;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
template <typename T>
void print(std::vector<T>& v, std::string s = " ") {}



void solve(long long N, std::vector<long long> a){
  ll alice=0, bob=0;
  sort(a.begin(), a.end(), std::greater<long long>());
  REP(i,N){
    if(i%2==0)alice+=a[i];
    else bob+=a[i];
  }
  cout << alice-bob << endl;

}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> a(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
  }
  solve(N, std::move(a));
  return 0;
}


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

int main()
{
    int n ,i;
    scanf("%d",&n);
    long long a[n],b[n],sum=0;
    for (i=0;i<n+1;i++)
    {
                scanf("%lld",&a[i]);
    }
    for (i=0;i<n;i++)
    {
                scanf("%lld",&b[i]);
    }
    for (i=0;i<n;i++)
    {
                 int mon = min(a[i],b[i]) ;
                 //printf("mon 1 %d\n",mon);
                 sum+= mon;
                 b[i]-= mon;
//printf("mon 2 %lld\n",mon);
                 mon = min(a[i+1],b[i]);
                 sum+= mon ;
                 //printf("mon 3 %lld\n\n",mon);
                 b[i]-=mon;
                 a[i+1]-= mon;
    }
    printf("%lld",sum);
    return 0;
}


Measured memory_bytes: 5324
import java.util.*;

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

		int N = sc.nextInt();
		int K = sc.nextInt();
	        
		int pt = 1;
		
		pt *= K;
		for(int i=1;i<N;i++) {
			pt *= K-1;
		}
		
		System.out.println(pt);
	}
}


Measured memory_bytes: 21844
from collections import Counter

s = input()
t = input()
# sとtの文字列をカウントして昇順にソート
ss = sorted(Counter(s).values())
st = sorted(Counter(t).values())
# アルファベットの種類数と要素数が同じならYes
print("Yes") if ss == st else print("No")


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

int main() {
  int n,gray,brown,green,lightblue,blue,yellow,orange,red,almighty;
  cin>>n;
  vector<int> a(n);
  gray=brown=green=lightblue=blue=yellow=orange=red=almighty=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]<400)gray=1;
    else if(a[i]<800)brown=1;
    else if(a[i]<1200)green=1;
    else if(a[i]<1600)lightblue=1;
    else if(a[i]<2000)blue=1;
    else if(a[i]<2400)yellow=1;
    else if(a[i]<2800)orange=1;
    else if(a[i]<3200)red=1;
    else almighty++;
  }
  red=gray+brown+green+lightblue+blue+yellow+orange+red;
  
  if(red>=almighty)cout<<red<<" "<<red+almighty<<endl;
  else cout<<max(red,1)<<" "<<red+almighty<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>

typedef long long int ll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;

using namespace std;

const int MAX = 300000;

int Prime[55555];
bool isPrime[MAX];


int main()
{
	int N;
	cin >> N;
	REP(i, MAX)
	{
		isPrime[i] = true;
	}

	int num = 0;
	isPrime[0] = isPrime[1] = false;
	for (int i = 2; i < MAX; ++i)
	{
		if (!isPrime[i])continue;
		if (i <= 55555)
		{
			Prime[num++] = i;
		}
		for (int j = 2 * i; j < MAX; j += i)
		{
			isPrime[j] = false;
		}
	}

	vector<int> ans;
	REP(i, num)
	{
		if (Prime[i] % 10 == 1)
		{
			ans.push_back(Prime[i]);
		}
		if (ans.size() == N)break;
	}

	cout << ans[0];
	REP(i, N-1)
	{
		cout << " " << ans[i + 1];
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  int n;
  string s;
  cin >> n >> s;
  int ans = 0, tmp = 0;
  rep(i,n){
    if(s[i]=='I'){ tmp++; }else {tmp--;}
    ans = max(ans,tmp);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
main(){
  int W,w[30],n,a,b,i,tmp;
  scanf("%d",&W);
  for(i=0;i<W;i++){
    w[i+1]=i+1;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d,%d",&a,&b);
    tmp=w[a];
    w[a]=w[b];
    w[b]=tmp;
  }
  for(i=0;i<W;i++){
    printf("%d\n",w[i+1]);
  }
  return 0;
}

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

int main()
{
	int h,a;
	cin >> h >> a;
	cout << (h+a-1) / a << endl;
	return 0;
}

Measured memory_bytes: 3592