akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
  
public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
        new aoj1149().doIt();
    }
    class aoj1149{
    	ArrayList<Par> array = new ArrayList<Par>();
    	void ADD(int move,Par p,int l){
 			move = move % l;
 			if(move - p.w < 0){
 				Par p2 = new Par(move,p.h,move*p.h);
 				Par p3 = new Par(p.w - move,p.h,(p.w - move)*p.h);
 				if(p2.s < p3.s){
 					array.add(p2);array.add(p3);
 				}else{
 					array.add(p3);array.add(p2);
 				}
 			 }else{
 				 Par p2 = new Par(p.w,move - p.w,p.w*(move - p.w));
 				 Par p3 = new Par(p.w,p.h - move + p.w,p.w*(p.h - move + p.w));
 				if(p2.s < p3.s){
 					array.add(p2);array.add(p3);
 				}else{
 					array.add(p3);array.add(p2);
 				}
 			 }
    	}
         void doIt(){
        	 while(true){
        		 int n = sc.nextInt();
        		 int w = sc.nextInt();
        		 int h = sc.nextInt();
        		 if(n+w+h == 0)break;
        		 array.add(new Par(w,h,w*h));
        		 for(int i = 0;i < n;i++){
        			 int num = sc.nextInt();
        			 int move = sc.nextInt();
        			 Par p = array.remove(num-1);
        			 ADD(move,p,p.w + p.h);
//        			 for(int j = 0;j < array.size();j++){
//        				 System.out.println(array.get(j).w+" "+array.get(j).h+" "+array.get(j).s);
//        			 }
        		 }
        		 Collections.sort(array);
//        		 for(int j = 0;j < array.size();j++){
//    				 System.out.println(array.get(j).w+" "+array.get(j).h+" "+array.get(j).s);
//    			 }
        		 System.out.print(array.get(0).s);
        		 for(int j = 1;j < array.size();j++){
        			 System.out.print(" "+array.get(j).s);
        		 }
        		 System.out.println();
        		 array.clear();
             }
         }
         class Par implements Comparable<Par>{
             int w,h,s;
             public Par(int w,int h,int s) {
                 this.w = w;
                 this.h = h;
                 this.s = s;
             }
             public int compareTo(Par o) {
                 return this.s - o.s;
             }
         }
     }
}

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

using namespace std;

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

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()

int ans = 0;
int main() {
    int n;
    vi d;
    

    cin>>n;

    d.resize(n);
    REP(i,n) cin>>d[i];

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

    FOR(i,d[(n/2)-1]+1, d[(n/2)]+1)
    {
        ans++;
    }

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

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	char day[7][10]={"Monday","Tuesday","Wednesday","Thursday"
					,"Friday","Saturday","Sunday"};
	int months[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
	int i;
	int totaldate;
	int month,date;
	for(i=2;i<13;i++)months[i]+=months[i-1];
	while(1) {
		scanf("%d %d",&month,&date);
		if(month==0)break;
		totaldate=months[month-1]+date;
		printf("%s\n",day[(totaldate+2)%7]);
	}
	return 0;
}

Measured memory_bytes: 0
main :: IO ()
main = do
  com <- getLine :: IO String
  putStr $ trim com ""

trim :: String -> String -> String
trim [] y = reverse y
trim (x:xs) y 
  | x == '0' = trim xs (x:y)
  | x == '1' = trim xs (x:y)
  | x == 'B' && y == mempty = trim xs y
  | x == 'B' = trim xs (tail y)


Measured memory_bytes: 380
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>
#include <tuple>

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;

int main(){

	int A,B,C;

	cin >> A >> B >> C;

	cout << min(C, B/A) << endl;

	return 0;
}


Measured memory_bytes: 384
#include<map>
#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
template<class AC>void r(AC &x){
    x=0;
	int f=0;
	char ch=getchar();
    while(ch<'0'||ch>'9'){
		f|=(ch=='-');
		ch=getchar();
	}
    while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
    x=f?-x:x;
    return;
}
int n,a[10005],ans;
int main(){
	r(n);
	n*=2;
	for(int i=1;i<=n;i++)r(a[i]);
	sort(a+1,a+1+n);
	for(int i=1;i<=n;i+=2)ans+=a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define max(a,b) (a>b?a:b)
using namespace std;
template <class T> inline void read(T &n) {
	n=0;register char ch;while(!isdigit(ch=getchar()));
	for(n=ch^48;isdigit(ch=getchar());n=(n<<3)+(n<<1)+(ch^48));
}
int a,b,c;
int main() {
    read(a);read(b);read(c);
    cout<<max(0,c+b-a);
    return 0;
}



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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> w(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> w[i];
        sum += w[i];
    }
    int ans = sum;
    int sum2 = 0;
    for (int i = 0; i < n; i++) {
        sum2 += w[i];
        ans = min(ans, abs(sum-sum2-sum2));
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int N, D, M, T;
    cin >> N;
    map<int, int> m;
    rep(i, N) {
        cin >> D;
        m[D]++;
    }
    cin >> M;
    rep(i, M) {
        cin >> T;
        if (m[T] <= 0) {
            cout << "NO\n";
            return 0;
        }
        m[T]--;
    }
    cout << "YES\n";
}

Measured memory_bytes: 9600
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*m]
    g = [[] for _ in [0]*n]
    [g[a].append(b) for a, b in ab]

    def scc(g_temp):
        g, n = [set(i) for i in g_temp], len(g_temp)
        rg, cmp_, vs = [[] for _ in [0]*n], [0]*n, []
        for v1, v_list in enumerate(g):
            for v2 in v_list:
                rg[v2].append(v1)
        used = [False]*n
        for v in range(n):
            if not used[v]:
                q = [v]
                while q:
                    v = q[-1]
                    used[v] = True
                    while g[v]:
                        i = g[v].pop()
                        if not used[i]:
                            q.append(i)
                            break
                    else:
                        q.pop()
                        vs.append(v)
        used = [False]*n
        kk = [-1]
        for i in range(len(vs)-1, -1, -1):
            if not used[vs[i]]:
                q = [vs[i]]
                kk[0] += 1
                while q:
                    v, k = q[-1], kk[0]
                    used[v], cmp_[v] = True, k
                    while rg[v]:
                        i = rg[v].pop()
                        if not used[i]:
                            q.append(i)
                            break
                    else:
                        q.pop()
        k = kk[0]
        g2 = [set() for _ in [0]*(k+1)]
        for v1, v_list in enumerate(g_temp):
            for v2 in v_list:
                g2[cmp_[v1]].add(cmp_[v2])
        for v, v_set in enumerate(g2):
            if v in v_set:
                g2[v].remove(v)
        g2 = [list(v) for v in g2]
        return g2, cmp_

    s = scc(g)[1]
    q = int(input())
    for i in range(q):
        c, d = map(int, input().split())
        if s[c] == s[d]:
            print(1)
        else:
            print(0)


main()



Measured memory_bytes: 14140
using System;

namespace Project
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			int i = 1;
			while (true)
			{
				int a = int.Parse(Console.ReadLine());
				if (a == 0) { break; }
				else
				{
					Console.WriteLine("Case {0}: {1}", i, a);
					i++;
				}
					
			}

		}
	}
}

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

