akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, qn;
  cin >> n >> qn;
  vector<vi> g(n);
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vl d(n, 0);
  rep(i, qn) {
    int p, x;
    cin >> p >> x;
    p--;
    d[p] += x;
  }
  vb seen(n, false);
  queue<int> q;
  q.push(0);
  seen[0] = true;
  while(!q.empty()) {
    int i = q.front();
    q.pop();
    for(int ni : g[i]) {
      if(seen[ni]) continue;
      seen[ni] = true;
      d[ni] += d[i];
      q.push(ni);
    }
  }
  rep(i, n) cout << d[i] << ' ';
  cout << endl;
}

Measured memory_bytes: 16372
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] T = new int[N];
    int sum = 0;
    for (int i = 0; i < N; i++) {
      T[i] = sc.nextInt();
      sum += T[i];
    }
    int M = sc.nextInt();
    int[] P = new int[M];
    int[] X = new int[M];
    for (int i = 0; i < M; i++) {
      P[i] = sc.nextInt();
      X[i] = sc.nextInt();
    }
    for (int i = 0; i < M; i++) {
      int d = X[i] - T[P[i] - 1];
      System.out.println(sum + d);
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

void solve(istream& cin, ostream& cout) {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while(true) {
    c -= b;
    if (c <= 0) {
      cout << "Yes" << endl;
      return;
    }
    a -= d;
    if (a <= 0) {
      cout << "No" << endl;
      return;
    }
  }
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e13;
const int mod = 1e9+7;
#define ll long long

signed main() {
    string s;
    cin >> s;
    int n = s.length();
    if(n==1 || (n==2 && s[0]!=s[1])) {
        cout << "YES" << endl;
        return 0;
    }
    if(n==2 && s[0]==s[1]) {
        cout << "NO" << endl;
        return 0;
    }  
    vector<int> a(26,0);
    rep(i,n) {
        int c = (int)(s[i]-'a');
        a[c]++;
        if((n+2)/3<a[c]) {
            cout <<"NO" << endl;
            return 0;
        }
    }
    int cnt = 0;
    rep(i,26) {
        if(a[i]>0)cnt++;
    }
    if(cnt>2)cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}



Measured memory_bytes: 3764
#include<iostream>
using namespace std;
void solve()
{
int n;
cin>>n;
long long int arr[n],sum(0);
for(int i=0; i<n; ++i)
cin>>arr[i];
for(int i=1; i<n; ++i)
{
if(arr[i]<arr[i-1])
{
sum+=arr[i-1]-arr[i];
arr[i]=arr[i-1];
}
}
cout<<sum;
}
int main()
{
int t;
t=1;
while(t--)
solve();
return 0;
}


Measured memory_bytes: 4724
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = intRead();
        Dictionary<int, int> dic = new Dictionary<int, int>();
        int[] Box = SpRead(' ').Select(a => int.Parse(a)).ToArray();
        foreach (int k in Box) { if (dic.ContainsKey(k)) { dic[k]++; } else { dic.Add(k, 1); } }
        int count = 0;
        foreach (var d in dic)
        {
            if (d.Key < d.Value) count += d.Value - d.Key;
            else if (d.Value < d.Key) count += d.Value;
        }
        Console.WriteLine(count);
    }
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int intRead()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 28252
//https://beta.atcoder.jp/contests/abc109/tasks/abc109_b
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int N;
    cin >> N;
    vector<string> W( N );
    for( auto &x : W )
    {
        cin >> x;
    }
    REP( i, N - 1 )
    {
        if( W[ i ].back() != W[ i + 1 ].front() )
        {
            cout << "No" << endl;
            return 0;
        }
        REP( j, N )
        {
            if( W[ i ] == W[ j ] && i != j )
            {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
ans = 0
if K % 2 == 1:
    for i in range(1, N+1):
        if i % K == 0:
            ans += (N // K) ** 2
elif K % 2 == 0:
    hK = K // 2
    for i in range(1, N+1):
        if i % K == 0:
            ans += (N // K) ** 2
        elif i % hK == 0:
            ans += ((N+hK) // K) ** 2
print(ans)

Measured memory_bytes: 64060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,C;
    cin >>N>>C;
    vector<ll>x(N);
    vector<ll>cx(N);
    vector<ll>v(N);
    rep(i,N){
        ll a,b;
        cin>>a>>b;
        x[i]=a;
        v[i]=b;
        cx[i]=C-a;
    }


    vector<ll>vn(N+1);
    vector<ll>rvn(N+1);
    vector<ll>vn2(N+1);
    vector<ll>rvn2(N+1);
    ll now=0;
    rep(i,N){
        now += v[i];
        vn[i+1] = max(vn[i],now-x[i]);
        //cout<<vn[i+1]<<endl;
    }
    now=0;
    rep(i,N){
        now += v[N-1-i];
        rvn[i+1] = max(rvn[i],now-cx[N-1-i]);
        //cout<<rvn[i+1]<<endl;
    }
    now=0;
    rep(i,N){
        now += v[i];
        vn2[i+1] = max(vn2[i],now-x[i]*2);
    }
    now=0;
    rep(i,N){
        now += v[N-1-i];
        rvn2[i+1] = max(rvn2[i],now-2*cx[N-1-i]);
    }
    ll ans = 0;

    rep(i,N+1){
        chmax(ans,vn[i]+rvn2[N-i]);
        //cout<<vn[i]<<" "<<rvn[N-i]<<endl;
    }
    rep(i,N+1){
        chmax(ans,vn2[i]+rvn[N-i]);
    }
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 8804
import sys
range = xrange
input = raw_input

n, k = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
i = 0
while i < n and A[i] < 0:
    i += 1
Aneg = A[:i]
Apos = A[i:]

Aneg.reverse()
nneg = len(Aneg)
npos = len(Apos)

l = -10**18 - 100
r = 10**18 + 100
while l < r:
    mid = l + r >> 1

    counter = 0
    if mid >= 0:
        counter += nneg * npos
        for B in Aneg, Apos:
            j = 0
            for i in reversed(range(len(B))):
                b = B[i]
                while j < len(B) and B[j] * b <= mid:
                    j += 1
                counter += min(j, i)
    else:
        j = 0
        for i in range(nneg):
            a = Aneg[i]
            while j < npos and Apos[~j] * a <= mid:
                j += 1
            counter += j
    
    if counter >= k:
        r = mid
    else:
        l = mid + 1

print l


Measured memory_bytes: 56092
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// 標準入力からデータを読み込む準備
	try (Scanner sc = new Scanner(System.in)) { 
			while (true) {
			int n = sc.nextInt();
			if (n == 0){ 
				break; 
			}
			int[] scores = new int[n];
			for (int i = 0; i < scores.length; i++) {
				scores[i] = sc.nextInt(); 
			}
			double average = 0, variance = 0;
// ... 平均値averageと，分散varianceを計算しよう ... System.out.println(Math.sqrt(variance));
			for(int i = 0; i<scores.length; i++){
				average += scores[i];
			} 
			average = average/scores.length;
			for(int i=0; i<scores.length; i++){
				variance += (scores[i]-average)*(scores[i]-average);
			}
			variance = variance/scores.length;
			System.out.println(Math.sqrt(variance));
			}	 
		}
	}
}


Measured memory_bytes: 31540
def inpl():
    return list(map(int, input().split()))


N, L = inpl()
A = [L + i - 1 for i in range(1, N + 1)]
sumA = sum(A)

tmp = 10**9
for a in A:
    if tmp > abs(a):
        tmp = abs(a)
        ans = sumA - a

# print(A)
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  int n,na,ans,num;
  ans=1;
  cin >> str;
  n=str.size();
  na=(n-1)/2;
  for(int i=0;i<na;i++){
    num=n-i-1;
    if(str.at(i)==str.at(num)){
    }else{
      ans=0;
    }
  }
  if(na%2==0){
     int nna;
     nna=na/2;
     for(int i=0;i<nna;i++){
       num=na-i-1;
       if(str.at(i)==str.at(num)){
       }else{
        ans=0;
       }
     }
    }else{
      int nnb;
      nnb=(na-1)/2;
      for(int i=0;i<nnb;i++){
      num=na-i-1;
      if(str.at(i)==str.at(num)){
      }else{
       ans=0;
      }
     }
     }
if(ans==0){
  cout<<"No"<<endl;
  }else{
  cout<<"Yes"<<endl;
}
}
  


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a)*b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a)*b);
}

