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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .

void solve ( int test_case )
{
    ld r ;
    cin >> r ;

    ld ans = 2 * pie * r ;
    pp ( ans ) ;
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i=1 ; i <= t ; i ++ ) solve ( i ) ;
    return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dr[8] = {-1,-1,-1, 0, 1, 1, 1, 0 };
const int dc[8] = {-1, 0, 1, 1, 1, 0,-1,-1 };

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int H, W; cin >> H >> W;
	char mines[H][W] = {0};
	rep (i, H) rep (j, W) cin >> mines[i][j];

	char res[H][W] = {0};
	rep (i, H){
		rep (j, W){
			if (mines[i][j] != '#'){
				int cnt = 0;
				rep (k, 8){
					int nr = i + dr[k];
					int nc = j + dc[k];
					if (nr < 0 || nr >= H || nc < 0 || nc >= W) continue;
					cnt += (int)(mines[nr][nc] == '#');
				} // end rep
				res[i][j] = (char)('0' + cnt);
			}else{
				res[i][j] = mines[i][j];
			} // end if
		} // end rep
	} // end rep

	rep (i, H){
		rep (j, W){
			cout << res[i][j];
		} // end rep
		cout << endl;
	} // end rep	

	return 0;
}

Measured memory_bytes: 256
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

void hora(int tc) {
	string s;
	cin>>s;
	int n = s.size();
	int paper = n / 2;
	int rock = n - paper;
	int tot = 0;
	for(int i = n - 1;i >= 0;i--) {
		if(s[i] == 'g' && paper != 0 && paper <= rock) {
			tot++;
			paper--;
		} else if(s[i] == 'g') {
			rock--;
		} else if(s[i] == 'p' && paper != 0) {
			paper--;
		} else {
			rock--;
			tot--;
		}
	}
	cout<<tot<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Measured memory_bytes: 512
#include <stdio.h>
#define LEN 52

int
main(void)
{
    int map[26] = { ['S' - 'A'] = 0, ['H' - 'A'] = 1, ['C' - 'A'] = 2, ['D' - 'A'] = 3 };
    int map2[4] = { 'S', 'H', 'C', 'D' };
    int card[LEN] = {};
    int i, n, num;
    char ch;
    scanf("%d", &n);
    while (getchar() != '\n')
        continue;
    i = n;
    while (i--) {
        scanf("%c %d", &ch, &num);
        card[map[ch - 'A'] * 13 + num - 1] = 1;
        while ((ch = getchar()) != '\n' && ch != EOF)
            continue;
    }
    for (i = 0; i < LEN; i++)
        if (!card[i])
            printf("%c %d\n", map2[i / 13], i % 13 + 1 );
    return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

#define KIT 4

int main() {
	int n, m, i, j;
	int ad, su;
	int max;

	cin >> n;	// 調査時間
	cin >> m;	// 開始時トンネル内台数

	max = m;
	for (i = 0; i < n; i++) {
		cin >> ad >> su;
		m += (ad - su);
		if (m < 0) {
			max = 0;
			break;
		}
		if (max < m) {
			max = m;
		}
	}
	cout << max << endl;
	return 0;
}



Measured memory_bytes: 3116
from sys import stdin
input = stdin.readline

N,M = map(int,(input().split()))

ans = "IMPOSSIBLE"

seta,setb = set(),set()

for m in range(M):
    a,b = map(int,(input().split()))
    if a == 1:
        seta.add(b)
    if b == N:
        setb.add(a)
        
if seta & setb:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


Measured memory_bytes: 18936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M;
    ll A[100010];
    cin >> N >> M;
    rep(i,0,N) cin >> A[i];
    ll B[100010], C[100010];
    rep(i,0,M){
        cin >> B[i] >> C[i];
    }
    sort(A, A+N);
    vector<lpair> lp;
    rep(i,0,M){
        lp.push_back(make_pair(C[i], B[i]));
    }
    sort(lp.begin(), lp.end(), greater<lpair>());
    ll pos = 0;
    rep(i,0,M){
        ll b = lp[i].second;
        ll c = lp[i].first;
        ll cnt = 0;
        while(cnt < b){
            if(pos >= N) break;
            if(A[pos] < c){
                A[pos] = c;
                pos++;
            }else{
                break;
            }
            cnt++;
        }
    }
    ll ans = 0;
    rep(i,0,N) ans += A[i];
    print(ans);


    
}

Measured memory_bytes: 4852
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Mon Aug  6 23:20:43 2018
//
package main

import "fmt"

const MOD int = 1e9 + 7

var S string

func main() {
	fmt.Scan(&S)

	dp := make([][]int, len(S)+1)
	for i := range dp {
		dp[i] = make([]int, 4)
	}

	dp[len(S)][0] = 0
	dp[len(S)][1] = 0
	dp[len(S)][2] = 0
	dp[len(S)][3] = 1

	for i := len(S) - 1; i >= 0; i-- {
		dp[i][3] = dp[i+1][3]
		dp[i][2] = dp[i+1][2]
		dp[i][1] = dp[i+1][1]
		dp[i][0] = dp[i+1][0]

		if S[i] == '?' {
			dp[i][3] = 3 * dp[i+1][3]
			dp[i][2] = 3*dp[i+1][2] + dp[i+1][3]
			dp[i][1] = 3*dp[i+1][1] + dp[i+1][2]
			dp[i][0] = 3*dp[i+1][0] + dp[i+1][1]
		} else if S[i] == 'A' {
			dp[i][0] = dp[i+1][0] + dp[i+1][1]
		} else if S[i] == 'B' {
			dp[i][1] = dp[i+1][1] + dp[i+1][2]
		} else if S[i] == 'C' {
			dp[i][2] = dp[i+1][2] + dp[i+1][3]
		}

		for j := range dp[i] {
			dp[i][j] %= MOD
		}
	}

	fmt.Println(dp[0][0])
}


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

int main(){
	int c[3][3], a[3], b[3], i, j, f;
	for(i = 0; i < 3; i++){
		for(j = 0; j < 3; j++){
			scanf("%d", &c[i][j]);
		}
	}
	for(a[0] = 0; a[0] <= 100; a[0]++){
		for(a[1] = 0; a[1] <= 100; a[1]++){
			for(a[2] = 0; a[2] <= 100; a[2]++){
				b[0] = c[0][0] - a[0];
				b[1] = c[1][1] - a[1];
				b[2] = c[2][2] - a[2];
				f = 1;
				for(i = 0; i < 3; i++){
					for(j = 0; j < 3; j++){
						if(c[i][j] != a[i] + b[j]){
							f = 0;
							break;
						}
					}
				}
				if(f == 1){
					printf("Yes\n");
					return 0;
				}
			}
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
from itertools import combinations
from itertools import product
import bisect
import math

N, K = [int(_) for _ in input().split()]
S = input()

if K == N:
    s = S[:K-1] + S[K-1].lower()
else:
    s = S[:K-1] + S[K-1].lower() + S[K:]

print(s)

Measured memory_bytes: 3188
import java.io.*;
import java.text.*;
import java.util.*;

public class Main {

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        solver s = new solver();
        int t = 1;
        while (t > 0) {
            s.solve();
            t--;
        }
        out.close();
    }

    static class InputReader {

        public BufferedReader br;
        public StringTokenizer token;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            token = null;
        }

        public String sn() {
            while (token == null || !token.hasMoreTokens()) {
                try {
                    token = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return token.nextToken();
        }

        public int ni() {
            return Integer.parseInt(sn());
        }

        public String snl() throws IOException {
            return br.readLine();
        }

        public long nlo() {
            return Long.parseLong(sn());
        }

        public double nd() {
            return Double.parseDouble(sn());
        }

        public int[] na(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.ni();
            return a;
        }

        public long[] nal(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = sc.nlo();
            return a;
        }
    }

    static int inf = 5000013;

    static class solver {
        DecimalFormat df = new DecimalFormat("0.00000000");
        int maxi = 200000000;

        void solve() {
            int n=sc.ni();
            long dp[]=new long[n];
            int a[]=new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]=sc.ni();
                dp[i]=Integer.MAX_VALUE;
            }
            dp[0]=0;
            dp[1]=Math.abs(a[1]-a[0]);
            for(int i=2;i<n;i++)
            {
                dp[i]=Math.min(dp[i-1]+Math.abs(a[i]-a[i-1]),dp[i-2]+Math.abs(a[i]-a[i-2]));
            }
            out.println(dp[n-1]);
        }
    }
}


Measured memory_bytes: 32064
n = int(input())
s = input()
res = 0
tem = s.find('WR')
if tem == -1:
    print(res)
else:
    i, j = 0, len(s)-1
    while i<j:
        while i < j and s[i] != 'W': i+=1
        while i < j and s[j] != 'R':j -= 1
        if s[i] == 'W' and s[j] == 'R':
            res += 1
            i += 1
            j -= 1
    print(res)



Measured memory_bytes: 9280
n = int(input())
dic = {}
for i in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
#print(dic)
dic = sorted(dic.items(), key = lambda x: x[1])
#print(dic)
dic.reverse()
#print(dic)
ans = []
mx = dic[0][1]
for i in range(len(dic)):
    if dic[i][1] == mx:
        ans.append(dic[i][0])
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 43228
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(_i,_a,_n) for(int _i=_a;_i<=_n;++_i)
#define PER(_i,_a,_n) for(int _i=_n;_i>=_a;--_i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(_a) ({REP(_i,1,n) cout<<_a[_i]<<',';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



#ifdef __APPLE__
const int N = 1e2+50;
#else
const int N = 1e6+50;
#endif


int n,m,vis[N][2];
vector<int> g[N];
char s[N];

int dfs(int x, int c) {
	if (~vis[x][c]) return vis[x][c];
	vis[x][c] = 0;
	for (int y:g[x]) if (s[y]==c) {
		vis[x][c] = 1;
		if (dfs(y,s[x]^1)) return 1;
		vis[x][c] = 0;
	}
	return 0;
}

int main() {
	scanf("%d%d%s",&n,&m,s+1);
	REP(i,1,n) s[i]-='A';
	REP(i,1,m) {
		int u, v;
		scanf("%d%d",&u,&v);
		g[u].pb(v),g[v].pb(u);
	}
	memset(vis,-1,sizeof vis);
	REP(i,1,n) if (dfs(i,0)&&dfs(i,1)) { 
		return puts("Yes"),0;
	}
	puts("No");
}








Measured memory_bytes: 41728
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n;
    cin>>n;
    vector<int> a(n);
    int sum = 0;
    vector<int> cnt(maxn,0);
    rep(i,0,a.size()){
        cin>>a[i];
        cnt[a[i]]++;
        sum += a[i];
    }
    int q;
    cin>>q;
    while(q--){
        int x,y;
        cin>>x>>y;
        int v1 = cnt[x]*x;
        int v = y*cnt[x] - v1;
        cnt[y] += cnt[x];
        cnt[x] = 0;
        sum += v;
        cout<<sum<<endl;
    }
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 4728
n = int(input().rstrip())
pre_map = input().rstrip().split(" ")
pre_map = map(int, pre_map)
in_list = input().rstrip().split(" ")
in_list = list(map(int, in_list))

result = []

def reconst(left, right):
    if left >= right:
        return 0
    c_of_pre = next(pre_map)
    c_of_in = in_list.index(c_of_pre)
    reconst(left, c_of_in)
    reconst(c_of_in+1, right)
    result.append(str(c_of_pre))
    
reconst(0, n)
print(" ".join(result))


Measured memory_bytes: 5596
#include<iostream>
#include<math.h>
using namespace std;

double abs(double x){
	if(x<0)return -1*x;
	return x;
}

int main(){
	int d,e;
	while(cin>>d>>e && d!=0 && e!=0){
		double ans=1e5;
		for(int x=0;x<d;x++)ans=min(ans,abs(sqrt(x*x+(d-x)*(d-x))-e));
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3276
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
#        for line in sys.stdin:
#            lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = [int(e) for e in lines[0].split(" ")]

    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):


    b = [(i+1, e) for i, e in enumerate(a)]

    b.sort(key=lambda e: e[1])

    c = [e[0] for e in b]

    return c


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, end=' ')
    else:
        print("%s" % result)

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 19428
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;
	int a=0;
	cin>>s;
	for(int i=0;i<s.length()-1;i++)
	{
		if(s[i]!=s[i+1])
		{
			a++;
		}
	}
	cout<<a<<endl;
    return 0;
}

Measured memory_bytes: 512
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var X int;
    X = nextInt();
    var A int;
    A = nextInt();
	solve(X, A);

}

