akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long a=0, b=0;
        boolean flag = false;
        for(a=0;a<200;a++){
            for(b=0;b<200;b++){
                if(a*a*a*a*a - b*b*b*b*b == x){
                    flag = true;
                    break;
                }else if(a*a*a*a*a + b*b*b*b*b == x){
                    b *= -1;
                    flag = true;
                    break;
                }else if(- a*a*a*a*a - b*b*b*b*b == x){
                    a *= -1;
                    flag = true;
                    break;
                }else if(- a*a*a*a*a + b*b*b*b*b == x){
                    a *= -1;
                    b *= -1;
                    flag = true;
                    break;
                }
            }
            if(flag){
                break;
            }
        }
        System.out.println(a + " " + b);
    }
}


Measured memory_bytes: 27004
n=int(input())
a=list(map(int,input().split()))

b=[0,0,0]
for i in a:
  if i % 4==0:
    b[0]+=1
  elif i % 2==0:
    b[1]+=1
  else:
    b[2]+=1
if b[2]<=b[0]:
  print("Yes")
elif b[2]-1==b[0] and b[1]==0:
  print("Yes")
else:
  print("No")

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int x, y, a, b, c;
  cin>>x>>y>>a>>b>>c;
  int p[125252], q[125252], r[125252];
  pii num[325252];
  REP(i, a){
    cin>>p[i];
    num[i]=pii(p[i], 0);
  }
  REP(i, b){
    cin>>q[i];
    num[i+a]=pii(q[i], 1);
  }
  REP(i, c){
    cin>>r[i];
    num[i+a+b]=pii(r[i], 2);
  }
  sort(num, num+a+b+c);
  ll ans=0;
  int cnt=0, red=0, grn=0;
  FORR(i, 0, a+b+c){
    auto tmp=num[i];
    int u=tmp.first, v=tmp.second;
    bool ok=false;
    if(v==2){
      ok=true;
    }
    if(v==0 && red<x){
      ++red;
      ok=true;
    }
    if(v==1 && grn<y){
      ++grn;
      ok=true;
    }
    if(ok){
      ++cnt;
      ans+=u;
    }
    // DEBUG(ans);
    if(cnt>=x+y){
      break;
    }
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)
ll modInv(ll a){
	return powm(a,mod-2)%mod;
}

int main()
{
	fast;
	ll n,i,j,k;
	cin>>n>>k;
    vector<pll>v;
    int z=0;
	for(i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		if(x==0)
		{
			z=1;
		}
		if(x<0)
		{
			v.pb({-1*x,1});
		}
		else
		{
			v.pb({x,0});
		}
	}
    sort(all(v));
    reverse(all(v));
    int x=0;
    int y;
    for(i=0;i<k;i++)
    {
    	if(v[i].se)
    	{
    		x++;
    		y=i;
		}
    	
	}
	ll ans=1;
	if(x%2==0)
	{
		for(i=0;i<k;i++)
		{
			ans=(ans*v[i].fi)%mod;
		}
		cout<<ans;
	}
	else
	{
		if(x==k)
		{
			int f=0;
			for(i=k;i<n;i++)
			{
				if(v[i].se==0)
				{
					f=i;
					break;
				}
			}
			if(f==0)
			{
				
				for(i=0;i<k;i++)
				{
					ans=(ans*v[n-i-1].fi)%mod;
				}
				ans=ans*-1;
				ans=(ans+mod)%mod;
				cout<<ans;
			}
			else
			{
				for(i=0;i<k-1;i++)
				{
					
					ans=(ans*v[i].fi)%mod;
					
				}
				ans=(ans*v[f].fi)%mod;
				cout<<ans;
			}
			
		}
		else
		{
			ll p=0;
			ll ne=0;
			for(i=0;i<k;i++)
			{
				if(v[i].se)
				{
					ne=max(ne,i);
				}
				else
				{
					p=max(p,i);
				}
				
			}
			ans=1;
			for(i=0;i<k;i++)
			{
				ans=(ans*v[i].fi)%mod;
			}
			ll p1=n,ne1=n;
			for(i=k;i<n;i++)
			{
				if(v[i].se)
				{
					ne1=min(ne1,i);
				}
				else
				{
					p1=min(p1,i);
				}
			}
			if(p1==n)
			{
				if(ne1==n)
				{
					
					ans=ans*-1;
					ans+=mod;
					ans%=mod;
					cout<<ans;
				}
				else
				{
					ans*=v[ne1].fi;
					ans=ans%mod;
					ans=ans*modInv(v[p].fi);
					ans=ans%mod;
					cout<<ans;
				}
			}
			else
			{
				if(ne1==n)
				{
					ans=ans*v[p1].fi;
					ans=ans%mod;
					ans=ans*modInv(v[ne].fi);
					ans%=mod;
					cout<<ans;
				}
				else
				{
					if(v[ne1].fi*v[ne].fi>=v[p1].fi*v[p].fi)
					{
						ans=ans*v[ne1].fi;
						ans%=mod;
						ans*=modInv(v[p].fi);
						ans=ans%mod;
						cout<<ans;
					}
					else
					{
						ans=ans*v[p1].fi;
						ans%=mod;
						ans*=modInv(v[ne].fi);
						ans%=mod;
						cout<<ans;
					}
					
				}
			}
		
		
		}
	}
	
	
    
}

