akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(ll i = 0; i < n; i++)

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> grid(h);
	rep(i, h) cin >> grid[i];
	map<int, bool> hight;
	rep(i, h) {
		bool flag = true;
		rep(j, w) {
			if (grid[i][j] == '#') flag = false;
		}
		if (flag) {
			hight[i] = true;
		}
	}
	map<int,bool> width;
	rep(j, w) {
		bool flag = true;
		rep(i, h) {
			if (grid[i][j] == '#') flag = false;
		}
		if (flag) {
			width[j] = true;
		}
	}
	rep(i, h) {
		rep(j, w) {
			if (hight[i] || width[j]) continue;
			cout << grid[i][j];
		}
		if(!hight[i]) cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.length()<=3)cout << "No"<<endl;
  else if(s.at(0)=='Y'&&s.at(1)== 'A'&&s.at(2)=='K'&&s.at(3)=='I')cout << "Yes"<<endl;
                                   else cout << "No"<<endl;
}

Measured memory_bytes: 256
let () =
  Scanf.scanf "%s\n" @@ fun s ->
  let ans = ref true in
  let check i c =
    if i mod 2 = 1 then
      if c = 'R' || c = 'U' || c = 'D' then () else ans := !ans && false
    else
      if c = 'L' || c = 'U' || c = 'D' then () else ans := !ans && false in
  StringLabels.iteri (fun i c -> check (i+1) c) s;
  Printf.printf "%s\n" (if !ans then "Yes" else "No")

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define s size
#define pb push_back
#define in insert
#define PI 3.1415926535897932384626433832795
#define MOD 100000007
#define F first
#define S second
#define aLL(str) (str).begin(), (str).end()
#define IOS                  \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0)
#define ll long long
typedef vector<ll> vl;
typedef map<ll,ll> ml;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
int main()
{IOS;
ll t,i,j,k;
//cin>>t;
t=1;
while(t--)
{ll n,k,sum=0;
cin>>n>>k;
ll v[n];
for(i=0;i<n;i++)
cin>>v[i];
sort(v,v+n);
for(i=0;i<k;i++)sum+=v[i];
cout<<sum;
}
return 0;}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=1005;
const int M=200005;
vector<int> e[N];
int head[N],tot;
int n,m,x[M],y[M];
int co1[N][N],co2[N][N];
int vis[N],q[N];
void dfs(int x,int co){
	vis[x]=co;
	for (auto i:e[x]) if (!vis[i]) dfs(i,co);
}
int main(){
	scanf("%d%d",&n,&m);
	For(i,1,m){
		scanf("%d%d",&x[i],&y[i]);
		e[x[i]].PB(y[i]);
	}
	For(i,1,n){
		*q=0;
		for (auto j:e[i]) q[++*q]=j;
		For(j,1,n) vis[j]=(j==i?-1:0);
		For(j,1,*q) if (!vis[q[j]]) dfs(q[j],q[j]);
		For(j,1,n) co1[i][j]=vis[j];
		For(j,1,n) vis[j]=(j==i?-1:0);
		Rep(j,*q,1) if (!vis[q[j]]) dfs(q[j],q[j]);
		For(j,1,n) co2[i][j]=vis[j];
	}
	For(i,1,m){
		bool f1=(co1[y[i]][x[i]]!=0);
		bool f2=(co2[x[i]][y[i]]&&co2[x[i]][y[i]]!=y[i])||
				(co1[x[i]][y[i]]&&co1[x[i]][y[i]]!=y[i]);
		puts(f1^f2?"diff":"same");
	}
}

Measured memory_bytes: 12288
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
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; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
    for(auto i=begin(v); i != end(v); ++i){
        if(i !=begin(v)) os << ' ';
        os << *i;
    }
    return os;
}

int main(){
    ll N,M;
    char A;
    cin >> N >> A >> M;
    cout << (A=='+' ? N+M :N-M) << endl; 
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
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;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
int main() {
	int n;
	cin >> n;
	vector<int>a;
	for (int i = 0; i < n; i++) {
		int in;
		cin >> in;
		a.push_back(in);
	}
	for (int i = 0; i < a.size(); i++) {
		if (a[i] % 2 == 0) {
			if (a[i] % 3 == 0 || a[i] % 5 == 0) {
				continue;
			}
			else {
				cout << "DENIED";
				return 0;
			}
		}
	}
	cout << "APPROVED";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  int count =0;
  int ans= 0;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='A'||S.at(i)=='T'||
       S.at(i)=='C'||S.at(i)=='G'){
      count++;
    }else{
      if(ans<count){
        ans=count;
      }
        count=0;
      }
    if(ans<count){
      ans=count;
    }
    
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
void RSort(int *,int,int);
void Reverse(int *,int,int,int);
double sum=0;
int main()
{
  int i,n;
  int N[200000];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&N[i]);
  }

  RSort(N,0,n);

 /* for(i=0;i<n;i++){
    printf("%d ",N[i]);
  }*/
  
  printf("%.0f\n",sum);

  return 0;
}

