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

using namespace std;

int main(){
	int n, m;
	cin >> n >> m;
	int A[100][100], b[100], c[100];
	c[100] = { 0 };

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> A[i][j];
		}
	}
	for (int j = 0; j < m; j++) {
		cin >> b[j];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			c[i] += (A[i][j] * b[j]);
		}
		cout << c[i] << endl;
	}


	return 0;
}




Measured memory_bytes: 3128
h,w=map(int,input().split())
s=[input()for _ in[0]*h]
a=[['..','..'],['.#','..'],['..','#.'],['##','..'],['..','##'],['#.','#.'],['.#','.#'],['##','.#'],['#.','##']]
for i in range(h-1):
  for j in range(w-1):
    t=s[i][j:j+2]
    u=s[i+1][j:j+2]
    for b in a:
      if t==b[0]and u==b[1]:
        break
    else:
      print('Impossible')
      exit()
print('Possible')

Measured memory_bytes: 3064
/*
 * atcoder/abc119/c.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

const ll INF = 100000000000000000;
int N;
int A, B, C, L[8];

/*
 * index-nまでのLをみた時に長さがa, b, cである状態のコスト
 */
ll rec(int n = 0, int a = 0, int b = 0, int c = 0) {
  if (n==N) {
    // A, B, CそれぞれLから1本も選んでいない場合は駄目.
    // 「Lから使っても良い」という問題ならこの行を削除する
    if (a == 0 or b == 0 or c == 0) return INF;
    return abs(A-a) + abs(B-b) + abs(C-c); // すべて合成し終わった時に残りを+-魔法で埋める
  }
  ll min_ = rec(n+1, a, b, c);
  chmin(min_, rec(n+1, a + L[n], b, c) + (a ? 10 : 0)); // 最初の1本以外はコスト10
  chmin(min_, rec(n+1, a, b + L[n], c) + (b ? 10 : 0));
  chmin(min_, rec(n+1, a, b, c + L[n]) + (c ? 10 : 0));
  return min_;
}

void solve() {
  cin >> N >> A >> B >> C;
  loop(n,0,N) cin >> L[n];
  cout << rec() << endl;
}
int main() {
  // cout.precision(15);
  // cout << fixed << double

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ls x<<1
#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=200+100;
int ans;
char g[maxn][maxn];
int vis[maxn][maxn];
int way[4][2]={0,1,0,-1,1,0,-1,0};
struct node{
	int x,y,len;
};
queue<node>q;
int check(int x,int y,int n,int m){
	return x>0&&x<=n&&y>0&&y<=m;
}
void bfs(node sta,int n,int m){
	vis[sta.x][sta.y]=1;
	q.push(sta);
	while(!q.empty()){
		node u=q.front();q.pop();
		ans=max(ans,u.len);
		rep(i,4){
			int nx=u.x+way[i][0];
			int ny=u.y+way[i][1];
			if(check(nx,ny,n,m)&&!vis[nx][ny]&&g[nx][ny]=='.'){
				q.push(node{nx,ny,u.len+1});
				vis[nx][ny]=1;
			}
		}
	}
}
void solve(){
	int n,m;scdd(n,m);
	rep1(i,n)scanf("%s",g[i]+1);
	rep1(i,n)rep1(j,m)if(g[i][j]=='.'){
		mst(vis,0);
		bfs(node{i,j,0},n,m);
	}
	ac;
}
int main(){
    //IOS;
    //freopen("D://data.txt","r",stdin);
    solve();
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  vector<int>b;
  b.push_back(a[0]);
  rep(i,n-1){
    if(a[i]==a[i+1])continue;
    else b.push_back(a[i+1]);
  }
  b.push_back(0);
  ll now = 1000;
  ll stock=0;
  n=b.size();
  bool ok = false;
  int m=0;
  rep(i,n){
    
    if(b[i]<b[i+1] && !ok){
      stock+=now/b[i];
      now-=(now/b[i])*b[i];
      ok=true;
    }
    else if(b[i]>b[i+1] && ok){
      now+=stock*b[i];
      stock=0;
      ok=false;
    }
    else continue;

  }
  cout << max(now,1000ll) << endl;
  return 0;
}


Measured memory_bytes: 3652
n = int(input())
yakusuukosuu=[1]*(n+1)
ans = 0
for i in range(1, n + 1):
    ans += yakusuukosuu[i] * i
    for j in range(i * 2, n + 1, i):
        yakusuukosuu[j] += 1
print(ans)

Measured memory_bytes: 151744
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
    ios::sync_with_stdio(false);

    int a, b;

    cin>>a>>b;

    if(a>8 or b> 8){
        cout<<":("<<endl;
    }else{
        cout<<"Yay!"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int N;
    int L;
    int i;
    int min;
    int abs;
    int sum;

    scanf("%d %d", &N, &L);

    sum = L;
    if(L >= 0) {
        min = L;
    } else {
        min = -L;
    }
    for(i = 1; i < N; i++) {
        sum += L + i;
        abs = L + i;
        if(abs < 0) {
            abs *= -1;
        }
        if(abs < min) {
            min = abs;
        }
    }

    if(sum < 0) {
        printf("%d\n", sum + min);
    } else {
        printf("%d\n", sum - min);
    }

    return 0;
}

Measured memory_bytes: 128
meta = [int(s) for s in input().split(' ')]

now = meta[0]
times = meta[1]
distance = meta[2]

out = 0
i = 0
while i < times:
    #何回移動するか決める
    #残り距離を移動距離で割った数と移動可能回数の少ない方を回数にする
    time = min([int(abs(now) / distance), times])
    #移動回数分カウンタ回す
    i += time

    #残り距離 < 移動距離になる時
    if time == 0:
        #残り移動可能回数が偶数の時はその位置で終わり
        if (times - i) % 2 == 0:
            print(abs(now))
            exit()
        #奇数の時はあと1回だけ
        else:
            time = 1
            i = times
#            print('kisuu')

    #現在位置の正負に合わせて移動実行    
    if now > 0:
        now -= distance * time
    else:
        now += distance * time
    
#    print('i: ' + str(i) + ', now: ' + str(now))

print(abs(now))


Measured memory_bytes: 9124
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

bool g[5][5];
vector<int> v;

int main(void){
	int a,b,n=4,i;
	bool flag;
	fill(g[0],g[5],false);
	for(i=0; i<4; ++i){
		v.push_back(i+1);
	}
	for(i=1; i<n; ++i){
		cin >> a >> b;
		g[a][b] = true;
		g[b][a] = true;
	}do{
		flag = true;
		for(i=1; i<n; ++i){
			if(!g[v[i-1]][v[i]]){
				flag = false;
				break;
			}
		}
		if(flag){
			cout << "YES" << endl;
			return 0;
		}
	}while(next_permutation(v.begin(),v.end()));
	cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();

		StringBuilder sb = new StringBuilder();

		for(int i = 0 ; i<S.length();i++) {
			sb.append("x");
		}

		System.out.println(sb.toString());
	}

}


