akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define cs(ans); cout<<setprecision(20)<<fixed<<ans<<endl;
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
using namespace std;
using namespace __gnu_pbds; 
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
ll pwm(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
template<typename T> using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
//st.order_of_key(num)->number of elements < num
//st.find_by_order(i)->iterator of ith element in sorted order starting from zero
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define int long long int
//Binary_Search->dp->greedy
//auto check = [&](ll x){};
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int X[]={2,1,-1,-2,-2,-1,1,2}; 
int Y[]={1,2,2,1,-1,-2,-2,-1}; 
struct comp{
	bool operator()(const pair<int,int>&a,const pair<int,int>&b) const {
		if(a.first>b.first) return true;
		if(a.first<b.first) return false; 
		if(a.second<b.second) return true;
		return false;
	}
};	
void solve(){
	int n;
	cin>>n;
	set<string> st;
	rep(i,0,n){
		string s;
		cin>>s;
		st.insert(s);
	}
	cout<<st.size()<<endl;
	
		
}
int32_t main(){
int t=1;
//scanf("%d",&t);
while(t--){
	solve();
}
return 0;
}    


Measured memory_bytes: 19116
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
int main()
{
fast;
    ll a,b,n;
    cin>>a>>b>>n;
    ll i=n;
    while(i>=b)
    {
        i--;
    }
    ll ans1=((a*i)/b);
    ll ans2=(i/b);
    cout<<ans1-a*ans2;
    return 0;
}

Measured memory_bytes: 3700
// -*- coding:utf-8-unix -*-

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        a: [usize; n],
    }
    let mut nagasa_muri;
    let mut nagasa_ok = 10usize.pow(9);
    // Initialization
    if kirerukana(k, 1, &a) {
        println!("1");
        return;
    }
    nagasa_muri = 1;
    while nagasa_muri + 1 < nagasa_ok {
        let nagasa_bimyou = nagasa_muri + (nagasa_ok - nagasa_muri) / 2;
        if kirerukana(k, nagasa_bimyou, &a) {
            nagasa_ok = nagasa_bimyou;
        } else {
            nagasa_muri = nagasa_bimyou;
        }
    }
    println!("{}", nagasa_ok);
}

fn kirerukana(k: usize, nagasa: usize, a: &[usize]) -> bool {
    let mut count = 0;
    for &ai in a {
        count += ai / nagasa;
        if ai % nagasa == 0 {
            count -= 1;
        }
        if count > k {
            return false;
        }
    }
    return true;
}


Measured memory_bytes: 5428
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstdint>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;


template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}

int main()
{
	string s;
	cin>>s;
	int nums=0,numt=0;
	bool sturn=true;
	int del=0;
	int n=s.size();
	rep(i,n){
		if(s[i]=='S'){
			if(sturn){
				nums++;
			}else{
				sturn=true;
				del+=min(nums,numt);
				if(nums>numt){
					nums-=numt;
					numt=0;
				}else{
					nums=0;
					numt=0;
				}
				nums++;
			}
		}else{
			if(sturn){
				sturn=false;
				numt++;
			}else{
				numt++;
			}
		}
	}
	if(!sturn){
		del+=min(nums,numt);
	}
	cout<<n-del*2<<endl;
}

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

int main(){
    int a, b;
    char str[100], str2[100], str3[100];
    scanf("%s%s",str,str2);
    scanf("%d%d", &a, &b);
    scanf("%s", str3);
    if(strcmp(str, str3) == 0){
        a--;
    } else {
        b--;
    }
    printf("%d %d", a, b);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main()
{
	long N, A, B;
	std::cin >> N >> A >> B;
	std::cout <<  std::max( (long)0, ( A + B * ( N - 1 ) ) - ( A * ( N - 1 ) + B ) + 1 ) << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fore(i,a) for(auto i:a)
#define ll long long
using namespace std;
ll N,K;
double p[200010];
double s[200010];//pのi番目までの累積和
int main(){
    cin>>N>>K;
    rep(i,0,200010){
        p[i]=0;
        s[i]=0;
    }
    rep(i,0,N){
        cin>>p[i];
        s[i+1]=s[i]+p[i];
    }
    double maxi=0;
    rep(i,0,N-K+1){
        maxi=max(maxi,s[i+K]-s[i]+K);
    }
    printf("%.6f\n", maxi/2);

}

Measured memory_bytes: 3328
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
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;}
const long long INF = 1LL << 60;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int r,g;
	cin>>r>>g;
	cout<<g+g-r<<endl;
	
	
	
	return 0;
}

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

