akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll ;

ll max(ll a , ll b)
{
  return (a > b) ? a: b;
}
ll min(ll a , ll b)
{
  return (a < b) ? a : b;
}
void memset(int *arr , int n , int value)
{
    for(int i= 0; i<n ; i++)
    {
        arr[i] = value;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n , k;
    cin>>n>>k;
    int *arr = new int[n] ;
    for(int i= 0; i<n ; i++)
    {
        cin>>arr[i] ;
    }
    bool *dp =  new bool[k+1] ;
    for(int i= 0; i<=k ; i++)
    {
        dp[i] = false ;
    }
    for(int i= 1; i<=k ; i++)
    {
        for(int j = 0 ; j< n ; j++)
        {
            if(i - arr[j] <0)
            {
                break;
            }
            if(dp[i - arr[j]] == false)
            {
                dp[i] = true ;
                break ;
            }
        }
    }
    if(!dp[k])
    {
        cout<<"Second"<<endl;
    }
    else
    {
        cout<<"First"<<endl;
    }

    return 0;
}


Measured memory_bytes: 384
#import math

w = int(input())
n = int(input())
field = [i for i in range(w+1)]
for i in range(n):
    a,b = map(int,input().split(","))
    field[a],field[b] = field[b],field[a]

for i in range(1,w+1):
    print(field[i])


Measured memory_bytes: 5600
N = int(input())
A = [int(x) for x in input().split()]

ans = 'APPROVED'

for a in A:
    if a%2==0:
        if a%3==0 or a%5==0:
            continue
        else:
            ans = 'DENIED'
            break
    else:
        continue

print(ans)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;

int main(int argc, char **argv) {
    string s,t;
    cin >> s >> t;

    bool ans = (s == t.substr(0, t.size()-1));
    ans = ans && (t.size() == s.size()+1);

    cout << (ans ? "Yes": "No") << endl;

    return 0;
}

Measured memory_bytes: 3596
L, R = map(int, input().split())

m = 2018
cont = 0

if L//2019 == R//2019:
    for i in range(L, R+1):
        for j in range(L+1, R+1):
            if i != j:
                cont = min((j * i) % 2019, m)
                m = cont
    print(m)
else:
    print(0)



Measured memory_bytes: 2940
n, place = [int(x) for x in input().split(' ')]
city_address = sorted([abs(int(x) - place) for x in input().split(' ')], reverse=True)
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

answer = city_address[0]
for address in city_address:
	answer = gcd(answer, address)

print(answer)

Measured memory_bytes: 14252
#include<iostream>

using namespace std;

int main(){

	int a,b;
	cin>>a>>b;
	if(a<b){
		cout<<"a < b"<<endl;
	}
	else if(a>b){
		cout<<"a > b"<<endl;
	}
	if(a==b){
		cout<<"a == b"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


template <class T>
vector<vector<T>> sum_2(const vector<vector<T>>& a) {
    int h = a.size(), w = a[0].size();
    vector<vector<T>> s(h + 1, vector<T>(w + 1, 0));
    for ( int i = 0; i < h; i++ ) {
    for ( int j = 0; j < w; j++ ) {
        s[i + 1][j + 1] = a[i][j];
    }
    }
    for ( int i = 0; i < h+1; i++ ) {
    for ( int j = 0; j < w; j++ ) {
        s[i][j + 1] += s[i][j];
    }
    }
    for ( int i = 0; i < h; i++ ) {
    for ( int j = 0; j < w+1; j++ ) {
        s[i + 1][j] += s[i][j];
    }
    }
    return s;
}

template <class T>
int calc_2(const vector<vector<T>>& s, int y, int x, int h, int w) {
    return s[y + h][x + w] - s[y][x + w] + s[y][x] - s[y + h][x];
}


int main() {
    
    int N,M,Q;
    cin >> N >> M >> Q;

    vector< vector<int> > P( 501, vector<int>(501,0) );

    for ( int i = 0; i < M; i++ ) {
        int l,r;
        cin >> l >> r;
        P[l][r]++;
    }

    vector< vector<int> > X;
    X = sum_2(P);

    vector<int> ans;
    for ( int i = 0; i < Q; i++ ) {
        int p,q;
        cin >> p >> q;

        ans.push_back(calc_2(X,p,1,N-p+1,q));
    }
    for ( int i = 0; i < Q; i++ ) {
        cout << ans[i] << endl;
    }


    return 0;
}

Measured memory_bytes: 3452
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    v = sorted([int(i) for i in input().split()])

    j = v[0]
    for i in v[1:]:
        j = (j + i) / 2

    print(j)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29932
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *A = map(int, read().split())

    COM_MAX = N

    fac, finv, inv = [0] * (COM_MAX + 1), [0] * (COM_MAX + 1), [0] * (COM_MAX + 1)
    fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1

    for i in range(2, COM_MAX + 1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    def com(n, r):
        if n < 0 or r < 0 or n < r:
            return 0
        return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD

    A.sort()

    ans = 0
    for i, a in enumerate(A):
        ans = (ans + a * com(i, K - 1) % MOD) % MOD
        ans = (ans - a * com(N - i - 1, K - 1) % MOD) % MOD

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 92968
#最大公約数を求める関数を再帰的に定義
def gcd(x,y):
	if x < y:
		x,y = y,x
	if y == 0:
		return x
	#一方が0の時、他方を最大公約数として定義
	return gcd(y,x % y)
	
N = int(input())
A = list(map(int,input().split()))

L = [0]
R = [0]
gcdlist = []

#リストの前と後ろから値を取得し
#A[i]を除いてA[i]以前と以降の最大公約数を算出
for i in range(N):
	L.append(gcd(L[i],A[i]))
	R.append(gcd(R[i],A[N-i-1]))


#i毎にA[i]を除いた最大公約数のリストを作成
for i in range(N):
	gcdlist.append(gcd(L[i],R[N-i-1]))

print(max(gcdlist))

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

int main(){
string A, B;
  cin >> A >> B;
bool a = true;  
  
  if(A.size() > B.size()){
    cout << "GREATER" << endl;
    a = false;
  }
  else if(A.size() < B.size()){
    cout << "LESS" << endl;
    a = false;
  }
  else{
    for(int i = 0;i < A.size();i++){
    if(A.at(i) > B.at(i)){
    cout << "GREATER" << endl;
      a = false;
      break;
    }
      else if(A.at(i) < B.at(i)){
    cout << "LESS" << endl;
      a = false;
      break;
    }
    }    
    }
  
  if(a) cout << "EQUAL" << endl;
  return 0;
  
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,d,l1,l2,ans;
int main()
{
	cin>>n>>d;
	while(n--)
	{
		cin>>l1>>l2;
		if(sqrt(l1*l1+l2*l2)<=d)
		{
			ans++;
		}
	}	
	cout<<ans;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k, x, sum = 0;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        if (x <= k - x)
        {
            sum += x;
        }
        else
        {
            sum += k - x;
        }
    }
    cout << sum*2 << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

ll n, m;
vvll edges(100000, vll());
vll group(100000, 0);

void dfs(ll i, ll g) {
  if (group.at(i) != 0) return;
  group.at(i) = g;
  REP(j, edges.at(i).size()) {
    if (group.at(edges.at(i).at(j)) == 0) dfs(edges.at(i).at(j), g);
  }
  return;
}

int main() {
  cin >> n >> m;
  REP(i, m) {
    ll a, b; cin >> a >> b;
    edges.at(a).push_back(b); edges.at(b).push_back(a);
  }
  ll g = 1;
  REP(i, n) {
    if (group.at(i) == 0) dfs(i, g++);
  }
  ll q; cin >> q;
  REP(i, q) {
    ll a, b; cin >> a >> b;
    if (group.at(a) == group.at(b)) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}



Measured memory_bytes: 13680
H,W,K=map(int,input().split())
ans=0
c=[input() for i in range(H)]

for i in range(2**H):
    for j in range(2**W):
        test=0
        for k in range(H*W):
            h=k//W
            w=k%W
            if i>>h&1==0 and j>>w&1==0:
                test+=(c[h][w]=="#")
        ans+=(test==K)

print(ans)


Measured memory_bytes: 67976
#include <vector>
#include <algorithm>
#include <queue>
#include <iostream>
#include <utility>
#include <tuple>
using namespace std;
using CostTp = long long int;

const CostTp INF = 1LL << 60;
CostTp rec[10010][210][3];
struct Elem {
  CostTp pos, x, mode, cost;
  Elem() {}
  Elem(CostTp a, CostTp b, CostTp c, CostTp d) : pos(a), x(b), mode(c), cost(d) {}
  bool operator<(const Elem &e) const {
    return cost > e.cost;
  }
};

int p[10010];
vector< pair<int, int> > G[10010];

bool is_danger(int ma, int mb) {
  if(ma == 0 and mb == 2) return true;
  if(ma == 2 and mb == 0) return true;
  return false;
}

int main() {
  int N, M, X; cin >> N >> M >> X;
  for(int i=0; i<N; i++) cin >> p[i];
  for(int i=0; i<M; i++) {
    int u, v, cost; cin >> u >> v >> cost;
    u--; v--;
    G[u].emplace_back(v, cost);
    G[v].emplace_back(u, cost);
  }

  priority_queue<Elem> que;
  fill(rec[0][0], rec[N+1][0], INF);
  rec[0][0][ p[0] ] = 0;
  que.emplace(0, 0, p[0], 0);

  while(que.size()) {
    Elem cur = que.top(); que.pop();
    if(rec[cur.pos][cur.x][cur.mode] < cur.cost) continue;
    // fprintf(stderr, "cur: %lld, %lld, %lld, %lld\n", cur.pos, cur.x, cur.mode, cur.cost);
    for(auto e : G[cur.pos]) {
      int to, cost; tie(to, cost) = e;
      if(is_danger(cur.mode, p[to])) {
        // danger
        if(cur.x + cost >= X and rec[to][0][ p[to] ] > cur.cost + cost) {
          rec[to][0][ p[to] ] = cur.cost + cost;
          que.emplace(to, 0, p[to], cur.cost + cost);
        }
      }
      else {
        // refresh
        {
          int nx = (p[to] != 1 ? 0 : cur.x + cost);
          int np = (p[to] != 1 ? p[to] : cur.mode);

          if(p[to] == 1 and nx >= X) {
            nx = 0;
            np = 1;
          }
          {
            if(rec[to][ nx ][ np ] > cur.cost + cost) {
              rec[to][ nx ][ np ] = cur.cost + cost;
              que.emplace(to, nx, np, cur.cost + cost);
            }
          }
        }
      }
    }
  }

  CostTp ans = INF;
  for(int i=0; i<=X; i++) {
    for(int k=0; k<3; k++) {
      ans = min(ans, rec[N-1][i][k]);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 53336
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
struct edge{int to,cost;};
struct info{
    int p,co;
    bool operator<(const info &a)const{
        if (co==a.co )p>a.p;
        return co>a.co ;
    }
};
int N,K;
vector<edge> E[101];
int dijkstra(int s,int g){
    int mini[102];
    for(int i=0;i<102;i++)mini[i]=2000000000;
    mini[s]=0;
    priority_queue<info>Q;
    info kari;
    kari.p=s,kari.co=0;
    Q.push(kari);
    while(!Q.empty()){
        info now=Q.top ();Q.pop();
        for(int i=0;i<E[now.p].size();i++){
            if(mini[E[now.p][i].to]>mini[now.p]+E[now.p][i].cost){
                mini[E[now.p][i].to]=mini[now.p]+E[now.p][i].cost;
                kari.p=E[now.p][i].to,kari.co=mini[E[now.p][i].to];
                Q.push(kari);
            }
        }
    }
    if(mini[g]<2000000000)return mini[g];
    return -1;
}
int main(){
    while(1){
        cin>>N>>K;
        if(N==0&&K==0)break;
        for(int i=0;i<101;i++)E[i].clear();
        for(int i=0;i<K;i++){
            int a;
            cin>>a;
            if(a==0){
                int b,c;
                cin>>b>>c;
                cout<<dijkstra(b,c)<<endl;
            }
            if(a==1){
                int b,c,d;
                cin>>b>>c>>d;
                edge kari[2];
                kari[0].to=c,kari[0].cost=d;
                kari[1].to=b,kari[1].cost=d;
                E[b].push_back(kari[0]);
                E[c].push_back(kari[1]);
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1252
#include <stdio.h>

int main(void){
	int N, M;
	int res = 0;
	int k;

	scanf("%d %d", &N, &M);

	if (N >= 2) {
		res += N*(N-1)/2;
	}

	if (M >= 2) {
		res += M*(M-1)/2;
	}

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

	return 0;
}


Measured memory_bytes: 128
S = list(input())

ans0 = 0
for i in range(len(S)):
    if i % 2 == 0:
        if int(S[i]) == 0:
            ans0 += 1
        else:
            pass
    else:
        if int(S[i]) == 1:
            ans0 += 1
        else:
            pass

ans1 = 0
for i in range(len(S)):
    if i % 2 == 1:
        if int(S[i]) == 0:
            ans1 += 1
        else:
            pass
    else:
        if int(S[i]) == 1:
            ans1 += 1
        else:
            pass

print(min(ans0, ans1))



Measured memory_bytes: 3956
#include "bits/stdc++.h"
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    int c = 0;
    cin>>a>>b;
    int d = 1;
    bool flag = false;
    while(1){
        if(d>=b){
            break;
        }
        c++;
        // if(d==0){
        //     d+=(a);
        // }else{
        //     d+=(a-1);
        // }
        d+=(a-1);
    }
    cout<<c<<endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

vector<int> g[10101];

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  for (int i = 0; i < n - 1; ++i) {
    g[i].push_back(i + 1);
    g[i + 1].push_back(i);
  }
  g[x - 1].push_back(y - 1);
  g[y - 1].push_back(x - 1);
  vector<int> ans(n);
  for (int s = 0; s < n; ++s) {
    vector<ll> dist(n, -1);
    queue<int> que;
    que.push(s);
    dist[s] = 0;
    while (que.size()) {
      int p = que.front();
      que.pop();
      for (auto u : g[p]) {
        if (dist[u] == -1) {
          que.push(u);
          dist[u] = dist[p] + 1;
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      ans[dist[i]]++;
    }
  }
  for (int i = 1; i < n; ++i) {
    cout << ans[i] / 2 << endl;
  }
  return 0;
}

Measured memory_bytes: 512
from collections import deque
n = int(input())
p = list(map(int,input().split()))
p_cutted = []
p_cutted = deque(p_cutted)
min_p_cutted = p[0]
ans = 0
for i in range(n):
    p_cutted.append(p[i])
    if min_p_cutted >= p[i]:
        min_p_cutted = p[i]
        ans += 1
print(ans)


Measured memory_bytes: 25124
#include <bits/stdc++.h>
#define rep(i,n1) for(int i=0;i<n1;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<'YES'<<endl;}else{cout<<'NO'<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
#define PI 3.141592653589793
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const ll inf=1000000007;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

vector<Pii> v[100001];
int dp[100000][3]={};
ll dp2[300000][60]={};
int main() {
	char n;
	cin>>n;
	cout<<(char)(n+1);
	return 0;
}


Measured memory_bytes: 3072
#include<iostream>
#include<stdio.h>
#include<math.h>
#include    <iomanip>
using namespace std;
int a,b;
int main(){
    int num;
    while(cin>>num&&num!=0){
        int pa=0,pb=0;
        for (int i=0; i<num; i++) {
            cin>>a>>b;
            if (a==b) {
                pa+=a;pb+=a;
            }else if(a>b){
                pa+=(a+b);
            }else{
                pb+=(a+b);
            }
        }
        cout<<pa<<" "<<pb<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;

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; }
const int INF = 1001001001;
const long long INFL = LLONG_MAX / 3;
const double eps = (1e-9);

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

  ll n; cin >> n;

  ll v = n;
  for (ll i = 0; i <= n; i++) {
    if ((i * (i+1)) / 2 >= n) {
      v = i;
      break;
    }
  }

  for (ll i = v; i > 0; i--) {
    if (n >= i) {
      cout << i << endl;
      n -= i;
    }
  }

  return 0;
}


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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int all=0,cnt=0;
  rep(i,n)all+=a[i];
  rep(i,n){
    if(all<=a[i]*4*m)cnt++;
  }
  if(cnt>=m)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  return 0;
}

Measured memory_bytes: 3620
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        a: i64, b: Bytes,
    }

    let mut c = 0;
    for b in b {
        if b == b'.' {
            continue;
        }
        c *= 10;
        c += (b - b'0') as i64;
    }
    println!("{}", a * c / 100);
}


Measured memory_bytes: 2120
# D
import sys
n = int(input())
a = [0]*n
b = [0]*n

for i in range(n):
    ab = list(map(int, input().split()))
    a[i] = [i, ab[0]]
    b[i] = [i, ab[1]]
b = sorted(b, key=lambda x: x[1])
time = 0
for i in range(n):
    time += a[b[i][0]][1]

    if time > b[i][1]:
        print("No")
        sys.exit()
print('Yes')


Measured memory_bytes: 67792
N,K = map(int,input().split())
P = list(map(int,input().split()))
E = [(p+1)/2 for p in P]
temp = sum(E[0:K])
S =  temp
for i in range(N-K):
  temp -= E[i]
  temp += E[i+K]
  if S < temp:
    S = temp  
print(S)


Measured memory_bytes: 25060
#include <iostream>
#include <vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<map>
#include<math.h>
#include<queue>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
const int mod = 1000000007;
const int INF = 1000000001;
const long long LINF = 1e18;
const int MAX = 510000;

int main() {
	long long int ans = 0;
	long long int n, m = LINF;
	cin >> n;
	for (int i = 1; i < sqrt(n) + 1; i++) {
		if (n % i == 0) {
			if (i + n / i < m) {
				m = i + n / i;
			}
		}
	}
	cout << m - 2 << endl;
	return 0;
}

Measured memory_bytes: 3616
n=int(input())

def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    return divisors

cnt=0
for i in range(1,n+1,2):
  l=divisore(i)
  if len(l)==8:
    cnt+=1
print(cnt)

Measured memory_bytes: 3060
#include<cmath>
#include<iostream>
#include<algorithm>
#include <string>
#include <stdexcept>
using namespace std; 
int main(){
  int a,b,c,d,e;
   char g[20]; string h,i;
    cin >> g;
    h=g[5];
    i=g[6];
	d=stoi(h);
  	e=stoi(i);
      if(d==1||e>4) cout << "TBD";
      else cout <<"Heisei";
}

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

int main()
{
	int n;

	cin >> n;

	while (n != 0) {
		vector<int> p(n, 0);
		char c[101];

		cin >> c;

		int b = 0;

		for (int i = 0; i < 100; i++) {
			if (c[i] == 'M')
				p[i % n]++;
			else if (c[i] == 'L') {
				p[i % n] += b + 1;
				b = 0;
			}
			else if (c[i] == 'S') {
				b += p[i % n] + 1;
				p[i % n] = 0;
			}
		}

		sort(p.begin(), p.end());

		for (vector<int>::iterator itr = p.begin(); itr != p.end(); itr++)
			cout << *itr << " ";

		cout << b << endl;

		cin >> n;
	}

	return 0;
}



Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#include <complex>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    ll X;
    cin >> X;
    ll temp  = 100;
    ll cnt=0;
    while(temp<X){
        cnt++;
        temp = temp*1.01;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A = sc.nextInt();
        String ans = solve(N, A);

        System.out.println(ans);
    }

    private static String solve(int N, int A) {
        N %= 500;

        return  N <= A ? "Yes" : "No";
    }

}


Measured memory_bytes: 22356
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

# 個数制限なしナップサック問題
W,N = map(int,readline().split())

dp = [INF]*(W+1)
dp[0] = 0

for i in range(N):
    w,v = map(int,readline().split())
    # dp[j] = 重さj以下でつくれる最大の価値
    for j in range(W+1):
        dp[j] = min(dp[j],dp[max(j-w,0)] + v)

print(dp[W])


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

int main() {
	// your code goes here
	long long n,i,sum=0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        if(i%5!=0 && i%3!=0)
            sum+=i;
    }
    cout<<sum;
	return 0;
}

Measured memory_bytes: 3156
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

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

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

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let N = read!(usize);
    let A = read![[f64]];

    let mean = A.iter().fold(0.0, |n, a| n + a) / A.len() as f64;
    let mut min_i = 0;
    let mut min_d = std::f64::MAX;
    for i in 0..N {
        let d = (A[i] - mean).abs();
        if min_d > d {
            min_d = d;
            min_i = i;
        }
    }

    println!("{}", min_i);
}


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

bool is_prime(int x){
  if(x<=1){
    return false;
  }
  for(int i=2;i*i<=x;i++){
    if(x%i == 0){
      return false;
    }
  }
  return true;
}

signed main(){
  int X,res;
  cin >> X;
  res=X;
  while(!is_prime(res)){
    res++;
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#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()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  map<string, int> mp;
  int q; cin >> q;
  for (int i = 0; i < q; ++i) {
    int op; cin >> op;
    if (op == 0) {
      string k; int x; cin >> k >> x;
      mp[k] = x;
    } else if (op == 1){
      string k; cin >> k;
      if (mp.find(k) == mp.end()) {
        cout << 0 << '\n';
      } else {
        cout << mp[k] << '\n';
      }
    } else if (op == 2) {
      string k; cin >> k;
      mp.erase(k);
    } else {
      string l, r; cin >> l >> r;
      auto it1 = mp.lower_bound(l);
      auto it2 = mp.upper_bound(r);
      for (auto it = it1; it != it2; ++it) {
        cout << it->first << " " << it->second << '\n';
      }
    }
  }

  return 0;
}


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

signed main()
{
  int N; cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++) cin>>a[i];
  
  vector<int> sum(N+1);
  for(int i=0;i<N;i++) sum[i+1]=sum[i]+a[i];
  
  int ans=0;
  map<int,int> cnt;
  for(int i=0;i<=N;i++){
    ans+=cnt[sum[i]];
    cnt[sum[i]]++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1'000'000'007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define REP(i, n) for(ll i=0; i<(ll)(n); i++)
#define REPD(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
    ll m;   cin >> m;
    ll sum=0, dig=0;
    REP(i, m){
        ll d, c;    cin >> d >> c;
        sum += d*c; dig += c;
    }
    cout << (sum-1)/9 + dig-1 << endl;
}

Measured memory_bytes: 3636
#pragma GCC optimize(2)
#include<bits/stdc++.h> 
using namespace std;
#define ll long long
#define endl "\n"
const int MAX=1e4+7;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
	string s,t;cin>>s>>t;
	ll ans=inf,l1=s.size(),l2=t.size();
	for(int i=0;i<l1-l2+1;i++){
		ll cnt=0;
		for(int j=0;j<l2;j++){
			 if(s[i+j]==t[j])cnt++;
		}
		ans=min(ans,l2-cnt);
	}  
	cout<<ans;
   return 0;
}  

Measured memory_bytes: 3644
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const long long INF = 1e10;
const long long MOD = 1e9+7;
using Graph = vector<vector<ll>>;
using pll = pair<ll, ll>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// a to A : -32
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll d; cin >> d;
    vector<ll> c(26);
    rep(i, 26){
        cin >> c[i];
    }
    vector<vector<ll>> vec(d, vector<ll>(26));
    rep(i, d){
        rep(j, 26){
            cin >> vec[i][j];
        }
    }
    vector<ll> t(d);
    rep(i, d){
        cin >> t[i];
        t[i]--;
    }

    ll ans = 0;
    ll day = 1;
    vector<ll> last(26);

    rep(i, d){
        rep(j, 26){
            if(t[i] == j){
                ans += vec[i][j];
                last[j] = 0;
            }else{
                last[j]++;
            }
        }

        rep(j, 26){
            ans -= c[j]*last[j];
        }

        cout << ans << endl;
    }


}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;

    vector<int> name(N);
    for(int i=0; i<N; i++) cin >> name.at(i);
    vector<int> manzoku(N);
    for(int i=0; i<N; i++) cin >> manzoku.at(i);
    vector<int> bonus(N-1);
    for(int i=0; i<N-1; i++) cin >> bonus.at(i);

    int sum=0;

    for(int i=0; i<N; i++){
        sum += manzoku.at(name.at(i)-1);
    }
    for(int i=0; i<N-1; i++){
        if(name.at(i) +1 == name.at(i+1)){
            sum += bonus.at(name.at(i)-1);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <map>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> P;

const ll max_n = 200000;
ll par[max_n];
ll rnk[max_n];

ll road_parent[max_n];
ll rail_parent[max_n];

void init(ll n){
  REP(i,n){
    par[i] = i;
    rnk[i] = 0;
  }
}

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

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

bool same(ll x, ll y){
  return find(x)==find(y);
}

int main(){
  ll n,k,l;
  cin >> n >> k >> l;
  init(n);
  REP(i,k){
    ll p,q;
    cin >> p >> q;
    unite(p-1,q-1);
  }
  REP(i,n){
    road_parent[i] = find(i);
  }
  init(n);
  REP(i,l){
    ll r,s;
    cin >> r >> s;
    unite(r-1,s-1);
  }
  REP(i,n){
    rail_parent[i] = find(i);
  }
  map<P,ll> mp;
  REP(i,n){
    mp[P(road_parent[i],rail_parent[i])]++;
  }
  REP(i,n){
    cout << mp[P(road_parent[i],rail_parent[i])] << " ";
  }
  return 0;
}


Measured memory_bytes: 18176
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aps
 */

#include "bits/stdc++.h"

using namespace std;

#define int long long int
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define se second
#define fi first

typedef pair<int, int> pii;
typedef vector<int> vi;

const int inf = 1e18;
const int mod = 1e9+7;

inline int add(int x, int y) { x += y; if (x >= mod) x -= mod; return x;}
inline int sub(int x, int y) { x -= y; if (x < 0) x += mod; return x;}
inline int mul(int x, int y) { return ((x % mod) * (y % mod)) % mod;}
inline int power(int a, int b) {
    int x = 1;
    while (b) {
        if (b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}
inline int inv(int a) { return power(a, mod - 2);}

int dp[100005][105][2],n,d;
string s;


class SDigitSum {
public:

    int f(int i,int small,int m){
        int& ret = dp[i][m][small];
        if(ret != -1) return ret;

        if(i == n) return ret = (m==0?1:0);

        ret = 0;
        int lim = (small ? 9 : s[i]-'0');
        for(int use=0;use<=lim;use++){
            ret=add(ret,f(i+1,(use < s[i]-'0' ? 1:small),(m+use)%d));
        }
        return ret;
    }

    void solve(std::istream& cin, std::ostream& cout){
        cin >> s >> d;
        n = s.length();

        memset(dp,-1,sizeof dp);
        cout << sub(f(0,0,0),1) << endl;
    }
};


int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    SDigitSum solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 164992
#include<algorithm>
#include<iostream>
#include<cstdio>
#define mod 1000000007
using namespace std;
int n,K,p[105],c[105],cnt,a[5005],top,f[5005],ans=0;
void dfs(int s,int x)
{
	if(s>cnt){a[++top]=x;return;}
	for(int k=0;k<=c[s];++k) dfs(s+1,x),x*=p[s];
}
inline int pow(int x,int k)
{
	int sum=1;
	for(;k;k>>=1,x=1LL*x*x%mod) if(k&1) sum=1LL*sum*x%mod;
	return sum;	
}
int main()
{
	scanf("%d%d",&n,&K);int t=n;
	for(int i=2;i*i<=t;++i) if(t%i==0)
	{
		p[++cnt]=i;
		while(t%i==0) t/=i,++c[cnt];
	}
	if(t>1) p[++cnt]=t,c[cnt]=1;
	dfs(1,1);sort(a+1,a+top+1);
	for(int i=1;i<=top;++i)
	{
		f[i]=pow(K,(a[i]+1)>>1);
		for(int j=1;j<i;++j) if(a[i]%a[j]==0) f[i]=(f[i]-f[j]+mod)%mod;
		ans=(ans+1LL*f[i]*((a[i]&1)?a[i]:a[i]/2))%mod;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
  int a, b,c,d;

  cin >> a >> b>>c>>d;
  bool can=false;

  int dif_ac = abs((a-c));
  if(dif_ac <= d)
    can =true;
  
  if( (abs((a-b))<=d)and (abs((b-c))<=d ) )
    can=true;

  if(can)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> A(5);
    for(int i=0; i<5; i++) cin >> A[i];
    for(int i=0; i<5; i++){
        if(A[i] == 0){
            cout << i+1 << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod107 1000000007
#define rep(i, n) for (int i = 0; i < n; ++i)
#define Graph vector<vector<int>>;
#define grepq priority_queue<double, std::vector<double>, std::greater<double>>
#define all(v) v.begin(), v.end()
#define PI acos(-1)
#define inf 1000000321
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};



int main(){
    ll X;
    cin >>X;
    ll i = 0;
    ll a = 0;
    while(X > a){
        a += i + 1;
        i++;
    }
    cout << i << endl;

}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
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; }

const long long int INF = 1LL << 60;

int main(){
    long long int N, K; cin >> N >> K;
    long long int h[110000]; for (int i=0; i<N; i++) cin >> h[i];
    long long int dp[110000]; for (int i=0; i<110000; i++) dp[i] = INF;

    dp[0] = 0;

    for (int i=0; i<N; i++) {
        for (int j=0; j<=K; j++) {
            chmin(dp[i+j], dp[i]+abs(h[i+j]-h[i]));
        }
    }

    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1920
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int a[15];
	int m=1;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	int sum=a[n-1]/2;
	for(int i=0;i<n-1;i++){
		sum+=a[i];
	}
	cout<<sum<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include<stdio.h>
typedef long long LL;
LL IN(void)
{
  LL x=0;int f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
int main(void)
{
  LL N=IN();int str[11],sz=0;
  while(N){N--;str[sz++]=97+N%26;N/=26;}
  for(int i=0;i<sz;i++)printf("%c",str[sz-i-1]);
}

Measured memory_bytes: 1508
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用

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

bool finish = false;

void dfs(vector<string> vec, vector<ll>& eage, stack<ll>& s, ll befo) {
	// v から行ける各頂点 next_v について
	for (int i = 0; i < vec[0].size(); i++) {
		if (befo == i + 1)
			continue;
		if (finish)
		{
			return;
		}
		if (vec[s.top() - 1][i] == '1')
		{
			if (abs(eage[s.top() - 1] - eage[i]) == 1)
				continue;
			else if (eage[s.top() - 1] == eage[i])
			{
				cout << -1 << endl;
				finish = true;
				return;
			}
			else if (!(eage[s.top() - 1] > eage[i]) || eage[i] == -1)
			{
				eage[i] = eage[s.top() - 1] + 1;
				befo = s.top();
				s.push(i % (vec[0].size()) + 1);
				dfs(vec, eage, s, befo); // 再帰的に探索
			}
			else if (i == vec[0].size() - 1)
			{
				s.pop(); return;
			}
		}
	}

	s.pop();
}

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

	int n, m, a, b;
	cin >> n >> m >> a >> b;
	vector<int> x(n), y(m);

	rep(i, n)
		cin >> x[i];
	rep(i, m)
		cin >> y[i];

	x.push_back(a);
	y.push_back(b);

	sort(x.begin(), x.end()); sort(y.begin(), y.end());
	if (x[n] < y[0])
		cout << "No War";
	else
		cout << "War";
	cout << endl;

	return 0;
}

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

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;

signed main(){
    llin(h);
    llin(w);
    llin(s);
    llin(t);
    if(h%s==0&&w%t==0){
        sal("No");
        return 0;
    }
    ll k=3000;
    sal("Yes");
    FOR(i,1,h){
        FOR(j,1,w){
            say((i%s==0&&j%t==0)?(s*t-1)*(-1)*k-1:k);
            say(" ");
        }
        cout <<endl;
    }
}


Measured memory_bytes: 1536
#include<stdio.h>

int n,x,y,t,a,b,c;

int abs(int);

int main(void){
	register int i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d%d%d",&c,&a,&b);
		if(((abs(x-a)+abs(y-b))%2!=(c-t)%2)||(abs(x-a)+abs(y-b)>c-t))
			return puts("No"),0;
		x=a,y=b,t=c;
	}
	puts("Yes");
	return 0;
}

int abs(int a){
	return a>0?a:-a;
}

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

using namespace std;

namespace Tzh{

	typedef long long ll;
	typedef double dd;
	const ll maxn=1e5+10;
	ll n,a[maxn],x,ans;

	void work(){
		cin>>n>>x;
		for(int i=1;i<=n;i++) cin>>a[i];
		sort(a+1,a+n+1);
		for(int i=1;i<=n;i++){
			if(x<a[i]) break;
			x-=a[i],ans++;
		}
		if(ans==n&&x) ans--;
		cout<<ans;
		return ;
	}
}

int main(){
	ios::sync_with_stdio(false);
	Tzh::work();
	return 0;
}


Measured memory_bytes: 256
# import sys
# sys.setrecursionlimit

from fractions import gcd

getarr = lambda _f: list(map(_f, input().split()))

a, b = getarr(int)

m = gcd(a, b)

i = 2
ans = 1
while i * i <= m:
    if m % i == 0:
        ans += 1
        while m % i == 0:
            m //= i
    i += 1

if m > 1:
    ans += 1
print(ans)

Measured memory_bytes: 65808
#include <stdio.h> 
int main(void)
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(c<b&&c<a){
	if(b<a){
		printf("%d %d %d\n",c,b,a);
	}
	else{
		printf("%d %d %d\n",c,a,b);
	}
}
if(b<a&&b<c){
	if(c<a){
		printf("%d %d %d\n",b,c,a);
	}
	else{
		printf("%d %d %d\n",b,a,c);
	}
}
if(a<b&&a<c){
	if(c<b){
		printf("%d %d %d\n",a,c,b);
	}
	else{
		printf("%d %d %d\n",a,b,c);
	}
}
if(a==b){
	if(a<c){
		printf("%d %d %d\n",a,b,c);
	}
	else{
		printf("%d %d %d\n",c,a,b);
	}
}
if(b==c){
	if(b<a){
		printf("%d %d %d\n",b,c,a);
	}
	else{
		printf("%d %d %d\n",a,b,c);
	}
}
if(a==c){
	if(a<b){
		printf("%d %d %d\n",a,c,b);
	}
	else{
		printf("%d %d %d\n",b,a,c);
	}
}
if(a==b&&b==c){
	printf("%d %d %d\n",a,b,c);
}
return 0;
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;

int main() {
  int n;
  cin >> n;
  map<char, int> cnt;
  rep(i, 3) cin >> cnt['A' + i];
  vector<string> s(n + 1);
  rep(i, n) cin >> s[i];
  string ans;
  rep(i, n) {
    char t1 = s[i][0];
    char t2 = s[i][1];
    if (cnt[t1] == 0 && cnt[t2] == 0) {
      cout << "No" << endl;
      return 0;
    }
    if (cnt[t1] > cnt[t2]) {
      swap(t1, t2);
    }
    if (cnt[t1] == 1 && cnt[t2] == 1) {
      if (t2 == s[i + 1][0] || t2 == s[i + 1][1]) {
        swap(t1, t2);
      }
    }
    ans += t1;
    cnt[t1]++;
    cnt[t2]--;
  }
  cout << "Yes" << endl;
  for (char i : ans) cout << i << endl;
  return 0;
}

Measured memory_bytes: 6700
#include <iostream>

using namespace std;

int main(void) {
    int N, K;
    cin >> N >> K;
    int D[K];
    for (int i = 0; i < K; ++i) {
        cin >> D[i];
    }

    int pay = N;
    while (1) {
        bool no_appear = true;
        int tmp = pay;
        while (tmp != 0) {
            int least = tmp % 10;
            for (int i = 0; i < K; ++i) {
                if (least == D[i]) {
                    no_appear = false;
                    break;
                }
            }
            tmp = tmp / 10;
        }
        if (no_appear) {
            break;
        }
        pay++;
    }

    cout << pay << endl;
    return 0;
}

Measured memory_bytes: 256
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>

using namespace std;

string A, B;



int main() {

	int N;
	cin >> N;
	vector<int> array;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		array.push_back(tmp);
	}

	int count = 0;
	int min_num = array[0];
	for (int i = 0; i < array.size(); i++) {
		if (array[i] <= min_num) {
			min_num = array[i];
			count++;
		}
	}

	cout << count << endl;

	return 0;
}



Measured memory_bytes: 1400