akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n),b(n),c(n-1);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
    }
    for(int i=0;i<n-1;i++){
        cin>>c[i];
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=b[a[i]-1];
        if(i>0&a[i]-1==a[i-1]){
            sum+=c[a[i-1]-1];
        }
    }
    cout<<sum<<endl;
    return 0;
}

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

using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using pii = pair<int, int>;

/* [💭] [💡] [🎈] */

string b[6];

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

    int h, w, k;
    cin >> h >> w >> k;
    for (int i = 0; i < h; i++) cin >> b[i];

    int c = 0;
    for (int i = 0; i < (1 << h); i++) {
        for (int j = 0; j < (1 << w); j++) {
            int s = 0;
            for (int x = 0; x < h; x++) {
                if (i & (1 << x)) continue;
                for (int y = 0; y < w; y++) {
                    if (j & (1 << y)) continue;
                    s += (b[x][y] == '#');
                }
            }
            if (s == k) c++;
        }
    }
    cout << c;

    return 0;
}

Measured memory_bytes: 3648
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■          ■   ■
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■     ■■
# ■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■  ■ ■■■■■■■■■■■■■■■■■■     ■
# ■■■■■■■■■■■■■■■■■■■■■  ■■■■■■■■■■■■■■■■■■ ■    ■■■■■■■   ■■■■■■■■■■      ■
# ■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■  ■   ■■■■■■■  ■      ■■■■  ■■■■
# ■■■■■■■■■■■■■■■■■ ■■ ■    ■■■■■■■■■        ■ ■        ■■ ■■■
# ■■■■■■■■■■■■■■■■■■    ■     ■■■           ■ ■■■    ■  ■■  ■■■■■■■■
# ■■■■■■■■■■ ■■■■■■■■                        ■■■■■■■■■  ■   ■■■■■■■■   ■■■
# ■■■■■■  ■■■  ■■■■     ■■■■■                  ■■■■■■■       ■■ ■■■■  ■    ■
# ■■■■■■      ■   ■■■■■■■■■■■ ■                 ■■■■         ■  ■■■           ■
# ■■■■■■       ■■■■■    ■                                  ■    ■■
# ■■■■■■     ■■■■■■■■                                    ■■    ■
# ■■■■■■     ■■■■■■■■■■■■■■                      ■          ■
# ■■■■■■■■  ■■■■■■■■■■■■■■■                                      ■
# ■■■■■■■■■       ■■■■■                                          ■

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    if v[i] - c[i] > 0:
        ans += v[i] - c[i]

print(ans)

Measured memory_bytes: 3060
import sys

X= int(input())

#添字の最大値を算出

a = 1
b = 0
dif = 0
while dif < 10**9:
    a += 1
    b += 1

    dif = a ** 5 - b ** 5

loop_sequence = a - 1

for i in range(-(loop_sequence),loop_sequence):
	for j in range(-(loop_sequence),loop_sequence):
		if(X == i ** 5 - j ** 5):
			print(i,j)
			sys.exit()


