akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1000000007;
const ll N=998244353;
ll power(ll x,ll n){ll res=1;while(n>0){if(n&1) res=res*x%MOD;x=x*x%MOD;n>>=1;}return res;}
ll modinverse(ll a){return power(a, MOD-2);}
void solve()
{
    string str;
    cin>>str;
    ll sum=0;
    forr(i, str.length())
    {
    	sum+=str[i]-'0';
    	sum%=9;
    }
    if(sum==0)
    	cout<<"Yes\n";
    else
    	cout<<"No\n";
}
int main()
{
	#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3972
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7
  10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理
  でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
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; }

int main(int argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;

    n %= 10;

    if (n == 2 || n == 4 || n==5 || n == 7 || n == 9) {
        cout << "hon";
    }
    else if (n ==3) {
        cout << "bon";
    }
    else {
        cout << "pon";
    }


    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));  // 2次元配列初期化
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
 
public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] A = new int[9];
        for (int i = 0; i < A.length; i++) {
            A[i] = sc.nextInt();
        }
        int N = sc.nextInt();
        List<Integer> B = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            B.add(sc.nextInt());
        }
        if (N < 3) {
            System.out.println("No");
        } else if (B.contains(A[0] ) && B.contains(A[1]) && B.contains(A[2])) {
            System.out.println("Yes");
        } else if (B.contains(A[0] ) && B.contains(A[4]) && B.contains(A[8])) {
            System.out.println("Yes");
        } else if (B.contains(A[0] ) && B.contains(A[3]) && B.contains(A[6])) {
            System.out.println("Yes");
        } else if (B.contains(A[1] ) && B.contains(A[4]) && B.contains(A[7])) {
            System.out.println("Yes");
        } else if (B.contains(A[2] ) && B.contains(A[5]) && B.contains(A[8])) {
            System.out.println("Yes");
        } else if (B.contains(A[2] ) && B.contains(A[4]) && B.contains(A[6])) {
            System.out.println("Yes");
        } else if (B.contains(A[3] ) && B.contains(A[4]) && B.contains(A[5])) {
            System.out.println("Yes");
        } else if (B.contains(A[6] ) && B.contains(A[7]) && B.contains(A[8])) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

typedef long long int lli;
typedef pair<int, int> ii;
#define mkpr make_pair

const int N = 405;
int n;
pair<ii, ii> c[N];

map<pair<ii, ii>, int> gesicht;

pair<ii, ii> rotate(pair<ii, ii> f) {
	pair<ii, ii> fans = f;

	int tmp = fans.second.second;
	fans.second.second = fans.second.first;
	fans.second.first = fans.first.second;
	fans.first.second = fans.first.first;
	fans.first.first = tmp;

	return fans;
}

