akhauriyash/Code-Regression huggingface dataset:
/***********************************************************
	When you are inspired by passion 
	and you want to live for the current moment

	When your every thought and action
	has the power to become the story of your future

	When difficulties stand to demolish your Glory
	Just remember that Life is a 'Golden adverse Story'

	Withstand it to acheive your passion and dreams
	more amazingly more easily.

	Why then? When writing the story of your Life
	You want to Let someone else hold your pen

					huzaifa242©

***********************************************************/
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define MAX 100005
#define x first 
#define y second

int seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l=0,int r=INT_MAX)
{return uniform_int_distribution<int>(l,r)(rng);}

template <typename T,typename G>
ostream& operator << (ostream& out, const pair<T,G> &a) 
{return out<<"( "<<a.x<<", "<<a.y<<")";}

template <typename T>
ostream& operator << (ostream& out, const vector<T> &a) 
{out<<"[ ";for(const auto &i:a)out<<i<<", ";return out<<"]"<<endl;}

template <typename T>
ostream& operator << (ostream& out, const set<T> &a) 
{out<<"{ ";for(const auto &i:a)out<<i<<", ";return out<<"}"<<endl;}

template <typename T,typename G>
ostream& operator << (ostream& out, const map<T,G> &a) 
{out<<"< ";for(const auto &i:a)out<<i<<", ";return out<<">"<<endl;}

template<typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
ostream&>::type operator<<(ostream& out, T(&a)[N])
{out<<"[ ";for(size_t i=0;i<N;++i)out<<a[i]<<", ";out <<"]"<<endl;return out;}

void debug_out(){cerr<<endl;} 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{cerr<<(H)<<" ";debug_out(T...);}
 
#ifdef LOCAL
#define debug(...) cerr<<"#"<<#__VA_ARGS__<<":\n",debug_out(__VA_ARGS__)
#else
#define debug(...) 24
#endif

signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,m,i,j,x;
	cin>>n>>m>>x;
	vector<int> c(n);
	vector<vector<int> > a(n,vector<int>(m));
	for(i=0;i<n;i++){
		cin>>c[i];
		for(j=0;j<m;j++)
			cin>>a[i][j];
	}
	int ans=LLONG_MAX;
	for(i=0;i<(1<<n);i++){
		vector<int> sm(m,0);
		int cost=0;
		for(j=0;j<n;j++){
			if(i&(1<<j)){
				for(int k=0;k<m;k++)
					sm[k]+=a[j][k];
				cost+=c[j];	
			}
		}
		for(j=0;j<m;j++)
			if(sm[j]<x)
				break;
		if(j==m)
			ans=min(ans,cost);
	}
	if(ans==LLONG_MAX)
		ans=-1;
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 3660
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  if (readln.chomp.to!int == 1) {
    writeln("Hello World");
  } else {
    int a, b;
    readf("%d\n%d",&a,&b);
    writeln(a+b);
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int n, m; cin >> n >> m;
  int p;
  vector<int> cnt(n, 0);
  vector<bool> ac(n, false);
  string s;
  int acn = 0;
  int pe = 0;
  for(int i=0; i<m; i++) {
    cin >> p >> s;
    p--;
    if (ac[p]) continue;
    if (s == "AC") {
      ac[p] = true;
      acn++;
      pe += cnt[p];
    } else {
      cnt[p]++;
    }
  }

  cout << acn << " " << pe << endl;

  return 0;
}


// EOF


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>

int N;
int max_num_robots = 0;
std::vector<std::pair<int,int>> right_left;

