akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

using namespace std;

int main() {
    int x, y, ans = 0;
    
    scanf("%d %d", &x, &y);
    
    if (x == 1) {
        ans += 300000;
    } else if (x == 2) {
        ans += 200000;
    } else if (x == 3) {
        ans += 100000;
    }
    
    if (y == 1) {
        ans += 300000;
    } else if (y == 2) {
        ans += 200000;
    } else if (y == 3) {
        ans += 100000;
    }
    
    if (x == 1 && y == 1) ans += 400000;
    
    printf("%d\n", ans);
    
    return 0;
}


Measured memory_bytes: 128
def main():

    N = input_int()

    prize = set()

    for _ in range(N):
        prize.add(input())
    
    print(len(prize))


def input_int():
    return int(input())


def input_ints():
    return map(int, input().split())


def input_int_list_in_line():
    return list(map(int, input().split()))


def input_int_tuple_list(n: int, q: int):
    return [tuple(map(int, input().split())) for _ in range(n)]


main()


Measured memory_bytes: 97880
#include "bits/stdc++.h"

using namespace std;

int main() {
    char a, b;
    cin >> a >> b;
    if (a == 'H') cout << b << endl;
    else {
        if (b == 'H') cout << 'D' << endl;
        else cout << 'H' << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[A];
		int[] b = new int[B];
		int[] x = new int[M];
		int[] y = new int[M];
		int[] c = new int[M];
		for(int i = 0; i < A; i++) {
			a[i] = sc.nextInt();
		}
		for(int i = 0; i < B; i++) {
			b[i] = sc.nextInt();

		}
		int ma = a[0];
		int mb = b[0];

		for(int i = 0; i < A; i++) {
			if(a[i]<ma)ma = a[i];
		}
		for(int i = 0; i < B; i++) {
			if(b[i]<mb)mb = b[i];
		}
		int m = ma+mb;

		for(int i = 0; i < M; i++) {
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			c[i] = sc.nextInt();
			if(a[x[i]-1]+b[y[i]-1]-c[i] <= m)m = a[x[i]-1]+b[y[i]-1]-c[i];
		}
		System.out.println(m);
	}
}

Measured memory_bytes: 153492
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

void Main() {
	int N; cin >> N;
	if (N == 0) {
		cout << 0 << endl;
		return;
	}
	vi v;
 	while (N > 1 || N < -1) {
		int mod = N % -2;
		N /= -2;
		if (mod < 0) {
			mod += 2;
			N++;
		}
		// debug(N);
		// debug(mod);
		v.push_back(mod);
	}
	if (N == 1) v.push_back(1);
	if (N == -1) {
		v.push_back(1);
		v.push_back(1);
	}
	reverse(ALL(v));
	// debug(v);
	for (int bi : v) cout << bi;
	cout << endl;
}

int main() {
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n;
    cin >> n;
    map<string, int> mp;
    string prev;
    cin >> prev;
    mp[prev] += 1;
    rep (n-1) {
        string t;
        cin >> t;
        if (mp.count(t) > 0) {
            cout << "No" << endl;
            return 0;
        }
        if (prev[prev.size()-1] != t[0]) {
            cout << "No" << endl;
            return 0;
        }
        mp[t] += 1;
        prev = t;
    }
    cout << "Yes" << endl;
}

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

