akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  ll H,W; cin>>H>>W;
  vector<string> grid(H); rep(i,H) cin>>grid[i];
  
  //列ごと行ごとに障害物のある位置をメモ
  vector<vector<ll>> gyo(H,vector<ll>(0));
  vector<vector<ll>> retsu(W,vector<ll>(0));
  
  rep(y,H){
    rep(x,W){
      if(grid[y][x]=='#') {
        gyo.at(y).push_back(x);
        retsu.at(x).push_back(y);
      }
    }
  }
  
  //全探索
  ll ans=0;
  rep(y,H){
    rep(x,W){
      if(grid[y][x]=='#') continue;
      ll sans=0;
      
      //行の探索
      //左端の探索
      ll ok=-1,ng=gyo.at(y).size();
      while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(gyo[y][mid]<x) ok=mid;
        else ng=mid;
      }
      ll left;
      if(ok==-1) left=0;
      else left=gyo[y][ok]+1;
      
      //右端の探索
      ok=gyo.at(y).size(),ng=-1;
      while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(gyo[y][mid]>x) ok=mid;
        else ng=mid;
      }
      ll right;
      if(ok==gyo.at(y).size()) right=W;
      else right=gyo[y][ok];
      
      //列の探索
      //上端の探索
      ok=-1,ng=retsu[x].size();
      while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(retsu[x][mid]<y) ok=mid;
        else ng=mid;
      }
      ll up;
      if(ok==-1) up=0;
      else up=retsu[x][ok]+1;
      
      //下端の探索
      ok=retsu[x].size(),ng=-1;
      while(abs(ok-ng)>1){
        ll mid=(ok+ng)/2;
        if(retsu[x][mid]>y) ok=mid;
        else ng=mid;
      }
      ll bottom;
      if(ok==retsu[x].size()) bottom=H;
      else bottom=retsu[x][ok];
      
      sans=right-left+bottom-up-1;
      chmax(ans,sans);
    }
  }
  
  cout<<ans<<endl;  
      
  return 0;
}

Measured memory_bytes: 77812
#include <stdio.h>
using namespace std;
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
	if(a > b){
		printf("a > b\n");
	}else if(a < b){
		printf("a < b\n");
	}else{
		printf("a == b\n");
	}
}