int main() {
  std::cin >> N;
  right_left.reserve(N);
  for (int i = 0; i < N; ++i) {
    int x, l;
    std::cin >> x >> l;
    right_left.push_back(std::make_pair(x + l, x - l));
  }
  std::sort(right_left.begin(),right_left.end());
  int current_mostright = 0;
  for (int i = 0; i < N; ++i) {
    if (i == 0) {
      current_mostright = right_left[0].first;
      ++max_num_robots;
    } else if (current_mostright <= right_left[i].second) {
      current_mostright = right_left[i].first;
      ++max_num_robots;
    }
  }
  std::cout << max_num_robots << std::endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		vector<UL> V = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
		UL K; cin >> K;
		cout << V[K - 1] << endl;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


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



int main(void){
    int n,m;
    cin >> n >> m;
    vector<int>x;
    rep(i,m){
        int a;
        cin >> a;
        x.push_back(a);
    }
    sort(x.begin(),x.end());
    ll ans = 0;
    if (m==1){
        ans = 0;
    }
    else{
        vector<int>bl;
        rep(i,m-1){
            bl.push_back(x[i+1]-x[i]);
        }
        ans = x[m-1]-x[0];
        sort(bl.begin(),bl.end(),greater<int>());
        rep(i,n-1){
            ans -= bl[i];
            if(i==m-1){
                break;
            }
        }
    }
    
    cout << ans <<endl;
    
    
    
    return 0;
}















































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

using namespace std;
#define INF (1<<28)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long

signed main(){
	int h,w;;
	cin>>h>>w;
	vector<int> a,b;
	lp(i,h){
		lp(j,w){
			char c;
			cin>>c;
			if(c=='B'){
				a.push_back(i+j);
				b.push_back(j-i);
			}
		}
	}
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	cout<<max(abs(a[0]-a[a.size()-1]),abs(b[0]-b[b.size()-1]))<<endl;
	return 0;
}


Measured memory_bytes: 3196
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &b : a) cin >> b;
    sort(a.begin(), a.end());
    int s = 0, t = 0;
    for (int i = 0; i < n; i++) {
        if (i&1) t += a[i];
        else s += a[i];
    }
    
    cout << abs(s - t) << endl;
    return 0;
}
        

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,q;
long long m;
vector<int>adj[100001];
int u[100001],v[100001],w[100001];
bool tree;
int cc;
int par[100001];
int find(int x){
	if(par[x]!=x) par[x]=find(par[x]);
	return par[x];
}
void join(int x,int y){
	x=find(x);y=find(y);
	cc-=(x!=y);
	par[x]=y;
}
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> m >> q;
	tree=m==n-1;cc=n;
	for(int i=1; i<=n ;i++){
		par[i]=i;
	}
	for(int i=1; i<=q ;i++){
		cin >> u[i] >> v[i] >> w[i];
		if(w[i]==0) join(u[i],v[i]);
		tree&=(w[i]!=1);
	}
	for(int i=1; i<=q ;i++){
		if(!w[i]) continue;
		if(find(u[i])==find(v[i])) return cout << "No\n",0;
	}
	if(tree) return cout << "Yes\n",0;
	if(cc<=2) return cout << "No\n",0;
	if(m>=n && m<=n+1LL*cc*(cc-3)/2) cout << "Yes\n";
	else cout << "No\n";
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(void){
    int n; cin >> n;
    vector<vector<int>> a(n,vector<int>(n,-1));
    for(int i=0;i<n;i++){
        int cnt; cin >> cnt;
        for(int j=0;j<cnt;j++){
            int x,y; cin >> x >> y;x--;
            a[i][x] = y;
        }
    }

    // for(int i=0;i<n;i++){
    //     for(int j=0;j<n;j++){
    //         cout << a[i][j] << ' ';
    //     }cout << endl;
    // }cout << endl;

    int ans = 0;
    for(int i=0;i<(1<<n);i++){
        bool br = false;
        vector<int>flag(n,-1);
        int tmp=0;
        for(int j=0;j<n;j++){
            if(((i>>j)&1)==1){
                tmp++;
                flag[j]=1;
            }
        }

        // for(int j=0;j<n;j++){
        //     cout << flag[j] << ' ';
        // }cout << endl;

        for(int j=0;j<n;j++){
            if(flag[j]==1){
                // cout << j <<"->"<< (i>>0) <<endl;
                for(int k=0;k<n;k++){
                    if((a[j][k] ==1 && flag[k]!=1)||(a[j][k]==0 && flag[k]==1)){
                        // cout << i << ' ' << j <<' ' <<  k <<' ' << a[j][k] << ' ' << flag[k] << endl;
                        br = true;
                        break;
                    }else if(a[j][k]==-1){
                        continue;
                    }else{
                        flag[k]=a[j][k];
                    }
                }
            }
            if(br==true)break;
        }
        if(br==false && ans < tmp)ans = tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> G(H);
  rep(i, H) {
    cin >> G[i];
  }
  vector<int> rows, cols;
  rep(i, H) {
    bool ok = false;
    rep(k, W) if (G[i][k] == '#') {
      ok = true;
      break;
    }
    if (ok) rows.push_back(i);
  }
  rep(k, W) {
    bool ok = false;
    rep(i, H) if (G[i][k] == '#') {
      ok = true;
      break;
    }
    if (ok) cols.push_back(k);
  }
  for (auto r : rows) {
    for (auto c : cols) cout << G[r][c];
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1000000007;

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------
class UnionFind{

public:
  vector<int> parents;

  UnionFind(int n){
    parents.assign(n, -1);
  }
  ~UnionFind(){}

  int find(int x){
    if(parents[x]<0){
      return x;
    } else {
      return find(parents[x]);
    }
  }

  void unite(int x, int y){
    x = find(x);
    y = find(y);
    if(x==y){return;}

    if(parents[x]>parents[y]){
      int tmp = x;
      x = y;
      y = tmp;
    }

    parents[x] += parents[y];
    parents[y] = x;
  }

  int size(int x){
    return -parents[find(x)];
  }

  int count_roots(){
    int ct=0;
    for(int i=0; i<parents.size(); i++){
      if(parents[i]<0){ct++;}
    }
    return ct;
  }

  bool is_same(int x, int y){
    return find(x) == find(y);
  }
};

int main(void) {
  int n, m;
  cin >> n >> m;

  UnionFind uf(n);
  rep(i,m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a,b);
  }

  int ans=0;
  rep(i,n){
    chmax(ans, uf.size(i));
  }

  prt(ans);

}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
#define pp pair<int,int>
#define MZ 1000000007
#define pq priority_queue
using namespace std;
int r,c;
struct Node
{
    int no,types;
    friend bool operator <(Node x1,Node x2)
    {
        return x1.no>x2.no;
    }
}temp;
bool ok(int x,int y)
{
    if(x==0 || x==r || y==0 || y==c)
        return 1;
    else
        return 0;
}
int nums(int x,int y)
{
    if(y==0)
        return x;
    else
    {
        if(x==r)
            return r+y;
        else
        {
            if(y==c)
                return r*2+c-x;
            else
                return r*2+c*2-y;
        }
    }
}
int ps=-1;
int st[200005];
pq <Node> q;
int main()
{
    int n;
    int x1,x2,y1,y2,num1,num2;
    bool flag=0;
    scanf("%d%d%d",&r,&c,&n);
    while(n)
    {
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(ok(x1,y1) && ok(x2,y2))
        {
            num1=min(nums(x1,y1),nums(x2,y2));
            num2=max(nums(x1,y1),nums(x2,y2));
            temp.no=num1;
            temp.types=-n;
            q.push(temp);
            temp.no=num2;
            temp.types=n;
            q.push(temp);
        }
        n--;
    }
    while(!q.empty())
    {
        temp=q.top();
        q.pop();
        if(temp.types<0)
            st[++ps]=temp.types;
        else
        {
            if(ps<0 || st[ps]+temp.types!=0)
                flag=1;
            else
                ps--;
        }
    }
    if(flag)
        printf("NO\n");
    else
        printf("YES\n");
    return 0;
}


Measured memory_bytes: 2420
N, M = map(int, input().split())
MOD = 1000000007
s = [int(input()) for i in range(M)]
s.append(N+1)

def fiv(n):
  a, b = 0, 1
  if n == 0:
    return 1
  elif n == 1:
    return 1
  else:
    for i in range(n):
      a, b = b, a+b
    return b

r = 1

for j in range(1,M):
  if s[j-1] +1 == s[j]:r = 0

if M == 1:
  r = fiv(s[0]-1)*fiv(N-s[0]-1)
else:
  r = r*fiv(s[0]-1)
  for j in range(1,M+1):
      r = r*fiv(s[j]-s[j-1]-2)

print(r%MOD)

Measured memory_bytes: 7080
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
int main()
{
    scanf("%d %d",&n,&m);
    if(n%2==0&&m==n/2-1)
	{
		        int m2 = m / 2;
        int m1 = m - m2;
        for (int i = 1; i <= m1; ++i) {
            std::cout << i << " " << m1 * 2 + 1 - i << std::endl;
        }
 
        int d = m1 * 2;
        for (int i = 1; i <= m2; ++i) {
            std::cout << d + i << " " << d + m2 * 2 + 2 - i << std::endl;
        }
	}
	else
	{
		for(int i=1;i<=m;i++)printf("%d %d\n",i,n-i+1);
	}
    return 0;
}

Measured memory_bytes: 3820
#include<stdio.h>

int main(void){
    int r,g,b,color=0;
    scanf("%d %d %d",&r ,&g, &b);
    color = r*100 + g *10 + b;
    if (color % 4 == 0) {
       printf("YES\n");
    }else{
       printf("NO\n");
    } return 0;
}

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

vector<int> prime;

void hurui(){
  prime.push_back(2);
  for(int i=3;i<=1000000;i++){
    int flag=1;
    for(int j=0;j<prime.size()&&prime[j]*prime[j]<=i;j++){
      if(i%prime[j]==0){
	flag=0;
	break;
      }
    }
    if(flag==1)prime.push_back(i);
  }
}
	
      
int n,p;
vector<int> np;
vector<int> nppl;
int main(){
  hurui();
  while(1){
    cin>>n>>p;
    np.clear();
    while(nppl.size())nppl.pop_back();
    if(n==-1&&p==-1)break;
    for(int i=0;i<prime.size()&&np.size()<=120;i++){
      if(prime[i]>n){
	np.push_back(prime[i]);
      }
    }
    for(int i=0;i<np.size();i++){
      for(int j=i;j<np.size();j++){
	nppl.push_back(np[i]+np[j]);
      }
    }
    sort(nppl.begin(),nppl.end());
    cout<<nppl[p-1]<<endl;
  }
  return 0;
}



Measured memory_bytes: 3348
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>

using namespace std;

int main(){
  int n;
  
  cin >> n;
  
  int i,j,H;
  vector<int> x(n),y(n),h(n);
  
  bool jud;
  
  for(int k = 0 ; k < n ; k++){
    cin >> x[k] >> y[k] >> h[k];
  }
  
  for(i = 0 ; i <=100 ; i++){
    for(j = 0 ; j <= 100 ; j++){
      for(int k = 0 ; k < n ; k++){
        if(h[k] != 0){
          H = h[k] + abs(i-x[k]) + abs(j-y[k]);
          break;
        }
      }
      
      jud = true;
      for(int k = 0 ; k < n ; k++){
        if(h[k] != max(H - abs(i-x[k]) - abs(j-y[k]), 0)){
          jud = false;
          break;
        }
      }
      if(jud) break;
    }
    if(jud) break;
  }
  cout << i << " " << j << " " << H << endl; 
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

int main(void) {
    int a, b;
    while(1) {
        scanf("%d%d", &a, &b);
        if (a == 0 && b == 0) break;
        if ( a > b ) printf("%d %d\n", b, a);
        else printf("%d %d\n", a, b);
    }
    return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof (x))
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define kill _z_kill
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outv(x) cerr<<#x" = "<<x<<"  "
#define outtag(x) cerr<<"--------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
	For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
#define User_Time ((double)clock()/CLOCKS_PER_SEC)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned uint;
typedef long double LD;
typedef vector <int> vi;
typedef pair <int,int> pii;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
//int Pow(int x,int y){
//	int ans=1;
//	for (;y;y>>=1,x=(LL)x*x%mod)
//		if (y&1)
//			ans=(LL)ans*x%mod;
//	return ans;
//}
//void Add(int &x,int y){
//	if ((x+=y)>=mod)
//		x-=mod;
//}
//void Del(int &x,int y){
//	if ((x-=y)<0)
//		x+=mod;
//}
//int Add(int x){
//	return x>=mod?x-mod:x;
//}
//int Del(int x){
//	return x<0?x+mod:x;
//}
//void ckmax(int &x,int y){
//	if (x<y)
//		x=y;
//}
//void ckmin(int &x,int y){
//	if (x>y)
//		x=y;
//}
int main(){
	int x=read();
	x=__gcd(x,360);
	cout<<360/x<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>                                               //scanf,printf
#include <algorithm>                                            //max,min
#include <string>                                               //string
#include <cstring>                                              //strlen,strcat
#include <cctype>                                               //isalpha,tolower
#include <cmath>                                                //sqrt,sin
#include <stack>                                                //top,push
#include <queue>                                                //front,push
#include <vector>                                               //push_back,sort
#include <set>                                                  //insert,begin
#include <map>                                                  //insert,find
#include <list>                                                 //push_front,begin
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>                                               //pow,powf
#define INF (1<<21)
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll         long long
#define pl pair<long long, long long>
#define pr pair<int,int>

#define MAX_E 2001
#define MAX_v 1001


struct edge{
  int from,to,cost;
};

edge es[MAX_E];
int d[MAX_v];
int v,e;

bool bellman_ford(int s){
  for(int i=0; i<v; i++){
    d[i]=INF;
  }
  d[s]=0;
  for (int j=0; j<v; j++) {
    for(int i=0; i<e; i++){
      edge e=es[i];
      if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost){
        d[e.to]=d[e.from]+e.cost;
        
        if(j==v-1) return true;
      }
    }
  }
  return false;
}

int main(){
  int r;
  cin>>v>>e>>r;
  for(int i=0; i<e; i++){
    cin>>es[i].from>>es[i].to>>es[i].cost;
  }
  if(bellman_ford(r)) {
    cout<<"NEGATIVE CYCLE"<<endl;
    return 0;
  }
  
  for(int i=0; i<v; i++){
    if(d[i]==INF) cout<<"INF"<<endl;
    else cout<<d[i]<<endl;
  }
}



Measured memory_bytes: 3096
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int n,m;
vector<int> v[100010];
ll dp[100010];
void dfs(int x){
	if(v[x].size()==0){
		dp[x]=0;
	}
	rep(i,v[x].size()){
		if(dp[v[x][i]]==-LLINF){
			dfs(v[x][i]);
		}
		dp[x]=max(dp[x],dp[v[x][i]]+1);
	}
}
int main(int argc,char** argv){
	cin>>n>>m;
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		v[a].pb(b);
	}
	rep(i,n){
		dp[i]=-LLINF;
	}
	rep(i,n){
		if(dp[i]==-LLINF){
			dfs(i);
		}
	}
	ll mx=-LLINF;
	rep(i,n){
		//cout<<dp[i]<<endl;
		mx=max(mx,dp[i]);
	}
	cout<<mx;
	return 0;
}

Measured memory_bytes: 9216
N = int(input())
mod = 10**9+7
data = dict([(i+j+k, 1) for i in "ACGT" for j in "ACGT" for k in "ACGT"])
data["AGC"] = 0
data["ACG"] = 0
data["GAC"] = 0

def check(text):
    one = text[0]
    two = text[1]
    three = text[2]
    four = text[3]
    if "AGC" in text:
        return False
    if "AGC" in two + one + three + four:
        return False
    if "AGC" in one + three + two + four:
        return False
    if "AGC" in one + two + four + three:
        return False
    return True


for i in range(N-3):
    new_data = dict([(i+j+k, 0) for i in "ACGT" for j in "ACGT" for k in "ACGT"])
    for s in data.keys():
        for c in "ACGT":
            if(not check(s+c)):
                continue
            new_data[s[1:]+c] += data[s]%mod
    data = new_data.copy()
print(sum(data.values())%mod)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

import heapq

def main():
  n = int(input())
  T = [[] for _ in range(n)]
  for i in range(1, n):
    a = int(input())
    a -= 1
    T[a].append(i)

  def dfs(v):
    if not T[v]:
      return 0
    L = []
    for i in T[v]:
      heapq.heappush(L, dfs(i)+1)
    temp = heapq.heappop(L)
    while L:
      temp = max(temp+1, heapq.heappop(L))
    return temp

  ans = dfs(0)
  print(ans)
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 131480
use proconio::input;
use std::cmp::min;

fn main() {
    input! {
        a: usize,
        b: usize,
        ab: usize,
        mut x: usize,
        mut y: usize,
    }

    let mut res = 0;
    if a + b <= 2 * ab {
        res = a * x + b * y;
    } else {
        let mini = min(x, y);
        res += ab * 2 * mini;
        x -= mini;
        y -= mini;
        // println!("{}, {}", x, y);
        res += min(a, 2 * ab) * x + min(b, 2 * ab) * y;
    }
    println!("{}", res);
}


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

int main(){
  int N;
  cin >> N;
  int c_p = 0, c_w = 0, c_g = 0, c_y = 0;
  string S;
  
  for (int i = 0; i < N; i++){
    cin >> S;
    if (S == "P"){
      if (c_p == 0){
        c_p += 1;
      }
    }
    if (S == "W"){
      if (c_w == 0){
        c_w += 1;
      }
    }
    if (S == "G"){
      if (c_g == 0){
        c_g += 1;
      }
    }
    if (S == "Y"){
      if (c_y == 0){
        c_y += 1;
      }
    }
  }
  
  int c = c_p + c_w + c_g + c_y;
  if (c == 3){
    cout << "Three" << endl;
  }
  else if (c == 4){
    cout << "Four" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	
	int j;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'C') {
			j = i + 1;
			while (j < s.length()) {
				if (s[j] == 'F') {
					cout << "Yes" << endl;
					return 0;
				}
				j++;
			}
		}
	}
	cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <climits>
#include <cmath>
#include <algorithm>

#define TEST_ASSERT(msg, cond) do { if (cond) { cout << msg << " => pass" << endl;} else { cout << msg << " => failed" << endl;} } while(0)

using namespace std;

int main() {

  int x,y,z;
  cin >> x;
  cin >> y;
  cin >> z;

  int max = 0;
  for (int i = 1; i <= 1000000; ++i) {
	  if (x < (i*y + z*(i+1))) {
		  max = i - 1;
		  break;
	  }
  }

  cout << max << endl;

  return 0;
}


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

int main(){

    long long A,B,K=0,ans=0;
    cin >> A >> B;

    if(A>=B)
        K=A;
    else
        K=B;
    for(K; K>1; K--){
        if(A%K==0 && B%K==0)
            break;
    }
    
    K = K*A/K*B/K;

    cout << K << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define PI            3.14159265
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),v.rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>
#define msi           map<string,int>

int gcd(int a, int b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
int lcm (int a, int b) {
    return a/gcd(a, b)*b;
}
int find(int a, int b, int c){
    if(a%c==0) return (b/c)-(a/c)+1;
    else return (b/c)-(a/c);
}
int solve(){
   int a,b,c,d;
   cin>>a>>b>>c>>d;
   int sa=find(a,b,d);
   int sb=find(a,b,c);
   int sc=find(a,b,lcm(c,d));
   cout<<(b-a+1)-(sa+sb-sc);
}

signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
char s1[10000000];
char s2[10000000];
char s3[10000000];
int main()
{
    ll test,n,i,j,k,l,m;
    cin>>s1;
    n=strlen(s1);
    for(i=0;i<n;i++)
        printf("x");
    return 0;
}


Measured memory_bytes: 2304
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
int A[100];
int main(){
	int n,cnt=0;scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&A[i]);
	for(int i=n-1;i>=0;i--){
		int flg=0;
		for (int j=0;j<i;j++)
			if (A[j]>A[j+1]){
				swap(A[j],A[j+1]);
				flg=1;cnt++;
			}
		if (!flg) break;
	}
	for (int i=0;i<n;i++){
		printf("%d",A[i]);
		if (i==n-1) printf("\n");
		else printf(" ");
	}
	printf("%d\n",cnt);
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
// #define int long long
#define ll int
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 
const int N=1e6+10;
 int vis[N];

int solve(){
    int n;cin>>n;
    int a[n];
    inputarr(a,n);
    // mii m;
    for(int i=0;i<n;i++) vis[a[i]]+=1;
    int ans=0;
for(int i=0;i<n;i++){
    int x=1;
    for(int j=1;j*j<=a[i];j++){
        if(a[i]%j==0){
            if(a[i]!=j){
                if(vis[j]) x=0;
            } 
            else if(vis[j]>1) x=0;
            int x2=a[i]/j;
            if(x2==j) continue;
            if(a[i]!=x2){
                if(vis[x2]) x=0;
            }
            else if(vis[x2]>1) x=0;
        }
    }
        ans+=x;
}
cout<<ans<<endl;




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


Measured memory_bytes: 8228
#include<bits/stdc++.h>
using namespace std;
const int N=1000010;
char s[N];
int a[N];
int dp[N][2],n;
int main()
{
	scanf("%s",s);
	n=strlen(s);
	for(int i=n-1;i>=0;--i) a[i+1]=s[i]-'0';
	dp[n][0]=a[n];dp[n][1]=10-a[n];
	//printf("dp[%d][0]=%d,dp[%d][1]=%d\n",n,dp[n][0],n,dp[n][1]);
	for(int i=n-1;i>=0;--i){
		dp[i][0]=min(dp[i+1][0]+a[i],dp[i+1][1]+a[i]+1);
		dp[i][1]=min(9-a[i]+dp[i+1][1],10-a[i]+dp[i+1][0]);
		//printf("dp[%d][0]=%d,dp[%d][1]=%d\n",i,dp[i][0],i,dp[i][1]);
	}
	printf("%d",min(dp[1][0],dp[1][1]+1));
	return 0;
}

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = int64_t;

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; }
const int INF = 1'001'001'001;
const ll INFL = (1LL<<60);
const double eps = (1e-9);

const int mod = 1000000007;

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

  int n;
  cin >> n;

  ll power = 1;

  for (ll i = 1; i <= n; i++) {
    power *= i;
    power %= mod;
  }

  cout << power << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
 
  int n;

  while(cin>>n, n){
    int ans=0;
    for(int i=0;i<n;i++){
      int cnt=0, sum=0;
      for(int j=i+1;j<n;j++){
	cnt++;
	sum+=j;
	if(sum>n) break;
	if(cnt>1&&sum==n) ans++;
      }
    }
    cout<<ans<<endl;
  }
     
  return 0;
}

Measured memory_bytes: 3080
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define speed ios::sync_with_stdio(false)
#define pb push_back
#define mp make_pair
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) (x).begin(), (x).end()
#define uint usigned int
typedef vector <pair<ll,ll>> vi;
ll mod=1918;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n,m,k,a,b,i,x=101,p,y,j,z=0,ans=0,sum=0,c=0;
	cin>>n;
	string s;
	cin>>s;
	for(i=0;i<n;i++){
	    if(s[i]=='R') c++;
	}
	if(2*c>n) cout<<"Yes";
	else cout<<"No";
    return 0; 
}

Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> inline void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> inline void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }
TPL<TNM T> inline void UNIQUE(vector<T>& vec) { sort(ALL(vec)); vec.erase(unique(ALL(vec)), vec.end()); }

