akhauriyash/Code-Regression huggingface dataset:
//                             In The Name Of Allah                                           
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define ll long long
#define int long long
#define ld long double
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std; 

const int N = 310, OO = 1e9 + 7, K = 3e5 + 100, T = 5, M = 1e9 + 7, P = 6151, SQ = 450, lg = 20;
typedef pair <int, int> pii;
int dp[N][N], c[N][N], sum[N][N];	

int32_t main() {
	use_fast;
	int n, m, mod;
	cin >> n >> m >> mod;
	for(int i = 0; i <= n; i++) {
		c[i][0] = c[i][i] = 1;
		for(int j = 1; j < n; j++)
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
	}
	for(int i = m; ~i; i--)
		dp[0][i] = 1, sum[0][i] = sum[0][i + 1] + 1;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= m; j++) 
			for(int k = 1; k <= i; k++) 
				dp[i][j] = (dp[i][j] + dp[i - k][j] * sum[k - 1][j + 1] % mod * c[i - 1][k - 1] % mod) % mod;
		for(int j = m; ~j; j--) 
			sum[i][j] = (sum[i][j + 1] + dp[i][j]) % mod;
	}
	cout << dp[n][0] << endl;
	return 0;
}


Measured memory_bytes: 5700
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
	int n;
	cin >> n;
	int s[n];
	REP(i,n) cin >> s[i];
	sort(s, s + n);
	int sum = 0;
	REP(i,n) sum += s[i];
	if(sum % 10 == 0){
		REP(i,n){
			if(s[i] % 10 != 0){
				cout << sum - s[i] << endl;
				return 0;
			}
		}
		cout << 0 << endl;
	}else cout << sum << endl;
}

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

#define ios  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll n;

int main() {
    ios;

    ll n,k;
    cin>>n>>k;
    ll arr[n+2];
    for(ll i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    ll dp[n+2]={0};
    for(ll i=0;i<=n+1;i++)
        dp[i]=1000000000;
    dp[n]=0;
     for(ll i=n-1;i>=1;i--)
     {
         for(ll j=1;j+i<=n&&j<=k;j++)
         {
           dp[i]=min(dp[i],(dp[i+j]+abs(arr[i+j]-arr[i])));
         }

     }
     cout<<dp[1];
     return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#define N 100000
  
struct Node{
  int p;
  int left;
  int right;
};
  
struct Node T[N];
int count =0;
int depth(int);
void degree(int);
  
int main(){
  int i,j,n,k,left,right,node,m,c;
    
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = T[i].left = T[i].right = -1;
  for(i=0;i<n;i++){
    scanf("%d%d",&node,&m);
    for(j=0;j<m;j++){
      scanf("%d",&c);
      T[c].p = node;
      if(j!=0) T[left].right = c;
      else T[node].left = c;
      left = c;
    }
  }
    
  for(i=0;i<n;i++){
    count = 0;
    printf("node %d: parent = %d, depth = %d, ",i,T[i].p,depth(i));
    if(T[i].p == -1) printf("root, [");
    else if(T[i].left == -1) printf("leaf, [");
    else  printf("internal node, [");
    count = 0;
    degree(T[i].left);
    printf("]\n");
  }
  return 0;
}
    
int depth(int id){
  if(T[id].p==-1){
 return count;
  }
  else{
    count++;
    return  depth(T[id].p);
  }
}
  
void degree(int id){
  if(id!=-1){
    if(count!=0){
      printf(", ");
    }
    printf("%d",id);
    count++;
    degree(T[id].right);
  }
}

Measured memory_bytes: 3924
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fbo find_by_order
#define ook order_of_key
#define f first
#define s second
#define pb push_back
#define reset(a,b) memset(a,b,sizeof a);
#define MOD 998244353
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 200003
#define pc(x) putchar_unlocked(x);
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int n,a[mx],jaw=1e9,di[mx],pake[mx];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		di[a[i]]=i;
	}
	for(int i=n;i>0;i--){
		pake[i]=1;
		if(di[i+1]>di[i])
			pake[i]=pake[i+1]+1;
	}
	for(int i=1;i<=n;i++){
		//cout<<pake[i]<<endl;
		jaw=min(jaw,n-pake[i]);
	}
	cout<<jaw;
}




Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include<cmath>
#include<iomanip>
#include <algorithm>
#include<string.h>
#include<queue>
#include<deque>
#include<set>

using namespace std;
//cout<<setprecision(9)<<fixed<<a;
typedef long long ll;


int main()

