akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define sum accumulate
typedef long long ll;
const int INF = 100000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 998244353LL;
int main(){
	for(int i=1;;i++){
		
		int n;
		std::cin >> n;
		if(n==0)exit(0);
		std::cout << "Case " <<i<<": "<<n<< std::endl;
		
	}
}


Measured memory_bytes: 3016
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>
#include<map>
#include <queue>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<set>
#include <bits/stdc++.h>
 
using namespace std;
using ll = long long int;
 
#define REP(i,n) for(ll i=0;i<(ll)(n);i++) //REP(i, 5) cout<<i;
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define MOD 1000000007 //10^9+7
//#define MOD 1
 
ll gcd(ll a, ll b) {
  ll tmp;
  if ( b > a) {
    tmp = a;
    a = b;
    b = tmp;
  }
  while (a % b !=0) {
    tmp = b;
    b = a % b;
    a = tmp;
  }
  return b;
}
 
const int MAX = 1000;
 
ll table[MAX][MAX];
 
// テーブルを作る前処理
void COMinit() {
    table[0][0] = table[0][1] = 1;
    FOR(i, 1, MAX-1){
      FOR(j, 0, i+1){
        if(j==0) table[i][j] = 1;
        else if(j == i+1) table[i][j] = 1;
        else table[i][j] = table[i-1][j-1]+table[i-1][j];
      }
    }
}
 
// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return table[n-1][k];
}

void sosuu(ll n, vector<ll> &v){

  vector<ll> num(n, 0);

  FOR(i, 1, sqrt(n)){
    if(num[i]==0){
      FOR(j, 0, n/i){
        num[i+(j*i)] = 1;
      }
    }
  }
  REP(i, n){
    if(num[i]==0) v.push_back(i+1);
  }
}


int main(void){

  ll n, m;
  cin>>n>>m;
  vector<vector<ll>> v(n+1);

  REP(i, m){
    ll x, y;
    cin>>x>>y;
    v[x].push_back(y);
    v[y].push_back(x);
  }

  vector<ll> visit(n+1, 0); //訪問済みかどうかを記録
  queue<ll> q;
  q.push(1);

  while(q.size()!=0){
    ll now = q.front();
    q.pop();
    // cout<<now<<" ";

    REP(i, v[now].size()){
      // cout<<v[now][i]<<endl;
      if(visit[v[now][i]] != 0) continue;
      else{
        q.push(v[now][i]);
        visit[v[now][i]] = now;
      }
    }
  }

  cout<<"Yes"<<endl;
  FOR(i, 2, n) cout<<visit[i]<<endl;
  return 0; 

}

Measured memory_bytes: 12812
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
#define MOD 1000000007ll
using namespace std;

int ctoi(char c)
{
    return c - '0';
}
int main(int argc, char const *argv[])
{
    int dp[101010][13];
    rep(i, 101010) rep(j, 13) dp[i][j] = 0;
    string s;
    cin >> s;
    int cap = 1;
    if (s[s.size() - 1] == '?')
    {
        rep(i, 10)
            dp[s.size() - 1][i] = 1;
    }
    else
    {
        dp[s.size() - 1][ctoi(s[s.size() - 1])] = 1;
    }
    cap = (cap * 10) % 13;
    for (int i = s.size() - 2; i >= 0; i--)
    {
        if (s[i] == '?')
        {
            rep(j, 10)
            {
                rep(k, 13)
                {
                    dp[i][k] += dp[i + 1][(k - j * cap + 13 * j) % 13];
                    dp[i][k] %= MOD;
                }
            }
        }
        else
        {
            int j = ctoi(s[i]);
            rep(k, 13)
            {
                dp[i][k] += dp[i + 1][(k - j * cap + 13 * j) % 13];
                dp[i][k] %= MOD;
            }
        }
        //rep(k, 13)
        //    cerr
        //<< i << " " << k << " " << dp[i][k] << endl;

        cap = (cap * 10) % 13;
    }
    cout << dp[0][5] << endl;
    return 0;
}


Measured memory_bytes: 5632
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var b = cin.ReadLine;
            if (b == "A") {
                WriteLine("T");
            }
            if (b == "T") {
                WriteLine("A");
            }
            if (b == "C") {
                WriteLine("G");
            }
            if (b == "G") {
                WriteLine("C");
            }
        }

        private double MultipleCeil(double value, double multiple) {return Math.Ceiling(value / multiple) * multiple;}

    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13268
n,m=map(int, input().split())
s=[list(map(int, input().split())) for i in range(m)]
x=max(a for a,b in s)
dp=[0]*(n+x)
for i in range(0,n+x):
  if i>0:
    dp[i]=min(dp[i-a]+b for a,b in s)
