akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define N 200005
using namespace std;

int n,t[N],T;

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

  long long ans=T;
  
  for(int i=0;i<n;i++)scanf("%d",&t[i]);

  for(int i=0;i<n-1;i++){
    
    if(t[i]+T<t[i+1]) ans+=T;
    else ans+=t[i+1]-t[i];      
    
  }

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define re register
#define SIZE 100005
#define LL long long
#define VI vector<int>
using namespace std;
int n,MOD;
VI p[SIZE];
LL dp[SIZE];
LL ans[SIZE],Last[SIZE];
LL qzj[SIZE],hzj[SIZE]; 
inline void dfs(int i,int fa)
{
	for(re int j=0;j<p[i].size();++j)
		if(p[i][j]!=fa)
			dfs(p[i][j],i);
	for(re int j=0;j<p[i].size();++j)
		if(p[i][j]!=fa)
			dp[i]=(dp[i]*(dp[p[i][j]]+1))%MOD;
}
inline void HuanGen(int i,int fa)
{ 
	ans[i]=(Last[i]+1)*dp[i]%MOD;
	qzj[0]=1;hzj[p[i].size()+1]=1;
	for(re int j=0;j<p[i].size();++j)	
		if(p[i][j]!=fa)
			qzj[j+1]=qzj[j]*(dp[p[i][j]]+1)%MOD;
		else
			qzj[j+1]=qzj[j]; 
	for(re int j=p[i].size();j>=1;--j)	
		if(p[i][j-1]!=fa)
			hzj[j]=hzj[j+1]*(dp[p[i][j-1]]+1)%MOD;
		else
			hzj[j]=hzj[j+1];
	for(re int j=0;j<p[i].size();++j)	
		if(p[i][j]!=fa) 
			Last[p[i][j]]=(Last[i]+1)*qzj[j]%MOD*hzj[j+2]%MOD;
	for(re int j=0;j<p[i].size();++j)	
		if(p[i][j]!=fa) 
			HuanGen(p[i][j],i);
}
int main()
{
	scanf("%d%d",&n,&MOD);
	for(re int i=1;i<n;++i)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		p[x].push_back(y);
		p[y].push_back(x);
	}
	for(re int i=1;i<=n;++i)
		dp[i]=1;
	dfs(1,0);
	HuanGen(1,0); 
	for(re int i=1;i<=n;++i)
		printf("%lld\n",ans[i]);
	return 0;	
} 

Measured memory_bytes: 17148
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

string solve(string a, string b, string c, int x, int y, int z) {
	if (y + z == 0) {
		string res = "";
		for (int i = 0; i < x; ++i) res += a;
		return res;
	}
	if (x == 0) return solve(b, c, "", y, z, 0);
	int p = x / (y + z);
	int r = x % (y + z);
	string A = "";
	for (int i = 0; i < p; ++i) A += a;
	if (z >= r) {
		string na = A + a + c;
		string nb = A + b;
		string nc = A + c;
		return solve(na, nb, nc, r, y, z - r);
	}
	else {
		string na = A + a + b;
		string nb = A + a + c;
		string nc = A + b;
		return solve(na, nb, nc, r - z, z, y + z - r);
	}
}

int main() {
	int x, y, z;
	while (cin >> x >> y >> z) {
		cout << solve("a", "b", "c", x, y, z) << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

int cnt[100000];

int main () {
  int n;
  cin >> n;
  vi a(n);
  rep(i,n) cin >> a[i];
  
  rep(i,n) {
    cnt[a[i]-1]++;
    cnt[a[i]]++;
    cnt[a[i]+1]++;
  }

  int ans = 0;
  rep(i,100000) {
    ans = max(ans, cnt[i]);
  }

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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
#define zrep(i, a, b, c) for (int i = int(a); i < int(b); i+=int(c))
using ll = long long;
const int INF = 1001001001;

void BubbleSort(vector<int> &A) {
    int N = A.size();
    int cnt = 0;
    int flag = 1;
    while(flag) {
        flag = 0;
        for(int i=N-1; i>0; i--) {
            if(A[i]<A[i-1]) {
                swap(A[i], A[i-1]);
                cnt++;
                flag = 1;
            }
        }
    }
    print(A);
    print(cnt);
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    BubbleSort(A);



    return 0;
}


Measured memory_bytes: 3092
A,B,K = [int(x) for x in input().strip('\n').split(' ')]
for i in range(K):
    if i%2==0:
        if A%2==1:
            A = A-1
        B += A/2
        A = A/2
    if i%2==1:
        if B%2==1:
            B = B-1
        A += B/2
        B = B/2
print(int(A),int(B))

Measured memory_bytes: 3064
import java.io.*;

class Main {
	public static void main(String[] arg)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		String[] div = str.split(" ");
		int W =  Integer.parseInt(div[0]);
		int H =  Integer.parseInt(div[1]);
		int x =  Integer.parseInt(div[2]);
		int y =  Integer.parseInt(div[3]);
		int r =  Integer.parseInt(div[4]);

		if( x-r<0 || y-r<0 || x+r>W || y+r>H ){
			System.out.println("No");
		}
		else{
			System.out.println("Yes");		
		}
	}	
}

Measured memory_bytes: 16952
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-20;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	int b;scanf("%d",&b);
	for(int i=0;i<b;i++){
		int t;scanf("%d",&t);t--;
		if(p[t]==2019)continue;
		bool ok=true;
		for(int j=0;j<a;j++){
			if(p[t]+1==p[j])ok=false;
		}
		if(ok)p[t]++;
	}
	for(int i=0;i<a;i++)printf("%d\n",p[i]);
}


Measured memory_bytes: 2764
#include <bits/stdc++.h>
#define rep(i,n) for (int i =0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main(){
  ll a;
  double b;
  cin >> a >> b;
  ll b2 = b*100+0.1;
  ll ans = a*b2;
  if(ans<100){cout << "0" << endl;return 0;}
  string ans2=to_string(ans);
  string ans3= ans2.substr(0,ans2.size()-2);
  cout << ans3 <<  endl;
}