using namespace std;

void solve()
{
    int n, k;
    cin >> n >> k;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += a[i];
    }
    cout << ans << endl;
}

int main() 
{
    int tt = 1;
    //cin >> tt;
    while (tt--) solve();
}


Measured memory_bytes: 3644
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}
//Cやるぜ
int main() {
	int n;
	cin >> n;
	vector<string>a(n);
	rep(i, n) {
		cin >> a[i];
	}
	int ans = 0;
	int ca = 0, cb = 0, cab = 0;
	rep(i, n) {
		if (a[i][0] == 'B' && a[i][a[i].size() - 1] == 'A') {
			cab++;
		}
		else if (a[i][0] == 'B') {
			cb++;
		}
		else if (a[i][a[i].size() - 1] == 'A') {
			ca++;
		}
		rep(j, a[i].size() - 1) {
			if (a[i][j] == 'A' && a[i][j + 1] == 'B') {
				ans++;
			}
		}
	}
	if (ca == 0 && cb == 0) {
		if (cab != 0) {
			ans += cab - 1;
		}
	}
	else {
		ans += cab + min(ca, cb);
	}
	cout << ans << endl;
	return 0;
}

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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    int c[3][3];
    int a[3][3];
    int b[3][3];
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>c[i][j];
        }
    }
    for(int i=0;i<3;i++){
        for(int j=1;j<3;j++){
            a[i][j]=c[i][j]-c[i][j-1];
        }
    }
    for(int i=1;i<3;i++){
        for(int j=0;j<3;j++){
            b[i][j]=c[i][j]-c[i-1][j];
        }
    }
    for(int i=1;i<3;i++){
        if(a[i][1]!=a[i-1][1]){
            cout << "No"<<endl;
            return 0;
        }
        if(a[i][2]!=a[i-1][2]){
            cout << "No"<<endl;
            return 0;
        }
    }
    for(int i=1;i<3;i++){
        if(b[1][i]!=b[1][i-1]){
            cout << "No"<<endl;
            return 0;
        }
        if(b[2][i]!=b[2][i-1]){
            cout << "No"<<endl;
            return 0;
        }
    }
    cout << "Yes"<<endl;
    return 0;
}


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

/*
seems like aoki would want to block if possible
acyclic
seems like just dp, where we calc expected for having taken and not having taken
for each node -> N * N solution? * should been a red flag dumbo
we can take in both farther subtrees...
go to edge based solution -> for each edge calculate what it would result from a shift
-> O(N^2) times O(N) solution
if we can nicely propagate backwards, only weird change is the prior one
O(N^4) solution (not any better from just calculating it)
greedy opt: only going to take one of the edges from any point (remove the worst one) -> do this, then calc the whole thing
*/

const int N = 600 + 5;
double E[N];
vector<int> g[N];

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	cout.precision(13);
	int n,m;
	cin >> n >> m;
	for(int i = 0;i < m; ++i){
		int x,y;
		cin >> x >> y;
		g[x].push_back(y);
	}
	// rememeber base case
	E[n] = 0;
	for(int i = n-1; i >= 1; --i){
		// not takeys	
		int cnt = g[i].size();
		double esum = cnt; // add trans, keep image
		for(int to: g[i]){
			esum += E[to];
		}
		E[i] = esum/cnt;
	}
	double D[N] = {};
	double ans = E[1];
	const double inf = 1e18;
	for(int u = 1; u <= n; ++u){
		if(g[u].size() > 1){
			int cnt = g[u].size();
			fill(D,D + sizeof(D)/sizeof(double), 0);
			D[u] = inf;
			for(int v: g[u]){
				D[u] = min(D[u], (E[u]*cnt - E[v] - 1)/(cnt-1));
			}
			for(int i = u-1; i >= 1; --i){
				int cnt = g[i].size();
				double esum = cnt;
				for(int to: g[i]){
					esum += (to <= u? D[to] : E[to]);
				}
				D[i] = esum/cnt;
			}
			ans = min(ans, D[1]);
		}
	}
	cout << ans << '\n';
}



