akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << " : " << x << endl

namespace atcoder {
	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;
}

using namespace atcoder;

int main() {
	int N;
	cin >> N;
	vector<array<int, 3>> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i][0] >> v[i][1] >> v[i][2];
	}
	vector<array<int, 3>>dp(N + 1);
	for (int i = 1; i < N + 1; i++) {
		for (int j = 0; j < 3; j++) {
			int other1 = (j + 1) % 3;
			int other2 = (j + 2) % 3;
			dp[i][other1] = max(dp[i][other1], v[i - 1][j] + dp[i - 1][j]);
			dp[i][other2] = max(dp[i][other2], v[i - 1][j] + dp[i - 1][j]);

		}
	}
	//for (auto arr : dp) {
	//	for (auto val : arr) {
	//		cout << val << " ";
	//	}
	//	cout << endl;
	//}
	cout << max({ dp[N][0],dp[N][1],dp[N][2] }) << endl;
	return 0;
}

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

int main()
{
    string stra, strb, strc;
    int a, b;
    cin >> stra >> strb >> a >> b >> strc;
    if(stra==strc){
        a--;
    }
    else
    {
        b--;
    }
    cout << a << " " << b << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
///#include<bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;



/// Info.
///****************************************************************************************************************************************///
/// Coder               : BAHAA El_DEEN OSAMA SAYED.
/// Problem name        : A - Haiku
/// Method              : IM-string
/// Date                : 23/2/2020
///****************************************************************************************************************************************///


#define rep0(i,x)         for(int i=0; i<=x ;++i)
#define all(v)           ((v.begin()),((v.end())
#define mm(v,d)          memset(v,d,sizeof(v))
#define lp(i,v)          for(int i=0;i<sizeof(v);++i)
#define lpi(i,j,n)       for(int i=(j);i>=(int)n;++i)
#define lpd(i,j,n)       for(int i=(j);i>=(int)n;--i)
#define MP               make_pair
#define SZ(v)            ((int) ( (v).size() ) )
#define ull              unsigned long long
#define ll               long long
#define pi               3.1415926536
#define oo               1e9
#define OO               1e18
#define Fx(n)            fixed<<setprecision(n)
#define FasterIO           std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define RE0              return 0
#define RE1              return 1
#define mp(a,b)          make_pair(a,b)
#define X                first
#define Y                second
#define pii              pair(int a, int b)
#define rep1(i,x)        for(int i=1;i<x;++i)
#define rep2(i,x)        for(int i=2;i<x;++i)
#define RE               return
//#define LD               long double
#define all(v) ((v).begin()),((v).end())


const  int  N   = (int) 1e5+100;
const  int  M   = (int) 1e4+4;
const  int  INF = (int) 0x3f3f3f3f;
///const double ESP = 1e-7;
///const ll MOD=1e8+9;


string str;

int main()
{
FasterIO;

cin>> str;
rep0(i,str.size())
{
    if(str[i]==',')
        str[i]= ' ' ;
}

cout << str;



 RE0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}

int power(int N, int M) {return M ? power(N * N, M / 2) * (M % 2 ? N : 1) : 1;}

int mystoi(string S){
    int num = 0;
    for (int i = (int) S.length()-1; i >= 0; i--){
        num += (S[i]-'0') * power(10,S.length()-1-i);
    }
    return num;
}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    string S;
    cin >> S;

    int N = S.length();

    REP(bit,1<<N) {
      	int j = 0;
        REP(i,N) {
            if (bit & (1<<i)) {
                ans += mystoi(S.substr(j,i-j));
                j = i+1;
            }
        }
      	ans += mystoi(S.substr(j));
    }
    cout << ans << endl;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/practice/arc061/arc061_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 3528
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,i,j,k,ct=0;
    cin>>n;
    int a[n+1];
    for(i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            for(k=j+1;k<=n;k++)
            {
                if(a[i]!=a[j]&&a[j]!=a[k]&&a[i]!=a[k]&&a[i]+a[j]>a[k])
                    ct++;
            }
        }
    }
    cout<<ct<<"\n";
    return 0;
}


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

