akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
bool cmp1(pair<int,int> x, pair<int,int> y)
{
    return x.first + x.second < y.first + y.second;
}
bool cmp2(pair<int,int> x, pair<int,int> y)
{
    return x.first - x.second < y.first - y.second;
}
int main()
{
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<pair<int,int>> a;
    for(int i=0;i<n;i++)
    {
        int x,y;
        cin >> x >> y;
        a.push_back({x,y});
    }
    sort(a.begin(), a.end(), cmp1);
    int res = 0;
    res = max(res, abs(a[0].first - a[n-1].first) + abs(a[0].second - a[n-1].second));
    sort(a.begin(), a.end(), cmp2);
    res = max(res, abs(a[0].first - a[n-1].first) + abs(a[0].second - a[n-1].second));
    cout << res << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
//#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i =0;i<n;++i)
//#define mod (ll)(1e9+7)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin >> n >> m;
    ll sum[n+1];
    ll ans = 0;
    sum[0] = 0;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        sum[i+1] = (sum[i]+tmp)%m;
    }
    sort(sum,sum+(n+1));
    //REP(i,n+1) cout << sum[i] <<" ";
    ll tmp = sum[1];
    if(sum[1]==0) ans++;
    ll count = 1;
    for(int i = 2;i<=n;i++){
        if(sum[i]==tmp){
            count++;
        }else{
            ans += (count-1)*count/2;
            //cout << ans << endl;
            count = 1;
            tmp = sum[i];
        }
        if(sum[i]==0)ans++;
    }
    ans += (count-1)*count/2;
    cout << ans << endl;
    return 0;
}

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

xl = []

for i in range(N):
    xl.append(list(map(int,input().split())))

itv = []

for i in range(N):
    right = xl[i][0] + xl[i][1]  ##right
    left = xl[i][0] - xl[i][1]  ##left   
    itv.append([right,left])
itv.sort()

ass = 0
tt = -1e10
for i in range(N):
    if tt <= itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)


            



Measured memory_bytes: 41440
#include <iostream>
#include<string.h>
#include<algorithm>
using namespace std;

int main() {
	string s;
	cin >> s;
	
	if (s[5] == '0' && s[6] == '5')cout << "TBD" << endl;
	else if (s[5] == '0' && s[6] == '6')cout << "TBD" << endl;
	else if (s[5] == '0' && s[6] == '7')cout << "TBD" << endl;
	else if (s[5] == '0' && s[6] == '8')cout << "TBD" << endl;
	else if (s[5] == '0' && s[6] == '9')cout << "TBD" << endl;
	else if (s[5] == '1' && s[6] == '0')cout << "TBD" << endl;
	else if (s[5] == '1' && s[6] == '1')cout << "TBD" << endl;
	else if (s[5] == '1' && s[6] == '2')cout << "TBD" << endl;
	else  cout << "Heisei" << endl;
	return 0;
}

Measured memory_bytes: 256
function main(a){
	a = a.split(" ");
	a=stn(a);
	
    function Actor(name,card){
			this.name=name;
			this.card=card;
	}
	var Alice = new Actor("Alice",a[0]);
	var Bob=new Actor("Bob",a[1]);
	console.log(poker(Alice,Bob));
}
function poker(Alice,Bob){
	if(Alice.card==Bob.card)
		return "Draw";
	if(Alice.card==1)
		return Alice.name;
	if(Bob.card==1)
		return Bob.name;
	if(Alice.card>Bob.card){
		return Alice.name;
	}else{
		return Bob.name;
	}
}
function stn(a){
	return a.map(function(x){return parseInt(x,10);});
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
    int N,K;
    cin >> N >> K;
    int num = 1;
    
    for(int i = 0; i < N; i++)
    {
        if(num < K)
        {
            num *= 2;
        }
        else
        {
            num += K;
        }
    }
    
    cout << num << endl;
}


Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

//Numbers
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		BigInteger b = BigInteger.ONE;
		for(int i=2;i<=n+1;i++)b = b.multiply(BigInteger.valueOf(i));
		System.out.println(b.add(BigInteger.valueOf(2)));
		for(int i=2;i<=n+1;i++)System.out.println(i);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
import java.util.*;
import java.io.*;
import java.math.*;
class Main{
public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		long count =0 ;
		String st = sc.next();
		for(int i=0;i<n-2;i++){
			if(st.charAt(i)=='A' &&  st.charAt(i+1)=='B' && st.charAt(i+2)=='C'  )
				count++;
		}
	System.out.println(count);
		
	}
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer sz;


		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (sz == null || !sz.hasMoreTokens()) {
				try {
					sz = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return sz.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}

}

Measured memory_bytes: 23124
# -*- coding: utf-8 -*-