Measured memory_bytes: 1408
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long r = sc.nextLong();
        if (r < 1200) {
            System.out.println("ABC");
        } else if (r < 2800){
            System.out.println("ARC");
        } else {
            System.out.println("AGC");
        }
    }
}


Measured memory_bytes: 23764
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <map>
#pragma comment(linker, "/STACK:336777216")  

using namespace std;

int N, K;
int Forbid[10];

int Check(int X)
{
	while (X)
	{
		if (Forbid[X % 10])
			return 0;
		X /= 10;
	}
	return 1;
}

void Work()
{
	scanf("%d%d", &N, &K);
	for (int i = 0; i < K; i ++)
	{
		int t;
		scanf("%d", &t);
		Forbid[t] = 1;
	}
	while (1)
	{
		if (Check(N))
			break;
		N ++;
	}
	printf("%d\n", N);
}

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cxxabi.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define LINF    ((ll)1ll<60)
#define INF     ((int)1<<30)
#define EPS     (1e-3)
#define MOD     (1000000007)
template<class S,class T>ostream& operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool b=1;for(auto s:t)os<<(exchange(b,0)||strlen(abi::__cxa_demangle(typeid(S).name(),0,0,0))>20?"":" ")<<s;return os<<endl;}

using D=double;
using P=complex<double>;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

D dot(P a, P b) {
  return (conj(a)*b).X;
}

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

bool isecSS(P a1, P a2, P b1, P b2) {
  return ccw(a1, a2, b1)*ccw(a1, a2, b2) <= 0 &&
         ccw(b1, b2, a1)*ccw(b1, b2, a2) <= 0;
}

bool isecSP(P a1, P a2, P b) {
  return !ccw(a1, a2, b);
}

P proj(P a1, P a2, P p) {
  return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1);
}

D distSP(P a1, P a2, P p) {
  P r = proj(a1, a2, p);
  if (isecSP(a1, a2, r)) return abs(r-p);
  return min(abs(a1-p), abs(a2-p));
}

D distSS(P a1, P a2, P b1, P b2) {
  if (isecSS(a1, a2, b1, b2)) return 0;
  return min(min(distSP(a1, a2, b1), distSP(a1, a2, b2)),
             min(distSP(b1, b2, a1), distSP(b1, b2, a2)));
}

constexpr bool inner(double l, double r, double v){
    return min(l,r)<=v and v<=max(l,r);
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n;
	while(cin>>n,n){
	    double ax,ay,bx,by;
		cin>>ax>>ay>>bx>>by;
		P s(ax,ay),g(bx,by);

		double ans=1e9;
		rep(i,n){
    		vector<P> r;
    		int h;
		    cin>>ax>>ay>>bx>>by>>h;
		    r={P(ax,ay),P(ax,by),P(bx,by),P(bx,ay)};
		    double dist=1e9;
            if(inner(ax,bx,s.X) and inner(ax,bx,g.X) and inner(ay,by,s.Y) and inner(ay,by,g.Y)) dist=0;
		    rep(i,4){
		        dist=min(dist,distSS(s,g,r[i],r[(i+3)%4]));
		        if(isecSS(s,g,r[i],r[(i+3)%4]))dist=0;
		    }
		    if(LE(dist,h)) ans=min(ans,dist);
		    else ans=min(ans,(h*h+dist*dist)/2/h);
		}
		cout.precision(4);
		cout<<fixed<<ans<<endl;
	}
	return 0;
}



Measured memory_bytes: 3348
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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

ll dp[55][55][3030];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A;
    cin >> N >> A;
    vector<int> x(N);
    REP(i,N) cin >> x[i];
    dp[0][0][0] = 1;
    for(int i=1;i<=N;i++) REP(j,N+1) REP(k,3030){
        if(k < x[i-1]) dp[i][j][k] = dp[i-1][j][k];
        else if(j > 0) dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i-1]];
    }
    ll ans = 0;
    for(int i=1;i<=N;i++) ans += dp[N][i][i*A];
    cout << ans << endl;
}

Measured memory_bytes: 66560
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
using namespace std;
int main(void){
    int x;
    cin >> x;
    while(x!=0){
        int total = 0;
    vector<int> a(x);
    int ans = 0; 
    for(int j=0;j<x;j++){
        cin >> a[j];
        total+=a[j];
    }
    total = total/x;
    for(int j=0;j<x;j++){
        if(total>=a[j]){
            ans++;
        }
    }
    cout << ans << endl;
    cin >> x;
    }
}


Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for (int i = 1;; i++) {
            int x = sc.nextInt();
            if (x == 0) break;
            System.out.printf("Case %d: %d\n", i, x);
        }
        sc.close();
    }
}



