akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    bool isYellow = false;
    for(int i=0; i<n; ++i){
        char c;
        cin >> c;
        if(c == 'Y')
            isYellow = true;
    }

    if(isYellow)
        cout << "Four" << endl;
    else
        cout << "Three" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == 'A' && s[i + 1] == 'C') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
int x,y,a,b,c;
int w;
vector<int>va,vb,v;
signed main()
{
	cin>>x>>y>>a>>b>>c;
	for (int i=0;i<a;i++){
		cin>>w;
		va.pb(-w);
	}
	for (int i=0;i<b;i++){
		cin>>w;
		vb.pb(-w);
	}
	for (int i=0;i<c;i++){
		cin>>w;
		v.pb(-w);
	}
	sort(all(va));
	sort(all(vb));
	for (int i=0;i<x;i++){
		v.pb(va[i]);
	}
	for (int i=0;i<y;i++){
		v.pb(vb[i]);
	}
	sort(all(v));
	int ns=0;
	for (int i=0;i<x+y;i++){
		ns-=v[i];
	}
	cout<<ns;
	re 0;
}

Measured memory_bytes: 7664
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CsTest
{
    public class Program
    {
        static void Main(string[] args)
        {
            int[] inputs = Console.ReadLine().Split(' ').Select(hoge => int.Parse(hoge)).ToArray();
            int a = inputs[0], b = inputs[1], x = inputs[2];

            if(x * 2 > a * a * b)
            {
                int l = (a * a * b) - x;
                double c = l * 2.0 / a / a;
                Console.WriteLine(Math.Atan2(c, a) * 180 / Math.PI);
            }
            else
            {
                double c = x * 2.0 / a / b;
                Console.WriteLine(Math.Atan2(b, c) * 180 / Math.PI);
            }
        }
    }
}

Measured memory_bytes: 13268
#include <vector>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    long long x, t=100;
    cin >> x;
    int out = 0;
    while(t < x){
        t *= 1.01;
        out ++;
    }
    cout << out << endl;
    return 0;
}

Measured memory_bytes: 3636
#require 'pp'

n = gets.to_i
a_n = gets.split.map(&:to_i)

memo = Hash.new(0)
a_n.each.with_index(1) do |a, j|
    x = j - a
    next if x <= 0

    memo[x] += 1
end

#pp memo

total = 0
a_n.each.with_index(1) do |a, i|
    y = a + i
    total += (memo[y] || 0)
end

puts total


Measured memory_bytes: 32088
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int n;
    cin >>n;
    vector<int> a(n);
    rep(i,n) cin >>a[i];

    int sa = 0;
    rep(i,n) sa += a[i];

    int val = 123456789;
    int idx = -1;
    rep(i,n){
        int d = abs(sa - n*a[i]);
        if(d < val){
            val = d;
            idx = i;
        }
    }
    cout << idx << endl;
    return 0;
}


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

