akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int[] Num = SpRead(' ').Select(a => int.Parse(a)).ToArray();
        Console.WriteLine((Num[0] + Num[1] < Num[2] ?"No":"Yes"));
    }

}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 13268
def min_max_sum(a):
    return min(a), max(a), sum(a)


if __name__ == '__main__':
    n = int(input())
    input_list = list(map(int, input().split()))
    ans1, ans2, ans3 = min_max_sum(input_list)
    print(ans1, ans2, ans3)


Measured memory_bytes: 6608
A, B, C, D, E = [input() for _ in range(5)]
L = [A, B, C, D, E]
ans = 0
tmp = []
for l in L:
  if l[-1] != "0":
    tmp.append(l)
  else:
    ans += int(l)
if tmp:
  tmp.sort(key = lambda x: x[-1] if x[-1] != "0" else "")
  ans += int(tmp[0])
  for t in tmp[1:]:
    ans += (int(t)//10+1)*10
print(ans)

Measured memory_bytes: 3064
from itertools import permutations
ans = 6000
for a, b, c in permutations(input() for _ in range(3)):
    ab, bc, ac = [], [], []
    for s, t, st in [(a, b, ab), (b, c, bc), (a, c, ac)]:
        for i in range(len(s) + 1):
            for si, ti in zip(s[i:], t):
                if si != '?' and ti != '?' and si != ti:
                    st.append(False)
                    break
            else:
                st.append(True)
    for i in range(len(a) + 1):
        for j in range(max(len(b), len(a) - i) + 1):
            if ab[i] and (j > len(b) or bc[j]) and (i+j > len(a) or ac[i+j]):
                ans = min(ans, max(len(a), i+len(b), i+j+len(c)))
print(ans)

Measured memory_bytes: 76892
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	for(int i = 0; i < B; i++) {
		for(int j = 0; j < A; j++) cout << '1';
		for(int j = A; j < W; j++) cout << '0';
		cout << '\n';
	}
	for(int i = 0; i < H-B; i++) {
		for(int j = 0; j < A; j++) cout << '0';
		for(int j = A; j < W; j++) cout << '1';
		cout << '\n';
	}
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 1280
A, B, C, D = [ int(x) for x in input().split() ]

if A <= C:
    if B <= D:
        ans = max(0, B - C)
    else:
        ans = max(0, D - C)
else:
    if B <= D:
        ans = max(0, B - A)
    else:
        ans = max(0, D - A)

print(ans)


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

#define el '\n'
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define DEBUG cerr << "DEBUG >>> " 
#define ms(a,b) memset(a, b, sizeof(a))

typedef long long ll;

const int nax = 1005;
ll ax[nax], ay[nax], az[nax];

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);

  int x, y, z, k;
  cin >> x >> y >> z >> k;
  for(int i = 0; i < x; i++){
    cin >> ax[i];
    // DEBUG << ax[i] << el;
  }
  for(int i = 0; i < y; i++) cin >> ay[i];
  for(int i = 0; i < z; i++) cin >> az[i];

  vector<ll> ab;
  for(int i = 0; i < x; i++){
    for(int j = 0; j < y; j++){
      ab.pb(ax[i]+ay[j]);
    }
  } 
  sort(ab.begin(), ab.end(), greater<ll>());
  if((int)ab.size() > k) ab.erase(ab.begin()+k, ab.end());
  vector<ll> ans;
  for(int i = 0; i < (int)ab.size(); i++){
    for(int j = 0; j < z; j++){
      ans.pb(ab[i]+az[j]);
    }
  }
  sort(ans.begin(), ans.end(), greater<ll>());
  for(int i = 0; i < k; i++){
    cout << ans[i] << el;
  }
  return 0;
}