#----------
n = int(input().strip())
a_list = list(map(int, input().rstrip().split()))
#----------
a_list.sort()
a2_list = a_list[n:]

sum=0
for i in range( 0,len(a2_list),2 ):
    sum += a2_list[i]

print(sum)


Measured memory_bytes: 37084
//ABC126A
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	if(s.at(k-1) == 'A'){
		s.at(k-1) = 'a';
	}else if(s.at(k-1) == 'B'){
		s.at(k-1) = 'b';
	}else{
		s.at(k-1) = 'c';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
//
// Created by yuu on 2019-04-27.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>

using namespace std;


int main(void){
    int A,B,T;
    cin>>A>>B>>T;
    int temp;
    temp = (int)T/A;

    cout<<B*temp<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

int calc(int a){
    int res = 0;
    int now = 2;
    while(a >= now){
        res += a/now;
        now *= 2;
    }
    return res;
}


int main(){
    int N; cin >> N;
    string s; cin >> s;
    vector<int> a(N);
    rep(i,N) a[i] = s[i]-'0';
    bool ok = false;
    rep(i,N){
        a[i]--;
        if(a[i] == 1) ok = true;
    }
    if(!ok){
        rep(i,N) a[i] /= 2;
    }
    rep(i,N){
        if(a[i] == 2) a[i] = 0;
    }
    int ans = 0;
    rep(i,N){
        int cnt1 = calc(N-1);
        int cnt2 = calc(N-1-i);
        int cnt3 = calc(i);
        if(cnt1 == cnt2+cnt3){
            ans += a[i];
            ans %= 2;
        }
    }
    if(!ok) ans *= 2;
    cout << ans << endl;
}



Measured memory_bytes: 5252
N, M, X = map(int, input().split())
A = [tuple(map(int, input().split())) for _ in range(N)]

def calc(state):
    ret = 0
    S = [0] * M
    for i, B in enumerate(A):
        if ((1 << i) & state) == 0:
            continue
        for j, a in enumerate(B[1:]):
            S[j] += a
        ret += B[0]
    if all(s >= X for s in S):
        return ret
    return 10**18

ans = 10**18
for state in range(1 << N):
    ans = min(ans, calc(state))

print(ans if ans < 10**18 else -1)


Measured memory_bytes: 9220
N, A, B = map(int, input().split())

if (B-A)%2==0:
  ans = (B-A)//2
else:
  if A-1<N-B:
    ans = A + (B-A-1)//2
  else:
    ans = N-B+1 + (N-(A+N-B+1))//2
    
print(ans)

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



int main(){
    int s,w;
    cin>>s>>w;
    string ans=(s>w)?"safe":"unsafe";
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll K;
    cin >> K;
    ll N = 50;
    vector<ll> v(N, N - 1 + ((K + N - 1) / N));
    REP(i, (N - (K % N)) % N) {
        v[i] -= N - i;
    }

    cout << N << endl;
    REP(i, N) {
        cout << v[i] << " ";
    }
    cout << endl;
    return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int d[k];
    int ans[n];
    rep(i,n){
        ans[i] = 0;
    }
    rep(i,k){
        cin >> d[i];
        rep(j,d[i]){
            int a;
            cin >> a;
            ans[a-1] = 1;
        }
    }
    int cnt = 0;
    rep(i,n){
        if(ans[i] == 0){
            cnt++;
        }
    }
    cout << cnt << endl;
}

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

char a[2][9][9];

void rotate(int f) {
  for (int i=0; i<8; i++) {
    for (int j=0; j<8; j++) {
      a[(f+1)&1][i][j] = a[f&1][7-j][i];
    }
  }
}

int main() {
  for (int i=0; i<8; i++) {
    scanf("%s", a[0][i]);
  }
  for (int i=0; i<3; i++) {
    rotate(i);
    printf("%d\n", 90*(i+1));
    for (int j=0; j<8; j++) {
      printf("%s\n", a[(i+1)&1][j]);
    }
  }
  return 0;
}

Measured memory_bytes: 980
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    set<int> s;
    for (int i = 0; i < 3; i++)
    {
        int x;
        cin >> x;
        s.insert(x);
    }
    cout << (s.size() == 2 ? "Yes" : "No") << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    int n, k;
    cin >> n >> k;
    map<int, int> m;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (!m.insert({a, 1}).second) {
            m[a]++;
        }
    }

    vector<int> cnt;
    for (auto e : m) {
        cnt.push_back(e.second);
    }
    sort(cnt.begin(), cnt.end());

    int ans = 0;
    if (k < cnt.size()) {
        int ro = cnt.size() - k;
        for (int i = 0; i < ro; i++) {
            ans += cnt[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 10744
#include<bits/stdc++.h>
 
using namespace std;
 
#define lli long long
lli M=1e9;
 
#define MAXN  10000001 
 
int main()
{
    lli q=1;
    // cin>>q;
    time_t start, end;
    time(&start);
    for(lli tc=1;tc<=q;tc++)
    {
        lli n,a;
        cin>>n;
        vector<int> c(100005,0);
        lli sum=0;
        for(int i=0;i<n;i++)
        {
            cin>>a;
            c[a]++;
            sum+=a;
        }
        lli Q,x,y;
        cin>>Q;
        for(int i=0;i<Q;i++)
        {
            cin>>x>>y;
            sum = sum+c[x]*(y-x);
            c[y]+=c[x];
            c[x]=0;
            cout<<sum<<endl;
        }

    }
    
    time(&end);
    // cout<<fixed<<double(end - start)<<setprecision(10)<<endl;
    return 0;
}

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

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var xs = Console.ReadLine().Split()
            .Select(x => Int64.Parse(x))
            .OrderByDescending(x => x)
            .ToArray();
        
        var creature = xs.Skip(1).Sum();
        var numSurvivable = 1;
        for (int i = 1; i < n; ++i)
        {
            if (xs[i - 1] > 2 * creature)
                break;

            creature -= xs[i];
            ++numSurvivable;
        }
        
        Console.WriteLine(numSurvivable.ToString());
    }
}


Measured memory_bytes: 30044
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

namespace io
{
	const int maxb = 1<< 15;
	char b[maxb], *s = b, *t = b;
	bool Getchar(char &ch)
	{
		return ch = s == t && (t = (s = b) + fread(b, 1, maxb, stdin)) == b ? 0 : *s ++;

	}
}

int Getint()
{
	using namespace io;
	char ch;
	while (Getchar(ch) && (ch < '0' || ch > '9'));
	int s = ch - '0';
	while (Getchar(ch) && ch >= '0' && ch <= '9')
		s = s * 10 + ch - '0';
	return s;
}

const int maxn = 1e5 + 10;

int a[maxn];

int main()
{
	int n = Getint();
	for (int i = 1; i <= n; ++ i)
		a[i] = Getint();
	sort(a + 1, a + n + 1, greater<int>());
	int pos = 0;
	while (a[pos + 1] >= pos + 1) ++ pos;
	int r = pos;
	while (a[r + 1] == pos) ++ r;
	if (a[pos] - pos & 1 || r - pos & 1) puts("First"); else puts("Second");
	return 0;
}


Measured memory_bytes: 640
import Data.List.Split

import Data.List
import Control.Monad

getLineRepeat :: Int -> IO [String]
getLineRepeat times = replicateM times getLine

adjust :: Int -> Int
adjust num = let rem = num `mod` 10 in if rem == 0 then num else num + (10 - rem)

mod' n d = let m = mod n d in if m == 0 then d else m

main = do
    input <- getLineRepeat 5
    let set = read <$> input :: [Int]
    let sorted = sortBy (\a b -> compare (b `mod'` 10) (a `mod'` 10)) set
    let ans = sum . (map adjust) . init $ sorted
    putStrLn . show $ ans + (last sorted)


Measured memory_bytes: 508
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

int X[12][22];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, D;
    cin>>N>>D;
    for(int i=0;i<N;i++){
        for(int j=0;j<D;j++)cin>>X[i][j];
    }
    int cnt = 0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            int cur = 0;
            for(int k=0;k<D;k++) cur += (X[i][k]-X[j][k]) * (X[i][k]-X[j][k]);
            int m = 0;
            while(m*m<cur) m++;
            if(m*m==cur)cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
lst1 = list(map(int,input().split()))

lst2 = [0]*9

for i in range(n):
    for j in range(8):
        if lst1[i] < 400*(j+1):
            lst2[j] += 1
            break
    if lst1[i] >= 3200:
        lst2[8] += 1

ans = 0
for i in range(8):
    if lst2[i]:
        ans += 1

print(max(1,ans))
print(ans+lst2[8])


Measured memory_bytes: 38384
import java.util.*;
import java.io.*;

public class Main {
	static final int mod = (int) 1e9 + 7;
	static final int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int[] DX8 = {-1,-1,-1,0,0,1,1,1}, DY8 = {-1,0,1,-1,1,-1,0,1};
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	static final String nextLine = "\n";

	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt();
		int red[][] = new int[n][2];
		for(int i=0;i<n;i++) {
			int a = fs.nextInt(), b = fs.nextInt();
			red[i][0] = a; red[i][1] = b;
		}
		int blue[][] = new int[n][2];
		for(int i=0;i<n;i++) {
			int c = fs.nextInt(), d = fs.nextInt();
			blue[i][0] = c; blue[i][1] = d;
		}
		
		int cnt = 0;
		Arrays.sort(red, (r1,r2)->r1[0]-r2[0]);
		Arrays.sort(blue, (r1,r2)->r1[0]-r2[0]);
		
		boolean used[] = new boolean[n];
		
		for(int i=0;i<n;i++) {
			int bx = blue[i][0], by = blue[i][1];
			int ymax = -1;
			int ymaxJ = -1;
			for(int j=0;j<n;j++) {
				if(used[j])continue;
				int rx = red[j][0], ry = red[j][1];
				if(rx<bx&&ry<by) {
					if(ymax<=ry) {
						ymax = ry;
						ymaxJ = j;
					}
				}
			}
			if(ymaxJ!=-1) {
				used[ymaxJ] = true;
				cnt++;				
			}
		}
		System.out.println(cnt);
		
	}

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

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

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 25812
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws Exception {
		FastScanner scanner = new FastScanner(System.in);
		String[] arr = new String[2];
		String[] sortedArr = new String[2];;
		String str1 = scanner.next();
		String str2 = scanner.next();
		arr[0]=str1;
		sortedArr[0]=str1;
		arr[1]=str2;
		sortedArr[1]=str2;
		Arrays.sort(sortedArr);
		PrintWriter printWriter = new PrintWriter(System.out);
		if(arr[0].equals(arr[1])){
			printWriter.println("=");
		}else if(arr[0]==sortedArr[0]){
			printWriter.println("<");
		}else{
			printWriter.println(">");
		}
		printWriter.close();
	}

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

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

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

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

			return tokenizer.nextToken("\n");
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public long nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = (int) nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n){
        cin >> a[i];
    }
    sort(all(a));
    reverse(all(a));
    int c = a[0];
    int d = a[1];
    rep(i, 2, n){
        int now = abs(c / 2 - d);
        int tmp = abs(c / 2 - a[i]);
        if(now > tmp){
            d = a[i];
        }
    }
    cout << c << ' ' << d << endl;
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int A[200001], B[200002];

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt","r",stdin));
	TEST(freopen("output.txt","w",stdout));
	TEST(freopen("debug.txt","w",stderr));
	int N, K;
	cin>>N>>K;
	for(int i=1;i<=N;i++) cin>>A[i];
	K=min(K,50);
	while(K--) {
		for(int i=0;i<=N;i++) B[i]=0;
		for(int i=1;i<=N;i++) {
			B[max(i-A[i],0)]++;
			B[min(i+A[i],N)+1]--;
		}
		for(int i=1;i<=N;i++) A[i]=B[i]+=B[i-1];
	}
	for(int i=1;i<=N;i++) cout<<A[i]<<' ';
	return 0;
}

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

