akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

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

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}


int main() {
    int n;
    cin >> n;
    map<string,int> mp;
    string s;
    rep(i,n) {
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for(auto x: mp) {
        if (x.second > mx) {
            mx = x.second;
        }
    }
    for(auto x: mp) {
        if (x.second == mx) {
            cout << x.first << "\n";
        }
    }
}


Measured memory_bytes: 25216
/*
[dp] E - Knapsack 2
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100;
const int MAX_V = 1e3;
const ll INF = 1e18;

int N, W;
int w[MAX_N], v[MAX_N];
ll dp[MAX_N * MAX_V + 1];

ll solve() {
    fill(dp, dp + MAX_N * MAX_V + 1, INF);
    dp[0] = 0;
    for (int i = 0; i < N; i++) {
        for (int j = MAX_N * MAX_V; j - v[i] >= 0; j--) {
            dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
        }
    }

    for (int j = MAX_N * MAX_V; j >= 0; j--) {
        if (dp[j] <= W) {
            return j;
        }
    }
    return -1;
}

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,m;
	cin>>n>>m;
	vector<pair<ll,ll>>ch;
	for(ll i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		ch.push_back(make_pair(x,y));
	}
	sort(ch.begin(),ch.end());
	reverse(ch.begin(),ch.end());
	ll ans=0;
	priority_queue<ll>q;
	for(ll i=1;i<=m;i++){
		bool c=true;
		while(ch.size()!=0&&c){
			c=false;
			pair<ll,ll>now=ch.back();
			if(i>=now.first){
				q.push(now.second);
				ch.pop_back();
				c=true;
			}
		}
		if(q.size()!=0){
		ans+=q.top();
		q.pop();
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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


void solve(string S){
    string buf;
    buf = S.substr(0, 2);
    ll upper = atoi(buf.c_str());
    buf = S.substr(2, 2);
    ll lower = atoi(buf.c_str());
    
    // cout << upper << endl;
    // cout << lower << endl;
    if ((upper > 12 || upper == 0) && lower <= 12 && lower > 0)
        cout << "YYMM" << endl;
    else if (upper <= 12 && (lower > 12 || lower == 0) && upper > 0)
        cout << "MMYY" << endl;
    else if (upper <= 12 && lower <= 12 && upper > 0 && lower > 0)
        cout << "AMBIGUOUS" << endl;
    else if ((upper > 12 || upper == 0) && (lower > 12 || lower == 0))
        cout << "NA" << endl;
    
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    string S;
    cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll INF=1000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
vector<ll> divisor(ll x){
	vector<ll> div;
	for(int i=1;i*i<=x;i++){
		if(i*i!=x && x%i==0){
			div.pb(i);
			div.pb(x/i);
		}
		else if(x%i==0) div.pb(i);
	}
	return div;
}

char field[1000][1000];
ll H,W; 

ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
ll d[1000][1000];

ll bfs(){
	queue<P> que;
	rep(i,H)rep(j,W) d[i][j]=INF;

	rep(i,H)rep(j,W){
		if(field[i][j]=='#'){
			que.push(P(i,j));
			d[i][j]=0;
		}
	}

	while(!que.empty()){
		P p=que.front(); que.pop();

		rep(i,4){
			ll nx=p.a+dx[i],ny=p.b+dy[i];
			if(0<=nx && nx<H && 0<=ny && ny<W && field[nx][ny]=='.' && d[nx][ny]==INF){
				que.push(P(nx,ny));
				d[nx][ny]=d[p.a][p.b]+1;
			}
		}
	}

	ll res=0;
	rep(i,H)rep(j,W){
		res=max(res,d[i][j]);
	}
	return res;
}

//a,b x
int main(){
	cin>>H>>W;
	ll cnt=0;
	rep(i,H){
		string tmp; cin>>tmp;
		rep(j,W){
			field[i][j]=tmp[j];
		}
	}
	cout<<bfs();
}

Measured memory_bytes: 25396
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    cout << 180 + (n - 3) * 180 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();

        System.out.println(A <= C && C <= B ? "Yes" : "No");
    }

}


Measured memory_bytes: 22996
#include <bits/stdc++.h> 
 
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI  acos(-1)
 
using ll  = long long;
using ull = unsigned long long;

int main(int argc, char *argv[])
{
    int a, b;
    std::cin >> a >> b;

    if (a > b) {
        std::cout << a - 1 << std::endl;
    } else {
        std::cout << a << std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n; cin>>n;
    int t;
    int ans=-1;
    for(int i=1; i<=n;i++){
        int hoge=-1;
        int sub=i;
        while(hoge++,((sub%2)==0)&&sub!=0)sub/=2;
        if(ans<hoge){ans=hoge; t=i;}
    }
    cout<<t<<endl;
}


Measured memory_bytes: 256
import bisect

s = input()
t = input()

lst = [[] for _ in range(30)]
ch = 'abcdefghijklmnopqrstuvwxyz'
for k, i in enumerate(s+s):
    lst[ch.find(i)].append(k)

len_s = len(s)

count = 0
index = -1
for i in t:
    if lst[ch.find(i)] == []:
        print(-1)
        break
    next_index = lst[ch.find(i)][bisect.bisect_right(lst[ch.find(i)], index)]
    count += next_index - index
    if next_index >= len_s:
        next_index -= len_s
    index = next_index
else:
    print(count)

Measured memory_bytes: 52460
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for (int i = 1; i <= n; i++) {
            ans += i;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 35572
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>

//マクロ
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)

#define All(a) (a).begin(),(a).end()

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数

//使用する関数


int main()
{
	int n, m;
	string s, t;
	cin >> s >> t;

	int cnt = 0;
	REP(i, 3) {
		if (s[i] == t[i])cnt++;
	}
	cout << cnt;
}

Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 105;
const ll mm = 1e+18;
bool isprime(long long n){
    if(n<=1) return false;
    for(long long i=2;i<=sqrt(n);i++){
         if(n%i==0) return false;
    }
    return true;
}
void solve()
{
    int n;
    cin>>n;
    int ans=1;
    rep1(i,n){
        if(isprime(i)){
            int ff=0;
            repp(j,i,n+1){
                int x=j;
                while(x%i==0){
                    ff++;
                    x/=i;
                }
            }
            ans=(ans*(ff+1))%mod;
        }
    }
    cout<<ans;
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}

Measured memory_bytes: 3644
import sys

import numpy as np
def sieve_of_eratosthenes(n=10 ** 7):
  sieve = np.ones(n + 1); sieve[:2] = 0
  for i in range(2, int(np.sqrt(n)) + 1):
    if sieve[i]: sieve[i*2::i] = 0
  return sieve, np.flatnonzero(sieve)

is_prime, prime_numbers = sieve_of_eratosthenes()

def prime_factorize(n):
  res = dict()
  if n < 2: return res
  border = int(n ** 0.5)
  for p in prime_numbers:
    if p > border: break
    while n % p == 0: res[p] = res.get(p, 0) + 1; n //= p
    if n == 1: return res
  res[n] = 1
  return res

def prime_factorize_factorial(n):
  res = dict()
  for i in range(2, n + 1):
    for p, c in prime_factorize(i).items(): res[p] = res.get(p, 0) + c
  return res

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():
  res = 1
  for c in prime_factorize_factorial(n).values():
    res *= c + 1; res %= MOD
  print(res)

if __name__ ==  '__main__':
  main()

Measured memory_bytes: 95816
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

const int MOD = 1000000007;

// O(log n) time
long long mod_pow(long long a, long long n, long long m) {
    a %= m;
    if (a < 0) a += m;
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % m;
        a = a * a % m;
        n >>= 1;
    }
    return res;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    vector<int> cnt(K + 1, 0);
    FOR (i, 2, K + 1) {
        cnt[i] = mod_pow(K / i, N, MOD);
    }

    for (int i = K; i >= 2; --i) {
        for (int j = 2 * i; j <= K; j += i) {
            cnt[i] -= cnt[j];
        }
    }

    cnt[1] = mod_pow(K, N, MOD);
    FOR (i, 2, K + 1) (cnt[1] += MOD - cnt[i]) %= MOD;

    int ans = 0;
    FOR (i, 1, K + 1) {
        (ans += i * cnt[i] % MOD) %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int nagasa = s.length();
		int hanbun = (nagasa - 1) / 2;
		boolean bool = true;
		for (int i = 0; i < hanbun; i++) {
			if (s.charAt(i) != s.charAt(nagasa - i - 1)) {
				bool = false;
				break;
			}
			if (s.charAt(i) != s.charAt(hanbun - i - 1)) {
				bool = false;
				break;
			}
			if (s.charAt(hanbun + i + 1) != s.charAt(nagasa - i - 1)) {
				bool = false;
				break;
			}
		}
		if (bool) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		sc.close();
	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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; }

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main(){
    ll n, k; cin >> n >> k;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    ll left = 0, right = 1001001001; // ng, ok
    while(right-left>1){
        ll mid = (left + right)/2;
        ll count = 0;
        rep(i,n) count += (a[i]+mid-1)/mid-1;
        if(count > k) left = mid;
        else right = mid;
    }
    cout << right << endl;
}

Measured memory_bytes: 4760
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int answer = 0;
		answer+=(N/500)*1000; N%=500;
		answer+=(N/5)*5;
		System.out.println(answer);
	}
}

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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll a[252521];

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%lld",a+i);
  REP(i,n)a[i] -= (i+1);
  sort(a,a+n);
  int c = n/2;
  ll ans = 0;
  REP(i,n)ans += abs(a[i]-a[c]);
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	int N; cin >> N;
	vector<ll>A(N+1);
	for (int i = 0; i < N+1; i++)cin >> A[i];
	vector<ll>B(N);
	for (int i = 0; i < N; i++)cin >> B[i];
	ll ans = 0;


	for (int i = 0; i < N; i++) {
		if (A[i] >= B[i]) {
			A[i] -= B[i];
			ans += B[i];
		}
		else {
			ans += A[i];
			B[i] -= A[i];
			A[i] = 0;
			if (A[i + 1] >= B[i]) {
				A[i + 1] -= B[i];
				ans += B[i];
			}
			else {
				ans += A[i + 1];
				A[i + 1] = 0;
			}
		}
	}
	print(ans);



	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s,t;
    cin>>s>>t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),greater<char>());
    if(t>s) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
/* abc_167_a */

#include<stdio.h>
#include<string.h>

int main()
{
  char S[15],T[15];
  int i,a;
  scanf("%s",S);
  scanf("%s",T);
  a=1;
  for (i=0;i<strlen(S);i++){
    if (S[i]!=T[i]){
      a=0;
      break;
    }
  }
  if (a==1) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int a[200010];
bool flag[1000010];
vector<int>pr;
int main()
{
	int n,i,j;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=0;i<n;i++)
	{
		if(i&&a[i]==a[i-1]&&pr.size()&&pr[pr.size()-1]==a[i])
			pr.pop_back();
		if(!flag[a[i]])
		{
			pr.push_back(a[i]);
			for(j=a[i];j<=1000000;j+=a[i])
				flag[j]=true;
		}
	}
	cout<<pr.size();
	return 0;
}

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

int n;
int li[14];
vector<int> ada;
vector<int> urut;
int main(){
	scanf("%d",&n);
	int ans = 15;
	for(int i=1;i<=n;i++){
		int x;
		scanf("%d",&x);
		li[x]++;
		ans = min(ans,x);
	}
	for(int i=1;i<=12;i++){
		if(li[i]>=3) ans = 0;
		else if(li[i] == 2){
			ada.push_back(i);
			ada.push_back(24-i);
		} else if(li[i] == 1){
			urut.push_back(i);
		}
	}
	int tmpa = 15;
	for(int i=0;i<ada.size();i++){
//		printf("> %d\n",ada[i]);
		for(int j=i+1;j<ada.size();j++){
			int lala = abs(ada[i] - ada[j]);
			tmpa = min(tmpa,min(lala,24-lala));
//			cout << tmpa << endl;
		}
	}
	int lala = -1;
	ans = min(ans,tmpa);
	for(int i=0;i<(1<<urut.size());i++){
		int curm = 15;
		for(int j=0;j<urut.size();j++){
			int cur;
			if(i & (1<<j)) cur = urut[j];
			else cur = 24-urut[j];
			for(int k=j+1;k<urut.size();k++){
				int now;
				if(i&(i<<k)) now = urut[k];
				else now = 24-urut[k];
				int dif = abs(cur-now);
				curm = min(curm,min(dif,24-dif));
			}
			for(int k=0;k<ada.size();k++){
				int dif = abs(cur-ada[k]);
				curm = min(curm,min(dif,24-dif));
			}
		}
		lala = max(lala,curm);
	}
	if(lala == -1) lala = 15;
	printf("%d\n",min(ans,lala));
  return 0;
}


Measured memory_bytes: 256
x, y, z, k = gets.chop.split.map(&:to_i)
as = gets.chop.split.map(&:to_i).sort! { |x, y| y <=> x }
bs = gets.chop.split.map(&:to_i).sort! { |x, y| y <=> x }
cs = gets.chop.split.map(&:to_i).sort! { |x, y| y <=> x }

abc = []

x.times do |i|
    y.times do |j|
        break if((i+1) * (j+1) > k)
        z.times do |l|
            break if((i+1) * (j+1) * (l+1) > k)
            abc << as[i] + bs[j] + cs[l]
        end
    end
end

abc.sort! { |x, y| y <=> x }
k.times do |i|
  puts abc[i]
end


Measured memory_bytes: 3896
#include <iostream>
#include <cmath>

#include <vector>
#include <algorithm>
#include <limits>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <queue>

typedef long long ll;

using namespace std;


int main() {
    int x;
    cin >> x;
    cout << 1 - x << endl;

}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 123456789012


int main(){
    int n,i,j;
	cin>>n;
	double rate=380000.0;
	double ans=0;
	double b=0;
	for(i=0;i<n;i++){
		double x;
		string u;
		cin>>x>>u;
		if(u[0]=='J') ans+=x;
		else b+=x;
	}
	cout<<fixed<<setprecision(15)<<ans+b*rate<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	char s1[10] ,s2[10],s3[10];
	    cin>>s1>>s2>>s3;
	    s1[0]=toupper(s1[0]);
	    s2[0]=toupper(s2[0]);
	    s3[0]=toupper(s3[0]);
	    
  cout<<s1[0]<<s2[0]<<s3[0]<<endl;
  
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll n;
    cin >> n;
    vl v(n);
    rep(i, n) cin >> v[i];
    reverse(all(v));
    if(v[0] != 2) {
        cout << -1 << endl;
        return 0;
    }
    ll l = 2, r = 3;
    REP(i, 0, n) {
        ll minK = (l + v[i] - 1) / v[i];
        ll maxK = (r + v[i] - 1) / v[i];
        if(minK >= maxK) {
            cout << -1 << endl;
            return 0;
        }

        ll kl = (l + v[i] - 1) / v[i];
        ll kr = (r + v[i] - 1) / v[i];
        l = kl * v[i];
        r = kr * v[i];
    }
    cout << l << " " << r -1 << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X,Y,Z;
    cin >> X >> Y >> Z;
    cout << Z << " " << X << " " << Y << "\n";
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int n;
	string code;
	int size;
	string dommy;
	while (cin >> n&&n != 0) {
		dommy = "I";
		for (int i = 0; i < n; ++i) {
			dommy += "OI";
		}
		cin >> size;
		cin >> code;
		int answer = 0;
		for (int i = 0; i < size - 1 - 2 * n; ++i) {
			if (code.substr(i, 1 + 2 * n) == dommy)++answer;
		}
		cout << answer << endl;
	}
	return 0;
}

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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e10;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);



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

    ll ans = INF;
    {
        // cを1枚も買わない
        ll now = a * x + b * y;
        cmin(ans, now);
    }
    {
        // cを2xだけ買う
        ll c_cost = c * 2 * x;
        ll b_cost = 0;
        if (x < y) {
            b_cost = (y - x) * b;
        }
        ll now = c_cost + b_cost;
        cmin(ans, now);
    }
    {
        // cを2yだけ買う
        ll c_cost = c * 2 * y;
        ll a_cost = 0;
        if (x > y) {
            a_cost = (x - y) * a;
        }
        ll now = c_cost + a_cost;
        cmin(ans, now);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <vector>

#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
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;
}
const long long INF = 1LL << 60;

