akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <numeric>
#include <algorithm>

using namespace std;


int main(void) {
    long n;
    vector< pair<string, int> > ass;
    cin >> n;

    for (long i=0; i<n; i++) {
        pair<string, int> tmp;
        cin >> tmp.first >> tmp.second;
        ass.push_back(tmp);
    }

    vector<int> index(ass.size());
    iota(index.begin(), index.end(), 0);


    sort(index.begin(),
         index.end(),
             [&](long x, long y){if( ass[x].first != ass[y].first) return ass[x].first<ass[y].first; return ass[x].second>ass[y].second;}
    );

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

    // for (long i=0; i<n; i++) {
    //     cout << ass[i].first << " "<< ass[i].second << endl;
    // }

    for(auto i: index){
        cout << i+1 << endl;
    }
}


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

using namespace std;

#define int long long
#define MOD 1000000007

#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 (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end() å
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

#define TENNINE 1000000005
#define TENFIVE 100005

int n;

signed main()
{
    cin >> n;

    int cnt = 0;
    int ans = 0;

    rep1(i, n + 1)
    {

        if (i % 3 == 0 || i % 5 == 0)
        {
        }
        else
        {
            ans += i;
        }
    }

    cout << ans << endl;

    return 0;
}


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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

template <typename A, typename B>
string to_string(pair<A, B> p){
    return "(" + to_string(p.fi) + ", " + to_string(p.se) + ")";
}

template <typename T>
string to_string(T v){
    string s = "{";
    bool first = true;
    for(const auto & x : v){
        if(!first) s += ", ";
        first = false;
        s += to_string(x);
    }
    return s + "}";
}

void debug_out(){ cerr << endl;}
template <typename First, typename... Next>
void debug_out(First F, Next... N){
    cerr << " " << to_string(F);
    debug_out(N...);
}

#ifdef LOCAL
    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 1
#endif

char op(char c){
    if(c == 'r') return 'p';
    if(c == 'p') return 's';
    if(c == 's') return 'r';
    return 'r';
}

int main(){
    fcin;
    int n, k;
    cin >> n >> k;

    vector<char> a = {'r', 's', 'p'};
    map<char, int> cost;
    cin >> cost['r'] >> cost['s'] >> cost['p'];
    sort(all(a));

    string s;   cin >> s;
    int ans = 0;

    do{
        int t = 0;
        string choose(n, '#');
        for(int j = 0; j < 3; j++){
            for(int i = 0; i < n; i++){
                if(op(s[i]) == a[j]){
                    if(i-k < 0 or (i-k >= 0 and choose[i-k] != a[j])){
                        choose[i] = a[j];
                        t += cost[a[j]];
                    }
                }
            }
        }
        debug(t);
        ans = max(ans, t);
    } while(next_permutation(all(a)));

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



Measured memory_bytes: 512
import collections
N=input()

a=[]
def soinsu_bunkai(x):
	if x==1:
		a.append(1)
		return a
	n=x
	flag=0
	while flag!=1:
		for i in range(2,x+1):
			if n%i==0:
				n=n/i
				if n==1:
					flag=1
				#print i
				a.append(i)
				break
	return a


for i in range(2,N+1):
	soinsu_bunkai(i)

#print a

b=collections.Counter(a)
#print b

ans=1
for i in b.values():
	ans*=(i+1)

print ans%(10**9+7)

Measured memory_bytes: 2936
#include<stdio.h>
#include<string.h>
int main(void)
{
	char s[101];
	int len=0,i,f1=0,f2=0;
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<len;i++){
		if(i%2!=0){
			if(s[i]=='R'){
				f1=1;
			}
		}
		else{
			if(s[i]=='L'){
				f2=1;
			}
		}
	}
	//printf("%d %d\n",f1,f2);
	if(f1==1||f2==1){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1660
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

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

		String left = "qwertasdfgzxcvb";
		String right = "yuiophjklnm";
		
		while(true){
			String input = sc.next();
		
			if("#".equals(input)){
				break;
			}
			
			int count = -1;
			boolean be_l = false;
			for(char c : input.toCharArray()){
				boolean left_b = false;
				
				for(char l : left.toCharArray()){
					if(c == l){
						left_b = true;
						break;
					}
				}
				
				if(count == -1){
					count = 0;
				}else if(be_l != left_b){
					count++;
				}
				be_l = left_b;
			}
			
			System.out.println(count);
			
		}
		
		
	}

}

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

using namespace std;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define REP(i,n) for (int i = 0; i < n; ++i)
#define REPR(i,n) for (int i = n-1; i >= 0; --i)
#define PB push_back
#define MP make_pair

const int MAX = 3e5;

int N;
bool reserved[MAX];
vii X;
int ans[MAX];

