akhauriyash/Code-Regression huggingface dataset:
// dile a la jardinera que traigo flores

#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) int(x.size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cout << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define FER(i,a,b) for(int i = int(a); i < int(b); ++i)
#define IFR(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;


int main(){	
	fastio;
	ll mn=LLONG_MAX;
	ll n;cin>>n;
	int pos=0;
	FER(i,0,5){
		ll k;cin>>k;
		mn=min(mn,k);
	}	
	ll val=(n+mn-1)/mn+4;
	cout<<val<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
int main() {
  int H, W; cin >> H >> W;
  int h, w; cin >> h >> w;
  cout << H*W - h*W - H*w + h*w << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {		
		try(Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			int K = scanner.nextInt();
			
			int output = (N - K) + 1;
			
			System.out.println(output);
		}catch(Exception e) {
			e.printStackTrace();
		}
	}

}


Measured memory_bytes: 21716
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) for(auto x:obj)cout<<x<<' ';cout<<endl;
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

ll rep_power_modM(ll a, ll n, ll M){
    if(n == 0LL)return 1LL;
    if(n%2 == 0LL){ll tmp = rep_power_modM(a,n/2,M); return tmp*tmp%M;}
    return a*rep_power_modM(a,n-1LL,M)%M;
}

int main(){
	int N,K;
	cin>>N>>K;
	vector<ll> e_ans(K+1, 0);
	for(int i = K; i>= 1; --i){
		ll t = rep_power_modM(K/i, N, MOD);
		for(int j = 2; i*j<=K; ++j){
			t -= e_ans[i*j];
			if(t < 0) t+=MOD;
		}
		e_ans[i] = t % MOD;
	}
	ll ans = 0LL;
	REP(i,K){
		ans += (e_ans[i]*i)%MOD;
	}
	cout<<ans%MOD<<endl;
}

// int main(){
// 	ll N,K; cin>>N>>K;
// 	int ans = 0;
// 	int cnt = 0;
// 	for(int i = 2; i<=K; ++i){
// 		ll t = rep_power_modM(K/i, N, MOD);
// 		ans += (t*i)%MOD;
// 		cnt += t%MOD;
// 		int div = 0;
// 		for(int j = 1; j*j<=i; ++j){
// 			if(i%j != 0)continue;
// 			if(j*j == i){div ++; ans -= j*t; continue;}
// 			else div += 2;
// 			int oth = i/j;
// 			if(j != 1)ans -= t*j;
// 			if(oth != i)ans -= t+i;
// 		}
// 		div -= 2;
// 		cnt -= div;
// 		ans %= MOD;
// 		cnt %= MOD;
// 	}
// 	printf("[ans]=>%d [cnt]=>%d\n", ans, cnt);
// 	ans += (rep_power_modM(K,N,MOD)-cnt)%MOD;
// 	cout<<ans<<endl;
// 	return 0;
// }

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

int main() {
  vector<int> abc(3);
  rep(i, 3) cin >> abc[i];
  sort(abc.begin(), abc.end());
  if(abc[0] == 5 && abc[1] == 5 && abc[2] == 7) cout <<"YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 3580
N=int(input())
s=input()
l=len(s)
dp=[[0]*(N+2) for i in range(N)]
dp[0][1]=2
dp[0][0]=1
mod=10**9+7
for i in range(N-1):
    for j in range(i+2):
        if j==0:
            dp[i+1][j+1]+=2*dp[i][j]
            dp[i+1][j+1]%=mod
            dp[i+1][j]+=dp[i][j]
            dp[i+1][j]%=mod            
            continue
        dp[i+1][j+1]+=2*dp[i][j]
        dp[i+1][j+1]%=mod
        dp[i+1][j-1]+=dp[i][j]
        dp[i+1][j-1]%=mod  
t=pow(2,(mod-2),mod)
t=pow(t,l,mod)
print((dp[-1][l]*t)%mod)

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

int main()
{
    string s, t;
    int flag;

    cin >> s;
    cin >> t;

    flag=0;
    for(int i=0; i<s.length(); i++)
    {
        if(s[i]!=t[i])
        {
            flag=1;
            break;
        }
    }

    if(flag)
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }


    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define int long long
#define sz(c) c.size()
#define fr first
#define sc second
#define pb push_back
#define sz(c) c.size()
#define ppb  pop_back
#define all(a)      (a).begin(),(a).end()
#define rep(i,a,n)   for( int i=a ; i<n ; i++)
#define U 1000000007
#define N 100005
#define ins insert
using namespace std;
signed main()
{
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;

  int a[n],b[n],c[n];
  rep(i,0,n) cin>>a[i]>>b[i]>>c[i];
  int dp[3][n];
  dp[0][0]=a[0];
  dp[1][0]=b[0];
  dp[2][0]=c[0];

  rep(i,1,n){
    dp[0][i] =max(dp[1][i-1],dp[2][i-1])+a[i];
    dp[1][i] =max(dp[0][i-1],dp[2][i-1])+b[i];
    dp[2][i] =max(dp[1][i-1],dp[0][i-1])+c[i];
  }
  int ans=max({dp[0][n-1],dp[1][n-1],dp[2][n-1]});
  cout<<ans;



}

Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;
const int maxn = 151;
int dp[maxn][maxn][maxn];
int solve(int a, int b, int c){
	if(a >= maxn || b >= maxn || c >= maxn) return INT_MAX / 2;
	if(a == b && b == c) return 0;
	if(dp[a][b][c] != -1) return dp[a][b][c];
	int res = INT_MAX / 2;
	res = min(res, 1 + solve(a + 1, b + 1, c));
	res = min(res, 1 + solve(a + 1, b, c + 1));
	res = min(res, 1 + solve(a, b + 1, c + 1));
	res = min(res, 1 + solve(a + 2, b, c));
	res = min(res, 1 + solve(a, b, c + 2));
	res = min(res, 1 + solve(a, b + 2, c));
	return dp[a][b][c] = res;
}
int main(){
	memset(dp, -1, sizeof(dp));
	int a, b, c;
	cin >> a >> b >> c;
	cout << solve(a, b, c) << endl;
    return 0;
}


Measured memory_bytes: 13696
fun main(args: Array<String>) {
    fun printlnInt(x: Number) = println(x.toInt())

    val (a, b, x) = readLine()!!.split(" ").map { it.toInt() }
    val litter = x / 1000.toDouble()
    val milliLitter = x / 500.toDouble()
    val allA = (Math.ceil(litter) * a).toInt()
    val allB = (Math.ceil(milliLitter) * b).toInt()
    val aAndB = ((x / 1000) * a + Math.ceil((x % 1000) / 500.toDouble()) * b).toInt()
    println(listOf(allA, allB, aAndB).min()!!)
}


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

int main(){
	int n,kk;
	cin  >> n >> kk ;
	
	int k = n - kk+1;

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

/*	
	for (int i = 0; i < k; i++){
		b[i] = 1;
		for (int j = 0; j < kk; j++){
			b[i] = b[i] * a[n-j-i-1];
		}
	}
*/
	string ans[k];
	for (int i = 0; i<k-1; i++) {
		if ( a[n-i-1] - a[n-i-kk-1] > 0 ) {ans[i] = "Yes";} 
		else {ans[i]="No";}
	}
	
	for (int i = 0; i<k;i++){
		cout << ans[k-i-1] <<endl;
	}	
	
//	if (count <= k) {cout << "Yes" << endl;} 
//	else  {cout << "No" << endl;}
//	cout << y << endl;
return 0;
}


Measured memory_bytes: 11388
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,x,y;
    cin>>x>>y;
    a=x+y;
    b=x-y;
    c=x*y;
    if((a>=b)&&(a>=c)){
        cout<<a<<endl;
    }
    else if((b>=c)&&(b>=a)){
        cout<<b<<endl;
    }
    else{
        cout<<c<<endl;
    }
return 0;
}


