akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// nichijou
#define REP(i,a,b) for (int i(a), _B(b); i < _B; ++i)
#define RP(i,n) REP(i,0,n)
#define PER(i,a,b) for(int i((a)-1), _B(b); i >= _B; --i)
#define PR(i,n) PER(i,n,0)
#define REP1(i,a,b) REP(i,a,(b)+1)
#define RP1(i,n) REP1(i,1,n)
#define PER1(i,a,b) PER(i,(a)+1,b)
#define PR1(i,n) PER1(i,n,1)
#define DO(n) REP(__i,0,n)
template<typename T>
void cmax(T & a, T b) {a = max(a, b);}
template<typename T>
void cmin(T & a, T b) {a = min(a, b);}

// data type
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define F first
#define S second

// STL container
typedef vector<int> vi;
typedef vector<ll> vll;
#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define CLR(a) a.clear()
#define BK(a) (a.back())
#define FT(a) (a.front())
#define DB(a) a.pop_back()
#define DF(a) a.pop_front()
#define PB push_back
#define EB emplace_back

/* I gave you my heart and then you turned around. */
void _BG(const char * s) {}
template<typename T, typename ... TT>
void _BG(const char * s,T a, TT...b)
{
	for (int c = 0; *s && (c || *s != ','); ++s) {
		cerr<<*s;
		switch (*s) {
		case '(':
		case '[':
		case '{':
			++c;
			break;
		case ')':
		case ']':
		case '}':
			--c;
			break;
		}
	}
	cerr<<" = "<<a;
	if (*s) {
		cerr<<", ";
		_BG(++s,b...);
	} else
		cerr<<endl;
}
#define BG(...) do { \
	cerr << __PRETTY_FUNCTION__ << ':' << __LINE__ << ": "; \
	_BG(#__VA_ARGS__,__VA_ARGS__); \
} while(0)

/* Reading input is now 20% cooler! */
bool RD(void) {return true;}
bool RD(char & a) {return scanf(" %c", &a) == 1;}
bool RD(char * a) {return scanf("%s", a) == 1;}
bool RD(double & a) {return scanf("%lf", &a) == 1;}
bool RD(int & a) {return scanf("%d", &a) == 1;}
bool RD(ll & a) {return scanf("%lld", &a) == 1;}

template<typename T, typename ... TT>
bool RD(T & a, TT & ...  b) {return RD(a) && RD(b...);}

/* Do princesses dream of magic sheep? */
#define RI(a) int a; RD(a)
#define RII(a,b) RI(a); RI(b)
#define RIII(a,b,c) RI(a); RII(b,c)
#define RIIII(a,b,c,d) RI(a); RIII(b,c,d)

/* For it's time for you to fulfill your output. */
void PT(const char a) {putchar(a);}
void PT(const char * a) {fputs(a, stdout);}
void PT(char * a) {fputs(a, stdout);}
void PT(const double a) {printf("%.16f", a);}
void PT(const int a) {printf("%d", a);}
void PT(const ll a) {printf("%lld", a);}

/* The line will last forever! */
template<char sep = ' ',char end = '\n'>
void PL(void) {if (end) PT(end);}
template<char sep = ' ',char end = '\n',typename T, typename ... TT>
void PL(const T a, const TT ...  b) {PT(a); if (sizeof...(b) && sep) PT(sep); PL<sep,end>(b...);}