Measured memory_bytes: 62272
//1, 2, 1に注意.
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int n;
int a[100000];

signed main() {
	int i;
	int ans = 0;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> a[i];
	
	for (i = 0; i < n - 1; i++) {
		ans += a[i] / 2;
		a[i] %= 2;
		if (a[i] && a[i+1]) {
			ans++;
			a[i]--;
			a[i+1]--;
		}
	}
	ans += a[n-1] / 2;
	
	cout << ans << endl;
	return 0;
}

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

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> dp(H+1,2000000000);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    int ATK, CST;
    cin >> ATK >> CST;
    for (int j = 1; j <= H; j++) {
      if (j <= ATK) dp[j] = min(dp[j],CST);
      else dp[j] = min(dp[j],dp[j-ATK]+CST); 
    }
  }
  cout << dp[H] << endl;
}

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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int a, b, c;
    cin >> a >> b >>c;
    if(2*b == (a + c)) cout << "YES" << endl;
    else cout << "NO" << endl; 
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  string s ;
  cin >> s ;
  
  if(s.at(0) == s.at(1) && s.at(1) == s.at(2) )
    cout << "No";
  else 
    cout << "Yes";


}


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

int main() {
    int n;
    cin >> n;
    map<long long, int> mp;
    vector<long long> v;
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        mp[a]++;
        if(mp[a] >= 2) {
            v.push_back(a);
            mp[a] -= 2;
        }
    }
    sort(v.begin(), v.end(), greater<long long>() );

    if(v.size() > 0) cout << v[0] * v[1] << endl;
    else cout << 0 << endl;

    return 0;
}

Measured memory_bytes: 6528
N = int(input())
D = {}
for i in range(N):
	S = input()
	M = D.get(S)
	if M == None:
		D.update([(S, 1)])
	else:
		D.update([(S, M+1)])
E = list(D.keys())
F = list(D.values())
MA = max(F)
I = [i for i,x in enumerate(F) if x == MA]
ans =[]
for i in I:
	ans.append(E[i])
ans = sorted(ans)
print('\n'.join(ans))

Measured memory_bytes: 49440
#組み合わせの計算
def combi(n, r, mod):
    r = min(r, n-r)
    numer = denom = 1

    for i in range(r):
        numer = numer * (n-i) % mod
        denom = denom * (i+1) % mod
    return numer * pow(denom, mod-2, mod) % mod #逆元

x, y = map(int, input().split())
mod  = 10**9+7

n = (-x + 2*y)/3
m = (2*x -  y)/3

if (x+y)%3 != 0:
    print(0)
    exit()

if n < 0 or m < 0:
    print(0)
    exit()

ans = combi(int(n+m), int(n), mod)
print(ans)

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

int main() {
    char s;
    cin >> s;
    s++;
    cout << s << 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)

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    ll N, A, B;
    cin >> N >> A >> B;

    if (A + B == 0) {
        puts("0");
        return 0;
    }

    ll sum = A + B, set = N / sum;
    ll ans = set * A;
    if (0 < set) N %= sum * set;
    if (A <= N) ans += A;
    else ans += N;

    cout << ans << endl;
}

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

using namespace std;

int main() {

	int time[5];
	for (int i = 0; i < 5; i++) {
		cin >> time[i];
	}

	bool orderd[5] = {false, false, false, false, false};

	int current = 0;
	for (int i = 0; i < 5; i++) {
	
		int select;
		int rem = 0;
		for (int j = 0; j < 5; j++) {
			if (orderd[j]) continue;

			int t = current + time[j];
			if (t % 10 == 0) {
				select = j;
				rem = 10;
				break;
			} else if (t % 10 > rem) {
				rem = t % 10;
				select = j;
			}
		}

		current += time[select];
		if (i != 4)
			current += 10 - rem;

		orderd[select] = true;
	}

	cout << current;

	return 0;
}



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

int main(){
  vector<string> str;
  string s;
  int K;

cin >> s;
cin >> K;


for(int i=0;s.size()>i && K>i;i++){
  for(int j=0;s.size()>j+i;j++){
    str.push_back(s.substr(j,i+1));
  }
}


set<string> s2(str.begin(), str.end());
vector<string> vec(s2.begin(), s2.end());


cout<<  vec.at(K-1) <<endl;


}