int main()
{
	int a, b, y, cnt, sum, i,k = 0;
	int arr[100] = {0};

	while (scanf("%d%d%d", &a, &b, &cnt) != EOF)
	{
		sum = 0;
		if (a < b)
		{
			a *= 10;
		}
		else
		{
			sum -= a / b;
			++cnt;
		}

		while (cnt > 0)
		{
			sum += a / b;
			y = a%b;
			if (y == 0)
			{
				break;
			}
			y *= 10;
			a = y;
			--cnt;
		}
		arr[k] = sum;
		++k;
	}

    for (i = 0; i < k; i++)
	{
		printf("%d\n",arr[i]);
	}

	return 0;
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;

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

    int N, ans = 0;
    cin >> N;
    int mi = INF;
    for (int i = 0; i < N; ++i) {
        int P;
        cin >> P;
        ans += (mi >= P);
        mi = min(mi, P);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def minimum_cost_sort():
    sorted_positions = {str(val):i for i, val in enumerate(sorted(W))}
    is_passed = [False]*n
    minimum_weight = min(W)
    ans = 0
    for i in range(n):
        if is_passed[i]:
            continue
        pointer = i
        total_weight = 0
        local_minimum_weight = 10000
        counter = 0
        while not is_passed[pointer]:
            is_passed[pointer] = True
            total_weight += W[pointer]
            local_minimum_weight = min(local_minimum_weight, W[pointer])
            pointer = sorted_positions[str(W[pointer])]
            counter += 1
        ans += min(total_weight+local_minimum_weight*(counter-2), total_weight+minimum_weight*(counter+1)+local_minimum_weight)
    print(ans)

if __name__ == "__main__":
    n = int(input())
    W = list(map(int, input().split()))
    minimum_cost_sort()


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

using namespace std ; 


const int N = 1e6 + 7 ; 

int n; 

int sei[N] ; 
int a[N] ; 

int main(){
        ios_base::sync_with_stdio(0) ; 
        cin.tie(0) ; 
        //freopen("in.in" , "r" , stdin) ; 
        cin >> n ;
        for(int i = 0 ; i < n;i++){
                int t ; 
                cin >> t; 
                a[i] = t ; 
                sei[t] ++ ;
        }
        int answer = 0 ; 
        for(int i = 0 ;i < n;i++){
                sei[a[i]] -- ; 
                int ok =1 ; 
                for(int j = 1 ;j * j <=a[i] ;j ++){
                        if(a[i] %j ) continue ; 
                        if(sei[j] )ok = 0 ; 
                        if(sei[a[i] / j ])ok = 0 ; 
                }
                sei[a[i]] ++ ; 
                answer += ok ; 
        }
        cout<< answer ; 

        return 0 ; 
}

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

num = len(str(N))

a =N%10**(num)


if num==1:
    print(N)
else:
    sum_=0
    for i in range(0,num-1,2):
        sum_+=9*(10**i)
    if num%2!=0:
        sum_+=(N-(10**(num-1))+1)
    print(sum_)

Measured memory_bytes: 3060
def solve(A, x):
    i = 0
    total = 0
    res = 0
    for j in range(N):
        total += A[j]
        while total > x:
            total -= A[i]
            i += 1
        res += j - i + 1
    return res


N, Q = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
X = [int(x) for x in input().split()]

for x in X:
    print(solve(A, x))



Measured memory_bytes: 16608
a,b,c,d=map(int,input().split())
A=""
for i in range(c-a):
  A=A+"R"
for i in range(d-b):
  A=A+"U"
for i in range(c-a):
  A=A+"L"
for i in range(d-b+1):
  A=A+"D"
for i in range(c-a+1):
  A=A+"R"
for i in range(d-b+1):
  A=A+"U"
A=A+"LU"
for i in range(c-a+1):
  A=A+"L"
for i in range(d-b+1):
  A=A+"D"
A=A+"R"
print(A)

Measured memory_bytes: 3064
# AOJ 0136: Frequency Distribution of Height
# Python3 2018.6.18 bal4u

freq = [0]*6

for i in range(int(input())):
	k = float(input())
	if   k < 165: freq[0] += 1
	elif k < 170: freq[1] += 1
	elif k < 175: freq[2] += 1
	elif k < 180: freq[3] += 1
	elif k < 185: freq[4] += 1
	else:         freq[5] += 1

for i in range(6):
	print(i+1, ':', '*'*freq[i], sep='')


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

long long N, M, K, H, W, L, R;

int main() {
  cin >> N >> K;
  long long int ans = 0;
  cin >> M;
  ans = abs(M - K);
  for (int i = 1; i < N; i++) {
    cin >> M;
    ans = gcd(ans, abs(M - K));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int num;
	float bmi, wei, hei;
	
	while(~scanf("%d,%f,%f", &num, &wei, &hei)){
		bmi = wei / (hei * hei);
		
		if (bmi >= 25.0)printf("%d\n", num);
	}
	
	return (0);
}

Measured memory_bytes: 624
/*Hatsune Miku 4ever!*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _for(i,a,b) for(int i = (a);i < b;i ++)
#define _rep(i,a,b) for(int i = (a);i > b;i --)
#define INF 0x3f3f3f3f
#define mod 1000000007
#define lowbit(x) ((x)&(-x))
#define pb push_back
#define MIKU 39
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug() printf("Miku Check OK!\n")
#define maxn 10003

int main()
{
	int D, T, S;
	scanf("%d%d%d",&D,&T,&S);
	if(T*S>=D)
		printf("Yes");
	else
		printf("No"); 
	return 0;
}

Measured memory_bytes: 3832
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 26 21:09:11 2020

@author: H_Hoshigi
"""

N, K = map(int, input().split())

H_list = list(map(int, input().split()))
H_list.sort(reverse=True)

answer = None
if K >= N:
    answer = 0
else:
    answer = sum(H_list[K:])

print(answer)



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

int main() {
  int64_t H, W;
  cin >> H >> W;

  if(H == 1 || W == 1) {
    cout << 1 << endl;
    return 0;
  }

  int64_t ans = (H * W) / 2;

  if(H % 2 == 1 && W % 2 == 1) {
    ans += 1;
  }

  cout << ans << endl;
}


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

int main() {
  int x, y;

  cin >> x >> y;

  int t, k;

  for (int i=0;i<=x;i++) {
    t = i * 2;
    k = (x-i) * 4;

    if (t+k == y){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#define ll long long
using namespace std;

ll arr[100005];
ll prefp[100005];
ll prefsum[100005];
int main() {
  int n, k;
  cin >> n >> k;

  prefp[0] = 0;
  prefsum[0] = 0;
  for (int i = 1; i <= n; i++){
    cin >> arr[i];
    if (i == 1){
      prefsum[i] = arr[i];
      if (arr[i] > 0)
        prefp[i] = arr[i];
      else
        prefp[1] = 0;
    }
    else{
      prefsum[i] = prefsum[i-1] + arr[i];
      if (arr[i] > 0)
        prefp[i] = prefp[i-1] + arr[i];
      else
        prefp[i] = prefp[i-1];
    }
  }

  ll ans = 0;
  for (int i = k; i <= n; i++){
    ll temp = 0;
    temp = prefp[i-k] + (prefp[n] - prefp[i]) + max((prefsum[i] - prefsum[i-k]),0ll);
    if (temp > ans)
      ans = temp;
  }

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

Measured memory_bytes: 5500
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();
      if(b%a==0)
        System.out.println(a+b);
      else
        System.out.println(b-a);
    }
}

Measured memory_bytes: 22612
import math
n = int(input())
rootn = int(math.sqrt(n))
ct = 0
for i in reversed(range(1,rootn+1)):
  if n%i == 0:
    tmp = n//i
    while tmp//10 != 0:
     ct += 1  
     tmp = tmp//10   
    break
print(ct+1)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    ll A, B, N;
    cin >> A >> B >> N;
    ll max_num = 0;
    ll x = min(B-1, N);
    ll ax_b = (A * x)/B;
    ll x_b = x / B;
    cout << ax_b - A * x_b << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
long long K,A,B;
int main()
{
    scanf("%lld%lld%lld",&K,&A,&B);
    if(B-A<=2)
    {
        printf("%lld",K+1);
    }
    else
    {
        K-=(A-1);
        int tag=0;
        tag=K%2;
        K-=tag;
        printf("%lld",A+K/2*(B-A)+tag);
    }
    
    return 0;
}

Measured memory_bytes: 256
S = gets.chomp.chars

score = 0
n_p = 0
S.each do |o|
  case o
  when "g"
    if n_p > 0
      n_p -= 1
      score += 1
    else
      n_p += 1
    end
  when "p"
    if n_p > 0
      n_p -= 1
    else
      score -= 1
      n_p += 1
    end
  end
end
p score


Measured memory_bytes: 7036
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int x, k;
	cin >> k >> x;
	if (500*k >= x)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Binary Search - Binary Search
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP2_6_A&lang=jp

"""
_ = input()
A = set(input().split())
for _ in range(int(input())):
    print(int(input() in A))
    


Measured memory_bytes: 19656
#include <cstdio>
#include <iostream>
#include <cstring>

using namespace std;

int ball[12];
int n;

bool dfs(int i,int b,int c){
    if(i==11) return true;
    if(ball[i]>b){
        if(dfs(i+1,ball[i],c)) return true;
    }
    if(ball[i]>c){
        if(dfs(i+1,b,ball[i])) return true;
    }
    return false;
}

void solve(){
    int l=0,r=0;
    for(int i=1;i<=10;i++){
        if(ball[i]>l&&ball[i]>r){
            if(l>r) l=ball[i];
            else r=ball[i];
        }
        else{
            if(ball[i]<l&&ball[i]<r){
                printf("NO\n"); return;
            }
            else{
                if(ball[i]>r) r=ball[i];
                else l=ball[i];
            }

        }
    }
    printf("YES\n");
}


int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=10;j++)
            scanf("%d",&ball[j]);
        solve();
    }
    return 0;
}



Measured memory_bytes: 3132
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

ans=0
n,d=MI()
for _ in range(n):
    x,y=MI()
    if x**2+y**2<=d**2:ans+=1
print(ans)


Measured memory_bytes: 9212
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

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

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

typedef long long ll;
typedef unsigned long long int llu;
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define mem(a, v) memset(a, v, sizeof(a))
#define PI acos(-1)
#define S(a) scanf("%d",&a)
#define SL(a) scanf("%lld",&a)
#define S2(a, b) scanf("%d%d",&a,&b)
#define nl printf("\n")
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define deb2(x, y) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" : "<<x<<" | "<<#y<<" : "<<y<<" | "<<#z<<" : "<<z<<endl;
#define debv(x) {cout<<#x<<" : "<<endl; for(int ii =0; ii < x.size(); ii++) cout<<x[ii]<<" "; cout<<endl; }
#define debarr(x, xs) {cout<<#x<<" : "<<endl; for(int ii =0; ii < xs; ii++) cout<<x[ii]<<" "; cout<<endl; }
//auto T=clock(); 
//cout<<double(clock()-T)/CLOCKS_PER_SEC<<'\n';
//cout << fixed << setprecision(10) << f(0, 0, 0) << "\n";
const ll mod = 1000000007LL;
const int lmt = 1000005;

ll a[lmt], diff[lmt];

int main(){
    int n;
    S(n);
    ll sum = 0, sub = n;
    sub = sub*(sub+1);
    sub /= 2LL;
    for(int i = 0; i < n; i++) {
        SL(a[i]);
        sum += a[i];
    }
    if(sum % sub != 0) {
        printf("NO");
        return 0;
    }
    ll k = sum/sub;
    for(int i = 0; i < n; i++) {
        diff[i] = a[(i+1) % n] - a[i];        
        diff[i] -= k;
    }
    ll cnt = 0;
    for(int i = 0; i < n; i++) {
        if(diff[i] > 0) {
            printf("NO");
            return 0;
        }
        else if(diff[i] < 0) {
            if(abs(diff[i]) % n != 0) {
                printf("NO");
                return 0;
            }
            cnt += abs(diff[i])/n;
        }
    }
    if(cnt != k)
        printf("NO\n");
    else
        printf("YES");
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std; // 575

const int MAX = 100;
int main() {
	int N, A, B, P[MAX];
	cin >> N >> A >> B;
	for (int i = 0;i < N;++ i) cin >> P[i];
	sort(P, P+N);
	int first, second;
	for (first = 0;first < N;++ first) if (P[first] > A) break;
	for (second = first;second < N;++ second) if (P[second] > B) break;
	cout << min(min(first, second - first), N - second);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

1問目から3問目までは排反なので、min(それぞれの候補問題数)で終わり
*/

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int n = sc.nextInt();

        int[] aArr = new int[n];
        int[] bArr = new int[n];

        for (int i = 0; i < n; i++) {
            aArr[i] = sc.nextInt();
            bArr[i] = sc.nextInt();
        }

        // dp[j] ... 体力をj減らす時の最小の魔力
        int[] dp = new int[h + 1];
        Arrays.fill(dp, Integer.MAX_VALUE);

        dp[0] = 0;
        for (int i = 0; i <= h; i++) {
            for (int j = 0; j < n; j++) {
                dp[i] = Math.min(dp[i], dp[Math.max(i - aArr[j], 0)] + bArr[j]);
            }
        }

//        debug(dp);
        System.out.println(dp[h]);

    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 26988
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
inline long long mod(long long n,long long m){return(n%m+m)%m;}
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    string s; cin>>s;
    int cnt[3]={};
    for(char c:s){
        cnt[c-'a']++;
    }
    int mi=INF;
    for(int i=0;i<3;i++) mi=min(mi,cnt[i]);
    bool flg=1;
    for(int i=0;i<3;i++){
        cnt[i]-=mi;
        if(cnt[i]>1) flg=0;
    }
    cout<<(flg?"YES":"NO")<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i,s,e) for(int i=(s); i<(e);i++)
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n)
#define repe(i,n) for(auto &&i:n)
#define all(v) (v).begin(),(v).end()
#define decimal fixed<<setprecision(20)
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
using namespace std;
using LL = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 1e9;
const LL LLINF = 1e16;

struct edge{
    int src, to, cost;
};
using Edges = vector<edge>;
using WeightedGraph = vector<Edges>;

vector<int> col;
vector<int> visit;

void dfs(WeightedGraph &G, int n){
    if(visit[n]) return;
    visit[n] = 1;
    repe(i, G[n]){
        if(col[i.to] != -1) continue;
        if(i.cost % 2 == 1) col[i.to] = (col[n]+1)%2;
        else col[i.to] = col[n];
        dfs(G, i.to);
    }
}

int main(){
    int n;
    cin >> n;
    WeightedGraph G(n);
    rep(i, n-1){
        int u,v,w;
        cin >> u >> v >> w;
        u--; v--;
        G[u].push_back((edge){u, v, w});
        G[v].push_back((edge){v, u, w});
    }
    col = vector<int>(n, -1);
    visit = vector<int>(n, 0);
    col[0] = 0;

    dfs(G, 0);
    rep(i, n) cout << col[i] << endl;


}

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

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for(int i = 0; i < n; ++i) {
    long long a;
    cin >> a;
    bool f = false;
    for(long long x = 1; 2*x*x+2*x <= a; ++x) {
      if((a-x)%(2*x+1) == 0) {
	f = true;
	break;
      }
    }
    if(f) cnt++;
  }
  cout << n - cnt << endl;
  return 0;
}