Measured memory_bytes: 63880
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int e[101][101] = {};
    int R, C, r, c;
    int s, total;
    
    //表の行数と列数
    scanf("%d %d", &R, &C);
    
    //表を入力
    for (r=1; r<=R; r++) {
        for (c=1; c<=C; c++) {
            scanf("%d", &e[r][c]);
        }
    }
    
    //列の合計を配列eの0行目に入れる
    for (r=1; r<=R; r++) {
        s=0;
        for (c=1; c<=C; c++) s+=e[r][c];
            e[r][0] = s;
        
    }
    
    //行の合計を配列eの0列目に入れる
    total = 0;
    for (c=1; c<=C; c++) {
        s=0;
        for (r=1; r<=R; r++) s+=e[r][c];
        e[0][c]=s;
        total+=s; //表の合計を計算する（上のfor文でも可）
        }
    
    //配列eを順番に印字（最下段以外）
    for (r=1; r<=R; r++) {
        for (c=1; c<=C; c++) printf("%d ", e[r][c]);
        
        printf("%d\n", e[r][0]);
    }
    
    //最下段を印字
    for (c=1; c<=C; c++) printf("%d ", e[0][c]);
    printf("%d\n", total);
    
    return 0;
}


Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  bool f=false;
  cin>>a>>b;
  for(int i=0;i<a.length();i++){
    if(a==b){f=true;break;}
    char t=a[a.length()-1];
    a.erase(a.end()-1);
    a.insert(a.begin(),t);
  }
  cout<<(f?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<i64> a(n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(begin(a), end(a));
	
	i64 sum = std::accumulate(begin(a), end(a), 0LL);
	if(n & 1) {
		if(sum % 2) printf("First\n");
		else printf("Second\n");
	} else {
		if(!(sum % 2) and !(a[0] % 2)) printf("Second\n");
		else printf("First\n");
	}
	return 0;
}



Measured memory_bytes: 4388
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

long long lcm(long long x,long long y){
  return x / __gcd(x,y) * y;
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll ans = b-a+1, l = lcm(c,d);
    ans -= (b/c - (a+c-1)/c + 1);
    ans -= (b/d - (a+d-1)/d + 1);
    ans += (b/l - (a+l-1)/l + 1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int main(){
  int x1,y1,x2,y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int v, w;
  v = x2 - x1;
  w = y2 - y1;

  int x3, y3;
  x3 = x2 - w;
  y3 = y2 + v;

  int x4, y4;
  x4 = x3 - v;
  y4 = y3 - w;

  cout << x3 << " " << y3 << " " <<  x4 << " " <<  y4 << endl;

  return 0;
}


Measured memory_bytes: 256
x,y=map(int,input().split())

ans=0
if x==1 and y==1:
  ans+=400000
if x==1:
  ans+=300000
if y==1:
  ans+=300000
if x==2:
  ans+=200000
if y==2:
  ans+=200000
if x==3:
  ans+=100000
if y==3:
  ans+=100000
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  vector<int> B(N - 1);
  for (auto &v : B) {
    cin >> v;
  }
  int sum = B[0];

  for (int i = 0; i < N - 2; ++i) {
    sum += min(B[i + 1], B[i]);
  }

  sum += B[N - 2];

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <math.h>


int main(int argc, char *argv[])
{
    int a, b, ans;
    char op;

    for (;;) {
        scanf("%d %c %d", &a, &op, &b);
        if (op == '?')
            break;
        switch (op) {
        case '+':
            ans = a + b;
            break;
        case '-':
            ans = a - b;
            break;
        case '*':
            ans = a * b;
            break;
        case '/':
            ans = a / b;
            break;
        }
        printf("%d\n", ans);
    }

    return 0;
}


Measured memory_bytes: 2068
base_str = input()
order_num = int(input())
for i in range(order_num):
    order_str = input().split()

    order_s = int(order_str[1])
    order_e = int(order_str[2])
    if order_str[0] == 'print':
        print('{}'.format(base_str[order_s : order_e + 1]))
    elif order_str[0] == 'reverse':
        if len(base_str) == order_e:
            tmp = base_str[order_s:]
        else:
            tmp = base_str[order_s:order_e + 1]
        tmp_r = tmp[::-1]
        if order_s -1 < 0:
            tmp_new = tmp_r + base_str[order_e + 1:]
        else:
            tmp_new = base_str[:order_s] + tmp_r + base_str[order_e + 1:]
        base_str = tmp_new
    elif order_str[0] == 'replace':
        tmp = base_str[:order_s] + order_str[3] + base_str[order_e + 1:]
        base_str = tmp



Measured memory_bytes: 5616
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vd = vector<ld>;
using vs = vector<string>;
using vb = vector<bool>;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;
using Graph = vector<vector<ll>>;
const ll INF = 1LL << 60;
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define debug cout << "line : " << __LINE__ << " debug" << endl;
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#define in1(A) REP(i,A.size()) in(A[i]);
#define in2(A,B) REP(i,A.size()) in(A[i],B[i]);
#define in3(s,t,u) REP(i,sz(s)){in(s[i] , t[i] , u[i]);}
#define in4(s,t,u,v) REP(i,sz(s)){in(s[i] , t[i] , u[i] , v[i]);}
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
struct Point{ ld x,y; };
ld dist(Point a, Point b){return sqrt(abs(a.x-b.x)*abs(a.x-b.x)+abs(a.y-b.y)*abs(a.y-b.y));} // ２点間の距離 
ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b;} 
ll fact(ll n){ if(n < 2) return 1; return (n * fact(n-1))%tl; } //階乗
inline ll updiv(ll a,ll b){ return (a + b - 1) / b; } //切り上げ
// template<typename T,typename U>ll ceil(T a,U b){return (a + b - 1) / b;}
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
//-----------------------------------
int main(){
    init();
    // ll n,l,t;
    inl(n,l,t);
    vl X(n); //蟻の座標
    vl W(n); //1:時計 2:半時計
    //速さは1でぶつかると逆に進む
    in2(X,W);
    //t秒後にそれぞれありがどこにいるか出力
    //t秒の間にすれ違う回数
    ll gap=0;
    REP(i,n){
        ll x= X[i];
        //T秒後の位置（番号は考慮しない）
        x+= ((W[i]+1)%3 - 1)*t;
        gap+= x/l; //座標0を基準としそれより前か一周後かどうか
        if(x<0 && x%l!=0) gap--;
        X[i]= ((x%l)+l)%l;
    }
    sort(all(X));
    REP(i,n) out(X[(((gap + i) % n) + n)%n]);
}

Measured memory_bytes: 2816
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Integer[] len = new Integer[n];
		for ( int i = 0; i < n; i++ ) {
			len[i] = in.nextInt();
		}
		Arrays.sort(len);

		int cnt = 0;
		// x, yを比べて等しい時、x > yとみなすコンパレータ
		Comparator<Integer> com = new Comparator<Integer>() {
			@Override
			public int compare(Integer o1, Integer o2) {				
				return o1.compareTo(o2) >= 0 ? 1 : -1;
			}
		};
		
		for ( int e1 = 0; e1 < n - 2; e1++ ) {
			for ( int e2 = e1 + 1; e2 < n - 1; e2++ ) {
				int d = len[e1] + len[e2];
				// LowerBoundを取りたい
				int i = Arrays.binarySearch(len, d, com);
				i = i >= 0 ? i : ~i;
				cnt += i - e2 - 1;
			}
		}
		System.out.println(cnt);
		in.close();
	}
}