int main(){
    int n,a;
    cin >>n;
    map<int,int> mp ;
    rep(i,n){
        cin >>a;
        mp[a]++;
        if(mp[a]>1){
            cout << "NO" <<endl;
            return 0;
        }
    }
    cout << "YES" <<endl;
    return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <vector>
using namespace std;
const int N=1e5+10;

#define PB push_back
int max(int a,int b){return a>b?a:b;}

int hev[N],top[N],dep[N],p[N];
vector<int>des[N];
int init(int now){
    if(des[now].empty())return 0;
    int ans=0,temp;
    for(int i=0;i<des[now].size();i++){
        dep[des[now][i]]=dep[now]+1;
        p[des[now][i]]=now;
        temp=init(des[now][i])+1;
        if(temp>ans){
            ans=temp;
            hev[now]=i;
        }
    }
    return ans;
}
void built(int now,int from){
    top[now]=from;
    for(int i=0;i<des[now].size();i++){
        if(hev[now]==i)built(des[now][i],from);
        else built(des[now][i],des[now][i]);
    }
    return ;
}
int lca(int a,int b){
    while(a!=b){
        if(dep[top[a]]>dep[top[b]])swap(a,b);
        if(top[a]==top[b]){
            if(dep[b]<dep[a])a=b;
            break;
        }
        b=p[top[b]];
    }
    return a;
}
int main(){
    int n,k,l,r;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&k);
        while(k--){
            scanf("%d",&l);
            des[i].PB(l);
        }
    }
    init(0);
    built(0,0);
    scanf("%d",&n);
    while(n--){
        scanf("%d%d",&l,&r);
        printf("%d\n",lca(l,r));
    }
}


Measured memory_bytes: 14280
// In the name of GOD
#include<bits/stdc++.h>
using namespace std;

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";

#define     IOS         ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define 	setprecn(x) cout<<fixed<<setprecision(x);
#define 	ll          long long int
#define 	pb          push_back
#define 	pll         pair<ll,ll>
#define 	vll         vector<ll>
#define 	ff          first
#define 	ss          second
#define 	all(a)      (a).begin(),(a).end()
#define 	sz(x)       (ll)x.size()
#define 	mod         1000000007
#define 	inf         10000000000000007
#define 	rep(i,n)    for(ll i=0;i<n;i++)
#define 	repe(i,a,b) for(ll i=a;i<b;i++)
#define 	lbnd        lower_bound
#define 	ubnd        upper_bound
#define 	bs          binary_search

ll power(ll a,ll b,ll m=mod)
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	ll c=power(a,b/2,m);
	if(b%2==0)
		return((c%m)*(c%m))%m;
	return ((((c%m)*(c%m))%m)*(a%m))%m;
}

/********************************************************/
//	d.erase(unique(all(d)), d.end());



