akhauriyash/Code-Regression huggingface dataset:
#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;

int x;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> x;
	cout << 8 - (x - 400) / 200 << '\n';
	return 0;
}

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

// #include "../../template-proj/myMente.h"

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

#define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
	// int N; cin>>N;
	int a,b; cin>>a>>b;
	// string s; cin>>s;

	ll ans = 0;


	if(b==1){
		ote(0);
		return 0;
	}
	// int i = a;
	// while(a<b){
	// 	a *= a;
	// 	++ans;
	// }
	// ote(ans);
	// ote((b+a-1)/a);

	while(b>0){
		b-=a;
		++ans;
		if(b>0) ++b;
	}
	ote(ans);
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int temp;
  int i,j;

  int data[10];

  for(i=0;i<10;i++){
    scanf("%d",&data[i]);
  }
  for(i=0;i<10;i++){
    for(j=i;j<10;j++){
      if(data[i]<data[j]){
        temp = data[j];
        data[j] = data[i];
        data[i] = temp;
      }
    }
  }

  printf("%d\n%d\n%d\n",data[0],data[1],data[2]);


  return(0);

}

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

int main() {
  int N, Y;
  cin >> N >> Y;

  for (int k10{}; k10 <= N; ++k10) {
    for (int k5{}; k5 <= N - k10; ++k5) {
      int k1 = N - k10 - k5;
      if (k10 * 10000 + k5 * 5000 + k1 * 1000 == Y) {
        cout << k10 << " " << k5 << " " << k1 << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;
  return 0;
}


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

using namespace std;

int main(){
  
  int n,res = -1;
  string s;
  cin >> n >> s;
  for(int i = 0;i < n;i++){
    string t = s.substr(0,i+1),u = s.substr(i+1);
    map<char,int> mp,mpp;
    for(int j = 0;j < t.size();j++){
      mp[t[j]]++;
    }
    for(int j = 0;j < u.size();j++){
      mpp[u[j]]++;
    }
    int sum = 0;
    for(char c = 'a';c <= 'z';c++){
      if(mp[c] > 0 && mpp[c] > 0)sum++;
    }
    res = max(sum,res);
  }
  cout << res << endl;
  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N, M;
    void solve()
    {
        N = cin.nextint;
        M = cin.nextint;
        input(M);
        var flag = find_negative_loop(N, M, 0);
        WriteLine(flag ? "inf" : $"{-D[N - 1]}");
    }

    struct Edge
    {
        public int from, to; public long cost;
        public Edge(int from, int to, long cost)
        {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
    }
    Edge[] G;
    long[] D;
    const long inf = long.MaxValue / 3;
    void input(int m)
    {
        G = new Edge[m];
        for (int i = 0; i < m; i++)
        {
            int a = cin.nextint - 1;
            int b = cin.nextint - 1;
            long c = -cin.nextlong;
            G[i] = new Edge(a, b, c);
        }
    }
    bool find_negative_loop(int n, int m, int s)
    {
        D = Enumerable.Repeat(inf, n).ToArray();
        D[s] = 0;
        for (int i = 0; i < n; i++)
        {
            foreach (var e in G)
            {
                if (D[e.to] > D[e.from] + e.cost)
                {
                    D[e.to] = D[e.from] + e.cost;

                    // n回目にも更新があるなら負の閉路が存在する
                    if (i == n - 1 && e.to == n - 1) return true;
                }
            }
        }
        return false;
    }
}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main(){
    char d;
    string line;
    getline(cin, line);
    rep(i, line.size()){
        if('a'<=line.at(i)&&line.at(i)<='z'){
            d=line.at(i)-32;
        }
        else if('A'<=line.at(i)&&line.at(i)<='Z'){
            d=line.at(i)+32;
        }
        else{
            d=line.at(i);
        }
        cout<<d;
    }
    cout<<endl;
}


Measured memory_bytes: 3116
import java.util.Scanner;

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

		if (s.length() == 1) {
			System.out.println(s);
			return;
		}

		int cnt = 0;
		for (int i = 1; i < s.length(); i++) {
			if (s.charAt(i) == '9') {
				cnt++;
			}
		}
		int a = Integer.parseInt(s.substring(0, 1));
		if (cnt < s.length() - 1) {
			a--;
		}
		System.out.println(a + 9 * (s.length() - 1));
	}
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;
using namespace std;
int ans[32];

bool judge(string JudgeStr){
    for(int i = 0; i < JudgeStr.size(); i++){
        ans[JudgeStr[i] - 'a']++;
        if(ans[JudgeStr[i] - 'a'] > 1){
            return false;
        }

    }
    return true;
}
int main(){
    string JudgeStr;
    cin >> JudgeStr;
    if(judge(JudgeStr)){
        cout << "yes" << '\n';
    }
    else{
        cout << "no" << '\n';
    }
}


Measured memory_bytes: 256
from collections import deque
def solve():
    N, M = map(int, input().split())
    data = []
    for i in range(N):
        a, b = map(int, input().split())
        data.append((a, b))
    
    data.sort(key=lambda x: x[0])
    data = deque(data)

    ans = 0
    cnt = 0
    while cnt < M:
        d = data.popleft()
        for i in range(d[1]):
            cnt += 1 
            ans += d[0]
            if cnt >= M:
                break
    
    print(ans)
        

if __name__ == '__main__':
    solve()

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

using namespace std;
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

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


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	ll n,m;
	cin >>n >>m;
	/*
	vector<VI> a(n, VI(m));
	rep(i,n) rep(j,m){
		rep(k,9){
			int ny=i+dy[k], nx=j+dx[k];
			if(ny<0 || ny>=n || nx<0 || nx>=m) continue;
			a[ny][nx]++;
		}
	}

	for(auto xl: a){for(auto x :xl) printf("%d, ",x); puts("");}
*/
	if(n==1 && m==1){puts("1");return 0;}
	if(m>n) swap(m,n);
	ll ans =-1;
	if(n>2 && m>2) ans = (n-2)*(m-2);
	else if(n==2 || m==2) ans =0;
	else  ans = n-2;
	cout << ans <<"\n";
	return 0;
	
}


Measured memory_bytes: 256
n = int(input())
L = list(map(int, input().split()))

total = sum(L)
mid = total / 2
accum = 0
for i, elm in enumerate(L):
    accum += elm
    if accum == mid:
        print(0)
        break
    elif accum > mid:
        right = accum - mid
        left = elm - right
        print(int(min(left, right) / 0.5))
        break

Measured memory_bytes: 26764
#include<stdio.h>
#include<string.h>

int main(void){
    char S[12];
    char T[12];
    int A,B;
    char U[12];

    scanf("%s", &S);
    scanf("%s", &T);
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%s", &U);

    if(strcmp(S, U) == 0){
        A--;
        printf("%d %d\n", A, B);
    }else if(strcmp(T, U) == 0){
        B--;
        printf("%d %d\n", A, B);
    }
    return 0;
}

Measured memory_bytes: 1720
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("2 4 6");
            //YES
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2 5 6");
            //NO
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("3 2 1");
            //YES
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        int A = wkArr[0];
        int B = wkArr[1];
        int C = wkArr[2];

        if (B - A == C - B) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }
}


