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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  string s; cin >> s;
  string ans;
  for (int i = 0; i < (int)s.size(); i += 2) ans += s[i];
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <queue>
#define int long long
using namespace std;

signed main() {
	int K;
	cin >> K;
	
	queue<int> que;
	for (int i = 1; i <= 9; i++) que.push(i);
	while (!que.empty()) {
		int x = que.front(); que.pop();
		K--;
		if (K == 0) { cout << x << endl; break; }
		
		for (int y = (x % 10) - 1; y <= (x % 10) + 1; y++) {
			if (y < 0 || y >= 10) continue;
			que.push(x * 10 + y);
		}
	}
	return 0;
}

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

int main(){
  vector<vector<int>> A(3,vector<int>(3));
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> A.at(i).at(j);
    }
  }
  
  int N;
  cin >> N;
  
  vector<int> B(N);
  for(int k=0; k<N; k++){
    cin >> B.at(k);
  }
  
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<N; k++){
        if(A.at(i).at(j)==B.at(k)){
          A.at(i).at(j)=0;
        }
      }
    }
  }
  
  string ans="No";
  if(A.at(0).at(0)==0 && A.at(0).at(1)==0 && A.at(0).at(2)==0){ans="Yes";}
  if(A.at(1).at(0)==0 && A.at(1).at(1)==0 && A.at(2).at(2)==0){ans="Yes";}
  if(A.at(2).at(0)==0 && A.at(2).at(1)==0 && A.at(2).at(2)==0){ans="Yes";}
  if(A.at(0).at(0)==0 && A.at(1).at(0)==0 && A.at(2).at(0)==0){ans="Yes";}
  if(A.at(0).at(1)==0 && A.at(1).at(1)==0 && A.at(2).at(1)==0){ans="Yes";}
  if(A.at(0).at(2)==0 && A.at(1).at(2)==0 && A.at(2).at(2)==0){ans="Yes";}
  if(A.at(0).at(0)==0 && A.at(1).at(1)==0 && A.at(2).at(2)==0){ans="Yes";}
  if(A.at(0).at(2)==0 && A.at(1).at(1)==0 && A.at(2).at(0)==0){ans="Yes";}
  
  cout << ans << endl;
 
}

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<pair<pair<int,int>,int>> city(M);
  int p,y;
  for(int i=0;i<M;i++){
    cin>>p>>y;
    city[i].first.first=y;
    city[i].first.second=p;
    city[i].second=i;
  }
  vector<int> nth(N+1,1);
  vector<ll> ans(M,0);
  sort(city.begin(),city.end());
  for(int i=0;i<M;i++){
    ans[city[i].second]=city[i].first.second*1e6+nth[city[i].first.second];
    nth[city[i].first.second]++;
  }
  for(int i=0;i<M;i++){
    printf("%012lld\n",ans[i]);
  }
  return 0;
}



Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}

int main(){
    ll n,k;cin>>n>>k;
    vi v(n);
    rep(i,n)cin>>v[i];
    sort(all(v));reverse(all(v));
    vi dp(k+1);
    dp[k]=1;
    rep(i,n){
        vi ndp(k+1);
        rep(j,k+1){
            ndp[j%v[i]]+=dp[j];
            ndp[j]+=dp[j]*(n-i-1)%mod;
        }
        rep(i,k+1)ndp[i]%=mod;
        dp=ndp;
    }
    ll ans=0;
    rep(i,k+1){
        ans+=i*dp[i];
        ans%=mod;
    }
    out(ans);
}

Measured memory_bytes: 1792
import random
import sys
sys.setrecursionlimit(10**5 + 10)


def main():
    n = input()
    edges = []
    nodes = [0] * n
    children = {i: [] for i in xrange(n)}
    for _ in xrange(n - 1):
        a, b = map(int, raw_input().split())
        a -= 1
        b -= 1
        edges.append([a, b])
        nodes[a] += 1
        nodes[b] += 1
        children[a].append(b)
        children[b].append(a)

    cc = map(int, raw_input().split())
    cc.sort(reverse=True)
    ans = [0] * n

    def dfs(node, visited):
        for nex in children[node]:
            if nex in visited:
                continue
            visited.add(nex)
            dfs(nex, visited)
        ans[node] = cc.pop()

    while True:
        start = random.randrange(n)
        if len(children[start]) > 1:
            break
    dfs(start, {start})

    score = 0
    for a, b in edges:
        score += min(ans[a], ans[b])
    print score
    print ' '.join(map(str, ans))


if __name__ == '__main__':
    main()


Measured memory_bytes: 119708
t = [0]
x = [0]
y = [0]
n = int(input())
for i in range(n):
  ti, xi, yi = map(int,input().split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True 
for i in range(1,n+1):
  if (t[i]-t[i-1]) < (x[i]-x[i-1]+y[i]-y[i-1]):
    flg = False
  elif ((t[i]-t[i-1])%2) != ((x[i]-x[i-1]+y[i]-y[i-1])%2):
    flg = False
if(flg):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 11816
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
#define int ll

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ld pi = 3.14159265358979;
    double r;cin >> r;
    cout << fixed << setprecision(10);
    cout << r * 2.0 * pi << endl;
}