int main()
{
	IOS;
	ll n,k,m,i,j,c=0,cs=0,t;
	t=1;

	// cin>>t;
	string s;
	while(t--)
	{
		cin>>n>>k;
		// n=s.length();
		c=n/k;
		n-=(c*k);
		n=min({abs(n-k),n});
		cout<<n;

		
		cout<<"\n";
	}
	return 0;
}

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


int main()
{
  ll d,n;
  cin >> d >> n;
  ll ans = 0;
  if(d == 0){
    if(n != 100){
        ans = n;
    } else if(n == 100){
      ans = n + 1;
    }
  } else if(d == 1){
    if(n != 100){
     ans = 100 * n;
   } else if (n == 100){
     ans = 100 * (n + 1);
   }
  } else if(d == 2){
    if(n != 100){
      ans = 10000 * n;
    } else if(n == 100){
      ans = 10000 * (n + 1);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 10007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0,  1, -1,  1, -1 };
static const int dy[] = { 0, -1, 0, 1 , 1,  1, -1, -1 };
 
 
int a, b, n;
VI pm;
 
int main() {
    pm.push_back( 2 );
    for ( int i = 3; i < 1000001; i += 2 ) {
        bool can_add = true;
        for ( int j = 0; j < pm.size() && pm[ j ] * pm[ j ] <= i; j++ ) {
            if ( !( i % pm[ j ] ) ) {
                can_add = false;
                break;
            }
        }
        if ( can_add ) {
            pm.push_back( i );
        }
    }
    while ( ~scanf( "%d %d %d", &a, &b, &n ) && a && b && n ) {
        while ( n ) {
            n -= binary_search( pm.begin(), pm.end(), a );
            if ( !n ) {
                printf( "%d\n", a );
                break;
            }
            a += b;
        }
    }
    return 0;
}

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

/*
code credits : ਜ਼ੈਲਦਾਰ
dashan jot singh
*/
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL)
#define pb push_back
#define mp make_pair
#define inf LLONG_MAX
#define pl pair<ll,ll>

void solve(){
    string s;
    cin>>s;
    string st,rev;
    st=s; 
    rev=s;
    reverse(rev.begin(),rev.end());
    // cout<<st<<" "<<rev<<"\n";
    int q;
    cin>>q;
    int cc=0;
    string add_front_rev="";
    string add_rear_rev="";
    string add_front_st="";
    string add_rear_st="";
    for(int i=0;i<q;i++){
    	int type;
    	cin>>type;
    	if(type==1){
    		cc+=1;
    	}
    	else{
    		int t2;
    		cin>>t2;
    		char c;
    		cin>>c;
    		if(t2==1){
    			if(cc%2==0){
    				// st=c+st;
    				add_front_st+=c;
    				// rev=rev+c;
    				add_rear_rev+=c;
    			}
    			else{
    				// st=st+c;
    				add_rear_st+=c;
    				// rev=c+rev;
    				add_front_rev+=c;
    			}
    		}
    		else{
    			if(cc%2==0){
    				// st=st+c;
    				add_rear_st+=c;
    				// rev=c+rev;
    				add_front_rev+=c;
    			}
    			else{
    				// st=c+st;
    				add_front_st+=c;
    				// rev=rev+c;
    				add_rear_rev+=c;
    			}
    		}
    	}
    }
    reverse(add_front_st.begin(),add_front_st.end());
    reverse(add_front_rev.begin(),add_front_rev.end());
    if(cc%2==1){
    	cout<<add_front_rev<<rev<<add_rear_rev<<"\n";
    }
    else{
    	cout<<add_front_st<<st<<add_rear_st<<"\n";
    }
}
int main(){
	fast;
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1360
#include<iostream>
#include<string>
using namespace std;
string d[7]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int x[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int y[12][31];
int main(){
	int a,b;
	while(true){
		cin>>a>>b;
		if(a==0){break;}
		int cnt=0;
		for(int i=0;i<12;i++){
			for(int j=0;j<x[i];j++){
				y[i][j]=cnt;
				cnt++;
			}
		}
		int D=y[a-1][b-1];
		D=(D+4)%7;
		cout<<d[D]<<endl;
	}
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
  int N, M,X; cin >> N >> M >> X;
  vector<int> A(M); for(int i = 0; i < M; i++){
    cin >> A[i];}
  sort(A.begin(),A.end());
  
  auto c1 = lower_bound(A.begin(),A.end(),X);//X以下のAの要素数を求める
  int d1 = distance(A.begin(),c1); 
  
  cout << min(d1, M - d1) << endl;

return 0;}

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

int main(){
    int W, H, x, y;
    cin >> W >> H >> x >> y;
    float half = (float)W * (float)H / 2.0;
    bool ans;
    if(2 * x == W && 2 * y == H){
        ans = 1;
    }else{
        ans = 0;
    }
    cout << half << " " << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)
set<long long int> s;
map<long long int, long long int> m;
bool divisors(long long int n)
{
for(long long int i=1; i<=sqrt(n);i++)
{if(n%i == 0)
{	if(i!=n and s.find(i)!=s.end())
	return false;
	if(n/i!=n and s.find(n/i)!=s.end())
		return false;
	if(i==n and m[i]>1 and s.find(i)!=s.end())
	return false;
	if(n/i==n and m[n/i]>1 and s.find(n/i)!=s.end())
		return false;
}}
return true;}
int main() 
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	long long int a;
	cin>>a;
	long long int b[a],ct=0;
	forr(i,0,a)
	{
		cin>>b[i];
		s.insert(b[i]);
		m[b[i]]++;
	}
	forr(i,0,a)
	{
		if(divisors(b[i]))
			ct++;
	}
	cout<<ct<<'\n';
	
	return 0; 	
}

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

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>

#define INF 100000000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int par[1000000]; //par[i] : iの親の番号

//全てが根であるとして初期化
void init(int n){
   for(int i = 0; i < n; i++){
       par[i] = i;
       //cout << i << " " << par[i] << endl;
   }
}

//データxが属する木の根を再帰で取得
int root(int x){
    //cout << x << endl;
   if(par[x] == x){
       return x;
   }else{
       return par[x] = root(par[x]);
   }
}

//xとyが同じ木に属しているかを判定
bool same(int x, int y){
   return root(x) == root(y);
}

//xとyの木を併合
void unite(int x, int y){
   int rx = root(x); //xの根
   int ry = root(y); //yの根
   if(rx == ry) return; //根が同じならそのまま

   par[rx] = ry; //根が違うなら併合
}


int main() {
    long long n, m;
    cin >> n >> m;
    init(n);
    int data[n];
    for(int i=0;i<n;i++) cin >> data[i];
    for(int i=0;i<m;i++) {
        long long a, b;
        cin >> a >> b;
        unite(a-1, b-1);
    }
    //cout << "C" << endl;
    long long ans = 0;


    for(int i=0;i<n;i++) {
        if(same(i, data[i]-1)) ans+=1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AnandOza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BMinorChange solver = new BMinorChange();
        solver.solve(1, in, out);
        out.close();
    }

    static class BMinorChange {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char[] s = in.next().toCharArray();
            char[] t = in.next().toCharArray();

            int answer = 0;
            for (int i = 0; i < s.length; i++) {
                if (s[i] != t[i])
                    answer++;
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 31732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
  
int main(void){
    int x, a, b;
    cin >> x >> a >> b;
    
    if(b-a <= 0){
        cout << "delicious";
        return 0;
    } else if ((0 < (b-a)) && ((b-a) <= x)) {
        cout << "safe";
        return 0;
    } else {
        cout << "dangerous";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;
int a[1000];
int table[] = { 5,12,17,24,31,-1 };

int main() {
	while (cin >> n&&n) {
		rep(i, n) {
			string s;
			cin >> s;
			a[i] = s.size();
		}
		rep(i, n) {
			a[i + 1] += a[i];
		}
		rep(i, n) {
			int pos = 0;
			FOR(j, i, n) {
				if (i != 0) {
					if (table[pos] == a[j] - a[i - 1])pos++;
				}
				else {
					if (table[pos] == a[j])pos++;
				}
			}
			if (pos == 5) {
				cout << i + 1 << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3148
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

string YorN(bool P) { if (P)return "YES"; else return "NO"; }

int main() {
    int N, ans=0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int l, r;
        cin >> l >> r;
        ans += r - l + 1;
    }

    cout << ans << endl;

    return 0;

}

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

int a, b;

int mx(int g, int h){
    return g > h ? g : h;
}

signed main(){
    cin >> a >> b;
    int c = mx(a + b, mx(a - b, a * b));
    cout << c << endl;



    return 0;
}



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

int main(){
    int N, M;
    std::cin >> N >> M;

    std::vector<int> X;
    for (int i=0; i<M; i++) {
        int t;
        std::cin >> t;
        X.push_back(t);
    }

    if (N > M) {
        std::cout << 0 << std::endl;
        return 0;
    }

    std::sort(X.begin(), X.end());

    int pos_min = X.at(0);
    int pos_max = X.at(X.size() - 1);
    int ans = pos_max - pos_min;

    std::vector<int> margins;
    for (int i=1; i<X.size(); i++)
        margins.push_back( X.at(i) - X.at(i-1) );

    std::sort(margins.begin(), margins.end());
    std::reverse(margins.begin(), margins.end());

    for (int i=0; i<N-1; i++) ans -= margins.at(i);

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

    return 0;
}


Measured memory_bytes: 1400
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+7;
#define IOS ios::sync_with_stdio(0)
#define ull unsigned ll
#define uint unsigned
#define pai pair<int,int>
#define pal pair<ll,ll>
#define IT iterator
#define pb push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);++i)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);--i)
#define endl '\n'
#define ll long long
ll a[N],n,k;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=k+1;i<=n;i++)
    {
        if(a[i]>a[i-k])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}


Measured memory_bytes: 5184
<?php
  $tmp = explode(" ",trim(fgets(STDIN)));

  $val1 = $tmp[0];
  $val2 = intval(str_replace(".", "", $tmp[1]));

  $tmp2 = $val1*$val2;
  if(strlen($tmp2)>2){
    echo substr($tmp2, 0, -2)."\n";
  }else{
    echo floor($tmp2 / 100)."\n";
  }
  


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

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

  vector<int64_t> cumsum(N+1);
  int64_t buf;
  for(int i=1; i<=N; i++){
    cin >> buf;
    cumsum.at(i)= cumsum.at(i-1)+ buf;
  }

  int64_t sum_all= cumsum.back();
  auto itr1= lower_bound(cumsum.begin(), cumsum.end(), sum_all/2);
  auto itr0= prev(itr1);
  int64_t sum1= *itr1;
  int64_t sum0= *itr0;

  int64_t ans= min(abs(sum_all- 2*sum1), abs(sum_all- 2*sum0));

  cout << ans << endl;
}

Measured memory_bytes: 1792
a, b, c = input(), input(), input()

if len(a) == 1:
    print("A")
    exit()

next = a[0]
a = a[1:]

while True:
    try:
        if next == "a":
            next = a[0]
            a = a[1:]
        elif next == "b":
            next = b[0]
            b = b[1:]
        elif next == "c":
            next = c[0]
            c = c[1:]
    except:
        if next == "a":
            print("A")
        elif next == "b":
            print("B")
        else:
            print("C")
        exit()
        

Measured memory_bytes: 8984
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	PrintWriter out = new PrintWriter(System.out);
	BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tok = new StringTokenizer("");
    String next() throws IOException {
        if (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine()); }
        return tok.nextToken();
    }
    int ni() throws IOException { return Integer.parseInt(next()); }
    long nl() throws IOException { return Long.parseLong(next()); }
    
    HashSet<Integer>[]H;
    int n;
    int[]B;
    
    void solve() throws IOException {
        n=ni();
        int m=ni();
        H=new HashSet[n+1];
        for (int i=1;i<=n;i++) H[i]=new HashSet();
        for (int i=0;i<m;i++) {
            int u=ni(),v=ni();
            H[u].add(v);
            H[v].add(u);
        }
        
        B=new int[n+1];
        int ans=0;
        
        for (int i=1;i<=n;i++) {
            if (B[i]>0) continue;
            ans=Math.max(ans,dfs(i));
        }
        
        out.println(ans);
        out.flush();
    }
    
    int dfs(int u) {
        B[u]=1;
        int r=1;
        for (Integer v:H[u]) {
            if (B[v]>0) continue;
            r+=dfs(v);
        }
        return r;
    }
    
    public static void main(String[] args) throws IOException {
        new Main().solve();
    }
}

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

int main(){
  string ab = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int N;
  string S;
  cin >> N >> S;
  string trans {""};
  for(char c : S)
  {
    trans += ab[(static_cast<int>(c)-65+N)%26];
  }
  cout << trans;
  return 0;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int N; cin >> N;
    vector<long double> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    long double ans = 0;
    for(int i=0; i<N; i++) ans += 1.0 / A[i];
    cout << fixed << setprecision(15) << 1.0 / ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define min(a, b) (a > b ? b : a)
#define chmax(a, b) a = (a >= b ? a : b)
#define chmin(a, b) a = (a <= b ? a : b)
#define out(a) cout << a << endl
#define outa(a, n) { rep(_, n) cout << a[_] << " "; cout << endl; }
#define outp(a, n) { cout << endl; rep(_, n) cout << a[_].F << " " << a[_].S << endl; }
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
#define FIX(a) fixed << setprecision(a)
#define LB(v, n) (int)(lower_bound(all(v), n) - v.begin())
#define UB(v, n) (int)(upper_bound(all(v), n) - v.begin())
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll nck(int n, int k) { ll ret = 1; rep(i, k) {ret *= n - i; ret /= i + 1; } return ret; } // n <= 60
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int n, m;
vector<int> a, b;

class UnionFind {
public:
    vector<int> Parent;
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    int size(int A) {
        return -Parent[root(A)];
    }
    bool connect(int A, int B) {
        A = root(A);
        B = root(B);
        if (A == B) {
            return true;
        }
        if (size(A) < size(B)) swap(A, B);
        Parent[A] += Parent[B];
        Parent[B] = A;
        return false;
    }
};

void solve() {
    vector<ll> ans;
    ans.eb((ll)n * (n - 1) / 2);
    
    
    UnionFind uni(n);
    rep(i, m - 1) { // 初期状態0はansに入れない
        if (uni.root(a[i]) == uni.root(b[i])) {
            ans.eb(ans.back());
            continue;
        }
        ans.eb(ans.back() - (ll)uni.size(a[i]) * uni.size(b[i]));
        uni.connect(a[i], b[i]);
    }
    reverse(all(ans));
    rep(i, m) out(ans[i]);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> n >> m;
    
    a.resize(m);
    b.resize(m);
    rep(i, m) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    reverse(all(a));
    reverse(all(b));
    
    solve();
    
}


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

int DP[100001];

int main() {
  int x;
  cin>>x;
  DP[0]=1;
  for(int i=100;i<106;i++){
    DP[i]=1;
  }
  
  for(int i=106;i<=100000;i++){
    DP[i]=max({DP[i-100],DP[i-101],DP[i-102],DP[i-103],DP[i-104],DP[i-105]});
  }
  cout<<DP[x];
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
const int N = 2e5+ 2, mod = 998244353;

void add(int& a, int b){
    if ((a += b) >= mod) a -= mod;
}


void solve() {
    int n, k;
    cin >> n >> k;
    vector<pii> p(k);
    for(int i = 0; i < k; i++) {
        cin >> p[i].first >> p[i].second;
    }
    vector<int> sum(n + 1);
    sum[1] = 1;
    for(int i = 2; i <= n; i++) {
        ll curr = 0;
        for(int j = 0; j < k; j++) {
            if(p[j].first >= i) {
                continue;
            }
            int l = max(1, i - p[j].second);
            int r = i - p[j].first;
            curr += sum[r] - sum[l - 1];
        }
        curr %= mod;
        if(curr < 0) {
            curr += mod;
        }
        sum[i] = (sum[i - 1] + curr) % mod;
    }
    ll ans = sum[n] - sum[n - 1];
    if(ans < 0) {
        ans += mod;
    }
    cout << ans;   
}    


int main() {
  int tt = 1;
  // cin >> tt;
  for (int tc = 1; tc <= tt; tc++) {
    // cout << "Case #:" << tc << " ";
    solve();
  }
}

Measured memory_bytes: 4028
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int n,a,b;
ll ans;
int getsum(int n)
{
	int cnt=0;
	while (n!=0)
	{
		cnt+=n%10;
		n/=10;
	}
	return cnt;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>a>>b;
	for (int i=1;i<=n;++i)
	{
		int sum=getsum(i);
		if (sum>=a && sum<=b) ans+=i;
	}
	cout<<ans;
	return 0;
}

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

#define COLUMN 100
#define ROW 100

int main(){
  int h,w;
  cin >> h >> w;
  string s[ROW][COLUMN];
  for (int i = 0; i<h; i++){
    for (int j = 0; j<w; j++){
      cin >> s[i][j];
      if (s[i][j] == "snuke"){
        char r = 'A'+j;
        cout << r << i+1 << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 384
def find_next_valid_digit(d, bad_nums):
    next_digit = d
    while True:
        valid = True
        for c in str(next_digit):
            if int(c) in bad_nums:
                valid = False
                break
        if valid:
            break
        else:
            next_digit += 1
    return next_digit

if __name__ == '__main__':
    n, k = list(map(int, input().split(' ')))
    bad_nums = list(map(int, input().split(' ')))
    n_str = str(n)
    cur_result = 0
    for i in range(len(n_str)):
        most_significant_digit = int(n_str[i])
        if most_significant_digit in bad_nums:
            basis = cur_result * 10 + most_significant_digit
            cur_result = find_next_valid_digit(basis, bad_nums)
            num_digits_to_fill = (len(n_str) - i - 1)
            num_to_fill = find_next_valid_digit(0, bad_nums)
            if num_digits_to_fill > 0:
                cur_result = (cur_result * (10**num_digits_to_fill)) + int(str(num_to_fill) * num_digits_to_fill)
            break
        else:
            cur_result = cur_result * 10 + most_significant_digit

    print(cur_result)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void)
{
    int N;
    scanf("%d", &N);
    char *str1, *str2;
    str1 = (char *)malloc(sizeof(char) * N);
    str2 = (char *)malloc(sizeof(char) * N);
        scanf("%s%s", str1,str2);
    for (int i = 0; i < N; i++)
    {
        printf("%c%c", str1[i], str2[i]);
    }
    return 0;
}

Measured memory_bytes: 128
H, W = map(int, input().split())

if H % 3 == 0 or W % 3 == 0:
    print(0)
else:
    ans = float('inf')

    # 横と縦の切るところを真ん中に固定してそれぞれのパターンを線形検索
    center = W//2
    for i in range(1, H):
        # 縦を先に割る
        a1 = center * H
        a2 = (W-center) * i
        a3 = (W-center) * (H-i)

        # 横を先に割る
        b1 = i * W
        b2 = (H-i) * center
        b3 = (H-i) * (W-center)
        ans = min(ans, max(a1, a2, a3) - min(a1, a2, a3))
        ans = min(ans, max(b1, b2, b3) - min(b1, b2, b3))

    center = H//2
    for i in range(1, W):
        # 縦を先に割る
        a1 = i * H
        a2 = (W-i) * center
        a3 = (W-i) * (H-center)

        # 横を先に割る
        b1 = center * W
        b2 = (H-center) * i
        b3 = (H-center) * (W-i)
        ans = min(ans, max(a1, a2, a3) - min(a1, a2, a3))
        ans = min(ans, max(b1, b2, b3) - min(b1, b2, b3))

    # 3つに分割
    ans = min(ans, (H//3+1)*W - (H//3)*W)
    ans = min(ans, (W//3+1)*H - (W//3)*H)

    print(ans)


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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main()
{
  int ans=1,N,M;scanf("%d %d",&N,&M);
  UnionFind tree(N);
  int fsize[N];fill(fsize,fsize+N,1);
  for(int i=0,A,B;i<M;i++)
  {
    scanf("%d %d",&A,&B);
    if(tree.same(A,B))continue;
    fsize[tree.root(B)]+=fsize[tree.root(A)];
    tree.unite(A,B);
    ans=max(ans,fsize[tree.root(B)]);
  }
  printf("%d",ans);
}

Measured memory_bytes: 4832
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}

inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// ll dx[4] = {1, 0, -1, 0};
// ll dy[4] = {0, 1, 0, -1};

string s[114514];
signed main() {
	IOS();
	char a;
	cin >> a;
	if (a == 'A') dump('T');
	if (a == 'T') dump('A');
	if (a == 'G') dump('C');
	if (a == 'C') dump('G');
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>  
using namespace std; 
int check(int x){
	for(int i=2;i<=sqrt(x);i++){
		if(x%i==0)
			return 0;
	}return 1;
} 
int main() {  
	int a;
	cin>>a;
	for(;;){
		if(check(a)==1){
			cout<<a;
			break;
		}
		a++;
	}
    return 0;  
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
int const M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e9+10;
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
ll pow(ll a, ll b){ll res = 1;for(int i = 1; i<=b; ++i) res *= a;return res;}
ll isPrime(ll n){for(ll i=2; i<=sqrt(n); i++){if(n%i==0) return 0;}return 1;}
ll fact(ll n){if(n==0 || n==1) return 1; else return n*fact(n-1);}
ll gcd (ll a, ll b) {return b ? gcd (b, a % b) : a;}
ll lcm(ll a, ll b){return (a/gcd(a,b))*b;}
int a[18]={2,3,5,7,11,13,13,17,19,23,29,31,37,41,43,47,53,59};
ll binarySearch(ll low,ll high,ll key){while(low<=high){ll mid=(low+high)/2;if(a[mid]<key){low=mid+1;}else if(a[mid]>key){high=mid-1;}else{return mid;}}return -1;}
void Sieve(ll n, ll prime[]){for(int p=2; p*p<=n; p++){if(prime[p] == true){for(int i=p*2; i<=n; i += p)prime[i] = false;}}for(int p=2; p<=n; p++)if(prime[p])cout << p << " ";}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,T;
	cin >> n >> T;
	ll c[n],t[n];
	ll mini=inf;
	for(ll i=0; i<n; i++){
        cin >> c[i] >> t[i];
        if(t[i]<=T && c[i]<mini) mini=c[i];
	}
	if(mini==inf) cout << "TLE";
	else cout << mini;
	return 0;
}
/* The judge is never wrong! Your code is buggy 😈
   Look for:
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 256
function main(input) {
  var primes = [2, 3]
  if (input == 2 || input == 3) {
    return console.log(input);
  }

  var base = 6
  while (true) {
    var root = Math.ceil(Math.sqrt(base))
    var tests = primes.filter(p => p <= root)

    var elder = base - 1
    var younger = base + 1

    if (tests.every(p => elder % p != 0)) {
      primes.push(elder);
      if (input <= elder) {
        return console.log(elder);
      }
    }
    if (tests.every(p => younger % p != 0)) {
      primes.push(younger);
      if (input <= younger) {
        return console.log(younger);
      }
    }
    base = base + 6;
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 10524
def main():
    people_num = int(input())
    information = sorted(list(map(int, input().split())))
    unique = len(set(information))
    answer = 0
    if unique * 2 == people_num + people_num % 2:
        if people_num > 1 and information[1] > 0:
            answer = 2 ** (unique - people_num % 2)
        elif people_num == 1 and information[0] == 0:
            answer = 1
    print(answer % (10 ** 9 + 7))


if __name__ == '__main__':
    main()



Measured memory_bytes: 13880
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(i,k,h) for(int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;



int main() {
    int x;
    cin >> x;
    if(x == 2) {
        cout << 2 << endl;
        return 0;
    }
    if(x % 2 == 0) {
        x +=1;
    }
    for(int i = x; i <= 1e8; i +=2) {
        int count = 0;
        for(int j = 1; j <= i; j++) {
            if(i % j == 0) {
                count++;
            }
        }
        if(count ==2) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<string>
#include<string.h>
#include<math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<cctype>
#include<utility>
#include<set>
#include<map>
#include<sstream>
#define pb push_back
#define F(i,a,b) for(int i=a;i<b;++i)
#define Fl(i,a,b) for(long long i=a;i<b;++i)
#define all(v) v.begin(), v.end() 
#define fi first;
#define se second;
#define mp make_pair;
typedef long long ll;
typedef std::vector<int> vec;
typedef std::vector<long long> vecl;
typedef std::pair<int,int> pii;
typedef pair<ll,ll> pll; 



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

// 	int t{};
// 	cin>>t;
// 	while(t--){
// 	    int n{},a{},b{},c{},s{},f{};
// 	    cin>>
// 	}

    char c;
    cin>>c;
    int a=c;
    if(a>=65&&a<=90){
        cout<<'A'<<endl;
    }else{
        cout<<'a'<<endl;
    }
    
	return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; ++i)
const int N = 1e5 + 7;

int n, a[N][5], f[N][5];

int main() {
	scanf("%d", &n);
	rep(i, 1, n) {
		scanf("%d%d%d", &a[i][1], &a[i][2], &a[i][3]);
	}
	
	rep(i, 1, n) {
		f[i][1] = max(f[i - 1][2], f[i - 1][3]) + a[i][1];
		f[i][2] = max(f[i - 1][1], f[i - 1][3]) + a[i][2];
		f[i][3] = max(f[i - 1][1], f[i - 1][2]) + a[i][3];
	}
	
	printf("%d\n", max(max(f[n][1], f[n][2]), f[n][3]));
	return 0;
}


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

using namespace std;

#define allof(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define pb push_back
#define exists(s, e) (s.find(e)!=s.end())
#define INF 0x3f3f3f3f
#define endl '\n'
#define mp make_pair
#define watch(x) cout << (#x) << " is " << (x) << endl;

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

ll gcd(ll a, ll b) {return b == 0 ? a : gcd(b, a % b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

void solve() {
    int n; cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin >> v[i];
    int cur = 0;
    while(true) {
        for(int i=0; i<n; i++) {
            if(v[i]%2) { 
                cout << cur << endl;
                return;
            }
            v[i] /= 2;
        }
        cur++;
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    solve();
    return 0;
}



Measured memory_bytes: 256
'use strict';

function main(stdin) {
  const S = 'L' + stdin.trim() + 'R';
  const L = 'L';
  const R = 'R';
  let ans = [];

  for (let i = 1; i < S.length - 1; ++i) {
    let a = 0;
    if (S[i] === L) {
      let l = 1;
      while (S[i - l] === R) ++l;
      if (l === 1) {
        ans.push(0);
        continue;
      }
      a += Math.ceil(l / 2);

      l = 1;
      while (S[i + l] === L) ++l;
      a += Math.floor((l - 1) / 2);
    } else {
      let l = 1;
      while (S[i + l] === L) ++l;
      if (l === 1) {
        ans.push(0);
        continue;
      }
      a += Math.ceil(l / 2);

      l = 1;
      while (S[i - l] === R) ++l;
      a += Math.floor((l - 1) / 2);
    }
    ans.push(a);
  }

  console.log(ans.join(' '));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 15564
n,m = map(int, input().split())
H = list(map(int, input().split()))
import collections
d = collections.defaultdict(list)
for i in range(m):
    a,b = map(int, input().split())
    d[a-1].append(b-1)
    d[b-1].append(a-1)
ans = 0
for i in range(n):
    s = list(set(d[i]))
    #print('l,s', d[i], s)
    #print('s',s)
    if len(s) == 0:
        ans += 1
        #print('0000000', i)
        continue
    f = 0
    for j in range(len(s)):
        #print(i,j,H[s[j]], H[i])
        if H[s[j]] >= H[i]:
            f += 1
            continue
    if f == 0:
        ans += 1
        #print('add',i,H[i])

print(ans)
#print(d)

Measured memory_bytes: 39516
#include<bits/stdc++.h>
using namespace std;
const int dx[8]={0,1,0,-1,1,1,-1,-1};
const int dy[8]={1,0,-1,0,1,-1,-1,1};
vector<vector<bool>> seen;
int H,W;
char info[50][50];
void GridDFS(const int y,const int x){
    seen[y][x]=1;
    for(int i=0;i<8;i++){
        int ny=y+dy[i],nx=x+dx[i];
        if(ny<0 or H<=ny or nx<0 or W<=nx)continue;
        if(seen[ny][nx])continue;
        if(info[ny][nx]=='1'){
            GridDFS(ny,nx);
        }
    }
}
void solve(int H,int W){
    seen=vector<vector<bool>>(H,vector<bool>(W));
    for(int i=0;i<H;i++)for(int j=0;j<W;j++)cin>>info[i][j];
    int ans=0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(seen[i][j])continue;
            if(info[i][j]=='1'){
                ans++;
                GridDFS(i,j);
            }
        }
    }
    printf("%d\n",ans);
}
int main(){
    while(true){
        scanf("%d%d",&W,&H);
        if(W+H==0)break;
        else solve(H,W);
    }
    return 0;
}


Measured memory_bytes: 3332
#qeueu
from collections import deque
n,p = map(int,input().split());cnt = 0
r = deque(input().split() for _ in range(n))
while r:
    name, val = r.popleft()
    val_af = max(int(val)-p, 0)
    if val_af != 0:r.append([name,val_af]);cnt += p
    else:cnt += int(val);print(name, cnt)


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

using namespace std;

int main()
{
    string s;
    cin>>s;
    int p1 = s.find('C');
    int p2 = s.rfind('F');
    if(p1 == -1 || p2 == -1)
    {
        cout<<"No";
        return 0;
    }
    if(p2<p1)
    {
        cout<<"No";
        return 0;
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256