vec<string> S;
int H, W;
int ans = 0;
int dx[] = { 1, -1, 0, 0 };
int dy[] = { 0, 0, 1, -1 };

inline bool range2d(int x, int y, int W, int H) { return (x >= 0) && (W >= x) && (y >= 0) && (H >= y); }




int main(void) {
	int N;
	int A, B;
	cin >> N >> A >> B;
	vec<int> P(N);
	REP(i, N) {
		cin >> P[i];
	}
	int x, y, z;
	x = y = z = 0;
	REP(i, N) {
		if (P[i] <= A)++x;
		else if (A + 1 <= P[i] && P[i] <= B)++y;
		else if (B + 1 <= P[i])++z;
	}
	cout << min({ x, y, z }) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define il inline
#define RG register
#define ll long long

using namespace std;

int a[2][105],f[2][105],n;

il int gi(){
  RG int x=0,q=1; RG char ch=getchar();
  while ((ch<'0' || ch>'9') && ch!='-') ch=getchar();
  if (ch=='-') q=-1,ch=getchar();
  while (ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q*x;
}

int main(){
  n=gi();
  for (RG int i=0;i<2;++i)
    for (RG int j=1;j<=n;++j)
      a[i][j]=gi(),f[i][j]=max(i?f[i-1][j]:0,f[i][j-1])+a[i][j];
  cout<<f[1][n]; return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using f80 = __float80;
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define pb push_back
#define rng(a) a.begin(),a.end()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define sz(x) (i64)(x).size()
#define bit(n) (1LL<<(n))
#define fi first
#define se second
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}

void Main()
{
  i64 n,x,y;
  cin >> n >> x >> y;
  x--;
  y--;

  vvi g(n,vi(n));
  rep(i,n) rep(j,n){
    g[i][j] = abs(i-j);
  }
  g[x][y] = 1;
  g[y][x] = 1;
  rep(i,n){
    chmin(g[i][x],g[i][y]+1);
    g[x][i] = g[i][x];
    chmin(g[i][y],g[i][x]+1);
    g[y][i] = g[i][y];
  }
  rep(i,n) rep(j,n){
    chmin(g[i][j],g[i][x]+g[x][j]);
    chmin(g[i][j],g[i][y]+g[y][j]);
  }
  
  vi ans(n,0);
  rep(i,n-1) rep(j,i+1,n){
    ans[g[i][j]]++;
  }

  rep(i,1,n) cout << ans[i] << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}



Measured memory_bytes: 31616
let a, b, x = Scanf.scanf " %f %f %f" @@ fun a b c -> a, b, c
let f r = 180. *. r /. acos (-1.) |> Printf.printf "%.10f\n"
let _ = f @@ if x <= b *. a *. a /. 2. then atan2 b @@ 2. *. x /. (a *. b) else atan2 (2. *. (a *. b -. x /. a)) (a *. a)

Measured memory_bytes: 640
import numpy as np

N = int(input())
A = [int(x) for x in input().split()]
a = np.array(A)

#mask = a%6==0 or a%10==0 or a%2==1 
mask = np.logical_or.reduce( (a%6==0 , a%10==0, a%2==1) )
if mask.all() : 
    print("APPROVED")
else :
    print("DENIED")


Measured memory_bytes: 12508
n = int(input())
a=[]
b=[]
c=[]
for i in range(n):
    tmpa,tmpb,tmpc = map(int,input().split())
    a.append(tmpa)
    b.append(tmpb)
    c.append(tmpc)

#dp[i][j] : i日目にjを行った時の幸福度の最大値
dp = [[0 for i in range(3)] for j in range(n+1)]

for i in range(1,n+1):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i-1]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i-1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i-1]