Measured memory_bytes: 3080
import java.util.*;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
        int b = sc.nextInt();
		int c = sc.nextInt();
        int d = 0;
        for (int i= b; i<= c; i++) {
          if (i % a == 0) {
       		d = 1;
            }
        }
      if (d == 0) {
        System.out.println("NG");
        } else {
        System.out.println("OK");
      }
	}
}

Measured memory_bytes: 35756
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
	int H,W,N;
	cin>>H>>W>>N;
	int color[N];
	for(int i=0;i<N;i++){
		cin>>color[i];
	}
	int ans[H][W];
	int cur = 0;
	for (int i = 0; i < H; i++) {
		if(i%2==0){
			for(int j=0;j<W;j++){
				ans[i][j]=cur+1;
				color[cur]--;
				if(color[cur]==0)cur++;
			}
		}
		else{
			for(int j=W-1;j>=0;j--){
				ans[i][j]=cur+1;
				color[cur]--;
				if(color[cur]==0)cur++;
			}
		}
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(j>0)cout<< " ";
			cout<<ans[i][j];
		}
		cout<<endl;
	}
}

Measured memory_bytes: 384
x1, y1, x2, y2 = map(int, raw_input().split())
dx = x2-x1
dy = y2-y1
x3 = x2-dy
y3 = y2+dx
x4 = x3-dx
y4 = y3-dy
print str(x3)+' '+str(y3)+' '+str(x4)+' '+str(y4)

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

