akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int findSumDigits(int s) {
    int num = 0;
    int temp = 0;
    while (s) {
        temp = s % 10;
        num += temp;
        s = s / 10;
    }
    return num;
}

int countDivisorNum(int n) {
    int count = 0;
    for (int i = 1; i <= n; i++) {
        if (n % i == 0) {
            count++;
        }
    }
    return count;
}


int main() {
    int n, k;
    cin >> n >> k;
    int check[n];
    rep(i, n, 0) {
        check[i] = -1;
    }

    int temp = 0;
    int temp2 = 0;
    rep(j, k, 0) {
        cin >> temp;
        rep(a, temp, 0) {
            cin >> temp2;
            check[temp2 - 1]++;
        }
    }
    int ans = 0;
    rep(b, n, 0) {
        if (check[b] == -1) {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr const char* YES = "Yes";
static constexpr const char* NO = "No";

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  long long K;
  scanf("%lld", &K);
  long long Q;
  scanf("%lld", &Q);
  std::vector<long long> A(Q);
  map<int, ll> m;
  for (int i = 0; i < Q; i++) {
    scanf("%lld", &A[i]);
    A[i]--;
    m[int(A[i])]++;
  }

  int max_index = -1;
  int max_quiz = -1;
  for (auto p : m) {
    if (p.second > max_quiz) {
      max_index = p.first;
      max_quiz = p.second;
    }
  }

  rep(i, 0, N) {
    if (K - (Q - m[i]) > 0) {
      put(YES);
    } else {
      put(NO);
    }
  }
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}


Measured memory_bytes: 7680
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

    int N, K;
    cin >> N >> K;
    vector<ll> H(N);
    rep(i, N) { cin >> H[i]; }

    sort(all(H), greater<int>());
    ll ans = 0;
    rep(i, N) {
        if (i < K)
            continue;
        else {
            ans += H[i];
        }
    }

    cout << ans << endl;
}

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

int main(){
    int a,b; cin >> a >> b;
    if(a < b){
        for(int i=0;i<b;i++){
            cout << a;
        }
    }
    else{
        for(int i=0;i<a;i++){
            cout << b;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	string ss, tt, uu;
	int64 aa, bb;
	cin >> ss >> tt;
	cin >> aa >> bb;
	cin >> uu;
	if(ss == uu)
	{
		aa--;
	}
	else if(tt == uu)
	{
		bb--;
	}
	cout << aa << ' ' << bb << endl;
	return 0;
}


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

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

int main(){
  int sx,sy,tx,ty;
  int rx,ry;

  scanf("%d %d %d %d", &sx, &sy, &tx, &ty);

  rx = tx - sx;
  ry = ty - sy;

  int i;

  for(i = 0;i < ry;i++) printf("U");
  for(i = 0;i < rx;i++) printf("R");
  for(i = 0;i < ry;i++) printf("D");
  for(i = 0;i < rx;i++) printf("L");
  printf("L");
  for(i = 0;i <= ry;i++) printf("U");
  for(i = 0;i <= rx;i++) printf("R");
  printf("DR");
  for(i = 0;i <= ry;i++) printf("D");
  for(i = 0;i <= rx;i++) printf("L");
  printf("U\n");


  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    cin >> n >> m;
    
    int a[n];
    int sum = 0;
    for(int i=0; i<n; i++){
        int tmp;
        cin >> tmp;
        a[i] = tmp;
        sum += tmp;
    }
    double lim = (double)sum / (double)(4*m);
    int cnt= 0;
    //cout << lim << endl;
    for(int i=0; i<n; i++){
        if((double)a[i]>=lim){
            cnt++;
        }
    }
    if(cnt>=m){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#define mod 1000000007
#define ff first
#define ss second
#define pi 3.1415926535
#define endl '\n'
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll inf=1e19;
/*ll power(ll x,ll y)
{
    ll res=1;
    while(y>0)
    {
        if(y%2==1)
            res=(res*x)%mod;
        x=(x*x)%mod;
        y=y/2;
    }
    return res;
}*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll i,n,a,b,c,r,k,d,s=inf,x=inf,y=inf,m;
    cin>>n>>m>>k;
    ll arr[n+1],arr1[m+1];
    for(i=1;i<=n;i++)
    {
        cin>>arr[i];
        x=min(x,arr[i]);
    }
    for(i=1;i<=m;i++)
    {
        cin>>arr1[i];
        y=min(y,arr1[i]);
    }
    s=x+y;
    for(i=1;i<=k;i++)
    {
        cin>>x>>y>>c;
        s=min(s,arr[x]+arr1[y]-c);
    }
    cout<<s<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;
int main()
{
    fastRead;
    int n;
    cin>>n;
    vector<int>op , cl;
    for(int i =0 ; i < n ; i++) {
        int x , y;
        cin>>x>>y;
        op.push_back(x);
        cl.push_back(y);
    }
    
    sort(op.begin() , op.end());
    sort(cl.rbegin() , cl.rend());
    
    int tgt = (n-1)/2;
    if(n%2) {
        cout<<cl[tgt] - op[tgt] + 1<<'\n';
    }
    else {
            
        int cl1 = cl[tgt] , cl2 = cl[tgt+1];
        int st1 = op[tgt] , st2 = op[tgt+1];
            
        cout<<(cl1 + cl2) - (st1 + st2) + 1<<'\n';
        
        
    }
    
    return 0;
    
    
    
    
    
    
}

Measured memory_bytes: 5128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  vector<int>x(5);
  rep(i,5) {
    cin>>x[i];
    if(x[i]==0){
      cout<<i+1<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3624
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()
res = "War"
flag = 0
if Y > X:
    for i in range(X+1, Y+1):
        if x[-1] < i <= y[0]:
            res = "No War"
            flag = 1
            break
    if flag == 1:
        print("No War")
    else:
        print("War")
else:
    print("War")

Measured memory_bytes: 3064
import sys
n, y = map(int, input().split())


for i in range(n + 1):
    for j in range(n + 1 - i):
        if 10000*i + 5000*j + 1000*(n - i - j) == y:
            print(i, j, n - i - j)
            sys.exit()
        
print(-1,-1,-1)

Measured memory_bytes: 3060
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public struct Edge
{
    public int to;
    public int idx;
    
}
class CompetitiveProgrammingProgram
{

    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        List<List<Edge>> g = new List<List<Edge>>();
        for (int i = 0; i < n; i++)
            g.Add(new List<Edge>());
        for (int i = 0; i < n - 1; i++)
        {
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]) - 1;
            int b = int.Parse(s[1]) - 1;
            g[a].Add(new Edge(){to=b,idx=i});
            g[b].Add(new Edge(){to=a,idx=i});
        }
        int ansk = 0;
        int[] ans=new int[n-1];
        Queue<int> Q = new Queue<int>();
        Q.Enqueue(0);
        List<int> pe = new List<int>();
        List<bool> visited = new List<bool>();
        for (int i = 0; i < n; i++)
        {
            pe.Add(0);
            visited.Add(false);
        }
        visited[0] = true;
        while (Q.Count != 0)
        {
            int q = Q.Peek(); Q.Dequeue();
            ansk = Math.Max(ansk, g[q].Count);
            int color = 1;
            for (int i = 0; i < g[q].Count; i++)
            {
                if (visited[g[q][i].to]) continue;
                if (color == pe[q]) color++;
                ans[g[q][i].idx] = color;
                pe[g[q][i].to] = color;
                color++;
                Q.Enqueue(g[q][i].to);
                visited[g[q][i].to] = true;
            }
        }
        Console.WriteLine(ansk);
        foreach (var x in ans)
        {
            Console.WriteLine(x);
        }
    }
}

Measured memory_bytes: 29960
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
//#define i_7 998244353
//#define i_5 i_7-2
ll i_7;
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

//////////////////////////



int main(){fastio
    
    ll n;cin>>n>>i_7;
    ll ofs=6005;
    ll dp[4][ofs*2];memset(dp,0,sizeof(dp));
    dp[0][ofs]=1;
    rep(i,1,3*n){
        rep(j,0,2*ofs-1){
            dp[i&3][j]=0;
        }
        rep(j,0,2*ofs-1){
            if(i-1>=0&&j+1<=2*ofs-1)Add(dp[i&3][j],dp[(i+3)&3][j+1]);
            if(i-2>=0&&j-1>=0)Add(dp[i&3][j],mod(dp[(i+2)&3][j-1]*(3*n-i+1)));
            if(i-3>=0)Add(dp[i&3][j],mod(dp[(i+1)&3][j]*mod((3*n-i+2)*(3*n-i+1))));
        }
    }
    ll ans=0;
    rep(j,0,ofs)Add(ans,dp[(3*n)&3][j]);
    cout<<mod(ans)<<endl;
    
    return 0;
}


Measured memory_bytes: 768
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{



    public class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();

            Console.WriteLine(Calc.Ans(s));
        }
    }
    public static class Calc
    {
        public static int Ans(string s)
        {
            switch (s)
            {
                case "SUN":
                    return 7;
                case "MON":
                    return 6;
                case "TUE":
                    return 5;
                case "WED":
                    return 4;
                case "THU":
                    return 3;
                case "FRI":
                    return 2;
            }
            return 1;
        }
    }
}


Measured memory_bytes: 11092
import Data.Functor((<$>))

main :: IO ()
main = do 
        q  <- read.last.words <$> getLine
        xs <- map ((\[n, t] -> (n, read t)).words).lines <$> getContents
        mapM_ (putStrLn.(\(n, t) -> unwords [n, show t])) $ solve xs [] [] q 0

solve :: [(String, Int)] -> [(String, Int)] -> [(String, Int)] -> Int -> Int -> [(String, Int)]
solve []            [] zs _ _   = reverse zs
solve []            ys zs q cnt = solve (reverse ys) [] zs q cnt
solve ((n, t) : xs) ys zs q cnt = let t'   = t - q
                                      cnt' = cnt + q
                                      m    = cnt' + t'
                                  in if t' > 0 then solve xs ((n, t') : ys) zs q cnt'
                                               else solve xs ys  ((n, m) : zs) q m

Measured memory_bytes: 35316
#include<iostream>
using namespace std;
int main(){
  int A,B,C,k,count=0;
  cin>>A>>B>>C>>k;
  while(A>=B){
    count++;
    B*=2;
  }
  while(B>=C){
    count++;
     C*=2;
  }
  if(count<=k) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
return 0;
}

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

int main() {
    string S,T;
    cin >> S >> T ;
    int A, B;
    cin >> A >> B ;
    string U;
    cin >> U;
    if (S==U) {
        A=A-1;
    }
    else {
        B=B-1;
    }
    cout << A << " "<< B << endl;

}

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

int main() {
int N;
  cin >>N;
  vector<int> vec(N);
  vector<int> veccopy(N);
for(int i=0;i<N;i++){
  cin>>vec[i];
  veccopy[i]=vec[i];
}
  int B;int counter=0;
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  int A=vec[0];
  for(int i=0;i<N;i++){
    if(vec[0]==vec[1]){
      counter=1;                }
    if(A!=vec[i]){
    B=vec[i];
      break;
    }
  }
  if(counter==0){
  for(int i=0;i<N;i++){
    if(veccopy[i]==A){
      cout<<B<<endl;}
else if(veccopy[i]!=A){
  cout<<A<<endl;}
  }}else if(counter==1){
      for(int i=0;i<N;i++){

  cout<<A<<endl;}
      }
    
}


Measured memory_bytes: 3200
#include<stdio.h>
main(){
    char S[1024];
    scanf("%s",S);
    for(int i = 0;S[i] != '\0';i++){
        char c = S[i] - 3;
        if(c < 'A'){
            c += 26;
        }
        printf("%c",c);
    }
    printf("\n");
}

Measured memory_bytes: 2576
#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 << "Balanced" << endl;
    }
    else if (a + b > c + d) {
        cout << "Left" << endl;
    }
    else {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using LL = long long;
using namespace std;
class Edge{
public:
    LL from,to,cost;
    Edge(LL f,LL t,LL c){
        from = f;
        to = t;
        cost = c;
    }
};

vector<LL> dijkstra(int s,int N, vector<Edge> E){
    vector<vector<Edge>> Edges(N);
    for(auto e : E){
        Edges.at(e.from).push_back(e);
        Edges.at(e.to).push_back(Edge(e.to,e.from,e.cost));
    }
    vector<LL> ans(N,1e18);
    ans.at(s)=0;
    priority_queue<pair<LL,LL>, vector<pair<LL,LL>> , greater<pair<LL,LL>>> que;
    que.push(make_pair(0,s));
    while(!que.empty()){
        pair<LL,LL> p = que.top();
        que.pop();
        if(p.first > ans.at(p.second))continue;
        for(auto e : Edges.at(p.second)){
            if(p.first + e.cost < ans.at(e.to)){
                ans.at(e.to) = p.first + e.cost;
                que.push(make_pair(ans.at(e.to),e.to));
            }
        }
    }
    return ans;
}
int main(){
    int N,M,C;cin >> N >> M >> C;
    LL sum = 0;
    vector<Edge> Edges;
    for(int a = 0;a < M;a++){
        int f,t,c;cin >> f >> t >> c;
        Edges.push_back(Edge(f-1,t-1,c));
        sum += c;
    }
    vector<LL> toku(N);
    vector<LL> dist = dijkstra(0,N,Edges);
    //return 0;
    for(auto e : Edges){
        if(dist.at(e.to) > dist.at(e.from)){
            toku.at(e.to) += e.cost;
        }else{
            toku.at(e.from) += e.cost;
        }
    }
    vector<pair<LL,LL>> uku;
    for(int a = 0;a < N;a++){
        uku.push_back(make_pair(dist.at(a),a));
    }
    sort(uku.begin(),uku.end());
    LL ans = 1e18;
    LL tapu = 0;
    for(int a = 0;a < N;a++){
        tapu += toku.at(uku.at(a).second);
        LL ins = 0;
        ins += uku.at(a).first * C;
        ins += sum - tapu;
        ans = min(ans,ins);
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 32560
#include <iostream>
#include <string>

using namespace std;

char ret;

int main()
{

	string s;
	while(cin>>s){
	
	
	for(int i=1;i<8;i++){
		string s_tmp;
		cin>>s_tmp;
		s += s_tmp;
	}
	
	// 2次元配列を1次元的に処理
	for(int i=0;i<8*8;i++){
		if(s[i]=='1'){
			// Aかどうか
			if(s[i+1]=='1' && s[i+8]=='1' && s[i+9]=='1'){
				ret = 'A';
				break;
			}else if(s[i+8]=='1' && s[i+16]=='1' && s[i+24]=='1'){
				ret = 'B';
				break;
			}else if(s[i+1]=='1' && s[i+2]=='1' && s[i+3]=='1'){
				ret = 'C';
				break;
			}else if(s[i+7]=='1' && s[i+8]=='1' && s[i+15]=='1'){
				ret = 'D';
				break;
			}else if(s[i+1]=='1' && s[i+9]=='1' && s[i+10]=='1'){
				ret = 'E';
				break;
			}else if(s[i+8]=='1' && s[i+9]=='1' && s[i+17]=='1'){
				ret = 'F';
				break;
			}else if(s[i+1]=='1' && s[i+7]=='1' && s[i+8]=='1'){
				ret = 'G';
				break;
			}
		}
	}
	
	cout<<ret<<endl;
	}
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>    
#define pb push_back

#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))

typedef long long ll;
const int inf = 2e9;
using namespace std;
ll MOD = 1000000007;
typedef pair<int,int> ii;
typedef struct {int a,b,c;}iii;

void mosA(vector<int> a){
	for(int i=0; i<a.size(); i++) printf("%d ",a[i]);
	printf("\n");
}
void mosP(vector<ii> a){
	for(int i=0; i<a.size(); i++) printf("%d %d\n",a[i].first,a[i].second);
	printf("\n");
}

bool ord(ii a, ii b){
	return b.second<a.second;
}

ll ans = 0;
int k,a,b,minimo,ver,t,p,n,m;
int A[200005];
map<ll,int> M;

int main(){
	scanf("%d",&n);
	FOR(i,n)scanf("%d",A+i);
	ll sum = 0;
	M[sum] = 1;
	FOR(i,n){
		sum+=A[i];
		if(M[sum]){ans+=M[sum];M[sum]++;}
		else M[sum]++;
	}
	printf("%lld\n",ans);

}

Measured memory_bytes: 13568
/*
* @author:  codancer
* @createTime:  2020-02-17, 09:39:06
*/
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
#define pb push_back
#define SZ(x) ((int)(x).size())
#define fi first
#define se second
typedef vector<int> VI;
typedef pair<int,int> pii;
ll n,k,ans,l,r;
ll a[200010];
bool check(ll x){
	ll cnt=0;// the number that less than x
	for(int i=1;i<=n;i++){
		ll num=0;
		if(a[i]==0){
			if(x>0) cnt+=n;
		}else{
			if(a[i]>0){
				ll h=x/a[i];
				if(x%a[i]&&(x>0)){
					++h;
				}
				num=lower_bound(a+1,a+n+1,h)-a-1;
			}
			else{
				ll h=x/a[i];
				if(x%a[i]&&(x>0)){
					h--;
				}
				ll great=upper_bound(a+1,a+n+1,h)-a-1;
				num=n-great;
			}
			cnt+=num;
		}
	}
	for(int i=1;i<=n;i++){
		if(a[i]*a[i]<x) --cnt;
	}
	cnt/=2;
	return cnt<k;
}

int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+n+1);
	l=-1e18,r=1e18;
	ll ans;
	// cout<<check(-6)<<endl;
	while(l<=r){
		ll mid=l+r>>1;
		if(check(mid)){
			 l=mid+1;
			 ans=mid;
		}
		else{
			r=mid-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include<stdio.h>
using namespace std;


int main()
{
	int p, q, r, x;
	cin >> p >> q >> r;
	x = p;
	if (x <= q)
		x = q;
	if (x <= r)
		x = r;
	x = p + q + r - x;
	cout << x << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    //Blackjack
    //
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a + b + c >= 22) System.out.println("bust");
        else System.out.println("win");
        sc.close();
    }
}


Measured memory_bytes: 21972
A,B,C = map(int,input().split())

roop = max(A,B,C).bit_length()

for i in range(roop+1):
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        ans = i
        break

    nA = (B+C) // 2 
    nB = (C+A) // 2
    nC = (A+B) // 2
    A = nA
    B = nB
    C = nC

if A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    ans = -1

print(ans)

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int a[n];
	for (int i = 0; i < n; i++) a[i] = ri();
	int upper = std::accumulate(a, a + n, 0) / 2;
	std::bitset<2000001> bitset;
	bitset[0] = 1;
	for (int i = 0; i < n; i++) bitset |= bitset << a[i];
	int res;
	for (int i = upper; i >= 0; i--) if (bitset[i]) {
		res = i;
		break;
	}
	std::cout << std::accumulate(a, a + n, 0) - res << std::endl;
	return 0;
}


Measured memory_bytes: 1024
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
const long long MAXN=1000005,MOD=924844033,ROOT=5;

long long PowMod(long long a,long long b)
{
	long long res=1;
	while(b)
	{
		if(b&1)
			res=1LL*res*a%MOD;
		a=1LL*a*a%MOD;
		b>>=1;
	}
	return res;
}

long long fac[MAXN],ifac[MAXN];
void InitFac()
{
	fac[0]=1;
	for(long long i=1;i<MAXN;i++)
		fac[i]=1LL*fac[i-1]*i%MOD;
	ifac[MAXN-1]=PowMod(fac[MAXN-1],MOD-2);
	for(long long i=MAXN-2;i>=0;i--)
		ifac[i]=1LL*ifac[i+1]*(i+1)%MOD;
}

void NTT(long long A[],long long n,long long mode)
{
	for(long long i=0,j=0;i<n;i++)
	{
		if(i<j)
			swap(A[i],A[j]);
		long long k=n>>1;
		while(j&k)
		{
			j^=k;
			k>>=1;
		}
		j^=k;
	}
	for(long long i=1;i<n;i<<=1)
	{
		long long w1=PowMod(ROOT,(MOD-1)/(i<<1)),w=1;
		if(mode==-1)
			w1=PowMod(w1,MOD-2);
		for(long long j=0;j<i;j++,w=(1LL*w*w1)%MOD)
            for(long long l=j,r=l+i;l<n;l+=(i<<1),r=l+i)
            {
                long long temp=(1LL*A[r]*w)%MOD;
                A[r]=(A[l]-temp+MOD)%MOD;
                A[l]=(A[l]+temp)%MOD;
            }
	}
	if(mode==-1)
	{
		long long inv=PowMod(n,MOD-2);
		for(long long i=0;i<n;i++)
			A[i]=1LL*A[i]*inv%MOD;
	}
}

long long N;
vector<long long> adj[MAXN];
long long cnt[MAXN],siz[MAXN];
long long A[MAXN],B[MAXN],ans[MAXN];

void dfs(long long u,long long f=0)
{
	siz[u]=1;
	for(auto v:adj[u])
	{
		if(v==f)
			continue;
		dfs(v,u);
		siz[u]+=siz[v];
	}
	cnt[siz[u]]++;
	cnt[N-siz[u]]++;
}

int main()
{
	InitFac();
	scanf("%lld",&N);
	for(long long i=1;i<N;i++)
	{
		long long u,v;
		scanf("%lld%lld",&u,&v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	
	dfs(1);
	cnt[N]=-N;
	for(long long i=0;i<=N;i++)
		A[i]=-1LL*cnt[i]*fac[i]%MOD;
	for(long long i=0;i<=N;i++)
		B[i]=ifac[N-i];
	long long len=1;
	while(len<=N*2)
		len<<=1;
	NTT(A,len,1);
	NTT(B,len,1);
	for(long long i=0;i<=len;i++)
		A[i]=1LL*A[i]*B[i]%MOD;
	NTT(A,len,-1);
	for(long long i=1;i<=N;i++)
		ans[i]=(1LL*A[i+N]*ifac[i]%MOD+MOD)%MOD;
	for(long long i=1;i<=N;i++)
		printf("%lld\n",ans[i]);
	
	return 0;
}


Measured memory_bytes: 78080
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = int;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define F  first
#define S  second
#define int ll
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define tm (tl+tr)/2
#define child 2*v
#define ceils(s,n) (s+n-1)/n
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

const int N = 2e5 + 10;
const double PI = acos(-1);
// const ll LINF = LLONG_MAX;
ll a[N],n,query,V[N];
ll seg[45][4*N];
ll lazy[45][4*N];
void push(ll v,ll i){
    seg[i][child]+=lazy[i][v];
    lazy[i][child]+=lazy[i][v];
    seg[i][child+1]+=lazy[i][v];
    lazy[i][child+1]+=lazy[i][v];
    lazy[i][v]=0;
}
void update(ll v,ll tl,ll tr,ll ql,ll qr,ll val,ll i){
    
    if(ql>qr){
        return ;
    }
    if(ql == tl and qr==tr){
        seg[i][v]+=val;
        lazy[i][v]+=val;
    }
    else{
        push(v,i);
        update(child,tl,tm,ql,min(qr,tm),val,i);
        update(child+1,tm+1,tr,max(ql,tm+1),qr,val,i);
        seg[i][v]=seg[i][child]+seg[i][child+1];
    }
}
ll rquery(ll v,ll tl,ll tr,ll ql,ll qr,ll i){
    if(ql>qr){
        return 0;
    }
    if(ql<=tl and tr<=qr){
        return seg[i][v];
    }
    push(v,i);
    return rquery(child,tl,tm,ql,min(qr,tm),i)+rquery(child+1,tm+1,tr,max(ql,tm+1),qr,i);
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k;
    cin >> n >> k;
    f(i,1,n+1){
        cin >> V[i];  
    }
    double r = pow(n,0.44);
    if(k >= r){
    	f(i,1,n+1){
    		cout << n << " ";
    	}
    	return 0;
    }
    int c1 = 1;
    int tmp[n+2];
    f(i,1,n+2){
    	tmp[i] = 0;
    }
    while(k--){
    	f(i,1,n+1){
    		int a1 = max(1,i-V[i]);
    		int a2 = min(n,i + V[i]);

    		tmp[a1]++;
    		tmp[a2+1]--;
    		// update(1,1,n,a1,a2,1,c1);
    	}
    	int c = 0,cc = 0;
    	f(i,1,n+1){
    		cc += tmp[i];
    		V[i] = cc;
    		c += (V[i] >= n);
    		tmp[i] = cc;
    	}
    	if(c == n){
    		for(int i = 1;i <= n;i++){
    			cout << V[i] << " ";
    		}
    		return 0;
    	}
    	f(i,1,n+2){
    		tmp[i] = 0;
    	}
    	c1++;
    }
    for(int i = 1;i <= n;i++){
    	cout << V[i] << " ";
    }
    return 0;
}
 

Measured memory_bytes: 5576
import java.util.*;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int billCount = sc.nextInt();
    int sum = sc.nextInt();

    int man = 0,gosen = 0, sen=0;
    boolean flag = false;
    for(int i=0;i<=billCount;i++){
       for(int j=0;j<=billCount-i;j++){
            if(check(i,j,billCount-i-j,sum)){
                man = i;
                gosen = j;
                sen = billCount-i-j;
                flag = true;
            }
       }
    }
    
    if(flag){
      System.out.println(man + " " + gosen + " " + sen);    
    } else {
      System.out.println("-1 -1 -1");
    }
    
  }
  
  public static boolean check(int a,int b, int c, int sum){
      return sum == a * 10000 + b * 5000 + c * 1000;
  }
}

Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100];
    int cnt,i,j;
   while( scanf("%s",s)!=EOF){
        getchar();
    int l=strlen(s);
    cnt=0;
    for(i=0,j=l-1;i<l/2;i++,j--)
    {
        if(s[i]!=s[j])
            cnt++;
    }
    printf("%d\n",cnt);
   }
   return 0;
}


Measured memory_bytes: 256
N = int(input())
A,B = map(int, input().split())
T= [int(i) for i in input().split()]
a=[i for i in T if i<=A]
b=[i for i in T if A<i<=B]
c=[i for i in T if i>B]
al=len(a)
bl=len(b)
cl=len(c)
list=[al,bl,cl]
print(min(list))

Measured memory_bytes: 3064
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;

class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String t = sc.nextLine();
        int[] salp = new int[27];
        int[] talp = new int[27];
        char[] sr = s.toCharArray();
        char[] tr = t.toCharArray();
        HashMap<Character, ArrayList<Integer>> map = new HashMap<Character, ArrayList<Integer>>();

        for (int i = 0; i < sr.length; i++) {
            salp[sr[i] - 'a']++;
        }
        for (int i = 0; i < tr.length; i++) {
            talp[tr[i] - 'a']++;
            if (salp[tr[i] - 'a'] == 0) {
                System.out.println(-1);
                return;
            }

        }

        for (int i = 0; i < 27; i++) {
            if (talp[i] > 0) {
                map.put((char) ('a' + i), new ArrayList<Integer>());
            }
        }

        long ans = 0;
        int pos = -1;
        for (int i = 0; i < sr.length; i++) {
            if (talp[sr[i] - 'a'] > 0) {
                map.get(sr[i]).add(i);
            }
        }
        for (int i = 0; i < sr.length; i++) {
            if (talp[sr[i] - 'a'] > 0) {
                map.get(sr[i]).add(i + sr.length);
            }
        }

        for (int i = 0; i < tr.length; i++) {
            ArrayList<Integer> list = map.get(tr[i]);
            // System.out.println(Arrays.toString(list.toArray()));
            int ret = binary_search(pos + 1, list);
            if (ret == -1)
                throw new Exception("not found");
            int pps = list.get(ret);
            if (pps >= sr.length) {
                ans += sr.length;
            }
            pos = pps % sr.length;

            // System.out.println(pps + ", " + pos + ", " + ans);
        }
        System.out.println(ans + pos + 1);
    }

    // index が条件を満たすかどうか
    static boolean isOK(int index, int key, ArrayList<Integer> list) {
        if (list.get(index) >= key)
            return true;
        else
            return false;
    }

    // 汎用的な二分探索のテンプレ
    static int binary_search(int key, ArrayList<Integer> list) {
        int left = -1; // 「index = 0」が条件を満たすこともあるので、初期値は -1
        int right = (int) list.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
        /* どんな二分探索でもここの書き方を変えずにできる！ */
        while (right - left > 1) {
            int mid = left + (right - left) / 2;
            if (isOK(mid, key, list))
                right = mid;
            else
                left = mid;
        }
        /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
        return right;
    }
}