Measured memory_bytes: 43364
ps=[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
np=25
cnts={p:0 for p in ps}
N=int(input())
for n in range(2,N+1):
    for p in reversed(ps):
        while n%p==0:
            cnts[p]+=1
            n//=p

nums={3:0,5:0,15:0,25:0,75:0}
for p, cnt in cnts.items():
    for n in nums:
        if cnt+1 >= n:
            nums[n]+=1
ans=0
if nums[5] >= 2:
    ans += (nums[5]*(nums[5]-1)//2)*(nums[3]-2)
if nums[15] >= 1:
    ans += nums[15]*(nums[5]-1)
if nums[25] >= 1:
    ans += nums[25]*(nums[3]-1)
if nums[75] >= 1:
    ans += nums[75]
print(ans)

Measured memory_bytes: 38640
#include <iostream>
#include <algorithm>
using namespace std;
 
int main()
{
  int N;
 
  cin >> N;
  int t = N -1;
  int a[t];
 
  for(int c = 0; c < N;c++){
    cin >> a[c];
  }
 
  sort(a,a+N);
 
  cout << a[t] - a[0] << "\n";
  
  return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	map<string,int> mp;
	int n,m,ans=0;
	string s;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		mp[s]++;
	}
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>s;
		mp[s]--;
	}
	for(auto p:mp){
		ans=max(p.second,ans);
	}
	cout<<ans<<endl;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int N;
    cin >> N;
    int H[100100];
    REP(i,N) cin >> H[i];
    int count = 0;
    int ans = 0;
    for(int i = 1; i < N; ++i){
        if(H[i-1] < H[i]) count = 0;
        else{
            count++;
            ans = max(ans,count);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vec(x) vector<x>
#define pb push_back
#define pii pair<ll,ll>
#define vi vector<ll>
#define vii vector<pair<ll,ll>>
#define matrix(x) vector<vector<x>>
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a, b, sizeof a)
#define ff first
#define ss second
#define mp make_pair
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main()
{
ll t;
cin>>t;
ll ac=0,wa=0,tle=0,re=0;
while(t--)
{
string s;
cin>>s;
if(s=="AC")
    ac++;
if(s=="WA")
    wa++;
if(s=="TLE")
    tle++;
if(s=="RE")
    re++;

}
cout<<"AC"<<" "<<"x"<<" "<<ac<<endl;
cout<<"WA"<<" "<<"x"<<" "<<wa<<endl;
cout<<"TLE"<<" "<<"x"<<" "<<tle<<endl;
cout<<"RE"<<" "<<"x"<<" "<<re<<endl;


}


Measured memory_bytes: 3568
#include<iostream>
using namespace std;
void hugou(int a) {
    if (a == -1) cout << "-";
    else cout << "+";
}
int main() {
    string s; cin >> s;
    int a = stoi(s.substr(0, 1));
    int b = stoi(s.substr(1, 1));
    int c = stoi(s.substr(2, 1));
    int d = stoi(s.substr(3, 1));
    for (int aa = -1; aa < 2; aa += 2) {
        for (int bb = -1; bb < 2; bb += 2) {
            for (int cc = -1; cc < 2; cc += 2) {
                if (a + aa * b + bb * c + cc * d == 7) {
                    cout << a;
                    hugou(aa);
                    cout << b;
                    hugou(bb);
                    cout << c;
                    hugou(cc);
                    cout << d << "=7" << endl;
                    return 0;
                }
            }
        }
    }
}


Measured memory_bytes: 256
n,m,k,*a=map(int,open(0).read().split())
s=sum(a[:n])
x=i=j=n
a+=k,
while~i:
 while s+a[j]<=k:s+=a[j];j+=1
 if s<=k:x=max(x,i+j)
 i-=1;s-=a[i]
print(x-n)

Measured memory_bytes: 124740
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());

        String result = n == m ? "Yes" : "No";
        System.out.println(result);

        sc.close();
    }
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  while (true) {
    int n; cin >> n;
    if (n == 0) break;
    vi32 a(n); cin >> a;
    sort(all(a));
    int sum = 0;
    for (int i = 1; i < n - 1; i++) sum += a[i];
    cout << sum / (n - 2) << '\n';
  }
}



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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

int main() {

  for(int N, M; cin >> N >> M && N && M;) {
    int sum[N + 1]; sum[0] = 0;

    int res = 0;
    rep(i, N) {
      int A; cin >> A; A %= M;
      sum[i + 1] = sum[i] + A;
      sum[i + 1] %= M;
      maximize(res, sum[i + 1]);
    }

    set<int> st;

    REP(i, 1, N + 1) {
      auto it = st.upper_bound(sum[i]);
      if(it != st.end())
        maximize(res, sum[i] + M - *it);
      st.insert(sum[i]);
    }

    cout << res << endl;

  }
  
  return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)

using namespace std;

using ld = long double;
using P = complex<ld>;
using VP = vector<P>;

ld cross (P a, P b) { return imag(conj(a) * b); }

ld area(const VP &p) {
  ld res = 0;
  int n = p.size();
  REP(j,n) res += cross(p[j], p[(j+1)%n]);
  return abs(res / 2);
}

int main() {
  VP vp;
  double x, y;
  while(scanf("%lf,%lf\n", &x, &y) != EOF) {
    vp.emplace_back(x, y);
  }
  cout << setprecision(10) << fixed << area(vp) << endl;
  return 0;
}

Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int a[n], xr = 0;
        for(int &i : a){
            cin >> i;
            xr ^= i;
        }
        if(xr){
            cout << "No\n";
        }else{
            cout << "Yes\n";
        }
    }
}