{

     int n;
     cin>>n;
     while(1)
     {
          bool p=true;
         for(int i=2; i*i<=n; i++)
         {
             if(n%i==0)
             {
                   p=false;
                   n++;
                  break;
             }

         }
         if(p)
         {
             return cout<<n,0;
         }

     }

}











Measured memory_bytes: 3604
#include <stdio.h>

int main(void){
	int i , d , area;
	while(scanf("%d" , &d)!=EOF){
		area =0;
		for(i=0;i*d<600;i++){
			area += d * ((d * i) * (d * i));
		}
		printf("%d\n" , area);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

string s;
ll cnt[28];

int main(void){
	cin >> s;
	ll n=s.size();
	ll res=1LL;
	for(int i=0;i<n;i++){
		res+=(ll)i-cnt[s[i]-'a'];
		cnt[s[i]-'a']++;
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int h = sc.nextInt();
		int w = sc.nextInt();
		int K = sc.nextInt();
		int[][] grid = new int[h][w];
		for(int i = 0; i < h; i++){
		    String s = sc.next();
		    for(int j = 0; j < w; j++){
		        grid[i][j] = s.charAt(j) - '0';
		    }
		}
		
		// 計算
		int result = Integer.MAX_VALUE;
		
		loop:
		for(int i = 0; i < 1<<(h-1); i++){
		    int cnt = Integer.bitCount(i);
		    int[] gid = new int[h];
		    for(int j = 0; j < h-1; j++){
		        if((i>>j & 1) == 1){
		            gid[j+1] = gid[j] + 1;
		        }else{
		            gid[j+1] = gid[j];
		        }
		    }
		    int[][] ggrid = new int[cnt+1][w];
		    for(int j = 0; j < h; j++){
		        for(int k = 0; k < w; k++){
		            ggrid[gid[j]][k] += grid[j][k];
		        }
		    }
		    int[] gsum = new int[cnt+1];
		    int tmp = cnt;
		    for(int j = 0; j < w; j++){
		        boolean flg = false;
		        for(int k = 0; k < cnt+1; k++){
		            if(ggrid[k][j] > K) continue loop;
		            if(gsum[k]+ggrid[k][j] > K) flg = true;
		        }
		        if(flg){
		            tmp++;
		            Arrays.fill(gsum, 0);
		        }
		        for(int k = 0; k < cnt+1; k++){
		            gsum[k] += ggrid[k][j];
		        }
		    }
		    
		    result = min(result, tmp);
		}
		
		// 出力
		System.out.println(result);
		
	}
}


Measured memory_bytes: 36100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");

		int a = Integer.parseInt(str[0]);
		int b = Integer.parseInt(str[1]);

		System.out.println(a * b);
	}
}

Measured memory_bytes: 32448
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define For(i,start,end) for(i64 i = start; i < end; i++)
#define newline std::cout<<'\n';
#define newlinedx(num) for(int i=0;i<num;i++)std::cout<<'\n';
using namespace std;
typedef long long ll;
typedef unsigned long ul;

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ui = uint64_t;

//----------------library in this time--------------------------------
template <class T>
T gcd(const T a,const T b) {
    return (b == 0) ? a : gcd (b, a % b);
}
template <class T>
T lcm(const T a, const T b) {
    return a * b / gcd(a,b);
}
template <class T>
inline T ave(const T a, const T b) {
    return (a + b) / 2.0f;
}

long long squareTwo(const long long a,const long long b) {
    return (b == 1) ? a : squareTwo(a * 2, b - 1);
}

template <class T>
inline T Max(const T a,const T b) {
    return (a >= b) ? a : b;
}

template <class T>
inline T Min(const T a,const T b) {
    return (a <= b) ? a : b;
}


//------------------------main function-------------------------------
void Main(){
    int a,b; cin >> a >> b;
    if(a >= 10 || b >= 10) cout << -1 << endl;
    else cout << a * b << endl;
}

//--------------------------------------------------------------------
int main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(10);
     
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long int
const LL INF = 1e18;
const int N = 3 * 1e5 + 5;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	string s;
	cin >> s;
	int m = (s[5]-'0') * 10 + s[6]-'0';
	if (m<=4) cout << "Heisei\n";
	else cout << "TBD\n";
	return 0;
}


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

#define ll long long
#define ld long double
#define db double
#define pb push_back
#define nl '\n'
#define X first
#define Y second
#define nimble ios::sync_with_stdio(0);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define mod(x,m) ((((x)%(m))+(m))%(m))
#define _sz(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(v) for(int i=0;i<_sz(v);i++)
#define rep1(i,b,a) for(int i=b;i>=a;i--)
#define preci(x) fixed<<setprecision(x)
#define tc int tt=1;cin>>tt;while(tt--)

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout<<name<<" : "<<arg1<<nl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');
    cout.write(names,comma-names)<<" : "<<arg1<<" | ";
    __f(comma+1, args...);
}
#else
#endif

