akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef double lld;
#define mod 1000000007
#define mod2 998244353
#define fori(n) for (int i = 0; i < n; i++)
#define forj(n) for (int j = 0; j < n; j++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
template <typename T, typename U>ostream &operator<<(ostream &out, const pair<T, U> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>void print(const ContainerType<ValueType, Args...> &c){for (const auto &v : c)cout << v << ' ';cout << '\n';} void print(){cout<<'\n';}
template <typename T, typename... Args>void print(T a, Args... args){cout << a << " ";print(args...);}
lli llipower(lli x, lli y, lli p = LLONG_MAX){lli res = 1;x = x % p;while (y > 0){if (y & 1)res = (res * x) % p;y = y >> 1;x = (x * x) % p;}return res;}

//8====================================D
int main(){
    int x,n,y;
    cin>>x>>n;
    set<int> p;
    fori(n) {
        cin>>y;
        p.insert(y);
    }
    int maxd=1000;
    int maxi=-1;
    fori(1000){
        if(p.count(i)==0 && abs(i-x)<maxd){
            maxd=abs(i-x);
            maxi=i;
        }
    }
    cout<<maxi<<endl;


}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    ll X; cin >> X;
    cout << ((X%100) <= (X/100)*5) << endl;
    return 0;
}

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

using namespace std;