void RSort(int *A,int left,int right)
{
  int mid,temp;
  if(left+1<right){
    mid=(left+right)/2;
    RSort(A,left,mid);
    RSort(A,mid,right);
    Reverse(A,left,mid,right);
  }
}

void Reverse(int *A,int left,int mid,int right)
{
  int k,n1,n2,L[200000],R[200000],i,j;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1]=1000000000;
  R[n2]=1000000000;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<R[j]){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      sum+=n1-i;
      j++;
    }
  }
}

Measured memory_bytes: 2204
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        n: u8,
        s: chars,
    }
    for i in 0..s.len() {
        let mut x:u8 = (s[i] as u8) - b'A';
        x = (x + n) % 26 + b'A';
        print!("{}", x as char);
    }
    println!("");
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<functional>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<map>
#include<ctime>
using namespace std;
typedef long long ll;
typedef long double ld;
const int maxn = 5e3+7;
const int inf = 1e5;
const int modn = 1e9+7;
const ld eps = 1e-8;
const long double PI = acos(-1.0);
void qRead(ll &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
void qRead(int &x){x = 0;char a;for(a = getchar();a <'0' || a > '9';a = getchar());for(;a >= '0' && a <= '9';a = getchar())x = x*10 + a-'0';}
ll qpow(ll a,ll b,ll mo = modn){
//    printf("%lld\n",mo);
    ll res = 1;
    while(b){
        if(b & 1)res = (res*a) % mo;
        a = (a*a) % mo;
        b >>= 1;
    }
    return res;
}
ld qpow(ld a,ll b){
    ld res = 1;
    while(b){
        if(b & 1)res *= a;
        a = a*a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b){
    if(!b)return a;
    return gcd(b,a%b);
}
//ll vis[maxn],prime[maxn],cnt,smallP[maxn];
//void getPrime(int n){
//    cnt = 0;
//    for(int i = 1;i <= n;i++)vis[i] = 0;
//    for(ll i = 2;i <= n;i++){
//        if(!vis[i]){
//            prime[++cnt] = i;
//            smallP[i] = i;
//        }
//        for(int j = 1;j <= cnt && i*prime[j] <= n;j++){
//            vis[prime[j]*i] = 1;
//            smallP[prime[j]*i] = prime[j];
//            if((i % prime[j]) == 0)break;
//        }
//    }
//}
//ll cnm[maxn][maxn];
//void getCnm(){
//    cnm[0][0] = 1;
//    for(int i = 1;i < maxn;i++){
//        for(int j = 0;j <= i;j++){
//            cnm[i][j] = cnm[i-1][j];
//            if(j)cnm[i][j] += cnm[i-1][j-1];
//            cnm[i][j] %= (modn-1);
//        }
//    }
//}
//ll f[maxn],invF[maxn];
//void getF(){
//    f[0] = invF[0] = 1;
//    for(int i = 1;i < maxn;i++)f[i] = f[i-1]*i % modn;
//    invF[maxn-1] = qpow(f[maxn-1],modn-2);
//    for(int i = maxn-2;i >= 1;i--)invF[i] = invF[i+1]*(i+1) % modn;
//}
char s[maxn];
ll dp[maxn][maxn];
int main(){
    int n;
    scanf("%d",&n);
    scanf(" %s",s);
    int len = strlen(s);
    dp[0][0] = 1;
    for(int i = 1;i <= n;i++){
        for(int j = 0;j <= i;j++){
            if(j == 0)dp[i][j] = (dp[i-1][j] + dp[i-1][j+1]) % modn;
            else dp[i][j] = (dp[i-1][j-1]*2 + dp[i-1][j+1]) % modn;
        }
    }
    ll ans = dp[n][len] * qpow(qpow(2ll,len),modn-2) % modn;
    printf("%lld\n",ans);
}


Measured memory_bytes: 194048
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char c1[1001],c2[1001];
int main()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a) printf("%d",k);
	else if(k>a&&k<=a+b) printf("%d",a);
	else printf("%d",a-(k-a-b));
	return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
#define FOR(i, n) for(int i = 1; i<=n; i++)
#define F0R(i, n) for(int i = 0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second


//var 
LL n, a[1000005], act[1000005], vc = 0, np[1000005];
vector<int> pr;
bool ok = 1;

void seeve(){
	for(int i = 2; i<=1000000; i++){
		if(np[i]) continue;
		pr.pb(i); vc = 0;
		if(act[i]) vc++;
		for(int j = i+i; j<=1000000; j += i){
			np[j] = 1;
			if(act[j]) vc++;
		}
		if(vc >= 2) ok = 0;
	}	
}

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

	cin >> n;
	FOR(i, n){
		cin >> a[i];
		act[a[i]] = 1;
	}

	LL g = a[1];
	FOR(i, n)
		g = __gcd(g, a[i]);

	if(g != 1){
		cout << "not coprime" << endl;
		return 0;
	}

	seeve();
	if(!ok){
		cout << "setwise coprime" << endl;
		return 0;
	}

	cout << "pairwise coprime" << endl;



	cout.flush();
	return 0;
}

