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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

int main() {
    ll x;
    cin >> x;
    ll ans = x / 11 * 2;
    if (x % 11) {
        if (x % 11 <= 6) {
            ans++;
        } else {
            ans += 2;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using int64 = long long;

class UnionFind {
 public:
  UnionFind(int64 n) : par_(n), sizes_(n, 1) {
    for (int64 i = 0; i < n; ++i) {
      par_[i] = i;
    }
  }

  int64 find(int64 x) {
    if (x == par_[x])
      return x;
    return par_[x] = find(par_[x]);
  }

  void unite(int64 x, int64 y) {
    x = find(x);
    y = find(y);
    if (x == y)
      return;

    if (sizes_[x] < sizes_[y])
      swap(x, y);

    par_[y] = x;
    sizes_[x] += sizes_[y];
  }

  int64 size(int64 x) {
    x = find(x);
    return sizes_[x];
  }

 private:
  vector<int64> par_;
  vector<int64> sizes_;
};

struct Town {
  int64 x, y, i;
};
struct Route {
  int64 i, j, dist;
};

int main() {
  int64 n;
  cin >> n;
  vector<Town> towns(n);
  for (int64 i = 0; i < n; ++i) {
    cin >> towns[i].x >> towns[i].y;
    towns[i].i = i;
  }

  vector<Route> routes;
  sort(towns.begin(), towns.end(), [](const Town& a, const Town& b) {
      if (a.x == b.x) return a.y < b.y;
      return a.x < b.x;
    });
  for (int i = 1; i < n; ++i) {
    int64 d = towns[i].x - towns[i - 1].x;
    Route r {towns[i].i, towns[i-1].i, d};
    routes.push_back(r);
  }
  sort(towns.begin(), towns.end(), [](const Town& a, const Town& b) {
      if (a.y == b.y) return a.x < b.x;
      return a.y < b.y;
    });
  for (int i = 1; i < n; ++i) {
    int64 d = towns[i].y - towns[i - 1].y;
    Route r {towns[i].i, towns[i-1].i, d};
    routes.push_back(r);
  }
  sort(routes.begin(), routes.end(), [](const Route& a, const Route& b) {
      return a.dist < b.dist;
    });

  UnionFind uf(n);
  int64 ret = 0;
  for (auto& r : routes) {
    if (uf.find(r.i) == uf.find(r.j))
      continue;
    uf.unite(r.i, r.j);
    ret += r.dist;
  }
  cout << ret << "\n";

  return 0;
}


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

using namespace std;

int notnumber(int a) {
  if(a == 48) return 49;
  else return 48;
}

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

  int cont = 0;
  int ant = s[0];

  for(int i = 1; i < s.length(); i++) {
    if(s[i] == ant) {
      ant = notnumber(s[i]);
      cont++;
    } else ant = s[i];
  }

  ant = s[s.length()-1];
  int cont2 = 0;

  for(int i = s.length()-2; i >= 0; i--) {
    if(s[i] == ant) {
      ant = notnumber(s[i]);
      cont2++;
    } else ant = s[i];
  }

  cout << min(cont, cont2) << endl;

  return 0;
}

Measured memory_bytes: 512
//
// Created by yamunaku on 2020/01/13.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 10000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n;
    cin >> n;
    vector<double> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];
    double ans = IINF;
    double l = 0, r = IINF;
    rep(t, 200){
        double mid = (l+r)/2;
        bool ok = false;
        rep(i, n){
            repl(j, i + 1, n){
                double mx = (x[i] + x[j]) / 2, my = (y[i] + y[j]) / 2;
                double vx = mx - x[i], vy = my - y[i];
                double l2 = vx * vx + vy * vy;
                if(l2 > mid * mid) continue;
                vx = vx / sqrt(l2), vy = vy / sqrt(l2);
                double d = sqrt(mid * mid - l2);
                double rx = mx + d * vy, ry = my - d * vx;
                rep(k, n){
                    if((rx - x[k]) * (rx - x[k]) + (ry - y[k]) * (ry - y[k]) > mid * mid * 1.0000000001){
                        goto next;
                    }
                }
                ok = true;
                next:;
                mx = (x[i] + x[j]) / 2, my = (y[i] + y[j]) / 2;
                vx = mx - x[i], vy = my - y[i];
                l2 = vx * vx + vy * vy;
                if(l2 > mid * mid) continue;
                vx = vx / sqrt(l2), vy = vy / sqrt(l2);
                d = sqrt(mid * mid - l2);
                rx = mx + d * vy, ry = my - d * vx;
                rep(k, n){
                    if((rx - x[k]) * (rx - x[k]) + (ry - y[k]) * (ry - y[k]) > mid * mid * 1.0000000001){
                        goto next2;
                    }
                }
                ok = true;
                next2:;
            }
        }
        if(ok){
            r = mid;
        }else{
            l = mid;
        }
    }
    CST(10);
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())

n_c = min(x, y) * 2
n_a = x - n_c // 2
n_b = y - n_c // 2
amount1 = a * n_a + b * n_b + c * n_c

