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

int main(void){
    ll n;
    cin >> n;
    vector<pair<ll, int>> fs;
    for(ll i = 2; i * i <= n; i++){
        int x = 0;
        while(n % i == 0){
            n /= i;
            x++;
        }
        fs.push_back({i, x});
    }
    if(n != 1) fs.push_back({n, 1});
    int ans = 0;
    for(auto p : fs){
        int x = p.second;
        int b = 1;
        while(b <= x){
            x -= b;
            b++;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 19780
#pragma GCC optimize("O3")

#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> b(n-1);
    int tot=0;
    F0R(i,n-1) cin >> b[i];
    tot+=b[0];
    FOR(i,1,n-1)
    {
        tot+=min(b[i-1],b[i]);
    }
    tot+=b[sz(b)-1];
    cout << tot;

    return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

enum CF = "CODEFESTIVAL2016";

void main()
{
    auto S = readln.chomp;
    int r;
    foreach (i, c; S) if (c != CF[i]) ++r;
    writeln(r);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 18, maxm = 2600;
long long a[maxn];
map<tuple<int,int,int,int>, long long> f;
long long solve(int l, int r, int xl, int xr){
	if(l + 1 >=r) return 0;
	auto it = f.find(make_tuple(l, r, xl, xr));
	if(it != f.end()) return it->second;
	long long ans = 1ll<<60;
	for(int i = l + 1; i < r; i++){
		ans = min(ans, solve(l, i, xl, xl + xr) + solve(i, r, xl + xr, xr) + (xl + xr) * a[i]);
	}
	return f[make_tuple(l, r, xl, xr)] = ans;
}
int main(){
	int n; cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	cout << solve(0, n - 1, 1, 1) + a[0] + a[n - 1] << endl;
	return 0;
}


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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if(A==B){
        cout << C << endl;
    }
    else if(A==C){
        cout << B << endl;
    }
    else
    {
        cout << A << endl;
    }
    
}

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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    vector<int> num_W(N);
    vector<int> num_E(N);
    vector<int> sum(N);
    for (int i = 0; i < N; i++)
    {
        if (i != 0)
        {
            if (S[i - 1] == 'W')
            {
                num_W[i] = num_W[i - 1] + 1;
            }
            else
            {
                num_W[i] = num_W[i - 1];
            }
            if (S[N - i] == 'E')
            {
                num_E[N - 1 - i] = num_E[N - i] + 1;
            }
            else
            {
                num_E[N - 1 - i] = num_E[N - i];
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        sum[i] = num_E[i] + num_W[i];
    }
    int min = *min_element(sum.begin(), sum.end());
    cout << min;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define int long long
#define fo(i, n) for(int i = 1; i <= (n); i ++)
#define out(x) cerr << #x << " = " << x << "\n"
#define type(x) __typeof((x).begin())
#define foreach(it, x) for(type(x) it = (x).begin(); it != (x).end(); ++ it)
using namespace std;
#define SZ(x) ((int) (x).size())
#define mem(x, b) memset((x), b, sizeof (x))
typedef long long ll;
#define QAQ cerr << "233\n";
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0;char c = getchar(); bool f = 0;
  for(; c < '0' || c > '9'; f |= (c == '-'), c = getchar());
  for(; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if(f) x = -x;
}
template<typename tp> inline void arr(tp *a, int n) {
  for(int i = 1; i <= n; i ++)
    cout << a[i] << " ";
  puts("");
}
int a, b, c, k;
main(void) {
  read(a); read(b); read(c); read(k);
  cout << (a - b) * (k & 1 ? -1 : 1) << "\n";
}


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

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n; cin>>n;
	vector<ll> a(n);
	for(auto &x : a){
		cin>>x;
	}
	ll sum = accumulate(a.begin(), a.end(), 0LL);
	ll b_0 = sum;
	for(int i = 1; i < n; i += 2){
		b_0 -= 2*a[i];
	}
	vector<ll> b(n); b[0] = b_0;
	for(int i = 1; i < n; i++){
		b[i] =2*a[i - 1] - b[i - 1];
	}
	for(auto x : b){
		cout<<x<<" ";
	}

	return 0;
}

Measured memory_bytes: 2944
#include<stdio.h>
int main()
{
    int n,i,j;
    scanf("%d",&n);
    i= n/100;
    j= n%100;
    if (1<=i && i<=12)
    {
        if (1<=j && j<=12)
        {
            printf("AMBIGUOUS \n");
        }

        else
        {
            printf(" MMYY \n");
        }
    }
    else
    {
        if (1<=j && j<=12)
        {
            printf("YYMM \n"); 
        }
        else
        {
            printf("NA \n");
        }
    }
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

int k;
queue <string> q;
vector <string> v;

string add(string a)
{
	string b(1,a.back()+1);
	return a+b;
}

string add2(string a)
{
	string b(1,a.back());
	return a+b;
}

string sub(string a)
{
	string b(1,a.back()-1);
	return a+b;
}

int main()
{
	for(int i=1;i<10;i++) q.push(to_string(i));
	while(v.size()<1e5)
	{
		string a=q.front();
		v.push_back(a);
		q.pop();

		if(a.back()!='0') q.push(sub(a));
		q.push(add2(a));
		if(a.back()!='9') q.push(add(a));
	}

	cin>>k;
	cout<<v[k-1];
}

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

int main(){
  int N;
  cin >> N;
  
  vector<int> W(N);
  int sum = 0;
  for(int i = 0; i < N; i++){
    cin >> W.at(i);
    sum += W.at(i);
  }
  
  int s1 = 0, s2 = W.at(0), count = 0;
  while(true){
    s1 += W.at(count);
    s2 += W.at(count + 1);
    if(s2 * 2 >= sum){
      break;
    }
    count++;
  }
  
  cout << min(sum - 2 * s1, 2 * s2 - sum) << endl;
}


Measured memory_bytes: 256
s = int(input())
def f(n):
    if n%2 == 0:
        return n/2
    else:
        return 3*n + 1

a = [s]
m = 1
for i in range(1000000):
    m += 1
    a.append(f(a[-1]))
    if a[-1] in a[:-1]:
        print(m)
        break

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

int main() {
	int A, B, C, X, Y; cin >> A >> B >> C >> X >> Y;

	int half =  C * ((X < Y) ? X : Y) * 2 + ((X < Y) ? B*(Y-X) : A*(X-Y));
	int all = A * X  + B * Y;
	int half_2 = C * ((X < Y) ? Y : X) * 2;

	if(half < all) {
		if(half < half_2) cout << half << endl;
		else cout << half_2 << endl;
	} else {
		if(all < half_2) cout << all << endl;
		else cout << half_2 << endl;
	}

	return 0;
}


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

int main(){
	int A, B, C, K;
	cin>>A>>B>>C;
	cin>>K;
	vector<int> Sum;
	for(int i=0;i<=K;i++){
		for(int j=0;j<=K-i;j++){
			int k = K - i -j;
			int U = A*pow(2,i) + B*pow(2,j) + C*pow(2,k);
			Sum.push_back(U);
		}
	}
	sort(Sum.begin(), Sum.end());
	int max =  *(Sum.end()-1);
	cout<<max;
	return 0;
}


Measured memory_bytes: 256
s = input()
def is_kaibun(s):
  for i in range(len(s)//2):
    if s[i] != s[-i-1]:
      return False
  return True
n = len(s)
s1 = s[:(n-1)//2]
s2 = s[(n+1)//2:]
if is_kaibun(s) & is_kaibun(s1) & is_kaibun(s2):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c>=22) cout << "bust" << endl;
    else cout << "win" << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
int n, ans;

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

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

#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

bool isPalindrome(string s) {
    string t(s.rbegin(), s.rend());
    return s == t;
}

int main(void) {
  int L;
  cin >> L;
  printf("%.12f\n", (double)L*L*L/27.0);
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# ワーシャルフロイド+全探索

import numpy as np
import itertools

def main():
    N, M, R = map(int, input().split())
    rs = list(map(int, input().split()))
    inf = float('inf')
    cost = [[inf]*N for _ in range(N)]

    # グラフ作る
    for i in range(N):
        cost[i][i] = 0

    for _ in range(M):
        a, b, c = map(int, input().split())
        cost[a-1][b-1] = c
        cost[b-1][a-1] = c
    
    # ワーシャルフロイドで全頂点間距離算出
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if cost[i][k]+cost[k][j] < cost[i][j]:
                    cost[i][j] = cost[i][k] + cost[k][j]

    # 組み合わせ全探索
    ans = inf
    for route in itertools.permutations(rs):
        d = 0
        for i in range(R-1):
            d += cost[route[i]-1][route[i+1]-1]
            if d > ans:
                break
        ans = min(ans, d)
    
    print(int(ans))


if __name__=='__main__':
    main()

Measured memory_bytes: 15576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;

int main() {
  string s;
  cin >> s;
  if(s.at(0)==s.at(1)&&s.at(1)==s.at(2)){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <limits>
#include <tuple>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <array>
#include <iomanip>
#include <set>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = n-1; i >= 0; --i)
#define REP(i, s, n) for (int i = s; i< (int)(n); ++i)
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
ll inf = ll(1e18);
using ll1d = vector<ll>;
using ll2d = vector<ll1d>;
using ll3d = vector<ll2d>;

void solve(istream &ccin = cin, ostream &ccout = cout) {
  ll n; ccin >> n;
  map<string, ll> mp;
  rep(i, n){
    string s;
    ccin >> s;
    ++mp[s];
  }
  ll m; ccin >> m;
  rep(i, m){
    string s;
    ccin >> s;
    --mp[s];
  }
  ll ans = 0;
  for (const auto& i: mp){
    ans = max(i.second, ans);
  }

  ccout << ans << endl;


}

int main() {
  ios::sync_with_stdio(false);
  solve();
  return 0;
}

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

int main() {
  int a,b,c;
  
  cin >> a >> b >> c;
   if(a+b >= c){
     cout<<"Yes"<< endl;
   }
  
  if(a+b<c){
    cout<<"No"<< endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,int>P; 
#define MAX_N 55
#define EPS 1e-10
const double g=9.8;
int N,V,X,Y;
int L[MAX_N],B[MAX_N],R[MAX_N],T[MAX_N];

double calc(double vy,double t)
{
	return vy*t-g*t*t/2;
}

double cmp(double lb,double ub,double a)
{
	return a<lb+EPS?-1:a>ub-EPS?1:0;
}

bool check(double qx,double qy)
{
	double a=g*g/4,b=g*qy-V*V,c=qx*qx+qy*qy;
	double D=b*b-4*a*c;
	if(D<0&&D>-EPS)D=0;
	if(D<0)return false;
	for(int d=-1;d<=1;d+=2)
	{
		double t2=(-b+d*sqrt(D))/(2*a);
		if(t2<=0)continue;
		double t=sqrt(t2);
		double vx=qx/t,vy=(qy+g*t*t/2)/t;

		double yt=calc(vy,X/vx);
		if(yt<Y-EPS)continue;

		bool ok=true;
		for(int i=0;i<N;i++)
		{
			if(L[i]>=X)continue;
			if(R[i]==X&&Y<T[i]&&B[i]<=yt)ok=false;
			int yL=cmp(B[i],T[i],calc(vy,L[i]/vx));
			int yR=cmp(B[i],T[i],calc(vy,R[i]/vx));
			int xH=cmp(L[i],R[i],vx*(vy/g));
			int yH=cmp(B[i],T[i],calc(vy,vy/g));
			if(yL*yR<=0)ok=false;
		}
		if(ok)return true;
	}
	return false;
}

void solve()
{
	for(int i=0;i<N;i++)
		R[i]=min(R[i],X);
	bool ok=check(X,Y);
	for(int i=0;i<N;i++)
	{
		ok|=check(L[i],T[i]);
		ok|=check(R[i],T[i]);
	}
	puts(ok?"Yes":"No");
}


int main()
{
	scanf("%d%d%d%d",&N,&V,&X,&Y);
	for(int i=0;i<N;i++)
		scanf("%d%d%d%d",&L[i],&B[i],&R[i],&T[i]);
	solve();

}

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

int main() {
    int n;
    while (cin >> n, n) {
        int c = 0;
        while (n != 1) {
            if (n % 2 == 0) {
                n /= 2;
            } else {
                n = n * 3 + 1;
            }
            c ++;
        }
        cout << c << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
N = int(input())
A, B = map(int, input().split())
P = list(map(int, input().split()))

f = 0
s = 0
t = 0

for i in range(len(P)):
    if P[i] <= A:
        f += 1
    
    elif A+1 <= P[i] <= B:
        s += 1

    elif B+1 <= P[i]:
        t += 1

print(min(f,s,t)) 

Measured memory_bytes: 3064
def main():
    N = int(input().strip())
    A = []
    A.append([(int(x),int(x)) for x in input().strip().split()])
    A.append([(int(x),int(x)) for x in input().strip().split()])

    x = y = 0
    gx = N - 1
    gy = 1

    buff = [(y, x, 0)]
    while(buff):
        next_buff = []
        for b in buff:
            y, x, s = b
            # 今のアメを取得し、最大値で更新
            sum = max(s+A[y][x][0], A[y][x][1])
            A[y][x] = (A[y][x][0], sum)
            # 移動先チェック
            if x + 1 < N:
                # 右に移動可
                if not (y, x+1, sum) in next_buff:
                    next_buff.append((y, x+1, sum))
            if y + 1 < 2:
                # 下に移動可
                if not (y+1, x, sum) in next_buff:
                    next_buff.append((y+1, x, sum))
        buff = next_buff
    return A[gy][gx][1]

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 3188
# https://atcoder.jp/contests/abc076/tasks/abc076_c

s = gets.chomp.tr('?', '.')
t = gets.chomp
valid = false

candidates = []

s.chars.each_with_index do |c, idx|
  sub = s[idx, t.size]
  res = t.match(sub)
  next if res.nil?
  if res.to_a[0].size == t.size
    cand = s.dup
    cand[idx, t.size] = t
    valid = true
    candidates << cand
  end
end

if valid
  puts candidates.sort[0].tr('.', 'a')
else
  puts "UNRESTORABLE"
end

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

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

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	ll a, b, n;
	cin >> a >> b >> n;

	ll x = min(n, b-1);
	cout << a*x/b - a * (x/b) << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    if(N/10 == 9 ){
      cout << "Yes" << endl;
    }
    else if(N-N/10*10 == 9) {
      cout <<"Yes"<< endl;
    }
    else {
      cout <<"No"<<endl;
    }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,r;
    cin>>s;
    if(s=="Sunny") cout<<"Cloudy"<<endl;
    else if(s=="Rainy") cout<<"Sunny"<<endl;
    else if(s=="Cloudy") cout<<"Rainy"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace  std;
typedef long long int ll;
ll mod=1e9+7;
const int N=1e5+5;
ll dp[104][N];
ll a[N];
int main()
{
  ll n,k;
  cin>>n>>k;
  for(int i=1;i<=n;i++)
    cin>>a[i];
  for(int i=0;i<=n;i++)
    dp[i][0]=1;
  for(int i=0;i<=k;i++)
    dp[0][i]=1;
  for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=k;j++)
    {
      if(j-a[i]<=0)
        dp[i][j]=dp[i-1][j];
      else
        dp[i][j]=(dp[i-1][j]-dp[i-1][j-a[i]-1]+mod)%mod;
    }
    for(int j=1;j<=k;j++)
      dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
  }
  cout<<(dp[n][k]-dp[n][k-1]+mod)%mod<<endl;
}

Measured memory_bytes: 79360
import java.util.Scanner;

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

		if(k==10) {
			System.out.println(s.length());
		}else {
			long n=0;
			while(Math.pow(k,n)<Long.valueOf(s)+1) {
				n++;
			}
			System.out.println(n);
		}
	}
}



Measured memory_bytes: 21716
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n, m;
		int r[];
		int r2[];

		n = sc.nextInt();
		m = sc.nextInt();
		r = new int[n];
		r2 = new int[n];
		for (int i = 0; i < m; i++) {
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				r[sc.nextInt() - 1] = i;
			}
		}

		int R = sc.nextInt();
		for (int i = 0; i < R; i++) {
			int b1 = sc.nextInt();
			int b2 = sc.nextInt();
			if (r[b1 - 1] == r[b2 - 1]) {
				r2[b1 - 1] = r2[b2 - 1] = 1;
			}
		}

		int sum = 0;
		for (int i = 0; i < n; i++) {
			sum += r2[i];
		}

		System.out.println(sum);
	}
}

Measured memory_bytes: 24304
package main

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

type Scanner struct {
	innerScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := new(Scanner)
	innerScanner := bufio.NewScanner(os.Stdin)
	innerScanner.Split(bufio.ScanWords)
	sc.innerScanner = innerScanner
	return sc
}

func (sc Scanner) scan() {
	sc.innerScanner.Scan()
}

func (sc Scanner) next() string {
	sc.scan()
	return sc.innerScanner.Text()
}

func (sc Scanner) nextInt() int {
	i, _ := strconv.Atoi(sc.next())
	return i
}

func (sc Scanner) nextFloat() float64 {
	f, _ := strconv.ParseFloat(sc.next(), 64)
	return f
}

func main() {
	sc := NewScanner()
	n := sc.nextInt()
	for i := 0; i <= 25; i++ {
		for j := 0; j <= 15; j++ {
			v := i * 4 + j * 7
			if n == v {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")
}


Measured memory_bytes: 640
#include <random>    //ランダム
#include <algorithm> //アルゴリズム
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <fstream>
#include <cmath>
#include <cstring>
#include <string>
#include <sstream>
#include <cassert>
#include <cfloat>
#include <numeric>
#include <climits>
#include <stdint.h>
#include <functional>
using namespace std;
// vector<int> temple(7,0);
    // for(int i=0; i<temple.size(); i++){
    
    // }
    // int maxtemp=*max_element(temple.begin(), temple.end());;
    // int mintemp=*min_element(temple.begin(), temple.end());;
    // int answer=0;
    // for(int i=0; i<temple.size(); i++){
    //     if(temple[i]==maxtemp||temple[i]==mintemp){
            
    //     }else{
    //         answer+=temple[i];
    //     }
    // }
    // answer/=5;
    // cout << answer << std::endl;
int main()
{
    int N, X, T;
    cin >> N >> X >> T;
    int answer=0;
    int copyN=N;
    while(copyN>0){
        copyN-=X;
        answer+=T;
    }
    cout<<answer<<endl;
}


Measured memory_bytes: 3628
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))
PY = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]

counts = defaultdict(int)

PY = np.array(PY, dtype=int)
idx = PY[:, 1].argsort()
ans = [''] * M
for i in idx:
    p, y = PY[i]
    counts[p] += 1
    ans[i] = '{:06d}{:06d}'.format(p, counts[p])
if ans:
    print(*ans, sep='\n')


Measured memory_bytes: 39100
#include <iostream>
#include <vector>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main()
{
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i += 2)
    {
        if(s[i] != 'h' || s[i+1] != 'i')
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int ans = v[0];
    for (int i = 0; i < n; ++i) {
        ans = __gcd(ans, v[i]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vi vector<int>
#define sl set<ll>
#define sc set<char>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mpi map<ll,ll>
#define mpc map<char,ll>
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inf        10000000


vector<ll> edges[100005];
int visited[100005]={0};
ll dp[100005]={0};
void dfs(ll t)
{
	if(visited[t]==1)
		return;
	visited[t]=1;
	for(ll j=0;j<edges[t].size();j++)
	{
		ll c=edges[t][j];
		if(visited[c]==0)
			dfs(c);
		dp[t]=max(dp[t],dp[c]+1);
	}
	return;
}

int main()
{
	ll n,m;
	cin>>n>>m;
	ll x,y;
	forn(i,m)
	{
		cin>>x>>y;
		edges[x].pb(y);
	}
	for(ll i=1;i<=n;i++)
	{
		if(visited[i]==0)
			dfs(i);
	}
	ll ans=0;
	for(ll i=1;i<=n;i++)
		ans=max(ans,dp[i]);
	cout<<ans;
}

Measured memory_bytes: 8960
/*I MAY NOT GET THE SUCCESS IMMEDIATELY BUT I WILL GET IT FOR SURE*/
#include<bits/stdc++.h>
#define opt std::ios_base::sync_with_stdio(false)
#define I int
#define li      int32_t
#define lli     long long
#define ulli unsigned long long

#define pn           printf("\n")
#define nl           cout<<'\n'
#define sf(N)        scanf("%lld",&N)
#define pf(N)        printf("%lld",N)
#define sf1(N1,N2)    scanf("%lld %lld",&N1,&N2)
#define pf1(N1,N2)    printf("%lld %lld",N1,N2)
#define sf2(N1,N2,N3) scanf("%lld %lld %lld",&N1,&N2,&N3)
#define pf2(N1,N2,N3) printf("%lld %lld %lld",N1,N2,N3)

#define sl          cout<<' '
#define ps          printf(" ")

#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))

#define pb      push_back
#define pob     pop_back
#define itr     iterator
#define sz()    size()
#define szof    sizeof
#define lb      lower_bound
#define ub      upper_bound
#define mp      make_pair
#define vlli    vector<lli>
#define plli    pair<lli,lli>
#define vplli   vector<plli >
#define F       first
#define S       second
#define Dup     erase(unique(V.begin(),V.end()),V.end())

#define bs      binary_search
#define ub      upper_bound
#define lb      lower_bound

#define ALL(V)  V.begin(),V.end()

#define MX1     100000
#define MX2     1000000
#define mod     1000000007
#define Inf     1000000000000000
using namespace std;

lli Power(lli a,lli b)
{
    lli result=1;

    while(b)
    {
        if(b%2)
        {
            result=(result*a)%mod;
        }

        b=b>>1;
        a=(a*a)%mod;
    }

 return result;
}

int main()
{
    /*#ifndef ONLINE_JUDGE
    freopen("double_squares.txt","r",stdin);
    freopen("double_squares_out.txt","w",stdout);
    #endif // ONLINE_JUDGE*/

    lli K,i;
    cin>>K;
    
    lli N=50;
    
    lli x=N-K%50;
    
    cout<<50;nl;
    rep(i,0,51)
    {
        if(i!=x)
        {
            cout<<i+K/50;sl;
        }
    }
    







 return 0;
}


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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    int answer = a + b;
    int result = a + c;
    int legit = b + c;
    if (answer <= result && answer <= legit) {
        cout << answer;
        return 0;
    }
    if (result <= answer && result <= legit) {
        cout << result;
        return 0;
    }
    if (legit <= result && legit <= answer) {
        cout << legit;
        return 0;
    }
}

Measured memory_bytes: 256
import sys

n = int(sys.stdin.readline())
s = sys.stdin.readline()
k = int(sys.stdin.readline())

ch = s[k - 1:k]
ans = ''
for i in range(n):
    tmp = s[i:i + 1]
    if tmp in list(ch):
        ans += tmp
    else:
        ans += '*'
print(ans)


Measured memory_bytes: 3060
#!/usr/bin/env python3
#aoj a

while 1:
    N = int(input())
    if N == 0:
        break
    A = [list(map(int,input().split())) for _ in range(N)]
    M = int(input())
    B = [list(input().split()) for _ in range(M)]
    D = []
    nx,ny = 10,10
    for i in range(M):
        if B[i][0] == "N":
            for j in range(1,int(B[i][1])+1):
                D.append([nx,ny+j])
            ny += int(B[i][1])
        elif B[i][0] == "E":
            for j in range(1,int(B[i][1])+1):
                D.append([nx+j,ny])
            nx += int(B[i][1])
        elif B[i][0] == "S":
            for j in range(1,int(B[i][1])+1):
                D.append([nx,ny-j])
            ny -= int(B[i][1])
        elif B[i][0] == "W":
            for j in range(1,int(B[i][1])+1):
                D.append([nx-j,ny])
            nx -= int(B[i][1])
    f = 1
    for i in A:
        if i not in D:
            f = 0
            break
    if f:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 5632
N = gets.to_i
V = N.times.to_a
C = N.times.map{ gets.split.map(&:to_i) }
D = Array.new(N){ Array.new(N, 0) }
Q = (1 .. N).inject(&:*)

V.combination(2) do |i,j|
  a, b = [i,j].map{|k| C[k] }
  d = Math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
  D[i][j] = D[j][i] = d
end
t = V.permutation(N).inject(0.0) do |sum, path|
  sum + path.each_cons(2).inject(0.0){|s,(a,b)| s + D[a][b]}
end
puts t / Q


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

using namespace std;

int n;

int main(){
    while(1){
        cin >> n;
        if(n==0)break;
        vector<string> w(n);
        int tan[] = {5,7,5,7,7};
        for(int i=0;i<n;i++){
            cin >> w[i];
        }
        int j=0;
        int ans=0;
        int sum=0;
        for(int k=0;k<n;k++){
            sum=0;
            ans=k;
            j=0;
            for(int i=k;i<n;i++){
                sum += w[i].size();
                if(sum > tan[j]){
                    sum = w[i].size();
                    j=0;
                    ans=i;
                }
                if(sum < tan[j])continue;
                if(sum == tan[j]){
                    if(j==4)break;
                    else {
                        j++;
                        sum = 0;
                    }
                }
            }
            if(j==4 && sum == tan[j])break;
        }
        cout << ans+1 << endl;

    }
}


Measured memory_bytes: 3180
typedef long long int ll;
typedef unsigned long long int ull;
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define sz(a) int((a).size())
#define forn(i, n) for (int i = 0; i < (n); ++i)
#define fore(i, l, r) for (int i = (l); i < (r); ++i)
#define loop for(int i=0;i<n;i++)
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d) max3(a,max(b,c),d)
#define max5(a,b,c,d,e) max4(a,max(b,c),d,e)
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d) min3(a,min(b,c),d)
#define min5(a,b,c,d,e) min4(a,min(b,c),d,e)
#define sec second
#define fir first
#define vec vector<int>
#define M_PI           3.14159265358979323846  /* pi */
#define pb push_back
#include<bits/stdc++.h>
#include<cmath>
using namespace std;

int main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n,m,sum=0;
	cin>>n>>m;
	FOR(i,m)
	{
			int x;
			cin>>x;
			sum+=x;
	}
	if(n-sum>=0)
		cout<<n-sum<<std::endl;
	else
		cout<<"-1\n";
}

Measured memory_bytes: 3624
[N,X,Y] = [int(s) for s in input().rstrip().split(' ')]
L = [0 for n in range(N)]
for i in range(N):
  for j in range(N-i):
    L[min(j,abs(X-1-i)+abs(Y-1-i-j)+1,abs(X-1-j-i)+abs(Y-1-i)+1)]+=1
for k in range(1,N):
  print(L[k])

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

int main(){
    ll N;
    string S;
    cin >> N;
    ll sum = 0;
    rep(i,1e6+1){
        if(i > N) break;
        if(i % 3 != 0 && i % 5 != 0){
            sum += i;
        }
    }

    cout << sum <<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;
int a[101][101];
int main(){
int n;
cin>>n;
for(int i=1;i<=2;i++)
for(int j=1;j<=n;j++)
cin>>a[i][j];
for(int i=1;i<=2;i++)
for(int j=1;j<=n;j++)
a[i][j]+=max(a[i-1][j],a[i][j-1]);
cout<<a[2][n];
system("pause");
return 0;
}

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

using namespace std;
const int N=2e5+5;
int cnt[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    string s;int p,n;
    cin>>n>>p;
    cin>>s;
    int cur=1,num=0,old=0;
    long long ans=0;
    cnt[0]=1;
    if(p==2||p==5)
    {
        for(int i=0;i<n;i++)
            if((s[i]-'0')%p==0) ans+=(i+1);

    }
    else
    {
        for(int i=n-1;i>=0;i--)
        {
            num=((s[i]-'0')*cur%p+old)%p;
            cur=cur*10%p;
            old=num;
            ans+=cnt[num];
            cnt[num]++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
#define int long long
#define double long double
#define fst first
#define snd second
#define fr(s,n,i) for(int i=s;i<n;i++)
#define times(n) for(int i=0;i<n;i++)
#define fr_(s,n,i) for(int i=s;i>=n;i--)
#define srt(v) sort(v.begin(), v.end());
#define upr(v, aim, ind) int ind; ind=(int)distance(v.begin(), upper_bound(v.begin(),v.end(), aim))
#define sz(v) (int)v.size()
#define ers(v, i) v.erase(v.begin() + i)
#define last(v) v[sz(v) - 1]
#define swp(v, i, j) int buf = v[j]; v[j] = v[i]; v[i] = buf
#define shout(a) cout << a << endl
#define dshout(a) printf("%.16Lf\n", a)
#define pr pair<int, int>
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vd vector<double>
#define vdd vector<vd>
#define mx(a, b) a = max(a, b)
#define mn(a, b) a = min(a, b)
#define mulM(a,b,c) a = a * b % c
#define squM(a,b) a = a * a % b
#define mpr(a,b) make_pair(a,b)
#define iinp(a) int a; cin >> a
#define sinp(a) string a; cin >> a
#define dinp(a) double a; cin >> a
#define ios() ios_base::sync_with_stdio(0);cin.tie(0)

int MOD = 998244353;
int INF = ~(1LL << 63);

int powM(int base, int exp){
    int ret = 1;
    int buf = base;
    while(exp > 0){
        if(exp & 1){
            ret *= buf;
        }
        squM(buf, MOD);
        exp >>= 1;
    }
    return ret;
}
int combM(int a, int b){
    if(b == 0){
        return 1;
    }
    if(a-b < b){
        return combM(a, a-b);
    }
    int ans = 1;
    fr(1,b+1,i){
        ans *= a + 1 - i;
        ans /= i;
    }
    return ans;
}
void solve();
signed main() {
    ios();
    solve();
    return 0;
}

void solve(){
    int  b;
    double a,t;
    cin >> a >> b >> t;
    int ans = 0;
    double time = a;
    while(time < (t+0.5)){
        ans += b;
        time += a;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
using std::scanf;
using std::printf;

struct Node { int left, right; };

int Reconstruction(int n, int preorder[], int *ppre_i,
                   int inorder[], int in_left, int in_right, Node tree[]) {
  int current = preorder[*ppre_i];
  int in_mid;
  for (int i = in_left; i < in_right; ++i) {
    if (inorder[i] == current) {
      in_mid = i;
      break;
    }
  }

  if (in_left != in_mid) {
    *ppre_i += 1;
    int left_child = Reconstruction(n, preorder, ppre_i,
                                    inorder, in_left, in_mid, tree);
    tree[current].left = left_child;
  }
  if (in_mid + 1 != in_right) {
    *ppre_i += 1;
    int right_child = Reconstruction(n, preorder, ppre_i,
                                     inorder, in_mid + 1, in_right, tree);
    tree[current].right = right_child;
  }

  return current;
}

void PrintPostorder(Node tree[], int i, int *pfirst) {
  if (tree[i].left != -1) { PrintPostorder(tree, tree[i].left, pfirst); }
  if (tree[i].right != -1) { PrintPostorder(tree, tree[i].right, pfirst); }
  if (*pfirst) {
    printf("%d", i);
    *pfirst = 0;
  } else {
    printf(" %d", i);
  }
}

int main() {
  int n;
  scanf("%d", &n);
  int preorder[n], inorder[n];
  for (int i = 0; i < n; ++i) { scanf("%d", &preorder[i]); }
  for (int i = 0; i < n; ++i) { scanf("%d", &inorder[i]); }
  int pre_i = 0;
  Node tree[n + 1];
  for (int i = 1; i < n + 1; ++i) {
    tree[i].left = -1;
    tree[i].right = -1;
  }
  int root = Reconstruction(n, preorder, &pre_i, inorder, 0, n, tree);
  int first = 1;
  PrintPostorder(tree, root, &first);
  printf("\n");
  return 0;
}

Measured memory_bytes: 2740
use v5.18;
use warnings;
use utf8;

sub line { chomp(my $str = <>); $str; }
sub split_line { (split / /, line) }

main();

sub main {
  my $str1 = line;
  my $str2 = line;
  say( solve($str1, $str2) ? 'Yes' : 'No' );
}

sub ord_sum_sort_small {
  my $str = shift;
  my @ords = sort { $a cmp $b } split //, $str;
  join '', @ords;
}

sub ord_sum_sort_big {
  my $str = shift;
  my @ords = sort { $b cmp $a } split //, $str;
  join '', @ords;
}

sub solve {
  my ($str1, $str2) = @_;
  my $s1_ord_sum = ord_sum_sort_small($str1);
  my $s2_ord_sum = ord_sum_sort_big($str2);
  if ($s1_ord_sum lt $s2_ord_sum) {
    1;
  }
  else {
    0;
  }
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = false;
}  // namespace mydef
using namespace mydef;
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans


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

    int N;
    int ans = 0;
    cin >> N;
    /*
    for (int l = 1; l <= N; l++) {
        ans += (N * (N + 1)) / 2 - (l * (l - 1)) / 2 - l + 1;
    }
    */
    int n = N;
    ans = (n * (n + 1) * (n + 2)) / 6;
    for (int i = 0; i < N - 1; i++) {
        int u, v;
        cin >> u >> v;
        if (u > v)
            swap(u, v);
        ans -= (u) * (N - v + 1);
    }
    cout << ans << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
//template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
//template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

template<class T>
void compress(vector<T> v,  map<T, int>& zip, vector<T>& unzip)
{
	sort(ALL(v));
	v.erase(unique(ALL(v)), v.end());
	unzip.resize(v.size());
	REP(i, v.size())
	{
		zip[v[i]] = i;
		unzip[i] = v[i];
	}
}

struct UnionFind
{
	vector<int> par;
	UnionFind(int n) :par(n, -1) {}
	int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
	void unite(int x, int y)
	{
		x = find(x); y = find(y);
		if (x == y) return;
		if (par[y] < par[x]) swap(x, y);
		if (par[x] == par[y]) par[x]--;
		par[y] = x;
		if (find(x) != find(y)) par[find(y)] = x;
	}
	int count()
	{
		int cnt = 0;
		REP(i, par.size()) if (par[i] < 0) cnt++;
		return cnt;
	}
	bool same(int x, int y)
	{
		return find(x) == find(y);
	}
};

const int dx[] = { -1, 0, 0, 1 }, dy[] = { 0, -1, 1, 0 };
//[const int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy[] = { 0, -1, 1, -1, 1, 0, -1, 1 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }



int main()
{
	int w, h;
	while (cin >> w >> h, h)
	{
		int n; cin >> n;
		vector<tuple<int, int, int, int>> v;
		vector<int> x, y;
		REP(i, n)
		{
			int a, b, c, d;
			cin >> a >> b >> c >> d;
			v.emplace_back(a, b, c, d);
			x.push_back(a), x.push_back(c);
			y.push_back(b), y.push_back(d);
		}
		x.push_back(0), x.push_back(w);
		y.push_back(0), y.push_back(h);
		map<int, int> xzip, yzip;
		vi xunzip, yunzip;
		compress(x, xzip, xunzip);
		compress(y, yzip, yunzip);
		vector<vi> fld(yzip[h], vi(xzip[w]));
		REP(i, n)
		{
			int left = xzip[get<0>(v[i])], right = xzip[get<2>(v[i])];
			int bottom = yzip[get<1>(v[i])], top = yzip[get<3>(v[i])];
			FOR(i, bottom, top)FOR(j, left, right) fld[i][j] = 1;
		}
		int ans = 0;
		REP(i, yzip[h])REP(j, xzip[w])
		{
			if (fld[i][j]) continue;
			queue<pii> que;
			que.push(pii(i, j));
			fld[i][j] = 1;
			ans++;
			while (que.size())
			{
				int tx = que.front().first, ty = que.front().second;
				que.pop();
				REP(k, 4)
				{
					int nx = tx + dx[k], ny = ty + dy[k];
					if (!valid(nx, ny, yzip[h], xzip[w])) continue;
					if (!fld[nx][ny])
					{
						fld[nx][ny] = 1;
						que.push(pii(nx, ny));
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 4176
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int n, y;
    cin >> n >> y;
    y/=1000;

    for(int i=0;i<=n;++i) {
        for(int j=0;j<=n-i;++j) {
            if (i*10+j*5+(n-i-j) == y) {
                cout << i << " " << j << " " << n-i-j << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


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

using namespace std;
int n, a[1000010];
struct node {
    int id, point;
} node[1<<22];

void add(int id, int x)
{
    id=n-1+id;
    node[id].point+=x;

    while (id>0) {
        id=(id-1)/2;
        int c1=2*id+1, c2=2*id+2;
        if (node[c1].point>=node[c2].point)
            node[id]=node[c1];
        else
            node[id]=node[c2];
    }
}

void print()
{
#ifdef DEBUG
    int k=1;
    int x=0;
    while (true) {
        for(int i=0;i<k;++i) printf("(%d %d)", node[x+i].id, node[x+i].point);
        puts("");
        x+=k;
        k<<=1;
        if (x>=n) break;
    }
    puts("");
#endif
}

int main()
{
    int m, r, l;
    scanf("%d%d%d", &m, &r, &l);
    n=1;
    while (n<m) n<<=1;
    for(int i=0;i<m;++i) node[n-1+i].id=i;

    int pt=0;
    for(int i=0;i<r;++i) {
        int d, t, x;
        scanf("%d%d%d", &d, &t, &x);

        if (pt<t) {
            int id=node[0].id;
            a[id]+=t-pt;
        }
        add(d-1, x);
        print();
        pt=t;
    }
    print();
    a[node[0].id]+=l-pt;
#ifdef DEBUG
    for(int i=0;i<n;++i) printf("%d ", a[i]); puts("");
#endif
    printf("%d\n", 1+(max_element(a, a+n)-a));
}

Measured memory_bytes: 4804
#include<bits/stdc++.h>
using namespace std;
const int N=200005;
int ne[N],tot,n,fi[N],zz[N],sg[N],x,y;
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x,int y){
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)dfs(zz[i],x),sg[x]^=sg[zz[i]]+1;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x); 
	}
	dfs(1,0);
	if (sg[1])puts("Alice");
	else puts("Bob");
} 

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
string s[200001];
int main(){
	int n,sum=1;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>s[i];
	sort(s+1,s+n+1);
	for(int i=1;i<n;i++){
		if(s[i]!=s[i+1]) sum++;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 9892
#pragma warning(disable : 4996)
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef tuple<ll,ll,ll> tl3;
// https://atcoder.jp/contests/abc175/tasks/abc175_b
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll n;
    cin >> n;
    vector<ll> v(n);
    for(int i = 0;i<n;i++){
        cin >> v[i];
    }
    sort(all(v));
    ll ans = 0;
    for(int i = 0;i<n;i++){
        for(int j = i+1;j<n;j++){
            for(int k = j+1;k<n;k++){
                if(v[i] != v[j] && v[j] != v[k] && v[i] != v[k]){
                    if(v[i]+v[j] > v[k]) ans++;
                }
            }
        }
    }
    cout << ans;

    return 0;
}



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

set<int> s;
int n,r,k,len=1;

int main()
{
	ios::sync_with_stdio(false);
	cin>>k;
	n=7;
	r=n%k;
	
	while(r!=0)
	{
		if(s.find(r)!=s.end())
		{
			cout<<-1<<endl;
			return 0;
		}
		s.insert(r);
		n=r*10+7;
		r=n%k;
		len++;
	}
	
	cout<<len<<endl;
	return 0;
}

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

int main(){
    stack<int> S1;
    stack<pair<int,int> > S2;
    char ch;
    int sum=0;
    for (int i=0;cin>>ch;i++){
        if(ch == '\\'){
            S1.push(i);
        }
        else if(ch == '/' && S1.size() > 0){
            int j = S1.top(); S1.pop();
            int h = i-j;
            sum = sum + h;
            while(S2.size()>0 && S2.top().first > j){
                h = h + S2.top().second;
                S2.pop();
            }
            S2.push(make_pair(j,h));
        }
    }
    vector<int> ans;
    while(S2.size()>0){
        ans.push_back(S2.top().second);
        S2.pop();
    }
    reverse(ans.begin(),ans.end());
    cout << sum <<endl;
    cout<<ans.size();
    for (int i=0;i<ans.size();i++){
        cout << " " << ans[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3224
#include <cstdio>
#include <cstring>
using namespace std;
int d[50][3001];
int main() {
int n,m,s;
while(scanf("%d%d%d",&n,&m,&s),n) {memset(d,0,sizeof(d));
d[0][0]=1;for (int i=1;i<=m;++i)for (int j=n*n;j;--j)for (int k=s;k>=i;--k)
d[j][k]=(d[j][k]+d[j-1][k-i])%100000;
printf("%d\n",d[n*n][s]);
}
}

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

int main() {
    string S;
    cin >> S;
    if(S == "Sunny") {
        cout << "Cloudy" << endl;
    }
    if(S == "Cloudy") {
        cout << "Rainy" << endl;
    }
    if(S == "Rainy") {
        cout << "Sunny" << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
  int n;
  int x = 0;
  int y = 0;
  int t = 0;
  int next_t, next_x, next_y;
  cin >> n;

  for (int i = 0; i < n; ++i)
  {
    cin >> next_t >> next_x >> next_y;
    int dist = abs(next_x - x) + abs(next_y - y);
    if (dist > (next_t - t) || (next_t - t - dist) % 2 == 1)
    {
      cout << "No" << endl;
      return 0;
    }
    x = next_x;
    y = next_y;
    t = next_t;
  }
  cout << "Yes" << endl;

  return 0;
}

Measured memory_bytes: 384
n = int(input())
for i in range(1, n + 1):
    x = i
    if x % 3 == 0:
        print(" " + str(i), end="")
    else:
        while x != 0:
            if x % 10 == 3:
                print(" " + str(i), end="")
                break
            x //= 10
print()



Measured memory_bytes: 5868
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1E9 + 7, N = 100005;
string s;
int n, c = 0, a[N], pr[N], dp[N][2];
int solve(int idx, int f)
{
	if (idx == n)
		return 1;
	else if (dp[idx][f] != -1)
		return dp[idx][f];
	int ans = 0, lim = 1;
	if (f)
		lim = a[idx];
	for (int i = 0; i <= lim; ++i)
	{
		int nf = f;
		if (f)
		{
			if (i < lim)
				nf = 0;
		}
		if (i)
			ans = (1LL * ans + (2 * solve(idx + 1, nf)) % MOD) % MOD;
		else
			ans = (1LL * ans + solve(idx + 1, nf)) % MOD;
	}
	return dp[idx][f] = ans;
}
int main(int argc, char const *argv[])
{
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; ++i)
	{
		a[i] = s[i] - '0';
	}
	memset(dp, -1, sizeof(dp));
	cout << solve(0, 1);
	return 0;
}

Measured memory_bytes: 12724
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
    
   string s;
   cin >> s;
    if(s[0] == '7' || s[1] == '7' || s[2] == '7'){
        cout << "Yes";
    }else{
        cout << "No";
    }
    
    return 0;
}

Measured memory_bytes: 3612