print(min(dp[n:]))

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

int main(){
    int64_t n;
    cin >> n;
    int64_t a[110000];
    a[0] = 0;
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    a[n+1] = 0;
    int64_t allCost = 0;
    for(int i=0; i<=n; i++){
        allCost += abs(a[i+1] - a[i]);
    }
    for(int i=0; i<n; i++){
        int64_t ans = allCost;
        ans -= abs(a[i+1] - a[i]);
        ans -= abs(a[i+2] - a[i+1]);
        ans += abs(a[i+2] - a[i]);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <complex>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>
#include <iterator>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
// template<class T> T gabs(const T& x) { return max(x, -x); }
// #define abs gabs

template<class T>
T cross(complex<T> a, complex<T> b) {
    return (conj(a) * b).imag();
}

int main() {
    int n;
    cin >> n;
    using C = complex<double>;
    vector<C> ps(n);
    for (int i = 0; i < n; ++i) {
        double x, y;
        cin >> x >> y;
        ps[i] = {x, y};
    }
    sort(begin(ps), end(ps), [](C p, C q) {
        if (p.imag() == q.imag()) {
            return p.real() < q.real();
        }
        return p.imag() < q.imag();
    });
    vector<C> ch[2];
    for (int k = 0; k <= 1; ++k) {
        double sign = k == 0 ? 1 : -1;
        for (int i = 0; i < n; ++i) {
            while (ch[k].size() >= 2) {
                int j = ch[k].size() - 1;
                auto c = cross(ps[i] - ch[k][j - 1], ch[k][j] - ch[k][j - 1]);
                if (sign * c > 0) {
                    ch[k].pop_back();
                } else {
                    break;
                }
            }
            ch[k].push_back(ps[i]);
        }
    }
    vector<C> res;
    for (int i = 0; i < ch[0].size(); ++i) {
        res.push_back(ch[0][i]);
    }
    for (int i = ch[1].size() - 2; i >= 1; --i) {
        res.push_back(ch[1][i]);
    }

    cout << res.size() << '\n';
    for (auto z : res) {
        cout << int(z.real()) << ' ' << int(z.imag()) << '\n';
    }
    return 0;
}


Measured memory_bytes: 7568
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n; cin >> n;
  cout << n * 800 - (n/15)*200 << endl;
  return 0;
}


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



int main(){
  int n,t;
  cin>>n>>t;
  long s,e,ans;
  s=e=ans=0;
  for(int i=0;i<n;i++){
    long a;
    cin>>a;
    if(a<e){
    }
    else{
      ans+=e-s;
      s=a;
    }
    e=a+t;
    if(i==n-1){
      ans+=e-s;
    }
  }
  cout <<ans;
      
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 10000000000000000
const ll mod=998244353;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

void solve()
{
    ll x;
    cin>>x;
    ll first=100,ct=0;
    while(first<x)
    {
        ll i=first/100;
        first+=i;
        ct++;
    }
    cout<<ct<<endl;
    return;
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1e9;
const int mod = 1000000007;

int main(){
  int N,A,B;
  cin>>N>>A>>B;
  if(A%2==B%2){cout<<"Alice"<<endl;}
  else{cout<<"Borys"<<endl;}
  return 0;                       
}

Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N, M := ReadInt(), ReadInt()
	Ps := ReadInts(N)

	valueToIdx := make(map[int]int)
	for i := 0; i < N; i++ {
		valueToIdx[Ps[i]] = i
	}

	uf := InitUnionFind(N)
	for m := 0; m < M; m++ {
		x, y := ReadInt(), ReadInt()
		uf.Unite(x-1, y-1)
	}

	groups := make(map[int][]int)
	for i := 0; i < N; i++ {
		root := uf.Root(i)
		groups[root] = append(groups[root], i)
	}

	ans := 0
	groupedIndexes := make(map[int]bool)
	for _, group := range groups {
		values := []int{}
		indexes := []int{}
		for _, idx := range group {
			groupedIndexes[idx] = true
			val := Ps[idx]
			indexes = append(indexes, idx+1)
			values = append(values, val)
		}
		m := make(map[int]bool)
		for _, v := range values {
			m[v] = true
		}
		for _, index := range indexes {
			if m[index] {
				ans++
			}
		}
	}

	for i := 0; i < N; i++ {
		if !groupedIndexes[i] {
			if Ps[i] == i+1 {
				ans++
			}
		}
	}

	fmt.Println(ans)
}

func InitUnionFind(size int) UnionFind {
	parent := make([]int, size)
	for i := 0; i < size; i++ {
		parent[i] = i
	}
	return parent
}

type UnionFind []int

func (uf UnionFind) Unite(x, y int) {
	x = uf.Root(x)
	y = uf.Root(y)
	if x != y {
		uf[x] = y
	}
}

func (uf UnionFind) Connected(x, y int) bool {
	return uf.Root(x) == uf.Root(y)
}

func (uf UnionFind) Root(x int) int {
	if uf[x] == x {
		return x
	}
	uf[x] = uf.Root(uf[x])
	return uf[x]
}

func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int) { Scan(&i); return }


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

int main()
{
  string s, t;
  cin >> s >> t;
  string ans = "Yes";
  map<char, char> map1, map2;
  for (auto i = 0; i < s.size(); i++) {
    if (map1[s[i]] || map2[t[i]]) {
      if (map1[s[i]] != t[i] || map2[t[i]] != s[i]) {
	ans = "No";
	break;
      }
    }
    map1[s[i]] = t[i];
    map2[t[i]] = s[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1020
N = int(input())

link = [[] for _ in range(N+1)] 
for _ in range(N-1):
    u, v, w = map(int, input().split())
    link[u].append((v, w))
    link[v].append((u, w))

dist = [-1]*(N+1)
dist[1] = 0
q = [1]
while q:
    p = q.pop()
    for n, w in link[p]:
        if dist[n] == -1:
            dist[n] = dist[p] + w
            q.append(n)

for i in range(1, N+1):
    if dist[i] % 2 == 0:
        print(0)
    else:
        print(1)

Measured memory_bytes: 71840
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define PI       3.1415926535897932384626433832795028841971
#define INF      100000000
#define EPS      1e-10
#define MOD      1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[100000];
bool b[100000];

int main(){
    cin >> n;
    rep(i,n) cin >> a[i];
    rep(i,n) a[i]--;
    int ans = 0;
    rep(i,n){
        if(a[a[i]] == i){
            ans++;
            a[i] = -1;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <cstdio>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
const int N=1e5+5;
#define ll long long
#define inf 0x3f3f3f3f
#define mem(x) memset(x,0,sizeof(x))
#define sca(x) scanf("%d",&x)
#define scall(x) scanf("%lld",&x)
#define eps 1e-6
ll a[200005];
int main()
{
	int n;sca(n);
	for(int i=0;i<n;i++)
	scall(a[i]);
	ll sum=0;
	for(int i=1;i<n;i++)
	{
		if(a[i]<a[i-1])
		{
			sum+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 5248
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline LL read(){
	LL x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const LL MAXN = 100010;
const LL INF = 2147483600;

LL N,Mod,K;
LL f[2010][2010],C[2010][2010];
inline void Add(LL &a,LL b){ a=(a+b>=Mod?a+b-Mod:a+b); }

int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	N=read(),K=read(),Mod=read(); f[0][0]=1;
	for(LL i=1;i<=K;i++) f[1][i]=i%Mod,f[0][i]=1; C[0][0]=1;
	for(LL i=1;i<=N;i++){
		C[i][0]=C[i][i]=1;
		for(LL j=1;j<i;j++)
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mod;
	}
	for(LL i=2;i<=N;i++){
		for(LL j=1;j<=K;j++){
			for(LL k=1;k<=i;k++)
				Add(f[i][j],f[i-k][j-1]*f[k-1][j]%Mod*C[i][k]%Mod);
			Add(f[i][j],f[i][j-1]);
		}
	} printf("%lld\n",f[N][K]%Mod);
	return 0;
}




Measured memory_bytes: 7228
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define all(A) A.begin(),A.end()
typedef long long ll;

int main(){
  int n;
  cin >> n;
  vector<int> buc(10001,0);
  rep1(x,100){
    rep1(y,100){
      rep1(z,100){
        int key = x*x + y*y+ z*z;
        key += x*y + y*z + z*x;
        if(key > 10000) continue;
        buc[key] += 1;
      }
    }
  }
  rep1(i,n){
    cout << buc[i] << endl;
  }
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>
int main(){
    char S[200];
    scanf("%s", S);
    int len=strlen(S);
    for (int i = 0; i <len ; ++i) {
        if(i%2==0){
            if(S[i]=='L'){
                printf("No");
                return 0;
            }
        }else{
            if(S[i]=='R'){
                printf("No");
                return 0;
            }
        }
    }
    printf("Yes");
    return 0;
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,A,B,C,D=MAP()
S='#'+input()+'#'

if C<D:
    for i in range(A, D-1):
        if S[i]==S[i+1]=='#':
            No()
            exit()
    Yes()
else:
    for i in range(A, C-1):
        if S[i]==S[i+1]=='#':
            No()
            exit()
    for i in range(B, D+1):
        if S[i-1]==S[i]==S[i+1]=='.':
            Yes()
            exit()
    No()


Measured memory_bytes: 3700
A, B, C, K = map(int, input().split())

a = 0
b = 0
c = 0

if A <= K:
    a = A
    if A + B <= K:
        b = B
        if A + B + C <= K:
            c = C
        else:
            c = K - A - B
    else:
        b = K - A
        
else:
    a = K

print(a-c)

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

using namespace std;


#include <math.h> 


int main() {


	int N, K;
	cin >> N >> K;

	vector<int> p(N);
	for (int i = 0; i < N; i++) {

		cin >> p[i];
	}

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

	int64_t total = 0;

	for (int i = 0; i < K; i++) {
		total += p[i];
	}


	cout << total;
	return 0;
}

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

int main()
{
    int N;
    scanf("%d", &N);
    int low = 2000, up = -100;
    for(int i = 0; i < N; ++i) {
        int a; scanf("%d", &a);
        low = min(low, a);
        up  = max(up, a);
    }
    printf("%d\n", up - low);
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;
using str = string;

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

long int M = 1e+9+7;
int inf = 1e+9;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int n;
    cin >> n;
    vi x(n);
    //int ma=1;
    rep(i,n){
        cin >> x[i];
        //chmax(mx,x[i]);
    }
    int ans=inf;
    rrep(i,100){
        int sum=0;
        rep(j,n){
            sum+=pow((x[j]-i),2);
        }
        chmin(ans,sum);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
s = gets.chomp

if s.size<26
  (?a..?z).each{|c|
    if !s.index(c)
      puts s+c
      exit
    end
  }
elsif s=="zyxwvutsrqponmlkjihgfedcba"
  p -1
else
  (s.size-1).times{|i|
    t = s[0...-i-2]
    w = s[-i-2]
    (?a..?z).each{|c|
      if !t.index(c) && w<c
        puts t+c
        exit
      end
    }
  }
  p -1
end

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
using namespace std;
const int N=2e5+10;
const ll M=1e9;
double a[N];
ll num[22][22],ans=0;
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lf",&a[i]);
		ll t=a[i]*M+0.1,cnt2=0,cnt5=0;
		while(t%2==0&&cnt2<=18)t/=2,cnt2++;
		while(t%5==0&&cnt5<=18)t/=5,cnt5++;
		int n2=max(0LL,18-cnt2),n5=max(0LL,18-cnt5);
		for(int j=n2;j<=20;j++)
		for(int k=n5;k<=20;k++)
		ans+=num[j][k];
		num[cnt2][cnt5]++;
	}
	printf("%lld\n",ans);

	return 0;
}


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

#define ll long long

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;

    if (a <= 9 && a >= 1 && b <= 9 && b >=1){
        cout << a * b << endl;
    }else cout << -1 << endl;


    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)


ll searchMax(ll c[], ll sd[], ll picked[]){
    ll max = -1;
    ll maxP = -1;
    REP(i, 26){
        if(picked[i] == 1){
            if(max < sd[i] + c[i]){
                max = sd[i] + c[i];
                maxP = i;
            }
        }else{
            if(max < sd[i]){
                max = sd[i];
                maxP = i;
            }
        }
    }

    return maxP;
}

int main(){
    // input
    ll D;
    cin >> D;

    ll c[27];
    ll s[D + 1][27];
    REP(i, 26){
        cin >> c[i];
    }
    REP(i, D){
        REP(j, 26){
            cin >> s[i][j];
        }
    }

    // preparation
    ll t[D + 1];
    ll picked[27];

    // main
    REP(i, D){
        t[i] = searchMax(c, s[i], picked);
        picked[t[i]] = 1;
    }

    // output
    REP(i, D){
        cout << t[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3728
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <vector>
#include <queue>
#include <unordered_map> 
#include <iomanip>
#include <random>
#include <future>
#include <thread>
#include <utility>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define INF (INT_MAX/3)
#define INF_L (LLONG_MAX/3)
#define PSB push_back
#define PN 1000000007
typedef long long LL;
#define int long long


// booooooooooooost
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/multiprecision/cpp_dec_float.hpp>
// namespace mp = boost::multiprecision;	//多倍長整数(mp::cpp_int), 多倍長小数(mp::cpp_dec_float_100)


signed main() {

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

	bool isTwoExist = false;
	int ones = 0, fours = 0;
	for (auto p : a) {
		if (p % 2 != 0) {
			++ones;
		}
		else if (p % 4 == 0) {
			++fours;
		}
		else {
			isTwoExist = true;
		}
	}

	bool ans = isTwoExist ? ones <= fours : ones <= fours + 1;

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



	return 0;
}

Measured memory_bytes: 1400
#include<stdio.h>
#include <iostream>
using namespace std;

int main() {
	long long money = 1000;
	long long kabu = 0;
	long long N, K;
	static long long A[100];

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	for (int i = 0; i < N-1; i++) {
		if (A[i] < A[i + 1]) {
			money = (money / A[i]) * A[i + 1] + (money % A[i]);
		}
	}

	cout << money << endl;

	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x,"r",stdin)
#define out(x) freopen(x,"w",stdout)
#define N 100500
#define oo ll(1e16)
#define P pair<ll,ll>
#define F first
#define S second
#define pb push_back
#define el '\n'
#define elf endl
#define base ll(1e9+7)
#define MM 4294967296
#define re return
#define nins 4294967295
using namespace std;
typedef long long ll;
void ok() {cout<<"Yes";}
void no() {cout<<"No";}
void oke() {cout<<"Yes"; exit(0);}
void noe() {cout<<"No"; exit(0);}
int n,k,q,a[N];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin>>n>>k>>q;
    for(int i=0;i<n;i++) a[i]=k-q;
    for(;q;q--) {
        int p; cin>>p;
        a[p-1]++;
    }
    for(int i=0;i<n;i++)
        if(a[i]>0) cout<<"Yes"<<el;
            else cout<<"No"<<el;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int MAXn = 1e5 + 10, MOD = 1e9 + 7;
string s, t, l;
long long dp[MAXn][2];
int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> l;
	if (l[0] == '0') {
		dp[0][0] = 1;
	}
	else {
		dp[0][0] = 2;
		dp[0][1] = 1;
	}
	for (int i = 1; i < l.size(); i++) {
		if (l[i] == '0') {
			dp[i][0] = dp[i-1][0];
			dp[i][1] = (3 * dp[i-1][1]) % MOD;
		}
		else {
			dp[i][0] = (2 * dp[i-1][0]) % MOD;
			dp[i][1] = (3 * dp[i-1][1] + dp[i-1][0]) % MOD;
		}
	}
	cout << (dp[(int)l.size()-1][0] + dp[(int)l.size()-1][1]) % MOD;
}


Measured memory_bytes: 2000
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#define GROUND 0
#define WALL 500
#define INITIAL -1

int count();
void init();
void map();
void mark_n(int,int,int,int,int);
void mark_n_all(int);
bool isValidPoint(int,int);

using namespace std;
const int MAX_W = 20;
const int MAX_H = 20;
char floor_[MAX_W][MAX_H];
//floorツつセツづ算ツ術ツ甘鳴青板づ債ャツつエツづゥ
int step[MAX_W][MAX_H];
int width,height;

int main(){
  //  char floor[MAX_W][MAX_H];
  //int step[MAX_W][MAX_H];
  
  while(cin >> width >> height && width > 0){
    string line;
    int ix,iy;
    //cout << width << " " << height << endl;
    init();
    for(int i = 0; i < height; i++){
      cin >> line;
      for(int j=0; j < width ; j++){
	floor_[j][i] = line[j];
	if(line[j]=='@'){
	  step[j][i]=GROUND;
	  ix = j; iy = i;
	}else if(line[j]=='#'){
	  step[j][i]=WALL;
	}
	//cout << step[j][i];
      }
      //cout << endl;
    }
    //cout << count('.') << count('#') << count('@') << endl;
    for(int k = 0; k < 300; k++){
      //map();
      mark_n_all(k);
      //mark_n(k+1,ix,iy,1,0);
      //cout << endl;
      //map();
      
      //cout << endl;
    }
    cout << count() << endl;
  }
  
}

int count(){
  int result =0;
  for(int i=0; i<height;i++){
    for(int j=0; j< width; j++){
      if(step[j][i] >= 0 && step[j][i] < WALL){
	result++;
      }
    }
  }
  return result;
}

void init(){
  for(int i=0; i<height;i++){
    for(int j=0; j< width;j++){
      step[j][i]=INITIAL;
    }   
  }
}

void map(){
  for(int i = 0; i < height; i++){
    for(int j=0; j < width ; j++){
      cout << setw(3)<< step[j][i] << " ";
    }
    cout << endl;
  }
}

void mark_n(int n,int x,int y,int dx,int dy){
  int temp;
  for(int i =0; i< 4;i++){
    temp = dx;
    dx = dy;
    dy = -temp;
    //cout << isValidPoint(x+dx,y+dy) << " " << x+dx << y+dy << endl;
    if(isValidPoint(x+dx,y+dy) && step[x+dx][y+dy]==INITIAL){
      //cout << isValidPoint(x+dx,y+dy) << " " << x+dx << y+dy << endl;
      step[x+dx][y+dy] = n;
    }
  }
}


void mark_n_all(int n){
  for(int i = 0; i < height; i++){
    for(int j = 0; j < width ; j++){
      if(step[j][i]==n){
	//	cout << j <<" " << i << "jツづツづ個値"<< endl;
	mark_n(n+1,j,i,1,0);
      }
    }
  }
}



bool isValidPoint(int x,int y){
  if(x < 0 || x >=  width || y < 0 || y >= height){
    return false;
  }else{
    return true;
  }
}

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

int main() {
    int N;
    cin >> N;
    vector<long> A(N);
    vector<long> B(N);
    B.at(0) = 0;
    for (int i = 0; i < N; i++){
        cin >> A.at(i);
        if(i == 0){
            B.at(i) = A.at(i);
        }
        else{
            B.at(i) = B.at(i-1) + A.at(i);
        }
    }
    long tmp = abs(B.at(N-1) - 2 * B.at(0));
    for (int i = 0; i < N; i++){
        tmp = min(tmp, abs(B.at(N-1) - 2 * B.at(i)));
    }
    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 3456
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 基本はdouble
//map<キー,値> p は辞書。p[キー] = 値
//絶対値 abs()
#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() {
	int N; cin >> N;
	if (N == 1) cout << "Hello World" << endl;
	else if(N==2){
		int A, B; cin >> A >> B;
		cout << A + B << endl;
	}
}

Measured memory_bytes: 256
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    M = int(input())
    print(24 + 24 - M)


if __name__ == '__main__':
    main()


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

int main() {
    int a, b, c; cin >> a >> b >> c;

    int ans = 0;
    for (int i = a; i <= b; i++) {
        if (c % i == 0)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mod 1000000007
int main() {

	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	string s,t;
	cin>>s>>t;
	int n=s.length();
	int m=t.length();
	if(m!=n+1)
	{
		cout<<"No\n";
		return 0;
	}

	if(s.substr(0,n)==t.substr(0,n))
		cout<<"Yes\n";
	else
		cout<<"No\n";
    
    return 0;
}

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

#define ll long long int
#define ull unsigned long long int
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


using namespace std;

const int INF = 1e9 + 7;
const int N = 1e5+5;

int main() {

	IO;
	
	int n, x;
	cin >> n >> x;
	if (x%2 == 0 && x <= 4*n && x >= 2*n) 	
		cout << "Yes";
	else
		cout << "No";
}	


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

int main() {
	// your code goes here
	ll int n,k;
	cin>>n>>k;
	vector<ll int> h(n+1),dp(n+k,0);
	ll int i,j;
	for(i=1;i<=n;i++)
	cin>>h[i];
	for(i=1;i<=k;i++)
	dp[i]=abs(h[i]-h[1]);
	for(i=k+1;i<=n;i++)
	{
	   dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
	   for(j=2;j<=k;j++)
	   dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
	}
	cout<<dp[n]<<"\n";
	return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1777777777ll
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[100100];

inline li lcm(li a, li b) {
    li g = __gcd(a, b);
    return (a / g) * b;
}

int main() {
    li n, m;
    cin >> n >> m;
    rin{
        cin >> a[i];
    }
    li g = 1;
    rin{
        g = lcm(g, a[i] / 2);
        if (g > m) {
            puts("0");
            return 0;
        }
    }
    rin{
        if ((g / (a[i] / 2)) % 2 == 0) {
            puts("0");
            return 0;
        }
    }
    li res = 1;
    li more = (m - g) / (g * 2);
    cout << res + more << endl;


    return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main
{
    static int N;
    static int W;
    static int w0;
    static ArrayList<Integer>[] v = new ArrayList[4];
    static
    {
        for (int i = 0; i < v.length; ++i)
        {
            v[i] = new ArrayList<Integer>(N);
        }
    }

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

        N = sc.nextInt();
        W = sc.nextInt();

        w0 = sc.nextInt();
        v[0].add(sc.nextInt());

        for (int i = 1; i < N; ++i)
        {
            int w = sc.nextInt();
            v[w - w0].add(sc.nextInt());
        }

        for (int i = 0; i < v.length; ++i)
        {
            v[i].sort(Comparator.reverseOrder());
        }

        System.out.println(solve(0, N, 0));
    }

    static int solve(int startIndex, int numLeft, int totalW)
    {
        if (startIndex >= v.length)
        {
            return 0;
        }

        int vi = 0;
        int wi = totalW;
        int max_v = 0;
        for (int n = 0; n <= numLeft && n <= v[startIndex].size(); ++n)
        {
            if (n >= 1)
            {
                vi += v[startIndex].get(n - 1);
                wi += w0 + startIndex;
            }

            if (wi > W)
            {
                break;
            }

            max_v = Integer.max(max_v, vi + solve(startIndex + 1, numLeft - n, wi));
        }

        return max_v;
    }
}


Measured memory_bytes: 23764
// Problem : C - Candles
// Contest : AtCoder Regular Contest 101
// URL : https://atcoder.jp/contests/arc101/tasks/arc101_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int n, k, a[N];

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	int ans = inf;
	for (int i = 1; i <= n - k + 1; i++) {
		if (a[i] >= 0) {
			ans = min(ans, a[i + k - 1]);
		} else if (a[i + k - 1] <= 0) {
			ans = min(ans, -a[i]);
		} else {
			ans = min(ans, min(-a[i] * 2 + a[i + k - 1], -a[i] + a[i + k - 1] * 2));
		}
	}
	cout << ans;
}


Measured memory_bytes: 640
w, h, x, y = gets.split.map(&:to_i)



if x/w == y/h || x/y == (h-y)/h
  ans1 = (w*h) / 2.0
  ans2 = x == w/2.0 && y == h/2.0 ? 1 : 0
else
  a = [x*h, (w-x)*h].min
  b = [y*w, (h-y)*w].min
  ans1 = [a, b].max
  ans2 = a == b ? 1 : 0
end

puts [ans1, ans2].join(' ')

Measured memory_bytes: 1788
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())

    A = []
    for i in range(N):
        A.append(int(stdin.readline().rstrip()))
    B = A.copy()
    A.sort(reverse=True)

    for i in range(N):
        if B[i] == A[0]:
            print(A[1])
        else:
            print(A[0])

Measured memory_bytes: 14112
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

MOD = 10 ** 9 + 7
N, M = lr()
S = [0] + lr()
T = [0] + lr()
dp = [[0] * (M+1) for _ in range(N+1)]
dp_cum = [[0] * (M+1) for _ in range(N+1)]
dp[0][0] = 1; dp_cum[0][0] = 1
for i in range(N+1):
    dp_cum[i][0] = 1
for j in range(M+1):
    dp_cum[0][j] = 1

for i in range(1, N+1):
    for j in range(1, M+1):
        if S[i] == T[j]:
            dp[i][j] = dp_cum[i-1][j-1]
        else:
            dp[i][j] = 0
        dp_cum[i][j] = (dp_cum[i-1][j] + dp_cum[i][j-1] - dp_cum[i-1][j-1] + dp[i][j]) % MOD

answer = dp_cum[N][M]
print(answer)
# 02

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

int main() {
	int	A, B, K;
	cin >> A >> B >> K;
	vector<int>	vec;
	for (int i = 1; i <= A; i++)
	{
		if (A % i == 0 && B % i == 0)
			vec.push_back(i);
	}
	cout << vec.at(vec.size() - K) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)
#define ALL(x) (x).begin(),(x).end()
const char* LF = "\n";
namespace{struct _{_(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}}a;}

signed main() {
    ll N;
    cin >> N;
    vector<ll> X(N), Y(N);
    REP(i, N) {
        cin >> X[i];
        Y[i] = X[i];
    }
    sort(ALL(Y));
    REP(i, N) {
        if (X[i] <= Y[N/2 - 1]) {
            cout << Y[N/2] << LF;
        }
        else {
            cout << Y[N/2 - 1] << LF;
        }
    }
    return 0;
}

Measured memory_bytes: 5376
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
#[derive(PartialEq, PartialOrd)]
pub struct TotalOrd<T>(pub T);
impl<T: PartialEq> Eq for TotalOrd<T> {}
impl<T: PartialOrd> Ord for TotalOrd<T> {
    fn cmp(&self, other: &TotalOrd<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}
use std::cmp::max;
fn main() {
    input! { n, mut xy: [(i64, i64); n] };
    xy.sort_by_key(|&(x, y)| TotalOrd((x as f64).atan2(y as f64)));
    let zz = xy.clone();
    xy.extend(zz);
    let mut ans = 0;
    for i in 0..n {
        let mut x = 0;
        let mut y = 0;
        for j in 0..n {
            x += xy[i + j].0;
            y += xy[i + j].1;
            ans = max(ans, x * x + y * y);
        }
    }
    println!("{}", (ans as f64).sqrt());
}


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

#define ALL(V) (V).begin(), (V).end()

template <typename T> using V = vector<T>;
template <typename T> using VV = vector<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

int main() {
    double mul = 380000.0;
    ll N;
    cin >> N;
    double ans = 0;
    for(ll i = 0; i < N; i++) {
        double x;
        string s;
        cin >> x >> s;
        if(s == "BTC") x *= mul;
        ans += x;
    }
    printf("%.20f\n", ans);
    return 0;
}


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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

vector<pair<int, int>> adj[100000];
int dist[100000];
bool chk[100000];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, M, t, c;
	priority_queue<pair<int, int>> Q;
	for (cin >> N >> M; M; M--) {
		int l, r, d;
		cin >> l >> r >> d;
		adj[--l].push_back({ --r,d });
		chk[r] = true;
	}
	memset(dist, 0x7f, sizeof(dist));
	for (int i = 0; i < N; i++) if (!chk[i]) {
		dist[i] = 0;
		Q.push({ 0,i });
	}
	while (!Q.empty()) {
		tie(t, c) = Q.top();
		Q.pop();
		if (-t != dist[c]) continue;
		for (auto n : adj[c]) {
			if (dist[n.first] > dist[c] + n.second) {
				dist[n.first] = dist[c] + n.second;
				Q.push({ -dist[n.first],n.first });
			}
		}
	}
	for (int i = 0; i < N; i++) {
		if (dist[i] == 0x7f7f7f7f) {
			cout << "No\n";
			return 0;
		}
		for (auto n : adj[i]) {
			if (dist[n.first] != dist[i] + n.second) {
				cout << "No\n";
				return 0;
			}
		}
	}
	cout << "Yes\n";
	return 0;
}

Measured memory_bytes: 7412
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
//l={1,2,3,4}
//greater<int>()
//sort(l,l+N)

int main(void)
{
	string test;
	cin >> test;
	int i = 0;
	int ans = 0;
	for (i; i < 105; i++) {
		if (test[i] == 'C') {
			ans++;
			break;
		}
	}
	for (i; i < 105; i++) {
		if (test[i] == 'F') {
			ans++;
			break;
		}
		else if (test[i] == '\0')
			break;
	}
	if (ans == 2)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
//I have to work harder than anyone else to make it! I’ll never catch up otherwise…
//Don’t worry about what other people think. Hold your head up high and plunge forward.

#include<bits/stdc++.h>
using namespace std;

#define P pair<int,int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define str std::string 
#define pb push_back
#define itrt(yo) for(auto x:yo){std::cout<<x<<nl;} 
#define vec(x) std::vector<x> 
#define nl '\n'
#define F first
#define S second
#define ll long long int
#define ALL(x) x.begin(),x.end() 
#define BN(x) x.begin()
#define ED(x) x.end()
#define MAP_traverse(it,x)  for(auto it = BN(x); it!= ED(x); it++)
#define PI 3.14159265358979323846264338327950L
const unsigned int M = 1000000007;

const int mxN=2e5;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n,m,k;
	cin>>n>>m>>k;

	ll a[mxN+1],b[mxN+1];
	for (int i = 0; i < n; i++)
	{
		cin>>a[i+1];
		a[i+1]+=a[i];
	}
	for (int i = 0; i < m; i++)
	{
		cin>>b[i+1];
		b[i+1]+=b[i];
	}
	int ans = 0;

	for (int i = 0,j=m; i <=n; i++)
	{
		if (a[i]>k)
		{
			break;
		}
		
			while (a[i]+b[j]>k)
			{
				j--;
			}
			ans = max(i+j,ans);
		
		
		
	}
	cout<<ans;
	
	
	



}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef long double LD;
typedef pair<LD, LD> PLDLD;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
LL MOD = 1e9+7;
LL INF = 1e9;
double EPS=1.0e-9;


int main()
{
    int n;
    cin>>n;
    vector<int> l(n*2);
    REP(i,n*2)
        cin>>l[i];
    
    sort(ALL(l));
    int sum=0;
    REP(i,n)
    sum+=l[i*2];
    
    cout<<sum<<endl;
}

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

int main () {
  string S_prime, T;
  cin >> S_prime >> T;
  bool restorable = false;
  if (S_prime.size() >= T.size()) {
    for (int i = S_prime.size() - T.size(); i >= 0; i--) {
      string sub_S = S_prime.substr(i, T.size());
      for (int j = 0; j < T.size(); j++) {
        if (sub_S.at(j) == T.at(j) || sub_S.at(j) == '?') {
          if (j == T.size() - 1) {
            restorable = true;
            for (int j = 0, k = i; j < T.size(); j++, k++) {
              S_prime.at(k) = T.at(j);
            }
          }
        } else {
          break;
        }
      }
      if (restorable) break;
    }
  }
  if (restorable) {
    for (int i = 0; i < S_prime.size(); i++) {
      if (S_prime.at(i) == '?') S_prime.at(i) = 'a';
    }
    cout << S_prime << endl;
  } else {
    cout << "UNRESTORABLE" << endl;
  }
}

Measured memory_bytes: 256