akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const int INF=1e9+5;
const int N=2e5+5;
const int mod=1e9+7;

vector<int> v[N];
int val[N],cnt;
int dp[N],ans[N];

void dfs(int u,int par=-1){
	int id=lower_bound(dp,dp+N,val[u])-dp;
	int pre=dp[id];
	dp[id]=val[u];
	ans[u]=id;
	if(par!=-1) ans[u]=max(ans[u],ans[par]);
	for(int x:v[u]){
		if(x==par) continue;
		dfs(x,u);
	}
	dp[id]=pre;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	for(int i=0;i<n;++i) cin>>val[i];
	for(int i=0;i<n-1;++i){
		int x,y;
		cin>>x>>y;
		--x;
		--y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	for(int i=0;i<N;++i) dp[i]=INT_MAX;
	dp[0]=-INT_MAX;
	dfs(0);
	for(int i=0;i<n;++i) cout<<ans[i]<<endl;
	return 0;
}


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

signed main(void)
{
	int n, m, ans;
	int syokin[3];

	cin >> n >> m;
	syokin[2] = pow(10, 5);
	syokin[1] = 2 * syokin[2];
	syokin[0] = 3 * syokin[2];
	ans = 0;
	if (n == 1 && m == 1)
		cout << 10 * syokin[2] << endl;
	else
	{
		if (n - 1 < 3)
		ans += syokin[n - 1];
		if (m - 1 < 3)
		ans += syokin[m - 1];
		cout << ans << endl;
	}
	return 0;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  if(A==B){
    cout << A+B << endl;
  }
  else{
    int x;
    x=max(A,B);
    cout << x*2-1 << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int ReadValue() {
    int value; scanf("%d",&value);
    return value;
}
void ReadArray(int *Array,int index) {
    int i;
    for (i=0; i<index; i++) {
        scanf("%d",&Array[i]);
    }
}
void swap(int *a,int *b) {
    int temp; temp=*a; *a=*b; *b=temp;
}
int bubbleSort(int *Array, int index) {
    int swapcount=0;
    int j,flag=1;
    while (flag) {
        flag=0;
        for (j=index-1; j>=1; j--) {
            if (Array[j]<Array[j-1]) {
                swap(&Array[j],&Array[j-1]);
                swapcount++;
                flag=1;
            }
        }
    }
    return swapcount;
}
void Display(int *Array,int index) {
    int ans=bubbleSort(Array,index);
    int i;
    for (i=0; i<index; i++) {
        if (i>0) {
            printf(" ");
        }
        printf("%d",Array[i]);
    }
    printf("\n");
    printf("%d\n",ans);
}
int main() {
    int N=ReadValue();
    int A[N]; ReadArray(A,N);
    Display(A,N);
    return 0;
}


Measured memory_bytes: 2140
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    int tmp = r * x - d;
    imfor(i, 10) {
        cout << tmp << endl;
        tmp = r * tmp - d;
    }

}

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

int main() {
	int n, x, s=0;
	cin >> n >> x;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
		
	}
	sort(a.begin(),a.end());
	for (int j =0; j < n; j++) {
		s=s+a.at(j);
	}
	cout << n+(x-s)/a.at(0)<<endl;

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){

	int a,b,c,d;
	int ans;

	scanf("%d %d %d %d", &a, &b, &c ,&d);

	if(a*b > c*d){
		ans = a*b;
	}else{
		ans = c*d;
	}

	printf("%d\n", ans);

	return 0;


}

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

int main(){

        string S;
        cin >> S;

        int L=S.size(); // length of the series of words

        if(S[0]!='A'){
                cout << "WA";
                return 0;
        }

        int C=0; // counter for "C"

        int i;

        for(i=1;i<L;i++){
                if(isupper(S[i])){              // judge of capital letters
                        if(i==1 || i==L-1 || S[i]!='C'){
                        cout << "WA";
                        return 0;
                        }
                C++;
                }
        }

        if(C!=1){
        cout << "WA";
        return 0;
        }

        cout << "AC";

        return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		int[] abc = Stream.of(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
		if (abc[0] == abc[1]) {
			System.out.println(abc[2]);
		} else if (abc[1] == abc[2]) {
			System.out.println(abc[0]);
		} else {
			System.out.println(abc[1]);
		}
	}
}


Measured memory_bytes: 29004
#include<stdio.h>
#define N_MAX 120
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N_MAX][N_MAX];
int color[N_MAX], d[N_MAX], f[N_MAX], t;

void visit(int u);
void dfs();

void visit(int u)
{
	int v;

	color[u] = GRAY;
	d[u] = ++t;
	for(v=0; v<n; v++){
		if(M[u][v] == 0) continue;
		if(color[v] == WHITE){
			visit(v);
		}
	}
	color[u] = BLACK;
	f[u] = ++t;
}