Measured memory_bytes: 7404
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll get(int num)
{
	vector<ll>v;
	for (int i = 0; i < num; i++)
	{
		ll z;
		scanf("%lld", &z);
		v.push_back(z);
	}
	ll ans = 0;
	for (ll i = 0; i < num - 1; i++)
	{
		ll t = (i + 1)*(num - i - 1) % mod;
		ans = (ans + t*(v[i + 1] - v[i])) % mod;
	}
	return ans;
}
int main()
{
	int a, b;
	scanf("%d%d", &a, &b);
	ll s = get(a), t = get(b);
	printf("%lld\n", s*t%mod);
}

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

typedef long long ll;
using namespace std;

int main(){
	
	int n,k;
	cin >> n ;
	k=3;
	vector< vector<int> > happ(n, vector<int>(k));
	int INF = 1<<30;
	
	for(int i=0;i<n;++i)
		for(int j=0;j<k;++j)
			cin >> happ[i][j];
			
	//dp[i][j] es la mayor felicidad del dia i con la actividad anterior j
	vector< vector<int> > dp(n+1, vector<int>(k,0));
	/*
	for(int i=0;i<k;++i){
		int maxi = 0;
		for(int j=0;j<k;j++){
			if(i!=j)
				maxi = max(maxi, happ[0][j]);
		}
		dp[0][i] = maxi;
	}
	* */
	for(int day=1;day<n+1;++day){
		for(int i=0;i<k;++i){
			for(int j=0;j<k;++j){
				if(i!=j){
					dp[day][j]=max(dp[day][j],dp[day-1][i]+happ[day-1][j] );
					//cout << "day " << day << " i " << i << " j " << j << " dp "  << dp[day][j] << endl;
				}
			}
		}
	}
	
	int maxi = -INF;
	for(int i=0;i<k;++i){
		maxi = max(maxi,dp[n][i]);
	}
	cout << maxi << endl;
	/*
	for(int i=0;i<n+1;++i){
		for(int j=0;j<k;j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	*/
	
	
			
	
	
	return 0;
}


Measured memory_bytes: 11136
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import sys
sys.setrecursionlimit(4100000)

n,m= map(int,readline().split())
a = list(map(int,readline().split()))

if a[0] == 1:
  print(1)
  exit()
  
d = set([0])
def dfs(now,cc,d):
    if cc == m:
      return now
    else:
      next = a[now]
      next -= 1
      if not next in d:
        d.add(next)
        return dfs(next,cc+1,d)
      else:
        d = list(d)
        for i,di in enumerate(d[::-1]):
          if di == next:
            return (i+1,cc,now)

def f(now,cc):
    global mar
    if cc == mar:
      return now
    else:
      next = a[now]
      next -= 1
      return f(next,cc+1)
    
res = dfs(0,0,d)
if type(res) == int:
  print(res+1)
else:
  m -= res[1]
  mar = m % res[0]
  print(f(res[2],0)+1)

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

int main() 
{
  int A, B, C;
  cin>>A>>B>>C;
  if(A==B)
  {  if(B==C)
        cout<<"No";
     else
        cout<<"Yes";
  }
  else if(B==C)
  {  if(C==A)
        cout<<"No";
     else
        cout<<"Yes";
  }
  else if(C==A)
  {  if(A==B)
        cout<<"No";
     else
        cout<<"Yes";
  }
  else 
    cout<<"No";
  return 0;
}


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

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin >> n;
	map<string , int> m;
	for (int i = 0; i < n; ++i){
		string s;
		cin >> s;
		sort(s.begin() , s.end());
		if (m.find(s) == m.end()){
			m[s] = 1;
		}
		else{
			ans += m[s];
			m[s]++;
		}
	}
	cout << ans;
	return 0;
} 

Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
int main(){
  int cnt = 0;
  string s,t;
  
  cin >> s >> t;
  
  for(int i = 0;i < s.length();i++)
    if(s.at(i) != t.at(i))
      cnt++;
  
  cout << cnt << endl;
  
}

Measured memory_bytes: 3912
import math
import itertools
N=int(input())
x=[0]*N
y=[0]*N
for i in range(N):
    a,b=map(int,input().split())
    x[i]=a
    y[i]=b
