akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

int main(void){
        int i;
        char moji;

        scanf("%s",&moji);

        if((moji>='a')&&(moji<='z'))
{

                printf("a\n");
}
        else if((moji>='A')&&(moji<='Z'))
{
                printf("A\n");
}

        return 0;
}
                    

Measured memory_bytes: 1652
/*
Hanit Banga
*/

#include <iostream>
#include <vector>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 5;

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

	cout << 2 * (x/11) + (x % 11 > 0) + (x % 11 > 6);	
}

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

int main(){
  int a, b, p;
  scanf("%d %d", &a, &b);
  
  if(a == b){
    p = a + b;
  }else if(a > b){
    p = 2 * a -1;
  }else{
    p = 2 * b -1;
  }
  printf("%d", p);
}
  

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.14159265358979323846
int main() 
{
    
    ll n,d;
    cin>>n>>d;
    ll x,y;
    int ans=0;
    while(n--)
    {
    	cin>>x>>y;
    	if(x*x+y*y<=d*d)
    	{
    		ans++;
		}
	}
	cout<<ans;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    char c;
    cin >> a >> c >> b;
    if (c == '+') {
      cout << a + b << endl;
    } else {
      cout << a - b << endl;
    }

    return 0;
}


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

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

int lcm(int64_t a, int64_t b)
{
   return a * b / gcd(a, b);
}

int main() {
  int N;
  int64_t M;
  cin>>N>>M;
  vector<int64_t> p(N);
for (int i=0;i<N;i++) {
  cin>>p.at(i);
}
  int64_t A=p.at(0),Z=0,B=1;
  while(A%2==0){
    A/=2;
    B*=2;
  }
  for(int i=1;i<N;i++){
    if(p.at(i)%B!=0||(p.at(i)/B)%2==0){
      B=1;
      break;
    }
  }
  if(B==1){
    cout<<"0"<<endl;
  }
  else{
    A=1;
    for(int i=0;i<N;i++){
      A=lcm(A,p.at(i));
      if(A>M*2){
        break;
      }
    }
    cout<<(M/(A/2)+1)/2<<endl;
  }
    
}




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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    double sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }

    sort(a.begin(), a.end(), greater<int>());

    bool x = true;

    for (int i = 0; i < m; i++)
    {
        if((double)a[i] < sum / (4 * m)){
            x = false;
            break;
        }
    }

    if(x) cout << "Yes" << endl;
    else cout << "No" << endl;    
    
}

Measured memory_bytes: 256
from sys import stdin
n,m = map(int,stdin.readline().split())
prob = dict()
AC,WA = 0,0
for _ in range(m):
	p,s = stdin.readline().split()
	p = int(p)
	if p in prob:
		if s == "AC":
			if prob[p] > 0:
				AC += 1
				WA += prob[p]
				prob[p] = 0
		else:
			if prob[p] > 0: prob[p] += 1
	else:
		if s == "AC":
			prob[p] = 0
			AC += 1
		else:
			prob[p] = 1
print(AC,WA)

Measured memory_bytes: 15068
N, K = map(int, input().split())

ans = 0
for i in range(K,N+2):
    # 0~K-1までK個選ぶ→(K-1)K/2:最小値
    # N-(K-1)~NまでK個選ぶ→(2N-K+1)K/2:最大値
    # 最小値〜最大値までの数→最大ー最小＋１
    # K(N-K+1)+1
    ans += (i*(N-i+1)+1)%(10**9+7)

print(ans%(10**9+7))

Measured memory_bytes: 62972
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


def main():
    S = input().strip()

    okflag = 0
    okflag1 = 0
    okflag2 = 0

    if S[0] == 'A':
        okflag1 = 1
    if S[1].islower() and S[len(S)-1].islower():
        okflag2 = 1
    for i in range(2, len(S)-1):
        if S[i] == "C" and okflag == 0:
            okflag = 1
        elif S[i].islower():
            pass
        else:
            okflag = 0
            break

    if okflag == 1 and okflag1 == 1 and okflag2 == 1:
        print("AC")
    else:
        print("WA")


if __name__ == '__main__':
    main()


Measured memory_bytes: 60012
// AT 2365
// DeP
#include <cctype>
#include <cstdio>
#include <algorithm>
using namespace std;

namespace IO {
    const int MAXSIZE = 1 << 18 | 1;
    char buf[MAXSIZE], *p1, *p2;

    inline int Gc() { return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2)? EOF: *p1++; }
    template<class T> void read(T& x) {
        x = 0; int f = 0, ch = Gc();
        while (!isdigit(ch)) f |= ch == '-', ch = Gc();
        while (isdigit(ch)) x = x * 10 + ch - '0', ch = Gc();
        if (f) x = -x;
    }
}
using IO::read;

typedef pair<int, int> Pii;
const int MAXN = 1e6+5, LOG = 21, INF = 0x3f3f3f3f;