Measured memory_bytes: 11348
import math
a,b,x = map(int,input().split())
c = x / (a**2)
if (b-c)*2 <= b:
    d = (b-c)*2
    print(math.atan(d/a)*180/math.pi)
else:
    d = a * c
    e = 2*d/b
    print(math.atan(b/e)*180/math.pi)



Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int k, n;
    cin >> n >> k;
    auto hs=vector<int>(n);
    for(int i=0; i<n; ++i){
        cin >> hs[i];
    }
    sort(hs.begin(), hs.end());
    int res=1000*1000*1000+1;
    for(int i=0; i<n-k+1; ++i){
        res=min(res, hs[i+k-1]-hs[i]);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 768
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = long.Parse(line[0]);
        var b = long.Parse(line[1]);
        var c = long.Parse(line[2]);
        if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) { Console.WriteLine(0); goto end; }
        if (a == b && b == c) { Console.WriteLine(-1); goto end; }
        var count = 0;
        while (a % 2 == 0 && b % 2 == 0 && c % 2 == 0)
        {
            var  wa = a / 2;
            var wb = b / 2;
            var wc = c / 2;
            a = wb + wc;
            b = wc + wa;
            c = wa + wb;
            count++;
        }
        Console.WriteLine(count);
        end:;
    }
}

Measured memory_bytes: 13140
import heapq
def dijkstra(start:int):
    """priority_queue ver. O(|E|log|V|)
    """
    global dist # list dist[|V|]
    global edges # 隣接リスト
    dist[start] = 0
    q = [(0,start)] #（暫定的な距離，頂点）
    while q:
        d_cur,cur = heapq.heappop(q)
        if dist[cur] < d_cur: # すでに探索済み
            continue
        for nex,cost in edges[cur]:
            if dist[nex] > dist[cur]+cost:
                dist[nex] = dist[cur]+cost
                heapq.heappush(q, (dist[nex], nex))


if __name__ == "__main__":
    V,E,start = map(int, input().split())
    edges = [[] for _ in range(V)]
    for _ in range(E):
        s,t,d = map(int, input().split())
        edges[s].append((t, d))
    dist = [float('inf') for _ in range(V)]
    dijkstra(start)
    for di in dist:
        if di==float('inf'):
            print("INF")
        else:
            print(di)



Measured memory_bytes: 91596
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e6+50;
int n, vis[N];
char a[N],b[N],c[N];
struct _ {
	int p,l,r;
} L[N],R[N];
vector<pair<int,_> > tag[N];
vector<int> tag2[N];