Measured memory_bytes: 2696
// test1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include<cstdio>
#include<cmath>
#include<stack>
using namespace std;
int main()
{
    stack <int>v;
    int n, t;
    cin >> n>>t;
    while (n){
        v.push(n % t);
        n = n / t;
    }
    cout << v.size() << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#define MOD 1000000007LL
using namespace std;

int main(){
	string s, t, u;
	cin >> s >> t >> u;
	cout << s[0] << t[0] << u[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<string.h>
#include<cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ll long long
using namespace std;


int main()
{
    int k;
    string s;
    cin >> k >> s;
    if (s.size() <= k) cout << s << endl;
    else
    {
        rep(i, k)
        {
            cout << s[i];
        }
        cout << "..." << endl;
    }
}

Measured memory_bytes: 3628
import sys
sys.setrecursionlimit(1000000)
n,m=map(int,input().split())
lb=[0 for i in range(n)]
l=[[] for i in range(n+1)]
for i in range(m):
  x,y,z=map(int,input().split())
  l[x].append(y)
  l[y].append(x)
def dfs(a,num):
  if lb[a-1]!=0:
    pass
  else:
    lb[a-1]=num
    for i in l[a]:
      dfs(i,num)
  return None
for i in range(n):
  dfs(i+1,i+1)
count=0
laa=[0 for i in range(n+1)]
for i in range(n):
  if lb[i]==0:
    count+=1
  elif laa[lb[i]]==0:
    count+=1
    laa[lb[i]]=1
  else:
    pass
print(count)

Measured memory_bytes: 110228
import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as B

main :: IO ()
main = do
    [r] <- sort . map (fst . fromJust . B.readInt) . B.words <$> B.getLine :: IO [Int]
    putStrLn (case (r<1200, r<2800) of
        (True,_) -> "ABC"
        (_,True) -> "ARC"
        _        -> "AGC")

Measured memory_bytes: 380
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	A, B, C = getlist()
	D = defaultdict(int)
	D[A] += 1
	D[B] += 1
	D[C] += 1
	if len(D) == 2:
		print("Yes")
	else:
		print("No")

	


if __name__ == '__main__':
	main()

Measured memory_bytes: 38384
/*
 *created by Kraken on 28-03-2020 at 17:05
 */
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		long in = sc.nextLong();
		long c500 = in / 500;
		long c5 = (in % 500) / 5;
		System.out.println((c500 * 1000) + (c5 * 5));
	}

	static class FastReader {

		BufferedReader br;

		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


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

int main()
{
  int64_t N, ans;
  cin >> N;
  vector<int64_t> A(N);
  map<int64_t, int64_t> mp;
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    mp[A.at(i)] = i;
  }
  sort(A.begin(), A.end());
  for (int i = 0; i < N; i++)
  {
    int64_t d = abs(mp[A.at(i)] - i);
    if (d % 2)
    {
      ans++;
    }
  }
  cout << ans / 2 << endl;
}

Measured memory_bytes: 10380
#include<cstdio>
#include<functional>
#include<algorithm>
#include<cstring>
using namespace std;
int main(void)
{
	int x,a,b,n,i;
	char s[11];
	scanf("%d %d %d",&x,&a,&b);
	scanf("%d",&n);
	for(i=0;i<n;i++)	{
		scanf("%s",s);
		if(strcmp(s,"nobiro")==0)	x+=a;
		else if(strcmp(s,"tidime")==0)	x+=b;
		else x=0;
		if(x<0)	x=0;
	}
	printf("%d\n",x);
}


Measured memory_bytes: 2732
from sys import stdin
n,y = map(int,stdin.readline().rstrip().split())
for i in range(n+1):
    for j in range(n+1-i):
        k = n-(i+j)
        if 10000*i+5000*j+1000*k == y:
            print(i,j,k)
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){

  int h, w;
  int i, j;

  while(1){
    scanf("%d %d", &h, &w);
    if(w == 0 && h == 0)
      break;

    for(i = 0; i < h; i++){
      for(j = 0; j < w; j++)
	printf("#");
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}

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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;

int n,m;
int top,mx;
int st[N],b[N];

int t[2001][2001];
char a[2001][2001];

int f (int i,int j) {
        return (a[i][j] == '#') ? 1 : 0;
}

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

        mx = max(n,m);

        for (int i = 1; i <= n; i ++)
                for (int j = 1; j <= m; j ++)
                        cin >> a[i][j];

        n --;
        m --;

        for (int i = 1; i <= n; i ++)
                for (int j = 1; j <= m; j ++)
                        t[i][j] = f(i,j) ^ f(i + 1,j) ^ f(i,j + 1) ^ f(i + 1,j + 1);

        for (int i = 1; i <= n; i ++) {
                for (int j = 1; j <= m; j ++)
                        if(t[i][j]) b[j] = 0;
                        else b[j] ++;

                top = 0;
                for (int j = 1; j <= m; j ++) {
                        while (top && b[st[top]] >= b[j]) {
                                mx = max (mx,(j - st[top - 1]) * (b[st[top]] + 1));
                                top --;
                        }
                        st[++top] = j;
                }
                while (top) {
                        mx = max(mx,(m - st[top - 1] + 1) * (b[st[top]] + 1));
                        top --;
                }
        }
        cout << mx << endl;
}


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

using namespace std;

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

    vector<int> a(n);
    cin >> a.at(0);
    int sum = 0;
    int mx = 0;

    for(int i=1; i<n; i++){
        cin >> a.at(i);
        sum += a.at(i) -a.at(i-1);
        mx = max(a.at(i) - a.at(i-1), mx);
    } 

    sum += k - a.at(n-1) + a.at(0);
    mx = max(k - a.at(n-1) + a.at(0), mx);

    cout << sum - mx << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;

ll arr[1000005];



int main()
{

    int N;
    cin >> N;
    ll sum=0;
    for(int i=1;i<=1000000;i++)
    {
        if(i%5&&i%3)
            sum+=i;
        arr[i]=sum;
    }
    cout << arr[N];



    return 0;
}


Measured memory_bytes: 11448
#include <bits/stdc++.h>
using namespace std;
// C - Replacing Integer

int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++)
        cin >> d.at(i);

    sort(d.begin(), d.end());
    if (d[(N - 1) / 2] == d[N / 2])
    {
        cout << 0 << endl;
    }
    else
    {
        int tmp = d[N / 2] - d[(N - 1) / 2];
        cout << tmp << endl;
    }
}

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

typedef pair<int,int> P;

signed main(){
	int n,x[510],ans[510 * 510] = {};
	vector<P> vec;
	cin >> n;
	for(int i = 0;i < n;i++){
		cin >> x[i];
		vec.push_back(P(x[i] - 1,i));
		ans[x[i] - 1] = i + 1;
	}
	sort(vec.begin(),vec.end());
	int ind = 0;
	for(P p : vec){
		int num = p.second;
		while(num){
			if(!ans[ind]){
				ans[ind] = p.second + 1;
				num--;
			}
			ind++;
		}
	}
	ind = n * n - 1;
	for(int i = 0;i < n;i++){
		P p = vec[n - 1 - i];
		int num = n - p.second - 1;
		while(num){
			if(!ans[ind]){
				ans[ind] = p.second + 1;
				num--;
			}
			ind--;
		}
	}
	for(int i = 0;i < n;i++){
		int cnt = 0;
		for(int j = 0;j < x[i];j++) if(ans[j] == i + 1) cnt++;
		if(cnt != i + 1){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for(int i = 0;i < n * n;i++) cout << (i ? " " : "") << ans[i];
	cout << endl;
}

Measured memory_bytes: 2176
#include <stdio.h>
int n, r, t;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &r, &t);
		bool f1 = (r % 100 == 0);
		bool f2 = (t % 30 == 0);
		int t1 = t / 30;
		int t2 = r / 100;
		if (f1 && f2) {
			printf("%d\n", t1 * 5 + t2);
		}
		else if (f1) {
			printf("%d %d\n", t1 * 5 + t2, t1 * 5 + t2 + 5);
		}
		else if (f2) {
			printf("%d %d\n", t1 * 5 + t2, t1 * 5 + t2 + 1);
		}
		else {
			printf("%d %d %d %d\n", t1 * 5 + t2, t1 * 5 + t2 + 1, t1 * 5 + t2 + 5, t1 * 5 + t2 + 6);
		}
	}
	return 0;
}