/* Good Luck && Have Fun ! */
char s[878];
int main()
{
	RII(n,m);
	DO(m+2) PT('#'); PL();
	RP(i,n) {RD(s);PL<0>('#',s,'#');}
	DO(m+2) PT('#'); PL();
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const ll MOD = 1e9+7;
const ll LINF = 1e18;


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
  double noudo=-1;
  vll ans(2);
  for(ll x=0; x<=30; x++){
    for(ll y=0; y<=30; y++){
      ll water=(a*x+b*y)*100;
      if(water>f || water==0) continue;
      ll rem=f-water;
      for(ll s=0; c*s<=rem; s++){
        for(ll t=0; d*t<=rem; t++){
          ll sugar=c*s+d*t;
          if(sugar>rem) continue;
          if(sugar<=water/100*e){
            if(chmax(noudo, 100.0*sugar/(water+sugar))){
              // cout<<s<<' '<<t<<endl;
              ans[0]=water+sugar, ans[1]=sugar;
            }
          }
        }
      }
    }
  }
  cout<<ans[0]<<" "<<ans[1]<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

char s[100001];

void NextLetter(int);

int main(){
    int K;
	scanf("%s",s);
	scanf("%d",&K);

	NextLetter(K);

	printf("%s\n",s);

	return 0;
}

void NextLetter(int K){
    for(int i =0; s[i] != '\0'; i++){
		if(s[i] != 'a' && K >= 'z' - s[i] + 1){
			K -= 'z' - s[i] + 1;
			s[i] = 'a';
		}
	}
	
	if(K >= 26){
        K %= 26;
    }
    int counts = 0;
    for(int j = 0; s[j] != '\0'; j++){
        counts++;
    }
	s[counts - 1] += K;
}

Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

int main(void)
{
	int h1, m1, h2, m2, k;
	while(scanf("%d%d%d%d%d", &h1, &m1, &h2, &m2, &k)==5)
	{
		int t1=h1*60+m1;
		int t2=h2*60+m2;
		int ans=t2-t1-k;

		printf("%d\n", ans);
	}
	return 0;
}


Measured memory_bytes: 1728
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin>>n;
    map<string,int> mp;
    string s;
    for(int i=0;i<n;i++){
        cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;

}


Measured memory_bytes: 3628
n, m = map(int, input().split())
V = n + m
par = [i for i in range(V)]
sizes = [1] * V


def f(x):
    if x == par[x]:
        return x
    par[x] = f(par[x])
    return par[x]


def unite(x, y):
    x, y = f(x), f(y)
    if x == y:
        return
    if sizes[x] < sizes[y]:
        x, y = y, x
    par[y] = x
    sizes[x] += sizes[y]


[unite(i,l-1+n)for i in range(n)for l in [int(k)for k in input().split()][1:]]
print("NO"if len([i for i in range(n)if f(i)!=f(0)])>0 else"YES")


Measured memory_bytes: 12676
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  cin >> a >> b;
  int N = a.size(), ans = 0;
  for(int i=0;i<N;i++){
    if(a[i]!=b[i]) ans++;
 }
  cout << ans << endl;
}
  


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

using namespace std;

int main()
{
  	int n1,n2,n3,n4;
  	cin>>n1>>n2>>n3>>n4;
  	vector<int>v;
  	v.push_back(n1);
  v.push_back(n2);
  v.push_back(n3);
  v.push_back(n4);
  	sort(v.begin(),v.end());
   if(v[0]==1&&v[1]==4&&v[2]==7&&v[3]==9)
     cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}


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