int main(){
    int N,K; cin >> N >> K;
    double p[N];
    for(int i=0;i<N;i++) cin >> p[i];
    for(int i=0;i<N;i++){
        p[i]=(1+p[i])/2;
    }
    double imos[N+1]={};
    for(int i=0;i<N;i++){
        imos[i+1]+=p[i]+imos[i];
    }
    /*
    for(int i=0;i<=N;i++){
        cout << imos[i] << endl;
    }
    */
    double ans=0;
    for(int i=0;i<=N-K;i++){
        ans=max(ans,imos[i+K]-imos[i]);
    }
    cout << setprecision(8) << ans << endl;
}

Measured memory_bytes: 3328
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000001
using namespace std;

#define NUM 2147483647

int N;
int* table;

void init(int first_N){
	while(N < first_N)N *= 2;
}

void update(int loc,int value){
	loc += N-1;

	table[loc] = value;

	if(N == 1)return;

	int parent = (loc-1)/2;

	while(true){
		table[parent] = min(table[2*parent+1],table[2*parent+2]);

		if(parent == 0)break;
		else{
			parent = (parent-1)/2;
		}
	}
}


int query(int search_left,int search_right,int node_id,int node_left,int node_right){

	if(search_right < node_left || search_left > node_right)return NUM;

	if(search_left <= node_left && search_right >= node_right){
		return table[node_id];
	}

	int left_min = query(search_left,search_right,2*node_id+1,node_left,(node_left+node_right)/2);
	int right_min = query(search_left,search_right,2*node_id+2,(node_left+node_right)/2+1,node_right);

	return min(left_min,right_min);
}