Measured memory_bytes: 2748
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ff first
#define ss second
#define eb emplace_back
#define MP make_pair
#define pb push_back
#define pf push_front
#define ins insert
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define mset(m,v) memset(m,v,sizeof(m))
#define tr(c,it) for(auto it=c.begin();it!=c.end();it++)
#define fr(i,n) for(lli i=0;i<(n);i++)
#define inc(i,a,b) for(lli i=a;i<=b;i++)
#define dec(i,a,b) for(lli i=a;i>=b;i--)
#define fr2(i,n) for(int i=0;i<(n);i++)
#define inc2(i,a,b) for(int i=a;i<=b;i++)
#define dec2(i,a,b) for(int i=a;i>=b;i--)
#define ymin(a,b)  (a=min((a),(b)))
#define ymax(a,b)  (a=max((a),(b)))
#define sz(x) (lli)(x).size()
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr<< *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long int lli;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<lli,lli> plli;
typedef vector<lli> vlli;
typedef vector<int> vi;
//typedef  vector<vector<lli> >ncr(1001,vector<lli>(1001,0))
typedef vector<plli> vplli;
long long MOD=1000000009;
#define addm(x,y) (x+y>=MOD? (x+y-MOD):(x+y))
int main()
{
		#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	IOS
	
	// int t;
	// cin>>t;
	// for(int i=1;i<=t;i++)
	// {
	// 	cout<<"Case #"<<i<<": ";
	// 	solve();

	// }
	lli x,k,d;
	cin>>x>>k>>d;

	if(x<0)
		x=-x;
	if(x==0)
	{
		if(k%2==0)
			cout<<0<<endl;
		else
			cout<<d<<endl;
		return 0;
	}
	if((x/d)>=k)
	{
		cout<<x-d*k<<endl;
	}
	else
	{
		if(x>=d)
		{
			lli p=x-(x/d)*d;
			lli b=k-(x/d);
			if(b%2==1)
				cout<<min(abs(p-d),abs(p+d))<<endl;
			else
				cout<<abs(p)<<endl;
		}
		else
		{
			if(k%2==1)
				cout<<abs(x-d)<<endl;
			else
				cout<<x<<endl;
		}
	}
	
	
	
	
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll a, b;
    cin >> a >> b;
    ll ret{0};
    for (auto &&i: irange(0LL, b - a + 1)){
        ret += i;
    }
    cout << ret - b << endl;
    return 0;
}

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

typedef long long int lint;

using namespace std;
int weights[102];
int values[102];
lint dp[102][100005];

int visited[102][100005];

lint knapsack(int m, int c){
    if(m==0) return 0;

    if(visited[m][c]) return dp[m][c];
    visited[m][c] = 1;

    dp[m][c] = 0;

    if(c >= weights[m]){
        dp[m][c] = knapsack(m-1,c-weights[m]) + values[m];
    }

    return dp[m][c] = max(dp[m][c], knapsack(m-1,c));

}

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

    for(int i=1; i<=n; i++){
        cin >> weights[i] >> values[i];
    }

    cout << knapsack(n,w);



    return 0;
}

Measured memory_bytes: 118656
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define br break
#define con continue
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m);i>(int)(n);i--)
#define rev(i, n) revi(i, 0, n)
#define revill(i, m, n) for(ll i=(ll)(m);i>(ll)(n);i--)
#define revll(i, n) revill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) (n.begin(), n.end())
#define allr(n) (n.rbegin(), n.rend())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

int main() {
  int N;
  ci(N);
  ve<int> A(N);
  rep(i, N){
    ci(A.at(i));
  }
  int c = 0;
  wh(true){
    rep(i, N){
      if(A.at(i) % 2 == 0){
        A.at(i) /= 2;
      }
      else{
        co(c);
        rt;
      }
    }
    c++;
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int A,B,K;

int main()
{
	cin >> A >> B >> K;
	for (int i=min(A,B); ; i--)
	{
		if (!(A%i)&&!(B%i)) K--;
		if (!K)
		{
			cout << i;
			return 0;
		}
	}
}

Measured memory_bytes: 256
///IN THE NAME OF ALLAH
 #include<bits/stdc++.h>
 using namespace std;
 long long cnt[200000];
 long long D[200000];
 long long Arr[200000];
 int main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&Arr[i]);
    cnt[Arr[i]]++;
  }
  int l=0;
  for(int i=0;i<200000;i++)
    if(cnt[i]!=0)
      D[l++]=i;
  sort(D,D+l);
  long long mx=1;
  for(int i=0;i<l;i++){
     long long C1 = cnt[D[i]];
     long long C2 = cnt[D[i+1]];
     long long C3 = cnt[D[i+2]];
     mx=max(C1,max(C2,max(C3,mx)));
     if(i+1<l&&(abs(D[i]-D[i+1])==1||D[i]==D[i+1]))
       C1+=C2;
     if(i+1<l&&i+2<l&&(abs(D[i+1]-D[i+2])==1||D[i+1]==D[i+2]))
        C1+=C3;
     mx=max(mx,C1);
    }
   cout<<mx;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#include <cmath>