Measured memory_bytes: 32256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;
	static boolean[] used;
	static int f = 0;
	static int s = 0;

	static long mod = 1000000007;
	static ArrayList<Integer> saitan;




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int[] s  = new int[n];
		int ans = 0;

		for(int i = 0;i < n;i++){
			s[i] = sc.nextInt();
			ans += s[i];
		}
		Arrays.sort(s);
		
		for(int i = 0;i < n;i++){
			if(ans % 10 != 0){
				System.out.println(ans);
				return;
			}else{
				if(s[i] % 10 != 0){
					ans -= s[i];
				}
			}
		}
		
		System.out.println(0);

		







	}
	static int lowerbond(int k, int[] data){		//kより小さい最小の値をdataの中から探し、返す二分探索
		int min = -1;
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return data[max];
	}


	static long cal(int n){
		long x = (long)n;
		for(int i = n-1;i > 0;i--){
			//	System.out.println(i);
			x *= i;
			x %= mod;
		}
		return x;
	}

}




Measured memory_bytes: 21716
// skip until line 65
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
struct Vec{
    double v[2];
    string to_s(){
        return "("+to_string(v[0])+","+to_string(v[1])+")";
    }
    double& operator[](int t){
        return v[t];
    }
    Vec operator+(Vec t) {
        return {v[0]+t[0],v[1]+t[1]};
    }
    Vec& operator+=(Vec t) {
        v[0]+=t[0];v[1]+=t[1];
        return *this;
    }
    Vec operator-(Vec t) {
        return {v[0]-t[0],v[1]-t[1]};
    }
    Vec& operator-=(Vec t) {
        v[0]-=t[0];v[1]-=t[1];
        return *this;
    }
    Vec operator*(double t) {
        return {v[0]*t,v[1]*t};
    }
    Vec& operator*=(double t) {
        v[0]*=t;v[1]*=t;
        return *this;
    }
    double operator*(Vec t) {
        return v[0]*t[0]+v[1]*t[1];
    }
    Vec operator-(){
        return {-v[0],-v[1]};
    }
    static Vec Z;
};
Vec Vec::Z={0,0};
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
int main() {
    ll N,K;
    vector<ll> A,O;
    cin >> N >> K;
    A.resize(N);
    O.resize(N,-1);
    REP(i,N)
        cin>>A[i];
    REP(i,N)
        A[i]--;
    ll c=0;
    O[c]=0;
    for(ll i=K-1;i>=0ll;--i) {
        if (O[A[c]]==-1) {
            O[A[c]]=O[c]+1;
            c=A[c];
        } else {
            ll L=O[c]+1-O[A[c]];
            i%=L;
            O.clear();
            O.resize(N,-1);
            O[c]=0;
            O[A[c]]=O[c]+1;
            c=A[c];
        }
    }
    cout<<c+1<<endl;
}


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

using namespace std;
using ll =  long long;
int main(){
    int n;
    cin>>n;
    vector<int>brick;
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        brick.push_back(temp);

    }
    int count= 0;
    int index=1;
    for(int i=0;i<n;i++){
        if(brick[i]==index){
            index++;
        }
        else{
            count++;
        }
    }

    if(count==n){
        cout<<-1;
    }
    else{
        cout<<count;
    }

    return 0;
}


Measured memory_bytes: 1528
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        char[] x = s.toCharArray();
        int popcount = 0;
        for(int i=0; i<n; i++){
            if(x[i]=='1'){
                popcount++;
            }
        }

        //0 -> popcount-1
        //2 -> popcount+1
        int[] remx = new int[3];
        int[][] rem2beki = new int[3][n+1];
        for(int i=0; i<3; i+=2){
            int mod = popcount-1+i;
            if(mod<=0){
                continue;
            }
            rem2beki[i][0] = 1;
            for(int j=0; j<n; j++){
                rem2beki[i][j+1] = rem2beki[i][j]*2%mod;
                remx[i] = remx[i]*2 + ((x[j]=='1')?1:0);
                remx[i] %= mod;
            }
        }

        for(int i=0; i<n; i++){
            if(popcount==1 && x[i]=='1'){
                System.out.println(0);
                continue;
            }

            int j = (x[i]=='0') ? 2 : 0;
            int res = remx[j];
            if(x[i]=='0'){
                //mod popcount+1
                res += rem2beki[j][n-1-i];
                res %= popcount+1;
            }else{
                //mod popcount-1
                res -= rem2beki[j][n-1-i] - (popcount-1);
                res %= popcount-1;
            }

            System.out.println(calc(res)+1);
        }
    }

    public static int calc(int n){
        if(n==0){
            return 0;
        }

        int popcount = Integer.bitCount(n);
        int res = n%popcount;

        return calc(res)+1;
    }
}