int main(){

	int first_N,Q,command,left,right;
	table = new int[1000000];
	N = 1;

	scanf("%d %d",&first_N,&Q);

	init(first_N);

	for(int i = 0; i <= 2*N-2; i++)table[i] = NUM;

	for(int i = 0; i < Q; i++){
		scanf("%d %d %d",&command,&left,&right);

		if(command == 0){
			update(left,right);
		}else{
			printf("%d\n",query(left,right,0,0,N-1));
		}
	}

	return 0;
}



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

int main()
{
	int n, i, br=0;
	scanf("%d", &n);

	if(n==25) printf("Christmas");
	if(n==24) printf("Christmas Eve");
	if(n==23) printf("Christmas Eve Eve");
	if(n==22) printf("Christmas Eve Eve Eve");

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5;

int main(){
	int Q;
	cin>>Q;
	lli A[100],B[100];
	rep(i,Q){
		cin>>A[i]>>B[i];
		if(A[i]==B[i])cout<<2*A[i]-2<<endl;
		else if(abs(A[i]-B[i])==1)cout<<2*min(A[i],B[i])-2<<endl;
		else{
			lli sq=sqrt(A[i]*B[i]);
			if(A[i]*B[i]==sq*sq)cout<<2*sq-3<<endl;
			else if(sq*(sq+1)>=A[i]*B[i])cout<<2*sq-2<<endl;
			else cout<<2*sq-1<<endl;
		}
	}
        return 0;
}
//  gotcha

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int i, d, n, S=0;
	while(scanf("%d",&d)!=EOF) {
		S = 0;
		n = 600/d;
		for(i=0;i<n;i++) {
			S += d * (i * d)*(i * d);
		}
		printf("%d\n", S);
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

int n, m;
ll gcd, lcm = 1;

int main(){
	
	cin >> n >> m;
	ll a;
	
	rep(i, n){
		cin >> a;
		gcd = __gcd(gcd, a);
	}
	rep(i, m){
		cin >> a;
		
		double x = 1.0 * lcm / __gcd(lcm, a) * a;
		
		if(x > gcd * 1.1){
			cout << 0 << endl;
			return 0;
		}
		
		lcm = lcm / __gcd(lcm, a) * a;
	}
	
	//cerr<<gcd<<" "<<lcm<<endl;
	
	gcd /= lcm;
	
	ll ans = 1;
	for(ll i = 2; i * i <= gcd; i++) if(gcd % i == 0){
		
		int cnt = 0;
		for(; gcd % i == 0; gcd /= i) cnt++;
		
		ans *= cnt + 1;
	}
	if(gcd > 1) ans *= 2;
	
	cout << ans << endl;
	
	return 0;
}


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

main() {
    string S,T; cin >> S >> T;
    sort(S.begin(),S.end());
    sort(T.begin(),T.end());
    reverse(T.begin(),T.end());
    if(S<T)cout << "Yes" <<endl;
    else cout << "No" <<endl;

    return 0;
}

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

/*
  ll n , m ;
  cin >> n >> m ;
  ll a , b , c ;
  cin >> a >> b >> c ;
  vector<ll> A(n) ;
  cout << "Yes" << endl ;
  cout << "No"  << endl ;
*/

int main(){
    ll n ;
    cin >> n ;
    ll ans = 7 % n ;
    for( ll i = 1 ; i <= 999982 ;i++){
      if( ans == 0 ){
        cout << i << endl ;
        return 0 ;
      }
      ans = 10 * ans + 7 ;
      ans = ans % n  ;
    }
    cout << -1 << endl ;
}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;
  cin >> a >> b;
  ll ret = 0;
  int bmin = b * 10;
  int bmax = (b+1) * 10 - 1;
  int flag = 0;
  for (int i = bmin; i<= bmax ; i ++){
     if( (int)(0.08 * i) == a ) {
       cout << i << endl;
       flag = 1;
       break;
     }
  }
  if( flag == 0 ) cout << -1 << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        Map<String, Boolean> map = new HashMap<>();
        for (int i = 0;i < n;i++) {
            map.put(sc.next(),true);
        }
        int m = sc.nextInt();
        
        boolean b = true;
        for (int i = 0;i < m;i++) {
            String s = sc.next();
            if (map.containsKey(s)) {
                if (b) {
                    System.out.println("Opened by " + s);
                } else {
                    System.out.println("Closed by " + s);
                }
                b = !b;
            } else {
                System.out.println("Unknown " + s);
            }
        }
    }
}