Measured memory_bytes: 256
//JSD
#include<iostream>
#define ll long long 
using namespace std;
int main(){
	ll l,r;
	cin>>l>>r;
	if(r-l+1>=2019){
		cout<<"0";
	}
	else{
		ll ans=2020;
		for(ll i=l;i<r;i++){
			for(ll j=i+1;j<=r;j++){
				ll p=(i*j)%2019;
				ans=min(ans,p);
			}
		}
		cout<<ans;
	}
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
 
using namespace std;
 
long long a,b;
 
int main()
{
    cin >> a >> b;
  	if (a == 1 || b == 1) cout << 1;
    else 
    {
      if (a*b%2 == 0) cout << a*b/2;
      else 
          cout << a*b/2+1;
    }
}

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

typedef pair<int,int>P;

const int INF=1e9;
int N,M,K;
vector<P>G[3000];
int dist[3000];
int main(){
    cin>>N>>M>>K;

    for(int i=0;i<M;i++){
        int a,b,c;cin>>a>>b>>c;
        G[--a].push_back(P(--b,c));
        G[b].push_back(P(a,c));
    }
    fill_n(dist,N,INF);
    priority_queue<P,vector<P>,greater<P> >Q;
    for(int i=0;i<K;i++){
        int x;cin>>x;
        Q.push(P(0,--x));
        dist[x]=0;
    }

    while(!Q.empty()){
        P p=Q.top();Q.pop();

        if(dist[p.second]<p.first)continue;

        for(int i=0;i<G[p.second].size();i++){
            P &e=G[p.second][i];
            if(p.first+e.second>=dist[e.first])continue;
            dist[e.first]=p.first+e.second;
            Q.push(P(p.first+e.second,e.first));
        }
    }

    int ma=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<G[i].size();j++){
            P &e=G[i][j];
            int d=abs(dist[i]-dist[e.first]);
            ma=max(ma,max(dist[i],dist[e.first])+(e.second-d+1)/2);
        }
    }

    cout<<ma<<endl;
    return 0;
}

Measured memory_bytes: 4192
#include<cstdio>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
using namespace std;

const int N=300010;
int n,m,a[N],r[N],mx[N];

int main(){
    scanf("%d",&m); int n=1<<m;
    for (int i=0; i<n; i++) scanf("%d",&a[i]);
    for (int i=0; i<n; i++)
        for (int j=i; j<n; j=(j+1)|i)
            r[j]=max(r[j],a[i]+mx[j]),mx[j]=max(mx[j],a[i]);
    for (int i=1; i<n; i++) printf("%d\n",r[i]=max(r[i],r[i-1]));
    return 0;
}

Measured memory_bytes: 6292
/* ex5_3
    suuxxu */

#include <stdio.h>

char square[100][100];

int remove_row(int n, int height, int width);
int remove_col(int n, int height, int width);

