akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
    /*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    int n,m;
    cin >> n >>m;
    ll ans = m*(m-1)/2 + n*(n-1)/2;
    cout<<ans<<endl;
}
    



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

//短縮
#define rep(i,n) for(int i=0;i<(n);++i)
//sort()用
#define all(v) v.begin(), v.end()

#define PB(N) push_back(N)

using namespace std;

using Graph = vector<vector<int>>;

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> A(N+1);
  rep(i,N) cin >> A[i+1];

  for(int i=1;i<=N-K;i++){
    if(A[K+i]>A[K+i-(K)]) cout << "Yes"<<endl;
    else cout << "No"<< endl;
  }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  int AliceSum = 0, BobSum = 0;

  for (int i = 0; i < N; i++) {
    if (i % 2 == 0) AliceSum += a[i];
    else BobSum += a[i];
  }

  cout << AliceSum - BobSum << endl;
}

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

ll a,b,c,n,m;
ll ans=100000000000;

string s;

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  
  cin>>a>>b;
  if(a<=b)cout<<"unsafe";
  else cout<<"safe";
  

  return 0;
}



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

int main(){
	int a[101],n,k,dp[101][4][4],ans=0;
	bool c[101];
	fill(c,c+101,false);
	scanf("%d%d",&n,&k);
	for(int i=0;i<k;i++){
		int b,d;
		scanf("%d%d",&b,&d);
		c[b]=true;
		a[b]=d;
	}
	if(n==1&&c[1])ans=1;
	if(n==1&&!c[1])ans=3;
	for(int i=1;i<4;i++)for(int j=1;j<4;j++){
		if((c[1]&&a[1]!=i)||(c[2]&&a[2]!=j))dp[2][i][j]=0;
		else dp[2][i][j]=1;
	}
	for(int i=3;i<n+1;i++){
		for(int j=1;j<4;j++){
			for(int k=1;k<4;k++){
				if(c[i]){
					if(a[i]==k){
						if(a[i]==j){
							int x=0;
							for(int m=1;m<4;m++){
								if(m!=a[i])x+=dp[i-1][m][j];
							}
							dp[i][j][k]=x;
						}
						else {
							int x=0;
							for(int m=1;m<4;m++){
								x+=dp[i-1][m][j];
							}
							dp[i][j][k]=x;
						}
					}
					else dp[i][j][k]=0;
				}
				if(!c[i]){
					if(j==k){
						int x=0;
						for(int m=1;m<4;m++){
							if(m!=j)x+=dp[i-1][m][j];
						}
						dp[i][j][k]=x;
					}
					else {
						int x=0;
						for(int m=1;m<4;m++){
							x+=dp[i-1][m][j];
						}
						dp[i][j][k]=x;
					}
				}
				dp[i][j][k]%=10000;
			}
		}
	}
	if(n!=1){
		for(int i=1;i<4;i++){
			for(int j=1;j<4;j++){
				ans+=dp[n][i][j];
			}
		}
	}
	printf("%d\n",ans%10000);
}

Measured memory_bytes: 1180
""" 
A店：200g,380y,20%/5 → 1.9y/g
B店：300g,550y,15%/4 → 1.83y/g
C店：500g,850y,12%/3 → 1.7y/g
380*5 *0.8 = 1520   304/1つ
550*4 *0.85 = 1870  467.5/1つ
850*3 *0.88 = 2244  748/1つ
"""
# 購入数は50g刻みと明言されているので

P = [2,10, 3,12, 5,15]
Q = [380,1520, 550,1870, 850,2244]
MAX = 50
Range = [0] + [1000000]*MAX

for p,q in zip(P,Q):
    for i in range(MAX - p+1):
        Range[i+p] = min(Range[i+p],Range[i]+q)

while True:
    v = int(input())
    if v==0:
        break
    print(Range[v//100])


Measured memory_bytes: 5604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll x, y;

int main() {
	cin >> x >> y;
	ll now = x;
	ll ans = 1;
	while (1) {
		ll buf = 2*now;
		if (buf > y)break;
		now = buf;
		ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun May 31 21:06:02 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(n);
    REP(i ,n) std::cin >> a[i];
    __int128_t cur = 1;
    if (std::count(a.begin(), a.end(), 0)) cur = 0;
    for (Int x : a) {
        cur *= x;
        if (cur > (Int)1e18) {
            std::cout << -1 << std::endl;
            return 0;
        }
    }
    std::cout << (Int)cur << std::endl;
}


Measured memory_bytes: 3984
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String args[]) {

        int[] time = new int[5];
        for (int i=0; i < 5; i++)
            time[i] = sc.nextInt();

        int minIndex = 0;
        int minModulusTime = 10;
        for (int i=0; i < 5; i++) {
            if (modulusTime(time[i]) < minModulusTime) {
                minIndex = i;
                minModulusTime = modulusTime(time[i]);
            }
        }

        int count = 0;

        for (int i=0; i < 5; i++) {
            if (i != minIndex)
                count += actualTime(time[i]);
            else
                count += time[i];
        }

        System.out.println(count);

    }

    private static int modulusTime(int time) {
        if (time % 10 == 0) return 10;
        return time % 10;
    }

    private static int actualTime(int time) {
        if (time % 10 == 0) return time;
        return time + (10 - time % 10);
    }

}


Measured memory_bytes: 23252
import java.util.Scanner;

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

    	try {
    		final int N = sc.nextInt();
    		final int K = sc.nextInt();

    		System.out.println(Integer.toString(N, K).length());

    	} finally {
    		sc.close();
    	}
    }
}


Measured memory_bytes: 23764
#include <stdio.h>
#include <cctype>
#include <limits.h>
#include <math.h>
#include <complex>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 1000000000;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={0, 1, 0, -1}, dy[4]={-1, 0, 1, 0};
using namespace std;
//typedef pair<int, int> P;
struct P {
	int x, y;
	P(int x, int y):x(x), y(y){}
	P(){}
};

/** Problem0256 : Points for a Perfect Scorer **/
int main()
{
	int sum=0;
	rep(i, 10) {
		int n; cin>>n;
		sum+=n;
	}
	cout << sum << endl;
}