int n, V;
int X[MAXN], f[MAXN], g[MAXN];
int L[LOG][MAXN], R[LOG][MAXN];
bool Ans[MAXN];
Pii segs[MAXN];

int main() {
    // input
    read(n); read(V);
    for (int i = 1; i <= n; ++i) read(X[i]);
    X[0] = -INF; X[n+1] = INF;
    // solve
    int log = 0;
    for (int v = V; v >= 0; v /= 2, ++log) {
        R[log][n+1] = n+1;
        for (int i = 1; i <= n; ++i) L[log][i] = X[i] - X[i-1] <= v? L[log][i-1]: i;
        for (int i = n; i >= 1; --i) R[log][i] = X[i+1] - X[i] <= v? R[log][i+1]: i;
        if (!v) { ++log; break; }
    }
    for (int i = 1; i <= n; ++i) segs[i] = make_pair(L[0][i], R[0][i]);
    int tot = unique(segs+1, segs+1+n) - segs - 1;
    if (tot > log) {
        for (int i = 1; i <= n; ++i) puts("Impossible");
        return 0;
    }
    for (int S = 0; S < (1 << log); ++S) f[S] = n+1;
    for (int S = 0; S < (1 << log); S += 2) {
        for (int i = 0; i < log; ++i) if ((S >> i) & 1) {
            f[S] = min(f[S], L[i][f[S ^ (1 << i)] - 1]);
            g[S] = max(g[S], R[i][g[S ^ (1 << i)] + 1]);
        }
    }
    for (int i = 1; i <= tot; ++i)
        for (int S = 0; S < (1 << log); S += 2)
            if (g[S] >= segs[i].first-1 && segs[i].second+1 >= f[((1<<log)-1)-(S+1)]) {
                for (int k = segs[i].first; k <= segs[i].second; ++k) Ans[k] = true;
                break;
            }
    // output
    for (int i = 1; i <= n; ++i) puts(Ans[i]? "Possible": "Impossible");
    return 0;
}


Measured memory_bytes: 133632
import heapq
pop = heapq.heappop
push = heapq.heappush

N, K = list(map(int, input().split()))
V = list(map(int, input().split()))

ans = 0
for i in range(min(N + 1, K + 1)):
  for j in range(min(N + 1, K + 1) - i):
    q = []
    t = 0
    for k in range(i):
      tt = V[k]
      t += tt
      push(q, tt)
    for k in range(j):
      tt = V[N - 1 - k]
      t += tt
      push(q, tt)

    for k in range(K - i - j):
      if q == []:
        break
      tt = pop(q)
      if tt >= 0:
        break
      t -= tt

    ans = max(ans, t)
print(ans)


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

int main(){
    char a, b; scanf("%c %c", &a, &b);
    if(a == 'H') printf("%c\n", b);
    else if(a == 'D') printf("%c\n", b == 'H'? 'D':'H');
    return 0;
}

Measured memory_bytes: 256
usrInput = input()
import math
taxRate = 0.08
finding = 1
whileIs = True
foundIs = False

while whileIs == True:
    if math.floor(finding * (taxRate + 1)) == int(usrInput):
        unTaxed = finding
        whileIs = False
        foundIs = True
    else:
       if 49300 <= finding:
        whileIs = False
        foundIs = False
    finding = finding + 1

if foundIs:
    print(str(unTaxed))
else:
    print(":(")

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

//#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1002000007
#define INF LONG_LONG_MAX


int main(){
    int x;
    cin>>x;
    int p[x];
    for (int i=0; i<x; i++){
        cin>>p[i];
    }
int co=0;
int mx=p[0];
    for(int i=0; i<x; i++){
        mx=min(mx,p[i]);
        if (mx==p[i]){
        co++;
        }
    }
    cout<<co<<endl;
    return 0;
}