Measured memory_bytes: 27280
#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;
int p[100006];
int main() {
	int n; cin >> n;
	vector<P>V;
	rep(i, n) {
		cin >> p[i];
		V.push_back(P(p[i], i));
	}
	sort(V.begin(), V.end());
	LL ans = 0;
	set<int>S1, S2;
	S1.insert(V[n-1].second);
	S2.insert(-V[n - 1].second);
	for (int i = n - 2; i >= 0; i--) {
		int q = V[i].second;
		auto i1 = S1.lower_bound(q);
		auto i2 = S2.lower_bound(-q);
		if (i1 != S1.end()) {
			LL l1, r1;
			if (i2 == S2.end())l1 = q + 1;
			else {
				l1 = q + (*i2);
			}
			auto i3 = S1.upper_bound(*i1);
			if (i3 == S1.end())r1 = n - (*i1);
			else r1 = (*i3) - (*i1);
			ans += l1*r1*(i + 1);
		}
		if (i2 != S2.end()) {
			LL l2, r2;
			if (i1 == S1.end())r2 = n -q;
			else {
				r2 = (*i1) - q;
			}
			auto i3 = S2.upper_bound(*i2);
			if (i3 == S2.end())l2 = 1-*i2;
			else l2 = (*i3) - (*i2);
			ans += l2*r2*(i + 1);
		}

		S1.insert(q);
		S2.insert(-q);
	}
	cout << ans << endl;
}

Measured memory_bytes: 10740
#include<iostream>

using namespace std;

bool check(int center, int *w,int n, int k){
	int tmp = 0;
	int cnt = 0;
	for (int i = 0; i < n; i++){
		tmp += w[i];
		if (tmp > center){
			tmp = 0;
			cnt++;
			i--;
		}else if (tmp == center){
			tmp = 0;
			cnt++;
		}
	//	cout << "tmp = " << tmp << ", cnt = " << cnt << endl;	
		if (i == n-1 and tmp > 0){
			cnt++;
		}
		if (cnt > k){
	//		cout << "false" << endl;
			return false;
		}
			
	}
	//cout << "true" << endl;
	return true;
}

int main(){
	int n; cin >> n;
	int k; cin >> k;
	int w[100000];
	int max = 0;
	int min = 100001;
	for (int i = 0; i < n; i++){
		cin >> w[i];
		max += w[i];
		if (min > w[i]){
			min = w[i];
		}
	}

	int good = max;
	int bad = min;
	int center = (good + bad) /2;
	
	//
	//cout << "good = " << good << ", bad = " << bad << ", center = " << center <<  endl;
	//cout << "-----------------------" << endl;
	//
	while(good - bad > 1){
		if ( check(center,w,n,k) ){
			good = center;
			center = (good + bad) / 2;
		}else{
			bad = center;
			center = (good + bad) / 2;
		}
		//cout << "good = " << good << ", bad = " << bad << ", center = " << center <<  endl;
	}

	if (check(bad,w,n,k)){
		cout << bad << endl;
	}else{
		cout << good << endl;
	}
	
		

return 0;
}

Measured memory_bytes: 3436
#include<stdio.h>

#define max 251

int main(){
  int i;
  int heap[max],heapsize,leftN,rightN;

  scanf("%d",&heapsize);
  for(i=1;i<=heapsize;i++){
    scanf("%d",&heap[i]);
  }
  
  for(i=1;i<=heapsize;i++){
    printf("node %d: key = %d, ",i,heap[i]);
    if(i>1){
      printf("parent key = %d, ",heap[parent(i)]);
    }
    leftN=left(i);
    rightN=right(i);
    if(leftN<=heapsize){
      printf("left key = %d, ",heap[leftN]);
    }
    if(rightN<=heapsize){
      printf("right key = %d, ",heap[rightN]);
    }
    printf("\n");
  }

  return 0;
}

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

Measured memory_bytes: 600
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        int H = int.Parse(str[0]);
        for(int i=0;i<H;i++){
               string s = Console.ReadLine();
               sb.Append(s+"\n");
               sb.Append(s+"\n");
        }
    }
}

Measured memory_bytes: 2776
#include<iostream>

using namespace std;

