akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        while (true) {
                                int n = sc.nextInt(), m = sc.nextInt(), ans = 0;
                                if (n == 0 && m == 0) {
                                        break;
                                }
                                int[] P = new int[n];
                                for (int i = 0; i < n; i++) {
                                        P[i] = sc.nextInt();
                                }
                                Arrays.sort(P);
                                for (int i = 0; i < n / 2; i++) {
                                        int tmp = P[i];
                                        P[i] = P[n - i - 1];
                                        P[n - i - 1] = tmp;
                                }
                                for (int i = 0; i < n; i++) {
                                        if (i % m != m - 1) {
                                                ans += P[i];
                                        }
                                }
                                System.out.println(ans);
                        }
                }
        }
}

Measured memory_bytes: 58656
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


const int P = 998244353;
void add(int &a,int b){
  a += b;
  if(a >= P)
    a -= P;
}
void sub(int &a,int b){
  a -= b;
  if(a < 0)
    a += P;
}
int mul(int a,int b){
  return a * b % P;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  vector<vector<int>> dp(c+1,vector<int>(d+1));
  dp[a][b] = 1;
  for(int i = a;i <= c; i++){
    for(int j = b;j <= d; j++){
      add(dp[i][j], mul(dp[i-1][j], j));
      add(dp[i][j], mul(dp[i][j-1], i));
      sub(dp[i][j], mul(dp[i-1][j-1], (i-1)*(j-1)));
    }
  }
  cout << dp[c][d] << "\n";
}


Measured memory_bytes: 73624
#include <stdio.h>

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

Measured memory_bytes: 584
n, k = map(int, input().split())

if k == 0:
    print(n * n)
    exit()

ans = 0
for i in range(k+1, n+1):
    quo, rem = divmod(n, i)
    ans += quo * (i-k)
    if rem >= k:
        ans += rem - k + 1

print(ans)

Measured memory_bytes: 9116
s = input()
l = len(s)
li = [0]
for i in range(l):
    for j in range(l-i):
        if all([k in ['A','C','G','T'] for k in list(s[i:i+j+1])]):
            li.append(len(s[i:i+j+1]))
print(max(li))

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

using namespace std;

typedef long long i64;

i64 gcd(i64, i64);

int main(void) {
    i64 N, X;
    cin >> N >> X;

    i64 L=N;
    i64 tmp;
    N -= X;
    if (X > N) swap(N, X);
    while (X) {
        if (N % X > 0) {
            L += 2 * (N / X) * X;
        } else {
            L += 2 * (N / X) * X - X;
            break;
        }

        tmp = X;
        X = N % X;
        N = tmp;
    }

    cout << L << endl;
    return 0;
}


i64 gcd(i64 m, i64 n) {
    i64 tmp;
    while (n) {
        if (m >= n) {
            tmp = m % n;
        } else {
            tmp = m;
        }
        m = n;
        n = tmp;
    }
    return m;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define setbits(x)          __builtin_popcountll(x)
#define lp(a,n) for(ll i=a; i<n; i++)
#define lpi(a,n) for(int i=a; i<n; i++)
#define w(t) int t; cin>>t; while(t--)
#define vi vector<int> 
#define vll vector<ll>
#define pll pair<ll, ll>
#define pii pair<int, int>
#define inf 1e9
#define LB lower_bound
#define UB upper_bound
const int mod = 1000000007;
using namespace std;
ll gcd(ll a,ll b){
    if(a==0)return b;
    return gcd(b%a,a);
}
ll lcm(ll a, ll b){
    return (a*b)/gcd(a,b);
}

int prime[100007];
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, -1, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
         
        if (prime[p] == -1) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = p; 
        } 
    } 
    
} 
int lps(string s){
    int len = 0;
    int n = s.length();
    int dp[n];
    dp[0] = 0;
    for(int i=1; i<n; i++){
        if(s[i] == s[len]){
            len++;
            dp[i] = len;
            continue;
        }
        if(len!=0){
            len = dp[len-1];
            i--;
            continue;
        }
        dp[i]=0;
    }
    return dp[n-1];
}
 
ll power(unsigned ll x,unsigned  ll y) 
{ 
    ll res = 1;     
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;  
    } 
    return res; 
}

//to calculate p1^x  *  p2^x2  *p3^x3 ----------
//i.e. prime factorization and store pi and xi in vector 
vector<pair<ll, ll>> pFactor;