int main(void){
    int height, width, i, j, answer_height, answer_width;
    int memo_row[100] = {}; // which row will be removed
    int memo_col[100] = {}; // which col will be removed

    // get inputs - H W
    scanf("%d %d", &height, &width);
    answer_height = height;
    answer_width = width;

    // get inputs - a_i,j
    for (i = 0; i < height; i++){
        for (j = 0; j < width; j++){
            scanf(" %c", &square[i][j]);
        }
    }

    // check which row or col will be removed
    for (i = 0; i < height; i++){
        for (j = 0; j < width; j++){
            if (square[i][j] == '#'){
                memo_row[i] = 1;
                memo_col[j] = 1;
            }
        }
    }

    // remove rows
    for (i = 0; i < height; i++){
        if (memo_row[i] == 0){
            remove_row(i, answer_height, answer_width);
            answer_height = answer_height - 1;
        }
    }

    // remove cols
    for (i = 0; i < width; i++){
        if (memo_col[i] == 0){
            remove_col(i, answer_height, answer_width);
            answer_width = answer_width - 1;
        }
    }

    // output answer
    for (i = 0; i < answer_height; i++){
        for (j = 0; j < answer_width; j++){
            printf("%c", square[i][j]);
        }
        printf("\n");
    }

    return 0;
}

int remove_row(n, height, width){
    static int times = 0; // how many rows removed already
    int i, j;

    for (i = n - times; i < height; i++){
        for (j = 0; j < width; j++){
            square[i][j] = square[i+1][j];
        }
    }

    times = times + 1;

    return 0;
}