int inf=0x3f3f3f3f;
ll infl=0x3f3f3f3f3f3f3f3fLL;
ld infd=1.0/0.0;
const ll MOD=1e9+7;// 998244353 // = (119<<23)+1
const ld pi=2*acos(0.0);

ll modi(ll a,ll n){
    ll x=1;
    a%=MOD;
    while(n){
        if(n&1)
            x=(x*a)%MOD;
        n>>=1;
        a=(a*a)%MOD;
    }
    return x;
}
const int N=(int)1e6+7;
ll fac[N];

int main(){
    nimble;
    ll n;
    cin>>n;
    if(n==1){
        cout<<0<<nl;
        return 0;
    }
   /* if(n==2){
        cout<<2<<nl;
        return 0;
    }*/
     fac[0]=1;
     rep(i,1,n+1)
        fac[i]=((ll)i*fac[i-1])%MOD;
    ll as=modi(10ll,n);
    ll bad=0;
    for(ll i=1;i<=n;i++){
        ll z=(  ( (fac[n]*(modi(fac[n-i],MOD-2)))%MOD   ) *modi(8,n-i))%MOD;
        (z*=modi(fac[i],MOD-2))%=MOD;
        (bad+=z)%=MOD;
    }
    bad%=MOD;
    as=as-modi(8ll,n);
    as+=MOD;
    as%=MOD;
    (bad*=2)%=MOD;
    as=as-bad;
    as+=MOD;
    as%=MOD;
    cout<<as;
    return 0;
}



Measured memory_bytes: 11460
n = int(input())
tab = []
good = 0
for i in range(n):
	a, b = map(int, input().split())
	tab.append([a, b])
	if i > 1:
		if tab[-1][0] == tab[-1][1] and tab[-2][0] == tab[-2][1] and tab[-3][0] == tab[-3][1]:
			good = 1
	
if good:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 9220
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b

ans = 0
def dfs(i, S, l):
    global ans
    if i >= len(S) - 1:
        pre = 0
        for j in l + [len(S) - 1]:
            ans += int(S[pre:j + 1])
            pre = j + 1
        return

    dfs(i + 1, S, l[:] + [i])
    dfs(i + 1, S, l[:])


def main():
    S = input()
    dfs(0, S, [])
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3952
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    int h,w;
    string s[100];
    cin>>h>>w;
    for(int i=0;i<h;i++)
        cin>>s[i];
    int dp[100][100];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            dp[i][j]=mod;
            if(i==0&&j==0)
                dp[i][j]=s[0][0]=='#';
            if(i!=0)
                dp[i][j]=min(dp[i-1][j]+(s[i][j]=='#'&&s[i-1][j]=='.'),dp[i][j]);
            if(j!=0)
                dp[i][j]=min(dp[i][j-1]+(s[i][j]=='#'&&s[i][j-1]=='.'),dp[i][j]);
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}


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

class Node {
    public:
        vector<int> children;
        vector<int> edge_value;
        int value;
        int parent;
};

class Tree {
    public:
        int root;
        int node_num;
        vector<Node> node;
        
        Tree(vector<vector<int>> hen, int r) {
            root = r;
            node_num = hen.size();
            node = vector<Node>(hen.size());
            
            queue<int> v;
            v.push(root);
            node[root].parent = -1;
            int edge_num = 0;
            while(!v.empty()) {
                int tyoten = v.front();
                node[tyoten].value = tyoten;
                v.pop();
                for (int i = 0; i < hen[tyoten].size(); i++) {
                    int child = hen[tyoten][i];
                    if (child != node[tyoten].parent) {
                        node[tyoten].children.push_back(child);
                        node[tyoten].edge_value.push_back(edge_num);
                        edge_num++;
                        node[child].parent = tyoten;
                        v.push(child);
                    }
                }
            }
        }
        
        Tree(vector<vector<int>> hen, vector<vector<long long>> w, int r) {
            root = r;
            node_num = hen.size();
            node = vector<Node>(hen.size());
            
            queue<int> v;
            v.push(root);
            node[root].parent = -1;
            while(!v.empty()) {
                int tyoten = v.front();
                node[tyoten].value = tyoten;
                v.pop();
                for (int i = 0; i < hen[tyoten].size(); i++) {
                    int child = hen[tyoten][i];
                    if (child != node[tyoten].parent) {
                        node[tyoten].children.push_back(child);
                        node[tyoten].edge_value.push_back(w[tyoten][i]);
                        node[child].parent = tyoten;
                        v.push(child);
                    }
                }
            }
        }
};