Measured memory_bytes: 1024
//16
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
  int s[2]={};
  for(int i=0;i<2;i++){
    for(int j=0;j<4;j++){
      int n;
      cin>>n;
      s[i]+=n;
    }
  }
  cout<<max(s[0],s[1])<<endl;
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int H, W, N; cin >> H >> W >> N;
    int sr, sc; cin >> sr >> sc;
    string s, t; cin >> s >> t;

    unordered_map<char, int> A, T; bool ok = true;
    REP(i, 0, N) {
        T[s[i]]++;
        if (min(H, sr + A['D']) - T['U'] < 1) ok = false;
        if (max(1, sr - A['U']) + T['D'] > H) ok = false;
        if (min(W, sc + A['R']) - T['L'] < 1) ok = false;
        if (max(1, sc - A['L']) + T['R'] > W) ok = false;
        
        // if (sr - T['U'] < 1) ok = false;
        // if (sr + T['D'] > H) ok = false;
        // if (sc - T['L'] < 1) ok = false;
        // if (sc + T['R'] > W) ok = false;

        if (t[i] == 'U') {
            if (T['D'] > 0) T['D']--;
            else A[t[i]]++;
        } else if (t[i] == 'D') {
            if (T['U'] > 0) T['U']--;
            else A[t[i]]++;
        } else if (t[i] == 'L') {
            if (T['R'] > 0) T['R']--;
            else A[t[i]]++;
        } else {
            if (T['L'] > 0) T['L']--;
            else A[t[i]]++;
        }
    }

    if (ok) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int cr=0,cw=0;
    for(int i=0;i<n;i++){
        if(s[i]=='W')
        cw++;
        else
        cr++;
    }
    int cwl=0,crl=0;
    for(int i=0;i<cr;i++){
        if(s[i]=='W')
        cwl++;
        else
        crl++;
    }
    int cwr=cw-cwl,crr=cr-crl;
    
    cout<<min(cwl,crr)+abs(cwl-crr);
}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    cout.precision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif
    int t = 1; 
    // cin >> t;	
    int tt = t;
    while (t--) { 
        solve();
    }
    return 0;
}
int x[20][20], y[20][20];
int a[20];
void solve() { 
	int n;
	cin >> n;
	for (int i = 0; i < n; i += 1) {
		cin >> a[i];
		for (int j = 0; j < a[i]; ++j) {
			cin >> x[i][j] >> y[i][j];
			--x[i][j];	
		}
	}
	int mx = 0;
	for (int mask = 0; mask < (1 << n); ++mask) {
		bool can = true;
		bool hon[n + 1];
		for (int bit = 0; bit < n; ++bit) {
			if ((1 << bit) & mask) {
				hon[bit] = true;
			}
			else {
				hon[bit] = false;
			}
		}
		for (int i = 0; i < n; i += 1) {
			if (!hon[i])
				continue;
			for (int j = 0; j < a[i]; ++j) {
				if (hon[x[i][j]] != y[i][j])
					can = false;
			}
		}
		if (can)
			mx = max(mx, (int) __builtin_popcountll(mask));
	}
	cout << mx;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e5;
int n,K,fst[N],nxt[N],to[N],dep[N],ans,cnt,mm;
void ade(int u,int v){to[++mm]=v,nxt[mm]=fst[u],fst[u]=mm;}
void dfs(int u,int fa,int lim)
{
    dep[u]=dep[fa]+1;++cnt;if(lim==dep[u])return;
    for(int i=fst[u];i;i=nxt[i])
    {
        int v=to[i];if(v==fa)continue;
        dfs(v,u,lim);
    }
}
int main()
{
    scanf("%d%d",&n,&K);
    for(int i=1,u,v;i<n;i++)scanf("%d%d",&u,&v),ade(u,v),ade(v,u);
    if(~K&1)for(int i=1;i<=n;i++)cnt=0,dfs(i,0,(K>>1)+1),ans=max(ans,cnt);
    else for(int i=1;i<=n;i++)for(int j=fst[i];j;j=nxt[j])cnt=0,dep[to[j]]=0,dfs(i,to[j],(K>>1)+1),dep[i]=0,dfs(to[j],i,(K>>1)+1),ans=max(ans,cnt);
    cout<<n-ans<<endl;
}

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

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

    ll bai = n / k;

    n = n - (bai * k);
    ll min = n;

    n = abs(n - k);

    while (1)
    {
        if(n<min){
            min = n;
        }
        else{
            break;
        }
        n = abs(n - k);
    }

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

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

int main(){
    int m1,d1,m2,d2;
    cin >> m1 >> d1 >> m2 >> d2;
    if(m2==m1+1 and d2==1){
        cout << 1 <<  endl;
    } else cout << 0 << endl;
}

Measured memory_bytes: 256
let readCharArray () = stdin.ReadLine().ToCharArray()

let rec solve min list =
    match list with
    | x :: y :: z :: xx ->
        let diff =
            [| x; y; z |]
            |> System.String
            |> int
            |> (-) 753
            |> abs

        if diff > min then solve min (y :: z :: xx) else solve diff (y :: z :: xx)
    | _ -> min

()
|> readCharArray
|> Array.toList
|> solve 753
|> printfn "%d"


Measured memory_bytes: 30080
#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
int n,weight;
const int MaxN = 1e5+5;
int dp[105][MaxN];
int w[105];
int v[105];
int solve(int i,int take){
    if(take<0){
        return 1e18;
    }
    if(i==n){
        if(take!=0) return 1e18;
        return 0;
    }
    int &ans = dp[i][take];
    if(ans!=-1){
        return ans;
    }
    return ans = min(solve(i+1,take),w[i]+solve(i+1,take-v[i]));
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>weight;
    int sum = 0;
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
        sum+=v[i];
    }
    int res = 0;
    memset(dp,-1,sizeof(dp));
    for(int i=1;i<=sum;i++){
        int x = solve(0,i);
        if(x<=weight){
            res = i;
        }
    }
    cout<<res<<endl;
    return 0;
    
}