Measured memory_bytes: 1160
fun main(arg: Array<String>) {
    val (R, G, B) = listOf('R' - 'A', 'G' - 'A', 'B' - 'A')
    val N = nextInt()
    val S = next()
    val T = LongArray(26)
    S.forEach { T[it - 'A'] += 1L }
    val total = T[R] * T[G] * T[B]
    var exc = 0L
    for (n in 0 until N - 2) {
        for (m in n + 1 until N - 1) {
            val k = m + (m - n)
            if (k >= N) continue
            if (S[n] != S[m] && S[n] != S[k] && S[m] != S[k]) exc += 1
        }
    }
    val ans = total - exc
    println(ans)
}

fun next() = readLine()!!
fun nextInt(offset: Int = 0) = Integer.parseInt(next()) + offset
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfDouble() = listOfString().map(String::toDouble)
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }
fun listOfInt(vararg offset: Int) = listOfString().map { Integer.parseInt(it) }.mapIndexed { index, int -> int + offset[index % offset.size] }
fun listOfLong(offset: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + offset }
fun listOfLong(vararg offset: Long) = listOfString().map { java.lang.Long.parseLong(it) }.mapIndexed { index, long -> long + offset[index % offset.size] }
fun listOfDouble(offset: Double = 0.0) = listOfString().map { java.lang.Double.parseDouble(it) + offset }
fun pairIntLong() = listOfLong().let { Pair(it[0].toInt(), it[1]) }
fun tripleIntIntLong() = listOfLong().let { Triple(it[0].toInt(), it[1].toInt(), it[2]) }
fun tripleIntLongLong() = listOfLong().let { Triple(it[0].toInt(), it[1], it[2]) }
fun pairIntLong(offset: Pair<Int, Long> = Pair(0, 0L)) = listOfLong().let { Pair(it[0].toInt() + offset.first, it[1] + offset.second) }
fun tripleIntIntLong(offset: Triple<Int, Int, Long> = Triple(0, 0, 0L)) = listOfLong().let { Triple(it[0].toInt() + offset.first, it[1].toInt() + offset.second, it[2] + offset.third) }
fun tripleIntLongLong(offset: Triple<Int, Long, Long> = Triple(0, 0L, 0L)) = listOfLong().let { Triple(it[0].toInt() + offset.first, it[1] + offset.second, it[2] + offset.third) }


Measured memory_bytes: 39496
N=int(input())
count = 0
count2 = 0
for i in range(1,N+1):
    #print(i,"i")
    for j in range(1,N+1):
        #print(j,"k")
        if i % j == 0 :
            count += 1
            #print(count,"count")
    if count == 8 and i%2 != 0:
        count2 += 1
    ans = count2
    count = 0