int ccw(xy_t a, xy_t b, xy_t c){
	b -= a, c -= a;
	if(cross(b, c) < 0) return 1;
	if(cross(b, c) > 0) return -1;
	if(dot(b, c) < 0) return 2;
	if(norm(b) < norm(c)) return -2;
	return 0;
}

bool intersectSS(const line &s, const line &t){
	return ccw(s.first, s.second, t.first) * ccw(s.first, s.second, t.second) <= 0
		&& ccw(t.first, t.second, s.first) * ccw(t.first, t.second, s.second) <= 0;
}

xy_t crosspoint(const line &l, const line &m){
	double a = cross(l.second - l.first, m.second - m.first);
	double b = cross(l.second - l.first, l.second - m.first);
	if(abs(a) < EPS && abs(b) < EPS) return m.first;
	if(abs(a) < EPS) assert(false);
	return m.first + b / a * (m.second - m.first);
}

int main(){
	line ls[3];
	xy_t p[3];
	int x1, y1, x2, y2;
	while(cin >> x1 >> y1 >> x2 >> y2 && (x1 || y1 || x2 || y2)){
		ls[0] = line(xy_t(x1, y1), xy_t(x2, y2));
		rep2(i, 1, 3) {
			cin >> x1 >> y1 >> x2 >> y2;
			ls[i] = line(xy_t(x1, y1), xy_t(x2,y2));
		}
		bool ok = true;
		rep(i, 3) if(!intersectSS(ls[i], ls[(i+1)%3])) ok = false;
		if(!ok) {
			cout << "kyo" << endl;
		}else{
			rep(i, 3) p[i] = crosspoint(ls[i], ls[(i+1)%3]);
			double area = abs(cross(p[2] - p[0], p[1] - p[0])) / 2;
			if(area < EPS){
				cout << "kyo" << endl;
			}else if(area < 100000){
				cout << "syo-kichi" << endl;
			}else if(area < 1000000){
				cout << "kichi" << endl;
			}else if(area < 1900000){
				cout << "chu-kichi" << endl;
			}else{
				cout << "dai-kichi" << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Linq;

namespace abc126A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (a[0] <= 5) Console.WriteLine("0");
            if (a[0] <= 12 && a[0] >= 6) Console.WriteLine(a[1] / 2);
            if (a[0] >= 13) Console.WriteLine(a[1]);
        }
    }
}


Measured memory_bytes: 28140
n=int(input())
l=input().split()
li=[int(i) for i in l]
dp=[0 for i in range(n)]
dp[0]=0
for i in range(1,n):
	if(i==1):
		dp[i]=dp[i-1]+abs(li[i]-li[i-1])
	else:
		dp[i]=min(dp[i-1]+abs(li[i]-li[i-1]),dp[i-2]+abs(li[i]-li[i-2]))
print(dp[-1])


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

using namespace std;
typedef vector<int> VI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAXSIZE 3010

int dp[MAXSIZE][MAXSIZE];
string s,t;

int main(){
//	ios::sync_with_stdio(0); cin.tie(0);
	cin>>s>>t;

	s="#"+s;
	t="#"+t;
	FOR(i,1,SIZE(s)-1){
		FOR(j,1,SIZE(t)-1){
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			if(s[i]==t[j])
				dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
		}
	}
	
	string odp;
	int p_1=SIZE(s)-1;
	int p_2=SIZE(t)-1;
	while(p_1!=0||p_2!=0){
		if(p_2==0)
			p_1--;
		else if(p_1==0)
			p_2--;
		else{
			if(s[p_1]==t[p_2]){
				odp+=s[p_1];
				p_1--;
				p_2--;
			}
			else{
				if(dp[p_1][p_2-1]>dp[p_1-1][p_2])
					p_2--;
				else
					p_1--;
			}
		}
	}
	
	FORD(i,SIZE(odp)-1,0)
		cout<<odp[i];
	
	
	return 0;
}


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

int main()
{
    string S; cin >> S;
    int N = S.size();
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        A[N-1-i] = S[i] - '0';
    }

    vector<int> R(N);
    R[0] = A[0];
    int x = 10;
    for (int i = 1; i < N; i++) {
        R[i] = (R[i-1] + A[i] * x) % 2019;
        x = x * 10 % 2019;
    }

    vector<int> cnt(2019, 0);
    cnt[0] = 1;
    for (int r : R) {
        cnt[r]++;
    }

    int ans = 0;
    for (int c : cnt) {
        if (c >= 2) {
            ans += c * (c-1) / 2;
        }
    }
    cout << ans << endl;
}


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

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

  string b = "aeiou";

  char c;
  cin >> c;

  for (int i = 0; i < 5; ++i) {
    if (c == b[i]) {
      cout << "vowel\n";
      return (0);
    }
  }

  cout << "consonant\n";

  return (0);
}