bool solve() {
    int idx = 0;
    REP (i, N) {
        int num = X[i].second, pos = X[i].first;
        REP (n, num-1) {
            while (idx < N*N && ans[idx] != 0) idx++;
            if (idx > pos) return false;
            ans[idx] = num;
        }
    }

    idx = N*N-1;
    REPR (i, N) {
        int num = X[i].second, pos = X[i].first;
        REP (n, N-num) {
            while (idx >= 0 && ans[idx] != 0) idx--;
            if (idx < pos) return false;
            ans[idx] = num;
        }
    }

    return true;
}

int main() {
    cin >> N;
    REP (i, N) {
        int x;
        cin >> x; x--;
        X.PB(MP(x, i+1));
        ans[x] = i+1;
    }
    sort(X.begin(), X.end());
    if (solve()) {
        cout << "Yes" << endl;
        REP (i, N*N-1) cout << ans[i] << " ";
        cout << ans[N*N-1] << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int x,y,z;
  x=0;y=0;z=0;
  cin>>n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    if(a[i]==b[i]&&x==0){
      x=1;
    }
    else if(x==1&&y==0&&a[i]==b[i]){
      y=1;
    }
    else if(x==1&&y==1&&a[i]==b[i]){
      z=1;
    }
    else{
      x=0;
      y=0;
    }
  }
  if(z==1){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}
  

Measured memory_bytes: 3624
/// @pSaurabh
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define read(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define print(a, n) for(int i = 0; i < n; i++) cout << a[i] << " ";
 
typedef long long ll;
const ll mod = 1e9 + 7;
 
void fast(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout .tie(0);
}
 
struct item{
	ll wt;
	ll val;
};
 
int main(){
	// fast();
 
	ll n, w;
	cin >> n >> w;
 
	item a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i].wt >> a[i].val;
	}
 
	ll dp[n][w + 1];
 
	for(ll i = 0; i < n; i++){
		dp[i][0] = 0;
	}
	for(ll i = 0; i <= w; i++){
		dp[0][i] = (i >= a[0].wt? a[0].val: 0);
	}
 
	for(ll i = 1; i < n; i++){
		for(ll j = 1; j <= w; j++){
			if(a[i].wt <= j){
				// cout << "Exec1 ";
				dp[i][j] = max(dp[i - 1][j], a[i].val + dp[i - 1][j - a[i].wt]);
				// cout << dp[i][j] << "\n";
			}
			else{
				// cout << "Exec2 ";
				dp[i][j] = dp[i - 1][j];
				// cout << dp[i][j] << "\n";
			}
		}
	}
 
	// for(int i = 0; i < n; i++){
	// 	for(int j = 0; j <= w; j++){
	// 		cout << dp[i][j] << "\t";
	// 	}
	// 	cout << "\n";
	// }
 
	cout << dp[n - 1][w];
 
	return 0;
}

Measured memory_bytes: 78336
#include<stdio.h>

int main(){

  int a,b,mul,i;

  scanf("%d %d",&a,&b);
  mul = 1;

  if(a>0){
    printf("Positive");
  }

  else if(a==0){
    printf("Zero");
  }

  else if(b>=0){
    printf("Zero");
  }

  else{
    if((b-a+1)%2==0){
      printf("Positive");
    }
    else{
      printf("Negative");
    }
  }

  return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
//↓✟MLE魔、TLE魔✟
#define int long long
//↑✟MLE魔、TLE魔✟
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
signed main(){
    int n,ans=1;
    string s;
    cin>>n>>s;
    map<char,int>mp;
    rep(i,n){
        if(mp[s[i]]==0)mp[s[i]]++;
        mp[s[i]]++;
    }
    for(auto it:mp){
        ans=ans*it.second%1000000007;
    }
    ans--;
    cout<<ans<<endl;
}

Measured memory_bytes: 512
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);
		int C = Integer.parseInt(tokens[2]);
		int K = Integer.parseInt(in.readLine());

		int i = 0;
		for (; i < K; ++i) {
			if (B <= A) {
				B *= 2;
			} else {
				break;
			}
		}
		for (; i < K; ++i) {
			if (C <= B) {
				C *= 2;
			} else {
				break;
			}
		}
		if (A < B && B < C) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

	void calc() {
	}

	void showResult() {
	}
}

Measured memory_bytes: 25392
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>

using namespace std;

int saisyoukouyakusuu(int x, int y) {
	if (x < y) {
		int tmp = x;
		x = y;
		y = tmp;
	}

	while (y) {
		int m = x % y;
		x = y;
		y = m;
	}

	return x;
}