Measured memory_bytes: 36136
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;

int f[maxn];
void add(int & x , int y){
    x += y;
    if(x >= mod)x -= mod;
}
int n , k;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> k;
    f[0] = 1;
    for(int i = 1 ; i <= k ; ++i)for(int j = i ; j < n  ; ++j)add(f[j],f[j-1]);
    for(int i = 1 ; i < n - k ; ++i)add(f[n-1],f[n-1]);
    cout << f[n - 1];
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll N,P,cnt[200101],T[200101],ans,mod;

int main()
{
    string s;cin>>s;
    N=s.size();P=2019;
    T[N-1]=1;
    for(int i=N-2;i>=0;i--) T[i]=T[i+1]*10%P;
    cnt[0]=1;
    for(int i=0;i<N;i++)
    {
        mod=(mod+(s[i]-'0')*T[i])%P;
        ans+=cnt[mod]++;
        //cout<<mod<<endl;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5304
import sys
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    a= str(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if a.islower():
        print("a")
    else:
        print("A")

main()


Measured memory_bytes: 9120
using System;

namespace _0630
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int B = int.Parse(Console.ReadLine());
            int C = int.Parse(Console.ReadLine());
            int D = int.Parse(Console.ReadLine());
            int E = int.Parse(Console.ReadLine());
            if (A < 0)
            {
                Console.WriteLine((0 - A) * C + D + (B * E));
            }
            else
            {
                Console.WriteLine((B - A) * E);
            }
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9196
s = input()
ok = True
if s[0] != 'A': ok = False
if s[1].isupper(): ok = False
if s[-1].isupper(): ok = False
c = 0
for si in s[2:-1]:
    if si == 'C': c += 1
print('AC' if ok and c==1 else 'WA')


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

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(const auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    LL a;
    cin >> a;
    cout << (a + a * a + a * a * a) << "\n";
    
    return 0;
}


Measured memory_bytes: 3648
N = int(input())
A = list(map(int, input().split()))
B = [0 for i in range(100000)]
cnt = 0
for a in A:
  if B[a-1] == 0:
    B[a-1] = 1
  else:
    cnt += 1
if cnt % 2 == 0:
  print(sum(B))
else:
  print(sum(B)-1)

Measured memory_bytes: 89888
#include<cstdio>

int main(){
	while (1){
		int sum = 0;
		char a[1000];
		scanf("%s", a);
		
		if (a[0] - '0' == 0) break;
		
		for (int i = 0; a[i] != 0; i++){
			sum += a[i] - '0';
		}
		printf("%d\n", sum);
	}

	return 0;
}


Measured memory_bytes: 2724
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;
constexpr i64 MOD = 1e9 + 7;

int main() {
    string K;
    cin >> K;
    int D;
    cin >> D;
    vector<vvi> dp(K.size() + 1, vvi(2, vi(D)));
    dp[0][0][0] = 1;
    for (int i = 0; i < K.size(); i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < D; k++) {
                for (int d = 0; d <= (j ? 9 : K[i] - '0'); d++) {
                    dp[i + 1][j | (d < K[i] - '0')][(k + d) % D] += dp[i][j][k];
                    dp[i + 1][j | (d < K[i] - '0')][(k + d) % D] %= MOD;
                }
            }
        }
    }
    cout << (dp[K.size()][0][0] + dp[K.size()][1][0] - 1 + MOD) % MOD << endl;
}


Measured memory_bytes: 17024
#include <bits/stdc++.h>
#define ll  long long int
#define mod 1000000007
using namespace std;
int main() {
    ll a,b;
    cin>>a>>b;
    ll s=a+b;
    if(s%2==0)cout<<s/2<<"\n";
    else
        cout<<"IMPOSSIBLE"<<"\n";
    }




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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------

//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();

    ll n ;
    cin >> n ;
    string ans = "" ;
    while(n!=0){
        if(n%26!=0){
            ans += (char)('a'+n%26-1) ;
            n /= 26 ;
        }
        else{
            ans += 'z' ;
            n /= 26 ;
            n-- ;
        }
    }
    reverse(ALL(ans)) ;

    cout << ans <<endl;


    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}





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