print(ans)


Measured memory_bytes: 9132
#include<math.h>
L(int ax,int ay,int bx,int by,int cx,int cy,int dx,int dy,double*X,double*Y){
	int acx,acy,bunbo;
	int r,s;
	acx=cx-ax;
	acy=cy-ay;
	bunbo=(bx-ax)*(dy-cy)-(by-ay)*(dx-cx);
	if(bunbo){
		r=((dy-cy)*acx-(dx-cx)*acy);
		s=((by-ay)*acx-(bx-ax)*acy);
		if(bunbo<0){
			r=-r;
			s=-s;
			bunbo=-bunbo;
		}
		if(r>=0&&r<=bunbo&&s>=0&&s<=bunbo){
			*X=ax+r/(double)bunbo*(bx-ax);
			*Y=ay+r/(double)bunbo*(by-ay);
			return 1;
		}
	}
	return 0;
}
main(){
	int x1[3],y1[3],x2[3],y2[3];
	double X[3],Y[3],S;
	int i=0;
	for(;~scanf("%d%d%d%d",x1+i,y1+i,x2+i,y2+i);){
		if(++i==3){
			if(L(x1[0],y1[0],x2[0],y2[0],x1[1],y1[1],x2[1],y2[1],X+0,Y+0)&&
			   L(x1[1],y1[1],x2[1],y2[1],x1[2],y1[2],x2[2],y2[2],X+1,Y+1)&&
			   L(x1[2],y1[2],x2[2],y2[2],x1[0],y1[0],x2[0],y2[0],X+2,Y+2))
			{
				S=0;
				for(i=0;i<3;i++){
					S+=(X[i]-X[(i+1)%3])*(Y[i]+Y[(i+1)%3])/2;
				}
				S=fabs(S);
				if(S==0)
					puts("kyo");
				else if(S<100000)
					puts("syo-kichi");
				else if(S<1000000)
					puts("kichi");
				else if(S<1900000)
					puts("chu-kichi");
				else
					puts("dai-kichi");
			}else{
				puts("kyo");
			}
			i=0;
		}
	}
}

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

int main() {
	int N;
	cin >> N;
	string S, T;
	cin >> S >> T;
	rep(i, N){
		cout << S[i] << T[i];
	}
	cout << endl;
	//cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>

using namespace std;
// using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<double,double> pd;
typedef priority_queue<int, vector<int>, greater<int>> min_heap;

// template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const double PI = 4*atan(1);
const ll INF = 1e18;
const int MX = 100001;

int n, m, x;
int c[13];
int a[13][13];


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    int mincost = 1e8;
    for (int i = 0; i < (1 << n); i++) {
        int cost = 0;
        vector<int> skills(m + 1);
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) {
                cost += c[j];
                for (int k = 0; k < m; k++) {
                    skills[k] += a[j][k];
                }
            }
        }
        bool possible = true;
        for (int i = 0; i < m; i++) {
            if (skills[i] < x) {
                possible = false;
                break;
            }
        }
        if (!possible) continue;
        mincost = min(mincost, cost);
    }
    if (mincost == 1e8) {
        cout << -1 << "\n";
    } else {
        cout << mincost << "\n";
    }
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;