func solve(X int, A int){
	if A>X {
		Println(0)
	}else{
		Println(10)
	}
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



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

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

    string out;

    for(int i = 0; i < s.size(); ++i) {
        if(s.at(i) == '0') {
            out.push_back('0');
        } else if(s.at(i) == '1') {
            out.push_back('1');
        } else if(s.at(i) == 'B' && out.size() != 0) {
            out.pop_back();
        }
    }

    cout << out;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<string.h>
using namespace std;
char a[5][5];
int main()
{
    int flag=0;
    while(~scanf("%s %s",a[1],a[2]))
    {
        for(int i=0; i<3; i++)
        {
            if(a[1][i]==a[2][2-i])
                flag=1;
            else
            {
                flag=0;
                break;
            }
        }
        if(flag==1)
            printf("YES\n");
        else
        {
            printf("NO\n");
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int n;
	while(scanf("%d",&n)!=EOF){
		int a,b,c,d,i=0;
		for(a=0;a<=9;a++){
			for(b=0;b<=9;b++){
				for(c=0;c<=9;c++){
					for(d=0;d<=9;d++){
						if(a+b+c+d==n){
							i++;
						}
					}
				}
			}
		}
	    printf("%d\n",i);
	}
	return 0;
}


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

typedef long long ll;
const int maxn = 200010;
int n;
ll a[maxn];

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]), a[i] += a[i - 1];
    }
    long long mn = 1e18;
    for (int i = 1; i < n; i++) {
        mn = min(mn, abs(a[i] - (a[n] - a[i])));
    }
    printf("%lld\n", mn);
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(){
    int S,h,m,s;
    scanf("%d",&S);
    h = S / 3600;
    S = S - h * 3600;
    m = S / 60;
    s = S - m *60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

Measured memory_bytes: 592
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int s = scan.nextInt();
		int w = scan.nextInt();
		scan.close();

		String message = w >= s ? "unsafe" : "safe";
		System.out.println(message);
	}

}

