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

using namespace std;

int main() {
    unsigned long long int x; cin >> x;
    unsigned long long ret = (x / 11) * 2, mod = x % 11;
    if (0 < mod && mod <=6) ret += 1;
    else if (6 < mod) ret += 2;
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG

long long int combination(long long int n, long long int r)
{
	//printf("n:%lld, r:%lld\n", n, r);
    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)

int memo[1000100];

int main(){
	int n;
	scanf("%d", &n);

	int count=0;
	for(int i=1; i<n; i++){
		int lim = pow(i, 0.5), tmpcount=0;
		for(int j=1; j<=lim; j++){
			if(i%j == 0){
				tmpcount++;
			}
		}
		count += tmpcount*2;
		if(lim*lim == i) count--;
	}
	
	printf("%d\n", count);
	
	return 0;
}



Measured memory_bytes: 2792
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.exe

int getrandom(int min,int max);

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

int n,d[110] = {},sum = 0;

cin >> n;

rep(i,n){
    cin >> d[i];
}

rep(i,n){
    for(int j = i+1;j < n;j++){

        sum += d[i]*d[j];

    }
}

cout << sum << endl;


//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
/* Filename: AGC005A.java
 * Author: Mushiyo
 */

import java.util.Scanner;
import java.util.Stack;

public class Main{

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

		while (input.hasNext()) {
			String X = input.next();
			Stack<Character> stack = new Stack<Character>();
			
			for(int i = 0; i < X.length(); ++i){
				if(stack.empty() == false){
					if(stack.peek() == 'S' && X.charAt(i) == 'T'){
						stack.pop();
					} else {
						stack.push(X.charAt(i));
					}
				} else {
					stack.push(X.charAt(i));
				}
			}
			
			System.out.println(stack.size());
		}
	}

}


Measured memory_bytes: 16168
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        int arr[] = new int[101];
        for(int i = 1; i <= 101; i++) {
            if((a % i == 0) && (b % i == 0)) {
                arr[i] = i;
            }
        }
        int count = 0;
        for(int i = 100; i >= 0; i--) {
            if(arr[i] > 0) {
                count++;
            }
            if(count == k) {
                System.out.println(i);
                break;
            }
        }
    }
}


Measured memory_bytes: 22868
N, D = map(int, input().split())
x_list = [ [int(i) for i in input().split()] for _ in range(N) ]


cnt = 0
for i in range(N-1):
  y = x_list[i]
  for j in range(i+1, N):
    z = x_list[j]
    d = (sum([ (y[k]-z[k])**2 for k in range(D) ])) ** 0.5
    if d % 1 == 0:
      cnt += 1
      
print(cnt)

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

const ll MOD = 1e9+7;

//verified KUPC2014-D,ABC034-C
//前処理O(n), クエリO(1)
ll power(ll a,ll b){
    ll ret=1;
    if(b>0){
        ret = power(a,b/2);
        if(b%2==0)ret = (ret*ret)%MOD;
        else ret = (((ret*ret)%MOD)*a)%MOD;
    }
    return ret;
}

vector<ll> fact,invfact;

void init(int n){
    fact.resize(n+1,1);
    invfact.resize(n+1,1);
    for(int i=2;i<=n;i++)fact[i] = (fact[i-1]*i)%MOD;
    
    invfact[n] = power(fact[n],MOD-2);
    for(int i=n-1;i>=1;i--) invfact[i] = (invfact[i+1]*(i+1))%MOD;
}


ll C(int n,int r){
    if(n<r)return 0;
    return ( ( fact[n]*invfact[r] )%MOD * invfact[n-r] )%MOD;
}