int main(){
  int D;
  int c[30];
  int s[400][30];
  int type[400];
  int last[400][30];
  cin >> D;
  rep(i,1,27) cin >> c[i];
  rep(i,1,D+1){
    rep(j,1,27){
      cin >> s[i][j];
      last[i][j]=0;
    }
  }
  rep(j,1,D+1) cin >> type[j];

  ll satis_level[400];
  rep(i,0,400) satis_level[i] = 0;
  vector<int> res;
  
  ll down_satis;
  rep(i,1,D+1){
    down_satis=0;
    rep(k,1,400) last[k][type[i]] = i;
    satis_level[i] += s[i][type[i]];
    rep(j,1,27) down_satis += c[j]*(i-last[i][j]);
    satis_level[i] -= down_satis;
    satis_level[i+1] += satis_level[i];
  }
  
  rep(i,1,D+1) cout << satis_level[i] << '\n'; //B答えのコード
  //for(auto r:res) cout << r << '\n'; //A答えのコード
  return 0;
}

Measured memory_bytes: 3728
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (int64_t)(n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

#define chmax(a, b) (a) = max(a, b)
#define chmin(a, b) (a) = min(a, b)

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M, K;
  cin >> N >> M >> K;

  vector<int> a(N);
  rep(i, N) { cin >> a[i]; }

  vector<vector<int64_t>> dp(
      K + 1, vector<int64_t>(N + 1, numeric_limits<int64_t>::min()));
  fill(dp[0].begin(), dp[0].end(), 0);
  rep(i, K) {
    deque<int64_t> window;
    rep(j, N) {
      while (not window.empty() and dp[i][window.back()] <= dp[i][j]) {
        window.pop_back();
      }
      window.push_back(j);

      dp[i + 1][j + 1] = dp[i][window.front()] + (int64_t)(i + 1) * a[j];

      if (window.front() <= j - (M - 1)) {
        window.pop_front();
      }
    }
  }

  int64_t result = 0;
  irep(i, N - K) { chmax(result, dp[K][K + i]); }
  cout << result << endl;

  return 0;
}