Measured memory_bytes: 3652
#include <iostream>

using namespace std;

int main(){
    int s[3];
    for(int i = 0;i < 3;i++){
        cin >> s[i];
    }
    int ans = 1000;

    int a[3];
    a[0] = abs(s[0] - s[1]) + abs(s[0] - s[2]);
    a[1] = abs(s[1] - s[2]) + abs(s[1] - s[0]);
    a[2] = abs(s[2] - s[0]) + abs(s[2] - s[1]);

    for(int j = 0;j < 3;j++){
        ans = min(ans,a[j]);
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 384
'''
　 ∧_,,∧    究極奥義「WAがACになーれ！！」
　（`・ω・)つ━☆・*。
　⊂　　 ノ 　　　・゜+.
　 し’´Ｊ　　*・ 
'''
import sys
input = sys.stdin.readline
n=int(input())
if n==10**18:
    print(0,0,0,10**9,10**9,0)
    exit()
print(0,0,10**9,1,10**9-n%10**9,1+n//10**9)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
#define FOR(i,to) for(i=0;i<(to);i++)

int64_t N; 
int64_t cnt;
int64_t wait;  
int64_t ans;

int main(int argc,char** argv) {
    // 入力
    cin >> N;
    ans = 0;
    cnt = 0;
    wait = 0;

    while(N%2==0){
        if(wait==0){
            cnt++;
            wait=cnt;
        }else{
            wait--;
        }
        N/=2;
    }
    
    ans = cnt;

    for(int64_t i=3; i*i<=N; i++){    
        cnt = 0;
        wait = 0;
        while(N%i==0){
            if(wait==0){
                cnt++;
                wait=cnt;
            }else{
                wait--;
            }
            N/=i;
        }
        ans = ans + cnt;
    }

    if(N>1)ans++;
    
    // 出力
    std::cout << ans ;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define int int64_t
#define pcnt __builtin_popcount
#define pb push_back
#define ALL(x) (x).begin(),(x).end()
#define vec vector<int>
#define mat vector<vector<int>> //mat データ名(縦,vec(横));
int INF = 1000000000000000001; //10^18+1
int MOD = 1000000007; //10^9+7
//cout << fixed << setprecision(15); (小数点以下表示)

signed main () {
  int X,A,B;
  bool ok=false;
  cin >> X;
  vec five(120);
  for(int i=0;i<120;i++){
    five.at(i)=i*i*i*i*i;
  }
  for(int i=0;i<120;i++){
    for(int j=i+1;j<120;j++){
      if(X%(i-j)==0||X%(i+j)==0){
        if(five.at(j)-five.at(i)==X){
          A=j;
          B=i;
          ok=true;
          break;
        }
        if(five.at(i)+five.at(j)==X){
          A=i;
          B=-j;
          ok=true;
          break;
        }
      }
    }
    if(ok)break;
  }
  if(!ok){
    for(int i=0;i<120;i++){
      if(five.at(i)+five.at(i)==X){
        A=i;
        B=-i;
        break;
      }
    }
  }
  cout << A << ' ' << B << endl;
}

Measured memory_bytes: 3632
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (int)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

ll check(ll leg, vector<int> &arr) {
	ll res = 0;
	for(int &a : arr)
		res += (a/leg+!!(a%leg))-1;
	return res;
}

signed main() {
	EmiliaMyWife

	int n, k;
	cin >> n >> k;
	vector<int> arr(n);
	for(auto &a : arr)
		cin >> a;
	ll l = 1, r = 1e18;
	while(l < r) {
		ll m = (l+r)>>1;
		if(check(m, arr) <= k)
			r = m;
		else
			l = m+1;
	}
	cout << l << '\n';

	return 0;
}


Measured memory_bytes: 3984
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <random>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define pi 3.141592653589793
#define prique priority_queue
constexpr auto mod=1000000007;
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int n){
    int cnt=0;
    for(int i=1;i<=sqrt(n);i++){
        if(n%1==0)cnt++;
    }
    if(cnt!=1) return false;
    else return n!=1;
}
struct UnionFind{
    vector<int> r;
    UnionFind(int N){
        r=vector<int>(N,-1);
    }
    int root(int x){
        if(r[x]<0) return x;
        return r[x]=root(r[x]);
    }
    bool unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(r[x]>r[y]) swap(x,y);
        r[x]+=r[y];
        r[y]=x;
        return true;
    }
    int size(int x){
        return -r[root(x)];
    }
};
vector<int> v;
int n,m,x,cnt=0,ans=0,aa[220000],ab[220000],a=0;
pair<int,int> pp[220000];
string s,ss[220000];
queue<int> que;
signed main(){
    cin>>n>>m;
    m/=1000;
    m-=n;
    rep(i,n+1){
        rep(j,n+1){
            if(i*9+j*4==m&&i+j<=n){
                cout<<i<<' '<<j<<' '<<n-i-j;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1";
}

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


Measured memory_bytes: 256
#include<vector>
#include<string>
#include<stdio.h>
#include<algorithm>
using namespace std;
char in[410000];
string str[110000];
struct Trie{
	int chi[26];
	int sz;
	int flag;
	Trie(){
		for(int i=0;i<26;i++)chi[i]=-1;
		sz=0;flag=0;
	}
};
Trie pool[410000];
char qs[110000][30];
pair<int,int> p[110000];
int ans[110000];
int pl[30][30];
int main(){
	int a;scanf("%d",&a);
	int ind=1;
	for(int i=0;i<a;i++){
		scanf("%s",in);
		str[i]=in;
		int at=0;
		for(int j=0;in[j];j++){
			if(pool[at].chi[in[j]-'a']==-1){
				at=pool[at].chi[in[j]-'a']=ind;
				ind++;
			}else{
				at=pool[at].chi[in[j]-'a'];
			}
			pool[at].sz++;
		}
		pool[at].flag=1;
	}
	int b;scanf("%d",&b);
	for(int i=0;i<b;i++){
		int c;scanf("%d%s",&c,qs[i]);
		c--;
		p[i]=make_pair(c,i);
	}
	std::sort(p,p+b);
	int v=0;
	for(int i=0;i<a;i++){
		for(int j=0;j<26;j++)for(int k=0;k<26;k++)pl[j][k]=0;
		int ad=0;
		int at=0;
		for(int j=0;j<str[i].size();j++){
			if(pool[at].flag)ad++;
			for(int k=0;k<26;k++){
				if(pool[at].chi[k]!=-1&&k!=str[i][j]-'a')pl[k][str[i][j]-'a']+=pool[pool[at].chi[k]].sz;
			}
			at=pool[at].chi[str[i][j]-'a'];
		}
		while(v<b&&p[v].first==i){
			int t=p[v].second;
			int tmp=ad;
			for(int j=0;j<26;j++){
				for(int k=j+1;k<26;k++){
					tmp+=pl[qs[t][j]-'a'][qs[t][k]-'a'];
				}
			}
			ans[t]=tmp;
			v++;
		}
	}
	for(int i=0;i<b;i++)printf("%d\n",ans[i]+1);
}

Measured memory_bytes: 55552
n, m, c = map(int, input().split())
b = [int(i) for i in input().split()]
counter = 0
for s in range(n):
	a = [int(i) for i in input().split()]
	u = [c]
	for t in range(m):
		u.append(b[t] * a[t])
	if sum(u) > 0:
		counter += 1
print(counter)

Measured memory_bytes: 3064
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string line = System.Console.ReadLine();
		string[] ab = line.Split(' ');
		int aa = Convert.ToInt32(ab[0]);
		int bb = Convert.ToInt32(ab[1]);
		decimal a = Convert.ToDecimal(aa);
		decimal b = Convert.ToDecimal(bb);
		Console.WriteLine("{0} {1} {2:F5}",aa/bb,aa%bb,a/b);
	}
}

Measured memory_bytes: 9280
# include <bits/stdc++.h>
using namespace std;
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define db long double
# define scn(x) scanf("%I64d",&x)
# define scan(x) scanf("%d",&x)
# define print(x) printf("%d ",x)
# define prnt(x) printf("%I64d ",x);
# define eol printf("\n")
# define IOS ios_base :: sync_with_stdio(0)
# define pe "Possible"
# define ie "Impossible"
# define halt(...) {fo << (__VA_ARGS__) << '\n';exit(0);}
# define rep1(n) for (int qwerty = 1;qwerty <= n;++qwerty)
# define CF
# ifdef CF
# define DEBUG
# endif // CF
# ifdef DEBUG
# define pp(n) cerr << #n << " = " << n << '\n'
# define ppp(v) for (auto it : v) cerr << it << ' ';cerr << '\n'
# define aprint(x,y,z) for (int i = x;i <= y;++i) cerr << z[i] << ' ';cerr << '\n'
# else
# define pp(n) ;
# define ppp(v) ;
# define aprint(x,y,z);
# endif // DEBUG
# define rep(n) for (int i = 1;i <= n;++i)
const int mod = 1e9 + 7;
int dp[4015][4015];
int f[1 << 20];
int c[1 << 20];
int pow(int a,int b,int mod)
{
    int ans = 1;
    while (b)
    {
        if (b&1) ans = (1ll * ans * a) % mod;
        a = (1ll * a * a) % mod;
        b /= 2;
    }
    return ans;
}
int main(void)
{
    # ifdef CF
    # endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    int n;
    IOS;
    fi>>n;
    vector < pair < int , int > > want;
    for (int i = 1;i <= n;++i)
    {
        int a,b;
        fi>>a>>b;
        dp[2000 - a][2000 - b] += 1;
        want.push_back({a,b});
    }
    for (int i = 0;i < 4003;++i)
        for (int j = 0;j < 4003;++j)
            dp[i+1][j] = (dp[i+1][j] + dp[i][j]) % mod,
            dp[i][j+1] = (dp[i][j] + dp[i][j+1]) % mod;
    f[0] = c[0] = 1;
    for (int i = 1;i <= 1e5;++i)
    {
        f[i] = (1ll * f[i-1] * i) % mod;
        c[i] = pow(f[i],mod - 2,mod);
    }
    auto C = [&](int n,int k)
    {
        int ans = (1ll * f[n] * c[k]) % mod;
        ans = (1ll * ans * c[n - k]) % mod;
        return ans;
    };
    int ans = 0;
    for (auto it : want) ans = (ans + dp[it.x + 2000][it.y + 2000]) % mod;
    for (auto it : want) ans = (ans + mod - 1ll * C((it.x+it.y) << 1,it.x << 1)) % mod;
    ans = (ans * 1ll * pow(2,mod - 2,mod)) % mod;
    fo << ans << '\n';
    return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

const int MAXN = 5e5 + 5;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}

int N,D;
int X[11][11];
int ans;

int is_square(int n) {
    int s = (int)sqrt(n);
    return s*s == n || (s+1)*(s+1) == n;
}

int ok(int i, int j) {
    int s = 0;
    for (int d = 0; d < D; d++) {
        int t = X[i][d] - X[j][d];
        s += t*t;
    }

    //cout << i << ' ' << j << ' ' << s << endl;
    return is_square(s);
}

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N >> D;
    for (int i = 0; i < N; i++) 
        for (int d = 0; d < D; d++) 
            cin >> X[i][d];

    for (int i = 0; i < N; i++)
        for (int j = i+1; j < N; j++)
            if (ok(i,j)) ans++;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner scan = new Scanner(System.in);
		StringBuilder str = new StringBuilder();
		
		int tmp;
		
		while (true) {
			int x = scan.nextInt();
			int y = scan.nextInt();
			
			if (x > y) {
				tmp = x;
				x = y;
				y = tmp;
			}
			if (x == 0 && y == 0)
				break;
			str.append(x + " " + y + "\n");
		}

		System.out.print(str);

	}
}

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

int main()
{
	string P, T;
	cin >> P;
	int ans = 0;
	while(cin >> T &&T != "END_OF_TEXT")
	{
		for(int i = 0; i < T.length(); ++i)
		{
			T[i] = tolower(T[i]);
		}
		
		if(T == P)
		{
			++ans;
		}
	}
	
	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3152
// Created by martinezdiego on 27/5/19

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  int r,d,x;
  cin >> r >> d >> x;
  long long ans[10];
  ans[0] = r*x-d;
  cout << ans[0] << '\n';
  for (int i = 1; i < 10; i++) {
    ans[i] = r*ans[i-1]-d;
    cout << ans[i] << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
char s[N];
int l[N],r[N];
int main()
{
    scanf("%s",s+1);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++)
        if(s[i]=='R') l[i]=l[i-1]+1;
    for(int i=n;i>=1;i--)
        if(s[i]=='L') r[i]=r[i+1]+1;
    for(int i=1;i<=n;i++)
    {
        if(s[i]=='R'&&s[i+1]=='L')
        {
            int a=0,b=0;
            a=l[i]/2+l[i]%2;b=l[i]/2;
            a+=r[i+1]/2;b+=r[i+1]/2+r[i+1]%2;
            printf("%d %d ",a,b);
            i++;
        }
        else printf("0 ");
    }
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N, W;
    cin >> N >> W;
    int v[N], w[N];
    for(int i = 0; i < N; i++) cin >> v[i] >> w[i];
    int dp[N + 1][W + 1];
    for(int i = 0; i < W + 1; i++) dp[0][i] = 0;
    for(int i = 0; i < N + 1; i++) dp[i][0] = 0;

    for(int i = 1; i <= N; i++) {
        for(int j = 1; j <= W; j++) {
            dp[i][j] = dp[i - 1][j];
            if(w[i - 1] <= j) {
                dp[i][j] = max(dp[i - 1][j - w[i - 1]] + v[i - 1], dp[i - 1][j]);
            }
        }
    }
    // for(int i = 0; i < N + 1; i++) {
    //     for(int j = 0; j < W + 1; j++) {
    //         cout << dp[i][j] << ' ';
    //     }
    //     cout << endl;
    // }
    cout << dp[N][W] << endl;
}


Measured memory_bytes: 7032
n=gets.to_i
v=gets.chomp.split("").map(&:to_s)
result=[]
red=v.count("R")
white_amount=v[0..red-1].count("W")
result<<white_amount

count=0
copy=v.dup
s=copy.unshift
while s=="R"
count+=1
s=copy.unshift
end
result<<red-count
p result.min

Measured memory_bytes: 26508
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll k=n*(n+1)/2;
    ll sum=0;
    for(auto &i:a){cin>>i; sum+=i;}
    if(sum%k){cout<<"NO"<<endl; return 0;}
    sum/=k;
    vector<ll> dp(n,0);
    for(int i=1;i<n;i++){
        ll k=a[i-1]+sum-a[i];
        if(k<0 || k%n){cout<<"NO"<<endl; return 0;}
        dp[i]=k/n;
    }
    k=a.back()+sum-a[0];
    if(k<0 || k%n){cout<<"NO"<<endl; return 0;}
    dp[0]=k/n;
    sum=0;
    ll count=0;
    for(int i=0;i<n;i++){
        count+=dp[i];
        sum+=count;
        a[i]-=sum;
    }
    sum=0;
    count=0;
    for(ll i=n-2;i>=0;i--){
        sum-=count;
        sum+=n*dp[i+1];
        count+=dp[i+1];
        a[i]-=sum;
    }
    for(auto &i:a){
        if(i){cout<<"NO"<<endl; return 0;}
    }
    cout<<"YES"<<endl;
    
    
    return 0;
}



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

#define int long long

string to_s(int n, int l) {
	string s;
	while ( n ) {
		s.push_back((n%10)+'0');
		n /= 10;
	}
	for ( int i = s.size(); i < l; i++ ) {
		s.push_back('0');
	}

	return s;
}

signed main() {
	int a, l;
	while ( cin >> a >> l, a+l ) {
		map<int, int> m;
		m[a] = 1;
		int cnt = 2;
		while ( 1 ) {
			string s = to_s(a, l);
			sort(s.begin(), s.end());
			int b = 0;			
			for ( int i = l-1; i >= 0; i-- ) {
				b *= 10;
				b += (s[i]-'0');
			}
			int c = 0;
			for ( int i = 0; i < l; i++ ) {
				c *= 10;
				c += (s[i]-'0');
			}
			a = b-c;
			if ( m[a] ) {
				cout << m[a]-1 << " " << a << " " << cnt-m[a] << endl;
				break;
			}
			m[a] = cnt;
			cnt++;
		}
	}
	return 0;
}



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

int n;
void dfs(string s, char mx){
  if (s.size() == n){
    cout << s << endl;
    return;
  }
  for (char c = 'a'; c <= mx + 1; c++){
    string t = s;
    t += c;
    dfs(t, max(c, mx));
  }
}

int main(){
  cin >> n;
  dfs("", 'a' - 1);
  return 0;
}
  



Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>
using namespace std;
static const int MAX=100;
static const long long INFTY = (1LL<<32);

int n;

int main()
{
  cin >> n;
  long long a[n][n];
  long long ans=0;
  bool del[n][n];
  for(int i=0;i<n;i++)
    {
      for(int j=0;j<n;j++)
	{
	  del[i][j]=false;
	}
    }
  for(int i=0;i<n;i++)
    {
      for(int j=0;j<n;j++)
	{ 
	  cin >> a[i][j];
	}
    }
  //floyd();
  for(int i=0;i<n;i++) 
    {
      for(int j=0;j<n;j++)
	{
	  for(int k=0;k<n;k++)
	    {
	      if(a[i][j] > (a[i][k]+a[k][j]))
		{
		  cout << -1 << endl;
		  return 0;
		}
	      if((a[i][j] == (a[i][k]+a[k][j])) && a[i][k] > 0 && a[k][j] >0)
		{
		  del[i][j]=true;
		}
	    }
	}
    }
  for(int i=0;i<n;i++)
    {
      for(int j=0;j<i;j++)
	{
	  if(del[i][j]!=true) ans+=a[i][j];
	}

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


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

int main() {
    int64_t N;
    cin >> N;
    vector<int64_t> x(N);
    for (int64_t i = 0; i < N; i++) {
        cin >> x[i];
    }

    constexpr int64_t MOD = 1e9 + 7;
    int64_t ans = 1;
    int64_t ng = 0;
    for (int64_t i = 1; i < N; i++) {
        //i番目のロボットが前のロボットについて最大何台分先にゴールできるか考える
        //たとえば1, 2, 3と固まっていたら,3番目のロボットは前の2台のうち1台しか抜けない
        //その抜けない台数をngとする
        //一度ngが増えたら以降も復活することはない

        //とりあえずここまでngが適切に計算されているとする
        //i番目(0-indexed)のロボットの前にはi台のロボットが居るのでi - ngが抜ける台数
        int64_t num = i - ng;

        //i - 1までの答えのどれについても、i番目のロボットを後ろから0番目 ~ num番目まで挿入することができる
        //よってnum + 1倍する
        (ans *= num + 1) %= MOD;

        //i番目を追加したことでngが増えるかどうかを考える
        //すでにngとなったものは消えているとして, num台に自分を加えたnum + 1台が
        //1, 3, 5, ..., 2 * num + 1 みたいに並んでいると大丈夫
        //逆にx[i]が2 * num + 1より小さいならどこかで詰まる
        //x[i]が2 * num + 1以上なら上手くやれば1, 3, 5, ..., 2 * num + 1 と並べることはできるのでこの判定だけで良い
        if (x[i] < 2 * num + 1) {
            ng++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
long long n,a,b,ta,tb;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>a>>b;
	long long res=LLONG_MAX,cur;
	long long cha=b-a;
	if(cha%2LL==0LL){//meet in middle
		res=min(cha/2LL,res);
	}
	else{
		cur=a;
		ta=1;
		tb=b-a;
		cha=tb-ta;
		res=min(cha/2LL+cur,res);
		cur=n-b+1;
		ta=n-(b-a)+1;
		tb=n;
		cha=tb-ta;
		res=min(cha/2LL+cur,res);
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys

def solve():
    input = sys.stdin.readline
    A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    K = int(input())
    print(A[K-1])
    
    return 0

if __name__ == "__main__":
    solve()

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll pro = INT_MIN;
    pro = a * c;
    pro = max(pro, a * d);
    pro = max(pro, b * c);
    pro = max(pro, b * d);
    cout << pro;

    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,d,ans,turn = 0;
  cin >> a >> b >> c >> d;
  while((c>0) && (a>0)) {
    if(turn % 2 == 0) c -= b;
    if(turn % 2 == 1) a -= d;
      ++turn;
    }
  if(turn % 2 == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3636
from collections import deque

SA = deque(list(input()))
SB = deque(list(input()))
SC = deque(list(input()))

turn = 'a'

while True:
    if turn == 'a' and len(SA)==0:
        ans = 'A'
        break
    elif turn =='b' and len(SB)==0:
        ans = 'B'
        break
    elif turn =='c' and len(SC)==0:
        ans = 'C'
        break
    
    if turn =='a':
        turn = SA.popleft()
    elif turn =='b':
        turn = SB.popleft()
    else:
        turn = SC.popleft()
print(ans)



Measured memory_bytes: 3316
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

class question {
public:
	int N, C, K;
	vector<int> T;
	void ans() {
		cin >> N >> C >> K;
		T.resize(N);
		REP(i,N){
			cin >> T[i];
		}
		sort(T.begin(), T.end());
		int l = 0;
		int res = 0;
		while (l < N) {
			l = upper_bound(T.begin() + l, T.begin() + min(l + C, N), T[l] + K) - T.begin();
			res++;
		}
		cout << res << "\n";
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	question q;
	q.ans();
	
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>

// a > b
inline int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a%b);
}

inline int lcm(int a, int b) {
    if (a < b)
        return a * b / gcd(b, a);
    return a * b / gcd(a, b);
}


int main(void) {
    int n, a, b, i, j, *x, ablcm, count;

    while (scanf("%d%d%d\n", &n, &a, &b) != EOF && (n || a || b)) {
        x = (int*)calloc(n+1, sizeof(int));

        for (i = a; i <= n; i += a) {
            x[i] = 1;
        }
        for (i = b; i <= n; i += b) {
            x[i] = 1;
        }
        ablcm = lcm(a, b);
        for (i = 0; i <= ablcm; i += b) {
            for (j = 0; i + j <= n; j += a) {
                x[i + j] = 1;
            }
        }
        for (i = 1, count = 0; i <= n; i++) {
            count += x[i] == 0;
        }

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

        free(x);
    }

    return 0;
}

Measured memory_bytes: 4520
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Windows.Markup;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			//string[] vs = Console.ReadLine().Split();
			long n = long.Parse(Console.ReadLine());
			//int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();

			long[] a = PrimeFactorization(n);
			System.Diagnostics.Debug.WriteLine(string.Join(" ", a));

			long ans = 0;
			int c = 0;
			for (int i = 0; i < a.Length; i++) {
				c++;
				if (i == a.Length - 1 || a[i] != a[i + 1]) {
					//System.Diagnostics.Debug.WriteLine($"{a[i]},{c}");
					int j = 0, sum = 0;
					while (sum < c) {
						j++;
						sum += j;
					}
					if (sum == c) {
						ans += j;
					} else {
						ans += j - 1;
					}
					c = 0;
				}
			}
			Console.WriteLine(ans);

		}

		#region 素因数分解 long[] PrimeFactorization(long a)
		public static long[] PrimeFactorization(long a)
		{
			if (a < 2) { return new long[] { }; }

			List<long> ans = new List<long>();
			while (a % 2 == 0) {
				ans.Add(2);
				a /= 2;
			}
			for (int i = 3; i <= Math.Sqrt(a); i += 2) {
				while (a % i == 0) {
					ans.Add(i);
					a /= i;
				}
			}
			if (a > 1) {
				ans.Add(a);
			}
			return ans.ToArray();
		}
		#endregion

	}
}


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

int main() {
	string s, t, u;
  	int a, b;
  cin >> s >> t >> a >> b >> u;
  
  if(s == u){
  cout << a-1 << " " << b << endl;
  }
  
  else if(t == u){
  cout << a << " " << b-1 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
	int W,H,x,y,r;
	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	if(x-r>=0 && x+r<= W){
		if(y-r>=0 && y+r<=H){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	}
	else{
		printf("No\n");
	}
}

Measured memory_bytes: 1816
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
beat = 0
for i in range(N+1):
    if i == 0:
        if A[i] < B[i]:
            beat += A[i]
            B[i] -= A[i]
        else:
            beat += B[i]
            B[i] = 0
    elif i == N:
        if A[i] <= B[i-1]:
            beat += A[i]
            B[i-1] -= A[i]
        else:
            beat += B[i-1]
    else:
        if A[i] <= B[i-1]:
            beat += A[i]
            B[i-1] -= A[i]
        elif A[i] - B[i-1] <= B[i]:
            beat += A[i]
            B[i] -= (A[i] - B[i-1])
        else:
            beat += B[i-1] + B[i]
            B[i] = 0
print(beat) 

    

Measured memory_bytes: 18752
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

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

string s, t;
const ll ll_inf = 1LL<<60;

int main(){
  cin >> s >> t;
  ll s_size = (ll)s.size();
  ll t_size = (ll)t.size();
  vector<vector<ll>> dp(s_size+1, vector<ll>(t_size+1, 0));
  for(ll i = 0; i < s_size; ++i) {
    for(ll j = 0; j < t_size; ++j) {
      if (s[i] == t[j]) chmax(dp[i+1][j+1], dp[i][j] + 1);
      chmax(dp[i+1][j+1], dp[i+1][j]);
      chmax(dp[i+1][j+1], dp[i][j+1]);
    }
  }

  int i=s_size;
  int j=t_size;
  string ans="";
  while(i>0&&j>0){
    if(dp[i-1][j]==dp[i][j]){
      i--;
    }else if(dp[i][j-1]==dp[i][j]){
      j--;
    }else{
      ans = s[i-1]+ans;
      i--; j--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 70784
fun main(args: Array<String>) {
    val arr = readLine()!!.split(" ").map { it.toInt() }
    val A = Array(arr[0]){ readLine()!!.split(" ").map { it.toInt() } }
    val B = Array(arr[1]){ readLine()!!.toInt() }
    for (i in 0 until arr[0]) println((0 until arr[1]).map { A[i][it]*B[it] }.sum())
}


Measured memory_bytes: 36684
fun main(args : Array<String>) {
    val (a, b, c) = readLine()!!.split(' ').map(String::toLong)
    println(if (a % 2 == 0L || b % 2 == 0L || c % 2 == 0L) 0 else Math.min(Math.min(a * b, b * c), a * c))
}

Measured memory_bytes: 22220
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define per1(i,n) for(int i=n;i>0;i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,ans=0;
    cin>>n;
    vec A(n);
    rep(i,n) cin>>A[i],ans^=A[i];
    rep(i,n) cout<<(ans^A[i])<<" ";
}

Measured memory_bytes: 4660
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    
    string ans = (a + b >= c)? "Yes" : "No";
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

void enqueue(P);
P dequeue(void);

P Q[LEN+1],y;
int head, tail, n;

void enqueue(P x){
 Q[head] = x;
  if( head + 1 == LEN ) head = 0;
  else head++;
}

P dequeue(){
  y = Q[tail];
  if( tail + 1 == LEN ) tail = 0;
  else tail++;
  return y;
}

int main(){
  int sum_time = 0;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 0 ; i < n ; i++ ){
    scanf("%s", u.name);
    scanf("%d", &u.t);
    enqueue(u);
  }

  while(head - tail != 0){
    u = dequeue();
    if( u.t <= q ) {
      sum_time += u.t;
      printf("%s %d\n",u.name,sum_time);
    }
    else{
      u.t -= q;
      sum_time += q;
      enqueue(u);
    }
  }
  return 0;
}

Measured memory_bytes: 10756