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

int main(){
  int a[4];
  cin >> a[0] >> a[1] >> a[2] >> a[3];

  sort(a, a+4);

  int b[4] = {1, 4, 7, 9};

  for(int i = 0;i < 4;i++){
    if(a[i] != b[i]){
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;

  return 0;
}


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

#define  all(v)            v.begin(), v.end()
#define  sz(x)             (int)x.size()
#define  debug(x)          cout << #x << ':' << x << endl;
#define  rep(i,n)          for(long long i = 0; i <  n ; i++)
#define  reps(i,n)         for(long long i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
#define  ajs(a)            (a<0)?(-1*a):a

using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
const ll MOD = 1e9+7;
bool cmp(int X, int Y) {return X > Y;}

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}

ll ncr(ll n , ll r){
	if(r > n - r) {r = n - r;}
	if(r==1){return n;}
	if(r==0){return 1;}
	
	if(r == n){return 1;}
	
	return ((n*ncr(n-1,r-1))/r)%MOD;
	}


int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll x;cin>>x;
if(x==0){
	cout<<1;
	
	}else{
		cout<<0;
		}
}		
		
				


Measured memory_bytes: 3644
from itertools import accumulate
def BC132_F():
    n, k = list(map(int, input().split(' ')))
    mod = 10**9 + 7
    sqt = int(n**0.5)
    cnt = [n // i - n // (i + 1) for i in range(1, n // sqt)] + [1] * sqt
    x = cnt
    for _ in range(k):
        x = [(i * j) % mod for i, j in zip(accumulate(reversed(x)), cnt)]
    return x[-1]


print(BC132_F())

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

const int N = 4e5 + 5;
typedef long long ll;

struct Edge {
	int to, next;
} e[N];
int n, m, cnt, first[N], s[N], h, r, q[N<<2];

void add(int u, int v) {
	e[++cnt] = (Edge) {v, first[u]};
	first[u] = cnt;
}

int main() {
	cout<<"Yes"<<endl;
	cin>>n>>m;
	for(int i = 1; i <= m; i++) {
		int u, v;
		cin>>u>>v;
		add(u, v);
		add(v, u);
	}
	q[h = r = 1] = 1;
	while(h <= r) {
		int u = q[h];
		for(int i = first[u]; i; i = e[i].next) {
			int v = e[i].to;
			if(!s[v]) {
				s[v] = u;
				q[++r] = v;
			}
		}
		h++;
	}
	for(int i = 2; i <= n; i++)
		cout<<s[i]<<endl;
	return 0;
}

Measured memory_bytes: 7880
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>

 
int main(){
   int a,b,c;
   scanf("%d %d %d", &a,&b,&c);
   if(a==b){
		if(b!=c){
         	printf("Yes"); 
        }else{
			printf("No");
        }
   } else{
    	if(b==c){
         	printf("Yes"); 
        } else if(a==c){
         	printf("Yes"); 
        } else{
         	printf("No"); 
        }
   }

   return 0;
 
}

Measured memory_bytes: 128
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int scnt = 0;
        int tcnt = 0;
        String s = sc.next();
        for (int i = 0, len = s.length(); i < len; ++i) {
            if (s.charAt(i) == 'S') {
                ++scnt;
            } else if (scnt > 0 && s.charAt(i) == 'T') {
                --scnt;
            } else {
                ++tcnt;
            }
        }

        out.println((scnt + tcnt));
        out.flush();
    }
}