int main()
{
    long long n,sum=0;
    cin>>n;
    for(long long i=0;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        {
            sum+=i;
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>

const long long mod = 1000000007;
const int l = 1000000;
std::vector<long long> fac(l,1),facr(l,1);
long long combi(int n,int k){
    if(n<k)return 0;
    else return fac.at(n)*facr.at(n-k)%mod*facr.at(k)%mod;
}

long long powMod(long long n,int k){
    long long res = 1;
    while(k>0){
        if(k%2 == 1){
            res *= n;
            res %= mod;
        }
        n = n*n%mod;
        k /= 2;
    }
    return res;
}

int main(){
    int n;
    std::cin >> n;

    for(int i=0;i<l-1;i++){
        fac.at(i+1) = fac.at(i)*(i+1)%mod;
    }
    facr.at(l-1) = powMod(fac.at(l-1),mod - 2);
    for(int i=l-1;i>0;i--){
        facr.at(i-1) = facr.at(i)*i%mod;
    }
    int m;
    std::vector<long long> A(n+1),last(n,-1);
    for(int i=0; i<n+1; i++){
        std::cin >> A.at(i);
        if(last.at(A.at(i) - 1) == -1){
            last.at(A.at(i) - 1) = i;
        }
        else{
            m = last.at(A.at(i)-1) + n - i;
        }
    }
    for(int i=0; i<n+1; i++){
        std::cout << ((combi(n+1,i+1) - combi(m,i))%mod + mod)%mod << std::endl;
    }

}

Measured memory_bytes: 20344
parseInt(x)=parse(Int, x)
parseMap(x::Array{SubString{String},1})=map(parseInt, x)

function main()
	x = readline() |> parseInt
	k::BigInt = 100
	for i in 1:1000000
		k=div(k*101,100)
		if k>=x
			println(i)
			break
		end
	end
end

main()

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

int main() {
   string output;

   // read
   size_t inputA, inputB;
   {
      cin >> inputA;
      cin >> inputB;
   }

   // process
   {
      if (inputA > inputB) {
         output = string(inputA, to_string(inputB).c_str()[0]);
      } else {
         output = string(inputB, to_string(inputA).c_str()[0]);
      }
   }

   // output
   {
      cout << output << endl;
   }
   
   return 0;
}


Measured memory_bytes: 256
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    t1,t2 = mi()
    a1,a2 = mi()
    b1,b2 = mi()

    saf = (a1-b1)*t1

    sas = (a2-b2)*t2

    wa = saf+sas

    if wa == 0:
        print('infinity')
        exit()

    if saf>0 and wa > 0:
        print(0)
        exit()
    elif saf<0 and wa < 0:
        print(0)
        exit()

    flag = False
    if not saf%wa:
        flag = True


    a = abs(saf)//abs(wa)
    
    ans = a*2+1

    if flag:
        ans-=1
    
    print(ans)



main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
bitset<4000006>bit;
int main(void)
{
    int n;
    scanf("%d",&n);
    bit.set(0);
    int sum = 0;
    for(int i = 0;i < n;i++)
    {
        int s;
        scanf("%d",&s);
        sum += s;
        bit|=bit<<s;
    }
    for(int i = (sum + 1)/2;i < 4000006;i++)
    {
        if(bit[i])
        {
          printf("%d\n",i);
          break;
        }
    }
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
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; }
 
// 累乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

ll solve2(ll a){
    return (a + 1) / 2 % 2;
}

ll solve(ll a){
    if(a % 2 == 1) return solve2(a);
    else return solve2(a + 1) ^ (a + 1);
}

int main(){
    ll A, B;
    cin >> A >> B;
    cout << (solve(B) ^ solve(A - 1)) << endl;
    return 0;
}

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

#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define RREP(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<"\n";
#define all(c)  (c).begin(),(c).end()
#define SORT(a) sort((a).begin(),(a).end())
#define TDARRAY(int,a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()

typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int n;

int main(){
    cin >> n;
    vector<int> a(n);
    REP(i,n){
        cin >> a[i];
        a[i]--;
    }
    int res = 0;
    REP(i,n){
        if(a[a[i]]==i)res++;
    }
    put(res/2);
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
typedef long long LL;
const int maxn=1e5+5;
const LL mod=1e9+7;
int read() {
	char ch=getchar();int x=0,f=1;
	while(ch<'0' || ch>'9')	{if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int gcd_(int a,int b) {return b==0?a:gcd_(b,a%b);}
LL fpow(LL a,LL b) {
	LL res=1;
	while(b) {
		if(b&1) res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main() {
//	cout<<"Accepted!\n";
	int n;
	cin>>n;
	n%=1000;
	if(n) cout<<1000-n;
	else cout<<n;
	return 0;
}


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

int a[100000]={} ;

int main()
	{
	int n ,k ,q ;
	int t ;
	int ans ;
	cin>>n>>k>>q ;
	ans=k-q ;
	for(int i=0 ;i<q ;i++)
		{
		cin>>t ;
		a[t-1]++ ;
		}
	for(int j=0 ;j<n ;j++)
		{
		if(ans+a[j]>0)
			cout<<"Yes"<<endl ;
		else
			cout<<"No"<<endl ;
		}
	}

Measured memory_bytes: 1024
# 初手 1 1 1 なら絶対成功 (greedy)
# どこかの状態で 1 1 1 を作れるなら絶対成功 (greedy)
# 0 1 2 なら絶対成功 (greedy)
# 0 0 3 で、初手がAB以外なら絶対成功 (greedy)
# 0 0 0 なら絶対失敗
#
# 初手で成否が分からないのは
# 0 1 1
# 0 0 2
# 0 0 1
#
# 0 0 1 は greedyにやるしかない
# 0 0 2 は、少なくとも1回はgreedy
#
# 結局、各回のgreedyでは問題になるのは
# 0 1 1 のときのみ
# これは1個先を読めば十分


def select(x, y, ops, i, z):
    # true -> x を増やす
    if not(x == 1 and y == 1 and i < len(ops) - 1):
        if x < y:
            return True
        else:
            return False

    # x = y = 1, i < len(ops) - 1
    # 先読みして xz なら x を増やす
    # 先読みして xy なら y を増やす
    # 先読みして xy なら どっちでもいい
    op = ops[i]
    nop = ops[i+1]

    oo = (op, nop)
    if op == nop:
        return True

    if oo in [("AB", "AC"), ("BC", "AB"), ("AC", "AB")]:
        return True

    return False

def main():
    nabc = [int(_x) for _x in input().split()]
    n = nabc[0]
    a = nabc[1]
    b = nabc[2]
    c = nabc[3]

    ops = []
    for i in range(n):
        ops.append(input())

    result = []
    for i in range(n):
        op = ops[i]
        if op == "AB":
            if select(a, b, ops, i, c):
                result.append("A")
                a+=1
                b-=1
            else:
                result.append("B")
                a-=1
                b+=1
        if op == "AC":
            if select(a, c, ops, i, b):
                result.append("A")
                a+=1
                c-=1
            else:
                result.append("C")
                a-=1
                c+=1
        if op == "BC":
            if select(b, c, ops, i, a):
                result.append("B")
                b+=1
                c-=1
            else:
                result.append("C")
                b-=1
                c+=1
        if a <0 or b<0 or c<0:
            print("No")
            return

    print("Yes")
    for r in result:
        print(r)

main()


Measured memory_bytes: 16992
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void){
	int i,j;
	long long int a,b,c,d,e[4],max;
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	e[0]=a*d;e[1]=a*c;e[2]=b*c;e[3]=b*d;
	max=e[0];
	for (i=0;i<4;i++){
		if (max<e[i]){
			max=e[i];
		}
	}
	printf("%lld",max);

	return 0;
}


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

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

        public static void Solve()
        {
            var ab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var answer = ab[0] - 1;
            if (ab[1] >= ab[0]) answer++;
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 11348
#include<bits/stdc++.h>
//#include<con> 
typedef long long ll;
using namespace std;
int a[100010];
map<int,int> mp;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    int mx=0;
    for(int i=0;i<n;i++)mx=max(mx,mp[a[i]]+mp[a[i]-1]+mp[a[i]+1]);
    cout<<mx<<endl;
    return 0;
}

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

bool check(vector<int> v, int g)
{
    int s = 0;
    for (int x: v)
        s += x;
    if (g<-s || s<g)
        return false;

    vector<bool> T(2*s+1);
    T[s] = true;
    for (int x: v)
    {
        vector<bool> P(2*s+1);
        P.swap(T);
        for (int i=-s; i<=s; i++)
            if (P[i+s])
                T[i-x+s] = T[i+x+s] = true;
    }
    return T[g+s];
}

int main()
{
    string s;
    cin>>s;
    int x, y;
    cin>>x>>y;

    int n = (int)s.size();
    int sx = 0;
    while (sx<n && s[sx]=='F')
        sx++;
    int c = 0;
    int l = 0;
    vector<int> vx;
    vector<int> vy;
    for (int i=sx; i<=n; i++)
    {
        if (i==n || s[i]=='T')
        {
            if (l>0)
                (c%2==0 ? vx : vy).push_back(l);
            l = 0;
            c++;
        }
        else
            l++;
    }

    if (check(vx, x-sx) && check(vy, y))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void print_char_line(const int n, const char edge, const char inside)
{
    cout << edge;
    for (int i = 0; i < n - 2; ++i)
    {
        cout << inside;
    }
    cout << edge << endl;
}

void print_frame(const int height, const int width)
{
    print_char_line(width, '#', '#');
    for (int i = 0; i < height - 2; ++i)
    {
        print_char_line(width, '#', '.');
    }
    print_char_line(width, '#', '#');
}

int main()
{
    int a, b;
    while (cin >> a >> b, a != 0 || b != 0)
    {
        print_frame(a, b);
        cout << endl;
    }
    return 0;
}

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

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

	string s;
	cin >> s;
	for (int i = 0; i < 19; i++) {
		if (i == 5 || i == 13 || i == 19) {
			cout << " ";
			continue;
		}
		cout << s[i];
	}
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

//-----------------------ここから-----------


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

	if(n % 2 == 0){
		cout << n << endl;
	} else {
		cout << n * 2 << endl;
	}
}



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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }
  decltype(a)::iterator result = unique(a.begin(), a.end());
  a.erase(result, a.end());

  int cnt = 1;
  for (int i = 1; i < a.size() - 1; i ++) {
    bool incre1 = a.at(i - 1) < a.at(i);
    bool incre2 = a.at(i) < a.at(i + 1);
    if (incre1 != incre2) {
      cnt ++;
      i ++;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 640
S = input()

S = S[::-1]

mod_list = [pow(10,i,13) for i in range(12)]
mod = 10**9 + 7
DP = [[0]*13 for i in range(len(S)+1)]
DP[0][0] = 1

for i in range(len(S)):
    if S[i]=='?':
        for j in range(10):
            for k in range(13):
                DP[i+1][(k+j*mod_list[i%12])%13] = (DP[i+1][(k+j*mod_list[i%12])%13] + DP[i][k])%mod
    else:
        s=int(S[i])
        for k in range(13):
            DP[i+1][(k+s*mod_list[i%12])%13] =(DP[i+1][(k+s*mod_list[i%12])%13] + DP[i][k])%mod

print(DP[len(S)][5])

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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x%mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
	mint operator+(const mint a) const { return mint(*this) += a; }
	mint operator-(const mint a) const { return mint(*this) -= a; }
	mint operator*(const mint a) const { return mint(*this) *= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const { return pow(mod - 2); }
	mint& operator/=(const mint a) { return *this *= a.inv(); }
	mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
}c(200005);

//約数の個数
mint calc(long long N, long long M) {
	vector<long long> x;
	for (long long i = 2; i*i <= N; i++) {
		int m = 0;
		while (N%i == 0) { // 素数で割り切れなくなるまで割っていく
			m++;//割った個数を配列に足す
			N /= i;
		}
		if (0 != m) {
			x.push_back(m);
		}
		if (1 == N) {
			break;
		}
	}
	if (1 != N) {
		x.push_back(1);
	}
	mint ans = 1;
	for (long long n = 0; n < x.size(); ++n) {
		ans *= c(x[n] + M - 1, M - 1);
	}
	return ans;
}

int main() {
	long long N, M;
	cin >> N >> M;
	cout << calc(M, N) << endl;
	return 0;
}

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

int main(){
  int W, H, N;
  cin >> W >> H >> N;
  int iro[W+1][H+1];
  for(int i=0; i<W+1; i++)
    for(int j=0; j<H+1; j++)
      iro[i][j]=0;
  
  for(int i=0; i<N; i++){
    int x, y, n;
    cin >> x >> y >> n;
    if(n==1){
      if(x==0)
        continue;
      for(int i=0; i<x; i++)
        for(int j=0; j<H+1; j++)
          iro[i][j]=1;
    }
    else if(n==2){
      if(x==W)
        continue;
      for(int i=x+1; i<W+1; i++)
        for(int j=0; j<H+1; j++)
          iro[i][j]=1;
    }
    else if(n==3){
      if(y==0)
        continue;
      for(int i=0; i<W+1; i++)
        for(int j=0; j<y; j++)
          iro[i][j]=1;
    }
    else{
      if(y==H)
        continue;
      for(int i=0; i<W+1; i++)
        for(int j=y+1; j<H+1; j++)
          iro[i][j]=1;
    } 
  }
  int kioku_x, kioku_y;
  int count_x=0, count_y=0;
  bool shiro=false;
  for(int i=0; i<W+1; i++){
    for(int j=0; j<H+1; j++){
      if(iro[i][j]==0){
        kioku_x=i, kioku_y=j;
        shiro=true;
        break;
      }
    }
    if(shiro==true)
      break;
  }
  
  for(int i=kioku_x; i<W+1; i++){
    if(iro[i][kioku_y]==0)
           count_x++;
  }
  for(int j=kioku_y; j<H+1; j++){
    if(iro[kioku_x][j]==0)
           count_y++;
  }
  if(shiro==false)
    cout << 0 << endl;
  else
    cout << (count_x-1)*(count_y-1) << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a,b,c,d,L;
    scanf("%d%d%d%d%d",&L,&a,&b,&c,&d);
    int ans=max(a/c+(a%c?1:0),b/d+(b%d?1:0));
    printf("%d\n",L-ans);
    return 0;
}

Measured memory_bytes: 1024
N,K = map(int,input().split())
A = list(map(int,input().split()))
route = [1]
for i in range(N):
  route.append(A[route[i]-1])
prepart = route.index(route[-1])
cycle = len(route) - prepart -1
if K > N:
  K = (K-prepart)%cycle + prepart
print(route[K])

Measured memory_bytes: 32280
/* Author: Mrigank
Science is what we understand well enough to explain to a computer, 
    Art is everything else we do - Donald E. Knuth */

#include <bits/stdc++.h>
#include <iostream>
#include <unordered_map>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <string> 
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<ll, int> PLI;
typedef pair < ll , ll > PLL;
typedef pair<int, int> PII;
typedef vector < ll > vl;
typedef vector < int > vi;
typedef vector < bool > vb;
typedef vector < pair < ll , ll > > vpl;
typedef vector < pair < ll , bool > > vpb;
typedef vector < vector < int > > vvi;
typedef vector < vector < ll > > vvl;


#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define pi pair < ll , ll >
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x , val) memset(x , val , sizeof(x))
#define deb(x) cout<<#x<<" :: "<<x<<"\n"
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n"
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n"
#define all(x) x.begin() , x.end()
#define alls(x , y) x.begin() , x.end() , y
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define endl "\n"

const ll mxsize = 5e5 + 10;
const ll linf = 1e9;
const ld inf = 10000000000.0;
const ll mod = 1e9 + 7;
 
/******************************************** CODE STARTS FROM HERE *************************************************/ 
int main()
{
    fastIO;
    ll n;
    cin >> n;
    int val = n % 10;
    if(val == 2 || val == 4 || val == 5 || val == 7 || val == 9)
    {
        cout << "hon" << endl;
    }
    else if(val == 0 || val == 1 || val == 6 || val == 8)
    {
        cout << "pon" << endl;
    }
    else
    cout << "bon" << endl;
}

Measured memory_bytes: 3612
import sys
x, n = map(int, input().split())
p = [int(_) for _ in input().split()]

if n == 0:
    print(x)
    sys.exit()

not_in_p = []
for i in range(0, 102):
    if i not in p:
        not_in_p.append(i)

nip_temp = []
for i in not_in_p:
    nip_temp.append(abs(x-i))

address = nip_temp.index(min(nip_temp))
print(not_in_p[address])


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

int main() {
  int n, i;
  cin >> n;
  
  long long dp[100009];
  dp[0] = 1;
  for(i = 1; i <= n; i++){
    dp[i] = (dp[i - 1] * i) % 1000000007;
  }
  
  cout << dp[n] << endl;
}

Measured memory_bytes: 1024
// unolight {{{
#include <bits/stdc++.h>
#include <unistd.h>
#define SZ(x) ((int)(x).size())
#define ALL(c) begin(c),end(c)
#define REP(i,n) for ( int i=0; i<(int)(n); i++ )
#define REP1(i,a,b) for ( int i=(int)(a); i<=(int)(b); i++ )
#define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;

void RI() {}

template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}

template<typename T>
void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; }

template<typename T, typename... Args>
void _dump( const char* s, T&& head, Args&&... tail ) {
    int c=0;
    while ( *s!=',' || c!=0 ) {
        if ( *s=='(' || *s=='[' || *s=='{' ) c++;
        if ( *s==')' || *s==']' || *s=='}' ) c--;
        cerr<<*s++;
    }
    cerr<<"="<<head<<", ";
    _dump(s+1,tail...);
}

#define dump(...) _dump(#__VA_ARGS__, __VA_ARGS__);

template<typename Iter>
ostream& _out( ostream &s, Iter b, Iter e ) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}

template<typename A, typename B>
ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; }
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); }
template<typename T>
ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); }
template<typename A, typename B>
ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); }
// }}}