int main(void) {
	int n, x; cin >> n >> x;
	int z[n];
	for (int i = 0; i < n; i++) {
		cin >> z[i];
		z[i] = abs(z[i] - x);
	}

	for (int i = 0; i < n - 1; i++) {
		z[i + 1] = saisyoukouyakusuu(z[i], z[i + 1]);
	}

	cout << z[n - 1] << endl;

	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

char M(char a, char b)
{
    if(a == 'T' and b == 'T') return 'T';
    if(a == 'T' and b == 'F') return 'F';
    if(a == 'F' and b == 'T') return 'T';
    return 'T';
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<char> P(N);
    for(int i = 0; i < N; i++) cin >> P[i];
    for(int i = 1; i < N; i++)
    {
        P[i] = M(P[i - 1], P[i]);
    }
    cout << P[N - 1] << endl;
    return 0;
}




Measured memory_bytes: 3252
import bisect
# from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    L=sorted(list(map(int,input().split())))
    cnt=0
    for i in range(N-2):
        for j in range(i+1,N-1):

            val=bisect.bisect_left(L,L[i]+L[j])
            cnt+=val-j-1

    print(cnt)

resolve()

Measured memory_bytes: 3188
k,n=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")]
maxDist=arr[0]+min(k-arr[-1],arr[-1]) 
# maxDist=max(arr)-min(arr)
for i in range(n-1):
    maxDist=maxDist if arr[i+1]-arr[i] <=maxDist else arr[i+1]-arr[i]
print(k-maxDist)

Measured memory_bytes: 31588
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int iInput = int.Parse( Console.ReadLine());

            if(iInput == 1)
            {
                Console.WriteLine("Hello World");
            }
            else
            {
                int A = int.Parse(Console.ReadLine());
                int B = int.Parse(Console.ReadLine());

                Console.WriteLine(A+B);
            }
        }
    }
}