print(max(dp[n][0],dp[n][1],dp[n][2]))

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

using namespace std;

#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok cerr << "ok\n";
#define whatis(x) cerr << #x << " = " << x << endl;
#define int long long

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;

main() {
  int n, m;
  cin >> n >> m;
  cout << abs(n - 2) * abs(m - 2);
}


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

char s[500005];
ll y,m,d;
ll ans;
ll x[500005];
ll l,r;
ll n;

bool solve(){
	cin >> n >> l >> r;
	if(n == 0)return false;
	for(int i=0;i<n;i++){
		cin >> x[i];
	}
	ans = 0;
	for(int i=l;i<=r;i++){
		//check i
		bool used = false;
		for(int j=0;j<n;j++){
			if(i % x[j] == 0){
				if(j % 2 == 0){
					used = true;
					ans++;
					break;
				}else{
					used = true;
					break;
				}
			}
		}
		if(!used){
			if(n % 2 == 0){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return true;

}




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


Measured memory_bytes: 3108
#14 C - Grid Repainting 2
H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]

dw = [0,1,0,-1]
dh = [1,0,-1,0]

#ある座標について
result = 'Yes'
for h in range(H):
    for w in range(W):
        #ある座標の上下左右について
        if s[h][w] == '#':
            cnt = 0   
            for i in range(4):
                nxt_w = w + dw[i]
                nxt_h = h + dh[i]
                if not(-1<nxt_w<W) or not(-1<nxt_h<H):
                    continue
                if s[nxt_h][nxt_w] == '#':
                    cnt += 1
            if cnt == 0:
                result = 'No'
                break            
    else:
        continue
    break

print(result)

Measured memory_bytes: 9144
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (chunk) {
	var a = chunk.split(' ');
	var b = parseInt(a[0],10);
	var c = parseInt(a[1],10);
	var menseki = b*c;
	var nagasa = b*2+c*2;
    console.log(menseki+' '+nagasa);
});

Measured memory_bytes: 15512
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

ll factorial(int n)
{
	if(n == 0)
		return 1;
	return n * factorial(n - 1);
}

int main(void)
{
	int n;
	cin >> n;

	cout << factorial(n) << endl;

	return 0;
}

Measured memory_bytes: 3012
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

N = int(input())
divsN = make_divisors(N)
divsN2 = make_divisors(N-1)
divsN.pop(0)

ans = len(divsN2)-1

for div in divsN:
    n = N+1-1
    while True:
        if n%div != 0 or n==1:
            break
        n //= div
    if n%div == 1:
        ans += 1

print(ans)

Measured memory_bytes: 9332
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    double l;
    cin >> l;
    cout << setprecision(10) << l/3 * l/3 * l/3 << endl;
    return 0;
}

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

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int r[ 51 ] = { 0 };
  int a, b, c, d;
  int n;

  for ( a = 0; a <= 9; ++a )
  for ( b = 0; b <= 9; ++b )
  for ( c = 0; c <= 9; ++c )
  for ( d = 0; d <= 9; ++d )
    ++r[ a + b + c + d ];

  while ( scanf ( "%d", &n ) == 1 )
    printf ( "%d\n", r[ n ] );

  return ( EXIT_SUCCESS );
}