Measured memory_bytes: 22484
#include<bits/stdc++.h>
using namespace std;
int a[25],b[25];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
		scanf("%d",&b[i]);
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>b[i])
			sum+=(a[i]-b[i]);
	}
	printf("%d",sum);
}

Measured memory_bytes: 256
import sys
import unittest
import random

T = 26


def solve(d, c, s):
    best = [0] * d
    last = [-1]*T

    for i in range(d):
        max_v = -float('inf')
        for j in range(T):
            v = s[i][j] + c[j] * (i - last[j])
            if max_v < v:
                max_v = v
                best[i] = j
        last[best[i]] = i

    score = get_score(d, c, s, best)
    for i in range(50):
        a = random.randint(0, d-1)
        b = random.randint(0, T-1)
        old = best[a]
        best[a] = b
        t_score = get_score(d, c, s, best)
        if t_score > score:
            score = t_score
        else:
            best[a] = old
    return best


def get_score(d, c, s, t):
    last = [-1]*T
    total = 0
    for i in range(d):
        total += s[i][t[i]]
        last[t[i]] = i
        for j in range(T):
            total -= c[j] * (i - last[j])
    return max(10**6+total, 0)


def main():
    d = int(input())
    c = list(map(int, input().split()))
    s = [list(map(int, input().split())) for i in range(d)]
    t = solve(d, c, s)
    print(get_score(d, c, s, t), file=sys.stderr)
    for i in range(d):
        print(t[i]+1)


if __name__ == "__main__":
    main()


class Test(unittest.TestCase):
    def test_score(self):
        pass


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


int main() {
  string S,T,U;
  cin>>S>>T>>U;
  int a=S.size(),b=T.size(),c=U.size();
  int A=0,B=0,C=0;
  char x='a';
  while(true){
    if(x=='a'){
      if(a==A){
      cout<<"A"<<endl;
      break;
    }
      x=S.at(A);
      A++;
    }
    else if(x=='b'){
      if(b==B){
      cout<<"B"<<endl;
      break;
    }
      x=T.at(B);
      B++;
    }
    else if(x=='c'){
       if(c==C){
      cout<<"C"<<endl;
      break;
    }
      x=U.at(C);
      C++;
    }
    
    
  }
        
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        if (n == 3 || n == 5 || n == 7) {
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 23252
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1];
  
  scanf("%s",s);
  if(strcmp(s,"ABC")==0){
    printf("ARC");
  }else{
    printf("ABC");
  }
  
  return 0;
}



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

typedef long long ll;

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

    int n; cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(),a.end());
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1024
import math


def is_prime_v2(x: int) -> bool:
    if x == 2:
        return True

    if x <= 1 or x % 2 == 0:
        return False

    for i in range(3, int(math.sqrt(x)) + 1, 2):
        if x % i == 0:
            return False
    return True


def main():
    n: int = int(input())
    count: int = 0

    for _ in range(n):
        num: int = int(input())
        if is_prime_v2(num) == True:
            count += 1

    print(count)


