akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
 
#define for0(i,n) for(ll i = 0;i < (n);i++)
#define for1(i,n) for(ll i = 1;i<=(n);i++)
#define for2(i,n) for(ll i = 2;i<=(n);i++)
std::pair<int,int> DR[] = {{-1,0},{0,1},{1,0},{0,-1},{-1,1},{-1,-1},{1,1},{1,-1}};
#define rep(i,st,en,cnt) for(ll i = st;i <= en;i+=cnt)
#define PB push_back
#define MP make_pair
#define fastio cin.tie(NULL);cout.tie(NULL);ios::sync_with_stdio(false)
#define F first
#define S second
#define EPS 1e-12
#define all(x) (x).begin(),(x).end()
#define INF ll(2e18)
#define NEGINF -INF
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define inp_arr(a,n) for0(i,n) {cin>>a[i];}
#define out_arr(a,n) for0(i,n) {cout<<a[i]<<" ";}cout<<endl;
#define deb1(a) cout<<(a)<<endl;
#define deb2(a,b) cout<<(a)<<" "<<(b)<<endl;
#define deb3(a,b,c) cout<<(a)<<" "<<(b)<<" "<<(c)<<endl;
 
using namespace std;
 
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ii> vii;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<pair<ll,ll> > vll;
typedef long double LD;
 
const ll mod =  998244353;

/* 
ll nop = 100;
vi primes(nop,1);
 
void sieve(){
    primes[1] = primes[0] = 0;
    for(ll i = 2;i * i <= nop;i++){
        if(primes[i]){
            for(ll j = i*i; j <= nop;j+=i){
                primes[j] = 0;
            }
        }
    }
}

ll phi(ll n) {
    ll tot = n;
    for(ll i = 2;i*i <= n;i++) {
        if(n%i == 0) {
            tot -= tot/i;
        }
        while(n%i == 0) {
            n /= i;
        }
    }
    if(n > 1) {
        tot -= tot/n;
    }
    return tot;
}
*/
 
ll gcd(ll a,ll b){    //a larger, b smaller
    if(b>a) swap(b,a);
    if(b==0) return a;
    return gcd(b,a%b);
}
/*
void extgcd(ll a,ll b,ll& x,ll& y){  //a smaller b larger
    if(a==0) {
        x = a;y = b;
        return;
    }
    extgcd(b%a,a,x,y);
    ll y1 = y,x1 = x;
    x = y1 - (b/a)*x1;
    y = x1;
}
 
ll lcm(ll a,ll b){
    return (a*b)/gcd(a,b);
}
 */
ll bexp(ll num,ll e){
    ll ans = 1;
    while(e>0){
        if(e&1){
            ans *= num;
        }
        num *= num;
        e>>= 1;
    }
    return ans;
}
 
ll mexp(ll num,ll e){
    ll ans = 1;
    while(e>0){
        if(e&1){
            ans = (ans*num)%mod;
        }
        num = (num*num)%mod;
        e>>=1;
    }
    return ans%mod;
}
 
ll modinv(ll a){
    return mexp(a,mod-2);
}

void solve() {
    ll n;
    cin>>n;
    vl a(n);
    inp_arr(a,n);
    vl freq((int)1e5+1,0);
    ll q;
    cin>>q;
    ll ans = 0;
    for0(i,n) {
        freq[a[i]]++;
        ans += a[i];
    }
    for0(i,q) {
        ll b,c;
        cin>>b>>c;
        ans -= (freq[b]*b);
        ans += (freq[b]*c);
        freq[c] += freq[b];
        freq[b] = 0;
        deb1(ans);
    }
}