ans=0
for i in itertools.permutations(range(N)):
    li=list(i)
    for j in range(N-1):
        ans+=math.sqrt((x[li[j]]-x[li[j+1]])**2+(y[li[j]]-y[li[j+1]])**2)
    

print(ans/(math.factorial(N)))

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

using namespace std;

int main(){

	long long a, b, c;
	cin >> a >> b >> c;
	cout << min(abs(a / 2 * b*c - (a - a / 2)*b*c), min(abs(a*(b / 2)*c - a * (b - b / 2)*c), abs(a*b*(c / 2) - a * b*(c - c / 2)))) << endl;

	return 0;
}

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

const int inf = 1e9 + 123;

struct MaxFlow {
	struct edge {
		int u; int v; int c; int f;
		edge(int u=0, int v=0, int c=0, int f=0): u(u), v(v), c(c), f(f) {}
	};
	int n, s, t;
	vector< vector<int> > G;
	vector<edge> e;
	MaxFlow(int n=0, int s=0, int t=0): n(n), s(s), t(t) { G.assign(n + 1, vector<int>()); }
	void add(int u, int v, int c) {
		G[u].push_back(e.size()); e.push_back(edge(u, v, c, 0));
		G[v].push_back(e.size()); e.push_back(edge(v, u, 0, 0));
	}

	vector<int> d, hd;
	bool bfs() {
		d.assign(n + 1, -1); hd.assign(n + 1, -1);
		queue <int> q; q.push(s); d[s] = 0;
		while(!q.empty()) {
			int u = q.front(); q.pop();
			for (int id : G[u]) if (e[id].c > e[id].f && d[e[id].v] == -1) {
				d[e[id].v] = u; hd[e[id].v] = id;
				q.push(e[id].v);
			}
		}
		return d[t] != -1;
	}
	int mnm() {
		int delta = inf;
		for (int i = t; i != s; i = d[i]) {
			int id = hd[i]; delta = min(delta, e[id].c - e[id].f);
		}
		for (int i = t; i != s; i = d[i]) {
			int id = hd[i]; e[id].f += delta; e[id ^ 1].f -= delta;
		}
		return delta;
	}

	long long maxFlow() {
		long long res = 0; while(bfs()) res += mnm(); return res;
	}
} mf;

const int N = 110;

int n, a[N];
long long ans;

int main() {
	scanf("%d", &n);
	int s = n + 1, t = n + 2;
	mf = MaxFlow(n + 2, n + 1, n + 2);
	
	for (int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
		if (a[i] <= 0) mf.add(s, i, -a[i]);
		else mf.add(i, t, a[i]), ans += a[i];
		for (int j = i + i; j <= n; j += i) mf.add(i, j, inf);
	}

	long long mincut = mf.maxFlow();
	ans -= mincut;
	printf("%lld\n", ans);
}

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

ll n,a[200001],ans;
map<ll,ll> mp;

int main() {

    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>a[i];
        mp[i+a[i]]++;
        ans += mp[i-a[i]];
    }
    cout<<ans;
}


Measured memory_bytes: 27612
#include <bits/stdc++.h>
using namespace std;
int fx4[] = {1 , -1 , 0 , 0};
int fy4[] = {0 , 0 , 1 , -1};
int Kfx[]= {-2,-2,2,2,1,1,-1,-1}; ///knight move x - exis
int Kfy[]= {1,-1,1,-1,2,-2,2,-2}; ///knight move y- exis
int fx8[]= {1,1,1,0,0,-1,-1,-1};
int fy8[]= {0,1,-1,1,-1,0,1,-1};
#define ll long long int
#define pii pair<int,int>
#define llu unsigned long long
#define inf 1<<28
#define gama 0.57721566490
#define PI              acos(-1.0)
#define INF             0x7fffffff
#define MOD             1000000007
#define EPS             1e-7
#define all(r)(r).begin(),(r).end()
/*
bool status[mx];
void sieve(){
   long long int  i,j;
    for(i=2;i<=mx;i++)
    {
        status[i]=0;
    }
    for( i=2;i<=sqrt(mx);i++){
        if(status[i]==0)
        {
            for(j=i*i;j<=mx;j+=i){
                status[j]=1;
            }
        }
    }
}*/
ll BM( ll a , ll b , ll m )
{
    if ( b == 0 ) return 1 ;
    ll x = BM(a,b/2,m);
    x = (( x % m) * (x % m))%m;

    if( b % 2 ) x = (( x % m) * (a %m)) % m ;
    return x ;
}
#define dd double
#define sc scanf
#define pr printf
#define VI vector<int>
#define VS vector<string>
#define VC vector<char>
#define VLL vector<long long int>
#define FILE freopen("input.txt","rt",stdin); freopen("output.txt","w",stdout);
#define p_b push_back
#define mem(x,y) memset(x,y,sizeof(x))
#define F(i,a,b) for(i=a;i<=b;i++)
#define sc1(a) scanf("%d",&a)
#define scL1(a) scanf("%lld",&a)
#define scL2(a,b) scanf("%lld%lld",&a,&b)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define scL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define fori(N)          for(int i = 0; i<(N); i++)
#define forj(N)         for(int j = 0; j<(N); j++)
#define fork(N)         for(int k = 0; k<(N); k++)
#define forl(N)         for(int l = 0; l<(N); l++)
#define ford(N)         for(int d = 0; d<(N); d++)
#define fori1(N)          for(int i = 1; i<=(N); i++)
#define forj1(N)         for(int j = 1; j<=(N); j++)
#define fork1(N)         for(int k = 1; k<=(N); k++)
#define ford1(N)         for(int d = 1; d<=(N); d++)
#define sqr(x)           (x)*(x)
#define TEST int test,te=0;cin>>test;
#define segment_tree int l=(n*2),r=(n*2)+1,mid=(l+r)/2
#define Mx 100005
#define mx 10005