Measured memory_bytes: 35884
N , K = (int(x) for x in input().split()) 
if K % 2 != 0:
    ans = (N // K) ** 3
else:
    k = K / 2
    x = N // k
    if x % 2 == 0:
        ans = 2 * (x / 2) ** 3
    else:
        ans = ((x // 2) + 1) ** 3 + (x // 2) ** 3
    
print(int(ans))
                    


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

using namespace std;

int main()
{
    long long n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    long long mod=1000000007;
    long long res=0;
    for(int o=0;o<n;o++)
    {
        for(int i=o+1;i<n;i++)
        {
            if(a[o]>a[i]) res=(res+k)%mod;
        }
    }
    for(int o=0;o<n;o++)
    {
        long long cnt=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]<a[o]) cnt++;
        }
        long long t=(k*(k-1)/2)%mod;
        res=(res+cnt*t)%mod;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a;
  int b;
  char op;

  for(;;){
    scanf("%d %c %d", &a, &op, &b);
    if(op == '+'){
      printf("%d\n", a + b);
    }
    else if(op == '-'){
      printf("%d\n", a - b);
    }
    else if(op == '*'){
      printf("%d\n", a * b);
    }
    else if(op == '/'){
      printf("%d\n", a / b);
    }
    else {
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 2136
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w;
		int n;
		int a,b;
		short tmp;
		
		w = sc.nextInt();
		n = sc.nextInt();
		
		int[] data = new int[w];
		
		for(int i=0;i<w;i++){
			data[i] = i+1;
		}
		for(int i=0;i<n;i++){
			String[] str = sc.next().split(",");
			data = swap(data,Integer.parseInt(str[0]),Integer.parseInt(str[1]));
		}
		sc.close();
		for(int i=0;i<w;i++){
			System.out.println(data[i]);
		}
	}
	
	static int[] swap(int[] dat,int a,int b){
		int temp;
		
		--a;
		--b;
		
		temp = dat[a];
		dat[a] = dat[b];
		dat[b] = temp;
		
		return dat;
	}
}

Measured memory_bytes: 17200
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;


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

    long H[N];
    for(int i = 0; i < N ; i++) cin >> H[i];

    //配列を右からループ、前の値よりも小さかったらカウントアップ。
    //小さくなるか、最後の時点になったらこれまでのMAXカウントと比較
    int maxMove = 0;
    int moveCount = 0;
    for (int i = 1; i < N ; i++){
        if(H[i-1] >= H[i] ) moveCount++;
        if(H[i-1] < H[i] || i == N-1 ){
            maxMove = max(maxMove, moveCount);
            moveCount=0;
        }
    }

    cout << maxMove << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int a,b,c;
        int ans = 0;
        int x = 0;//比較用
        for(int i = 0;i < n; i++){
            scanf("%d%d%d",&a,&b,&c);
            if(x < b+c){
                x = b+c;
                ans = a;
            }
        }
        printf("%d %d\n",ans,x);
    }
    return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;
typedef unsigned long long BITMASK; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<double, double> pdd; typedef pair<long long, long long> pll;
#define has_bit(bit_mask, x) ((bit_mask) & (1ULL << (x)))
#define turn_on_bit(bit_mask, x) (bit_mask |= (1ULL << (x)))
#define turn_off_bit(bit_mask, x) (bit_mask &= (~(1ULL << (x))))
#define smallest_on_bit(bit_mask) (__builtin_ctzint((bit_mask) & (-(bit_mask))))
#define CLOCK_START clock_t chrono_clk_beg = clock()
#define CLOCK_END clock_t chrono_clk_end = clock(); cerr << (double(chrono_clk_end - chrono_clk_beg) / CLOCKS_PER_SEC) << " sec"
#define bug(args ...) cerr << __LINE__ << ">> ", err(new istringstream(string(#args)), args), cerr << '\n'
#define decToBin(name, num) string name = bitset<8>(num).to_string();
#define binToDec(name, binary) unsigned long name = bitset<8>(binary).to_ulong();
#define radToDeg(name, radians) double name = radians * 180 / M_PI;
#define all(x) x.begin(), x.end()
#define removeDuplicates(vec) sort(vec.begin(), vec.end()); vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define printMat(mat) for (auto &x : mat) { for (auto &y : x) { if (y < INF) cout << setw(7) << y; else cout << setw(7) << "-"; } cout << '\n'; }
#define fillMat(mat, n, m, x) for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) mat[i][j] = x;
#define printArr(arr) for (auto &x : arr) cout << x << " "; cout << '\n';
#define arrReplace(arr, from, to) for (auto &x : arr) if (x == from) x = to;
#define INF (1LL<<30)
#define INF32 (1LL<<62)
#define F first
#define S second
#define M_PI 3.14159265358979323846
#define MOD 1000000007
ll powMod(ll a, ll b) { ll x = 1; while (b > 0) { if (b&1) x = (x*a) % MOD; a = (a*a) % MOD; b >>= 1; } return x; }
ll multiply(ll x, ll y) { return ((x % MOD) * (y % MOD)) % MOD; }
ll divide(ll x, ll y) { return ((x % MOD) * powMod(y % MOD, MOD-2)) % MOD; }
inline int ceil(int a, int b) { return (a+b-1)/b; }
void err(istringstream *iss) {} template<typename T, typename ... Args> void err(istringstream *iss, const T &_val, const Args & ... args) { string _name; *iss >> _name; if (_name.back()==',') _name.pop_back(); cerr << _name << " = " << _val << "; ", err(iss, args ...); }
int str_replace(string& str, const string& from, const string& to, int limit = -1) { if(from.empty()) return 0; size_t start_pos = 0; int cnt = 0; while((start_pos = str.find(from, start_pos)) != std::string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); cnt++; if (cnt == limit) break; } return cnt; }
#define int ll