int main()
{
	char a[101],i=0,j=1;
	cin>>a;
	for(int i=0;i<strlen(a);i++){
		if(j==1){
			if(a[i]=='C'){
				j++;
			}
		}else{
			if(a[i]=='F'){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

//Shuffle
public class Main{

	class Scanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-') return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}
	}

	void run(){
		Scanner sc = new Scanner();
		long mask = (1L << 32)-1;
		Comparator<Long> C = new Comparator<Long>() {
			public int compare(Long o1, Long o2) {
				return (int) ((o1>>32)-(o2>>32));
			}
		};
		int[] p = new int[5000], q = new int[5000];
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			int m = sc.nextInt(), P = sc.nextInt(), Q = sc.nextInt(), R = sc.nextInt();
			List<Long> l = new ArrayList<Long>();
			//int(32bit)を2つ並べて1つのlong(64bit)とする、2つの値は区間の左端、右端
			l.add(((long)P<<32)|Q);
			for(int i=0;i<m;i++){
				p[i] = sc.nextInt(); q[i] = sc.nextInt();
			}
			for(int i=m-1;i>=0;i--){
				long t1 = n-q[i], s2 = t1+1, t2 = n-p[i], s3 = n-p[i]+1, y = q[i];
				List<Long> next = new ArrayList<Long>(1500);
				for(int j=0;j<l.size();j++){
					long x = l.get(j);
					long s = x>>32, t = x&mask;
					if(t<=t1){
						next.add((s+y)<<32 | (t+y));
					}
					else if(t<=t2){
						if(s<=t1){
							next.add((s+y)<<32 | (t1+y));
							s = s2;
						}
						next.add((s-s2+p[i]+1)<<32 | (t-s2+p[i]+1));
					}
					else{
						if(s<=t1){
							next.add((s+y)<<32 | (t1+y));
							s = s2;
						}
						if(s<=t2){
							next.add((s-s2+p[i]+1)<<32 | (t2-s2+p[i]+1));
							s = s3;
						}
						next.add((s-s3+1)<<32 | (t-s3+1));
					}
				}
				//区間数が多くなってきたら隣り合っている区間の結合処理
				//あと最後は必ず行う
				if(i==0||1100<=next.size()){
					l = new ArrayList<Long>();
					Collections.sort(next, C);
					long ss = next.get(0)>>32, tt = next.get(0)&mask;
					for(int j=1;j<next.size();j++){
						long x = next.get(j);
						long s = x>>32, t = x&mask;
						if(tt+1==s)tt = t;
						else{
							l.add((ss<<32)|tt);
							ss = s; tt = t;
						}
					}
					l.add((ss<<32)|tt);
				}
				else{
					l = next;
				}
			}
			int res = 0;
			for(long x:l){
				long s = x>>32, t = x&mask;
				if(R<s)break;
				if(R<t)t = R;
				res+=t-s+1;
			}
			System.out.println(res);
		}
	}

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

Measured memory_bytes: 10000
#TLE
from collections import deque
s = deque(input())
q = int(input())
num = 0
for _ in range(q):
    t = input()
    if t == '1':
        if num == 0:
            num = 1
        else:
            num = 0
    else:
        t, f, c = t.split()
        if num == 0:
            if f == '1':
                s.appendleft(c)
            else:
                s.append(c)
        else:
            if f == '2':
                s.appendleft(c)
            else:
                s.append(c)
s = ''.join(s)
if num == 1:
    s = s[::-1]
print(s)

Measured memory_bytes: 8564
a, b = list(map(int,input().split(' ')))
 
def gcd(x,y):
 
  while y!=0:
    x,y=y,x%y
  return x
 
gcd = gcd(a,b)
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
if gcd == 1:
  print(1)
else:
  print(len(factorization(gcd)) + 1)
 

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back

signed main(){
    int n;
    cin>>n;
    
    vector<int> a(n),b(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    
    
    int ans = 0;
    for(int i=29;i>=0;i--){
        rep(j,n)a[j]%=(1<<(i+1));
        rep(j,n)b[j]%=(1<<(i+1));
        sort(all(a));
        sort(all(b));

        int num = 0;
        rep(j,n){
            num +=  lower_bound(all(b),(1LL<<(i+1))-a[j]) - lower_bound(all(b),(1LL<<i)-a[j]);
            num +=  lower_bound(all(b),(1<<(i+1))+(1LL<<(i+1))-a[j]) - lower_bound(all(b),(1<<(i+1))+(1LL<<i)-a[j]);
            num%=2;
        }
        
        if(num%2==1)ans += (1<<i);
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#define pb push_back 
#include<vector>
#define all(c) c.begin(), c.end()
using namespace std;
int N=200000;
int main(){
  int n,p;
  vector<int> pr(200000,1);
  pr[0]=0;
  pr[1]=0;
  vector<int> prime;
  for(int i=0;i*i<N;i++){
    if(pr[i]){
      for(int j=i*2;j<N;j+=i){
	pr[j]=0;
      }
    }
  }
  for(int i=0;i<N;i++)
    if(pr[i])
      prime.pb(i);
  /*for(int i=0;i<(int)prime.size();i++)
    cout<<prime[i]<<endl;
  */
  while(cin>>n>>p,n!=-1||p!=-1){
    vector<int> buf,plus;
    int cnt=0;
    for(int i=0;i<prime.size()&&cnt<p;i++){
      if(prime[i]>n){
	cnt++;
	buf.pb(prime[i]);
      }
    }
    for(int i=0;i<p;i++){
      for(int j=i;j<p;j++){
	plus.pb(buf[i]+buf[j]);
      }
    }
    sort(all(plus));
    /* for(int i=0;i<plus.size();i++)
      cout<<plus[i]<<endl;
    */
    cout<<plus[p-1]<<endl;
  }

  return 0;
}

Measured memory_bytes: 2124
/* *>>>>>Anshit_Bhardwaj<<<<<* */
#include <bits/stdc++.h>
#define ll long long
#define f(i, x, n) for(int i = x; i < n; i++)
#define dbg(x) cout << x << endl
#define dbg2(x, y) cout << x << ' ' << y << endl
#define dbg3(x, y, z) cout << x << ' ' << y << ' ' << z << endl
#define mod 1000000007
using namespace std;

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

Measured memory_bytes: 3636
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Loc{

	void set(int arg_row,int arg_col){
		row = arg_row;
		col = arg_col;
	}
	int row,col;
};

int H,W;
int num_map;
int change_time[16];
int diff_row[5] = {-1,0,0,0,1},diff_col[5] = {0,-1,0,1,0};
char table[16][25][25];
int check[2][25][25];

bool rangeCheck(Loc loc){

	if(loc.row >= 0 && loc.row <= H-1 && loc.col >= 0 && loc.col <= W-1){

		return true;

	}else{

		return false;
	}
}

int main(){

	scanf("%d %d",&H,&W);

	Loc start,goal;

	for(int row = 0; row < H; row++){

		scanf("%s",table[0][row]);
		for(int col = 0; col < W; col++){
			if(table[0][row][col] == 'S'){

				start.set(row,col);

			}else if(table[0][row][col] == 'G'){

				goal.set(row,col);
			}
		}
	}

	scanf("%d",&num_map);

	for(int i = 1; i <= num_map; i++){

		scanf("%d",&change_time[i]);

		for(int row = 0; row < H; row++){

			scanf("%s",table[i][row]);
		}
	}

	int limit = change_time[num_map]+H*W;
	int CURRENT = 0,NEXT = 1;

	for(int row = 0; row < H; row++){
		for(int col = 0; col < W; col++){

			check[CURRENT][row][col] = BIG_NUM;
			check[NEXT][row][col] = BIG_NUM;
		}
	}
	check[CURRENT][start.row][start.col] = 0;

	int ans = BIG_NUM;
	Loc next_loc;
	int next_time,next_map,next_cost,current_map = 0;

	//printf("limit:%d\n",limit);

	for(int current_time = 0; current_time <= limit; current_time++){

		//1病後のマップ
		if(current_map < num_map && current_time+1 == change_time[current_map+1]){

			next_map = current_map+1;

		}else{

			next_map = current_map;
		}

		for(int row = 0; row < H; row++){
			for(int col = 0; col < W; col++){

				if(check[CURRENT][row][col] == BIG_NUM || check[CURRENT][row][col] >= ans)continue;

				for(int i = 0; i < 5; i++){
					next_loc.row = row+diff_row[i];
					next_loc.col = col+diff_col[i];

					if(rangeCheck(next_loc) == false || table[next_map][next_loc.row][next_loc.col] == '#')continue;

					next_cost = check[CURRENT][row][col];

					if(i != 2){
						next_cost++;
					}

					check[NEXT][next_loc.row][next_loc.col] = min(check[NEXT][next_loc.row][next_loc.col],next_cost);
				}
			}
		}

		ans = min(ans,check[NEXT][goal.row][goal.col]);
		swap(CURRENT,NEXT);

		for(int row = 0; row < H; row++){
			for(int col = 0; col < W; col++){

				check[NEXT][row][col] = BIG_NUM;
			}
		}

		current_map = next_map;
	}

	if(ans == BIG_NUM){

		printf("-1\n");
	}else{

		printf("%d\n",ans);
	}

	return 0;
}



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

int gcd(int a, int b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

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

    int ans = 0;
    for(int i = 1; i <= K; ++i) {
        for(int j = 1; j <= K; ++j) {
            for(int k = 1; k <= K; ++k) {
                ans += gcd(gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

Int sum;
Int sumone, n, cnt;
Int a[216000];
void ok(){
  cout << "YES" << endl;
  exit(0);
}

void ng(){
  cout <<  "NO" << endl;
  exit(0);
}


int main(){
  cin >> n;
  for(Int i = 0;i < n;i++)cin >> a[i], sum += a[i];
  sumone = n * (n+1) / 2;
  if(sum % sumone)ng();
  sum /= sumone;
  for(Int i = 0;i < n;i++){
    Int b = (i + n - 1) % n;
    Int diff = a[b] - a[i];
    diff += sum;
    if(diff < 0 || diff % n)ng();
    cnt += diff / n;
  }
  if(sum != cnt)ng();
  ok();
  return 0;
}


Measured memory_bytes: 1024
/*input
14
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=5005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
int n;
vector<int> edge[maxn];
bool vis[maxn];
int sz[maxn];
vector<int> cent;
void dfs(int u){
	vis[u]=1;
	bool f=1;
	sz[u]=1;
	for(int v:edge[u]) if(!vis[v]){
		dfs(v);
		sz[u]+=sz[v];
		if(sz[v]+sz[v]>n) f=0;
	}
	if(sz[u]+sz[u]<n) f=0;
	if(f) cent.pb(u); 
}

vector<ll> poly={1};
ll fac[maxn];

void add(int u){
	// cout<<u<<'\n';
	vector<ll> tmp;
	ll cur=1;
	for(int i=0;i<=u;i++){
		tmp.pb(cur*cur%MOD*fac[i]%MOD);
		cur=cur*(u-i)%MOD*mypow(i+1,MOD-2)%MOD;
	}
	// REP(i,SZ(tmp)) cout<<tmp[i]<<" \n"[i==SZ(tmp)-1];
	vector<ll> res(SZ(poly)+SZ(tmp)-1);
	REP(i,SZ(res)) res[i]=0;
	REP(i,SZ(poly)) REP(j,SZ(tmp)){
		res[i+j]+=poly[i]*tmp[j]%MOD;
		if(res[i+j]>=MOD) res[i+j]-=MOD;
	}
	poly=res;
	// REP(i,SZ(poly)) cout<<poly[i]<<" \n"[i==SZ(poly)-1];
}

int main(){
	// IOS;
	cin>>n;
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%MOD;
	REP(i,n-1){
		int u,v;
		cin>>u>>v;
		u--;v--;
		edge[u].pb(v);
		edge[v].pb(u);
	}
	dfs(0);
	if(SZ(cent)==2){
		add(n/2);
		add(n/2);
		// cout<<fac[n/2]*fac[n/2]%MOD<<'\n';
	}
	else{
		for(int v:edge[cent[0]]) if(sz[v]<sz[cent[0]]) add(sz[v]);
		add(n-sz[cent[0]]);
	}

	ll ans=0;
	for(int i=0;i<SZ(poly);i++){
		if(i%2){
			ans-=fac[n-i]*poly[i]%MOD;
			if(ans<0) ans+=MOD;
		}
		else{
			ans+=fac[n-i]*poly[i]%MOD;
			if(ans>=MOD) ans-=MOD;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  ll N,w,sum = 0; cin >> N;
  vector<ll> sumvec(N);
  for (ll i = 0; i < N; ++i) {
    cin >> w;
    sum += w;
    sumvec[i] = sum;
  }
  ll absdiff = sum;
  for (ll i = 0; i < N; ++i) {
    ll absdiff_new = abs(sum-2*sumvec[i]);
    if (absdiff_new < absdiff) absdiff = absdiff_new;
    else break;
  }
  cout << absdiff << endl;
  return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main(){
 string str;
  //空白も含めて1行まるごとを文字列として受け取るためにはgetline関数を使う
  getline(cin,str);

  for(int i=0;i<str.size();i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i]=str[i]-32;
    }else if('A'<=str[i]&&str[i]<='Z'){
      str[i]=str[i]+32;
    }
  }
  cout<<str<<endl;
}


Measured memory_bytes: 3164
package main

import (
	"fmt"
	"math"
)

func main() {
	var n, k int
	fmt.Scan(&n)
	fmt.Scan(&k)

	var re float64
	for index := 1; index <= n; index++ {
		b := 1 / float64(n)
		if k-1 < index {
			re += b
			continue
		}
		logb := float64(k) / float64(index)
		re += b * math.Pow(0.5, math.Ceil(math.Log2(logb)))
	}

	fmt.Printf("%v\n", re)
}


Measured memory_bytes: 512
#include<stdio.h>

int cal(int an){
  int i;
  if(an<2){
    return 0;
  }
  else if(an == 2) {
    return 1;
  }
  if(an%2 == 0){
    return 0;
  }
  for(i=3;i*i<=an;i+=2){
    if(an%i==0) return 0;
  }
  return 1;

}



int main(){
  int num,an,i;

  int ka =0;
  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&an);

    if(cal(an)){
      ka++;
    }
  }
  printf("%d\n",ka);

    return 0;
  }



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

int main() {
	int N;
	int B[100];
	cin >> N;
	rep(i, N-1){
		cin >> B[i]; 
	}
	int sum = 0;
	sum += B[0] + B[N-2];
 	rep(i, N-2){
		sum += min(B[i], B[i+1]);
	}
	cout << sum;
}

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

AB = [[0, 0]]
for i in range(N):
  AB.append(list(map(int, input().split()))[::-1])

AB.sort()
ans = 'Yes'

for i in range(1, N+1):
  AB[i][1] += AB[i-1][1]
  if AB[i][1] > AB[i][0]:
    ans = 'No'
    break

print(ans)

Measured memory_bytes: 37176
#include <algorithm>  //min, max, sort, unique, fill
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>  //pair, swap,
#include <vector>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using VI = vector<ll>;
using VB = vector<bool>;
using VP = vector<P>;
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) for (ll i = 0; i < (n); i++)

static const ll kIntMax = numeric_limits<ll>::infinity();
static const double kFloatMax = numeric_limits<double>::infinity();

vector<ll> vi;

int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b) + min(c, d) << endl;

  return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];

    int cnt = 0;
    for (int i = 0; i < n; i += 2) {
        if (a[i] % 2 == 1) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3548
#include <iostream>
using namespace std;
int main(void){

int N,M,C;

cin >> N >> M >> C;

int B[M];
int A[N][M];

for (int m=0;m<M;m=m+1) {
cin >> B[m];
}


for (int n=0;n<N;n=n+1) {
for (int m=0;m<M;m=m+1) {
cin >> A[n][m]; 
}
}



long sum=0;
int count =0;

for (int n=0;n<N;n=n+1) {
sum=0;
for (int m=0;m<M;m=m+1) {
sum = sum + A[n][m]*B[m];
}

if (sum+C>0) count = count +1;
}

cout << count << endl ;

}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)

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

struct edge {
	int to,cost;
	edge(int t,ll c):to(t),cost(c) {}
};

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

ll mypow(ll x,ll n,ll m) {
	if(n==0) return 1;
	if(n%2==0) return mypow(x*x%m,n/2,m);
	else return x*mypow(x,n-1,m)%m;
}

//-----------------------------------------------------------------------------

int n;
ll a,b,x[100000];

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

	cin>>n>>a>>b;
	REP(i,n) cin>>x[i];

	ll sum=0;
	FOR(i,1,n) {
		ll d=x[i]-x[i-1];
		sum+=min(d*a,b);
	}

	cout<<sum<<endl;

	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

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

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T get(){T a;cin>>a;return a;}
template<typename T>T rev(T a){reverse(all(a));return a;}
template<typename T>istream&operator>>(istream&is,vector<T>&vec){rep(i,vec.size())is>>vec[i];return is;}
template<typename T>vector<T>&sort(vector<T>&a){sort(all(a));return a;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

int W, H, N;

int mp[100][100];
pii uzuki, rin;

void move_uzuki()
{
    mp[uzuki.fst][uzuki.scd] = 0;
    if (uzuki.fst == 0 && uzuki.scd < W - 1) uzuki = pii(uzuki.fst, uzuki.scd + 1);
    else if (uzuki.scd == W - 1 && uzuki.fst < H - 1) uzuki = pii(uzuki.fst + 1, uzuki.scd);
    else if (uzuki.fst == H - 1) uzuki = pii(uzuki.fst, uzuki.scd - 1);
    mp[uzuki.fst][uzuki.scd] = 1;
}

void move_rin()
{
    mp[rin.fst][rin.scd] = 0;
    if (rin.fst == 1 && rin.scd < W - 2) rin = pii(rin.fst, rin.scd + 1);
    else if (rin.scd == W - 2 && rin.fst < H - 2) rin = pii(rin.fst + 1, rin.scd);
    else if (rin.fst == H - 2) rin = pii(rin.fst, rin.scd - 1);
    mp[rin.fst][rin.scd] = 1;
}

bool check(int y, int x)
{
    int dy[4] = {-1, 0, 1, 0}, dx[4] = {0, -1, 0, 1};

    rep(i, 4) {
        int ny = y + dy[i], nx = x + dx[i];
        if (0 <= ny && ny < H && 0 <= nx && nx < W) {
            if (mp[y][x] && mp[ny][nx]) return true;
        }
    }

    return false;
}

signed main()
{
    omajinai;
    cin >> W >> H;

    mp[0][0] = 1;
    mp[1][0] = 1;

    uzuki = pii(0, 0);
    rin = pii(1, 0);

    int ans = 0;

    cin >> N;

    rep(i, N) {
        int p; cin >> p;
        if (p == 0) {
            move_uzuki();
        } else {
            move_rin();
        }
        if (check(uzuki.fst, uzuki.scd)) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1208
//Code by Mukul Totla
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void sublime(){ 
    #ifndef ONLINE_JUDGE 
    freopen ("input.txt", "r", stdin);
    freopen ("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
      }
  
int main()
{   
   sublime();
  
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  ll ans=a*c;
  ans=max(ans,a*d);
  ans=max(ans,b*c);
  ans=max(ans,b*d);
  cout<<ans;
}

Measured memory_bytes: 3656
import sys
#import numpy as np
#from collections import defaultdict
#import math
#from collections import deque

input = sys.stdin.readline



def main():


    N = int(input())
    H = list(map(int,input().split()))
    H = [10**6] + H
    dp= [0] *(N+1)

    for i in range(2,N+1):
        dp[i]= min(dp[i-2]+abs(H[i]-H[i-2]),dp[i-1]+abs(H[i]-H[i-1]))

    print(dp[N])





if __name__ == "__main__":
    main()

Measured memory_bytes: 20100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
typedef pair<int, int> P;
const int MAX_N = 10000;
const int MAX_L = 100000000;
const int MAX_SQRT_B = 10000;
const int INF = 1000000000;
typedef int64_t ll;
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; }

int N;
string S;

int main() {
	cin >> S;
	int bNum=0;
	N = S.size();
	rep(i, N) {
		if (S.at(i) == '1')bNum++;
	}

	int ans = min(bNum, N - bNum);
	cout << ans * 2 << endl;
}

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

public class Main {
    private static final int MAX_SIZE = 1000002;
    private static int key[]  = new int[MAX_SIZE];
    private static int prev[] = new int[MAX_SIZE];
    private static int next[] = new int[MAX_SIZE];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        init();

        int n = sc.nextInt();

        while (n-- > 0) {
            String cmd = sc.next();
            if (cmd.equals("insert"))
                insert(Integer.parseInt(sc.next()));
            else if (cmd.equals("delete"))
                delete(Integer.parseInt(sc.next()));
            else if (cmd.equals("deleteFirst"))
                deleteFirst();
            else
                deleteLast();
        }
        printKey();
    }
    private static void init() {
        for (int p = 1; p < next.length - 1; p++)
            next[p] = p + 1;
    }
    private static int newCell() {
        int p = next[1];
        next[1] = next[p];
        return p;
    }
    private static void putBack(int p) {
        next[p] = next[1];
        next[1] = p;
    }
    private static void destroy(int p) {
        prev[next[p]] = prev[p];
        next[prev[p]] = next[p];
        putBack(p);
    }
    private static void insert(int k) {
        int p = newCell();
        key[p] = k;
        prev[next[0]] = p;
        next[p] = next[0];
        next[0] = p;
        prev[p] = 0;
    }
    private static void delete(int k) {
        for (int p = next[0]; p != 0; p = next[p]) {
            if (key[p] == k) {
                destroy(p);
                break;
            }
        }
    }
    private static void deleteFirst() {
        destroy(next[0]);
    }
    private static void deleteLast() {
        destroy(prev[0]);
    }
    private static void printKey() {
        PrintWriter out = new PrintWriter(System.out);
        int first = next[0];
        for (int p = next[0]; p != 0; p = next[p]) {
            if (p != first)
                out.print(' ');
            out.print(key[p]);
        }
        out.println();
        out.flush();
    }
}



Measured memory_bytes: 317688
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <climits>
#include <functional>
#include <array>
#include <cmath>
#include <set>

using namespace std;

int N, Y;

int main(){
	
	cin >> N >> Y;

		
	for (int i = 0; i <= N; ++i) {
		for (int k = 0; k <= N - i; ++k) {
			int price = i * 10000 + k * 5000 + (N - i - k) * 1000;
			if (price == Y) {
				cout
					<< i
					<< ' '
					<< k
					<< ' '
					<< N - i - k
					<< endl;
				return 0;
			}
		}
	}
	


	cout 
		<< -1
		<< ' '
		<< -1
		<< ' '
		<< -1
		<< endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <iostream>
#include <cmath>
#include <math.h>
#include<algorithm> 

using namespace std;

int main(){
    long long int a, b, c, d;
    cin>>a>>b>>c>>d;
    long long int p= max ({(a*c), (a*d), (b*c), (b*d) });
    cout<<p<<endl;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main(void){
	int r,c;
	int i,j;
	int a[101][101]={0};
	
	scanf("%d %d",&r,&c);
	for(i=0;i<r;i++){
		for(j=0;j<c;j++){
			scanf("%d",&a[i][j]);
			a[r][j]+=a[i][j];
			a[i][c]+=a[i][j];
			a[r][c]+=a[i][j];
		}
	}
	for(i=0;i<r+1;i++){
		for(j=0;j<c+1;j++){
			if(j)printf(" ");
			printf("%d",a[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 652
#include <stdio.h>

int main(){
  long x;
  scanf("%ld",&x);

  long y = x/11;
  long z = x - y*11;
  long ans = 2*y;
  if(z > 0 && z < 7){
    ans +=1;
  }else if(z >=7){
    ans +=2;
  }
  printf("%ld",ans);
}

Measured memory_bytes: 128
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

struct Elem {
    int pos, cost;
    Elem(int p, int c) : pos(p), cost(c) {}
    bool operator<(const Elem &e) const {
        return cost > e.cost;
    }
};

int dist[100010];
int main() {
    int N; scanf("%d", &N);
    vector<int> P(N), dead(N+1), visited(N+1, -1);
    for(int i=0; i<N; i++) {
        scanf("%d", &P[i]);
    }

    // fprintf(stderr, "input end\n");
    for(int i=0; i<N; i++) {
        if(dead[i] or visited[i] >= 0) continue;
        bool ng = false;
        {
            int v = i;
            while(true) {
                visited[v] = i;
                if(P[v] == 0) break;
                v += P[v];
                if(visited[v] == i or dead[v]) {
                    ng = true;
                    break;
                }
            }
        }

        if(ng) {
            int v = i;
            while(true) {
                dead[v] = true;
                v += P[v];
                if(dead[v]) break;
            }
        }
    }

    priority_queue<Elem> que;
    fill(dist, dist + N + 1, INF);
    dist[0] = 0;
    que.emplace(0, 0);
    while(que.size()) {
        auto e = que.top(); que.pop();
        int u = e.pos, c = e.cost;
        if(dist[u] < c or u == N - 1) continue;
        for(int d=1; d<=6 and P[u] == 0; d++) {
            int v = min(u + d, N - 1);
            if(dead[v]) continue;
            if(dist[v] > dist[u] + 1) {
                dist[v] = dist[u] + 1;
                que.emplace(v, dist[v]);
            }
        }
        if(u > 0 or P[u] != 0) {
            int v = u + P[u];
            if(dead[v]) continue;
            if(dist[v] > dist[u]) {
                dist[v] = dist[u];
                que.emplace(v, dist[v]);
            }
        }
    }
    /*
    for(int i=0; i<N; i++) cerr << dead[i] << " ";
    cerr << endl;
    for(int i=0; i<N; i++) cerr << dist[i] << " ";
    cerr << endl;
    */
    printf("%d\n", dist[N - 1]);
    return 0;
}



Measured memory_bytes: 4412
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<P> r(n), b(n);
    rep(i, n)cin >> r[i].first >> r[i].second;
    rep(i, n)cin >> b[i].first >> b[i].second;
    sort(r.begin(), r.end(), greater<P>());
    set<P> ans;
    for(P v : r){
        int x = v.first;
        int y = v.second;
        P mn = make_pair(1000, 1000);
        for(P t : b){
            if(x < t.first && y < t.second){
                if(t.second < mn.second && ans.find(t) == ans.end())mn = t;
            }
        }
        if(mn != make_pair(1000, 1000))ans.insert(mn);
    }
    cout << ans.size() << endl;
}

Measured memory_bytes: 256
import math
def fact(n):
    ans = 1
    for i in range(2, n+1):
        ans*= i
    return ans
def comb(n, c):
    return fact(n)//(fact(n-c)*c)

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

if M%2==0:
  for i in range(M//2):
    print(i+1,M-i)
  for i in range(M//2):
    print(M+i+1,2*M-i+1)  
else:
  for i in range(M//2):
    print(i+1,M-i)
  for i in range(M//2+1):
    print(M+i+1,2*M-i+1)


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

using namespace std;
int main()
{
	int a,i,j,n;
   vector<int>v;
   for(i=1;i<=9;i++)
   {
   	for(j=1;j<=9;j++)
	{
		a=i*j;
		v.push_back(a);
	}
   }
   cin>>n;
   for(i=0;i<v.size();i++)
   {
   	if(n==v[i])
	{
		cout<<"Yes"<<endl;
		break;
	}
   }
   if(i==v.size())
   {
   	cout<<"No"<<endl;
   }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAXR 1000
#define MOD 1000000007

int H, W, dp[MAXR + 3][MAXR + 3];

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

    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            char ch;

            cin >> ch;
            if (ch == '#')
                dp[i][j] = 0;
            else {
                if (i == 1 && j == 1)
                    dp[i][j] = 1;

                if (i > 1)
                    dp[i][j] += dp[i - 1][j];
                
                if (j > 1)
                    dp[i][j] += dp[i][j - 1];

                dp[i][j] %= MOD;
            }
        }
    }

    cout << dp[H][W] << endl;
}


Measured memory_bytes: 4224
K = input()
K = int(K)
ab = list(map(int, input().split()))
S = 0

for i in range(1000):
    if ab[0] <= (i + 1) * K and (i + 1) * K <= ab[1]:
        print("OK")
        break
    S += 1
if S == 1000:

    print("NG")

Measured memory_bytes: 9176
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <cstdio>
#include <complex>
#include <climits>
using namespace std;

int main() {
  string a, b;
  cin >> a >> b;
  a = " " + a;
  b = " " + b;
  vector<vector<int> > v(b.size(), vector<int>(a.size(), INT_MAX));
  for (int i = 0; i < a.size(); i++) {
    v[0][i] = i;
  }
  for (int i = 0; i < b.size(); i++) {
    v[i][0] = i;
  }
  for (int i = 1; i < b.size(); i++) {
    for (int j = 1; j < a.size(); j++) {
      if (b[i] == a[j]) {
        v[i][j] = v[i-1][j-1];
      } else {
        v[i][j] = min(v[i][j-1], min(v[i-1][j], v[i-1][j-1])) + 1;
      }
    }  
  }
  /*
  for (int i = 0; i < b.size(); i++) {
    for (int j = 0; j < a.size(); j++) {
      cout << v[i][j] << " ";
    }
    cout << endl;
  }*/

  cout << v[b.size()-1][a.size()-1] << endl;
}

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

const int N = 3005;

ll n, a[5], ans;
string s;


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n; 
	while (n--){
		cin >> s;
		if (s[0]=='M') a[0]++;
		else if (s[0]=='A') a[1]++;
		else if (s[0]=='R') a[2]++;
		else if (s[0]=='C') a[3]++;
		else if (s[0]=='H') a[4]++;
	}
	
	ans = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = i+1; j < 5; j++) {
			for (int k = j+1; k < 5; k++) {
				ans += a[i]*a[j]*a[k];
			}
		}
	}
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int times;
	int rate;

	scanf("%d %d", &times, &rate);
	if(times<10){
		printf("%d", rate + 100 * (10 - times));
	}else{
		printf("%d", rate);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 128
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		LL x;
		cin >> x;
		vector<LL> a(n);
		REP(i,n) cin >> a[i];
		LL ans = 0;
		FOR(i,1,n){
			if(a[i]+a[i-1] <= x) continue;
			ans += (a[i]+a[i-1])-x;
			LL t = min(a[i],(a[i]+a[i-1])-x);
			a[i] -= t;
			a[i-1] -= x-(a[i]+a[i-1]);
		}
		cout << ans << endl;
	}
	return 0;
}


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

int main()
{
    // 価格記録用コンテナ
    std::vector<int> input;

    int number = 0, bought = 0;

    std::cin >> number >> bought;

    input.reserve(number);

    // 果物の価格を読み込む
    for (int kosu = 0; kosu < number; kosu++)
    {
        int kakaku = 0;

        std::cin >> kakaku;

        input.emplace_back(kakaku);
    }

    // 昇順に並び替える
    std::sort(input.begin(), input.end());

    // 答えを出力する。
    int answer = 0;
    for (int kau = 0; kau < bought; kau++)
    {
        answer += input.at(kau);
    }

    std::cout << answer << std::endl;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;


int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   
   string a,b;
   cin>>a>>b;

   map<string,long int> m;
   cin>>m[a]>>m[b];

   string c;
   cin>>c;
   m[c]--;

   cout<<m[a]<<" "<<m[b];
      return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>
#include <cstdarg>
#include <set>
#include <limits>
#include <iomanip>
#ifdef DEBUG

#else

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

#    ifdef __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")

using namespace std;
#define INF 2e9 + 9
#define MOD 1000000007
#define ALL(v) v.begin() , v.end()
#define Int int64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T, vector<T>>;
template<class T> using pq = priority_queue<T, vector<T>, greater<T>>;
#define ll(n) Int n; cin >> n;
#define LL(...) Int __VA_ARGS___; cin >> __VA_ARGS___;
#define OUT(...) cout << __VA_ARGS___;
#define RP(n, i, s) for(Int i = s ;i < n ;i++)
#define REP(n, i) for (Int i = 0; i < n; i++)
#define REPe(n, i) for (Int i = 1; i <= n; i++)
#define RPe(n, i, s) for (Int i = s; i <= n; i++)
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;

void ansYes(bool flag){
    if (flag) cout << "Yes" << endl; else  cout << "No" << endl;
}

void ansYES(bool flag){
    if (flag) cout << "YES" << endl; else  cout << "NO" << endl;
}

struct node {
    Int to;
    Int length;
};


vector<Int> divisor(Int n) {
    vector<Int> ret;
    for (Int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    return (ret);
}

int main() {
    Int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}

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


int main(){
    int n;
    int t[100001],x[100001],y[100001];
    cin >> n;
    t[0] = x[0] = y[0] = 0;
    for(int i=1;i<=n;i++){
        cin >> t[i] >> x[i] >> y[i];
    }

    bool can = true;
    for(int i=0;i<n;i++){
        int dt = t[i+1]-t[i];
        int dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if(dt < dist){
            can = false;
            break;
        }
        if(dt%2 != dist%2){
            can = false;
            break;
        }
    }
    string ans = "Yes";
    if(can == false){
        ans = "No";
    }
    cout << ans << endl;
}


Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <math.h>
#include <algorithm>
const double EPS = 1e-9;
using namespace std;
class vector {
public:
	double x, y;
	vector(double a, double  b) {
		x = a;
		y = b;
	};
	vector operator * (const vector &v)const {
		return vector(x*v.x, y* v.y);
	}
	vector operator * (double a) {
		return vector(x * a, y * a);
	}
	vector operator - (vector v) {
		return vector(x - v.x, y - v.y);
	}
	vector operator + (vector v) {
		return vector(x + v.x, y + v.y);
	}
};
inline double dot(vector v1, vector v2) {
	return v1.x*v2.x + v1.y*v2.y;
}
inline double squ(vector v) {
	return v.x*v.x + v.y*v.y;
}
inline double norm(vector v) {
	return sqrt(squ(v));
}
inline void print(vector v) {
	printf("%.10f %.10f\n", v.x, v.y);
}
inline vector pro(vector base, vector v, vector be) {
	double a = dot(base, v) / squ(base);
	vector v1 = base * a;
	return v1 + be;
}
inline vector ref(vector v, vector be) {
	return (v - be)*2 + be;
}
inline double cross(vector v1, vector v2) {
	return v1.x*v2.y - v1.y*v2.x;
}
inline int ccw(vector v1, vector v2, vector v3) {
	vector a = v2 - v1;
	vector b = v3 - v1;
	if (cross(a, b) < 0.0) return -1;
	else if (cross(a, b) > 0.0) return 1;
	else if (dot(a, b) < 0.0) return -2;
	else if (dot(a, b) > squ(a)) return 2;
	else return 0;
}
inline int inter(vector v1, vector v2, vector v3, vector v4) {
	return (ccw(v1, v2, v3) * ccw(v1, v2, v4) <= 0) && (ccw(v3, v4, v1) * ccw(v3, v4, v2) <= 0);
}
inline double disPP(vector v1, vector v2) {
	return norm(v2 - v1);
}
inline double disLP(vector v1, vector v2, vector v3) {
	vector a = v2 - v1;
	vector b = v3 - v1;
	return fabs(cross(a, b) / norm(a));
}
inline double disSP(vector v1, vector v2, vector v3) {
	vector a = v2 - v1;
	vector b = v3 - v1;
	vector c = v1 - v2;
	vector d = v3 - v2;
	if (dot(a, b) < 0.0) return disPP(v1, v3);
	else if (dot(c, d) < 0.0) return disPP(v2, v3);
	else return disLP(v1, v2, v3);
}
inline double disSS(vector v1, vector v2, vector v3, vector v4) {
	if (inter(v1, v2, v3, v4)) return 0;
	double a = disSP(v1, v2, v3);
	double b = disSP(v1, v2, v4);
	double c = disSP(v3, v4, v1);
	double d = disSP(v3, v4, v2);
	return min(min(a, b), min(c, d));
}
int main() {
	int n, x0, x1, x2, x3, y0, y1, y2, y3;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		vector v1(x0, y0);
		vector v2(x1, y1);
		vector v3(x2 , y2);
		vector v4(x3 , y3);
		vector v5 = pro(v2 - v1, v3 - v1, v1);
		vector v6 = pro(v2 - v1, v4 - v1, v1);
		double a = disPP(v3,v5);
		double b = disPP(v4,v6);
		vector vans = (v6 - v5)*a*(1 / (a + b)) + v5;
		print(vans);
	}
	return 0;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;
	cin>>N;
	unordered_set<string> s;
	for (int i = 0; i < N; ++i){
		string x;
		cin>>x;
		s.insert(x);
	}
	cout<<s.size()<<endl;
}


Measured memory_bytes: 17700
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
int n;
int dp[3][100005];
int a[3][100005] ;//,b[100005],c[100005];

int dpa(int last,int n){
if (n < 0)
{
	return 0;
}
if (dp[last][n]!=-1)
{
	return dp[last][n];
}
int lcmx=-999;
for (int i = 0; i < 3; ++i){
	if(i == last) {continue;}
	else lcmx = max(lcmx,dpa(i,n-1)+a[i][n]);
}
// cout<<lcmx<<" ";
dp[last][n] = lcmx;
return dp[last][n];
}

int main(){
	
	
  
	memset(dp,-1,sizeof(dp));
// ios_base::sync_with_stdio(false);
// cin.tie(NULL);
cin>>n;
int ans =0;

 for(int i=0;i<n;i++){
	 cin>>a[0][i]>>a[1][i]>>a[2][i];}
	 
	 ans= max(dpa(0,n-2)+a[0][n-1],dpa(1,n-2)+a[1][n-1]);
 	 
 	 cout<< max(ans,dpa(2,n-2)+a[2][n-1])<<" ";
	return 0;
}

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

int main(){
  int n; cin >>n;
  ll sum = 0;
  for(int i = 1; i<=n; i++){
    for(int j = i; j<=n; j+=i) sum += j;
  }
  cout << sum << endl;
  return 0; 
}

Measured memory_bytes: 3520