Measured memory_bytes: 3816
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
    int A;
    int B;
    int M;
    int Ay=100001;
    int By=100001;
    int result=200001;
    Scanner sc = new Scanner(System.in);
    A=sc.nextInt();
    B=sc.nextInt();
    M=sc.nextInt();
    int As[]= new int[A];
    int Bs[]= new int[B];
    int Xs[]= new int[M];
    int Ys[]= new int[M];
    int Cs[]= new int[M];
   for(int i=0;i<A;i++){
     As[i]=sc.nextInt();
   }
   for(int i=0;i<B;i++){
     Bs[i]=sc.nextInt();
   }
   for(int i=0;i<M;i++){
     Xs[i]=sc.nextInt();
     Ys[i]=sc.nextInt();
     Cs[i]=sc.nextInt();

   }
   for(int i=0;i<M;i++){

    if(result>As[Xs[i]-1]+Bs[Ys[i]-1]-Cs[i]){result=As[Xs[i]-1]+Bs[Ys[i]-1]-Cs[i];}
   }
   for(int i=0;i<A;i++){
     if(Ay>As[i]){Ay=As[i];}
   }
   for(int i=0;i<B;i++){
     if(By>Bs[i]){By=Bs[i];}
   }
   if(result>Ay+By){result=Ay+By;}
   System.out.println(result);

  }

}


Measured memory_bytes: 156208
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a
#define pr2(a,b)    cout<<a<<" "<<b
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll minize(ll& a,ll b){return a=(a>b?b:a);}
inline ll maxize(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;



ll Solves(){
	
	ll n,k,cnt=0,ans=0,x,y,q,sum=0,v,t,m,odd=-1,four=0,two=0;
	// PROCESSING IN HERE
	sc2(n,m); sc(k);
	
	fu(i,0,n){
		fu(j,0,m){
			if(n*m+2*i*j-i*m-j*n==k){
				re cout<<"Yes",0;
			}
		}
	}
	
	cout<<"No";
	re 0;
	// Hack it if you can :)
}

int main(){
//	INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	ll test;
//	sc(test);
//	fu(T,1,test)
	Solves();
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

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

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == ',')
            cout << " ";
        else
            cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int i =0, j = 0, n = 0, x = 0, minimum = 0;
    cin >> n;
    int a[n];
    for(i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    minimum = a[0];
    for(i = 0; i < n; i++)
    {
        if(a[i] <= minimum)
        {
            minimum = a[i];
            continue;
        }
        if(a[i] >= minimum)
        {
            x++;
        }
    }
    cout << n - x;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // AtCoder
    // template
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> ab(n);
    rep(i, n) cin >> ab.at(i).first >> ab.at(i).second;

    sort(all(ab));
    ll cnt = m;
    ll ans = 0;

    rep(i, n) {
        ans += ab[i].first * min(cnt, ab[i].second);
        cnt -= min(cnt, ab[i].second);
        if(cnt == 0)
            break;
    }
    cout << ans;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int x;
  cin >> x;
  int res = 0;
  res += 1000*((int)x/500);
  x -= 500 * ((int)x/500);
  res += 5 * ((int)x/5);
  cout << res << endl;
  return 0;
}

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

int a[6], d[5];

int main(){
    scanf("%d%d%d%d%d%d", a, a + 1, a + 2, a + 3, a + 4, a + 5);
    for(int i = 0; i < 6; i++) d[a[i]]++;
    sort(d + 1, d + 5);
    int t = 1000 * d[1] + 100 * d[2] + 10 * d[3] + d[4];
    puts(t == 1122 ? "YES" : "NO");
}

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

int main(){
    int n, k;
    cin >> n >> k;

    string s;
    cin >> s;
    s.resize(2*s.size());
    for(int i = 0; i<n; i++){
        s[2*n - 1 - i] = s[i];
    }

    string mi, m;
    mi.resize(1e6);
    m.resize(1e6);
    for(int i = 0; i<1e6; i++){
        mi[i] = 'z';
        m[i] = 'z';
    }

    if(k == 1){
        for(int i = 0; i<=n; i++){
            mi = min(mi, s.substr(i, n));
        }

        cout << mi << endl;
    }

    else{
        reverse(s.begin(), s.end());
        for(int i = 0; i<=n; i++){
            mi = min(mi, s.substr(i, n));
        }

        reverse(mi.begin(), mi.end());
        //cout << mi << endl;

        for(int i = k - 1; i>=max(2, k - 30); i--){
            mi.resize(2*n);
            for(int i = 0; i<n; i++){
                mi[2*n - 1 - i] = mi[i];
            }
            int pos;
            for(int j = n; j<2*n; j++){
                if(mi[j] != mi[n]) break;
                pos = j;
            }
            pos++;

            mi = mi.substr(pos - n, n);
            //cout << mi << endl;
        }

        mi.resize(2*n);
        for(int i = 0; i<n; i++){
            mi[2*n - 1 - i] = mi[i];
        }

        for(int i = 0; i<=n; i++){
            m = min(m, mi.substr(i, n));
        }

        cout << m << endl;
    }
}


Measured memory_bytes: 2176
import java.util.Scanner;

class Main{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		
		int ans = dfs(N, 0);
		
		System.out.println(ans);
	}
	
	static int dfs(long N, long num) {
		int count = 0;
		
		if (num > N) {
			return count;
		}
		String s = Long.toString(num);
		if (s.contains("3") && s.contains("5") && s.contains("7")) {
			count++;
		}
		
		count += dfs(N, num*10+3);
		count += dfs(N, num*10+5);
		count += dfs(N, num*10+7);
		
		return count;
	}
	
}