Measured memory_bytes: 3768
#include <iostream>
#include <iomanip>
#include <functional>
#include <string>
#include <vector>
#include <algorithm>
 
using namespace std;

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

    switch (X) {
        case 3:
        case 5:
        case 7:
            cout << "YES";
            break;
        default:
            cout << "NO";
    }

    return 0;
}


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

using ll = int_fast64_t;

map<ll,ll> prime_factorize(ll n){
  map<ll,ll> res;
  for(ll p=2;p*p<=n;++p){
    while(n%p==0){
      res[p]++;
      n/=p;
    }
  }
  if(n!=1)res[n]++;
  return res;
}

constexpr long long MOD = (1e9+7);
constexpr ll COM_MAX = (ll)1e6;
vector<ll> fac(COM_MAX),finv(COM_MAX),inv(COM_MAX);
// 前処理
void comb_init(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<COM_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;
  }
}
// 二項係数計算
ll comb(ll n,ll k){
  if(n<k)return 0;
  if(n<0||k<0)return 0;
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
// 重複組み合わせ
ll nHk(ll n,ll k){
  return comb(n+k-1,k-1);
}


signed main(){

  ll n,m;
  cin>>n>>m;

  auto pfac = prime_factorize(m);
  ll ans = 1;
  comb_init();
  for(auto x:pfac){
    ans *= nHk(x.second,n);
    ans %= MOD;
  }
  cout<<(ans)<<endl;

}

Measured memory_bytes: 23808
def inpl(): return [int(i) for i in input().split()]

c11, c12, c13 = inpl()
c21, c22, c23 = inpl()
c31, c32, c33 = inpl()
for a1 in range(1,101):
    b1 = c11-a1
    a2 = c21-b1
    a3 = c31-b1
    b2 = c12-a1
    b3 = c13-a1
    if a2+b2 != c22 or\
    a2+b3 != c23 or\
    a3+b2 != c32 or\
    a3+b3 != c33:
        continue
    print('Yes')
    break
else:
    print('No') 

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>
#include <stdio.h>
using namespace std;
 

class Dice{
public:
    int labels[6];

    Dice(int *s){
        for(int i=0;i<6;i++){
            labels[i] = s[i];
        }        
    }
    
    void update_state(char c){
        int tmp;
        switch(c){
            case 'N':
                tmp = labels[0];
                labels[0] = labels[1];
                labels[1] = labels[5];
                labels[5] = labels[4];
                labels[4] = tmp;
                break;
            case 'S':
                tmp = labels[0];
                labels[0] = labels[4];
                labels[4] = labels[5];
                labels[5] = labels[1];
                labels[1] = tmp;
                break;
            case 'W':
                tmp = labels[0];
                labels[0] = labels[2];
                labels[2] = labels[5];
                labels[5] = labels[3];
                labels[3] = tmp;
                break;
            case 'E':
                tmp = labels[0];
                labels[0] = labels[3];
                labels[3] = labels[5];
                labels[5] = labels[2];
                labels[2] = tmp;
                break;
        }
    }

    void roll(){
        int tmp = labels[1];
        labels[1] = labels[3];
        labels[3] = labels[4];
        labels[4] = labels[2];
        labels[2] = tmp;     
    }
    
};


int main(){
    int labels[6];
    for(int i=0;i<6;i++){
        cin >> labels[i];
    }
    Dice dice(labels);

    int q; cin >> q;
    int nt, nf;
    for(int i=0;i<q;i++){
        cin >> nt >> nf;
        if(nt==dice.labels[3]){
            dice.update_state('E');
        }else if(nt==dice.labels[2]){
            dice.update_state('W');
        }
        while(nt != dice.labels[0]){
            dice.update_state('N');
        }
        while(nf != dice.labels[1]){
            dice.roll();
        }
        cout << dice.labels[2] << endl;
    }
    return 0;

}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back


#define L_B lower_bound
#define U_B upper_bound

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf (1000*1000*1000+5)
#define mod 1000000007
#define maxn 100009
#define maxr 100009

void solve()
{
	ll h,n;
	rl2(h,n);
	ll sum=0;
	fr(i,0,n)
	{
		ll x;
		rl(x);
		sum+=x;
	}
	if(sum>=h)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	NL;
}
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	solve();
	return 0;
}

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

int N;
bool able = true;
vector<pair<int, int>> work;

bool comp(pair<int, int> a, pair<int, int> b){
  if(a.second != b.second)
    return a.second < b.second;
  else
    return a.first < b.first;
}