Measured memory_bytes: 240248
<?php
$X = [];
fscanf(STDIN, "%d", $X[]);
fscanf(STDIN, "%d", $X[]);
fscanf(STDIN, "%d", $X[]);
fscanf(STDIN, "%d", $X[]);
fscanf(STDIN, "%d", $X[]);
usort($X, function($x, $y) {return ($x - 1) % 10 < ($y - 1) % 10; });
$ans = 0;
for ($i = 0; $i < 4; $i++) {
    $ans += ceil($X[$i] / 10) * 10;
}
$ans += $X[4];
echo $ans;

Measured memory_bytes: 4856
import scala.collection.mutable
import util.control.Breaks._

object Main extends App {
  case class State(a: Int, b: Int, c: Int)
  val cache = mutable.HashMap.empty[Int, Int]
  val stateCache = mutable.HashMap.empty[State, Boolean]
  def head (b: Int, n: Int): Int = cache.getOrElseUpdate(b, {
    var h = 1 << n-1
    breakable {
      while (h > 0) {
        if ((h & b) == h) break()
        h = h >> 1
      }
    }
    h
  })
  def readLine: Array[Int] = io.StdIn.readLine().split(' ').map(_.toInt)
  def solver(n: Int, m: Int): Unit = {
    val Array(_, as @ _*) = readLine
    val Array(_, bs @ _*) = readLine
    val Array(_, cs @ _*) = readLine
    val queue = mutable.Queue.empty[(State, Int)]
    val state: Array[Int] = for (x <- Array(as,bs,cs)) yield x.foldLeft(0)((acc, i) => acc | (1 << i - 1))
    queue.enqueue((State(state(0), state(1), state(2)), 0))
    var count = -1
    val goal = (1 << n) - 1
    def enq(ns: State, nc: Int): Unit =
      if (!stateCache.getOrElseUpdate(ns, false)) {queue.enqueue((ns, nc)); stateCache += (ns -> true)}

    breakable {
      while (queue.nonEmpty) {
        val (s, c) = queue.dequeue()

        if (c > m) break()
        if (s.a == goal || s.c == goal) {count = c; break()}

        val (h0, h1, h2) = (head(s.a, n), head(s.b, n), head(s.c, n))

        if (h0 > h1) enq(State(s.a ^ h0, h0 | s.b, s.c),c+1)
        else if (h1 > h0) enq(State(h1 | s.a, s.b ^ h1, s.c), c+1)
        if (h1 > h2) enq(State(s.a, s.b ^ h1, h1 | s.c), c+1)
        else if (h2 > h1) enq(State(s.a, h2 | s.b, s.c ^ h2), c+1)
      }
    }
    println(count)
  }
  breakable(
    while(true) {
      val Array(n, m) = readLine
      if (n == 0 || m == 0) break()
      else solver(n, m)
    }
  )
}