int main(void) {
  int M; cin >> M;
  ll K; cin >> K;

  if (K == 0) {
    cout << "0 0";
    for (ll i = 1; i < pow(2, M); i++) {
      cout << ' ' << i << ' ' << i;
    }
    cout << endl;
  } else if (K < pow(2, M)) {
    if (M == 1) cout << -1 << endl;
    else {
      cout << 0;
      for (ll i = 1; i < pow(2, M); i++) {
        if (i != K) cout << ' ' << i;
      }
      cout << ' ' << K;
      if (K != pow(2, M)-1) {
        cout << ' ' << pow(2, M)-1;
        for (ll i = pow(2, M)-2; i >= 0; i--) {
          if (i != K) cout << ' ' << i;
        }
      } else {
        cout << ' ' << pow(2, M)-2;
        for (ll i = pow(2, M)-3; i >= 0; i--) {
          cout << ' ' << i;
        }
      }
      cout << ' ' << K << endl;
    }
  } else cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

LL a[100];
int N;

int main() {
	cin >> N;
	FOR (i, N)
		cin >> a[i];
	LL maxval = a[0];
	int idx = 0;
	FOR (i, N) {
		if (abs(a[i]) > abs(maxval)) {
			maxval = a[i];
			idx = i;
		}
	}
	vector<pair<int, int> > ret;
	ret.clear();
	FOR (i, N) {
		if (i == idx)
			continue;
		ret.pb(make_pair(idx, i));
	}
	if (maxval >= 0) {
		FOR (i, N - 1)
			ret.pb(make_pair(i, i + 1));
	}
	else {
		for (int i = N - 1; i > 0; i--)
			ret.pb(make_pair(i, i - 1));
	}
	cout << ret.sz << endl;
	FOR (i, ret.sz)
		cout << ret[i].first + 1 << " " << ret[i].second + 1 << endl;
	return 0;
}

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

class DisjointSet {
  public:
    vector<int> rank, p;

    DisjointSet() {}
    DisjointSet(int size) {
      rank.resize(size, 0);
      p.resize(size, 0);
      for (int i = 0; i < size; i ++) makeSet(i);
    }

    void makeSet(int x) {
      p[x] = x;
      rank[x] = 0;
    }
    
    bool same(int x, int y) {
      return findSet(x) == findSet(y);
    }

    void unite(int x, int y) {
      link(findSet(x), findSet(y));
    }

    void link(int x, int y) {
      if (rank[x] > rank[y]) {
        p[y] = x;
      } else {
        p[x] = y;
        if (rank[x] == rank[y]) {
          rank[y] ++;
        }
      }
    }

    int findSet(int x) {
      if (x != p[x]) {
        p[x] = findSet(p[x]);
      }
      return p[x];
    }
};

int main() {
  int n, a, b, q;
  int t;

  cin >> n >> q;
  DisjointSet ds = DisjointSet(n);

  for (int i = 0; i < q; i ++) {
    cin >> t >> a >> b;
    if (t == 0) ds.unite(a, b);
    else {
      if (ds.same(a, b)) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }
}


Measured memory_bytes: 3180
n,k = map(int,input().split())
mod = 10**9+7

  
mod = 10**9+7 

ans = 0
for i in range(k,n+2):
    a = i*(i-1)//2
    b = i*(2*n-i+1)//2
    ans += b-a+1
    ans %= mod

print(ans%mod)



Measured memory_bytes: 63712
while True:
    R_0, W_0, C, R = map(int, raw_input().split())

    if R_0 == 0 and W_0 == 0 and C == 0 and R == 0:
        break

    t = C * W_0 - R_0
    print max(0, t / R if t % R == 0 else t / R + 1)


Measured memory_bytes: 4632
#include<iostream>
#include<fstream>
#include <cmath>
#include <algorithm>
#include <stack>
#include <vector>
#include <random>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)

int main(){
    int x;
    cin >> x;
    FOR(i,0,1000){
        int a = x-i*100;
        if(a<0)continue;
        if(a<=5*i){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}


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

int main() {
  int N;
  string S;
  cin >> N;
  int check = 0;

 for(int i = 0; i < N; i++){
   cin >> S;
   if(S == "Y"){
     check = check + 1;
   }
 }
   
  if(check > 0){
   cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
 }
   
}

Measured memory_bytes: 3616
import math
import sys
import numpy as np
from decimal import *
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# ----------------------------------------
a, b, x = map(int, readline().split())

ans = Decimal(b // x) - Decimal(a // x)
if (a % x == 0):
    ans += 1

print(int(ans))


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

using namespace std;

inline void quit(){ exit(0); }

typedef long long ll;

ll mpow(ll _x, ll _y, ll _mod){
    if(_y==0) return 1;
    if(_y==1) return _x%_mod;
    if(_y&1) return (mpow(_x, _y-1, _mod)*_x)%_mod;
    ll _tmp = mpow(_x, _y>>1, _mod);
    return (_tmp*_tmp)%_mod;
}

int n;
int arr[102];
int ans[102];

int main(){
    scanf("%d", &n);
    for(int i=1; i<n; i++) scanf("%d", &arr[i]);

    for(int i=1; i<=n; i++){
        ans[i] = INT_MAX;
    }
    for(int i=1; i<n; i++){
        ans[i] = min(ans[i], arr[i]);
        ans[i+1] = min(ans[i+1], arr[i]);
    }
    printf("%d", accumulate(ans+1, ans+n+1, 0));
}


Measured memory_bytes: 256
// 配列によるキューの実装 p.93
// リングバッファ
 
#include <cstring>
#include <cstdio>
#define LEN 1000005
 
using namespace std;
 
/* プロセスを表す構造体 */
struct P {
    char name[100];
    int t;
};
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}
 
P dequeue() {
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}
 
int min(int a, int b) {
    return a < b ? a : b;
}
 
int main() {
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q); // n:名前, q:時間
    /* 全てのプロセスをキューに順番に追加 */
    for (i=1; i<=n; i++) {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1; tail = n + 1;
 
    /* シミュレーション */
    while (head != tail) {
        u = dequeue();
        c = min(q, u.t); /* qまたは必要な時間u.tだけ処理を行う */
        u.t -= c;        /* 残りの必要時間 */
        elaps += c;      /* 経過時間 */
        if (u.t > 0)
            enqueue(u);  /* 処理が終わってなかったらまたキューに入れる */
        else
            printf("%s %d\n", u.name, elaps);
    }
    return 0;
}


Measured memory_bytes: 21920
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> num(n);
    for(int i=0;i<n;i++){
        cin >> num[i];
    }
    sort(num.begin(),num.end());
    int ans = abs(num[0]-num[n-1]);
    cout << ans << endl;
    return 0;
}


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

int main() {
	string S;
	int tsize = 0;
	int maxSize = 0;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S.at(i) == 'A' || S.at(i) == 'C' || S.at(i) == 'G' || S.at(i) == 'T') {
			tsize++;
		}
		else {
			tsize = 0;
		}
		maxSize = max(maxSize, tsize);
	}

	cout << maxSize << endl;

	return 0;
}

Measured memory_bytes: 256
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++) 
#define LL long long
#define pii pair <LL,LL>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,m,ans=0;
vector <pii> v;