int main(void){
    int n;
    cin >> n;
    vector<vector<int>> hen(n);
    vector<vector<ll>> weight(n);
    
    rep(i, n-1) {
        int u, v;
        ll w;
        cin >> u >> v >> w;
        hen[u-1].push_back(v-1);
        hen[v-1].push_back(u-1);
        weight[u-1].push_back(w);
        weight[v-1].push_back(w);
    }
    
    vector<int> color(n, 0);
    Tree tree(hen, weight, 0);
    queue<pair<int, ll>> que;
    que.push(make_pair(0, 0));
    while(!que.empty()) {
        pair<int, ll> p = que.front();
        que.pop();
        for(int i = 0; i < tree.node[p.first].children.size(); i++) {
            ll d = p.second+tree.node[p.first].edge_value[i];
            if (d % 2 == 1)
                color[tree.node[p.first].children[i]] = 1;
            que.push(make_pair(tree.node[p.first].children[i], d));
        }
    }
    
    for (int i = 0; i < n; i++)
        cout << color[i] << " ";
}

Measured memory_bytes: 32384
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------

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

    map<ll,ll> rem;
    map<ll,ll> mp;
    rep(i, n){
        rem[x[i] % m]++;
        mp[x[i]]++;
    }
    map<ll,map<ll,ll>> mp2;
    for(auto &i : mp){
        mp2[i.first % m][i.first] = i.second / 2;
    }

    ll ans = 0;
    ll M;
    if(m % 2 == 0){
        M = m / 2;
    } else {
        M = (m - 1) / 2;
    }
    for(int i = 0; i <= M; i++){
        if(i == 0){
            ans += rem[i] / 2;
        } else if(m % 2 == 0 && i == m / 2){
            ans += rem[i] / 2;
        } else {
            ans += min(rem[i], rem[m - i]);
            ll rest = abs(rem[i] - rem[m - i]);
            //cout << i << " " << rest << endl;
            ll plus = 0;
            if(rem[i] > rem[m - i]){
                ll totalpair = 0;
                for(auto &j : mp2[i]){
                    totalpair += j.second;
                }
                plus += min(totalpair, rest / 2);
            } else if(rem[i] <= rem[m - i]) {
                ll totalpair = 0;
                for(auto &j : mp2[m-i]){
                    totalpair += j.second;
                }
                plus += min(totalpair, rest / 2);
            }

            ans += plus;
        }
    }

    cout << ans << endl;


}


Measured memory_bytes: 29184
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 100000
#define INFTY (1<<30)
 
class Edge {
public:
    int t, w;
    Edge(int t,int w):t(t),w(w){}
};
 
vector<Edge> G[MAX];
int n, d[MAX];
 
void bfs(int s) {
    for (int i = 0; i < n; i++)d[i] = INFTY;
    queue<int> Q;
    Q.push(s);
    d[s] = 0;
    int u;
    while (!Q.empty()) {
        u = Q.front();
        Q.pop();
        for (int i = 0; i < G[u].size(); i++) {
            Edge e = G[u][i];
            if (d[e.t] == INFTY) {
                d[e.t] = d[u] + e.w;
                Q.push(e.t);
            }
        }
    }
}
 
void solve() {
    bfs(0);
    int maxv = 0;
    int tgt = 0;
    for (int i = 0; i < n; i++) {
        if (maxv < d[i]) {
            maxv = d[i];
            tgt = i;
        }
    }
 
    bfs(tgt);
    maxv = 0;
    for (int i = 0; i < n; i++) {
        if (d[i] == INFTY)continue;
        maxv = max(maxv, d[i]);
    }
 
    cout << maxv << endl;
}
 
main() {
    int s, t, w;
    cin >> n;
 
    for (int i = 0; i < n - 1; i++) {
        cin >> s >> t >> w;
 
        G[s].push_back(Edge(t, w));
        G[t].push_back(Edge(s, w));
    }
    solve();
}