Measured memory_bytes: 633752
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        if(a == b)
            cnt++;
        else
            cnt = 0;
        if(cnt == 3){
            cout << "Yes" << "\n";
            return 0;
        }
    }
    cout << "No" << "\n";
}

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

typedef long long ll;

int main() {
  int N; cin >> N;
  double x[11];
  string u[11];
  for ( int i = 0; i < N; i++ ) cin >> x[i] >> u[i];
  double ans = 0;
  double bit = 0;
  for ( int i = 0; i < N; i++ ) {
    if ( u[i] == "JPY" ) {
      ans += x[i];
    } else {
      ans += x[i] * 380000;
    }
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <tuple>
#include <algorithm>
#include <cmath>
#include <cstdio>

using namespace std;

int main() {
    int k, tmp;
    vector<int> antena;
    for (int i = 0; i < 5; i++) {
        cin >> tmp;
        antena.emplace_back(tmp);
    }
    cin >> k;

    sort(antena.begin(), antena.end());

    if (k >= antena[4] - antena[0]) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }


    return 0;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
A = []
for _ in range(N):
    a = LS2()
    if not '.' in a:
        a = int(''.join(a))
        a *= 10**9
        b,c = 0,0
        while a % 2 == 0:
            a //= 2
            b += 1
        while a % 5 == 0:
            a //= 5
            c += 1
        A.append((b-9,c-9))
    else:
        i = a.index('.')
        l = len(a)
        del a[i]
        a += ['0']*(9-l+1+i)
        a = int(''.join(a))
        b, c = 0, 0
        while a % 2 == 0:
            a //= 2
            b += 1
        while a % 5 == 0:
            a //= 5
            c += 1
        A.append((b - 9, c - 9))


from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    d[A[i]] += 1

ans = 0
for a in d.keys():
    b,c = a
    x = 0
    for e in d.keys():
        f,g = e
        if f >= -b and g >= -c:
            x += d[e]
    ans += d[a]*x

for a in d.keys():
    b,c = a
    if b >= 0 and c >= 0:
        ans -= d[a]

print(ans//2)


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

const int N = 2e5 + 100;

int n, a[N], b[N];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	for (int i = 0; i < n; i++)
		if(a[i] >= b[(n >> 1)])
			cout << b[(n >> 1) - 1] << '\n';
		else
			cout << b[n >> 1] << '\n';
	return 0;
}

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

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

  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for (int i = 0; i < H; ++i) {
    cin >> a.at(i);
  }

  for (int i = 0; i < W + 2; ++i) {
    cout << "#";
  }
  cout << endl;
  for (int i = 0; i < H; ++i) {
    cout << "#" << a.at(i) << "#" << endl;
  }
  for (int i = 0; i < W + 2; ++i) {
    cout << "#";
  }
  cout << endl;

  return 0;
}


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

const long long MAX_N = 2e5 + 6, inf = 1e9 + 7, MOD = 1e9 + 7;
long long n, m, ans;
string s;
long long dp[MAX_N][2];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> s;
	n = s.size();
	dp[0][1] = 2;
	dp[0][0] = 1;
	for (long long i = 1; i < n; i++) {
		dp[i][1] = dp[i - 1][1] * (s[i] == '0'? 1: 2) % MOD;
		dp[i][0] = dp[i - 1][0] * 3 % MOD;
		if (s[i] == '1')
			dp[i][0] = (dp[i][0] + dp[i - 1][1]) % MOD;
	}

	cout << (dp[n - 1][0] + dp[n - 1][1]) % MOD << "\n";
	return 0;
}