#include <iomanip>
#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 FORR(i, m, n) for(int i=m; i>=n; i--)
#define INF 999999999
#define ll long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
aaaaaaaaaaaaaaab
aaaaaaaaaaaaaaab
)");
#define cin input
#endif

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

	int n;
	n = s.size();

	string a;

	for (int i=0; i<n; i++)
	{
		if (s==t)
			break;

		a = s[n-1];
		s.pop_back();
		s = a+s;
	}

	cout << (s==t ? "Yes":"No") << endl;
}

Measured memory_bytes: 256
public class Main {
public static void main(String[] args) {
 java.util.Scanner scanner = new java.util.Scanner(System.in);
 String n = scanner.next();
 if (n.charAt(0) == n.charAt(1)  && n.charAt(0) == n.charAt(2)) {
   System.out.println("Yes");
 } else if (n.charAt(3) == n.charAt(1)  && n.charAt(3) == n.charAt(2)) {
   System.out.println("Yes");
 } else {
   System.out.println("No");
 }
}
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    if ((n % 2 == 1) || (n < 2)) {
        cout << 0 << endl;
    }
    else {
        ll cur = 5, ans = 0;
        n /= 2;
        while(cur <= n) {
            ans += n / cur;
            cur *= 5;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import itertools
n, k, q = map(int, input().split())
a = [0 for i in itertools.repeat(None, n)]
for i in itertools.repeat(None, q):
    t = int(input())
    a[t-1] += 1

for i in range(n):
    if a[i] + k - q > 0:
        print('Yes')
    else:
        print('No')



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

int calc_digit(int n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

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

    int digit = calc_digit(n);

    int ans = 0;
    
    int i = digit - 1;
    while(i > 0) {
        if (i % 2 == 1) {
            ans += pow(10, i) - pow(10, i - 1);
        }
        i--;
    }

    if (digit % 2 == 1) {
        ans += n - (pow(10, digit - 1) - 1);
    }

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

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

int main(){
  string s, t;
  cin>>s;
  cin>>t;
  int count = 0;
  for(int i=0;i<s.length();i++){
      if(s[i] != t[i])
        count++;
  }
  
  cout<<count;
}

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

int main(){
  int ans = INT_MAX;
  int tmp;
  int D, G;
  cin >> D >> G;
  int p[11], c[11];
  for(int i = 0; i < D; i++){
    cin >> p[i] >> c[i];
  }
  int sum, N_usenum;
  for(int conf = 0; conf < (1 << D); conf++){	//confは完答の組み合わせ
    sum = 0;
    N_usenum = 0;
    tmp = 0;
    for(int bit = 0; bit < D; bit++){
      if((conf >> bit) & 1){
      	sum += 100 * (bit+1) * p[bit] + c[bit];
        tmp += p[bit];
      }
      else{
        N_usenum = bit;
      }
    }
    
    if(sum < G){
      int p_data = 100 * (N_usenum + 1);
      if(G - sum <= p_data * (p[N_usenum] - 1)){
        tmp += (G - sum + p_data - 1) / p_data;
    	ans = min(ans, tmp);
      }
    }
    if(sum >= G){
      ans = min(ans, tmp);
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
const int INF = 1e6;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uld = unsigned long long;
using P = pair<int,int>;
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    ll n,d;
    cin >> n >> d;
    ll ans = 0;
    rep(i,n){
        ll p,q;
        cin >> p >> q;
        if(p*p+q*q <= d*d) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) string((s).rbegin(), (s).rend())
#define MP make_pair
#define X first
#define Y second

using namespace std;

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

typedef vector<vector<int> > vvi;
vvi rect;

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

int seedfill(vvi &r, int oldc, int newc){
//	if(oldc == newc) return;
	queue<P> q;
	r[1][1] = newc;
	q.push(MP(1, 1));

	int cnt = 1;
	while(!q.empty()){
		P p = q.front();
		q.pop();

		rep(i, 4){
			int x = p.X + dx[i];
			int y = p.Y + dy[i];
			if(r[y][x] == oldc){
				cnt++;
				r[y][x] = newc;
				q.push(MP(x, y));
			}
		}
	}
	return cnt;
}

int c;

int best;

int solve(int n = 0){
	if( n == 4 ){
		if(rect[1][1] != c) seedfill(rect, rect[1][1], c);
		return seedfill(rect, rect[1][1], 0); // カウント用に存在しない色で塗る
	}

	FOR(i, 1, 7){
		if(rect[1][1] == i) continue;

		//rep(test, 10){
		//	rep(testj, 10){
		//		cout << rect[test][testj];
		//	}
		//	cout << endl;
		//}
		//cout << endl;


		vvi tmp = rect;
		seedfill(rect, rect[1][1], i);
		//rep(test, 10){
		//	rep(testj, 10){
		//		cout << rect[test][testj];
		//	}
		//	cout << endl;
		//}
		//cout << endl;

		best = max(best, solve(n+1));
		rect = tmp;
	}

	return best;
}

int main(){
	rect.resize(10);
	rep(i, 10){
		rect[i].resize(10);
	}
	while(1){
		int h, w;
		cin >> h >> w >> c;
		if(!h && !w && !c) break;

		rep(i, 10){
			rep(j, 10){
				rect[i][j] = 0;
			}
		}

		rep(i, h){
			rep(j, w){
				cin >> rect[i+1][j+1];
			}
		}

		best = 0;
		//cout << "***";
		cout << solve() << endl;

		//rep(i, h+2){
		//	rep(j, w+2){
		//		cout << rect[i][j];
		//	}
		//	cout << endl;
		//}


	}

	return 0;
}

Measured memory_bytes: 1228
using System;
using System.Numerics;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split();
            var a = BigInteger.Parse(line[0]);
            var b = BigInteger.Parse(line[1]);
            var k = BigInteger.Parse(line[2]);

            if(k >= a){
                k -= a;
                a = 0;
                b = (b >= k ? b - k : 0);
            }else{
                a -= k;                
            }

            Console.WriteLine(string.Format("{0} {1}", a, b));
        }
    }
}


Measured memory_bytes: 13652
// (N * (L + (L + N - 1))) / 2
// (N * (2 * L + N - 1)) / 2
using System;
// using System.Collections.Generic;
// using System.Globalization;
// using System.IO;
// using System.Linq;
// using System.Text;
// using System.Text.RegularExpressions

class Program
{
    static void Main()
    {
        string[] arr = Console.ReadLine().Split();
        int N, L;
        N = int.Parse(arr[0]);
        L = int.Parse(arr[1]);
        int ans = (N * (2 * L + N - 1)) / 2;
        if (0 < L) ans -= L;
        else if (L + N - 1 < 0) ans -= L + N - 1;
        Console.WriteLine(ans);
        return;
    }
}

Measured memory_bytes: 27520
#include<bits/stdc++.h>
using namespace std;
const long long MOD=998244353;
long long f[2][3][3][2];
int n,x;
string s;
int main(){
    ios::sync_with_stdio(false);
    cin>>s;
    bool bz=0,bz1=1;
    f[0][0][0][0]=1;
    int sig=0;
    for (int i=0;i<s.size()-1;i++)
        if (s[i]==s[i+1])
            sig++;
    if (sig==s.size()-1&&sig){
        cout<<1;
        return 0;
    }
    for (int i=0;i<s.size();i++,swap(bz,bz1)){
        (x+=s[i]-'a')%=3;
        for (int j=0;j<3;j++)
            for (int k=0;k<3;k++)
                for (int l=0;l<2;l++)
                    if (f[bz][j][k][l]){
                        for (int r=0;r<3;r++)
                            (f[bz1][(j+r)%3][r][l||(k==r&&i)]+=f[bz][j][k][l])%=MOD;
                        f[bz][j][k][l]=0;
                    }   
    }
    long long ans=0;
    for (int i=0;i<3;i++)
        (ans+=f[bz][x][i][1])%=MOD;
    cout<<(ans+(sig==0&&!(s.size()==3&&s[0]!=s[1]&&s[0]!=s[2]&&s[1]!=s[2])))%MOD;
    return 0;
}

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

int main() {
	stack<int>s;
	string t; getline(cin, t);
	string k;
	for (char c : t) {
		if (c == ' ') {
			if (!k.empty())s.push(stoi(k));
			k = ""; continue;
		}
		if (c == '+') {
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(a + b);
		}
		else if (c == '-') {
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(b - a);
		}
		else if (c == '*') {
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(a*b);
		}
		else k += c;
	}
	cout << s.top() << endl;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;


int main(){
  string s;
  cin >> s;
  int n=s.size();
  ll ans=0;
  for (int tmp = 0; tmp < (1 << n); tmp++) {
    bitset<12> d(tmp);//これで0101010といった数列を2^n個生成してくれる
    string g="";
    for(int i=1;i<=n;i++){
      if(d[n-i]){g+=s[i-1];}
      else{
        if(g!=""){ll q=stol(g);
        ans+=q;
        g="";
        }
      }
    }
    if(g!=""){
      ans+=stol(g);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3508
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

const long long inf = std::numeric_limits<long long>::min();

vector<vector<long long>> dp;
long long f(int i, int W, const vector<int> &w, const vector<int> &v) {
  if (i == -1 or W <= 0) {
    return W >= 0 ? 0 : inf;
  }

  if (dp[i][W] == -1) {
    long long a = f(i - 1, W, w, v);
    long long b = v[i] + f(i - 1, W - w[i], w, v);
    dp[i][W] = max(a, b);
  }

  return dp[i][W];
}

int main() { IO;
  int n, W;
  cin >> n >> W;

  vector<int> w(n), v(n);
  for (int i = 0; i < n; ++i) {
    cin >> w[i] >> v[i];
  }

  dp.resize(n);
  for (auto &v : dp) {
    v.resize(W + 1);
    fill(v.begin(), v.end(), -1);
  }

  long long ans = f(n - 1, W, w, v);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 78720
N = int(input())
S = list(input())
w = [0 for i in range(N)]
e = [0 for i in range(N)]

if S[0] == 'W':
    w[0] = 1

for i in range(1,N-1):
    if S[i] == 'W':
        w[i] = w[i-1] + 1
        e[i+1] = e[i]  
    else:
        w[i] = w[i-1]
        e[i+1] = e[i] - 1

if S[-1] == 'W':
    w[-1] = w[-2] + 1
    scale = -e[-1]
else:
    w[-1] = w[-2]
    scale = -e[-1] +1

ans = w[0] + e[0]
for i in range(N):
    w[i] = w[i] + e[i]
    if ans > w[i]:
        ans = w[i]

print(ans + scale - 1)


Measured memory_bytes: 29412
A, B = map(int, input().split())

def prime_decompose(x):
    decomposed = []
    for i in range(2,int(pow(x,0.5))+1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed

A_dec = set(prime_decompose(A))
B_dec = set(prime_decompose(B))

ans = 1
for a in A_dec:
    if a in B_dec:
        ans += 1

print(ans)


Measured memory_bytes: 38512
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF=1e18;
#define PI 3.14159265358979323846
const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    COMinit();

    int A, B, C, D;
    cin >> A >> B >> C >> D;
    while(true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << '\n';
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << '\n';
            break;
        }
    }


    return 0;
}

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

int n[50];

int main(){
    int input = 0;
    while(cin >> n[input]){
        if(n[input] == EOF) break;
        input++;
    }
    for(int h = 0; h < input; h ++){
        int c = 0;
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                for (int k = 0; k < 10; k++)
                {
                    if (n[h] - (i + j + k) >= 0 && n[h] - (i + j + k) < 10)
                        c++;
                }
            }
        }
        cout << c << endl;
    }
    return 0;
}


Measured memory_bytes: 2984
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string s;
	cin >> s;
	if (s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I')
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
# O(N * log(Xn))
from bisect import bisect_left
import sys
readline = sys.stdin.readline
N = int(readline())
X = [int(x) for x in readline().split()]

# X = [i for i in range(2*10**5)]
# N = len(X)

sX = sorted(X)
m = (N - 1) // 2
for i in range(N):
    p = bisect_left(sX, X[i])
    if p <= m:
        print(sX[m + 1])
    else:
        print(sX[m])

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

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

int card[4][13] = {};
for(int i=0;i<n;i++){
string suit;
int num;
cin>>suit>>num;

if(suit == "S") card[0][num-1] = 1;
if(suit == "H") card[1][num-1] = 1;
if(suit == "C") card[2][num-1] = 1;
if(suit == "D") card[3][num-1] = 1;
}


string str[4] = {"S", "H" , "C", "D"};
for(int i=0;i<4;i++){
for(int j=0;j<13;j++){
if(card[i][j] == 1) continue;
cout<<str[i]<<" "<<j+1<<endl;
}
}

return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    string a, b, c; cin >> a >> b >> c;
    if(a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;


int n;
vector<int> h;
int ans = 0;

int main() {
    cin >> n;
    h.resize(n);
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    for(int l = 0; l < n; l++){
        // 左端から0になるまで水やりしていく
        // もともと0だったりすでに0だったらスルー
        while(h[l] > 0){
            // h[r] == 0より前までを水やり
            int r;
            for(r = l + 1; r < n; r++){
                if(h[r] == 0) break;
            }
            for(int i = 0; i < r; i++) h[i]--;
            ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 764
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
X, Y = rs_()
print('=' if X == Y else '<' if X < Y else '>')

Measured memory_bytes: 63468
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sp <<" "<<
bool isprime(ll n){
    if (n <= 1)return false;ll g=sqrt(n);
    for (ll i = 2; i <= g; i++)if (n % i == 0)return false;
    return true;
}
ll MOD=LLONG_MAX;
ll power(ll base, ll exp)
{
    if(exp==1)return base;
    else{if(exp%2==0){ll base1=(pow(power(base, exp/2),2));return base1%MOD;}
        else{ll ans=(base*pow(power(base,(exp-1)/2),2));return ans%MOD;}}
}
ll temp,temp1,temp2;
int main()
{
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n,x,t;
    cin>>n>>x>>t;

    int m=n/x;
    if(n%x) m++;
    cout<<m*t;
    
    return 0;
}


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

typedef unsigned long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define int ll
typedef long double ld;

int a,b,c;

int32_t main(){
	fast;
	
	cin>>a>>b>>c;
	
	//~ int d;
	//~ bool neg;
	//~ if (c < a + b) d = a + b - c, neg = 1;
	//~ else d = c - a - b, neg = 0;
	
	
	//~ if (neg){
		//~ if (4 * a * b > d * d) cout<<"Yes";
		//~ else cout<<"No";
	//~ }else{
		//~ if (4 * a * b < d * d) cout<<"Yes";
		//~ else cout<<"No";
	//~ }
	
	if (a + b >= c){
		cout<<"No";
		return 0;
	}
	
	if (a*a + b*b + c*c > 2 * a * b + 2 * a * c + 2 * b * c) cout<<"Yes";
	else cout<<"No";
	
	
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main() {
    int n,m;
    cin>>n>>m;
    vector<vector<pair<int,int>>> v(n+1);
    rep(i,m){
        int p,y;
        cin>>p>>y;
        v[p].push_back({y,i});
    }
    vector<pair<int,string>> ans;
    rep(i,n+1){
        sort(all(v[i]));
        rep(j,v[i].size()){
            string p=to_string(i);
            int num=p.size();
            rep(k,6-num){
                p='0'+p;
            }
            string nn=to_string(j+1);
            num=nn.size();
            rep(k,6-num) nn='0'+nn;
            ans.push_back({v[i][j].second,p+nn});
        }
    }
    sort(all(ans));
    rep(i,m) cout<<ans[i].second<<endl;
}



Measured memory_bytes: 13936
#include<bits/stdc++.h>
using namespace std;
//#define int long long

int main(){
    vector<int>adj[100001];
    int n,m;
    cin>>n>>m;
    int h[100001];
    for(int i=1;i<=n;i++)
        cin>>h[i];
//    cout<<n<<endl;
    for(int i=1;i<=m;i++)
    {
        int u,v;
        cin>>u>>v;
//        if(find(adj[u].begin(),adj[u].end(),v)==adj[u].end())
        adj[u].push_back(h[v]);
//        if(find(adj[v].begin(),adj[v].end(),u)==adj[v].end())
        adj[v].push_back(h[u]);
    }
    for(int i=1;i<=n;i++)
    {
        if(adj[i].size()>0)
            sort(adj[i].begin(),adj[i].end());
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(adj[i].size()==0)
            ans+=1;
        else
        {
            if(h[i]>adj[i][adj[i].size()-1])
                ans+=1;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 9148
// khodaya khodet komak kon
#include <bits/stdc++.h>
#define pb push_back
#define ers erase
#define ins insert
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
#define kill(x) return cout << x, 0;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vpl;

const ld Pi = 3.14159265359;
const ll MOD = 1000 * 1000 * 1000 + 7;
const ll N = 2e5 + 10;
const ll INF = 1e18;
const ll LOG = 20;

ll n, m, a[30];
int main(){
	IOS;
	ll ans = 1;
	cin >> n;
	str s;
	cin >> s;
	for (int i = 0; i < n; i++){
		a[s[i] - 'a'] ++;
	}
	for (int i = 0; i < 30; i++){
		ans *= a[i] + 1;
		ans %= MOD;
	}
	cout << (((ans - 1) % MOD) + MOD) % MOD;
	
	
	
	
	return 0;
}






/*
     ,---,           ___                 ,--,
    '  .' \        ,--.'|_             ,--.'|                             ,--,
   /  ;    '.      |  | :,'            |  | :                           ,--.'|    ,---.        ,---,
  :  :       \     :  : ' :            :  : '                 .--.--.   |  |,    '   ,'\   ,-+-. /  |
  :  |   /\   \  .;__,'  /    ,--.--.  |  ' |     ,--.--.    /  /    '  `--'_   /   /   | ,--.'|'   |
  |  :  ' ;.   : |  |   |    /       \ '  | |    /       \  |  :  /`./  ,' ,'| .   ; ,. :|   |  ,"' |
  |  |  ;/  \   \:__,'| :   .--.  .-. ||  | :   .--.  .-. | |  :  ;_    '  | | '   | |: :|   | /  | |
  '  :  | \  \ ,'  '  : |__  \__\/: . .'  : |__  \__\/: . .  \  \    `. |  | : '   | .; :|   | |  | |
  |  |  '  '--'    |  | '.'| ," .--.; ||  | '.'| ," .--.; |   `----.   \'  : |_|   :    ||   | |  |/
  |  :  :          ;  :    ;/  /  ,.  |;  :    ;/  /  ,.  |  /  /`--'  /|  | '.'\   \  / |   | |--'
  |  | ,'          |  ,   /;  :   .'   \  ,   /;  :   .'   \'--'.     / ;  :    ;`----'  |   |/
  `--''             ---`-' |  ,     .-./---`-' |  ,     .-./  `--'---'  |  ,   /         '---'
                            `--`---'            `--`---'                 ---`-'
*/




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

const int maxn=2005;
const int mod=1e9+7;
int n,m;
int dp[maxn];

void Add(int &a,int b){
	a+=b;
	if(a>=mod)a-=mod;
}

int main(){
	scanf("%d%d",&n,&m);
	dp[n+1]=1;
	for(int i=1;i<m;i++){
		int sum=dp[n-i+2];
		for(int j=n-i+1;j>=2;j--){
			Add(sum,dp[j]);
			dp[j]=sum;
		}
	}
	int ans=0;
	for(int j=2;j<=n-m+2;j++)Add(ans,dp[j]);
	for(int i=m+1;i<=n-1;i++)ans=2LL*ans%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 100100
const ll inf = (ll)1e10;
const ll mod = (ll)1e9+7;
int n, m;
vector <int> adj[MAXN];
int dp[MAXN];
int solve( int u ) {
	int sz = (int) adj[u].size();
	if ( sz == 0 ) return 1;
	if ( dp[u] != -1 ) return dp[u];
	int ret = 0;
	for ( int i = 0; i < sz; i++ ) {
		int v = adj[u][i];
		ret = max(ret,solve(v));
	}
	dp[u] = 1+max(dp[u],ret);
	return dp[u];
}
int main()
{
	#ifdef __APPLE__
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	for ( int i = 0; i < m; i++ ) {
		int x, y;
		cin >> x >> y;
		adj[x].push_back(y);
	}
	memset(dp,-1,sizeof(dp));
	for ( int i = 1; i <= n; i++ ) {
		if ( dp[i] == -1 ) solve(i);
	}
	int mx = 0;
	for ( int i = 1; i <= n; i++ ) mx = max(mx,dp[i]);
	cout << max(0,mx-1) << endl;
	return 0;
}


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

lint X[1005], Y[1005], A[45];
string ans[1005];

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N; cin >> N;
    for(int i=0;i<N;i++) cin >> X[i] >> Y[i];

    A[30] = 1;
    for(int i=29;0<=i;i--) A[i] = A[i+1] << 1;

    lint p = ((X[0]+Y[0])%2+2) % 2, M = 31;
    if(p==0) A[31] = 1, M++;

    for(int i=0;i<N;i++){
        lint x = X[i], y = Y[i];
        if(((x+y)%2+2)%2!=p) {cout << -1 << endl; return 0;}
        for(int j=0;j<M;j++){
            lint len = A[j], mx = A[j] + (p^1);
            if(abs(x-len)+abs(y)<mx) ans[i] += 'R', x -= len;
            else if(abs(x+len)+abs(y)<mx) ans[i] += 'L', x += len;
            else if(abs(x)+abs(y-len)<mx) ans[i] += 'U', y -= len;
            else ans[i] += 'D', y += len;
        }
    }

    cout << M << endl;
    for(int i=0;i<M;i++) cout << A[i] << ' ';
    cout << endl;
    for(int i=0;i<N;i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 384
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
class lazy_segment_tree{
    private:
        static int calc_size(int n){
            int m = 1;
            while(m < n){
                m *= 2;
            }
            return m;
        }

        void eval(int i, int l, int r){
            if(lazy[i] != -1){
                node[i] = lazy[i];
                if(r - l > 1){
                    lazy[i * 2 + 1] = lazy[i];
                    lazy[i * 2 + 2] = lazy[i];
                }
                lazy[i] = -1;
            }
        }

        void update(int s, int t, int x, int i, int l, int r){
            eval(i, l, r);

            if(t <= l || r <= s){
                return ;
            }

            if(s <= l && r <= t){
                lazy[i] = x;
                eval(i, l, r);
                return;
            }

            int m = l + (r - l) / 2;
            update(s, t, x, 2 * i + 1, l, m);
            update(s, t, x, 2 * i + 2, m, r);
            node[i] = node[2 * i + 1] + node[2 * i + 2];
        }

        T query(int s, int t, int i, int l, int r){
            eval(i, l, r);

            if(t <= l || r <= s){
                return 0;
            }

            if(s <= l && r <= t){
                return node[i];
            }

            int m = l + (r - l) / 2;
            T vl = query(s, t, i * 2 + 1, l, m);
            T vr = query(s, t, i * 2 + 2, m, r);
            return vl + vr;
        }

    public:
        int n;
        vector<T> node, lazy;
        T init;
        function<T(T, T)> f;

        lazy_segment_tree(int n, T init, function<T(T, T)> f)
            : n(calc_size(n)), node(calc_size(n) * 2, init) , lazy(calc_size(n) * 2, -1), init(init), f(f) {}

        T query(int s, int t){
            return query(s, t, 0, 0, n);
        }

        void update(int s, int t, int x){
            update(s, t, x, 0, 0, n);
        }
};

signed main(){
    int n, q;
    cin >> n >> q;

    lazy_segment_tree<int> lst(n+1, (1LL << 31)-1, [](int a, int b){return a+b;});
    rep(i, q){
        int qq;
        cin >> qq;

        if(qq == 0){
            int s, t, x;
            cin >> s >> t >> x;
            lst.update(s, t+1, x);
        }

        if(qq == 1){
            int i;
            cin >> i;
            cout << lst.query(i, i+1) << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 7084
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, m, v, p;std::cin >> n >> m >> v >> p;
  vll a(n);re(i, n) std::cin >> a[i];
  sort(a.begin(), a.end());
  ll l = -1, r = n+1;
  while(r-l>1){
    ll mid = (l+r)/2;
    if(n-1-mid<=p-1){
      r = mid;
      continue;
    }
    ll t = v - p - mid;
    ll s = 0;
    for(int i=mid+1;i<=n-p;i++) s+=a[mid]+m-a[i];
    if(s>=t*m&&a[n-p]-a[mid]<=m) {
      r = mid;
      //std::cout << a[mid] << " " << mid << " " << s << "ok" << '\n';
    }else {
      l = mid;
      //std::cout << a[mid] << " "<< mid << " " << s << "out" << '\n';
    }
  }
  std::cout << n - r << '\n';
  return 0;
}


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

#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ppb pop_back
#define vll vector<ll>
#define vi vector<int>
#define endl "\n"

const ll INF = 1000000007;

/*
const int max_size = 100001;
int parent[max_size];
int Size[max_size];

int root(int x){
	while(x!=parent[x]){
		parent[x] = parent[parent[x]];
		x = parent[x];
	}
	return x;
}

void sunion(int x,int y){
	int rx = root(x);
	int ry = root(y);
	if(rx != ry){
		if(Size[rx] > Size[ry]){
			parent[ry] = parent[rx];
			Size[rx] += Size[ry];
		}
		else{
			parent[rx] = parent[ry];
			Size[ry] += Size[rx];
		}
	}
}
*/

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc=1;
	//cin >> t;
	while(tc--){
		ll n,x,t;
		cin >> n >> x >> t;
		ll ans = (n/x)*t;
		if (n%x != 0) ans += t;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;


int main(){
  string s; cin >> s; ll count = 0;
  
  rep(i,3){
    if(s.at(i) == '1') count++;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256