Measured memory_bytes: 14724
#include<iostream>
#include<string>
#include<map>
using namespace std;
int vals;
pair<string, string> equation(string str){
  int i=0;
  for(i=0;i<(int)str.length();i++){
    if(str[i]=='=')break;
  }
  return make_pair(str.substr(0, i),str.substr(i+1));
}
bool formula(string str){
  if(str[0]=='-'){
    return !formula(str.substr(1));
  }if(isalpha(str[0])){
    return
      (str[0] == 'T')?true
      :(str[0] == 'F')?false
      :((vals >> (str[0]-'a')) & 1);
  }else if(str[0]=='('){
    int tcur=1, opc=-1, op=-1, depth=0;

    while(tcur<(int)str.length()){
      if(str[tcur]=='('){
        depth++;
      }else if(str[tcur]==')'){
        depth--;
      }else if(depth==0){
        if(str[tcur]=='+'){
          op=1;opc=tcur;
          break;
        }else if(str[tcur]=='*'){
          op=2;opc=tcur;
          break;
        }else if(str[tcur]=='-'
                 &&tcur+1<(int)str.length()
                 &&str[tcur+1]=='>'){
          tcur++;
          op=3;opc=tcur;
          break;
        }
        
      }
        tcur++;
    }
    switch(op){
    case -1:
      return formula(str.substr(1,str.length()-2));
    case 1:
      return formula(str.substr(1,opc-1))
        ||formula(str.substr(opc+1, str.length()-1 - (opc+1)));
    case 2:
      return formula(str.substr(1,opc-1))
        &&formula(str.substr(opc+1, str.length()-1 - (opc+1)));
    case 3:
      return !(formula(str.substr(1,opc-2))
               &&!formula(str.substr(opc+1, str.length()-1 - (opc+1))));
    default:
      cout<<"ERROR!"<<endl;
      return false;
    }
  }
}
int main(){
  string str;
  pair<string, string> eq;
  while(cin>>str&&str!="#"){
    eq=equation(str);
    int flg=1;
    for(vals=0;vals< 1<<10;vals++){
      if(formula(eq.first) != formula(eq.second)) flg=0;
    }
    (flg)?cout<<"YES"<<endl:cout<<"NO"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1912
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ld eps = 1.0e-18;
int main(){
  ld a,b,c; cin>>a>>b>>c;
  if(c<a+b){
        cout << "No" << endl;
        return 0;
    }
  if(4*a*b<(c-a-b)*(c-a-b)){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

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

using namespace std;
#define ll long long
#define ld  long double

#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;
ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}
//__builtin_popcount ();
struct def{
    string h = ">";
};
int main()
{
    FAST
       string h;
       cin>>h;
       map<char, int> m;
       m['x'] = 0;
       m['o'] = 100;
       cout << m[h[0]] + m[h[2]] + m[h[1]]+700 << endl;

       return 0;
}

Measured memory_bytes: 256
s = raw_input().split()
[N] = s
N = int(N)

if (N == 1):
    print "Yes"
    exit(0)

for i in range(8):
    if (N % (i+2) == 0 and N / (i+2) <= 9):
        print "Yes"
        exit(0)

print "No"


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

using namespace std;

int main()
{
vector<int> v {0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k; cin >> k;

	cout << v[k];
	return 0;
}




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

ll tw(ll x){
	ll p = 1;
	ll ans = 0;
	rep(i,x){
		ans += p;
		p *= 2;
	}
	return ans;
}

int main(){
	ll h; cin >> h;
	ll count = 0;
	while(true){
		if(h == 0)break;
		h /= 2;
		count++; 
	}
	cout << tw(count) << endl;
}

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

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

	priority_queue<int> p, q, t;
	for (int i = 0; i < A; ++i) {
		int pi;
		cin >> pi;
		p.push(pi);
	}

	for (int i = 0; i < B; ++i) {
		int qi;
		cin >> qi;
		q.push(qi);
	}

	for (int i = 0; i < C; ++i) {
		int r;
		cin >> r;
		t.push(r);
	}

	for (int i = 0; i < X; ++i) {
		t.push(p.top());
		p.pop();
	}

	for (int i = 0; i < Y; ++i) {
		t.push(q.top());
		q.pop();
	}

	long long s = 0;
	for (int i = 0; i < X + Y; ++i) {
		s += t.top();
		t.pop();
	}

	cout << s;

	return 0;
}
	


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define INFTY 1<<20
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const int MOD=1000000007;
int n;
int x[102],cnt=0;

int main(){
    ll n,t[5];cin>>n;
    rep(i,5)cin>>t[i];
    ll mn =2*pow(10,15),ans,now=0;
    rep(i,5){
        if(t[i]<mn){
            ll d,e;
            if(n%t[i]!=0) d= n/t[i]+1;
            else d = n/t[i];
            if(n%mn!=0) e= n/mn+1;
            else e = n/mn;
            now += d-e;
            mn = t[i];
        }
        now += 1;
        //cout<<i <<" " << now<<endl;
    }
    cout << now<<endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d,e;
long long gcd(long long a,long long b) {
	if(!b)return a;
	return gcd(b,a%b);
}
int main() {
	scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
	a--;
	e=c*d/gcd(c,d);
	printf("%lld",b-a-(b/c)+(a/c)-(b/d)+(a/d)+(b/e-a/e));
	return 0;
}

Measured memory_bytes: 256
/* 0-1 Knapsack Problem
 *
 * You have N items that you want to put them into a knapsack. Item i has value
 * vi and weight wi.
 *
 * You want to find a subset of items to put such that:
 *
 * The total value of the items is as large as possible.
 * The items have combined weight at most W, that is capacity of the knapsack.
 * Find the maximum total value of items in the knapsack.
 *
 * Input
 * N W
 * v1 w1
 * v2 w2
 * :
 * vN wN
 * The first line consists of the integers N and W. In the following lines, the
 * value and weight of the i-th item are given.
 *
 * Output
 * Print the maximum total values of the items in a line.
 *
 * Constraints
 * 1 ≤ N ≤ 100
 * 1 ≤ vi ≤ 1000
 * 1 ≤ wi ≤ 1000
 * 1 ≤ W ≤ 10000
 */

#include <algorithm>
#include <iostream>
#include <vector>

#define MAXN 105
#define MAXW 10010
using namespace std;
int dp[MAXN][MAXW];

int main() {
  for (int i = 0; i < MAXN; ++i)
    fill(dp[i], dp[i] + MAXW, 0);

  int n, W;
  cin >> n >> W;

  struct item {
    int v, w;
  };
  vector<item> knap;
  for (int val, wt; cin >> val >> wt;)
    knap.push_back({val, wt});

  // dp[i][cap]= maximum value attainable from considering items
  //             i+1,...,N-1 with remaining capacity cap
  // dp[i][cap]= if w_i<=cap then max(v_i + dp[i+1][cap-w_i], dp[i+1][cap]) else
  // dp[i+1][cap]
  //             dp[N][_] = 0
  // overall solution=dp[0][W]

  for (int i = n - 1; i >= 0; --i)
    for (int c = 0; c <= W; ++c)
      dp[i][c] = max(knap[i].w <= c ? knap[i].v + dp[i + 1][c - knap[i].w]
                                    : dp[i + 1][c],
                     dp[i + 1][c]);

  cout << dp[0][W] << endl;
}


Measured memory_bytes: 7264
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#define mt(a) memset(a,0,sizeof(a))
#define MAXN 100005
#define ll long long
const ll INF = 0x3f3f3f3f;
using namespace std;
int main (void)  
{   
	int a,b,c;
	cin>>a>>b>>c; 
	int maxx = max(a,b);
	maxx = max(maxx,c);
	int a1 = (maxx - a)/2;
	a+=a1*2,a-=maxx;
	int b1 = (maxx - b)/2;
	b+=b1*2,b-=maxx;
	int c1 = (maxx-c)/2;
	c+=c1*2,c-=maxx;
	int sum = a1+b1+c1;
	int ans = 0;
	if(a==-1)
		ans++;
	if(b==-1)
		ans++;
	if(c==-1)
		ans++;
	if(ans==1)
		sum+=2;
	else if(ans==2)
		sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define mem0(x) memset(x,0,sizeof(x))
#define meminf(x) memset(x,0x3f,sizeof(x))
#define VI vector<int>
#define VL vector<ll>
using namespace  std;

const int N = 1e5+5;
int a[N];
deque<int> q;
int num;
int main()
{
    ios::sync_with_stdio(0);
    int n;cin>>n;
    rep(i,1,n){
        cin>>a[i];
    }
    q.push_back(a[1]);++num;
    rep(i,2,n){

        // cout<<"t"<<i-1<<":";
        // rep(i,1,num){
        //     cout<<q[i-1]<<' ';
        // }
        //cout<<endl;
        int idx = upper_bound(q.begin(),q.end(),a[i],greater<int>())-q.begin();
        //cout<<"idx:"<<idx<<endl;
        if(idx==num){
            q.push_back(a[i]);
            ++num;
        }else{
            q[idx] = a[i];
        }
        //sort(q.begin(),q.end(),greater<int>());
    }
    cout<<num;
    
}


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

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector <int> a(n);
  bool d = true;
  for (int i = 0; i < n; ++i){
	cin >> a[i];
	if (a[i] % 2 == 0){
		if(a[i] % 3 != 0 && a[i] % 5 != 0){
			d = false;
		}	
	}
  }
  (d) ? cout << "APPROVED\n" : cout << "DENIED\n";
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define vi vector<ll>
#define vvi vector<vi>
#define Q queue<ll>
#define DQ deque<ll> 
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back
#define mp make_pair
#define mt make_tuple
#define f first
#define s second
#define ub upper_bound
#define lb lower_bound
#define loop(x,y,z) for(ll i=x; i<=y; i+=z)
#define rloop(x,y,z) for(ll i=x; i>=y; i-=z)
#define all(x) x.begin(), x.end()
#define sum(x) accumulate(all(x),0LL)
#define minE(x) *min_element(all(x))
#define maxE(x) *max_element(all(x))
#define mem(a,b) memset(a,b,sizeof(a))
#define watch(x) cout<<(#x)<<" is "<<x<<endl;

vi divisors;

void precompute(ll x){
	ll root=(ll)(sqrt(x));
	loop(1,root,1){
		if (x%i==0){
			divisors.push_back(i);
			if(x/i!=i) divisors.push_back(x/i);
		}
	}
	// divisors.push_back(x);
	sort(all(divisors));
}

ll gcd(ll a, ll b){
	return (!b)?a:gcd(b,a%b);
}

void display(vi &v,string c){
	for(auto x:v) cout<<x<<c;
}

bool check(vi &v, ll mid, ll k){
	// watch(mid);
	vi v2;
	for(auto x:v) v2.pb(x%mid);
	sort(all(v2));
	ll i=0;
	ll j=v2.size()-1;
	ll workers=0;
	while(i<j){
		if(!v2[i]) i++;
		else{
			ll need=mid-v2[j];
			if(v2[i]<need){
				v2[j]+=v2[i];
				workers+=v2[i];
				i++;
			}
			else{
				v2[i]-=need;
				j--;
				workers+=need;
			}
		}
	}
	// watch(workers);
	return (workers<=k);
}

int main(){
	IOS
	ll n,k;
	cin>>n>>k;
	vi v(n);
	loop(0,n-1,1) cin>>v[i];
	ll total=sum(v);
	precompute(total);
	sort(all(v));
	ll ans=1;
	for(auto x:divisors){
		if(check(v,x,k)){
			ans=x;
		}
	}
	cout<<ans;
	// display(divisors," ");
	// ll low=0,high=divisors.size()-1,mid;
	// while(low!=high){
	// 	mid=(low+high+1)/2;
	// 	if (check(v,divisors[mid],k)){
	// 		low=mid;
	// 	}
	// 	else{
	// 		high=mid-1;
	// 	}
	// }
	// cout<<divisors[low];
	return 0;
}


Measured memory_bytes: 256
/*input
111100
*/
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define pii pair<ll,ll>
#define list vector<ll>
#define mp make_pair
#define vp vector< pair<ll,ll> >
#define in insert
#define pb push_back
#define ft first
#define sd second
#define matrix vector< vector<ll> >
#define all(x) x.begin(),x.end()
#define line string
#define rall(x) x.rbegin(),x.rend()
#define f(i,n) for(ll i=1;i<=n;i++) 
ll mod=(ll)(1e9+7);
ll total[101];
ll N;
ll solve(ll pos,ll cnt,ll foo)
{
	if(cnt==0)return foo;
	ll ans=0;
	for(ll i=1;i<=N;i++)
		if(i!=pos)
			{
					ans+=solve(i,cnt-1,foo+total[pos]);
			}
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin>>s;
	int cnt=0;
	for(int i=0;i<s.size();i++)
		if(s[i]=='1')
				cnt++;
	cout<<cnt<<endl;
	return 0 ;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<bitset>
 
#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.begin(), a.end())
#define Srep(n) for(int i = 0; i < (n); i++)
#define Lrep(i,a,n) for(int i = (a); i < (n); i++)
#define Brep(n) for(int bit = 0; bit < (1<<n); bit++)
#define rep2nd(n,m) Srep(n) Lrep(j,0,m)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vector<int>>
#define vvi64 vector<vector<int64_t>>
 
using namespace std;

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  char d = 'A' - 'a';
  printf("%c%c%c\n", a[0] + d, b[0] + d, c[0] + d);
}

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

int main(){
  long n, m, k, a, b;
  map<long, long> h,x;
  cin >> n >> m;
  for(long i = 1; i <= n; i++){
    cin >> k;
    h[i] = k;
   // cout << h.at(i) << endl;
  }
  x = h;
  
  for(long i = 0; i < m; i++){
    cin >> a >> b;
    if(h.at(a) > h.at(b) && x.count(b) )
      x.erase(b);
    else if(h.at(b) > h.at(a) && x.count(a) )
      x.erase(a);
    else if(h.at(a) == h.at(b) ){
      if(x.count(a))
         x.erase(a); 
      if(x.count(b))
         x.erase(b);
    }
  }
  /*for(long i = 1; i<= n ; i++)
    cout << x[i] << endl;*/
  cout << x.size() << endl;
}


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

#define int long long

signed main(){
  bool flag = true;
  int N;
  int maximum = 0, minimum = (1<<30);
  vector<int> a, con;

  cin>>N;

  a.resize(N);
  con.resize(N);

  for(int i = 0; i < N; i++){
    cin>>a[i];
    con[a[i]]++;

    maximum = max(a[i], maximum);
    minimum = min(a[i], minimum);
  }
  //  cout<<minimum<<endl;
  if((maximum)%2){
    if(con[minimum] != 2) {
      flag = false;
    }
  } else {
    if(con[minimum] != 1) {
      flag = false;
    }
  }

  for(int i = minimum+1; i <= maximum; i++){
    if(con[i] < 2){
      flag = false;
      break;
    }
  }


  if(flag) cout<<"Possible"<<endl;
  else cout<<"Impossible"<<endl;



  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <iostream>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define mt make_tuple
#define tii tuple<int,int,int>
#define pq priority_queue<ll>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vecbl vector<bool>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
string stin(){string s;cin>>s;return s;}

int main(){
    int x=in(),y=in();
    int ans=0;
    if(x<=3 & y<=3){
        ans=(8-x-y)*100000;
        if(x+y==2)ans+=4*100000;
    }else if(x<=3 || y<=3){
        int k=min(x,y);
        ans=(4-k)*100000;
    }else{
        ans=0;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

/* 
The read function reads a string according to each one. 
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//main function
fn main() {
    let string: String = read();
    let v: Vec<char> = string.chars().collect();
    let mut acount: i32 = -1;
    let mut zcount: i32 = -1;
    for i in 0..v.len(){
	if acount==-1 && v[i as usize]=='A'{
	    acount = i as i32;
	}else if v[i as usize]=='Z'{
	    zcount = i as i32;
	}
    }
    println!("{}",zcount-acount+1);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
typedef long long ll;
using namespace std;

int main() {
    int r,g;
    cin >> r >> g;
    cout << g*2-r << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int H,W,i,j;
  while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)break;
    for(j=0;j<W;j++){
      printf("#");
    }
    printf("\n");
    for(i=1;i+1<H;i++){
      printf("#");
      for(j=1;j+1<W;j++){
	printf(".");
      }
      printf("#\n");
    }
    for(j=0;j<W;j++){
      printf("#");
    }
    printf("\n");
    printf("\n");
  }
  return 0;
}



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

int main()
{
	long long l,r;
	cin>>l>>r;
	
	if(r-l>=2018)
	{
		cout<<"0";
		return 0;
	}
	l%=2019;
	r%=2019;
	long long mmin=LLONG_MAX;
	for(long long i=l; i<r; i++)
	{
		for(long long j=r; j>i; j--)
			mmin=min(mmin,(i*j)%2019);
	}
	cout<<mmin;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    long long n, a[200005], counts[200005] = {0};
    cin >> n;

    for (long long i = 0; i < n; i++)
    {
        cin >> a[i];
        counts[a[i]]++;
    }

    long long total = 0;

    for (long long i = 1; i <= n; i++) total += (counts[i] * (counts[i]-1)) / 2;

    for (long long i = 0; i < n; i++)
    {
        cout << total - (counts[a[i]] * (counts[a[i]]-1)) / 2 + ((counts[a[i]]-1) * (counts[a[i]]-2) / 2) << endl;
    }
}

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

#include <math.h>
#include <stdlib.h>


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

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s; cin >> s;
    cout << "ABC" << s << endl;

    return 0;
}


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

int main(){
	int n;
	cin >> n;
	int m[n];
	for(int i=0; i<n; ++i){
		cin >> m[i];
	}
	int dev = 100;
	for(int t=0; t<n-1;++t){
		int left = 0;
		int right = 0;

		for(int i=0; i<=t; i++){
			left += m[i];
		}
		for(int i=t+1; i<n; i++){
			right += m[i];
		}
		if(abs(right-left)<dev){
			dev = abs(right-left);
		}
	}
	cout << dev;
	
	return 0;
}

Measured memory_bytes: 256
#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 r;
  cin >>r;
  double ans = 2*r*3.141592653;
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}


Measured memory_bytes: 3764
package main

import (
	"fmt"
)

func main() {
	var a,b,k int
	fmt.Scan(&a,&b,&k)
	
	if b - a + 1 <= k * 2 {
		for i := a; i <= b; i++{
			fmt.Println(i)
		}
	} else {
		for i := a; i < a + k; i++ {
			fmt.Println(i)
		}
		for i := b-k+1; i <= b; i++ {
			fmt.Println(i)
		}
	}
	
}


Measured memory_bytes: 512
x = int(input())

if x <= 599:
    print(8)
elif x <= 799:
    print(7)
elif x <= 999:
    print(6)
elif x <= 1199:
    print(5)
elif x <= 1399:
    print(4)
elif x <= 1599:
    print(3)
elif x <= 1799:
    print(2)
elif x <= 1999:
    print(1)

Measured memory_bytes: 61616
from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)



Measured memory_bytes: 5048
def x(p0, p1):
    d = abs(p0 - p1)
    if d > 2:
        return []
    elif d == 2:
        return [(p0 + p1) / 2]
    else:
        m = (p0 + p1) / 2
        v = m - p0
        w = complex(v.imag, -v.real)
        l = abs(w)
        h = (1 - l ** 2) ** .5 * w / l
        return [m + h, m - h]

for e in iter(input, '0'):
    n = int(e)
    P = [complex(*map(float, input().split(','))) for _ in [0] * n]
    Q = []
    for i in range(n):
        for j in range(i + 1, n):
            Q += x(P[i], P[j])
    print(max(sum(1.01 >= abs(q - p) for p in P) for q in Q) if Q else 1)


Measured memory_bytes: 5728
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=1000000007;

int main() {
    int k,n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(all(a));
    int ans=k-a[n-1]+a[0];
    rep(i,n-1){
        ans=max(ans,a[i+1]-a[i]);
    }
    cout << k-ans << endl;
}


Measured memory_bytes: 1024
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(input())
uvw = [list(map(int, input().split())) for i in range(n - 1)]
d = [-1 for i in range(n)]
edge = [[] for i in range(n)]
for u, v, w in uvw:
    edge[u - 1].append((v - 1, w))
    edge[v - 1].append((u - 1, w))
def dfs(now, D):
    d[now] = D
    for i, j in edge[now]:
        if d[i] == -1:
            dfs(i, D + j)
dfs(0, 0)
for i in d:
    print(i % 2)

Measured memory_bytes: 103608
/*******************************************
*    Template created by Danel Batyrbek    *
*    All rights reserved 2018 (lol)        *
********************************************/

#include <bits/stdc++.h>

#define fr first
#define sc second
#define mkp make_pair
#define lrb lower_bound
#define upb upper_bound
#define pb emplace_back
#define ins insert
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define speed_up ios_base :: sync_with_stdio(0);cin.tie(0)
#define skip continue
#define left(x) x << 1
#define rght(x) x << 1 | 1
#define forn(x, y, z) for(int x = y; x <= z; ++ x)
#define for1(x, y, z) for(int x = y; x >= z; -- x)
#define fname ""

using namespace std;

typedef long long ll;
typedef double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 2e5 + 10;
const int INF = 2e9 + 10;
const int mod = 1e9 + 7;
const ll LINF = 4e18 + 10;

string n;
ll ans;

int main(){
#ifdef DANEL
	freopen("in", "r", stdin);
#else
	if(fname != ""){
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	}
#endif
	cin >> n;
	int sz = n.size();
	forn(pos, -1, sz - 1){
		string str = n;
		if(pos > -1){
			str[pos] --;
			int temp = pos;
			while(temp >= 0 && str[temp] < '0'){
				str[temp --] = '9';
				str[temp] --;
			}

			forn(j, pos + 1, sz - 1){
				str[j] = '9';
			}
		}
		ll val = 0;
		forn(i, 0, sz - 1){
			val += str[i] - '0';
		}
		ans = max(val, ans);
	}
	cout << ans;
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  cout << n - (k - 1)  << "\n";
}

Measured memory_bytes: 256
/*
,..-─,ﾍ-.、
(,.r-/_@_r-i　　  i
i　ﾉﾙﾊﾉﾘﾉﾉ　    ﾉ|
ﾙl.ﾘ_ﾟ ヮﾟﾉﾘ　(_,ﾉ
 rX,_,i.∞i,〉
 <_/_,§! |〉
 ｀'-r_,ｨ_ｧ'*/
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  cout <<  n-(n/2) << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
using P = pair<int,int>;
using pq = priority_queue<int>;
typedef long long ll;
string yes = "Yes\n";
string no = "No\n";

int gcd(int a, int b)
{
	if (a % b == 0)
		return b;
	else
		return (gcd(b, a % b));
}

int  lcm(int a, int b)
{
	return (a * b / gcd(a,b));
}

int  main()
{
	int n; cin >> n;
	cout << lcm(n,2) << endl;
	return 0;
}


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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1000000007LL;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

set<ll> st;
ll a[Maxn];
ll cnt[Maxn];

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll h, w, a, b;
	cin >> h >> w >> a >> b;
	for(int i = 0; i < h;i++){
		for(int j = 0; j< w; j++) cout << ((int)((i < b) ^ (j < a)));
		cout << '\n';
	}
	return 0; 
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/


Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;
typedef pair<int,int> P;
typedef long long int ll;

int main()
{
    char str[120][120];
    int n, l, i, j;
    scanf("%d %d", &n, &l);
    for(i=0;i<n;i++)
        scanf(" %s", str[i]);
    for(i=0;i<n;i++)
        for(j=i+1;j<n;j++)
        {
            if(strcmp(str[i], str[j]) > 0)
            {
                char str1[120];
                strcpy(str1, str[i]);
                strcpy(str[i], str[j]);
                strcpy(str[j], str1);
            }
        }
    for(i=0;i<n;i++)
        printf("%s", str[i]);
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()

void solve(long long D, long long G, std::vector<long long> p, std::vector<long long> c){
  ll ans = LLONG_MAX;
  for (int bit = 0; bit < (1 << D); bit++) {
    ll pre = 0,w = 0,m_zero = -1;
    for (int i = 0; i < D; i++) {
      if(bit & (1 << i)){
        pre += p[i];
        w += p[i]*(i+1)*100 + c[i];
      }else{
        m_zero = i;
      }
    }  
    if(G > w){
      ll n = roundup((G-w),((m_zero+1)*100));
      if(n >= p[m_zero]){
        continue;
      }
      pre += n;
    }
    ans = min(ans,pre);
  }
  cout << ans << endl;
}

int main(){
    long long D;
	scanf("%lld",&D);
	long long G;
	scanf("%lld",&G);
	std::vector<long long> p(D);
	std::vector<long long> c(D);
	for(int i = 0 ; i < D ; i++){
		scanf("%lld",&p[i]);
		scanf("%lld",&c[i]);
	}
    solve(D, G, std::move(p), std::move(c));
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var W = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var sum = W.Sum();

            var min = int.MaxValue;
            for (int i = 0; i < N - 1; i++)
            {
                min = Math.Min(min, Math.Abs(sum - W.Take(i + 1).Sum() * 2));
            }

            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 13396
# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))
ans=0
cnt=1
for i in range(n):
    if a[i]!=cnt:
        ans+=1
    else:
        cnt+=1
if ans==n:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 24744
#include<bits/stdc++.h>
using namespace std;
long double prob[3000];
long double dp[3000][3000];
long double solve(int ind ,int heads)
{
	if(ind==-1)
	{
		if(heads==0)
		return 1;
		else
		return 0;
	}
	if(dp[ind][heads]!=-1)
	return dp[ind][heads];
	long double res=0;
	if(heads!=0)
	res=res+prob[ind]*solve(ind-1,heads-1);
	res=res+(1-prob[ind])*solve(ind-1,heads);
	dp[ind][heads]=res;
	return res;
}
int main()
{
	int n,i,j,k;
	cin >> n;
	for(i=0;i<n;i++)
	{
		cin >> prob[i];
	}
	for(i=0;i<3000;i++)
	{
		for(j=0;j<3000;j++)
		{
			dp[i][j]=-1;
		}
	}
	long double ans=0;
	for(i=1;i<=n;i++)
	{
		int heads=i;
		int tails=n-i;
		if(heads>tails)
		ans=ans+solve(n-1,heads);
	}
	cout << setprecision(15) << ans << "\n";
	return 0;
}

Measured memory_bytes: 141184
using System;

namespace ConsoleApp48
{
    class Program
    {
        static void Main(string[] args)
        {
            double r = double.Parse(Console.ReadLine());
            double area = r * r * Math.PI;
            double enshu = 2 * r * Math.PI;
            Console.WriteLine("{0} {1}", area, enshu);
        }
    }
}



Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i,n) {
    int a;
    cin >> a;
    a--;
    v[i] = a;
  }
  vector<int> cnt(n);
  int i = 0;
  int p = 0;
  bool b = true;
  for(;;) {
    if (i == 1) break;
    if (cnt[i]) {
      b = false;
      break;
    }
    p++;
    cnt[i] = 1;
    i = v[i];
  }
  cout << (b? p: -1) << endl;
}

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

Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/


signed main(){
  int H,W,h,w;
  cin>>H>>W>>h>>w;
  int ans=(H-h)*(W-w);

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

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

#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define sqr(x) (x) * (x)

using namespace std;
using namespace __gnu_pbds;

mt19937_64 gen(time(0));

typedef tree<
pair <int, int>,
null_type,
less<pair <int, int>>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

//const int mod = 1e9 + 7;
//const int inf = 2e9 + 6555;
//const int maxn = 2e5 + 544;



signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(false);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; ++i)
        if (i % d == 0) ++ans;
    cout << ans;
    return 0;
}


Measured memory_bytes: 3632
s = [ord(x) - ord("a") for x in input()]
k = int(input())

for i in range(len(s)):
    if s[i] == 0: continue
    r = 26 - s[i]
    if r <= k:
        k -= r
        s[i] = 0

s[-1] = (s[-1] + k) % 26
print("".join([chr(x + ord("a")) for x in s]))


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


int main() {
  
  int N, M; cin >> N >> M;
  
  vector<vector<int>> vec(100010);
  
  for (int i = 0; i < N; i++) {
    
    int A, B; cin >> A >> B;
    A--;
    vec[A].push_back(B);
  
  }
  
  int sum = 0;
  priority_queue<int> pq;
  
  for (int i = 0; i < M; i++) {
    
    if (!vec[i].empty()) {
      for (int j = 0; j < vec[i].size(); j++) {
        pq.push(vec[i][j]);
      }
    }
    
    if (!pq.empty()) {
      sum += pq.top();
      pq.pop();
    }
    
  }
  
  cout << sum << endl;
  
}

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

int main(void)
{
    int N,K;
    cin >> N >> K;
    vector<int> p(N);
    for(int i = 0; i < N; i++) cin >> p[i];
    sort(p.begin(), p.end());
    int S = 0;
    for(int i = 0; i < K; i++) S += p[i];
    cout << S << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   int k=0;
   for(int i=0;i<s.size();i++)
   {
       if(k!=1)
       {
           cout<<"2018";
           k=1;
       }
       if(i>3)
       {

           cout<<s[i];
       }
   }
   cout<<endl;
return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int zenbu = sc.nextInt();
		int now = sc.nextInt();
      if(zenbu==now){
        System.out.println("Yes");
      }else{
        System.out.println("No");
      }
	}
}

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

#define rep(i,n) for(int i = 0;i < n;++i)
#define rep2(i,n,m) for(int i = n;i < m;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;

P f(int x){
    int a = x % 10;
    int b = 0;
    while(x){
        b = x;
        x /= 10;
    }
    return P(a,b);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    map<P,int> freq;
    for(int i = 1;i <= n;++i){
        P p = f(i);
        freq[p]++;
    }
    ll ans = 0;
    for(int i = 1;i <= n;++i){
        P p = f(i);
        P q(p.second,p.first);
        ans += freq[q];
    }
    cout << ans << endl;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [0 for i in range(4)]
b = ["AC", "WA", "TLE", "RE"]
for i in range(n):
  s = input()
  for j in range(4):
    if s == b[j]:
      a[j] += 1
for i in range(4):
  print(b[i], "x", a[i])

Measured memory_bytes: 9204
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int main(){
	int a, b, c, eq=0, eq1=0, eq2=0;
	scanf("%d %d %d", &a, &b, &c);
	eq= b+c;
	eq1= a-b;
	eq2= c-eq1;
	if (a > eq)
		printf("0");
	
	else 
		printf("%d", eq2);
	printf("\n");
    return 0;
}

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

using namespace std;

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

#define fori(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i >= 0; i--)
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repd(i, a, b) for (int i = a; i >= b; i--)
#define trav(x, a) for (auto &x : a)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define sz(a) (int)(a).size()
#define fi first
#define se second

clock_t time_p = clock();
void time_taken()
{
    time_p = clock() - time_p;
    cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}

const ll mod = 1e9 + 7;
const ll INF = 1e18;

#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 

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

    int n;
    cin >> n;
    vi a(n + 1);
    rep(i,1,n){
        cin >> a[i];
        a[i] -= i;
    }
    sort(1+all(a));
    int l = max(n / 2 - 10, 1);
    int r = min(n / 2 + 10, n);
    ll ans = INF;
    rep(i, l, r)
    {
        int b = a[i];
        ll cur = 0;
        rep(j, 1, n)
        {
            cur += abs(b - a[j]);
        }
        ans = min(ans, cur);
    }
    cout << ans << endl;
    time_taken();
    return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
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; }

long long n, k;
vector<long long> A(200200, 0);
vector<long long> visited(200200, -1);
struct pqdata {
    long long pos; long long len;
};

int main() {
    cin >> n >> k;
    for(int i = 0; i < n; ++i) {
        cin >> A.at(i);
        A.at(i)--;
    }

    visited.at(0) = 0;
    queue<pqdata> que;
    pqdata first; first.pos = 0; first.len = 0;
    que.push(first);
    long long start = 0; long long goal = 0;
    while(!que.empty()) {
        pqdata now = que.front();
        que.pop();
        long long next = A.at(now.pos);
        long long nlen = now.len+1;
        if(visited.at(next) == -1) {
            visited.at(next) = nlen;
            pqdata nnext;
            nnext.pos = next; nnext.len = nlen;
            que.push(nnext);
        }else {
            start = visited.at(next);
            goal = nlen;
            break;
        }
    }

    long long check = (k-start) % (goal-start);

    long long nextpos = 0;

    // cout << start << " " << goal << endl;
    
    for(int i = 0; i < min(k, start+check); ++i) {
        nextpos = A.at(nextpos);
    }

    cout << nextpos+1 << endl;
}

Measured memory_bytes: 6236
#include<bits/stdc++.h>
#define ll long long
#define f(i,l,r) for(int i=l;i<=r;i++)
#define debug(x) cout<<#x<<'='<<(x)<<endl
#define pb push_back
#define mp make_pair
#define rng(x) x.begin(),x.end()
#define fst first
#define scnd second
using namespace std;
template<class T> bool maxs(T& a,T& b)
{
    if(a<b)
    {
        T t;
        t=a;
        a=b;
        b=t;
        return true;
    }
    return false;
}
template<class T> bool maxi(T& a,T b)
{
    if(a<b)
    {
        a=b;
        return true;
    }
    return false;
}
template<class T> bool mini(T& a,T b)
{
    if(a>b)
    {
        a=b;
        return true;
    }
    return false;
}
int main()
{
#ifdef LOCAL
    freopen("output.txt","w",stdout);
    freopen("input.txt","r",stdin);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#endif
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    f(i,0,n-1)  cin >> a[i];
    ll turn=1;
    ll dp[k+1][2];
    dp[0][1]=0;
    dp[0][0]=1;
    f(i,1,k)
    {
        ll f1=0,f2=0;
        f(j,0,n-1)
        {
            if(i>=a[j])
            {
                if(dp[i-a[j]][0]==1)
                {
                    dp[i][1]=1;
                    f1=1;
                }
                if(dp[i-a[j]][1]==0)
                {
                    dp[i][0]=0;
                    f2=1;
                }
            }
        }
        if(!f1) dp[i][1]=0;
        if(!f2) dp[i][0]=1;
    }
    cout<< ((dp[k][1])?"First":"Second");
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

class sai{
public:
  int men[6];

  void e();
  void n();
  void s();
  void w();
  void kat();
  void kah();
};

void sai::e(){
  int t = men[0];
  men[0] = men[3];
  men[3] = men[5];
  men[5] = men[2];
  men[2] = t;
}
void sai::n(){
  int t = men[0];
  men[0] = men[1];
  men[1] = men[5];
  men[5] = men[4];
  men[4] = t;
}
void sai::s(){
  int t = men[0];
  men[0] = men[4];
  men[4] = men[5];
  men[5] = men[1];
  men[1] = t;
}
void sai::w(){
  int t = men[0];
  men[0] = men[2];
  men[2] = men[5];
  men[5] = men[3];
  men[3] = t;
}
void sai::kat(){
  int t = men[1];
  men[1] = men[2];
  men[2] = men[4];
  men[4] = men[3];
  men[3] = t;
}
void sai::kah(){
  int t = men[1];
  men[1] = men[3];
  men[3] = men[4];
  men[4] = men[2];
  men[2] = t;
}

int main(){
  int n;
  scanf("%d", &n);
  sai sa[n];
  for(int j = 0; j < n; j++) for(int i = 0; i < 6; i++) scanf("%d", &sa[j].men[i]);

  for(int l = 0; l < n - 1; l++){
    for(int m = l + 1; m < n; m++){
      for(int j = 0; j < 6; j++){
        if(sa[l].men[0] == sa[m].men[0]){
          for(int k = 0; k < 4; k++){
            if(sa[l].men[1] == sa[m].men[1]){
              for(int i = 2; i < 6; i++){
                if(sa[m].men[i] != sa[l].men[i]) break;
                if(i == 5){
                  printf("No\n");
                  return 0;
                }
              }
            }
            sa[m].kat();
          }
        }
        if(j < 3) sa[m].n();
        else if(j == 3) sa[m].e();
        else if(j == 4){
          sa[m].e();
          sa[m].e();
        }
      }
    }
  }

  printf("Yes\n");
}



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

int main(){
  int n;
  cin>>n;
  vector<int> a(110);
  for(int i =0;i<n;i++ )cin>>a.at(i);

  sort(a.begin(),a.end(),greater<int>());
    int Alice = 0;
    int Bob = 0;
    for (int i = 0; i < n; ++i) {
        if (i % 2 == 0) { 
            Alice += a[i];
        }
        else { 
            Bob += a[i];
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256