int main(){
  int r;
  cin >> r;
  cout << r*r << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
T = []
A = []
for _ in range(N):
    t, a = map(int,input().split())
    T.append(t)
    A.append(a)

ans = 1
ct = 1
ca = 1
for t, a in zip(T, A):
    n = max((ct + t - 1) // t, (ca + a - 1) // a)
    ct = n * t
    ca = n * a

print(ct+ca)




Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>

using namespace std;

int main()
{
	int n, j;
	int cnt;
	int tmp;


	while(1) {
		cin >> n;
		if (n == 0) break;
		j = 5;
		cnt = 0;
		while (j <= n) {
			tmp = j;
			while(tmp % 5 == 0) {
				tmp /= 5;
				cnt++;
			}
			j += 5;
		}
		cout << cnt << endl;
	}

	

	return (0);
}

Measured memory_bytes: 1160
#include<iostream>
#include<stdio.h>
#include<string>

int main(){
  std::string s;
  std::cin >> s;

  int cnt=0;
  for(int ii=0; ii<s.size(); ii++){
    if(s[ii]=='1'){
      cnt++;
    }
  }
  
  printf("%d", cnt);
  
  return 0;
}


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

int main(){

    long long a, b;
    cin >> a >> b;

    for(int n = 1; n < 1000; n++){
        long long left = n * (n + 1) / 2;
        long long right = (n + 1) * ((n + 1) + 1) / 2;
        if(left - a == right - b){
            cout << left - a << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        String s = scan.next();
        int len = s.length();
        String newStr = s.replace("ABC", " ");
        int newLen = newStr.length();
        System.out.println((len-newLen)/2);

    }
}

Measured memory_bytes: 21584
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll f=a[1];
    for(int i=2;i<n;i++)
    {
        f=f^a[i];
    }
    if(f==a[0]) cout<<"Yes"<<endl;
    else    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
    // clang-format on

#include <map>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    map<int, int> m;
    int ans = 0;
    REP(i, 0, n) {
        int x;
        cin >> x;
        m[x]++;
        ans ^= x;
    }
    if (m.size() == 1 && m.count(0) > 0) {
        cout << "Yes" << endl;
        return 0;
    }
    if (m.size() > 3 || n % 3 != 0) {
        cout << "No" << endl;
        return 0;
    }
    if (ans != 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 3840
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Point2D.Double;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;
import java.lang.Object;
 
public class Main {
    Scanner sc = new Scanner(System.in);
   
    public static void main(String[] args) {
        new Main(); 
    }
   
    public Main() {
        new D().doIt();
    }
    class D{	
    	ArrayList<ArrayList<Integer>> array = new ArrayList<ArrayList<Integer>>();
    	void doIt(){
    		String str = sc.next();
    		int length = str.length();
    		for(int c = 0;c < 26;c++){
    			array.add(new ArrayList<Integer>());
    		}
    		for(int i = 0;i < length;i++){
    			array.get(str.charAt(i) - 'a').add(i);
    		}
    		int s = -1;int g = -1;
    		for(int c = 0;c < 26;c++){
    			ArrayList<Integer> array2 = new ArrayList<Integer>();
    			array2 = array.get(c);
//    			System.out.println(array2.toString());
    			int length2 = array2.size();
    			if(length2 > 1){
    				for(int i = 1;i < length2;i++){
    					if(array2.get(i) - array2.get(i-1) <= 2){
    						s = array2.get(i-1)+1;
    						g = array2.get(i)+1;
    					}
    				}
    			}
    		}
    		System.out.println(s+" "+g);
    	}
    }
}

Measured memory_bytes: 15832
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+1;

int main(){
    ll x,a,b;
    cin >> x >> a >> b;
    cout << (x-a)%b << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>
int main(void){
    double x1,y1,x2,y2;
    scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
    printf("%.8f\n",sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
    return 0;
    
}



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

void main()
{
    readln;
    int c;
    foreach (i; readln.split.to!(int[])) if (i%2 == 1) ++c;
    writeln(c%2 == 0 ? "YES" : "NO");
}

Measured memory_bytes: 4348
from collections import deque
from heapq import heappop, heappush

INF = float("inf")

# ２部グラフの判定
def bfs():
  stack = deque()
  stack.append((0, 1)) #頂点:0, 色:1
  colors[0] = 1
  while stack:
    v, c = stack.popleft()
    for i in edges[v]:
      if colors[i] == c:
        return False
      if colors[i] == 0:
        stack.append((i, -c))
        colors[i] = -c
  return True

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    hq = [(0, s)] # (距離, 頂点)
    while hq:
        d, v = heappop(hq)
        if dist[v] < d:
            continue
        for child in G[v]:
            if dist[child] > dist[v] + 1:
                dist[child] = dist[v] + 1
                heappush(hq, (dist[child], child))
    return dist

n = int(input())
S = [input() for _ in range(n)]

edges = [[] for _ in range(n)]

for i in range(n):
  for j in range(n):
    if S[i][j] == "1":
      edges[i].append(j)
  
# 0: 未踏, 1 or -1: 踏破
colors = [0] * n

if bfs() == True:
  import numpy as np
  from scipy.sparse.csgraph import shortest_path
  from scipy.sparse.csgraph import floyd_warshall
  from scipy.sparse.csgraph import csgraph_from_dense

  li = [list(map(int, s)) for s in S]
  nli = np.array(li)
  nnli = np.where(nli == 0, 10**12, nli)

  G = csgraph_from_dense(nnli, null_value=10**12)
  d = floyd_warshall(G)
  
  ans = 0
  for i in range(n):
    for j in range(n):
      if ans < d[i][j]:
        ans = d[i][j]
      
  print(int(ans) + 1)
else:
  print(-1)


Measured memory_bytes: 18996
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { debug(itr); }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n, 0);
  
  set<int> st;
  rep(i, n) cin >> a[i];

  for (int i = n; i > 0; --i) {
    int cnt = 0;
    for (int j = i + i; j <= n; j += i) {
      cnt += b[j - 1];
    }
    if (cnt % 2 != a[i-1]) {
      b[i-1] = 1;
      st.insert(i);
    }
  }

  cout << st.size() << endl;
  if (st.size()) {
    for (auto&& itr : st) {
    cout << itr << " ";
  }
    END;
  }
  

}


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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> board(h);
    for (int i = 0; i < h; i++) {
        cin >> board[i];
    }
    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            if (board[y][x] == '.') {
                int cnt = 0;
                for (int i = 0; i < 3; i++) {
                    for (int j = 0; j < 3; j++) {
                        int xx = x - 1 + j;
                        int yy = y - 1 + i;
                        if (0 <= xx && xx < w && 0 <= yy && yy < h) {
                            if (board[yy][xx] == '#') {
                                cnt++;
                            }
                        }
                    }
                }
                cout << char(cnt + '0');
            } else {
                cout << board[y][x];
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

int dir(char ch) 
{
    int ret;

    if (ch == 'N')
        ret = 2;
    else if (ch == 'E')
        ret = 3;
    else if (ch == 'S')
        ret = 0;
    else if (ch == 'W')
        ret = 1;

    return ret;
}


int main()
{
    int n;

    while (cin >> n, n) {
        bool map[22][22];
        int x, y, m;

        for (int i = 0; i <= 20; i++)
            for (int j = 0; j <= 20; j++) 
                map[i][j] = false;

        for (int i = 0; i < n; i++) {
            cin >> x >> y;
            map[y][x] = true;
        }

        x = y = 10;
        cin >> m;
        for (int i = 0; i < m; i++) {
            char d;
            int l;

            cin >> d >> l;
            for (int j = 0; j < l; j++) {
                x += dx[dir(d)];
                y += dy[dir(d)];

                if (map[y][x]) {
                    map[y][x] = false;
                    n--;
                }
            }
        }

        if (n == 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, count=0;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    if(a[n/2]>a[n/2-1]) count=a[n/2]-a[n/2-1];
    else count=0;
    cout << count;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <memory.h>
int main(void){
    int sign,num,q,map[101],i,o,temp,n,max;
start:
    for(;sign=0,max=0,scanf("%d %d",&num,&q),num;){
        memset(map,0,sizeof(map));
        for(i=0;i<num;i++){
            scanf("%d",&n);
            for(o=0;o<n;o++){
                scanf("%d",&temp);
                map[temp-1]++;
                
            }
        }
        max=num+1;
        while(max--,max != q-1){
            for(i=1;i<101;i++){
                if(max == map[i-1]){
                    printf("%d\n",i);
                    goto start;
                }
            }
        }
        printf("0\n");
    }
    return 0;
}

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

bool can_make(const vector<int>& A, int i, int m){
    if (m == 0) return true;
    if (m < 0 || i >= A.size()) return false;
    return can_make(A, i + 1, m) || can_make(A, i + 1, m - A[i]);
}

int main(){
    int n;
    cin >> n;
    vector<int> A(n);
    for (auto& a : A) cin >> a;
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int m;
        cin >> m;
        cout << (can_make(A, 0, m) ? "yes" : "no") << endl;
    }
    return 0;
}

Measured memory_bytes: 3116
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x, y = 0;
		while (true) {
			x = sc.nextInt();
			y = sc.nextInt();
			if (x == 0 && y == 0)
				break;
			if (x <= y) {
				System.out.println(x + " " + y);
			} else {
				System.out.println(y + " " + x);
			}
		}
	}
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i) os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1) printEoln();
  if (suc == 2) printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

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

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

template <class T>
T Sq(const T &t) {
  return t * t;
}

signed main() {
  int N = read();
  string str;
  vector<string> W;
  W.PB(readString());
  FOR(i, 1, N) {
    str = readString();
    if (find(ALL(W), str) != W.end()) {
      cout << "No" << endl;
      return 0;
    }
    if (W[i - 1][W[i - 1].length() - 1] != str[0]) {
      cout << "No" << endl;
      return 0;
    }
    W.PB(str);
  }
  cout << "Yes" << endl;
}


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



#define all(c) (c).begin(),(c).end()
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define pb push_back
#define MAX 1000000000
#define mod 1000000007

int main(){
  int N,T;
  cin >> N >> T;
  int c[N],t[N];
  rep(i,N) cin >> c[i] >> t[i];
  int ok = 0;
  rep(i,N){
    if(T >= t[i]){
      if(ok == 0 || c[ok-1] >= c[i]){
        ok = i+1;
      }
    }
  }
  if(ok != 0) cout << c[ok-1] << endl;
  else cout << "TLE"  << endl;
}

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

using namespace std;

int n,num=0,x;
map<int,int>a;

int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {

        cin>>x;
        a[x]++;
        if(a[x]%2==0)
        {
            num--;
        }
        else
        {
            num++;
        }

    }
    cout<<num<<endl;


    return 0;

}


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

using namespace std;
using i64 = long long;

int main()
{
    i64 a, b, c;
    cin >> a >> b >> c;

    i64 Y = c - a - b;
    i64 X = 4LL * a * b;
    if (Y > 0 && Y*Y > X)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main{
	public static void main(String[] args) throws Exception {
		int num;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		num = Integer.parseInt(br.readLine());
		System.out.println(num*num*num);
	}
}


Measured memory_bytes: 24372
#include<iostream>

using namespace std;

int main(void)

{
    int x, y;
    cin>>x>>y;
    if(x == 1 ||x == 3 ||x == 5 ||x == 7 ||x == 8 ||x == 10 ||x == 12 ){
        if(y == 1 ||y == 3 ||y == 5 ||y == 7 ||y == 8 ||y == 10 ||y == 12 )
            cout<<"Yes\n";
        else cout<<"No\n";
    }
    else if(x == 4 ||x == 6 ||x == 9 ||x == 11){
        if((y == 4 ||y == 6 ||y == 9 ||y == 11))
            cout<<"Yes\n";
        else cout<<"No\n";

    }
    else if(x == 2 && y ==2){
        cout<<"Yes\n";
    }
    else cout<<"No\n";
    //for(int i = 0; i < 1000000; i++){

    //}
    return 0;
}


Measured memory_bytes: 888
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    int s = 0;
    int tmp = n;
    while (tmp > 0) {
        s += tmp % 10;
        tmp /= 10;
    }
    if (n % s == 0) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll; 

ll max(ll a, ll b) {
  return a > b ? a : b;
}

ll min(ll a, ll b) {
  return a < b ? a : b;
}

int main(void) {
  ll i, j, n, k;
  scanf("%lld%lld", &n, &k);
  ll a[n], sum[n + 1];
  for(i = 0; i < n; ++i) scanf("%lld", &a[i]);
  bool flg = true;
  for(i = 0; i < k && flg; ++i) {
    flg = false;
    for(j = 0; j < n; ++j) sum[j] = 0;
    for(j = 0; j < n; ++j) sum[max(0, j - a[j])]++, sum[min(n, j + a[j] + 1)]--;
    a[0] = sum[0];
    if(a[0] != n) flg = true;
    for(j = 1; j < n; ++j) {
      a[j] = a[j - 1] + sum[j];
      if(a[j] != n) flg = true;
    }
  }
  for(i = 0; i < n; ++i) printf("%lld ", a[i]);
  return 0;
}

Measured memory_bytes: 4844
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = [a - b for a, b in zip(A, B)]
upper = sorted([x for x in diff if x > 0])
lower = sorted([x for x in diff if x < 0])
ans = N - len([x for x in diff if x == 0])
while upper and lower:
    rest = upper.pop()
    while lower:
        tgt = lower.pop()       # negative value
        if rest + tgt >= 0:
            rest += tgt
        else:
            lower.append(tgt + rest)
            break
if lower:
    print(-1)
else:
    print(ans - len(upper))

Measured memory_bytes: 19508
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int n;
int a[25][25];
long long dp[2097157][25];

// long long f(vector<bool> used, int pos) {
long long f(int used, int pos) {
    if(dp[used][pos] != -1) return dp[used][pos];
    if(pos == n) return dp[used][pos] = 1;
    
    int res = 0;
    for(int i = 0; i < n; i++) {
        if(a[pos][i] and !(used & (1 << i))) {
            // used[i] = true;
            used |= (1 << i);
            res = (res + f(used, pos+1))%MOD;
            // used[i] = false;
            used &= ~(1 << i);
        }
    }
    
    return dp[used][pos] = res;
}

int main() {
	// your code goes here
	cin >> n;
	for(int i = 0; i < n; i++) {
	    for(int j = 0; j < n; j++) {
	        cin >> a[i][j];
	    }
	}
// 	vector<bool> used(n, false);
    int used = 0;
    memset(dp, -1, sizeof dp);
	cout << f(used, 0);
	return 0;
}


Measured memory_bytes: 409856
#include<iostream>
using namespace std;
int main()
{
  int i,n;
  cin>>n;
  int A[n],sum=0;
  for(i=0;i<n;i++)
  {
    cin>>A[i];
  }
  int j,k;
  for(k=1;k<n;k++)
  {
    for(j=0;j<k;j++)
    {
      sum=sum+A[k]*A[j];
    }
  }
  cout<<sum;
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int N;
  long a;
  long long ans = 0;

  scanf("%d",&N);
  for(int i = 0;i < N;i++){
    scanf("%ld",&a);
    ans += a;
  }

  printf("%lld\n",ans-N);
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

public class Contestant
{
    public static void Main(string[] args)
    {
        checked
        {
            var para = Console.ReadLine().Split()
               .Select(int.Parse)
               .ToList();

            Console.WriteLine(para.IndexOf(0) + 1);
        }
    }

    private static string NextInput = "";

    private static int Int() => int.Parse(Str());
    private static long Long() => long.Parse(Str());
    private static float Float() => float.Parse(Str());
    private static double Double() => double.Parse(Str());
    private static string Str()
    {
        var s = NextInput;
        if (s == "") s = Console.ReadLine();

        var idx = s.IndexOf(' ');
        if (idx >= 0)
        {
            NextInput = s.Substring(idx + 1);
            return s.Substring(0, idx);
        }
        NextInput = "";
        return s;
    }
}



Measured memory_bytes: 28312
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）

//MODINT
//変数名.nでint型の数値を受け取る
struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};
 
mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

int ii() { int x; scanf("%d", &x); return x; }
long long il() { long long x; scanf("%lld", &x); return x; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od(double x) { printf("%.15f ", x); }
void os(const string &s) { printf("%s ", s.c_str()); }
auto op = [&](auto p) -> void{ cout << p; };
auto ov = [&](auto vec) -> void{ cout << vec; };
void br() { putchar('\n'); }
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << p.first << " " << p.second;}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
	}
	return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	int len = vv.size();
	for (int i = 0; i < len; ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

// ----- template end ---- //
 
// ------- library ------- //



// ----- library end ----- //



int main() {


  vector<ll> vals(5);
  rep(i, 5) vals[i] = il();

  ll k = il();

  os(vals[4]-vals[0]>k ? ":(" : "Yay!"); br();

  
// -- main() end -- //
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

int main(int argc, char const *argv[]) {
  int D;
  std::cin >> D;

  switch (D) {
    case 25:
      std::cout << "Christmas" << '\n';
      break;
    case 24:
      std::cout << "Christmas Eve" << '\n';
      break;
    case 23:
      std::cout << "Christmas Eve Eve" << '\n';
      break;
    case 22:
      std::cout << "Christmas Eve Eve Eve" << '\n';
      break;
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

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

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n, x, t;
    cin >> n >> x >> t;
    cout << ((n - 1) / x + 1) * t << endl;
    return;
}

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

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll n;cin >> n;
	ll ans = 0;
	ll a = 0;
	ll b = 0;
	ll c = 0;

	vector<string> v;
	REP(i, n){
		string str;cin >> str;
		REP(j, str.size() - 1){
			if(str[j] == 'A' && str[j+1] == 'B')ans++;
		}
		v.PB(str);
		if(str[0] == 'B' && str[str.size() - 1] == 'A')a++;
		else if(str[0] == 'B')b++;
		else if(str[str.size() - 1] == 'A')c++;
	}

	//cout << ans << " " << a << " " << b << " " << c << endl;


	ll tmp = min(b, c);
	ans += tmp;
	b -= tmp;c -= tmp;
	ll seica = min(a, max(b, c));
	ans += seica;
	a -= seica;
	if(a > 0 && (tmp > 0 || seica > 0))ans += a;
	else if(a > 0)ans += a - 1;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 768
N = int(input())
S = list(input())

if (N % 2 != 0):
    print("No")
else:
    can = True
    N = int(N/2)
    for i in range(N):
        if (S[i] != S[i + N]):
            can = False
    if (can):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;
#define vsort(v) sort(v.begin(), v.end());

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c, d;
	cin >> a >> b >> c >> d;

	if(abs(a - c) <= d) {
		cout << "Yes" << endl;
		return 0;
	}

	if(abs(a - b) <= d and abs(b - c) <= d) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <climits>

constexpr int SINT_MAX = std::numeric_limits<int>::max();
constexpr int SINT_MIN = std::numeric_limits<int>::min();

using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

template<class T>
T choose(bool b, T t, T f)
{
    if (b) return t;
    else return f;    
}

const char *YesNo(bool b)
{
    return choose(b, "Yes", "No");
}

const char *YESNO(bool b)
{
    return choose(b, "YES", "NO");
}

template<template<class...> class ContT, class ValueT, size_t Dim>
struct vec_type
{
    using type = ContT<typename vec_type<ContT, ValueT, Dim-1>::type>;
};

template<template<class...> class ContT, class ValueT>
struct vec_type<ContT, ValueT, 0>
{
    using type = ValueT;
};

template<class ValueT, size_t Dim = 1>
using vec_t = typename vec_type<std::vector, ValueT, Dim>::type;


template<class ValueT, size_t Dim, class = typename std::enable_if<Dim == 0>::type>
auto make_vec(ValueT value = ValueT()) -> ValueT
{
    return value;
}

template<class ValueT, size_t Dim, class... Rest>
auto make_vec(size_t size0, Rest... rest)
{
    auto vec = make_vec<ValueT, Dim-1>(rest...);
    return std::vector(size0, vec);
}

int diffabs(int l, int r)
{
    if (l < r) return r-l;
    else return l-r;    
}


///////////////////////////////////////////////////

int main()
{
    char c;
    cin >> c;
    bool ans = isupper(c);
    cout << choose(ans, "A", "a") << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	int k;
	int a, b;
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++){
		if (i % k == 0){
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	
	return 0;
}

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

long long int nax=1e5+5;
vector<vector<int>>edge(nax);
vector<int>degree(nax);
vector<bool>visited(nax,false);
vector<int>dp(nax,0);
void recur(int a){
    visited[a]=true;
    for(int i=0;i<edge[a].size();i++)
    {
        int k=edge[a][i];
        dp[k]=((dp[k]>dp[a]+1)?dp[k]:dp[a]+1);
        degree[k]--;
        if(degree[k]==0){
            recur(k);
        }
    }
    
}


int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        a--,b--;
        edge[a].push_back(b);
        degree[b]++;
    }
    for(int i=0;i<n;i++)
    {
        if(!visited[i]&&degree[i]==0){
            recur(i);
        }
    }
    int nax=0;
    for(int i:dp){
        nax=max(nax,i);
    }
    cout<<nax;
}

Measured memory_bytes: 15500
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <string>
#include <iostream>
#define B 100000007LL
using namespace std;
typedef long long ll;
int n,m;
string str;
ll data[500000];
set<ll> all;

ll mod_pow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1)res=res*x;
		x=x*x;
		n>>=1;
	}
	return res;
}

int main(void){
	scanf("%d %d",&n,&m);
	cin >> str;
	int l=0,r=1;
	for(int i=0;i<n;i++){
		ll s=str[i]-'a'+1;
		data[i+1]=data[i]*B+s;
	}
	for(int i=0;i<m;i++){
		string query;
		cin >> query;
		if(query=="R++")r++;
		if(query=="R--")r--;
		if(query=="L++")l++;
		if(query=="L--")l--;
		if(all.find(data[r]-data[l]*mod_pow(B,r-l))==all.end())all.insert(data[r]-data[l]*mod_pow(B,r-l));
	}
	printf("%d\n",all.size());
	return 0;
}

Measured memory_bytes: 17940
#include <stdio.h>

int max(int number_a, int number_b, int number_c) {
  if(number_a >= number_b && number_a >= number_c) {
    return number_a;
  } else if(number_b >= number_c) {
    return number_b;
  } else {
    return number_c;
  }
  return 0;
}

int main() {
  int buttom_a, buttom_b, ans = 0;
  scanf("%d %d", &buttom_a, &buttom_b);
  ans = max(buttom_a + buttom_b, 2 * buttom_a - 1, 2 * buttom_b - 1);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128