void factorize(long long n) 
{ 
    int count = 0; 
  
    // count the number of times 2 divides  
    while (!(n % 2)) { 
        n >>= 1; // equivalent to n=n/2; 
        count++; 
    } 
  
    // if 2 divides it 
    if (count) 
        pFactor.pb({2,count}); 
  
    // check for all the possible numbers that can  
    // divide it 
    for (long long i = 3; i <= sqrt(n); i += 2) { 
        count = 0; 
        while (n % i == 0) { 
            count++; 
            n = n / i; 
        } 
        if (count) 
            pFactor.pb({i,count});
    } 
  
    // if n at the end is a prime number. 
    if (n > 2) 
        pFactor.pb({n,1}); 
} 



int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
    int n;
    cin>>n;
    vi adj[n+1];
    lp(2,n+1){
        int a;
        cin>>a;
        adj[a].pb(i);
    }
    lp(1,n+1){
        cout<<adj[i].size()<<endl;
    }
}

Measured memory_bytes: 14488
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//よくわかんないけど通った？

ll dp[302][301];
int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);


	int N, K;
	scanf("%d", &N);
	scanf("%d", &K);
	int H[302] = {};
	rep1(i, N) scanf("%d", H + i);
	ll hutuu = 0;
	rep(i, N + 1) {
		if (H[i + 1] > H[i]) hutuu += H[i + 1] - H[i];
	}

	if (N == K) {
		printf("0");
		return 0;
	}

	rep(i, N + 1) {
		auto dpi = dp[i];
		ll tmp1 = max(0, H[i + 1] - H[i]);
		ll tmp2 = max(0, H[i] - H[i + 1]);
		ll tmp3 = min(tmp1, tmp2);
		int mae = H[i + 1];
		ll maetmp = tmp3;
		for (int j = i + 2; j <= min(N + 1, K + i + 1); j++) {
			if (mae < H[j]) tmp1 += H[j] - mae;
			if (mae > H[j]) tmp2 += mae - H[j];
			tmp3 = min(tmp1, tmp2);
			if (maetmp < tmp3) {
				int k = j - i - 1;
				auto dpj = dp[j] + k;
				rep(p, K - k + 1) if (dpj[p] < dpi[p] + tmp3) dpj[p] = dpi[p] + tmp3;
			}
			mae = H[j];
			maetmp = tmp3;
		}
		auto dpi2 = dp[i + 1];
		rep(p, K + 1) if (dpi2[p] < dpi[p]) dpi2[p] = dpi[p];
	}
	printf("%lld", hutuu - dp[N + 1][K]);


	Would you please return 0;
}

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