#define MAXN 4005
typedef long long lint;

using namespace std;

int n, m, total;
lint f[MAXN][MAXN][2], ans;
lint fac[MAXN];
bool illegal[MAXN];
const int mod = 924844033;

void init() {
    fac[0] = 1;
    for (int i = 1; i <= n; ++i)
        fac[i] = fac[i - 1] * i % mod;
}

int main() {
    scanf("%d%d", &n, &m);
    init();
    for (int i = 1; i <= m; ++i)
        for (int j = 0; j <= 1; ++j)
            for (int k = i; k <= n; k += m) {
                ++total;
                if (k == i)
                    illegal[total] = true;
            }
    f[0][0][0] = 1;
    for (int i = 1; i <= total; ++i)
        for (int j = 0; j <= i; ++j) {
            f[i][j][0] = (f[i - 1][j][0] + f[i - 1][j][1]) % mod;
            if (!illegal[i])
                f[i][j][1] = f[i - 1][j - 1][0];
        }
    for (int i = 0; i <= n; ++i)
        if (i & 1)
            ans = (ans - fac[n - i] % mod * (f[total][i][0] + f[total][i][1]) % mod) % mod;
        else
            ans = (ans + fac[n - i] % mod * (f[total][i][0] + f[total][i][1]) % mod) % mod;
    printf("%lld\n", (ans + mod) % mod);
}