signed main(){
    init(200000);
    int n;
    cin>>n;
    vector<int> v(n+1);
    rep(i,n+1)cin>>v[i];
    rep(i,n+1)v[i]--;
    
    vector<int> d(n,0);
    rep(i,n+1)d[v[i]]++;
    int num = -1;
    rep(i,n)if(d[i]==2)num = i;
    int a=-1,b=-1;
    rep(i,n+1){
        if(v[i]==num){
            if(a==-1)a = i;
            else b = n-i;
        }
    }
    
    rep(i,n+1){
        cout<<(C(n+1,i+1) - C(a+b,i) + MOD)%MOD<<endl;
    }
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
const int INF=1e9;
int main(){
      int ans=0,a;
      REP(i,5){
            cin>>a;
            if(a<40)a=40;
            ans+=a/5;
      }
      cout<<ans<<endl;
}

Measured memory_bytes: 1160
n,s=map(int,input().split())
l=[abs(int(i)-s) for i in input().split()]
ans=l[0]
def gc(a,d):
  ai=a;bi=d
  a,d=min(ai,bi),max(ai,bi)
  if a==0:return d
  else:return gc(d%a,a)
  
  
for i in l:
  ans=gc(ans,i)
print(ans)

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

int main() {
  int n;
  cin >> n;
  vector<int> diameters(n);
  for (int i = 0; i < n; i++) {
      cin >> diameters[i];
  }
  sort(diameters.begin(), diameters.end(), greater<>());

  int mochi_step = 0;
  int prev_size = 0;
  for(int i = 0; i < n; i++) {
    if (prev_size == diameters.at(i)) continue;
    mochi_step++;
    prev_size = diameters.at(i);
  }

  cout << mochi_step << endl;
}


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

int main() {
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		for(int j = i + 1; j < n; ++j) {
			printf("%d ", __builtin_ctz(i ^ j) + 1);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
	#include<stdlib.h>
	#include<vector>
	#include<algorithm>
	#include<stdio.h>
	#include<string>
	#include<map>
	#include<math.h>
	#include<iomanip>
	#include<set>
	#include<limits.h>
	#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
	#define swap(a,b) a^=b;b^=a;a^=b;
	#define chmax(a,b) {if(a < b) a = b;}
	#define chmin(a,b) {if(a > b) a = b;}
	using namespace std;
	typedef long long ll;
	ll gcd(ll, ll);
	vector<bool> to_binary(int);
	int sum(vector<int>);
	int min(vector<int>);
	int max(vector<int>);
	ll nCr(ll n, ll r);

	const ll INF = 1LL << 60;

	ll N;
	vector<vector<ll>> abc;

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

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

		ll d_byC = (B / C - A / C) + ((A % C == 0) ? 1 : 0);
		ll d_byD = (B / D - A / D) + ((A % D == 0) ? 1 : 0);
		ll gc = (C * D) / gcd(C, D);
		//cout << gc << endl;
		ll d_byCD = (B / (gc) - A / (gc)) + ((A % (gc) == 0) ? 1 : 0);

		//cout << B / C - A / C + ((A % C == 0) ? 1 : 0) << endl;

		//cout << d_byC << endl;
		//cout << d_byD << endl;
		//cout << d_byCD << endl;

		cout << (B - A + 1) - (d_byC + d_byD - d_byCD) << endl;

		//cout << (B / C - A / C) << endl;
		//cout << (B / D - A / D) << endl;

		/*
		ll N, W;
		cin >> N >> W;

		vector<ll> w(N), v(N);

		rep(i, N) {
			cin >> w[i] >> v[i];
		}

		vector<vector<ll>> dp(N + 1);
		rep(i, N + 1) dp[i].resize(W + 1);

		for (int i = 0; i < N; i++) {
			for (int weight = 0; weight <= W; weight++) {
				if (weight - w[i] < 0) {
					chmax(dp[i + 1][weight], dp[i][weight]);
				}
				else chmax(dp[i + 1][weight], dp[i][weight - w[i]] + v[i]);
			}
		}

		/*
		rep(i, N + 1) {
			rep(j, W + 1) {
				cout << to_string(dp[i][j]) + " ";
			}
			cout << endl;
		}*

		cout << dp[N][W] << endl;

		*/

	ProgramEndPointLabel:;

		//Program End
		system("pause");

		return 0;
	}

	ll nCr(ll n, ll r) {
		ll res = 1;
		for (int i = 0; i < r; i++) {
			res *= (n - i);
		}
		for (int i = 1; i <= r; i++) {
			res /= i;
		}
		return res;
	}

	int vsum(vector<int> v) {
		int res = 0;
		for (auto it = v.begin(); it != v.end(); it++)
			res += *it;
		return res;
	}
	int vmin(vector<int> v) {
		int min = INT32_MAX;
		for (auto it = v.begin(); it != v.end(); it++)
			min = std::min(min, *it);
		return min;
	}
	int vmax(vector<int> v) {
		int max = 0;
		for (auto it = v.begin(); it != v.end(); it++)
			max = std::max(max, *it);
		return max;
	}

	ll gcd(ll A, ll B) {
		int r = A % B;
		while (r != 0) {
			A = B;
			B = r;
			r = A % B;
		}

		return B;
	}

	vector<bool> to_binary(int x) {
		vector<bool> res;
		while (x != 0) {
			res.push_back(x % 2);
			x /= 2;
		}
		return res;
	}


Measured memory_bytes: 504
#include<stdio.h>
#include<stdlib.h>

int compare(const void *a, const void *b){
	long long int *A = (long long int *)a;
	long long int *B = (long long int *)b;
	if (*A > *B) return 1;
	if (*A < *B) return -1;
	return 0;
}

int main(){
	long long N,i,ans=0;
	scanf("%lld",&N);
	long long A[N],sum[N+1];
	sum[0]=0;
	for(i=0;i<N;i++){
		scanf("%lld",&A[i]);
		sum[i+1]=0;
		sum[i+1]=sum[i]+A[i];
	}
	
	qsort(sum,N+1,sizeof(long long),compare);
	
	long long c=1;
	for(i=0;i<N;i++){
		if(sum[i]==sum[i+1])c++;
		else{
			ans+=c*(c-1)/2;
			c=1;
		}
	}
	ans+=c*(c-1)/2;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4860
#include<stdio.h>

int main(void){

	int A, B, C, D, cntt, cnta;

	scanf("%d %d %d %d", &A, &B, &C, &D);

	for(cntt = 0; A > 0 ;){
		A = A - D;
		cntt++;
	}

	for(cnta = 0; C > 0 ;){
		C = C - B;
		cnta++;
	}

	if(cntt >= cnta)
		printf("Yes");
	else
		printf("No");

	return 0;

}

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

const int P=1000000007;
int n,m;
long long dp[2][305][305];

int main(){
	scanf("%d%d",&n,&m);
	if(m<n)return puts("0"),0;
	dp[0][1][1]=1;
	for(int i=0;i<m;++i){
		memset(dp[i+1&1],0,sizeof dp[i+1&1]);
		for(int j=1;j<=n;++j)
			for(int k=1;k<=n;++k)
				if(dp[i&1][j][k]){
					(dp[i+1&1][j+1][k]+=dp[i&1][j][k]*(n-j))%=P;
					(dp[i+1&1][j][k]+=dp[i&1][j][k]*(j-k))%=P;
					(dp[i+1&1][j][j]+=dp[i&1][j][k]*k)%=P;
				}
	}
	printf("%lld\n",dp[m&1][n][n]);
}


Measured memory_bytes: 1664
from collections import deque

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

edge = [[] for i in range(N)]
ans = [0] * N
query = [0] * N

for i in range(N-1):
    a, b = map(int, input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

for q in range(Q):
    p, x = map(int, input().split())
    query[p-1] += x

is_visited = [False] * N
stack = deque([(0,0)])

while len(stack) != 0:
    cur, q = stack.pop()
    is_visited[cur] = True

    q = q + query[cur]
    ans[cur] += q

    for next in edge[cur]:
        if is_visited[next]:
            continue
        stack.append((next, q))

print(*ans)

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

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

    stack<char> st;
    string left="", right="";
    for(int i=0;i<n;++i){
        if(s[i] == '(')st.push('(');
        else{
            if(st.empty())left.push_back('(');
            else st.pop();
        }
    }
    while(!st.empty()){
        right.push_back(')');
        st.pop();
    }
    cout << left << s << right << endl;

    return 0;
}


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

L = list(map(int,input().split()))

L.sort()

for i in range(N-1):

    new = L[0] + L[1]
    new /= 2
    
    L = L[2:]
    L.append(new)
    L.sort()

print('{:.6f}'.format(L[0]))


Measured memory_bytes: 38384
/*
 * author Puneet;
 */
#include <bits/stdc++.h>
#define ll long long int
using namespace std;


int main() {

    int n;
    cin>>n;
    ll ar1[n],ar2[n],ar3[n];
    for(int i=0;i<n;i++)
    {
        cin>>ar1[i]>>ar2[i]>>ar3[i];
    }
    bool chek=true;
    if(ar1[0]<(ar2[0]+ar3[0])) {
        chek = false;
     //   cout<<"1";
    }
    for(int i=1;i<n;i++)
    {
        if(!chek)
            break;
        if(ar1[i]<(ar2[i]+ar3[i]))
        {
            chek = false;
       //     cout<<"2";
        }
        ll dt=ar1[i]-ar1[i-1];
        ll dx=ar2[i]-ar2[i-1];
        ll dy =ar3[i]-ar3[i-1];
        if(dt<(dx+dy))//TODO
        {
            chek = false;
       //     cout<<"3";
        }
        if((abs(dt)%2)!=(abs(dx+dy)%2))
        {
       //     cout<<dt<<" "<<dx<<" "<<dy;
            chek = false;
         //   cout<<"4";
        }
    }

    if(chek)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
} 

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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
#define dbg(x) cerr << #x"= " << x << endl

std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

int main() {
    READ(0);
    int n;cin>>n;
    string s[n];
    int t[n];
    FOR(i,n) cin>>s[i] >> t[i];
    string x;cin>>x;
    int i=0;while(s[i]!=x) ++i;
    int ret=0;
    while(++i<n) ret += t[i];
    cout << ret;
    return 0;
}



Measured memory_bytes: 256
n = int(input())
a = [0 for _ in range(10050)]
for i in range(1, 105):
    for j in range(1, 105):
        for k in range(1, 105):
            v = i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i
            if(v < 10050):
                a[v] += 1
for i in range(n):
    print(a[i + 1])

Measured memory_bytes: 9368
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ARC091C {
    class Program {
        static void Main(string[] args) {
            int[] input = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = input[0];
            int A = input[1];
            int B = input[2];
            int lowAnum = (N + B - 1) / B;
            int highAnum = N - B + 1;
            bool ok = true;
            if (A < lowAnum || highAnum < A) {
                ok = false;
            }
            if (ok) {
                int point = 0;
                bool mark = true;
                for (int i = 0; i < lowAnum; i++) {
                    for (int j = 1; j <= B; j++) {
                        int k = i * B + j;
                        if (N - k + (i + 1) == A) {
                            point = k;
                            mark = false;
                            break;
                        }
                    }
                    if (!mark) {
                        break;
                    }
                }
                int[] ans = new int[N];
                int bnum = B;
                int varnum = B;
                int first = B - (point % B);
                int second = B - first;
                int third = N - point;
                int pointer = 0;
                for (int i = 0; i < first; i++) {
                    for (int j = 0; j < (point / B); j++) {
                        ans[pointer] = varnum;
                        varnum += B;
                        pointer++;
                    }
                    bnum--;
                    varnum = bnum;
                }
                for (int i = 0; i < second; i++) {
                    for (int j = 0; j < (point / B) + 1; j++) {
                        ans[pointer] = varnum;
                        varnum += B;
                        pointer++;
                    }
                    bnum--;
                    varnum = bnum;
                }
                for(int i = 0; i < third; i++) {
                    ans[pointer] = point + i + 1;
                    pointer++;
                }
                Console.WriteLine(string.Join(" ", ans));
            } else {
                Console.WriteLine(-1);
            }
        }
    }
}


Measured memory_bytes: 31832
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const ll mod = 1e9 + 7;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
const int IMAX = 200000;
ll fac[IMAX + 1], ifac[IMAX + 1], inv[IMAX + 1];
inline ll comb(int A, int B) {
	return fac[A] * ifac[B] % mod * ifac[A - B] % mod;
}

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


	int N;
	cin >> N;
	int X[100000];
	rep(i, N) cin >> X[i];
	for (int i = N - 1; i > 0; i--) {
		X[i] = X[i] - X[i - 1];
	}

	fac[0] = 1;
	rep1(i, IMAX) fac[i] = fac[i - 1] * i % mod;
	ifac[IMAX] = modpow(fac[IMAX], mod - 2);
	for (int i = IMAX; i > 0; i--) ifac[i - 1] = ifac[i] * i % mod;
	inv[0] = 1;
	rep1(i, IMAX) inv[i] = ifac[i] * fac[i - 1] % mod;

	ll are[200000];
	are[0] = 0;
	rep1(i, N) {
		are[i] = (are[i - 1] + inv[i]) % mod;
	}


	ll kari = 0;
	rep1(i, N - 1) {
		ll tmp = are[i];
		kari += tmp * X[i] % mod;
	}
	kari %= mod;
	rep1(i, N - 1) {
		kari *= i;
		kari %= mod;
	}

	co(kari);



	Would you please return 0;
}

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

int main() {
  string 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>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

ll nl, nm;

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

  string a, b;
  cin >> a >> b;
  
  a += b;

  int v = stoi(a);

  //cout << sqrt(v) << " " << v << endl;
  
  if(floor(sqrt(v))*floor(sqrt(v)) == v) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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

using namespace std;

const int maxN = 1e5;

int a, b;

int h = 0;

string res;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
    cin >> a >> b;
    while (a >= 50)
    {
        for (int i = 0; i < 50; ++i)
        {
            res += ".#";
        }
        res += '\n';
        ++h;
        res += ".";
        for (int i = 0; i < 99; ++i)
        {
            res += "#";
        }
        res += '\n';
        ++h;
        a -= 49;
    }
    --a;
    res += ".";
    for (int i = 0; i < 100 - a * 2 - 1; ++i)
    {
        res += "#";
    }
    for (int i = 0; i < a; ++i)
    {
        res += ".#";
    }
    res += '\n';
    ++h;
    res += '.';
    for (int i = 0; i < 99; ++i)
    {
        res += '#';
    }
    res += '\n';
    ++h;
    for (int i = 0; i < 100; ++i)
    {
        res += '.';
    }
    res += '\n';
    ++h;
    --b;
    while (b >= 50)
    {
        for (int i = 0; i < 50; ++i)
        {
            res += ".#";
        }
        res += '\n';
        ++h;
        for (int i = 0; i < 100; ++i)
        {
            res += '.';
        }
        res += '\n';
        ++h;
        b -= 50;
    }
    for (int i = 0; i < 100 - b * 2; ++i)
    {
        res += '.';
    }
    for (int i = 0; i < b; ++i)
    {
        res += ".#";
    }
    cout << ++h << " 100\n";
    cout << res << '\n';
    return 0;
}


Measured memory_bytes: 256
//***The night is the darkest just before the dawn***
 
#include<bits/stdc++.h>
using namespace std;
 
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
 
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef long double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main()
{
	ll h,w,n;
	cin>>h>>w>>n;

	if(h<w) swap(h,w);
	cout<<ceil((double)n/(double)h);
}

Measured memory_bytes: 256
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

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

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

ll N, M;
ll ans = 1;

int main() {
	cin >> N >> M;
	//Mの約数を列挙して、昇順に並べたi番目をaiとしたときにM / ai >= Nを満たす最大のiをインデックスとしたaiが答え
	for (ll i = 1; i * i <= M; i++) {
		if (M % i != 0) continue;
		ll j = M / i;
		if (N <= M / i) ans = max(ans, i);
		if (N <= M / j) ans = max(ans, j);
	}
	cout << ans << endl;
//	REP(i, j) cout << a[i] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main()
{
    int n,m; cin>>n;
    vector<double>p(n);
    for(int i=0;i<n;i++) {cin>>p[i];}
    m=(n+1)/2;
    double dp[n+1][m+1];//probability of getting atleast m heads from n coins 
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(j==0) {dp[i][j]=1; continue;}
            if(i==0) {dp[i][j]=0; continue;}
            dp[i][j]=p[i-1]*dp[i-1][j-1]+(1-p[i-1])*dp[i-1][j];
            //cout<<p[i-1]*dp[i-1][j-1]<<" ";
        }
    }
    // for(int i=0;i<=n;i++)
    // {
    //     for(int j=0;j<=m;j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<fixed<<setprecision(10)<<dp[n][m];
}

Measured memory_bytes: 35456
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

const lint MOD = pow(10, 9) + 7;

/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/


int main() {
	int N, K;
	cin >> N >> K;
	if ((N + 1) / 2 >= K) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}


Measured memory_bytes: 256
/// Thank you tanakh!!!
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

const MOD: usize = 1e9 as usize + 7;

fn main() {
    input!(n: usize, m: usize);
    let mut m = m;
    let mut divisors = vec![];
    for i in 2.. {
        if m % i == 0 {
            let mut count = 0;
            while m % i == 0 {
                m /= i;
                count += 1;
            }
            divisors.push((i, count));
        }
        if i * i > m {
            break;
        }
    }
    if m != 1 {
        divisors.push((m, 1));
    }

    let comb = Combination::new(1000000, MOD);

    let mut ans = 1;
    for &(_, count) in divisors.iter() {
        ans *= comb.get(n + count - 1, count);
        ans %= MOD;
    }
    println!("{}", ans);
}

pub struct Combination {
    fact: Vec<usize>,
    inv_fact: Vec<usize>,
    modulo: usize,
}

impl Combination {
    pub fn new(max: usize, modulo: usize) -> Combination {
        let mut inv = vec![0; max + 1];
        let mut fact = vec![0; max + 1];
        let mut inv_fact = vec![0; max + 1];
        inv[1] = 1;
        for i in 2..(max + 1) {
            inv[i] = inv[modulo % i] * (modulo - modulo / i) % modulo;
        }
        fact[0] = 1;
        inv_fact[0] = 1;
        for i in 0..max {
            fact[i + 1] = fact[i] * (i + 1) % modulo;
        }
        for i in 0..max {
            inv_fact[i + 1] = inv_fact[i] * inv[i + 1] % modulo;
        }
        Combination {
            fact: fact,
            inv_fact: inv_fact,
            modulo: modulo,
        }
    }

    pub fn get(&self, x: usize, y: usize) -> usize {
        assert!(x >= y);
        self.fact[x] * self.inv_fact[y] % self.modulo * self.inv_fact[x - y] % self.modulo
    }
}


Measured memory_bytes: 28924
function Main (input) {
	var inputArr = input.split(' ');
	var sNum = Number(inputArr[0]);
	var cNum = Number(inputArr[1]);
	var result = 0;
	// Sを使う組み合わせ
	if (sNum > (cNum/2)) {
		result += Math.floor(cNum/2);
	} else {
		result += sNum;
		cNum -= result * 2;
		result += Math.floor(cNum/4)
	}
	console.log(result);
}
// Main("12345 678901");
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [usize; n],
    }

    let mut set = std::collections::HashSet::new();

    for x in a {
        if set.get(&x).is_some() {
            set.remove(&x);
        } else {
            set.insert(x);
        }
    }

    println!("{}", set.len());
}


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