if __name__ == "__main__":
    main()



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

ll sum_score(vector<int> &contest_no, vector<vector<int>> &s,vector<int> &c){
    vector<int> day(26,0);
    //スコアの合計を求める
    ll score_daysum=0;
    rep(z,D){
        score_daysum += s[z][contest_no[z]-1];
        day[contest_no[z]-1] = z+1;
        rep(i,26){
            score_daysum -= c[i] * ((z+1) - day[i]);
        }
        //cout << score_daysum << endl;
    }
    return score_daysum;
}

int main(){
    cin >> D;
    vector<int> c(26);
    rep(i,26) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(26));
    rep(i,D){
        rep(j,26){
            cin >> s[i][j];
        }
    }


    vector<int> day(26,0);
    vector<int> contest_no;
    rep(z,D){
        int m_contest=1;
        ll m_score=-1e9;
        rep(i,26){
            if(m_score <  s[z][i] + c[i] * ((z+1) - day[i])){
                m_score = s[z][i] + c[i] * ((z+1) - day[i]);
                m_contest = i+1;
            }
        }
        day[m_contest - 1] = z+1;

        contest_no.push_back(m_contest);
    }


    while(clock() < 180000){
        int day=rand()%D;
        int contest = rand()%26;
        //変える前のデータ保持
        int old_score=sum_score(contest_no, s ,c);
        int old_contest = contest_no[day];

        // //データを入れ替える
        contest_no[day]=contest;

        // // //スコアの合計を改めて計算
        //int new_score = sum_score(contest_no, s ,c);

        //新旧のスコアを比較
        //if(old_score > new_score){
            contest_no[day] = old_contest;
        //}
    }
    //解の出力
    for(int i:contest_no){
        cout << i << endl;
    }
}


Measured memory_bytes: 3716
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int F( long a, long b ) {
	int x = to_string( a ).size();
	int y = to_string( b ).size();
	return max( x, y );
}