Measured memory_bytes: 45164
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[100001];
		int[] b = new int[100001];
		for(int i=0;i<n;i++){
			if(i%2==0)
				a[sc.nextInt()]++;
			else
				b[sc.nextInt()]++;
		}
		
		int max1=0, max2=0;
		int num1=0, num2=0;
		for(int i=1;i<a.length;i++){
			if(a[i]>max1){
				max1=a[i];
				num1=i;
			}
		}
		for(int i=1;i<b.length;i++){
			if(b[i]>max2){
				max2=b[i];
				num2=i;
			}
		}
		
		if(num1!=num2){
			System.out.println(n-max1-max2);
		}
		else{
			int ma1=0, ma2=0;
			int s=0, t=0;
			for(int i=0;i<a.length;i++){
				if(a[i]>ma1 && i!=num1){
					ma1=a[i];
					s=i;
				}
			}
			for(int i=0;i<b.length;i++){
				if(b[i]>ma2 && i!=num2){
					ma2=b[i];
					t=i;
				}
			}
			
			if(s==0 && t==0){
				System.out.println(n/2);
			}
			else if(s==0){
				System.out.println(n/2-ma2);
			}
			else if(t==0){
				System.out.println(n/2-ma1);
			}
			else{
				System.out.println(n-Math.max(max1+ma2, ma1+max2));
			}
		}
	}
}
/*
4
3 1 3 2
*/

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

int D=365,c[26+1],last[26+1],M;

int main(){
    cin>>D;
    //input
    int s[D+1][26+1];
    for(int i=1;i<=26;i++)cin>>c[i];
    for(int i=1;i<=D;i++)for(int j=1;j<=26;j++)cin>>s[i][j];

    int t[D+1];
    for(int day=1;day<=D;day++){
        //greedy
        int max_type=0,max=-1000000000;
        for(int type=1;type<=26;type++){
            int score=s[day][type];
            for(int i=1;i<=26;i++)score-=c[i]*(day-last[i]);
            if(score>max)max=score,max_type=type;
        }
        t[day]=max_type;
        last[max_type]=day;
    }
    //output
    for(int i=1;i<=D;i++)cout<<t[i]<<endl;
    return 0;
}

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

int main(){
	int a,b,c,d,n,i,j,k,l,h,p=0;
	
	while(1){
		cin >> n;
		if(n==0){
			break;
		}
		if(p){
			cout << "\n";
		}
		p=1;
		cin >> a >> b >> c >> d;
		n=a+5*b+10*c+50*d-n/10;
		for(i=0;50<=n;i++){
			n-=50;
		}
		for(j=0;10<=n;j++){
			n-=10;
		}
		for(k=0;5<=n;k++){
			n-=5;
		}
		for(h=0;1<=n;h++){
			n-=1;
		}
		d-=i;
		c-=j;
		b-=k;
		a-=h;
		if(a>0){
			cout << "10 " << a <<"\n";
		}
		if(b>0){
			cout << "50 " << b <<"\n";
		}
		if(c>0){
			cout << "100 " << c <<"\n";
		}
		if(d>0){
			cout << "500 " << d <<"\n";
		}
	}				
return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

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

long long fact(int N) {
    long long sum = 1;
    for (int i = 1; i <= N; i++) {
        sum *= i;
    }
    return sum;
}

int main() {
    int N;
    cin >> N;
    int x[N], y[N];
    double sum = 0;
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            if (i != j) sum += sqrt((x[i] - x[j]) * (x[i] - x[j]) * 1.0 + (y[i] - y[j]) * (y[i] - y[j]) * 1.0) * fact(N - 1);
        }
    }
    cout << setprecision(20) << sum / fact(N) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String line = br.readLine();

        while(!(line.equals("0 0"))){
            String[] inputs = line.split(" ");
            int height = Integer.valueOf(inputs[0]);
            int width = Integer.valueOf(inputs[1]);
            StringBuilder result = new StringBuilder();

            for(int i = 0; i < height; i++){
                if(i == 0 || i == height-1){
                    for(int j = 0; j < width; j++) result.append("#");
                }else{
                    for(int j = 0; j < width; j++){
                        if(j == 0 || j == width-1) result.append("#");
                        else result.append(".");
                    }
                }
                result.append("\n");
            }

            System.out.println(result);
            
            line = br.readLine();
        }

    }
}

Measured memory_bytes: 25832
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

vector<int> G[10101];
priority_queue<int> pq;
bool visited[10101] = {};
int ans[10101];

void dfs(int s) {
  visited[s] = true;
  int cur = pq.top(); pq.pop();
  ans[s] = cur;
  for (int i = 0; i < (int) G[s].size(); ++i) {
    if (visited[G[s][i]]) continue;
    visited[G[s][i]] = true;
    dfs(G[s][i]);
  }
}

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

  int n; cin >> n;

  for (int i = 0; i < n - 1; ++i) {
    int a, b; cin >> a >> b;
    --a; --b;
    G[a].push_back(b); G[b].push_back(a);
  }

  int ans1 = 0;
  int mx = -1;

  for (int i = 0; i < n; ++i) {
    int c; cin >> c;
    chmax(mx, c);
    ans1 += c;
    pq.push(c);
  }
  dfs(0);
  print(ans1 - mx);

  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }

  return 0;
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		
		int a = stdIn.nextInt();
		int b = stdIn.nextInt();
		int c = stdIn.nextInt();
		int d = stdIn.nextInt();
		
		if(abs(a-c) <= d)
		{
			System.out.println("Yes");
		}
		else if(abs(a-b) <= d && abs(b-c) <= d)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}

	}
	
	public static int abs(int x)
	{
		if(x >= 0)
		{
			return x;
		}
		else
		{
			return -x;
		}
	}

}