typedef long long int ll;
ll powk(ll a, ll n){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

int main()
{
    ll n, k, s;
    cin >> n >> k >> s;
    for(ll i = 0;i < k;i++){
        cout <<  s << " ";
    }
    for(ll i = k;i < n;i++){
        if(s + 1 < 1000000000){
            cout << s + 1 << " ";
        }
        else{
            cout << s - 1 << " ";
        }
    }

    return 0;
}

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

#define ll long long
#define endl '\n'
#define REP(i, a, n) for(int i=a; i<n; ++i)
#define pb push_back
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()

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

const double PI = 3.141592653589793238460;
const ll mod = 1e9 + 7;

void FAST(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

int main(){
  FAST();

  int n, i;
  string str;
  cin >> n >> str;

  REP(i, 0, str.length()){
      if(str[i] + n <= 'Z')
        str[i] += n;
      else
        str[i] = 'A' + (n - ('Z' - str[i]) - 1);
  }

  cout << str << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

  int T;
  // cin >> T;
  T = 1;

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

void solve() {
  int n, m;
  cin >> n >> m;
  if (n < m) cout << 0 << endl;
  else cout << 10 << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;
string S[] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
int N, M, SLEN = 12;
map<string, int> strtoi;
vector<int> v, vv;
bool f = false;

void dfs(int cnt, int now){
  int n = v[now];
  if(cnt < M && now == 0) return ;
  if(cnt >= M) { if(now == 0) f = true; return ; }
  //cout <<cnt <<", " <<now <<", " <<S[n] <<endl;
  //cout <<"    " <<S[(vv[cnt] - 1 + SLEN) % SLEN] <<", " <<S[vv[cnt]] <<", " <<S[(vv[cnt] + 1) % SLEN] <<endl;
  if(vv[cnt] == n && now - 1 >= 0) dfs(cnt + 1, now - 1);
  if((vv[cnt] + 1) % SLEN == n && now + 1 < N + 1) dfs(cnt + 1, now + 1);
  if((vv[cnt] - 1 + SLEN) % SLEN == n && now - 2 >= 0) dfs(cnt + 1, now - 2);
}

int main() {
  REP(i, SLEN) strtoi[S[i]] = i;
  int T; cin >>T;
  while(T--){
    f = false;
    cin >>N >>M;
    v = vector<int>(N + 1);
    vv = vector<int>(M);
    FOR(i, 1, N + 1){
      string s; cin >>s;
      v[i] = strtoi[s];
    }
    REP(i, M){
      string s; cin >>s;
      vv[i] = strtoi[s];
    }
    REVERSE(vv);
    dfs(0, N);
    if(!f) dfs(0, N - 1);
    cout <<(f ? "Yes" : "No") <<endl;
  }
  return 0;
}

Measured memory_bytes: 4060
import sys
from collections import namedtuple, deque


INF = sys.maxsize
Edge = namedtuple('Edge', 's t d')

V, E, r = map(int, input().split())
edges = []

for _ in range(E):
  s, t, d = map(int, input().split())
  edges.append(Edge(s, t, d))

def solve():
  costs = [INF] * V
  costs[r] = 0
  
  for i in range(V):      
    for edge in edges:
      if costs[edge.s] != INF and costs[edge.t] > costs[edge.s] + edge.d:
        if i == V - 1:
          print('NEGATIVE CYCLE')
          return
          
        costs[edge.t] = costs[edge.s] + edge.d        
      
  for x in costs:
    print(x if x != INF else 'INF')

solve()



Measured memory_bytes: 6524
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		if (k == 1) {
			System.out.println(0);
		} else {
			System.out.println(n - k);
		}
	}
}


Measured memory_bytes: 21588
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
ll MOD = 1000000007;
int main() {
	ll N, M;
	cin >> N >> M;
	ll Factorial1 = 1;
	ll Factorial2 = 1;
  	ll Factorial3 = 1;
	if (N == M) {
		for (ll i = 2; i <= N; ++i) {
			Factorial1 = ((Factorial1 % MOD)*i)%MOD;
		}
		cout << (((Factorial1%MOD)*(Factorial1%MOD)%MOD)*2%MOD)<< endl;
	}
	else if (N+1==M||N==M+1) {
		for (ll i = 1; i <= N; ++i) {
			Factorial2 = ((Factorial2 % MOD)*i)%MOD;
		}
		for (ll i = 1; i <= M; ++i) {
			Factorial3 = ((Factorial3 % MOD)*i)%MOD;
		}
	cout << (Factorial2%MOD)*(Factorial3%MOD)%MOD << endl;}
	else cout<<0<<endl;
}


Measured memory_bytes: 384
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        String[] s = sc.next().split("");
        
        for(int i=1; i<=s.length; i++){
            if(i % 2 == 1){
                System.out.print(s[i-1]);
            }
        }
    }
}

Measured memory_bytes: 32760
#include<cstdio>
#define fo(x,a,b) for(int x=(a),e_=(b);x<=e_;x++)

const int N=200005;
int a[N],n;
struct node{int l,r,c;node(int u=0,int v=0,int w=0){l=u,r=v,c=w;}}s[N];

bool ck(int col){
	int top,len=a[1];
	s[top=1]=node(1,a[1],1);
	fo(i,2,n) {
		if(a[i]>len) {
			s[++top]=node(len+1,a[i],1);
			len=a[i];
			continue;
		}
		while(top>0 && s[top].r>a[i]) {
			if(s[top].l>a[i]) top--;
			else {s[top].r=a[i]; break;}
		}len=a[i];

		for(; top>0 && s[top].c==col; top--) ;
		if(top==0) return false;
		if(s[top].l<s[top].r) {
			++top;s[top].l=s[top].r=s[top-1].r;
			s[top].c=s[top-1].c+1;s[top-1].r--;
		} else s[top].c++;
		if(s[top].r+1<=len) top++,s[top]=node(s[top-1].r+1,len,1);
//		fo(j,1,top) printf("%d~%d:%d  ;",s[j].l,s[j].r,s[j].c);puts("");
	}return true;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n) scanf("%d",&a[i]);

	int l=1, r=n, mid, ans=n;
	while(l<=r){
		mid=(l+r)>>1;
//		printf("mid:%d\n",mid);
		if(ck(mid)) r=mid-1, ans=mid; else l=mid+1;
	}
	printf("%d",ans);
	return 0;
}


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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007
#define tc             ll tc;scanf("%lld",&tc);while(tc--)

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/