Measured memory_bytes: 2428
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<bitset>
#include<random>
#include<time.h>
#include<fstream>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<(ll)m; i++)
#define FOR(i,n,m) for(long long i=n; i<(ll)m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

map<ll,ll> dp;
vector<vector<ll>> co(4);
vector<P> pos;
vector<P> cir;
vector<ll> mask;
ll dfs(ll bit) {
	if(dp.count(bit)) return dp[bit];
	ll ret=0;
	bitset<32> bi(bit);
	REP(i,4) {
		REP(j,(ll)co[i].size()) {
			if(bi[co[i][j]]==0||(bit&mask[co[i][j]])!=0) continue;
			REP(k,j) {
				if(bi[co[i][k]]==0||(bit&mask[co[i][k]])!=0) continue;
				bi[co[i][j]]=0;
				bi[co[i][k]]=0;
				ret=max(ret,2+dfs(bi.to_ullong()));
				bi[co[i][j]]=1;
				bi[co[i][k]]=1;
			}
		}
	}
	return dp[bit]=ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(1) {
		ll n;
		cin>>n;
		if(n==0) return 0;
		dp.erase(ALL(dp));
		REP(i,4) co[i].resize(0);
		pos.resize(n);
		cir.resize(n);
		mask.resize(n);
		REP(i,n) {
			ll x,y,r,c;
			cin>>x>>y>>r>>c;
			c--;
			pos[i]=P(x,y);
			cir[i]=P(r,c);
		}
		REP(i,n) co[cir[i].second].pb(i);
		REP(i,n) {
			bitset<32> bi(0);
			REP(j,i) {
				if((pos[i].first-pos[j].first)*(pos[i].first-pos[j].first)+(pos[i].second-pos[j].	second)*(pos[i].second-pos[j].second)<(cir[i].first+cir[j].first)*(cir[i].first+cir[j].first)) {
					bi[j]=1;
				}
			}
			mask[i]=bi.to_ullong();
		}
		cout<<dfs((1ll<<n)-1ll)<<endl;
	}
}


Measured memory_bytes: 68764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
	int h,n,a;
	long sum=0;
	cin >> h>> n ;
	
	rep(i,n){
		cin >> a;
		sum += a;
	}
	if(sum >= h) cout << "Yes" << endl;
	else cout << "No" << endl; 
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define usecppio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) ((x).begin()),((x).end())
#define int ll
using pii = pair <int, int>;
#define INF 0x7f7f7f7f7f7f7f7f
const bool debug = 0;
const int mod = 1000000007;

vector <int> a, b;
vector <int> as = {0}, bs = {0};
int32_t main()
{
    usecppio
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i<n; i++)
    {
        int x; cin >> x;
        a.push_back(x);
        as.push_back(as.back()+x);
    }
    for (int i = 0; i<m; i++)
    {
        int x; cin >> x;
        b.push_back(x);
        bs.push_back(bs.back()+x);
    }
    int res = 0;
    for (int i = 0; i<=n; i++)
    {
        if (as[i]>k) continue;
        int ans = i;
        ans += (upper_bound(all(bs),k-as[i])-bs.begin()-1);
        res = max(ans, res);
    }
    cout << res << '\n';
}

Measured memory_bytes: 11448
s = input()
t = input()

max_count = 0
for i in range(len(s) - len(t) + 1):
  count = 0
  for j in range(len(t)):
    if t[j] == s[i + j]:
      count += 1
  if max_count < count:
    max_count = count
print(len(t) - max_count)

Measured memory_bytes: 9084
#include<stdio.h>
int main(void)
{
	//変数を定義。
	int c[3][3];
	int flag = 0;
 
	//3×3のグリッドを入力。
	for (int i = 0; i < 3; i++) {
		scanf("%d %d %d\n", &c[i][0], &c[i][1], &c[i][2]);
	}
 
	/*表の上の数値から下の数値を引いた値がそれぞれ等しいと条件が満たされる。
	  例えば、c[0][0] - c[1][0] と c[0][1] - c[1][1]の差が等しい。*/
	for (int j = 0; j < 2; j++) {
		for (int k = 0; k < 2; k++) {
			if (c[j][k] - c[j + 1][k] != c[j][k + 1] - c[j + 1][k + 1]) {
				printf("No\n");
                return 0;
			}
		}
	}
		printf("Yes\n");
		
		return 0;
}