Measured memory_bytes: 35640
#include<stdio.h>
#include<string.h>
int main()
{
    char a[101];
    int i,L,x,j;
    while(scanf("%s",&a)!=EOF)
    {
        x=0;
        L=strlen(a);
        for(i=0;i<L;i++)
        {
            if(a[i]=='C')
            {
                for(j=i;j<L;j++)
                {
                    if(a[j]=='F')
                    {
                        x=1;
                        break;
                    }
                    else
                        continue;
                }
            }
            else
                continue;

        }
        if(x==1)
            printf("Yes\n");
        else
            printf("No\n");
    }
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main()
{
    int h,n,a=0;
    cin>>h>>n;
    int arr[n];
    for (int i=0;i<n;i++){
        cin>>arr[i];
        a=a+arr[i];
    }
    if(a>=h)
        cout<<"Yes";
    else
       cout<<"No";

}


Measured memory_bytes: 640
N = int(input())
st = []
for i in range(N):
    s = list(map(str,input().split()))
    st.append(s)
X = input()
check = 0
ans = 0
for i in st:
    if check == 1:
        ans += int(i[1])
    if i[0] == X:
        check = 1
print(ans)
        




Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1e18;
#define print(x) cout << (x) << endl;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    if (A < 10 && B < 10) {
        cout << A * B << endl;
    }
    else {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int judge(int a,int b){
    if(a==0)return b;
    if(a==1)return 0-b;
}
char ans(int a){
    if(a==0)return '+';
    if(a==1)return '-';
}

int main(void){
    int A,B,C,D;
    string s;cin>>s;
    A=s[0]-0x30;B=s[1]-0x30;C=s[2]-0x30;D=s[3]-0x30;
    int x,y,z;
    for(int i=0;i<2;i++){
        for(int j=0;j<2;j++){
            for(int k=0;k<2;k++){
                if(A+judge(i,B)+judge(j,C)+judge(k,D)==7){x=i;y=j;z=k;}
            }
        }
    }
    cout<<A<<ans(x)<<B<<ans(y)<<C<<ans(z)<<D<<"=7"<<endl;
}

Measured memory_bytes: 256
n = int(input())

nums = []
for i in range(n+1):
    num = 0
    k=0
    while 6**k <= i:
        num += int(i/(6**k))%6
        k+=1
    k=0
    while 9**k <= n-i:
        num += int((n-i)/(9**k))%9
        k+=1
    
    nums.append(num)

print(min(nums))

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

using namespace std;

typedef long long LL;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define fin "\n"


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

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
const int MOD=1e9+7;
#define SZ 2123
LL comb[2*SZ][2*SZ];
LL C[SZ][SZ];
struct latte{
    latte(){
        REP(i,2*SZ)comb[i][0]=comb[i][i]=1;
        FOR(i,2,2*SZ){
            FOR(j,1,2*SZ){
                comb[i][j]=(comb[i-1][j-1]+comb[i-1][j])%MOD;
            }
        }
        REP(i,SZ)REP(j,SZ)C[i][j]=0;
        C[0][0]=1;
        REP(i,SZ-1){
            FOR(j,0,SZ-1){
                C[i+1][j+1]+=C[i][j];
                C[i+1][0]+=MOD-C[i][j];
            }
            for(int j=SZ-1;j>0;j--)
                (C[i+1][j-1]+=C[i+1][j])%=MOD;
        }
    }
}malta;

inline LL nHr(LL n,LL r){
    //if(r<0||n<r)return 0;
    return comb[n+r-1][r];
}
int main(){
    int N,K;
    cin>>N>>K;
    LL res=0;
    if(N==K){
        REP(i,N)
            res+=C[N-1][i];
        res%=MOD;
    }
    else{
        REP(i,K){
            int n=i;
            int r=K-i-1;
            LL ans=0;
            REP(j,n+1)
                ans+=C[n][j]*nHr(j+1,r)%MOD;
            ans%=MOD;
            (res+=ans*comb[N-n-2][r]%MOD)%=MOD;
        }
    }
    REP(i,N-K-1)(res<<=1)%=MOD;
    cout<<res<<endl;
    return 0;
}
            


Measured memory_bytes: 176384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<vector<ll>> A(N,vector<ll>(N));
    rep(i,N) rep(j,N) cin >> A[i][j];
    vector<ll> score(1<<N);
    rep(bit,1<<N){
        rep(i,N){
            rep2(j,i+1,N){
                if ((bit&1<<i)&&(bit&1<<j)) score[bit]+=A[i][j];
            }
        }
    }
    vector<ll> dp(1<<N,0);
    rep(bit,1<<N){
        ll unused=((1<<N)-1)^bit;
        for (ll S=unused;;S=(S-1)&unused){
            chmax(dp[bit|S],dp[bit]+score[S]);
            if (!S) break;
        }
    }
    cout << dp[(1<<N)-1] << endl;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
 
 
 
int main() {
  int n;
  scanf("%d",&n);
  
  if(n == 3 || n == 5|| n == 7)yn
   
  return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

#define pb push_back
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SKY ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long int

void solve()
{
    string n;
    cin>>n;
    int x = 0;
    for(auto it: n)
        x+=(it-'0');
   // cout << x << "\n";
    if(x%9==0)
        cout << "Yes";
    else cout << "No";
}
int32_t main()
{
    SKY;
    int T = 1;
    //cin >> T;
    for(int i = 1 ; i <= T ; i++)
    {
        solve();
    }
    return 0;
}
/*
 Umang Agrawal
 @skylag
 */


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main()
{
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int cnt = 0;
  for (int i = 0; i <= A; ++i){
    for (int j = 0; j <= B; ++j){
      for (int k = 0; k <= C; ++k){
        if (500 * i + 100 * j + 50 * k == X)cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a[] = {1,3,5,7,8,10,12};
	int b[] = {4,6,9,11};
	int c[] = {2};
	
	int x,y;
	x = 0;
	y = 0;
	
	int flag = 0;
	
	scanf("%d%d",&x,&y);
	 int i;
	 for(i = 0; i < 7;i++){
	 	if(x == a[i]){
	 		for(i = 0; i < 7;i++){
	 			if(y == a[i]) flag = 1;
	 		}
	 	}
	 }
	 
	 for(i = 0; i < 4;i++){
	 	if(x == b[i]){
	 		for(i = 0; i < 4;i++){
	 			if(y == b[i]) flag = 1;
	 		}
	 	}
	 }
	 
	if(flag == 1) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>

using namespace std;

int N;
int F[100][14];
int P[100][15];
int main(){
    //入力
    scanf("%d", &N);
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<10;j++) scanf("%d", &F[i][j]);
    }
    for(int i=0;i<N;i++) for(int j=0;j<11;j++) scanf("%d", &P[i][j]);

    int res = -(1<<30);
    for(int b=1;b<(1<<10);b++)
    {
        int cc=0;
        for(int i=0;i<N;i++)
        {
            int c=0;
            for(int j=0;j<10;j++) if((b>>j & 1) && F[i][j]) c++;
            cc+=P[i][c];
        }
        if(res<cc)res=cc;
    }
    printf("%d\n", res);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
class Main{
    public static void main(String[] args){
	BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
	int[] prime = new int[1000000];
	prime[0] = 1; prime[1] = 1;
	for(int i=2; i<1000; i++)
	    if(prime[i]==0)
		for(int j=i*i; j<1000000; j+=i)
		    prime[j]=1;
	try {
	    while(true){
		String[] st = sc.readLine().split(" ");
		int a = Integer.valueOf(st[0]), d = Integer.valueOf(st[1]), n = Integer.valueOf(st[2]);
		if(a==0 && d==0 && n==0)
		    break;
		int check = 0;
		while(check!=n){
		    if(prime[a]==0)
			check++;
		    a+=d;
		}
		System.out.println(a-d);
	    }
	}catch(Exception e){
	    System.out.println("Error");
	}
    }
}

Measured memory_bytes: 13000
#define ONLINE_JUDGE
#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>
#include <iterator>
#include <map>
#include <set>
#ifndef ONLINE_JUDGE
#include <prettyprint/prettyprint.hpp>
#endif

#define FOR(i, n) for(int i = 0; i < n; ++i)
#define TEST int T; std::cin >> T; while(T--)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using vll = std::vector<ll>;
using vull = std::vector<ull>;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

using namespace std;

const int mod = 1e9 + 7;
void add_self(int& a, int b) {
	a += b;
	if(a >= mod) a -= mod;
}
void sub_self(int& a, int b) {
	a -= b;
	if(a < 0) a += mod;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	ifstream fin("in.txt");
	ofstream fout("out.txt");
	auto cinbuf = cin.rdbuf(fin.rdbuf());    // save and redirect
	auto coutbuf = cout.rdbuf(fout.rdbuf()); // save and redirect
#endif	
	int n;
	cin >> n;
	string cmp;
	cin >> cmp;
	vi dp(n + 2);
	dp[1] = 1;
	for(int i = 0; i < n - 1; ++i) {
		auto c = cmp[i];
		vi cur(n + 2), pre(n + 2);
		for(int i = 1; i < pre.size(); ++i) {
			add_self(pre[i], dp[i]);
			add_self(pre[i], pre[i - 1]);
		}
		auto sum = [&](int l, int r) {
			int ans = pre[r];
			if(l != 0) sub_self(ans, pre[l - 1]);
			return ans;
		};
		if(c == '<') {
			for(int j = 1; j <= i + 2; ++j) {
				int L = 1, R = j - 1;
				if(L <= R) add_self(cur[j], sum(L, R));
				// for(int t = L; t <= R; ++t) {
				// 	add_self(cur[j], dp[t]);
				// }
			}
		} else {
			for(int j = 1; j <= i + 2; ++j) {
				int L = j, R = i + 1;
				if(L <= R) add_self(cur[j], sum(L, R));
				// for(int t = L; t <= R; ++t) {
				// 	add_self(cur[j], dp[t]);
				// }
			}
		}
		dp = cur;
		// cout << dp << endl;
	}
	int ans = 0;
	for(auto e : dp) {
		add_self(ans, e);
	}
	cout << ans << endl;
#ifndef ONLINE_JUDGE
	cin.rdbuf(cinbuf);    // restore
	cout.rdbuf(coutbuf); // restore
#endif	
}


Measured memory_bytes: 256
using System;

class EntryPoint
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int a = int.Parse(s[0]);
        int b = int.Parse(s[1]);

        Calc c = new Calc();
        c.Compare(a, b);
    }
}

class Calc
{
    public void Compare(int a, int b)
    {
        if (a < b)
            Console.WriteLine("a < b");
        else if (a > b)
            Console.WriteLine("a > b");
        else
            Console.WriteLine("a == b");
    }
}

Measured memory_bytes: 8796
import numpy as np

H, W, N = map(int, input().split())
si, sj = map(int, input().split())
si, sj = si - 1, sj - 1

S = input()
T = input()

piece_remaining = True

low_min = 0
high_max = H - 1

for t in range(N)[::-1]:
	if T[t] == 'U':
		high_max = min(high_max + 1, H - 1)
	elif T[t] == 'D':
		low_min = max(0, low_min - 1)
	
	if S[t] == 'U':
		low_min += 1
	elif S[t] == 'D':
		high_max -= 1
	
	if high_max < low_min:
		piece_remaining = False
		break

if not low_min <= si <= high_max:
	piece_remaining = False


low_min = 0
high_max = W - 1

for t in range(N)[::-1]:
	if T[t] == 'L':
		high_max = min(high_max + 1, W - 1)
	elif T[t] == 'R':
		low_min = max(0, low_min - 1)
	
	if S[t] == 'L':
		low_min += 1
	elif S[t] == 'R':
		high_max -= 1
	
	if high_max < low_min:
		piece_remaining = False
		break

if not low_min <= sj <= high_max:
	piece_remaining = False

print('YES' if piece_remaining else 'NO')


Measured memory_bytes: 21604
from collections import deque
H,W=map(int,input().split())
white=0
s=[]
for y in range(H):
    line=input()
    white+=line.count('.')
    s.append(list(line))

q = deque([(0,0,1)])
q_append=q.append
q_popleft=q.popleft
while q:
    x,y,l=q_popleft()
    if s[y][x]!='.':
        continue
    if x==W-1 and y==H-1:
        print(white-l)
        break
    s[y][x]='*'
    for d in [(1,0),(0,1),(-1,0),(0,-1)]:
        nx, ny=(x+d[0],y+d[1])
        if 0<=nx<W and 0<=ny<H:
            q_append((nx,ny,l+1))
else:
    print(-1)
    


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    int N;
    cin >> N;
    vector<LL> A(N);
    REP(i, N) {
        cin >> A[i];
    }
    /*
    int N = 7;
    vector<int> A = {100, 130, 130, 130, 115, 115, 150};
    */

    LL money = 1000;
    LL stock = 0;
    LL value = 0;
    REP(i, N - 1) {
        LL a = A[i];
        auto il = find_if(A.begin() + i + 1, A.end(), [a](auto x){return x < a;});
        int low = *il;
        auto ih = find_if(A.begin() + i + 1, A.end(), [low](auto x){return low < x;});
        int high = *ih;

        if(0 < ih - il || ih == A.end()) {
            money += stock*A[i];
            stock = 0;
        }
        if(ih - il < 0 || il == A.end()) {
            LL q = money/A[i];
            money -= q*A[i];
            stock += q;
        }
    }
    money += stock*A[N - 1];
    stock = 0;
    cout << money << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

pair<vector<string>, vector<string>> extract(string s1) {
    vector<string> command1, str1;
    bool is_command = true;
    string s= "";
    for (char c : s1) {
        if (c == '"') {
            if (is_command) command1.pb(s);
            else str1.pb(s);
            s = "";
            is_command = !is_command;
            continue;
        }
        s += c;
    }
    if (is_command) command1.pb(s);
    else str1.pb(s);
    return make_pair(command1, str1);
}

int solve(string s1, string s2) {
    pair<vector<string>, vector<string>> verb1 = extract(s1);
    pair<vector<string>, vector<string>> verb2 = extract(s2);

    auto command1 = verb1.first;
    auto str1 = verb1.second;

    auto command2 = verb2.first;
    auto str2 = verb2.second;

    if (command1.size() != command2.size() && str1.size() != str2.size()) return 0;

    for (int i = 0; i < command1.size(); i++) {
        if (command1[i] != command2[i]) return 0;
    }

    int count = 0;
    for (int i = 0; i < str1.size(); i++) {
        if (str1[i] != str2[i]) count++;
    }

    if (count == 0) return 1;
    else if (count == 1) return 2;
    else return 0;
}

int main() {
    cin.tie(0);
    while (1) {
        string s1, s2;
        cin >> s1;
        if (s1 == ".") break;
        cin >> s2;
        int ans = solve(s1, s2);
        if (ans == 1) cout << "IDENTICAL" << endl;
        else if (ans == 0) cout << "DIFFERENT" << endl;
        else if (ans == 2) cout << "CLOSE" << endl;
    }
    return 0;
}


Measured memory_bytes: 3220
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1145141919364364
#define double long double
using namespace std;
typedef pair<ll, ll>P;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll a[114514];
P b[114514];
signed main() {
	ll n, m;
	cin >> n >> m;
	rep(i, n)cin >> a[i];
	sort(a, a + n);
	rep(i, m)cin >> b[i].second >> b[i].first;
	sort(b, b + m);
	reverse(b, b + m);
	ll memo = 0, ans = 0;
	ll p = 0;
	rep(i, m) {
		ans += (min(max((ll)0, (ll)(lower_bound(a, a + n, b[i].first) - a) - memo), b[i].second)) * b[i].first;
		memo += (min(max((ll)0, (ll)(lower_bound(a, a + n, b[i].first) - a) - memo), b[i].second));
	}
	for (int i = memo; i < n; i++)p += a[i];
	cout << ans + p << endl;
	ggr
}


Measured memory_bytes: 2560
#include <iostream>
#include<cmath>
using namespace std;
int main()
{    long double a,b;
     long double avg;
  cin>>a>>b;
  avg=(a+b)/2;
  if(avg==floor(avg))
    cout<<(long)avg<<endl;

  else  cout<<"IMPOSSIBLE"<<endl;
    return 0;
}



Measured memory_bytes: 384
#include <stdio.h>
int main(void){
    
    int W, H, x, y, r;
    
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    
    if(x < r || y < r || W - x < r || H - y < r){
        printf("No\n");
    }else {
        printf("Yes\n");
    }
    
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int ans =0;
  rep(i,s.size()/2){
    if(s[i]!=s[s.size()-i-1])ans++;
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define r_all(a) (a).rbegin(), (a).rend()
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cout<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef priority_queue<ll> pq;

const int MOD = 1e9+7;
const int INF = (1<<28);
const ll INFL = (1L<<61);

int main() {
  int m; cin >> m;
  ll d, c, sum = 0, C = 0;
  rep(i,m) {
    scanf("%lld %lld", &d, &c);
    sum += d * c;
    C += c;
  }
  cout << --sum/9 + C - 1<< endl;
  return 0;
}


Measured memory_bytes: 256
s = int(input())

# 3 million should do for upper limit...
K = [0]*3000000

for i in range (0, 10000000):
	if K[s] == 0:
		K[s]=1
		if s%2 == 0:
			s = int(s/2)
		else:
			s = 3*s+1
	else:
		print(i+1)
		exit()

Measured memory_bytes: 32316
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define DEBUG(debug_x) cerr <<#debug_x<<": "<<debug_x<<endl;
#define DEBUG2(debug_x, debug_y) cerr <<#debug_x<<":"<<debug_x<<" "<<#debug_y<<":"<<debug_y<<endl;
#define DEBUG3(debug_x, debug_y, debug_z) cerr <<#debug_x<<":"<<debug_x<<" "<<#debug_y<<":"<<debug_y<<" "<<#debug_z<<":"<<debug_z<<endl;
#define DEBUGVC(debug_x) cerr <<#debug_x<<": "; for(auto a:debug_x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(debug_x) cerr <<#debug_x<<":"<<endl; for(auto a:debug_x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (200005)
#define INF (1LL << 60)
const int MOD = (int)1e9;
typedef pair<int,int> Pii;
typedef pair<double,double> Pdd;
 
signed main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int, vector<int>, greater<int>> pq;
    for(int i=0; i<N; i++) {
        int a;
        cin >> a;
        pq.push(a);
    }
    vector<Pii> CB(M);
    for(int i=0; i<M; i++) {
        int b, c;
        cin >> b >> c;
        CB[i].first=c;
        CB[i].second=b;
    }
    sort(CB.rbegin(),CB.rend());

    int i=0;
    while(1){
        int p = pq.top(); pq.pop();
        //DEBUG3(p, CB[i].first,CB[i].second);
        if(p >= CB[i].first){
            pq.push(p);
            break;
        }
        p = CB[i].first;
        pq.push(p);
        CB[i].second--;
        if(CB[i].second==0) i++;
    }

    int sum=0;
    while(!pq.empty()) {
        sum += pq.top();
        pq.pop();
    }

    cout << sum << endl;

}

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

int main(){
	int n;
	scanf("%d", &n);
	list<long> ls;
	auto it = ls.begin();
	for(int i = 0; i < n; i++) {
		int y;
		scanf("%d", &y);
		if(y == 0) {
			long x;
			scanf("%ld", &x);
			it = ls.insert(it, x);
		}
		if(y == 1) {
			long d;
			scanf("%ld", &d);
			advance(it, d);
		}
		if(y == 2) {
			it = ls.erase(it);
		}
	}
	for(auto x: ls)
		printf("%ld\n", x);
}



Measured memory_bytes: 18664
N = int(input())
D,X = map(int,input().split())
A = [int(input()) for i in range(N)]

ans = 0

for i in range(N):
    for day in range(1,D+1):
        if (day-1)%A[i] == 0:
            ans += 1
            
print(ans + X)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <cctype>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std;

int main(){
  int i,j;
  int nn,n;
  int xx,yy;
  long double ww;
  long double sum = 0;
  long double ans = 0;
  int a[10][2] = {};
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> a[i][0] >> a[i][1];
  }
  for(i = 0; i < n ;i++){
    for(j = 0; j < n; j++){
      xx = (a[i][0] - a[j][0]) * (a[i][0] - a[j][0]);
      yy = (a[i][1] - a[j][1]) * (a[i][1] - a[j][1]);
      ww = sqrt(xx + yy);
      sum = sum + ww;
    }
  }
  nn = (n - 1) * n;
  ans = (sum / nn)*(n - 1);
  cout << setprecision(20) << ans;
}


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

int N, M;
vector<int> adj[300000];
bool seen[300000];

int dfs(int at) {
	if (seen[at]) return 0;
	seen[at] = 1;
	int num = 1;
	for (int c : adj[at]) {
		num += dfs(c);
	}
	return num;
}

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

	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int u,v;
		cin >> u >> v;
		--u;--v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	int mx = 0;

	for (int i = 0; i < N; ++i) {
		mx = max(mx, dfs(i));
	}

	cout << mx << endl;
}

Measured memory_bytes: 23268
# -*- coding: utf-8 -*-
def main():
    r,D,x = map(int,input().split())
    xs = list()
    xs.append(x)
    for i in range(10):
        xst = r*xs[i]-D
        xs.append(xst)
        if i != 0:
            print(xs[i])
    print(xs[10])
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int a, b;

int main() {
    cin >> a >> b;
    bool flg = true;
    int ca = a / 0.08;
    int cb = b / 0.1;
    if(ca * 0.08 != a) ca++;
    if(cb * 0.1 != b) cb++;
    if(ca > cb) {
        if((int)(ca * 0.1) != b) flg = false;
    }else {
        if((int)(cb * 0.08) != a) flg = false;
    }

    if(flg) cout << max(ca, cb) << endl;
    else cout << -1 << endl;
}

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

using namespace std;

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

	vector<int> cost(n);
	for(auto &i: cost) scanf("%d", &i);

	vector<int> dp(n+1);
	dp[0] = 0;
	dp[1] = abs(cost[1] - cost[0]);
	for(int i = 2; i<n; i++){
		dp[i] = min( dp[i-1] + abs(cost[i] - cost[i-1]), dp[i-2] + abs(cost[i] - cost[i-2]) );
	}
	cout<<dp[n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 1024
from fractions import gcd
def main():
    T=int(input())
    for _ in range(T):
        A,B,C,D=map(int, input().split())
        ans=True
        if B>D or B>A:
            ans=False
        elif B<=C:
            pass
        else:
            i=A%B
            if C<i:
                ans=False
            g=gcd(B,D)
            if g and not ((C-i)//g*g+i<=C and B<=(C-i)//g*g+i+g):
                ans=False
        print("YNeos"[not ans::2])

if __name__ == "__main__":
    main()

Measured memory_bytes: 5728
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<int,int>&a,const pair<int,int>&b)
{
    return (a.second<b.second);
}
int main()
{
    ios;
    int n;
    cin>>n;
    int a[n];
    map<ll,ll>m;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    sort(a,a+n);
    int mx=a[n-1],cnt=0;
    for(int i=0;i<n;i++)
    {
        for(int j=a[i];j<=mx;j+=a[i])
        {
            if(j==a[i]&&m[j]>1)
            {
                cnt+=m[j];
                m[j]=0;
            }
              if(j!=a[i]&&m[j]>=1)
            {
                cnt+=m[j];
                m[j]=0;
            }

        }
    }
    cout<<n-cnt<<endl;

}





























Measured memory_bytes: 66720
fun main() {
    val input = rint()
    val input2 = rspint()
    function(input, input2)
}

fun function(in1: Int, in2: List<Int>) {
    val counts = in2.groupingBy { it }.eachCount()
    for (i in 1..in1) {
        println(counts[i] ?: 0)
    }
}

inline fun rsp() = readLine()!!.split(" ")

inline fun rspint() = rsp().map(String::toInt)

inline fun rint() = readLine()!!.toInt()

Measured memory_bytes: 86884
// https://atcoder.jp/contests/abc171/tasks/abc171_c

use proconio::input;

fn main() {
    input! {
      n: u64
    }
    let mut rest = n;
    let mut name: Vec<u8> = Vec::new();
    while rest > 0 {
        let c = rest % 26;
        name.push(if c == 0 {
            b'z'
        } else {
            (c + b'a' as u64 - 1) as u8
        });
        rest = (rest - 1) / 26;
    }
    name.reverse();
    println!("{}", String::from_utf8(name).unwrap());
}


Measured memory_bytes: 2076
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=1e5+10;
LL a[N];

int main(){
	int n,k;scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
	LL ans=1e17;
	for(int i=1;i<=n-k+1;++i){
		if(a[i]<=0){
			if(a[i+k-1]>0) ans=min(min(ans,a[i+k-1]-2*a[i]),a[i+k-1]*2-a[i]);
			else if(!a[i+k-1]) ans=min(ans,-a[i]);
			else ans=min(ans,-a[i]);
		}
		if(a[i]>0) ans=min(ans,a[i+k-1]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1024