int main() {
	cin >> n;
	int c0, c1, c2, c3;
	for(int i = 0; i < n; i++) {
		cin >> c0 >> c1 >> c2 >> c3;
		c[i] = mkpr(mkpr(c0, c1), mkpr(c2, c3));
		pair<ii, ii> tmp = c[i];
		for(int j = 0; j < 4; j++) {
			if(gesicht.find(c[i]) == gesicht.end()) gesicht.insert(mkpr(c[i], 1));
			else gesicht[c[i]]++;
			c[i] = rotate(c[i]);
		}
	}

	lli ans = 0;

	for(int f1i = 0; f1i < n; f1i++) {
		pair<ii, ii> f1 = c[f1i];
		for(int f4i = f1i+1; f4i < n; f4i++) {
			pair<ii, ii> f4 = c[f4i];
			for(int rot = 0; rot < 4; rot++) {
				lli partAns = 1;
				pair<ii, ii> f2, f3, f5, f6;
				f2 = mkpr(mkpr(f1.first.second, f4.first.first), mkpr(f4.second.second, f1.second.first));
				f3 = mkpr(mkpr(f1.second.first, f4.second.second), mkpr(f4.second.first, f1.second.second));
				f5 = mkpr(mkpr(f1.second.second, f4.second.first), mkpr(f4.first.second, f1.first.first));
				f6 = mkpr(mkpr(f1.first.first, f4.first.second), mkpr(f4.first.first, f1.first.second));

				int matches = 0;
				for(int subrot = 0; subrot < 4; subrot++) {
					if(f2 == f1) matches++; if(f2 == f4) matches++;
					f1 = rotate(f1); f4 = rotate(f4);
				}
				partAns *= (gesicht[f2]-matches);

				matches = 0;
				for(int subrot = 0; subrot < 4; subrot++) {
					if(f3 == f1) matches++; if(f3 == f4) matches++; if(f3 == f2) matches++;
					f1 = rotate(f1); f4 = rotate(f4); f2 = rotate(f2);
				}
				partAns *= (gesicht[f3]-matches);

				matches = 0;
				for(int subrot = 0; subrot < 4; subrot++) {
					if(f5 == f1) matches++; if(f5 == f4) matches++; if(f5 == f2) matches++; if(f5 == f3) matches++;
					f1 = rotate(f1); f4 = rotate(f4); f2 = rotate(f2); f3 = rotate(f3);
				}
				partAns *= (gesicht[f5]-matches);

				matches = 0;
				for(int subrot = 0; subrot < 4; subrot++) {
					if(f6 == f1) matches++; if(f6 == f4) matches++; if(f6 == f2) matches++; if(f6 == f3) matches++; if(f6 == f5) matches++;
					f1 = rotate(f1); f4 = rotate(f4); f2 = rotate(f2); f3 = rotate(f3); f5 = rotate(f5);
				}
				partAns *= (gesicht[f6]-matches);

				ans += partAns;
				f4 = rotate(f4);
			}
		}
	}

	ans /= 3; //Answers are overcounted twice
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 80128
using System;
namespace AtConderCSharp
{
    class Program
    {
        public static void Main()
        {
            var x = Console.ReadLine().Split(' ');
            int h = int.Parse(x[0]);
            int a = int.Parse(x[1]);
            if(h%a == 0)
            {
                Console.WriteLine(h / a);
            }
            else
            {
                Console.WriteLine(h / a + 1);
            }
            
        }
    }
}

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

using namespace std;

typedef long long LL;

const LL mod=1000000007;
LL n,i3,in,ans;

void upd(LL &x,LL y){x=(x+y)%mod;}

LL inv(LL x){return x==1?1:(mod-mod/x)*inv(mod%x)%mod;}

int main(){
	scanf("%lld",&n);
	i3=inv(3); in=inv(n);
	for (LL i=1,k=1;i<=n;++i){
		k=k*i3%mod;
		upd(ans,k*in%mod*inv(n-i+1));
	}
	printf("%lld\n",ans);
	
	return 0;
}
			

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

#define endl '\n'
#define ll  long long
#define modd(a,b) ((a+2*b)%b)
#define ioso ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define debug(a) cout << #a << ": " << (a) << "\n"
#define ffe freopen("input.txt","r",stdin), freopen("output.txt","w",stdout)
ll mod = 1000000007;

int main() {
	ioso;
	#ifndef ONLINE_JUDGE
	ffe;
	#endif

	ll n;
	cin >> n;
	ll ans = 100,k=0;
	for(int i=1;i<=3800;i++) {
		ans += (ans/100);
		if(ans>=n) { k=i;break;}
	}

	cout << k << endl;
	
	
}

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

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

int main(){
   int n;
   cin >> n;
   if (n%10==3){
       cout << "bon" << endl;
   }else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
       cout << "pon" << endl;
   }else{
       cout << "hon" << endl;
   }
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N;
    cin >> N;
    vector<int> edges[200000];
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    create_mod_tables(200000);

    // 1回目のDFS
    vector<int> num(N);
    vector<int64_t> dp(N);
    auto dfs1 = [&](auto&& dfs1, int i, int p)->void{
        dp[i] = 1;
        for(int j : edges[i]) if(j != p){
            dfs1(dfs1, j, i);
            num[i] += num[j];
            mul(dp[i], dp[j] * comb_mod(num[i], num[j]) % MOD);
        }
        num[i]++;
    };
    dfs1(dfs1, 0, -1);

    // 答えを求める2回目のDFS。引数uが、iの親pの「iの子としての」dp[p]の値を示す
    vector<int64_t> ans(N);
    auto dfs2 = [&](auto&& dfs2, int i, int p, int64_t u)->void{
        // pを子としてマージするときの係数を掛けて答えとする
        ans[i] = dp[i] * u % MOD * comb_mod(N-1, N-num[i]) % MOD;
        
        for(int j : edges[i]) if(j != p){
            // ans[i]から子jのマージの逆操作をした値を次に渡す
            int64_t u2 = ans[i] * inv_mod(dp[j]) % MOD * inv_mod(comb_mod(N-1, num[j])) % MOD;
            dfs2(dfs2, j, i, u2);
        }
    };
    dfs2(dfs2, 0, -1, 1);

    for(int i=0; i<N; i++) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 22516
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make(map[int]int, 0)
	for i := 0; i < n; i++ {
		var num int
		fmt.Scan(&num)
		a[num]++
	}
	flag := true
	for _, e := range a {
		if e >= 2 {
			flag = false
			break
		}
	}
	if flag {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}

Measured memory_bytes: 13056
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define llp 1000000007
#define mod 1000000007

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;


int main(){
	ios::sync_with_stdio(false);

    string s;
    cin>>s;
    vector<char>a;
    ll ans=0;
    for(int i=0;i<s.size();i++){
        if(a.size()==0){
            a.PB(s[i]);
        }
        else{
            if(a[a.size()-1]!=s[i]){
                ans+=2;
                a.pop_back();
            }
            else{
                a.PB(s[i]);
            }
        }
    }
    cout<<ans<<"\n";


	return 0;
}   

Measured memory_bytes: 592
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    vector<int> niz(n);
    for (int i = 0; i < n; i++)
        cin >> niz[i];

    vector<int> niz2(niz);
    sort(niz2.begin(), niz2.end());

    int cnt = 0;
    for (int i = 0; i < n; i++)
    {
        if (niz[i] != niz2[i])
            cnt++;
        if (cnt > 2)
        {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n;

signed main() {
	cin >> n;
	cout << "Christmas";
	rep(i,25-n) cout << " Eve";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define pi acos(-1)
#define int long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<int> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const int ths = 1LL << 40;
const int NN = 5e3 + 6;

const int maxN = 1000007;

///constructive algorithm
/// A k A' K
///where A is a sequence of numbers from 0 to 2 ^ m - 1 except for k and A' is the sequence A in reverse order
///using that the xor from 1 upto n is 0 if n is a multiple of 4


void solve()
{

    int m, k;
    cin>>m>>k;
    if(m == 0 )  {
        if(k == 0) {
            cout<<"0 0";
        }
        else {
            cout<<-1;
        }
        return ;
    }

    if(m == 1) {
        if(k == 0) {
            cout<<"0 0 1 1";
        }
        else
            cout<<-1;
        return ;
    }

    if(k >= (1 << m)) {
        cout<<-1;
        return ;
    }

    vector<int> v;

    for(int i = 0 ; i < (1 << m); i ++) {
        if(i != k) {
            v.push_back(i);
        }
    }

    for(auto it : v) {
        cout<<it<<' ';
    }
    cout<<k<<' ';
    reverse(v.begin(), v.end());
    for(auto it : v)
        cout<<it<<' ';
    cout<<k;

    cout<<"\n";
    return ;
}

/*
*/

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 2932
#include <cstdio>
const int MAXN = 2e5+1;
const int MAXM = 4002;
const int ZERO = 2001;
const int mo = 1e9+7;
int F[MAXM][MAXM];
int fac[MAXM<<1], env[MAXM<<1];
int x[MAXN], y[MAXN];
typedef long long LL;
int pow(int x, int y)
{
	int res = 1;
	while (y)
	{
		if(y&1) res = LL(res) * x % mo;
		x = LL(x) * x % mo;
		y >>= 1;
	}
	return res;
}
void init()
{
	fac[0] = env[0] = 1;
	for(int i=1; i<MAXM<<1; ++i)
	{
		fac[i] = LL(fac[i-1]) * i % mo;
		env[i] = pow(fac[i], mo-2);
	}
}
#define C(n,m) (LL(fac[(n)]) * env[(m)] % mo * env[(n)-(m)])
int main()
{
	init();
	int N, i, j;
	scanf("%d", &N);
	for(i=0; i<N; ++i)
	{
		scanf("%d%d", x+i, y+i);
		++F[ZERO-x[i]][ZERO-y[i]];
	}
	for(i=1; i<MAXM; ++i)
		for(j=1; j<MAXM; ++j)
			F[i][j] = (F[i][j] + F[i][j-1] + F[i-1][j]) % mo;
	int ans = 0;
	for(i=0; i<N; ++i)
	{
		ans = (ans + F[ZERO+x[i]][ZERO+y[i]]) % mo;
		ans = (ans - C((x[i]+y[i])<<1,x[i]<<1)) % mo;
	}
	ans = LL(ans) * pow(2, mo-2) % mo;
	printf("%d\n", (ans + mo) % mo);
}



Measured memory_bytes: 64384
use std::io;
use std::io::prelude::*;

fn main() {
    let stdin = io::stdin();
    let lock = stdin.lock();
    let mut lines = lock.lines();

    let mut state = 0u64;

    let q = lines.next().unwrap().unwrap().parse().unwrap();

    for (_, l) in (0..q).zip(lines) {
        let l = l.unwrap();
        let mut sw = l.split_whitespace();
        let com = sw.next().unwrap().parse().unwrap();
        let i = sw.next();
        match com {
            0 => {
                let i: u8 = i.unwrap().parse().unwrap();
                println!("{}", if state & (1 << i) != 0 { 1 } else { 0 });
            }
            1 => {
                let i: u8 = i.unwrap().parse().unwrap();
                state |= 1 << i;
            }
            2 => {
                let i: u8 = i.unwrap().parse().unwrap();
                state &= !(1 << i);
            }
            3 => {
                let i: u8 = i.unwrap().parse().unwrap();
                state ^= 1 << i;
            }
            4 => {
                println!("{}", if state == 0xffffffffffffffff { 1 } else { 0 });
            }
            5 => {
                println!("{}", if state != 0 { 1 } else { 0 });
            }
            6 => {
                println!("{}", if state == 0 { 1 } else { 0 });
            }
            7 => {
                println!("{}", state.count_ones());
            }
            _ => {
                println!("{}", state);
            }
        }
    }
}



Measured memory_bytes: 5052
city_num, road_num = tuple(int(i) for i in input().split(" "))
city_road_list = [0 for i in range(city_num)]
for i in range(road_num):
    city_1, city_2 = tuple(int(i) for i in input().split(" "))
    city_road_list[city_1 - 1] += 1
    city_road_list[city_2 - 1] += 1
for i in city_road_list:
    print(i)


Measured memory_bytes: 2940
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <deque>
#define N_MAX 100005

using namespace std;
typedef long long ll;

int main(){
	int N;
  	cin >> N;
	vector<ll> A;
  	deque<ll> d;
  	for(int i = 0; i < N; i++){
      	ll a;
    	cin >> a;
      	A.push_back(a);
    }
	for(int i = 0; i < N; i++){
    	int p = lower_bound(d.begin(), d.end(), A[i])-d.begin();
    	if(p == 0) d.push_front(A[i]);
      	else d[p-1] = A[i];
    }
  	int ans = d.size();
  	cout << ans << endl;
}

Measured memory_bytes: 1908
#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#define rep1(i,N) for(int i=1;i<=(int)N;i++)
#define pb push_back
#define chmax(x,y) x=max(x,y)
using namespace std;
vector<int> ds;
int N,a[200000];
int main(){
	cin>>N;
	rep(i,N) cin>>a[i];
	for(int j=1;j*j<=N;j++){
		if(N%j==0){
			ds.pb(j);
			if(j*j!=N) ds.pb(N/j);
		}
	}
	int ans=0;
	for(int d:ds){
		bool ok=1;
		rep(i,N-d) if(a[i]!=a[i+d]) ok=0;
		if(ok) chmax(ans,N/d);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3928
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <ctime>
#include <iomanip>
#include <set>
#include <iterator>
#include <map>
using namespace std;

#define pb push_back

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define for1(i, n) for(int i = 1; i <= (int)(n); i++)

typedef vector<int> vi;

const int INF = 1e9 + 5;


int main()
{
	int n;
	cin >> n;
	vi dp(3);
	for (int day = 0; day < n; day++)
	{
		vi new_dp(3, 0);
		vi c(3);
		for (int i = 0; i < 3; i++)
			cin >> c[i];
		for (int i = 0; i < 3; i++)
			for (int j = 0; j < 3; j++)
				if (i != j)
					new_dp[j] = max(new_dp[j], dp[i] + c[j]);
		dp = new_dp;
	}
	cout << max({ dp[0], dp[1], dp[2] });
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSnukeFestival solver = new CSnukeFestival();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSnukeFestival {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int n = in.ints();
            int[] a = in.ints(n), b = in.ints(n), c = in.ints(n);
            Arrays.sort(a);
            Arrays.sort(b);
            Arrays.sort(c);
            long ans = 0;
            long[] v = new long[n + 1];
            for (int i = n - 1; i >= 0; i--) {
                v[i] = v[i + 1] + n - ArrayUtil.upperBound(c, b[i]);
            }
            for (int i = 0; i < n; i++) {
                ans += v[ArrayUtil.upperBound(b, a[i])];
            }
            out.println(ans);
        }

    }

    static final class ArrayUtil {
        private ArrayUtil() {
        }

        public static int upperBound(int[] a, int t, int min) {
            int max = a.length;
            while (min < max) {
                final int mid = (min + max) / 2;
                if (t >= a[mid]) {
                    min = mid + 1;
                } else {
                    max = mid;
                }
            }
            return min;
        }

        public static int upperBound(int[] a, int t) {
            return upperBound(a, t, 0);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

    }
}



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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    set<string> st;
    for(int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        st.insert(s);

    }
    cout << st.size() << endl;
    return 0;
}



Measured memory_bytes: 19204
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
// #pragma GCC optimize ("Ofast,unroll-loops,-ffloat-store")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")

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

string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
    #define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 3
#endif
 
#define cin_exception cin.exceptions(cin.failbit);
#define cout_precision cout.setf(ios::fixed); cout.precision(15);
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using ld = long double; using vi = vector<int>;
using ll = int_fast64_t; using ull = uint_fast64_t;
using vl = vector<ll>; using vul = vector<ull>;

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

void solve() {
    string s; cin >> s;
    int n = s.length();
    int a = 0, b = n / 2 - 1, c = n / 2 + 1, d = n - 1;
    while (a <= b) {
        if (s[a] != s[b] || s[b] != s[c] || s[c] != s[d]) {
            cout << "No\n";
            return;
        }
        ++a; --b; ++c; --d;
    }
    cout << "Yes\n";
}

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

int main() {
    fast_io;
#ifdef LOCAL
    cin_exception;
#endif
    int t = 1;
    // cin >> t;
    // preprocess();
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
#import heapq
#from fractions import gcd
#from collections import defaultdict
#sys.setrecursionlimit(10**9)
#map(int,input().split())

def f0(x):
    if x%4==0:
        return x
    elif x%4==1:
        return 1
    elif x%4==2:
        return x+1
    else:
        return 0


def main():
    a,b=map(int,input().split())
    A=f0(a-1)
    B=f0(b)
    print(A^B)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;

int main(){
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
	// #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    double n,k;cin>>n>>k;
    double ans=0;
    for(double i=1;i<=n;++i){
    	if(i<k){
	    	double x=ceil(k/i);
	    	x=ceil(log(x)/log(2));
	    	ans+=pow(0.5,x);
	    }
	    else{
	    	ans+=1;
	    }
    }
    ans*=1/n;
    cout<<setprecision(20)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
n=int(input())
use=0
for i in range(10000):
    if i*(i+1)>=2*n:
        use=i
        break
      
lists=[ i for i in range(1,use+1)]
distance=sum(lists)-n
while distance>0:
    for j in lists:
        if distance==j:
            lists.remove(j)
            distance-=j
for some in lists:
  print(some)

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

class UnionFind {
private:
  int sz;
  vector<int> par, siz;
public:
  UnionFind() {}
  UnionFind(int n) : sz(n), par(sz), siz(sz, 1) {
    iota(par.begin(), par.end(), 0);
  }
  int root(int x) {
    if (par.at(x) == x) return x;
    else return par.at(x) = root(par.at(x));
  }
  void unit(int x,int y) {
    x = root(x), y = root(y);
    if (x == y) return;
    if (siz.at(x) < siz.at(y)) swap(x, y);
    par.at(y) = x;
    siz.at(x) += siz.at(y);
  }
  int size(int x) {
    x = root(x);
    return siz.at(x);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
};

int main() {
  int N, M;
  cin >> N >> M;
  UnionFind UF(N);
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A--, B--;
    UF.unit(A, B);
  }
  int mx = 0;
  for (int i = 0; i < N; i++) {
    mx = max(mx, UF.size(i));
  }
  cout << mx << "\n";
}

Measured memory_bytes: 4776
using System;

class plogram
{
    static void Main()
    {

        string str = Console.ReadLine();
        string[] array = str.Split(' ');

        int age = int.Parse(array[0]);
        int fee = int.Parse(array[1]);

        if(age<=5)
        {
            fee = 0;
        }
        else if(age<=12)
        {
            fee /= 2;
        }

        Console.WriteLine(fee);
    }
}

Measured memory_bytes: 11092
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

struct Node {
  int x;
  Node *l, *r;
};

int nm(string::iterator &it){
  int x = 0;
  while (isdigit(*it)){
    x *= 10;
    x += *it - '0';
    ++it;
  }
  return x;
}

Node *dfs(string::iterator &it){
  if (*it != '('){
    ++it;
    return nullptr;
  }
  ++it;
  auto l = dfs(it);
  ++it;
  int x = nm(it);
  ++it, ++it;
  auto r = dfs(it);
  ++it;
  return new Node{x, l, r};
}

string dfs2(Node *v, Node *u){
  if (v == nullptr || u == nullptr) return "";
  auto l = dfs2(v->l, u->l);
  auto x = to_string(v->x + u->x);
  auto r = dfs2(v->r, u->r);
  return "(" + l + ")[" + x + "](" + r + ")";
}

int main(){
  string s, t;
  cin >> s >> t;
  auto it1 = s.begin(), it2 = t.begin();
  auto a = dfs(it1), b = dfs(it2);
  cout << dfs2(a, b) << endl;
}

Measured memory_bytes: 3300
import sys
input=sys.stdin.readline
s=input().rstrip()
q=int(input())
count=0
pre=[]
post=[]
for i in range(q):
    l=input().split()
    if len(l)==1:
        count+=1
    else:
        f=int(l[1])
        c=l[2]
        if count%2==0:
            if f==1:
                pre.append(c)
            else:
                post.append(c)
        else:
            if f==1:
                post.append(c)
            else:
                pre.append(c)
if count%2==0:
    pre.reverse()
    for i in pre:
        print(i,end='')
    print(s,end='')
    for i in post:
        print(i,end='')
else:
    post.reverse()
    for i in post:
        print(i,end='')
    n=len(s)
    for i in range(n-1,-1,-1):
        print(s[i],end='')
    for i in pre:
        print(i,end='')





Measured memory_bytes: 84444
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int main() {
  int coin=0;
  int A, B;

  cin >> A >> B;

  for(int j =0; j<2; j++){
    
    if(A > B){
      coin = coin + A;
      A--;
    }else if(B > A){
      coin = coin + B;
      B--;
    }else if(A == B){
      coin = coin + A;
      A--;
    }
  }

  cout << coin << endl;

}


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

int main(){
    int r;
    cin >> r;
    cout << r*r << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <time.h>
#include <queue>
#include <stdarg.h>
#include <map>
#include <vector>
#include <algorithm>
#include <stack>
#include <iostream>
#include <numeric>
#include <set>

#define ll long long

using namespace std;

void
solve() {
  ll n, m;
  cin>>n>>m;

  vector<vector<ll>> link(n+1, vector<ll>());
  ll a, b; 
  for (int i=0; i<m; i++) {
    cin>>a>>b;
    link[a].push_back(b);
    link[b].push_back(a);
  }

  vector<ll> cnt(n+1, 0);
  vector<bool> vis(n+1, false);
  vis[1] = 0;
  cnt[1] = 0;

  queue<ll> data;
  data.push(1);
  while (data.size() > 0) {
    auto p = data.front();
    data.pop();

    for (ll next : link[p]) {
      if (vis[next]) continue;
      vis[next] = true;
      cnt[next] = p;
      data.push(next);
    }
  }

  bool valid = true;
  for (int i=2; i<=n; i++)
    if (cnt[i] == 0) {
      valid = false;
      break;
    }

  if (!valid)
    cout<<"No"<<endl;
  else {
    cout<<"Yes"<<endl;
    for (int i=2; i<=n; i++)
      cout<<cnt[i]<<endl;
  }
}

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

  int t = 1;
  //cin>>t;

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

  return 0;
}



Measured memory_bytes: 12940
#include <stdio.h>

int main(void){
	double r1, r2, r3;
	
	scanf("%lf %lf", &r1, &r2);
	
	r3 = (r1*r2)/(r1+r2);
	
	printf("%.10lf\n", r3);
	
	return 0;
}

Measured memory_bytes: 128
#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;
  cin >> a >> b;
  int ie = b - a;
  int he = 0;
  for (int i = 1; i <= ie; i++) he += i;
  int ans = he - b;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3616
# C
N = int(input())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
ans = N - 1
lst = make_divisors(N)
if (len(lst) % 2 == 0):
    for i in range(0, len(lst), 2):
        num = lst[i] + lst[i+1] - 2
        ans = min(ans,num)
else:
    for i in range(0, len(lst)-1, 2):
        num = lst[i] + lst[i+1] - 2
        ans = min(ans,num)
    ans = min(ans,2*lst[-1] - 2)
print(ans)

Measured memory_bytes: 39152
S = list(str(input()))
T = list(str(input()))
check = 1
bij1 = {}
bij2 = {}
for i in range(len(S)):
  if S[i] in bij1 and bij1[S[i]] != T[i]:
    check = 0
    break
  elif T[i] in bij2 and bij2[T[i]] != S[i]:
    check = 0
    break
  elif S[i] not in bij1 and T[i] not in bij2:
    bij1[S[i]] = T[i]
    bij2[T[i]] = S[i]
    
if check:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 6704
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<31)-1;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
//int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int a[1010];

int main(){
	while(1){
		cin>>n;
		if(n==0)break;
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		sort(a,a+n);
		int ans=INF;
		for(int i=0;i<n-1;i++){
			ans=min(ans,a[i+1]-a[i]);
		}
		cout<<ans<<endl;
	}
	return 0;
}


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



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

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;++i){
		int tmp;
		cin>>tmp;
		if(tmp%2)continue;
		if((tmp%3!=0)&&(tmp%5!=0)){
			cout<<"DENIED";
			return 0;
		}
	}
	cout<<"APPROVED";
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
S = list(input())

cnt = 0
init_s = S[0]
pre = '_'
for i, s in enumerate(S):
    if s != init_s:
        if pre != s:
            K -= 1
        if K == -1:
            break
        S[i] = init_s
    pre = s
ans = 0
pre = '_'
for s in S:
    ans += pre == s
    pre = s
print(ans)


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

using namespace std;
using lint = long long;

// dp[x][y]:x番目まで見て重さがyのときの価値の最大値
lint dp[105][100005];

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

    for (int w = 0; w <= Wmx; ++w) dp[0][w] = 0;
    for (int i = 1; i <= N; ++i) {
        lint w, v;
        cin >> w >> v;
        for (int j = 0; j <= Wmx; ++j) {
            if (j >= w) {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    cout << dp[N][Wmx] << endl;
    return 0;
}

Measured memory_bytes: 80128
N=int(input())
W=list(map(int,input().split()))
S=sum(W)
W1=[]
W2=[]
for i in range(N-1):
    W1=W[0:i+1]
    W2=W[i+1:N]
    if S >= abs(sum(W2)-sum(W1)):
        S = abs(sum(W2)-sum(W1))
print("{}".format(S))


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, S; cin >> N >> S;
	vector<int> a(N); rep(i, 0, N) { cin >> a[i]; }
	int r(0), l(0),sum(0);
	int ans(INF);
	while (r < N) {
		while (r < N&&sum < S) {
			sum += a[r++];
		}
		if(sum>=S)chmin(ans, r - l);
		while (l < r&&sum >= S) {
			chmin(ans, r - l);
			sum -= a[l++];
		}
	}
	cout << (ans == INF ? 0 : ans) << endl;
	return 0;
}

Measured memory_bytes: 3344
from collections import deque

anslist = deque()
for i in range(int(input())):
    query = list(map(int, input().split()))
    if query[0] == 0:
        if query[1] == 0:
            anslist.appendleft(query[2])
        elif query[1] == 1:
            anslist.append(query[2])
    elif query[0] == 1:
        print(anslist[query[1]])
    elif query[0] == 2:
        if query[1] == 0:
            anslist.popleft()
        elif query[1] == 1:
            anslist.pop()


Measured memory_bytes: 21976
ss = input()
l = ["dream","dreamer","erase","eraser"]
    
for i_1 in range(4):
    for i_2 in range(4):
        for i_3 in range(4):
            for i_4 in range(4):
                s = ss
                while l[i_1] in s or l[i_2] in s or l[i_3] in s or l[i_4] in s:
                    s = s.replace(l[i_1],"").replace(l[i_2],"").replace(l[i_3],"").replace(l[i_4],"")
                    if s == "":
                        print("YES")
                        exit()

if s != "":
    print("NO")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
	while(true){
		int N;
		scanf("%d",&N);
		if(N==0)return 0;
		int price[100];
		map<string,int>Map;
		for(int i=0;i<N;i++){
			string S;
			cin >> S;
			Map[S]=i;
			int P;
			scanf("%d",&P);
			price[i]=P;
		}
		int M;
		scanf("%d",&M);
		int gou[100][100];
		int K[100];
		for(int i=0;i<N;i++){
			K[i]=-1;
		}
		for(int i=0;i<M;i++){
			string S;
			cin >> S;
			scanf("%d",&K[Map[S]]);
			for(int j=0;j<K[Map[S]];j++){
				string S1;
				cin >> S1;
				gou[Map[S]][j]=Map[S1];
			}
		}
		while(true){
			bool F=false;
			for(int i=0;i<N;i++){
				if(K[i]==-1)continue;
				int sum=0;
				for(int j=0;j<K[i];j++){
					sum+=price[gou[i][j]];
				}
				if(sum<price[i]){
					F=true;
					price[i]=sum;
				}
			}
			if(!F)break;
		}
		string S;
		cin >> S;
		printf("%d\n",price[Map[S]]);
	}
	return 0;
}

Measured memory_bytes: 1280
N = int(input())
list = []

for i in range(1, N + 1):
    if i % 3 == 0 and i % 5 == 0:
        "FizzBuzz"
    elif i % 3 == 0:
        "Fizz"
    elif i % 5 == 0:
        "Buzz"
    else:
        list.append(i)
print(sum(list))

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


const ll mod = 1e9+7;
long double pi = 3.141592653589793238;
ll mulmod(ll x,ll y)
{
  return (x%mod*y%mod)%mod;
}


ll addmod(ll x,ll y)
{
  return (x%mod+y%mod)%mod;
}
void testcases()
{
  ll r;
  cin >> r ;
  long double area = (2.00)*(pi)*((long double)r);

  cout << setprecision(21) << fixed << area << "\n";
  
}



int main()
{
    ll t;
     t = 1;
    while(t--)
      testcases();
}

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

int main(){
  string a, b;
  cin >> a >> b;
  
  string S;
  S = a + b;
  
  int N = stoi(S);
  
  string ans = "No";
  
  for(int i=0; i<1000; i++){
    if(N == i*i){
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
string s;
ll k;
int main(){
	cin >> s >> k;
	for(int i=0;i<min(k,(ll)s.size());i++){
		if(s[i] - '0' > 1){
			cout << s[i] << endl;;
			return 0;
		}
	}
	cout << s[0] << endl;
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
import math
import re
import queue

input = stdin.readline

MOD = 1000000007
INF = 122337203685477580

def solve():
    A,B,C,K = map(int, input().split())

    x = ((-1)**(K%2))*(A- B)

    if(x>1e18):
        print("Unfair")

    print(x)
if __name__ == '__main__':
    solve()


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

int main() {
	int a, b, k;
	cin >> a >> b >> k;
	int ans = 0, i = 101; 
	while (i--) {
		if (a%i == 0 && b%i == 0) {
			ans++;
			if (ans == k) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long dp[100010][4]={},MOD=1000000007;
int main()
{
	string s,ABC="ABC";
	dp[0][0]=1;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if (s[i]=='?')
		{
			dp[i+1][0]=(dp[i][0]*3)%MOD;
			for (int j=0;j<3;j++)
			{
				dp[i+1][j+1]=(dp[i][j]+dp[i][j+1]*3)%MOD;
			}
		}
		else
		{
			dp[i+1][0]=dp[i][0];
			for(int j=0;j<3;j++)
			{
				if(s[i]==ABC[j])
				{
					dp[i+1][j+1]=(dp[i][j]+dp[i][j+1])%MOD;
				}
				else
					dp[i+1][j+1]=dp[i][j+1]%MOD;
			}
		}
	}
	cout<<dp[s.size()][3]<<"\n";
	return 0;
}


Measured memory_bytes: 3584