Measured memory_bytes: 66808
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define VEC(kata, num) (kata*)calloc(num, sizeof(kata))
#define DB puts("ok")
#define SENTINEL 1000000007
typedef long long lli;

// 降順
int cmp(const void *a, const void *b) {
    return *(int*)b - *(int*)a;
}

int main()
{
    int a, b, k, i, ans;
    scanf("%d%d%d",&a,&b,&k);
    int count = 0;
    for(i=MIN(a,b); ; i--) {
        if(a%i==0 && b%i==0) {
            count++;
            //printf("%d\n",i);
            if(count>=k)break;
        }
    }
    printf("%d",i);
    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		int i,j,w;
		int[] a=new int[3];
		Scanner scan = new Scanner(System.in);

	    a[0]= Integer.parseInt(scan.next());
	    a[1]= Integer.parseInt(scan.next());
	    a[2]= Integer.parseInt(scan.next());
	    
	    for(i=0;i<3;i++)
	    {
	    	for(j=i+1;j<3;j++) 
	    	{
	    		if(a[i]>a[j]) {
	    			w=a[i];
	    			a[i]=a[j];
	    			a[j]=w;
	    		}
	    	}
	    
	    }
	    System.out.println(a[0]+" "+a[1]+" "+a[2]);
	}

}

Measured memory_bytes: 26180
r, c = map(int, input().split())
table = []
for i in range(r):
    table.append(list(map(int, input().split())))
for i in table:
    i.append(sum(i))
b = []
for i in range(c):
    x = 0
    for k in range(r):
        x += table[k][i]
    b.append(x)
b.append(sum(b))
for i in table:
    print(" ".join(map(str, i)))
print(" ".join(map(str, b)))


Measured memory_bytes: 5700
//(bool) ? (if true) : (if false)
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define fst first
#define snd second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define sz size()
#define FORN(i,j,n) for(long long i=j; i<(long long)n;i++) 
#define FOR(i,n) FORN(i,0,n)
#define FORIT(i,x) for( auto i = x.begin() ; i != x.end() ; i++ )
#define MOD 998244353LL
#define LIM 262150
#define ones(x) __builtin_popcount(x)
#define trace(x)    cerr << #x << ": " << x << endl;
#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
using namespace std;
 
typedef long long ll ;
typedef unsigned long long ull ;
typedef vector <int> vi;
typedef pair <int,int> ii;
typedef vector <string> vs;
typedef vector <ii> vii;
ll n;
double arr[3005];
double dp[3005][3005];
double ans = 0.0;
int main() {
	fastio;
	cin>> n;
	FORN(i,1,n+1) cin>> arr[i];
	
	FORN(i,1,n+1){
		FOR(j,i+1){
			if(i == 1){
				dp[1][j] = (j == 1) ? arr[1] : (1-arr[1]);
				continue;
			}
			dp[i][j] = dp[i-1][j]*(1-arr[i]) + dp[i-1][j-1]*(arr[i]);
		}
	}
	FORN(i,(n/2+1),n+1){
		ans += dp[n][i];
	}
	cout.precision(10);
	cout<< ans << '\n';
	return 0;
}

Measured memory_bytes: 49884
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e14;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll H,A;
    cin >> H >> A;
    cout << (H + A - 1) / A << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	int A,B,X;
	cin>>A>>B>>X;
	if(A<=X && X<=A+B)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int ZETTAI(int num){
    int N;
    N=num;
    if(num<0){
        N=-N;
    }
    return N;
}
int main(){
    int A,B,C;
    scanf("%d%d%d",&A,&B,&C);
    int a,b,c;
    a=ZETTAI(A-B);
    b=ZETTAI(B-C);
    c=ZETTAI(C-A);
    int max=a;
    if(max<b)
    max=b;
    if(max<c)
    max=c;
    printf("%d",max);
    return 0;
}


Measured memory_bytes: 128
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
MOD = 10**9+7

def mint():
    return map(int,input().split())
def lint():
    return map(int,input().split())
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)

S = input()
T = 'keyence'
N = len(S)

i = 0
while i<7 and S[i]==T[i]:
    i += 1
j = 0
while j<7 and S[N-1-j]==T[6-j]:
    j += 1
judge(i+j>=7,['YES','NO'])

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