Measured memory_bytes: 2000
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void YES()
{
	OUT("YES");
}
void NO()
{
	OUT("NO");
}
void YESNO(const bool cond)
{
	OUT(cond ? "YES" : "NO");
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}
void YesNo(const bool cond)
{
	OUT(cond ? "Yes" : "No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
ll factorial(ll n)
{
	for (ll i = n - 1; i > 1; --i)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll ncr(const ll n, ll r)
{
	if (r * 2 > n) r = n - r;

	ll dividend = 1, divisor = 1;

	for (ll i = 1; i <= r; ++i) {
		dividend *= n - i + 1;
		divisor *= i;
	}

	return dividend / divisor;
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool isprime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (ll i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0) return false;
    }

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll digsum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll n;
	FOR(i, n, 1000)
	{
		if (i / 100 == (i % 100) / 10 && (i % 100) / 10 == i % 10) return OUT(i);
	}
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.*;

public class Main{

    //private static Object InputStream;

    public static void main(String args[]) throws IOException {
        // Object input;
        Scanner scan=new Scanner(System.in);
        long P=100;
        long X=scan.nextLong();
        int x=0;
        long it=0;
        while (P<X){
            it= (long) Math.ceil(P/100);
            P= P+it;
            x++;
            //System.out.println(P);
        }
        System.out.println(x);
    }

}


Measured memory_bytes: 35772
#include <stdio.h>

int main()
{
    int n; scanf("%d", &n);
    int a[200000];
    long long step = 0;

    for (int i=0; i<n; i++) scanf("%d", &a[i]);

    for (int i=1; i<n; i++)
    {
        if (a[i-1] > a[i])
        {
            step += a[i-1] - a[i];
            a[i] = a[i-1];
        }
    }

    printf("%lld\n", step);
}

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

typedef long long ll;
int cnt[26];

ll p(ll x) {
    ll ret = 1;
    for(ll k = 2; k<=x; ++k) ret *= k;
    return ret;
}

int main() {
    string s;
    cin>>s;
    for(int i=0; i<s.length(); ++i) cnt[s[i]-'a']++;
    int odd = 0;
    for(int i=0; i<26; ++i) if(cnt[i]%2) odd++;

    if(odd > 1 || (odd == 1 && ((int)s.length())%2 == 0)) {
        cout<<0<<endl;
        return 0;
    }

    for(int i=0; i<26; ++i) cnt[i]/=2;
    ll ans = p((ll)(s.length()/2));
    for(int i=0; i<26; ++i)
        if(cnt[i]>0) ans /= p(cnt[i]);
    cout<<ans<<endl;
}

Measured memory_bytes: 0
import numpy as np

n = int(input()) 

nums = list(map(int, input().split()))

minus = 0
zero = 0
for num in nums:
    if num == 0:
        zero += 1
        break
    elif num < 0:
        minus += 1

nums = np.abs(nums)
nums.sort()

if minus % 2 and not zero:
    ans = sum(nums) - 2 * nums[0]

else:
    ans = sum(nums)

print(ans)

Measured memory_bytes: 23288
import sys
s = input()
i = 0
while s[i:i+5] != '':
    if s[i:i+5] == 'dream':
        if s[i+5:i+10] == 'dream':
            i += 5
        elif s[i+5:i+10] == 'erase':
            i += 5
        elif s[i+5:i+7] == 'er':
            i += 7
        else:
            i += 5
    elif s[i:i+5] == 'erase':
        if s[i+5:i+10] == 'dream':
            i += 5
        elif s[i+5:i+10] == 'erase':
            i += 5
        elif s[i+5:i+6] == 'r':
            i += 6
        else:
            i += 5
    else:
        print('NO')
        sys.exit(0)
print('YES')

Measured memory_bytes: 3188
import java.io.*;
import java.util.*;
class Main{
    public static void main(String args[]) throws IOException{

	int a=0;
	int b=0;
	int i=0;

	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String str = br.readLine();
	String delimiter = " ";
        StringTokenizer stringTokenizer = new StringTokenizer( str, delimiter );
	while(stringTokenizer.hasMoreTokens())
	{
            String current = stringTokenizer.nextToken();
	    if(i==0)a=Integer.parseInt(current);
	    if(i==1)b=Integer.parseInt(current);
	    i++;
	}

	if(a<b)System.out.println("a < b");
	else if(a>b)System.out.println("a > b");
	else System.out.println("a == b");
    }
}

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

using namespace std;

int main(void){
	int N;
	cin >> N;
	vector<tuple<string,int,int>> a;
	for(int i=0;i<N;i++){
		string S;
		int p;
		cin >> S >> p;
		p = -p;
		a.push_back(tie(S,p,i));
	}
	sort(a.begin(),a.end());
	for(int i=0;i<N;i++){
		cout << get<2>(a[i])+1 << endl;
	}
}

Measured memory_bytes: 256
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
#UnionFindクラス
class UnionFind(object):
 
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0 for i in range(n)]
        self.size=[1 for i in range(n)]
 
    def find(self, x):
  
        if self.par[x] == x:
            return x
        else:
            return self.find(self.par[x])
  
    # xとyの根を結合させる
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x]+=self.size[y]
  # x,yの根が同じかどうかを返す（根が同じ:True、根が異なる:False）
    def same(self, x, y):
        return self.find(x) == self.find(y)

    
n,m=IL()
l=[[0,0] for i in range(m)]
par=[1 for i in range(n)]
for i in range(m):
    a,b=IL()
    l[i]=[a-1,b-1]
ans=[0 for i in range(m)]
uf=UnionFind(n)
t_ans=n*(n-1)/2
ans[-1]=t_ans
for i in range(m-1):
    a=uf.find(l[-1-i][0])
    b=uf.find(l[-1-i][1])
    
    if a!=b:
        t_ans-=uf.size[a]*uf.size[b]
        uf.union(a,b)
    ans[-2-i]=t_ans
for i in range(m):
    print(int(ans[i]))

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

using namespace std;

int main() {
  int n;
  cin >> n;
  int a[100010];
  for(int i=0; i < n; i++) {
    int m; cin >> m; a[m-1] = i;
  }
  for(int i=0; i < n; i++) {
    cout << a[i]+1 << (i == n-1 ? "" : " ");
  }
  cout << endl;
}


Measured memory_bytes: 1152
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

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

  vector<int> b(N, 0), w(N, 0);
  FOR(i, 1, N) {
    b[i] = b[i - 1] + ((S[i - 1] == '#') ? 1 : 0);
    w[N - i - 1] = w[N - i] + (S[N - i] == '.' ? 1 : 0);
  }

  int answer = numeric_limits<int>::max();
  REP(i, N) { answer = min(answer, b[i] + w[i]); }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 2324
#include <cstdio>
#include <cstring>
#include <algorithm>
#define P 1000000007
#define M 400010

using namespace std;

typedef long long ll;

bool B[1 << 17][18];

int n, a, b;

void Solve(int l, int r, int mask) {
    if(r == l + 1) return;
    int md = (l + r) / 2;
    for(int i = 0; i < n; i++) if((mask >> i & 1) && (B[l][i] != B[r][i])) {
        for(int j = l; j <= md; j++) B[j][i] = B[l][i];
        for(int j = md + 1; j <= r; j++) B[j][i] = B[r][i];
        for(int j = 0; j < n; j++) if(j != i && (mask >> j & 1)) {
            memcpy(B[md], B[l], sizeof B[l]);
            B[md][j] ^= 1;
            memcpy(B[md + 1], B[md], sizeof B[md]);
            B[md + 1][i] ^= 1;
            Solve(l, md, mask ^ (1 << i));
            Solve(md + 1, r, mask ^ (1 << i));
            return;
        }
        return;
    }
}

int main() {
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++) {
        B[0][i] = a >> i & 1;
        B[(1 << n) - 1][i] = b >> i & 1;
    }
    int tmp = a ^ b;
    if(!(__builtin_popcount(tmp) & 1)) {
        puts("NO");
        return 0;
    }
    Solve(0, (1 << n) - 1, (1 << n) - 1);
    puts("YES");
    for(int i = 0; i < 1 << n; i++) {
        int ans = 0;
        for(int j = 0; j < n; j++)
            ans += B[i][j] << j;
        printf("%d ", ans);
    }
    putchar('\n');
    return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

ll powmod(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res*=a;
		a*=a;
		b/=2;
	}
	return res;
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	////freopen("output.txt","w",stdout);
	//#endif
	ll n;
	cin>>n;
	if(n&1){
		cout<<0<<endl;
	}
	else{
		ll ans = n/10LL;
		for(ll i=50;i<=n;i*=5){
			ans+=n/i;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main()
{
	long x=0, y=0, z=0, a, b, c;
	cin >> x>> y>> z;
	a = y;
	b = x;
	c = z;
	x = c;
	y = b;
	z = a;
	cout << x << " " << y << " " << z << endl;
	return 0;
}

Measured memory_bytes: 256
N,M = list(map(int, input().split()))
X = list(map(int, input().split()))

X.sort()
cnt = 0
arr = [0]*(M-1)
if N >= M:
    ans = 0
else:
    for i in range(1,M):
        arr[i-1] = (abs(X[i-1]-X[i]))
    #print(arr)
    arr.sort()
    ans = sum(arr[0:M-N])
print(ans)

Measured memory_bytes: 20232
/* Read input from STDIN. Print your output to STDOUT*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,i,j,k,l,m,o,p,q,r,s,t,a[300001],prefix[30001],suffix[300001];
    cin>>k>>n;
    s=0;
    a[n+1]=k;
    a[0]=0;
    prefix[0]=0;
    suffix[n+1]=0;
    for(i=1;i<=n;i++)
    {
        
        cin>>a[i];  
    }
    r=a[1]-a[0]+a[n+1]-a[n];
   //cout<<s<<" "<<r<<endl;
    ll ans=a[n]-a[1];
    s=a[n]-a[1];
    for(i=1;i<=n;i++)
    {
        //clockwise or anticlockwise. if we start at house i.
        q=a[n+1]-a[i]+a[i-1];
        ans=min(ans,q);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
#define rep(i, n) for(Int i = 0; i < (Int)(n); ++i)
#define guard(x) if( not (x) ) continue;
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif

struct DisjointSet {
   DisjointSet(Int n)
      : ps(n, -1), ns(n, 1) {}
   std::vector<Int> ps, ns;
   Int find(Int x) {
      if( ps[x] == -1 ) return x;
      return ps[x] = find(ps[x]);
   }
   void unite(Int x, Int y) {
      x = find(x), y = find(y);
      if( x == y ) return;
      if( ns[x] > ns[y] ) std::swap(x, y);
      ps[x] = y;
      ns[y] += ns[x];
   }
   bool same(Int x, Int y) {
      return find(x) == find(y);
   }
};

int main() {
   Int n, q;
   std::cin >> n >> q;
   std::vector<Int> ps(n, -1), ns(n);
   DisjointSet dset(n);
   rep(i,q) {
      Int c, x, y;
      std::cin >> c >> x >> y;
      if( c == 0 ) {
         dset.unite(x, y);
      }
      else {
         puts(dset.same(x, y)?"1":"0");
      }
   }
}



Measured memory_bytes: 3292