Measured memory_bytes: 9852
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    ll n;
    cin>>n;
    vector<ll> as(n);
    rep(i, n) cin>>as[i];
    vector<ll> bs(n);
    rep(i, n) cin>>bs[i];

    ll m = 0;
    ll cnt = 0;
    rep(i, n) {
        ll d = bs[i] - as[i];
        m += d;
        if (d < 0) cnt += -d;
        if (d > 0 && d % 2 == 1) cnt++;
    }
    if (m < 0) {
        cout<<"No"<<endl;
        return 0;
    }
    if (cnt > m) {
        cout<<"No"<<endl;
        return 0;
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long



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

    int n,x,y; cin >> n >> x >> y;
    vector<vector<int> > ans(n+10,vector<int>(n+10));
    
    for(int i = 1;i < n+1;i ++){
        for(int j = i+1;j < n+1;j ++){
            if(j <= x || y <= i){
                ans.at(i).at(j) = j-i;
            }else if(i <= x && y <= j){
                ans.at(i).at(j) = (x-i) + (j-y) + 1;
            }else{
                ans.at(i).at(j) = min(j-i, abs(x-i) + 1 + abs(y-j));
            }
        }
    }

    vector<int> bns(n+10);
    for(int i = 1;i < n+1;i ++){
        for(int j = 1;j < n+1;j ++){
            if(ans.at(i).at(j) > 0)bns.at(ans.at(i).at(j)) ++;
        }
    }

    for(int i = 1;i < n;i ++){
        cout << bns.at(i) << endl;
    }

/*    for(int i = 1;i < n+1;i ++){
        for(int j = 1;j < n+1;j ++){
            cout << ans.at(i).at(j) << " ";
        }
        cout << endl;
    }
    */
}