int solve(int d) {
	REP(i,0,n) tag[i].clear(),tag2[i].clear();
	int ans = 0, cnt = 0;
	REP(i,1,n) { 
		vis[i] = 0;
		int nxt = i-d;
		if (nxt<=0) nxt += n;
		c[nxt] = b[i]^a[i];
		if (b[i]) L[++cnt].p = i;
	}
	REP(i,1,n) ans += c[i];
	REP(i,1,cnt) { 
		L[i].l=i-1,L[i].r=i+1,R[i]=L[i];
	}
	L[0].r = 1, R[0] = L[0];
	if (!ans) return d;
	int tot = 0, pl = 0, pr = 0;
	REP(i,1,n) if (b[i]) { 
		vis[i] = 1;
		if (c[i]) ++tot;
	}
	if (tot==ans) return ans+d;
	auto add = [&](_ f[], int &p, int tp) {
		p += tp;
		for (int i=f[0].r; i!=cnt+1; i=f[i].r) {
			int nxt = f[i].p-tp;
			if (nxt==0) nxt=n;
			if (nxt>n) nxt=1;
			f[i].p = nxt;
			if (tp<0) {
				if (vis[nxt]) {
					tag[abs(p)].pb(pair<int,_>(f[i].l,f[f[i].l]));
					tag[abs(p)].pb(pair<int,_>(f[i].r,f[f[i].r]));
					f[f[i].l].r=f[i].r;
					f[f[i].r].l=f[i].l;
				}
				else { 
					tag2[abs(p)].pb(nxt);
					vis[nxt] = 1;
					if (c[nxt]) ++tot;
				}
			}
			else {
				if (vis[nxt]>=10) f[f[i].l].r=f[i].r,f[f[i].r].l=f[i].l;
				else {
					if (!vis[nxt]&&c[nxt]) ++tot;
					vis[nxt] += 10;
				}
			}
		}
	};
	while (tot<ans) add(L,pl,-1);
	int ret = min(abs(pl)+abs(pr-pl)+abs(d-pr),abs(pr)+abs(pl-pr)+abs(d-pl));
	do {
		for (auto &t:tag[abs(pl)]) { 
			L[t.x] = t.y;
		}
		for (auto &t:tag2[abs(pl)]) {
			--vis[t];
			if (!vis[t]&&c[t]) --tot;
		}
		++pl;
		while (tot<ans) add(R,pr,1);
		ret = min(ret, min(abs(pl)+abs(pr-pl)+abs(d-pr),abs(pr)+abs(pl-pr)+abs(d-pl)));
	} while (pl);
	return ans+ret;
}


int solve() {
	int ans = 1e9;
	REP(d,0,n-1) {
		ans = min(ans, solve(d));
		char t = a[n];
		PER(i,2,n) a[i]=a[i-1];
		a[1] = t;
	}
	return ans;
}

char tmp[N];

int main() {
	scanf("%s%s",a+1,b+1);
	n = strlen(a+1);
	if (strcmp(a+1,b+1)==0) return puts("0"),0;
	if (*max_element(b+1,b+1+n)=='0') return puts("-1"),0;
	REP(i,1,n) a[i]-='0',b[i]-='0',tmp[i]=a[i];
	int ans = solve();
	REP(i,1,n) a[i]=tmp[i];
	reverse(a+1,a+1+n);
	reverse(b+1,b+1+n);
	ans = min(ans, solve());
	printf("%d\n", ans);
}






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

int main(void)
{
    string s;
    int n, k;
    char c;

    cin >> n >> s >> k;
    c = s[k-1];
    for (int i = 0; i < n; i++) {
        if (s[i] != c) s[i] = '*';
    }
    cout << s << endl;
}


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

int main(){
    string str;
    cin >> str;
    char B,W;
    B='B'; W='W';
    int ans=0;
    char tmp=str[0];
    for(int i=1;i<str.size();i++){
        if(tmp!=str[i]){
            tmp=str[i];
            ans++;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 1020
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    int m = 0;
    m = max(A * 10 + B + C, m);
    m = max(A + B * 10 + C, m);
    m = max(A + B + C * 10, m);

    cout << m << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		while(true){
			// 入力処理ここから
			String input = null;
			try {
				input = br.readLine();
			} catch (IOException e) {
			}
			String[] inputs = input.split(" ");
			int a = Integer.parseInt(inputs[0]);
			String op = inputs[1];
			int b = Integer.parseInt(inputs[2]);
			// 入力処理ここまで

			// op分岐ここから
			int result = 0;
			boolean isLoop = true;
			switch(op){
				case "+":
					result = a + b;
					break;
				case "-":
					result = a - b;
					break;
				case "*":
					result = a * b;
					break;
				case "/":
					result = a / b;
					break;
				case "?":
					isLoop = false;
					break;
				default:
					break;
			}
			// op分岐ここまで

			// op結果ここから
			if(!isLoop){
				break;
			}
			System.out.println(result);
			// op結果ここまで
		}
	}
}



Measured memory_bytes: 24208
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int sum = 0;
		int s;
	        int w;
                while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
                        sum = 0;
			for(int i = 0;i < n;i++){
				s = scan.nextInt() + scan.nextInt() + scan.nextInt();
				w = scan.nextInt();
				if(s <= 60 && w <= 2){
					sum += 600;
				}else if(s <= 80 && w <= 5){
					sum += 800;
				}else if(s <= 100 && w <= 10){
					sum += 1000;
				}else if(s <= 120 && w <= 15){
					sum += 1200;
				}else if(s <= 140 && w <= 20){
					sum += 1400;
				}else if(s <= 160 && w <= 25){
					sum += 1600;
				}
			}
			System.out.println(sum);
		}
	}
}

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