const int MAX_N = 25;
int n, m, ans=0;
char B[MAX_N][MAX_N];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int solve(int a, int b)
{
    int sx = a / m, sy = a % m;
    int tx = b / m, ty = a % m;
    if(B[sx][sy] == '#' || B[tx][ty] == '#')
        return 0;
    queue<PII> q;
    bool vis[MAX_N][MAX_N]={};
    vis[sx][sy] = true;
    q.push({sx, sy});
    int d = 0;
    while (!q.empty())
    {
        int sz = q.size();
        for (int k = 0; k < sz; k++)
        {
            int x = q.front().first, y = q.front().second;
            q.pop();
            if (x == tx && y == ty)
                return d;
            for (int i = 0; i < 4;i++) {
                int xx = x + dx[i];
                int yy = y + dy[i];
                if( 0 <= xx && xx <n && 0<=yy && yy < m && B[xx][yy]!='#' && !vis[xx][yy]) {
                    q.push({xx, yy});
                    vis[xx][yy] = true;
                }
            }
        }
        d++;
    }
    return d-1;
}

int main( int argc, char *argv[] ) {
    RI(n, m);
    REP(i, n) {
        scanf("%s", B[i]);
    }
    REP(i, n*m) {
        REP1(j, i+1, n*m) {
            ans = max(ans, solve(i, j));
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[110];
int main(){
	int n,k,d,t,ans=0;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		cin>>d;
		for(int j=1;j<=d;j++){
			cin>>t;
			a[t]=1;
		} 
	}
	for(int i=1;i<=n;i++){
		if(a[i]==0){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int n;
  cin >> n;
  map<string,int> mp;
  rep(i,n) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    mp[s]++;
  }
  ll ans = 0;
  for (auto& p : mp) {
    int s = p.second;
    ans += (ll)s*(s-1)/2;
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<", "<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	for(int i = 0;i < (int)v.size(); i++){
		if(i)os<<", ";
		os<<v[i];
	}
	os<<"}";
	return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

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

int main(){
    cin.tie(0); ios_base::sync_with_stdio(0);
    int n; cin >> n; 
    vector<int> a(n), b(n);
    ll sA = 0;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    ll s1 = 0, s2 = 0;
    for(int i = 0; i < n; i++){
        if(a[i] < b[i]){
            s1 += (b[i] - a[i]) / 2;
        } else s2 += a[i] - b[i];
    }
    trace(s1, s2);
    if(s1 < s2){
        printf("No\n");
        return 0;
    }
    
    printf("Yes\n");
}

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

using namespace std;

/* g++ -g -fsanitize=address -lasan -std=c++11 -Dfoo_ */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

/*
 * For example, if i = x, any box whose index is muliple of x (2x,3x ..)
 * will be counted if there is a ball in them. The sum of balls in
 * those boxes mod 2 must be same as ai mod 2 (if ai is even, sum has
 * to be even; ai is odd sum is odd).
 */

int main()
{
#ifdef foo_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    while (cin >> n) {
        VI A(n+1), ans(n+1); int res = 0;
        FOR(i,1,n+1)
            cin >> A[i];
        FORR(i,n,0) {
            int j = 2*i, x = 0;
            while (j < n+1) {
                x += ans[j];
                j += i;
            }
            if (A[i]%2 != x%2)
                ans[i] = 1, res++;
        }
        cout << res << endl;
        if (res) 
            FOR(i,1,n+1) if (ans[i])
                cout << i << ' ';
        cout << endl;            
    }
    return 0;
}


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

int main() {
long long n,m;
cin >> n >> m;
long long k;
bool ng[n+1];
for(long long i=0;i<n+1;i++){
    ng[i]=false;
}
for(long long i=0;i<m;i++){
    cin >> k;
    ng[k]=true;
}
long long ans[n+1];
ans[0]=0;
ans[1]=1;
ans[2]=2;
if(ng[1]){
  ans[1]=0;
  ans[2]=1;}
if(ng[2]){
  ans[2]=0;}
  
for(long long i=1;i<n;i++){
    ans[i]%=1000000007;
    ans[i+1]%=1000000007;
    ans[i+2]=ans[i+1]+ans[i];
    if(ng[i])ans[i+2]-=ans[i];
    if(ng[i+1])ans[i+2]-=ans[i+1];
    ans[i+2]%=1000000007;    
    }
cout << ans[n];
}


Measured memory_bytes: 1152
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 K = 0;

	SINT32 min = 1000000001;

	cin >> N;
	cin >> K;

	vector<SINT32> PDATA;
	vector<SINT32> MDATA;
	
	SINT32 BUF;
	for (SINT32 i = 0; i < N; i++) {
		cin >> BUF;
		if (BUF>=0) {
			PDATA.emplace_back(BUF);
		} else {
			MDATA.emplace_back(BUF*-1);
		}	
	}
	
	if (PDATA.size() == 0) {
		
		sort(MDATA.begin(),MDATA.end());
		min = MDATA[K-1];


	} else if (MDATA.size() == 0) {
		min = PDATA[K-1];
	} else {
		sort(MDATA.begin(),MDATA.end());

	}


	for (SINT32 i = 0; i < K; i++) {
		if ((PDATA.size()>i) && (MDATA.size()>(K-i-2))){
			if (i == K-1) {
				min = MIN(min,PDATA[i]);

//				cout << 1 <<" "<< min <<endl;
			} else {
				min = MIN(min,(PDATA[i])*2+MDATA[K-i-2]);
//				cout << 2 <<" "<< min <<endl;
			}
		}

		if ((MDATA.size()>i) && (PDATA.size()>(K-i-2))){
			if (i == K-1) {
				min = MIN(min,MDATA[i]);
//				cout << 3 <<" "<< min <<endl;
			} else {
				min = MIN(min,(MDATA[i])*2+PDATA[K-i-2]);
//				cout << 4 <<" "<< min <<endl;
			}
		}

	}


	cout << min << endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();

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

int main(){
  ll n,m,k;
  cin >> n >> m >> k;
  vector<ll> a(n),b(m);
  for(ll i=0;i<n;i++){
    cin >> a.at(i);
  }
  for(ll i=0;i<m;i++){
    cin >> b.at(i);
  }
  
  ll cnt=-1,dnt=n;
  vector<ll> d(n+1);
  for(ll i=1;i<=n;i++){
    d.at(i) += d.at(i-1);
    d.at(i) += a.at(i-1);
    if(d.at(i) > k){
      dnt = i-1;
      break;
    }
  }
  
  ll ent=m;
  vector<ll> e(m+1);
  for(ll i=1;i<=m;i++){
    e.at(i) += e.at(i-1);
    e.at(i) += b.at(i-1);
    if(e.at(i) > k){
      ent = i-1;
      break;
    }
  }
  
  for(ll i=0;i<=dnt;i++){
    for(ll j=ent;j>=0;j--){
      if(d.at(i) + e.at(j) <= k){
        cnt = max(i+j,cnt);
        ent = j;
        break;
      }
    }
  }
  if(cnt == -1) cnt = dnt+ent;
  
  cout << cnt << endl;
   
  return 0;
}


Measured memory_bytes: 9560
#include <cstdio>
#include <cassert>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <bitset>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define eps 1e-8
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define int long long
using namespace std;

typedef long double ld;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef tuple<int, int, int> tiii;
typedef unsigned long long ull; 
typedef vector<int> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const int INF = 1e18;
const int M = 1e9 + 7;
//__int128


signed main()
{
#ifndef ONLINE_JUDGE
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    cout << 3 * n * n << endl;
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int n,x;
	cin >> n >> x;
	vector<int>snack(n);

	rep(i, n)cin >> snack[i];
	int zairyo = x - accumulate(all(snack),0);
	sort(all(snack));
	cout << n + zairyo / snack[0] << endl;
	return 0;
}



Measured memory_bytes: 3632
package main;

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"strings"
)

func main() {
	s := NewScanner().NextLine()

	fmt.Println(strings.Replace(s, ",", " ", -1))
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf) + 1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}



Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll a,b,c;
int main(){
	scanf("%lld%lld%lld",&a,&b,&c);
	c = min(c,a + b + 1);
	printf("%lld\n",b + c);
	return 0;
}


Measured memory_bytes: 768
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
const vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
template<class T>void debag(const vector<T> &a){cerr<<"debag :";for(auto v:a)cerr<<v<<" ";cerr<<"\n";}
template<class T>void print(const vector<T> &a){for(auto v:a)cout<<v<<" ";cout<<"\n";}
int main(){
    string s;
    cin>>s;
    if(s.back()=='s'){
        cout<<s<<"es"<<"\n";
    }else{
        cout<<s<<'s'<<"\n";
    }
}

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


using LL = long long int;
using uLL = unsigned long long int;
using uint = unsigned int;
using ld = long double;

const int N = 107;
const int K = 100007;
const int M = 1000000007;

int pref[N][K];
int dp[N][K], A[N];


int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> A[i];
    }
    for(int i = 0; i <= k; i++){
        pref[0][i] = 1;
    }
    for(int i = 1; i <= n; i++){
        dp[i][0] = 1;
        pref[i][0] = 1;
        for(int j = 1; j <= k; j++){
            if(j-A[i] > 0){
                dp[i][j] = pref[i-1][j]-pref[i-1][j-A[i]-1];
                if(dp[i][j] < 0) dp[i][j] += M;
            }
            else{
                dp[i][j] = pref[i-1][j];
            }
            pref[i][j] = pref[i][j-1]+dp[i][j];
            if(pref[i][j] >= M) pref[i][j] -= M;
        }
    }
    cout << dp[n][k] << '\n';
    return 0;
}

