akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b)
{
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s)
{
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v)
{
	forl(i,v.size())
	{
		cout<<v[i]<<" ";
	}
	cout<<"\n";
}
void pa(ll *v,ll size)
{
	forl(i,size)
	{
		cout<<v[i]<<" ";
	}
	cout<<"\n";
}
// ll facs[], facsinv[];
// ll nck(ll N,ll K,ll mod)
// {
// 	if(N<K)
// 	{
// 		return 0;
// 	}
// 	return (((facs[N]*facsinv[N-K])%mod)*facsinv[K])%mod;
// }
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
inline bool isSqr(ll x) {
	ll sqr = sqrt(x);
	return (sqr * sqr == x);
}
ll power(ll x,ll y,ll p)
{
	ll res=1;
	x=x%p;
	while(y>0)
	{
		if(y&1)
		{
			res=(res*x)%p;
		}
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x,ll mod)
{
	if(x>=mod)
	{
		x%=mod;
	}
}
ll ncr(ll n, ll r, ll mod) {
	ll ans = 1;
	forl(i,min(r,n - r)) {
		ans *= n - i;
		checkmod(ans,mod);
		ans *= power(i+1, mod - 2,mod);
		checkmod(ans,mod);
	}
	return ans;
}
ll sumofgp(ll a,ll n,ll m)
{
	// n = number of terms - 1
	if(n<0)
	{
		return 0;
	}
	if(n==0)
	{
		return 1;
	}
	if(n==1)
	{
		return (1+a)%m;
	}
	ll ans;
	if(n%2)
	{
        ans=(1+a)*sumofgp((a*a)%m,(n-1)/2,m);
	}
    else
    {
        ans=1+((a*(1+a))%m)*sumofgp((a*a)%m,n/2-1,m);
    }
    return ans%m;
}
ll power_of_2_not_less(ll n)
{
	if(!n)
	{
		return 1;
	}
	n--;
	n |= n>>1;
	n |= n>>2;
	n |= n>>4;
	n |= n>>8;
	n |= n>>16;
	n |= n>>32;
	n++;
	return n;
}
ll mod = 1e9 + 7;
// void checktime()
// {
// 	struct timespec ts;
// 	printf("Running Program\n");
// 	clock_gettime(CLOCK_MONOTONIC_RAW,&ts);
// 	long double st=ts.tv_nsec/(1e9)+ts.tv_sec;
// 	// Call Funcn Here
// 	clock_gettime(CLOCK_MONOTONIC_RAW,&ts);
// 	long double en=ts.tv_nsec/(1e9)+ts.tv_sec;
// 	printf("Program ended\nTime = %Lf\n",en-st);
// }

void thisIsMain() {
	ll arr[5];
	forl(i,5) cin>>arr[i];
	forl(i,5) if(arr[i] ==0 ) {
		cout<<i + 1<<"\n";
		return ;
	}
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int x,y,z;
    cin >> x >> y >> z;
    cout << z << ' ' <<  x << ' ' << y;

    return 0;
}

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

def f(x):
    if x % 2 == 0:
        return x/2
    else:
        return 3*x + 1
d = dict()
d[s] = True
i = 2
while f(s) not in d:
    i += 1
    s = f(s)
    d[s] = True
print(i)

Measured memory_bytes: 2940
def get_nums
  gets.split.map(&:to_i)
end

def init_matrix(row_num, row_length, default = nil)
  Array.new(row_num).map { Array.new(row_length, default) }
end

n, m = get_nums
if n == m
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 1788
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const long long SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long>dij;
struct edge { long long to, cost; };
vector<vector<edge> >G;

long long mod_pow(long long a, long long b) {
	long long res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

//↑template↑





int main() {

	int n;
	cin >> n;
	vector<pair<string, pair<int, int>>>v(n);
	for (int i = 0; i < n; ++i) {
		cin >> v[i].first >> v[i].second.first;
		v[i].second.first = 100 - v[i].second.first;
		v[i].second.second = i + 1;
	}
	sort(all(v));
	for (int i = 0; i < n; ++i) {
		cout << v[i].second.second << endl;
	}






}

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

int main(){
int n,b[100000],f[100000],r[100000],v[100000];
int A[5][4][11];

for(int i=1;i<5;i++){
for(int j=1;j<4;j++){
for(int k=1;k<11;k++){
A[i][j][k]=0;
}
}
}

cin>>n;
for(int i=1;i<=n;i++){
cin>>b[i]>>f[i]>>r[i]>>v[i];
A[b[i]][f[i]][r[i]] += v[i];
}

for(int i=1;i<=4;i++){
for(int j=1;j<=3;j++){
for(int k=1;k<=10;k++){
cout<<" "<<A[i][j][k];
}
cout<<endl;
}
if(i!=4){
cout<<"####################"<<endl;
}
}

return 0;
}



Measured memory_bytes: 3108
N, X = map(int, input().split())
L =list( map(int, input().split()))
D = 0
d = 0
for i in range(2, N+2):
  D = D + L[i-2]
  if D>X:
    print(i-1)
    d = 1
    break
if d == 0:
  print(N+1)

Measured memory_bytes: 3064
import java.io.*;

public class Main {
	public static void main(String[] args) {
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		String line;
		try {
			line = buf.readLine();
			double r = Double.parseDouble(line);
			System.out.printf("%.6f %.6f", Math.PI*r*r, 2*Math.PI*r);
		} catch (IOException e) {
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 16924
#include <stdio.h>

int main() {
  int n, k, i;
  char s[55];

  scanf("%d %d", &n, &k);
  scanf("%s", s);

  s[k-1] -= 'A';
  s[k-1] += 'a';

  printf("%s\n", s);

  return 0;
}

Measured memory_bytes: 128
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
mod = 10 ** 9 + 7
s = int(input())
ans = 0
for i in range(1, (s // 3) + 1):
    v = s - (i * 3)
    if v >= 0:
        ans += combinations_count(i + v - 1, i - 1)
        ans = ans % mod
print(ans)    

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  int maximum=0;
  for(int i=0;i<K;i++){
    if(i<A){
      maximum++;
    }else if(i>=A+B){
      maximum--;
    }
  }
  cout << maximum << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;


int main(){
	int n, m, x, a[100],way1,way2;
	way1 = 0; way2 = 0;
	cin >> n >> m >> x;

	for (int i = 0; i < m; i++) {
		cin >> a[i];
		if (a[i] > x) ++way1;
		else ++way2;
	}

	if (way1 > way2) cout << way2 << endl;
	else cout << way1 << endl;

	return 0;
}

Measured memory_bytes: 256
from math import gcd


# def sieve(n):
#     is_prime = [1 for _ in range(n + 1)]
#     is_prime[0] = 0
#     is_prime[1] = 0

#     for i in range(2, n + 1):
#         if is_prime[i]:
#             j = i + i
#             while j <= n:
#                 is_prime[j] = 0
#                 j += i

#     return is_prime


def factorization(n):
    from collections import Counter
    arr = Counter()
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt

    if temp != 1:
        arr[temp] = 1

    if len(arr.keys()) == 0 and n != 1:
        arr[n] = 1

    return arr


N = int(input())
A = list(map(int, input().split()))

# setwise
tmp = 0
for a in A:
    tmp = gcd(tmp, a)
isSetwise = (tmp == 1)


# pairwise
M = 10 ** 6
sieve = [0] * (M + 1)
for a in A:
    if sieve[a] == 1:
        isPairwise = False
        break
    else:
        arr = factorization(a)
        for p in arr.keys():
            np = p
            while np <= M:
                sieve[np] = 1
                np += p
else:
    isPairwise = True

# check
if isPairwise:
    ans = 'pairwise coprime'
elif isSetwise:
    ans = 'setwise coprime'
else:
    ans = 'not coprime'
print(ans)


Measured memory_bytes: 205012
#include<iostream>
using namespace std;
int main()
{
int a[100],n,max=-100000000,min=100000000;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];}
cout<<max-min;

return 0;
}


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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-14);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

int main(){
    fIO

    long double a, b, c;
    cin >> a >> b >> c;

    long double sum = sqrtl(a) + sqrtl(b);

    if(sum + EPS < sqrtl(c)) cout << "Yes\n";
    else cout << "No\n";

}








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

int main(){
    string w;
    cin >> w;
    string ans="No";
    if(w.size()%2==0){
        sort(w.begin(),w.end());
        ans="Yes";
        for(int i=0;i<w.size();i+=2){
            if(w.at(i)!=w.at(i+1)){
                ans="No";
                break;
            }
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()

using LL = long long;
int vis[100005];
vector <int> ans;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
	return getchar();
//    if (ib == ie) {
//        ib = ibuf;
//        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
//    }
//    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

using P = pair<int,int> ;
vector<vector<P> > g(100005 + 1);
int b[100005];
#define fi first
#define se second

void dfs(int x)
{
	vis[x]=1;
	for(auto u:g[x])
	{
		if(vis[u.first]) continue;
		dfs(u.first);
		if(b[u.first])
		{
			ans.push_back(u.second);
			b[u.first]^=1;
			b[x]^=1;
		}
	}
}

int main() {
    int n = read();
    int m = read();
    vector<P> bomb;
    vector <int> lsh;
    for (int i = 0; i < n; ++i) {
        int a = read(), b = read();
        bomb.emplace_back(a, b);
		lsh.push_back(a);
    }
	sort(all(lsh));
    sort(begin(bomb), end(bomb));
    for(int i=0;i<n;i++)
    {
    	b[i]=bomb[i].second;
	}
	for(int i=n;i>=0;i--)
	{
		b[i]^=(i?b[i-1]:0);
	}
    for (int i = 1; i <= m; ++i) {
    	int l,r;
		cin>>l>>r;
		l=lower_bound(all(lsh),l)-lsh.begin();
		r=upper_bound(all(lsh),r)-lsh.begin();
		g[l].push_back(make_pair(r,i));
		g[r].push_back(make_pair(l,i));
    }
    
	for(int i=0;i<=n;i++)
	{
		if(vis[i]) continue;
		dfs(i);
		if(b[i])
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	sort(all(ans));
	cout<<ans.size()<<endl;
	for(auto x:ans)
	{
		printf("%d ",x);
	}
	cout<<endl;
    return 0;
}


Measured memory_bytes: 14964
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define SIZE(a) int((a).size();
const int INF=INT_MAX;
const int dx[5]={-1,0,0,0,1};
const int dy[5]={0,-1,0,1,0};
int main(){
  int n,i;cin>>n>>i;
  cout<<n-i+1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int a[200002], b[200002];
long long dp[52];
vector<pii> p;
vector<int> x;
bool cmp(pii p1, pii p2){
    return p2.first*1ll*p1.second + p2.first < p1.first*p2.second + p1.first;
}
int main(){
    int n, t;
    scanf("%d%d", &n, &t);
    x.emplace_back(0);
    for(int i=1;i<=n;i++){
        scanf("%d%d", &a[i], &b[i]);
        if(a[i] >= 1) p.emplace_back(pii(a[i], b[i]));
        else x.emplace_back(b[i]+1);
    }
    sort(x.begin(), x.end());
    sort(p.begin(), p.end(), cmp);
    for(int i=0;i<=50;i++) dp[i] = 2e9;
    dp[0] = 0;
    for(int i=0;i<p.size();i++){
        int a = p[i].first, b = p[i].second;
        for(int j=50;j>=0;j--){
            if(dp[j] == 2e9) continue;
            long long T = dp[j]+1;
            T = T + a*1ll*T + b;
            if(T > t) continue;
            dp[j+1] = min(dp[j+1], T);
        }
    }
    int ans = 0;
    for(int i=0;i<=50;i++){
        if(dp[i] > t) continue;
        ans = max(ans, i);
        int sum = dp[i];
        for(int j=1;j<x.size();j++){
            sum += x[j];
            if(sum > t) break;
            ans = max(ans, i+j);
        }
    }
    printf("%d\n", ans);
}

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

using pii=pair<int,int>;
using ppp=pair<pii,pii>;

int main(){
    int n;
    cin>>n;
    vector<int> h(n),w(n);
    for(int i=0;i<n;i++){
        cin>>h[i]>>w[i];
    }
    vector<string> c(4);
    for(int i=0;i<4;i++) cin>>c[i];
    vector<vector<int>> tar(4,vector<int>(4));
    for(int i=0;i<4;i++){
        for(int j=0;j<4;j++){
            if(c[i][j]=='R') tar[i][j]=0;
            if(c[i][j]=='G') tar[i][j]=1;
            if(c[i][j]=='B') tar[i][j]=2;
        }
    }
    set<ppp> s;
    for(int k=0;k<n;k++){
        for(int i=-3;i<4;i++){
            for(int j=-3;j<4;j++){
                int u=max(i,0);
                int b=min(4,i+h[k]);
                int l=max(j,0);
                int r=min(4,j+w[k]);
                if(u!=b && l!=r) s.insert(ppp(pii(u,b),pii(l,r)));
            }
        }
    }

    vector<ppp> stamp(s.begin(),s.end());
    const int INF=1e8;
    vector<int> d(1<<16,INF);
    d[0]=0;

    queue<int> que;
    que.push(0);

    while(!que.empty()){
        int st=que.front(); que.pop();
        for(int k=0;k<stamp.size();k++){
            int u=stamp[k].first.first,b=stamp[k].first.second;
            int l=stamp[k].second.first,r=stamp[k].second.second;
            for(int c=0;c<3;c++){
                int to=st;
                for(int i=u;i<b;i++){
                    for(int j=l;j<r;j++){
                        int pos=i*4+j;
                        if(tar[i][j]!=c){
                            to&=(~(1<<pos));
                        }
                        else{
                            to|=(1<<pos);
                        }
                    }
                }
                if(d[st]+1<d[to]){
                    d[to]=d[st]+1;
                    que.push(to);
                }
            }
        }
    }
    cout<<d[(1<<16)-1]<<endl;

    return 0;
}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl


const ll mod = 1e9 + 7;
const int maxn = 1e6 + 5;

int n;
ll a[maxn];
map<ll,int> f[maxn];

map<ll,int> fac;


ll modpow(ll a, ll b) {
  ll res = 1;
  while (b) {
    if (b%2) {
      res *= a;
      res %= mod;
      if (res<0) res+=mod;
    }
    a =a*a;
    a%=mod;
    if (a<0) a+=mod;
    b=b/2;
  }
  return res;
}

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

  cin>>n;
  for (int i=0; i<n; i++) {
    cin>>a[i];
    ll x = a[i];
    map<ll,int> mp;
    for (ll i=2; i*i<=x; i++) {
      while (x%i==0) {
	mp[i]++;
	x=x/i;
      }
    }
    if (x>1) {
      mp[x]++;
    }

    f[i] = mp;
    for (auto p: mp) {
      fac[p.first] = max(fac[p.first], p.second);
    }
  }

  ll lcm = 1;
  for (auto p: fac) {
    for (int i=0; i<p.second; i++) {
      lcm *= p.first;
      lcm %= mod;
    }
  }


  ll ans =0;
  for (int i=0; i<n; i++) {
    ll b = lcm*modpow(a[i],mod-2);
    ans += b;
    ans %= mod;
  }

  out(ans);
  return 0;
}


Measured memory_bytes: 50432
fn main() {
    proconio::input!(
        s: String
    );
    let s: String = s;
    let date: Vec<usize> = s.split("/").map(|c| c.parse::<usize>().unwrap()).collect();
    let ans = if let [y, m, _d] = date[..] {
        if y > 2019 || (y == 2019 && m > 4) {
            "TBD"
        } else {
            "Heisei"
        }
    } else {
        ""
    };
    println!("{}", ans);
}


Measured memory_bytes: 2076
package main

import (
	"fmt"
)

func max(x, y int) int {
	if x < y {
		return y
	} else {
		return x
	}
}

func main() {
	var n, m int
	fmt.Scan(&n)
	blueCards := map[string]int{}
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		blueCards[s]++
	}

	fmt.Scan(&m)
	redCards := map[string]int{}
	for i := 0; i < m; i++ {
		var s string
		fmt.Scan(&s)
		redCards[s]++
	}

	ans := 0

	for k, v := range blueCards {
		ans = max(ans, v-redCards[k])
	}
	fmt.Println(max(0, ans))

}


Measured memory_bytes: 512
const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const lines = input.trim().split('\n');
while ((first = lines.shift()) && (second = lines.shift())) {
	var purchase = 0
	const [n, max] = first.split(' ').map(Number)
	const prices = second.split(' ').map(Number)
	for (var i=0; i<n; i++) {
		for (var j=0; j<n; j++) {
			if (i!=j && max >= prices[i]+prices[j] && purchase < prices[i]+prices[j]) {
				purchase = prices[i]+prices[j]
			}
		}
	}
	purchase ? console.log(purchase) : console.log("NONE")
} 



Measured memory_bytes: 18588
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,t,a;
  cin >> n;
  cin >> t >> a;
  vector<int> h(n);
  REP(i,n) cin >> h[i];
  int ans;
  float ans_temp=INF;
  
  REP(i,n){
    float temp;
    temp = t - h[i] * 0.006;
    if(ans_temp > abs(temp-a)){
      ans_temp = abs(temp-a);
      ans=i+1;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	bs := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&bs[i])
	}

	aSum, bSum := 0, 0
	for i := 0; i < n; i++ {
		aSum += as[i]
		bSum += bs[i]
	}
	if aSum < bSum {
		fmt.Println(-1)
		return
	}

	positives := make([]int, 0, n)
	sumNeg := 0
	ct := 0
	for i := 0; i < n; i++ {
		diff := as[i] - bs[i]
		if diff > 0 {
			positives = append(positives, diff)
		} else if diff < 0 {
			sumNeg += (-diff)
			ct++
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(positives)))

	sumPos := 0
	i := 0
	for sumPos < sumNeg {
		sumPos += positives[i]
		ct++
		i++
	}
	fmt.Println(ct)
}


Measured memory_bytes: 7552
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
#define int long long
const int nax = 1e5 + 5;
int dp[nax];
bool visited[nax];
vector<int> adj[nax];
void dfs(int s)
{
    visited[s] = true;
    for(auto it : adj[s])
    {
        if(!visited[it])
        {
            dfs(it);
        }
        dp[s] = max(dp[s] , dp[it] + 1);
    }
}
signed main()
{
    IOS
    int n,m; cin>>n>>m;
    int a,b;
    while(m--)
    {
        cin>>a>>b;
        adj[a].pb(b);
    }
    int ans = 0;
    dfs(1);
    for(int i=1;i<=n;i++)
    {
        if(!visited[i])
        {
            dfs(i);
        }
    }
    for(int i=1;i<=n;i++)
    {
        ans = max(ans , dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8704
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 10000000;

int gcd(int a,int b){return b?gcd(b,a%b):a;}


int main(){
    ll a, b, k;
    cin >> a >> b >> k;

    if(a >= k){
        if(a > k){
            cout << a-k << ' ' << b << endl;
        }else{
            cout << 0 << ' ' << b << endl;
        }
    }else{
        if(b >= (k - a)){
            cout << 0 << ' ' << b - (k - a) << endl;
        }else{
            cout << 0 << ' ' << 0 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,M;
  cin>>N>>M;
  long long sum=0;
  vector<int> data(N);
  for(int i=0;i<N;i++){
    cin>>data.at(i);
    sum+=data.at(i);
  }
  int count = 0;
  for(int i=0;i<N;i++){
    if(data.at(i)*4*M>=sum){ 
      count++;
    }
  }
  if (count >=M) {                                       
    cout<<"Yes"<<endl; 
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
N = int(input())
T = list(map(int,input().split()))
M = int(input())
P_X = []
for i in range(M):
	P_X.append(list(map(int,input().split())))

temp_sum = sum(T)
for i in range(M):
	print(temp_sum - T[P_X[i][0] - 1] + P_X[i][1])

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

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

    vector<int> vec(N);
    for (int i = 0; i < N; i++)
    {
        cin >> vec.at(i);
    }

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

    int cnt = 0, t = 0;
    for (int i = 0; i < N; i++)
    {
        if (t < vec.at(i))
        {
            t = vec.at(i);
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
def check(x):
  if len(str(x))!=N:
    return False
  for i in range(M):
    if str(x)[S[i]]!=str(C[i]):
      return False
  return True

N,M=map(int,input().split())
S=[]
C=[]
for i in range(M):
  s,c=map(int,input().split())
  s-=1
  S.append(s)
  C.append(c)
#print(S,C)
for i in range(1000):
  if check(i):
    print(i)
    exit()   
print(-1)    


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 301000;
int n;
ll lim;
struct node{ll r,w;}st[N];
struct edge{int v,w;};
vector<node> v[N];
vector<edge> e[N];
void dfs(int x,int fw=0){
	for(auto v:e[x]) dfs(v.v,v.w);
	if(!e[x].size()){
		v[x].push_back({fw,fw});
		return;
	}
	auto &v1=v[e[x][0].v],&v2=v[e[x][1].v];
	if(v1.size()>v2.size()) swap(v1,v2);
	int k=0,tp=0;
	for(auto p:v1){
		while(k+1<v2.size()&&v2[k+1].r+p.w<=lim) k++;
		if(v2[k].r+p.w<=lim) st[++tp]={p.r+fw,v2[k].w+fw};
	}
	reverse(v1.begin(),v1.end());
	k=(int)v2.size()-1;
	for(auto p:v1){
		while(k>0&&v2[k-1].w+p.r<=lim) k--;
		if(v2[k].w+p.r<=lim) st[++tp]={v2[k].r+fw,p.w+fw};
	}
	sort(st+1,st+tp+1,[](node a,node b){
		return a.r<b.r||a.r==b.r&&a.w<b.w;
	});
	for(int i=1;i<=tp;i++)
		if(i==1||st[i].w<v[x].back().w) v[x].push_back({st[i].r,st[i].w});
}
bool check(ll k){
	lim=k;
	for(int i=1;i<=n;i++) v[i].clear();
	dfs(1);
	return v[1].size();
}
int main(){
	read(n);
	for(int i=2;i<=n;i++){
		int x,y;read(x);read(y);
		e[x].push_back({i,y});
	}
	ll l=-1,r=1ll<<40;
	while(l+1<r){
		ll mid=l+r>>1;
		if(check(mid)) r=mid;
		else l=mid;
	}
	cout<<r<<'\n';
	return 0;
}


Measured memory_bytes: 41512
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .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)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    
    ($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, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i64,
        b: i64,
        c: i64,
    }

    let mut ok: bool = false;
    for i in 1..b + 1 {
        if (a * i) % b == c {
            ok |= true;
        } else {
            ok |= false;
        }
    }
    println!("{}", if ok { "YES" } else { "NO" });
}




Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
typedef pair<int, int> P;
int B[] = { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };

int compare(string s1, string s2)
{
	int l1 = s1.size();
	int l2 = s2.size();
	if (l1 != l2)
	{
		if (l1 < l2)
		{
			return(1);
		}
		else
		{
			return(-1);
		}
	}
	for (int i = 0; i < l1; ++i)
	{
		if (s1[i] == s2[i])
		{
			continue;
		}
		else if (s1[i] < s2[i])
		{
			return(1);
		}
		else
		{
			return(-1);
		}
	}
}

void solve()
{
	int N, M;
	cin >> N >> M;
	vector<int> A(M);
	for (int i = 0; i < M; ++i)
	{
		cin >> A[i];
	}
	vector<string> dp(N + 1);
	vector<int> vst(N + 1);
	vst[0] = 1;
	for (int i = 0; i < N; ++i)
	{
		if (!vst[i])
		{
			continue;
		}
		for (int j = 0; j < M; ++j)
		{
			int d = A[j];
			if (i + B[d] <= N && (/*!vst[i + B[d]] ||*/ (compare(dp[i + B[d]], dp[i] + to_string(d)) > 0)))
			{
				dp[i + B[d]] = dp[i] + to_string(d);
				vst[i + B[d]] = 1;
			}
		}
	}
	cout << dp[N] << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 33024
c = []
csum0 = 0
3.times do
  row = gets.chomp.split(" ").map(&:to_i)
  csum0 += row.inject(:+)
  c << row
end

csum1 = c[0][0] + c[1][1] + c[2][2]
csum2 = c[0][2] + c[1][1] + c[2][0]

if csum0 == csum1 * 3 && csum0 == csum2 * 3 then
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;

int n, m;
int cnt[N];

int main()
{
  cin >> n >> m;
  for(int i = 0 ; i < m ; i++){
    int l, r;
    cin >> l >> r;
    cnt[l]++;
    cnt[r + 1]--;
  }
  int ans = 0;
  for(int i = 1 ; i <= n ; i++){
    cnt[i] += cnt[i - 1];
    ans += cnt[i] == m;
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    int n;
    int a;
    int b;
    int i;
    bool q = false;
    cin >> n;
    for(i = 1;i <= 9;i++){
        if(n % i == 0 && 1 <= n / i && n / i <= 9){
            q = true;
            continue;
        }
    }
    cout << (q ? "Yes":"No") << 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 P(x) cout << (x) << "\n"

#define MOD 1000000007 // 1e9+7
#define PI acos(-1.0)
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
ll fact(ll x){
  ll res=1;
  while(x>1){
    res*=x;
    res%=MOD;
    x--;
  }
  return res%MOD;
}
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;cin>>n;
  P(fact(n));
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int N;
	scanf("%d", &N);
	int *X = (int *)malloc(sizeof(int)*N);
	int *Y = (int *)malloc(sizeof(int)*N);
	int *H = (int *)malloc(sizeof(int)*N);
	for (int i = 0; i < N; i++) {
		scanf("%d%d%d", &X[i], &Y[i], &H[i]);
	}

	for (int posY = 0; posY <= 100; posY++) {
		for (int posX = 0; posX <= 100; posX++) {
			//頂上がどれくらいの高さであってほしいか。
			//-1はまだ良く分からない時。0以上は確定してるとき
			//-2はダメだって分かった時
			int needH = -1;

			for (int i = 0; i < N; i++) {
				if (H[i] > 0) {
					//この頂点から見て、頂上がposY,posXの時に、
					//どれくらいの高さがあってほしいかを求める
					int tmp = H[i] + abs(posY - Y[i]) + abs(posX - X[i]);
					if (needH == -1) {
						needH = tmp;
					}
					else {
						if (needH != tmp) {
							needH = -2;
							break;
						}
					}
				}
			}
			//ダメだったら別の場所を探す
			if (needH == -2) {
				continue;
			}
			for (int i = 0; i < N; i++) {
				//高さが0の場合に矛盾してないか調べる
				if (H[i] == 0) {
					int dist = abs(posY - Y[i]) + abs(posX - X[i]);
					if (needH > dist) {
						needH = -2;
						break;
					}
				}
			}
			//ダメだったら別の場所を探す
			if (needH == -2) continue;
			//見つけられたら答えをそのまま返す。
			printf("%d %d %d", posX, posY, needH);
			printf("\n");
			return 0;
		}
	}
}

Measured memory_bytes: 128
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

long long int getPow(int x, int n) {
	if (n == 0) return 1;
	long long int tmp = getPow(x, n / 2);
	if (n % 2 == 0)
		return (tmp * tmp) % mod;
	else
		return (((tmp * tmp) % mod) * x) % mod;
}

long long int getFact(int n) {
	long long int ans = 1;
	for (int i = 2; i <= n; i++) {
		ans = (ans * i) % mod;
	}
	return ans;
}

long long int getComb(int n, int r) {
	long long int ans = 1;
	for (int i = 0; i < r; i++) {
		ans = (ans * (n - i)) % mod;
	}
	for (int i = 1; i <= r; i++) {
		ans = (ans * getPow(i, mod - 2)) % mod;
	}
	return ans;
}

int main() {
	long long int n, a, b;
	cin >> n >> a >> b;
	long long int ans = (getPow(2, n) - 1 + mod) % mod;
	ans = (ans - getComb(n, a) + mod) % mod;
	ans = (ans - getComb(n, b) + mod) % mod;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <utility>

bool sort_a(std::pair<long long, long long> a, std::pair<long long, long long> b) {
    if(a.first == b.first) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

int main() {
    long long n;
    long long k;
    std::cin >> n >> k;
    std::vector<std::pair<long long, long long> > ab(n);
    for (int i = 0; i < n; i++) {
        std::cin >> ab[i].first >> ab[i].second;
    }

    std::sort(ab.begin(), ab.end(), sort_a);

    long long sum = 0;
    long long ans = 0;
    for(int i = 0; i < n; i++) {
        //std::cout << ab[i].first << " " << ab[i].second << std::endl;
        if((sum += ab[i].second) >= k) {
            ans = ab[i].first;
            break;
        }
    }

    std::cout << ans << std::endl;
}

Measured memory_bytes: 4796
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        long ans = 0L;
        for (long a = 1; a < n; a++) {
            ans += (n - 1) / a;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35700
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int n = Integer.parseInt(sc.next());
        String ans = "APPROVED";
        for(int i = 0; i < n; ++i) {
            int tmp = Integer.parseInt(sc.next());
            if(tmp % 2 == 0 && tmp % 3 != 0 && tmp % 5 != 0) {
                ans = "DENIED";
            }
        }
        System.out.println(ans);
    }
}


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

typedef long long ll;
int x,y,a,b,c;
ll Now;

struct node{
    int kd,val;
}Apple[300005];

bool CMP(const node &a,const node &b){
    return a.val > b.val;
}

int main(){
    //these IN 
    scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
    for(int i = 1; i <= a; i++) scanf("%lld",&Apple[i].val), Apple[i].kd = 1;
    for(int i = a + 1; i <= a + b; i++) scanf("%lld",&Apple[i].val), Apple[i].kd = 2;
    for(int i = a + b + 1; i <= a + b + c; i++) scanf("%lld",&Apple[i].val), Apple[i].kd =3;
    
    sort(Apple + 1, Apple + 1 + a + b + c, CMP);
    ll ans = 0;
    int nx = 0, ny = 0, cnt = 0;
    for(int i = 1 ; i <= a + b + c; i++){
        if(Apple[i].kd == 1){
            if(nx == x) continue;
            nx++;
        }
        else if(Apple[i].kd == 2){
            if(ny == y) continue;
            ny++;
        }
        cnt++;
        ans += Apple[i].val;
        if(cnt == x + y) break;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
ll INF = 9999999999999999;

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

ll gcf(ll a, ll b){
    if(b == 0) return a;
    return gcf(b, a%b);
}

ll lcm(ll a, ll b){
    ll g = gcf(a, b);
    return a/g * b;
}
int main(void){
    int N; cin >> N;
    vector<double> v(N); for(int i = 0; i < N; i++) cin >> v[i];
    
    sort(v.begin(), v.end());
    double prev = (v[0] + v[1])/2;
    double now = 0;
    for(int i = 2; i < N; i++){
        now = (prev + v[i])/2;
        prev = now;
        // cout << now << endl;
    }
    cout << prev << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    ll n,m;
    string s,t;
    cin >> n >> m >> s >> t;
    ll gcd = __gcd(n,m);
    ll l = n*m/gcd;
    ll n2 = n / gcd;
    ll m2 = m / gcd;
    int cur = 0;
    while(n2*cur<s.size()){
        if(s[n2*cur]!=t[m2*cur]){
            cout << -1 << endl;
            return 0;
        }
        cur++;
    }
    cout << l << endl;
    return 0;
}

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

using namespace std;

using int64 = long long;
const int INF = 1 << 30;

int N, A[100000];
map< int, int > latte, malta;
int diff;


int main() {

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  bool first = false;

  for(int i = 0; i < N; i++) {
    int j = N - 1 - i;
    if(malta[A[i]] == latte[A[i]]) ++diff;
    latte[A[i]]++;
    if(malta[A[i]] == latte[A[i]]) --diff;
    if(malta[A[j]] == latte[A[j]]) ++diff;
    malta[A[j]]++;
    if(malta[A[j]] == latte[A[j]]) --diff;
    if(diff == 0) {
      if(first++) cout << " ";
      cout << i + 1;
    }
  }
  cout << endl;

}


Measured memory_bytes: 8172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	//C問題

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		Scanner scan = new Scanner(System.in);

		String input = br.readLine();

		//Sは SUN,MON,TUE,WED,THU,FRI,SAT のいずれか

		Map<String, Integer> map = new HashMap<String, Integer>();
		map.put("SUN", 0);
		map.put("MON", 1);
		map.put("TUE", 2);
		map.put("WED", 3);
		map.put("THU", 4);
		map.put("FRI", 5);
		map.put("SAT", 6);

		System.out.println(7 - map.get(input));
	}

}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
a11, a12, a13 = map(int, input().split())
a21, a22, a23 = map(int, input().split())
a31, a32, a33 = map(int, input().split())

a_list = [a11, a12, a13, a21, a22, a23, a31, a32, a33]
open_list = [False] * 9

n = int(input())

b_list = []

for i in range(n):
    b_list.append(int(input()))

for item in b_list:
    for i in range(len(a_list)):
        if a_list[i] == item:
            open_list[i] = True

if (open_list[0] and open_list[1] and open_list[2]) or (open_list[3] and open_list[4] and open_list[5]) or (open_list[6] and open_list[7] and open_list[8]) or (open_list[0] and open_list[3] and open_list[6]) or (open_list[1] and open_list[4] and open_list[7]) or (open_list[2] and open_list[5] and open_list[8]) or (open_list[0] and open_list[4] and open_list[8]) or (open_list[2] and open_list[4] and open_list[6]):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38256
//*** 1010101010101010101 ***//
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long a, b, k;
  cin >> a >> b >> k;
  if (a >= k) {
    a -= k;
    k = 0;
  } else {
    k -= a;
    a = 0;
  }
  b -= min(b, k);
  cout << a << " " << b << '\n';
  return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))

c = []
cnt = 0
for a in A:
    if a < 400:
        c.append(0)
    elif a < 800:
        c.append(1)
    elif a < 1200:
        c.append(2)
    elif a < 1600:
        c.append(3)
    elif a < 2000:
        c.append(4)
    elif a < 2400:
        c.append(5)
    elif a < 2800:
        c.append(6)
    elif a < 3200:
        c.append(7)
    else:
        cnt += 1
d = len(set(c))

if d == 0:
    print(1, cnt)
else:
    print(d, d+cnt)


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

int main() {
  int N,K;
  cin >> N;
  cin >> K;
  int sum = 1;
  for(int i=0;i<N;i++){
    if(sum > K){
      sum += K;
    }
    else if(sum <= K){
      sum *= 2;
    }
  }
  cout << sum << endl;
  return 0;
}

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

int main() {
    int N, Q; cin >> N >> Q;
    vector<long long> A(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    reverse(A.begin(), A.end()); // 考えやすいように左右反転
        
    vector<long long> sum(N+1), evensum(N+1); // 累積和、偶数番目累積和
    for (int i = 0; i < N; ++i) {
        sum[i+1] = sum[i] + A[i];
        evensum[i+1] = evensum[i] + (i % 2 == 0 ? A[i] : 0);
    }
        
    vector<long long> ths, vals; // ths: L の値が変化する x の境目、vals: またそのときの先手のスコア
    for (int i = 0; i < (N-1)/2; ++i) {
        long long th = (A[i+1] + A[i*2+2])/2 + 1;
        long long val = (sum[i+1] - sum[0]) + (evensum[N] - evensum[i*2+2]);
        ths.push_back(th); vals.push_back(val);
    }
    reverse(ths.begin(), ths.end()); reverse(vals.begin(), vals.end());
    for (int _ = 0; _ < Q; ++_) {
        long long x; cin >> x;
        int it = upper_bound(ths.begin(), ths.end(), x) - ths.begin(); // L の値が何かを求める
        if (it == 0) cout << sum[(N+1)/2] - sum[0] << endl;
        else cout << vals[it-1] << endl;
    }
}

Measured memory_bytes: 5108
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a[4],e,f;
    
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>e>>f;
    sort(a,a+4);
   
    
    cout<<a[3]+a[2]+a[1]+(max(e,f))<<endl;
    
        
    

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int p, w, g, y;
  
  bool isFour = false;
  
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    
    if (s == "Y") {
      isFour = true;
      break;
    }
  }
  
  if (isFour) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <functional>
#include <queue>
#include <cmath>
#include <utility>

using namespace std;

#define int long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rep1(i,n) for(int i=1;i<=(int)n;++i)

int n, a, b;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

int pow_mod(int n, int a)
{
	if (a == 0) return 1;

	int res = 1;

	if (a & 1) {
		res *= n;
		res %= MOD;
		a--;
	}

	res *= pow_mod(n, a/2);
	res %= MOD;
	res *= pow_mod(n, a/2);
	res %= MOD;

	return res;
}

// O(k)
int C(int n, int k)
{
	int res = 1;

	for (int i = 0; i < k; ++i) {
		res *= (n-i);
		res %= MOD;
		res *= inv[i+1];
		res %= MOD;
	}

	return res;
}

signed main()
{
	int n, a, b; cin >> n >> a >> b;
	int ans = 0;
	ans += pow_mod(2, n) - 1 + MOD;
	ans %= MOD;

	COMinit();
	ans -= C(n, a);
	ans -= C(n, b);

	ans += MOD * 100;
	ans %= MOD;

	cout << ans << endl;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

#define T int

class Dijkstra {
public:
	struct edge{
		int to; T cost;
	};
	vector<vector<edge> > G;
	vector<T> d;
	int V;
	using pti = pair<T,int>;
	Dijkstra(int node_size){
		V = node_size;
		G.resize(V),d.resize(V,numeric_limits<T>::max());
	}
	//無向グラフの場合
	void add_edge(int u,int v,T cost){
		G[u].pb((edge){v,cost});
	}
	void solve(int s){
		set<pti> st;
		d[s] = 0;
		st.insert(pti(0,s));
		while(!st.empty()){
			pti p = *(st.begin());
			st.erase(st.begin());
			int v = p.second;
			if(d[v] < p.first) continue;
			for(auto& w : G[v]){
				if(d[w.to] > d[v] + w.cost){
					d[w.to] = d[v] + w.cost;
					st.insert(pti(d[w.to],w.to));
				}
			}
		}
	}
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, r;
    cin >> n >> m >> r;
	Dijkstra dj(n);
	rep(i,m){
		int a,b,c;
		cin >> a >> b >> c;
		dj.add_edge(a, b, c);
	}
	dj.solve(r);
	each(val,dj.d){
		if(val == numeric_limits<T>::max()){
			cout << "INF\n";
		}else{
			cout << val << "\n";
		}
	}
    return 0;
}



Measured memory_bytes: 15296
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int n = in.nextInt();
		System.out.println(solve(n));
		in.close();
	}

	private static int solve(int n) {
		int r = 1;
		r *= n;
		r *= n;
		r *= n;
		return r;
	}
}

Measured memory_bytes: 21716
#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 a;
  cin >> a;
  
  if(a%111 == 0) cout << a << endl;
  else cout << a + 111 - a%111 << endl; 
  
  
  
}


Measured memory_bytes: 256