using namespace std;

int main()
{
    int N;
    vector<int> A, B, Ans;
    
    cin >> N;
    A.resize(N);
    for(int i = 0; i < N; ++i)
      cin >> A[i];
    
    cin >> N;
    B.resize(N);
    for(int i = 0; i < N; ++i)
      cin >> B[i];
      
      
    set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(Ans, Ans.end()));
    
    for(auto x : Ans)
      cout << x << endl;
    
    return 0;
}


Measured memory_bytes: 6476
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
	int n;
	cin>>n;
	int a[n],b[n],c[n];
	for(int i = 0; i < n; i++){
		cin>>a[i]>>b[i]>>c[i];
		
	}
	int dp[n][3];
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];
	for(int i = 1; i < n; i++){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2])+a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2])+b[i];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1])+c[i];
	}
	cout<<max(dp[n-1][0], max(dp[n-1][1] , dp[n-1][2]));
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define all(v) v.begin(), v.end()
using pint = pair<int, int>;
using tint = tuple<int, int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 30;

int main() {
	int N, M, X;
	cin >> N >> M >> X;
	vector<int> v(N);
	vector<vector<int>> vv(N, vector<int>(M));
	rep(i, N) {
		cin >> v.at(i);
		rep(j, M) {
			cin >> vv.at(i).at(j);
		}
	}

	int a=INF, b=0, c=0, x, y, z;
	bool ok = false;
	for (int i = 0; i < (1 << N); i++) {
		y = 0;
		bool flag = true;
		bitset<12> bits(i);
		vector<int> t(M);
		rep(j, N) {
			if (!bits.test(j))
				continue;
			rep(k, M) {
				t.at(k) += vv.at(j).at(k);
			}
			y += v.at(j);
		}

		rep(k, M) {
			if (t.at(k) < X)
				flag = false;
		}
		if (!flag)
			continue;

		chmin(a, y);
		ok = true;
	}

	if (!ok)
		std::cout << "-1" << '\n';
	else
		std::cout << a << '\n';
}