int remove_col(n, height, width){
    static int times = 0; // how many cols removed already
    int i, j;

    for (i = 0; i < height; i++){
        for (j = n - times; j < width; j++){
            square[i][j] = square[i][j+1];
        }
    }

    times = times + 1;

    return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

struct dice {
	int N[6];
	char num[5];
};
struct dice DICE = { 1, 2, 3, 4, 5, 6, 4, 3, 0, 2, 1 };

void check_a(int l1, char *str);
void check_b(int l1, char *str);
void rot(char *str);

int main(void) {
	char str[100];
	char v[2][24];
	int i, num;
	scanf("%d%d%d%d%d%d", &DICE.N[0], &DICE.N[1], &DICE.N[2], &DICE.N[3], &DICE.N[4], &DICE.N[5]);
	for (i = 0; i < 6; i++) {							//6面の値の取得
		if (DICE.N[i] < 0) { DICE.N[i] = 0; }			//0以下の場合は0とする
		if (DICE.N[i] > 100) { DICE.N[i] = 100; }		//100以上の場合は100とする
	}
	getchar();											//改行の読み飛ばし
	scanf("%d", &num);									//質問数の取得
	if (num < 1) { num = 1; }							//質問数の下限値は1
	if (num > 24) { num = 24; }							//質問数の上限値は24
	getchar();											//改行の読み飛ばし
	for (i = 0; i < num; i++) {
//		scanf("%d%d", &v[0][i], &v[1][i]);				//上面と前面の値の取得
//		getchar();										//改行の読み飛ばし
	}
	for (i = 0; i < num; i++) {

		scanf("%d%d", &v[0][i], &v[1][i]);				//上面と前面の値の取得
		getchar();										//改行の読み飛ばし

		check_a(v[0][i], str);							//上面の位置取得
		rot(str);										//
		check_b(v[1][i], str);							//前面の位置取得
		rot(str);										//
		printf("%d\n", DICE.N[DICE.num[3]]);			//右面の値
	}
	return 0;
}
void check_a(int l1, char *str) {
	int i, j = 0, k = 5;
	for (i = 0; i < 6; i++) {							//求めたい値が何番目に格納されているか調べる
		if (l1 == DICE.N[i]) {
			j = i;
			break;
		}
	}
	for (i = 0; i < 5; i++) {							//上で一致した番号がダイスのどの位置にあるか調べる
		if (j == DICE.num[i]) {
			k = i;
			break;
		}
	}
	switch (k) {
	case 0:
		strcpy(str, "");
		break;
	case 1:
		strcpy(str, "EN");
		break;
	case 2:
		strcpy(str, "N");
		break;
	case 3:
		strcpy(str, "WN");
		break;
	case 4:
		strcpy(str, "NN");
		break;
	default:
		strcpy(str, "S");
		break;
	}
}
void check_b(int l1, char *str) {
	int i, j = 0, k = 5;
	for (i = 0; i < 6; i++) {							//求めたい値が何番目に格納されているか調べる
		if (l1 == DICE.N[i]) {
			j = i;
			break;
		}
	}
	for (i = 0; i < 5; i++) {							//上で一致した番号がダイスのどの位置にあるか調べる
		if (j == DICE.num[i]) {
			k = i;
			break;
		}
	}
	switch (k) {
	case 0:
		strcpy(str, "");
		break;
	case 1:
		strcpy(str, "E");
		break;
	case 2:
		strcpy(str, "");
		break;
	case 3:
		strcpy(str, "W");
		break;
	case 4:
		strcpy(str, "");
		break;
	default:
		strcpy(str, "EE");
		break;
	}
}
void rot(char *str) {
	int i = 0;
	while (str[i] != '\0') {
		switch (str[i]) {
		case 'N':
			DICE.num[0] = DICE.num[2];
			DICE.num[2] = DICE.num[4];
			DICE.num[4] = 5 - DICE.num[0];
			break;
		case 'S':
			DICE.num[4] = DICE.num[2];
			DICE.num[2] = DICE.num[0];
			DICE.num[0] = 5 - DICE.num[4];
			break;
		case 'E':
			DICE.num[3] = DICE.num[2];
			DICE.num[2] = DICE.num[1];
			DICE.num[1] = 5 - DICE.num[3];
			break;
		case 'W':
			DICE.num[1] = DICE.num[2];
			DICE.num[2] = DICE.num[3];
			DICE.num[3] = 5 - DICE.num[1];
			break;
		default:
			break;
		}
		i++;
	}
}


Measured memory_bytes: 2104
#include <stdio.h>

void swap(int* a, int *b)
{
  int tmp = *a;
  *a = *b;
  *b = tmp;
}

int main(void)
{
  int w; // タテ棒 |  の数
  int n; // ヨコ棒 ー の数

  int a, b; // a番からb番にかけてヨコ棒が引かれる

  int i;

  scanf("%d", &w);
  scanf("%d", &n);

  int line[w];

  for (i=1; i<=n; i++)
    line[i] = i;

  for (i=0; i<n; i++)
    {
      scanf("%d,%d", &a, &b);
      swap(&line[a-1], &line[b-1]);
    }

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

  return 0;
}

Measured memory_bytes: 596
# coding:utf-8

import sys


input = sys.stdin.readline


def inpl(): return list(map(int, input().split()))


# ---
class UnionFind:
    __slots__ = ['nodes', 'weight']

    def __init__(self, size: int) -> None:
        self.nodes = [-1] * size
        self.weight = [0] * size

    # 検索
    def find(self, x: int) -> int:
        if self.nodes[x] < 0:
            return x
        else:
            parent = self.find(self.nodes[x])
            self.weight[x] += self.weight[self.nodes[x]]
            self.nodes[x] = parent
            return parent

    # 併合
    # def unite(self, x: int, y: int, w: int) -> bool:
    #     root_x = self.find(x)
    #     root_y = self.find(y)
    #     if root_x == root_y:
    #         return False
    #     else:
    #         rank_x = -self.nodes[root_x]
    #         rank_y = -self.nodes[root_y]
    #         if rank_x < rank_y:
    #             self.nodes[root_x] = root_y
    #             self.weight[root_x] = w - self.weight[y] - self.weight[x]
    #         else:
    #             self.nodes[root_y] = root_x
    #             self.weight[root_y] = w - self.weight[x] - self.weight[y]
    #
    #             if rank_x == rank_y:
    #                 self.nodes[root_x] += -1
    #
    #         return True

    # xとyのルートが等しい時: 入力された重みwが正しいかどうかを判定
    # xとyのルートが異なる時: xとyを併合する
    # True: 併合した，False: 何もしなかった，ValueError: 入力された重みに矛盾がある
    def relate(self, x: int, y: int, w: int) -> bool:
        root_x = self.find(x)
        root_y = self.find(y)
        if root_x == root_y:  # 入力された重みwに矛盾がないか判定
            # print(x, y, self.weight[x], self.weight[y], w)
            # print(self.get_tree())
            # print(self.weight)
            if self.weight[x] - self.weight[y] == w:
                return False
            raise ValueError
        else:
            rank_x = -self.nodes[root_x]
            rank_y = -self.nodes[root_y]
            if rank_x < rank_y:
                self.nodes[root_x] = root_y
                self.weight[root_x] = w + self.weight[y] - self.weight[x]
            else:
                self.nodes[root_y] = root_x
                self.weight[root_y] = -w + self.weight[x] - self.weight[y]

                if rank_x == rank_y:
                    self.nodes[root_x] += -1
            return True

    # UnionFind木の一覧を返す
    def get_tree(self) -> dict:
        tree = {}
        for i, node in enumerate(self.nodes):
            if node < 0:
                if i not in tree.keys():
                    tree[i] = []
            else:
                if self.find(node) in tree.keys():
                    tree[self.find(node)].append(i)
                else:
                    tree[self.find(node)] = [i]

        return tree


N, M = inpl()
uf = UnionFind(N)
relate = uf.relate
try:
    for i in range(M):
        l, r, d = inpl()
        relate(l - 1, r - 1, d)
    else:
        print('Yes')
except ValueError:
    print('No')


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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for(int i=0; i<N; i++){
    cin >> H.at(i);
  }

  int ans = 0;

  for(int h : H){
    if(h >= K){
      ans++;
    }
  }

  cout << ans << endl; 
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>

#define FOR1(n) for(int i=0;i<n;i++)
#define FOR2(j, n) for(int j=0;j<n;j++)
#define FOR3(i, m, n) for(int i=m;i<=n;i++)
#define ALL(c) c.begin(), c.end()
#define SCANF(x) scanf("%lld", &x)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

/*
逆順ソート sort(ALL(vec), greater<ll>());
ペア定義 P pair = make_pair(100, 200);
集合find set.find(item);
小さい順に取り出したい優先度付きキュー
priority_queue<int, vector<int>, greater<int> > que;
配列の最大要素 *std::max_element(ALL(vec))
*/

signed main(){
	int n;
	scanf("%d", &n);
	int m = 1;
	while(m * (m + 1) / 2 <= n) m++;
	
	int v =  m*(m+1)/2 - n;
	FOR1(m){
		if(i + 1 != v) printf("%d\n", i+1);
	}
	
}

Measured memory_bytes: 504
#include <bits/stdc++.h>
#define f first
#define s second
#define pl pair < long long , long long >
#define ll long long

using namespace std;

const long long BIG = 1e7 + 9 ;
string s ;
int main()
{
    bool ans = 0 ;
    cin >> s ;
    for ( auto i : s )
        if ( i == '7' )
        ans = 1 ;
    ans ? cout << "Yes" : cout << "No" ;

}


Measured memory_bytes: 3628
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


def lcm(x, y):
    return x * y // gcd(x, y)


n = int(input())
t = [int(input()) for _ in range(n)]
ans = t[0]
for i in range(1, n):
    ans = lcm(ans, t[i])
print(ans)

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)