Measured memory_bytes: 82304
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N,M,R;
vector<vector<ll>> Mat;
vector<int> visit;
void input(){
    fast_io();
    cin >> N >> M >> R;
    for (int i = 0; i < R; i++)
    {
        int r; cin >> r;
        r--;
        visit.push_back(r);
    }

    Mat.assign(N,vector<ll>(N,INT_INF));
    for (int i = 0; i < M; i++)
    {
        int a,b,c; cin >> a >> b >> c;
        a--,b--;
        Mat[a][b] = c;
        Mat[b][a] = c;
    }
    for (int i = 0; i < N; i++) Mat[i][i] = 0;
}

int solve(){
    for (int k = 0; k < N; k++)
    {
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                Mat[i][j] = min(Mat[i][j],Mat[i][k]+Mat[k][j]);
            }
        }
    }
    ll ans = INT_INF;
    sort(visit.begin(),visit.end());
    do
    {
        ll cost = 0;
        for (int i = 0; i < R-1; i++)
        {
            cost += Mat[visit[i]][visit[i+1]];
        }
        ans = min(ans,cost);
    } while (next_permutation(visit.begin(),visit.end()));

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

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Data{
public:
    int x, y, b, d;
    Data(int x0, int y0, int b0, int d0){
        x = x0;
        y = y0;
        b = b0; // êÊÌÚ
        d = d0; // ü«
    }
};