int main()
{
    string s,t;
    ll ans=0;
    cin >> s >> t;
    for(ll i=0;i<s.size();i++) if(s[i]!=t[i]) ans++;
    cout << ans;
}


Measured memory_bytes: 3912
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int x = n % 10;
    if (x == 0 || x == 1 || x == 6 || x == 8) {
        cout << "pon" << endl;
    } else if (x == 3) {
        cout << "bon" << endl;
    } else {
        cout << "hon" << endl;
    }
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    
    int a,b,k = 1;
    cin >> a >> b;
    int sum = 0;
    if(b<=9){
        sum = a*10+b ;
    }
    else if (b>9 && b < 100){
        sum = a*100+b;
    }
    else if (b == 100) {
        sum = a*1000+b;
    }
    while (k*k <= sum) {
        k ++ ;
    }
    if((k-1)*(k-1) == sum ) {
        cout << "Yes";
    }
    else{
        cout << "No";
        return 0;
    }
}


Measured memory_bytes: 760
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
typedef long long ll;

int main() {
    set<ll> s;
    int n;
    cin >> n;

    vec d(n);
    for(int i=0;i<n;i++){
        scanf("%d", &d[i]);
    }
    for(int i=0;i<n;i++){
        ll num = 0;
        for(int j=0;j<5&&i+j<n;j++){
            num += d[i+j];
            s.insert(num);
            num *= 10;
        }
    }
    int i=0;
    while(true){
        if(s.count(i)==0){
            cout << i << endl;
            break;
        }
        i++;
    }

    return 0;
}

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

const int maxn = 100100;
vector<int> g[maxn];
int col[maxn];

bool FAIL = false;
ll cnt[3];

void dfs(int u, int c = 1) {
  col[u] = c;
  ++cnt[c];
  for (int v : g[u]) {
    if (col[v]) {
      if (col[v] == col[u]) {
        FAIL = true;
      }
    } else {
      dfs(v, 3 - c);
    }
  }
}

signed main() {
#ifdef LOCAL
  assert(freopen("c.in", "r", stdin));
#endif
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0);
  if (FAIL) {
    cout << ll(n) * (n - 1) / 2 - m << '\n';
  } else {
    cout << cnt[1] * cnt[2] - m << '\n';
  }
}

Measured memory_bytes: 6912
#include <stdio.h>
#include <stdlib.h>
#include <math.h>



int main(void){
	double a,b,c,d,e,f;
	double x,y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
		y=(((c*d)-(a*f))/((b*d)-(a*e)));
		x=((c-(b*y))/a);
		printf("%.3f %.3f\n",x,y);
	}

    return 0;
}


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

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

struct pa {
  ll i;
  ll num;

  bool operator<(const pa& right) const {
    return num == right.num ? i < right.i : num < right.num;
  }
};