void dfs()
{
	int u;
	for(u=0; u<n; u++){
		color[u] = WHITE;
	}
	t=0;

	for(u=0; u<n; u++){
		if(color[u] == WHITE) visit(u);
	}
	for(u=0; u<n; u++){
		printf("%d %d %d\n", u+1, d[u], f[u]);
	}
}


int main()
{
	int u, v, k;
	int i, j;
	
	scanf("%d", &n);
	for(i=0; i<n; i++){
		for(j=0; j<n; j++){
			M[i][j] = 0;
		}
	}

	for(i=0; i<n; i++){
		scanf("%d%d", &u, &k);
		u--;
		for(j=0; j<k; j++){
			scanf("%d", &v);
			v--;
			M[u][v] = 1;
		}
	}

	dfs();

	return 0;
}

Measured memory_bytes: 644
//<--sbhmsh-->//

#include <bits/stdc++.h>
#include <iostream>
#define FASTIO std::ios::sync_with_stdio(false);
using namespace std;
#define lli long long int
#define endl '\n'
#define deb cout<<"sab_badhiya"<<endl;
// const long long INF = 1000 * 1000 * 1000 * 1ll * 1000 * 1000 * 1000;
const long INF = 1000 * 1000 * 1000;
const long long int mod = 1000000007;
int a[105], b[105];
lli dp[100][100005]= {0};
vector<int>g[105];
int main() {
  FASTIO
  int n, w, v;
  cin >> n >> w;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  vector<int>::iterator it;
  for (int i = 0; i <= w; i++) {
    if (a[0] <= i) {
      dp[0][i] = b[0];
    }
    else {
      dp[0][i] = 0;
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= w; j++) {
      if(j >= a[i])dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a[i]] + b[i]);
      else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }
  cout << dp[n - 1][w] << endl;
}


Measured memory_bytes: 78464
n_regident = int(input())
address = list(map(int, input().split()))

min_total_dis = 100000000
for i in range(min(address), max(address)+1):
    total_dis = sum(map(lambda x:(x-i)**2, address))
    min_total_dis = min(min_total_dis, total_dis)

print(min_total_dis)

Measured memory_bytes: 3060
#include <stdio.h>

int division2(int x, int n)
{
	if ((x % 2) == 0) {
		n++;
		division2(x/2, n);
	}

	else return n;
}

int minof(int x[], int n)
{
	int i, min;

	min = x[0];

	for (i = 1; i < n; i++) {
		if (min > x[i]) min = x[i];
	}

	return min;
}