Measured memory_bytes: 248832
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
MOD = 10**9+7
for i in range(2, 2*10**6+1):
    g1.append((g1[-1] * i) % MOD)
    inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
    g2.append((g2[-1] * inverse[-1]) % MOD)

def comb(n, r, mod=MOD):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n-r] % mod

K = int(input())
S = input()
N = len(S)
NN = N + K
ans = 0
pow25 = [1]
pow26 = [1]
for i in range(K+1):
  pow25.append(pow25[-1]*25 % MOD)
  pow26.append(pow26[-1]*26 % MOD)

for i in range(K+1):
  n = NN - i
  ans = (ans + pow26[i]*pow25[n-N]*comb(n-1, N-1)) % MOD

print(ans)

Measured memory_bytes: 244896
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(b<c) swap(b,c);
	if(a<b) swap(a,b);
	printf("%d",(a*10+b+c));
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  int flag=0;
  string S;
  for (int i=0; i<N; i++) {
    cin >> S;
    if (S=="Y") flag = 1;
  }
  
  if (flag==0) cout << "Three" << endl;
  else cout << "Four" << endl;
}

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

#define Fo(i,k,n) for(i=k ; i<n ; i++)
#define ll  long long
#define ull unsigned long long
#define f(i,n) for(int i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MOD 1000000007