Measured memory_bytes: 31872
#include <stdio.h>
int main(void){
    long long int i, n, s = 1, result = 0;
    
    scanf("%lld", &n);
    
    if( n % 2 == 1 ){
        printf("0\n");
        return 0;
    } 
    
    for( i = 5; s > 0; i *= 5  ){
        s = n / (i*2);
        result += s;
    }
    
    printf("%lld\n", result);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int R, G, B, N; cin >> R >> G >> B >> N;
  int ans = 0;
  REP(r, 3001){
    REP(g, 3001){
      int b = (N - r*R - g*G)/B;
      if(b < 0 || b > 3000 || (N - r*R - g*G)%B != 0) continue;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}
int main() {
  ll a, b;
  cin >> a >> b;
  ll g=euclidean_gcd(a, b);
  cout << a*b/g;
}
  

Measured memory_bytes: 256
#include"iostream"
#include"vector"
#include"stdio.h"
using namespace std;
class branch
{
public:
  int id;
  int p;
  int sibling;
  int right;
  int left;
};
vector<branch> tree;
int preParse(int id)
{
  if(id==-1)
    {
      return 0;
    }
  cout<<" "<<id;
  preParse(tree[id].left);
  preParse(tree[id].right);
}
int inParse(int id)
{
  if(id==-1)
    {
      return 0;
    }
  inParse(tree[id].left);
  cout<<" "<<id;
  inParse(tree[id].right);
}
int postParse(int id)
{
  if(id==-1)
    {
      return 0;
    }
  postParse(tree[id].left);
  postParse(tree[id].right);
  cout<<" "<<id;
}
int main()
{
  branch buf;
  buf.p=-1;
  buf.sibling=-1;
  int n;
  int hId;
  cin>>n;
  for(int i=0;i<n;i++)
    {
      tree.push_back(buf);
    }
  for(int i=0;i<n;i++)
    {
      int id;
      int right,left;
      cin>>id;
      tree[id].id=id;
      cin>>left;
      tree[id].left=left;
      cin>>right;
      tree[id].right=right;
      if(right!=-1)
        {
          tree[right].p=id;
          tree[right].sibling=left;
        }
      if(left!=-1)
        {
          tree[left].p=id;
          tree[left].sibling=right;
        }
    }
  for(int i=0;i<tree.size();i++)
    {
      if(tree[i].p==-1)
        {
          hId=tree[i].id;
        }
    }
  cout<<"Preorder"<<endl;
  preParse(hId);
  cout<<endl;
  cout<<"Inorder"<<endl;
  inParse(hId);
  cout<<endl;
  cout<<"Postorder"<<endl;
  postParse(hId);
  cout<<endl;
  return 0;
}


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

unsigned euclidean_gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

int gcd(int a, int b, int c) {
	int ans;
	ans = euclidean_gcd(a, b);
	ans = euclidean_gcd(ans, c);
	return ans;
}

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

	int output = 0;
	for (int a = 1; a <= K; a++) {
		for (int b = 1; b <= K; b++) {
			for (int c = 1; c <= K; c++) {
				output += gcd(a, b, c);
			}
		}
	}

	cout << output << endl;

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <tuple>
#include <cmath>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;

template<typename T>auto& operator<<(ostream &s, const vector<T> &v) {
   s << v.size() << " [";
   for (auto e:v) {
      s << e << "\t";
   }
   s << "]";
   return s;
}
#define rep(i, m) for(ll i=0;i<(m);i++)
#define rep1(i, m) for(ll i=1;i<=(m);i++)
#define FOR(i, a, b) for(ll i=(a);i<(b);i++)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//https://cpprefjp.github.io/reference/algorithm/unique.html
int main() {
   int N; cin >> N;
   vector<ll> A;
   int m;
   rep(i, N) {
      cin >> m;
      A.push_back(m);
   }
   sort(A.begin(), A.end());
   vector<ll> p;
   p.push_back(0);
   p.push_back(0);
   rep(i, N-1) {
      if (A[i] == A[i+1]) {
         i++;
         p.push_back(A[i]);
      }
   }
   sort(p.begin(), p.end());
   reverse(p.begin(), p.end());
   cout << p[0] * p[1] << endl;
}

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

using namespace std;
const int MAXN = 2e5 + 10;
int mp[MAXN], m, n, sum, tt;

bool Cmp(int a, int b){return a > b;}

int main(){
    //freopen("in", "r", stdin);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1;i <= n; i++) cin >> mp[i], sum += mp[i];
    sort(mp + 1, mp + 1 + n, Cmp);
    for (int i = 1;i <= m; i++){
        if (1.0 * mp[i] < 1.0 * sum / (4.0 * m)){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int l = 0;
        int r = (int)Math.pow(10, 9);
        while (r - l > 1) {
            int x = (l + r) / 2;
            long now = 0;
            for (int i = 0; i < a.length; i++) {
                now += (a[i] - 1) / x;
            }
            if (now <= k) {
                r = x;
            } else {
                l = x;
            }
        }
        System.out.println(r);
    }

}


Measured memory_bytes: 61804
def solve(n: int, s: str) -> str:
    def inc(c: str, n: int) -> str:
        tbl = {
            0: 'A',
            1: 'B',
            2: 'C',
            3: 'D',
            4: 'E',
            5: 'F',
            6: 'G',
            7: 'H',
            8: 'I',
            9: 'J',
            10: 'K',
            11: 'L',
            12: 'M',
            13: 'N',
            14: 'O',
            15: 'P',
            16: 'Q',
            17: 'R',
            18: 'S',
            19: 'T',
            20: 'U',
            21: 'V',
            22: 'W',
            23: 'X',
            24: 'Y',
            25: 'Z',
        }
        rev_tbl = {v: k for k, v in tbl.items()}
        idx = (rev_tbl[c] + n) % len(tbl)
        return tbl[idx]

    return ''.join([inc(c, n) for c in s])


n = int(input().strip())
s = input().strip()
print(solve(n, s))


Measured memory_bytes: 3192
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    if a <= 5:
        print(0)
    elif 6 <= a <= 12:
        print(b // 2)
    else:
        print(b)
    return

#B
def B():
    r, d, x = LI()
    for i in range(10):
        print(x * r - d)
        x = x * r - d
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 38768
#include <stdio.h>



int main(void){
    int n, i,ans=0;
 
    scanf("%d",&n);
    int data[n];
       int top=0,head=n-1;
    
    for (i=0;i<n;i++){
        scanf("%d",&data[i]);
        
    }
    while(top <=head){
        if(ans <0){
            ans+=data[top];
            top+=1;
        }else{
            ans-=data[head];
            head-=1;
            
        }
       
    }  
    if(ans <0){ans*=-1;}
    printf("%d\n",ans);
   
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>
#define F first
#define S second
typedef long long ll;
ll n, mn=2e9, c[100005];
std::pair<ll, ll> a[100005];
int main() {
	ll i;
	scanf("%lld", &n);
	for(i=1; i<=n; i++) scanf("%lld", &a[i].F), a[i].S=i;
	sort(a+1, a+n+1);
	for(i=n; i; i--) {
		if(a[i].S<mn) mn = a[i].S;
		if(a[i].F!=a[i-1].F) c[mn] += (a[i].F - a[i-1].F) * (n+1-i);
	}
	for(i=1; i<=n; i++) printf("%lld\n", c[i]);
	return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0)
				break;
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++)
					if(i == 0 || j == 0)
						System.out.printf("#");
					else if(i == H-1 || j == W-1)
						System.out.printf("#");
					else
						System.out.printf(".");
				System.out.println();
			}
			System.out.println();
		}
	}
}	