int main() {
	string s;
	cin >> s;

	if (s[0] == s[1] && s[1]==s[2])
		cout << "No" << endl;
	else
		cout << "Yes" << endl;




}

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

template <typename T>
class BIT {
  int n;
  vector<T> bit;
public:
  BIT(int _n) {
    n = _n;
    bit = vector<T>(n+1,(T)0);
  }
  T sum(int i) {
    T s = 0;
    while(i > 0){
    s += bit[i];
    i -= i & -i;
  }
  return s;
  }
  void add(int i, T x) {
    while(i <= n){
    bit[i] += x;
    i += i & -i;
    }
  }
};

int main(){
  ll n;
  cin >> n;
  ll a[n+1];
  rep(i,n) cin >> a[i+1];
  ll l = 0, r = INF;
  while(r - l > 1) {
    ll m = (l + r) / 2;
    vector<int> s(n+1,0);
    BIT<ll> odd(4*n), even(4*n);
    ll num = 0;
    even.add(2*n,1);
    for(ll i = 1; i <= n; i++) {
      s[i] = s[i-1];
      if(a[i] >= m) s[i]++;
      ll k = 2*s[i] - i + 2*n;
      if(i % 2) {
        num += odd.sum(k);
        num += even.sum(k-1);
      } else {
        num += odd.sum(k-1);
        num += even.sum(k);
      }
      if(i % 2) odd.add(k,1);
      else even.add(k,1);
    }
    if(num >= (n*(n+1)/2 +1)/2) l = m;
    else r = m;
  }
  cout << l << endl;
}


Measured memory_bytes: 7720
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

#define rep(i, o) for (ll i = 0; i < (o);i++)
#define rep_s(i, o) for (int i = 1; i <= (o);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<(int)(b);i++)
#define NUM 1e5

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }


template<class T>
bool chmax(T &a, const T &b) {
    if (a < b)
    {
        return b;
    }
    return a; 
}

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