int main() {
  ll n, ans[100001] = {};
  cin >> n;
  pa a[n];
  rep(i, 0, n) {
    cin >> a[i].num;
    a[i].i = i;
  }
  sort(a, a + n);

  ll z = a[n - 1].num, zz = z, m = 1145141919;
  dep(i, n - 2, 0) {
    if(z != a[i].num) {
      m = min(m, a[i + 1].i);
      ans[m] += (z - a[i].num) * (n - i - 1);
      zz = z;
      z = a[i].num;
    }
  }

  m = min(m, a[0].i);
  ans[m] += a[0].num * n;

  rep(i, 0, n) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 3456
n,k=map(int,input().split())
v=list(map(int,input().split()))
ans=[]
for i in range(k+1):
  x=v[0:i]
  for j in range(k-i+1):
    if i<=n-j:
      y=v[n-j:n]
    else:
      y=v[i:n]
    L=x+y
    L.sort()
    ct=0
    ct2=0
    for m in range(len(L)):
      if L[m]>=0:
        ct+=L[m]
      else:
        if ct2<k-i-j:
          ct2+=1
        else:
          ct+=L[m]
    ans.append(ct)
print(max(ans))

Measured memory_bytes: 3188
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-01-03 17:21:20
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    for (int i = 0; i < 2*n; i++) {
        if (i % 2 == 0) {
            cout << s[i/2];
        } else {
            cout << t[(i-1)/2];
        }
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8

n=int(input()) 
h=list(map(int, input().split()))

max = 0
i = 0
j = 0
while i < n-1:
    #print("h[",i,"]:", h[i], "->,", h[i+1], " j:", j, ", max:", max)
    if h[i] < h[i+1]:
        if max < j: max = j
        j = 0
    else:
        j += 1
    i += 1
if max < j: max = j
print(max)

Measured memory_bytes: 14252
#define _GLIBCXX_DEBUG //test only

#include<bits/stdc++.h>
using namespace std;

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  int i;
  rep(i,n) cin >> a[i];
  sort(all(a));
  ll inc = 0;
  ll dec = 0;
  ll ans = 0;
  if(n%2 == 0)
  {
    int low = n/2;
    int high = n-low;
    rep(i,low)
    {
      if(i == low-1) dec += a[i];
      else dec += a[i] *2;
    }
    rep(i,high)
    {
      if(i == 0) inc += a[low+i];
      else inc += a[low+i]*2;
    }
    ans = max(ans, inc-dec);
  }
  else
  {
    int low = n/2;
    int high = n-low;
    rep(i,low)
    {
      dec += a[i] *2;
    }
    rep(i,high)
    {
      if(i <= 1) inc += a[low+i];
      else inc += a[low+i]*2;
    }
    ans = max(ans, inc-dec);
    swap(low,high);
    inc = 0;
    dec = 0;
    rep(i,low)
    {
      if(i >= low-2) dec += a[i];
      else dec += a[i]*2;
    }
    rep(i,high)
    {
      inc += a[low+i]*2;
    }
    ans = max(ans, inc-dec);
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))

import math
def lcm(x, y):
    return (x*y)//math.gcd(x, y)
if n >=2:
    ue = lcm(a[0], a[1])
    if n >= 3:
        for i in range(2, n):
            ue = lcm(ue, a[i])
else:
    ue = a[0]

shita = 0
if n >=2:
    for i in range(len(a)):
        shita += ue//a[i]
else:
    shita = n

ans = ue / shita
print(f"{ans:.6f}")


Measured memory_bytes: 9168
import java.util.Scanner;

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

    public static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        System.out.println(c >= a && c <= b ? "Yes" : "No");
    }
}

Measured memory_bytes: 22100
//基本の形
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
    int n;
    cin >> n;
    for (int a=1;a<=9;++a){
        for (int b=1;b<=9;++b){
            if(a*b==n){
                puts("Yes");
                return 0;
            }
        }
    }
    puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <utility>
using namespace std;

long long pow(long long a,long long b,long long mod){
    if(b==0){
        return 1;
    }else{
        if(b%2==0){
            return pow(a*a%mod,b/2,mod);
        }else{
            return pow(a*a%mod,b/2,mod)*a%mod;
        }
    }
}

long long gcd(long long a,long long b){
    long long r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

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

    long long a,b,g;
    long long mod=1000000007;
    map<pair<long long,long long>,pair<int,int>> m;
    int z=0;

    for(int i=0;i<N;i++){
        cin>>a>>b;
        if(a==0 && b==0){
            z++;
        }else if(a==0){
            m[{0,1}].first++;
        }else if(b==0){
            m[{0,1}].second++;
        }else if(a>0&&b>0){
            g=gcd(a,b);
            m[{a/g,b/g}].first++;
        }else if(a>0){
            g=gcd(a,-b);
            m[{-b/g,a/g}].second++;
        }else if(b>0){
            g=gcd(-a,b);
            m[{b/g,-a/g}].second++;
        }else{
            g=gcd(-a,-b);
            m[{-a/g,-b/g}].first++;
        }
    }

    long long ans=1;
    long long tmp;
    for(auto p:m){
        //cout<<p.second.first<<" "<<p.second.second<<endl;
        tmp=pow(2,p.second.first,mod);
        tmp+=pow(2,p.second.second,mod);
        tmp--;
        tmp%=mod;
        ans*=tmp;
        ans%=mod;
    }
    ans--;
    ans+=mod;
    ans%=mod;
    ans+=z;
    ans%=mod;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 16044
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
 
 
int main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    cout << ceil((float)(N - 1) / (float)(K - 1)) << endl;
    return 0;
}