n_c = max(x, y) * 2
n_a = max(x - n_c // 2, 0)
n_b = max(y - n_c // 2, 0)
amount2 = a * n_a + b * n_b + c * n_c

n_a = x
n_b = y
n_c = 0
amount3 = a * n_a + b * n_b + c * n_c

amount = min(amount1, amount2, amount3)

print(amount)

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define PI acos(-1.0)

typedef long long ll;
const int maxn=1e5+10;
ll max1[maxn],max2[maxn];
ll sum,n,c,maxx,ans;
ll v[maxn],x[maxn];

int main()
{
    cin >> n >> c;
    for(int i=0;i<n;i++)
        cin >> x[i] >> v[i];
    for(int i=0;i<n;i++)
    {
        if(i==0)
            sum+=v[i]-x[i];
        else
            sum+=(v[i]-x[i]+x[i-1]);
        ans=max(ans,sum);
//        maxx=max(ans,maxx);
        max1[i]=ans;
    }
    maxx=max(ans,maxx);
//    cout << maxx << endl;
    ans=sum=0;
    for(int i=n-1;i>=0;i--)
    {
        if(i==n-1)
            sum+=(v[i]-c+x[i]);
        else
            sum+=(v[i]-x[i+1]+x[i]);
        ans=max(ans,sum);
        max2[i]=ans;
    }
    maxx=max(ans,maxx);
//    cout << maxx << endl;
    sum=ans=0;
//    for(int i=0;i<n;i++)
//    {
//        printf("%lld %lld\n",max1[i],max2[n-1-i]);
//    }
    for(int i=0;i<n-1;i++)
    {
        if(i==0)
            sum+=(v[i]-2*x[i]);
        else
            sum+=(v[i]-2*(x[i]-x[i-1]));
        maxx=max(maxx,sum+max2[i+1]);
    }
    sum=0;
    for(int i=n-1;i>0;i--)
    {
        if(i==n-1)
            sum+=(v[i]-2*(c-x[i]));
        else
            sum+=(v[i]-2*(x[i+1]-x[i]));
        maxx=max(maxx,sum+max1[i-1]);
//        cout << maxx << endl;
    }
    cout << maxx << endl;
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

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

    if (N % (2 * D + 1) == 0) {
        cout << N / (2 * D + 1) << endl;
        return 0;
    }
    cout << N / (2 * D + 1) + 1 << endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] moves = Console.ReadLine().ToCharArray();
            int moveLength = moves.Count();
            char[] difficultSteps = new char[] { 'L', 'R' };
            bool isDifficult = false;
            for(int i = 0; i < moveLength; i++)
            {
                if (moves[i] == difficultSteps[i % 2])
                {
                    isDifficult = true;
                    break;
                }
            }
            Console.WriteLine(isDifficult ? "No" : "Yes");
        }

    }
}


Measured memory_bytes: 13268
from fractions import Fraction
import math

n = int(input())


ab = []
ba = []

a0 = 0
b0 = 0
ab0 = 0


def irr(a, b):
    gcd = math.gcd(a, b)
    a = a // gcd
    b = b // gcd

    if b < 0:
        return (-a, -b)
    else:
        return (a, b)


for i in range(n):
    a, b = map(int, input().split())
    if a != 0 and b != 0:
        ab.append(irr(a, b))
        ba.append(irr(-b, a))
    elif a == 0 and b == 0:
        ab0 += 1
    elif a == 0 and b != 0:
        a0 += 1
    elif a != 0 and b == 0:
        b0 += 1


d_ab = dict()
d_ba = dict()

# d_done = dict()

for i in range(len(ab)):
    cur = ab[i]
    if cur in d_ab:
        d_ab[cur] += 1
    else:
        d_ab[cur] = 1

    cur = ba[i]
    if cur in d_ba:
        d_ba[cur] += 1
    else:
        d_ba[cur] = 1

mod = 1000000007
ans = 1

d_done = set()

for k, v in d_ab.items():
    x = v
    if k in d_ba:
        if k in d_done:
            continue
        else:
            y = d_ba[k]
            kake = 0
            kake += ((2**x) % mod + (2**y) % mod - 1)
            ans *= kake
            ans %= mod
            # d_done[Fraction(-k.denominator, k.numerator)] = 1
            d_done.add(irr(-k[1], k[0]))
    else:
        kake = (2**x) % mod
        ans *= kake
        ans %= mod

ans *= ((2**a0) % mod+(2**b0) % mod-1)
ans %= mod

ans -= 1

ans += ab0
ans %= mod

print(ans)


Measured memory_bytes: 89536
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();

    int mai= n;
    rep(i, n-1) {
        if(s[i] != s[i+1]) {
            mai = min(mai, max(i+1, n-i-1));
        }
    }

    cout << mai << endl;
}