int main()
{
ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);///Beware of use it, if u use it dont use scanf or printf
    ll n;
    cin>>n;
    map<ll,ll>arr;
    ll a[n+1];
    fori(n){
    	ll x;
    	cin>>x;
    	a[i]=x;
    	arr[x]++;
	}
	ll sum=0;
	for(auto it:arr){
		if(it.second>=2){
			ll p=it.second;
			if(p>2){
				sum+=(p*(p-1))/2;
			}
			else sum+=1;
		}
	}
	fori(n){
		ll x=arr[a[i]];
		x--;
		if(x>=1)cout<<sum-x<<endl;
		else cout<<sum<<endl;
//		ll t=x-1;
//		ll s1=(x*(x-1))/2;
//		ll s2=(t*(t-1))/2;
//		ll xx=sum;
//		xx-=s1;
//		cout<<xx+s2<<endl;
	}
}


Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <unordered_set>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
static const int INF = 1000010000;
static const int NIL = -1;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.begin(), v.end(), greater<int>);
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue
 
int gcd(int a, int b) { int c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
int lcm(int a, int b) { int c = gcd(a, b); a /= c; return a*b; }
int nCr(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
int pow(int a, int b) { int i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llpow(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= a; }return r; }
long long llgcd(long long a, long long b) { long long c; while (b != 0) { c = a%b; a = b; b = c; }return a; }
long long lllcm(long long a, long long b) { long long c = llgcd(a, b); a /= c; return a*b; }
long long llnCr(long long a, long long b) { long long i, r = 1; for (i = 1; i <= b; i++) { r *= (a + 1 - i); r /= i; }return r; }
 
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge{
    int to, cost;
};

int main(){
    string a, b;
    cin >> a >> b;
    int ab = stoi(a + b);
    REP(i, ab){
        if(i * i == ab){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


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

#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fst first
#define snd second

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2 == 0)
        cout << abs(a + b) / 2;
    else
        cout << "IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int[] number = new int[6];
		for(int i=0;i<6;i++){
			number[i] = stdIn.nextInt();
		}
		String str = stdIn.next();
		int c = 1;
		int n = 5;
		int w = 4;
		int s = 2;
		int e = 3;
		
		System.out.println(number[move_cube(c,n,w,s,e,str)-1]);
	}
	static int move_cube(int c,int n,int w,int s,int e,String str){
		for(int i=0;i<str.length();i++){
			if(str.charAt(i) == 'S'){
				n = 7 - c;
				c = 7 - s;
				s = 7 - n;
			}
			else if(str.charAt(i) == 'N'){
				s = 7 - c;
				c = 7 - n;
				n = 7 - s;
			}
			else if(str.charAt(i) == 'W'){
				e = 7 - c;
				c = 7 - w;
				w = 7 - e;
			}
			else{
				w = 7 - c;
				c = 7 - e;
				e = 7 - w;
			}
		}
		return c;
	}
}

Measured memory_bytes: 17232
s = input()
a = 1
f = 0
for i in s:
  if a == 1 and i == "L":
    print("No")
    f = 1
    break
  if a == 0 and i == "R":
    print("No")
    f = 1
    break
  a ^= 1
if f == 0:
  print("Yes")

Measured memory_bytes: 61792
#include <bits/stdc++.h>
 
using namespace std;
 
template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef __APPLE__
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  cout << (t>=30?"Yes":"No");
}
 

Measured memory_bytes: 3668
#include<vector>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

const int MAXN = 9000;
const int OFFSET = 8000+9;
int X,Y;
char S[MAXN];
int dp[2][MAXN<<1];
int len;

vector<int> vec,line,row;

void solve(){
	bool ans1=0,ans2=0;
	int opt=1;
	dp[1][OFFSET]=1;
	for(int i=0;i<line.size();i++){
		opt^=1;
		memset(dp[opt],0,sizeof(dp[opt]));
		for(int j=-OFFSET;j+line[i]<OFFSET;j++)
			dp[opt][j+OFFSET]|=dp[opt^1][j+line[i]+OFFSET];
		for(int j=-OFFSET+line[i];j<OFFSET;j++)
			dp[opt][j+OFFSET]|=dp[opt^1][j-line[i]+OFFSET];
	}
	if(dp[opt][Y+OFFSET])
		ans1=1;
	memset(dp,0,sizeof(dp));
	opt=1;
	dp[1][row[0]+OFFSET]=1;
	for(int i=1;i<row.size();i++){
		opt^=1;
		memset(dp[opt],0,sizeof(dp[opt]));
		for(int j=-OFFSET;j+row[i]<OFFSET;j++)
			dp[opt][j+OFFSET]|=dp[opt^1][j+row[i]+OFFSET];
		for(int j=-OFFSET+line[i];j<OFFSET;j++)
			dp[opt][j+OFFSET]|=dp[opt^1][j-row[i]+OFFSET];
	}
	if(dp[opt][X+OFFSET])
		ans2=1;
	if(ans1&ans2)puts("Yes");
	else puts("No");
}

int main(){
	//freopen("in.in","r",stdin);
	scanf("%s",S);
	scanf("%d%d",&X,&Y);
	len=strlen(S);
	int tmp=0;
	for(int i=0;i<len;i++){
		if(S[i]=='F')
			tmp++;
		else{
			vec.push_back(tmp);
			tmp=0;
		}
	}
	if(tmp)
		vec.push_back(tmp);
	for(int i=0;i<vec.size();i++){
		if(i&1)
			line.push_back(vec[i]);
		else
			row.push_back(vec[i]);
	}
	solve();
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long n,k,x,y;
int main(){
	cin>>n>>k;
	if (k%2==0){
		x=n/k;y=n/k;
		if (n%k>=(k/2))y++;
	}else{
		x=n/k;y=0;
	}
	cout<<x*x*x+y*y*y<<endl;
	return 0;
}

Measured memory_bytes: 256
#! /usr/local/bin/python3
# coding: utf-8

from math import inf

inv = 0


def merge(A, left, mid, right):
    global inv

    L = A[left:mid]
    L.append(inf)
    R = A[mid:right]
    R.append(inf)
    i = j = 0
    for k in range(left, right):
        if L[i] < R[j]:
            A[k] = L[i]
            i += 1
        else:
            inv += len(L) - i - 1
            A[k] = R[j]
            j += 1


def merge_sort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)


def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    merge_sort(A, 0, n)
    print(inv)


main()



Measured memory_bytes: 28964
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
//#include <stdio.h>
//#include <stack>
//#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <fstream>
//#include <list>
//#include <iomanip>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())


void printVec(std::vector<int> & vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str = "";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}

int main() {
	int n, l; cin >> n >> l;
	int sum = 0, minz = 10000000, hoji;
	for (int i = 0; i < n; i++) {
		if (abs(l + i) < minz) {
			minz = abs(l + i);
			hoji = i;
		}
	}
	//cout << hoji << endl;
	for (int i = 0; i < n; i++) {
		if (i != hoji) sum += l + i;
	}
	cout << sum;


	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <bits/stdc++.h>

#include<unordered_set>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p)
#define SINT5(n,m,o,p,q) scanf("%d %d %d %d %d",&n,&m,&o,&p,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1000000009;
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first	
#define sc  second



int main() {
	int n;
	int ret = 0;

	cin >> n;
	int b = -1;
	rep(i, n) {
		int a;
		cin >> a;
		if (b == a) {
			ret++;
			b = -1;
		} else {
			b = a;
		}
	}
	cout << ret << endl;

}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,a[200010];
map<int,int>mp;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a[i];
        mp[a[i]]++;
    }
    int ans=0;
    for(P p:mp){
        ans+=(p.se-1)*(p.se)/2;
    }
    rep(i,n){
        int p=mp[a[i]];
        cout<<ans-p+1<<endl;
    }
    return 0;
}


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