int main()
{
    int N, K;
    cin >> N >> K;
    if (K % 2 == 0)
    {
        long long c = N / K;
        long long t = c;
        if (N - K * c >= K / 2)
        {
            t++;
        }
        cout << c * c * c + t * t * t << endl;
    }
    else
    {
        long long c = N / K;
        cout << c * c * c << endl;
    }
}

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

int mini(int a,int b)
{
    return a>b?b:a;
}

int abs(int n)
{
    return n>0?n:-n;
}

int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int x[100000];
    for(int i=0;i<n;i++)
    scanf("%d",&x[i]);

    int min=INT_MAX;
    for(int i=0;i<n-k+1;i++)
    {
        int tmp=x[i+k-1]-x[i]+mini(abs(x[i+k-1]),abs(x[i]));
        if(min>tmp) min=tmp;
    }
    printf("%d\n",min);
}

Measured memory_bytes: 512
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
using namespace std;
int x[45],t[45];
int n;
int memo[45][4];
const int INF = 1<<26;
int solve(bool& ok){
  for(int i=0;i<=n;++i)
    for(int j=0;j<4;++j)
      memo[i][j] = INF;
  memo[0][0] = 0;

  for(int i=0;i<n;++i){
    int dt = t[i+1]-t[i];
    int dx = abs(x[i+1]-x[i]);
    for(int j=0;j<=2;++j)
      if(dt>=dx*(j+1))
	memo[i+1][j+1] = min(memo[i+1][j+1], memo[i][j]+dx);
    for(int j=1;j<=3;++j)
      if(dt>=x[i]*(j+1)+x[i+1])
	memo[i+1][1] = min(memo[i+1][1], memo[i][j]+x[i]+x[i+1]);
  }
  /*
  for(int i=0;i<=n;++i){
    for(int j=0;j<=3;++j) cout << memo[i][j] << " ";
    cout << endl;			    
  }
  */

  int ret = INF;
  for(int j=1;j<=3;++j) ret = min(ret,memo[n][j]+x[n]);
  if(ret==INF){
    ok = false;
    for(int i=1;i<=n;++i){
      bool flg = false;
      for(int j=1;j<=3;++j)
	if(memo[i][j]!=INF)
	  flg = true;
      if(!flg) return i;
    }
  }
  return ret;
}
int main(){
  while(cin>>n,n){
    for(int i=1;i<=n;++i) cin>>x[i]>>t[i];
    bool ok = true;
    int ans = solve(ok);
    if(ok) cout << "OK ";
    else cout << "NG ";
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
#define MAX 2000000
#define INFTY (1<<30)

int n,A[MAX];

void maxHeapify(int i){
  int l,r,largest,temp;
  l=2*i;
  r=2*i+1;

  if(l<=n && A[l]>A[i]){
    largest=l;
  }
  else{
    largest=i;
  }
  if(r<=n && A[r]>A[largest]){
    largest=r;
  }
  if(largest != i){
    temp=A[i];
    A[i]=A[largest];
    A[largest]=temp;
    maxHeapify(largest);
  }
  
}

int extract(void){
  int maxv;
  if(n<1){
    return -INFTY;
  }
  maxv=A[1];
  A[1]=A[n--];
  maxHeapify(1);
  return maxv;
}

void increaseKey(int i,int key){
  int temp;
  if(key<A[i]){
    return;
  }
  A[i]=key;
  while(i>1 && A[i/2]<A[i]){
    temp=A[i];
    A[i]=A[i/2];
    A[i/2]=temp;
    i=i/2;
  }
}

void insert(int key){
  n++;
  A[n]= -INFTY;
  increaseKey(n,key);
}

int main(){
  int key;
  char com[10];

  while(1){
    scanf("%s",com);
    if(com[0]=='e' && com[1]=='n'){
      break;
    }
    if(com[0]=='i'){
      scanf("%d",&key);
      insert(key);
    }
    else{
      printf("%d\n",extract());
    }
  }
  return 0;
}



Measured memory_bytes: 5672
#include<bits/stdc++.h>
#include<sstream>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define loop(i,a,b) for(i=(int)a;i<(int)b;i++)
#define revloop(i,a,b) for(i=(int)a;i>=(int)b;i--)
#define stloop(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<int,int>
#define MP make_pair
#define pb push_back
#define ll long long int
#define INF 1000000005
#define PI acos(-1.0)
#define f first
#define s second
int main()
{  std::ios::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int n,ma,mb,i,j,k,sum1=0,sum2=0,ans=INF,x,y;
   cin>>n>>ma>>mb;
   int a[n+1],b[n+1],c[n+1];
   loop(i,1,n+1)
   { cin>>a[i]>>b[i]>>c[i];
     sum1+=a[i];
     sum2+=b[i];
   }
   int dp[sum1+1][sum2+1];
   loop(j,0,sum1+1)
   {
     loop(k,0,sum2+1)
       dp[j][k]=INF;
   }
   loop(i,1,n+1)
   {
     revloop(j,sum1,a[i])
     {
      revloop(k,sum2,b[i])
      {
        if(dp[j-a[i]][k-b[i]]!=INF)
          dp[j][k]=min(dp[j][k],c[i]+dp[j-a[i]][k-b[i]]);
      }

     }
     dp[a[i]][b[i]] = min(dp[a[i]][b[i]],c[i]);
   }
   loop(j,1,sum1+1)
   { loop(k,1,sum2+1)
     {
      if(dp[j][k] != INF)
      {
        i = __gcd(j,k);
        x = j/i;
        y = k/i;
        if(x==ma && y==mb)
         ans=min(ans,dp[j][k]);
      }
     }
   }
   if(ans == INF)
    cout<<-1;
   else
    cout<<ans;
   return 0;
}


Measured memory_bytes: 512
N, L = list(map(int, input().split()))
aji = []
for i in range(1, N + 1):
    aji.append(L + i - 1)
if 0 in aji:
    print(sum(aji))
elif min(aji) < 0:
    print(sum(aji) - max(aji))
else:
    print(sum(aji) - min(aji))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
   int n;
   cin >> n;
   double A[1000] = {};
   for(int i = 1; i <= n; i++)
   {
       cin >> A[i];
   }
   double res = 0;
   for(int i = 1; i <= n; i++)
   {
       res += (1/A[i]);
       //cout << res << endl;
   }
   res = (1/res);
   printf("%0.6f\n", res);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define clr(a,x) memset(a,x,sizeof(a))
using namespace std;

const int N=(1<<19)+5,mod=1e9+7;

int n,m,k,d,bits[N],f[2][N]={1},a[22][20];
inline int calc(int x){return bits[x&-x];}
inline int ch(int &x,int y){x=(x+y)%mod;}

int main(){
	cin>>n>>m>>k;
	n--;clr(a,-1);
	for(int i=0;i<=n;i++)
		bits[1<<i]=i;
	for(int i=1;i<=k;i++){
		int a,b,c;
		cin>>a>>b>>c;
		b--;::a[a][b]=c;
	}for(int i=1;i<=m;i++)
		for(int j=0;j<n;j++,d^=1){
			clr(f[d^1],0);
			for(int k=0;k<(1<<n);k++){
				if(!f[d][k]) continue; 
				if(a[i][j]!=0) 	
					if(k>>j) ch(f[d^1][k^(1<<j)^(1<<calc(k>>j)+j)],f[d][k]); else ch(f[d^1][k^(1<<j)],f[d][k]);
				if(a[i][j]!=1&&!(k&(1<<j)))	ch(f[d^1][k],f[d][k]);
			}
		}
	int ans=0;
	for(int i=0;i<(1<<n);i++) ch(ans,f[d][i]);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4480
#include <iostream>
#include <string>
#include <math.h>

typedef long long ll;

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

    int slen;
    slen = S.length();

    for(int i=0;i<slen;i++){
        std::cout << "x";
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
sz=[0,2,5,5,4,5,6,3,7,6]
l=[]
dp=[0]*(n+1)
l=list(map(int,input().split()))
l.sort(reverse=True)
dp[0]=1
for i in range(1,n+1):
    for j in l:
        if i-sz[j]>=0 and dp[i-sz[j]]>0:
            dp[i]=max(dp[i],1+dp[i-sz[j]])
#print(dp)
ans=[]
#using the dp table construct the number 
cur=n
while cur>0:#cur denotes count of available match sticks
 #   print(cur)
    for j in l:
        if cur-sz[j]>=0:
            if dp[cur]==1+dp[cur-sz[j]] and dp[cur-sz[j]]>0:
                ans.append(j)
                cur-=sz[j]
                break
ans.sort(reverse=True)
print(''.join(map(str,ans)))




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

using namespace std;

typedef long long 		ll;
typedef vector<ll> 		vll;
typedef pair<ll,ll> 	pll;
typedef vector<pll> 	vpll;
typedef vector<int> 	vi;
typedef pair<int,int> 	pii;
typedef vector<pii> 	vpii;

#define fi				first
#define se 				second
#define pb 				push_back
#define mp 				make_pair
#define all(v)			v.begin(),v.end()
#define sz(v)			s.size()
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define per(i,a,b) 		for(int i=a;i>=b;i--)
#define fill(a,v)		memset(a,v,sizeof(a))
#define tc				int T;cin>>T;while(T--)
#define nl				printf("\n")
#define aya				printf("yaha aya\n")
#define debug(x,y)		printf("%d %d\n",x,y)

const int mod = 1e9+7;
const int mod2= 1e9+9;

inline int pow_(ll a, int n, int p=mod){
	int r=1;while(n){if(n&1)r=r*a%p;n>>=1;a=a*a%p;}return r;
}

int main(void)
{
	int n,k;cin>>n>>k;
	int cost[n+1];
	fill(cost,0);
	int h[n+1];
	rep(i,1,n) cin>>h[i];
	cost[1] = 0;
	if(n==1) return 0*printf("0");
	rep(i,2,n)
	{
		cost[i] = 1e9;
		per(j,i-1,max(1,i-k))
			cost[i] = min(cost[i],cost[j]+abs(h[j]-h[i]));
	}
	int ans = cost[n];
	cout<<ans<<"\n";

}

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

int main() {
    int K, S; cin>>K>>S;
    long long ans=0;
    rep(i,K) {
        int s=S-i;
        if (s > 2*K) continue;
        else {
            int t=0;
            rep(j,K) {
                int ss=s-j;
                if (K >= ss && ss >= 0) t++;
            }
            ans += t;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input {(source=$s:expr,$($r:tt)*) => {let mut iter=$s.split_whitespace(); let mut next=||{iter.next().unwrap()}; input_inner! {next,$($r)*}};($($r:tt)*) => {let stdin=std::io::stdin();let mut bytes=std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next=move||->String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()}; input_inner! {next,$($r)*}};}
#[allow(unused_macros)]
macro_rules! input_inner {($next:expr) => {}; ($next:expr,) => {}; ($next:expr,$var:ident:$t:tt$($r:tt)*) => {let $var=read_value!($next,$t); input_inner! {$next$($r)*}};}
#[allow(unused_macros)]
macro_rules! read_value {($next:expr,($($t:tt),*)) => {($(read_value! ($next,$t)),*)}; ($next:expr, [$t:tt; $len:expr]) => {(0..$len).map(|_|read_value! ($next,$t)).collect::<Vec<_>>()}; ($next:expr,chars) => {read_value! ($next,String).chars().collect::<Vec<char>>()}; ($next:expr,usize1) => {read_value! ($next,usize)-1}; ($next:expr,$t:ty) => {$next().parse::<$t>().expect("Parse error")};}

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

#[allow(dead_code)]
const MAX: usize = 100006;
#[allow(dead_code)]
const INF_U32: u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32: i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64: u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64: i64 = 1 << 62;
#[allow(dead_code)]
const MOD: i64 = 1e9 as i64 + 7;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{s:chars};
    let mut ch = s[0];
    let mut ans = 0i64;
    for el in s {
        if el != ch {
            ans += 1;
            ch = el;
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct data{
  struct data *next;
  long xdeff;
  long ydeff;
  int num;
} cell;

long x[52],y[52],v[52][52],w[52][52];

cell *make(long v,long w);

int main(void){
  int N,i,j,max;
  long maxp,maxq;
  char str[100],*p;
  cell *q,s;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  
  for(i=0;i<N;i++){
    fgets(str,sizeof(str),stdin);
    p=strtok(str," \n");
    x[i]=atol(p);
    p=strtok(NULL," \n");
    y[i]=atol(p);
  }
  
  s.next=NULL;
  
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(i!=j){
        v[i][j]=x[i]-x[j];
        w[i][j]=y[i]-y[j];
        q=s.next;
        while(q!=NULL){
          if(q->xdeff==v[i][j] && q->ydeff==w[i][j]){
            q->num++;
            break;
          }
          q=q->next;
        }
        if(q==NULL){
          q=make(v[i][j],w[i][j]);
          q->next=s.next,s.next=q;
        }
      }
    }
  }
  
  max=0,q=s.next;
  
  while(q!=NULL){
    if(max<q->num){
      max=q->num,maxp=q->xdeff,maxq=q->ydeff;
    }
    q=q->next;
  }
  
  
  printf("%d\n",N-max);
  
  return 0;
}

cell *make(long v,long w){
  cell *p;
  p=malloc(sizeof(cell));
  p->xdeff=v;
  p->ydeff=w;
  p->num=1;
  return p;
}

Measured memory_bytes: 384
main = do
    s  <- getLine
    print $ f s
    

f s | s == "SAT" = 1
    | s == "FRI" = 2
    | s == "THU" = 3
    | s == "WED" = 4
    | s == "TUE" = 5
    | s == "MON" = 6
    | otherwise = 7

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

const std::vector<std::string>
    ts = {"pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"};

void solve() {
    int n;
    std::cin >> n;
    std::cout << ts[n % 10] << "\n";
}

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

    solve();

    return 0;
}


Measured memory_bytes: 3612
// https://atcoder.jp/contests/abc139/tasks/abc139_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    double a, b;
    cin >> a >> b;
    cout << ceil((b - 1) / (a - 1)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;

long long cnt;
int l;
int A[1000000];
int n;
vector<int> G;

// 間隔gを指定した挿入ソート
void insertionSort(int A[], int n, int g) {
    for ( int i = g; i < n; i++ ) {
        int v = A[i];
        int j = i - g;
        while ( j >= 0 && A[j] > v ) {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
}

void shellSort(int A[], int n) {
    //数列G = {1, 4, 13, 40, 121, 364, 1093,...}を生成
    for ( int h = 1;; ) {
        if ( h > n ) break;
        G.push_back(h);
        h = 3*h + 1;
    }
    
    for ( int i = G.size()-1; i >= 0; i-- ) { // 逆順にG[i] = gを指定
    insertionSort(A, n, G[i]);
    }
}

int main(void) {
    cin >> n;
    // より速い入力scanf関数を使用
    for ( int i = 0; i < n; i++ ) scanf("%d", &A[i]);
    cnt = 0;

    shellSort(A, n);

    cout << G.size() << endl;
    for ( int i = G.size() - 1; i >= 0; i-- ) {
        printf("%d", G[i]);
        if( i ) printf(" ");
    }
    printf("\n");
    printf("%d\n", cnt);
    for ( int i = 0; i < n; i++ ) printf("%d\n", A[i]);

    return 0;
}


Measured memory_bytes: 7172
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let h = read_as_vec::<usize>()[0];
    let w = read_as_vec::<usize>()[0];
    let n = read_as_vec::<usize>()[0];
    let long = cmp::max(h, w);

    println!("{}", (n+long-1)/long);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

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

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

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

print(0)
s = input()
if s == 'Vacant':
  quit()

root = 0
num = N - 1 # root以外の席数 (<- 偶数)
while True:
  n = num // 2
  print((root + n)%N)
  _s = input()
  if _s == 'Vacant':
    quit()
  if (s==_s and n%2==0) or (s!=_s and n%2==1):
    root += n
    s = _s
    num = n + (n%2==1)
  else:
    num = n - 1 + (n%2==0)

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define FASTIO() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N = 2005, M = 1000000007, BIG = 0x3f3f3f3f;

int ct = 0;
int n, x, y;

bool Read() {
  cin >> n;
  if (cin.eof())
    return 0;
  cin >> x >> y;

  return 1;
}

void Process() {
  int k[N];
  memset(k, 0, sizeof k);
  int red = y - x - 1, d;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      d = min(j - i, abs(x - i) + 1 + abs(j - y));
      k[d]++;
    }
  for (int i = 1; i < n; i++)
    cout << k[i] << "\n";
}

int main() {
  FASTIO();

  while (Read())
    Process();

  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) = println(run {
    tailrec fun gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
    readLine()
    val a = readLine()!!.split(" ").map { it.toInt() }
    a.reduce { a, b -> gcd(a, b) }
})

Measured memory_bytes: 53648
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        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, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($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) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::min;

fn main() {
    input! {
        n: usize,
    }
    let mut ans = n;
    for i in 1..((n as f64).sqrt() as usize) + 1 {
        if n % i == 0 {
            ans = min(ans, i + (n / i) - 2);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
//saikyogakusei1_b.cpp
//Sun Sep 15 10:20:08 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll a[n];
	for (int i=0;i<n;i++){
		cin >> a[i];
	}

	ll within[n];
	ll later[n];
	fill(within,within+n,0);
	fill(later,later+n,0);

	for (int i=0;i<n;i++){
		for (int j=0;j<n;j++){
			if (a[i]>a[j]){
				within[i]++;
				if (i<j){
					later[i]++;
				}
			}
		}
	}

	ll ans = 0;
	ll MOD = 1000000007;
	for (int i=0;i<n;i++){
		ll temp1 = k*later[i]%MOD;
		ll temp2 = (k*(k-1)/2)%MOD*within[i];
		ans = (ans+temp1+temp2)%MOD;
	}


	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 384
function main(input) {
  	const total = parseInt(input.split('\n')[0], 10)
    let num = 0
	
	for(let a = 1; a < total; a++) {
		for(let b = 1; b < total; b++) {
          	if(a*b > total-1) break
            num++
	  	}
	}

	console.log(num)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 32196
#include <stdio.h>
#include <string.h>
int main(){
  int a, b;

  scanf("%d%d", &a, &b);

  if(a + b == 15){
    printf("+");
  }else if(a * b == 15){
    printf("*");
  }else{
    printf("x");
  }

  printf("\n");


}


Measured memory_bytes: 128
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

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

mod = 1000000007

if __name__ == "__main__":
    A, B, C = map(int, sys.stdin.readline().split())
    cnt = 0
    while True:
        if B < A or cnt >= C:
            print(cnt)
            exit()
        B -= A
        cnt += 1

Measured memory_bytes: 5612