akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    string S;
    cin >> S;
    map<char, int> list;
    for (int i = 0; i < S.size(); i++)
        list[S[i]]++;
    if (list.size() == S.size())
        cout << "yes";
    else
        cout << "no";
}

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

int main() {
    int n;
    string s[55];
    int t[55];
    string x;

    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i] >> t[i];
    cin >> x;

    int tsum = 0;

    for (int i = 0; i < n; i++) {
        if (s[i] == x) {
            for (int j = i + 1; j < n; j++) {
                tsum += t[j];
            }
            break;
        }
    }

    cout << tsum << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();
		sc.close();
		
		for(int i=-1; i<n; i++){
			for(int j=-1; j<m; j++){
				int num = (i+1)*m + (j+1)*n - (i+1)*(j+1)*2;
				if(k == num){
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
}


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

int main() {
    int A, B, C, D; cin >> A >> B >> C >> D;

    if(A + B > C + D) {
        cout << "Left" << endl;
    } else if(A + B == C + D) {
        cout << "Balanced" << endl;
    } else {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

map<ll, ll> primeFactors(ll n)
{
    map<ll, ll> ret;
    while (n % 2 == 0)
    {
        if( ret.find(2) != ret.end() ) {
            ret[2]++;
        }
        else
        {
            ret[2] = 1;
        }
        n = n / 2;
    }
    for (ll i = 3; i <= sqrt(n); i = i+2)
    {
        while (n%i == 0)
        {
            if( ret.find(i) != ret.end() ) {
            ret[i]++;
        }
        else
        {
            ret[i] = 1;
        }
            n = n / i;
        }
    }
    if (n > 2)
        {
            if( ret.find(n) != ret.end() ) {
            ret[n]++;
        }
        else
        {
            ret[n] = 1;
        }
        }
    return ret;
}

void print_map(map<ll, ll> mp){
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        std::cout << "key = " << itr->first           // キーを表示
                        << ", val = " << itr->second << "\n";    // 値を表示
    }
}

int main()
{
    ll A, B, C;
    cin >> A >> B >> C;
    if (A + B + C == 17){
cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

using ll = long long int;
using P = pair<int,int>;

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

const ll INF=(ll)1e19;
//const int INF=(1<<30);

int main(){
  ll s;
  cin >> s;

  ll x1 = 1000000000;
  ll y1 = (x1 - s%x1)%x1;
  ll y2 = (s+y1)/x1;

  cout << "0 0 1000000000 1 " << y1 << " " << y2 << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include<math.h>
using namespace std;

int main() {
	int n; cin >> n;
	int a[n];
	for (int i = 0; i < n-1; i++) {
		cin >> a[i];
		cout << a[i] << ' ';
	}
	cin >> a[n - 1]; cout << a[n - 1];
	for (int i = 1; i < n; i++) {
		int v = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > v) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		cout << endl;
		for (int i = 0; i < n-1; i++)cout << a[i]<<' ';
		cout << a[n - 1];
	}
	cout<<endl;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	set<string> gchga;
	while(n--){
		cin>>s;
		gchga.insert(s);
	}
	cout<<gchga.size()<<endl;
	return 0;
}


Measured memory_bytes: 19100
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  
  map<int, int> oddm, evenm;
  int oddc = 0, evenc = 0;
  int soddc = 0, sevenc = 0;
  int maxodd = 0, maxeven = 0;
  int smaxodd = 0, smaxeven = 0;
  int maxv = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    maxv = max(A[i], maxv);
  }
  for(int i = 0; i < N; i += 2){
    oddm[A[i]]++;
  }
  for(int i = 1; i < N; i += 2){
    evenm[A[i]]++;
  }
  
  for(int i = 0; i <= maxv; i++){
    if(oddc < oddm[i]){
    oddc = oddm[i];
    maxodd = i;
    }
    if(evenc < evenm[i]){
    evenc = evenm[i];
    maxeven = i;
    }
  }
  
    for(int i = 0; i <= maxv; i++){
    if(soddc < oddm[i] && i != maxodd){
    soddc = oddm[i];
    smaxodd = i;
    }
    if(sevenc < evenm[i] && i != maxeven){
    sevenc = evenm[i];
    smaxeven = i;
    }
  }
  
  if(maxeven != maxodd){
    cout << (N/2 - oddc) + (N/2 - evenc);
  }else if(oddc == N / 2 || evenc == N /2){
    cout << min(oddc,evenc);
  }else{
    cout << min(N / 2 - sevenc + N / 2 - oddc, N / 2 - soddc + N / 2 - evenc);
  }
}


Measured memory_bytes: 9984
#include<stdio.h>
#include<queue>
#include<string.h>
struct S{int i,c,m;S(int i,int c,int m):i(i),c(c),m(m){}bool operator<(const S&r)const{return c>r.c;}};
#define C(d) memset(d,X,sizeof(d))
int main()
{
	int N,M,L,A,B,D,E,X=0x7f7f7f7f;
	int d[100][100],e[100][100],x[100][101],i;
	while(scanf("%d%d%d",&N,&M,&L),N)
	{
		C(d),C(e),C(x);
		while(M--)
		{
			scanf("%d%d%d%d",&A,&B,&D,&E);
			A--,B--;
			d[A][B]=d[B][A]=D;
			e[A][B]=e[B][A]=E;
		}
		std::priority_queue<S>q;
		q.push(S(0,0,L));
		for(;;)
		{
			S p(q.top());q.pop();
			if(x[p.i][p.m]<=p.c)continue;
			if(p.i==N-1){printf("%d\n",p.c);break;}
			x[p.i][p.m]=p.c;
			for(i=0;i<N;++i)
			{
				if(d[p.i][i]==X)continue;
				if(d[p.i][i]<=p.m)q.push(S(i,p.c,p.m-d[p.i][i]));
				q.push(S(i,p.c+e[p.i][i],p.m));
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1532
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define INF 1e9
#define mod 1000000007
#define eps 1e-6
#define abs(x) ((x)>=0?(x):-(x))
#define y1 solai
#define fi first
#define se second
typedef long long ll;
void read(ll &x)
{
	scanf("%lld",&x);
}
void read(ll &x, ll &y)
{
	scanf("%lld%lld",&x,&y);
}
void read(ll &x, ll &y, ll &z)
{
	scanf("%lld%lld%lld",&x,&y,&z);
}
void print(ll x)
{
	printf("%lld ",x);
}
void println(ll x)
{
	printf("%lld\n",x);
}
const ll N=2000;
ll n,k,q,a[N+10],l,r,mid,b[N+10],ans;
void f(ll x)
{
	multiset<ll>s,res;
	ll need;
	for(ll i=1;i<=n;i++)
	{
		if(a[i]>x)
			s.insert(a[i]);
		else
		{
			if(s.size()>=k)
			{
				need=s.size()-k+1;
				for(ll j=1;j<=need;j++)
				{
					res.insert(*s.begin());
					s.erase(s.begin());
					if(res.size()>q)
					{
						auto it=res.end();
						it--;
						res.erase(it);
					}
				}
			}
			s.clear();
		}
	}
	if(s.size()>=k)
	{
		need=s.size()-k+1;
		for(ll j=1;j<=need;j++)
		{
			res.insert(*s.begin());
			s.erase(s.begin());
			if(res.size()>q)
			{
				auto it=res.end();
				it--;
				res.erase(it);
			}
		}
	}
	if(res.size()==q)
		ans=min(ans,*res.rbegin()-*res.begin());
}
int main()
{
	//freopen("c.cpp","r",stdin);
 
	cin>>n>>k>>q;
	for(ll i=1;i<=n;i++)
		read(a[i]),b[i]=a[i];
	sort(b+1,b+n+1);
	ans=b[n];
	for(ll i=0;i<=n;i++)
		f(b[i]);
	cout<<ans;
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
using namespace std;
long long a[100001];

int main(){
	long long n,ans=0,min=1000000001;
	cin>>n;
	for (int i=0;i<n;i++){
		cin>>a[i];
		if (abs(a[i])<min) min=abs(a[i]);
	}
	for (int i=0;i<n-2;i++){
		if (a[i]<0){
			a[i]*=-1;
			a[i+1]*=-1;
		}
		ans+=a[i];
	}
	long long x=abs(a[n-2]),y=abs(a[n-1]);
	if (a[n-2]*a[n-1]<0){
		ans+=x+y-2*min;
	}else ans+=x+y;
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N;
    cin >> N;
    if(!cin) return;
    unordered_map<ll, ll> mp(N);
    mp[0]++;
    ll sum = 0, ans = 0;
    for (int i = 0; i < N; ++i) {
        ll A;
        cin >> A;
        sum += A;
        if(mp.count(sum) != 0){
            ans += mp[sum];
        }
        mp[sum]++;
    } // end i
    cout << ans << endl;
}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    cerr << "DEBUG MODE" << endl;
    string test_cases = "test.txt";
    auto fs = fstream(test_cases, fstream::in);
    while(fs) {
        solve(fs);
    }
#else
    solve(cin);
#endif
    return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iostream>
#define ios   ios_base::sync_with_stdio(false);  cin.tie(0);    cout.tie(0);
typedef   long long int ll;
using namespace std;
const int M=1e9+7;
const int N=1e3+5;
#define fi first
#define se second
#define pb push_back
#define endl "\n"
char a1[N][N];
ll a2[N][N];
int main()
{
   ll h,w;cin>>h>>w;
   for(ll i=1;i<=h;++i)
   {
       for(ll j=1;j<=w;++j)
       {
           cin>>a1[i][j];
       }
   }
   a2[1][1]=1;
   for(ll i=1;i<=h;++i)
   {
       for(ll j=1;j<=w;++j)
       {
           if((i!=1 || j!=1) && a1[i][j]=='.')
           {
               a2[i][j]=(a2[i-1][j]+a2[i][j-1])%M;
           }
       }
   }
   cout<<a2[h][w];
}

Measured memory_bytes: 12484
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <map>
#include <cstdlib>
using namespace std;
int main()
{
    int x, a, b;
    cin >> x >> a >> b;
    cout << x - (a + ((x - a) / b) * b) << endl;
    return 0;
}

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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;


int main(){

    int n, x, t;
    cin >> n >> x >> t;

    if(n % x == 0){
        cout << n / x * t << endl;
    }
    else{
        cout << (n / x + 1) * t << endl;
    }

    return 0;
}

Measured memory_bytes: 3620
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define umap unordered_map
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




//———————UnionFind木   UF uf(n);——————————————————————————

struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void reset(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

//—————————————————————————————————————————————————

using Graph = vector<vector<int>>;


int main() {
  ll n,m;
  cin >>n>>m;
  
  UF uf(n);    
    
  vector<pair<ll,ll>> p(m);
  rep(i,m){
  cin>>p[i].fi>>p[i].se;
  }

  vector<ll> q(m);
  q[m-1]=n*(n-1)/2;
  
  for(ll i=m-1;i>=1;i--){
    if(uf.root(p[i].fi-1)!=uf.root(p[i].se-1)) {
      q[i-1]=q[i]-uf.size(p[i].fi-1)*uf.size(p[i].se-1);
    }
    else q[i-1]=q[i];
    uf.unite(p[i].fi-1,p[i].se-1);
  }
  
  rep(i,m){
  cout << q[i] << endl;
  }
  
}


Measured memory_bytes: 5248
a = []
a.append(int(input()))
if a[0] in {1, 2}:
    s = a[0]
else:
    s = 4
cnt_s = 0
for i in range(10**6):
    if a[i] == s:
        cnt_s += 1
    if cnt_s == 2:
        break

    if a[i] % 2 == 0:
        a.append(a[i] // 2)
    else:
        a.append(3*a[i] + 1) 
print(len(a))

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

using namespace std;

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

typedef long long ll;

int main(){
 ll n;
   cin >> n;

  ll res=0;
  
  vector<pair<ll,ll>> r(n),b(n);
  vector<bool> flag(n,true);
   rep(i,0,n) cin>> r[i].first >> r[i].second;
   rep(i,0,n) cin>> b[i].first >> b[i].second;
  sort(r.begin(),r.end());
  sort(b.begin(),b.end());
  
  rep(i,0,n){
    int index=-1;
    int rs=-1;
   rep(j,0,n){
    if(r[j].first<b[i].first&&r[j].second<b[i].second&&flag[j]&&rs<r[j].second) {
       rs=r[j].second;
       index=j;
    }
   }
    if(index!=-1)  {
      flag[index]=false; 
      res++;
  }
  }
   cout << res << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        // 入力
var S = Console.ReadLine();
var N = S.Length;
 
// 逆順の数列にしておく
var A = S.Select(c => c - '0').Reverse().ToArray();
// 10のk乗を計算しておく
var pow = new int[N];
pow[0] = 1;
for (int i = 1; i < N; i++)
{
    pow[i] = pow[i - 1] * 10;
    pow[i] %= 2019;
}
 
// 元の文字列の右からi桁の10進法での数を計算し2019の余りをとる
var X = new long[N + 1];
for (int i = 0; i < N; i++)
{
    X[i + 1] = X[i] + A[i] * pow[i];
    X[i + 1] %= 2019;
}
 
// 余りが等しいものから2つ選ぶ組み合わせの数を求める
var ans = 0L;
foreach (var g in X.GroupBy(x => x))
{
    // nC2 = N*(N-1)/2
    ans += (long)g.Count() * (g.Count() - 1) / 2;
}
Console.WriteLine(ans);

    }


}





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

int main() {
	string s;
	cin >> s;
	int i;
	if ((s.at(0) == '7') || (s.at(1) == '7') || (s.at(2) == '7')) {
		cout << "Yes" << endl;

	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

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

using namespace std;

int main() {
    int n,m;
    cin>>n;
    string x[1000];
    map<string,int> k;
    for(int i=0;i<n;i++)
    {
        cin>>x[i];
        k[x[i]]++;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        string h;
        cin>>h;
        k[h]--;
    }int sum=0;
    for(int i=0;i<n;i++)
    {
        sum=max(sum,k[x[i]]);
    }
    cout<<sum<<endl;
    return 0;
}

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

int main () {
  string S;
  cin >> S;
  
  int64_t sum = 0;  
  
  for (int tmp = 0; tmp < (1 << ((int)S.size() - 1)); tmp++) {
    bitset<9> s(tmp);
    string T;
    
    for (int i = 0; i < ((int)S.size() - 1); i++) {
      T += S.at(i);
      if (s.test(i)) T += "+";
    }
    T += S.at(S.size() - 1);

    string num;     
    
    for (int i = 0; i < T.size(); i++) {
      if (T.at(i) == '+') {
        sum += stol(num);
        num = "";
      } else {
        num += T.at(i);
      }
    }
    sum += stol(num);
  }
  cout << sum << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=3000;
ll mod,a[maxn],b[maxn],c[maxn];
ll jc[maxn],ans[maxn],tmp;
ll ksm(ll x,ll y) {
	ll res=1;
	while (y) {
		if (y&1) res=res*x%mod;
		x=x*x%mod; y/=2;
	}
	return res;
}
void update(ll &x,ll y) {
	x+=y; if (x>=mod) x-=mod;
} 
int main() {
//	freopen("1.txt","r",stdin);
	read(mod);
	for (int i=0;i<mod;i++) read(a[i]);
	b[1]=1;
	for (int i=1;i<mod;i++) {
		for (int j=1;j<=mod;j++)
			c[j]=(b[j-1]-b[j]*i%mod+mod)%mod;
		swap(b,c);
	}
	jc[0]=1;
	for (int i=1;i<=mod;i++) jc[i]=jc[i-1]*i%mod;
	for (int i=0;i<mod;i++)
	if (a[i]) {
		tmp=jc[i]*jc[mod-i-1]%mod;
		if ((mod-i+1)%2==1) tmp=mod-tmp;
		tmp=ksm(tmp,mod-2);
		if (!i) {
			for (int j=0;j<mod;j++)
				update(ans[j],b[j+1]*tmp%mod);
			continue;
		}
		for (int j=1;j<=mod;j++) c[j]=b[j];
		for (int j=mod-1;j>=0;j--) {
			update(ans[j],c[j+1]*tmp%mod);
			update(c[j],c[j+1]*i%mod);
		}
	}
	for (int i=0;i<mod;i++) printf("%lld ",ans[i]);
	printf("\n");
	return 0;
}

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

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

  long long p = K / 50ll;
  long long q = K % 50ll;

  vector<long long> a(50);
  for (int i = 0; i < 50; i++) {
    a[i] = i < 50 - q ? i : i + 1;
  }
  for (int i = 0; i < 50; i++) {
    a[i] += p;
  }

  cout << 50 << endl;
  for (int i = 0; i < 50; i++) {
    cout << a[i] << " ";
  }
  cout << endl;

  return 0;
}


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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long int N;
	cin >> N;
	long long int a = 26;
	int cnt = 1;
	while (N > a){
	N -= a;
	a *= 26;
	++cnt;
	}
	string s(cnt, '?');
//	cout << N << "\n";
	for (int i = 0; i < cnt; ++i){
		int r = (N + 25) % 26;
		s[cnt-1-i] = (char) 'a' + r;
		N = (N+25) / 26;
	}
	cout << s << "\n";
	return 0;
}


Measured memory_bytes: 3588
#include <iostream>

int main(){
  int a, b, ret;
  std::cin >> a >> b;
  if((1 <= a && a <= 9) && (1 <= b && b <= 9)){
    ret = a*b;
  }
  else{
    ret = -1;
  }
  std::cout << ret << std::endl;
  return 0;
}



Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))

mini = min(X)
maxi = max(X)
consume = 999999999

for i in range(mini, maxi+1):
    pos = i
    total = sum([(pos - j) ** 2 for j in X])
    consume = min(total, consume)

print(consume)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<algorithm>
#include<string.h>
#define ll long long
#define Start ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fr first
#define sc second
#define M_PI           3.14159265358979323846
using namespace std;
int n;
int Dp[200200];
int A[100100];
int Solve(int i)
{

    if(i>n-1)
        return 1e9;
    if(i==n-1)
        return 0;
    if(Dp[i]!=-1)
        return Dp[i];
    Dp[i]=min(Solve(i+1)+abs(A[i+1]-A[i]), Solve(i+2)+abs(A[i+2]-A[i]));

    return Dp[i];
}
int main()
{
    Start;

    cin>>n;
    for(int i=0;i<n;i++)
        cin>>A[i];
    memset(Dp,-1,sizeof(Dp));
    cout<<Solve(0);

}


Measured memory_bytes: 2944
/**
  *  Worg
  */
#include <cstdio>

//FILE *fin = freopen("main.in", "r", stdin); FILE *fout = freopen("main.out", "w", stdout);

int main() {
    int N, M, K; scanf("%d%d%d", &N, &M, &K);

    for(int a = 0; a <= N; a++) {
        for(int b = 0; b <= M; b++) {
            if(K == b * (N - a) + a * (M - b)) {
                printf("Yes\n"); return 0;
            }
        }
    }
	printf("No\n"); return 0;
}


Measured memory_bytes: 128
s = int(input())
cnt = 0
ans = 0
s-=3
mod = 10**9+7
while s>=0:
    temp = 1
    for i in range(cnt):
        temp *= (s+cnt-i) * pow(i+1,mod-2,mod) %mod
    ans += temp
    ans %= mod
    s -= 3
    cnt += 1
    # print(temp)
print(ans)

Measured memory_bytes: 68248
import java.util.*
import java.io.PrintWriter

val pw = PrintWriter(System.out)
val MOD = 1000000007L
val INF = 2147483647
val LINF = 9223372036854775807L

fun main(args: Array<String>){
    solve()
    pw.flush()    
}

fun solve(){
    val (n, m) = nextIntList()
    val s = next()
    val ng = StringBuilder()
    repeat(m){
        ng.append(1)
    }
    if(s.contains(ng)){
        println(-1)
        return
    }

    var now = n
    val ans = mutableListOf<Int>()

    while(now != 0){
        if(now <= m){
            ans.add(0, now)
            break;
        }
        for (i in m downTo 1) {
            val next = now - i
            if(s[next] == '0'){
                ans.add(0, i)
                now = next
                break
            }
        }
    }

    println(ans.joinToString(" "))

}


// Print
fun println(v: String){
    pw.println(v)
}
fun print(v: String){
    pw.print(v)
}

// Read
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map{ it.toInt() }
fun nextLongList() = next().split(" ").map{ it.toLong() }
fun nextDoubleList() = next().split(" ").map{ it.toDouble() }
fun nextAryln(n: Int) = Array(n){ next() }
fun nextIntAryln(n: Int) = IntArray(n){ nextInt() }
fun nextLongAryln(n: Int) = LongArray(n){ nextLong() }
fun nextDoubleAryln(n: Int) = DoubleArray(n) { nextDouble() }

// Math
fun abs(n: Long) : Long = Math.abs(n)
fun abs(n: Double) : Double = Math.abs(n)
fun max(a: Long = -LINF, b: Long = -LINF, c: Long = -LINF, d: Long = -LINF, e: Long = -LINF): Long = listOf(a, b, c, d, e).max()!!.toLong()
fun min(a: Long = LINF, b: Long = LINF, c: Long = LINF, d: Long = LINF, e: Long = LINF): Long = listOf(a, b, c, d, e).min()!!.toLong()
fun prime(from: Long, to: Long = from) : List<Long>{
    return (from..to).filter{ i ->
        val max = Math.sqrt(i.toDouble()).toLong()
        (2..max).all{ j -> i % j != 0L}
    }
}
fun gcd(a: Long, b: Long) : Long = if(a % b == 0L) b else gcd(b, (a % b))
fun lcm(a: Long, b: Long) : Long = a / gcd(a, b) * b
fun modpow(a: Long, n: Long, p:Long = MOD) : Long {
    var res = 1L
    var ar = a
    var nr = n
    while(nr > 0){
        if((nr and 1) == 1L) res = res * ar % p
        ar = ar * ar % p
        nr = nr shr 1
    }
    return res
}
fun modinv(a: Long, p: Long = MOD) : Long = modpow(a, p - 2, p)
fun ncr(n: Long, r: Long) : Long {
    var a = 1L
    var b = 1L
    for (i in 1..r) {
        a = a * (n + 1 - i) % MOD
        b = b * i % MOD
    }
    return modinv(b, MOD) * a % MOD
}


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

int main(){
    int n, a, b, ans = 0;
    cin >> n >> a >> b;
    if((a+b)-n < 0){
        ans = 0;
    }else{
        ans = (a+b)-n;
    }
    cout << min(a, b) << ' ' << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a,v= map(int, input().split())
b,w= map(int, input().split())
t = int(input())
if a < b:
    if a + v*t >= b + w*t:
        print('YES')
    else:
        print('NO')
elif a == b:
    print('YES')
else:
    if a - v*t <= b - w*t:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 9208
#include<iostream>
#include<cstdio>
using namespace std;
int t[1000001],p[1000001],cnt=0;
int a[1000001];
int c[1000001];
int main()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++)
		scanf("%d",&t[i]);
	for(int i=1;i<=1000;i++)a[i]=i;
	for(int i=2;i<=1000;i++)
	{
		if(a[i]==i)p[++cnt]=i;
		for(int j=1;j<=cnt&&p[j]<=a[i]&&i*p[j]<=1000;j++)
			a[i*p[j]]=p[j];
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=cnt&&p[j]<=t[i];j++)
			if(t[i]%p[j]==0)
			{
				c[p[j]]++;
				while(t[i]%p[j]==0)t[i]/=p[j];
			}
		if(t[i]!=1)c[t[i]]++;
	}
	bool f1=true,f2=true;
	for(int i=1;i<=1000000;i++)
	{
		if(c[i]>1)f1=false;
		if(c[i]==n)f2=false;
	}
	if(f1)cout<<"pairwise coprime";
	else if(f2)cout<<"setwise coprime";
	else cout<<"not coprime";
	return 0;
}

Measured memory_bytes: 11316
#include <bits/stdc++.h>
typedef long long  ll;
typedef unsigned long long int ull;
#define pb push_back
#define For(ii,aa,bb) for(ll ii = aa; ii < bb;ii++)
#define Rof(ii,aa,bb) for(ll ii = aa; ii >= bb;ii--)
#define st first 
#define nd second 
#define MP make_pair
#define MAX 1000000009
#define MOD 1000000007
#define all(v6) v6.begin(),v6.end()
#define IT iterator
#define ln "\n"
#define F(ii) ((abs(ii) + ii)/2)
#define N 500005
using namespace std;
ll n, x;
int main(){
	#ifndef ONLINE_JUDGE
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	ll  ans = n, mn = MAX; 
	vector <ll> v; 
	For(i, 1, n + 1){
		cin >> x;
		if (x > mn){
			ans--;
		}
		mn = min(x, mn);
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處
LL a[200005];
LL u[200005];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        u[i] = a[i] - i;
    }
    // for (int i = 1; i <= n; i++) {
    //     printf("%lld ", u[i]);
    // }
    sort(u + 1, u + n + 1);
    LL b = u[n/2 + 1];
    LL ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += abs(u[i] - b);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;
typedef pair<int,int> p;
const ll mod=998244353;
const ll linf=1ll<<60;
const int inf=1<<30;




int main(){
    int n;cin >> n;
    vector<pair<int,int>> a(n);

    for (int i = 0; i < n; i++) {
        cin >> a[i].fs;
        a[i].sc = i+1;
    }
    sort(all(a));
    for (int i = 0; i < n; i++) {
        cout << a[i].sc << (i==n-1?"\n":" ");
    }
    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

#define fst first
#define snd second

using namespace std;

using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

int m, n;
int f[11][11];
PII c;
int hn = 0;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};

ll dfs(int x, int y, int sum){
	ll res = 0;
	if(x == c.fst && y == c.snd){
		if(sum == hn){
			return 1;
		}else if(sum > 0){
			return 0;
		}
	}
	REP(i, 4){
		int nx = dx[i]+x, ny = dy[i]+y;
		while(1){
			if(nx < 0 || m <= nx || ny < 0 || n <= ny) break;
			if(f[nx][ny] == 2)
				res += dfs(nx, ny, sum+1);
			if(f[nx][ny] == 1){
				f[nx][ny] = -1;
				res += dfs(nx, ny, sum+1);
				f[nx][ny] = 1;
				break;
			}
			nx += dx[i];
			ny += dy[i];
		}
	}
	return res;
}

int main(void){
	while(cin >> m >> n && m && n){
	hn = 0;
	REP(i, n){
		REP(j, m){
			int a;
			cin >> a;
			if(a == 1){
				f[j][i] = 1;
				hn++;
			}else if(a == 2){
				c = {j, i};
				f[j][i] = 2;
				hn++;
			}else{
				f[j][i] = -1;
			}
		}
	}
	cout << dfs(c.fst, c.snd, 0) << endl;
	}
}

Measured memory_bytes: 3032
//g++ -std=c++17 -Wshadow -Wall -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -g PROGRAM -o OUTPUT -DLOCAL -lasan -lubsan
#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define eps 1e-6
#define pi 3.141592653589793
using namespace std;

typedef vector<int> VII;
typedef vector<ll> VLL;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef vector<pair<int, PII>> VPPI;
const int MOD = 1e9 + 7;
const int INF = 1e9;


inline ll modulo(ll a, ll m)
{
    return (a % m + m) % m;
}

inline ll modInverse(ll a, ll m)
{
    assert(__gcd(a, m) == 1);
    ll m0 = m;
    ll y = 0, x = 1;

    if (m == 1)
        return 0;

    while (a > 1)
    {
        ll q = a / m;
        ll t = m;

        m = a % m, a = t;
        t = y;

        y = x - q * y;
        x = t;
    }

    if (x < 0)
        x += m0;

    return x;
}

inline ll modPow(ll x, ll y, ll m)
{ //x^y % m
    if (y == 0)
        return 1LL;
    else if (y == 1)
        return x;
    else
    {
        ll ans = modPow(x, y / 2, m) % m;
        if (y & 1)
        {
            return (((ans * ans) % m) * x) % m;
        }
        else
        {
            return (ans * ans) % m;
        }
    }
}

vector<string> split(char d,string s)
{
    stringstream ss(s);
    string t;
    vector<string> words;
    while(getline(ss,t,d))
    {
        words.pb(t);
    }

    return words;
}

int main(int argc, char *argv[])
{
    
    ios::sync_with_stdio(false);
    cin.tie(NULL);

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

    VII ord;
    map<int, int> st;
    while(st.find(x)==st.end()){
        ord.pb(x);
        st[x] = ord.size()-1;
        x = ((x % m) * (x % m)) % m;
    }

    VII cyc,nyc;
    for (int i = 0; i < st[x];++i)
        nyc.pb(ord[i]);

    ll fsum = 0;
    for (int i = st[x]; i < ord.size();++i)
        cyc.pb(ord[i]),fsum+=0LL+ord[i];

    // for(auto x:nyc)
    //     cout << x << ' ';
    // cout << endl;
    // for(auto y:cyc)
    //     cout << y << ' ';
    ll ans = 0;
    int i = 0;
    while(n>0LL && i<nyc.size()){
        ans += nyc[i];
        i++;
        n--;
    }
    if(n>0LL){
        ll cmp = n / ((ll)(cyc.size()));
        ans += (fsum * cmp);
        n = n % ((ll)cyc.size());
        int i = 0;
        while(n>0LL){
            ans += cyc[i++];
            n--;
        }
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 6124
#include <stdio.h>

int main(void) {
  int i, n;
  long long a;
  long long minValue = 1000000;
  long long maxValue = -1000000;
  long long sum = 0;

  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%lld",&a);
    if(a < minValue) minValue = a;
    if(a > maxValue) maxValue = a;
    sum += a;
  }
  printf("%lld %lld %lld\n",minValue,maxValue,sum);
  return 0;
}


Measured memory_bytes: 2096
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int res = 0;
		for (int i = 1; i <= N; i++) {
			int sum = 0;
			String target = String.valueOf(i);
			String[] targetSplit = target.split("");
			for (int j = 0; j < targetSplit.length; j++) {
				sum += Integer.parseInt(targetSplit[j]);
			}
			if (A <= sum && sum <= B) {
				res += i;
			}
		}
		System.out.print(res);
	}
}


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

int main(){

    int R;
    cin >> R;

    float ans = 2 * R * M_PI;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3784
n = int(input())
x, u = [0]*n, [0]*n

for i in range(n):
    x[i], u[i] = map(str, input().split())
    x[i] = float(x[i])
ans = 0
for i in range(n):
    if u[i] == "JPY":
        ans += int(x[i])
    else:
        ans += x[i]*380000
print(ans)


Measured memory_bytes: 38512
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int solve(const vector<vi> &num, int lim){
	for(const vi &v: num) for(int i : v) if(i > lim) return inf;
	vi cur(num.size());
	int res = 0;
	rep(i, num[0].size()){
		bool ok = 1;
		rep(j, num.size()) if(cur[j] + num[j][i] > lim) ok = 0;
		if(!ok){
			cur = vi(num.size());
			res++;
		}
		rep(j, num.size()) cur[j] += num[j][i];
	}
	return res;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int h, w, k; cin >> h >> w >> k;
	vector<string> s(h);
	rep(i, h) cin >> s[i];
	
	int ans = inf;
	rep(bit, 1 << h - 1){
		vector<vi> pos;
		vi cur;
		rep(i, h){
			cur.pb(i);
			if(i == h - 1 || (bit >> i & 1)){
				pos.emplace_back(cur);
				cur.clear();
			}
		}
		vector<vi> num(pos.size(), vi(w));
		rep(i, w) rep(j, pos.size()) for(int l : pos[j]) num[j][i] += s[l][i] - '0';
		ans = min(ans, __builtin_popcount(bit) + solve(num, k));
	}
	cout << ans << endl;
	
	return 0;
}

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

int N, M, X, Y;

int main(){
  cin >> N >> M >> X >> Y;
  int x_ma = X, y_mi = Y;
  for(int i = 0; i < N; i++){
    int x; cin >> x;
    x_ma = max(x_ma, x);
  }
  for(int i = 0; i < M; i++){
    int y; cin >> y;
    y_mi = min(y_mi, y);
  }
  
  if(x_ma < y_mi) cout << "No War" << endl;
  else cout << "War" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(n); ++i)
#define REP(i, d, n) for(long long i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main() {

ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans=0;
  
  ll e=max(a,b)*max(c,d);
  ll f=max(a,b)*min(c,d);
  ll g=min(a,b)*max(c,d);
  ll h=min(a,b)*min(c,d);
  
  ans=max( max(e,f) , max(g,h) );
  if(a*b<=0||c*d<=0){ if(ans<0)ans=0;}
  

 cout<<ans<<endl;
}


Measured memory_bytes: 3616
#template
def inputlist(): return [int(j) for j in input().split()]
from collections import Counter
#template
#issueから始める
N = int(input())
w = [0]*N
for i in range(N):
    w[i] = input()
c = Counter(w)
if len(list(c.keys())) != N:
    print("No")
    exit()
for i in range(1,N):
    if w[i][0] != w[i-1][-1]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 3316
PROGRAM-ID.                      ABC_062_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 i      PIC 9(3).
    01 SHP    PIC X(1) VALUE '#'.
    01 INP    PIC X(7).
    01 H      PIC 9(3).
    01 W      PIC 9(3).
    01 ln     PIC X(102).
    01 a      PIC X(100).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO H W.

*>  初期化不要
    PERFORM VARYING i FROM 1 BY 1 UNTIL W + 2 < i
        STRING
            ln(1:FUNCTION STORED-CHAR-LENGTH(ln))
            SHP
            INTO ln
        END-STRING
    END-PERFORM.

    DISPLAY ln(1:FUNCTION STORED-CHAR-LENGTH(ln)).

    PERFORM VARYING i FROM 1 BY 1 UNTIL H < i
        ACCEPT a

*>      初期化
        MOVE SHP TO ln

        STRING
            ln(1:FUNCTION STORED-CHAR-LENGTH(ln))
            a
            INTO ln
        END-STRING

        STRING
            ln(1:FUNCTION STORED-CHAR-LENGTH(ln))
            SHP
            INTO ln
        END-STRING

        DISPLAY ln(1:FUNCTION STORED-CHAR-LENGTH(ln))
    END-PERFORM.

*>  初期化
    MOVE SPACE TO ln.

    PERFORM VARYING i FROM 1 BY 1 UNTIL W + 2 < i
        STRING
            ln(1:FUNCTION STORED-CHAR-LENGTH(ln))
            SHP
            INTO ln
        END-STRING
    END-PERFORM.

    DISPLAY ln(1:FUNCTION STORED-CHAR-LENGTH(ln)).

    STOP RUN.


Measured memory_bytes: 384
# import sys
# input = sys.stdin.readline

def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

n = int(input())
a = lmp()
u = []
now= -1
for i in range(n):
    if now < a[i]:
        u.append(a[i])
        now = a[i]
    else:
        u.append(now)
ans = 0
for i in range(n):
    ans += u[i] -a[i]
print(ans)






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

int main() {
  ll a, b, k;
  cin >> a >> b >> k;
  ll foo = min(a, k);
  a -= foo;
  k -= foo;
  foo = min(b, k);
  b -= foo;
  cout << a << " " << b << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
using ll = long long;
int main(){ 
    ll n,k;
    cin>>n>>k;
    vector<ll> a(n);
    REP(i,n) cin>>a[i];
    ll b=0;
    REP(i,n){
        if(a[i]>=k){
            b++;
        }
    }
    cout<<b;
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
  long long int i,j,k,n,a,b,c,sum=0,x,y;
   scanf("%lld %lld %lld %lld",&n,&k,&x,&y);
    if(k>=n){
        for(i=1;i<=n;i++){
            sum+=x;
        }
    }
    else{
            a=n-k;
   for(i=1;i<=k;i++){
        sum+=x;
   }
   for(i=1;i<=a;i++){
    sum+=y;
   }
    }
   printf("%lld\n",sum);
    return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    double x = -1.0;
    bool w[3010];
    fill(w, w + 3010, false);
    bool s[3010];
    fill(s, s + 3010, false);
    for (int i = 0; i < 31; i++) {
        for (int j = 0; j < 31; j++) {
            if (a * i + b * j <= f / 100) {
                w[100 * (a * i + b * j)] = true;
            }
        }
    }
    for (int i = 0; i < 3001; i++) {
        for (int j = 0; j < 3001; j++) {
            if (c * i + d * j < f) {
                s[c * i + d * j] = true;
            }
        }
    }
    int res1 = 0, res2 = 0;
    for (int i = 0; i <= f; i++) {
        for (int j = 0; j <= f; j++) {
            if (i + j > f) break;
            if (w[i] && s[j] && i * e >= j * 100) {
                if (j > x * (i + j)) {
                    x = 1.0 * j / (i + j);
                    res1 = i + j;
                    res2 = j;
                }
            }
        }
    }
    cout << res1 << " " << res2 << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        int N = sc.nextInt();
                        int count = 0;
                        for (int i = 0; i < N; i++) {
                                if (sc.nextLong() % 2 == 1) {
                                        count++;
                                }
                        }
                        if (count % 2 == 0) {
                                System.out.println("YES");
                        } else {
                                System.out.println("NO");
                        }
                }
        }
}

Measured memory_bytes: 33040
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <map>
using namespace std;

int main()
{
  cout << setprecision(6);
  cout << setiosflags(ios::scientific);
  cout.flags(ios::fixed);

      int r,c;
      cin >> r >> c;

      int table[r+1][c+1];
      memset(table, 0, sizeof(table));
      for(int i=0; i<r; i++){
	for(int j=0; j<c; j++){
	  int a=0;
	  cin >> a;
	  table[i][j] = a;
	}
      }

      for(int i=0; i<r; i++){
	for(int j=0; j<c; j++){
	  table[i][c] += table[i][j];
	  table[r][j] += table[i][j];
	}
      }
      
      int sum=0;
      for(int i=0; i<c; i++)
	sum += table[r][i];
      table[r][c] = sum;

      for(int i=0; i<r+1; i++){
	for(int j=0; j<c+1; j++){
	  cout << table[i][j];
	  if(j==c)
	    cout << endl;
	  else
	    cout << " ";
	}
      }
  }

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

int main(){
	int k, ans=0;
	cin >> k;

	if(k%2){
		ans = ((k+1)/2)*((k-1)/2);
	}else{
		ans = (k/2)*(k/2);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int power(int num)
{
	int ans=1;
	for(int i=0;i<num;i++)ans*=10;
	return ans;
}
int main() {
	int n,m;
	while(cin>>m>>n,n,m){
		string str,fb[3]={"FizzBuzz","Fizz","Buzz"};
		bool player[1000]={};
		for(int i=1,now=0,out=m,co;i<=n;i++,now=(now+1)%m){
			cin>>str;
			if(out>1){
				while(player[now])now=(now+1)%m;
				if(i%15<1)co=0;
				else if(i%3<1)co=1;
				else if(i%5<1)co=2;
				else{
					co=-1;
					int num=0;
					for(int j=0;j<str.size();j++)num+=(str[j]-'0')*power(str.size()-1-j);
					if(num!=i)player[now]=1;
				}
				if(co>-1&&str!=fb[co])player[now]=1;
				if(player[now])out--;
			}
		}
		for(int i=0,co=0;i<m;i++){
			if(co==0&&!player[i]){
				cout<<i+1;
				co++;
			}
			else if(!player[i])cout<<" "<<i+1;
		}
		cout<<endl;
	}
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;
  
  bool can = true;
  
  if(e-d>k){can = false;}
   if(e-c>k){can = false;}
   if(e-b>k){can = false;}
   if(e-a>k){can = false;}
   if(d-c>k){can = false;}
   if(d-b>k){can = false;}
   if(d-a>k){can = false;}
   if(c-b>k){can = false;}
   if(c-a>k){can = false;}
     if(b-a>k){can = false;}
  
  if(can){cout << "Yay!" << endl;}
  else {cout << ":(" << endl;}
}
  
    

Measured memory_bytes: 256
io = STDIN
n=io.gets.to_i
ans = []
ans = ['0'] if n==0
while n != 0
  if n % -2 == 0
    ans.unshift '0'
  else
    ans.unshift '1'
  end
  n += (n%-2)
  n /= -2
end
puts ans.join


Measured memory_bytes: 1788
n = int(input())
t_N = input().split()
list_Time = []
for id in range(n):
    list_Time.append(int(t_N[id]))
sum = sum(list_Time)
m = int(input())
for id in range(m):
    p, x = map(int, input().split())
    answer = sum + x - list_Time[p - 1]
    print(answer)

Measured memory_bytes: 3060
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int bon[1111],gut[1111],cb,cg,n,m;
char s[20][20],*z[20];
bool viz[20];
bool chk()
{
	int i,j,k,l,a,b,c,d;
	for(i=0;i<m;i++)viz[i]=0;
	for(i=0;i<m;i++)if(!viz[i])
	{
		for(j=i+1;j<m;j++)if(!viz[j])
		{
			for(a=1;a<=n;a++)if(z[a][i]!=z[n-a+1][j])goto fail;
			viz[i]=1;viz[j]=1;break;
			fail:;
		}
	}
	int fl=1;
	for(i=0;i<m;i++)
	{
		if(!viz[i])
		{
			if(m&1)
			{
				if(fl==1)
				{
					for(j=1;j<=n;j++)if(z[j][i]!=z[n-j+1][i])return 0;
					fl=0;
				}
				else return 0;
			}
			else return 0;
		}
	}
	return 1;
}
void DFS(int S,int d)
{
	if(d>n)
	{
		if(chk())
		{
			puts("YES");
			exit(0);
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(S&(1<<i-1))
		{
			z[d]=s[i];
			DFS(S-(1<<i-1),d+1);
		}
	}
}
int main()
{
	int N,M,i,j,c;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)scanf("%s",s[i]);
	N=1<<n;
	for(i=0;i<N;i++)
	{
		for(j=i,c=0;j;j>>=1)if(j&1)c++;
		if(c==n/2)
		{
			int r=0;
			for(j=i,c=0;j;j>>=1)
			{
				c++;
				if(j&1)z[++r]=s[c];
			}
			DFS(N-1-i,n/2+1);
		}
	}
	puts("NO");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    string S;
    cin >> S;
    cout << S[0] << S[1] << S[2] << "\n";
}

Measured memory_bytes: 3620
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

struct edge{int to,cost;};
vector<int> G[100005];
 
long long int n,m,k,i,j=1;
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1,};
ll a,b,c;

std::vector<P> tree[100010];
long long int d[100005];
bool flag=false;

void bfs(int node,ll x){
	d[node] = x;
	for(int i=0;i<tree[node].size();i++){
		if(d[tree[node][i].first]==INF){
			bfs(tree[node][i].first,x+tree[node][i].second);
		}else{
			if(d[tree[node][i].first]!=x+tree[node][i].second){
				flag=true;
				break;
			}else{
				continue;
			}
		}
	}
}

int main(){
	cin>>n>>m;
	for(i=1;i<=m;i++){
		cin>>a>>b>>c;
		tree[a].push_back(P(b,c));
		tree[b].push_back(P(a,-c));
	}
	for(i=1;i<=n;i++)d[i]=INF;
	for(i=1;i<=n;i++){
		if(d[i]==INF && !flag)bfs(i,0);
	}
	if(flag){
		cout<<"No";
	}else{
		cout<<"Yes";
	}

	cout<<endl;
	return 0;
}

Measured memory_bytes: 18816
N=int(input())
number=list(map(int,input().split()))
ans=1
if 0 in number:
    print(0)
    exit(0)
    
for i in range(N):
    ans *= number[i]
    if ans>1000000000000000000:
        print(-1)
        exit(0)
print(ans)

Measured memory_bytes: 21776