int main(){
  cin >> N;

  for(int i = 0; i < N; i++){
    int time, dead;
    cin >> time >> dead;
    work.push_back(make_pair(time, dead));
  }

  sort(work.begin(), work.end(), comp);

  uint64_t sum = 0;
  for(int i = 0; i < N; i++){
    sum += work[i].first;
    if(sum > work[i].second)
      able = false;
  }

  if(able)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}
    
  

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

int H, W;
char S[20][20];
int rowperm[20];
bool row_used[20];

bool is_match(int j1, int j2){
    for(int i = 0; i < H; i++){
        if(S[rowperm[i]][j1] != S[rowperm[H - 1 - i]][j2]){
            return false;
        }
    }
    return true;
}

bool rec(int depth){
    if(depth == H / 2){
        for(int i = 0; i < W; i++){
            bool used[20] = {};
            if(W % 2){
                if(!is_match(i, i)){
                    continue;
                }
                used[i] = true;
            }
            
            for(int j = 0; j < W; j++){
                if(used[j]) continue;
                used[j] = true;
                bool ok = false;
                for(int k = 0; k < W; k++){
                    if(used[k]) continue;
                    if(j == k) continue;
                    if(is_match(j, k)){
                        used[k] = true;
                        ok = true;
                        break;
                    }
                }
                if(!ok) break;
            }

            int cnt = 0;
            for(int i = 0; i < W; i++)
                if(used[i]) cnt++;
            
            if(cnt == W) return true;

            if(W % 2 == 0) break;

            if(W % 2) used[i] = false;
        }
        return false;
    }
    else{
        int start = -1;
        for(int i = 0; i < H; i++){
            if(row_used[i]) continue;
            start = i;
            break;
        }

        row_used[start] = true;
        rowperm[depth] = start;

        for(int i = start + 1; i < H; i++){
            if(row_used[i]) continue;
            rowperm[H - 1 - depth] = i;
            row_used[i] = true;
            if(rec(depth + 1))
                return true;
            row_used[i] = false;
        }
        row_used[start] = false;
    }
    return false;
}

bool solve(){
    if(H % 2){
        for(int i = 0; i < H; i++){
            row_used[i] = true;
            rowperm[H / 2] = i;
            if(rec(0)){
                return true;
            }
            row_used[i] = false;
        }
        return false;
    }
    else{
        return rec(0);
    }
}