int main(void)
{
	char s[27];
	int i,t[26]={0};
	scanf("%s",s);
	for(i=0;i<strlen(s);i++){
		t[s[i]-'a']++;
	}
	for(i=0;i<26;i++){
		if(t[i]>1){
			puts("no");
			return 0;
		}
	}
	puts("yes");
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>

/*
 *変数
 */
int a,b;

/*
 *解 
 */
void solve(){
    if(b%a==0)printf("%d",b+a);
    else printf("%d",b-a);
    
}

/*
 *入力 
 */
int main(){
       std::cin.tie(0);
       std::ios::sync_with_stdio(false);
       std::cin>>a>>b;
       solve();
       return 0;
}

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

int main(void){
    //char num[128],book[128];
    int num;
    //printf("");
    scanf("%d", &num);
    if(num%10 == 2 || num%10 == 4 || num%10 == 5 || num%10 == 7 || num%10 == 9)
    {
        printf("hon");
    }
    else
    {
        if (num%10 == 0 || num%10 == 1 || num%10 == 6 || num%10 == 8)
        {
            /* code */
            printf("pon");
        }
        else
        {
            printf("bon");
        }
        
    }
    return 0;
}

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

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define rep(i, N) for (ll i = 0; i < (N); i++)
#define FOR(i, a, b) for (ll i = (a), i < (N): i++)
#define all(A) (A).begin(), (A).end()

int main(){
    int N;
    cin >> N;
    int H[N];
    rep(i, N) cin >> H[i];
    rep(i, N - 1) {
        if (H[i] > H[i + 1]) {
            cout << "No" << endl;
            return 0;
        }
        H[i + 1] = max(H[i], H[i + 1] - 1);
    }
    cout << "Yes" << endl;
    return 0;
}


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

struct p{
  int x; int y; char c;
  bool operator<(const p &a)const{
    return x < a.x;
  }
};

int main(){
  int n;
  cin>>n;
  vector<p> s(2*n);
  rep(i,n){
    int x,y;
    cin>>x>>y;
    s[i].x = x; s[i].y = y; s[i].c = 'r';
  }
  rep(i,n){
    int x,y;
    cin>>x>>y;
    s[n+i].x = x; s[n+i].y = y; s[n+i].c = 'b';
  }
  sort(s.begin(),s.end());
  
  vector<pair<int,int>> res;
  int ans = 0;
  
  rep(i,2*n){
    if(s[i].c == 'r'){
      res.pb({s[i].y,s[i].x});
      sort(res.begin(),res.end());
    }else{
      for(int j = res.size()-1;j>=0;j--){
        if(res[j].first < s[i].y){
          ans++;
          res[j].first = 2*n+1;
          break;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
s = input()
c1 = [0] * 10
c2 = [0] * 100
c3 = [0] * 1000
for i in s:
  i = int(i)
  for j in range(100):
    c3[j*10+i] = c2[j]
  for j in range(10):
    c2[j*10+i] = c1[j]
  c1[i] = 1
print(sum(c3))

Measured memory_bytes: 41068
# include <iostream>
# include <algorithm>
# include <cstring>
using namespace std;

void bubble_sort(string* cards, int length) {
    for (int i = 0; i < length; ++i) {
        for (int j = length - 1; j >= i + 1; --j) {
            if (cards[j - 1][1] > cards[j][1]) swap(cards[j - 1], cards[j]);
        }
    }
}

void selection_sort(string* cards, int length) {
    for (int i = 0; i < length; ++i) {
        int min_idx = i;
        for (int j = i + 1; j < length; ++j) {
            if (cards[j][1] < cards[min_idx][1]) min_idx = j;
        }
        if (i != min_idx) swap(cards[i], cards[min_idx]);
    }
}

int main() {
    int n; cin >> n;
    string cards[n], bubble_sorted[n], sel_sorted[n];
    for (int i = 0; i < n; ++i) {
        string val; cin >> val;
        cards[i] = val, bubble_sorted[i] = val, sel_sorted[i] = val;
    }

    bubble_sort(bubble_sorted, n);
    selection_sort(sel_sorted, n);
    
    
    for (int i = 0; i < n - 1; ++i) cout << bubble_sorted[i] << " ";
    cout << bubble_sorted[n - 1] << endl;
    cout << "Stable" << endl;
    
    for (int i = 0; i < n - 1; ++i) cout << sel_sorted[i] << " ";
    cout << sel_sorted[n - 1] << endl;
    string sort_type = "Stable";
    for (int i = 0; i < n; ++i) {
        if (bubble_sorted[i] != sel_sorted[i]) {
            sort_type = "Not stable";
            break;
        }
    }
    cout << sort_type << endl;
    
    return 0;
}


Measured memory_bytes: 3220
#include <iostream>

using namespace std;

using i64 = int64_t;

i64 gcd(i64 x, i64 y) {
    if (x % y == 0) return y;
    else return gcd(y, x % y);
}

i64 lcm(i64 x, i64 y) {
    return x * y / gcd(x, y);
}

int main()
{
    i64 A,B;
    cin >> A >> B;

    cout << lcm(A, B) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a*b>c*d)
	{
		cout<<a*b;
	}
		if(a*b<c*d)
	{
		cout<<c*d;
	}
		if(a*b==c*d)
	{
		cout<<a*b;
	}
	return 0;	
 }

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

const ll large_P = 1e9 + 7;


int main(){
  ll N, K;
  cin >> N >> K;
  
  vector<ll> H(N);
  rep(i, N) cin >> H.at(i);
  
  sort(H.begin(), H.end(), greater<int>());
  
  ll res = 0;
  if(K >= N) res = 0;
  else{
    rep(i, N-K) res += H.at(i + K);
  }
  
  cout << res;
  
  
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

#pragma warning(disable:4996)
using namespace std;



int main() {
	int C, N, M; cin >> C >> N >> M;
	vector<int>dp(C+1);
	for (int i = 0; i < N; ++i) {
		vector<int>nextdp(dp);
		int s,p;cin>>s>>p;
		for (int w = 0; w <= C - s; ++w) {
			int nw(w+s);
			nextdp[nw]=max(nextdp[nw],dp[w]+p);
			
		}
		dp=nextdp;
	}
	for (int i = 1; i <= M; ++i) {
		int ans=i*dp[C/i];
		cout<<ans<<endl;
	}
	return 0;
} 


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

using namespace std;

int main(){
    int N;
    cin >> N;
    int X[N], Y[N];
    for(int i = 0; i < N; i++){
        cin >> X[i];
        Y[i] = X[i];
    }

    sort(Y, Y+N);
    
    for(int i = 0; i < N; i++){
        if(X[i] <= Y[N/2 - 1]){
            cout << Y[N/2] << endl;
        }else{
            cout << Y[N/2-1] << endl;
        }
    }


    return 0;
}

Measured memory_bytes: 3712
import numpy as np
 
n=int(input())
w=list(map(int, input().split()))
s=[0]*n
 
for i in range(n):
  a = np.sum(w[:i])
  b = np.sum(w)
  c = b - a
  s[i] = abs(a-c)
  
print(int(np.min(s)))

Measured memory_bytes: 12396
#include <bits/stdc++.h>
using namespace std;
int d[10], k;
bool valid(int x)
{
    while (x)
    {
        if (d[x % 10])
            return false;
        x /= 10;
    }
    return true;
}
int32_t main()
{
    ios::sync_with_stdio(0);
    int n;
    cin >> n >> k;
    for (int i = 0; i < k; ++i)
    {
        int x;
        cin >> x;
        d[x] = true;
    }
    int ans;
    for (ans = n; !valid(ans); ++ans);
    cout << ans << '\n';
    return 0;
}

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

if n%2 == 1:
  print(0)
else:
  out = 0
  n //= 2
  x = math.log((10**18)//2, 5)
  for i in range(math.floor(x)):
    out += n // 5**(i+1)

  print(out)
  
  

  

      


Measured memory_bytes: 2940
def trace(a)
  puts a.join(" ")
end

def insertionSort(a, n)
  for i in 1..n-1 do
    v = a[i]
    j = i - 1
    while j >= 0 && a[j] > v do
      a[j+1] = a[j]
      j -= 1
    end
    a[j+1] = v
    trace(a)
  end
end

n = gets.to_i
a = gets.split.map(&:to_i)
trace(a)
insertionSort(a, n)



Measured memory_bytes: 6892
def equ(s,t):
    for i in range(len(t)):
        if t[i]!=s[i]!='?':
            return False
    return True

S1=input()
T=input()

l=len(S1)
m=len(T)

S=''
for i in range(l-m,-1,-1):
    if equ(S1[i:i+m],T):
        S=(S1[:i]+T+S1[i+m:]).replace('?','a')
        break

print(S if S!='' else 'UNRESTORABLE')

Measured memory_bytes: 38256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int a, b;
  cin >> a >> b;
  if ((a * b) % 2 == 0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args){
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[][] a = new int[110][5];
        
        for(int i = 0 ; sc.hasNext() ; i++){
            for(int j = 0 ; j < 2 ; j++){
                a[i][j] = sc.nextInt();
            }
        }
        
        int count = 0;
        boolean ans = false;
                
        for(int i = 0 ; i < N ; i++){
            

            if((a[i][0] == a[i][1])){
                count++;
                if(count >= 3){
                    ans = true;
                }
            }else{
                count = 0;
            }
        }
        
        if(ans){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 27260
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  rep(i,N){
    cin>>S.at(i);
    sort(S.at(i).begin(),S.at(i).end());
  }
  long long ans=0;
  sort(S.begin(),S.end());
  int i=1;
  long long sum=0;
  rep(i,N-1){
    if(S.at(i)==S.at(i+1)){
      sum++;
    }
    else{
      ans+=sum*(sum+1)/2;
      sum=0;
    }
  }
  ans+=sum*(sum+1)/2;
  cout<<ans<<endl;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define INF (1e18)

int main(){   
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B;
    cin >> A >> B;
A--;
ll ans=0;
    rep(i,0,41){
ll r= 1LL<<(i+1);
ll r2=1LL<<i;
ll aa=A%r;
ll bb=B%r;
aa=max(0LL,aa-r/2+1);
bb=max(0LL,bb-r/2+1);
if(abs(r2*(A/r)+aa-r2*(B/r)-bb)%2==1){
ans+=r/2;
}
}
print(ans);
}


Measured memory_bytes: 256
N,Q = map(int,input().split())
ab=[list(map(int,input().split()))for _ in range(Q)]
par = [i for i in range(N+1)]
rank = [0]*(N+1)
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]
def same(x,y):
    return find(x) == find(y)
def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    if rank[x] < rank[y]:
        par[x] = y
    else:
        par[y] = x
        if rank[x]==rank[y]:rank[x]+=1

for a,b in ab:
    unite(a,b)
for a,b in ab:
    unite(a,b)

from collections import*
C=Counter(par)
A=max(C.values())
print(A)

Measured memory_bytes: 55068
import java.io.PrintWriter;
import java.util.*;

import static java.lang.Math.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in); 
		PrintWriter out=new PrintWriter(System.out);
		
		while(sc.hasNext()){
			int ans = sc.nextInt();
			int count=0;
			for (int a = 0; a < 10; a++ ){
				for (int b = 0; b < 10; b++ ){
					for (int c = 0; c < 10; c++ ){
						for (int d = 0; d < 10; d++ ){
							int sum = a + b + c + d;
							if(sum == ans )count++ ;
						}
					}
				}
			}
			System.out.println(count);
		}
	}

}

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

ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}

int main(){
    rep(i,5){
        int a; cin >> a;
        if(a==0){
            cout << i+1 << endl;
            return 0;
        }
        
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    int n,k;
    cin >> n >> k;
    if(k > ((n-1)*(n-2))/2){
        cout << -1 << endl;
        return 0;
    }
    int m = (n*(n-1))/2 - k;
    vector<P> ans;
    for(int i=1;i<n;i++) ans.push_back(P(0,i));
    int cnt = n-1;
    bool ok = true;
    for(int i=1;i<n;i++){
        for(int j = i+1;j<n;j++){
            if(cnt >= m) {
                ok = false;
                break;
            }
            ans.push_back(P(i,j));
            cnt ++;
        }
        if(!ok) break;
    }

    cout << m << endl;
    for(P p:ans){
        cout << p.first+1 << " " << p.second+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 384
void main(){
	int r = _scan();
	( r^^2 ).writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2660
n,q = map(int, input().split())
s = input()
a = [0]*n
for i in range(n):
  if s[i-1]=="A" and s[i]=="C":
    a[i] = a[i-1]+1
  else:
    a[i] = a[i-1]
for i in range(q):
  l,r = map(int, input().split())
  print(a[r-1]-a[l-1])

Measured memory_bytes: 11544
#include <bits/stdc++.h>
#define PB push_back
#define FT first
#define SD second
#define MP make_pair
#define INF 0x7fffffff
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int>  P;
typedef vector<int> VI;
typedef map<int,int> MII;
const int N = 3e5 + 10, MOD = 998244353;
LL C[N];
LL pw(LL x, int k)
{
    LL res = 1LL;
    while(k) 
    {
        if(k&1) res = res * x % MOD;
        x = x * x % MOD;
        k >>= 1;
    }
    return res;
}
void init(int n)
{
    C[0] = 1;
    for(int i = 0;i < n;i ++)
    {
        C[i+1] = C[i] * (n - i) % MOD * pw(i + 1, MOD - 2) % MOD;
    }
}
int main()
{
#ifdef YUUKILP
    freopen("in.txt","r",stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    LL k;
    cin >> n >> a >> b >> k;
    init(n);
    LL ans = 0;
    for(int i = 0;i <= n;i ++)
    {
        if((k - 1ll * i * a) % b == 0)
        {
            int j = (k - 1ll * i * a) / b;
            if(j >= 0 && j <= n) ans = (ans + C[i] * C[j] % MOD) % MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PI;
typedef pair<LL, LL> PLL;
const LL MOD = 1000000007LL;
const int inf = 1e9;
const LL INF = 1e18;
int main() {
	int N;
	cin >> N;
	vector<tuple<int, int, int>> v;
	for (int i = 0; i < 2 * N; i++) {
		int a, b;
		cin >> a >> b;
		v.emplace_back(a, b, i < N);
	}
	sort(v.begin(), v.end());
	int ans = 0;
	set<int> S;
	for (int i = 0; i < 2 * N; i++) {
		if (get<2>(v[i])) {
			S.insert(get<1>(v[i]));
		}
		else {
			auto itr = S.lower_bound(get<1>(v[i]));
			if (itr == S.begin()) continue;
			S.erase(--itr);
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int x,y;
    int i,j;
    int match_cnt;
    int groups[3][7] = {
        {1,3,5,7,8,10,12},
        {4,6,9,11},
        {2}
    };

    scanf("%d %d",&x,&y);

    for(i = 0;i < 3;i++){
        match_cnt = 0;
        for(j = 0;j < 7;j++){
            if(x == groups[i][j] || y == groups[i][j]){
                match_cnt++;
            }
        }
        if(match_cnt == 2){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 128
import java.io.*;
import java.math.BigInteger;
import java.util.*;
 
public class Main{
	
 
	public void solve(){
		long A = nextLong();
		long B = nextLong();
		long C = nextLong();

		BigInteger a = BigInteger.valueOf(A);
		BigInteger b = BigInteger.valueOf(B);
		BigInteger c = BigInteger.valueOf(C);
		
		
		BigInteger aa = BigInteger.valueOf(A / 2);
		BigInteger aaa = BigInteger.valueOf(A - (A / 2));
		
		BigInteger ans = aaa.multiply(b).multiply(c).subtract(aa.multiply(b).multiply(c));

		

		aa = BigInteger.valueOf(B / 2);
		aaa = BigInteger.valueOf(B - (B / 2));

		BigInteger ans2 = aaa.multiply(a).multiply(c).subtract(aa.multiply(a).multiply(c));
		if(ans2.compareTo(ans) < 0){
			ans = ans2;
		}
		

		aa = BigInteger.valueOf(C / 2);
		aaa = BigInteger.valueOf(C - (C / 2));
		 ans2 = aaa.multiply(a).multiply(b).subtract(aa.multiply(a).multiply(b));
			if(ans2.compareTo(ans) < 0){
				ans = ans2;
			}
			
		out.println(ans);
	}
	
	private static PrintWriter out;
	public static void main(String[] args){
		out = new PrintWriter(System.out);
		new Main().solve();
		out.flush();
	}
	
	
	
	public static int nextInt(){
		int num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10 + (c - '0');
		}
		return minus ? -num : num;
	}
	
	public static long nextLong(){
		long num = 0;
		String str = next();
		boolean minus = false;
		int i = 0;
		if(str.charAt(0) == '-'){
			minus = true;
			i++;
		}
		int len = str.length();
		for(;i < len; i++){
			char c = str.charAt(i);
			if(!('0' <= c && c <= '9')) throw new RuntimeException();
			num = num * 10l + (c - '0');
		}
		return minus ? -num : num;
	}
	public static String next(){
		int c;
		while(!isAlNum(c = read())){}
		StringBuilder build = new StringBuilder();
		build.append((char)c);
		while(isAlNum(c = read())){
			build.append((char)c);
		}
		return build.toString();
	}
	
	
	private static byte[] inputBuffer = new byte[1024];
	private static int bufferLength = 0;
	private static int bufferIndex = 0;
	private static int read(){
		if(bufferLength < 0) throw new RuntimeException();
		if(bufferIndex >= bufferLength){
			try{
				bufferLength = System.in.read(inputBuffer);
				bufferIndex = 0;
			}catch(IOException e){
				throw new RuntimeException(e);
			}
			if(bufferLength <= 0) return (bufferLength = -1);
		}
		return inputBuffer[bufferIndex++];
	}
	
	private static boolean isAlNum(int c){
		return '!' <= c && c <= '~';
	}
}

Measured memory_bytes: 8276
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using Edge = pair<ll,ll>;
using Graph =vector<vector<Edge>>;
vector<int> color;
Graph G;
ll N;
void dfs(ll v,ll o=-1,ll c=0){
for(auto u:G[v]){
  if(color[u.first]!=-1)continue;
  if(u.second%2==0)color[u.first]=c,dfs(u.first,v,c);
  else color[u.first]=1-c,dfs(u.first,v,1-c);
  
}
}
int main() {
cin>>N;
G.resize(N);
rep(i,N-1){
  ll a,d,c;
  cin>>a>>d>>c;
  --a;
  --d;
  G[a].push_back(Edge(d,c));
  G[d].push_back(Edge(a,c));
}
color.resize(N,-1);
color[0]=0;
dfs(0);
rep(i,N)cout<<color[i]<<endl;
return 0;
}


Measured memory_bytes: 10496
#【註】入力受け取り部分 …… そのまま用いています。
A = input()
B = input()
C = input()

#【註】現在 A, B, C がカードを何枚目まで切っているかを示す変数 …… そのまま用いています。
xa = 0
xb = 0
xc = 0

#【註】関数 next は、単純に A[xa] や B[xb] および C[xc] を用いることで
# 複雑な処理を行うことなく次の手番が誰になるかを確認できるため、今回の
# 解答となるコードからは削除しました。

#【註】最初の A の手番の処理
h = 'A'
k = A[xa] #【註】 next 関数を削除し、A[xa] を用いて A の 0 枚目のカードを参照するように変更しました。
xa += 1

#【註】このゲームの勝敗が決まるタイミングに着目します。
# このゲームは、「場に出たカードに書かれているプレイヤー」のカードが
# 残り 0 枚だったとき、そのプレイヤーが勝利するようになっています。
# そのため、ループ構造は「カードを場に出す」→「もしもそのプレイヤーが勝つならループを抜ける、そうでなければ
# 次のカードを場に出させる（ループを続ける）」という形になるのが適切です。
# カードを場に出した際にループが続くか・ループから抜けるかが決まるため、while 文は
# 条件式を True とし、ループから抜ける処理が走るまでループさせ続けるとよいでしょう。
while True:

    #【註】場に出たカードに書かれている文字（ k ）に注目 … この if 文の構造はそのまま用いています。
    if k == 'a':
        h = 'A'  #【註】h（誰の手番になったのか）を更新 …… そのまま用いています。

        #【註】もし次に参照するべきカードの順番：xa がカードの枚数：len(A) より小さければ、
        # A に 1 枚カードを出させる（k に A[xa] を代入し、xa に 1 を足す）処理をします。
        if xa < len(A): 
            k = A[xa]
            xa += 1
        #【註】そうでなければ、A はもうカードを持っていないことになりますから、このループを抜けることができます。
        else:
            break

    elif k == 'b':
        h = 'B'
        xb += 1
        if xb < len(B):
            k = B[xb]
            xb += 1
        else:
            break
    else:
        h = 'C'
        xc += 1
        if xc < len(C):
            k = C[xc]
            xc += 1
        else:
            break

print(h)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define inlld(x) scanf("%lld", &x)
#define ind(x) scanf("%d", &x)
#define inlld2(x, y) scanf("%lld%lld", &x, &y)
#define inlld3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z)
#define ind2(x, y) scanf("%d%d", &x, &y)
#define ind3(x, y, z) scanf("%d%d%d", &x, &y, &z)

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

typedef long long ll;
typedef long double ld;

using namespace std;

int main()
{
	string x;
	cin>>x;
	int n = x.length();
	for(int a = 0; a < n; a++)
		if(x[a] == '7')
		{
			cout<<"Yes";
			return 0;
		}
	cout<<"No";
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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 vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int N, M; cin >> N >> M;
  string S; cin >> S;
  vector<int> tmp; int res = 1;
  REP(i, N + 1) {
    if(i == 0) continue;
    if(S[i] == '0') {
      tmp.push_back(res);
      res = 1;
    } else {
      res++;
    }
  }
  int ans = 0;
  REP(i, tmp.size()) {
    if(tmp[i] > M) ans = -1;
  }
  if(ans == -1) {
    cout << ans << endl;
  } else {
    int a = 0;
    vector<int> ans2;
    for(int i = tmp.size() - 1; i >= 0; --i) {
      if(a + tmp[i] <= M) a += tmp[i];
      else {
        ans2.push_back(a);
        a = 0; a += tmp[i];
      }
      if(i == 0) ans2.push_back(a);
    }
    for(int i = ans2.size() - 1; i >= 0; --i) {
      cout << ans2[i] << " ";
    }
    cout << endl;
  }
  
}

Measured memory_bytes: 4300
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <thread>
#include <chrono>
#include <queue>

using namespace std;

int main(void){
	string s;
	cin >> s;
	for(int i=0;i<s.length();i=i+2){
		cout << s.at(i);
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 512
gets
d = gets.split.map(&:to_f).zip(gets.split.map(&:to_f)).map{|x, y| (x-y).abs}
(1..4).each do |i|
  puts ((i == 4) ? d.max : d.map{|c| c**(i)}.inject(:+)**(1.0/i))
end

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

long gcd(long a, long b) {
    long c = a % b;
    a = b, b = c;
    while (b != 0) {
        c = a % b;
        a = b, b = c;
    }

    return a;
}

long gcd_tri(long a, long b, long c) {
    if(a > b) {
        swap(a, b);
    }
    if (a > c) {
        swap(a, c);
    }
    return gcd(gcd(a, b), c);
}

int main() {
    int k;
    cin >> k;
    long long sum = 0;
    for (int i = 1; i <= k; ++i) {
        for (int j = 1; j <= k; ++j) {
            for (int l = 1; l <= k; ++l) {
                sum += gcd_tri(i, j, l);
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
const int N=2010;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
const int mod=924844033;
int f[N],g[N];
int fac[N],inv[N];
inline int C(int n,int m) {
	if (n<m||m<0) return 0;
	return 1LL*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
inline void work(int n,int m) {
	int i,j;m--;
	for (i=(m+1)/2;i;i--)
		g[i]=C(m-i+1,i);
	for (i=n;i;i--)
		for (j=min(i,(m+1)/2);j;j--)
			f[i]=(f[i]+1LL*g[j]*f[i-j])%mod;
}
int main()
{
	int n=gi(),m=gi(),i,ans=0;
	for (i=fac[0]=1;i<=n;i++) fac[i]=1LL*fac[i-1]*i%mod;
	for (i=2,inv[0]=inv[1]=1;i<=n;i++) inv[i]=-1LL*(mod/i)*inv[mod%i]%mod;
	for (i=3;i<=n;i++) inv[i]=1LL*inv[i-1]*inv[i]%mod;
	
	f[0]=1;
	for (i=(n%m)*2;i;i--) work(n,n/m+1);
	for (i=(m-n%m)*2;i;i--) work(n,n/m);

	for (i=0;i<=n;i++) ans=(ans+(i&1?-1LL:1LL)*fac[n-i]*f[i])%mod;
	printf("%d\n",(ans+mod)%mod);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(i=0;i<n1;i++) L[i] = A[left + i];
  for(i=0;i<n2;i++) R[i] = A[mid  + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k=left; k<right; k++) {
    if(L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j].value <= x.value) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if(p<r) {
    q = partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for(i=0;i<n;i++) {
    scanf("%s %d",S,&v);
    A[i].suit =  B[i].suit  = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);

  for(i=0;i<n;i++) {
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++) {
    printf("%c %d\n",B[i].suit,B[i].value);
  }

  return 0;
}


Measured memory_bytes: 4132
#include<bits/stdc++.h>
#define EM 100000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vLL = vector<LL>;
using vvLL = vector<vector<LL>>;

vint color(100010, 0);
vvint G(100010);
bool dfs(int v, int c){
	color[v] = c;
	for(auto g : G[v]){
		if(color[g] == c)	return false;
		if(color[g] == 0 && !dfs(g, -c))	return false;
	}
	return true;
}
int main(){
	LL N, M;
	cin >> N >> M;
	for(int i = 0;i < M;i++){
		int ai, bi;
		cin >> ai >> bi;
		G[ai-1].push_back(bi-1);
		G[bi-1].push_back(ai-1);
	}
	bool f = dfs(0, 1);
	LL r = 0, b = 0;
	for(int i = 0;i < N;i++){
		if(color[i] == 1)	r++;
		else 	b++;
	}

	if(f)	cout << (r*b-M) << endl;
	else 	cout << (N*(N-1)/2-M) << endl;
}

Measured memory_bytes: 6528
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
using namespace std;
using ll = long long;
#define rep(i,k) for (int i = 0; i < (int)(k); i++)
#define all(c) begin(c), end(c)
#define int ll


int solve(int h, int w) {
    if (h < w) swap(h, w);
    int res = 0;
    if (h%w != 0) {
        res += (h / w) * 2 * w;
        res += solve(w, h%w);
    } else {
        res += ((h / w) * 2 - 1) * w;
    } 
    //cout << h << ' ' << w << ' ' << res << endl;
    return res;
}

signed main() {
    int n; int x;
    while (cin >> n >> x) {
        int h = x;
        int w = n - x;
        cout << h + w + solve(h, w) << endl;
    }
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#define ll long long int
#define MOD 1000000007LL
using namespace std; 
int main() {
    int n,kk;
    cin>>n>>kk;
    ll x[60]={};
    ll y[60]={};
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }
    ll ans=3999999996000000020;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                for(int l=0;l<n;l++){
                    
                    if((x[i]==x[j])||(y[k]==y[l])){
                        continue;
                    }
                    int c=0;
                    for(int m=0;m<n;m++){
                        if(x[i]<x[j]){
                            if((x[i]<=x[m])&&(x[m]<=x[j])){
                                c=c;
                            }else{
                                continue;
                            }
                        }else{
                            if((x[i]>=x[m])&&(x[m]>=x[j])){
                                c=c;
                            }else{
                                continue;
                            }
                        }
                        if(y[k]<y[l]){
                            if((y[k]<=y[m])&&(y[m]<=y[l])){
                                c++;
                            }else{
                                continue;
                            }
                        }else{
                            if((y[k]>=y[m])&&(y[m]>=y[l])){
                                c++;
                            }else{
                                continue;
                            }
                        }
                    }
                    if(c<kk){
                        continue;
                    }
                    ll s=abs(x[i]-x[j])*abs(y[k]-y[l]);
                    if(s<ans){
                        ans=s;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
package main

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

func max(a, b uint) uint {
	if a >= b { return a}
	return b
}

func main(){
	r := bufio.NewReader(os.Stdin)
	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()

	var N int 
	fmt.Fscan(r, &N)
	var ans uint = 0
	for i := 0; i < N; i++ {
		var a uint
		fmt.Fscan(r, &a)
		for a > 0 && a%2 == 0{
			a /= 2;
			ans++;
		}
	}
	

	fmt.Fprintln(w, ans)
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define popb pop_back()
#define sz size()
#define y1 dfsdsfsdfsd
#define next fdsfsdfjkl
#define int long long
#define endl "\n"
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
double pi = acos(-1.0);
int mod = 1e9+7;
const double eps = (double)1e-9;
const ll INF = 1e18+7;
/////////////////////////////////////////
 
 
int n,k;
 
main(){speed;
    cin>>n>>k;
    int ans = 0;
    for(int i=1;i<=n;i++) {
        int x;
        cin>>x;
        if(x>=k) ans++;
    }
    
    cout<<ans;
}

Measured memory_bytes: 256
import itertools
H, W = [int(_) for _ in input().split()]
S = []
count_dot = 0
for _ in range(H):
    s = input()
    count_dot += s.count('.')
    S += [list(s)]
S[0][0] = '#'
coord = [[0, 0]]
count = 1
flag = True
while flag:
    count += 1
    coord_new = []
    for i, j in coord:
        for x, y in [i + 1, j], [i - 1, j], [i, j + 1], [i, j - 1]:
            if (x, y) == (H - 1, W - 1):
                print(count_dot - count)
                exit()
            elif 0 <= x and x < H and 0 <= y and y < W and S[x][y] == '.':
                S[x][y] = '#'
                coord_new += [[x, y]]
    coord = coord_new
    flag = len(coord)
print(-1)

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

using ll = long long;


void solve(long long N, std::vector<long long> A){
    vector<int> sieve(1e6 + 1);
    sort(A.begin(), A.end());
    set<int> se;
    for(int i = 0;i < N - 1;i++){
        if(A[i] == A[i+1]){
            se.insert(A[i]);
        }
    }
    A.erase(unique(A.begin(), A.end()), A.end());
    for(int i = 0;i < A.size();i++){
        int a = A[i];
        int cnt = 2;
        while(a * cnt < sieve.size()){
            sieve[a * cnt] = 1;
            cnt++;
        }
    }
    int ans = 0;
    for(int i = 0;i < A.size();i++){
        if(se.find(A[i]) == se.end() && sieve[A[i]] == 0){
            ans++;
        }
    }
    cout<<ans<<endl;
}

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


Measured memory_bytes: 9500
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp51 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int D = st[0];
            int G = st[1];

            int[] p = new int[D];
            int[] c = new int[D];

            for (int i = 0; i < D; i++) {
                var t = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
                p[i] = t[0];
                c[i] = t[1];
            }

            int ans = p.Sum();  //初めはansは考えうる最大の値を入れておく

            int nowSum = 0;
            int nowAns = 0;

            //全てパターン試す
            for (int s = 0; s < (1 << D); s++) {
                nowSum = 0;
                nowAns = 0;

                //コンプリートしたところだけをまずは足していく
                for (int i = D - 1; i >= 0; i--) {
                    //今、何問目？
                    int nowPro = D - i - 1;
                    //i桁目のビットが立っているかどうか
                    if ((s & (1 << i)) != 0) {
                        //i問目をコンプリートした
                        nowSum += p[nowPro] * (nowPro + 1) * 100 + c[nowPro];
                        nowAns += p[nowPro];
                    }
                }

                //コンプリートしていないとこを順次足していく
                for (int i = D - 1; i >= 0; i--) {
                    //今、何問目？
                    int nowPro = i;
                    if ((s & (1 << (D - i - 1))) == 0) {
                        for (int j = 1; j <= p[nowPro] - 1; j++) {
                            if (nowSum >= G) {
                                goto warp;
                            }
                            nowSum += (nowPro + 1) * 100;
                            nowAns++;
                        }
                    }
                }

                warp:

                if (nowSum >= G) {
                    ans = Math.Min(ans, nowAns);
                }
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static final int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int r = parseInt(sc.next());
		sc.close();
		out.println(r*2*Math.PI);
	}
}


Measured memory_bytes: 27056
#include <bits/stdc++.h>
using namespace std;
const int N = 105 ;
int n ;
int a[500] , b[500] , c[500] , d[500] ; 
vector < int > g[500] ; 

bool bpm( int u, bool seen[], int matchR[])
{
    // Try every job one by one
    for (auto v : g[u] )
    {
        // If applicant u is interested in job v and v is
        // not visited
        if ( !seen[v])
        {
            seen[v] = true; // Mark v as visited
 
            // If job 'v' is not assigned to an applicant OR
            // previously assigned applicant for job v (which is matchR[v]) 
            // has an alternate job available. 
            // Since v is marked as visited in the above line, matchR[v] 
            // in the following recursive call will not get job 'v' again
            if (matchR[v] < 0 || bpm( matchR[v], seen, matchR))
            {
                matchR[v] = u;
                return true;
            }
        }
    }
    return false;
}
int maxBPM()
{
    // An array to keep track of the applicants assigned to
    // jobs. The value of matchR[i] is the applicant number
    // assigned to job i, the value -1 indicates nobody is
    // assigned.
    int matchR[N];
 
    // Initially all jobs are available
    memset ( matchR, -1, sizeof(matchR));
 
    int result = 0; // Count of jobs assigned to applicants
    for (int u = 0; u <  n ; u++)
    {
        // Mark all jobs as not seen for next applicant.
        bool seen[N];
        memset(seen, 0, sizeof(seen));
 
        // Find if the applicant 'u' can get a job
        if (bpm( u, seen, matchR))
            result++;
    }
    return result;
}

int main() {
   
    cin >> n  ;
    for ( int i = 0 ; i < n ;++i){
          cin >>  a[i] >> b[i] ;  
    }
    for ( int i = 0 ; i < n ; ++i ){
          cin >> c[i] >> d[i];
          for ( int j = 0 ; j < n  ; ++ j ){
               if ( a[j] < c[i] && b[j] <  d[i] )  g[i].push_back ( j ) ; 
          }
    }
    
    cout << maxBPM() ; 
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= 9; i++)
		for (int j = 1; j <= 9; j++)
		{
			if (i * j == n)
			{
				puts("Yes");
				return 0;
			}
		}
	puts("No");
}


Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;
 
 int main()
 {
   int N;
   int arr[20][20];
   while(cin>>N&&N)
   {
     for(int i=0;i<N;i++) for(int j=0;j<N;j++) arr[i][j]=0;
     int x=N/2+1;
     int y=N/2;
     int count=1;
     arr[x][y]=count++;
     while(count!=(N*N+1))
     {
       x++;
       y++;
       if(x<N&&y<N&&(arr[x][y]!=0))
       { 
         x--;
         y--;
         x=(x+2)%N;
         //cout<<x<<" "<<y<<endl;
         arr[x][y]=count++;
         //cout<<count<<endl;
       }
       else
       {
         if(x>=N) x=0;
         if(y>=N) y=0;
         //cout<<x<<" "<<y<<endl;
         if(arr[x][y]!=0)
         {
           x=(x-1+N)%N;
           y=(y-1+N)%N;
           x=(x+2)%N;
           arr[x][y]=count++;        
         }
         else arr[x][y]=count++;
       }          
     }          
     for(int i=0;i<N;i++)
     {
       for(int j=0;j<N;j++)
       {
         if(arr[i][j]<10) cout<<"   "<<arr[i][j];
         else if(arr[i][j]>=10&&arr[i][j]<=99) cout<<"  "<<arr[i][j];
         else cout<<" "<<arr[i][j];        
       }
       cout<<endl;        
     }      
   }
   //while(1);
   return 0; 
 }

 
  

Measured memory_bytes: 2988
use std::io;


fn get_line() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main () {
    let nm = get_line().split_whitespace().map( |s| s.parse().unwrap() ).collect::<Vec<u64>>();
    let n = nm[0]; let m = nm[1];
    println!("{}", solve(n,m));
}

fn solve(n:u64, m:u64) -> u64 {
    if n*2 > m { // enough s's
        m / 2
    } else {
        let rem = m - n*2;
        n + (rem / 4)
    }
}

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

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, M; cin >> N >> M;
    int left = 1, right = N;
    for(int i=0;i<M;i++){
        int l, r; cin >> l >> r;
        left = max(left, l);
        right = min(right, r);
    }
    cout << max(0, right-left+1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c,d;
  scanf("%d %d %d", &a, &b, &c);
  if(a > b){
    d = b;
    b = a;
    a = d;
  }

  if(b > c){
    d = c;
    c = b;
    b = d;
  }
  if(a > b){
    d = b;
    b = a;
    a = d;
  }
    
  printf("%d %d %d\n", a, b, c);
  return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a, b, c;
	cin >> a >> b >> c;
	int ans = 3;
	if(a==b)
		ans--;
	if(b==c)
		ans--;
	if(a==c)
		ans--;
	if(a==b && b==c)
		ans = 1;
	cout << ans;
	return 0;
} 

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

using namespace std;

struct SegTree {
  int n, start;
  vector<vector<pair<int, int>>> graph;
  vector<int> stop;
  
  SegTree(int n, int m) : n(n), graph(8 * n + m), stop(n) {
    init(1, 0, n - 1);
  }
  
  void add(int a, int b, int c) {
    graph[a].emplace_back(b, c);
  }

  void init(int node, int b, int e) {
    if (b == e) {
      add(2 * node, 2 * node + 1, 0);
      add(2 * node + 1, 2 * node, 0);
      if (b == 0) start = node * 2;
      stop[b] = node * 2 + 1;
    } else {
      int m = (b + e) / 2;
      add(4 * node + 0, 2 * node + 0, 0);
      add(4 * node + 2, 2 * node + 0, 0);
      add(2 * node + 1, 4 * node + 1, 0);
      add(2 * node + 1, 4 * node + 3, 0);
      init(node * 2, b, m);
      init(node * 2 + 1, m + 1, e);
    }
  }

  void add(int node, int b, int e, int l, int r, int to, int c) {
    l = max(l, b);
    r = min(r, e);

    if (l > r) return;
    if (b == l && e == r) {
      add(2 * node, to, c);
      add(to, 2 * node + 1, 0);
      return;
    }
    int m = (b + e) / 2;
    add(node * 2, b, m, l, r, to, c);
    add(node * 2 + 1, m + 1, e, l, r, to, c);
  }

  void Add(int l, int r, int idx, int c) {
    add(1, 0, n - 1, l, r, idx + 8 * n, c);
  }

  long long Solve() {
    const long long kInf = 2e18;

    vector<long long> dist(graph.size(), kInf);
    priority_queue<pair<long long, int>> pq;
    auto push = [&](int node, long long d) {
      if (dist[node] <= d) return;
      dist[node] = d;
      pq.emplace(-d, node);
    };
    push(start, 0);
    while (!pq.empty()) {
      int node; long long d; tie(d, node) = pq.top(); pq.pop(); d = -d;
      if (dist[node] != d) continue;
      for (auto e : graph[node]) {
        int vec, cost; tie(vec, cost) = e;
        push(vec, cost + d);
      }
    }
    if (dist[stop[n - 1]] == kInf)
      return -1;
    return dist[stop[n - 1]];
  }
};

int32_t main() {
  int n, m; cin >> n >> m;
  SegTree st(n, m);
  for (int i = 0; i < m; ++i) {
    int l, r, c; cin >> l >> r >> c;
    //cerr << "ADDING " << i << endl;
    st.Add(l - 1, r - 1, i, c);
  }
  //cerr << "SOLVING" << endl;
  cout << st.Solve() << endl;

  return 0;
}


Measured memory_bytes: 109408