int main(){

  int N[4];
  int flag[4];
  for(int i=0; i<4; i++) flag[i] = 0;

  cin >> N[0] >> N[1] >> N[2] >> N[3];

  for(int i=0; i<4; i++){
    int val = N[i];
    if(val == 1){
      flag[0] = 1;
    }else if(val == 9){
      flag[1] = 1;
    }else if(val == 7){
      flag[2] = 1;
    }else if(val == 4){
      flag[3] = 1;
    }
  }

  int ans_int = 1;
  for(int i=0; i<4; i++){
    ans_int *= flag[i];
  }

  if(ans_int == 1){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  bool flg = true;
  for (int i=0; i<3; i++){
    if (s[i]==s[i+1]){
      flg = false;
      break;
    }
  }
  if(flg){
    cout << "Good" << endl;
  }else{
    cout << "Bad" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
 
template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool) *this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t) v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { if ((v += r.v) >= P) v -= P; return *this; }
  M& operator-=(M r) { if ((v += P - r.v) >= P) v -= P; return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  M pow(auto n) const {
    if (n < 0) return pow(-n).inv();
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  friend M operator*(auto l, M r) { return M(l) *= r; }
  friend M operator/(auto l, M r) { return M(l) /= r; }
  friend M operator+(auto l, M r) { return M(l) += r; }
  friend M operator-(auto l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  friend bool operator==(auto l, M r) { return M(l) == r; }
  friend bool operator!=(auto l, M r) { return !(l == r); }
};
using Mint = ModInt<(unsigned) 1e9 + 7>;
 
int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  V<> a(n); for (auto&& e : a) cin >> e;
  V<> b(m); for (auto&& e : b) cin >> e;
  VV<Mint> dp(n + 1, V<Mint>(m + 1));
  for (int i = 0; i <= n; ++i) dp[i][0] = 1;
  for (int j = 0; j <= m; ++j) dp[0][j] = 1;
  for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) {
    dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1] - dp[i][j];
    if (a[i] == b[j]) dp[i + 1][j + 1] += dp[i][j];
  }
  cout << dp[n][m] << '\n';
}

Measured memory_bytes: 16000
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
	double r,i,k;
	cin>>r;
	i=r*r*3.141592653589;
	k=r*2*3.141592653589;

	printf("%.5lf ",i);
	printf("%.5lf\n",k);

return 0;
}


Measured memory_bytes: 3200
#include<stdio.h>

int main(){
  int n,i,j,l,u,k;
  int v[101][101];
  int a[101][101];
  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d %d",&u,&k);
    for(j=1;j<=k;j++){
      scanf("%d",&v[i][j]);
    }
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      a[i][j] = 0;
    }
  }
    
    for(i=1;i<=n;i++){
      for(j=1;j<=n;j++){
	for(l=1;l<=n;l++){
	if(v[i][j] == l) a[i][l] = 1;
      }
    }
    }
       for(i=1;i<=n;i++){
      for(j=1;j<=n;j++){
	printf("%d",a[i][j]);
	if(j != n) printf(" ");
      }
      printf("\n");
       }

       return 0;
  }

Measured memory_bytes: 680
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define endl '\n'
#define ll long long
#define pi pair<int, int>
#define f first
#define s second

const int mxn = 100;
int n;
int a[mxn];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	
	for(int i = 0; i < n; i++) cin >> a[i];
	
	sort(a, a + n);
	
	int ret = 0;
	for(int i = 0; i < n; i++)
	for(int j = 0; j < i; j++)
	for(int k = 0; k < j; k++){
	    ret += (a[i] != a[j] && a[j] != a[k] && a[j] + a[k] > a[i]);
	}
	
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 3652
using System;
class pg
 {
  static void Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    string a = Console.ReadLine();
    string[] aa = a.Split(' ');
    
    double t= 0;
    foreach(string i in aa)
    {
      double ii =1 / double.Parse(i);
      t= t+ ii;
    }
    double ret = 1/t;
    Console.WriteLine(ret);

  }
}

Measured memory_bytes: 13140
import math
from string import ascii_lowercase

a = []
a.append(input())
a.append(input())
a.append(input())
index = 0
while (True):
	if (len(a[index]) == 0):
		print(chr(index + ord('A')))
		exit()
	sym = a[index][0]
	a[index] = a[index][1:]
	index = ord(sym) - ord('a')