int main()
{
	cin>>n>>m;
	rep(i,n)
	{
		int x,y;
		cin>>x>>y;
		v.pb({x,y});
	}
	sort(v.begin(),v.end());
	rep(i,v.size())
	{
		if(v[i].se>=m)
		{
			ans+=v[i].fi*m;
			cout<<ans<<endl;
			rt0;
		}
		ans+=v[i].se*v[i].fi;
		m-=v[i].se;
	}
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define print(x) std::cout<<x<<"\n"
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repd(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SZ(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

const ll INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll GCD(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = gcd(a, v[i]);} return a;}
ll LCM(VI v){ll a = v[0]; for (ll i = 1; i<SZ(v); i++) {a = lcm(a, v[i]);} return a;}
VI Bit2Vector(const ll bit, ll n) {	VI s;	rep(i,n) if (bit & (1 << i)) s.push_back(i); return s;}


void Main()
{
	ll n,m,l; ll res=0;
	string s,t,u; string sres="No or NO";

	cin>>n;
	VVI a(n,VI(3,0));
	VVI dp(n+1,VI(3,0));
	rep(j, n) {
		rep(i, 3) {
			cin >> a[j][i];
		}
	}
	//初期条件
	rep(i,3) {
		dp[0][i] = 0;
	}
	//ｋは次の日jは今日
	rep(i,n){
		rep(j,3){
			rep(k,3){
				if(j==k) continue;
				dp[i+1][k]=max(dp[i+1][k],dp[i][j]+a[i][k]);
			}
		}
	}
	res=MAX(dp[n]);
	cout << res << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
    int n;
    int i, j, k;
    int ans = 0;
    while (cin >> n)
    {
        ans = 0;
        i = 0;
        j = 0;
        k = 0;
        rep(i, 10)
        {
            rep(j, 10)
            {
                rep(k, 10)
                {
                    if (0 <= n - i - j - k && n - i - j - k <= 9)
                    {
                        ans++;
                    }
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};

int main() {

	while(1){
		int a,b,c,d;
		int e,f,g,h;
		int t[10]={};
		int hi=0,bu=0;
		cin>>a>>b>>c>>d;
		cin>>e>>f>>g>>h;
		if(cin.eof())return 0;
		t[a]++;
		t[b]++;
		t[c]++;
		t[d]++;
		t[e]++;
		t[f]++;
		t[g]++;
		t[h]++;
		for(int i=1; i<10; i++){
			if(t[i]==2)bu++;
		}
		if(a==e)hi++;
		if(b==f)hi++;
		if(c==g)hi++;
		if(d==h)hi++;
		cout<<hi<<" "<<bu-hi<<endl;
	}

	return 0;
}



Measured memory_bytes: 3044
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(){
    int n,r,ans;
    scanf("%d %d",&n,&r);
    if(n>=10){
        printf("%d",r);
        return 0;
    }
    else {
        printf("%d",r+100*(10-n));
        return 0;
    }
}

Measured memory_bytes: 128
import bisect
import sys

N, H = map(int, input().split())
ab = [map(int, input().split()) for _ in range(N)]
a, b = [list(i) for i in zip(*ab)]

a_max = max(a)
b.sort(reverse=True)

l = [b[i] for i in range(N) if b[i] >= a_max]
d = 0
cnt = 0
for v in l:
    d += v
    cnt += 1
    if d >= H:
        print(cnt)
        sys.exit()
cnt += (H-d+a_max-1)//a_max
print(cnt)

Measured memory_bytes: 92248
def make(l,ai): # len(a)=2
    global N
    for i in range(2,N):
        ai.append(ai[i-2]==(ai[i-1]==l[i-1]))
    return ai

def check(l,ai):
    return ai[0]==(ai[-2]==(ai[-1]==l[-1])) and ai[1]==(ai[-1]==(ai[0]==l[0]))

N=int(input())
l=[c=='o' for c in input()]

f=False
a=[[True,True],[True,False],[False,True],[False,False]]
for ai in a:
    ai=make(l,ai)

f=False
for ai in a:
    if check(l,ai):
        for aij in ai:
            print('S' if aij else 'W',end='')
        f=True
        break
if not f:
    print(-1)

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

int N;

int pair_of(int n) {
    int pow = 1;
    while(pow <= n) {
        pow *= 2;
    }
    return pow - n;
}

int main() {
    
    cin >> N;
    
    map<int, int> m;
    int a;
    for (int i = 0; i < N; i++) {
        cin >> a;
        m[a] += 1;
    }
    
    int ans = 0;
    for (auto itr = m.rbegin(); itr != m.rend(); ++itr) {
        if (!(*itr).second) continue;
        
        int i = (*itr).first;
        int j = pair_of(i);
        int c = min(m[j], m[i]);
        if (i == j) {
            ans += c / 2;
            m[i] %= 2;
            continue;
        }
        if (c > 0) {
            ans += c;
            m[j] -= c;
            m[i] -= c;
        }
    }
    
    cout << ans << endl;
}

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

int main()
{
  int h, w;
  cin >> h >> w;

  string s[h];
  for (int i = 0; i < h; i++) cin >> s[i];

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

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (s[i][j] == '#') continue;

      int c = 0;
      for (int d = 0; d < 8; d++) {
        int ni = i + dx[d];
        int nj = j + dy[d];
        if (ni < 0 || h <= ni) continue;
        if (nj < 0 || w <= nj) continue;
        if (s[ni][nj] == '#') c++;
      }
      s[i][j] = c + '0';
    }
  }
  for (int i = 0; i < h; i++) cout << s[i] << endl;
}


Measured memory_bytes: 256
fn main() {
    let s: String = read();
    let w: usize = read();

    let r: String = s
            .chars()
            .enumerate()
            .filter(|&(i, c)| {
                i % w == 0
            })
            .map(|(i, c)| {c})
            .collect();

    println!("{}", r);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_lines<T: std::str::FromStr>(n: u32) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

Measured memory_bytes: 4352
#include <stdio.h>

int main (void){
    int n, q, i, j, count=0;
    scanf("%d", &n);
    int s[n];
    for(i=0; i<n; i++){
        scanf("%d", &s[i]);
    }
    scanf("%d", &q);
    int t[q];
    for(i=0; i<q; i++){
        scanf("%d", &t[i]);
    }
    
    for(i=0; i<q; i++){
        for(j=0; j<n; j++){
            if(s[j] == t[i]){
                count++;
                i++; j=-1;
            }
                
            
        }
    }
    
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 636
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;

int main() {
  //
  cin >> N;
  string ans = "";
  while (N > 0) {
    N--;
    int x = N % 26;
    char c = 'a' + x;
    ans.push_back(c);
    N /= 26LL;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 998244353
#define invp(a,p)pom(a,p-2,p)
#define add(x,y)(x=(x+y)%MOD)

int a[400],acnt;
char s[310];
int k;

#define S 310
#define K 22600
int dp[2][S][K];
int main(){
	scanf("%s %d",s,&k);
	int len=strlen(s);
	int acnt=0,cnt=0;
	rep(i,0,len){
		if(s[i]=='0'){
			a[acnt++]=cnt;
			cnt=0;
		}else{
			cnt++;
		}
	}
	if(cnt)a[acnt++]=cnt;
	while(cnt-1>=0&&a[cnt-1]==0)cnt--;
	int sum=0;
	{
		int cum=0;
		for(int i=acnt-1;i>=1;i--)cum+=sum+=a[i];
		k=min(k,cum);
		sum+=a[0];
	}
	
	if(k==0){
		puts("1");
		return 0;
	}
	
	//rep(i,0,acnt)printf("%d ",a[i]);puts("");
	
	int pre=0;
	dp[0][0][0]=1;
	rep(i,0,acnt){
		memset(dp[(i%2)^1],0,sizeof(int)*S*K);
		rep(s,pre,sum+1)rep(x,0,k+1)if(dp[i%2][s][x]){
			//printf("%d %d %d\n",i,s,x);
			rep(ss,max(pre+a[i],s),sum+1){
				//printf("%d %d %d %d\n",i,s,x,ss-s);
				if(x+max(0,ss-s-a[i])>k)break;
				add(dp[(i%2)^1][ss][x+max(0,ss-s-a[i])],dp[i%2][s][x]);
				//printf("%d %d %d %d\n",i,s,x,ss-s);
			}
		}
		pre+=a[i];
		
		//rep(s,0,5){rep(x,0,5)printf("%d ",dp[i+1][s][x]);puts("");}puts("");
	}
	
	ll ans=0;
	rep(i,0,k+1)add(ans,dp[acnt%2][pre][i]);
	printf("%d",ans);
}

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

int main(void) {
    int n;
    long long int sum = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            for (int k = 1; k <= n; k++) {
                sum += __gcd(__gcd(i, j), k);
            }
        }
    }
    cout << sum;
    
}

Measured memory_bytes: 3568
import java.util.Scanner;

public class Main {

   public static void main(String[] args) {
      Scanner scanner = new Scanner(System.in);

      final int SIZE = 10;

      int[] height = new int[SIZE];
      for (int i = 0; i < SIZE; i++) {
         height[i] = scanner.nextInt();
      }

      int[] valueMax = max3(height);

      for (int i = 0; i < 3; i++) {
         System.out.println(valueMax[i]);
      }
   }

   static int[] max3(int[] args) {
      final int MIN = Integer.MIN_VALUE;
      int[] valueMax = { MIN, MIN, MIN };

      for (int value : args) {
         int tmp;
         for (int i = 0; i < 3; i++) {
            if (value > valueMax[i]) {
               tmp = valueMax[i];
               valueMax[i] = value;
               value = tmp;
            }
         }
      }

      return valueMax;
   }

}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	if(S.size()>4) S=S.substr(0,4);
	if(S=="YAKI") cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  char S;
  cin >> S;
  char T = S+1;
  cout << T << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ss second
#define ff first

int32_t main(){
	int n;
	cin>>n;
	int a[3][n];
	for(int i=0;i<n;i++){
		cin>>a[0][i]>>a[1][i]>>a[2][i];
	}
	int dp[3][n+1];
	for(int i=0;i<3;i++){
		for(int j=0;j<n+1;j++){
			dp[i][j]=0;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			for(int k=0;k<3;k++){
				if(j!=k){
					dp[j][i+1]=max(dp[k][i]+a[j][i],dp[j][i+1]);
				}
			}
		}
	}
	cout<<max(dp[0][n],max(dp[1][n],dp[2][n]));
}

Measured memory_bytes: 4864
#include <string>
#include <iostream>
using namespace std;
 
using ll = long long;
#define REP(i,n) for(ll i=0; i<(n); ++i)
 
int main(){
	string s,t;
	cin >> s >> t;
 
	ll s_index = 0;
	ll t_index = 0;
	bool finish = true;
	REP(i,s.size()){
		if(i%2==0){
			for(;s_index < s.size(); ++s_index){
				if(s[s_index] == s[i]) break;
			}
			if(s_index == s.size()) finish = false;
			else ++s_index;
		}else{
			for(;t_index < t.size(); ++t_index){
				if(t[t_index] == s[i]) break;
			}
			if(t_index == t.size()) finish = false;
			else ++t_index;
		}
	}
	if(finish){
		cout << "Yes" << endl;
		return 0;
	}
 
 
	s_index = 0;
	t_index = 0;
	finish = true;
	REP(i,s.size()){
		if(i%2==1){
			for(;s_index < s.size(); ++s_index){
				if(s[s_index] == s[i]) break;
			}
			if(s_index == s.size()) finish = false;
			else ++s_index;
		}else{
			for(;t_index < t.size(); ++t_index){
				if(t[t_index] == s[i]) break;
			}
			if(t_index == t.size()) finish = false;
			else ++t_index;
		}
	}
	if(finish){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int ans=0;
	for(int i=1;i<=n;i++){
		if(i%15==0){
			ans-=200;
		}
		ans+=800;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[1]:


N = int(input())


# In[15]:


def func(i,j,N):
    ans = []
    for x in range(1,N+1):
        x_ = str(x)
        if x_[0] == str(i) and x_[-1] == str(j):
            ans += [x]
    return ans


# In[23]:


ans = 0
for i in range(10):
    for j in range(10):
        ans += len(func(i,j,N))*len(func(j,i,N))
print(ans)


# In[ ]:






Measured memory_bytes: 72100
#include<iostream>
#include<deque>
using namespace std;
int k,dist[100000];
deque<int> q;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>k;
	for(int i=0;i<k;i++)
	{
		dist[i]=1000000009;
	}
	dist[1]=1;
	q.push_back(1);
	while(q.size())
	{
		int x=q.front();
		q.pop_front();
		if(dist[(10*x)%k]>dist[x])
		{
			dist[(10*x)%k]=dist[x];
			q.push_front((10*x)%k);
		}
		if(dist[(x+1)%k]>dist[x]+1)
		{
			dist[(x+1)%k]=dist[x]+1;
			q.push_back((x+1)%k);
		 } 
	}
	cout<<dist[0];
	return 0;
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        int[] V = new int[N];
        int[] C = new int[N];

        for (int i = 0; i < N; i++) {
            V[i] = sc.nextInt();
        }
        for (int i = 0; i < N; i++) {
            C[i] = sc.nextInt();
        }

        System.out.println(solve(N, V, C));
    }

    private static int solve(int N, int[] V, int[] C) {
        int count = 0;

        for (int i = 0; i < N; i++) {
            if (V[i] > C[i]) {
                count += V[i] - C[i];
            }
        }

        return count;
    }

}

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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

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

    unordered_map<int64_t, int64_t> m;
    int64_t mi = n, mx = 0;
    for (auto _ : irange(0L, n)) {
        int64_t a;
        cin >> a;
        ++m[a];
        mx = max(mx, a);
        mi = min(mi, a);
    }

    if (mi * 2 < mx) {
        cout << "Impossible" << endl;
        return 0;
    }

    if (m[(mx + 1) / 2] != 1 + (mx % 2)) {
        cout << "Impossible" << endl;
        return 0;
    }

    for (auto i : irange((mx + 1) / 2 + 1, mx + 1)) {
        if (m[i] < 2) {
            cout << "Impossible" << endl;
            return 0;
        }
    }

    cout << "Possible" << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,t,ans;
	scanf("%d %d",&a,&b);
	if(a<b) t=a,a=b,b=t;
	ans=a-b+1;
	if(a>=0)
		ans=-b;
	if(a>=0&&b>=0) ans=0;
	if(a>=0&&b<=0) 
	{
		printf("Zero\n");
		return 0;
	}
	if(ans%2==0) printf("Positive\n");
	if(ans%2) printf("Negative\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	//java11

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long X = sc.nextLong();
		long K = sc.nextLong();
		long D = sc.nextLong();

		if(X < 0) {
			X = -X;
		}

		long min_plus_n = X / D;
		long min_plus = X % D;
		long min_minus_n = min_plus_n + 1;
		long min_minus = Math.abs(min_plus-D);

		if(K <=min_minus_n) {
			System.out.println(Math.abs(X-D*K));
			return;
		}

		if(K % 2 == min_plus_n % 2) {
			System.out.println(min_plus);
		}else {
			System.out.println(min_minus);
		}

	}


}


Measured memory_bytes: 35436
#include<iostream>
#include<queue>         //FIFO=first in,first out
using namespace std;
int main()
{
   int n,q,index,order,value,x;
  cin>>n>>q;
  queue<int>Q[n];
  while(q--){


    cin>>order>>index;

  switch(order)
  {
      case 0:
                  cin>>value;
                  Q[index].push(value);
                  break;
      case 1:
                  if( !Q[index].empty())
                  cout<< Q[index].front()<<endl;
                     break;
      case 2:
                   if( !Q[index].empty())
                  Q[index].pop();
                  break;
  }

  }
return 0;
}



Measured memory_bytes: 4380
#include <bits/stdc++.h>
#define int long long
const int MOD=1e9+7;
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 2e5 + 5;

int n, a[maxn];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    map<int, int> cnt;
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        ans += cnt[i - a[i]];
        cnt[abs(a[i] + i)]++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 27924
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int[] iArray = Arrays.stream(sc.nextLine().split(" ")) //" "で区切ってString配列へ
    .mapToInt(Integer::parseInt) //数値にして
	.toArray(); //配列へ
	int n = iArray[0];
	int m = iArray[1];
	int x = iArray[2];
	int y = iArray[3];
	int Flag = 0;

	int[] xArray = Arrays.stream(sc.nextLine().split(" ")) //" "で区切ってString配列へ
    .mapToInt(Integer::parseInt) //数値にして
	.toArray(); //配列へ

	int[] yArray = Arrays.stream(sc.nextLine().split(" ")) //" "で区切ってString配列へ
    .mapToInt(Integer::parseInt) //数値にして
	.toArray(); //配列へ

	for(int i = x;i <= y;i++){
		if(xzy(x,y,i) && xCheck(xArray,n,i) && yCheck(yArray,m,i)){
			if(Flag != 1){
				// 出力
				System.out.println("No War");
				Flag = 1;
			}
		}else{
			//continue
		}
	}

	if (Flag == 1){

	}else{
		// 出力
		System.out.println("War");
	}

	}

	public static boolean xzy(int x, int y, int z){
		if(x < z && z <= y){
			return true;
		}else{
			return false;
		}
	}

	public static boolean xCheck(int[] xn, int n, int z){
		for(int i = 0;i < n;i++){
			if(xn[i] < z){
				//continue
			}else{
				return false;
			}
		}
		return true;
	}

	public static boolean yCheck(int[] ym, int m, int z){
		for(int i = 0;i < m;i++){
			if(ym[i] >= z){
				//continue
			}else{
				return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 28500
N,K = map(int,input().split())
p = list(map(int,input().split()))
for i in range(N):
  p[i] = (p[i]+1)/2
total = sum(p[:K])
ans = total
for j in range(N-K):
  total = total+p[K+j]-p[j]
  ans = max(ans,total)
print(ans)

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int main()
{
	int x;
	cin>>x;
	if(x>=30) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int i = 0;
  while (1){
    if (i % 2 == 0){
      C -= B;
      if (C <= 0){
        cout << "Yes" << endl;
        break;
      }
    } else {
      A -= D;
      if (A <= 0){
        cout << "No" << endl;
        break;
      }
    }
    i++;
  }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;	
#pragma GCC optimize("Ofast") 
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)	
#define fn1 for( int i =1;i<=n;	i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
#define PI  3.14159265358979323846
#define MOD 1000000007
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
const int N = 2e6+5;	
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n , x ,t ;
		cin >> n >> x >> t;
		int ans = (n/x)*t ;
		ans+=n%x>0?t:0;
		cout << ans <<'\n';

	
	}
	return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  int l[n];
  for (int i=0; i < n; i++) cin >> l[i];
  sort(l, l + n, greater<int>()); //l[0:N]を大きい順にソート
  int sum = 0;
  for (int i=0; i < k; i++) {
      sum += l[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 3576
#include <iostream> // cout, endl, cin
#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 <cmath>
using namespace std;

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if ((b+c) <= a) {
        cout << 0 << endl;
    }
    else cout << (b+c)-a << endl;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
mat=[]
for i in range(h):
    a=[i for i in list(input())]
    mat.append(a)
for i in range(w):
    if mat[0][i]=='.':
        mat[0][i]=1
    else:
        for j in range(i,w):
            mat[0][j]=0
        break
for i in range(1,h):
    for j in range(w):
        if mat[i][j]=='.':
            mat[i][j]=0
            mat[i][j]=(mat[i][j]+mat[i-1][j])%1000000007
            if j-1>=0:
                mat[i][j]=(mat[i][j]+mat[i][j-1])%1000000007
        else:
            mat[i][j]=0

print(mat[h-1][w-1])


Measured memory_bytes: 106204
#include <cstdio>
#include <cctype>
#include <utility>
#include <stack>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	stack<int> s;
	for (int n; n = in(), ~n;) {
		do
			s.push(n % 4);
		while (n /= 4);
		while (!s.empty()) {
			out(s.top());
			s.pop();
		}
		outl();
	}
}


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

typedef long long ll;

ll md = 1000000007;

vector<ll> a;

int main(int, char**) 
{
	ll n, ans = 0;
	string s;
	std::cin >> n >> s;
	char ls = 0;
	for(int i = 0; i < s.length(); i++) {
		if (ls != s[i]) ans++;
		ls = s[i];
	}

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


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

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

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    string O, E;
    cin >> O >> E;
    while (!E.empty()) {
        cout << O[0] << E[0];
        O = O.substr(1);
        E = E.substr(1);
    }

    if (!O.empty())
        cout << O[0];
    cout << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//


    // input
    cout << fixed << setprecision(10);
    ll H, W; cin >> H >> W;

    if(H == 1 || W == 1){
        print(1);
        return 0;
    }

    ll tmp = H / 2 + H % 2;
    ll tmp2 = H / 2;
    ll ans = tmp * (W / 2 + W % 2) + tmp2 * (W /2);
    print(ans);
    
    return 0;
}


Measured memory_bytes: 256
def main():
    n, k = [int(e) for e in input().split()]
    D = []
    A = []
    for i in range(k):
        D.append(input())
        A.append([int(e) for e in input().split()])

    S = set()
    for Aa in A:
        S = S.union(Aa)

    print(n - len(S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 67936
using System;

public class Program {

        public static void Main(string[] args) {

            var n = int.Parse(Console.ReadLine());

            var input = Console.ReadLine().Split(' ');
            var s = input[0];
            var t = input[1];

            var ans = "";

            for(int i = 0; i < n; i++) {

                ans += s[i];
                ans += t[i];

            }

            Console.WriteLine(ans);


        }

    }

Measured memory_bytes: 11092