int main() {
    fastio;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int t = 1;
    //cin>>t;
    for1(T,t) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 4776
#include <iostream>

using namespace std;

int main() {

  //input
  int n;
  cin >> n;
  int m;
  cin >> m;

  //solve
  int ans = 0;
  for (int i=0; i<2; i++){
    if (n >= m){
      ans += n;
      n -= 1;
    }else{
      ans += m;
      m -= 1;
    }
  }
  //output
  cout << ans << endl;

  return 0;
}


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

using namespace std;



int main() {
	int a, b, c, tmp;
	//int x, y, z;
	cin >> a >> b >> c;
	
	tmp = a;
	a = b;
	b = tmp;

	tmp = a;
	a = c;
	c = tmp;

	printf("%d %d %d\n", a, b, c);

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    
    int x[110];
    int y[110];
    int h[110];
    for(int i = 0; i < N; i++)
    {
        cin >> x[i] >> y[i] >> h[i];
    }

    int c_correct = 0;
    int final_corrent_num[3];
    long long H;
    int clear_pos = -1;
    
    //Bug may exist here.
    for(int k = 0; k < N; k++)
    {
        if (h[k] > 0) {
            clear_pos = k;
            k = (1 << 30);
        }
    }
    
    if (1 < N) {
        for(int c_x = 0; c_x <= 100; c_x++)
        { 

            for(int c_y = 0; c_y <= 100; c_y++)
            {
                H = h[clear_pos] + abs(x[clear_pos] - c_x) + abs(y[clear_pos] - c_y);
                if (H < 0) { H = 0; }
                for (int i = 0; i < N; i++)
                {
                    if (h[i] == max((int)H - abs(x[i] - c_x) - abs(y[i] - c_y), 0))
                    {
                        c_correct++;
                    } else {
                        break;
                    }
                }
                
                if (c_correct == N) {
                    final_corrent_num[0] = c_x;
                    final_corrent_num[1] = c_y;
                    final_corrent_num[2] = H;
                    c_x = (1 << 30);
                    c_y = (1 << 30);
                    H = (1 << 30);
                }
                c_correct = 0;
            }

        }
    } else {
        final_corrent_num[0] = x[0];
        final_corrent_num[1] = y[0];
        final_corrent_num[2] = h[0];
    }
    
    cout << final_corrent_num[0] << " " << final_corrent_num[1] << " " << final_corrent_num[2] << endl;
    
    return 0;
}


Measured memory_bytes: 384
n, m = map(int, input().split())
lone = [0]*n
ln = [0]*n
for i in range(m):
    a, b = map(int, input().split())
    if a==1: lone[b-1] = 1
    if b==1: lone[a-1] = 1
    if a==n: ln[b-1] = 1
    if b==n: ln[a-1] = 1
cant = True
for i in range(n):
    if lone[i] and ln[i]: cant = False
if cant: print("IMPOSSIBLE")
else: print("POSSIBLE")

Measured memory_bytes: 6132
#include <stdio.h>
int main(int argc, char const *argv[])
{
  int n;
  scanf("%d",&n);
  int x[n];
  int i,k;
  int max=0;
  int min;
  int sum=0;
  int sum2=0;
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
    sum+=x[i];
    sum2+=x[i]*x[i];
    if(max<x[i]) max=x[i];
  }
  for(i=1;i<=100;i++){
    k=n*i*i-2*i*sum+sum2;
    if(i==1) min=k;
    //printf("%d\n",k);
    //printf("%d\n",max);
    if(k>min) break;
    min=k;
  }
  printf("%d",min);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <iostream>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;

int ans[300001];
int n, mav, idx;

// 길이 x의 그룹 rotn개를 만든다.
void makes(int len, int rotn) {
	mav = n;
	for (int i = 0; i < rotn; i++) {
		mav -= len;
		for (int j = 1; j <= len; j++)
			ans[j + len * i] = mav + j;
	}
}

int main() {
	int l, d;
	scanf("%d %d %d", &n, &l, &d);

	int k = n / l;
	if (n % l) k++;

	if (n + 1 < d + l) return !printf("-1");
	if (d < k) return !printf("-1");

	int ro, rr;
	for (ro = k; ro >= 1; ro--) {
		rr = n - ro * l; // ro * l개의 수를 사용
		rr += ro; // 온전한 그룹 개수 + 1개의 가중치를 받음.

		if (rr >= d) break;
	}

	// rr개의 수를 확보할 수 있음.
	// 온전한 그룹 rr - d개 만큼 남은 그룹을 만들고
	// 그 나머지는 내림차순으로 배치한다.
	// d - ro개의 추가 설치가 필요함.
	// mav부터 rr - d개 설치.
	
	rr++;
	makes(l, ro);
	idx = l * ro + 1;
	
	mav -= rr - d - 1;
	for (int i = 0; i < rr - d; i++)
		ans[idx++] = mav + i;
	mav--;
	for (int i = idx; i <= n; i++)
		ans[i] = mav--;

	for (int i = 1; i <= n; i++)
		printf("%d ", ans[i]);
}

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


using namespace std;

#define endl '\n'
#define PB push_back
#define MP make_pair
#define LL long long
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

typedef long long ll;

bool file=0,rt=1;
clock_t tStart ;
void FAST_IO();
////////////////////////

int main() {

    void FAST_IO();
    cout << setprecision(5);
    cout << fixed;

    ll n, w;
    cin >> n >> w;
    ll val[n], weight[n], dp[n+1][w+1];
    for(int i = 0; i < n; i++) {

        cin >> weight[i] >> val[i];
    }

    for(ll i = 0; i <= n; i++) {

        for(ll j = 0; j <= w; j++) {


            if(i == 0 || j == 0) {

                dp[i][j] = 0;
            }
            else if(weight[i-1] <= j) {

                dp[i][j] = max(val[i-1] + dp[i-1][j-weight[i-1]], dp[i-1][j]);
            }
            else {

                dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout << dp[n][w] << endl;




    return 0;
}

void FAST_IO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    //cout.tie(NULL);
    //cout.setf(ios::fixed);
    //cout.precision(2);
    if(rt && file){ tStart = clock(); }
    if(file){
    #ifndef _offline
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    }
}




Measured memory_bytes: 79104
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

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

ll mod = 1e9 + 7;

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

	int ans = 0;
	for(int i=0;i<n;i++){
		int h;
		cin >> h;
		ans += (h>=k ? 1 : 0);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
n=int(input())
st=True
for _ in range(n):
    if st==False:
        print()

    puzzle=[]
    for i in range(9):
        row=[int(j) for j in input().split(" ")]
        puzzle.append(row)

    dup=[[False for i in range(9)] for j in range(9)]
    for i in range(9):
        for j in range(9):
            for k in range(9):
                if i!=k and puzzle[i][j]==puzzle[k][j]:
                    dup[i][j]=True
                if j!=k and puzzle[i][j]==puzzle[i][k]:
                    dup[i][j]=True

            for p in range(3):
                for q in range(3):
                    x=(i//3)*3+p
                    y=(j//3)*3+q
                    if (x==i and y==j):
                        continue

                    if puzzle[x][y]==puzzle[i][j]:
                        dup[i][j]=True

    for i in range(9):
        for j in range(9):
            if dup[i][j]:
                print("*", end="")
            else:
                print(" ", end="")
            print(puzzle[i][j], end="")
        print()
    st=False



Measured memory_bytes: 5628
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處
namespace Number {
    typedef long long int LL;
    // 求取 a, b 的最大公因數
    LL gcd(LL a, LL b) {
        if (a % b == 0) {
            return b;
        }
        return gcd(b, a % b);
    }
    // 求取 a, b 的最大公因數 gcd
    // 以及 x, y 使得 a*x + b*y = gcd
    LL gcd_extend(LL a, LL b, LL *x, LL *y) { 
        if (a == 0) { 
            *x = 0, *y = 1; 
            return b; 
        } 
    
        LL x1, y1; // To store results of recursive call 
        LL gcd = gcd_extend(b%a, a, &x1, &y1); 
    
        *x = y1 - (b/a) * x1; 
        *y = x1; 
    
        return gcd; 
    }
    // 求 a_inv 使得 (a * a_inv) % m = gcd(a, m)
    // 若 a, m 互質，即求 a 在 mod m 群的反元素 a_inv 
    LL mod_inv(LL a, LL m) { 
        LL x, y; 
        LL g = gcd_extend(a, m, &x, &y); 
        // 處理 x 爲負的情形 
        LL a_inv = (x%m + m) % m; 
        return a_inv;
    }
    // 求 x^n % m
    LL mod_pow(LL x, LL n, LL m) {
        if (n == 0) {
            return 1;
        } else if (n & 1) {
            LL half = mod_pow(x, n/2, m);
            return (half * half % m) * x % m;
        } else {
            LL half = mod_pow(x, n/2, m);
            return half * half % m;
        }
    }
    // 連乘
    LL mul(LL from, LL to, LL m) {
        LL ret = 1;
        for (LL i = from; i <= to; i++) {
            ret *= i;
            ret %= m;
        }
        return ret;
    }
    // 求 (C n 取 k) % m
    LL mod_comb(LL n, LL k, LL m) {
        LL mi = k < n-k ? k : n-k;
        LL up = mul(n - mi + 1, n, m);
        LL down = mul(1, mi, m);
        return (up * mod_inv(down, m)) % m;
    }
}

const int MAXN = 17;
const int MASK = (1 << 17)-1;
const int MOD = 1e9+7;
LL dp[2][1 << MAXN];

bool has_bit(int n, int b) {
    return (n & (1 << (b-1))) > 0;
}
bool is_haiku(int n, int X, int Y, int  Z) {
    return has_bit(n, X + Y + Z) &&
        has_bit(n, Y + Z) &&
        has_bit(n, Z);
}

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    int N, X, Y, Z;
    cin >> N >> X >> Y >> Z;
    dp[0][0] = 1;
    LL ans = 0;
    for (int i = 1; i <= N; ++i) {
        memset(dp[i&1], 0, sizeof(dp[i&1]));
        for (int j = 0; j < 1 << MAXN; ++j) {
            for (int k = 1; k <= 10; ++k) {
                int new_state = (((j<<1) | 1) << (k-1)) & MASK;
                dp[i&1][new_state] += dp[(i-1)&1][j];
                dp[i&1][new_state] %= MOD;
            }
        }
        for (int j = 0; j < 1 << MAXN; ++j) {
            if (is_haiku(j, X, Y, Z)) {
                // if (dp[i&1][j]) {
                //     for (int i = 0; i < X + Y + Z; ++i) {
                //         cout << (j >> (X + Y + Z-i-1) & 1);
                //     }
                //     cout << endl;
                //     cout << dp[i&1][j] << endl;
                // }
                ans += dp[i&1][j] * Number::mod_pow(10, N-i, MOD) % MOD;
                ans %= MOD;
                dp[i&1][j] = 0;
            }
        }
        // cout << "i " << i << " ans " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2304
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

N,M = map(int,input().split())
uf = UnionFind(N)
for i in range(M):
    A,B = map(lambda x:int(x)-1, input().split())
    uf.Unite(A,B)

answer = 1
for i in range(N):
    answer = max(answer, uf.Count(i))
print(answer)

Measured memory_bytes: 80900
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int n;
    cin>>n;
    pair<ll,ll> p[n];
    rep(i,n)cin>>p[i].first>>p[i].second;
    sort(p,p+n);
    vector<ll> li(n+1,inf),ri(n+1,inf),la(n+1,-1),ra(n+1,-1);
    rep(i,n){
        la[i+1]=max(la[i],p[i].first);
        li[i+1]=min(li[i],p[i].second);
        ra[n-i-1]=max(ra[n-i],p[n-i-1].first);
        ri[n-i-1]=min(ri[n-i],p[n-i-1].second);
    }
    ll ans = 0;
    rep(i,n-1){
        ans = max(ans,max(0ll,li[i+1]-la[i+1]+1)+max(0ll,ri[i+1]-ra[i+1]+1));
    }
    rep(i,n){
        ans = max(ans,p[i].second-p[i].first+1+max(0ll,min(li[i],ri[i+1])-max(la[i],ra[i+1])+1));
    }
    cout<<ans<<endl;
    return 0;
}

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

long long mod = 1e9+7;

int main(){
    long long n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;

    long long i = 0;
    long long ans = 1;
    while(i < n){
        if(i == 0){
            if(s1[i] == s2[i]){
                ans = ans*3;
                ans = ans%mod;
                i++;
            }
            else{
                ans = ans*6;
                ans = ans%mod;
                i = i + 2;
            }
        }
        else{
            if(s1[i] == s2[i]){
                if(s1[i-1] == s2[i-1]){
                    ans = ans*2;
                    ans = ans%mod;
            
                }
                i++;
            }
            else{
                if(s1[i-1] == s2[i-1]){
                    ans = ans*2;
                    ans = ans%mod;
                }
                else{
                    ans = ans*3;
                    ans = ans%mod;
                }
                i = i+2;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
using System;
using System.Linq;
using System.Collections.Generic;

public class AtCoderC
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int[] xs = new int[n];
        {
            var line = Console.ReadLine();
            var words = line.Split(' ');
            for (int i = 0; i < n; i++)
            {
                xs[i] = int.Parse(words[i]);
            }
        }

        int answer = int.MaxValue;
        for (int i = 1; i < 100; i++)
        {
            int sum = 0;
            for (int j = 0; j < n; j++)
            {
                sum += (xs[j] - i) * (xs[j] - i);
            }
            answer = Math.Min(answer, sum);
        }

        Console.WriteLine(answer);
    }
}

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

int main() {
    ll X, Y;
    cin >> X >> Y;

    ll a = X;
    ll count = 0;
    for (ll i=0; ; ++i) {
        if (a > Y) break;
        count++;
        a = a * 2;
    }

    cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define tii tuple<int,int,int>
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

bool func (int n,string s){
    if(n%2==1)return false;
    rep(i,n/2){
        if(s[i]!=s[i+n/2])return false;
    }
    return true;
}

int main(){
    int n=in();
    string s=stin();
    cout<<(func(n,s)? "Yes":"No")<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
	int n, W;
	int v[110], w[110];
	int dp[110][10010] = { {0} };
	cin >> n >> W;
	for (int i = 0; i < n; i++) {
		cin >> v[i] >> w[i];
	}
	for (int i = 1; i <= n; i++) {
		for (int i2 = 0; i2 <= W; i2++) {
			if (i2 - w[i - 1] >= 0)dp[i][i2] = max(dp[i - 1][i2], dp[i][i2 - w[i - 1]] + v[i - 1]);
			else dp[i][i2] = dp[i - 1][i2];
		}
	}
	cout << dp[n][W] << endl;
}

Measured memory_bytes: 5468
H,N=map(int,input().split())
A=[];B=[]
for i in range(N):
    a,b=map(int,input().split())
    A.append(a);B.append(b)
dp=[[-1 for i in range(H+1)] for i in range(N)]
dp[0][0]=0
for i in range(N):
    dp[i][0]=0
tmp=0
while True:
    if tmp>=H:
        break
    if dp[0][tmp]!=-1:
        if tmp+A[0]>H:
            dp[0][H]=dp[0][tmp]+B[0]
        else:
            dp[0][tmp+A[0]]=dp[0][tmp]+B[0]
    tmp+=1
for i in range(N-1):
    tmp=0
    for j in range(H+1):
        dp[i+1][j]=dp[i][j]
    while True:
        if tmp>=H:
            break
        if dp[i+1][tmp]!=-1:
            if tmp+A[i+1]>=H:
                dp[i+1][H]=min(dp[i+1][H],dp[i+1][tmp]+B[i+1])
            else:
                if dp[i+1][tmp+A[i+1]]==-1:
                    dp[i+1][tmp+A[i+1]]=dp[i+1][tmp]+B[i+1]
                else:
                    dp[i+1][tmp+A[i+1]]=min(dp[i+1][tmp]+B[i+1], dp[i+1][tmp+A[i+1]])
        tmp+=1
print(dp[N-1][H])

Measured memory_bytes: 125788
import collections

n = int(input())
a = collections.Counter(list(map(int, input().split())))
s = []
for k, v in sorted(a.items(), key=lambda x: -x[0]):
    # print(k,v)
        
    if v > 1:
        s.append(k)
        if len(s) > 1:
            print(s[0] * s[1])
            exit()

    if v >= 4:
        print(k ** 2)
        exit()
print(0)


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

int main() {
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if (a == 0){
    cout<<1<<endl;
  }
  else if (b == 0){
    cout<<2<<endl;
  }
  else if(c == 0){
    cout<<3<<endl;
  }
  else if(d == 0){
    cout<<4<<endl;
  }
  else{
    cout<<5<<endl;
  }
}

Measured memory_bytes: 3632
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

ll pow(ll x, ll y) {
    ll ret = 1;
    while(y-- > 1) ret *= x;
    return ret;
}

ll gcd(ll x, ll y) {
    if (x < y) swap(x, y);
    if (y == 0) return x;
    ll r = x / y;
    return gcd(y, x-y*r);
}

int run(istream& in, ostream& out) {
    ll N;
    in >> N;
    vector<ll> A(N);
    REP(i, N) {
        ll a{};
        in >> a;
        if (a % 2 == 0 && (a % 3 != 0 && a % 5 != 0)) {
            cout << "DENIED" <<endl;
            return 0;
        }
    }
    out << "APPROVED" << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 256
k,t = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*t
for i in range(t):
    b[i] = [a[i], i]
s = -1
ans = 0
if t == 1:
    ans = k-1
else:
    for i in range(k):
        b.sort(key= lambda val : val[0],reverse=True)
        if b[0][1] == s:
            if b[1][0] == 0:
                ans = b[0][0]
                break
            else:
                b[1][0] -= 1
                s = b[1][1]
        else:
            b[0][0] -= 1
            s = b[0][1]
print(ans)

Measured memory_bytes: 73172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P>> vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, long long M, long long Q, std::vector<long long> L, std::vector<long long> R,
           std::vector<long long> p, std::vector<long long> q) {
    vector<vector<ll>> data(N + 1, vector<ll>(N + 1));
    rep(i, M) data[L[i]][R[i]]++;
    vector<vector<ll>> sum(N + 1, vector<ll>(N + 1));
    rep(i, N) {
        rep(j, N) { sum[i + 1][j + 1] = sum[i + 1][j] + sum[i][j + 1] - sum[i][j] + data[i + 1][j + 1]; }
    }
    rep(i, Q) { cout << sum[q[i]][q[i]] - sum[p[i] - 1][q[i]] - sum[q[i]][p[i] - 1] + sum[p[i] - 1][p[i] - 1] << endl; }
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    long long Q;
    scanf("%lld", &Q);
    std::vector<long long> L(M);
    std::vector<long long> R(M);
    for (int i = 0; i < M; i++) {
        scanf("%lld", &L[i]);
        scanf("%lld", &R[i]);
    }
    std::vector<long long> p(Q);
    std::vector<long long> q(Q);
    for (int i = 0; i < Q; i++) {
        scanf("%lld", &p[i]);
        scanf("%lld", &q[i]);
    }
    solve(N, M, Q, std::move(L), std::move(R), std::move(p), std::move(q));
    return 0;
}


Measured memory_bytes: 9600
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <cstdio>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  int a,b;
  cin >> a >> b;
  if (a%b==0 ){
    cout << 0;
  } else {
    cout << 1;
  }
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define F first
#define S second

using ll = long long;
using P = pair<int,int>;

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

  vector<int> a(n), v(n, 0);
  rep(i, n) {
    cin >> a[i];
    int t = i + a[i] + 1;
    if(t < n) {
      v[t] += 1;
    }
  }

  ll res = 0;
  rep(i, n) {
    int t = i - a[i] + 1;
    if(t >= 0) {
      res += v[t];
    }
  }

  cout << res << endl;

  return 0;
}


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

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

typedef long long ll;

using namespace std;

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

  int result = 0;

  for (int i = 0; i < N - 2; i++) {
    if (S.substr(i, 3) == "ABC") {
      result++;
    }
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

#define MAX 20

signed main() {
    int n;
    cin >> n;
    int x[n + 2];
    for (int i = 1; i <= n; i++) {
        cin >> x[i];
    }
    x[0] = x[1] - 1;
    x[n + 1] = x[n] + 1;
    n += 2;
    int l, q;
    cin >> l >> q;
    int a[q], b[q];
    rep(i, q) {
        cin >> a[i] >> b[i];
    }
    int dp[n][MAX + 1], dpr[n][MAX + 1];
    rep(i, n) {
        dp[i][0] = upper_bound(x, x + n, x[i] + l) - x - 1;
    }
    for (int i = n - 1; i >= 0; i--) {
        dpr[i][0] = lower_bound(x, x + n, x[i] - l) - x;
    }
    for (int i = 0; i < MAX; i++) {
        for (int j = 0; j < n; j++) {
            dp[j][i + 1] = dp[dp[j][i]][i];
        }
    }
    for (int i = 0; i < MAX; i++) {
        for (int j = 0; j < n; j++) {
            dpr[j][i + 1] = dpr[dpr[j][i]][i];
        }
    }
    rep(i, q) {
        int ans = 0;
        int cur = a[i];
        if (a[i] < b[i]) {
            while (cur < b[i]) {
                int j;
                for (j = 0; j <= MAX; j++) {
                    if (b[i] < dp[cur][j]) break;
                }
                if (j) j--;
                cur = dp[cur][j];
                ans += 1 << j;
            }
        } else {
            while (b[i] < cur) {
                int j;
                for (j = 0; j <= MAX; j++) {
                    if (dpr[cur][j] < b[i]) break;
                }
                if (j) j--;
                cur = dpr[cur][j];
                ans += 1 << j;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 21108
N = int(input())
s = ['']*N
t = ['']*N
for i in range(N):
    s[i], t[i] = input().split()
t = list(map(int, t))
t.append(0)
x = input()

for i in range(N):
    if s[i] == x:
        idx = i
        break

print(sum(t[idx+1:]))

Measured memory_bytes: 3060
package main

import "fmt"

func main() {
	var str string
	fmt.Scanf("%s", &str)
	aa := false
	in := []byte(str)
	if in[0] != 'A' {
		goto wa
	}
	if 'A' <= in[1] && in[1] <= 'Z' {
		goto wa
	}
	for i := 2; i <= len(in)-2; i++ {
		if in[i] == 'C' {
			if !aa {
				aa = true
				continue
			} else {
				goto wa
			}
		}
		if 'A' <= in[i] && in[i] <= 'Z' {
			goto wa
		}

	}
	if !aa {
		goto wa
	}
	if 'A' <= in[len(in)-1] && in[len(in)-1] <= 'Z' {
		goto wa
	}
	fmt.Println("AC")
	return
wa:
	fmt.Println("WA")
}


Measured memory_bytes: 1832
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static long mod = (long)(Math.Pow(10, 9) + 7);
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        var n = Read.ints();
        var b = Read.ints();
        var a = new int[200000];
        for(int i = 0; i < b.Length; i++)
        {
            a[b[i] - 1]++;
        }
        Array.Sort(a);
        Array.Reverse(a);
        int ans = 0;
        for(int i = 0; i < n[1]; i++)
        {
            ans += a[i];
        }
        Console.WriteLine(n[0]-ans);
        Console.ReadLine();
    }
    public static long gcd(long a, long b)
    {
        if (b == 0) { return a; }
        return gcd(b, a % b);
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static string Reverse(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 34112
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#define eps 1e-14
#define double long double
using namespace std;
struct point{
	double x,y;
	void read(){scanf("%Lf%Lf",&x,&y);}
	void write(){printf("%.10Lf %.10Lf\n",x,y);}
	point(double X=0.0,double Y=0.0):x(X),y(Y){}
	point operator +(const point a)const{return point(x+a.x,y+a.y);}
	point operator -(const point a)const{return point(x-a.x,y-a.y);}
	point operator *(double a)const{return point(x*a,y*a);}
	point operator /(double a)const{return point(x/a,y/a);}
	bool operator ==(const point a)const{return abs(x-a.x)<=eps && abs(y-a.y)<=eps;}
};
double dis(point a,point b=point(0,0)){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
double dot(point a,point b){return a.x*b.x+a.y*b.y;}
double cross(point a,point b){return a.x*b.y-a.y*b.x;}
double cross3(point o,point a,point b){return cross(a-o,b-o);}
bool jiao(point a,point b,point c,point d)
{
	if(min(a.x,b.x)>max(c.x,d.x) || min(a.y,b.y)>max(c.y,d.y)) return false;
	if(min(c.x,d.x)>max(a.x,b.x) || min(c.y,d.y)>max(a.y,b.y)) return false;
	if(cross3(a,b,c)*cross3(a,b,d)>0) return false;
	if(cross3(c,d,a)*cross3(c,d,b)>0) return false;
	return true;
}
short int on_line(point o,point a,point b)//oa->ob 0:D 1:U 2:O
{
	if(dot(a-o,b-o)<-eps) return 0;
	return 1+(dis(a-o)>=dis(b-o));
}
void make_rand(double &x){x=x+(1ll*rand()%10+1)/10.0*eps;}
struct Line{
	point a,b;
	void read(){a.read();b.read();}
	bool operator &&(const Line u){return jiao(a,b,u.a,u.b);}
	point operator &(const Line u)
	{
		if(a==u.a || a==u.b) return a;
		if(b==u.a || b==u.b) return b;
		double x1=a.x,x2=b.x,x3=u.a.x,x4=u.b.x;
		double y1=a.y,y2=b.y,y3=u.a.y,y4=u.b.y;
		if(x3==x4) return point(x3,(y2-y1)*x3/(x2-x1)+(y1*x2-x1*y2)/(x2-x1));
		if(x1==x2) return point(x1,(y4-y3)*x1/(x4-x3)+(y3*x4-x3*y4)/(x4-x3));
		make_rand(x2);
		double x=((y3*x4-y4*x3)*(x2-x1)-(y1*x2-y2*x1)*(x4-x3))/((y2-y1)*(x4-x3)-(y4-y3)*(x2-x1));
		double y=(y2-y1)*x/(x2-x1)+(y1*x2-x1*y2)/(x2-x1);
		return point(x,y);
	}
};
point project(Line a,point p)
{
	point &p1=a.a,&p2=a.b;
	double len=dot(p2-p1,p-p1)/dis(p2-p1);
	return p1+(p2-p1)/dis(p2-p1)*len;
}
double dis(Line a,Line b)
{
	if(a && b) return 0;
	double ans=min(min(dis(a.a,b.a),dis(a.a,b.b)),min(dis(a.b,b.a),dis(a.b,b.b)));
	point res=project(a,b.a);
	if(on_line(a.a,a.b,res)==2) ans=min(ans,dis(res,b.a));
	res=project(a,b.b);
	if(on_line(a.a,a.b,res)==2) ans=min(ans,dis(res,b.b));
	res=project(b,a.a);
	if(on_line(b.a,b.b,res)==2) ans=min(ans,dis(res,a.a));
	res=project(b,a.b);
	if(on_line(b.a,b.b,res)==2) ans=min(ans,dis(res,a.b));
	return ans;
}
int main()
{
	int n;
	scanf("%d",&n);
	
	srand(n);
	for(int i=1;i<=n;i++)
	{
		Line a,b;
		a.read();b.read();
		printf("%.10Lf\n",dis(a,b));
	}
	return 0;
}



Measured memory_bytes: 3220
n=int(input())
List=list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt=1
    else:
      cnt+=1
      ans = max(ans, cnt)
  else:
    cnt=0
print(ans)

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N; cin >> N;
  vector<int> v;
  int now_val = 0;
  int num = 0;

  for(int i = 0; i < N; i++){
    int tmp; cin >> tmp;
    if(now_val == tmp){
      num++;
    } else { 
      v.push_back(num);
      num = 1;
      now_val = tmp;
    }

    if(i == N-1 && num > 0){
      v.push_back(num);
    }
  }

  int ans = 0;
  for(int i = 0; i < v.size(); i++){
    // cerr << v[i] << endl;
    ans += v[i]/ 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3604
from collections import deque
n = int(input())

mapping = [[] for i in range(n)]
#入力の受け取り
for i in range(n-1):
    u, v, w = map(int, input().split())
    mapping[u-1].append([u-1, v-1, w])
    mapping[v-1].append([v-1, u-1, w])

#壁の検出
already = [False]*n

depth = [0]*n

not_yet = deque(mapping[0])
already[0] = True
#始点の情報をnot_yetに入れる    
for u, v, w in mapping[0]:
    already[v] = True
#本番   
while not_yet:
    key = not_yet.popleft()
    u, v, w = key[0], key[1], key[2]
    depth[v] = (depth[u]+w)%2  
    
    for key in mapping[v]:
        if already[key[1]]:
            continue
        not_yet.append(key)
        already[key[1]] = True
    
for i in range(n):
    print(depth[i])

Measured memory_bytes: 52492
#include <stdio.h>
#include <memory.h>
int c[50][50];
int w,h;
void solve(int i,int j){
  c[i][j]=0;
  if(i<h-1&&c[i+1][j]==1)
    solve(i+1,j);
  if(i>0&&c[i-1][j]==1)
    solve(i-1,j);
  if(j>0&&c[i][j-1]==1)
    solve(i,j-1);
  if(j<w-1&&c[i][j+1]==1)
    solve(i,j+1);
  if(i>0&&j>0&&c[i-1][j-1]==1)
    solve(i-1,j-1);
  if(i>0&&j<w-1&&c[i-1][j+1]==1)
    solve(i-1,j+1);
  if(i<h-1&&j>0&&c[i+1][j-1]==1)
    solve(i+1,j-1);
  if(i<h-1&&j<w-1&&c[i+1][j+1]==1)
    solve(i+1,j+1);
}
int main(void){
  int i,j,ans;
  while(1){
    scanf("%d %d",&w,&h);
    if(w+h==0)
      break;
    ans=0;
    memset(c,0,sizeof(c));
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	scanf("%d",&c[i][j]);
      }
    }
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	if(c[i][j]==1){
	  ans++;
	  solve(i,j);
	}
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 760
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
using namespace std;
typedef long long int ll;


int main() {

	ll N, M;
	cin >> N >> M;
	ll g = 0;

	for (int i = M/N; 1 <=i ; i--) {
		if (M%i == 0&&M/i>=N){
			g = i;
			break;
		}
	}


	cout << g << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    public static void Main()
    {
        long[] input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        long count = (input[0] / (input[1] + input[2])) * input[1];
        count += Math.Min(input[0] % (input[1] + input[2]), input[1]);
        Console.WriteLine(count);
    }
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int D, N;
signed main() {
    cin >> D >> N;
    int a = 1;
    for (int i = 0; i < D; i++) a *= 100;
    if (N == 100) N = 101;
    cout << N * a << endl;
}

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

int main() {
  string S;
  cin >> S;
  
  int size = S.size();
  string ans = "AC";
  int count=0;
  
  if(S.at(0)!='A')ans = "WA";
  for(int i=2;i<size-1; i++){
    if(S.at(i)=='C')count ++;
  }
  if(count != 1)ans= "WA";

  count = 0;
  for(int i=0; i<size; i++){
    if(S.at(i)>'Z')count++;
  }
  if(count != size-2)ans = "WA";
  
  cout << ans << endl;
}

Measured memory_bytes: 3632
let () =
  let rec loop () = 
    let a, op, b = Scanf.scanf "%d %c %d\n" (fun a b c -> a,b,c) in
    match op with
      | '?' -> ()
      | '+' -> Printf.printf "%d\n" (a+b); loop ()
      | '-' -> Printf.printf "%d\n" (a-b); loop ()
      | '*' -> Printf.printf "%d\n" (a*b); loop ()
      | '/' -> Printf.printf "%d\n" (a/b); loop ()
      | _   -> ()
  in loop ()

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

struct peak {
  long long int h;
  int flag;
};

int main(void) {
  long long int n, m;
  scanf("%lld %lld", &n, &m);
  struct peak peak[n];
  for (long long int i = 0; i < n; i++) {
    long long int tmp_h;
    scanf(" %lld", &tmp_h);
    peak[i].h = tmp_h;
    peak[i].flag = 1;
  }

  for (long long int i = 0; i < m; i++) {
    long long int a, b;
    scanf(" %lld %lld", &a, &b);
    if (peak[a - 1].h > peak[b - 1].h) peak[b - 1].flag = 0;
    else if (peak[a - 1].h < peak[b - 1].h) peak[a - 1].flag = 0;
    else {
      peak[b - 1].flag = 0;
      peak[a - 1].flag = 0;
    }
  }

  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    if (peak[i].flag) sum++;
  }
  printf("%lld\n", sum);

  return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};


int main(){

  int n;
  cin >> n;
  priority_queue<ll,vector<ll>,less<ll>> que;
  REP(i,n){
    int x;cin >> x;
    que.push(x);
  }
  ll ov = que.top();que.pop();
  ll a = 0,b = 0;
  REP(i,n){
    if(b)break;
    int nv = que.top();que.pop();
    if(nv == ov){
      if(!a)a = nv;
      else b = nv;
      ov = -1;
    }else{
      ov = nv;
    }
  }

  cout << a*b << endl;




  

  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using ll = int_fast64_t;

ll F(ll a, ll b){
	ll x = 0, y = 0;
	while(a) a/=10, x++;
	while(b) b/=10, y++;
	return std::max({1l, x, y});
}

int main(){
	ll n, ans = 1e18;;
	scanf("%ld", &n);
	for(ll i=1; i*i<=n; i++){
		if(n%i==0) ans = std::min(ans, F(i, n/i));
	}
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 256
#import<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef struct{LL x;LL h;}H;
LL a,d,h,i,j,k,m,n,s,t,z[200040];
H w[200040];
int C(H a,H b){return a.x<b.x;}
main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>d>>a;
	for(;i<n;i++)cin>>w[i].x>>w[i].h;
	sort(w,w+n,C);
	w[n].x=w[n].h=4000000000;
	d*=2;
	for(i=0;j<n;)
	{
		if(w[j].x-w[i].x>d)t-=z[i++];
		else
		{
			if(w[j].h>t)
			{
				m=(w[j].h-t-1)/a+1;
				s+=m;
				m*=a;
				z[j]=m;
				t+=m;
			}
			
			j++;
		}
	}
	cout<<s;
}

Measured memory_bytes: 4992
if __name__=='__main__':
    import numpy as np
    n,k,*h=map(int,open(0).read().split())
    H=np.array(h)
    dp=np.zeros(n,dtype=int)
    for i in range(1,n):
        j=max(0,i-k)
        dp[i]=np.min(dp[j:i]+np.abs(H[j:i]-H[i]))
    print(dp[-1])

Measured memory_bytes: 22932
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int a, b, x;
    cin >> a >> b >> x;
    int v = a*a*b;
    double ans;
    const double pi = acos(-1);
    if (2*x <= v) {
        ans = atan((double)a*b*b/x/2) * 180 / pi;
    } else {
        ans = atan(2.0*(a*a*b - x)/a/a/a) * 180 / pi;
    }
    cout << fixed << setprecision(15) << ans << endl;
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

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

    int ans = 0;
    rep(i, S.size()) {
        if (S[i] == T[i]) ans++;
    }

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

Measured memory_bytes: 256
H, W = (map(int, input().split()))

c = []
for _ in range(10):
    c.append(list(map(int, input().split())))

for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][k] + c[k][j], c[i][j])

A = []

for _ in range(0, H):
    A.append(list(map(int, input().split())))

ans = 0

for i in range(H):
    for j in range(W):
        a = A[i][j]
        if a != -1:
            ans += c[a][1]

print(ans)


Measured memory_bytes: 3444
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

int  n,q;
int par[10000];
int rank[10000];

void init(int n){
    REP(i,n){
        par[i]=i;
        rank[i]=0;
    }
    return;
}

int find(int x){
    if(par[x]==x){
        return x;
    }else{
        return par[x]=find(par[x]);
    }
}

void unite(int x,int y){
    x=find(x);
    y=find(y);
    if(x==y) return;
    if(rank[x]<rank[y]){
        par[x]=y;
    }else{
        par[y]=x;
        if(rank[x]==rank[y]) rank[x]++;
    }
    return;
}

bool same(int x,int y){
    return find(x)==find(y);
}
int main(){
  cin >> n >> q;
    init(n);
    REP(i,q){
        int com,x,y;
        cin >> com >> x >> y;
        if(com==1){
            if(same(x,y)) cout << 1 << endl;
            else cout << 0 << endl;
        }else{
            unite(x,y);
        }
    }
  return 0;
}

Measured memory_bytes: 1240
#include <stdio.h>

int main(void){
  int n,i,ans=0;
  long int d,x,y;
  scanf("%d",&n);
  scanf("%d",&d);
  d=d*d;
  for(i=0;i<n;i++){
    scanf("%ld",&x);
 	scanf("%ld",&y);
    if(x*x+y*y<=d){
      ans++;
    }
  }
  printf("%ld",ans);
  return 0; 
}

Measured memory_bytes: 1704
/*  ex4_3
    supercomputerjoi    */

#include <stdio.h>

// calculate answer
int calc(int west, int east);

// calculate xth tower's height
int xHeight(int size);

int main(void){

    int west, east;

    // input A B
    scanf("%d %d", &west, &east);

    // print answer
    printf("%d\n", calc(west, east));

    return 0;
}

int calc(int west, int east){

    // original height - now height
    int ans = xHeight(east - west) - east;

    return ans;
}

int xHeight(int size){

    // xth height = x-1th height + x
    if(size > 1){
        return xHeight(size - 1) + size;
    }

    // others is 1
    return 1;
}

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

typedef long long ll;

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

    int a,b;
    cin >> a >> b;
    cout << max({a+b,a+a-1,b+b-1}) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	string w;
	cin >> w;

	vector<int> cnt(26, 0);
	for(auto it=w.begin(); it!=w.end(); it++)
		cnt[*it-'a']++;

	bool ok = true;
	for(int i=0; i<26; i++)
		if(cnt[i]%2 != 0)
		{
			ok = false;
			break;
		}

	string ret;
	if(ok == true)
		ret = "Yes";
	else
		ret = "No";

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256