void Main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  int cnt = 0;
  int ans[n];
  memset(ans, 0, sizeof(ans));
  for (int i = n; i > 0; i--) {
    int tmp = 0;
    for (int j = i + i; j <= n; j += i) {
      tmp += ans[j];
    }
    if (a[i] == tmp % 2) {
      ans[i] = 0;
    } else {
      ans[i] = 1;
      cnt++;
    }
  }

  cout << cnt << endl;
  for (int i = 1; i <= n; i++) {
    if (ans[i]) cout << i << endl;
  }
}

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

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i=0;i<n;i++)
#define ll long long
#define sc(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
typedef pair<ll, ll>	pl;
typedef vector<int>	vi;
typedef  set<int>	s;
typedef map<int,int>	m;
int main()
{
char c;
cin>>c;
if(c>=65 && c<=90)
 cout<<"A";
 else
 {
     cout<<"a";
 }
 

return 0;
}

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

using ll=long long;
using ld=long double;

void solve(){
	int n,x,t;
	cin>>n>>x>>t;
	if(n%x==0){
		cout<<((n/x)*t)<<'\n';
	}else{
		cout<<(((n/x)+1)*t)<<'\n';
	}
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;

const int len = 105;
int cnt[len], n;
vector<ii> ed;
vector<int> adj[len];

void init(){
    for (int i = 0; i < n; i++)
        cnt[i] = 0;
}

pair<int, ll> check(){
    pair<int, ll> ans = mp(0, 1);
    int pos = 0;
    while (cnt[pos] > 0){
        ans.se *= cnt[pos];
        pos++;
    }

    ans.fi = pos+1;
    return ans;
}

void dfs(int u, int p, int d){
    int kids = 0;
    for (int j = 0; j < adj[u].size(); j++){
        int v = adj[u][j];
        if (v != p){
            kids++;
            dfs(v, u, d+1);
        }
    }

    cnt[d] = max(cnt[d], kids);
}

int main(){
    scanf("%d", &n);
    for (int i = 0; i < n-1; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        adj[a].pb(b);
        adj[b].pb(a);
        ed.pb(mp(a, b));
    }

    pair<int, ll> ans = mp(n+1, 0);
    for (int i = 1; i <= n; i++){
        init();
        dfs(i, i, 0);

        pair<int, ll> temp = check();
        if (adj[i].size() == 1) temp.se++;
        ans = min(ans, temp);
    }

    for (int i = 0; i < ed.size(); i++){
        init();
        int a = ed[i].fi, b = ed[i].se;
        dfs(a, b, 0), dfs(b, a, 0);

        pair<int, ll> temp = check();
        temp.se *= 2;
        ans = min(ans, temp);
    }

    printf("%d %lld\n", ans.fi, ans.se);
    return 0;
}


Measured memory_bytes: 256
//基準の人きめて、そこから座標管理すればいいかな
//あれっぽい、3回ソートするやつ
//ワーシャル
//ループする木みたいな感じ
//N^2は無理
//map?
//M^2通り全部しらべるのも無理
//与えられたデータを調べてM通りのチェックか
//数字でソート。数字ごとに矛盾がないか調べるか
//新しく出現した数字は0位置に固定
//1 2 100
//1 3 200
//1 4 400
//2 3 100 とかはきうる
//map[1]=0
//map[2]=100
//とか。
//初期値、1e10とかにするか
//それ配列でいいかも
//LsortだけだとRが乱れてるかも。R先にsort
//関係なかった
//1 7
//5 6
//6 7
//7 8
//これでばぐる。UnionFindかな、ツリーみたいな
//やっぱマップかな
//treeで子どもみつける。
//関連する位置情報うめてく。
//
//map(1,7)=100
//map(7,1)=-100
//1 7
//2 5
//2 9
//3 4
//10 4
//5 6
//6 7
//7 9
//8 9

//1-7-6-5-2
//   -9-8
//     -2
//逆いるか
//ループしてても、1度見てたらスルーでいいのかな
//だめだた

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
vector<ll> pos;
vector<vector<ll>>T;
vector<bool> seen;
map<pair<ll,ll>,ll> mp;
bool dfs(ll i){
  for(auto next_i:T[i]){
    if(seen[next_i]){
      if(mp[make_pair(next_i,i)]!=pos[next_i]-pos[i])
        return false;
    }
//      cout<<i<<" "<<next_i<<" "<<mp[make_pair(i,next_i)]<<" "<<pos[next_i]-pos[i]<<endl;
    else{
      seen[next_i]=true;
      if(pos[next_i]==1e10){
        pos[next_i]=pos[i]+mp[make_pair(next_i,i)];
      }
      else if(mp[make_pair(next_i,i)]!=pos[next_i]-pos[i])
        return false;
      dfs(next_i);
    }
  }
  return true;
}

int main(){
  ll N,M; cin>>N>>M;
  pos.assign(N+1,1e10);
  seen.assign(N+1,false);
  T.assign(N+1,vector<ll>());
  ll m=1e6;
  for(int i=0; i<M; i++){
    ll L,R,D; cin>>L>>R>>D;
    mp[make_pair(R,L)]=D;
    mp[make_pair(L,R)]=-D;
    T[L].emplace_back(R);
    T[R].emplace_back(L);
    m=min(m,L);
  }
  for(int i=1; i<=N; i++){
    if(pos[i]==1e10)
      pos[i]=0;
    seen[i]=true;
    if(!dfs(i)){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 42112
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin,c.end()
#define tr(c,i) for(typeof(c).begin() i=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF 1e9+7
typedef long long int ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

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

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
}

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

int main() {
    //input
    int n,m;
    cin >> n >> m;
    int count[m] = {0};
    int c=0;
    for(int i=0;i<n;i++){
        int k;
        cin >> k;
        for(int j = 0;j<k;j++){
            int a;
            cin >> a;
            count[a-1]++;
        }
        if(i == n-1){
            for(int l=0;l<m;l++){
                if(count[l] == n){
                    c++;
                }
            }
        }
    }

    cout << c << endl;
    return 0;
}

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

typedef struct {
  int num;
  int mass;
} bigint;

int compare_int(const void *a, const void *b){
  return *(int*)a - *(int*)b;
}

int compare_bigint( const void *p, const void *q ) {
   return ((bigint*)q)->mass - ((bigint*)p)->mass;
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  return b;
}

void calic(int *A,int n,bigint*ma,int*a){
  int i;
  int k=1;
  int j=0;
  for(i=0;i<n;i++){
    ma[i].mass=0;
    ma[i].num=0;
  }
  for(i=1;i<n/2;i++){
    if(A[i]==A[i-1]){
      k++;
    }else{
      ma[j].mass=k;
      ma[j].num=A[i-1];
      j++;
      k=1;
    }
  }
  ma[j].mass=k;
  ma[j].num=A[n/2-1];
  a[0]=j+1;
}

int main(){
  int n,i,ans;
  scanf("%d",&n);
  int A[n/2];
  int B[n/2];
  for(i=0;i<n;i++){
    if(i%2==0){
      scanf("%d",&A[i/2]);
    }else{
      scanf("%d",&B[(i-1)/2]);
    }
  }

  bigint ma[n];
  bigint mb[n];
  int a[1];
  int b[1];
  qsort(A, n/2, sizeof(int), compare_int);
  qsort(B, n/2, sizeof(int), compare_int);
  calic(A,n,ma,a);
  calic(B,n,mb,b);
  qsort(ma, a[0], sizeof(bigint), compare_bigint);
  qsort(mb, b[0], sizeof(bigint), compare_bigint);

  
  if(ma[0].num==mb[0].num){
    ans=min(n-ma[1].mass-mb[0].mass,n-ma[0].mass-mb[1].mass);
  }else{
    ans=n-(ma[0].mass+mb[0].mass);
  }
  printf("%d",ans);
  return 0;
}


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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

/////////////////////GCD//////////////////////
ll gcd(ll a, ll b)
{
	if(b==0) return a;
	return gcd(b, a%b);
}


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}

int rec(int level, int n, int a)
{
	if(level==n)
	{
		return a;
	}

	rec(level+1, n, a);
	for(int i = a+1; i<=n; i++)
	{
		rec(level+1, n, a+1);
	}
	// ans.pb()
	// rec(level+1, n, a+1);
}

int best = imn;
int q, m, n;
int rec_fn(int i, int pivot, vector<int>& arr, vector<vector<int> >& mat)
{
	// cout<<i<<endl;

	// for(auto i: arr) cout<<i<<" ";
		// cout<<endl;
	if(i==n+1)
	{
		int sum = 0;
		for(int k = 0; k < q; k++)
		{
			if(arr[mat[k][1]-1]-arr[mat[k][0]-1]==mat[k][2])
				sum+=mat[k][3];
		}
		// cout<<sum<<endl;
		best = max(best, sum);
		// return;
		return best;
	}

	for(int j = pivot; j<=m; j++)
	{
		arr[i]=j;
		// rec_fn(i+1, j, arr, mat);//
		best = max(rec_fn(i+1, j, arr, mat), best);
		// cout<<" best "<<best<<" j "<<j<<endl;
		// return best;
	}
	return best;

}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// ll x;
	// cin>>x;
	// ll start =100;
	// int i = 0;
	// while(start < x)
	// {
	// 	start= (start+(start*1)/100);
	// 	i++;
	// }
	// cout<<i<<endl;
	// int a, b, c, d;
	ll sum = 0, maxim = 0;
	cin>>n>>m>>q;
	// for(int vector<)
	vector<vector<int> > mat(q+1, vector<int> (4));
	vector<int> ans(n+1, imx);
	for(int i = 0; i < q; i++)
		for(int j = 0; j < 4; j++)
			cin>>mat[i][j];

	// for(int i = 0; i < n; i++)
	// {
	// 	for(int j = 0; j < 4; j++)
	// 	{
	// 		cout<<mat[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }
	// rec_fn(0, 1, ans, mat);
	// p(best);
		int an = rec_fn(0, 1, ans, mat);
		p(an);
		// p(best);
	// rec(0, n, 1);
	// while(q--)
	// {
		// cin>>a>>b>>c>>d;

	// }
}

Measured memory_bytes: 3624
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from itertools import accumulate

# 転倒数を求めるためのBIT
class BIT(object):
    def __init__(self, size):
        self.size = size+1
        self.bitree = [0]*self.size
        
    def addval(self, idx:int, val:int):
        while idx < self.size:
            self.bitree[idx] += val
            idx += idx&(-idx)
            
    def getsum(self, idx:int):
        ret = 0
        while idx > 0:
            ret += self.bitree[idx]
            idx -= idx&(-idx)
            
        return ret
    
    def reset(self):
        self.bitree = [0]*self.size
        
# 二分探索のための関数
def findInv(arr:list, med:int):
    arrbin = [-1 if ai < med else 1 for ai in arr]
    arrcum = [0] + list(accumulate(arrbin))
    arrcummin = abs(min(arrcum))
    arrcumpos = [arrcum_i + arrcummin + 1 for arrcum_i in arrcum]
    
    bitree = BIT(max(arrcumpos))
    inv = 0
    for i,ai in enumerate(arrcumpos):
        inv += (i - bitree.getsum(ai))
        bitree.addval(ai, 1)
        
    return inv

# 二分探索
def binsearch(arr:list):
    low = 0
    high = max(arr) + 1
    n = len(arr)
    threshould = n*(n+1)//4
    
    while high-low > 1:
        mid = (high+low) // 2

        if findInv(arr, mid) <= threshould:
            low = mid
            
        else:
            high = mid
            
    return low        

n = ni()
a = list(li())

print(binsearch(a))

Measured memory_bytes: 123104
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
int main() {
  int A,B,C,D,E,F;
  cin>>A>>B;
  C=A+B;
  D=A-B;
  E=A*B;
  F=max(C,max(D,E));
  cout<<F<<endl;
}

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

typedef long long ll;
 
int main(){
  ll n, m;
  cin >> n >> m;
  ll ans = (m*1800+n*100);
  for(int i=0; i<m; i++){
    ans *= 2LL;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int maxN = 305;
int dp[maxN][maxN][maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    string s;
    int k;
    cin >> s >> k;
    int n = s.size();
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n - i; j++) {
            for (int cnt = k; cnt >= 0; cnt--) {
                if (!i || !j) continue;
                dp[i][j][cnt] = max(dp[i][j][cnt], dp[i - 1][j][cnt]);
                dp[i][j][cnt] = max(dp[i][j][cnt], dp[i][j - 1][cnt]);
                if (cnt) {
                    dp[i][j][cnt] = max(dp[i][j][cnt], dp[i - 1][j - 1][cnt - 1] + 2);
                }
                if (s[i - 1] == s[n - j]) {
                    dp[i][j][cnt] = max(dp[i][j][cnt], dp[i - 1][j - 1][cnt] + 2);
                }
            }
        }
    }
    int best = 0;
    for (int cut = 0; cut < n; cut++) {
        best = max(best, dp[cut][n - cut - 1][k] + 1);
    }
    for (int cut = 0; cut < n; cut++) {
        best = max(best, dp[cut][n - cut][k]);
    }
    cout << best;
    return 0;
}

Measured memory_bytes: 58172
#include <iostream>

int main() {
  long N, D, X;

  std::cin >> N;
  std::cin >> D;
  std::cin >> X;

  long ans = 0;

  for (long i=0; i<N; i++) {
    long A;
    std::cin >> A;
    ans += 1 + ((D-1) / A);
  }

  std::cout << (ans+X) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  ll n,r,m;
  cin >> n >> m >> r;
  ll city[r];
  rep(i,r) cin >> city[i];
  ll a,b,c;
  
  ll load[n][n];
  rep(i,n)rep(j,n) load[i][j]=INF;
  rep(i,n) load[i][i]=0;
  rep(i,m){
    cin >> a >> b >> c;
    load[a-1][b-1]=c;
    load[b-1][a-1]=c;
  }

  //初期化
  rep(k,n)rep(i,n)rep(j,n)
    load[i][j]=min(load[i][j],load[i][k]+load[k][j]);
  
  ll ans = INF;
  sort(city,city+r);
  while(next_permutation(city,city+r)){
    ll tempans=0;
    rep(i,r-1)
    tempans += load[city[i]-1][city[i+1]-1];
    chmin(ans,tempans);
  }
  pri(ans);
  
  return 0;
}



Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
  int a;
  cin>>a;
  for(int i=0;i<a;i++){
    string numStr;
    int max=0; int min=0;
    cin>>numStr;
    int num[8];
    for(int j=0;j<8;j++){
      num[j]=numStr[j]-'0';
    }
    sort(num,num+8);
    for(int j=0;j<8;j++){
      max+=num[j]*pow(10.0,(double)j);
    }
    sort(num,num+8,greater<int>());
    for(int j=0;j<8;j++){
       min+=num[j]*pow(10.0,(double)j);
    }
    cout<<max-min<<endl;
  }
}