int main(){
    cin >> H >> W;
    for(int i = 0; i < H; i++) cin >> S[i];
    if(solve()){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << 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)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  // rep(i, 10) {
  //   cout << i << endl;
  // }
  string s;
  cin >> s;

  int easy = 1; // Yes
  rep(i, s.length()) {
    // kisuu
    if ((i+1) % 2 == 1) {
      if (s.substr(i, 1) == string("R") || s.substr(i, 1) == string("U") || s.substr(i, 1) == string("D")) {
        // do nothing
      }
      else {
        easy = 0; // No
      }
    }
    // guusuu
    if ((i+1) % 2 == 0) {
      if (s.substr(i, 1) == string("L") || s.substr(i, 1) == string("U") || s.substr(i, 1) == string("D")) {
        // do nothing
      }
      else {
        easy = 0; // No
      }
    }
  }

  if (easy == 1) {
    cout << string("Yes") << endl;
  }
  else {
    cout << string("No") << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main(){
ll n,m,r;
cin>>n>>m>>r;
ll c[r]={};
rep(i,r){
  cin>>c[i];
  c[i]--;}
  sort(c,c+r);
  vvl dist(n, vl(n,INF));
  for(ll i=0; i<m; i++){
    ll a,b,c; cin>>a>>b>>c;
    dist[a-1][b-1]=c;
    dist[b-1][a-1]=c;}
  
  for (ll k = 0; k < n; k++){       // 経由する頂点
    for (ll i = 0; i < n; i++) {    // 始点
      for (ll j = 0; j < n; j++) {  // 終点
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
ll ca = 1;
  for(ll i=1; i<=r; i++){
    ca*=i;}
  ll ans = INF;
  ll cb = 0;
  for(ll i=0; i<ca; i++){
    next_permutation(c,c+r);
    cb = 0;
    for(ll j=0; j<r-1; j++){
      cb += dist[c[j]][c[j+1]];}
    ans = min(ans,cb);
  }
  cout << ans << endl;}
  
    
  
  
    


Measured memory_bytes: 3944
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(true)
    {
        c-=b;
        if(c<=0)
        {
            cout<<"Yes";
            break;
        }
        a=a-d;
        if(a<=0)
        {
            cout<<"No";
            break;
        }
    }
}

Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
    int N,A,B,x,max;
    scanf("%d%d%d",&N,&A,&B);
    max=N*A;
    if(max<B)
    {
        x=max;
    }
    else if(max>B)
    {
        x=B;
    }
    else if(max==B)
    {
        x=B;
    }
    printf("%d\n",x);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e8;
typedef pair<int,int> P;

ll fact(ll n) {
   if (n == 0 || n == 1)
      return 1;
   else
      return n * fact(n - 1);
}

int main(){
  ll N;cin>>N;
  string s;
  map<string,ll> mp;
  ll ans=0;
  REP(i,0,N){
    cin>>s;
    sort(s.begin(),s.end());
    if(mp.count(s)>0){ans+=mp[s];mp[s]++;}
    else mp[s]=1;
  }
  print(ans)
  return 0;

}


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

int main() {

    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    //Write code below
    
    int a, b;
    
    cin >> a >> b;
    
    int tap = 1, number = 0;
    
    for (number; ; number++) {
        if (a * number - (number - 1) >= b) {
            cout << number << endl;
            exit(0);
        }
    }
}


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

int main(void){
    
    int H,W;
    cin >> H >>W;
    string S[H];
    
    for(int i = 0; i < H;i++) cin >> S[i];
    
    
    queue<pair<int,int>> queue;
    int F[H][W];
    
    for(int i = 0; i < H;i++){
        for(int j = 0; j < W;j++ ){
            F[i][j] = 0;
            if(S[i][j]=='#'){
                F[i][j] = 1;
                queue.push(make_pair(i,j));
            }
        }
    }
    
    
    int h,w;
    int cont = 0;
    bool flag = true;
    while(queue.size()){
        
        flag = false;
        // for(int i = 0; i < H;i++){
        //     for(int j = 0; j < W;j++ ){
        //         cout << S[i][j]<<" ";
                
        //         if(S[i][j]=='.') flag = true; 
        //     }
        //     cout << endl;
        // }
        // cout <<"------------------------"<<endl;

            
        //cout << h <<" "<< w << endl;
        h = queue.front().first;
        w = queue.front().second;
        cont = F[h][w];
            
        queue.pop();
            
        if(h < H - 1){
            if(S[h+1][w]!='#'){
                queue.push(make_pair(h+1,w));
                S[h+1][w]='#';
                F[h+1][w]=cont+1;
            }
        }
            
        if(0 < h){
            if(S[h-1][w]!='#'){
                queue.push(make_pair(h-1,w));
                S[h-1][w]='#';
                F[h-1][w]=cont+1;
            }
        }
            
        if(w < W - 1){
            if(S[h][w+1]!='#'){
                queue.push(make_pair(h,w+1));
                S[h][w+1]='#';
                F[h][w+1]=cont+1;
            }
        }
            
        if(0 < w){
            if(S[h][w-1]!='#'){
                queue.push(make_pair(h,w-1));
                S[h][w-1]='#';
                F[h][w-1]=cont+1;
            }
        }
        

        
    }
    
    cout << cont -1  << endl;    
    
}


Measured memory_bytes: 13456
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int n;
  cin >> n;
  vi cnt(55556,1);
  cnt[0] = cnt[1] = 0; //cnt[0] は１が素数かどうか
  rep(i, 55556){
    if(cnt[i]){
      if(i % 5 != 1) cnt[i] = 0;
      for(int j = i + i; j < 55555; j += i) cnt[j] = 0;
    }
  }
  int count = 0;
  rep(i, 55555){
    if(cnt[i]){
      count++;
      if(count != n) cout << i << " ";
      else{
        cout << i << endl;
        return 0;
      }
    }
  }
}

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


using namespace std;

vector<int> vec(30);

bool compare(int a, int b)
{
	return a > b;
}

int main()
{
	
	
	int n,k;
	scanf("%d %d",&n,&k);
	
	for (int i = 0; i < n; i++)
	{
		char s[20];
		scanf("%s",s);
//		printf("!%d\n",s[0]-'A');
		vec[s[0]-'A']++;
	}
	
	int count = 0;
	while(1)	
	{
		sort(vec.begin(), vec.end(), compare);
		
		int f = 1;
		for (int i = 0; i < k; i++)
		{
			if (vec[i] == 0)
				f = 0;
		}
		
		if (f)
		{
			for (int i = 0; i < k; i++)
				vec[i]--;							
			
			count++;
		}
		else
			break;
				
	}
	
	printf("%d\n",count);
	
	return 0;
}


Measured memory_bytes: 256
#! /usr/bin/env python3

N, A, B, C, D = map(int, input().split())

a = abs(A - B)
b = abs(D - C)
l = 0
r = 0
p = 0

for i in range(N-1):
    if p < a:
        p += C
        r += b
    else:
        p -= C
        l += b
        
if p <= a:
    print('YES' if p+r >= a else 'NO')
else:
    print('YES' if p-l <= a else 'NO')

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;

ll ans, mx, mn = 1e8, flag, sum, cnt;

int main(){
	ll n;
	cin>>n;
	for(int i=n; i<= 100000; i++){
		if(i%111==0) {
			cout<<i<<endl;
			return 0;
		}
	}
}


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

int main(){
    map<int,int> mp;
    int n,k;
    cin >> n >> k;

    for ( int i = 0 ; i < n ; i++ ){
        int l;
        cin >> l;
        if ( mp.find(l) == mp.end() ) mp[l] = 1;
        else mp[l]++;
    }

    vector<int> ans(0);
    for ( auto itr = mp.begin(); itr != mp.end() ; itr++){
        ans.push_back(itr -> second);
    }
    sort(ans.begin(),ans.end());
    int64_t cnt = 0;
    if ( ans.size() > k ){
        for ( int i = 0 ; i < ans.size()-k ; i++ ){
            cnt += ans.at(i);
        }
    }
    cout << cnt << endl;
}

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

int main()
{
    int n;
    while (cin >> n)
    {
	int w=1,f=0;
	for (int i=0;i<10;i++)
	{
	    if (n&w)
	    {
		if (f==1)
		    cout << " ";
		f=1;
		cout << w;
	    }
	    w*=2;
	}
	cout << endl;
    }
    return 0;
}

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

#define ll long long

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int>r,g,b;
    for(int i=0; i<n; i++)
    {
        if(s[i]=='R')
        {
            r.push_back(i+1);
        }
        else if(s[i]=='G')
        {
            g.push_back(i+1);
        }
        else
        {
            b.push_back(i+1);
        }
    }
    ll ans = r.size()*b.size()*g.size();

    for(int i=0; i<r.size(); i++)
    {
        for(int j=0; j<g.size(); j++)
        {
            int p=r[i];
            int q=g[j];
            if((p+q)%2==0&&binary_search(b.begin(),b.end(),(p+q)/2))
            {
                ans--;
            }
            if(binary_search(b.begin(),b.end(),2*p-q))
            {
                ans--;
            }
            if(binary_search(b.begin(),b.end(),2*q-p))
            {
                ans--;
            }
        }
    }
    cout<<ans<<endl;


}


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

typedef long long ll;

const ll Maxb = 41;

int n;
ll k;
int ones[Maxb], zers[Maxb];
ll mask;
ll all[Maxb], best[Maxb];

int main()
{
    scanf("%d %lld", &n, &k);
    for (int i = 0; i < n; i++) {
        ll a; scanf("%lld", &a);
        for (ll j = 0; j < Maxb; j++)
            if (a & 1ll << j) ones[j]++;
            else zers[j]++;
    }
    all[0] = max(ones[0], zers[0]);
    best[0] = bool(k & 1ll)? all[0]: ones[0];
    for (ll j = 1; j < Maxb; j++) {
        all[j] = ll(max(ones[j], zers[j])) * (1ll << j) + all[j - 1];
        if (k & 1ll << j)
            best[j] = max(ll(ones[j]) * (1ll << j) + all[j - 1], ll(zers[j]) * (1ll << j) + best[j - 1]);
        else best[j] = ll(ones[j]) * (1ll << j) + best[j - 1];
    }
    cout << best[Maxb - 1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

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

    int count = n / 2;
    if(0 != n % 2){
        ++count;
    }

    std::string ans = "NO";
    if(k <= count){
        ans = "YES";
    }

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

    return 0;
}

Measured memory_bytes: 256
class Dice():
  def __init__ (self):
    # 1:ue 2:syomen 3:migi 4:hidari 5:oku 6:shita
    self.position = [0,0,0,0,0,0]
    self.search_result = []
  
  def setNumber (self, num):
    for i,x in enumerate(num):
      self.position[i] = x
    #print(self.position)
      
  def roll(self, roll):
    for i in range(len(roll)):
      s = roll[i:i+1]
      p = self.position
      if s == 'E':
        self.setNumber([p[3], p[1], p[0], p[5], p[4], p[2]])
      elif s == 'W':
        self.setNumber([p[2], p[1], p[5], p[0], p[4], p[3]])
      elif s == 'S':
        self.setNumber([p[4], p[0], p[2], p[3], p[5], p[1]])
      elif s == 'N':
        self.setNumber([p[1], p[5], p[2], p[3], p[0], p[4]])
      elif s == 'R':
        self.setNumber([p[0], p[2], p[4], p[1], p[3], p[5]])

  def printTop(self):
    print(self.position[0])

  def searchRight(self, a, b):
    i1 = self.position.index(a)
    i2 = self.position.index(b)
    #print("i1:" + str(i1) + " i2:" + str(i2) )
    
    # 0
    if (i1 == 1 and i2 == 2) or (i1 == 2 and i2 == 4) or (i1 == 4 and i2 == 3) or (i1 == 3 and i2 == 1):
      self.search_result.append(self.position[0])
    # 1
    elif (i1 == 0 and i2 == 3) or (i1 == 3 and i2 == 5) or (i1 == 5 and i2 == 2) or (i1 == 2 and i2 == 0):
      self.search_result.append(self.position[1])
    # 2
    elif (i1 == 0 and i2 == 1) or (i1 == 1 and i2 == 5) or (i1 == 5 and i2 == 4) or (i1 == 4 and i2 == 0):
      self.search_result.append(self.position[2])
    # 3
    elif (i1 == 1 and i2 == 0) or (i1 == 0 and i2 == 4) or (i1 == 4 and i2 == 5) or (i1 == 5 and i2 == 1):
      self.search_result.append(self.position[3])
    # 4
    elif (i1 == 0 and i2 == 2) or (i1 == 2 and i2 == 5) or (i1 == 5 and i2 == 3) or (i1 == 3 and i2 == 0):
      self.search_result.append(self.position[4])
    # 5
    elif (i1 == 2 and i2 == 1) or (i1 == 1 and i2 == 3) or (i1 == 3 and i2 == 4) or (i1 == 4 and i2 == 2):
      self.search_result.append(self.position[5])
    
  def printResult(self):
    for i in self.search_result:
      print (i)
  
  def isSame(self, d):
    for r in ["", "R", "R", "R", 
              "RE",  "R", "R", "R",
              "RE",  "R", "R", "R",
              "RE",  "R", "R", "R",
              "RS",  "R", "R", "R",
              "RNN", "R", "R", "R"]:
      self.roll(r)
      #print(self.position)
      if self.position == d.position:
        return True
    return False

dices = []
n = int(input())

for i in range(n):
  n = list(int(x) for x in input().split())

  d = Dice()
  d.setNumber(n)

  dices.append(d)

result = True
for i in range(len(dices)):
  if result == False:
    break

  for j in range(i+1, len(dices)):
    #print ("check:" + str(i) + "," + str(j))
    if dices[i].isSame(dices[j]):
      result = False
      break

if result == True:
  print("Yes")
else:
  print ("No")


Measured memory_bytes: 5748
package main

import (
	"fmt"
	"sort"
)

func main() {
	var L [3]int
	var ans string
	fmt.Scan(&L[0], &L[1], &L[2])

	sort.Ints(L[:])

	C := [3]int{5, 5, 7}

	if L == C {
		ans = "YES"
	} else {
		ans = "NO"
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int f=1;
	if(s.size()%2==1) cout <<"No" ;
	else{
		for(int i=0;i<s.size()/2;i++) {
			if(s[i]==s[i+s.size()/2]) ;
			else {
				f=0;
				break;
			}
		}
		if(f) cout <<"Yes" ;
		else  cout <<"No" ;
	} 
	
	
	return 0;
} 

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int r = scan.nextInt();
    int D = scan.nextInt();
    int x_2000 = scan.nextInt();
    
    for (int i = 0; i < 10; i++) {
      x_2000 = r * x_2000 - D;
      System.out.println(x_2000);
    }
  }
}

Measured memory_bytes: 21716
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, char, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

const ll mod = 1000000007;

int main(void)
{
	ll n;
	cin >> n;
	set<ll> s;
	rep(i, n) {
		ll a;
		cin >> a;
		s.insert(a);
	}
	if (s.size() == n) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<cmath>

int main(){
  int n,a[10000],cnt=0;
  
  std::cin>>n;
  
  for(int i=0;i<n;i++){
    std::cin>>a[i];
  }
  
  for(int i=0;i<n;i++){
    int j;
    for(j=2;j<=(int)sqrt(a[i]);j++){
      if(a[i]%j==0) break;
    }
    
    if(j>(int)sqrt(a[i])){
      cnt++;
    }
  }
  
  std::cout<<cnt<<'\n';
  
  return 0;
}



Measured memory_bytes: 3068
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String ans = (a % 2 == 1) && (b % 2 == 1) ? "Odd" : "Even";

		System.out.println(ans);
    }

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define FOR(i,j,k,inc) for(int i=j ; i<k ; i+=inc)
#define rep(i,n) FOR(i,0,n,1)
#define rfor(i,k,j,dec) for(int i=k-1 ; i>=j ; i-=dec)
#define repr(i,n) rfor(i,n,0,1)

int main()
{	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	int x,n;
	cin >>x>>n;
	if(n==0) {cout<<x; return 0;}
	vector<int>arr(n,0);
	for(int i=0 ; i<n ; i++) 
		cin>>arr[i];

	for(int i=0 ;; i++)
	{
		auto it1=find(arr.begin(),arr.end(),x-i);
		if(it1==arr.end()) {cout<<x-i;break;}
		auto it2=find(arr.begin(),arr.end(),x+i);
		if(it2==arr.end()) {cout <<x+i;break;}
	}
	return 0;


}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    ll n,k;
    cin>>n>>k;
    cout<<min(n%k,abs((n%k)-k))<<endl;
}

Measured memory_bytes: 3636
def main():
    K = int(input())

    def gcd(a, b):
        d = a % b
        return b if d == 0 else gcd(b, d)

    #    total = (K + 1) * K // 2
    total = 0

    dp = [[0] * (K + 2) for _ in range(K + 2)]

    sub0 = (K + 1) * K // 2

    sub1 = 0
    for a in range(1, K + 1):
        for b in range(a + 1, K + 1):
            v = gcd(a, b)
            dp[a][b] = v
            sub1 += v

    sub2 = 0
    for a in range(1, K + 1):
        for b in range(a + 1, K + 1):
            ab = dp[a][b]
            for c in range(1, K + 1):
                sub2 += gcd(ab, c)

    total += sub0 + sub1 * 2 + sub2 * 2

    print(total)


if __name__ == "__main__":
    main()


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

const double PI = acos(-1);

int main() {
  int a,b,h,m;
  cin >> a >> b >> h >> m;

  //針の角度を求める
  double th = double(h*60+m)/720 * 2 * PI;//長針
  double tm = double(m)/60 * 2 * PI;//短針

  //余弦定理から座標を求める
  double xh = a*cos(th),yh = a*sin(th);
  double xm = b*cos(tm),ym = b*sin(tm);

  double dx = xh-xm,dy = yh-ym;
  double ans = sqrt(dx*dx + dy*dy);

  printf("%.10f\n",ans);
}

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

ll choose2(ll n){
  return n*(n-1)/2;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n,0);
  rep(i,n){
    cin >> a[i];
    a[i]--;
    b[a[i]]++;
  }
  ll total = 0;
  for (int x : b) total+=choose2(x);
  for (int c : a){
    ll ans=total;
    ans -= choose2(b[c]);
    ans += choose2(b[c]-1);
    cout << ans <<endl;
  }
  return 0;
}