signed main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int x, y, z; cin >> x >> y >> z;
	swap(x, y);
	swap(x, z);
	cout << x << " " << y << " " << z << '\n';
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <stdio.h>

int main()
{
  	int N;
  	std::cin >> N;
 
  	N = N % 10;
  	if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9)
      printf("hon");
  	else if (N == 0 || N == 1 || N == 6 || N == 8)
      printf("pon");
  	else if (N == 3)
      printf("bon");
}

Measured memory_bytes: 3244
// E - Bomber
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
using PR = pair<int,int>;

int main(){
	int H,W,M; cin>>H>>W>>M;
	set<PR> HW;
	rp(i,0,M){
		int h,w; cin>>h>>w; h--,w--;
		HW.insert({h,w});
	}

	// for(auto s:HW){
	// 	cout<<s.first<<" "<<s.second<<"\n";
	// }

	vi sum_h(H, 0), sum_w(W, 0);
	for(auto hw:HW){
		sum_h[hw.first]++;
		sum_w[hw.second]++;
	}

	int max_h_num = 0;
	map<int,set<int>> h_num_ix;
	rp(i,0,H){
		int num = sum_h[i];
		if(num == 0) continue;
		h_num_ix[num].insert(i);
		max_h_num = max(max_h_num, num);
	}

	// for(auto x:h_num_ix){
	// 	cout<<x.first<<": ";
	// 	for(auto y:x.second){
	// 		cout<<y<<" ";
	// 	}
	// 	puts("");
	// }

	int max_w_num = 0;
	map<int,set<int>> w_num_ix;
	rp(i,0,W){
		int num = sum_w[i];
		if(num == 0) continue;
		w_num_ix[num].insert(i);
		max_w_num = max(max_w_num, num);
	}

	int max_num = max_h_num + max_w_num - 1;
	for(auto h_ix:h_num_ix[max_h_num]){
		for(auto w_ix:w_num_ix[max_w_num]){
			if(HW.find({h_ix, w_ix}) != HW.end()) continue;
			cout<< max_num + 1 <<endl;
			return 0;
		}
	}
	cout<< max_num <<endl;
}