Measured memory_bytes: 3712
/*"You can do anything you set your mind to,man" - Eminem*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define llpow(a,b) (ll)(pow(a,b)+0.5)
#define l_b(a,val) min((int)a.size()-1, (int)(lower_bound(a.begin(),a.end(),val)-a.begin()))
#define f first
#define up(a,b) max(a,b)
#define s second
#define INF 9223372036854775807
const  int mod = 1000000007;
// template <typename T> T add(T& a, T b){a+=b;while(a>=mod)a-=mod;while(a<0)a+=mod;}
// template <typename T> T mul(T& a, T b){ a = a*b%mod;}
//template <typename T> T up_self(T& a, T b){a = up(a,b);}
template <typename T> T min_self(T& a, T b){a = min(a,b);}
// ll binexpomodulo(ll x, ll y){ll res =1;x%=mod;if(!x)return 0;while(y){if(y&1){mul(res, x);}mul(x,x);y>>=1;}return res;}
// ll nCrInOr(ll n, ll r){ll res = 1;if(r>n-r)r = n-r;ll rin = 1;for(ll i = 1; i <=r ; i++)rin = (rin*i)%mod;rin = binexpomodulo(rin,mod-2);for(ll i = 1; i <= r; i++)res = (res*(n-i+1))%mod;res = (res*rin)%mod;return res;}
int msb(ll n){int ans;for(int i = 0 ; i < 64;  i++)if(n&(1LL<<i))ans = i+1;return ans;}
/*All the macros below are copied from nik_y(OG)*/
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define all(c) c.begin(),c.end()
#define endl "\n"
#define get(a,n) fl(i,0,n)  cin>>a[i];
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;


int mul(int a, int b)
{
	return (ll)a*b%mod;
}
void add(int&a, int b) {
    a += b;
    if(a >= mod) {
        a -= mod;
    }
}
int n;
struct M{
	vector<vector<int>> t;

	M(){
		t.resize(n,vector<int>(n));
	}
	M operator* (const M& b) const{
		M c = M();
		for(int i = 0 ; i < n; i++){
			for(int j = 0 ; j < n; j++){
				for(int k = 0 ; k < n; k++){
					add(c.t[i][k], mul(t[i][j],b.t[j][k]));
				}
			}
		}
		return c;
	}
};
int main()
{
	Shazam;
	ll k; cin>>n>>k;
	vector<vector<int>> can(n,vector<int>(n));
	for(int i = 0 ; i < n; i++)
		for(int j = 0; j < n ;j++)
			cin>>can[i][j];
	M answer = M();
	for(int i =0 ; i < n ;i++){
		answer.t[i][i] = 1;
	}
	M m = M();
	m.t = can;

	
	while(k){
		if(k%2){
			answer = answer*m;
		}
		m = m*m;
		k/=2;
	}
	int ans = 0;
	for(int i = 0 ; i < n ;i++)
		for(int j = 0 ; j < n; j++)
			add(ans,answer.t[i][j]);
		
	
	cout<<ans<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<endl
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<endl
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}

int main(){
	fast();
	inp(n);
	inpv(a,n);
	ll mx = a[0]-1;
	for(int i=1; i<n; i++){
		if(a[i]==mx){
			continue;
		}
		else if(a[i]-1==mx){
			a[i]--;
		}
		else if(a[i]>mx){
			a[i]--;
			mx = max(a[i], mx);
		}
		else{
			out("No");
			return 0;
		}
	}
	out("Yes");
}

Measured memory_bytes: 1400
n = int(input())
*p, = map(int, input().split())

ans = 0
for i in range(1, n-1):
    mi = min(p[i-1], p[i], p[i+1])
    ma = max(p[i-1], p[i], p[i+1])
    if mi < p[i] and p[i] < ma:
        ans += 1

print(ans)


Measured memory_bytes: 3060
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.

*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;

int mod = 1000000007;
ll dp[100005];
const ll INF = 1e18;