Measured memory_bytes: 128
/**
 * C - 4-adjacent
 * https://atcoder.jp/contests/abc069/tasks/arc080_a
 **/
#include<iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    int four=0, two=0, other=0;
    for(int i=0; i<N; i++) {
        long long tmp;
        cin >> tmp;
        if(tmp%4==0) {
            four++;
        } else if(tmp%2==0) {
            two++;
        } else {
            other++;
        }
    }
    // cout << four << ":" << two << ":" << other << endl;
    if(four==other) {
        cout << "Yes" << endl;
    } else if(two==0&(four+1==other)) {
        cout << "Yes" << endl;
    } else if(four<other) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    return 0;
}

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

long long dp[110][100100];

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> W(N);
    vector<int> V(N);
    for (int i = 0; i < N; i++) {
        cin >> W[i] >> V[i];
    }

    for (int i = 0; i < N; i++) {
        for (int weight = 0; weight <= M; weight++) {
            if (weight >= W[i]) {
                dp[i + 1][weight] = max(dp[i][weight - W[i]] + V[i], dp[i][weight]);
            }
            else dp[i + 1][weight] = dp[i][weight];
        }
    }
    cout << dp[N][M] << endl;
}

Measured memory_bytes: 79360
import sys
def input(): return sys.stdin.readline().rstrip()
 
 
def per(n, r, mod=10**9+7):  # 順列数
    per = 1
    for i in range(r):
        per = per*(n-i) % mod
    return per


def com(n, r, mod=10**9+7):  # 組み合わせ数
    r = min(n-r, r)
    bunshi = per(n, r, mod)
    bunbo = 1
    for i in range(1, r+1):
        bunbo = bunbo*i % mod
    return bunshi*pow(bunbo, -1, mod) % mod

def comH(n, r, mod=10**9+7): # n種類からr個取る重複組み合わせ数
    return com(n+r-1,r,mod)
 