Measured memory_bytes: 24276
#include <iostream>
#include <queue>

using namespace std;

int mp[500][500];
struct ima{
  int x,y;
};
int n,tu;
queue <ima> Q;
int dis[500][500];

void reset() {

  for(int i=0;i<300;i++)
    for(int j=0;j<300;j++) {
      mp[i][j] = 0;
      dis[i][j] = 100000;
    }
}


int visit() {
  ima t;
  int dx[6] = {1,1,0,-1,-1,0};
  int dy[6] = {1,0,-1,-1,0,1};
  int count =0;

  while(!Q.empty()){

    t = Q.front();
    Q.pop();
    count++;
    if(dis[t.y][t.x]+1 >tu) continue;
    for(int i=0;i<6;i++) {
      if(t.y+dy[i] >=0 && t.x+dx[i] >=0) 
      if(mp[t.y+dy[i]][t.x+dx[i]] == 0 && dis[t.y+dy[i]][t.x+dx[i]] > dis[t.y][t.x]+1){
	Q.push((ima){t.x+dx[i],t.y+dy[i]});
	dis[t.y+dy[i]][t.x+dx[i]] = dis[t.y][t.x]+1;
      }
    }
  }
    return count;
}


int main() {

  while(1) {
  cin >> tu >> n;
  if(tu == 0 && n == 0) break;
  
  int a,b;
  reset();
  for(int i=0;i<n;i++) {
    cin >> a >>b;

    mp[100+b][100+a] =1;

  }
  
  int tx,ty;
  cin >> tx >>ty;

  Q.push((ima){100+tx,100+ty});
  dis[100+ty][100+tx] = 0;
  
  int ans = visit();

  cout << ans <<endl;

  }
  return 0;
}

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