Measured memory_bytes: 640
n, m = [int(i) for i in input().split()]
maxl = -1
minr = 10**6
for i in range(m):
    lh, rh = [int(i) for i in input().split()]
    if maxl < lh:
        maxl = lh
    if minr > rh:
        minr = rh
diff = minr - maxl
if diff >= 0:
    print(diff+1)
else:
    print(0)

Measured memory_bytes: 45928
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,M = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N+M-1)]

out_edge = [set() for _ in range(N+1)]
in_edge = [set() for _ in range(N+1)]
for a,b in AB:
    out_edge[a].add(b)
    in_edge[b].add(a)

# topological sortを計算する
in_deg = [len(x) for x in in_edge]

q = [i for i,x in enumerate(in_deg[1:],1) if x == 0]

node_sorted = []
while q:
    x = q.pop()
    node_sorted.append(x)
    # xから出ている辺を削除
    for y in out_edge[x]:
        in_deg[y] -= 1
        if in_deg[y] == 0:
            q.append(y)

node_rank = {x:i for i,x in enumerate(node_sorted,1)}
node_rank[0] = 0

answer = [0] * (N+1)
for a,b in AB:
    # b の親をaにするか：rankが上なら
    if node_rank[answer[b]] < node_rank[a]:
        answer[b] = a

print('\n'.join(map(str,answer[1:])))

Measured memory_bytes: 90828
#: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"

input = sys.stdin.readline

########################################
a , v  = map(int , input().split())
b , w  = map(int , input().split())
t = int(input())
s = v-w
d = abs(a-b)
if s <= 0:
	print("NO")
	exit()
if d/s <= t:
	print("YES")
else:
	print("NO")










Measured memory_bytes: 9484
#include <iostream>
#include <stack>


int main()
{
	std::stack<int> train;
	int number;
	while(std::cin >> number){
		if(number == 0){
			std::cout << train.top() << std::endl;
			train.pop();
		}
		else
			train.push(number);
	}
	
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
#define reps(i,n) for(ll i=1;i<=(n);++i)
using ll = long long;
using str = string;
constexpr long long INF = (1LL<<60);
constexpr long long MOD = (1e9+7);
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
inline void dump(){cout<<endl;}
template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);}
template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;}
constexpr ll dx[]={1,0,-1,0};
constexpr ll dy[]={0,1,0,-1};
main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(10);
  
  ll h,w;
  cin>>h>>w;
  queue<tuple<ll,ll,ll>> que;
  vector<vector<ll>> cost (h,vector<ll>(w,INF));
  rep(i,h)rep(j,w){
    char c;
    cin>>c;
    if(c=='#')que.emplace(i,j,0);
  }

  while(!que.empty()){
    ll x,y,t;
    tie(y,x,t)=que.front();
    que.pop();
    if( chmin(cost[y][x],t) ){
      rep(i,4){
        ll nx=x+dx[i],ny=y+dy[i],nt=t+1;
        if(nx==-1||nx==w||ny==-1||ny==h)continue;
        que.emplace(ny,nx,nt);
      }
    }
  }

  ll ans=0;
  rep(i,h)rep(j,w)chmax(ans,cost[i][j]);
  cout<<(ans)<<endl;


}


Measured memory_bytes: 107320
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int[] a = new int[3];
		int max = 0;
		for(int i=0;i<3;i++){
			a[i] = sc.nextInt();
			max = (int)Math.max(max, a[i]);
		}
		int count = 0;
		for(int i=0;i<3;i++){
			int x = (max - a[i])/2;
			a[i] += x*2;
			count += x;
		}
		Arrays.sort(a);
		if(a[0]==a[1] && a[1]==a[2]){

		}
		else if(a[2]==a[1]){
			count += 2;
		}
		else{
			count += 1;
		}
		System.out.println(count);

	}
}



Measured memory_bytes: 21844
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
#define N_MAX 100005
int par[N_MAX];
int ran[N_MAX];
int V[N_MAX];
typedef long long ll;

void init(int n){
	for(int i = 0; i < n; i++){
    	par[i] = i;
    	ran[i] = 0;
      	V[i] = 1;
    }
}