Measured memory_bytes: 11092
// {{{
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef long int i32;
typedef unsigned long int u32;
typedef long long int i64;
typedef unsigned long long int  u64;
typedef pair<i32, i32> PII;
typedef vector<i32> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<i32, i32> MPII;
typedef set<i32> SETI;
typedef multiset<i32> MSETI;
#define IN(x) cin >> x;
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define BTW(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
// }}}

const int MAX_K = (i32)1e5;
bool used[MAX_K];

struct xyz {
    u64 x;
    u64 y;
    u64 z;
};
int main() {
    u64 K;
    IN(K);
    auto q = deque<struct xyz>();
    q.PB({1, 1, 1});
    while(1) {
        auto xyz = q.front();
        u64 x = xyz.x;
        u64 y = xyz.y;
        u64 z = xyz.z;
        q.pop_front();
        if(used[x]) {
            continue;
        }
        if(x == 0) {
            cout << y << endl;
            break;
        }
        used[x] = true;
        if(z == 9) {
            q.push_front({(x+1)%K, y, 0});
        } else {
            q.push_back({(x+1)%K, y+1, z+1});
        }
        q.push_front({x*10%K, y, 0});
    }
        
    return 0;
}



Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#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)
const int MOD = 1000000007;

template <typename T>
void __dump__(std::ostream &os, const T &first) {
    os << first;
}
template <typename First, typename... Rest>
void __dump__(std::ostream &os, const First &first, const Rest &... rest) {
    os << first << ", ";
    __dump__(os, rest...);
}
#define dump(...)                                         \
    do {                                                  \
        std::ostringstream os;                            \
        os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \
        __dump__(os, __VA_ARGS__);                        \
        std::cerr << os.str() << std::endl;               \
    } while (0)

int n, m;

int reduce[200010];
int imos0[200010], imos1[200010];
// f[l] += x, f[l+1] += x+y, f[l+2] += x+2y...
void add(int l, int r, long long a, long long b) {
    imos0[l] += a;
    imos0[r] -= a;

    imos0[l] -= b * l;
    imos0[r] += b * l;

    imos1[l] += b;
    imos1[r] -= b;
}

int ss[100010];

signed main() {
    while (cin >> n >> m) {
        memset(imos0, 0, sizeof imos0);
        memset(imos1, 0, sizeof imos1);
        rep(i, n) {
            cin >> ss[i];
            --ss[i];
        }
        rep(i, n - 1) {
            int s = ss[i], d = ss[i + 1];
            dump(s, d);
            if (s < d) {
                add(s + 2, d + 1, 1, 1);
            } else if (d < s) {
                add(s + 2, s + m + 2, 1, 1);
                add(0, d + 1, m - s - 1, 1);
            }
        }

        rep(i, m) {
            imos0[i + 1] += imos0[i];
            imos1[i + 1] += imos1[i];
        }
        rep(i, m) {
            reduce[i] = imos0[i] + imos1[i] * i;
            // dump(i, reduce[i]);
        }

        int maxi = *max_element(reduce, reduce + m);
        int org = 0;
        rep(i, n - 1) {
            int s = ss[i], d = ss[i + 1];
            int add;
            if (s < d) add = d - s;
            else add = d + m - s;
            // dump(org);
            org += add;
        }
        dump(org, maxi);
        cout << org - maxi << endl;
    }
}


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

using namespace std;

#define ll long long int
#define ld long double
#define MAX 1001
#define MOD 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

int main(){

    fast;

    ll n;
    cin >> n;

    vector<ll> a[n+1];

    ll i;
    for(i=2;i<=n;i++){
        ll a1;
        cin >> a1;
        a[a1].push_back(i);
    }
    for(i=1;i<=n;i++){
        cout << a[i].size() << endl;
    }

}










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

#define int long long
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define dbg(x) cout<<#x" = "<<(x)<<ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

// aに+2 bに+1
// aに2足す権利、bに1足す権利
int n, a[10000], b[10000], ap, bp;

signed main() {
	cin >> n;
	rep(i,n) cin >> a[i];
	rep(i,n) cin >> b[i];
	rep(i,n) {
		if (a[i]==b[i]) continue;
		if (a[i]>b[i]) {
			// 権利を使うだけ使う　それでも差が埋まらないならaに2足す権利を獲得
			int dif = a[i]-b[i];
			int ken = min(dif,bp);
			dif -= ken, bp -= ken;
			ap += dif;
			//cout << "apに" << dif << ln;
		}
		else if (a[i]<b[i]) {
			// 同様
			int dif = b[i]-a[i];
			// 両方に2,1ずつ足せば差は1埋まる
			if (dif%2==1) dif--;
			int ken = min(dif/2, ap);
			dif -= ken*2, ap -= ken;
			bp += dif/2;
			//cout << "bpに" << dif/2 << ln;
		}
	}
	//cout << ap << ' ' << bp << ln;
	if (ap<=bp) cout << "Yes" << ln;
	else cout << "No" << ln;
}

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

const int N = 200001;

int n, indez[N], value[N];

int main()
{
  while (scanf("%d", &n) == 1) {
    long long result = 0;
    long long sum = 0;
    int t = 1;
    indez[0] = -1;
    value[0] = 0;
    for (int i = 0, a; i < n; ++ i) {
      scanf("%d", &a);
      while (value[t - 1] > a) {
        t --;
        sum -= 1LL * value[t] * (indez[t] - indez[t - 1]);
      }
      indez[t] = i;
      value[t] = a;
      sum += 1LL * a * (i - indez[t - 1]);
      t ++;
      result += sum;
    }
    printf("%lld\n", result);
  }
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
typedef long long ll;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

bool bellman_ford(int s, vector<vector<pair<int, ll>>> const &g,
                  vector<ll> &dist) {
    int n = g.size();
    bool negative_cycle = false;
    rep(i, n) dist[i] = INF;
    dist[s] = 0;
    for(int i = 0; i < 3 * n; i++) {
        for(int v = 0; v < n; v++) {
            for(auto e : g[v]) {
                if(dist[v] != INF && dist[e.first] > dist[v] + e.second) {
                    dist[e.first] = dist[v] + e.second;
                    if(i >= n - 1) {
                        dist[e.first] = -INF;
                        negative_cycle = true;
                    }
                }
            }
        }
    }
    return !negative_cycle;
}

int main() {
    ll N, M, P;
    cin >> N >> M >> P;
    using pil = pair<int, ll>;
    vector<vector<pil>> G(N, vector<pil>());

    rep(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;
        b--;
        G[a].push_back(MP(b, P - c));
    }
    vector<ll> dist(N, 0);
    bellman_ford(0, G, dist);
    if(dist[N - 1] == -INF) {
        cout << -1 << endl;
    } else {
        cout << max(0LL, -dist[N - 1]) << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
using ll = long long;




int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (n * a > b) cout << b << endl;
	else cout << n*a << endl;

	return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
branch = dict()
for i in range(1,n+1):
	branch[i] = []
for i in range(m):
	a,b = map(int,input().split())
	branch[a].append(b)
	branch[b].append(a)
for i in range(1,n+1):
	print(len(branch[i]))

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
using namespace std;
int mp[2][20010];

int solve(int goal){
  int x=0,y=0,cost=0,f=1;
  while(x!=goal+1) {
    if(f&&mp[0][x])f=0;
    if(f&&mp[1][x])f=0,cost++;

    if(mp[1][x])y=1,mp[1][x]=0;
    else if(mp[0][x])y=mp[0][x]=0;
    else x++;
    cost++;
  }
  if(y==1)cost++;
  return cost-1;
}

int main(){
  int q;
  cin>> q;
  while(q--){
    int n;
    cin>>n;
    memset(mp,0,sizeof(mp));

    char a;
    for(int i=0;i<2;i++)
      for(int j=0;j<2*n;j++)cin>> a,mp[i][(j+1)/2] |= a/'Y';
    cout<<solve(n)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1324
N, M = list(map(int, input().split()))
P = [input().split() for i in range(M)]

for i in range(M):
  P[i][0] = int(P[i][0])

ans_status = [0] * N
penalty = [0] * N
ans_count = 0

for i in range(M):
  if ans_status[P[i][0] - 1] != "AC":
    if P[i][1] == "AC":
      ans_status[P[i][0] - 1] = "AC"
      ans_count += 1
    else:
      penalty[P[i][0] - 1] += 1

penalty_count = 0

for i in range(N):
  if ans_status[i] == "AC":
    penalty_count += penalty[i]

print(ans_count, penalty_count)


Measured memory_bytes: 81496
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int A[MAX_N];
ll ans;

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	int at = 0;
	rer(i, N, 0) {
		if(A[i] < at) {
			cout << "-1\n"; return;
		}
		else if(A[i] > at) {
			if(A[i] > i) {
				cout << "-1\n"; return;
			}
			else {
				ans += A[i];
				at = A[i];
			}
		}
		else at = A[i];
		at--;
	}
	cout << ans << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 1024
#include  <stdio.h>
#define MAX 100001

int Partition(int *A, int left, int right);
void Swap(int *x, int i, int j);

int main()
{     
  int A[MAX], n, i, j, pivot;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  pivot=A[n-1];
  j=Partition(A, 0, n-1);
  /*i=0;
  while(pivot!=A[i]){
    printf("%d ",A[i]);
    i++;
  }
  printf("[%d]",A[i++]);
  while(i!=n-1){
    printf(" %d",A[i]);
    i++;
  }
  */
  for(i=0;i<j;i++){
    printf("%d ",A[i]);
  }
  printf("[%d]",pivot);
  for(i=j+1;i<n-1;i++){
  printf(" %d",A[i]);
  }
  printf(" %d\n",A[i]);  
  return 0;
}

int Partition(int *A, int left, int right)
{
  int i, j, x;
    x = A[right];
    i = left-1;
    for(j=left; j<right; j++){
      if(A[j]<=x){
	i++;
	Swap(A, i, j);
      } 
    }
    Swap(A, i+1, right);
    return i+1;
}

void Swap(int *x, int i, int j)
{
    int temp;
    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

Measured memory_bytes: 992
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int N;
  while (cin >> N) {
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    int r1 = 0, r2 = 0, r3 = 0;
    for (int i = 0; i < N; i++) {
      if (a[i] == 1) {
        ++r1;
      } else if (a[i] == 2) {
        ++r2;
      } else if (a[i] == 3) {
        ++r3;
      }
    }
    vec<double, 3> dp = make_v(N + 1, N + 1, N + 1, -1.0);
    function<double(int, int, int)> solve = [&](int r1, int r2, int r3) {
      int r0 = N - r1 - r2 - r3;
      double& res = dp[r1][r2][r3];
      if (res >= 0) return res;
      if (r0 == N) return res = 0;
      res = 1;
      if (r1 > 0) {
        res += solve(r1 - 1, r2, r3) * r1 / N;
      }
      if (r2 > 0) {
        res += solve(r1 + 1, r2 - 1, r3) * r2 / N;
      }
      if (r3 > 0) {
        res += solve(r1, r2 + 1, r3 - 1) * r3 / N;
      }
      res /= (1 - (double)r0 / N);
      return res;
    };
    double res = solve(r1, r2, r3);
    printf("%.20f\n", res);
  }
  return 0;
}


Measured memory_bytes: 216960
/*
    Code written by Talant I.D.
*/
   
#include <bits/stdc++.h>
   
using namespace std;
   
typedef long long ll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tiii;
   
#define precision(n) fixed << setprecision(n)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define mt make_tuple
#define mod (int)1e9+7
#define eps (double)1e-9
#define PI 2*acos(-0.0);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define curMod 998244353

inline bool isvowel(char ch){
    ch = tolower(ch);
    return (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u');
}

bool isprime(int n){
	if(n < 2 || (n % 2 == 0 && n != 2))
		return false;
	for(int i = 3; i*i <= n; i += 2) 
		if(n % i == 0) return false;
	return true;
}

int main(){ 
    do_not_disturb
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    //freopen("milkvisits.in", "r", stdin);
    //freopen("milkvisits.out", "w", stdout);
	int n, i, k;
	cin >> n >> k;
	vector <int> v(n), dp(k+1);
	for(i = 0; i < n; i++){
		cin >> v[i];
	}
	dp[0] = 0;
	for(i = 1; i <= k; i++){
		int flag = 0;
		for(int j = 0; j < n; j++){
			if(i-v[j] >= 0){
				if(!dp[i-v[j]]){
					flag++;
				}
			}
		}
		if(flag){
			dp[i] = 1;
		}
		else{
			dp[i] = 0;
		}
	}
	if(dp[k]) cout << "First";
	else cout << "Second";
    
    return 0;
} // What is to be written here?


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

int main() {
  int N;
  
  cin >> N;
  
  int tmp;
  set<int> A;
  
  for (int i=0; i<N; i++){
    cin >> tmp;
    A.insert(tmp);
  }

  if(A.size() == N){
  	cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }

}



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

int main(){
  int h,w;
  cin >> h >> w;
  const int INF = 1e9 + 7;
  vector<vector<int>> dp(h,vector<int>(w));

  vector<string> a;
  for (int i = 0; i < h; i++)
  {
    string s;
    cin >> s;
    a.push_back(s);
  }
  dp[0][0] = 1;
  for (int i = 0; i < h; i++)
  {
    for (int j = 0; j < w; j++)
    {
      if(a[i][j]=='.'){
        if(i-1>=0 && a[i-1][j]=='.') dp[i][j] += dp[i-1][j];
        dp[i][j] %= INF;
        if(j-1>=0 && a[i][j-1]=='.') dp[i][j] += dp[i][j-1];
        dp[i][j] %= INF;
      }
    }
  }
  cout << dp[h-1][w-1] << endl;  
}

Measured memory_bytes: 5248
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
  long long n,i,j,k,res=0;
  long long c[5];
  string s,m="MARCH";
  cin >> n;
  fill(c,c+5,0);
  for(i=0;i<n;i++){
    cin >> s;
    for(j=0;j<5;j++)
      if(s[0]==m[j])
        c[j]++;
  }
  for(i=0;i<=2;i++)
    for(j=i+1;j<=3;j++)
      for(k=j+1;k<=4;k++)
        res+=c[i]*c[j]*c[k];
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};

int main(){
	int N,M;
	cin>>N>>M;
	vector<int> vec[51];
	for(int i=0;i<M;i++){
		int a,b;
		cin>>a>>b;
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	for(int i=1;i<=N;i++){
		cout<<vec[i].size()<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
Scanf.scanf "%d %s" (fun n s ->
    let z = 1000000007 in
    let ( *@) a b = (a * b) mod z in

    let hist = Array.make 26 1 in
    String.iter (fun c -> let q = int_of_char c - 97 in hist.(q) <- hist.(q) + 1) s;

    Printf.printf "%d\n" @@ (z - 1 + Array.fold_left ( *@) 1 hist) mod z
)

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

int main()
{
    string s,t;
    cin >> s >> t;
    int a=0, b=0;
    cin >> a >> b;
    string u;
    cin >> u;

    if(s==u){
        cout << a-1 << " " << b << endl;
    }
    else{
        cout << a << " " << b-1 << endl;
    }
}


Measured memory_bytes: 256
#define ll long long
#define MOD 1000000007 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#include <bits/stdc++.h>
using namespace std;
ll dp[105][100009]={0},sum[105][100009]={0};
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,k,a[105];
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=k;j++)
        {
            if(j==0)
            dp[i][j]=1;
            else if(j<=a[i])
            {
                dp[i][j]=(1+(sum[i-1][j]-sum[i-1][0]+MOD)%MOD)%MOD;
                sum[i][j]=(dp[i][j]+sum[i][j-1])%MOD;
            }
            else 
            {
                dp[i][j]=(sum[i-1][j]-sum[i-1][j-a[i]-1]+MOD)%MOD;
                sum[i][j]=(dp[i][j]+sum[i][j-1])%MOD;
            }
        }
    }
    cout<<dp[n][k];
return 0;
} 

Measured memory_bytes: 159232
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long long

int main(){
  LL s,x1=0,x2,y1,y2;
  cin>>s;
  LL lb=0,ub=1000000000;
  while(lb<ub){
    LL mid = (lb+ub)/2;
    if(mid*mid < s){
      lb=mid+1;
    }else{
      ub=mid;
    }
  }
  x1=lb;y2=lb;
  while(x1*y2-s > 1000000000){
    x1++;
    y2--;
  }
  LL del = x1*y2 - s;
  x2=1;y1=del;
  cout<<0<<" "<<0<<" "<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<endl;
  //cerr<<x1*y2-x2*y1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

signed main()
{
	IO_OP;
	
	map<string , int> cnt;
	int n;
	cin >> n ;
	while(n--) {
		string s;
		cin >> s;
		cnt[s]++;
	}
	int mx = 0;
	V<string> ans;
	for(auto p:cnt) mx = max(mx, p.S);
	for(auto p:cnt) if(p.S == mx) ans.PB(p.F);
	sort(ALL(ans));
	for(string s:ans) cout << s << endl;	

}





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

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll mod = 1000000007;
ll INF = 1145141919454519;

ll fast_pow(ll a, ll n){
    if(n == 0) return 1;
    //べき数nが奇数, aを前にだして, a^n-1の気持ちに
    if(n % 2 == 1){
        return a * fast_pow(a, n - 1) % mod;
    }else{
        //べき数nが偶数のとき，べき数を半分にして, aをまとめる. べき数を半分にする
        return fast_pow(a * a % mod, n / 2) % mod;
    }
}


int main() {

    ll A, B, C;
    cin >> A >> B >> C;

    if(A % 2 == 1 || B % 2 == 1 || C % 2 == 1){
        cout << 0 << endl;
        return 0;
    }else if(A == B && B == C && A == C){
        cout << -1 << endl;
        return 0;
    }

    ll ans = 0;

    while(true){
        
        ll t_A = B / 2 + C / 2;
        ll t_B = A / 2 + C / 2;
        ll t_C = A / 2 + B / 2;

        A = t_A;
        B = t_B;
        C = t_C;

        ans++;
        
        if(t_A % 2 == 1 || t_B % 2 == 1 || t_C % 2 == 1){
            cout << ans << endl;
            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 long long ll;

int main() {
  ll N;
  cin >> N;
  vector< ll > A(N+1);
  A[0] = 0;
  REP(i,N) {
    ll a;
    cin >> a;
    A[i+1] = A[i] + a;
  }

//REP(i,N+1) cout << A[i] << " ";
//cout << endl;

  ll ans = 1000000000000000;
  // 探索開始位置は全部左端によせた場合
  //  探索時の判定条件を簡便にするために、C,E開始位置はB,D開始位置と同じにしている。
  //  こうすることで、最初の P と Q の比較で必ず Q の方が大きくなる。
  int st_c = 1;
  int st_d = 3;
  int st_e = 3;
  // D開始位置を振る
  for ( ; st_d < N; st_d++ ) {
    // C 開始位置を尺取り
    for ( ; st_c < st_d; st_c++ ) {
      if ( st_c+1 == st_d ) break;
      ll P0 = A[st_c-1] - A[0];
      ll Q0 = A[st_d-1] - A[st_c-1];
      ll P1 = A[st_c] - A[0];
      ll Q1 = A[st_d-1] - A[st_c];
      if ( abs(P0-Q0) < abs(P1-Q1) ) break;
    }
    // E 開始位置を尺取り
    for ( ; st_e < N+1; st_e++ ) {
      if ( st_e+1 == N+1 ) break;
      ll S0 = A[st_e-1] - A[st_d-1];
      ll T0 = A[N] - A[st_e-1];
      ll S1 = A[st_e] - A[st_d-1];
      ll T1 = A[N] - A[st_e];
      if ( abs(S0-T0) < abs(S1-T1) ) break;
    }
    ll P = A[st_c-1] - A[0];
    ll Q = A[st_d-1] - A[st_c-1];
    ll R = A[st_e-1] - A[st_d-1];
    ll S = A[N] - A[st_e-1];
    ll dif = abs( max(P, max(Q,max(R,S))) - min(P, min(Q,min(R,S))));
    ans = min( ans, dif );
//    cout << P << " " << Q <<  " " << R <<  " " << S << " : " << dif << endl;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 1792
fun main(args: Array<String>){
    val ( num , small , large) = readLine()!!.split(" ").map(String::toInt)
    var sum : Int = 0
    var ketasum :Int = 0
    //println(num)
    for(i in 1..num){
        var number :Int= i
        //println("number : "+ number)
        while(number / 10 != 0){
            var dig =number % 10
            ketasum += dig
            number /= 10
        }
        ketasum = ketasum + number
        //println(ketasum)
        if(ketasum >= small && ketasum <= large){
            sum += i
            //println("sum :" + sum)
        }
        ketasum = 0
    }
    println(sum)
}


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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int n,m;
    cin>>n>>m;
    vector<int> a(n);
    int sum=0;
    for(auto& it:a) cin>>it,sum+=it;
    int cnt=0;
    for(auto it:a){
        if(it>=double(sum)/4/m) cnt++;
    }
    cout<<(cnt>=m?"Yes":"No");
    return 0;
}



Measured memory_bytes: 256
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline



    n, k, q = map(int, input().split())

    ans_list = [0]*(n+1)
    for _ in range(q):
        ans_list[int(input())] += 1

    norma = q - k

    for num in ans_list[1:]:
        if num > norma:
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 5448
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n, m = MI()
a = [II() for _ in range(m)]

tmp = [0] * (n+1)
ok = [True] * (n+1)
for num in a:
    ok[num] = False
tmp[0] = 1
for i in range(n):
    for j in range(i+1, min(n, i+2)+1):
        if ok[j]:
            tmp[j] += tmp[i]
print(tmp[n] % MOD)


Measured memory_bytes: 477416
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

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

  string s1, s2;
  cin >> s1 >> s2;

  s1 += (char)s2[s2.size()-1];
  if (s1 == s2) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}


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

#define         ull             unsigned long long
#define         ll              long long
#define         inf             INT_MAX
#define         pi              acos(-1.0)
#define         vi              vector<int>
#define         vl              vector<long long>
#define         pii             pair<int,int>
#define         pll             pair<long long,long long>
#define         mp              make_pair
#define         mii             map<int,int>
#define         mll             map<int,int>
#define         mli             multimap<int,int>
#define         mlll            multimap<long long,long long>
#define         msi             multiset<int>
#define         msl             multiset<long long>
#define         si              set<int>
#define         sl              set<long long>
#define         FOR(I,A,B)      for(int I = (A); I < (B); I++)
#define         rev(I,A,B)      for(int I = A ; I >= B ; I--)
#define         mem(a, v)       memset(a, v, sizeof (a))
#define         mod             1000000007
#define         all(a)          a.begin(),a.end()
#define         rall(a)         a.rbegin(),a.rend()
#define         ff              first
#define         ss              second
#define         arsort(ar,n)    sort(ar,ar+n);
#define         vsort(v)        sort(v.begin(),v.end())
#define         vrev(v)         reverse(v.begin(),v.end())
#define         arrev(ar,n)     reverse(ar,ar+n)
#define         pb              push_back
#define         popb            pop_back
#define         booster()       ios_base::sync_with_stdio(0); cin.tie(0);
#define         read(f)         freopen(f, "r", stdin)


#define         min3(a,b,c)     min(a,min(b,c))
#define         max3(a,b,c)     max(a,max(b,c))
#define         min4(a,b,c,d)   min(min(a,b),min(c,d))
#define         max4(a,b,c,d)   max(max(a,b),max(c,d))
#define         max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define         min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))


#define         bitCheck(a,k)     ((bool)(a&(1<<(k))))
#define         bitOff(a,k)       (a&(~(1<<(k))))
#define         bitOn(a,k)        (a|(1<<(k)))
#define         bitFlip(a,k)      (a^(1<<(k)))


int fx[] = {-1,+0,+1,+0,+1,+1,-1,-1,+0};
int fy[] = {+0,-1,+0,+1,+1,-1,+1,-1,+0};
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

using namespace std;

bool comp(int x, int y) { return x > y; }

ull arr[10000000];



/*********************** let the play begin() ***********************************/

int main()
{
    booster()
    int n;
    cin>>n;
    ull ans=1;
    FOR(i,0,n) cin>>arr[i];ans=arr[0];
    FOR(i,1,n)
    {
        ull g=__gcd(arr[i],ans);
        ans=ans/g*arr[i];
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
    let sa = read1::<String>().chars().collect::<Vec<char>>();
    let sb = read1::<String>().chars().collect::<Vec<char>>();
    let sc = read1::<String>().chars().collect::<Vec<char>>();

    let mut ca = 1;
    let mut cb = 0;
    let mut cc = 0;
    let la = sa.len();
    let lb = sb.len();
    let lc = sc.len();
    let mut t = sa[0];

    loop {
        if t == 'a' {
            if ca == la {
                println!("A");
                return;
            } else {
                t = sa[ca];
                ca += 1;
            }
        } else if t == 'b' {
            if cb == lb {
                println!("B");
                return;
            } else {
                t = sb[cb];
                cb += 1;
            }
        } else {
            if cc == lc {
                println!("C");
                return;
            } else {
                t = sc[cc];
                cc += 1;
            }
        }
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
main(){
  int n,k,q,a;
  cin>>n>>k>>q;
  vector<int> b(n,k);
  for(int i=0;i<q;++i){
    cin>>a;
    b[a-1]++;
  }
  for(auto &i:b)i-=q;
  for(auto i:b)cout<<(i>0?"Yes":"No")<<"\n";
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

// #define DEBUG

void printarray(int n, int a[])
{
    for (int i = 1; i < n + 1; i++)
    {
        cout << a[i];
        if (i != n)
            cout << " ";
    }
    cout << endl;
}

int cycleanalysis(int n, int a[])
{
    int pos, ret, next;
    pos = 0, ret = 0;
    for (int i = 1; i < n + 1; i++)
    {
        pos = i;
        while (a[pos] != pos)
        {
            ret += (a[pos] + a[a[pos]]);
            next = a[pos];
            swap(a[pos], a[a[pos]]);
            pos = next;
        }
    }

    return ret;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, v, m, x;
    cin >> n;
    int a[n][n] = {};
    for (int i = 0; i < n; i++)
    {
        cin >> v >> m;
        for (int j = 0; j < m; j++)
        {
            cin >> x;
            a[v-1][x - 1] = 1;
        }
        for (int k = 0; k < n; k++){
            cout << a[i][k];
            if (k != n-1) cout << " ";
        }
        cout << endl;
    }
    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 3120