def main():
    s = int(input())
    ans = 0
    for i in range(1, (s//3)+1):
        k = s-3*i
        ans += comH(i,k)
        #print(com(k+i,k),k+i,i)
    print(ans % (10**9+7))
 
 
if __name__ == '__main__':
    main()

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(ll i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

const double one = 1.0;
const double PI = 3.141592653589;
const ll m = ll(1e9+7);

int main() 
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cerr.tie(0);
	ll k;
	cin>>k;
	string s = "ACL";
	FOR(i,0,k)cout<<s;
	cout<<endl;
	return 0;
}

Measured memory_bytes: 3612
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<ll,ll>;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

////////// 繰り返し二乗法 //////////

ll power(ll a,ll b){
  ll res=1;
  while(b>0){
    if(b&1) res=res*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return res;
}

//////////////////////////////////////////////////

int main(){
  ll N,A,B;
  cin>>N>>A>>B;
  ll ans=power(2,N)-1;
  
  ll a=1,af=1;
  REP(i,A){
    a*=N-i;
    a%=MOD;
    af*=i+1;
    af%=MOD;
  }
  ans-=a*power(af,MOD-2)%MOD;
  
  ll b=1,bf=1;
  REP(i,B){
    b*=N-i;
    b%=MOD;
    bf*=i+1;
    bf%=MOD;
  }
  ans-=b*power(bf,MOD-2)%MOD;
  
  ans%=MOD;
  if(ans<0) ans+=MOD;
  co(ans);
  return 0;
}


Measured memory_bytes: 3608
import fractions


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


N = int(input())
a = list(map(int, input().split()))
lcm_ans = a[0]
for i in range(1, N):
    lcm_ans = lcm(lcm_ans, a[i])
ans = 0
for i in range(N):
    ans += (lcm_ans - 1) % a[i]
print(ans)


Measured memory_bytes: 5344
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

class Main {

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

        try {

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

            List<String> inputIndex = Arrays.asList(br.readLine().split(" "));
            StringBuilder inputString = new StringBuilder(br.readLine());

            int lowerIndex = Integer.parseInt(inputIndex.get(1));
            inputString.replace(lowerIndex - 1, lowerIndex,  inputString.substring(lowerIndex - 1, lowerIndex).toLowerCase());

            System.out.println(inputString);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

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

int main(){
    int ans = 0;
    string n;
    cin >> n;
    
    if (n == "RRR") {
        ans = 3;
    } else if ((n[0] == 'R' && n[1] == 'R') || (n[1] == 'R' && n[2] == 'R')) {
        ans = 2;
    } else if (n[0] == 'R' || n[1] == 'R' || n[2] == 'R') {
        ans = 1;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public long MOD = 1000000007;

        public void Run()
        {
            long W, H, X, Y;
            {
                var line = Input.ReadLongArray();
                W = line[0];
                H = line[1];
                X = line[2];
                Y = line[3];
            }

            double A = W * H / 2.0;
            int R = ((X * 2 == W) && (Y * 2 == H) ? 1 : 0);
            
            Console.WriteLine($"{A} {R}");
        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    string S,T;
    cin >> S >> T;
    ll a,b;
    cin >> a >> b;
    string U;
    cin >> U;
    if(U == S){
        cout << a-1 << " " << b << "\n";
    }else{
        cout << a << " " << b-1 << "\n";
    }
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define pi 3.14159265

bool compare(pll a, pll b){
    return (a.first*b.second) < (a.second*b.first);
}

const int mod = 1e9 + 7;
const ll inf = ll(1e18);

ll modexp(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%mod,n/2);
    return (x*modexp((x*x)%mod,n/2))%mod;
}

int main(){
    fastio;
    //clock_t tm = clock();
    int n;
    cin>>n;
    int m1=ceil(n/1.08);
    int m2=floor(n/1.08);
    if(int(m1*1.08)==n)cout<<m1<<endl;
    else if(int(m2*1.08)==n)cout<<m2<<endl;
    else cout<<":("<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int M, D;
	int count = 0;
	scanf("%d%d", &M, &D);
	if (D <= 21) {
		printf("0");
		return 0;
	}
	for (int i = 1; i <= M; i++) {
		for (int j = 22; j <= D; j++) {
			if ((j - ((j / 10) * 10)) > 1) {
				if ((j / 10) * (j - ((j / 10) * 10)) == i) {
					count++;
				}
			}
		}
	}
	printf("%d", count);
	return 0;
}


Measured memory_bytes: 128
/// Kazuki Hoshino


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define inf 1000000000
#define mod 1000000007
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define rep1(i, a, b) for(int i =a; i >=b; i--)
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
//#define endl '\n'
typedef tree<
int,
null_type,less<int>,
rb_tree_tag,tree_order_statistics_node_update>
ordered_set;

class comp{
public:
	bool operator()(const pair<pair<int,int>,int>&a, const pair<pair<int,int>,int>&b ){
		if(a.fs.fs*b.fs.sc!=a.fs.sc*b.fs.fs)return a.fs.fs*b.fs.sc>a.fs.sc*b.fs.fs;
		return a.sc<b.sc;
	}
};

set<pair<pair<int,int>,int>,comp> s;
int n,c0[201010],c1[202020],ans,p[202020],v[202020],lnk[202020],sze[202020];
void init(){
	for(int i=0;i<202000;i++){
		lnk[i]=i;
		sze[i]=1;
	}
}
int fnd(int x){
	while(x!=lnk[x])x=lnk[x];
	return x;
}
bool issame(int x, int y){
	return fnd(x)==fnd(y);
}
bool unite(int x, int y){
	x = fnd(x);
	y = fnd(y);
	lnk[y]=x;
	c0[x]+=c0[y];
	c1[x]+=c1[y];
}

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

#ifndef ONLINE_JUDGE
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif
init();
cin >> n;
for(int i=2;i<=n;i++){
	cin >> p[i];
}
for(int i=1;i<=n;i++){
	cin >> v[i];
	if(v[i]==1){
		c1[i]++;
		if(i!=1)
		s.insert({{0,1},i});
	}
	else {
		c0[i]++;
		if(i!=1)
		s.insert({{1,0},i});
	}
}
n--;
while(n--){
	auto it = s.begin();
	int k = (*it).sc;
	s.erase(it);
	int pre = fnd(p[k]);
	if(pre!=1){
		s.erase({{c0[pre],c1[pre]},pre});
	}
	ans+=c1[pre]*c0[k];
	unite(pre,k);
	if (pre!=1){
		s.insert({{c0[pre],c1[pre]},pre});
	}
}

cout << ans << endl;

return 0;}
///....


Measured memory_bytes: 24320
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e,f;
    cin>>a>>b;
    if(b<10){d=b+a*10;}
    else if(b>9&&b<100){d=b+a*100;}
    else d=b+a*1000;
    for(int i=1;i<1002;i++){
        e=d/i;
        if(d%i==0&&i==e){
            cout<<"Yes";break;
        }
        else if(i==1001){
            cout<<"No";
        }
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_map>
#include<stack>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
const long long mod = 1000000007;

signed main() {
	string s; cin >> s;
	int a = 0, b = 0, c = 0;
	rep(i, s.size()) {
		if (s[i] == 'a')a++;
		else if (s[i] == 'b')b++;
		else c++;
	}
	if (max(a, max(b, c)) - min(a, min(b, c)) > 1)puts("NO");
	else puts("YES");
}

Measured memory_bytes: 512
# 入力
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

class UnionFind:
    def __init__(self, node:int) -> None:
        self.n = node
        self.par = [i for i in range(self.n)]
        self.rank = [0 for i in range(self.n)]
        
    def find(self, x:int) -> int:
        if x == self.par[x]:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
        
    def unite(self, x:int, y:int) -> bool:
        if self.isSame(x,y):
            #print("x and y has already united")
            return False
        
        rx = self.find(x)
        ry = self.find(y)
        
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = self.par[ry]
        else:
            self.par[ry] = self.par[rx]
            
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1
                
        return True
                
    def isSame(self, x:int, y:int) -> bool:
        return self.find(x) == self.find(y)

from collections import defaultdict

dic = defaultdict(list)

n,m = li()

# 各言語を話せる人を登録
for i in range(n):
    l_list = li()
    for l in l_list[1:]:
        dic[l].append(i)
        
# union-findでマージしていく
uf = UnionFind(n)
for key in dic.keys():
    val = dic[key]
    for i in range(len(val)-1):
        if not uf.isSame(val[i], val[i+1]):
            uf.unite(val[i], val[i+1])
            
root = uf.find(0)
for i in range(n):
    if uf.find(i) != root:
        print("NO")
        break
    
    if i == n-1:
        print("YES")

Measured memory_bytes: 18328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).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 long long INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main() {
    ll n;
    cin >> n;
    bool f=true;
    ll a[n],c=0;
    for (ll i=0;i<n;i++){
        cin >> a[i];
        if (a[i]==i+1){
            if (!f){
                f=true;
                continue;
            }
            c++;
            f=false;
            continue;
        }
        f=true;
    }
    cout << c << endl;
    return 0;
}


Measured memory_bytes: 4352
import math

A,B,H,M = map(int,input().split())
angH = 30.0*H+0.5*M
angM = 6.0*M
angD = abs(angH-angM)

if angD > 180.0:
    angD = 360.0-angD
cosD = math.cos(math.radians(angD))
ans2 = A*A + B*B - 2*A*B *cosD
ans = math.sqrt(ans2)
print(ans)

Measured memory_bytes: 9456
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
int m,a,b,frst,cnt[100010];
vector<int> vct,v[100010];
void dfs(int n,int p)
{
	cnt[n]=1;
	vct.pb(n);
	if (n==m) frst=vct[(vct.size()+1)/2];
	for (int i=0;i<v[n].size();++i)
	{
		if (v[n][i]==p)continue;
		dfs(v[n][i],n);
		cnt[n]+=cnt[v[n][i]];
	}
	vct.pop_back();
}
int main()
{
	cin>>m;
	for (int i=0;i<m-1;++i)
	{
		cin>>a>>b;
		v[a].pb(b);
		v[b].pb(a);
	}
	frst=-1;
	dfs(1,-1);
	bool win=cnt[frst]*2<m;
	if (win) cout<<"Fennec";
	else cout<<"Snuke";
    return 0;
}

Measured memory_bytes: 11256
/**
 * @author: Mackenzie
**/
#include <bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int h, n;
    cin >> h >> n;
    ll sum = 0;
    forn(i, n) {
        int v;
        cin >> v;
        sum += v;
    }
    if (sum >= h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
# 最大公約数(mathは3.5以降) 
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

# 初期入力
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

ans =gcd_list(A)
print(ans)


Measured memory_bytes: 20328