Measured memory_bytes: 3644
#include <stdio.h>

int main(void) {
    int n, i, min, ans;
    scanf("%d", &n);
    int p[n];
    min = n + 1; ans = 0;

    for (i = 0; i < n; i++) {
        scanf("%d", &p[i]);
        if (min >= p[i]) {
            min = p[i];
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
int main(){
  int n;
  cin >> n;
  cout << n*800-(n/15)*200 << endl;  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pi pair<ll,int> 
#define pii pair<int,ll>
 
ll mod = 1e9+7;
ll INF = 1e17;
/*ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}*/
int main()
{
    IOS
    ll n,m;
    cin>>n>>m;
    ll x=ceil((n*25)/(2.0));
    ll c1=ceil((25*(n+1))/2.0);
    ll flag=0,ans;
    for(ll i=x;i<c1;i++)
    {
        if(floor(i/10.0)==m)
        {
            flag=1;
            ans=i;
            break;
        }
    }
    if(flag==0)
    cout<<-1<<endl;
    else
    cout<<ans;
    return(0);
}


Measured memory_bytes: 256
from bisect import bisect_left
A, B, Q = map(int, input().split())
minf, inf = -(10**18), 10**18
jinja = [minf] + [int(input()) for _ in range(A)] + [inf]
tera = [minf] + [int(input()) for _ in range(B)] + [inf]
ans = []
append = ans.append

for q in [int(input()) for _ in range(Q)]:
    i = bisect_left(jinja, q)
    j = bisect_left(tera, q)
    left_jinja, right_jinja = q-jinja[i-1], jinja[i]-q
    left_tera, right_tera = q-tera[j-1], tera[j]-q
 
    append(min(
        left_jinja if left_jinja > left_tera else left_tera,
        left_jinja + right_tera + (left_jinja if left_jinja < right_tera else right_tera),
        right_jinja + left_tera + (right_jinja if right_jinja < left_tera else left_tera),
        right_jinja if right_jinja > right_tera else right_tera
    ))
 
print(*ans, sep="\n")

Measured memory_bytes: 19140
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0); 
	int N; cin >> N; 
	int A[1000010] = {}; 
	bool D[1000010] = {}; 
	for(int i = 0; i < N; i++){
		int a; cin >> a; 
		A[a] ++; 
	}
	for(int i = 1; i <= 1000000; i++){
		if(A[i] == 0) continue; 
		for(int k = 1; i * k <= 1000000; k++){
			if(k == 1 && A[i] >= 2) D[i] = true; 
			else if(k >= 2) D[i * k] = true; 
		}
	}
	int ans = 0; 
	for(int i = 1; i <= 1000000; i++){
		if(!D[i]) ans += A[i]; 
	}
	cout << ans << "\n"; 
}

Measured memory_bytes: 8536
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

bool dfs(int node, vector<Pin> r[], unordered_map<int, int> &coor) {
    bool flag = true;

    REP(i, r[node].size()) {
        Pin p = r[node][i];

        int next = p.fi;
        int d = p.se;

        if (coor.find(next) == coor.end()) {
            coor[next] = coor[node] + d;
            flag &= dfs(next, r, coor);
        } else {
            if (coor[next] != coor[node] + d) {
                flag = false;
            }
        }

        if (!flag) return false;
    }

    return true;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, M;
    cin >> N >> M;

    vector<Pin> R[N];
    REP(i, M) {
        int l, r, d;
        cin >> l >> r >> d;
        --l; --r;

        R[l].pb({r, d});
        R[r].pb({l, -d});
    }

    unordered_map<int, int> coor;
    bool f = true;
    REP(i, N) {
        if (coor.find(i) == coor.end()) {
            coor[i] = 0;
            f &= dfs(i, R, coor);
        }

        if (not f) break;
    }

    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;
    
}


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

A = list(map(int,input().split()))
maxL = 0
superM = 0
lasta = -1
for a in A:
    if lasta >= a:
        maxL += 1
        if maxL > superM:
            superM = maxL
    else:
        maxL = 0
    lasta = a
print(superM)


Measured memory_bytes: 14252
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] line1 = line.split(" ");
        int k = Integer.parseInt(line1[0]);
        int x = Integer.parseInt(line1[1]);
        for(int i = x - k + 1; i <= x + k - 1; i++) System.out.print(i + " ");
    }
}