int main(void)
{
	int i;
	int N;
	int A[200], count[200];
	int min;

	scanf("%d", &N);

	for (i = 0; i < N; i++) {
		scanf("%d", &A[i]);
	}

	for (i = 0; i < N; i++) {
		count[i] = division2(A[i], 0);
	}

	min = minof(count, N);

	printf("%d", min);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<pair<int, ll>>>;

const int INF = 1001001001;
vector<ll> dist;
vector<bool> seen;
Graph G;

void dfs(int v, ll d = 0){
    seen[v] = true;
    dist[v] = d;
    for(auto p : G[v]){
        int nv = p.first;
        ll far = p.second;
        if(seen[nv]) continue;
        dfs(nv, d+far);
    }
}

int main(){
    int n; cin >> n;
    G.resize(n);
    dist.resize(n);
    seen.resize(n, false);
    for(int i = 0; i < n-1; i++){
        int a, b;
        ll c; 
        cin >> a >> b >> c;
        --a; --b;
        G[a].push_back({b, c});
        G[b].push_back({a, c});
    }
    int q, k; cin >> q >> k;
    --k;
    dfs(k);
    for(int i = 0; i < q; i++){
        int x, y; cin >> x >> y;
        --x; --y;
        cout << dist[x] + dist[y] << endl;
    }
}

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

using namespace std;

//R:1~9, G:11~19, B:21~29 とする．

#define RED		0
#define GREEN	10
#define BLUE	20

int main(void)
{
	int T;
	cin >> T;
	for(int i=0;i<T;i++){
		vector<int> card(9, 0);
		for(int j=0;j<9;j++){
			int n;
			cin >> n;
			card[j] += n;
		}
		for(int j=0;j<9;j++){
			string color;
			cin >> color;
			if (color == "R"){
				card[j] += RED;
			}else if(color == "G"){
				card[j] += GREEN;
			}else if(color == "B"){
				card[j] += BLUE;
			}
		}
		bool win=false;
		//cardをソート
		sort(card.begin(), card.end());
		do{
			int set=0;
			for(int j=0;j<3;j++){
				//3つ同じカードの場合
				if (card[3*j]==card[3*j+1] && card[3*j+1]==card[3*j+2]){
					set++;
				}
				//連番の場合
				if (card[3*j]+1==card[3*j+1] && card[3*j+1]+1==card[3*j+2]){
					set++;
				}
			}
			//3つのセットができていたら
			if (set == 3){
				win = true;
				break;
			}
		}while(next_permutation(card.begin(), card.end()));
		if (win){
			cout << 1 << endl;
		}else{
			cout << 0 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3156
#N = gets.chomp.to_i
A = []
A[0] = gets.chomp.split.map(&:to_i)
A[1] = gets.chomp.split.map(&:to_i)
A[2] = gets.chomp.split.map(&:to_i)
# S = gets.chomp.chars

def check_b(b)
  0.upto(2).each do |i|
    0.upto(2).each do |j|
      if A[i][j] == b
        A[i][j] = -1
      end
    end
  end
end

def bingo
  # Check row
  0.upto(2).each do |i|
    ok = true
    0.upto(2).each do |j|
      if A[i][j] != -1
        ok = false
        break
      end
    end
    if (ok)
      return true
    end
  end
  
  # Check col
  0.upto(2).each do |j|
    ok = true
    0.upto(2).each do |i|
      if A[i][j] != -1
        ok = false
        break
      end
    end
    if (ok)
      return true
    end
  end
  
  # Check vertice
  if A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1
    return true
  end
  
  # Check vertice
  if A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1
    return true
  end
  return false   
end

N = gets.chomp.to_i
N.times do
  b = gets.chomp.to_i
  check_b(b)
end

if bingo
  print "Yes\n"
else
  print "No\n"
end

Measured memory_bytes: 1788
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
#include <functional>
#include <random>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef long double LD;
typedef vector<LD> vld;
typedef vector<pair<LD, LD>> vpld;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
typedef vector<vvpl> vvvpl;
typedef pair<ll, PL> TL;
typedef vector<TL> vtl;
typedef vector<vtl> vvtl;
typedef long double ld;
typedef vector<ld> vld;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T> T gcd(T a, T b) {return (a == 0) ? b : gcd(b%a, a);}
template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b;}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec /* copy */){
    sort(ALL(vec)); vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
//friend bool operator<(const tpl& lhs, const tpl& rhs){
//    return std::tie(lhs.l, lhs.r) < std::tie(rhs.l, rhs.r);
//}

bool bit(ll st, ll b){return ((st>>b)&1) == 1;}


int main(){
#ifdef __DEBUG_LOCAL__
    ifstream file("../../../../../in.txt"); if(file.is_open()) cin.rdbuf(file.rdbuf());
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    
    ll A, B, C; cin >> A >> B  >> C;
    set<ll> s; s.insert(A); s.insert(B); s.insert(C);
    
    cout << (s.size() == 2 ? "Yes" : "No") << endstr;
    return 0;
}


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

from collections import defaultdict
E = [list() for _ in range(N)]

for _ in range(M):
  l,r,d = map(int,input().split())
  E[l-1].append((r-1,d))
  E[r-1].append((l-1,-d))

locations = [None]*N

for s in range(N):
  if locations[s] is None:
    locations[s] = 0
    stack = [s]

    while stack:
      v = stack.pop()
      p = locations[v]

      for u,d in E[v]:
        if locations[u] is None:
          locations[u] = p+d
          stack.append(u)
        elif locations[u] != p+d:
          print('No')
          exit()


print('Yes')


Measured memory_bytes: 66236
import java.util.*;

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

        int D = sc.nextInt();
        int N = sc.nextInt();
        long ans = 0;

        if(D==0){
            if(N==100){
                ans = 101;
            }
            else{
                ans = N;
            }
        }
        else if(D==1){
            if(N==100){
                ans = 10100;
            }
            else{
                for(int i=0; i<N; i++){
                    ans += 100;
                }
            }
        }
        else{
            if(N==100){
                ans = 1010000;
            }
            else{
                for(int i=0; i<N; i++){
                    ans += 10000;
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>


#define MAX 500000
#define SENTINEL 2000000000

int LEFT[MAX/2+2],RIGHT[MAX/2+2];
int c;

void marge(int A[],int n,int left, int mid, int right)
{
  int i,j=0,g,n1,n2;
   n1 = mid -left;
   n2 = right - mid;
  for ( i = 0; i < n1; i++) LEFT[i]  =  A[left + i];
  for ( i = 0; i < n2; i++) RIGHT[i] =  A[mid  + i];
  LEFT[n1] = RIGHT[n2] = SENTINEL;
  i=0;
 
  for(g = left; g < right; g++)
    {
      c++;
      if(LEFT[i] <= RIGHT[j])
	{
	  A[g] = LEFT[i++];
	}
      else
	{
	  A[g] = RIGHT[j++];
	}
    }
}

void margesort(int A[],int n, int left, int right)
{
  int mid;
  if(left+1<right)
    {
      mid = (left + right)/2;
      margesort(A,n,left,mid);
      margesort(A,n,mid,right);
      marge(A,n,left,mid,right);
    }
}

int main()
{
  int A[MAX],n,i;
  c =0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  margesort(A,n,0,n);

  for(i=0;i<n;i++)
    {
      if(i)
	printf(" ");
      printf("%d",A[i]);
	
    }
  printf("\n");

  printf("%d\n",c);

  return 0;
}
    
      



Measured memory_bytes: 6472
n,m,x=map(int,input().split())
X=[]
for i in range(n):
    X.append(list(map(int,input().split())))

ans=10**9
for i in range(2**n):
    s=format(i,'b')
    Z=s.zfill(n)
    cost=0
    M=[0]*m
    for j in range(n):
        if Z[j]=='1':
            cost+=X[j][0]
            for k in range(m):
                M[k]+=X[j][1+k]
    if all([m>=x for m in M]):
        ans=min(ans,cost)

if ans==10**9:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9224
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    a = list(map(int, input().split()))
    res = 0
    cnt = 0
    while cnt < n-1:
        if a[cnt] == a[cnt+1]:
            res += 1
            cnt += 2
        else:
            cnt += 1
    print(res)

if __name__ == '__main__':
    main()

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

void solve() {
  int n, k;
  cin>>n>>k;
  vector <int> a(n);
  for (int i=0; i<n; i++) {
    cin>>a[i];
  }
  sort (a.begin(), a.end());
  int sum=0;
  for (int i=0; i<k; i++) {
    sum+=a[i];
  }
  cout<<sum;
  return;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
    solve();
	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(obj)   (obj).begin(),(obj).end()

#define debug(var)  do{std::cout << __LINE__ << "> " << #var << ": ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

// 重み無し
struct UnWeightedEdge {
    int src, to;
    UnWeightedEdge(int src, int to) : src(src), to(to) {}
};
using UnWeightedEdges = vector<UnWeightedEdge>;
using UnWeightedGraph = vector<UnWeightedEdges>;

void Main() {
	int N, M; cin >> N >> M;
	UnWeightedGraph g(N, UnWeightedEdges());
	REP(i, M) {
		int A, B; cin >> A >> B;
		--A, --B;
		g[A].emplace_back(A, B);
		g[B].emplace_back(B, A);
	}

	vector<bool> seen(N);
	vector<int> dir(N);
    queue<int> que;

    seen[0] = true;
	dir[0] = -1;
    que.push(0);

	while (!que.empty()) {
        int v = que.front();
        que.pop();

        for (auto e : g[v]) {
            int next_v = e.to;
            if (seen[next_v]) continue;

            // 処理
            seen[next_v] = true;
            dir[next_v] = v;
            que.push(next_v);
        }
    }
	cout << "Yes" << endl;
	for (auto d : dir) {
		if (d + 1 == 0) continue;
		cout << d + 1 << endl;
	}
}

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


Measured memory_bytes: 12276
N, M = map(int, input().split())
ans = -1
cond = []
for i in range(M):
  cond.append(list(map(int, input().split())))
for i in range(10**3):
  D = True
  s = str(i)
  if M == 0 and N >= 2:
    ans = 10 ** (N-1)
    break
  for j in range(M):
    if N > len(s):
      D = False
      break
    if s[cond[j][0]-1] != str(cond[j][1]):
      D = False
      break
  if D == True:
    ans = i
    break
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var p = Input().ToInt();
		var n = p[0];
		var m = p[1];
		var s = Console.ReadLine();
		var t = new List<int>();
		for(int i = s.Length - 1; i >= 0; )
		{
			int j = m;
			for(; j >= 1 && (i - j) < s.Length && (i - j) >= 0; j--)
			{
				if(s[i - j] == '0')
					break;
			}
			if(j < 1)
			{
				Console.WriteLine(-1);
				return;
			}
			if(i - j < 0)
			{
				j = i;
			}
			t.Add(j);
			i -= j;
			if(i <= 0)
				break;
		}
		for(int i = t.Count - 1; i >= 0; i--)
		{
			Console.Write(t[i] + " ");
		}
		Console.WriteLine();
	}

	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


Measured memory_bytes: 14560
#include <stdio.h>
int main()
{
	int count_red=0;
	int count_blue=0;
	int i;
	char s[256];
	int n;
	scanf("%d",&n);
	scanf("%s",&s);
	
	for(i=0;i<n;i++)
	{
		if(s[i]=='R')
		{
			count_red++;
		}
		
		else
		{
			count_blue++;
		}
	}
	
	if(count_red>count_blue)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int
main(){
  int a, b;
  scanf("%d %d", &a, &b);
  if(a < 1 || 10000 < b)
    return 1;

  if( (a % 2) && (b % 2)  ){
    printf("Odd\n");
  } else {
    printf("Even\n");
  }
  
  return 0;
}

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

#define ordered_set_ii tree<pair<int,int>,null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_set_int tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define MP make_pair
#define pb push_back
#define FS first
#define SC second
#define INF (1e9+7)

typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef long long ll;
typedef pair<long long,int> pli;

int maxn = 200000;

int main()
{
    string s;
    cin>>s;
    int n = s.size();
    ll sum = 0;
    for(int i=0;i<n;i++)
        sum += int(s[i]-'0');
    if(sum%9==0)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}


Measured memory_bytes: 3720
# n,m,k = gets.chomp.split(' ').map(&:to_i)
# a = gets.chomp.split(' ').map(&:to_i)
# b = gets.chomp.split(' ').map(&:to_i)
# count = 0
# while true
#   if a[0] <= b[0] && a[0] <= k 
#     k -= a[0]
#     a.shift()
#     a << 200001 if a == []
#     count += 1
#   elsif a[0] > b[0] && b[0] <= k
#     k -= b[0]
#     b.shift()
#     b << 200001 if b == []
#     count += 1
#   else
#     break
#   end
#   # p a,b,k
# end
# puts count


n, m, k = gets.split.map(&:to_i)
a = [0] + gets.split.map(&:to_i)
b = [0] + gets.split.map(&:to_i)
 
n.times {|i| a[i+1] += a[i]}
m.times {|j| b[j+1] += b[j]}
 
ans = 0
j = m
(n+1).times do |i|
    break if a[i] > k
    j -= 1 while a[i] + b[j] > k && j > 0
    ans = [ans, i + j].max
end
 
p ans

Measured memory_bytes: 44364
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/



int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	string s;
	int k;
	cin >> s >> k;

	int n = s.size();
	set<string> st;
	for (int i = 1; i <= k; i++)
	{
		//i文字の部分文字列
		for (int j = 0; j < n; j++)
		{
			if (j + i > n)continue;
			//cout << s.substr(j,i);
			st.insert(s.substr(j, i));
		}
	}


	int cnt = 1;
	for (auto itr : st) {
		//cout << itr << endl;
		if (cnt == k) {
			cout << itr << endl;
			return 0;
		}
		cnt++;
	}




	return 0;
}



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

inline int D(){
    int t ;
    scanf( "%d" , &t ) ;
    return t ;
}
inline ll LLD(){
    ll t ;
    scanf( "%lld" , &t ) ;
    return t ;
}
//const int INF = 0x3f3f3f3f;
//const int mod=1e9+7;
//const double pi="3.14159265359;
//###################################################################

int main(){
    int n=D(),x=D(),t=D();
    int z=n/x;
    if(n%x)z++;
    cout<<z*t;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
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;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n - 1));
    REP(i, n) REP(j, n - 1) {
        cin >> a[i][j];
        a[i][j]--;
    }

    vector<int> q(n);
    iota(ALL(q), 0);
    int d = 0;
    while (!q.empty()) {
        d++;
        vector<int> r;
        r.swap(q);
        vector<bool> b(n, true);
        for (int i : r) {
            if (!b[i]) continue;
            int o;
            if (a[i][0] >= 0) {
                o = a[i][0];
            } else {
                o = a[i][-a[i][0]];
            }
            if (!b[o]) continue;
            if (a[o][0] == i) {
                // ok
                b[i] = false;
                b[o] = false;
                if (a[i][0] >= 0) {
                    a[i][0] = -1;
                } else {
                    a[i][0]--;
                }
                a[o][0] = -1;
                if (a[i][0] > 1 - n) {
                    q.push_back(i);
                }
                if (a[o][0] > 1 - n) {
                    q.push_back(o);
                }
            } else if (a[o][0] < 0 && a[o][0] > 1 - n) {
                if (a[o][-a[o][0]] == i) {
                    // ok
                    b[i] = false;
                    b[o] = false;
                    if (a[i][0] >= 0) {
                        a[i][0] = -1;
                    } else {
                        a[i][0]--;
                    }
                    a[o][0]--;
                    if (a[i][0] > 1 - n) {
                        q.push_back(i);
                    }
                    if (a[o][0] > 1 - n) {
                        q.push_back(o);
                    }
                }
            }
        }
    }
    REP(i, n) {
        if (a[i][0] > 1 - n) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << d << endl;
}


Measured memory_bytes: 4224
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

m1, d1 = rm()
m2, d2 = rm()
if m1 != m2:
    print(1)
else:
    print(0)


Measured memory_bytes: 27116
#include<iostream>
#include<string>
#include<stack>/*** LIFO *** stack<type> var;
push(), top():to get data, pop():to remove, size(), empty() ***/
using namespace std;

#define Fp(I, STAT, END) for(int I = STAT; I < END; I++)
#define Fm(I, STAT, END) for(int I = STAT; I > END; I--)

int main(){
    int N;
    string S;
    cin >> N >> S;
    int length = S.length();
    Fp(i, 0, length){
        if((int)S[i] + N > 'Z'){
            S[i] = 'A' - 1 + (int)S[i] + N - 'Z';
        }else{
            S[i] = (int)S[i] + N;
        }
    }
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a, b, c, d, p;
	int x, y;
	
	scanf("%d %d %d %d %d", &a, &b, &c, &d, &p);
	
	x = a*p;
	if (p < c) y = b;
	else y = b + d*(p-c);
	
	if (x > y) printf("%d\n", y);
	else printf("%d\n", x);
	
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() {
	int n, m;
	cin >> n >> m;
	vector<P<int>> part(m);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		int syugo = 0;
		rep(j, b) {
			int k;
			cin >> k;
			k--;
			syugo |= (1 << k);
		}
		part[i] = make_pair(syugo, a);
	}
	VV dp(m + 1, V((1 << n), upper));
	dp[0][0] = 0;
	rep(i, m) {
		rep(j, (1 << n)) {
			chmin(dp[i + 1][j], dp[i][j]);
			int nj = (j | part[i].first);
			chmin(dp[i + 1][nj], dp[i][j] + part[i].second);
		}
	}
	if (dp[m][(1 << n) - 1] == upper) cout << -1 << endl;
	else cout << dp[m][(1 << n) - 1] << endl;
	return 0;
}

Measured memory_bytes: 16384
N, Q = gets.chomp.split(" ").map{|s| s.to_i }
S = gets.chomp

q_arr = []
Q.times do |i|
  q_arr << gets.chomp.split(" ").map{|s| s.to_i }
end

iarr = [0] # index調整兼index=1の時の初期値
count = 0
N.times do |i|
  count += 1 if S[i..(i+1)] == "AC"
  iarr << count
end

q_arr.each do |l, r|
  left = iarr[l-1] # lの時の増分を入れるために-1
  right = iarr[r-1] # rの時の増分を外すために-1

  puts right - left
end


Measured memory_bytes: 11260
#include <vector>
#include <iostream>
#include <cstdio>

using namespace std;
typedef long long ll;

int nxt() {
    int x;
    scanf("%d", &x);
    return x;
}

template <class T>
T remin(T &x, T val) {
    if (x > val) {x = val;}
    return x;
}

template <class T>
T remax(T &x, T val) {
    if (x < val) {x = val;}
    return x;
}

void solve() {
    int n = nxt();
    vector<int> t(n + 1);
    vector<int> x(n + 1);
    vector<int> y(n + 1);
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for (int i = 1; i <= n; ++i) {
        t[i] = nxt();
        x[i] = nxt();
        y[i] = nxt();
    }
    for (int i = 0; i < n; ++i) {
        int d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
        if (d > t[i + 1] - t[i]) {
            cout << "No\n";
            return;
        }
        int dt = (t[i + 1] - t[i]);
        if ((dt - d) % 2 != 0) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "r", stdout);
#endif

//    int t = nxt();
//    for (int i = 0; i < t; ++i) {
//        solve();
//    }
    solve();
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
#include <inttypes.h>

uint64_t atusa[64];
uint64_t zenbu[64];

uint64_t yakusimaruhiroko(int lv, uint64_t taberu) {
	if (lv == 0) {
		return taberu > 0;
	} else if (atusa[lv] <= taberu) {
		return zenbu[lv];
	} else if (1 + atusa[lv - 1] + 1 + atusa[lv - 1] <= taberu) {
		return zenbu[lv - 1] + 1 + zenbu[lv - 1];
	} else if (1 + atusa[lv - 1] + 1 <= taberu) {
		return zenbu[lv - 1] + 1 + yakusimaruhiroko(lv - 1, taberu - (1 + atusa[lv - 1] + 1));
	} else if (1 <= taberu) {
		return yakusimaruhiroko(lv - 1, taberu - 1);
	} else {
		return 0;
	}
}

int main(void) {
	int N;
	uint64_t X;
	int i;
	if (scanf("%d%" SCNu64, &N, &X) != 2) return 1;
	atusa[0] = 1;
	zenbu[0] = 1;
	for (i = 1; i <= N; i++) {
		atusa[i] = 1 + atusa[i - 1] + 1 + atusa[i - 1] + 1;
		zenbu[i] = zenbu[i - 1] + 1 + zenbu[i - 1];
	}
	printf("%" PRIu64 "\n", yakusimaruhiroko(N, X));
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou((int)bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<int> hukasa;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
    }
    else{
      par.at(rx) = ry;
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}

int main(){
  long long n;
  cin >> n;
   cout << (n-1) * n / 2 << endl;
}

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

typedef long long ll;
ll MOD = 1000000007;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}


int main(){
  string S;cin >> S;
  vector<char> T;
  for(int i = 0;i < S.size();i++){
    T.push_back(S[i]);
  }
  T.push_back('A');
  int n = T.size();
  for(int i = 0;i < n;i++){
    if(T[i] == 'S' && T[i+1] == 'T'){
      remove(T,i);
      remove(T,i);
      n = T.size();
      i--;i--;
    }
  }
  cout << n - 1 << endl;
}

Measured memory_bytes: 772
import java.util.Scanner;

public class Main {
    public static String process(int N, int i) {
        return String.valueOf(N - i + 1);
    }

    // Util Func

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

        // process
        final String result = process(N, i);

        // output
        System.out.println(result);
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
int main()
{
	int H,W,n,m,i,j,k;
	char a[100][100];
	scanf("%d %d",&H,&W);
	m=W+2;
	for(i=0;i<H;i++)
	{
		scanf("%s",&a[i]);
	}
	for(k=0;k<m;k++)
	{
		printf("#");
	}
	printf("\n");
	for(i=0;i<H;i++)
	{
		printf("#");
		for(j=0;j<W;j++)
		{
			printf("%c",a[i][j]);
		}
		printf("#\n");
	}
	for(k=0;k<m;k++)
	{
		printf("#");
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
while True:
    Hcounter = 1 # "#"
    H, W = map(int,input().split())
    if H == 0 and W ==0:
        break
    for i in range(H):
        chesstr = str()
        if Hcounter == 1:
            Wcounter = 1 # "#"
        else :
            Wcounter = -1 # "."
        for j in range(W):
            if Wcounter == 1:
                chesstr += "#"
            else:
                chesstr += "."
            Wcounter *= -1
        print(chesstr)
        Hcounter *= -1
    print()


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

int main() {
  string S;
  cin >> S;
  // cout << S.size() << endl;
  vector<int> just(S.size() + 1);
  vector<int> over(S.size() + 1);
  just[0] = 0;
  over[0] = 1;
  for(int i = 0; i < S.size(); ++i) {
    int n = S[i] - '0';
    just[i + 1] = min(just[i] + n, over[i] + 10 - n);
    over[i + 1] = min(just[i] + n + 1, over[i] + 9 - n);
  }
  int ans = just[S.size()];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9220
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=nxt(),b=nxt();
    set <int> s;
    s.insert(1);
    s.insert(2);
    s.insert(3);
    s.erase(a);
    s.erase(b);
    cout<<*(s.begin())<<endl;
    
    

    return 0;   
}


 
 


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	m := make(map[int]int)
	for i := 0; i < n; i++ {
		sc.Scan()
		x, _ := strconv.Atoi(sc.Text())
		m[x]++
	}

	if m[0] == n {
		fmt.Println("Yes")
		return
	}

	if n%3 != 0 {
		fmt.Println("No")
		return
	}

	switch len(m) {
	case 2:
		if m[0] == n/3 {
			fmt.Println("Yes")
			return
		}
	case 3:
		x := 0
		for k, v := range m {
			if v != n/3 {
				fmt.Println("No")
				return
			}
			x ^= k
		}
		if x == 0 {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}


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

int main() {
	// your code goes here
	int N,X,T;
	cin>>N>>X>>T;
   long long int val = 0;
    while(N>0)
    {
        N=N-X;
       val+=T;
    }
	cout<<val<<endl;
	return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }

int main() {
    int n;
    cin >> n;
    vector<st> s(n);
    rep(i, n) cin >> s.at(i);
    int ac = 0, wa = 0, tle = 0, re = 0;
    rep(i, n){
        if(s.at(i) == "AC") ac++;
        if(s.at(i) == "WA") wa++;
        if(s.at(i) == "TLE") tle++;
        if(s.at(i) == "RE") re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 6388
// ABC 154-F
// 2020.2.9 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long ll;

#define MOD 1000000007
#define MAX 2000005
int fact[MAX+2] = {1,1};
int inv[MAX+2] = {1,1};
int facinv[MAX+2] = {1,1};

void init() {
    int i;
	for (i = 2; i < MAX; i++) {
		fact[i] = (ll)fact[i-1]*i % MOD;
		inv[i] = -(MOD/i)*(ll)inv[MOD%i] % MOD;
		facinv[i] = (ll)facinv[i-1]*inv[i] % MOD;
	}
}

int comb(int n, int k) {
    if (n < k) return 0;
//	if (k == 0) return 1;
    return (ll)fact[n] * facinv[k] % MOD * facinv[n-k] % MOD;
}

int main()
{
	int i, r, c, r1, r2, c1, c2;
	ll ans;

    init();
	scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
	ans = 0;
	for (r = r1; r <= r2; ++r) {
		ans += comb(c2+1+r, r+1) - comb(c1+r, r+1);
	}
    ans %= MOD;
	if (ans < 0) ans += MOD;
	printf("%d\n", (int)ans);
	return 0;
}

Measured memory_bytes: 23552
<?php

fscanf(STDIN, '%d %d %d', $inputParticipants, $inputPoints, $inputTimes);

$initializePoints = $inputPoints - $inputTimes;

//各参加者の持ち点
$participantHasPointsList = [];
for ($ip = 1; $ip <= $inputParticipants; $ip++){
    $participantHasPointsList[$ip] = $initializePoints;
}

for ($iTime = 1; $iTime <= $inputTimes; $iTime++){

    fscanf(STDIN, '%d', $inputParticipantNum);

    $participantHasPointsList[$inputParticipantNum] += 1;
}

foreach ($participantHasPointsList as $participantNum => $participantHasPoints){

    if ($participantHasPoints <= 0){
        echo 'No'. PHP_EOL;
        continue;
    }

    echo 'Yes'. PHP_EOL;
}

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

# define ll long long

int main()
{
   ll n;
   cin>>n;
   ll t=0;
   for(int i=0;i<n;i++)
   {
       ll it;
       cin>>it;
       if(it%2!=0)
       continue;
       else
       {
           if(it%3==0 || it%5==0)
            continue;
            else
            t=1;
       }
   }
   if(t==0)
    cout<<"APPROVED"<<endl;
    else
    cout<<"DENIED"<<endl;
   
   
   return 0;
}

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

int main(){
    ll N; cin >> N;
    ll A[110][110];
    rep(i,N){
        ll u,k; cin >> u >> k;
        rep(j,k){
            ll a; cin >> a;
            A[i][a-1] = 1;
        }
    }
    rep(i,N){
        rep(j,N){
            cout << A[i][j];
            if(j < N-1) cout << " ";
        }
        cout << endl;
    }
}


Measured memory_bytes: 3124
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;

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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll a, b, c;
	cin >> a >> b >> c;

	bool flag = false;
	if (a == b && a != c) {
		flag = true;
	}
	if (a == c && b != a) {
		flag = true;
	}
	if (b == c && a != b) {
		flag = true;
	}

	cout << ((flag) ? "Yes" : "No") << en;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

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

using namespace std;

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

    if (k*500 >= x)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    
}



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

#define loop(x) for(int knzk=0;knzk<x;++knzk)
int in(){int x;scanf("%d",&x);return x;}

template<class T>
ostream& operator<<(ostream& os,set<T> const& v){for(auto itr=v.begin();itr!=v.end();++itr){if(itr!=v.begin())os<<' ';os<<*itr;}return os;}


signed main(){

  int n,m;
  set<int> s;
  cin>>n;
  loop(n)s.insert(in());
  cin>>m;
  loop(m)s.insert(in());
  for(auto x:s)cout<<x<<endl;


}


Measured memory_bytes: 21908
#include<stdio.h>
int main(){
int a[3];
scanf("%d%d%d",&a[0],&a[1],&a[2]);
int Min1=100,Min2=100,x;
for(int i=0;i<3;i++){
    if(a[i]<Min1){
        Min1=a[i];
        x=i;
    }
}
a[x]=101;
for(int i=0;i<3;i++){
    if(a[i]<Min2){
        Min2=a[i];
    }
}
printf("%d\n",Min1+Min2);
}


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


using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(ll i=st; i<ed; i++)
#define repn(i, st, ed) for(ll i=st; i<=ed; i++)
#define repb(i, ed, st) for(ll i=ed; i>=st; i--)
#define all(v) v.begin(),v.end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 1e5 + 10;
const ll INF = 1LL << 60;

template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}



// Main Code

ll gcd(ll x, ll y)
{
  if(y == 0) return x;
  return gcd(y, x%y);
}
ll lcm(ll x, ll y)
{
  return (x / gcd(x, y)) * y;
}


int main()
{
	ll a, b, c,d ;
	cin>>a>>b>>c>>d;
	ll total = b - a + 1;
	ll ans = total - ((b /c) - ((a-1) / c));
	ans += total - ((b / d) - ((a- 1) / d));
	ll comm = lcm(c, d);
	ans += ((b/ comm) - ((a-1) / comm));
	ans -= total;
	cout<<ans<<endl;
}


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

ll solve(ll n){
	if(n == 1)  return 1;
	
	else return 2 * solve( n / 2 ) + 1;
	
}

int main(){
	
	ll n;
	cin >> n;
	
	cout << solve(n) << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,x,n) for(ll i=x;i<n;i++) 
#define sort(v) sort(v.begin(),v.end());
const ll mod = 1E9+7;

int main()
{
   ll n,m;
   cin>>n>>m;
   cout<<(n==m?"Yes":"No");
}

Measured memory_bytes: 3632