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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  getchar();
  if (getchar() == 'B') puts("ARC");
  else puts("ABC");
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

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

const ll MRINF = 5000000000000000;

int main() {


  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n)cin >> a[i];
  sort(a.begin(), a.end());

  ll ma = -1;
  REP(i, n){
    if(min((a[i]), (a[n-1]-a[i]))> ma){
      ma = a[i];
    }
  }

  cout << a[n-1] << " " << ma << endl;



    

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
//#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

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)...);
}

int main() {
  string n;
  cin >> n;
  if ((n[0] == n[1] && n[0] == n[2]) || (n[3] == n[1] && n[3] == n[2])) {
    print("Yes");
  } else {
    print("No");
  }
  return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(15);
#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
#endif
    long long x, n;
    cin >> x >> n;
    if (n == 0)
    {
        cout << x << endl;
    }
    else
    {
        long long a[n];
        unordered_map<long long, bool> h;
        for (long long i = 0; i < n; i++)
        {
            cin >> a[i];
            h[a[i]] = true;
        }
        if (h[x] == false)
        {
            cout << x << endl;
        }
        else
        {
            long long dis = 500;
            long long ans = 1e9;
              for(long long i=x+1;i<=200;i++){
                if(h[i]==false){
                    if(abs(x-i)<dis){
                        dis=abs(x-i);
                        ans=i;
                    }
                }
            }
            for(long long i=x-1;i>=-200;i--){
                if(h[i]==false){
                    if(abs(x-i)<=dis){
                        dis=abs(x-i);
                        ans=i;
                    }
                }
            }
            cout<<ans<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> tmp(1, -1);
    vector<vector<int>> num(10, tmp);
    int slen = s.size();
    rep(i, slen){
        int x = s[i] - '0';
        num[x].push_back(i);
    }
    int cnt=0, fir, sec;
    rep(i, 10){
        if(num[i].back()==-1){
            continue;
        }else{
            fir = num[i][1];
        }
        rep(j, 10){
            if(num[j].back() <= fir){
                continue;
            }else{
                auto it = upper_bound(num[j].begin(), num[j].end(), fir);
                sec = *it;
            }
            rep(k, 10){
                if(num[k].back() > sec){
                    cnt++;
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3844
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll N;
  cin >> N;
  vector<ll> W(N);
  for (ll i = 0; i < N; i++) {
    cin >> W[i];
  }
  ll ans = 1000000;

  for (ll i = 1; i < N; i++) {
    ll sumleft = 0;
    for (ll left_i = 0; left_i < i; left_i++) {
      sumleft += W[left_i];
    }

    ll sumright = 0;
    for (ll right_i = i; right_i < N; right_i++) {
      sumright += W[right_i];
    }

    ans = min(ans, abs(sumleft - sumright));
  }

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


Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	llint syo=0,zyun=0,sto=0,bub=-1;
	string str;cin>>str;
	for(auto it:str){
		if(it=='.'){bub=1;}
		else if(it=='('){sto=bub;}
		else if(it!=')'){
			bub*=10;
			if(sto==0){syo*=10;syo+=it-'0';}
			else{zyun*=10;zyun+=it-'0';}
		}
	}
	llint busi,bunbo;
	if(sto==0){busi=syo;bunbo=bub;}
	else{busi=syo*(bub/sto-1)+zyun;bunbo=bub-sto;}
	llint x=gcd(busi,bunbo);
	cout<<busi/x<<"/"<<bunbo/x<<endl;
	return 0;
}



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

int main() {
  string s, t;
  cin >> s >> t;
  int cnt = 1001;
  for (int i = 0; i + (int)t.size() <= (int)s.size(); i++) {
    int cntt = 0;
    for (int j = 0; j < (int)t.size(); j++) {
      if (s[i + j] != t[j]) cntt++;
    }
    cnt = min(cnt, cntt);
  }

  cout << cnt << endl;
  return 0;
}

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

long long n, m;
vector<vector<int>> g, perm;
vector<int> memo;
vector<string> o;

vector<int> dfs(int now, int p, int bf = -1, int dep = 0);

int main() {
  {
    vector<int> v = {0, 1, 2, 3};
    do {
      perm.push_back(v);
    } while (next_permutation(v.begin(), v.end()));
  }
  cin >> n >> m;
  o.resize(n);
  g.resize(n);
  memo.assign(24, 0);
  for (int i = 0; i < n - 1; ++i) cin >> o[i + 1];
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  memo = dfs(0, 0);
  for (int i = 0; i < m; ++i) {
    int x, y;
    cin >> x >> y;
    int res = 0;
    vector<int> v;
    for (int j = 15; j >= 0; --j) {
      int now = (x >> j & 1) * 2 + (y >> j & 1);
      bool ch = 1;
      for (auto id : v)
        if (id == now) ch = 0;
      if (ch) v.push_back(now);
    }
    int id = -1;
    for (int j = 0; j < 24; ++j) {
      bool ch = 1;
      for (int k = 0; k < v.size(); ++k)
        if (perm[j][k] != v[k]) ch = 0;
      if (ch) id = j;
    }
    for (int j = 0; j < 16; ++j) {
      int now = (x >> j & 1) * 2 + (y >> j & 1);
      if (memo[id] >> now & 1) res += 1 << j;
    }
    cout << res << endl;
  }
  return 0;
}

vector<int> dfs(int now, int p, int bf, int dep) {
  bool ch = 1;
  vector<int> res(24, 0);
  if (bf != -1) {
    int t = 12;
    if (o[now][4] == 'Y') t = 10;
    if (o[now][3] == '&')
      p = p & t;
    else if (o[now][3] == '|')
      p = p | t;
    else
      p = p ^ t;
  }
  for (auto to : g[now])
    if (bf != to) {
      vector<int> tmp = dfs(to, p, now, dep + 1);
      if (ch)
        res = tmp;
      else {
        for (int i = 0; i < 24; ++i) {
          bool ch = 0;
          for (int j = 0; j < 4; ++j) {
            int id = perm[i][j];
            if ((res[i] >> id & 1) != (tmp[i] >> id & 1)) {
              if ((dep & 1) ^ (tmp[i] >> id & 1)) ch = 1;
              break;
            }
          }
          if (ch) res[i] = tmp[i];
        }
      }
      ch = 0;
    }
  if (ch)
    for (int i = 0; i < 24; ++i) res[i] = p;
  return res;
}


Measured memory_bytes: 37192
n = int(input())
ans = 0
for i in range(1, n+1):
  for j in range(i, n+1):
    for k in range(j, n+1):
      b = 1
      for m in range(1, i + 1):
        if i%m == 0 and j%m == 0 and k%m == 0:
          b = m
      if i == j == k:
        ans += b
      elif i != j and j != k:
        ans += 6*b
      else:
        ans += 3*b
print(ans)


Measured memory_bytes: 67924
#include <iostream>
#include <algorithm>

using namespace std;
using ll = long long;
const ll INF = 1e15;
ll N;
ll A[300][300];
ll B[300][300];

int main()
{
    cin >> N;
    for (int i = 0; i < N;i++)
    {
        for (int j = 0; j < N;j++)
        {
            cin >> A[i][j];
            B[i][j] = A[i][j];
        }
    }

    // Warshall–Floyd
    for (int k = 0; k < N;k++)
    {
        for (int i = 0; i < N;i++)
        {
            for (int j = 0; j < N;j++)
            {
                B[i][j] = min(B[i][j], B[i][k] + B[k][j]);
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if(A[i][j] != B[i][j])
            {
                cout << "-1" << endl;
                return 0;
            }
        }
    }

    ll ans = 0;

    for (int i = 0; i < N;i++)
    {
        for (int j = i + 1; j < N;j++)
        {
            bool flag = false;
            for (int k = 0; k < N; k++)
            {
               if(i != k && j != k && B[i][j] == B[i][k] + B[k][j])
               {
                   flag = true;
               }
            }
            if(flag == false)
            {
                ans += B[i][j];
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

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

	vector<int>v;
	v.push_back(m);
	int flg = 1;
	for (int i = 0;i < n;i++) {
		int a, b;
		cin >> a >> b;
		m += a;
		m -= b;
		if (0 > m)flg = 0;
		else v.push_back(m);
	}
	sort(v.begin(), v.end());
	if (flg == 0)cout << '0' << endl;
	else cout << v[v.size()-1] << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 3196
/**
    B - K-th Common Divisor
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C, cont=0;
    scanf("%d %d %d",&A, &B, &C);
    int limit=min(A,B);
    for(int i=limit; i>0; i--){
        if(A%i==0 && B%i==0)
            cont++;
        if(cont==C){
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
typedef    complex<ld>   P;
#define    X   real()
#define    Y   imag()
ld restant(P p){return abs(p);}
//polar(x,y) mag=l,arg=y
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pair<ll,ll> >   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pair<int,int> >   vpi;
typedef    vector<pair<double,double> >   vpd;
typedef    pair<double,double>   pd;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf   1000000000000000001
#define    ninf   -1000000000000000001
#define    ima   1000000001
#define    imi   -1000000001
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define all(x) x.be(),x.en()
#define    eps   1e-9
const    ld   PI=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}

int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{	
string a;
cin>>a;
bool f=false;
int n=a.length();
for(int i=0;i<n-1;i++)
	{
		if(a[i]==a[i+1])
		{
			cout<<i+1<<" "<<i+2;
			f=true;
			break;
		}
	}

if(!f)
{
	for(int i=0;i<n-2;i++)
	{
		if(a[i]==a[i+2])
		{
			cout<<i+1<<" "<<i+3;
			f=true;
			break;
		}
	}
}

if(!f)
cout<<-1<<" "<<-1;


}return 0;}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int mod_pow(int x,int y,int m=mod){
	int res=1;
	while(y>0){
		if(y&1)(res*=x)%=m;
		(x*=x)%=m;
		y>>=1;
	}
	return res;
}
vector<int>perm,inv;
void init_perm(){
	int x=1e6+1;perm.resize(x);inv.resize(x);
	perm[0]=1;
	REP(i,x+1)perm[i]=perm[i-1]*i%mod;
	inv[x]=mod_pow(perm[x],mod-2);
	for(int i=x-1;i>=0;i--){
		inv[i]=inv[i+1]*(i+1)%mod;
	}
}
int nCk(int x,int y){
	if(x<y)return 0;
	return perm[x]*inv[x-y]%mod*inv[y]%mod;
}
signed main(){
	init_perm();
	int N,A,B,C;
	int ans=0;
	cin>>N>>A>>B>>C;
	int aa=A*mod_pow(A+B,mod-2)%mod,bb=B*mod_pow(A+B,mod-2)%mod;
	for(int i=N;i<2*N;i++){
		ans+=i*nCk(i-1,N-1)%mod*(mod_pow(aa,N)*mod_pow(bb,i-N)%mod)%mod;
		ans+=i*nCk(i-1,N-1)%mod*(mod_pow(aa,i-N)*mod_pow(bb,N)%mod)%mod;
		ans%=mod;
	}
	ans*=100*mod_pow(A+B,mod-2)%mod;
	cout<<ans%mod<<endl;
}


Measured memory_bytes: 15872
import java.io.PrintWriter;
import java.util.*;

public class Main {
    static Scanner scanner;
    static PrintWriter out;
    public static void main(String[] args) {
        scanner = new Scanner(System.in);
        out = new PrintWriter(System.out);
        if (nextInt() == 0) {
            println(1);
        } else {
            println(0);
        }
        out.flush();
    }

    public static void println(Object o) {
        out.println(o);
    }

    public static void print(Object o) {
        out.print(o);
    }

    public static void printf(String format, Object... o) {
        out.printf(format, o);
    }

    public static String next() {
        return scanner.next();
    }

    public static int nextInt() {
        return Integer.parseInt(scanner.next());
    }

    public static long nextLong() {
        return Long.parseLong(scanner.next());
    }

    public static double nextDouble() {
        return Double.parseDouble(scanner.next());
    }

    public static short nextShort() {
        return Short.parseShort(scanner.next());
    }

    public static float nextFloat() {
        return Float.parseFloat(scanner.next());
    }

    public static void printYes() {
        System.out.println("Yes");
    }

    public static void printYES() {
        System.out.println("YES");
    }

    public static void printNo() {
        System.out.println("No");
    }

    public static void printNO() {
        System.out.println("NO");
    }

    public static String nextLine() {
        return scanner.nextLine();
    }

    public static double distance(double x, double y, double x2, double y2) {
        return Math.sqrt((x2 - x) * (x2 - x) + (y2 - y) * (y2 - y));
    }

    public static int MOD = 1_000_000_007;
    public static int MAX = 100000;
    public static long[] fac = new long[MAX];
    public static long[] finv = new long[MAX];
    public static long[] inv = new long[MAX];

    public static void combinit() {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < MAX; i++) {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    }

    public static long combination(int n, int k) {
        if (n < k || n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }

    public static long factorial(long n) {
        return n <= 0 ? 1 : n * factorial(n - 1);
    }
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	if (a == b == c) {
		cout << "No";
	}
	else if (a != b && a != c && b==c) {
		cout << "Yes";
	}
	else if (b != a && b != c && a==c) {
		cout << "Yes";
	}
	else if (c != a && c != b && a==b) {
		cout << "Yes";
	}

	else {
		cout << "No";
	}
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        q.push(x);
    }
    while (m--)
    {
        int cur = q.top();
        q.pop();
        cur /= 2;
        q.push(cur);
    }
    ll ans = 0;
    while (!q.empty())
    {
        int cur = q.top();
        q.pop();
        ans += 1ll * cur;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3788
def gcd(x,y):
  while y>0:
    x,y=y,x%y
  return x
def lcm(x,y):
  return x*y//gcd(x,y)
def div(x):
  return x-(x//c+x//d-x//lcm(c,d))
a,b,c,d=map(int,input().split())
print(div(b)-div(a-1))

Measured memory_bytes: 3060
import heapq


N, M = map(int, input().split())
A = [[-int(i), int(i)] for i in input().split()]
heapq.heapify(A)
for _ in range(M):
    x = heapq.heappop(A)[1]
    x //= 2
    heapq.heappush(A, [-x, x])
ans = 0
for a in A:
    ans += a[1]
print(ans)


Measured memory_bytes: 27280
#include <iostream>
#define MAXK 100100
using namespace std;

int dp[MAXK];
int A[110];

int main(){
	int n,k;
	cin>>n>>k;
	for(int i=0;i<=k;i++)dp[i]=-1;
	
	for(int i=0;i<n;i++)cin>>A[i];
	
	dp[0]=1;
	
	for(int i=0;i<n;i++){
		dp[A[i]]=0;
	}

	for(int i=1;i<=k;i++){
		if(dp[i]==-1){
			dp[i]=1;
			for(int j=0;j<n;j++){
				if(i+A[j]<=k){
				dp[i+A[j]]=0;
                }
                }
		}
	}
	if(dp[k]==1){
		cout<<"Second\n";
	}else cout<<"First\n";
	
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong N, M;

	cin >> N >> M;
	vector<llong> v(M+1, 0);
	for (int i = 0; i < N; ++i) {
		int k;
		cin >> k;
		for (int j = 0; j < k; ++j) {
			int a;
			cin >> a;
			v[a]++;
		}
	}

	llong ans = 0;
	for (auto x : v)
		ans += x == N;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <string.h>
using namespace std;

#define LIST_SIZE 1000000

typedef struct node {
	char name[13];
	struct node *next;
}NODE;

NODE *LIST[LIST_SIZE];
NODE *makenode(char name[13]);
int ctoi(char chr);
void findnode(char name[13], int placenum);

int main(void) {
	int N, placenum;
	char order[7], name[13];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> order >> name;
		placenum = 0;
		for (int j = 0; j < strlen(name) + 1; j++) {
			placenum += ctoi(name[j]);
			placenum = placenum * 5;
		}
		placenum = placenum % LIST_SIZE;
		if (strcmp(order, "insert") == 0) {
			NODE *newnode = makenode(name);
			NODE *ptr = LIST[placenum];
			if (ptr == NULL) {
				LIST[placenum] = newnode;
			}
			else {
				while (ptr->next != NULL) {
					ptr = ptr->next;
				}
				ptr->next = newnode;
			}
		}
		else {
			findnode(name, placenum);
		}
	}
	return 0;
}

NODE *makenode(char name[13]) {
	NODE *newnode;
	newnode = (NODE *)malloc(sizeof(NODE));
	strcpy(newnode->name, name);
	newnode->next = NULL;
	return newnode;
}

int ctoi(char chr) {
	if (chr == 'A') return 1;
	else if (chr == 'C') return 2;
	else if (chr == 'G') return 3;
	else return 4;
}

void findnode(char name[13], int placenum) {
	if (LIST[placenum] == NULL) {
		cout << "no" << endl;
		return;
	}
	else {
		NODE *ptr = LIST[placenum];
		while (ptr != NULL) {
			if (strcmp(ptr->name, name) == 0) {
				cout << "yes" << endl;
				return;
			}
			ptr = ptr->next;
		}
		cout << "no" << endl;
		return;
	}
}


Measured memory_bytes: 26688
// D - Katana Thrower

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int b[100000];

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

	int max_a = 0;
	for (int i=0; i<N; i++) {
		int a;
		cin >> a >> b[i];
		max_a = max(max_a, a);
	}

	sort(b, b+N, greater<int>());
	int max_b = b[0];

	int ans = 0;

	for (int i=0; i<N; i++) {
		if (b[i] <= max_a || H <= 0) break;
		H -= b[i];
		ans++;
	}

	if (H > 0) {
		ans += (H - 1) / max_a + 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int ai[100005];
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(abs(c-a) <= d)
        printf("Yes\n");
    else if(abs(b-a)<=d&&abs(c-b)<=d)
        printf("Yes\n");
    else
        printf("No\n");
	return 0;
}


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

int main() {
  string w;
  cin >> w;

  int count = 0;
  while (1) {
    string t;
    cin >> t;

    if (t == "END_OF_TEXT") break;

    for (int i = 0; i < t.size(); i++) {
      if ('A' <= t[i] && t[i] <= 'Z') t[i] += 32;
    }

    if (w == t) count++;
  }

  cout << count << endl;

  return 0;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 char c;
  cin>>c;
  for(int i=0;i<5;i++){
  	if("aeiou"s.at(i)==c){
    	cout<<"vowel"<<endl;
      break;
    }
    if(i==4){
      cout<<"consonant"<<endl;
    }   
  }

}

Measured memory_bytes: 256
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
INF = -1
def main(T1, T2, A1, A2, B1, B2):
    D1 = T1 * (A1 - B1)
    D2 = D1 + T2 * (A2 - B2)

    if D1 * D2 > 0:
        return 0

    if abs(D1) == abs(D2) or D2 == 0:
        return INF

    d, m = divmod(abs(D1), abs(D2))
    return (1 if m else 0) + 2 * d


if __name__ == '__main__':
    input = sys.stdin.readline
    T1, T2 = map(int, input().split())
    A1, A2 = map(int, input().split())
    B1, B2 = map(int, input().split())
    ans = main(T1, T2, A1, A2, B1, B2)
    print(ans if ans >= 0 else 'infinity')


Measured memory_bytes: 9104
class Union_Find():
    def __init__(self,N):
        """0,1,...,n-1を要素として初期化する.

        n:要素数
        """
        self.n=N
        self.parents=[-1]*N
        self.rank=[0]*N

    def find(self, x):
        """要素xの属している族を調べる.

        x:要素
        """
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        """要素x,yを同一視する.

        x,y:要素
        """
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x]>self.rank[y]:
            self.parents[x] += self.parents[y]
            self.parents[y] = x
        else:
            self.parents[y] += self.parents[x]
            self.parents[x] = y

            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1

    def size(self, x):
        """要素xの属している要素の数.

        x:要素
        """
        return -self.parents[self.find(x)]

    def same(self, x, y):
        """要素x,yは同一視されているか?

        x,y:要素
        """
        return self.find(x) == self.find(y)

    def members(self, x):
        """要素xが属している族の要素.
        ※族の要素の個数が欲しいときはsizeを使うこと!!

        x:要素
        """
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """族の名前のリスト
        """
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        """族の個数
        """
        return len(self.roots())

    def all_group_members(self):
        """全ての族の出力
        """
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
#================================================
N,M=map(int,input().split())
U=Union_Find(N)
for _ in range(M):
    a,b=map(int,input().split())
    U.union(a-1,b-1)

M=0
V=U.roots()
for v in V:
    M=max(M,U.size(v))

print(M)

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

using namespace std;

typedef long long ll;

int main(){
    int n,m;
    cin >> n >> m;
    ll k ;
    cin >> k;
    int a[n];
    for (int i = 0 ;i < n;i++) cin >> a[i];
    int b[m];
    for (int j = 0 ;j < m; j++) cin >> b[j];

    ll as[n+1],bs[m+1];
    as[0] = 0;
    bs[0] = 0;
    for (int i = 1; i <= n;i++){
        as[i] = as[i-1] + a[i-1];
    }
    for (int j = 1;j <= m;j++){
        bs[j] = bs[j-1] + b[j-1];
    }

    int ans = 0;
    int checkpointj = m;

    for (int i = 0 ;i <= n;i++){
        if(as[i] > k) break;
        while(bs[checkpointj] > k - as[i]) checkpointj--;
        ans = max(ans,i+checkpointj);
    }

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


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int H, W;
  cin >> H >> W;
  vector<int> A(H), B(H);
  for (int i = 0; i < H; i++) {
    cin >> A[i] >> B[i];
    A[i]--, B[i]--;
  }
  map<int, int> mp;
  multiset<int> res;
  for (int i = 0; i < W; i++) {
    mp[i] = i;
    res.insert(0);
  }
  for (int i = 0; i < H; i++) {
    auto it = mp.lower_bound(A[i]);
    int n = -1;
    while (it != mp.end() && it->first < B[i] + 2) {
      int x = it->first - it->second;
      n = max(n, it->second);
      res.erase(res.find(x));
      mp.erase(it++);
    }
    if (n != -1 && B[i] + 1 < W) {
      res.insert(B[i] + 1 - n);
      mp[B[i] + 1] = n;
    }
    if (!res.empty()) {
      cout << *res.begin() + i + 1 << '\n';
    } else {
      cout << -1 << '\n';
    }
  }
  return 0;
}


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

tri_d = {0:3, 1:5, 2:7}
tri = [0,1,2]

def tri_dec(lst):
  d = 0
  for l in lst:
    d *= 10
    d += tri_d[l]
  return d

def tri_inc(lst):
  lst[-1] += 1
  i = 1
  while lst[-i] > 2:
    if i == len(lst):
      lst.insert(0, -1)
    lst[-i] -= 3
    lst[-(i+1)] += 1
    i += 1
  if set(lst) != {0,1,2}:
    tri_inc(lst)
  return lst

count = 0
while tri_dec(tri) <= N:
  count += 1
  tri = tri_inc(tri)
print(count)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s, n) for(int i = s; i < (int)(n); i++)
#define co(x) cout<<x<<endl
#define SQvec(i,j) vector<vector<int>> data(i, vector<int>(j))
#define mod 1000000000+7
typedef long long int lint;

int main(){
  int A,B;
  string op;
  cin >> A >> op >> B;
  if(op == "+"){co(A + B);}
  else{co(A - B);}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;

using namespace std;

int main()
{
  int n, k;
  ll x[100000] = {};
  cin >> n >> k;
  REP(i, n)
  {
    cin >> x[i];
  }

  ll ans = INF;
  REP(i, n - k + 1)
  {
    if (x[i] <= 0 && x[i + k - 1] <= 0)
    {
      ans = min(ans, abs(x[i]));
    }
    if (x[i] < 0 && x[i + k - 1] > 0)
    {
      ans = min(ans, min(abs(x[i]) * 2 + x[i + k - 1], abs(x[i]) + x[i + k - 1] * 2));
    }
    if (x[i] >= 0 && x[i + k - 1] >= 0)
    {
      ans = min(ans, x[i + k - 1]);
    }
  }
  cout << ans << endl;
}


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

int main() {
    int n; 
    cin>>n; 
    int x = ceil(n/1.08);
    if(floor(x* 1.08)==n){
        cout<<x<<"\n";
    }else{
        cout<<":("<<"\n";
    }
    
}

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

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    ll x=a+b;
    ll sum = n / x*a;

    ll ama = n%x;
    if(ama>a){
        sum += a;
    }
    else{
        sum += ama;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp[4],tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

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

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

    cin>>a>>b>>c;
    if(a%2==0||b%2==0||c%2==0)Cout(0);
    else{
        tmp[0]=a;tmp[1]=b;tmp[2]=c;
        sort(tmp,tmp+3);
        Cout(tmp[0]*tmp[1]);
    }
    return 0;
}


Measured memory_bytes: 764
#include <vector>
#include <map>
#include <string>

using namespace std;

string inputWord() {
    char buf[256];
    scanf("%s", buf);
    return buf;
}

int inputInt() {
    int i;
    scanf("%d", &i);
    return i;
}

int N;
vector<string> S;
vector<string> W;
map<string, int> revW;
vector<int> C;

int main() {
    N = inputInt();
    S.resize(max((int)S.size(), N)); for(int i=0; i<N; ++i) S[i] = inputWord();
    W = vector<string>({"AC", "WA", "TLE", "RE"});
    for(int i=0; i<W.size(); ++i) revW[W[i]] = i;
    C.resize(max(C.size(), W.size())); for(int i=0; i<W.size(); ++i) C[i] = 0;
    for(int i=0; i<S.size(); ++i) ++C[revW[S[i]]];
    for(int i=0; i<W.size(); ++i) printf("%s %s %d\n", W[i].c_str(), "x", C[i]);
}


Measured memory_bytes: 5940
import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int ret = k;
        for (int i = 2;i <= n;i++) {
            ret *= (k-1);
        }
        System.out.println(ret);
    }
}


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

#define rep(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)

using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  unsigned n;
  cin >> n;

  vector <int64_t> a;
  copy_n (istream_iterator <decay_t <decltype (a.front ())>> (cin), n, back_inserter (a));

  vector <int64_t> ans (n);
  ans [0] = 0;
  
  rep (i, n) 
  {
    if (i % 2 == 0)
    {
      ans [0] += a [i];
    }
    else
    {
      ans [0] -= a [i];
    }
  }

  ans [0] /= 2;
  for (auto i = 1u; i < n; ++ i)
  {
    ans [i] = a [i - 1] - ans [i - 1];
  }
  for (auto && elem : ans)
  {
    elem *= 2;
  }
  
  copy (ans.begin (), ans.end (), ostream_iterator <decay_t <decltype (ans.front ())>> (cout, " "));
  cout << endl;
}


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}

int abs(int x){
    return x >= 0 ? x : -x;
}

int check(int &x){
    x = x*2;
    return x;
}

int main(){
    set<string> s;
    int n; cin >> n;

    rep(i,n){
        string q,t; cin >> q >> t;
        if(q == "insert"){
            s.insert(t);
        }else{
            if(s.count(t)){
                cout << "yes" << endl;
            }else{
                cout << "no" << endl;
            }
        }
    }

}


Measured memory_bytes: 32152
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 01/Mar/20 05:52:46 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	int n, m;
	cin >> n >> m;
	string x;
	fr (i, 0, n) x += '.';
	bool flag = 1;
	while (m--) {
		int s, c;
		cin >> s >> c;
		if (x[s - 1] == '.') {
			x[s - 1] = c + '0';
		} else {
			if (x[s - 1] != c + '0') flag = 0;
		}
	}
	if (!flag) {
		pr (-1);
		return 0;
	}
	fr (i, 0, n) if (x[i] == '.') {
		if (i == 0 and n != 1)
			x[i] = '1';
		else
			x[i] = '0';
	}

	if (n != 1 and x[0] == '0') x = "-1";
	pr (x);
	return 0;
}

Measured memory_bytes: 256
h,w=map(int,input().split())
cnt=[0]*26
for i in range(h):
	a=input()
	for j in range(w):
		cnt[ord(a[j])-ord("a")]+=1
if h%2==1 and w%2==1:
	f=0
	for i in range(26):
		if cnt[i]%2==1:
			cnt[i]-=1
			break
	four=0
	for i in range(26):
		if cnt[i]>=4:
			four+=cnt[i]//4*4
		elif cnt[i]%2==1:
			f=-1
			break
	if four>=h*w-(h//2+w//2)*2-1 and f==0:
		f=1
	else:
		f=0
elif h%2==0 and w%2==0:
	f=1
	for i in range(26):
		if cnt[i]%4!=0:
			f=0
			break
else:
	if h%2==0:
		h,w=w,h
	two=0;f=0
	for i in range(26):
		if cnt[i]%4==2:
			two+=2
		elif cnt[i]%2==1:
			f=-1
			break
	if two<=w and f==0:
		f=1
	else:
		f=0
print("Yes" if f else "No")

Measured memory_bytes: 9300
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int INF = 0x3f3f3f3f;
int knight_moves[8][2]={{-2,-1},{-1,-2},{1,-2},{2,-1},{-2,1},{-1,2},{1,2},{2,1}};
int moves[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	//#ifndef ONLINE_JUDGE
	//freopen("inputf.in","r",stdin);
	//freopen("outputf.in","w",stdout);
	//#endif

	int t;
	cin>>t;
	int n=1000;
	while(n<t)
	{
		n=n+1000;
	}
	//cout<<n<<endl;
	cout<<n-t;

	
}	

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

int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    long long int l,r,d,c=0;
    cin>>l>>r>>d;
    for(int i=l;i<=r;i++)
    {
        if(i%d==0)
        c++;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include<algorithm>
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int A[50]={};
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    A[a-1]+=1;
    A[b-1]+=1;
  }
  
  for(int i=0;i<n;i++){
    cout<<A[i]<<endl;
  }
    

  return 0;
  
}


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

void solve() {
    int h, w, n;
    cin >> h >> w >> n;
    swap(w, h);
    map<int, int> up;
    map<pair<int, int>, int> t;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        t[{x, y}] = 1;
        if (up[x] == 0) {
            up[x] = y;
        } else {
            up[x] = min(up[x], y);
        }
    }
    if (t[{2, 1}] == 1) {
        cout << "1\n";
        return;
    }
    int y = 1;
    for (int x = 2; x < w; ++x) {
        //cout << x << " " << y << "\n";
        if (t[{x, y + 1}] != 1) {
            y++;
        }
        if (y >= up[x + 1] && up[x + 1] != 0) {
            cout << x << "\n";
            return;
        }
    }
    cout << w << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}



Measured memory_bytes: 31232
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	string s;
	cin >> s;

	auto target = s[0];
	auto result = "Yes";
	if (target != s[1])
	{
		target = s[1];
		if (target != s[3])
		{
			result = "No";
		}
	}

	if (target != s[2])
	{
		result = "No";
	}
	cout << result << endl;

	return 0;
}

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

int main(){
 bool x[30];
 for(int z=0;z<30;z++){
	 x[z]=false;
 }
 int a;
 for(int i=0;i<28;i++){
	 cin>>a;
	 x[a-1]=true;
 }
 for(int j=0;j<30;j++){
	 if(x[j]==false)cout<<j+1<<endl;
	 }
 return 0;
 }



Measured memory_bytes: 3088
//Created by Kira

#include<bits/stdc++.h>
using namespace std;

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    
//DP on Trees : Standard Problem

//No two adjacent vertices be painted black
//dp[i][0] : number of ways to paint ith vertex black
//dp[i][1] : number of ways to paint ith vertex white

//dp[i][0] = product of dp[child][1]
//dp[i][1] = product of (dp[child][0] + dp[child][1])


const int N = 1e5 + 10;

ll dp[N][2];
vi g[N];

inline void mul_self(ll &a, ll b){
    a *= b;
    a %= mod;
}

void dfs(int v, int p){

    dp[v][0] = 1ll, dp[v][1] = 1ll;

    for(int child : g[v]){
        if(child != p){
            dfs(child, v);
          }
    }

    for(auto child : g[v]){
        if(child != p){
            mul_self(dp[v][0], dp[child][1]);
            mul_self(dp[v][1], (dp[child][0] + dp[child][1])%mod);
        }
    }

  
}

int main(){
   IOS

   int n; cin>>n;

   for(int i = 0; i < n-1; i++){
       int u, v;
       cin>>u>>v; u--, v--;

       g[u].pb(v), g[v].pb(u);
   }



   dfs(0, -1);


    cout<<(dp[0][0] + dp[0][1])%mod<<"\n";

}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1)
        res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 14208
#include <iostream>
#include <cstdlib>
#include <string>
#include <typeinfo>
#include <cstring>
#include <iostream>
using namespace std;
struct Node{int key;
Node *right, *left, *parent;};
Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else x = x->right;
    }
    z->parent = y;
    if(y == NIL)root = z;
    else if(z->key < y->key)y->left = z;
    else y->right = z;
}

void inorder(Node *u){
    if(u == NIL)return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
}
void preorder(Node *u){
    if(u == NIL)return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;
    
    cin >> n;
    
    for(i = 0; i < n; i++){
        cin >> com;
        if(com == "insert"){
        cin >> x;insert(x);
       }else if(com == "print"){
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }
    return 0;
}





Measured memory_bytes: 26588
import itertools
n=int(input())
s=[]
for _ in range(n):
  s.append(input())
m=[0]*5
p=['M','A','R','C','H']
for x in s:
  for i in range(5):
    if x[0]==p[i]:
      m[i] += 1
ans=0
for v in itertools.combinations(m,3):
  ans += v[0]*v[1]*v[2]
print(ans)

Measured memory_bytes: 9780
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m,x = inpl()
a = inpl()
for i in range(m):
    if a[i] >= x:
        break
print(min(i,m-i))

Measured memory_bytes: 38256
import java.io.*;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while (true) {
			String sz_input = br.readLine();
			String[] sz_num = sz_input.split(" ");
			int H = Integer.parseInt(sz_num[0]);
			int W = Integer.parseInt(sz_num[1]);
			
			if (H == 0 && W == 0) break;
			
			for (int y = 0; y < H; y++) {
				for (int x = 0; x < W; x++) {
					if (y == 0 || y == (H-1) || x == 0 || x == (W-1)) {
						System.out.print("#");
					} else {
						System.out.print(".");
					}
				}
				System.out.println();
			}
			
			System.out.println();
		}
	}
}

Measured memory_bytes: 31080
#include <iostream>

using namespace std;

int main()
{
    int n,m,k;
    cin>>n>>m>>k;
    int flag = 0;
    for(int i=0;i<=n;i++)  //行
    {
        for(int j=0;j<=m;j++)
        {
            int black = (n*m) - i*m - j*(n-i) + i*j;
            
            if(black == k)
            {
                flag = 1;
                break;
            }

        }
        if(flag) break;
    }
    if(flag == 1) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
N, M, Q = map(int, input().split())

LR = [list(map(int, input().split())) for _ in range(M)]
PQ = [list(map(int, input().split())) for _ in range(Q)]


def rectangle_sum(n):
    table = [[0 for _ in range(n)] for _ in range(n)]

    for l, r in LR:
        table[l - 1][r - 1] += 1

    for y in range(N):
        for x in range(1, N):
            table[y][x] += table[y][x - 1]

    for y in range(1, N):
        for x in range(N):
            table[y][x] += table[y - 1][x]
    return table


t = rectangle_sum(N)
for p, q in PQ:
    if p - 2 >= 0:
        tmp = t[q - 1][q - 1] - t[q - 1][p - 2] - t[p - 2][q - 1] + t[p - 2][p - 2]
    else:
        tmp = t[q - 1][q - 1]

    print(tmp)

Measured memory_bytes: 77280