Measured memory_bytes: 21844
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
const long long INF=1e18;
struct Graph{
	struct Edge{
		int v;
		int c;
		long long cost;
		int nxt;
	}e[100010];int tot;
	int first[1010];
	void build(int u,int v,int c,long long cost)
	{
		e[++tot]=(Edge){v,c,cost,first[u]};
		first[u]=tot;
		return ;
	}
	void adde(int u,int v,int c,long long cost)
	{
		build(u,v,c,cost);
		build(v,u,0,-cost);
		return ;
	}
	void reset()
	{
		memset(first,0,sizeof(first));
		tot=1;
		return ;
	}
	long long dis[1010];
	int pren[1010],pree[1010];
	bool book[1010];
	int S,T;
	bool spfa()
	{
		queue<int>q;
		for(int i=S;i<=T;i++)
			dis[i]=-INF;
		book[S]=true;
		dis[S]=0;
		q.push(S);
		while(!q.empty())
		{
			int u=q.front();
			q.pop();book[u]=false;
			for(int i=first[u];i;i=e[i].nxt)
				if(e[i].c&&dis[u]+e[i].cost>dis[e[i].v])
				{
					dis[e[i].v]=dis[u]+e[i].cost;
					pren[e[i].v]=u;
					pree[e[i].v]=i;
					if(!book[e[i].v])
					{
						book[e[i].v]=true;
						q.push(e[i].v);
					}
				}
		}
		return dis[T]>-INF;
	}
	long long solve()
	{
		long long ans=0;
		while(spfa())
		{
			ans+=dis[T];
			for(int i=T;i!=S;i=pren[i])
			{
				int ee=pree[i];
				e[ee].c--;
				e[ee^1].c++;
			}
		}
		return ans;
	}
}G;
int n,m;
int l[110],r[110],d[110],u[110];
int L[81],R[81],D[81],U[81];
int x[81],y[81];
long long v[81];
long long solve(int k)
{
	G.reset();
	for(int i=1;i<=k;i++)
		L[i]=D[i]=1,R[i]=U[i]=100;
	for(int i=1;i<=100;i++)
	{
		//l
		if(l[i]+1<=k)L[l[i]+1]=max(L[l[i]+1],i+1);
		//d
		if(d[i]+1<=k)D[d[i]+1]=max(D[d[i]+1],i+1);
		//r
		if(k-r[i]>0)R[k-r[i]]=min(R[k-r[i]],i-1);
		//u
		if(k-u[i]>0)U[k-u[i]]=min(U[k-u[i]],i-1);
	}
	for(int i=2;i<=k;i++)
		L[i]=max(L[i],L[i-1]),
		D[i]=max(D[i],D[i-1]);
	for(int i=k-1;i>=1;i--)
		R[i]=min(R[i],R[i+1]),
		U[i]=min(U[i],U[i+1]);
	G.S=0;G.T=k+n+n+k+1;
	for(int i=1;i<=k;i++)
	{
		G.adde(G.S,i,1,0);
		G.adde(k+n+n+i,G.T,1,0);
	}
	for(int i=1;i<=n;i++)
	{
		G.adde(k+i,k+n+i,1,v[i]);
		for(int j=1;j<=k;j++)
		{
			if(L[j]<=x[i]&&x[i]<=R[j])
				G.adde(j,k+i,1,0);
			if(D[j]<=y[i]&&y[i]<=U[j])
				G.adde(k+n+i,k+n+n+j,1,0);
		}
	}
	return G.solve();
}
char s[5];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d %d %lld",&x[i],&y[i],&v[i]);
	for(int i=1;i<=100;i++)
		l[i]=r[i]=u[i]=d[i]=n;
	scanf("%d",&m);
	for(int i=1;i<=m;i++)
	{
		scanf("%s",s);
		int a,b;scanf("%d %d",&a,&b);
		if(s[0]=='L')l[a]=min(l[a],b);
		if(s[0]=='R')r[a]=min(r[a],b);
		if(s[0]=='D')d[a]=min(d[a],b);
		if(s[0]=='U')u[a]=min(u[a],b);
	}
	long long ans=0;
	for(int i=1;i<=n;i++)
		ans=max(ans,solve(i));
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 768
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int nax = 1e5 + 5;
vector<int> edges[nax];