Measured memory_bytes: 28592
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <utility>
using namespace std;
using ll = long long;

int main(){
  ll n, m; cin >> n >> m;
  ll a[n+1], cum[n+1];
  cum[0] = 0;
  map<ll, ll> mp;
  for(int i=1; i<=n; i++) {
    cin >> a[i];
    cum[i] = cum[i-1] + a[i];
    mp[cum[i] % m]++;
  }
 
  ll ans = 0;
  for(auto itr = mp.begin(); itr!=mp.end(); itr++){
    ll n = itr->second;
    if(itr->first == 0) ans += n;
    ans += n * (n-1) / 2;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cctype>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VII;
typedef pair<int, int> PII;
typedef long long ll;

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back;
#define MP make_pair
#define SIZE(a) int((a).size())
#define SORT(c) sort((c).begin(), (c).end())

const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 3;

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

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

string solve(string &input){
  string train(input, 0, 1);
  int f = 0, b = 0, n = 0;
  for(int i = 1; i < input.size(); i++){
    if(input[i] == '<') n++;
    else if(input[i] == '>') n--;
    else if(input[i] != '-' && n > f) { train.insert(train.begin(), input[i]); f = n;}
    else if(input[i] != '-' && n < b) { train.insert(train.end(), input[i]); b = n;}
  }
  return train;
}

int main(void){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    string input;
    cin >> input;
    cout << solve(input) << endl;
  }
  return 0;
}

Measured memory_bytes: 1220
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> // 文字幅の指定 setw(int), 詰めたい文字の指定 setfill(char)
#include <algorithm> // sort
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define p(x) cout << (x) << endl
#define FOR(i,r,n) for(ll i=(ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n); i>=r; i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) REP(i,0,n)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define pb push_back

// 定義する？→左揃えで0埋め
// cout << setfill('0') << left << setw(4) << 12; // "0012"
// http://marycore.jp/prog/cpp/padding-left-right-zero/

const int inf = (int)1e9;
const ll INF = (ll)1e18;

// vectorの中身をcout << vs;で表示
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}