Measured memory_bytes: 596
#![allow(unused)]
use std::io::{self, Read};

fn get_stdin() -> String {
    let mut buf = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buf);
    return buf
}

fn to_nums(ss: &str) -> Vec<i32> {
    ss.split_whitespace()
        .map(|x| x.parse::<i32>().unwrap())
        .collect()
}

fn main() {
    let input = get_stdin();
    let lines: Vec<&str> = input.split('\n').collect();
    let nums = lines[1].trim();
    let nums = to_nums(nums);
    let nums_rev = nums.iter().rev();
    let mut buf = String::new();
    for i in nums_rev {
        buf = format!("{} {}", buf, i);
    }
    println!("{}", buf.trim())
}



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

using namespace std;

vector<int> fact(101, 0);

int find_75(int n) {
  int res = 0;
  for (int i = 1; i <= 100; i++) {
    if (fact[i] >= n - 1)
      res++;
  }
  return res;
}

int main() {
  int N;
  cin >> N;
  for (int i = 2; i <= N; i++) {
    int n = i;
    for (int j = 2; j <= i; j++) {
      while (n % j == 0) {
        fact[j]++;
        n /= j;
      }
    }
  }
  cout << find_75(75) + find_75(25) * (find_75(3) - 1) +
              find_75(15) * (find_75(5) - 1) +
              find_75(5) * (find_75(5) - 1) * (find_75(3) - 2) / 2
       << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
static const int MAX_N = 1000000;
static const int INF = 1 << 30;

int n;
vector<int> va, vb;
int memo[2][MAX_N + 1], memo2[2][MAX_N + 1];

int main(){
	for(int i = 1; ; i++){
		int num = i * (i + 1) * (i + 2) / 6;
		if(num > MAX_N) break;
		va.push_back(num);
		if(num % 2) vb.push_back(num);
	}
	fill(memo[0], memo[2], INF);
	memo[0][0] = 0;
	for(int i = 0; i < va.size(); i++){
		for(int j = 0; j <= MAX_N; j++){
			if(j - va[i] < 0) memo[1][j] = memo[0][j];
			else memo[1][j] = min(memo[0][j], min(memo[0][j - va[i]] + 1, memo[1][j - va[i]] + 1));
		}
		for(int j = 0; j <= MAX_N; j++) memo[0][j] = memo[1][j];
	}
	fill(memo2[0], memo2[2], INF);
	memo2[0][0] = 0;
	for(int i = 0; i < vb.size(); i++){
		for(int j = 0; j <= MAX_N; j++){
			if(j - vb[i] < 0) memo2[1][j] = memo2[0][j];
			else memo2[1][j] = min(memo2[0][j], min(memo2[0][j - vb[i]] + 1, memo2[1][j - vb[i]] + 1));
		}
		for(int j = 0; j <= MAX_N; j++) memo2[0][j] = memo2[1][j];
	}
	for(;;){
		scanf("%d", &n);
		if(n == 0) break;
		printf("%d %d\n", memo[0][n], memo2[0][n]);
	}
	return 0;
}



Measured memory_bytes: 18896
#include <bits/stdc++.h>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    reverse(t.begin(), t.end());
    bool equal = true;
    for (int i = 0; i < s.size() && i < t.size(); i++)
    {
        if (s[i] < t[i])
        {
            equal = false;
            break;
        }
    }
    if (equal == false) cout << "Yes";
    else
    {
        for (int i = 0; i < s.size() && i < t.size(); i++)
        {
            if (s[i] != t[i])
            {
                equal = false;
                break;
            }
        }
        if (equal == true && s.size() < t.size()) cout << "Yes";
        else cout << "No";
    }
}