ll gcd(long long a,long long b){

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


bool sortbyval(const pair<string, int> &a,
               const pair<string, int> &b)
{
    return (a.second < b.second);
}

int main(){

 int a,p;
 cin>>a>>p;

 int pieces = a*3;

 p += pieces ;

 cout<<p/2<<endl;

return 0;
}



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

int H,W;

int main() {
  cin >> H >> W;
  vector<vector<char>> A(H+2,vector<char>(W+2,'#'));
  int all=0;
  for (int i=0;i<H;i++) {
    for (int j=0;j<W;j++) {
      cin >> A.at(i+1).at(j+1);
      if (A.at(i+1).at(j+1)=='.') all++;
    }
  }
  vector<int> St={1,1,1};
  queue<vector<int>> Q;
  Q.push(St);
  int count=all+1;
  while (!Q.empty()) {
    vector<int> x=Q.front();
    if (x.at(0)==H && x.at(1)==W) {
      count=x.at(2);
      break;
    }
    Q.pop();
    if (A.at(x.at(0)-1).at(x.at(1))=='.') {
      Q.push(vector<int>{x.at(0)-1,x.at(1),x.at(2)+1});
      A.at(x.at(0)-1).at(x.at(1))='#';
    }
    if (A.at(x.at(0)+1).at(x.at(1))=='.') {
      Q.push(vector<int>{x.at(0)+1,x.at(1),x.at(2)+1});
      A.at(x.at(0)+1).at(x.at(1))='#';
    }
    if (A.at(x.at(0)).at(x.at(1)-1)=='.') {
      Q.push(vector<int>{x.at(0),x.at(1)-1,x.at(2)+1});
      A.at(x.at(0)).at(x.at(1)-1)='#';
    }
    if (A.at(x.at(0)).at(x.at(1)+1)=='.') {
      Q.push(vector<int>{x.at(0),x.at(1)+1,x.at(2)+1});
      A.at(x.at(0)).at(x.at(1)+1)='#';
    }
  }
  cout << all-count << endl;
}


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

int main() {
    ll X;
    cin >> X;
    ll a = X % 500;
    ll ans = 0;
    ans = 1000*(X/500) + 5*(a/5);
    cout << ans; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sort_(a) sort(a.begin(), a.end())
#define sum(a) accumulate(a.begin(), a.end(), 0)
#define rep(i, n) for (int i = 0; i < n; ++i)
typedef long long unsigned int ll;
const long mod = 1e9 + 7;

int main(void) {
#ifdef DEBUG
  freopen(".testcase", "r", stdin);
#endif

  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int A, B, C;
  cin >> A >> B >> C;
  int n = A * B;
  for (int i = 1; i <= n; ++i) {
    if ((A * i) % B == C) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}


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

using namespace std;

using button_t = std::pair<int, int>;

int64_t solve(const std::vector<button_t>& buttons) {
  int64_t ret = 0;
  for (auto itr = buttons.crbegin(); itr != buttons.crend(); itr++) {
    const auto& button = *itr;
    int const a = (button.first + ret) % button.second;
    if (a) {
      ret += button.second - a;
    }
  }
  return ret;
}

int main() {
  int n;
  std::cin >> n;
  std::vector<button_t> buttons(n);
  for (auto& button : buttons) {
    std::cin >> button.first >> button.second;
  }
  std::cout << solve(buttons) << std::endl;
  return 0;
}

Measured memory_bytes: 1024
from sys import stdin
from collections import Counter

input = stdin.readline

S = list(input())
T = list(input())


def main():
    C1 = Counter(S).most_common()
    C2 = Counter(T).most_common()

    if len(C1) != len(C2):
        print("No")
        return

    flg = True
    for i in range(len(C1)):
        if C1[i][1] != C2[i][1]:
            flg = False

    print("Yes" if flg else "No")
    return


main()


Measured memory_bytes: 6832
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a,b,c = f()
    if (a*100 + b*10 +c )%4 == 0:
        print('YES')
    else:
        print('NO')

solve()


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

int main(void)
{
  int n;
  scanf("%d", &n);
  int i = 0;
  while (n >= pow(10, i)){
    i++;
  }
  int ans = 0;
  for (int j = 1; j < i; j += 2){
    ans += 9 * pow(10, j - 1);
  }
  if (i % 2 == 1){
    ans += n - pow(10, i - 1) + 1;
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
int mod=100000;
int dp[2][50][3001];
void add(int& x,int y){
	x+=y;
	if(x>=mod) x-=mod;
}
int main(){
	while(true){
		int n,m,s;
		scanf("%d%d%d",&n,&m,&s);
		if(n==0) break;
		n=n*n;
		rep(j,n+1) rep(k,s+1) dp[0][j][k]=0;
		dp[0][0][0]=1;
		rep(i,m){
			rep(j,n+1) rep(k,s+1) dp[1-i%2][j][k]=0;
			rep(j,n+1){
				rep(k,s+1){
					if((i*2+1+n-j)*(n-j)/2>s) break;
					add(dp[1-i%2][j][k],dp[i%2][j][k]);
					if(j+1<=n&&k+i+1<=s) add(dp[1-i%2][j+1][k+i+1],dp[i%2][j][k]);
				}
			}
		}
		cout<<dp[m%2][n][s]<<endl;
	}
}

Measured memory_bytes: 2368
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <map>
#include <climits>

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

int main()
{
  int n, k, d, a;
  cin >> n >> k;
  vector<bool> snk(n, false);
  rep(i, k)
  {
    cin >> d;
    rep(j, d)
    {
      cin >> a;
      snk[a-1] = true;
    }
  }

  int ans = 0;
  rep(i, n)
  {
    if(!snk[i])
      ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3616
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);

  ll N; cin>>N;
  vector<vector<int>> F(N,vector<int>(10)); rep(i,N) rep(j,10) cin>>F[i][j];
  vector<vector<ll>> P(N,vector<ll>(11)); rep(i,N) rep(j,11) cin>>P[i][j];
  
  ll ans=-INF;
  rep(i,1<<10){
    if(i==0) continue;
    ll sans=0;
    rep(j,N){
      ll count=0;
      rep(k,10) if(i&F[j][k]<<k) count++;
      sans+=P[j][count];
    }
    chmax(ans,sans);
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 3676
#include <stdio.h>

int a,b,c,d ;

int main(void){
    
    scanf ("%d%d%d%d",&a,&b,&c,&d) ;
    
    if ( a*b>c*d ){
        printf ("%d",a*b) ;
        
    } else {
        printf ("%d",c*d) ;
        
    }
    
    return 0 ;
}

Measured memory_bytes: 128
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        int ans = 0;
        
        int[] p = new int[N];
        
        for(int i = 0 ; i < N ; i++){
            p[i] = sc.nextInt();
        }
        
        Arrays.sort(p);
        
        for(int i = 0 ; i < K ; i++){
            ans = ans + p[i];
        }
        
        System.out.println(ans);
        
    }    
}


Measured memory_bytes: 30172
S = input()
if S[0] == "A":
  if S[2:-1].count("C") == 1:
    if S.count("C") == 1:
      S = S.replace("A", "", 1)
      S = S.replace("C", "")
      if S.islower():
        print("AC")
      else:
        print("WA")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;

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

    long long sum = 0;
    map<long long, long long> T;
    for(long long i = 0; i < n; i++){
        long long a;
        cin >> a;
        sum += a;
        if(T.find(a) == T.end()) T[a] = 1;
        else T[a]++;
    }
    long long q;
    cin >> q;

    vector<long long> ans;
    for(long long i = 0; i < q; i++){
        long long b, c;
        cin >> b >> c;
        if(T.find(b) == T.end()){
            ans.push_back(sum);
            continue;
        }

        long long cnt = T[b];
        T[b] = 0;
        if(T.find(c) == T.end()) T[c] = cnt;
        else T[c] += cnt;

        sum -= b * cnt;
        sum += c * cnt;
        ans.push_back(sum);
    }

    for(auto v : ans) printf("%lld\n", v);

    return 0;
}

Measured memory_bytes: 9168
#include <iostream>
#include <string.h>
#include <algorithm>

using namespace std;
int main(void){
    // Your code here!
    int N;
    string S;
    
    cin >> N;
    cin >> S;
    int ans = 0;
    for(int i = 0;i < N - 2;i++){
        if(S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C'){
            ans++;
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 384
n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==k:
    suma=sum(a)
    m=a[0]+1
    for i in range(1,n):
        x=a[i]
        if x>=m:
            m=x+1
        else:
            a[i]=m
            m+=1
    print(sum(a)-suma)
    exit()
ans=15*10**10
for i in range(2**(n-1)):#1番目は確定だから
    cnt,s,mh=0,0,a[0]+1
    for j in range(n-1):
        if i>>j&1:
            cnt+=1
            x=a[j+1]
            if x>=mh:
                mh=x+1
            else:
                s+=mh-x
                mh+=1
        else:
            mh=max(mh,a[j+1]+1)
    if cnt>=k-1:
        ans=min(ans,s)
print(ans)

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

#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x)      begin(x),end(x)

using namespace std;

using vecint = vector<int>;
using ll = int64_t;

int main()
{
  string s;
  cin>>s;
  int k;
  cin>>k;
  int n=s.size();
  REP(i,n-1) {
    int to_a = ('z' - s[i] + 1) % 26;
    if (to_a <= k) {
      s[i] = 'a';
      k -= to_a;
    }
  }
  s[n-1] = (s[n-1] - 'a' + k) % 26 + 'a';
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 512
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int ans = Math.max(A + B ,Math.max(A - B,  A * B));
    System.out.println(ans);
    }
}

Measured memory_bytes: 22996
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	int N; cin >> N;
	rep(i, 0, N) {
		int x, y, b, p; cin >> x >> y >> b >> p;
		cout << min(
			x*b + y*p,
			(x*max(5, b) + y*max(2, p)) * 4 / 5
		) << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include<stdio.h>
long long a[100010];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%lld",&a[i]);
    int zero=0;
    for(int i=0;i<n;i++)
        if(a[i]==0)zero++;
    if(zero >0)
        {
            printf("0\n");
            return 0;
        }
            long long prod=1;
    for(int i=0;i<n;i++)
        {if(a[i]<=1000000000000000000/prod)
        {
            prod*=a[i];
        }
    else{
            printf("-1\n");
             return 0;
    }
        }
        printf("%lld",prod);
        return 0;
}


Measured memory_bytes: 2504
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	cin >> N;
	vector< int > P(N);
	rep(i, N) cin >> P[i];
	//reverse(P.begin(), P.end());
	int c = LINF;
	int ans = 0;
	rep(i, N) {
		if (c >= P[i]) {
			ans++;
		}
		chmin(c, P[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<vector>
using namespace std;
  
int bit[1000000],bit_n;
int sum(int i){
  int s=0;
  while(i){
    s+=bit[i];
    i-=i&-i;
  }
  return s;
}
void add(int i,int x){
  while(i<=bit_n){
    bit[i]+=x;
    i+=i&-i;
  }
}
  
struct data{
  int time,type,l,r;
  bool operator < (const data &p)const{
    return (time==p.time?type<p.type:time<p.time);
  }
};
// 1 | add
// 2 - check
// 3 | delete
  
int n;
vector<data> t;
vector<int> X;
map<int,int> mapx;
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    X.push_back(a);
    X.push_back(c);
    if(a==c){
      t.push_back((data){min(b,d),1,a,a});
      t.push_back((data){max(b,d),3,a,a});
    }else{
      t.push_back((data){b,2,min(a,c),max(a,c)});
    }
  }
  sort(t.begin(),t.end());
  sort(X.begin(),X.end());
  int c=2;
  for(int i=0;i<(int)X.size();i++)
    if(i==0||X[i]!=X[i-1])
      mapx[X[i]]=c++;
    
  bit_n=n*2+1;
  long long ans = 0;
  for(int i=0;i<(int)t.size();i++){
    data d=t[i];
    d.l=mapx[d.l],d.r=mapx[d.r];
    if(d.type==1){
      add(d.l,1);
    }else if(d.type==2){
      long long A=sum(d.r)-sum(d.l-1);
      ans+=A;
    }else if(d.type==3){
      add(d.l,-1);
    }
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 9828
#include<stdio.h>

int main(){
  char str[3], a;
  str[2] = 0;
  scanf("%s", str);
  if(str[2] != 0){
    a = str[0];
    str[0] = str[2];
    str[2] = a;
  }
    printf("%s\n", str);
  
 
  return 0;
}


Measured memory_bytes: 128
using System;
class Program
{
  static void Main (string[] args)
  {
    string[] input = Console.ReadLine().Split(' ');
    int r = int.Parse(input[0]);
    int D = int.Parse(input[1]);
    int x = int.Parse(input[2]);
    
    for (int i = 0; i < 10; i++)
    {
      x = r * x - D;
      Console.WriteLine(x);
    }
  }
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for (auto&& u : s) cin >> u;
  vector<bool> bh(h, false), bw(w, false);
  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') {
      bh[i] = true;
      bw[j] = true;
    }
  }
  vector<string> ans;
  rep(i, h) {
    if (bh[i] == false) continue;
    string s0 = "";
    rep(j, w) {
      if (bw[j] == true) s0.push_back(s[i][j]);
    }
    ans.push_back(s0);
  }
  for (auto&& u : ans) cout << u << endl;
}

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

dp = [-1]*(N+1)
dp[0] = 0
dp[1] = 1
for i in range(1, N+1):
    if dp[i] == -1:
        dp[i] = dp[i-1] + 1
        k = 6
        while i >= k:
            dp[i] = min(dp[i], dp[i-k]+1)
            k *= 6
        l = 9
        while i >= l:
            dp[i] = min(dp[i], dp[i-l]+1)
            l  *= 9
print(dp[N])

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

int main() {
	int a, b, c, d, e, f, g, l;
	while (cin >> a >> b) {
		c = a; d = b;
		e = a; f = b;
		while (1) {
			if (a >= b) {
				a %= b;
				if (a == 0) { g = b; break; }
			}
			else if (a<b) {
				b %= a;
				if (b == 0) { g = a; break; }
			}
		}
		while (1) {
			if (c>d) d += f;
			else if (c < d) c += e;
			if (c == d) { l = c; break; }
		}
		cout << g << " " << l << endl;
	}
}

Measured memory_bytes: 1160
import java.io.*;
import java.lang.*;
import java.util.*;
import java.math.*;

class Main{
	static int imax=Integer.MAX_VALUE;
	static long lmax=Long.MAX_VALUE;
	
	public static void main(String[] args) throws FileNotFoundException{
	
		Scanner sc=new Scanner(System.in);
		int[] num=readlnI(sc," ");
		int n=num[0]*100+num[1]*10+num[2];
		puts( n%4==0 ? "YES" : "NO");
		}//main_end
	
	//utility
	static int readI(Scanner sc){
		return Integer.parseInt(sc.nextLine().trim());
	}
	static long readL(Scanner sc){
		return Long.parseLong(sc.nextLine().trim());
	}
	static String readS(Scanner sc){
		return sc.nextLine().trim();
	}
	static int[] readlnI(Scanner sc, String dl){
		return Arrays.stream(sc.nextLine().trim().split(dl)).mapToInt(Integer::parseInt).toArray();
	}
	static long[] readlnL(Scanner sc, String dl){
		return Arrays.stream(sc.nextLine().trim().split(dl)).mapToLong(Long::parseLong).toArray();
	}
	static String[] readlnS(Scanner sc, String dl){
		return sc.nextLine().trim().split(dl);
	}
	@SuppressWarnings("unchecked")
	static <T> void puts(T... args){
		for(int i=0; i<args.length-1; i++){
			System.out.printf("%s ",args[i]);
		}
		System.out.println(args[args.length-1]);
	}
	static void puts(int[] ary){
		for(int i=0; i<ary.length-1; i++){
			System.out.printf("%d ",ary[i]);
		}
		System.out.println(ary[ary.length-1]);
	}
	static void puts(long[] ary){
		for(int i=0; i<ary.length-1; i++){
			System.out.printf("%d ",ary[i]);
		}
		System.out.println(ary[ary.length-1]);
	}
	static void bs(){
		System.out.println("");
	}
	static void tblSort(int[][] tbl){
		Arrays.sort(tbl, new Comparator<int[]>(){
			@Override
			public int compare(int[] a, int[] b){
				if(a[0]==b[0]){
					return b[1]-a[1];
				}else{
					return b[0]-a[0];
				}
			}
		});
	}
}


Measured memory_bytes: 26836
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 998244353
#define INF 1000000000000000000

int main(){
  int N;
  cin>>N;
  vector<pair<pair<int,int>,int>> xy(N);
  for(int i=0;i<N;i++){
    cin>>xy[i].first.first>>xy[i].first.second;
    xy[i].second=i;
  }
  sort(xy.begin(),xy.end());

  vector<int> m(N),M(N);
  m[0]=xy[0].first.second;
  for(int i=1;i<N;i++){
    m[i]=min(m[i-1],xy[i].first.second);
  }
  M[N-1]=xy[N-1].first.second;
  for(int i=N-2;i>=0;i--){
    M[i]=max(M[i+1],xy[i].first.second);
  }
  vector<int> cnt(N,1);
  for(int i=1;i<N;i++){
    if(m[i-1]<M[i]){
      cnt[i]=cnt[i-1]+1;
    }
  }
  vector<int> ans(N);
  int count=cnt[N-1];
  ans[xy[N-1].second]=count;
  for(int i=N-2;i>=0;i--){
    if(cnt[i+1]==1){
      count=cnt[i];
    }
    ans[xy[i].second]=count;
  }
  for(int i=0;i<N;i++){
    cout<<ans[i]<<endl;
  }
}


Measured memory_bytes: 8804
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
using P=pair<int,int>;

signed _main(){
  int N,K; cin >> N >> K;
  v<int> p(N);
  rep(i,N){
    cin >> p[i];
  }
  sort(ALL(p));
  int ans=0;
  rep(i,K){
    ans+=p[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3664
n = int(input())
h = list(map(int,input().split()))
 
t = 0
result =0
 
for i in range(n-1):
  if h[i] >= h[i+1]:
    t += 1
  else:
    result = max(t,result)
    t = 0
 
result = max(t, result)
 
print(result)

Measured memory_bytes: 14224
N, W = map(int, raw_input().split())
X = [map(int, raw_input().split()) for _ in range(N)]
 
dp = {}
dp[0] = 0
 
for w, v in X:
    d = dp.copy()
    for k in d:
        if k + w > W:
            continue
        if k + w in dp:
            dp[k + w] = max(dp[k + w], d[k] + v)
        else:
            dp[k + w] = d[k] + v
 
print max(dp.values())

Measured memory_bytes: 3544
using System;

public class Hello
{
    public static void Main()
    {
        int num = int.Parse(Console.ReadLine());
        string[] x = Console.ReadLine().Split(' ');
        string[] y = Console.ReadLine().Split(' ');

        // p1-p3,???????¨????
        double p1 = 0;
        double p2 = 0;
        double p3 = 0;
        double p = 0;
        for (int i = 0; i < num; i++)
        {
            double diff = Math.Abs(double.Parse(x[i]) - double.Parse(y[i]));
            p1 += diff;
            p2 += Math.Pow(diff, 2.0);
            p3 += Math.Pow(diff, 3.0);
            p = Math.Max(p, diff);
        }

        Console.WriteLine(p1.ToString("F6"));
        Console.WriteLine(Math.Pow(p2, 1.0 / 2.0).ToString("F6"));
        Console.WriteLine(Math.Pow(p3, 1.0 / 3.0).ToString("F6"));
        Console.WriteLine(p.ToString("F6"));
    }
}

Measured memory_bytes: 9424
main :: IO ()
main = do
    a <- getLine
    b <- getLine
    c <- getLine
    putStrLn $ (solve (a,b,c)):[]


solve = solveAux 'a'

solveAux :: Char -> (String,String,String) -> Char
solveAux 'a' ([],_,_) = 'A'
solveAux 'b' (_,[],_) = 'B'
solveAux 'c' (_,_,[]) = 'C'

solveAux 'a' (x:a,b,c) = solveAux x (a,b,c)
solveAux 'b' (a,x:b,c) = solveAux x (a,b,c)
solveAux 'c' (a,b,x:c) = solveAux x (a,b,c)





Measured memory_bytes: 508
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 1000010
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

ll fac[maxn], ifac[maxn];
const ll p = 1000003;
template <class T> void read (T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
ll pw(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1)
      ret = ret * a % p;
    a = a * a % p, b >>= 1;
  }
  return ret;
}
void solve() {
  ll a, b, n;
  read(a), read(b), read(n);
  if (!b)
    return printf("%lld\n", pw(a, n)), void();
  ll x = a * pw(b, p - 2) % p;
  if (x + n - 1 >= p || !x)
    return puts("0"), void();
  printf("%lld\n", fac[x + n - 1] * ifac[x - 1] % p * pw(b, n) % p);
}
void init() {
  fac[0] = 1;
  for (int i = 1; i < p; i++) {
    fac[i] = fac[i - 1] * i % p;
  }
  ifac[p - 1] = pw(fac[p - 1], p - 2);
  for (int i = p - 2; ~i; i--) {
    ifac[i] = ifac[i + 1] * (i + 1) % p;
  }
}
int main() {
  int T;
  for (read(T), init(); T--; solve());
  return 0;
}

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

A, B = map(int, input().split())

P = list(map(int, input().split()))

k1 = 0
k2 = 0
k3 = 0

for i in range(N):
    if P[i]<=A:
        k1 = k1+1
    elif P[i]<=B:
        k2 = k2+1
    else:
        k3 = k3+1
      
ans = [k1, k2, k3]    
    
print(min(ans))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b;
  cin >> a >> b;
  int t=1;
  int ans=0;
  while(t<b){
    t+=a-1;
    ans++;
  }
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

void solve() {
  ll N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  ll p[] = {2, 3, 5};
  ll c[] = {A, B, C, D};
  priority_queue<ll> q;
  map<ll, ll> mp;
  q.push(N);
  mp[N] = 0;
  while(!q.empty()) {
    ll tmp = q.top();
    q.pop();
    rep(i, 3) {
      ll ne = tmp/p[i];

      if(!mp.count(ne)) {
        mp[ne] = longinf;
        q.push(ne);
      }
      mp[ne] = min(mp[tmp]+(tmp-ne*p[i])*c[3]+c[i], mp[ne]);

      if(!mp.count(ne+1)) {
        mp[ne+1] = longinf;
        q.push(ne+1);
      }
      mp[ne+1] = min(mp[tmp]+((ne+1)*p[i]-tmp)*c[3]+c[i], mp[ne+1]);

      mp[ne+1] = min(mp[ne]+c[3], mp[ne+1]);
      mp[ne] = min(mp[ne+1]+c[3], mp[ne]);

      if(mp[tmp]+(tmp-q.top())*c[3] > 0) mp[q.top()] = min(mp[tmp]+(tmp-q.top())*c[3], mp[q.top()]);
    }
  }
  cout << mp[0] << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  rep(t, T) solve();
  return 0;
}


Measured memory_bytes: 4892
N = int(input())
A = list(map(int, input().split()))

l, r = 0, 0
SUM, XOR = 0, 0
ans = 0

for l in range(N):
    while r < N and SUM == XOR:
        SUM += A[r]
        XOR ^= A[r]
        r += 1

    if SUM == XOR:
        r = N+1

    ans += r-l-1

    SUM -= A[l]
    XOR ^= A[l]

print(ans)

Measured memory_bytes: 24712
#include <stdio.h>
int main(){
  int r,d,x;
  int y[20];
  scanf("%d %d %d",&r,&d,&x);
  y[0]=x;
  for(int i=0;i<10;i++){
    y[i+1]=y[i]*r-d;
    printf("%d\n",y[i+1]);
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int cnt = 0;
        for (int i = 0; i < n - 1; i++) {
            if (a[i] == a[i + 1]) {
                cnt++;
                a[i + 1] += 100;
            }
        }

        System.out.println(cnt);
    }

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


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

int main() {
  	ios::sync_with_stdio(false);
  	cin.tie(NULL);
 	int n;
  	cin >> n;
  	if (n < 1000) {
      cout << "ABC" << endl;
    } else {
      cout << "ABD" << endl;
    }
	return 0;
}

Measured memory_bytes: 256
/**
 *    author:  math2do
 *    created: 04.09.2020 18:04:55 IST
**/

#include <bits/stdc++.h>

using namespace std;

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };
 
  vector<edge> edges;
  vector<vector<int>> g;
  int n;
 
  graph(int _n) : n(_n) {
    g.resize(n);
  }
 
  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;
 
  digraph(int _n) : graph<T>(_n) {
  }
 
  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }
 
  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_toposort(const digraph<T> &g) {
  vector<int> deg(g.n, 0);
  for (int id = 0; id < (int) g.edges.size(); id++) {
    deg[g.edges[id].to]++;
  }
  vector<int> x;
  for (int i = 0; i < g.n; i++) {
    if (deg[i] == 0) {
      x.push_back(i);
    }
  }
  for (int ptr = 0; ptr < (int) x.size(); ptr++) {
    int i = x[ptr];
    for (int id : g.g[i]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (--deg[to] == 0) {
	x.push_back(to);
      }
    }
  }
  if ((int) x.size() != g.n) {
    return vector<int>();
  }
  return x;
}


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  digraph <int> g(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g.add(x, y);
  } 
  
  vector <int> from = find_toposort(g);
  vector <int> dp(n, 0);
  for (int u : from) {
    for (int id : g.g[u]) {
      int v = g.edges[id].from ^ g.edges[id].to ^ u;
      dp[v] = max(dp[v], 1 + dp[u]);
    }
  } 
  
  int ans = *max_element(dp.begin(), dp.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 11096
a,b,m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = min(a)+min(b)

for i in range(m):
    x,y,c = map(int, input().split())
    ans = min(ans, a[x-1]+b[y-1]-c)
print(ans)


Measured memory_bytes: 18612
n,m = map(int,input().split())
li=[0]*n
ans=[0,0]
for i in range(m):
    p,s=input().split()
    p=int(p)
    if li[p-1]>=0:
        if s=="WA":
            li[p-1]+=1
        elif s=="AC":
            ans[0]+=1
            ans[1]+=li[p-1]
            li[p-1]=-1
print(*ans)

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define ll long long int
#define ci cin>>
#define co cout<<
#define l <<endl
#define mp make_pair
#define v vector<int> v;
#define vv vector<vector<int>> vv
#define v_print for(auto x:v){cout<<x<<"\n";}
#define floop(i,a,b) for(int i=a;i<b;i++)
#define w(n) while(n--)
#define mod 1000000007
using namespace std;

long long int A[100003];
long long int INF= INT_MAX;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	fill(A,A+100003,INF);
	ll n,k,j;	ci n>>k;
	ll h[n];
	floop(i,0,n)
	{
		ci h[i];
	}
	A[0]=0;
	//A[1]=abs(h[1]-h[0]);
	floop(i,0,n)
	{
		j=1;
		while((j<=k)&&((i+j)<n))
		{
			A[i+j]=min(A[i+j],abs(h[i]-h[i+j])+A[i]);
			j++;
		}
	}
	co A[n-1];

}


Measured memory_bytes: 1792