Measured memory_bytes: 47852
#include                        <bits/stdc++.h>
#include                        <ext/pb_ds/assoc_container.hpp>
#define lb                      lower_bound
#define ub                      upper_bound
#define fe(x)                   (*(x.begin()))
#define le(x)                   (*(x.rbegin()))
#define pb                      push_back
#define load(node,n)            bool operator < (const node &n) const
#define fbo(x,id)               (*(x.find_by_order(id)))
#define ook(y)                  order_of_key(y)
#define all(x)                  (x).begin(),(x).end()
#define FOR(i,n)                for(int i = 1; i<=n; i++)
#define REP(i,n)                for(int i = 0; i<n;  i++)
#define TT                      long long TC;  scanf("%lld",&TC);  while(TC--)
#define read                    freopen("input.txt","r",stdin)
#define write                   freopen("output.txt","w",stdout)
#define set(x)                  tree<x,null_type,less<x>,rb_tree_tag,tree_order_statistics_node_update>
using                           namespace __gnu_pbds;
using                           namespace std;
typedef                         long long ll;
typedef                         pair<ll,ll> pll;
typedef                         pair<int,int> pii;





main(){
//read;

string s;
cin>>s;
if(le(s)=='s')  s+="es";
else s+="s";
cout<<s;


return 0;
}