ll gcd (ll a, ll b) {
	while (b > 0) {
		ll t = a % b;
		a = b, b = t;
	}
	return a;
}

ll lcm (ll a, ll b) {
	return (a / gcd (a, b)) * b;
}

bool is_prime (ll n) {
		if (n < 2) return false;
		else if (n == 2) return true;
		else if (n % 2) return false;
		
		double sqrtn = sqrt(n);
		for (ll i = 3; i < sqrtn; i += 2) {
			if (n % i == 0) return false; 
		}
		return true;
}

ll ctoi(char c) {
	return (ll)(c - 48);
}

ll n, k, cnt=0, ans=0;
string s,t;

// ==================== template ============================

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

	int m, x; cin >> n >> m >> x;
	vi vs1;
	vi vs2;
	REP(i, m) {
		int a; cin >> a;
		if (a < x) vs1.pb(a);
		else vs2.pb(a);
	}
	cout << min(vs1.size(), vs2.size()) << endl;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	int A, B, C, D;

	cin >> A >> B >> C >> D;

	if (A + B > C + D) {
		cout << "Left" << endl;
	}

	if (A + B == C + D) {
		cout << "Balanced"<< endl;
	}

	if (A + B < C + D) {
		cout << "Right" << endl;
	}

	return 0;

}

Measured memory_bytes: 256
import java.util.*;

class Main{           
  
   public static void main(String[] args){
       Scanner sc = new Scanner(System.in);  
  
       long A = sc.nextLong();
       long B = sc.nextLong();
       long C = sc.nextLong();
     
       if(A%2 == 0 || B%2 == 0 || C%2 == 0){
           System.out.println(0);
       }else{
           System.out.println(Math.min(A*B,Math.min(B*C,C*A)));
       }
       
     
   }         
         
 }
  

        

Measured memory_bytes: 23508
//Author : Ayush Jain

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

#define ull unsigned long long
#define ll long long
#define mod 1000000007
#define fi first
#define se second
const int N=1e5 + 5;
const int M=1e5 + 5;

ull pw[67];
void pre()
{
	pw[0]=1;
	for(int i=1;i<64;i++) pw[i]=2*pw[i-1];
}

int main()
{
	ios_base::sync_with_stdio(false);
	pre();
	char s[100005];
	int i,n;
	vector < pair < char , int > > v1,v2;
	cin>>s;
	n=strlen(s);
	for(i=0;i<n;i++){
		if(s[i]!='x'){
			v1.push_back(make_pair(s[i],i));
			v2.push_back(make_pair(s[i],i));
		}
	}
	if(v1.size()==0){
		cout<<"0\n";
		return 0;
	}	
	reverse(v2.begin(),v2.end());
	for(i=0;i<v1.size();i++){
		if(v1[i].fi != v2[i].fi){
			cout<<"-1\n";
			return 0;
		}
	}
	int c1,c2;
	if(v1.size()%2==1){
		int k=v1.size();
		c1=v1[k/2].se;
		c2=v1[k/2].se;
	}
	else{
		int k=v1.size();
		c1=v1[k/2 - 1].se;
		c2=v1[k/2].se;	
	}
	int fst;
	vector <int> v3,v4;
	fst=c1;
	for(i=c1-1;i>=0;i--){
		if(s[i]!='x'){
			v3.push_back(fst-i-1);
			fst=i;
		}
	}
	v3.push_back(fst);
	fst=c2;
	for(i=c2+1;i<n;i++){
		if(s[i]!='x'){
			v4.push_back(i-fst-1);
			fst=i;
		}
	}
	v4.push_back(n-1-fst);
	int ans=0;
	for(i=0;i<v3.size();i++) ans+=abs(v3[i]-v4[i]);
	cout<<ans<<endl;	
		
	return 0;
}

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