Measured memory_bytes: 4096
n = int(input())
lis = []
a = 0
b = 0
for _ in range(n):
  x,y = input().split()
  a += int(y)
  lis.append((x, int(y)))
x = input()
cnt = 0
for i in range(n):
    b += lis[i][1]
    if lis[i][0] == x:
        break
print(a-b)

Measured memory_bytes: 3064
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    ll a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    ll w=min(a+b,2*c);
    int v=min(x,y);

    ll sum=w*v;
    
    if(x>y){
        sum+=(x-y)*a;
        
        ll tmp=sum;
        
        if(a+b<2*c){
            int cnt=y;
            while(tmp<=sum && cnt>=0){
                sum=tmp;
                tmp=sum-a-b+2*c;
                cnt--;
            }
        }else{
            int cnt=x-y;
            while(tmp<=sum && cnt>=0){
                sum=tmp;
                tmp=sum-a+2*c;
                cnt--;
            }
        }

    }else{
        sum+=(y-x)*b;
        
        ll tmp=sum;

        if(a+b<2*c){
            int cnt=x;
            while(tmp<=sum && cnt>=0){
                sum=tmp;
                tmp=sum-a-b+2*c;
                cnt--;
            }
        }else{
            int cnt=y-x;
            while(tmp<=sum && cnt>=0){
                sum=tmp;
                tmp=sum-b+2*c;
                cnt--;
            }
        }
    
    }

    cout << sum << endl;
}