int main()
{
    int dy[] = {1, 0, 0};
    int dx[] = {0, 1, -1};
    int db[][3] = {{5,1,-1}, {-5,5,6}, {-6,5,-5}, {-5,-1,1}};


    queue<Data> q1, q2;
    q1.push(Data(0, 0, 0, 0));
    vector<vector<vector<vector<int> > > > minCost(203, vector<vector<vector<int> > >(203, vector<vector<int> >(20, vector<int>(3, -1))));
    minCost[101][101][0][0] = 0;

    int cost = 0;
    for(;;){
        if(q1.empty()){
            q1 = q2;
            q2 = queue<Data>();
            ++ cost;
            if(cost == 100)
                break;
        }
        int x0 = q1.front().x;
        int y0 = q1.front().y;
        int b0 = q1.front().b;
        int d0 = q1.front().d;
        q1.pop();

        for(int i=0; i<3; ++i){
            int x = x0 + dx[i] * ((x0+y0)%2 ? -1:1);
            int y = y0 + dy[i] * ((x0+y0)%2 ? -1:1);
            int tmp = db[b0/5][(d0+i)%3];
            int b = (b0 / 5 + tmp / 5) * 5 + (b0 % 5 + tmp % 5 + 5) % 5;
            int d = (find(db[b/5], db[b/5]+3, -tmp) - db[b/5] - i + 3) % 3;

            if(minCost[x+101][y+101][b][d] == -1){
                minCost[x+101][y+101][b][d] = cost + 1;
                q2.push(Data(x, y, b, d));
            }
        }
    }

    for(;;){
        int x, y, n;
        cin >> x >> y >> n;
        if(x == 0 && y == 0 && n == 0)
            return 0;

        int ret = INT_MAX;
        for(int i=0; i<3; ++i){
            if(minCost[x+101][y+101][n][i] != -1)
                ret = min(ret, minCost[x+101][y+101][n][i]);
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 24000
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N,A,B = LMIIS()
    one = A+B
    #all_balls = one * 10**100
    if N%one <= A:
        remain = N%one
    else:
        remain = A
    print(N//one*A+remain)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll; 
typedef long double ld;
typedef pair<ll, ll> pll;

const ll N = 2e5 + 30, Mod = 1e9 + 7;
const ll SQ = 330;

int main () {
    ios::sync_with_stdio(0), cin.tie(0);
    ll a, b, n;
    cin >> a >> b >> n;
    vector<ll> vec;
    for (ll i = 1; i * i <= b; i ++) {
    	vec.pb(i);
    	vec.pb(b / i);
    }
    vec.pb(0);
    ll ans = 0;
    for (auto s : vec) {
    	ll r = b * s + b - 1;
    	ll l = b * s;
    	ll x = min(n, r);
    	if (x < l) continue;
    	ll ff = (a * x) / b;
    	ll ss = a * s;
    	if (ff - ss > ans) {
    		//cout << s << endl;
	    }
    	ans = max(ans, ff - ss);
    }
    cout << ans;
     return (0);
}

Measured memory_bytes: 19624
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <iomanip>
#include <assert.h>

using namespace std;

const int MAXN = 200005;

int n,tot;
int a[MAXN];
int len[MAXN];
int tp[MAXN];
int sum[MAXN];

bool ok(int lim)
{
	tot = 1;
	len[tot] = a[1];
	tp[tot] = 1;
	sum[tot] = a[1];
	for (int i = 2;i <= n;i++)
	{
		if (a[i] > a[i - 1])
		{
			if (tp[tot] == 1)
			{
				len[tot] += a[i] - a[i - 1];
				sum[tot] += a[i] - a[i - 1];
			}
			else
			{
				tot++;
				len[tot] = a[i] - a[i - 1];
				tp[tot] = 1;
				sum[tot] = a[i];
			}
		}
		else
		{
			int low = 1,high = tot;
			while (low < high)
			{
				int mid = (low + high) >> 1;
				if (sum[mid] >= a[i])
					high = mid;
				else
					low = mid + 1;
			}
			tot = low;
			sum[tot] = a[i];
			len[tot] = sum[tot] - sum[tot - 1];
			if (tp[tot] == lim)
			{
				if (tot == 1)
					return false;
				tot++;
				sum[tot] = sum[tot - 1];
				len[tot] = len[tot - 1];
				tp[tot] = 1;
				sum[tot - 1] = sum[tot] - len[tot];
				len[tot - 1] = 1;
				tp[tot - 1] = tp[tot - 2] + 1;
				sum[tot - 2]--;
				len[tot - 2]--;
				if (!len[tot - 2])
				{
					sum[tot - 2] = sum[tot - 1];
					len[tot - 2] = len[tot - 1];
					tp[tot - 2] = tp[tot - 1];
					sum[tot - 1] = sum[tot];
					len[tot - 1] = len[tot];
					tp[tot - 1] = tp[tot];
					tot--;
					if (tp[tot - 1] == tp[tot - 2])
					{
						sum[tot - 2] = sum[tot - 1];
						len[tot - 2] += len[tot - 1];
						sum[tot - 1] = sum[tot];
						len[tot - 1] = len[tot];
						tp[tot - 1] = tp[tot];
						tot--;
					}
				}
			}
			else
			{
				tot++;
				sum[tot] = sum[tot - 1];
				len[tot] = 1;
				tp[tot] = tp[tot - 1] + 1;
				sum[tot - 1]--;
				len[tot - 1]--;
				if (!len[tot - 1])
				{
					sum[tot - 1] = sum[tot];
					len[tot - 1] = len[tot];
					tp[tot - 1] = tp[tot];
					tot--;
					if (tp[tot] == tp[tot - 1])
					{
						sum[tot - 1] = sum[tot];
						len[tot - 1] += len[tot];
						tot--;
					}
				}
			}
		}
	}
	return true;
}

int main()
{
	scanf("%d",&n);
	for (int i = 1;i <= n;i++)
		scanf("%d",&a[i]);
	int low = 1,high = n;
	while (low < high)
	{
		int mid = (low + high) >> 1;
		if (ok(mid))
			high = mid;
		else
			low = mid + 1;
	}
	cout << low << endl;
	return 0;
}

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

struct qwq
{
	int a,b;
	inline bool operator<(const qwq &x)const
	{
	   return a<x.a;
	}
} x[100005];

priority_queue<int> q;

int main()
{
	int n,m,i,j=1,s=0;
	
	scanf("%d%d",&n,&m);
	
	for(i=1;i<=n;++i)
	   scanf("%d%d",&x[i].a,&x[i].b);
	
	sort(x+1,x+n+1);
	
	for(i=1;i<=m;++i)
	{
		for(;x[j].a==i&&j<=n;++j)
		   q.push(x[j].b);
		if(!q.empty())
		{
		   s += q.top();
		   q.pop();
		}
	}
	
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 1660
#include <stdio.h>
#include <string.h>

int main()
{
	int K;
	char S[128];
	scanf("%d%s", &K, S);

	if (strlen(S) <= K) {
		puts(S);
	}
	else {
		S[K] = '\0';
		printf("%s...\n", S);
	}

	return 0;
}


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

#ifdef FEI
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(...) do { \
    fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \
    _dump(#__VA_ARGS__, ##__VA_ARGS__); \
} while(0);

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> &x) { return _out(s,ALL(x)); }
template<typename T, size_t N>
ostream& operator <<(ostream &s, const array<T,N> &x) { return _out(s,ALL(x)); }
template<typename T>
ostream& operator <<(ostream &s, const set<T> &x) { return _out(s,ALL(x)); }
template<typename A, typename B>
ostream& operator <<(ostream &s, const map<A,B> &x) { return _out(s,ALL(x)); }
#else
#define dump(...)
#endif

template<typename T>
void _R(T &x) { cin>>x; }
void _R(int &x) { scanf("%d",&x); }
void _R(LL &x) { scanf("%" PRId64,&x); }
void _R(double &x) { scanf("%lf",&x); }
void _R(char &x) { scanf(" %c",&x); }
void _R(char *x) { scanf("%s",x); }

void R(){}
template<typename T, typename... X>
void R(T& head, X&... tail) { _R(head); R(tail...); }
// }}}

const int N = 100005;
int arr[N];

int main() {
    int n;
    R(n);

    for (int i=0; i<n; i++) {
        R(arr[i]);
    }

    LL cnt[2]={}, sum[2]={};

    for (int i=0; i<n; i++) {
        sum[0] += arr[i];
        sum[1] += arr[i];

        int x = i&1;
        if (sum[x] >= 0) {
            cnt[x] += sum[x]+1;
            sum[x] = -1;
        }
        if (sum[!x] <= 0) {
            cnt[!x] += -sum[!x]+1;
            sum[!x] = 1;
        }

    }
    cout << min(cnt[0], cnt[1]) << endl;

    return 0;
}


Measured memory_bytes: 640
using System;
class Program
{

    static void Main()
    {
        string[] In = Console.ReadLine().Split(' ');
        int a = int.Parse(In[0]);
        int b = int.Parse(In[1]);
        int c = int.Parse(In[2]);
        int k = int.Parse(In[3]);
        int sum = 0;
        if (k >= a)
        {
            sum += a;
        }
        else
        {
            sum += k;
        }
        k -= a;
        k -= b;
        if (k > 0)
        {
            sum -= k;
        }
        Console.WriteLine(sum);
    }
}

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

int main(){
	int i=1;
	int j=1;

	for (i;i<10;i++){
		for(j;j<10;j++){

			cout << i << 'x' << j << '=' << i*j << endl;
		}
		j = 1;

	}
	return 0;
}

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

vector<vector<long long> >dp;
vector<int>v,w;
long long maxval(int n,int wt){
        if(dp[n][wt]!=-1){
            return dp[n][wt];
        }
        long long mx = 0;
        mx = max(mx,maxval(n-1,wt));
        if(wt>=w[n]){
            mx = max(mx,maxval(n-1,wt-w[n])+v[n]);
        }
        return dp[n][wt]=mx;
}
void solve(){
	int n,wt;cin>>n>>wt;
	v.resize(n);
	w.resize(n);
	dp.resize(n,vector<long long>(wt+1,-1));
	for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
	}
	for(int i=0;i<w[0];i++){
        dp[0][i]=0;
	}
	for(int i=w[0];i<=wt;i++){
        dp[0][i]=v[0];
	}
	cout <<maxval(n-1,wt)<<"\n";
}
int main(){
	int t=1;//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 79360
#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> vi;
typedef vector<pii> vii;
typedef vector<long double> vd;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;
//__int128
int p[2000005], vis[2000005];
int prime(int n){
  int res = 0;
  for(int i = 2; i <= n; ++i) {
    if(!vis[i]) {
      p[res++] = i;
    }
    for(int j = 0; j < res && p[j] * i <= n; ++j) {
      vis[p[j] * i] = 1;
      if(i % p[j] == 0) {
        break;
      }
    }
  }
  return res;
}



signed main() {
  // freopen("in.txt", "r", stdin);
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  cout.setf(ios::fixed); cout.precision(10);
  int n;
  cin >> n;
  prime(2000000);
  for(int i = n; ; ++i) {
    if(!vis[i]) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 10496
/* #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define md 1000000007
int main()
{
    int n; cin >> n;
    char s[100000]; cin >> s; ll d = strlen(s);
    for(int i = 0; i < d;i++)
    {
        if(s[i] + n <= 'Z')
        {
            s[i] = s[i] + n;
        }
       else  if(s[i] + n >'Z')
        {
            s[i] = s[i] - 26;
            s[i] = s[i] + n;
        }

    }
    cout << s ;
} */
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;

#define md 1000000007
ll gcd (ll a, ll b)
{
    return b == 0 ? a : gcd(b,a % b);
}
int main()
{
    ll n,m; cin >> n >> m;
    ll d = gcd(n,m);
    ll f = m * n;
    cout << f /d;

}


















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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 ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    ll a,b,c,k,ans;
    cin >> a >> b >> c >> k;
    if(a>=k) {
        ans=k;
    } else if(a+b>=k) {
        ans=a;
    } else {
        ans=a-(k-(a+b));
    }
    cout << ans << endl;
}

Measured memory_bytes: 3904
#include <stdio.h>

int main()
{
        int ans,nn;
        int n,i,j;
        int matrix[11][11];

        scanf("%d",&n);
        while(n){
        for(i=0;i<n;i++){
                ans=0;
                for(j=0;j<n;j++){
                scanf("%d",&matrix[j][i]);
                ans+=matrix[j][i];
                }
                matrix[n][i]=ans;
        }
        for(i=0;i<n;i++){
                ans=0;
                for(j=0;j<n;j++){
                ans+=matrix[i][j];
                }
                matrix[i][n]=ans;
                nn+=ans;
        }
        matrix[n][n]=nn;
        for(i=0;i<=n;i++){
                for(j=0;j<=n;j++){
                        printf("%5d",matrix[j][i]);
                        }
                puts("");
                }
        nn=0;
        scanf("%d",&n);
        }
        return 0;
}

Measured memory_bytes: 620
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, r;
    cin >> n >> r;
    if (n >= 10)
        cout << r << endl;
    else
        cout << r + 100 * (10 - n) << endl;
}


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

#define ll                  long long int
#define llu                 long long unsigned
#define ld                  long double
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);
#define endl                "\n"
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define mp                  make_pair
#define ms(a,b)             memset((a),(b),sizeof(a))
#define min3(a,b,c)         min(a,min(b,c))
#define max3(a,b,c)         max(a,max(b,c))
#define min4(a,b,c,d)       min(min(a,b),min(c,d))
#define max4(a,b,c,d)       max(max(a,b),max(c,d))
#define max5(a,b,c,d,e)     max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e)     min(min3(a,b,c),min(d,e))
#define NUM                 1000000
#define PI		            2*acos(0.0)
#define maximum             (-1*INF)
#define READ(f) 	        freopen("f", "r", stdin)
#define WRITE(f) 	        freopen("f", "w", stdout)
const int INF = 1e5 + 10 ;

int main()
{
    ll s, w;
    cin>>s>>w;
    if(w >= s)
        cout<<"unsafe";
    else
        cout<<"safe";
    return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	uint64_t a,b,c;
	cin>>a>>b>>c;
	long double ab;
	ab=sqrtl(a)*sqrtl(b);
	if(a+ab*2+b<c)cout<<"Yes\n"s;
	else cout<<"No\n"s;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Set;

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

        Scanner scan = new Scanner(System.in);

        int K = scan.nextInt();
        String S = scan.next();
        int leng = S.length();
         if(leng<=K){
             System.out.println(S);
         }else{
             System.out.println(S.substring(0,K)+"...");
         }
    }
}



Measured memory_bytes: 38640
#include <bits/stdc++.h>
#include <math.h>
#define lli long long int
#include <limits.h>
#include <fstream>
#define F first
#define S second
#define PI 3.141592653589793238
#define pb push_back

using namespace std;

//doesn't work for arrays
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

const lli N=100000;
vector<lli> g[N];
lli low[N],in[N]={0},timer=1;
set<pair<lli,lli>> ans;
bool bridge=0;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli i,j,tt=1;
    //cin>>tt;
    while(tt--)
    {
        lli n;
        cin>>n;
        if(n>=30)
            cout<<"Yes\n";
        else
            cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 5976
using System;

namespace ABC128A
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Trim().Split();
            var A = int.Parse(input[0]);
            var B = int.Parse(input[1]);

            Console.WriteLine((A * 3 + B) / 2);
        }
    }
}

Measured memory_bytes: 11092
# https://atcoder.jp/contests/abc045/tasks/arc061_a
s = input()
if len(s) == 1:
    print(s)
    exit()
o = []
sum = 0
for i in range(1 << len(s) - 1):
    bit = format(i, "0" + str(len(s) - 1) + "b")
    o.append(bit.replace("1", "+").replace("0", " "))
for t in o:
    r = ""
    for s1, s2 in zip(s, t):
        r += (s1 + s2)
    r += s[-1]
    r = r.replace(" ", "")
    sum += eval(r)
print(sum)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o set

constexpr ll INF=1e18;
signed main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    int col[n][n];
    rep(i,n){
        rep(j,n){
            int k=i^j;
            k=k&(-k);
            col[i][j]=log2(k)+1;
        }
    }
    rep(i,n){
        rep(j,n){
            if(i<j) cout << col[i][j] << " ";
        }
        cout << endl;
    }
}


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