int main(int argc, char const *argv[])
{
    long n;
    cin >> n;
    string t;

    unordered_set<string> s;
    for (int i = 0; i < n; i++)
    {
        cin >> t;
        s.insert(t);
    }

    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 17648
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int r[55];

int main(){
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        int x, y;
        cin >> x >> y;
        r[x-1]++;
        r[y-1]++;
    }

    for(int i = 0; i < n; i++){
        cout << r[i] << endl;
    }
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	int n,a,b,c,d;cin>>n>>a>>b>>c>>d;
	a--;b--;c--;d--;
	string s;cin>>s;
	for(int i=a;i<max(c,d);++i){
		if(s[i]=='#'&&s[i+1]=='#'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	if(c<d){
		cout<<"Yes"<<endl;
	}
	else{
		for(int i=b-1;i<d-1;++i){
			if(s[i]=='.'&&s[i+1]=='.'&&s[i+2]=='.'){
				cout<<"Yes"<<endl;
				return 0;
			}
		}
        if(s[d-1]=='.'){
            cout<<"Yes"<<endl;return 0;
        }
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(b>=a*c) cout << c << endl;
  else cout << b/a << endl;
}


Measured memory_bytes: 256
function A(){
var max=0;
var ary=[];
for(var i=1;i<=8;i++){
for(var j=1;j<=8;j++){
if(yx[i][j]!=".")continue;
var cnt=seach(i,j,"x","o");
if(cnt>max){ary=[i,j];max=cnt;}
}
}
return ary;
}

function B(){
var max=0;
var ary=[];
for(var i=8;i>=1;i--){
for(var j=8;j>=1;j--){
var cnt=seach(i,j,"o","x");
if(yx[i][j]!=".")continue;
if(cnt>max){ary=[i,j];max=cnt;}
}
}
return ary;
}
//------------------------------------------------------
function seach(y,x,a,b){
var dy=[-1,-1,-1,0,0,1,1,1];
var dx=[-1,0,1,-1,1,-1,0,1];
var sum=0;
for(var i=0;i<8;i++){
var DY=dy[i];
var DX=dx[i];
var cnt=0;
var k=1;

while(true){
   if(yx[y+DY*k][x+DX*k]=="f" || yx[y+DY*k][x+DX*k]==".")break;
   else if(yx[y+DY*k][x+DX*k]==a)cnt++;
   else if(yx[y+DY*k][x+DX*k]==b){sum+=cnt;break;}
   k++;
}
}
return sum;
}
//----------------------------------------------------------
function change(y,x,a,b){
yx[y][x]=b;
var dy=[-1,-1,-1,0,0,1,1,1];
var dx=[-1,0,1,-1,1,-1,0,1];
var cnt=0;
for(var i=0;i<8;i++){
var DY=dy[i];
var DX=dx[i];
var cnt=0;
var k=1;
var flag=false;
while(true){
   if(yx[y+DY*k][x+DX*k]=="f" || yx[y+DY*k][x+DX*k]==".")break;
   else if(yx[y+DY*k][x+DX*k]==a)flag=true;
   else if(yx[y+DY*k][x+DX*k]==b){
      if(flag){
         while(k--)yx[y+DY*k][x+DX*k]=b;
      }
      break;
   }
   k++;
}
}


}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');


var arr=input.trim().split("\n");
var yx=[];
yx.push("ffffffffff".split(""));
arr.forEach(function(v){
v="f"+v+"f";
yx.push(v.split(""));
});
yx.push("ffffffffff".split(""));
var pass=0;


while(true){

var ansA=A();
if(ansA.length==0)pass++;
else {pass=0;change(ansA[0],ansA[1],"x","o");}
if(pass==2)break;



var ansB=B();
if(ansB.length==0)pass++;
else {pass=0;change(ansB[0],ansB[1],"o","x");}

if(pass==2)break;



}
yx.shift();
yx.pop();
console.log(yx.join("\n").replace(/\,|f/g,""));

Measured memory_bytes: 16732
#include <iostream>
#include <cstdio>
#include <string.h>
using namespace std;
int main(void) {
  char ser[100];
  int serlen;
  int a=0, b=0;

  while(scanf("%s", ser) != 0) {
    serlen = strlen(ser);
    for(int i = 1 ; i < serlen ; i++) {
      if(ser[i] == 'A') a++;
      else if(ser[i] == 'B') b++;
      //cout << a << ' ' << b << endl;
    }
    if(a > b) a++;
    else if(b > a) b++;
    if(a == 0 && b == 0) break;
    cout << a << ' ' << b << endl;
    a = 0; b = 0;
  }
  return 0;
}

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

void print(int *a, int n) {
    int _n = n - 1;
    for (int i = 0; i < n; ++i) {
        if (i == _n)
            cout << a[i] << endl;
        else
            cout << a[i] << " ";
    }
}

void insertionSort(int *a, int n) {
    for (int i = 0; i < n; ++i) {
        int v = a[i];
        int j = i - 1;
        while (0 <= j && v < a[j]) {
            a[j + 1] = a[j];
            --j;
            a[j + 1] = v;
        }
        print(a, n);
    }
}

int main() {

    int n;
    cin >> n;

    int *a = new int[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    insertionSort(a, n);

    return 0;
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

int t[]={5,7,5,7,7};

signed main(){
    int N;
    while(cin>>N,N){
        vector<string>S(N);
        rep(i,N)cin>>S[i];
        rep(i,N){
            bool ok=true;
            int cur=i;
            rep(j,5){
                int sum=0;
                while(cur<N&&sum<t[j]){
                    sum+=S[cur++].size();
                }
                if(sum!=t[j])ok=false;
            }
            if(ok){
                cout<<i+1<<endl;
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 998244353;

int main() {
    int N;
    cin >> N;
    vector<ll> a(N);
    ll ans = 1LL, sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum += a[i];
        ans *= 3LL;
        ans %= M;
    }

    vector<vector<ll>> dp(500, vector<ll>(100000, 0));
    vector<vector<ll>> dp2(500, vector<ll>(100000, 0));
    dp[0][0] = dp2[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= sum; j++) {
            dp[i + 1][j + a[i]] += dp[i][j];
            dp[i + 1][j + a[i]] %= M;
            dp[i + 1][j] += 2 * dp[i][j];
            dp[i + 1][j] %= M;

            dp2[i + 1][j + a[i]] += dp2[i][j];
            dp2[i + 1][j + a[i]] %= M;
            dp2[i + 1][j] += dp2[i][j];
            dp2[i + 1][j] %= M;
        }
    }

    ll x = 0;
    for (int i = (sum + 2 - 1) / 2; i <= sum; i++) {
        x += dp[N][i];
        x %= M;
    }

    ans -= 3 * x;
    if (sum % 2 == 0) ans += 3 * dp2[N][sum / 2];

    cout << (ans % M + M) % M << endl;
}

Measured memory_bytes: 783728
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			// int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			foreach (var c in s) {
				char x = (char)(c + n);
				if (x > 'Z') {
					x -= (char)26;
				}
				Console.Write(x);
			}
			Console.WriteLine();


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 11092
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, t = list(map(int, readline().split()))
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab.sort()
    dp = [0] * t
    mt = 0
    for a, b in ab:
        mt = max(mt, dp[-1] + b)
        for i in range(t - a - 1, -1, -1):
            dp[i+a] = max(dp[i+a], dp[i] + b)
    print(mt)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 40560
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll a[225816];

int main(void){
	int n,i;
	ll s=0ll;
	std::cin >> n;
	for(i=0; i<n; ++i){
		std::cin >> a[i];
		s ^= a[i];
	}
	for(i=0; i<n; ++i){
		std::cout << (i?" ":"") << (s^a[i]);
	}
	std::cout << std::endl;
	return 0;
}


Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int a,b,c;
  cin >> a >> b;
  if(a<=b)cout << a << "\n";
  else cout << a-1 << "\n";
  return 0;
}


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

int main() {
  int N;
  int* Aij = new int[9];
  for(int j = 0; j < 3; j++) {
    cin >> Aij[0 + (j * 3)] >> Aij[1 + (j * 3)] >> Aij[2 + (j * 3)];
  }
  cin >> N;
  for(int j = 0; j < N; j++) {
    int num = 0;
    cin >> num;
    for(int i = 0; i < 9; i++) {
      if(Aij[i] == num) Aij[i] = 0;
    }
  }
  bool res = false;
  if(!res && !Aij[0] && !Aij[1] && !Aij[2]) res = true;
  if(!res && !Aij[3] && !Aij[4] && !Aij[5]) res = true;
  if(!res && !Aij[6] && !Aij[7] && !Aij[8]) res = true;
  if(!res && !Aij[0] && !Aij[3] && !Aij[6]) res = true;
  if(!res && !Aij[1] && !Aij[4] && !Aij[7]) res = true;
  if(!res && !Aij[2] && !Aij[5] && !Aij[8]) res = true;
  if(!res && !Aij[0] && !Aij[4] && !Aij[8]) res = true;
  if(!res && !Aij[2] && !Aij[4] && !Aij[6]) res = true;
  delete Aij;
  if(res) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 632
#include <iostream>
using namespace std;
#define MAX 500001

int H, A[MAX+1];

void maxHeapify(int i) {
    int l, r, largest;
    l = 2 * i;
    r = 2 * i + 1;

    if( l <= H && A[l] > A[i] ) largest = l;
    else largest = i;
    if ( r <= H && A[r] > A[largest] ) largest = r;

    if ( largest != i ){
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}

int main() {
    cin >> H;

    for ( int i = 1; i<= H; i++ ) cin >> A[i];
    for ( int i = H/2; i >= 1; i-- ) maxHeapify(i);

    for ( int i = 1; i <= H; i++ ) {
        cout << " " << A[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 5008
#include <stdio.h>

int d[9],c[9];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)scanf("%d%d",d+i,c+i);
	int l,r;
	if(n==1)l=0,r=10;
	if(n==2)l=10,r=100;
	if(n==3)l=100,r=1000;
	
	for(int x=l;x<r;x++){
		char s[9];
		sprintf(s,"%d",x);
		int flag=1;
		for(int i=0;i<m;i++)flag&=s[d[i]-1]-'0'==c[i];
		if(flag){
			printf("%d",x);
			return 0;
		}
	}
	puts("-1");
}

Measured memory_bytes: 128
N = int(input())

# 初期化
G = [None] * (10 ** 6 + 1)  # グラフ
for i in range(10 ** 6 + 1):
    G[i] = set()
U = [None] * (10 ** 6 + 1)  # 入次数
D = [0] * (10 ** 6 + 1)  # 根からの距離


# 変換用
def x(i, j):
    return j + 1000 * i


# グラフを構築
for i in range(1, N + 1):
    A = list(map(int, input().split()))
    for j in range(N - 2):
        fv1, fv2 = min(i, A[j]), max(i, A[j])
        tv1, tv2 = min(i, A[j + 1]), max(i, A[j + 1])
        G[x(fv1, fv2)].add(x(tv1, tv2))
        U[x(fv1, fv2)] = 0
        U[x(tv1, tv2)] = 0


# 入次数をカウント
for i in range(10 ** 6 + 1):
    for v in G[i]:
        U[v] += 1

        
# トポロジカルソート
U_zero_nodes = []
for i in range(10 ** 6 + 1):
    if U[i] is None:
        continue

    if U[i] == 0:
        U_zero_nodes.append(i)


topological_order = []
while U_zero_nodes:
    n = U_zero_nodes.pop()
    topological_order.append(n)

    for v in G[n]:
        U[v] -= 1
        if U[v] == 0:
            U_zero_nodes.append(v)


# 不可能判定
if len(topological_order) != N * (N - 1) // 2:
    print(-1)
    exit()


# 最長経路を計算
for t_n in topological_order:
    for v in G[t_n]:
        D[v] = max(D[v], D[t_n] + 1)
print(max(D) + 1)


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

int main(){
    int A,B,C;
    cin >> A >> B >> C;

    int res = 0;

    while(true){
        if(A == B && A==C){
            break;
        }

        else if(A > B && A > C){
            B++;
            C++;
            res++;
        }
        else if(A == B && B > C){
                C +=2;
                res++;
        }
        else if(A == C && C > B){
                B += 2;
                res++;
        }
        
        else if(B > C && B > A){
                A++;
                C++;
                res++;
        }
            
        else if(B == A && A > C){
                C +=2;
                res++;
        }
        else if(B == C && C > A){
                A += 2;
                res++;
        }
        
        else if(C > A && C > B){
            A++;
            B++;
            res++;
        }
        else if(A == C && A > B){
                B += 2;
                res++;
        }
        else if(B == C && B > A){
                A += 2;
                res++;

        }
        
    }

    cout << res << endl;    
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, M) = readInputLine().split(" ").map { it.toInt() }
    
    val pic = Array(N) { readInputLine().toCharArray() }
    val tmp = Array(M) { readInputLine().toCharArray() }
    
    for (i in 0..N - M) {
        for (j in 0..N - M) {
            var ok = true
            for (k in 0 until M) {
                if (!ok) {
                    break
                }
                for (l in 0 until M) {
                    if (pic[i + k][j + l] != tmp[k][l]) {
                        ok = false
                        break
                    }
                }
            }
            if (ok) {
                println("Yes")
                return
            }
        }
    }
    
    println("No")
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37728
N = int(input())
res = 0
#a = [0]*(N+1)
#for i in range(1,N+1):
#    for j in range(i,N+1,i):
#        a[j] += 1
#for i in range(1,N+1):
#    res += i * a[i]
for i in range(1,N+1):
    p = N // i
    res += i * p*(p+1)//2

print(res)


Measured memory_bytes: 9000
#include <stdio.h>

char s[5001], t[6], c[5];
int k, n, l[6], i, j, iM;
int main() {
  scanf("%s", s);
  scanf("%d", &k);
  n = 5000;
  while (n - i > 1) {
    j = (n + i) >> 1;
    if (s[j]) {
      i = j;
    } else {
      n = j;
    }
  }
  for (c[0] = 'a'; c[0] <= 'z'; ++c[0]) {
    t[0] = c[0];
    l[1 + 0] = -1;
    for (i = l[0], iM = n - 0; i < iM; ++i) {
      if (s[i + 0] != t[0]) continue;
      l[1 + 0] = i;
      break;
    }
    if (l[1] < 0) continue;
    if (k == 1) {
      printf("%s\n", t);
      return 0;
    }
    --k;
    for (c[1] = 'a'; c[1] <= 'z'; ++c[1]) {
      t[1] = c[1];
      l[1 + 1] = -1;
      for (i = l[1], iM = n - 1; i < iM; ++i) {
        if (s[i + 0] != t[0] || s[i + 1] != t[1]) continue;
        l[1 + 1] = i;
        break;
      }
      if (l[2] < 0) continue;
      if (k == 1) {
        printf("%s\n", t);
        return 0;
      }
      --k;
      for (c[2] = 'a'; c[2] <= 'z'; ++c[2]) {
        t[2] = c[2];
        l[1 + 2] = -1;
        for (i = l[2], iM = n - 2; i < iM; ++i) {
          if (s[i + 0] != t[0] || s[i + 1] != t[1] || s[i + 2] != t[2]) continue;
          l[1 + 2] = i;
          break;
        }
        if (l[3] < 0) continue;
        if (k == 1) {
          printf("%s\n", t);
          return 0;
        }
        --k;
        for (c[3] = 'a'; c[3] <= 'z'; ++c[3]) {
          t[3] = c[3];
          l[1 + 3] = -1;
          for (i = l[3], iM = n - 3; i < iM; ++i) {
            if (s[i + 0] != t[0] || s[i + 1] != t[1] || s[i + 2] != t[2] || s[i + 3] != t[3]) continue;
            l[1 + 3] = i;
            break;
          }
          if (l[4] < 0) continue;
          if (k == 1) {
            printf("%s\n", t);
            return 0;
          }
          --k;
          for (c[4] = 'a'; c[4] <= 'z'; ++c[4]) {
            t[4] = c[4];
            l[1 + 4] = -1;
            for (i = l[4], iM = n - 4; i < iM; ++i) {
              if (s[i + 0] != t[0] || s[i + 1] != t[1] || s[i + 2] != t[2] || s[i + 3] != t[3] || s[i + 4] != t[4]) continue;
              l[1 + 4] = i;
              break;
            }
            if (l[5] < 0) continue;
            if (k == 1) {
              printf("%s\n", t);
              return 0;
            }
            --k;
          }
          t[4] = 0;
        }
        t[3] = 0;
      }
      t[2] = 0;
    }
    t[1] = 0;
  }
}


Measured memory_bytes: 1668
def f(e):
 a=[list(map(int,input().split()))for _ in[0]*int(e)]
 b=[list(map(int,input().split()))for _ in[0]*int(input())]
 for s,t in b:
  u,v=a[0]
  x,y=s-u,t-v
  for u,v in a:
   if[u+x,v+y]not in b:break
  else:return print(x,y)
for e in iter(input,'0'):f(e)


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
	~debug() { cerr << endl; }
	eni( != ) cerr << boolalpha << i; ris;
}
eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

void solve();

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    // cin >> t;
    for(int i=1; i<=t; ++i) {
        solve();
    }
    return 0;
}

const int mod = 1e9+7;

void solve() {
    int n;
    cin >> n;
    if(n < 2) {
        cout << 0;
        return;
    }
    int v1 = 1, v2 = 1, v3 = 1;
    for(int i=0; i<n; ++i) {
        v1 = (v1 * 10)%mod;
        v2 = (v2 * 9)%mod;
        v3 = (v3 * 8)%mod;
    }
    v2 = (v2 * 2)%mod;
    cout << (v1 + (-v2 + v3 + mod) % mod  + mod)%mod;
}


Measured memory_bytes: 3632
int main(void){int N, x, y, b, p, i, wa1, wa2;scanf("%d", &N); for (i = 1; i <= N; i++) {scanf("%d %d %d %d", &x, &y, &b, &p);wa1 = x*b + y*p; if (b >= 5 && p >= 2) {wa1 = 4 * wa1 / 5; } else { if (b < 5) { b = 5;  } if (p < 2) { p = 2; } wa2 = 4*(x*b + y*p)/5; if (wa1 > wa2) {wa1 = wa2; } } printf("%d\n", wa1); }return 0;}

Measured memory_bytes: 600
N = int(input())
ab_arr = []
for _ in range(N):
    ab_arr.append(tuple([int(x) for x in input().split()]))

ab_arr.sort(key=lambda x:x[1])

finish = True
time = 0
for a,b in ab_arr:
    time += a
    if time > b:
        finish = False

if finish:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 31804
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

int N;
void fill(vector<char>& fix, vector<int>& mx, vector<int>& Ts) {
    REP(n,N) {
        mx[n] = Ts[n];
        if (n == 0) {
            fix[n] = 1;
        } else {
            if (Ts[n] > Ts[n-1]) {
                fix[n] = 1;
            }
        }
    }
}

ll MOD = 1000000007;

int main(void)
{
    cin.sync_with_stdio(false);
    cin >> N;
    vector<int> Ts(N);
    vector<int> As(N);
    REP(n,N) cin >> Ts[n];
    REP(n,N) cin >> As[n];
    
    vector<char> fix_left(N);
    vector<int> mx_left(N);
    fill(fix_left, mx_left, Ts);

    reverse(ALL(As));
    vector<char> fix_right(N);
    vector<int> mx_right(N);
    fill(fix_right, mx_right, As);

    ll ans = 1;
    REP(n,N) {
        auto f1 = fix_left[n];
        auto m1 = mx_left[n];
        auto f2 = fix_right[N-1-n];
        auto m2 = mx_right[N-1-n];
        // printf("f1,m1,f2,m2 = %d,%d,%d,%d\n", f1, m1, f2, m2);

        if (f1 * f2 > 0) {
            if (m1 != m2) {
                ans = 0;
                break;
            }
        }
        else if ((f1 > 0) && (f2 == 0)) {
            if (m1 > m2) {
                ans = 0;
                break;
            }
        }
        else if (f1 == 0 && f2 > 0) {
            if (m2 > m1) {
                ans = 0;
                break;
            }
        }
        else {
            ans *= min(m1,m2);
            ans %= MOD;
        }
        // cout << "ans:" << ans << endl;
    }

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


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if((A + B) > (C + D)) {
    cout << "Left" << endl;
  }
  else if((A + B) < (C + D)) {
    cout << "Right" << endl;
  }
  else cout << "Balanced" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define deb(x)   cout<<"> "<<#x<<" : "<<x<<endl;
#define deb2(x,y)cout<<"> "<<#x<<"->"<<x<<"  "<<#y<<"->"<<y<<endl;
#define LINE   cout << "--- LINE NO : " << __LINE__ <<"  ---"<< endl;
#define pnr(a)   for(auto x:a){cout<<x<<" ";}cout<<endl;
#define pnr2(a)  for(auto x:a){cout<<x.first<<" "<<x.second<<endl;}
#define   pi       2*acos(0.0)
#define   inf      (int)1e18
const int mod =    1e9 + 7,
          mxn =    2e5 + 5;

#define   vt       vector
#define   ff       first
#define   ss       second
#define   int      long long
#define   db       long double
#define   umap     unordered_map
#define   pii      pair<int,int>
#define   Maxpq(x) priority_queue<x>
#define   Minpq(x) priority_queue<x,vt<x>,greater<x>>

#define   endl     "\n"
#define   pb       push_back
#define   si(x)    (int)x.size()
#define   all(x)   x.begin(),x.end()
#define   rall(x)  x.rbegin() ,x.rend()
#define   mem(a,x) memset(a,x,sizeof(a))
#define   forr(i,n) for(int i=0;i<n;i++)
#define   FOR(a)   for(auto& x :  a )

int mainx() {
  int n;
  cin >> n;
  map<string , int > mp;
  forr(i , n)
  {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << "AC x " << mp["AC"] << endl;
  cout << "WA x " << mp["WA"] << endl;
  cout << "TLE x " << mp["TLE"] << endl;
  cout << "RE x " << mp["RE"] << endl;
  return 0;
}


bool cmp(pii &a , pii &b) {
  if (a.ff < b.ff)return true;
  if (a.ff == b.ff )return a.ss < b.ss;
  return false;
}
inline void INCLUDE() {
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
//freopen("out.txt","w",stdout);
#endif
}
int32_t main() {

 // INCLUDE();

  ios::sync_with_stdio(0);
  cin.tie(NULL); cout.tie(NULL);
  //cout << fixed << setprecision(20);

  int tt = 1;
  //cin>>tt;
  for (int t = 1 ; t <= tt ; t++ )
  {
    // cout<<"Case #"<<t<<": ";
    mainx();
  }
  return 0 ;
}



Measured memory_bytes: 3684
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#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=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int d, n;
    cin >> d >> n;
    if(n == 100) cout << (n + 1) * (int)pow(100, d) << endl;
    else cout << n * (int)pow(100, d) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
#define pb push_back
#define M 1000000007
typedef long long int ll;


void solve(){

	ll x;
	cin >> x;
	if(x >= 30)
		cout << "Yes\n";
	else
		cout << "No\n";

}	

int main(){

	int t;
	// cin >> t;
	t = 1;
	for(int q = 0; q < t; q++){
		solve();
	}

	return 0;
}

Measured memory_bytes: 3632
def solve():
    v=list(map(int,input().split()))
    a=v[0]
    b=v[1]
    c=v[2]
    if c <= a + b:
        return False
    return 4 * a * b < (c - a - b)**2

if solve():
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
	nums = input().split(" ")
	fst , snd ,trd = int(nums[0]),int(nums[1]),int(nums[2])
	if fst < snd < trd :
		return "Yes"
	else:
		return "No"
	
if __name__ == '__main__':
  print(main())

Measured memory_bytes: 7708
#include<stdio.h>
#include<string.h>
#define max 10000
int main()
{int a,b;
scanf("%d%d",&a,&b);
if(a==1&&b==2||a==2&&b==1)
	printf("3");
if(a==3&&b==2||a==2&&b==3)
	printf("1");
if(a==1&&b==3||a==3&&b==1)
	printf("2");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
const int R = 0;
const int G = 1;
const int B = 2;

ll N;

ll calc(ll n)
{
  return (n * (n - 1) / 2) * (N - n) + n * (n - 1) * (n - 2) / 6;
}

int main()
{
  cin >> N;
  string S;
  ll cnt_R = 0, cnt_G = 0, cnt_B = 0;
  rep(i, N)
  {
    char c;
    cin >> c;
    S.push_back(c);
    if (c == 'R')
    {
      cnt_R++;
    }
    else if (c == 'G')
    {
      cnt_G++;
    }
    else
    {
      cnt_B++;
    }
  }
  ll sz_S = 0, sz_T = 0, sz_ST = 0;
  sz_S = calc(cnt_R) + calc(cnt_G) + calc(cnt_B);
  for (int i = 0; i < N; i++)
  {
    for (int k = i + 1; k < N; k++)
    {
      if ((i + k) % 2)
      {
        continue;
      }
      int j = (i + k) / 2;
      sz_T++;
      if (S.at(i) == S.at(j) || S.at(i) == S.at(k) || S.at(j) == S.at(k))
      {
        sz_ST++;
      }
    }
  }
  cout << N * (N - 1) * (N - 2) / 6 - sz_S - sz_T + sz_ST << endl;
}

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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

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

    int n, m;
    cin >> n >> m;

    vi a(n);
    int total = 0;
    rep(i, 0, n) {
        cin >> a[i];
        total += a[i];
    }

    int sum = 0;
    rep(i, 0, n) {
        if (4 * a[i] * m >= total) { sum++; }
    }

    cout << (sum >= m ? "Yes" : "No") << endl;

    return 0;
}

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

int main() {
  int N, ans = 1000000000;
  cin >> N;
  for (int i = 0; i < N; i++) {
  	int A, count = 0;
    cin >> A;
    while (A % 2 == 0) {
      A /= 2;
      count++;
    }
    if (ans > count) {
      ans = count;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256