Measured memory_bytes: 3624
import math

N, K = map(int, input().split())
ans = 0
n = N
if N >= K:
    n = K - 1
    ans += (N-K+1)/N
for i in range(1, n+1):
    ind = math.ceil(math.log2(K/i))
    ans += (1/N)*(1/2)**ind

print(ans)


Measured memory_bytes: 3060
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    # divisors.sort()
    return divisors


def main():
    N = int(input())

    divs = make_divisors(N)
    divs2 = make_divisors(N - 1)

    ans = set(divs2)
    for k in divs:
        tmpN = N
        if k == 1:
            continue
        while tmpN % k == 0:
            tmpN /= k

        if tmpN % k == 1:
            ans.add(k)

    print(len(ans) - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

struct edge{
  ll to, cost;
};

int MAX_V = 1000010;
vector<vector<edge>> G(MAX_V);
vector<ll> d(MAX_V, inf);


void dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>>que;
	d[s] = 0;
	que.push(P(0, s));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		rep(i, G[v].size()) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int h, w, ch, cw, dh, dw;
vector<string> s(1010);
void make_graph(int x, int y){
    rep(i, 5)rep(j, 5){
        if(i == 2 && j == 2)continue;
        int nx = x + i - 2, ny = y + j - 2;
            if(nx < 0 || nx >= h || ny < 0 || ny >= w)continue;
        if(abs(i-2) + abs(j-2) <= 1 ){
            if(s[nx][ny] != '#')G[x*h+y].push_back({nx*h+ny, 0});
        }else{
            if(s[nx][ny] != '#')G[x*h+y].push_back({nx*h+ny, 1});
        }
    }
}

int main(){
    cin >> h >> w >> ch >> cw >> dh >> dw;
    ch--; cw--; dh--; dw--;
    rep(i, h)cin >> s[i];
    rep(i, h)rep(j, w)make_graph(i, j);
    dijkstra(ch*h + cw);
    cout << (d[dh*h+dw] == inf ? -1 : d[dh*h+dw]) << endl;
}   

Measured memory_bytes: 300240
n = int(input())
a = list(map(int,input().split()))

def gcd(a,b):
    if a<b:
        a,b = b,a
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return (a*b)//gcd(a,b)

ans = a[0]
for i in range(n-1):
    ans = lcm(ans,a[i+1])
ans-=1
ans2 = 0
for i in range(n):
    ans2 += ans%a[i]
    #print(ans2)
print(ans2)

Measured memory_bytes: 3316
use std::cmp;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let m: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let mut start = vec![vec![]; m + 1];
    let mut end = vec![vec![]; m + 1];

    let mut carry = 0;
    let mut sum = 0;
    for i in 1..n {
        let from = a[i - 1];
        let to = a[i];

        start[from].push(to);
        end[to].push(from);

        if from > to {
            carry += 1;
            sum += to;
        } else {
            sum += to - from;
        }
    }

    let mut ans = sum;
    for pos in 1..(m + 1) {
        if pos > 1 {
            sum -= carry;
        }

        ans = cmp::min(ans, sum);
        carry += start[pos - 1].len();
        carry -= end[pos].len();
        for &from in end[pos].iter() {
            if pos > from {
                sum += pos - from - 1;
            } else {
                sum += m - from + pos - 1;
            }
        }
    }

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

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 16764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int n;
  cin >> n;
  vi b(n);
  rep(i, n-1) {
    cin >> b[i];
  }

  b[n-1] = 1e9;



  vi ans(n);
  ans[0] = b[0];

  rep(i, n-1) {
    ans[i+1] = min(b[i], b[i+1]);
  }

  ll sum = 0;
  rep(i, n) {
    sum += ans[i];
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int a[1005];
int main()
{
   int n,i,j;

   int s1=0,sum=0,s2=0;
   int ans=1000000;
   scanf("%d",&n);
    for(i=1;i<=n;i++){scanf("%d",&a[i]);sum+=a[i];}
   for(i=1;i<=n;i++)
   {
       s1+=a[i];
       s2=sum-s1;

       if(ans>abs(s1-s2))ans=abs(s1-s2);
   }
   printf("%d\n",ans);
    return 0;
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

vector<vector<int>> v(111111);
int zisuu[111111];
bool used[111111];

int main(){
	
	int n;cin >> n;
	REP(i,n-1){
		int a,b;cin >> a >> b;
		a--;b--;
		v[a].PB(b);
		v[b].PB(a);
		zisuu[a]++;
		zisuu[b]++;
	}
	
	queue<int> que;
	REP(i,n){
		if(zisuu[i] == 1)que.push(i);
	}
	
	while(!que.empty()){
		int now = que.front();que.pop();
		//cout << now << " " << used[now] << endl;
		bool flag = !used[now];
		bool madePair = used[now];
		used[now] = true;
		REP(i,v[now].size()){
			zisuu[v[now][i]]--;
			if(flag && !used[v[now][i]]){
				used[v[now][i]] = true;
				madePair = true;
			}
			if(zisuu[v[now][i]] == 1){
				//cout << "   " << v[now][i] << " " << used[v[now][i]] << endl;
				que.push(v[now][i]);
			}
		}
		if(!madePair){
			cout << "First" << endl;
			return 0;
		}
	}
	
	cout << "Second" << endl;
	
	return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;

int main(){
    int N; cin>>N;
    int array[N];
    int count=0;
    for(int i=0;i<N;i++){
        cin>>array[i];
    }
    for(int i=0;i<N;i++){
        if(array[i]==i+1){
            if(i!=N-1)array[i+1]=i+1;
            count++;
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 640
def main():
    N = int(input())

    lst = erastosthenes(55555)
    prime_lst = [2] + [i for i in range(3, 55556, 2) if lst[i]]

    ans = []
    for i in prime_lst:
        mod = i % 10
        if mod == 1:
            ans.append(i)
    print(*ans[:N], sep=' ')


def erastosthenes(n):
    prime = [0, 1] * ((n + 1) // 2)
    if not n % 2:
        prime += [0]
    prime[1], prime[2] = 0, 1

    sqrt = n ** 0.5
    i = 3
    while i <= sqrt:
        for j in range(i ** 2, n + 1, i):
            prime[j] = 0
        i += 2
    return prime

main()


Measured memory_bytes: 3700
def solve():
    from math import atan2, pi, hypot
    n = int(input())
    txy = []
    sx, sy = 0, 0
    for i in range(n):
        a, b = map(int, input().split())
        theta_0 = atan2(b, a)
        sx += a
        sy += b
        txy.append((theta_0, a, b))
    txy.sort()
    ans = hypot(sx, sy)
    for i in range(n):
        for j in range(i + 1, n):
            tx, ty = 0, 0
            for k in range(i, j):
                theta, x, y = txy[k]
                tx += x
                ty += y
                ans = max(ans, hypot(tx, ty))
                ans = max(ans, hypot(sx - tx, sy - ty))
    print(ans)

solve()


Measured memory_bytes: 9536
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define rep1(i,a,b)    for(ll i=a; i<=b; i++)
#define repVect(i,n)    for(ll i=0; i<sum.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n'
#define no cout<<"No"<<'\n'
using namespace std;

int main()
{
    godspeed
    ll  i,j,k,l,h,w,n,ans=0;
    cin>>h>>w>>n;
    ans=n/max(h,w);
    if(n%max(h,w)) ans++;
    cout<<ans<<endl;
    return 0;
}





Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

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

int main() {
    int n;
    int ans = 0;
    cin >> n;
    //queue<pair<int, int>> cd;
    vector<bool> isPaired(n, false);
    vector<int> a(n), b(n), c(n), d(n), pairCountR(n), pairCountB(n);
    vector<pair<int, int>> ab(n), cd(n);
    rep(i, n) {
        cin >> a[i] >> b[i];
        ab[i] = make_pair(a[i], b[i]);
    }
    sort(ab.begin(), ab.end());
    rep(i, n) {
        cin >> c[i] >> d[i];
        cd[i] = make_pair(c[i],d[i]);
    }
    sort(cd.begin(), cd.end());
    rep(i, n) {
        int index = -1;
        int dist = -5;
        rep(j, n) {
            if(ab[j].first < cd[i].first and ab[j].second < cd[i].second and !isPaired[j]) {
                if(dist < ab[j].second) {
                    index = j;
                    dist = ab[j].second;
                }
            }
        }

        if(index != -1) {
            isPaired[index] = true;
            ans += 1;
        }
    }

    cout << ans << endl;


}


Measured memory_bytes: 256
n,k=map(int,input().split())
d={}
for i in range(n):
	a,b=map(int,input().split())
	if a in d:d[a]+=b
	else:d[a]=b
cnt=0
d=sorted(tuple(d.items()),key=lambda a:a[0])
for i in d:
	if cnt+i[1]>=k:
		print(i[0]);quit()
	cnt+=i[1]

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

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

	bool can = false;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			int x = (N - i) * j + (M - j) * i;

			if (x == K) {
				can = true;
			}
		}
	}

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

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,A[1000010],Q[1000010],head=1,tail,ans,BIT[1000010],dp[1000010],num[1000010],m;
void Add(int i,int x){
	while(i>=1)BIT[i]=max(BIT[i],x),i-=i&-i;
}
int Query(int i){
	int res=0;
	while(i<=m)res=max(res,BIT[i]),i+=i&-i;
	return res;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]),num[i]=A[i];
	sort(num+1,num+1+n);
	m=unique(num+1,num+1+n)-num-1;
	for(int i=1;i<=n;i++)A[i]=lower_bound(num+1,num+1+m,A[i])-num;
	for(int i=1;i<=n;i++){
		int res=Query(A[i]);
		dp[i]=res+1;
		ans=max(ans,dp[i]);
		Add(A[i],dp[i]);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 12928
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll mod =1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);++i)

template<class T> T maxt(T x,T y) {if (x>y) return x;else return y;}
template<class T> T mint(T x,T y) {if (x>y) return y;else return x;}
//sort(v.begin(), v.end(), [](auto& x, auto& y){return x[1] < y[1];});


//小数出力
// double print_double(double d){printf("%.6f", d);}

//約数列挙
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}



// ll combination_mod(int n, int k) {
//   k = mint(k,n-k);
//   ll ans = 1;
//   if (n==0 || k ==0) return ans;
//   rep(i,k) {
//     ans = ans*(n-i)%mod;
//     ans = ans*modinv(i+1)%mod;
//   }
//   return ans;
// }

struct edge {
  int from; //出発点
  int to;   //到達点
  ll cost; //移動コスト
};

//ベルマンフォード法
vector<ll> bellman_ford (vector<edge> edges, int V, int E, int r, ll INF = 100000000000) {  
  vector<ll> cost_to(V,INF);
  cost_to[r] = 0;
  rep(i,V) {
    rep(j,E) {
      edge e = edges[j];
      if (cost_to[e.from]==INF) continue;
      if (cost_to[e.to] > cost_to[e.from] + e.cost) {
        cost_to[e.to] = cost_to[e.from] + e.cost;
        if (i==V-1) {
          printf("NEGATIVE CYCLE\n");
          return {};
        }
      }

    }
  }
  return cost_to;
}

// combination
const int MAX = 510000;
const int MOD = 1000000007;
 
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;
}


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


// 木上の探索
vector<int> cnt;
void dfs(const vector<vector<int>> &G, int v, int p) {
    for (auto nv : G[v]) {
        if (nv == p) continue; // nv が親 p だったらダメ
        dfs(G, nv, v);
    }

    // 帰りがけ時に、部分木サイズを求める
    cnt[v] = 1; // 自分自身
    for (auto c : G[v]) {
        if (c == p) continue;
        cnt[v] += cnt[c]; // 子のサイズを加える
    }
}

int main() {
  int N;
  cin >> N;
  vector<ll> A(N+1,0);
  rep2(i,1,1+N) {
    cin >> A[i];
    A[i]+=A[i-1];
    }
  vector<vector<ll>> dp(N+1,vector<ll> (N+2,0));

  rep2(i,2,N+1) {
    rep2(j,1,N+2-i) {
      dp[j][j+i] = LONG_LONG_MAX;
      rep2(k,j+1,j+i) {
        chmin(dp[j][j+i], dp[j][k] + dp[k][j+i] + A[j+i-1] - A[j-1]);
      }
    }
  }
  cout << dp[1][N+1] << endl;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int N, M;
// dp[i][j][k] := i番目までみて, 位置がjで
// k = 0のとき今までの左端の最小値が0になってない
ll dp[3100][3100][2];

int main(void) {
	cin >> N >> M;
	
	rep(i, 3100)rep(j, 3100)rep(k, 2) dp[i][j][k] = 0ll;
	reps(i, 1, N + 1) dp[0][i][0] = 1ll;
	dp[0][0][1] = 1ll;

	rep(i, M)rep(j, N + 1)rep(k, 2) {
		if(dp[i][j][k] == 0) continue;
		if(j) (dp[i + 1][j - 1][k | (j == 1) ? 1 : 0] += dp[i][j][k]) %= MOD;
		if(j) (dp[i + 1][j][k | (j == 1) ? 1 : 0] += dp[i][j][k]) %= MOD;
		if(N - j) (dp[i + 1][j][k] += dp[i][j][k]) %= MOD;
		if(N - j) (dp[i + 1][j + 1][k] += dp[i][j][k]) %= MOD;
	}

	ll ans = 0;
	rep(j, N + 1) (ans += dp[M][j][1]) %= MOD;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 150400