int a[100005];
bool flag[100005];
int main() {
    // freopen("boss.in", "r", stdin);
    // freopen("boss.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) {
        int x, y;
        cin >> x >> y;
        if (a[x] >= a[y]) flag[y] = true;
        if (a[x] <= a[y]) flag[x] = true;
    }
    int cnt = 0;
    for (int i = 1; i <= n; i++)
        if (!flag[i]) cnt++;
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 4128
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;




int main()
{
	vint a(3);
	cin >> a[0] >> a[1] >> a[2];

	sort(a.begin(), a.end(),greater<int>());
	cout << a[0] * 10 + a[1] + a[2] << endl;
	
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;


int main() {
	while (true) {
		int W,H;cin>>W>>H;
		if(H==0)break;
		string command;
		int dx[4] = { -1,0,1,0 };
		int dy[4] = { 0,1,0,-1 };
		int way=3;
		int nx(0);
		int ny(H-1);
		while (cin >> command) {
			if (command == "STOP") {
				cout << nx + 1 <<" "<< H - ny << endl;
				break;
			}
			else if (command == "RIGHT") {
				way=(way+3)%4;
			}
			else if (command == "LEFT") {
				way=(way+1)%4;
			}
			else if (command == "FORWARD") {
				int k;cin>>k;
				while (k--) {
					const int nextx=nx+dx[way];
					const int nexty=ny+dy[way];
					if (nextx >= 0 && nextx < W&&nexty >= 0 && nexty < H) {
						nx=nextx;
						ny=nexty;
					}
				}
			}
			else if (command == "BACKWARD") {
				int k; cin >> k;
				way=(way+2)%4;
				while (k--) {
					const int nextx = nx + dx[way];
					const int nexty = ny + dy[way];
					if (nextx >= 0 && nextx < W&&nexty >= 0 && nexty < H) {
						nx = nextx;
						ny = nexty;
					}
				}
				way = (way + 2) % 4;

			}
			else {
				assert(false);
			}
		}
	}
	return 0;
}

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

int main(){
    int N;
    cin >> N;

    int a;
    a = N % 10;
    if(a == 2 || a==4 || a==5|| a==7|| a==9)
    {
        cout << "hon";
    }else if(a == 0 || a==6 || a==1|| a==8)
    {
        cout << "pon";
    }else if(a == 3){
        cout << "bon";
    }

    
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    int N = scanner.nextInt();
    int M = scanner.nextInt();

    final long INF = -1_000_000_000_000_000L;
    long[] dist = new long[N];
    for (int i = 1; i < N; i++) dist[i] = INF;
    int[][] edges = new int[M][2];
    int[] costs = new int[M];

    for (int i = 0; i < M; i++) {
      edges[i] = new int[] {scanner.nextInt() - 1, scanner.nextInt() - 1};
      costs[i] = scanner.nextInt();
    }

    int[] prev = new int[N];
    prev[0] = -1;
    for (int i = 0; i < 2 * N; i++) {
      for (int j = 0; j < M; j++) {
        int from = edges[j][0];
        int to = edges[j][1];
        int cost = costs[j];
        if (dist[from] > INF) {
          long newValue = dist[from] + cost;
          if (newValue > dist[to]) {
            dist[to] = newValue;
            prev[to] = from;
          }
        }
      }
    }

    boolean[] visited = new boolean[N];
    int i = N - 1;
    while (i != -1) {
      if (visited[i]) {
        System.out.println("inf");
        return;
      }
      visited[i] = true;
      i = prev[i];
    }
    System.out.println(dist[N - 1]);
  }
}


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