void solve(char *s1,char *s2)
{  

    int n=strlen(s1);
    int m=strlen(s2);
  
    int dp[m+1][n+1];
    memset(dp,0,sizeof dp);
  

    for (int i = 1; i <=m ; i++)
    {
        for (int j = 1; j <=n; j++)
        {
            if(s2[i-1]==s1[j-1]) dp[i][j]=dp[i-1][j-1]+1;
            else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    /*for (int i = 0; i <=m ; i++)
    {
        for (int j = 0; j <=n; j++)
        {
            cout<<dp[i][j]<<" ";
        }cout<<endl;
    }*/

    int i=m,j=n;
    string s="";
    while(i!=0 && j!=0){
        if(s1[j-1]==s2[i-1]) {
            s+=s1[j-1];--i;--j;
            } 
        else{
            if(dp[i][j]==(dp[i-1][j])) {--i;}
            else  {--j;}
        }
    }

    reverse(s.begin(),s.end());
    cout<<s;
    
}

int main()
{

   char s1[3002], s2[3003];
    cin>>s1>>s2;

    solve(s1,s2);

}


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

int main() {
    int A,B,C,D,E,F;

    cin >> A >> B >> C >> D;

    E = 0;
    F = 0;

    while (C>0)
    {
        E += 1;
        C -= B;
    }

    while (A>0)
    {
        F += 1;
        A -= D;
    }
    
    if(F>=E) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3572
import java.io.*;

public class  Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] st = br.readLine().split(" ");
        int a = Integer.parseInt(st[0]);
        int b = Integer.parseInt(st[1]);
        int area = a * b;
        int perimeter = 2*(a + b);
        bw.append(area + " " + perimeter + "\n");
        bw.flush();
    }
    
}