int main() {
	string s;
	cin >> s;
	int left = 0, right = s.size();
	while (left < right) {
		int mid = (left + right) / 2;
		// test mid
		int even_low = 0;
		int even_high = mid;
		bool even_ok = even_high >= even_low;
		if (mid % 2) {
			even_high--;
		}
		int odd_low = 1;
		int odd_high = mid;
		bool odd_ok = odd_high >= odd_low;
		if (mid % 2 == 0) {
			odd_high--;
		}
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '1') {
				even_low++;
				even_high++;
				odd_low++;
				odd_high++;
			}
			else if (s[i] == '0') {
				even_low--;
				even_high--;
				odd_low--;
				odd_high--;
			}
			else {
				even_low--;
				even_high++;
				odd_low--;
				odd_high++;
			}
			swap(even_low, odd_low);
			swap(even_high, odd_high);
			swap(even_ok, odd_ok);
			while (even_low < 0) {
				even_low += 2;
			}
			while (even_high > mid) {
				even_high -= 2;
			}
			while (odd_low < 0) {
				odd_low += 2;
			}
			while (odd_high > mid) {
				odd_high -= 2;
			}
			if (even_high < even_low) {
				even_ok = false;
			}
			if (odd_high < odd_low) {
				odd_ok = false;
			}
		}
		if (odd_ok || even_ok) {
			right = mid;
		}
		else {
			left = mid + 1;
		}
	}
	cout << left << endl;
}

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

int main() {
	unsigned long long int n, ans = 0;
	cin >> n;
	REP(i, 1, n+1) {
		if (i % 3 != 0 && i % 5 != 0)ans = ans + i;
	}
	cout << ans<<endl;
	


}

Measured memory_bytes: 3632
#include <stdio.h>

#define NUM 1003

int main(int argc, char *args[])
{
  int h, w;
  scanf("%d %d", &h, &w);
  char a[NUM][NUM];
  int i, j;
  for (i = 0; i < h; i++)
    scanf("%s", a[i]);

  long long int p = 1e9 + 7;
  long long int dp[NUM][NUM];
  for (i = 0; i <= h; i++)
    for (j = 0; j <= w; j++)
      dp[i][j] = 0;

  for (i = 1; i <= h; i++)
  {
    for (j = 1; j <= w; j++)
    {
      if (i == 1 && j == 1)
      {
        dp[1][1] = 1;
        continue;
      }

      if (a[i - 1][j - 1] == '#')
      {
        dp[i][j] = 0;
      }
      else
      {
        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % p;
      }
    }
  }

  printf("%lld", dp[h][w]);

  return 0;
}


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

int main() {
  
  double pi = 3.141592653589793;
  
  double a,b,h,m;
  cin >> a >> b >> h >> m;
  
  double c,x,y,z;
  
  x = h * 30 + m * 0.5;
  y = m * 6;
  
  z = abs(x-y);
  
  c = a * a + b * b - 2 * a * b * cos(pi/180*z);
  
  cout << fixed << setprecision(14) << sqrt(c) << endl;
  
}