Measured memory_bytes: 58748
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double c = sc.nextDouble();
        double sum = (a+b+c)/2;

        if(sum == a || sum == c || sum == b ){
            System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var h = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();

			var dp = new long[n];
			for (int i = 0; i < n; i++) {
				dp[i] = long.MaxValue;
			}

			dp[0] = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 1; j <= 2; j++) {
					if (i + j < n) {
						dp[i + j] = Math.Min(
							dp[i + j],
							dp[i] + Math.Abs(h[i] - h[i + j]));
					}
				}
			}

			Console.WriteLine(dp[n - 1]);
		}
	}
}

Measured memory_bytes: 19680
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vec vector
#define vi vec<int>
#define vvi vec<vec<int>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [=](auto i, auto j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;
int mod_add(int A, int B) { return (A + B) % MOD; }
int mod_sub(int A, int B) { return (A + MOD - B) % MOD; }
int mod_mul(int A, int B) { return ((A % MOD) * (B % MOD)) % MOD; }
int mod_bipow(int X, int Y) {
    if (Y == 0) return 1;
    else if (Y == 1) return X % MOD;
    else if (Y % 2 == 0) {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(Z, Z);
    } else {
        int Z = mod_bipow(X, (int)(Y / 2));
        return mod_mul(mod_mul(Z, Z), X);
    }
}
int mod_inv(int X) { return mod_bipow(X, MOD - 2); }
int mod_div(int A, int B) { return mod_mul(A, mod_inv(B)); }

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n, k;
  int ans = 0;

  cin >> n >> k;
  vi up(k + 1), ex(k + 1);
  FOR(i, 1, k + 1) {
    up[i] = mod_bipow(k / i, n);
  }
  RFOR(i, 0, k + 1) {
    ex[i] = up[i];
    for(int j = i * 2; j <= k; j += i) {
      ex[i] = mod_sub(ex[i], ex[j]);
    }
    ans = mod_add(ans, mod_mul(ex[i], i));
  }

  cout << ans << endl;
  // REP(i, n) {
  //   cout << v[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 4768
a, b = map(int, input().split())

if a * b > 0:
    ans = abs(b - a)
    if a > b:
        ans += 2

else:
    ans = abs(a - b)
    if a > b:
        ans += 1
    tmp = abs(abs(a) - abs(b)) + 1
    ans = min(ans, tmp)
    
print(ans)

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