int find(int x){
	if(par[x] == x){
    	return x;
    } else {
    	return par[x] = find(par[x]);
    }
}

void unite(int x, int y){
	x = find(x);
  	y = find(y);
  	if(x == y) return;
  	if(ran[x] < ran[y]){
    	par[x] = y;
      	V[y] += V[x];
    } else {
    	par[y] = x;
      	V[x] += V[y];
      	if(ran[x] == ran[y]) ran[x]++;
    }
}

int size(int x) {return V[find(x)];}

bool same(int x, int y){
	return find(x) == find(y);
}
int main(){
	int N, M;
  	cin >> N >> M;
  	int A[N_MAX];
  	int B[N_MAX];
  	ll ans[N_MAX];
  	ll num = N;
    init(N);
  	for(int i = 0; i < M; i++){
    	cin >> A[i] >> B[i];
    }
  	ans[M-1] = (num*(num-1))/2;
  	for(int i = M-2; i >= 0; i--){
      	if(same(A[i+1]-1, B[i+1]-1)) ans[i] = ans[i+1];
        else {
          	ans[i] = ans[i+1] - size(A[i+1]-1)*size(B[i+1]-1);
    		unite(A[i+1]-1, B[i+1]-1);
        }
    }
  	for(int i = 0; i < M; i++){
    	cout << ans[i] << endl;
    }
}

Measured memory_bytes: 4096
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <list>

using namespace std;

const int mod = int(1e9) + 7;
//const int SZ = 10100;
//const int MX = 210500;
#define pii pair<int,int>
#define ll long long
#define sqr(x) (x)*(x)