void solve()
{
  int n,w;
  cin>>n>>w;
  ll W[n],V[n];
  for(int i=0;i<n;i++)
    cin>>W[i]>>V[i];
  ll dp[w+1][n+1];
  memset(dp,0,sizeof(dp));
  for(int i=1;i<=w;i++)
  {
    for(int j = 1;j<=n;j++)
      {
        if(i >= W[j-1])
          dp[i][j] = max(V[j-1]+dp[i-W[j-1]][j-1],dp[i][j-1]);
        else
        dp[i][j] = dp[i][j-1];
      }
      
  }
  cout<<dp[w][n]<<"\n";
}

signed main()
{
  fastio
  int t=1;
  //cin>>t;
  
  for(int i = 1;i<=t;i++)
  {
    //cout<<"Case #"<<i<<": "<<solve()<<"\n";
    solve();
  }

}

Measured memory_bytes: 82412
#include <iostream>

using namespace std;

int main(){
	int n;
  	cin >> n;
  	for(int i = 1; i <= 9; i++) {
    	if (n % i == 0) {
        	if (n / i <= 9) {
            	cout << "Yes";
              	return 0;
            }
        }
    }
  	cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+10;
#define ll long long
#define ld long double
int main()
{
	//freopen("/home/zz7/CFInput","r",stdin);
	ll n,m,d;scanf("%lld%lld%lld",&n,&m,&d);
	
	ll A=(n-d)+(n-d);
	if(d==0)A=n;

	printf("%.14lf\n",(double)A*(m-1)/(n*n));
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
	int a,b,s;
	char c;
	while(1){
		scanf("%d %c %d",&a,&c,&b);
		if(c=='?') return 0;
		if(c=='+'){
			s=a+b;
		}else if(c=='-'){
			s=a-b;
		}else if(c=='*'){
			s=a*b;
		}else if(c=='/'){
			s=a/b;
		}
		printf("%d\n",s);
	}
	
	return 0;
}


Measured memory_bytes: 2104
n = int(input())
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)
if digitSum(n) % 9 == 0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 79992
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a <= b){
            if(b <= c){
                System.out.printf("%d %d %d\n",a,b,c);
            }else if(a <= c){
                System.out.printf("%d %d %d\n",a,c,b);
            }else{
                System.out.printf("%d %d %d\n",c,a,b);
            }
        }
        if(a > b){
            if(a <= c){
                System.out.printf("%d %d %d\n",b,a,c);
            }else if(b <= c){
                System.out.printf("%d %d %d\n",b,c,a);
            }else{
                System.out.printf("%d %d %d\n",c,b,a);
            }
        }
    sc.close();
    }
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, a, b, allCnt = 0, overseaCnt = 0;
    string students;
    cin >> n >> a >> b;
    cin >> students;
    for (int i = 0; i < n; i++){
        if (students[i] == 'a'){
            if (allCnt < a + b){
                allCnt++;
                cout << "Yes" << "\n";
                continue;
            }
        }
        if (students[i] == 'b'){
            if (allCnt < a + b && overseaCnt < b){
                allCnt++;
                overseaCnt++;
                cout << "Yes" << "\n";
                continue;
            }
        }
        cout << "No" << "\n";
    }

    return 0;
}