Measured memory_bytes: 1268
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, sum = 0, tmp;
	cin >> nn;
	vector<int64> aa(nn), memo(nn + 1, 0);
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> aa[ii];
		memo[aa[ii]]++;
	}
	vector<int64> cc(nn + 1, 0);
	for(int64 ii = 0;ii <= nn;ii++)
	{
		if(memo[ii] > 1)
		{
			cc[ii] = memo[ii] * (memo[ii] - 1) / 2;
		}
		sum += cc[ii];
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		if(memo[aa[ii]] < 2)
		{
			cout << sum << endl;
		}
		else if(memo[aa[ii]] == 2)
		{
			cout << sum - 1 << endl;
		}
		else
		{
			tmp = (memo[aa[ii]] - 1) * (memo[aa[ii]] - 2) / 2;
			cout << sum - cc[aa[ii]] + tmp << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 7988
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    vector<char> S(s.size());
    for (int i=0;i<s.size();i++) {
        S.at(i) = s[i];
    }
    int cnt,cnta,cntz;
    int i = 0;
    while (true) {
        cnta = i;
        if (S.at(i) == 'A') break;
        i++;
    }
    reverse(S.begin(),S.end());
    int j = 0;
    while (true) {
        cntz = j;
        if (S.at(j) == 'Z') break;
        j++;
    }
    cnt = s.size() - cnta - cntz;
    cout << cnt << endl;
}

Measured memory_bytes: 772
a,b=map(int,input().split())
ans=1
for i in range(2,int(min(a,b)**0.5)+1):
  if a%i==0 and b%i==0:
    ans+=1
  while a%i==0:
    a//=i
  while b%i==0:
    b//=i
if a!=1 and b!=1 and (a%b==0 or b%a==0):
  ans+=1
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>

int main(void){
  int a,b,num;
  char OP;

  while(1){
    scanf("%d %c %d",&a,&OP,&b);
    if(OP=='?') break;
    if(OP=='+') num=a+b;
    if(OP=='-') num=a-b;
    if(OP=='*') num=a*b;
    if(OP=='/') num=a/b;
    printf("%d\n",num);
  }

  return 0;

}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,b=0;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]%2==0){
			if(a[i]%3!=0&&a[i]%5!=0)
				b++;
		} 
	}
	if(b!=0){
		cout<<"DENIED"<<endl;
		return 0;
	}
	cout<<"APPROVED"<<endl;	
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;