Measured memory_bytes: 81792
/*
 Abu Jafor Mohammad Saleh
 ios_base :: sync_with_stdio(false);
 cin.tie(NULL);
 */

#include<cstdio>
#include<iomanip>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<limits>
#include <algorithm>
#include <unordered_map>
#define f first
#define s second
#define MOD 1000000007
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//#include<bits/stdc++.h>
using namespace std;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
    
}

unsigned ll solve(ll n)
{
    unsigned ll c = 0;

    for( unsigned ll v = 5; (n/v) >= 1; v = v*5)
    {
        c += (n/v);
   
    }
    
    return c;
}

int main()
{
    fast;
    unsigned ll n;
    cin>>n;
    if(n%2){
        cout<<0<<endl;
        exit(0);
    }
    cout<<solve(n/2)<<endl;
   
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = 0;
		double m = 0;
		double temp = 0;
		int count = 0;
		double ans[] = new double[1000];
		while (true) {
			n = sc.nextInt();
			if (n == 0)
				break;
			int s[] = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = sc.nextInt();
				m += s[i];
			}
			m = m / n;
			for (int i = 0; i < n; i++) {
				temp += (s[i] - m) * (s[i] - m);
			}
			ans[count] = Math.sqrt(temp / n);
			m = 0;
			temp = 0;
			count++;
		}
		for (int i = 0; i < count; i++) {
			System.out.println(ans[i]);
		}
	}
}