Measured memory_bytes: 24192
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

template <std::uint_fast64_t Modulus>
class modint {
  using u64 = std::uint_fast64_t;

 public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept
      : a(x % Modulus) {
  }
  constexpr u64 &value() noexcept {
    return a;
  }
  constexpr const u64 &value() const noexcept {
    return a;
  }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(const modint rhs) noexcept {
    return *this *= ~rhs;
  }
  constexpr modint operator^(u64 exp) const noexcept {
    modint v = 1, x = *this;
    while (exp) {
      if (exp & 1) {
        v *= x;
      }
      x *= x;
      exp >>= 1;
    }
    return v;
  }
  constexpr modint operator~() const noexcept {
    return *this ^ (Modulus - 2);
  }
};

using mint = modint<998244353>;

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N;
  while (cin >> N) {
    vector<int> D(N);
    for (int &x : D) cin >> x;
    vector<int> cnt(N, 0);
    for (int x : D) ++cnt[x];
    mint res = 1;
    if (D[0] != 0 || cnt[0] != 1) res = 0;
    for (int x = 1; x < N; x++) res *= (mint(cnt[x - 1]) ^ cnt[x]);
    cout << res.value() << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    int w;
    cin>>s>>w;
    string res="";
    for(int i=0;i<s.size();i++){
        if(i%w==0)res+=s[i];
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

int memo[55];
int p_memo[55];

int f(int n) {
	if (n == 0) return memo[0] = 1;
	return memo[n] = f(n - 1) * 2 + 3;
}

int fill_p(int n) {
	if (n == 0) return p_memo[0] = 1;
	return p_memo[n] = fill_p(n - 1) * 2 + 1;
}

int solve(int x, int n) {
	if (x == 0) return 0;
	if (n == 0) return 1;
	/*
	debug(x);
	debug(n);
	debug(memo[n]);
	debug(p_memo[n]);BR;
	*/
	int res = 0;
	x--;
	if (x >= memo[n - 1]) {
		res += p_memo[n - 1];
		x -= memo[n - 1];
	} else {
		return res += solve(x, n - 1);
	}
	if (x == 0) return res;
	
 	res++;
	x--;
	if (x >= memo[n - 1]) {
		res += p_memo[n - 1];
		x -= memo[n - 1];
	} else {
		return res += solve(x, n - 1);
	}
	x--;
	return res;
}


signed main() {
  INIT;
	VAR(int, n, x);
	f(n);
	fill_p(n);
	
	/*int ans;
	if (x >= memo[n] / 2) {
		ans = p_memo[n] - solve(memo[n] - x, n);
	} else {
		ans = solve(x, n);
	}
	*/
	int ans = solve(x, n);
	OUT(ans)BR;

	
	//debug(p_memo[n]);
  
  return 0;
}


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

int main()
{
	int n;
	cin >> n;
	if (n >= 2000)
		cout << 1;
	else if (n < 100)
		cout << 0;
	else
	{
		int x = n / 100;
		if (n <= x * 105)
			cout << 1;
		else
			cout << 0;
	}

	return 0;
}


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;
long long int n,cnt=0,ans=0,a[ohara],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);
      
      cin>>n;
      cnt=1;
      rep(i,n)cnt*=3;
      rep(i,n)cin>>a[i];
      if(n==1){
        if(a[0]%2==0){
          Cout(cnt-2);
        }
        else Cout(cnt-1);
      }
      else{
        pos=1;
        rep(i,n){
          if(a[i]%2==0)pos*=2;
        }
        Cout(cnt-pos);
      }
    
       
return 0;
}


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