Measured memory_bytes: 4196
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	vector<string> s(n);
	vector<int> t(n);
	rep(i, n)cin >> s[i] >> t[i];
	string x; cin >> x;
	int res = 0;
	bool started = false;
	rep(i, n)
	{
		if (started)res += t[i];
		if (s[i] == x)started = true;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

ll N, M, V, P;
vector<ll> v;
vector<ll> s;

//////////一般化した二分探索

const bool LEFT = false;
const bool RIGHT = true;
bool judgeLR1(ll i, ll key);// 左に属するか右に属するかを判断する関数。下で定義する。
bool judgeLR2(ll i);// 左に属するか右に属するかを判断する関数。下で定義する。

ll nibutanL1(ll size, ll key) {// LEFTグループに属するうち最も右側のindexを得る
	ll L = -1;
	ll R = size;
	while (abs(R - L) > 1) {
		ll mid = (L + R) / 2;
		if (judgeLR1(mid, key) == RIGHT) R = mid;
		else L = mid;
	}
	return L;
}
ll nibutanR1(ll size, ll key) {//RIGHTグループに属するうち最も左側のindexを得る
	return nibutanL1(size, key) + 1;
}

ll nibutanL2(ll size) {// LEFTグループに属するうち最も右側のindexを得る
	ll L = -1;
	ll R = size;
	while (abs(R - L) > 1) {
		ll mid = (L + R) / 2;
		if (judgeLR2(mid) == RIGHT) R = mid;
		else L = mid;
	}
	return L;
}
ll nibutanR2(ll size) {//RIGHTグループに属するうち最も左側のindexを得る
	return nibutanL2(size) + 1;
}


bool judgeLR1(ll i, ll key) {// v[i]がkeyよりも大きいかどうか
	if (key < v[i]) { return RIGHT; }
	return LEFT;
}

bool judgeLR2(ll i) {
	ll n = V;
	ll sum = 0;
	ll x = v[i] + M; n--;
	sum += M;
	ll k = nibutanR1(N, x);
	k = (N - k);
	if (k >= P) { return LEFT; }
	sum += k * M; n -= k;
	if (n <= 0) { return RIGHT; }

	for (ll j = 0; j < N - k; j++) {
		if (j == i) { continue; }
		if (j > N - P) { sum += M; }
		else {
			sum += min(v[i] + M - v[j], M);
		}
	}
	if (sum >= M * V) { return RIGHT; }
	return LEFT;
}

int main() {
	cin >> N >> M >> V >> P;
	for (ll i = 0; i < N; i++) {
		ll a; cin >> a;
		v.push_back(a);
	}

	sort(v.begin(), v.end());
	for (ll i = 0; i < N; i++) {
		if (i == 0) { s.push_back(0); }
		else { s.push_back(s[i - 1] + v[i]); }
	}

	ll k = nibutanR2(N);
	cout << N - k << endl;

	return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll h,n,sum=0;
	cin>>h>>n;
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		sum+=x;
	}
	if(sum>=h){
		cout << "Yes";
		return 0;
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
const int MAX = 1000001;
int main()
{
	int h[MAX];
	int dp[MAX];
	int n, k, i;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> h[i];
	dp[0] = 0;
	for (i = 1; i < n; i++)
	{
		dp[i] = 1000000000;
		for (int j = 1; j <=k; j++)
		{
			if (i - j < 0)	break;
			dp[i] = min(dp[i],(abs(h[i] - h[i - j]) + dp[i - j]));
		}
	}
	cout << dp[n - 1];
	
	return 0;
}


Measured memory_bytes: 6528
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#include <bits/stdc++.h>
using namespace std;

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int r, D, x;

int main(){
    INIT;
    cin >> r >> D >> x;
    REP(i,10) {
        x = r*x - D;
        cout << x << "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
    }
    ll half = N / 2;
    ll maxskip = (N % 2 == 0) ? 1 : 2;
    vector<vector<ll>> dp(maxskip + 1, vector<ll>(N, -INF));
    if (N % 2 == 0) {
        dp[0][0] = A[0];
        dp[1][1] = A[1];
        if (N > 2) {
            dp[0][2] = A[0] + A[2];
        }
        for (ll i = 3; i < N; i++) {
            dp[0][i] = dp[0][i - 2] + A[i];
            dp[1][i] = max(dp[1][i - 2] + A[i], dp[0][i - 3] + A[i]);
        }
        ll result = max(dp[0][N - 2], dp[1][N - 1]);
        print(result);
    } else {
        dp[0][0] = A[0];
        dp[1][1] = A[1];
        if (N > 2) {
            dp[2][2] = A[2];
            dp[0][2] = A[0] + A[2];
        }
        if (N > 3) {
            dp[1][3] = max(A[1] + A[3], A[0] + A[3]);
        }
        for (ll i = 4; i < N; i++) {
            dp[0][i] = dp[0][i - 2] + A[i];
            dp[1][i] = max(dp[1][i - 2] + A[i], dp[0][i - 3] + A[i]);
            dp[2][i] = max(max(dp[2][i - 2] + A[i], dp[1][i - 3] + A[i]), dp[0][i - 4] + A[i]);
        }
        ll result = max(max(dp[0][N - 3], dp[1][N - 2]), dp[2][N - 1]);
        print(result);
    }
}


Measured memory_bytes: 11184
/*************************
author : coldbeer
2019-05-25 05:35:00 PM IST
*************************/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll r,d,x; cin >> r >> d >> x;
	ll curr = x;
	for(int i = 0;i < 10;i++){
		ll ans = r * curr - d;
		cout << ans << endl;
		curr = ans;
	}
	return 0;
}


Measured memory_bytes: 256