int main(){
	int n; cin>>n;
	vector<int> v;
	FOR(i,10) v.push_back(i);
	for(int i = 5; i > 0; i--) v.push_back(i);
	while(n--){
		int x,y; cin>>x>>y;
		int ans_l,a_cnt = 100;
		FOR(i,sz(v)){
			if(v[i] == x){
				int cnt = 1;
				for(int j = i+1; v[j] != y; j = (j+1) % sz(v))
					cnt++;
				if(a_cnt > cnt){
					a_cnt = cnt;
					ans_l = i;
				}
			}
		}

		for(int i = 0; i <= a_cnt; i++) printf("%d%c",v[(ans_l+i)%sz(v)],i==a_cnt?'\n':' ');
	}

	return 0;
}

Measured memory_bytes: 1192
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use ascii::*;

fn main() {
    input!(mut n: i64);
    if n == 1 {
        println!("0");
        return;
    }
    let mut factor_list: Vec<(i64, i64)> = Vec::new();
    for i in 2..=(f64::sqrt(n as f64) as i64 + 1) {
        let mut count = 0;
        while n % i == 0 {
            n /= i;
            count += 1;
        }
        if count > 0 {
            factor_list.push((i, count));
        }
    }
    if n > 1 { factor_list.push((n, 1)); }
    let mut count = 0;
    for item in factor_list.as_mut_slice() {
        let mut a = 1;
        while item.1 - a >= 0 {
            item.1 -= a;
            count += 1;
            a += 1;
        }
    }
    println!("{}", count);
}