Measured memory_bytes: 3772
import std.stdio,std.string,std.conv,std.bigint;
void main(){
	
	int set = to!int( readln().chomp() );
	for( int i=0; i<set ; i++ ){
		BigInt x = readln().chomp();
		BigInt y = readln().chomp();
		x += y;
		if( 	BigInt("1_0000000000_0000000000_0000000000_0000000000_0000000000_0000000000_0000000000_0000000000") <= x ){
			writeln("overflow");	
		}else{
			writeln( x );
		}
	}
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

bool Solve() {
  int64 a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;

  if (w >= v) return false;
  return (v - w) * t >= abs(a - b);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  cout << (Solve() ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3652
/*
 * atcoder/abc130/a.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>

using namespace std;

#define ll long long

#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

int x[3];

void input() {
  for (int i=0;i<3;i++) cin >> x[i];
}

void solve() {
  cout << x[0] * x[1] / 2 << endl;
}

int main() {
  // cout.precision(15);
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,N) for(int i=0; i<N; i++){ ;
int main() {
int N,D;
cin>>N>>D;
vector<double>X(N);
vector<double>Y(N);
int count=0;
for(int i=0; i<N; i++){
    cin>>X.at(i);
    cin>>Y.at(i);
    if(sqrt(X.at(i)*X.at(i)+Y.at(i)*Y.at(i))<=D)
    {
        count++;
    }
}
cout<<count<<endl;
 }


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

int main(){

  string a,b,c;

  cin >> a >> b >> c;
  a[0] = a[0]-32;
  b[0] = b[0]-32;
  c[0] = c[0]-32;
  cout << a[0]<<b[0]<<c[0] << endl;

}






Measured memory_bytes: 256
s = input()
l_s = len(s)
t = input()
l_t = len(t)

dp = list([0 for _ in range(l_t+1)] for _ in range(l_s+1))

for i in range(l_s):
    for j in range(l_t):
        #dp[i+1][j+1]  = ...
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i][j]+1 , dp[i+1][j] , dp[i][j+1])
        else:
            dp[i+1][j+1] = max(dp[i][j], dp[i+1][j] , dp[i][j+1])

ans = []
l = dp[-1][-1]
i = l_s
j = l_t
while l != 0:
    if s[i-1] == t[j-1]:
        ans.append(s[i-1])
        i -= 1
        j -= 1
        l -= 1
    elif dp[i][j] == dp[i-1][j]:
        i -= 1
    else:
        j -= 1

print("".join(ans[::-1]))




Measured memory_bytes: 153248
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5e5 + 100;
struct bit{
    int n;
    vector<int> ar;
    bit(int x = 0){
        n = x;
        ar.assign(n , 0);
    }
    void upd(int i , int val){
        while(i < n) ar[i] += val , i += (i & -i);  
    }
    int qry(int i){
        int sum = 0;
        while(i > 0) sum += ar[i] , i -= (i & -i);
        return sum;
    }
};

vector<pair<int,int>> qry[N];
vector<int> last(N , -1) , ans(N , 0) , ar(N , 0);

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);

    int n , q;
    cin >> n >> q;
    for(int i = 0 ; i < n ; i++) 
        cin >> ar[i];
    
    for(int i = 0 ; i < q ; i++){
        int l , r;
        cin >> l >> r;
        l--;r--;
        qry[l].emplace_back(r , i);
    }

    bit tree(N);
    
    for(int i = n - 1 ; i >= 0 ; i--){
        int x = ar[i];
        if(last[x] == -1){
            last[x] = i;
            tree.upd(last[x] + 1 , 1);
        }else{
            tree.upd(last[x] + 1 , -1);
            last[x] = i;
            tree.upd(last[x] + 1 , 1);
        }
        for(auto [r , id] : qry[i])
            ans[id] = tree.qry(r + 1);
    }

    for(int i = 0 ; i < q ; i++)
        cout << ans[i] << '\n';
    cout << '\n';
    return 0;
}

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

int main() {
  int k, a, b;
  cin >> k >> a >> b;
  bool flag = false;

  for (int i = a; i < b + 1; i++){
    if(i % k == 0) {
      flag = true;
    }
  }

  if(flag) cout << "OK" << endl;
  else cout << "NG" << endl;
}



Measured memory_bytes: 3604
#include <iostream>

using namespace std;


void call(int n) {
    int i = 1;
    do {
        int x = i;
        if (x % 3 == 0) {
            cout << " " << i;
        }
        else {
            while (x) {
                if (x % 10 == 3) {
                    cout << " " << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    while (++i <= n);
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    call(n);
    return 0;
}

Measured memory_bytes: 1160
// file creato da gio il 2020-04-20 19:47:11.168327

#include <bits/stdc++.h>
#define FAST 

#ifdef FAST
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#endif

#define S second
#define F first
#define PB push_back
using namespace std;

int main(){
	//freopen("output","w",stdout);
	//freopen("input","r",stdin);
#ifdef FAST
	ios::sync_with_stdio(0);
  	cin.tie(0);
#endif

	int n,k,tmp;
	cin >> n>>k;
	for(int i=0;i<k;i++){
		cin >>tmp;
		n-=tmp;
	}
	if(n>=0)
		cout <<n;
	else
		cout <<-1;

}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  int d,g;
  cin >> d >> g;
  vint p(d);
  vint c(d);
  rep(i,d) cin >> p[i] >> c[i];
  int ans = 1000000;
  rep(i,1<<d){
    int count = 0;
    int gg = g;
    int maxbit = d;
    rep(j,d){
      if(i>>j&1){
        count += p[j];
        gg -= (j+1)*100*p[j] + c[j];
        //cout << "a" << count << endl;
      }
      else{
        maxbit = j+1;
      }
    }
    int pmax = p[maxbit-1];
    if(gg > 0){
      while(gg > 0){
        count++;
        gg -= maxbit*100;
        pmax--;
        //cout << "b" << count << endl;
      }
    }
    if(pmax > 0) ans = min(ans,count);
    //cout << "c" << ans << endl;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int pow3[600005];
int fact[900005];
int invf[900005];
int Power(int x, int y)
{
	int re = 1;
	while(y)
	{
		if(y & 1)
		{
			re = 1ll * re * x % MOD;
		}
		x = 1ll * x * x % MOD;
		y >>= 1;
	}
	return re;
}
int C(int n, int m)
{
	if(m < 0)
	{
		return 0;
	}
	if(n < m)
	{
		return 0;
	}
	return 1ll * fact[n] * invf[m] % MOD * invf[n - m] % MOD;
}
int n, m, k;

int main()
{
	fact[0] = 1;
	for(int i = 1; i <= 900000; i++)
	{
		fact[i] = 1ll * fact[i - 1] * i % MOD;
	}
	invf[900000] = Power(fact[900000], MOD - 2);
	for(int i = 900000; i; i--)
	{
		invf[i - 1] = 1ll * invf[i] * i % MOD;
	}
	pow3[0] = 1;
	for(int i = 1; i <= 600000; i++)
	{
		pow3[i] = 3ll * pow3[i - 1] % MOD;
	}
	scanf("%d%d%d", &n, &m, &k);
	int ans = 0;
	int t = 1;
	for(int i = 0; i <= m + k; i++)
	{
		int tmp = 1ll * C(n - 1 + i, n - 1) * t % MOD;
		tmp = 1ll * tmp * pow3[m + k - i] % MOD;
		ans = (ans + tmp) % MOD;
		t = ((2ll * t + MOD - C(i, m)) % MOD + MOD - C(i, i - k)) % MOD;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 9728
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int x;
	String s; 
	Stack stack = new Stack();
	s = sc.nextLine();
	char[] str = s.toCharArray();
	int len = s.length();
	int num = 0;
	for(int i = 0;i < len;i++){
	    num = 0;
	    boolean f = false;
	    while(i < len && str[i] <= '9' && str[i] >= '0'){
		num *= 10;
		num += str[i] - '0';
		i++;
		f = true;
	    }
	    if(f){
		i--;
		stack.push(num);
	    }else if(str[i]=='+' || str[i]=='-' || str[i]=='*' || str[i]=='/'){
		int b = (int)stack.pop();
		int a = (int)stack.pop();
		switch(str[i]) {
		case '+': stack.push(a + b); break;
		case '-': stack.push(a - b); break;
		case '*': stack.push(a * b); break;
		case '/': stack.push(a / b); break;
		default: break;
		}
	    }
	}
	System.out.println((int)stack.pop());
    }
}


class Stack{
    private int top = 0;
    private int[]  S = new int[200]; 
    private static final int MAX = 10;
    public void initialize(){
	top = 0;
    }
    public boolean isEmpty(){
	return top == 0;
    }
    public boolean isFull(){
    	return top >= MAX - 1;
    }
    public void push(int x){
    	/*if(isFull()){
	    System.out.println("Stack over flow");
    	}*/
    	top++;
    	S[top] = x;
    }
    public int pop(){
	/*if(isEmpty()){
	    throw new RuntimeException("Stack under flow");
	}*/
	top--;
	return S[top + 1];
	
    }
    
}


Measured memory_bytes: 26192
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
#include <functional>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define rep1(i, n) for(int i = 1; i <= (int) n; i++)
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;

int main() {
    int x,y;
    cin >> x >> y;
    for (int i = 0; i <= 100; i++)
    {
        for (int j = 0; j <= 100; j++)
        {
            if (i+j == x && 2*i+4*j == y) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}
/*
int main() {
    vector<int> a(5),b = {1,2,3,4,5};
    rep(i,5) {
        cin >> a[i];
        if (a[i] != b[i]) {
            cout << i+1 << endl;
        }
    }

    return 0;
}
*/

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>

using namespace std;
const int maxn = 10;
int cost[] = {0, 2,5,5,4,5,6,3,7,6};
int canUse[maxn];
string dp[10005];
bool cmp( string &a, string &b )
{
    if( a.length() == b.length() )
    {
        for( int i = 0; i < a.length(); ++ i )
        {
            if( a[i] != b[i] )
                return a[i] < b[i];
        }
    }
    return a.length() < b.length();
}
int main()
{
    int n, m;
    cin >> n >> m;
    for( int i = 1; i <= m; ++ i )
    {
        cin >> canUse[i];
        string t = ""; t += '0' + canUse[i];
        if( dp[cost[canUse[i]]] < t ) dp[cost[canUse[i]]] = t;
    }
    for( int i = 0; i <= n; ++ i )
    {
        if( dp[i] != "")
        {
            for( int j = 1; j <= m; ++ j )
            {
                string t = dp[i]; t += '0' + canUse[j];
                if( i + cost[canUse[j]] <= n )
                {
                    if( cmp(dp[i + cost[canUse[j]]] , t) ) dp[i + cost[canUse[j]]] = t;
                }
            }
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 30720
import Control.Monad

main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return()
    else do
      ls <- replicateM n getLine
      let ls' = map (map (read :: String -> Int)) (map words ls)
          ans = sum (map check (map fix ls'))
      putStrLn $ show ans
      main

fix :: [Int] -> (Int,Int)
fix [x,y,h,w] = (x+y+h,w)

checkl :: (Int,Int) -> Int
checkl (l,_)
  |l <= 60 = 600
  |l <= 80 = 800
  |l <= 100 = 1000
  |l <= 120 = 1200
  |l <= 140 = 1400
  |l <= 160 = 1600
  |otherwise = 0

checkr :: (Int,Int) -> Int
checkr (_,r)
  |r <= 2 = 600
  |r <= 5 = 800
  |r <= 10 = 1000
  |r <= 15 = 1200
  |r <= 20 = 1400
  |r <= 25 = 1600
  |otherwise = 0

check :: (Int,Int) -> Int
check t
  |checkl t == 0 = 0
  |checkr t == 0 = 0
  |otherwise = max (checkl t) (checkr t)

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

int pop_count(int bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int N, M;
vector<pair<int, int>> edges[50];

int mask[50];
bool dfs_mask(int i, int p, int target, int ei, int b){
    bool ok = (i==target);
    for(auto& e : edges[i]) if(e.first != p) ok |= dfs_mask(e.first, i, target, e.second, b);
    if(ok && ei >= 0) mask[ei] |= 1<<b;
    return ok;
}

int main(){
    cin >> N;
    for(int i=0; i<N-1; i++){
        int a, b;
        cin >> a >> b;
        edges[a-1].emplace_back(b-1, i);
        edges[b-1].emplace_back(a-1, i);
    }
    cin >> M;
    for(int i=0; i<M; i++){
        int a, b;
        cin >> a >> b;
        dfs_mask(a-1, -1, b-1, -1, i);
    }
    int64_t ans = 0;
    for(int b=0; b<(1<<M); b++){
        int64_t res = 1;
        for(int i=0; i<N-1; i++) if(!(b & mask[i])) res *= 2;
        if(pop_count(b)%2) res *= -1;
        ans += res;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
	ll N;
	cin >>N;
	ll ans = N;
	for (ll i = 1; i*i <= N; i++) {
		if (N%i == 0 ) {
			ans = min(ans, i + N / i - 2);
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


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


const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	// Point: ans = (10の個数) = min((2の個数),(5の個数))
	// nが奇数の場合、素因数2がどの数にも含まれないので0
	if (n % 2 == 1) {
		cout << 0 << endl;
	}
	else {
		int now = 1;
		int ans = 0;
		// 素因数2の個数よりも明らかに素因数5の個数の方が少ない
		// よって、各数が素因数5で何回割れるか求めればよい。
		// ans = (n/(2*5))+(n/(2*25))+(n/(2*125))・・・
		rep(i, 25) {
			now *= 5;
			ans += n / (2 * now);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for (int i=a; i<(b);++i)

int N;
string S;
char dp[110000];
void check(){
    rep(i,1,N+1){
        if(dp[i-1]=='S' && dp[i]=='S'){
            if(S[i]=='o') dp[i+1] = 'S';
            else dp[i+1] = 'W';
        } else if(dp[i-1]=='S' && dp[i]=='W'){
            if(S[i]=='o') dp[i+1] = 'W';
            else dp[i+1] = 'S';
        } else if(dp[i-1]=='W' && dp[i]=='S'){
            if(S[i]=='o') dp[i+1] = 'W';
            else dp[i+1] = 'S';
        } else if(dp[i-1]=='W' && dp[i]=='W'){
            if(S[i]=='o') dp[i+1] = 'S';
            else dp[i+1] = 'W';
        }
    }
}
int main(){
    cin >> N >> S;
    S += S[0]; // 0と1の確認のために
    // 0 と1を仮定すると、S[1]の符号により2がわかる。
    // N-1まで決めて、S[N-1]の符号と合わせて0と矛盾しないかチェック

    dp[0] = 'S', dp[1] = 'S';
    check();
    if(dp[N] == dp[0] && dp[N+1] == dp[1]){
        REP(i,N) cout << dp[i];
        cout << endl;
        return 0;
    }
    dp[0] = 'S', dp[1] = 'W';
    check();
    if(dp[N] == dp[0] && dp[N+1] == dp[1]){
        REP(i,N) cout << dp[i];
        cout << endl;
        return 0;
    }
    dp[0] = 'W', dp[1] = 'S';
    check();
    if(dp[N] == dp[0]&& dp[N+1] == dp[1]){
        REP(i,N) cout << dp[i];
        cout << endl;
        return 0;
    }
    dp[0] = 'W', dp[1] = 'W';
    check();
    if(dp[N] == dp[0]&& dp[N+1] == dp[1]){
        REP(i,N) cout << dp[i];
        cout << endl;
        return 0;
    }
    cout << -1 << endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
typedef long long int ll;
#define graphsize 2000007

ll tree[graphsize];
ll arr[graphsize];

ll buildtree(ll left,ll right,ll index){
    if(left==right){
        tree[index] = arr[left];
        return arr[left];
    }

    ll mid = left +((right-left)/2);
    ll leftsum = buildtree(left,mid,index*2);
    ll rightsum = buildtree(mid+1,right,index*2+1);
    tree[index]=leftsum+rightsum;
    return tree[index];
}

void update(ll left,ll right,ll index,ll value,ll currindex){
    if(left==right && left==currindex){
        tree[index]+=value;
        return;
    }

    if(left==right){
        return;
    }

    

    ll mid = left+((right-left)/2);
    tree[index]+=value;
    if(currindex<=mid){
        update(left,mid,index*2,value,currindex);
    }else{
        update(mid+1,right,index*2+1,value,currindex);
    }
    return;
}

ll query(ll left,ll right,ll index,ll start,ll end){
    if(left>end || right<start){
        return 0;
    }
    if(left>=start&&right<=end){
        return tree[index];
    }
    if(left==right){
        return tree[index];
    }

    ll mid = left+((right-left)/2);
    ll leftq = query(left,mid,index*2,start,end);
    ll rightq = query(mid+1,right,index*2+1,start,end);
    return leftq+rightq;
    
}

int main(){
    ll n,q,a,b,c;
    cin>>n>>q;
    for(ll i=1;i<=n;i++){
        cin>>arr[i];
    }
    buildtree(1,n,1);
    for(ll i=0;i<q;i++){
        cin>>a>>b>>c;
        if(a==0){
            update(1,n,1,c,b+1);
        }else{
            cout<<query(1,n,1,b+1,c)<<endl;
        }
    }
}

Measured memory_bytes: 16432
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int R=scan.nextInt();
		int a;
		a=100*(10-N);
		if(N>=10) {
			System.out.println(R);
		}
		else {
			System.out.println(R+a);
		}
	}
}


Measured memory_bytes: 21716
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) int(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod = 998244353;
const int inf = 9e18;
const int N = 1e5 + 5;

void solve(){
    int i,n;
    cin>>n;
    int ans=2;
    for(i=2;i*i<=n-1;++i){
        if((n-1)%i==0){
            ++ans;
            if(i!=(n-1)/i)
                ++ans;
        }
    }
    for(i=2;i*i<=n;++i){
        if(n%i==0){
            int m=n;
            while(m%i==0)
                m/=i;
            if(m%i==1)
                ++ans;
            if(i!=n/i){
                int m=n;
                while(m%(n/i)==0)
                    m/=n/i;
                if(m%(n/i)==1)
                    ++ans;
            }
        }
    }
    if(n==2){
        cout<<1;
        return;
    }
    cout<<ans;
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}

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


long long A, B, C, K, N,ans,six,nine;
bool L; //lを動かすときtrue
int main(){
	ans = 1000000000;
	cin >> N;
	six = nine = 0;
	for (int i = 0; i <= N; i++){
		A = i;
		while (A > 0){
			six += A % 6;
			A /= 6;
		}
		B = N - i;
		while (B>0){
			nine += B % 9;
			B /= 9;
		}
		ans = min(ans, nine + six);
		nine = 0;
		six = 0;
	}

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if((a+b+c)<=21) cout << "win" << endl;
    if((a+b+c)>=22) cout << "bust" << endl;
}

Measured memory_bytes: 256
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).ok();
    let v: Vec<u16> =
        line.split_whitespace().map(|n| n.parse().unwrap()).collect();
    let a = v[0];
    let b = v[1];
    let ans =
        if a%3==0 || b%3==0 || (a+b)%3==0 {
            "Possible"
        } else {
            "Impossible"
        };
    println!("{}", ans);
        
}


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

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

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;


const int SIZE = 1e5+100;
string s;

int main(){
    cin >> s;
    for(int i = 0; i < s.length()-1; i++){
        if(s[i] == 'A'){
            if(s[i+1] == 'C'){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 256
#include <stdio.h>


int main () {
    int n;
    scanf("%d", &n);
    char echo[n + 1];
    scanf("%s", echo);
    if (n % 2 == 1) {
        puts("No");
    }
    else {
        int flag = 1;
        for (int i = 0; i < n / 2; i++){
            if (echo[i] != echo[i + n / 2]){
                flag = 0;
            }
        }
        if (flag){
            puts("Yes");
        }
        else {
            puts("No");
        }
    }
    return 0;
}

Measured memory_bytes: 1644
#include <bits/stdc++.h>
#define N 200
using namespace std;

bool isEven(int a[],int n){
    while(n--){
        if(a[n]%2) return false;
    }
    return true;
}

void half(int a[],int n){
    while(n--) a[n]/=2;
}

int main(){
    int c=0,n,a[200];
    cin >> n;
    
    for(int i=0; i<n; i++) cin >> a[i];
    
    while(isEven(a,n)){
        half(a,n);
        c++;
    }
    
    cout << c << "\n"; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool func(int a,int b)
{
    return a>b;
}
int main()
{
    int i,j,ara[100000];
    for (i=0;i<10;i++)
        cin>>ara[i];
    sort(ara,ara+10,func);
    for (i=0;i<3;i++)
        cout<<ara[i]<<endl;

}


Measured memory_bytes: 3144
#include <iostream>
using namespace std;
int main(){
	int n;
	int t=0,h=0;
	cin>>n;
	for(int i=0;i<n;i++){
		string tc,hc;
		cin>>tc>>hc;
		if(tc==hc){
			t++;h++;
		}else if(tc>hc){
			t+=3;
		}else{
			h+=3;
		}
	}
	cout<<t<<" "<<h<<endl;
	return 0;
}

Measured memory_bytes: 1212