int main(){
  int N,M,X;
  cin >> N >> M >> X;
  vector<int> data(M);
  for(int i=0; i<M; i++){
    cin >> data[i];
  }
  int sum1=0,sum2=0;
  for(int i=X; i>0; i--){
    for(int j=0; j<M; j++){
      if(data[j]==i){
        sum1++;
      }
    }
  }
  for(int i=X; i<N+1; i++){
    for(int j=0; j<M; j++){
      if(data[j]==i){
        sum2++;
      }
    }
  }
  cout << min(sum1,sum2) << endl;
  
}

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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;

// 関数 //
template<class T> lint gcd(T a, T b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

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

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
#define pi acos(-1)
#define mod 1000000007
#define MOD 998244353
#define inf ((1LL << 62) - 1 + (1LL << 62))

// キーワード //
#define elif else if

// End of Template //

vector<double> sum;
void summ(int n, double K, vector <double>& p) {
    rep(i, K) {
        sum[n] += p[n + i];
    }
}

void pExchange(vector<double>& p) {
    rep(i, (int)p.size()) {
        p[i] = (p[i] + 1) / 2;
    }
}

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N, K;
    cin >> N >> K;
    vector<double> p(N);
    rep(i, N) cin >> p[i];
    rep(i, N) p[i] = (p[i] + 1) / 2;
    vector<double> sum(N + 1);
    double q = 0;
    for (int i = 1; i <= N; i++) {
        q += p[i - 1];
        sum[i] = q;
    }
    q = 0;
    for (int i = K; i <= N; i++) {
        chmax(q, sum[i] - sum[i - K]);
    }
    cou(q);
}

Measured memory_bytes: 3456
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

// 何も得られなかった: t-(grape+cherry+seven+bar+star+seven*5+bar*3), -3
// Grape/Cherry/Seven/Bar: grape+cherry+seven+bar, それぞれによる
// Star: star, 0
// Bonus game: seven*5+bar*3, +13

int main(){
    int seven, bar, grape, cherry, star, t;
    while(std::cin >> seven >> bar >> grape >> cherry >> star >> t, seven||bar||grape||cherry||star||t){
        int res = 100 - (t-(seven+bar+grape+cherry+star+seven*5+bar*3)) * 3
            + grape * 4 - cherry + seven * 12 + bar * 12 + (seven*5+bar*3) * 13;
        std::cout << res << std::endl;
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <math.h>
#include <vector>
#include <stack>
#include <cstdio>
#include <string>
#include <bitset>
#include <list>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <functional>

using namespace std;
//debug

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

#define pb push_back

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;



#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()



int main() {
	ll d;
		double n, m;
	cin >> n >> m >> d;



	if(d==0)
		printf("%.8f\n", (n-d)*(m-1)/n/n);
	else
		printf("%.8f\n", 2 * (n - d)*(m - 1) / n/n );
	return 0;
}



Measured memory_bytes: 256