Measured memory_bytes: 3644
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
  int K;
  cin >> K;
  lint A[K];
  reprev(i,K) cin >> A[i];
  lint maxi=2,mini=2;
  bool check=true;
  rep(i,K){
    if(maxi<A[i]) check=false;
    if(maxi/A[i]==mini/A[i] && mini%A[i]!=0 && maxi%A[i]!=0) check=false;
    lint rem=maxi/A[i],rem2=ceil((double)mini/A[i]);
    maxi=rem*A[i]+A[i]-1;
    mini=rem2*A[i];
   }
   if(check) cout << mini << " " << maxi << endl;
   else cout << -1 << endl;
}

Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String answer = "";

		if(str.equals("a")){
			answer = "vowel";
		}else if(str.equals("i")){
			answer = "vowel";
		}else if(str.equals("u")){
			answer = "vowel";
		}else if(str.equals("e")){
			answer = "vowel";
		}else if(str.equals("o")){
			answer = "vowel";
		}else{
			answer = "consonant";
		}


		System.out.println(answer);


	}

}


Measured memory_bytes: 8148
#include<stdio.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}Point;

void koch(int n,Point a,Point b){
  Point s,t,u;
  double th=M_PI*60.0/180.0;

  if(n == 0) return;
  s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

  koch(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main(){
  Point a,b;
  int n;

  scanf("%d",&n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);

  return 0;
}

Measured memory_bytes: 640
n, x, y = map(int, input().split())

ans=[0]*n
for i in range(1,n+1):
    for j in range(i+1,n+1):
        dict1=j-i
        dict2=abs(x-i)+abs(y-j)+1
        d=min(dict1,dict2)
        ans[d]+=1
for i in range(1,n):
    print(ans[i])

Measured memory_bytes: 3444