Measured memory_bytes: 3600
let constr x y =
  let ly = Array.length y in
  let z = Array.(init (length x * ly) (fun i -> x.(i / ly) + y.(i mod ly))) in
  Array.sort (fun x y -> y - x) z; z
let () =
  Scanf.scanf "%d %d %d %d" @@ fun x y z k ->
  let a = Array.init x (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let b = Array.init y (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let c = Array.init z (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let ab = constr a b in
  let abc = constr (Array.sub ab 0 (min (x * y) k)) c in
  Array.sub abc 0 k |> Array.iter (Printf.printf "%d\n");

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

using namespace std;

typedef long long ll;
typedef vector<ll> v1;

const ll mod = 1000000007;

ll m;
ll d[200000];
ll c[200000];
ll ans = 0;
ll x;

int main(){
  cin >> m;
  for(ll i = 0;i < m;i++) cin >> d[i] >> c[i];
  x = d[0];
  c[0]--;
  for(ll i = 0;i < m;i++){
    set<ll> s;
    s.insert(x);
    while(c[i] > 0){
      c[i]--;
      x = x+d[i];
      ans++;
      if(x > 9){
        x = x%10+1;
        ans++;
      }
      if(s.count(x)) break;
      s.insert(x);
    }
    if(c[i] == 0) continue;
    ll y = x;
    ll cnt = 0;
    ll add = 0;
    while(c[i] > 0){
      c[i]--;
      cnt++;
      x = x+d[i];
      ans++;
      add++;
      if(x > 9){
        x = x%10+1;
        ans++;
        add++;
      }
      if(x == y) break;
    }
    if(c[i] == 0) continue;
    ll p = c[i]/cnt;
    ans += add*p;
    c[i] %= cnt;
    while(c[i] > 0){
      c[i]--;
      x = x+d[i];
      ans++;
      if(x > 9){
        x = x%10+1;
        ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3328
//بِسْمِ ٱللَّٰهِ ٱلرَّحْمَٰنِ ٱلرَّحِيمِ
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;

#define endl "\n"

const int MOD = 1000000007;


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

    char a, b;
    cin >> a >> b;
    if(a == 'H' && b == 'H')
        cout << "H" << endl;
    else if (a == 'D' && b == 'D')
        cout << "H" << endl;
    else
        cout << "D" << endl;

    return 0;
}


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



int main(){
    ll N;
    cin>>N;
    vector<pair<ll,ll>> tasks;
    bool ok = true;
    for(int i=0;i<N;i++){
        ll a,b;cin>>a>>b;
        tasks.push_back(make_pair(b,a));
    }
    sort(tasks.begin(),tasks.end());
    //for(int i=0;i<N;i++)cout<<tasks[i].first<<endl;
    ll now = 0;
    for(ll i=0;i<N;i++)
    {
        now+=tasks[i].second;
        if(tasks[i].first<now){
            ok=false;break;
        }
    }
    if(ok) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 7460
n = int(input())
v = map(int, input().split())

d1, d2 = {}, {}

for i, a in enumerate(v):
    if i % 2 == 0:
        d1[a] = d1.get(a, 0) + 1

    if i % 2 == 1:
        d2[a] = d2.get(a, 0) + 1

d1[-1] = 0
d2[-1] = 0

s = (sorted(d1.items(), key=lambda x: x[1], reverse=True))
t = (sorted(d2.items(), key=lambda x: x[1], reverse=True))
#print (s)
#print (t)
if (s[0][0] != t[0][0]):
    print (n-s[0][1]-t[0][1])
else:
    print( min( n-s[0][1]-t[1][1], n-s[1][1]-t[0][1]) )


Measured memory_bytes: 20968
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

p = []
for i in range(n):
    p.append(v[i] - c[i])

p.sort(reverse=True)
ans = 0
for i in range(n):
    if p[i] > 0:
        ans += p[i]
    else:
        break
print(ans)


Measured memory_bytes: 3060
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
int h, w, n, m, s, ans = 0, a[10000], num = 0, sum = 0;
int flag = 0;
string str,stt;
int main() {
	cin >>str;
	stt = "CODEFESTIVAL2016";
	for (int i = 0; i < str.size(); i++) {
		if (str[i] != stt[i])
			ans++;
	}
	cout <<ans<< endl;
	return 0;
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>	tree_set;
typedef long long ll;
typedef long double ld;
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

ll mod=1e9 + 7;

int main()
{
    fast();
    ll n,a,b;
    cin>>n>>a>>b;

    cout<<min(n*a , b);

}


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

using namespace std;


int main(){
 long n,m,d; 
  cin >> n >> m >> d;
  
  double res;
  
  if(!d) res=1.0/double(n);
  else res=2.0*double(n-d)/double(n*n);
  
  res*=double(m-1);
  
  cout << setprecision(12) << res << endl;
}

Measured memory_bytes: 256
def solve(x,k,d):
    if x==0:
        if k%2==1:
            return d
        else:
            return 0
    elif x<0:
        return solve(-x,k,d)
    else:
        if x-k*d>=0:
            return abs(x-k*d)
        else:
            a=x//d
            x=x-a*d
            k=k-a
            if k%2==0:
                return abs(x)
            else:
                return abs(x-d)
X,K,D=map(int,input().split())
print(solve(X,K,D))


Measured memory_bytes: 61788
(x1, y1, x2, y2) = gets.chomp.split(' ').map(&:to_i)

def deg2rad(t)
  (Math::PI * t.to_f) / 180.0
end

def rotate(x, y, t)
  [
    (x * Math.cos(t) - y * Math.sin(t)).round.to_i, 
    (x * Math.sin(t) + y * Math.cos(t)).round.to_i
  ]
end

def vec_add(v, u)
  [v[0] + u[0], v[1] + u[1]] 
end

dx = x2 - x1
dy = y2 - y1

(x3, y3) = vec_add([x2, y2], rotate(dx, dy, deg2rad( 90)))
(x4, y4) = vec_add([x3, y3], rotate(dx, dy, deg2rad(180)))

puts [x3, y3, x4, y4].map(&:to_s).join(' ')

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int res;
int n, m, q;
int tmp[15];
pair<P, P> a[50];

void dfs(int pos) {
    if(pos > n) {
        int t = 0;
        for(int i = 0; i < q; ++i) {
            if(tmp[a[i].F.S] - tmp[a[i].F.F] == a[i].S.F) t += a[i].S.S;

        }
        res = max(res, t);
        return;
    }

    int i = tmp[pos - 1];
    while(i <= m) {
        tmp[pos] = i;
        dfs(pos + 1);
        ++i;

    }

    return;
}


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

    cin >> n >> m >> q;
    for(int i = 0; i < q; ++i) {
        cin >> a[i].F.F >> a[i].F.S >> a[i].S.F >> a[i].S.S;

    }
    tmp[0] = 1;

    dfs(1);
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  int a,b,c;
  cin >> a >> b >> c;

  cout << (b-a==c-b ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256