Measured memory_bytes: 33848
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(void){
  int N;
  cin >> N;
  if(N==1){
    cout << "Hello World" << endl;
  }else{
    int A,B;
    cin >> A >> B;
    cout << A + B << endl;
  }
}


Measured memory_bytes: 256
a, b, c, d = map(int, list(input()))
if a + b + c + d == 7:
    print("{}+{}+{}+{}=7".format(a, b, c, d))
elif a + b + c - d == 7:
    print("{}+{}+{}-{}=7".format(a, b, c, d))
elif a + b - c + d == 7:
    print("{}+{}-{}+{}=7".format(a, b, c, d))
elif a - b + c + d == 7:
    print("{}-{}+{}+{}=7".format(a, b, c, d))
elif a + b - c - d == 7:
    print("{}+{}-{}-{}=7".format(a, b, c, d))
elif a - b - c + d == 7:
    print("{}-{}-{}+{}=7".format(a, b, c, d))
elif a - b + c - d == 7:
    print("{}-{}+{}-{}=7".format(a, b, c, d))
elif a - b - c - d == 7:
    print("{}-{}-{}-{}=7".format(a, b, c, d))


Measured memory_bytes: 9216
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define reps(i,x) for(ll i=1;i<=(ll)(x);i++)
#define rrep(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(ll)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int a[10000];
int main() {
    int n;
    cin >> n;
    rep(i, n)
        cin >> a[i];
    int cnt = 0;
    rep(i,n){
        while(a[i]%2==0){
            a[i] /= 2;
            cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
n = int(input())
alf = "0abcdefghijklmnopqrstuvwxyz"
ans = ""

while n != 0:
    x = n%26
    
    if x == 0:
        x = 26
        
    ans += alf[x]
    n -= x
    n //= 26

print(ans[::-1])

Measured memory_bytes: 9160
#include <stdio.h>

int main()
{
  long a,v,b,w,t;
  scanf("%ld%ld%ld%ld%ld",&a,&v,&b,&w,&t);
  long alen,blen;
  if (b > a)
  {
   alen = a + v*t;
   blen = b + w*t;
   if (alen >= blen)
   {
     printf("YES");
   }
   else
   {
     printf("NO");
   }
  }
  else
  {
    alen = a - v*t;
    blen = b - w*t;
    if (alen <= blen)
    {
      printf("YES");
    }
    else
    {
      printf("NO");
    }
  }
}

Measured memory_bytes: 1736
n = int(input())
blocks = [list(map(int, input().split())) for _ in range(n)]
blocks.sort(key=lambda x: x[0] + x[1])
res = 0
dp = [0] * 20123
# dp[i] - best score of boxes with total weight i
for w, s, v in blocks:
    for j in range(s, -1, -1):
        dp[j + w] = max(dp[j + w], dp[j] + v)
        res = max(res, dp[j + w])
print(res)

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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

int n;
 
double a, x, ans;
 
int main() 
{
	giii(n, a, x);
	for(int i = n; i; --i) 
	{
		double m = 2 * i;
		double v = (a + (a + (m - 1) *x)) / m * i;
		ans += v;
		a = ((m + 2) * a + 5 * x) / m;
		x = (m + 4) / m * x;
	}
	printf("%.15lf\n", ans);
	return 0;
}

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

#include<string>


using namespace std;
int main()
{
    unsigned int inputHP = 0 , inputNumber = 0 ,  kougei[100000], sumKougeki=0;

    cin >> inputHP >> inputNumber;

    for (int i = 0; i < inputNumber;i++) {
        cin >> kougei[i];
        sumKougeki = sumKougeki + kougei[i];
    }

    if (inputHP <= sumKougeki) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}

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

int main(){
    int N,K;
    cin >> N >> K;
    int x[N];
    for(int i=0;i<N;i++){ cin >> x[i]; }
    int count = 0;
    
    for(int i=0;i<N;i++){
        if(x[i] < K-x[i]){  //タイプAの方が近かったら
            count += x[i];
        }
        else{   //タイプBの方が近かったら
            count += K-x[i];
        }
    }
    count *= 2; //ロボットは往復するので2倍
    
    cout << count << endl;
}

Measured memory_bytes: 256