Measured memory_bytes: 3776
def calc(a, b, c)
  (a+b+c+1)/2
end

n, m, k = gets.split.map(&:to_i)
l1 = Array.new(n){ [0]*n }
l2 = Array.new(n){ [] }
l3 = []
m.times do
  a, b, c = gets.split.map(&:to_i)
  a -= 1; b -= 1
  l1[a][b] = l1[b][a] = c
  l2[a] << b; l2[b] << a
  l3 << [a,b,c]
end

visited = [false]*n
arr = []
dist = [1<<31]*n
k.times do
  visited[i = gets.to_i - 1] = true
  arr << i
  dist[i] = 0
end

until arr.empty?
  s = arr.min{ |a,b| dist[a] <=> dist[b] }
  arr.delete s
  l2[s].each do |t|
    d = dist[s] + l1[s][t]
    if (old = dist[t]) > d
      dist[t] = d
      arr << t if old == 1 << 31
    end
  end
end
ret = 0
m.times{ |i| ret = [ret, calc(dist[l3[i][0]], dist[l3[i][1]], l3[i][2])].max }
p ret

Measured memory_bytes: 88580
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int ctoi(const char c)
{
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}

int main()
{
    string A, B; cin >> A >> B;
    if (A.size() > B.size()) cout << "GREATER" << endl;
    else if (A.size() < B.size()) cout << "LESS" << endl;
    else {
        for (int i = 0; i < A.size(); ++i) {
            int a = ctoi(A[i]), b = ctoi(B[i]);
            if (a > b) {
                cout << "GREATER" << endl;
                return 0;
            } else if (a < b) {
                cout << "LESS" << endl;
                return 0;
            }
        }
        cout << "EQUAL" << endl;
    }
}

Measured memory_bytes: 256