void solve();
int main(int argc, char** argv)
{
#ifdef LOCAL
    freopen("../in.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
//    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
//-----------------------------------------------------------------------------

const int MX = 100500;

void solve(){
    int n;
    cin >> n;
    int x = 0;
    int y = 0;
    int t = 0;
    while(n--) {
        int x1, y1, t1;
        cin >> t1 >> x1 >> y1;
        int dx = x1 - x;
        int dy = y1 - y;
        int dt = t1 - t;
        if(dx < 0) dx *= -1;
        if(dy < 0) dy *= -1;
        if(dt < 0) dt *= -1;
        dt -= dx + dy;
        if(dt < 0) {
            cout << "No\n";
            return;
        }
        if(dt & 1) {
            cout << "No\n";
            return;
        }
        x = x1;
        y = y1;
        t = t1;
    }
    cout << "Yes\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using namespace std;

int main()
{
	int ans;
	int a, b;
	cin >> a;
	cin >> b;
	ans = max({ a + b, a - b, a*b });
	
	cout << ans << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<=(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    string s,t;
    cin >> s >> t;

    REP(i,s.size()){
        REP(j,s.size()){
            
                if (s[(j)%s.size()] != t[(j+i) % s.size()])
                {
                    goto END;
                }
            
        }
        cout << "Yes" << endl;
        return 0;
    END:;
    }
    cout << "No" << endl;

    return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000;
const ll LINF = (ll) 4000000000000000000;
const ll MOD = (ll) 1000000007;
const double PI = acos(1.0);
const int limit = 100010;

#define REP(i,m,n) for(int i = (int)m; i < (int)n; i++)
#define rep(i,n) REP(i,0,n)
#define rep2(i,n) REP(i,1,n+1)
#define rep3(i,n) REP(i,0,n+1)
#define REPM(i,m,n) for(int i = (int)m; i >= (int)n; i--)
#define REPLL(i,m,n) for(ll i=m;i<(ll)(n);i++)
#define repll(i,n) REPLL(i,0,n)
#define repll2(i,n) REPLL(i,1,n+1)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define Size(s) (int) s.size()
#define smaller_queue  priority_queue <ll, vector<ll>, greater<ll> >

//------------------------------------------------------

int main() {
    int a, b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mx 1000000000000000000
#define ll long long int
int main()
{
    ll a,n;
    cin >> n;
    a = n%10;
    if(a==2 || a== 4 || a==5 || a==7 || a==9)
        cout << "hon" << endl;
    else if(a==0 || a== 1 || a== 6 || a== 8)
        cout << "pon" << endl;
    else if(a==3)
        cout << "bon" << endl;
    return 0;
}


Measured memory_bytes: 3520
arr = Array.new(4){ Array.new(13, 0) }
mark = ["S","H","C","D"]
(gets.to_i).times do
check = gets.split
arr[mark.index(check[0])][(check[1].to_i)-1] = 1
end

4.times do |i|
  13.times do |j|
    if arr[i][j] == 0 then
      puts "#{mark[i]} #{j+1}"
    end
  end
end

Measured memory_bytes: 6096
N = int(input())
A = list(map(int,input().split()))
m = 1000
s = 0
flag = 0
a = A[0]
for i in range(N):
    if A[i]>a and flag==0:
        n = m//a
        s += n
        m -= n*a
        flag = 1
    elif A[i]<a and flag==1:
        m += s*a
        s = 0
        flag = 0
    a = A[i]
if flag==1:
    m += s*A[-1]
print(m)

Measured memory_bytes: 61760
using System;
using System.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("1234");
            WillReturn.Add("150");
            WillReturn.Add("100");
            //84
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1000");
            WillReturn.Add("108");
            WillReturn.Add("108");
            //28
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("579");
            WillReturn.Add("123");
            WillReturn.Add("456");
            //0
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("7477");
            WillReturn.Add("549");
            WillReturn.Add("593");
            //405
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int X = int.Parse(InputList[0]);
        int A = int.Parse(InputList[1]);
        int B = int.Parse(InputList[2]);
        Console.WriteLine((X - A) % B);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define cinf(x,n) for(int i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(int i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

ll ans;

int main(){
	ll n,k,x,y;
	cin >> n;
	cin >> k;
	cin >> x;
	cin >> y;
	rep(i,n){
		if(i<k)
			ans+=x;
		else
			ans+=y;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{
 	long long N,K;
  	cin>>N>>K;
  	long long temp=10e18+1;
  	N=N%K;
  	while(1)
    {
      	N=abs(N-K);
      	if(temp<N)
          break;
      	
      	temp=N;
    }
  	cout<<temp<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
// using ll = boost::multiprecision::int128_t;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;


ll solve(ll a, ll b) {
  if (a == b) return 1;
  if (Log2(a) == Log2(b)) {
    a ^= (1ll<<(Log2(a)-1));
    b ^= (1ll<<(Log2(b)-1));
    return solve(a, b);
  }

  ll ans = 0;

  ll c = b;
  int d1 = Log2(b);
  c = b - (1ll<<(d1-1));
  int d2 = Log2(c);
  c = (1ll<<d2) - 1;
  c += (1ll<<(d1-1));

  ans += c - a + 1;

  ll e = (1ll<<(d1-1)) + a;
  ll f = (1ll<<d1) - 1;
  if (c < e) ans += f - e + 1;
  else ans += f - c;

  return ans;
}


int main() {
  ll a, b; cin >> a >> b;
  cout << solve(a, b) << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

template<typename T> bool chmax( T &a, const T b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }


int main()
{
	ll n; cin >> n;
	vector<ll> x( n ), y( n );
	rep( i, n ) cin >> x[i] >> y[i];

	ll a = -1e18, b = -1e18;
	ll c = 1e18, d = 1e18;
	rep( i, n )
	{
		chmax( a, x[i] + y[i] );
		chmin( c, x[i] + y[i] );
		chmax( b, x[i] - y[i] );
		chmin( d, x[i] - y[i] );
	}

	cout << max( ( a - c ), ( b - d ) ) << endl;

	return ( 0 );
}


Measured memory_bytes: 5988
#include <iostream>
#include <math.h>
using namespace std;
long long n;
int main(void){
    // Your code here!
    cin >> n;
    int rou = sqrt(n), ans, res = 0;
    for (int i = 1; i <= rou; i++) {
        if(n % i == 0) {
            ans = n / i;
        }
    }
    while (ans > 0) {
        ans /= 10;
        res++;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	string s;
	cin >> s;
	if(s[0] != 'A' || s[1] == 'C' || s[(int)s.size() - 1] == 'C'){
		cout << "WA" << endl;
		return 0;
	}
	int cnt = 0;
	int f = 1;
	repn(i, 1, s.size()){
		if(s[i] >= 'A' && s[i] <= 'Z'){
			if(s[i] == 'C'){
				cnt++;
				if(cnt > 1){
					f = 0;
					break;
				}
			}	
			else{
				f = 0;
				break;
			}
		}
	}
	if(!cnt) f = 0;
	if(f) cout << "AC" << endl;
	else cout << "WA" << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256