int main() {
	ios_base::sync_with_stdio( false );

	long N;
	cin >> N;

	int ans = INT_MAX;
	for( long i = 1; i*i <= N; ++i ) {
		if( N%i == 0 ) {
			ans = min( ans, F( i, N/i ) );
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>

using ll = long long;
using namespace std;
ll M = 1000000000000000;


int main()
{
	string n;
	cin >> n;
	int iti=count(n.begin(), n.end(), '1');
	int zero = count(n.begin(), n.end(), '0');
	int ans = min(iti, zero);
	cout << ans * 2;

}

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

int main()
{
    int a,b,c=0;
    cin>>a>>b;
    int p[a];
    for(int i=0;i<a;i++)
    {
        cin>>p[i];
    }sort(p,p+a);
    for(int i=0;i<b;i++)
    {
        c+=p[i];
    }cout<<c;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 100005
#define M 51
#define INF 1000000007
#define MOD 1000000007
#define MOD2 1000000009
#define eps 1e-14
using namespace std;
inline int Max(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^b;
}
inline int Min(int a,int b)
{
    return (((b-a)>>(32-1))&(a^b))^a;
}

int n;
int a[N];
int gcder(int a,int b)
{
    return a == 0?b:gcder(b%a,a);
}
int calc()
{
    if(n == 1)return a[1];
    int ret = gcder(a[1],a[2]);
    FOR(i,3,n)ret = gcder(ret,a[i]);
    return ret;
}
int main()
{
    while(cin>>n)
    {
        int odd = 0,even = 0;
        FOR(i,1,n)
        {
            cin>>a[i];
            if(a[i]%2)odd++;
            else even++;
        }
        int win,rev = 0;
        while(1)
        {
            if(even%2 == 0&&odd == 1)
            {
                int p;
                FOR(i,1,n)if(a[i]%2)p = i;
                if(a[p] == 1)
                {
                    win = 1;
                    break;
                }
                a[p]--;
                int gcd = calc();
                odd = even = 0;
                FOR(i,1,n)
                {
                    a[i]/=gcd;
                    if(a[i]%2)odd++;
                    else even++;
                }
                rev = 1-rev;
            }
            else
            {
                if(odd == n)win = 1;
                else if(even%2)win = 0;
                else if(odd>=2)win = 1;
                break;
            }
        }
        if(rev)win = 1-win;
        if(win == 0)cout<<"First"<<endl;
        else cout<<"Second"<<endl;
    }
    return 0;
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;

int main(void)
{
    int a, b;

    cin >> a;
    cin >> b;

    if(a==1){
        if(b==2){
            cout << 3 << endl;
        }
        else{
            cout << 2 << endl;
        }
    }
    else if(a==2){
        if(b==1){
            cout << 3 << endl;
        }
        else{
            cout << 1 << endl;
        }
    }
    else{
        if(b==1){
            cout << 2 << endl;
        }
        else{
            cout << 1 << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
#define ll long long
#define MN 131072
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
vector<int> e[MN+5];
vector<pair<ll,ll> >v[MN+5];
int n,a[MN+5];ll d[MN+5],mid;

ll Check(int x,ll s)
{
	ll l=0,r=v[x].size()-1,Mid,res=-1;
	while(l<=r)
	{
		Mid=l+r>>1;
		if(v[x][Mid].first<=s) res=Mid,l=Mid+1;
		else r=Mid-1;	
	}
	return res<0?res:v[x][res].second;
}

void dfs(int x)
{
	v[x].clear();
	if(!e[x].size())return v[x].push_back(make_pair(d[x],d[x]));
	int l=e[x][0],r=e[x][1];
	d[l]=d[x]+a[l];dfs(l);
	d[r]=d[x]+a[r];dfs(r);
	if(v[l].size()>v[r].size()) swap(l,r);
	for(int i=0;i<v[l].size();++i)
	{
		ll rd=Check(r,d[x]+mid-(v[l][i].second-d[x]));
		if(rd!=-1) v[x].push_back(make_pair(v[l][i].first,rd));
	}
	int top=v[x].size();
	for(int i=0;i<top;++i) v[x].push_back(make_pair(v[x][i].second,v[x][i].first));
	sort(v[x].begin(),v[x].end());
	for(int i=1;i<v[x].size();++i) v[x][i].second=min(v[x][i].second,v[x][i-1].second);
}

int main()
{
	n=read();
	for(int i=2;i<=n;++i) e[read()].push_back(i),a[i]=read();
	ll l=0,r=(ll)2e10,res;
	while(l<=r)
	{
		mid=l+r>>1;dfs(1);
		if(v[1].size()) res=mid,r=mid-1;
		else l=mid+1;
	}
	cout<<res;
	return 0;
}



Measured memory_bytes: 32000
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
X = [];Y = [];H = []
for i in range(n):
    x,y,h = readInts()
    X.append(x)
    Y.append(y)
    H.append(h)
    if h > 0:
        si = i
resx=-1;resy=-1;resh=-1;
for cx in range(101):
    for cy in range(101):
        judge = True
        h = H[si] + abs(X[si] - cx) + abs(Y[si] - cy)
        for i in range(n):
            if H[i] == 0:
                if h > abs(X[i] - cx) + abs(Y[i] - cy):
                    judge ^=True
                    break
            else:
                if h - H[i] != abs(X[i]-cx) + abs(Y[i]-cy):
                    judge ^= True
                    break
        if judge:
            resx =cx;resy=cy;resh=h;
print(resx,resy,resh)


Measured memory_bytes: 10364
N, M, Q = map(int,input().split())
senro = [list(map(int,input().split())) for k in range(M)]
query = [list(map(int,input().split())) for k in range(Q)]
S = [[0 for k in range(N+2)] for l in range(N+2)]

for s in senro:
    S[s[0]][s[1]] += 1

for k in range(1,N+2):
    for l in range(1,N+2):
        S[k][l] += S[k][l-1]

for k in range(1,N+2):
    for l in range(1,N+2):
        S[k][l] += S[k-1][l]

for q in query:
    print(S[q[1]][q[1]]-S[q[0]-1][q[0]-1]-S[q[0]-1][q[1]]+S[q[1]][q[0]-1])

Measured memory_bytes: 77296
#include<bits/stdc++.h>
#define int long long
using namespace std;

const int SIZE=100010;

vector<int> G[SIZE];
int color[SIZE],num[2];

bool dfs(int v,int c)
{
    color[v]=c; num[c]++;
    for(int u:G[v]){
        if(color[u]==c){
            return false;
        }
        if(color[u]==-1 and !(dfs(u,c^1))){
            return false;
        }
    }
    return true;
}

signed main()
{
    int N,M; cin>>N>>M;
    for(int i=0;i<M;i++){
        int a,b; cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    memset(color,-1,sizeof(color));
    if(dfs(0,0)){
        cout<<num[0]*num[1]-M<<endl;
    }else{
        cout<<N*(N-1)/2-M<<endl;
    }
}


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

int main()
{
    string S;
    cin >> S;
    bool ans = false;

    for (int i = 1; i < S.size(); i++)
    {
      if(S.at(i) == S.at(i-1))
        ans = true;
    }

  if(ans)
    cout << "Bad" << endl;
  else
    cout << "Good" << endl; 
  

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define bit(n,m)(((n)>>(m))&1)
#define min(p,q)((p)<(q)?(p):(q))

int cnt[11];
int bo[11];
int main(){
	int n,s;
	scanf("%d%d",&n,&s);
	int ans=1e9;
	for(int i=0;i<n;i++)scanf("%d%d",cnt+i,bo+i);
	for(int i=0;i<1<<n;i++){
		int temps=0,tempcnt=0;
		for(int k=0;k<n;k++)if(bit(i,k)){
			temps+=cnt[k]*(k+1)*100+bo[k];
			tempcnt+=cnt[k];
		}
		if(temps>=s){
			ans=min(ans,tempcnt);
		}else{
			int rest=s-temps;
			for(int k=0;k<n;k++)if(!bit(i,k)){
				if(rest<=(cnt[k]-1)*(k+1)*100){
					ans=min(ans,tempcnt+(rest+(k+1)*100-1)/((k+1)*100));					
				}
			}
		}
	}	
	printf("%d",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
using P = pair<int,int>;
typedef long long ll;


#define rep(i,n) for (int i=0; i<(n); i++)
//const int INF =1001001001;
const ll BIG = 1e9+7;
const double PI = 3.141592653589793;

const int M = 1000005;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> cnt(M);
    for(int x: a){
        if(cnt[x] != 0){
            cnt[x] = 2;
            continue;
        }
        for(int i=x; i<M; i+=x) cnt[i]++;
    }
    int ans = 0;
    for(int x: a){
        if(cnt[x]==1) ans++;
    }
    cout << ans << endl;
    return 0;
}

/*

int main(){
    int n;
    cin >> n;
    vector<int> a(n), to(n, 1);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    rep(i, n){
        int j = i+1;
        if(to[i]==0) continue;
        for(j; j<n; j++){
            if(to[j]==0) {
                continue;
            }
            if(a[j]==a[i]){
                to[i] = 0;
                to[j] = 0;
            }else if(a[j]>a[i] && a[j]%a[i]==0){
                to[j] = 0;
            }
        }
    }
    cout << accumulate(to.begin(), to.end(), 0) << endl;
    return 0;
}
*/

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

typedef long long ll;


int main(){
    int a,b;
    cin >> a >> b;
    int c = b - a;
    int b_height = 0;
    for(int i = 1; i <= c; i++){
        b_height += i;
    }
    cout << b_height - b << endl;

}


Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define pll pair<double,ll>


int n;
int p[100001];
int c[100001];
ll mod = (ll)(1e9+7);

ll calc(int a)
{
    ll r = 1;
    for(int i = 0;i < a;i++)
    {
        r *= 2;
        r %= mod;
    }
    return r;
}

int main()
{
    fill(c, c + 100001, 0);
    cin >> n;
    for(int i = 0;i < n;i++)
    {
        cin >> p[i];
        c[p[i]]++;
    }
    if(n % 2 == 1)
    {
        if(c[0] != 1)
        {
            cout << 0 << endl;
            return 0;
        }
        for(int i = 2;i <= n/2;i += 2)
        {
            if(c[i] != 2)
            {
                cout << 0 << endl;
                return 0;
            }
        }
        cout << calc(n/2) << endl;
        return 0;
    }
    else
    {
        for(int i = 1;i <= n/2+1;i += 2)
        {
            if(c[i] != 2)
            {
                cout << 0 << endl;
                return 0;
            }
        }
        cout << calc(n/2) << endl;
        return 0;
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define int long long
#define INF 1000000000000000000
using namespace std;

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
template<typename T>
void debug(vector<vector<T>> m){ REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;} }



signed main(){

    int N, A, B; cin >> N >> A >> B;
    int ans1 = max(0LL, A + B - N);
    int ans2 = min(A, B);
    cout << ans2 << " " << ans1 << endl;
    
    return 0;
}

Measured memory_bytes: 764
#include<stdio.h>

int A[100001];

int qartition(int,int);

int main(){
  int i,j;
  int r;
  int q;

  scanf("%d",&r);

  for(i=0;i<r;i++) scanf("%d",&A[i]);

  q=qartition(0,r-1);

  for(i=0;i<r;i++){
    if(i!=0) printf(" ");
    if(i==q) printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
  }
  printf("\n");

  return 0;
}

int qartition(int p,int r){
  int i,j;
  int x,t;

  x=A[r];
  i=p-1;

  for(j=p;j<r;j++){
    if(x>=A[j]){
      t=A[j];
      A[j]=A[i+1];
      A[i+1]=t;
      i++;
    }
  }
  t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
  
    
  return i+1;
}

Measured memory_bytes: 992
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000007
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;


int main(){
string s ;
cin>>s;
int ans = s[0]-'0';
for(int op1 = 0 ;op1 < 2;op1++)
{
     if(op1)
        {
            ans+=(s[1]-'0');
        }
        else ans-=(s[1]-'0');
    for(int op2 = 0;op2<2;op2++)
    {
       if(op2)
        {
            ans+=(s[2]-'0');
        }
        else ans-=(s[2]-'0');
        for(int op3 = 0 ; op3<2;op3++)
        {
              if(op3)
            {
            ans+=(s[3]-'0');
            }
             else ans-=(s[3]-'0');

             if(ans==7)
             {
                 cout<<s[0];
                 if(op1)cout<<"+";
                 else cout<<"-";
                 cout<<s[1];
                 if(op2)cout<<"+";
                 else
                    cout<<"-";
                 cout<<s[2];
                  if(op3)cout<<"+";
                 else
                    cout<<"-";
                cout<<s[3] <<"=7"<<endl;
                 return 0;
             }


             if(op3)
            {
            ans-=(s[3]-'0');
            }
             else ans+=(s[3]-'0');

        }
          if(op2)
        {
            ans-=(s[2]-'0');
        }
        else ans+=(s[2]-'0');
    }

    if(op1)
        {
            ans-=(s[1]-'0');
        }
        else ans+=(s[1]-'0');
}

 return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String ok = "keyence";
        String s = sc.next();
        for (int i = 0; i < ok.length(); i++) {
            if(s.startsWith(ok.substring(0,i)) && s.endsWith(ok.substring(i))) {
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)



int main() {
	int n, a, b; cin >> n >> a >> b;
	string s; cin >> s;
	int cnt = 0;
	int cntc = 0;
	rep(i, s.length()) {
		if(s[i] == 'a' && (cnt + cntc) < a + b){
			cout << "Yes" << endl;
			cnt++;
		}
		else if (s[i] == 'b' && (cnt + cntc) < a + b && cntc < b) {
			cout << "Yes" << endl;
			cntc++;
		}
		else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

const int MAX_V = 330;
int V;

long long dist[MAX_V][MAX_V];

void init_dist() {
  for (int i = 0; i < MAX_V; ++i) {
    for (int j = 0; j < MAX_V; ++j) {
      if (i == j) {
        dist[i][j] = 0;
      } else {
        dist[i][j] = INF;
      }
    }
  }
}

void warshall_floyd() {
  // 1-indexed
  for (int k = 1; k <= V; ++k) {
    for (int i = 1; i <= V; ++i) {
      for (int j = 1; j <= V; ++j) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
}

int N, M, R;
int r[8];
ll A[330][330];

int main() {
  int N, M, R;
  cin >> N >> M >> R;
  V = N;
  init_dist();

  rep(i, 0, R) { cin >> r[i]; }

  rep(i, 0, M) {
    int a, b, c;
    cin >> a >> b >> c;
    dist[a][b] = c;
    dist[b][a] = c;
  }

  warshall_floyd();

  sort(r, r + R);

  int ans = inf;
  do {
    int cnt = 0;
    rep(i, 0, R - 1) { cnt += dist[r[i]][r[i + 1]]; }
    chmin(ans, cnt);
  } while (next_permutation(r, r + R));

  cout << ans << endl;
}


Measured memory_bytes: 4496
#include <stdio.h>

int N;
int A[1000];

int insertion(int a[], int b);
int print(int d[], int c);

int main(){

	int i = 0;
   
	scanf("%d", &N);

	for (i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	print(A, N);
	insertion(A, N);



}

int insertion(int a[], int b){
	int v;
	int i;
	int j;
	for (i = 1; i <= N - 1; i++){
		v = A[i];
		j = i - 1;
	 
		while (j >= 0 && A[j] > v){
			A[j + 1] = A[j];
			j--;
		}
		A[j + 1] = v;

		print(A,b);

	}

	return 0;

}

int print(int d[], int c){
	int i = 0;
	for (i = 0; i < c; i++){
		if (i > 0) printf(" ");
		printf("%d", d[i]);
	}
	printf("\n");
	return 0;
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    LL a, b;
    cin >> a >> b;

    LL ans = 0;
    REP(i, 40){
        LL bi = 0;
        bi += (b+1) / (1LL << (i+1)) * (1LL << i);
        bi += max(0LL, (b+1) % (1LL << (i+1)) - (1LL << i));

        bi -= a / (1LL << (i+1)) * (1LL << i);
        bi -= max(0LL, a % (1LL << (i+1)) - (1LL << i));

        ans += (bi & 1) << i;
    }
    cout << ans << endl;
}

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

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

int A, B, C, K;

int main() {
  scanf("%d%d%d%d", &A, &B, &C, &K);
  if (A >= C && A >= B) REP(i,K) A *= 2;
  else if (B >= C && B >= A) REP(i,K) B *= 2;
  else if (C >= A && C >= B) REP(i,K) C *= 2; 
  printf("%d\n", A + B + C);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long 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 main() {
    int n;
    cin >> n; 
    vector<int>a(n);
    rep(i,n) cin >> a[i];
    ll money = 1000;
    rep(i,n-1) {
        ll cnt = 0;
        if(a[i] < a[i+1]) {
            cnt = money/a[i];
        }
        money += (a[i+1] - a[i]) * cnt;
    }
    cout << money << endl;
}

Measured memory_bytes: 3600
void main() {
    int n = readln.chomp.to!int;
    int[] a = readln.split.to!(int[]);
    int cnt;
    while (a.all!(t => t % 2 == 0)) {
        a[] /= 2;
        ++cnt;
    }
    cnt.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
int PrimeNumbers(int b);
int main(void) {
	int n;
	char str[100];

	for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
		sscanf(str,"%d",&n);
		PrimeNumbers(n);
	}
	return 0;
}

int PrimeNumbers(int b){
	int j,c,n=b;
	start:;
	n-=1;
	if(n==2){
		printf("%d ",n);
		goto out;}
	if(n%2==0)
		goto start;
	c = sqrt(n);
	for(j=3;j<=c;j+=2){
		if(n%j==0)
			goto start;
	}
	printf("%d ",n);
	out:;
	b+=1;
	if(b%2==0)
		goto out;
	c = sqrt(b);
	for(j=3;j<=c;j+=2){
		if(b%j==0)
			goto out;
	}
	printf("%d\n",b);
	return 0;		
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
signed main(void){
    vector <vector<int>> board(2010,vector <int>(2010));
    int N,K; cin>>N>>K;
    int sum = 0, white = 0;
    rep(i,N){
        int x,y; char c; cin>>x>>y>>c;
        x %= 2*K; y %= 2*K;
        if(c == 'B') {board[x+1][y+1]++; sum++;}
        else board[x+1][y+1]--, sum--, white++;
    }
    for(int i=1; i<=2*K; i++) {
        for(int j=1; j<=2*K; j++) {
            board[i][j] += board[i][j-1];
        }
    }

    for(int j=1; j<=2*K; j++) {
        for(int i=1; i<=2*K; i++) {
            board[i][j] += board[i-1][j];
        }
    }
    int ma = -1145141919;
    for(int i=0; i<=K; i++) {
        for(int j=0; j<=K; j++) {
            int a = board[i][j];
            int b = board[i+K][j+K] - board[i+K][j] - board[i][j+K] + board[i][j];
            int c = board[2*K][j] - board[i+K][j];
            int d = board[i][2*K] - board[i][j+K];
            int e = board[2*K][2*K] - board[2*K][j+K] - board[i+K][2*K] + board[i+K][j+K];
            int tmp = a + b + c + d + e;
            ma = max(ma, max(tmp + white, sum - tmp + white));
        }
    }
    cout<<ma<<endl;
}


Measured memory_bytes: 31872
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>

#define inf  1000000007
#define ll long long
#define PA pair<int,int>
#define PPAP pair<int,pa>
#define  MP make_pair
#define  PB push_back

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[100010]={};
	for(int i=0;i<n;i++){
		int p;
		cin >> p;
		a[p]++;
		a[p+1]++;
		a[p+2]++;
	}
	cout << *max_element(a,a+100010) << endl;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=2e5+10;
char str[maxn];
int main()
{
    int ans=1;
    scanf("%s",str+1);
    int last=1,len=1;
    for(int i=2;str[i];)
    {
        if(len==2)
        {
            ans+=1;
            last=i;
            len=1;
            i++;
        }else if(len==1)
        {
            if(str[last]==str[i])
            {
                if(str[i+1])
                {
                    ans+=1;
                    len=2;
                    last=i;
                    i+=2;
                }else
                {
                    i++;
                    break;
                }
            }else
            {
                ans+=1;
                len=1;
                last=i;
                i+=1;
            }
            
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<57;
const double pi=acos(-1);
const double eps=1e-6;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,-0};
const int DX[8]={-1,-1,-1,0,1,1,1,0},DY[8]={1,0,-1,-1,-1,0,1,1};

ll n,D,q;
vl d;

int main(){
	ios::sync_with_stdio(0);
	cin>>n>>D;
	d=vl(n);
	for(int i=0;i<n;i++) cin>>d[i];
	vl a(n+1);
	for(int i=0;i<n;i++){
		a[i]=D;
		if(d[i]<D) D-=d[i];
		else D=min(D,d[i]-D);
	}
	a[n]=D;
	D=1;
	vl b(n+1);
	for(int i=n-1;i>=0;i--){
		b[i+1]=D;
		if(D>d[i]/2) D+=d[i];
	}
	b[0]=D;
	cin>>q;
	for(int i=0;i<q;i++){
		ll t;
		cin>>t;
		if(a[t-1]>=b[t]) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 13696
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c;
string s, t;

int main()
{
	cin >> a>>b>>c ;	
	
  if(c+b-a>0)
	cout << c+b-a << endl;
  else
    cout<<0<<endl;
}


Measured memory_bytes: 256
//include---------------------------------------------------------------------------
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cctype>
#include<vector>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<bitset>
#include<map>
#include<algorithm>
#include<memory>

//using namespace-------------------------------------------------------------------
using namespace std;

//define,const----------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < n; i++)
const int INF = 1 << 25;
#define MAX_N 100

//global----------------------------------------------------------------------------
int aboutmap[14][14];

//function--------------------------------------------------------------------------
void solve(int x, int y){
	aboutmap[x][y] = 0;
	if(aboutmap[x + 1][y])
		solve(x + 1, y);
	if(aboutmap[x][y + 1])
		solve(x, y + 1);
	if(aboutmap[x - 1][y])
		solve(x - 1, y);
	if(aboutmap[x][y - 1])
		solve(x, y - 1);
}
int main(){
	for(int i = 0; i < 14; i++){
		aboutmap[i][0] = 0;
		aboutmap[0][i] = 0;
		aboutmap[i][13] = 0;
		aboutmap[13][i] = 0;
	}
	while(scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d",
		&aboutmap[1][1], &aboutmap[1][2], &aboutmap[1][3], &aboutmap[1][4], &aboutmap[1][5], &aboutmap[1][6], 
		&aboutmap[1][7], &aboutmap[1][8], &aboutmap[1][9], &aboutmap[1][10], &aboutmap[1][11], &aboutmap[1][12]) != EOF){
			for(int i = 2; i < 13; i++)
				for(int j = 1; j < 13; j++)
					scanf("%1d", &aboutmap[i][j]);
			int ans = 0;
			for(int i = 1; i < 13; i++){
				for(int j = 1; j < 13; j++){
					if(aboutmap[i][j]){
						solve(i, j);
						ans++;
					}
				}
			}
			printf("%d\n", ans);
	}
	return 0;
}

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

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

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  vec<int> ABC(3);
  cin >> ABC[0] >> ABC[1] >> ABC[2];

  sort(ALL(ABC));
  const auto sum = accumulate(ALL(ABC), 0);
  const auto A = ABC[2], B = ABC[1], C = ABC[0];

  const int diff = 3 * A - sum;
  const int res = ((diff & 1) ? (3 * (A + 1) - sum) : diff) / 2;
  cout << res << endl;
  return 0;
}


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

int main()
{
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif

	int n;
	cin>>n;

	vector<int> A;

	for(int i=0; i<n; i++)
	{
		int a;
		cin>>a;
		A.push_back(a);
	}

	vector<int> ends = {-A[0]};

	for(int i=1; i<n; i++)
	{
		int k = (upper_bound(ends.begin(),ends.end(),-A[i])-ends.begin());
		if(k==ends.size()) ends.push_back(-A[i]);
		else ends[k]=-A[i];
	}

	cout << ends.size() << "\n";
}

Measured memory_bytes: 1400
import java.util.*;

public class Main {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (Math.abs(x - a) < Math.abs(x - b)) {
			System.out.println("A");
		} else {
			System.out.println("B");
		}
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

int main(){
  int N;
  cin >> N;
  vector<LL> A(N+1), B(N);
  rep(i,N+1) cin >> A[i];
  rep(i,N) cin >> B[i];
  LL ans=0;
  rep(i,N){
    if(B[i]<=A[i]) ans+=B[i];
    else if(B[i]<A[i]+A[i+1]){
      ans+=B[i];
      A[i+1]-=B[i]-A[i];
    }
    else{
      ans+=A[i]+A[i+1];
      A[i+1]=0;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
n, y = map(int, input(). split())
l = []
for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            l = [i, j, n-i-j]
            break
    if l:
        break

if l == []:
    print(' '.join(map(str, [-1, -1, -1])))
else:
    print(' '.join(map(str, l)))

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

#define N 8
#define FREE -1
#define NOT_FREE 1

int row[N], col[N], dpos[2 * N - 1], dneg[2* N - 1];

bool X[N][N];

void initialize() {
  rep(i, 0, N) {
    row[i] = FREE; col[i] = FREE;
  }
  rep(i, 0, 2*N-1) {
    dpos[i] = FREE; dneg[i] = FREE;
  }
};

void printBoard() {
  rep(i, 0, N) {
    rep(j, 0, N) {
      if (X[i][j]) {
        if (row[i] != j) return;
      }
    }
  }

  rep(i, 0, N) {
    rep(j, 0, N) {
      cout << ((row[i] == j) ? "Q" : ".");
    }
    cout << endl;
  }
};

void recursive(int i) {
  if (i == N) { // クイーンの配置に成功
    printBoard();
    return;
  }

  rep(j, 0, N) {
    // (i, j)が他のクイーンに襲撃されている場合は無視
    if (
      NOT_FREE == col[j] ||
      NOT_FREE == dpos[i+j] ||
      NOT_FREE == dneg[i - j + N - 1]
    ) continue;

    // (i, j)にクイーンを配置する
    row[i] = j;
    col[j] = dpos[i + j] = dneg[i - j + N - 1] = NOT_FREE;
    // 次の行を試す
    recursive(i+1);
    // (i, j)に配置されているクイーンを取り除く
    row[i] = col[j] = dpos[i + j] = dneg[i - j + N - 1] = FREE;
  }

  // クイーンの配置に失敗
};

int main() {
  initialize();

  rep(i, 0, N) {
    rep(j, 0, N) X[i][j] = false;
  }

  int k;
  cin >> k;
  rep(i, 0, k) {
    int r, c;
    cin >> r >> c;
    X[r][c] = true;
  }

  recursive(0);

  return 0;
};



Measured memory_bytes: 3116
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int i, j;
	int n, d, x;
	int num = 0;

	cin >> n;
	cin >> d >> x;

	vector<int> a(n);
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}

	for (i = 0; i < n; i++) {
		for (j = 0; (a[i] * j + 1) <= d; j++) {
			num++;
		}
	}

	cout << num + x << endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    A.sort()
    t = A[0]
    ans = 1
    for i in range(1, N):
        t -= A[i]
        if t == 0:
            ans -= 1
        else:
            t = A[i]
            ans += 1
    print(ans)


main()


Measured memory_bytes: 7508