int main(){
    string s; cin>>s;
    int out;
    if (s == "SUN"){
        out = 7;
    } else if(s == "MON"){
        out = 6;
    } else if (s == "TUE"){
        out = 5;
    } else if ( s == "WED"){
        out = 4;
    } else if (s == "THU"){
        out = 3;
    } else if (s == "FRI"){
        out = 2;
    } else{
        out = 1;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 760
#include<iostream>
#include<string>
#include<ctype.h>
#include<cstdio>

using namespace std;


int main() {
	char a[1200],*p;
	int i,j;
	p = a;
	for (i = 0; i < 1200; i++) {
		a[i]=getchar();
		if (a[i] == '\n') {
			break;
		}
	}
	for (j = 0; j < i; j++) {
		if (isupper(a[j]) != 0) {
			a[j] = tolower(a[j]);
		}
		else if (islower(a[j]) != 0) {
			a[j] = toupper(a[j]);
		}
		else if (a[j] == '\n') {
			break;
		}
	}
	for (j = 0; j < i; j++) {
		cout << a[j];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1120
#include <cstdio>
#include <utility>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

typedef tuple <int, int, int, int, int> iiiii;

#define INF 1000000005

int dirr[] = {-1, 0, 1, 0}, dirc[] = {0, 1, 0, -1};

int H, W, K;
int x1, y1, x2, y2;
deque <iiiii> bfs;
int ans = INF;

int main() {
	scanf("%d%d%d", &H, &W, &K);
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	char grid[H + 5][W + 5];
	for (int i = 1; i <= H; i++) for (int j = 1; j <= W; j++) scanf(" %c", &grid[i][j]);
	int dist[4][H + 5][W + 5];
	for (int i = 0; i < 4; i++) for (int j = 1; j <= H; j++) for (int k = 1; k <= W; k++)
		dist[i][j][k] = INF;
	for (int i = 0; i < 4; i++) {
		dist[i][x1][y1] = 1;
		bfs.emplace_front(i, K, 1, x1, y1);
	}
	while (!bfs.empty()) {
		int dir, remK, ud, ur, uc; tie(dir, remK, ud, ur, uc) = bfs.front(); bfs.pop_front();
		// printf("dir: %d; remK: %d; dist: %d, u: (%d %d)\n", dir, remK, ud, ur, uc);
		for (int i = 0; i < 4; i++) {
			int vr = ur + dirr[i], vc = uc + dirc[i];
			if (vr <= 0 || vr > H || vc <= 0 || vc > W) continue;
			if (grid[vr][vc] == '@') continue;
			if (i == dir && remK > 0) {
				if (dist[i][vr][vc] > ud) {
					dist[i][vr][vc] = ud;
					bfs.emplace_front(i, remK - 1, dist[i][vr][vc], vr, vc);
				}
			} else {
				if (dist[i][vr][vc] > ud + 1) {
					dist[i][vr][vc] = ud + 1;
					bfs.emplace_back(i, K - 1, dist[i][vr][vc], vr, vc);
				}
			}
		}
	}
	for (int i = 0; i < 4; i++) ans = min(ans, dist[i][x2][y2]);
	if (ans == INF) printf("-1\n");
	else printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 24620
#include<iostream>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int cd=s.size();
	for(int i=0;i<cd;++i)
	{
		if(s[i]=='C')
		{
			for(int j=i+1;j<cd;++j)
			{
				if(s[j]=='F')
				{
					cout<<"Yes\n";
					return 0;
				}
			}
		}
	}
	cout<<"No\n";
	return 0;
} 

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

int main() {
    int64_t A,V,B,W,T;
    cin >> A >> V >> B >> W >> T;

    if (A < B) {
      if (A+V*T < B+W*T) {
        cout << "NO" << endl;  
      }
      else {
        cout << "YES" << endl;  
      }
    }
    else {
       if (A-V*T > B-W*T) {
        cout << "NO" << endl;  
      }
      else {
        cout << "YES" << endl;  
      }
    }
  
}


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

int main() {
    using namespace std;
    const int INF = 1'000'000;

    int n, x, y;
    cin >> n >> x >> y;

    int d[n + 1][n + 1];
    fill(d[0], d[n + 1], INF);
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            d[i][j] = j - i;
            d[i][j] = min(d[i][j], abs(x - i) + 1 + abs(y - j));
        }
    }
    // for (int i = 1; i <= x; i++) {
    //     for (int j = y; j <= n; j++) {  // i<=x,y<=j
    //         d[i][j] -= y - x - 1;
    //     }
    //     for (int j = 1; j < y - x; j++) {  // i<=x<j<y
    //         d[i][y - j] = min(d[i][y] + j, d[i][y - j]);
    //     }
    // }
    // for (int i = x + 1; i < y; i++) {
    //     for (int j = y; j <= n; j++) {  // x<i<y<=j
    //         d[i][j] = min(i - x + 1 + j - y, d[i][j]);
    //     }
    // }

    long long ans[n + 1];
    fill(ans, ans + n + 1, 0LL);
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            ans[d[i][j]]++;
            //----------------------------------------
            // cout << d[i][j] << ' ';
        }
        //--------------------------------------------
        // cout << endl;
    }

    for (int k = 1; k < n; k++) {
        cout << ans[k] << endl;
    }

    // n
    return 0;
}

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

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