int main() {
    string s; cin >> s;

    string nickname;
    rep(i, 3) {
        nickname += s[i];
    }

    cout << nickname << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
int main()
{
        ll  a,c=0;
        cin>>a;
        ll arr[a];
        for(int i=0;i<a;i++) cin>>arr[i];
        for(int i=1;i<(a-1);i++){
                if((arr[i]>arr[i-1]&& arr[i]<arr[i+1]) || (arr[i]<arr[i-1]&& arr[i]>arr[i+1])) c++;
        }
        cout<<c<<endl;

}


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

int main()
{
    string w;
    cin >> w;
    cin.ignore();

    // // upper to lower conversion
    // for (long unsigned int i = 0; i < w.length(); i++)
    // {
    //     if ('A' <= w[i] && w[i] <= 'Z')
    //     {
    //         w[i] += 'a' - 'A';
    //     }
    // }

    int cnt = 0;
    while (1)
    {
        string s;
        getline(cin, s);
        if (s == "END_OF_TEXT")
            break;

        // upper to lower conversion
        for (long unsigned int i = 0; i < s.length(); i++)
        {
            if ('A' <= s[i] && s[i] <= 'Z')
            {
                s[i] += 'a' - 'A';
            }
        }

        // cout << s << endl;

        // bool condition = false;

        // search and counting
        for (long unsigned int i = 0; i < s.length() - w.length() + 1; i++)
        {

            bool flag1 = ((i == 0 && s.substr(i, w.length()) == w) || (s[i - 1] == ' ' && s.substr(i, w.length()) == w));
            bool flag2 = (s[i + w.length()] == '\n' || s[i + w.length()] == '\0' || s[i + w.length()] == ' ');
            // cout << i << endl;
            // cout << "i = " << i << ", Cond1: " << (bool) ((i == 0 && s.substr(i, w.length()) == w) || (s[i - 1] == ' ' && s.substr(i, w.length()) == w)) << endl;
            // cout << "i = " << i << ", Cond2: " << (bool) (s[i + w.length()] == '\n' || s[i + w.length()] == '\0' || s[i + w.length()] == ' ') << endl;

            // (s[i + w.length() - 1] == '\n' || s[i + w.length() - 1] == '\0' || s[i + w.length() - 1] == ' ') if (((i == 0 && s.substr(i, w.length()) == w) || (s[i] == ' ' && s.substr(i + 1, w.length()) == w)) && (s[i + w.length() - 1] == '\n' || s[i + w.length() - 1] == '\0' || s[i + w.length() - 1] == ' '))
            if ((flag1 && flag2) == true)
            {
                cnt++;
            }
            // {
            //     cnt++;
            // }
            // cout << s.substr(i, w.length()) << endl;
        }

        // cout << cnt << endl;
    }

    cout << cnt << endl;
    return 0;
}


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

int n,a,ans;
stack<int> s;

int main(){
  cin>>n;
  s.push(0);
  while(n--){
    cin>>a;
    while(s.top()>a)s.pop();
    if(s.top()<a)s.push(a),ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1804
import sys
import math
sys.setrecursionlimit(200000)
MOD = 10 ** 9 + 7


def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0], w[1]]
# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)


def mod_inv(a,m):
    x = extgcd(a, m)[0]
    return (m + x % m) % m


def main():
    X, Y = map(int, input().split())
    if (X + Y) % 3 != 0:
        print(0)
        exit()
    else:
        m = (2 * X - Y) // 3
        n = (2 * Y - X) // 3
        if m < 0 or n < 0:
            print(0)
            exit()
        else:
            res = 1
            for i in range(1, n + m + 1):
                res = res * i % MOD
            for i in range(1, n + 1):
                res = res * mod_inv(i, MOD) % MOD
            for i in range(1,m + 1):
                res = res * mod_inv(i, MOD) % MOD
            print(res)

if __name__ == "__main__":
    main()


Measured memory_bytes: 43612
#include<bits/stdc++.h>
using namespace std;
char s[200];
int main(){
	int i,j;
	cin>>s;
	int l=strlen(s);
	for (i=int(floor(l/2.0-0.5));i>=1;i--){
		bool flag=1;
		for (j=0;j<i;j++)
			if (s[j]!=s[i+j]){flag=0; break;}
		if (flag) {printf("%d\n",i*2); break;}
	}
	return 0;
}

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

typedef long long ll;
#define mem(x,y) memset(x,y,sizeof(x))

const int N=105;

int main(){
    int a,b,c,cnt=0;
    scanf("%d%d%d",&a,&b,&c);
    while (cnt<N){
        if (a%2 || b%2 || c%2){
            printf("%d\n",cnt);
            return 0;
        }
        int ax=a,bx=b;
        a=(bx+c)>>1;
        b=(ax+c)>>1;
        c=(ax+bx)>>1;
        cnt++;
    }
    printf("-1\n");
    
    return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-2;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int main() {
	int a, b, c; cin >> a >> b >> c;
	cout << min(c, b / a) << endl;
	//stop
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin>>c;
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }
}

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;  typedef pair<int,ll> pii;
typedef vector<int> VI; typedef vector<ll> VL;
const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int n; ll a,b;

bool ck(ll md, const VL& h){
	__int128_t usu = 0;
	rep(i, n){
		__int128_t z = (h[i] - (__int128_t)md * b + (a-b)-1) / (a-b);
		if(z > 0) usu += z;
		if(usu > md){
			//dbg(md,"false");
			return false;
		}
	}
	//dbg(md,"true");

	return true;
}

int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	cin >>n >>a >>b;
	VL h(n);
	for(auto& ih: h) cin >>ih;
	
	
	
	ll lo=0, hi =1LL<<60 ;
	while(hi - lo >1){
		ll md = (hi + lo) >> 1;
		(ck(md, h)? hi: lo) = md;
	}

	cout << hi <<"\n";
	
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(int argc, const char * argv[]){

	int x, i;
	int n;

	scanf("%d", &x);

	for (i=1; i<=x; i++) {
		if (i%3 == 0) printf(" %d", i);

		else {
			n = i;

		while (n % 10 != 3 && n) {
			n /= 10;
		}

		if (n){
			printf(" %d", i);
		}
		}
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include <iomanip>
#include<deque>
#include<stack>
#include<set>
#include <numeric>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
const int INF = 111111111;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const int DIV = 1000000007; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;





int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	//==================================

	int N;
	cin >> N;

	vector<ll> V(100010), U(100010);
	for (ll i = 0; i < 100005; i++) {
		V[i] = 0;
		U[i] = 0;
	}

	for (int i = 0; i < N; i++) {
		ll temp;
		if (i % 2 == 0) {
			cin >> temp;
			V[temp] ++;
		}
		else {
			cin >> temp;
			U[temp]++;
		}
	}

	ll maxV = 0;
	ll maxU = 0;
	ll secV = 0;
	ll secU = 0;

	for (ll i = 0; i < 100008; i++) {
		if (V[maxV] < V[i]) {
			maxV = i;
		}
		if (U[maxU] < U[i]) {
			maxU = i;
		}
	}

	if (maxV != maxU) {
		cout << N - (V[maxV] + U[maxU]);
		return 0;
	}

	for (ll i = 0; i < 100008; i++) {
		if (V[secV] < V[i] && i !=maxV) {
			secV = i;
		}
		if (U[secU] < U[i] && i !=maxU) {
			secU = i;
		}
	}

	cout << N - max(V[maxV] + U[secU], V[secV] + U[maxU]);


}




Measured memory_bytes: 1792
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3,unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

int a[2001][2001][2];
int b[2001][2001][2];
int f(int x1, int x2, int y1, int y2, int c){
	return b[x2][y2][c]-b[x2][y1][c]-b[x1][y2][c]+b[x1][y1][c];
}
int main(void){
	int n=nextint();
	int k=nextint();
	for(int i=0; i<n; i++){
		int x=nextint();
		int y=nextint();
		char c=getchar();
		a[x%(k*2)][y%(k*2)][c=='B']++;
	}
	for(int i=0; i<k*2; i++){
		for(int j=0; j<k*2; j++){
			b[i+1][j+1][0]=a[i][j][0]+b[i][j+1][0]+b[i+1][j][0]-b[i][j][0];
			b[i+1][j+1][1]=a[i][j][1]+b[i][j+1][1]+b[i+1][j][1]-b[i][j][1];
		}
	}
	int ans=0;
	for(int i=0; i<k; i++){
		for(int j=0; j<k; j++){
			int now1 = f(0,i,0,j,1)+f(0,i,j,j+k,0)+f(0,i,j+k,k+k,1)+f(i,i+k,0,j,0)+f(i,i+k,j,j+k,1)+f(i,i+k,j+k,k+k,0)+f(i+k,k+k,0,j,1)+f(i+k,k+k,j,j+k,0)+f(i+k,k+k,j+k,k+k,1);
			if(now1>ans) ans=now1;
			int now2 = f(0,i,0,j,0)+f(0,i,j,j+k,1)+f(0,i,j+k,k+k,0)+f(i,i+k,0,j,1)+f(i,i+k,j,j+k,0)+f(i,i+k,j+k,k+k,1)+f(i+k,k+k,0,j,0)+f(i+k,k+k,j,j+k,1)+f(i+k,k+k,j+k,k+k,0);
			if(now2>ans) ans=now2;
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 64016
n = int(input())
l = list(map(int, input().split()))
ans = 1000000000000
sum_ab = sum(l)
sum_a = [0] * n
sum_a[0] = l[0]
for i in range(n - 1):
    if i == 0:
        x = sum_a[0]
    else:
        x = sum_a[i - 1] + l[i]
        sum_a[i] = x
    y = sum_ab - x
    if abs(x - y) < ans:
        ans = abs(x - y)
print(ans)

Measured memory_bytes: 24824
#include<bits/stdc++.h>
using namespace std;
#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 RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL A[300001];
LL B[62];
LL MOD=1e9+7;
int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	REP(i,N){
		int a=0;
		while(A[i]!=0){
			if(A[i]%2==1){
				B[a]++;
			}
			A[i]/=2;
			a++;
		}
	}
	LL a=1;
	LL ans=0;
	REP(i,62){
		LL b=B[i]*(N-B[i]);
		b%=MOD;
		LL c=a*b;
		ans+=c;
		ans%=MOD;
		a=a*2;
		a%=MOD;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a>=c){
		//???????????????????????????
		cout << c << endl;
		return 0;
	}
	REP(i,60){
		int d = c % (a+b);
		if(d<=a){
			//???????????? ??????
			cout << c << endl;
			return 0;
		}
		c += 60;
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 1164
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 123456789
//0x3f3f3f3f
#define INFL 10000000000000000
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
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; }
typedef complex<double> P;
typedef pair<int,pii> pdii;
long long int MOD = 1000000007;


int main(void){
	ll x,y;
	cin>>x>>y;
	if(x<y){
		ll ans=min(y-x,abs(x+y)+1);
		cout<<ans<<endl;
	}else{
		if(-x<=y){
			ll ans=min(y+x+1,abs(-x+y)+2);
			cout<<ans<<endl;
		}else{
			
			cout<<min(abs(y+x)+1,abs(-x+y)+2)<<endl;
		}
		
	}
}

Measured memory_bytes: 256
N, M = map(int, raw_input().split())
A = map(int, raw_input().split())
B = [0]*M
C = [0]*M
for i in range(M):
  B[i], C[i] = map(int, raw_input().split())

A.sort()
BC = [(C[i], B[i]) for i in range(M)]
BC.sort()

p = 0
for c, b in BC[::-1]:
  for i in range(b):
    if A[p]>c:
      break
    A[p] = c
    p += 1
    if p>=N:
      break
  else:
    continue
  break
print sum(A)


Measured memory_bytes: 23956
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 10000000000007;

signed main(){


    int a, b, q; cin >> a >> b >> q;
    set<int> s1;
    set<int> s2;
    for(int i = 0; i < a; i++){
        int in; cin >> in;
        s1.insert(in);
    }

    for(int i = 0; i < b; i++){
        int in; cin >> in;
        s2.insert(in);
    }

    s1.insert(INF);
    s1.insert(-INF);
    s2.insert(INF);
    s2.insert(-INF);

    for(int i = 0; i < q; i++){

        int x; cin >> x;
        int ans = 10000000000000007LL;

        auto itr1 = s1.lower_bound(x);
        auto itr2 = s2.lower_bound(x);
        auto pre1 = itr1;
        auto pre2 = itr2;
        pre1--;
        pre2--;

        ans = min(ans, (int)abs(*itr1 - x) + (int)(abs(*itr2 - *itr1)));
        ans = min(ans, (int)abs(*itr2 - x) + (int)(abs(*itr2 - *itr1)));

        ans = min(ans, (int)abs(*itr1 - x) + (int)(abs(*pre2 - *itr1)));
        ans = min(ans, (int)abs(*pre2 - x) + (int)(abs(*pre2 - *itr1)));

        ans = min(ans, (int)abs(*pre1 - x) + (int)(abs(*itr2 - *pre1)));
        ans = min(ans, (int)abs(*itr2 - x) + (int)(abs(*itr2 - *pre1)));

        ans = min(ans, (int)abs(*pre1 - x) + (int)(abs(*pre2 - *pre1)));
        ans = min(ans, (int)abs(*pre2 - x) + (int)(abs(*pre2 - *pre1)));
    
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>
using namespace std;
vector<int> g[200001];
long long cnt[200001];
double ans;

void dfs(int v , int p = -1){
	for (int u : g[v]){
		if (u == p) continue;
		cnt[u] += cnt[v];
		dfs(u , v);
	}
}

int main(){
	ios::sync_with_stdio(0);
	int n , q;
	cin >> n >> q;
	for (int i = 0; i < n - 1; i++){
		int a , b;
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for (int i = 0; i < q; i++){
		int root;
		long long val;
		cin >> root >> val;
		cnt[root] += val;
	}
	dfs(1);
	for (int i = 1; i <= n; i++){
		cout << cnt[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 24320
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
#include <random>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector <int> vec;
typedef vector <ll> vecll;
typedef vector <double> vecd;
typedef vector <vec> mat;
typedef vector <vecll> matll;
typedef vector <vecd> matd;

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

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const ll INFL = 1e18;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

//********************************template END****************************************//

void solve(void){

	int N, K;
	cin >> N >> K;

	set <int> s;
	rep(K, i)
	{
		int d;
		cin >> d;
		s.insert(d);
	}

	while(1)
	{
		int n = N;
		while(n > 0)
		{
			if (s.count(n%10))
			{
				break;
			}
			n /= 10;
		}
		if (n==0)
		{
			cout << N << endl;
			break;
		}
		N++;
	}


}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , "; logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

int main(){
    ii3(k, a, b);
    repp(i, a, b+1){
        if(i%k == 0){
            out("OK"); return 0;
        }
    } out("NG");
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

long long cut(long long x, vector<long long> a)
{
    long long sum = 0;
    for (long long i = 0; i < a.size(); i++)
    {
        if(a[i] <= x) continue;

        sum += ceil((long double)a[i] / x) - 1;
    }

    return sum;
}

int main(void)
{
    long long N,K;
    cin >> N >> K;
    vector<long long> a(N);
    for (long long i = 0; i < N; i++)
    {
        cin >> a[i];
    }
    
    sort(a.begin(), a.end());
    
    long long left = 1;
    long long right = a[N - 1];
    long long mid;

    while(right - left > 1)
    {
        mid = (left + right) / 2;
        long long c = cut(mid, a);

        if(c <= K)
        {
            right = mid - 1;
        }
        else
        {
            left = mid + 1;
        }   
    }

    long long ans = mid;
    if(cut(left, a) <= K) ans = left;
    else if(cut(right, a) <= K) ans = right;

    cout << ans << endl;
}

Measured memory_bytes: 6420
#include<iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int A[100],N,v,j;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    for(int i=0;i<N;i++){
        v = A[i];
        j = i-1;
        while(j>=0&&A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
    for(int i=0;i<N;i++){
        cout << A[i];
        if(i!=N-1)   cout << " ";
    }
    cout << "\n";
    }
}


Measured memory_bytes: 3116
#include<iostream>
#include<cmath>
#include<string>

using namespace std;

struct GamePoints {
	int points;
};

int main() {
	
	GamePoints Taro, Hanako;
	int n;
	
	while( cin >> n) {
		
		string card_1, card_2;
		
		Taro.points = 0;
		Hanako.points = 0;
		
		for(int i=0;i<n;i++) {
			
			cin >> card_1 >> card_2;
			
			if(card_1 == card_2 ) 
			Taro.points++, Hanako.points++;
			
			else if(card_1 > card_2 ) 
			Taro.points += 3;
			
			else
			Hanako.points += 3;
	}
		cout << Taro.points << " " << Hanako.points << "\n";
	}

	return 0;
}


Measured memory_bytes: 3208
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

vector<int> dy = { 0,0,1,-1 };
vector<int> dx = { 1,-1,0,0 };

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {
	o << "{" << obj.first << ", " << obj.second << "}"; return o;
}

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

int main() {
	int H, W, N; cin >> H >> W >> N;
	V<int> a(N+1,0),b; FOR(i,1,N+1) cin >> a[i];
	FOR(i, 1, N + 1) REP(j, a[i]) b.push_back(i);
	V<V<int>> grid(H, V<int>(W));
	int idx = 0;
	REP(i, H)REP(j, W) grid[i][j] = b[idx++];
	REP(i,H){
		if (i % 2 == 0) {
			cout << grid[i][0];
			for (int j = 1; j < W; ++j) cout << " " << grid[i][j];
		}
		if (i % 2 == 1) {
			cout << grid[i][W-1];
			for (int j = W - 2; 0 <= j; --j) cout << " " << grid[i][j];
		}
		cout << endl;
	}


	

	return 0;
}



Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main() {
	int n;
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		if (1000 >= n - (1000 * i)) {
			break;
		}
	}
	cout << 1000-(n - 1000 * i);
	return 0;
}

Measured memory_bytes: 3536
#include<stdio.h>

int main(){
  int t, n, i;
  int V[5] = {0, 6000, 4000, 3000, 2000};

  for ( i = 0; i < 4; i++ ){
    scanf("%d %d", &t, &n);
    printf("%d\n", V[t]*n);
  }

  return 0;
}






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

int main(){
    vector<int> food(5);
    for (int i = 0; i < 5; i++) {
        cin >> food.at(i);
    }
    
    vector<int> mod(5);
    for (int i = 0; i < 5; i++) {
        mod.at(i) = food.at(i) % 10;
        if (mod.at(i) == 0) {
            mod.at(i) = 10;
        }
    }
    sort(mod.begin(),mod.end());
    
    for (int i = 0; i < 5; i++) {
        if (mod.at(i) == 10) {
            mod.at(i) = 0;
            continue;
        }
        if (i == 0) {
            continue;
        }
        mod.at(i) = 10;
    }
    
    int sum = 0;
    for (int i = 0; i < 5; i++) {
        int buf = food.at(i) / 10;
        sum += buf * 10;
        sum += mod.at(i);
    }
    
    cout << sum << endl;
}


Measured memory_bytes: 256