int main() {
  int a, b;
  cin >> a >> b;
  
  if (a % 2 != 0 && b % 2 != 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
long xxx[10][1001][101];

long pattern(int n,int s,int from){
	long i,x=0;
	if(xxx[n][s][from]>=0)x=xxx[n][s][from];
	else{
		for(i=(s-100*(n-1)>from?s-100*(n-1):from); i<100 && i<=s ;i++){x+=pattern(n-1,s-i,i+1);}
		xxx[n][s][from]=x;
	}
	return x;
}

long pattern2(int n,int s,int from){
    if(n>1){
        long i,x=0;
        if(xxx[n][s][from]>=0)x=xxx[n][s][from];
        else{
        for(i=s-100*(n-1)>from?s-100*(n-1):from; i<100 && i<=s ;i++){x+=pattern(n-1,s-i,i+1);}
        xxx[n][s][from]=x;
        }
        return x;
    }
    else{if(from<=s && s<=100)return 1; else return 0;}
}

int main(void){
	int n,s,i,j,k;
	for(j=0;j<1001;j++){
		for(k=0;k<101;k++){
			xxx[1][j][k]=( (j<=100 && k<=j)?1:0 );
			xxx[2][j][k]=( (2*k<=j && j<=200) ? ((100-k+1)-abs((100-k)-(j-k*2)))/2 : 0 );
		}
	}

	for(i=3;i<10;i++){for(j=0;j<1001;j++){for(k=0;k<101;k++){xxx[i][j][k]=-1;}}}
    while(scanf("%d %d",&n,&s)*(n+s)){
	if(pattern(n,s,0)!=pattern2(n,s,0)){
		fprintf(stderr,"%d %d\n",n,s);
		assert(0);
	}
	printf("%ld\n",pattern(n,s,0));}
    return 0;
}

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

int main()
{
  std::string S;
  std::cin >> S;
  int num_0 = 0, num_1 = 0;
  for (int i = 0; i < S.size(); i++)
  {
    if (S[i] == '0') num_0++;
    else num_1++;
  }
  std::cout << 2 * std::min(num_0, num_1) << std::endl;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	char S[4];
	for (int i = 0; i < 4; i++) {
		scanf("%c", &S[i]);
	}
	if (S[0] == '0') {
		if (S[1] == '0') {
			if (S[2] == '0' && S[3] == '0') {
				printf("NA");
				return 0;
			}
			else if (S[2] <= '1' && S[3] <= '2') {
				printf("YYMM");
				return 0;
			}
			else  if (S[2] == '0' && S[3] != '0') {
				printf("YYMM");
				return 0;
			}
			else {
				printf("NA");
				return 0;
			}
		}
		else if (S[1] >= '1') {
			if (S[2] == '0' && S[3] == '0') {
				printf("MMYY");
				return 0;
			}
			else if (S[2] <= '1' && S[3] <= '2') {
				printf("AMBIGUOUS");
				return 0;
			}
			else  if (S[2] == '0' && S[3] != '0') {
				printf("AMBIGUOUS");
				return 0;
			}
			else {
				printf("MMYY");
				return 0;
			}
		}
	}
	if (S[0] == '1') {
		if (S[1] <= '2') {
			if (S[2] == '0' && S[3] == '0') {
				printf("MMYY");
				return 0;
			}
			else if (S[2] <= '1' && S[3] <= '2') {
				printf("AMBIGUOUS");
				return 0;
			}
			else  if (S[2] == '0' && S[3] != '0') {
				printf("AMBIGUOUS");
				return 0;
			}
			else {
				printf("MMYY");
				return 0;
			}
		}
		else {
			if (S[2] == '0' && S[3] == '0') {
				printf("NA");
				return 0;
			}
			else if (S[2] <= '1' && S[3] <= '2') {
				printf("YYMM");
				return 0;
			}
			else  if (S[2] == '0' && S[3] != '0') {
				printf("YYMM");
				return 0;
			}
			else{
				printf("NA");
				printf("d");
				return 0;
			}
		}
	}
	if (S[0] >= '2') {
		if (S[2] == '0' && S[3] == '0') {
			printf("NA");
			return 0;
		}
		else if (S[2] <= '1' && S[3] <= '2') {
			printf("YYMM");
			return 0;
		}
		else  if (S[2] == '0' && S[3] != '0') {
			printf("YYMM");
			return 0;
		}
		else {
			printf("NA");
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 128
/*
[ ( ^ _ ^ ) ]
*/

// problem: atc/abc162_c

import java.io.*;
import java.util.*;


public class Main {
    int INF = (int)1e9;
    long MOD = 1000000007;


    long gcd(long a, long b) {
        return b==0 ? a : gcd(b, a%b);
    }

    void solve(InputReader in, PrintWriter out) throws IOException {
        long n = in.nextInt();
        long s = 0;
        for(int i=1; i<=n; i++) {
            for(int j=1; j<=n; j++) {
                for(int k=1; k<=n; k++) {
                    s += gcd(gcd(i, j), k);
                }
            }
        }
        out.println(s);
    }
    

    public static void main(String[] args) throws IOException {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;//in.nextInt();
        while(t-- >0) {
            new Main().solve(in, out);
        }
        out.close();
    }
    
    public static void show(Object... o) {
        System.out.println(Arrays.deepToString(o));
    }
    
    static class InputReader {
        static BufferedReader br;
        static StringTokenizer st;
        public InputReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }
    }
}

Measured memory_bytes: 26008
#include <iostream>
using namespace std;
int main()
{
    string s, t;
    cin >> s >> t;
    bool pass = true, over = false;
    long long ans = 0;
    int alp[26][s.size()], now = -1;
    for(int i = s.size() - 1; i >= 0; i--)
    {
        if(i == s.size() - 1)
        {
            for(int j = 0; j < 26; j++)
            {
                alp[j][i] = -1;
            }
            alp[s[i] - 'a'][i] = i;
        }
        else
        {
            for(int j  =0; j < 26; j++)
            {
                alp[j][i] = alp[j][i + 1];
            }
            alp[s[i] - 'a'][i] = i;
        }
    }
    for(int i = 0, j = 0; i < t.size(); i++)
    {
        if(alp[t[i] - 'a'][j] == -1)
        {
            if(alp[t[i] - 'a'][0] == -1)
            {
                pass = false;
                break;
            }
            ans = ans + alp[t[i] - 'a'][0] + s.size() - now;
            j = alp[t[i] - 'a'][0] + 1;
            now = alp[t[i] - 'a'][0];
            if(j >= s.size())
            {
                j = 0;
            }
        }
        else
        {
            if(over)
            {
                ans = ans + alp[t[i] - 'a'][j] + s.size() - now;
                over = false;
            }
            else
            {
                ans = ans + alp[t[i] - 'a'][j] - now;
            }
            now = alp[t[i] - 'a'][j];
            j = alp[t[i] - 'a'][j] + 1;
            if(j >= s.size())
            {
                j = 0;
                over = true;
            }
        }
    }
    if(pass)
    {
        cout << ans << endl;
    }
    else
    {
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 13940
#include<algorithm>/*{{{*/
#include<cctype>
#include<cassert>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<vector>
using namespace std;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define ROF(i,a,b) for(int i=(a);i>=(b);--i)
namespace RA{
    int r(int p){return 1ll*rand()*rand()%p;}
    int r(int L,int R){return r(R-L+1)+L;}
}/*}}}*/
/******************heading******************/
const int N=305,P=1e9+7;

int n,tot;
int typ[N*2];//1:已确定；0：(-1,-1)；-1：(-1,x)
int f[N*2][N][N];//

int main(){
    scanf("%d",&n);
    FOR(i,1,n){
        int x,y;
        scanf("%d%d",&x,&y);
        if(x!=-1&&y!=-1)typ[x]=typ[y]=1;
        else if(x==-1&&y==-1)++tot;
        else if(x!=-1)typ[x]=-1;
        else typ[y]=-1;
    }
    f[n*2+1][0][0]=1;
    ROF(i,n*2,0){
        if(typ[i]==1)memcpy(f[i],f[i+1],sizeof(f[i+1]));
        else if(typ[i]==0){
            FOR(j,0,n)FOR(k,0,n){
                f[i][j][k+1]=(f[i][j][k+1]+f[i+1][j][k])%P;//添加一个普通括号
                if(j)f[i][j-1][k]=(f[i][j-1][k]+f[i+1][j][k]*1ll*j)%P;//匹配一个特殊括号
                if(k)f[i][j][k-1]=(f[i][j][k-1]+f[i+1][j][k])%P;//匹配一个普通括号
            }
        }else {
            FOR(j,0,n)FOR(k,0,n){
                f[i][j+1][k]=(f[i][j+1][k]+f[i+1][j][k])%P;//添加一个特殊括号
                if(k)f[i][j][k-1]=(f[i][j][k-1]+f[i+1][j][k])%P;//匹配一个普通括号
            }
        }
    }
    int ans=f[1][0][0];
    FOR(i,1,tot)ans=1ll*ans*i%P;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 219392
#include <bits/stdc++.h>
using namespace std;
//
struct Sieve{
  vector<pair<long long,int>>factor(long long x){//素因数分解（素数、何個あるか）
    vector<pair<long long,int>>res;
    for(long long i=2;i*i<=x;++i){
      int y=0;
      while(x%i==0){
        x/=i;
        ++y;
      }
      if(y!=0)res.emplace_back(x,y);
    }
    if(x!=1)res.emplace_back(x,1);
    return res;
  }
};
int main(){
  long long n;
  cin>>n;
  Sieve s;
  auto fs=s.factor(n);
  int ans=0;
  for(auto p:fs){
    int x=p.second;
    int b=1;
    while(b<=x){
      x-=b;
      b++;
      ++ans;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

typedef unsigned long long ull;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const ull mod = 1e9 + 7;

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

	string S;	cin>>S;
	FOR(i,0,S.size())	cout<<"x";

    return 0;
}

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

int main() {
  int n; cin >> n;
  vector<int> a(n), b(n), c(n);
  int aa, bb;

  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < n; i++) c[i] = i + 1;
  int v = 0;

  do {
    v++;
    if (c == a) aa = v;
    if (c == b) bb = v;
  } while (next_permutation(c.begin(), c.end()));

  cout << abs(aa - bb) << endl;
}

Measured memory_bytes: 256
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 基本はdouble
//map<キー,値> p は辞書。p[キー] = 値
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

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

	int mi = 10000;
	rep(i, S.size()-2) {
		string s;
		s += S[i]; s += S[i + 1]; s += S[i + 2];
		int x = stoi(s);
		mi = min( mi, abs(x-753) );
	}

	cout << mi << endl;
}

Measured memory_bytes: 256
s = input()
ans = 0
if s == 'SSS':
    print(0)
elif s == 'SSR' or s == 'RSS' or s == 'SRS' or s == 'RSR':
    print(1)
elif s == 'SRR' or s == 'RRS':
    print(2)
else:
    print(3)

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

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

  unsigned long num_m = 0;
  unsigned long num_a = 0;
  unsigned long num_r = 0;
  unsigned long num_c = 0;
  unsigned long num_h = 0;

  for (int i=0; i<n; i++) {
    std::string name;
    std::cin >> name;
    switch (name.front()) {
    case 'M': num_m++; break;
    case 'A': num_a++; break;
    case 'R': num_r++; break;
    case 'C': num_c++; break;
    case 'H': num_h++; break;
    }
  }

  unsigned long ans =
    num_m * num_a * num_r                 +
    num_m * num_a *         num_c         +
    num_m * num_a *                 num_h +
    num_m *         num_r * num_c         +
    num_m *         num_r *         num_h +
    num_m *                 num_c * num_h +

            num_a * num_r * num_c         +
            num_a * num_r *         num_h +
            num_a *         num_c * num_h +

                    num_r * num_c * num_h;

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
/**
 *   created: 22 May 2019  22:00:21
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================

int main()
{
	optimizeIO();
	int tt=1;
	//cin>>tt;
	while(tt--){
		int n,k;
		cin>>n>>k;
		vi v(n);
		rep(i,0,n)
			cin>>v[i];
		vi mini(n);
		mini[0] = 0;
		rep(i,1,n){
			int temp = INF;
			rep(j,1,k+1){
				if(i-j<0)
					break;
				int temp2 = mini[i-j] + abs(v[i]-v[i-j]);
				temp = min(temp,temp2);
			}
			mini[i] = temp;
		}
		cout<<mini[n-1];
	}
	return 0;
}


Measured memory_bytes: 1024
N, M = [int(v) for v in input().split()]
students = [[int(v) for v in input().split()] for _ in range(N)]
checkpoints = [[int(v) for v in input().split()] for _ in range(M)]

for a, b in students:
    min_d = float("inf")
    ans = None
    for i, (c, d) in enumerate(checkpoints):
        dist = abs(a - c) + abs(b - d)
        if dist < min_d:
            min_d = dist
            ans = i+1
    print (ans)

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

int main(){
	int array[10];
	int work;
    for(int i=0; i<10; i++){
       cin >> array[i];
	}
	
	for(int i=0; i<10; i++){
       for(int j=10-1; j>i; j--){
			if(array[j] > array[j-1]){
				work = array[j];
				array[j] = array[j-1];
				array[j-1] = work;
			}
		}
	}
			
	for(int i=0; i<3; i++){
       cout << array[i] << "\n";
	}
	
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

int main() {

	int a, b;
	cin >> a >> b;

	int ans = 0;
	if (a == 1)
		ans += 300000;
	else if (a == 2)
		ans += 200000;
	else if (a == 3)
		ans += 100000;
	if (b == 1)
		ans += 300000;
	else if (b == 2)
		ans += 200000;
	else if (b == 3)
		ans += 100000;

	if (a == 1 && b == 1)
		ans += 400000;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <cstdlib>
using namespace std;
using ll = long long int;
int INF = 1e9+7;
int a[1000000+1];
int f(int n) {
    if (n%2 == 0) return n/2;
    else return 3*n+1;
}

int main() {
    int s;
    cin >> s;
    int now = s;
    a[0] = s;
    int i = 1;
    int count = 0;
    while (1) {
        now = f(now);
        for (int j=0; j<i;j++) {
            if (now == a[j])
                count = 1;
        }
        if (count)
            break;
        a[i] = now;
        i++;
    }
    cout << i+1;

}


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

int main(){
  int n;
  cin >> n;
  n++;
  vector<int> a(n);
  for(int i=1;i<n;i++){
    char c;
    cin >> c;
    if(c=='W') a[i]++;
    a[i]+=a[i-1];
  }
  int ans=300000;
  for(int i=1;i<n;i++){
    ans=min(ans,a[i-1]-a[n-1]+a[i]+n-i-1);
  }
  cout << ans << endl;
}

Measured memory_bytes: 4556
import java.util.*;

public class Main {

  public static void main(String[] args) {
  Scanner scan = new Scanner(System.in);
  int n = scan.nextInt();
  int k = scan.nextInt();
  int x = scan.nextInt();
  int y = scan.nextInt();
  if(n > k){
    System.out.println(k * x + (n - k) * y);
  }else{
    System.out.println(n * x);
  }
  }
}


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

int main() {
	int a,b;
	cin>>a>>b;
	if(a>1&&b>1)
	cout<<a*b;
	else if(b<0&&a>0)
	cout<<a-b;
	else if(a<0&&b<0)
	cout<<a*b;
	else
	cout<<a+b;
	return 0;
}

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

#define lli long long int
#define pb push_back
#define in insert
#define pi pair<int, int>
#define pd pair<double, int>
#define pii pair<int, pi>
#define mp make_pair
#define fir first
#define sec second
#define MAXN 200001
#define mod 1000000000

int freq[MAXN];
signed main()
{
  lli n;
  cin >> n;
  for (int i = 0; i < n - 1; i++)
  {
    lli a;
    cin >> a;
    freq[a]++;
  }
  for (int i = 1; i <= n; i++)
  {
    cout << freq[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 4372
from sys import stdin
A, B, Q = list(map(int, input().split()))
# もし神社(寺)が1つしかなかった場合に両端に仮想の神社を建築して処理の一貫性を保つ。かりにこれが選ばれても最大のコストなので最終的に最適になることはない。
INF = 10 ** 18

S = [-INF] + list(map(int, (stdin.readline() for _ in [0] * A))) + [INF]
T = [-INF] + list(map(int, [stdin.readline() for _ in [0] * B])) + [INF]


from bisect import bisect_right
# from bisect import bisect_left as bisect_right #これでも通ったりする。
from itertools import product

for q in range(Q):  # 各問に答える
    x = int(input())  # 位置の指定
    s_idx, t_idx = bisect_right(S, x), bisect_right(T, x)
    ans = INF
    # 左右の神社と寺のの組み合わせ
    for s, t in product(S[s_idx - 1:s_idx + 1], T[t_idx - 1:t_idx + 1]):
        t_root = abs(t - x) + abs(s - t)  # 寺から最初に回るルート
        s_root = abs(s - x) + abs(s - t)
        ans = min(ans, t_root, s_root)
    # 最小をとって終わり
    print(ans)

'''
bisect_right

ソートされた順序を保ったまま x を a に挿入できる点を探し当てます。リストの中から検索する部分集合を指定するには、パラメータの lo と hi を使います。デフォルトでは、リスト全体が使われます。x がすでに a に含まれている場合、挿入点は既存のどのエントリーよりも後(右)になります。戻り値は、list.insert() の第一引数として使うのに適しています。a はすでにソートされているものとします。


In[3]: A
Out[3]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

In[4]: bisect.bisect_right(A, 2.5)
Out[4]: 3

In[5]: bisect.bisect_right(A, 3)
Out[5]: 4
'''


Measured memory_bytes: 18828
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s; cin >> s;
  int k; cin >> k;
  int n = s.size();
  set<string> S;
  rep(i, n) {
    REP(j, i, min(n, i+5)) {
      S.insert(s.substr(i, j-i+1));
    }
  }
  auto itr = S.begin();
  rep(i, k-1) itr++;
  cout << *itr << endk;
  return 0;
}


Measured memory_bytes: 4724