const int mod = 1e9 + 7;
int mul(int a, int b) {
    return (ll) a * b % mod;
}

// returns a pair {black, white}
pair<int,int> dfs(int a, int parent) {
    int all_white = 1; // means: my vertex can be painted black
    int sth_is_black = 0;
    for(int b : edges[a]) {
        if(b != parent) {
            pair<int,int> p = dfs(b, a);
            // p.first is the number of ways to color the subtree
            // such that 'b' is black
            int memo_all_white = all_white;
            all_white = mul(all_white, p.second);
            sth_is_black = (mul(memo_all_white, p.first)
                + mul(sth_is_black, p.first + p.second)) % mod;
        }
    }
    return make_pair(all_white, (all_white + sth_is_black) % mod);
}

int main() {
    int n;
    scanf("%d", &n);
    for(int i = 0; i < n - 1; ++i) {
        int a, b;
        scanf("%d%d", &a, &b);
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    pair<int,int> p = dfs(1, -1);
    int answer = (p.first + p.second) % mod;
    printf("%d\n", answer);
}

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

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

int main(int argc, char **argv)
{
	ll N; cin >> N;
	ll T, A; cin >> T >> A;

	auto f = [](ll a, ll b)
			 {
				 return (a/b + (a % b != 0));
			 };


	REP(i, N-1)
	{
		ll t, a; cin >> t >> a;
		ll n = max(f(T, t), f(A, a));
		T = t*n;
		A = a*n;
		// std::cout << "n : " << n << std::endl;
		// std::cout << "A : " << A << "\tB : " << T << std::endl;
	}

	std::cout << T + A << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

	ll H, N;
	cin >> H >> N;

	ll A = 0;
	for (ll i = 0; i < N; ++i)
	{
		ll t;
		cin >> t;
		A += t;
	}

	if (A >= H)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	//system("pause");
}


Measured memory_bytes: 256
n, m = map(int, input().split())
votes = list(map(int, input().split()))
total_votes = sum(votes)
border = total_votes / (4 * m)

count = 0
for a in votes:
    if a < border:
        continue
    count += 1

if count >= m:
    print('Yes')
else:
    print('No')

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

int val[1000003] , N; char str[1000003];

int main(){
	scanf("%d %s" , &N , str + 1); bool flg = 1;
	for(int i = 1 ; i < N ; ++i) flg &= (val[i] = abs(str[i] - str[i + 1])) != 1;
	if(flg) for(int i = 1 ; i < N ; ++i) val[i] >>= 1;
	int sum = 0; for(int i = 1 ; i < N ; ++i) sum ^= (((N - 2) & (i - 1)) == i - 1) & val[i];
	cout << (sum << flg); return 0;
}


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

int main(){
  int n,a;
  cin >> n >> a;
  if(n%500 <= a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
na = lambda: list(map(int, stdin.readline().split()))
ni = lambda: int(ns())

a = ni()
b = ni()

x = min(a, b)
y = max(a, b)

if x == 1 and y == 3:
    print(2)
elif x == 1 and y == 2:
    print(3)
elif x == 2 and y == 3:
    print(1)


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main(){
  int N, M, C, i, j, sum, ans=0;
  cin >> N >> M >> C;
  int B[M], A[N][M];
  for(i=0; i<M; i++) cin >> B[i];
  for(i=0; i<N; i++) for(j=0; j<M; j++) cin >> A[i][j];
  for(i=0; i<N; i++){
    sum = 0;
    for(j=0; j<M; j++){
      sum += A[i][j]*B[j];
    }
    if(sum + C > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256