const int MOD = 1e9 + 7;
const int N = 3e5 + 5;
int n;
ll t, res;
ll psum[N];
ll cnt[63];


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    for (int j = 0; j <= 62; ++j) {
      if (t & (1LL << j)) {
        ++cnt[j];
      }
    }
  }
  for (int i = 0; i <= 62; ++i) {
    ll p = cnt[i] * (n - cnt[i]) % MOD;
    res = (res + ll (pow(2, i)) % MOD * p % MOD) % MOD;
  }
  cout << res << endl;

  return 0;
}


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

#define N 10000
int judge(int);

int main(){
  int data[N];
  int num,i=0,cnt=0;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&data[i]);
  }

  for(i=0;i<num;i++){
    if(data[i] < 2 || data[i] > 100000000) break;
    if(judge(data[i]) == 1) cnt++;
  }

  printf("%d\n",cnt);
  return 0;
}

int judge(int x)
{

  int num;
  num = sqrt(x);
  while(num != 1){

    if(x % num == 0) return 0;
    num--;
  }
  return 1;
}



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

int main(void) {
  int N, L;
  cin >> N >> L;
  vector<string> v;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < N; i++) {
    cout << v[i];
  }
  cout << endl;
  return 0;
}

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

int main() {
  int N, sat = 0;
  cin >> N;
  vector<int> A(N), B(N), C(N - 1);
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    cin >> B.at(i);
  }
  for(int i = 0; i < N - 1; i++) {
    cin >> C.at(i);
  }
  for(int i = 0; i < N; i++) {
    sat += B.at(A.at(i) - 1);
    if((A.at(i) != N) && (i != (N - 1)))
      if((A.at(i + 1) - A.at(i)) == 1)
        sat += C.at(A.at(i) - 1);
  }
  cout << sat << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const int MN = 2;
const int MX = 55555;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    ll n;
    cin>>n;
    vi ans;

    for(int i=1; i<MX/10; i++){
        int temp = i*10+3;
        int len = floor(sqrt(temp));
        int j = 3;
        bool isprime = true;
        while(j<=len){
            if(temp%j==0){
                isprime=false;
                break;
            }
            j += 2;
        }

        if(isprime)
            ans.emplace_back(temp);
    }

    string sans="";
    
    REP(i,n){
        sans += to_string(ans[i]) + " ";
    }
    cout << sans.substr(0,sans.size()-1) << endl;
    return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
c = {i + 1: 0 for i in range(b)}
for i in range(a):
    d = list(map(int, input().split()))
    for j in range(1, len(d)):
        c[d[j]] += 1
d = 0
for k in c.keys():
    if c[k] == a:
        d += 1
print(d)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
  int n,i,in,j,result=0,minj;

  /*nに要素数を入力*/
  scanf("%d",&n);
  /*配列作成,A[n]値入力*/
  int A[n];
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  
  for(i=0;i<n;i++){
    /*変換、変換回数カウント*/   
    minj=i;
    for(j=i;j<n;j++){
      if(A[j]<A[minj]){
	minj=j;
      }
    }
    if(i!=minj){
      in=A[i];
      A[i]=A[minj];
      A[minj]=in;
      result++;
    }    
  }
  
  /*出力*/
  for(i=0;i<n;i++){
    if(i==n-1)
      printf("%d\n",A[i]);
    else
      printf("%d ",A[i]);
  }
  printf("%d\n",result);
  
  return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;

int main() {
    int h, n;
    cin >> h >> n;
    vector<int> as(n);
    for (int i : irange(0, n)) {
        cin >> as[i];
    }

    bool yes = accumulate(as.begin(), as.end(), 0) >= h;
    cout << (yes ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
	int n,a,b,i,j,result=0,sum;
	
	scanf("%d%d%d",&n,&a,&b);
	
	for(i=1;i<=n;i++){
		j=i;
		sum=0;
		do{
			sum+=j%10;
			j=j/10;
		}while(j>0);
		if(sum>=a && sum<=b){
			result+=i;
		}
	}
	printf("%d\n",result);
	
	return 0;
}

Measured memory_bytes: 128