int main(){
    int N, K, Q; cin >> N >> K >> Q;
    vector<int> score(N);
    score.assign(N, K - Q);

    for(int i = 0; i < Q; i++){
        int A; cin >> A; A--;
        score[A]++;
    }

    for(int i = 0; i < N; i++){
        if(score[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string ans;
    int dx = tx - sx, dy = ty - sy;
    rep(i, dy) ans += "U";
    rep(i, dx) ans += "R";
    rep(i, dy) ans += "D";
    rep(i, dx) ans += "L";

    ans += "L";
    rep(i, dy+1) ans += "U";
    rep(i, dx+1) ans += "R";
    ans += "D";
    ans += "R";
    rep(i, dy+1) ans += "D";
    rep(i, dx+1) ans += "L";
    ans += "U";

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
class Solution
{
    static void Main(String[] args)
    {
 
        var s= Console.ReadLine().Split();
        var n = Convert.ToInt32(s[0]);
        var m= Convert.ToInt32(s[1]);
        var a= Console.ReadLine().Split().Select(c=>Convert.ToInt32(c)).ToList();
        double bar=(1.0/(4.0*m))*a.Sum();
        var pop=a.Where(num=>num>=bar).ToList();
        if(pop.Count()>=m){
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }


        }
 
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt int Q[100005]={0}
#define mp make_pair
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<int>()) 
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(int i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(int i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(int i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
int powe(int n,int m){if(m==0)return 1;int t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
int mpowe(int n,int m){if(m==0)return 1;int t=mpowe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
int logtwo(int n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]<=x){y=mid;ceilsearch(ar,mid+1,high,x,y);}else{ceilsearch(ar,low,mid-1,x,y);}}
int main()
{
    fastio();
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    string s1,s2,u;
    int a,b;
    cin>>s1>>s2>>a>>b>>u;
    if(u==s1)
        a--;
    else if(u==s2)
        b--;
    cout<<a<<" "<<b<<endl;

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
  int a, b, c;
  int freq[12] = {0};
  cin >> a >> b >> c;
  freq[a]++;
  freq[b]++;
  freq[c]++;
  if(freq[5] == 2 && freq[7] == 1)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}

Measured memory_bytes: 256
N = int(input())

ans = 0
bN = N
while bN:
    ans += bN % 10
    bN //= 10

for i in range(17, 0, -1):
    p = N // (10**i)
    if p == 0:
        continue
    
    # tmp = (p-1)*10**i  + int("9"*i)    # 51231 i == 4 $B$G(B10000 $B$H$J$j!">&$O(B5
    tmp = 0
    rem = p-1
    while rem:
        tmp += rem % 10
        rem //= 10

    tmp += 9*i
    # print("i: ", i, "tmp: ", tmp)
    if tmp > ans:
        ans = tmp
print(ans)


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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int n,k,m,aa[110000];
string s;
char c;
signed main(){
	cin>>n>>k>>m;
	cout<<(m+max(n,k)-1)/max(n,k);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0 ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
 
}


int32_t main(){
  fastio;
  int n,k;
  cin>>n>>k;
  n = n%k;
  if(n <= k-n) cout<<n<<endl;
  else cout<< k-n<<endl;
  // Math -> gcd it all // chack MAXN // check ll
  //did you check N=1? Did you mix up N,M?
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<set>
#include<map>
#include<ctime>
#include<iostream>
typedef long long LL;
using namespace std;
const int maxn = 1e6;
char A[27];
map<char , int> Q;
int main()
{
	while( ~scanf(" %s",A) ){
		int len = strlen(A);
		if( len <= 25 ){
			for( int i  = 0 ; i < len ; i++ ){
				Q[A[i]] += 1;
			}
			char T;
			int flag = 0;
			for( char i = 'a' ; i <= 'z' ; i++ ){
				if( Q[i] == 0 ){
					T = i;
					flag = 1;
				}
				if( flag == 1 )	break;
			}
			for( int i = 0 ; i < len ; i++ ){
				printf("%c",A[i]);
			}
			printf("%c\n",T);
		}
		if( len == 26 ){
			for( int i  = 0 ; i < len ; i++ ){
				Q[A[i]] += 1;
			}
			int trn = 0,flag = 0,check = 0;
			for( char i = 'z' ; i >= 'a' ; i-- ){
				if( A[trn] != i ) check = 1;
				if( check == 1 ) break;
				trn++;
			}
			int cq;
			if( check == 1 ){
			for( int i = 25 ; i >= 0 ; i-- ){
				char mit = A[i];
				while( A[i] <= 'z' ){
					if( A[i] < 'z' ){
						A[i] += 1;
					}
					if( Q[A[i]] == 0 ){
						flag = 1;
						cq = i;
					}
					if( flag == 1 )	break;
					if( A[i] == 'z' )	break;
				}
				if( flag == 1 )	break;
				Q[mit]--;
			}
			}
			if( check == 1 ){
				for( int i = 0 ; i <= cq ; i++ ){
					printf("%c",A[i]);
				}
				printf("\n");
			}
			else	printf("-1\n");
		}
		Q.clear();
		memset( A , ' ', sizeof(A) );
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

typedef pair<string, string> P;

struct Data{
  string id1, id2, str;
};

void solve1(int& n, vector<Data>* data){
  Data a;
  for(int i=0; i<n; ++i){
    cin >> a.str >> a.id1 >> a.id2;
    data->push_back(a);
  }
  reverse(data->begin(), data->end());
}

bool check(const string& a, const string& b){
  if(a.size() != b.size()) return false;
  for(int i=0; i<a.size(); ++i){
    if(a[i] == '?' || b[i] == '?') continue;
    if(a[i] != b[i]) return false;
  }
  return true;
}

bool check_permit(Data a, vector<Data>& data){
  for(vector<Data>::iterator i=data.begin(); i!=data.end(); ++i){
    if(check(a.id1, i->id1) && check(a.id2, i->id2)){
      if(i->str == "permit")
	return true;
      else
	return false;
    }
  }
  return false;
}

void solve2(int& n, vector<Data>& data){
  Data a;
  vector<Data> ans;
  for(int i=0; i<n; ++i){
    cin >> a.id1 >> a.id2 >> a.str;
    if(check_permit(a, data)){
      ans.push_back(a);
    }
  }
  cout << ans.size() << endl;
  for(int i=0; i<ans.size(); ++i){
    cout << ans[i].id1 << " " << ans[i].id2 << " " << ans[i].str << endl;
  }
}

int main(){
  int n, m;
  vector<Data> data;
  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;
    solve1(n, &data);
    solve2(m, data);
    data.clear();
  }
  return 0;
}

Measured memory_bytes: 1460
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let a: usize = read!(usize);
    let b: usize = read!(usize);
    let c: usize = read!(usize);
    let X: usize = read!(usize);
    let mut ans = 0;
    for x in 0..(a + 1) {
        for y in 0..(b + 1) {
            for z in 0..(c + 1) {
                let amount = 500 * x + 100 * y + 50 * z;
                if amount == X {
                    ans += 1;
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352