Measured memory_bytes: 2148
#include<stdio.h>

int main(void)

{

 int a,b,c,x;

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


 if(a>b){


           x = a;


           a = b;


           b = x;


} 


 if(a>c){


          x = a;


          a = c;


          c = x;


}


 if(b>c){


         x = b;


         b = c;


         c = x;


}


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


 return 0;


}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    int n,k;
    string s;
    cin >> n >> k >> s;
    if (s[k-1] == 'A')
        s[k-1] = 'a';
    else if (s[k-1] == 'B')
        s[k-1] = 'b';
    else
        s[k-1] = 'c';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int n,a[maxn];
ll A,B;

int main() {
 // freopen("in.cpp","r",stdin);
  cin>>n>>A>>B;
  for(int i=1;i<=n;i++)cin>>a[i];
  ll ret=0;
  for(int i=2;i<=n;i++){
  ret+=min(A*(a[i]-a[i-1]), B);
  }
  cout<<ret<<endl;
  return 0;
}


Measured memory_bytes: 640
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){

    string s;
    cin>>s;
    
    int c=0;
    
    for(int i=0;i<s.size();i++){
        if(c==0){
            if(s[i]=='C') c++;
        }
        else if(c==1){
            if(s[i]=='F') c++;
        }
    }
    
    if(c==2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3096
#include<iostream>
#include<fstream>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define int long long
#define mod 1000000007
#define inf 4444444444444444444
#define mn 150005

int n, k;
int A[2005];

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n>>k;
	for (int i=1; i<=n; i++) cin>>A[i];
	int ans=0;
	for (int i=1; i<=n; i++)
	{
		int localInv=0, globalInv=0;
		for (int j=1; j<=n; j++) if (A[j]<A[i])
		{
			globalInv++;
			if (j>i) localInv++;
		}
		ans=(ans+localInv*k)%mod;
		int temp=(((k-1)*k)/2)%mod;
		ans=(ans+globalInv*temp)%mod;
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
int main()
{
    vector<ll> x(5);
    rep(i, 5) cin >> x.at(i);
    rep(i, 5){
      if(x.at(i) == 0){
        cout << i+1 << endl;
      }
    }
}

Measured memory_bytes: 3588
#include <stdio.h>
int main(void){
    int x,y,z,ans=0 ;
    scanf ("%d%d%d",&x,&y,&z) ;
    while (x>=y+2*z){
        x-=y+z ;
        ans++ ;
    }
    printf ("%d\n",ans) ;
    return 0 ;
}

Measured memory_bytes: 128
ans = []

while True:
    text = input()
    if text == "-":
        break
    characters = list(text)
    text = ""; m = 0

    m = int(input())
    for h in range(m):
        h = int(input())
        characters = characters[h:] + characters[:h]
    for i in range(len(characters)):
        text += characters[i]
    ans.append(text)

for i in range(len(ans)):
    print(ans[i])


Measured memory_bytes: 5600
#define DEBUG 0

/**
 * File    : B2.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-6-2 21:39:22
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

/*
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}

void No()
{
  cout << "No" << endl;
  exit(0);
}
*/

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

// const ll MOD = 1000000007;

string S;
vector<vector<int>> V;

ll count(vector<int> W)
{
  ll ans = 0;
  reverse(W.begin(), W.end());
  int t = 0;
  for (auto x : W)
  {
    if (x == 1)
    {
      t++;
    }
    else
    {
      ans += t;
    }
  }
  return ans;
}

int main()
{
  cin >> S;
  int N = S.size();
  S = S + "X";
  vector<int> W;
  for (auto i = 0; i < N; i++)
  {
    if (S[i] == 'A')
    {
      W.push_back(0);
    }
    else if (S[i] == 'B' && S[i + 1] == 'C')
    {
      W.push_back(1);
      i++;
    }
    else
    {
      if (!W.empty())
      {
        V.push_back(W);
      }
      W.clear();
    }
  }
  if (!W.empty())
  {
    V.push_back(W);
  }
  ll ans = 0;
  for (auto W : V)
  {
    ans += count(W);
  }
  cout << ans << endl;
}

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

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) {
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) {
	return mod_pow(a , mod-2);
}

void solve() {
	
	string s , t;
	
	cin >> s >> t;
	
	int f[26] {};
	int ff[26] {};
	
	int sm = 0;
	
	for(int i = 0; i < s.size(); ++i) {
		if(s[i] != t[i]) sm++;
	}
	
	cout << sm;
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


Measured memory_bytes: 3808
#include <iostream>
#include <cstdint>

using namespace std;

int main() {
  uint64_t a[3] = {1, 0, 0, };
  uint64_t b[3];
  uint64_t n;
  const uint64_t mod = 1'000'000'007;
  cin >> n;
  for (uint64_t i = 0; i < n; ++i) {
    b[0] = (a[0] * 8) % mod;
    b[1] = (a[0] + a[1] * 9) % mod;
    b[2] = (a[1] * 2 + a[2] * 10) % mod;
    a[0] = b[0];
    a[1] = b[1];
    a[2] = b[2];
  }

  cout << a[2] << endl;
}


Measured memory_bytes: 3084