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

int main(void) 
{
 
    int N;
    cin >> N;

    vector<long long> A(N+2);

    A[0] = 0;
    A[N+1] = 0;
    long long sum = 0;
    for (int i=1; i<=N; ++i)
    {
        cin >> A[i];
        sum += abs(A[i-1] - A[i]);
    }
    sum += abs(A[N] - A[N+1]);

    for (int i=1; i<=N; ++i) 
    {
        long long ans=0;
        ans = sum - abs(A[i-1] - A[i]) - abs(A[i] - A[i+1]) + abs(A[i-1] - A[i+1]);

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


Measured memory_bytes: 2048
#include <iostream>

using namespace std;

int n, br[2][2];
string s;

int main(){
cin >> s;
n = (int)s.size();
for(int i = 0 ; i <= 1 ; ++i){
	for(int j = i ; j < n ; j += 2){
		br[i][0] += (s[j] == '1');
		br[i][1] += (s[j] == '0');
	}
}
int sol = min(br[0][1] + br[1][0], br[0][0] + br[1][1]);
cout << sol << endl;

return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>

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

int main() {

	int n;
	cin >> n;

	vector<long long int>a(n + 1);
	vector<long long int>b(n + 1);

	rep(i, n + 1)
		cin >> a[i];

	rep(i, n)
		cin >> b[i];


	long long int ans = 0;
	long long int now = 0;
	for (int i = 0; i < n + 1; i++) {
		if (a[i] >= now) {
			a[i] -= now;
			ans += now;
		}
		else {
			ans += a[i];
			a[i] = 0;
		}

		if (a[i] <= b[i]) {
			ans += a[i];
			now = b[i] - a[i];
		}
		else {
			ans += b[i];
			now = 0;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

typedef  long long ll;
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;}

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

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int64_t n;
int main(){
    cin>>n;
    int64_t x,y;
    for(int64_t i=1;i<=sqrt(n);i++){
        if(!(n%i))y=i;
    }
    x=n/y;
    cout<<x+y-2<<endl;
    return 0;
}




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

string S;
int cnt=0;
int len;

int main() {
    cin >> S;
    len = S.size();
    for (int i=0; i<len; ++i) {
        if (S[i] == '1') ++cnt;
    }

    cout << min(cnt, len-cnt) * 2 << endl;

    return 0;
}

Measured memory_bytes: 512
def b162(n):

    ans = 0

    for i in range(1 , n + 1):
        if i % 3 != 0 and i % 5 != 0:
            ans += i

    return ans

def main():
    n = int(input())
    print(b162(n))

if __name__ == '__main__':
    main()

Measured memory_bytes: 9112
#include <bits/stdc++.h>
 
#define rep_(v, f, l) for (int v = (f); v < (l); ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)
 
using namespace std;
 
typedef long long int lint;
 
static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }
 
const int MAX_N = 10000000;
 
bool sieve[MAX_N + 1];
int main()
{
    sieve[0] = sieve[1] = true;
    for (int i = 2; i * i <= MAX_N; i++){
        if (sieve[i]) continue;
        for (int j = i * i; j <= MAX_N; j += i){
            sieve[j] = true;
        }
    }
    deque<int> quad_prime;
    for (int i = 13; i <= MAX_N; i += 2){
        if (!sieve[i] && !sieve[i - 2] && !sieve[i - 6] && !sieve[i - 8]){
            quad_prime.push_back(i);
        }
    }
 
    int n;
    while (n = in()){
        printf("%d\n", quad_prime[upper_bound(quad_prime.begin(), quad_prime.end(), n) - quad_prime.begin() - 1]);
    }
 
    return (0);
}

Measured memory_bytes: 10976
n = int(input())
A = list(map(int, input().split()))
c = 1000  # cash
s = 0  # stock
up = False
for i in range(n-1):
    if A[i] < A[i+1]:
        if not up:
            s, c = divmod(c, A[i])
            up = True
            #print(A[i], c, s)
    elif A[i] > A[i+1]:
        if up:
            c += s * A[i]
            s = 0
            up = False
            #print(A[i], c, s)
    else:
        pass
else:
    c += s * A[-1]
print(c)

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

using namespace std;

int main()
{
  int a, b, c, d; cin >> a >> b >> c >> d;
  if (abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d)) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main {

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

		int N = sc.nextInt();
		
		int[] a = new int[N];
		for(int i=0; i<N; i++){
			a[i] = sc.nextInt();
		}

		int cnt = 0;
		int cnt2 = 0;

		boolean hasGray = false;
		boolean hasBrown = false;
		boolean hasGreen = false;
		boolean hasWater = false;
		boolean hasBlue = false;
		boolean hasYellow = false;
		boolean hasOrange = false;
		boolean hasRed = false;

		for(int i=0; i<N; i++){
			if(a[i]<=399){
				if(!hasGray){
					cnt++;
					hasGray = true;
				}
			}else if(a[i]<=799){
				if(!hasBrown){
					cnt++;
					hasBrown = true;
				}
			}else if(a[i]<=1199){
				if(!hasGreen){
					cnt++;
					hasGreen = true;
				}
			}else if(a[i]<=1599){
				if(!hasWater){
					cnt++;
					hasWater = true;
				}
			}else if(a[i]<=1999){
				if(!hasBlue){
					cnt++;
					hasBlue = true;
				}
			}else if(a[i]<=2399){
				if(!hasYellow){
					cnt++;
					hasYellow = true;
				}
			}else if(a[i]<=2799){
				if(!hasOrange){
					cnt++;
					hasOrange = true;
				}
			}else if(a[i]<=3199){
				if(!hasRed){
					cnt++;
					hasRed = true;
				}
			}else{
					cnt2++;
			}
		}

		if(cnt==0){
			cnt = 1;
			cnt2 = cnt2 - 1;
		}

		System.out.println(cnt + " " + (cnt + cnt2));

	}

}


Measured memory_bytes: 21716
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }
  sort(h.rbegin(), h.rend());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (K <= h[i]) {
      ans++;
    } else {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int h, w; cin >> h >> w;
	int a[h], b[h];
	for(int i = 0; i < h; ++i) {
		cin >> a[i] >> b[i];
		--a[i], --b[i];
	}
	map<int, int> mp;
	multiset<int> st;
	for(int x = 0; x < w; ++x) {
		mp[x] = 0;
		st.insert(0);
	}
	for(int y = 0; y < h; ++y) {
		while(true) {
			auto itr = mp.lower_bound(a[y]);
			if(itr == mp.end()) break;
			auto [x, c] = *itr;
			if(x > b[y]) break;
			mp.erase(itr);
			st.erase(st.find(c));
			if(b[y] + 1 >= w) continue;
			if(not mp.count(b[y] + 1)) {
				mp[b[y] + 1] = c + (b[y] + 1) - x;
				st.insert(c + (b[y] + 1) - x);
			} else {
				if(c + (b[y] + 1) - x < mp[b[y] + 1]) {
					st.erase(st.find(mp[b[y] + 1]));
					mp[b[y] + 1] = c + (b[y] + 1) - x;
					st.insert(c + (b[y] + 1) - x);
				}
			}
		}
		if(st.empty()) {
			cout << -1 << '\n';
		} else {
			cout << *st.begin() + y + 1 << '\n';
		}
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n; cin >> n;

    vector<int> b(n-1);
    for (int i = 0; i < n-1; ++i) {
        cin >> b[i];
    }

    vector<int> ans(n);
    ans[0] = b[0];

    for (int i = 1; i < n-1; ++i) {
        ans[i] = min(b[i-1], b[i]);
    }

    ans[n-1] = b[n-2];

    int s = 0;
    for (int i = 0; i < n; ++i) {
        s += ans[i];
    }

    cout << s << endl;
}

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

left_weight = 0
min_difference = 10000
for i in range(N):
    sum_W = sum(W)
    left_weight += W[i]
    right_weight = sum_W - left_weight
    if abs(left_weight - right_weight) < min_difference:
        min_difference = abs(left_weight - right_weight)
    else:
        pass
print(min_difference)

Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <cstdio>
#include <iostream>

using namespace std;

void get() {

}

int sum[510][510];
typedef pair<int,int> pii;

class DAtCoderExpress2 {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, m, q, x, y;
		in >> n >> m >> q;
		memset(sum, 0, sizeof(sum));

		for (int i = 0; i < m; ++i) {
			in >> x >> y;
			sum[x][y] ++;
		}

		for (int i = 1; i <= n ; ++i) {
			for (int j = 1; j <= n ; ++j) {
				sum[i][j] += sum[i][j-1];
				sum[i][j] += sum[i-1][j];
				sum[i][j] -= sum[i-1][j-1];
			}
		}
		for (int i = 0; i < q; ++i) {
			in >> x >> y;
			out << sum[y][y] - sum[y][x-1] - sum[x-1][y] + sum[x-1][x-1] << '\n';
		}
	}
};


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	DAtCoderExpress2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 2040
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		System.out.println(z + " " + x + " " + y);
	}
	
}


Measured memory_bytes: 22356
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


int main(){

    int n; cin >> n;
    vector<int> c(n-1),s(n-1),f(n-1);
    rep(i,n-1) cin >> c.at(i) >> s.at(i) >> f.at(i);

    for(int point = 0; point <= n-2; point++){
        ll time = 0;
        for(int i = point; i <= n-2; i++){
            if(time <= s.at(i)) time = s.at(i);
            else{
                time = ((time -1)/f.at(i)+1)*f.at(i);
            }
            time += c.at(i);
        }
        cout << time << endl;
    }
    cout << 0 << endl;
    return 0;   

}


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

int main() {
  int N, li, ri, sum;
  sum = 0;
  cin >> N;
  for(int i = 0; i < N; i ++){
    cin >> li >> ri;
    sum += ri - li + 1;
  }
  cout << sum << endl;
}
  


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

void _149() {
    string s, t;
    cin >> s >> t;
    cout << t + s << endl;
}

void _148() {
    int a, b;
    cin >> a;
    cin >> b;

    int c = 0;
    if ((a != 1) && (b != 1))
        c = 1;
    else if ((a != 2) && (b != 2))
        c = 2;
    else if ((a != 3) && (b != 3))
        c = 3;
    cout << c << endl;
}

int main()
{
    _148();
    return 0;
}



Measured memory_bytes: 256
import itertools

while True:
    n, x = [int(e) for e in input(). split()]

    if n == 0 and x == 0:
        break
    
    a = 0

    for i, j, k in itertools.combinations(range(1, n + 1), 3):
        if i + j + k == x:
            a = a + 1
    
    print("%d" % (a))


Measured memory_bytes: 5640
package main

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

func main() {
	S := scan()
	date := strings.Split(S, " ")
	month,_ := strconv.Atoi(date[0])
	day,_ := strconv.Atoi(date[1])
	if month <= day {
		fmt.Println(month)
		return
	}
	fmt.Println(month-1)
}

func scan() string {
	reader := bufio.NewReaderSize(os.Stdin, 1000000)
	bytes := make([]byte, 0, 1000000)
	for {
		line, isPrefix, _ := reader.ReadLine()
		bytes = append(bytes, line...)
		if !isPrefix {
			break
		}
	}
	return string(bytes)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    int x,y,z;cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 256
s = int(input())
s_ = s
x = [s]
counter = 0
#while s != 1:

for _ in range(1000000):
  if s%2 ==0:
    s = s/2
    x.append(s)
  else:
      s = 3*s+1
      x.append(s)
#  counter +=1

if s_ == 4 or s_ == 2 or s_ == 1:
  print(4)
else:
  print(x.index(4)+4)
#print(x)  

Measured memory_bytes: 34708
import java.util.*;
import java.io.*;

 public class Main{
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  int[] x=int_arr();
	        		  int n=x[0],k=x[1];
	        		  long[][] prefix=new long[n+1][k+1];
	        		  long mod=(long)1e9+7;
	        		  int[] a=int_arr();
	 
	        		  /*
	        		  # prefix[i][j] holds sum of coeff of x^0,x^1,....,x^j  in product
	        		  of 1st i polynomials

	        		  # coeff of X^k in product of 1st i polynomials therefore depends on
	        		  whether highest degree of X (a[i] here) in last polynomial i.e. "ith" poly is
	        		  >= k or not.

	        		  Case1:- if a[i]>=k then all it's term till (x^0,x^1,....,x^k) will contribute
	        		  (see math) so coeff of x^k =prefix[i-1][k]

	        		  Case2:- a[i]<k then all it's term (x^0,x^1,....,x^a[i]) will contribute so 
	        		  in previous product only term contributing are (x^k,x^(k-1),....,x^(k-a[i]))
	        		   so coeff of x^k =prefix[i-1][k]-prefix[i-1][k-a[i]-1];
	        		  */
                      Arrays.fill(prefix[0],1);
	        		  for(int i=1;i<=n;i++){prefix[i][0]=1;}
	        		  for(int i=1;i<=n;i++){
	        		  	  for(int j=1;j<=k;j++){
	        		  	  	long r=(j-a[i-1]-1>=0)?prefix[i-1][j-a[i-1]-1]:0;
	        		  	  	long l=prefix[i-1][j]; 
	        		  	  	prefix[i][j]=(prefix[i][j-1]+(l-r+mod)%mod)%mod;
	        		  	  }
	        		  }
	        		  long r=(k-a[n-1]-1>=0)?prefix[n-1][k-a[n-1]-1]:0;
	        		  long l=prefix[n-1][k]; 
	        		  out.write((l-r+mod)%mod+"");
                      out.flush();
	        		 
	}
}
	       
	          



	
  





Measured memory_bytes: 127696
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N; cin >> N;
	int ans = INF;
	REP(i, N) {
		int a; cin >> a;
		int cnt = 0;
		while (a) {
			if (a % 2)break;
			else {
				cnt++;
				a /= 2;
			}
		}
		chmin(ans, cnt);
	}
	
	cout << ans << endl;

	return 0;
}



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

int K, X;
int main() {
  cin >> K >> X;
  cout << (K * 500 >= X ? "Yes" : "No") << endl;
  return 0;
}


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

int main(){
  int n,m,p,d[100001];
  cin>>n>>m>>p;
  d[m]=p;
  for(int i=0;i<m;i++)cin>>d[i];
  sort(d,d+m+1);
  int st=0;
  for(int i=0;i<=m;i++) if(d[i]==p) st=i;

  m++;
  int ans=(n+d[(m+st-1)%m]-p)%n;
  ans=min(ans,(n+p-d[(st+1)%m])%n);
  for(int i=1;i<m;i++){
    int j=(st+i)%m;
    int dis1=(n+d[j]-p)%n;
    int dis2=n-(n+d[(j+1)%m]-p)%n;
    ans=min(ans,dis1*2+dis2);
  }

  for(int i=1;i<m;i++){
    int j=(m+st-i)%m;
    int dis1=(n-(n+d[j]-p)%n)%n;
    int dis2=(n+d[(m+j-1)%m]-p)%n;
    ans=min(ans,dis1*2+dis2);
 }
  cout <<ans*100<<endl;

  return 0;
}

Measured memory_bytes: 1220
N,M,R = list(map(int,input().split()))

r = list(map(int,input().split()))
e_list = [[] for i in range(N)]
for i in range(M):
    a,b,c = list(map(int,input().split()))
    a=a-1
    b=b-1
    e_list[a].append([b,c])
    e_list[b].append([a,c])

#dijkstra
#you need to prepare e_list = [[orient,dist]]

import heapq
r_dis_list = []
for i in range(len(r)):
    vi = r[i]-1
    min_d_list = [10**27 for i in range(N)]
    min_d_list[vi] = 0
    prev_list = [-1 for i in range(N)]
    q = []
    for i in range(N):
        heapq.heappush(q,[min_d_list[i],i])

    while len(q)>0:
        d,v = heapq.heappop(q)
        for e in e_list[v]:
            v1,d1=e
            if min_d_list[v1]>d+d1:
                min_d_list[v1]=d+d1
                prev_list[v1]=v
                heapq.heappush(q,[d+d1,v1])

    r_dis_list.append([min_d_list[r[i]-1] for i in range(len(r))])

import itertools
min_ans = 10**27
for i in itertools.permutations(range(len(r))):
    ans = 0
    for j in range(len(r)-1):
        ans+=r_dis_list[i[j+1]][i[j]]
    min_ans=min(ans,min_ans)

print(min_ans)

Measured memory_bytes: 10084
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
#define INF 1e9
using ll = int64_t;
#define waru 1000000007

std::int64_t gcd(std::int64_t a, std::int64_t b) {
  // a >= b && b != 0
  std::int64_t c;
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb) {
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0) {
    return -1;
  }
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
void rle(std::vector<std::pair<char, std::int64_t>> &data, std::string str) {
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++) {
    if (i == str.size()) {
      data.push_back(make_pair(str[i - 1], count));
      break;
    } else if (now != str[i]) {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return;
}

void Main() {
  //自動整形防止用コメント
  int a, b;
  std::cin >> a >> b;
  std::cout << max({a + b, a - b, a * b}) << '\n';

  return;
}

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: 256
#include<iostream>
using namespace std;

bool IsPrime(int m){
    if(m==1){
        return(0);
    }else if(m==2){
        return(1);
    }else if(m%2==0){
        return(0);
    }else{
        for(int i=3;i*i<=m;i+=2){
            if(m%i==0)return(0);
        }
        return(1);
    }
}

int main(){
    int n;
    int r[30];
    bool p[1000000];
    for(int i=1;i<=999999;i++){
        p[i]=IsPrime(i);
    }
    for(int i=0;i<30;i++){
        r[i]=0;
    }
    int j=0;
    while(cin>>n){
        for(int i=1;i<=n;i++){
            r[j]+=p[i];
        }
        cout<<r[j]<<endl;
        j++;
    }
    return(0);
}

Measured memory_bytes: 3980
#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;

const int MAXN = 200200;
const int MAXE = 400400;
const int INF = 0x3f3f3f3f;

template<typename T> inline void CheckMax(T &A, T B) {
	A < B ? A = B : A;
}

template<typename T> inline void CheckMin(T &A, T B) {
	A > B ? A = B : A;
}

template <typename T> inline void read(T &x) {
    int c = getchar();
    bool f = false;
    for (x = 0; !isdigit(c); c = getchar()) {
        if (c == '-') {
            f = true;
        }
    }
    for (; isdigit(c); c = getchar()) {
        x = x * 10 + c - '0';
    }
    if (f) {
        x = -x;
    }
}

int n, a, b;

signed main() {
	read(n);
	if(n == 1) {
		puts("Hello World");
	}
	else {
		read(a), read(b);
		printf("%d\n", a + b);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
using ll = long long;
int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> ab(n);
    rep(i,m){
        int x, y;
        cin >> x >> y;
        ab.at(x-1).push_back(y-1);
        ab.at(y-1).push_back(x-1);
    }
    queue<int> q;
    vector<int> d(n, -1);
    d.at(0)=0;
    q.push(0);
    while(!q.empty()){
        int x =q.front();
        q.pop();
        for(int i : ab.at(x)){
            if(d.at(i) !=-1){
                continue;
            }
            d.at(i) = x+1;
            q.push(i);
        }
    }
    cout << "Yes" <<endl;
    rep(i,n-1){
        cout << d.at(i+1)<< endl;
    }
}

Measured memory_bytes: 10276
#include <iostream>
#include <cstdio>
using namespace std;
int a,b;
int ans = 0;
bool s(int x){
	if(x % 10 == x / 10000 && x % 100 / 10 == x / 1000 % 10) return true;
	else return false;
}
int main()
{
	scanf("%d%d",&a,&b);
	for(int i = a;i <= b;i ++){
		if(s(i)) ans ++;
	} 
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
A,B = map(int,input().split())
a = 0
ans = 0
for i in range(A, B + 1):
    i = str(i)
    l = len(i)
    for j in range(l):
        if i[0 + j] == i[l - j - 1]:
            a += 1
    if a == l:
        ans += 1
    a = 0
print(ans)

Measured memory_bytes: 9184
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()


#100円
a = int(arr_data[0][0])

#50円
b = int(arr_data[1][0])

#10円
c = int(arr_data[2][0])

#合計
x = int(arr_data[3][0])


mycnt=0


for i in range(0,a+1):
    
    for j in range(0,b+1):
        
        for k in range(0,c+1):
#            
#            
            if (500*i + 100*j + 50*k)==x:
            
#                print(i,j,k)
               
                mycnt+=1
                
print(mycnt)                

Measured memory_bytes: 3064
#include <stdio.h>

long ruka(int n, long a, long b)
{
  if ( n <= 1 ) { return a; }
  return ruka(n-1, a+b, a);
}

int main(void)
{
  int n;
  long r;
  scanf("%d", &n);
  if ( n == 0 ) {
    r = 2;
  } else if ( n == 1 ) {
    r = 1;
  } else {
    r = ruka(n, 1, 2);
  }
  printf("%ld\n", r);
  return 0;
}

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

using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  for (int x = 0; x < W + 2; x++) cout << "#";
  cout << endl;
  for (int y = 0; y < H; y++) {
    string A;
    cin >> A;
    cout << "#" << A << "#\n";
  }
  for (int x = 0; x < W + 2; x++) cout << "#";
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
def gcd(x,y):
    if y==0:
        return x
    return gcd(y,x%y)

def lcm(a,b):
    return a*b//gcd(a,b)

A,B,C,D = map(int,input().split())
E = lcm(max(D,C),min(D,C))
num = B-A+1
tmp1 = (B//C)+(B//D)-((B//E))
tmp2 = ((A-1)//C)+((A-1)//D)-(((A-1)//E))
print(num-tmp1+tmp2)

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

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main() {
	int n; scanf("%d", &n);
	ll t[n + 1];
	ll h[n];
	forn(i, n + 1)
		scanf("%lld", &t[i]);
	forn(i, n)
		scanf("%lld", &h[i]);
	ll total = 0;
	ford(i, n) {
		if(t[i + 1] >= h[i]) {
			total += h[i];
		} else {
			total += t[i + 1];
			h[i] -= t[i + 1];
			total += min(h[i], t[i]);
			t[i] -= min(h[i], t[i]);
		}
	}
	printf("%lld", total);
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=8000005;
ll n,k,fac[N],inv[N],f[2005][2005],mod=1e9+7;
ll power(ll a,ll b){
	ll res=1,tmp=a;
	while(b){
		if(b&1)res=res*tmp%mod;
		tmp=tmp*tmp%mod;
		b>>=1;
	}
	return res;
}
ll C(ll n,ll m){
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
} 
int main(){
	scanf("%lld%lld",&n,&k);
	if(k==1){
		puts("1");
		return 0;
	}
	fac[0]=inv[0]=1;
	for(int i=1;i<=n*k;i++){
		fac[i]=fac[i-1]*i%mod;
		inv[i]=power(fac[i],mod-2);
	}
	for(int i=0;i<=n;i++)f[i][0]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=i;j++)
			f[i][j]=f[i-1][j]%mod+f[i][j-1]%mod*(n-j+1)%mod*C(n*k-i-1-(j-1)*(k-1),k-2)%mod;
	printf("%lld",f[n][n]%mod);
	return 0;
}

Measured memory_bytes: 88860
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

ll a[1000010];

void solve(){

    long double r;
    long double PI=3.14159265358979323846;
    cin >> r;
    cout << 2*r*PI << endl;

}

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


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

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

  int count[4][3][10] = {0};

  for (int i = 0; i < N; i++) {
    int b, f, r, v;
    cin >> b >> f >> r >> v;
    b--, f--, r--;
    count[b][f][r] += v;
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 10; k++) {
        cout << ' ' << count[i][j][k];
      }
      cout << endl;
    }
    if(i != 3) cout << "####################" << endl;
  }
}


Measured memory_bytes: 3088
import sys, math, itertools, collections, bisect 
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n=int(input())
A=[(e,i) for i,e in enumerate(list(map(int,input().split())))]
#print(A)
A.sort(key=lambda tup: tup[0])
#print(A)
for e,i in A:
    print(i+1)

Measured memory_bytes: 93480
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;
#define pi 3.14159265358979

int main()
{
	ll H, ans = 1;	//入力が10^22までの制限なので、int じゃ足りないから型は long long

	// 入力を受け取る
	cin >> H;

	// Hが何回2で割ると1以下になるか計算する。
	// Hが1以下になるまで割った数分2引きに分裂し、攻撃回数が増える。
	ll count = 0;
	while (H > 1)
	{
		count++;
		ans += pow(2,count);	// 攻撃回数(2の割った数乗)

		H /= 2;
	}

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

Measured memory_bytes: 4096
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		long K = sc.nextLong();
		long ans = 0;
		long add = 1;
		PrintWriter pw = new PrintWriter(System.out);
		// n/s(n)<=m/s(m)
		// ns(m)<=ms(n)
		int cnt = 0;
		while (cnt++ < K) {
			if ((ans + add) * S(ans + add * 10) > (ans + add * 10) * S(ans + add))
				add = add * 10;
			ans += add;
			pw.println(ans);
		}
		pw.close();
	}

	long S(long a) {
		long ret = 0;
		while (a > 0) {
			ret += a % 10;
			a /= 10;
		}
		return ret;
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 19156
from sys import stdin


def main():
    N, M = map(int, input().split())
    *X, = map(int, stdin.readline().split())
    X.sort()
    D = [X[i + 1] - X[i] for i in range(M - 1)]
    D.sort()
    print(0 if M <= N else sum(D[: M - N]))
    return


main()


Measured memory_bytes: 13316
import argparse
import collections
import logging.config
import sys
import csv
import numpy as np

def tstr(n):
  total = n
  cnt = 1
  while total%360 != 0:
#    print (str(cnt) + "," + str(total))
    cnt += 1
    total += n 
  return (cnt)


def main():
  N = int(input())
  print (tstr(N))

if __name__ == '__main__':
    main()


Measured memory_bytes: 28864
//make sure to make new file!
import java.io.*;
import java.util.*;

public class Main{
   
   public static void main(String[] args)throws IOException{
      BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
      PrintWriter out = new PrintWriter(System.out);
      
      double n = Double.parseDouble(f.readLine());
      
      out.println(n*2.0*3.1415926535);
      
      
      
      
      
      
      
      
      out.close();
   }
   
      
}

Measured memory_bytes: 33396
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto Q = s[1];
    auto st = new LazySegmentTree!(long, long, (a,b)=>a+b, (a,b)=>a+b, (a,b)=>a+b, (a,b)=>a*b, 0L, 0L)(N+1);

    while (Q--) {
        s = readln.split.map!(to!int);
        int q = s[0];
        int l = s[1];
        int r = s[2];
        if (q == 0) {
            long v = s[3];
            st.update(l, r, v);
        } else {
            st.query(l, r).writeln;
        }
    }
}


class LazySegmentTree(T, L, alias opTT, alias opTL, alias opLL, alias opPrd, L eL, T eT) {
    T[] table;
    L[] lazy_;
    int n;
    int size;

    this(int n) {
        this.n = n;
        size = 1;
        while (size <= n) size <<= 1;
        size <<= 1;
        table = new T[](size);
        lazy_ = new T[](size);
        table[] = eT;
        lazy_[] = eL;
    }

    void push(int i, int a, int b) {
        if (lazy_[i] == eL) return;
        table[i] = opTL(table[i], opPrd(lazy_[i], b - a + 1));
        if (i * 2 + 1 < size) {
            lazy_[i*2] = opLL(lazy_[i*2], lazy_[i]);
            lazy_[i*2+1] = opLL(lazy_[i*2+1], lazy_[i]);
        }
        lazy_[i] = eL;
    }

    T query(int l, int r) {
        if (l > r) return eT;
        return query(l, r, 1, 0, n-1);
    }

    T query(int l, int r, int i, int a, int b) {
        if (b < l || r < a) return eT;
        push(i, a, b);
        if (l <= a && b <= r) {
            return table[i];
        } else {
            return opTT(query(l, r, i*2, a, (a+b)/2), query(l, r, i*2+1, (a+b)/2+1, b));
        }
    }

    void update(int l, int r, L val) {
        if (l > r) return;
        update(l, r, 1, 0, n-1, val);
    }

    void update(int l, int r, int i, int a, int b, L val) {
        if (b < l || r < a) {
            push(i, a, b);
        } else if (l <= a && b <= r) {
            lazy_[i] = opLL(lazy_[i], val);
            push(i, a, b);
        } else {
            push(i, a, b);
            update(l, r, i*2, a, (a+b)/2, val);
            update(l, r, i*2+1, (a+b)/2+1, b, val);
            table[i] = opTT(table[i*2], table[i*2+1]);
        }
    }
}



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

int Button(int A, int B){
    int cnt;
    for(int i=0;i<2;i++){
    if(A<B){
        cnt+=B;
        B-=1;
    }
    else{
        cnt+=A;
        A-=1;
    }
    }
    return cnt;
}

int main(){
    int A, B; cin >> A >> B;
    cout << Button(A,B) << endl;
    return 0;
}

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

using namespace std;

#define MAX 100000

struct TRAMP{
    char mark;
    int number,inputed_order;
};

TRAMP cards[MAX];

int n;

int Partition(int left,int right){
    int i = left-1,pivot = cards[right].number;
    for(int start = left; start < right; start++){
      if(cards[start].number <= pivot){
        i++;
        std::swap(cards[i],cards[start]);
      }
    }

    std::swap(cards[i+1],cards[right]);

    return i+1;
}

void quickSort(int left,int right){
    if(left < right){
      int q = Partition(left,right);
      quickSort(left,q-1);
      quickSort(q+1,right);
    }
}

int main(){
    bool stableFLG = true;
    scanf("%d",&n);

    for(int i = 0; i < n; i++){
      scanf("%s %d",&cards[i].mark,&cards[i].number);
      cards[i].inputed_order = i;
    }

    quickSort(0,n-1);

    for(int i = 1; i < n; i++){
      if(cards[i].number == cards[i-1].number && cards[i].inputed_order < cards[i-1].inputed_order){
        stableFLG = false;
        break;
      }
    }

    if(stableFLG){
       printf("Stable\n");
    }else{
      printf("Not stable\n");
    }

    for(int i = 0; i < n; i++) printf("%c %d\n",cards[i].mark,cards[i].number);
}


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

int main(){
    string s;
    cin >> s;
    int sum = 0;
     rep(i,s.size()){
        sum += s[i]-'0';
    }
    if(sum % 9 == 0)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3712
n=int(input())
a=list(map(int,input().split()))
temp=sum(a)
ans=0
t=9999999999999999
tsum=0
ta=0
for i in range(n):
  tsum=tsum+a[i]
  if abs(tsum-temp/2)<t:
    t=abs(tsum-temp/2)
    ta=tsum
print(abs(int(ta)*2-temp))

Measured memory_bytes: 26396
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int K, N; cin >> K >> N;
  vector<int> A(N, 0);
  int ans = 0;
  REP(i, N){
    cin >> A[i];
    if(i){
      ans = max(ans, A[i]-A[i-1]);
    }
  }
  ans = max(ans, K-A[N-1]+A[0]);
  cout << K - ans << endl;
}

Measured memory_bytes: 1024
n = int(input())
s = list()
counter = 0

for i in range(n):
    s.append(input())
    
m = int(input())
t = list()

for i in range(m):
    t.append(input())
    
for word in s:
    counter = max(counter,s.count(word) - t.count(word))
    
print(counter)

Measured memory_bytes: 3060
import math


def run():
    t_hp, t_att, a_hp, a_att = map(int, input().split())

    t_required_attack_num = math.ceil(a_hp / t_att)
    a_required_attack_num = math.ceil(t_hp / a_att)

    if t_required_attack_num <= a_required_attack_num:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    run()


Measured memory_bytes: 9168
N = int(input())
A = [int(x) for x in input().split()]
def isPossible(n):
    cnt = 1
    for a in A:
        cnt += (cnt == a)
    return n < cnt

if (1 not in A):
    print(-1)
else:
    lb = 0
    ub = 200100
    for i in range(25):
        if (ub-lb == 1): break
        mid = (lb + ub) // 2
        if isPossible(mid):
            lb = mid
        else:
            ub = mid
    print(N-lb)


Measured memory_bytes: 76364
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int H, W;
    cin >> H >> W;
    char m[H][W];
    for (int i = 0; i < H; i++)
    {
        cin >> m[i];
    }

    for (int y = 0; y < H; y++)
    {
        for (int x = 0; x < W; x++)
        {
            if (m[y][x] != '#')
            {
                int r = 0;
                if (y > 0 && x > 0 && m[y - 1][x - 1] == '#')
                    r++;
                if (y > 0 && m[y - 1][x] == '#')
                    r++;
                if (y > 0 && x < W - 1 && m[y - 1][x + 1] == '#')
                    r++;
                if (x > 0 && m[y][x - 1] == '#')
                    r++;
                if (x < W - 1 && m[y][x + 1] == '#')
                    r++;
                if (y < H - 1 && x > 0 && m[y + 1][x - 1] == '#')
                    r++;
                if (y < H - 1 && m[y + 1][x] == '#')
                    r++;
                if (y < H - 1 && x < W - 1 && m[y + 1][x + 1] == '#')
                    r++;
                cout << to_string(r);
            }
            else
            {
                cout << m[y][x];
            }
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
S=input()
if S[0]==S[1] and S[2]==S[3] and S[0]!=S[2]:
    print('Yes')
elif S[0]==S[2] and S[1]==S[3] and S[0]!=S[1]:
    print('Yes')
elif S[0]==S[3] and S[1]==S[2] and S[0]!=S[1]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> a >> b >> c;
  ans = (a + b - 1) / b;
  ans *= c;
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3580
#include<iostream>
#include<algorithm>

using namespace std;

int main()
{
  int i,j,N;
  cin>>N;
  
  long long a[N]={};
  for(i=0;i<N;i++)
  {
    cin>>a[i];
  }
  sort(a,a+N);    
  for(i=0;i<N;i++)
  {
    if(a[i]==a[i+1])
    {
      cout<<"NO";
      goto end;
    }
  }  

  cout<<"YES";
  end:; 
  return 0;
}
  
  

Measured memory_bytes: 1792
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
dic = {}
for i in range(1, n+1):
  dic[i] = [p[i-1], c[i-1]]
INF = 10**20
ans = -INF
for j in range(1, n+1):
  state = [True] * 5001
  max_score = -INF
  max_idx = 0
  score = 0
  now = dic[j][0]
  cnt = 0
  lst = []
  flg = True
  for _ in range(k):
    if not state[now]:
      flg = False
      break
    score += dic[now][1]
    cnt += 1
    if max_score < score:
      max_score = score
      max_idx = cnt
    lst.append(score)
    state[now] = False
    now = dic[now][0]
  if score <= 0 or flg:
    ans = max(max_score, ans)
  else:
    q = k // cnt
    r = k % cnt
    if r >= max_idx:
      x = score * q + max_score
      ans = max(ans, x)
    else:
      if q >= 1:
        if r == 0:
          x = score * (q - 1) + max_score
          ans = max(ans, x)
        else:
          x = score * (q - 1) + max_score
          y = score * q + max(lst[:r])
          ans = max(ans, x, y)
      else:
        ans = max(ans, max_score)
print(ans)
    


Measured memory_bytes: 105116
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <tuple>

template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

constexpr int INF = 1 << 30;

const std::vector<int>
    dx{1, 0}, dy{0, 1};

void solve() {
    int n, m;
    std::cin >> n >> m;

    std::vector<std::string> ss(n);
    for (auto& s : ss) std::cin >> s;

    auto dist = vec(n, vec(m, INF));
    dist[0][0] = 0;
    if (ss[0][0] == '#') ++dist[0][0];

    MinHeap<std::tuple<int, int, int>> heap;
    heap.emplace(dist[0][0], 0, 0);

    while (!heap.empty()) {
        int d, x, y;
        std::tie(d, x, y) = heap.top();
        heap.pop();
        if (d > dist[x][y]) continue;

        for (int i = 0; i < 2; ++i) {
            int nx = x + dx[i],
                ny = y + dy[i];
            if (nx < 0 || n <= nx ||
                ny < 0 || m <= ny) continue;

            int nd = d + (ss[x][y] != ss[nx][ny]);
            if (dist[nx][ny] <= nd) continue;

            dist[nx][ny] = nd;
            heap.emplace(nd, nx, ny);
        }
    }

    int d = dist.back().back();
    std::cout << (d + 1) / 2 << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 384
S = input().strip()	 # novel
T = input().strip()  # substring

x = len(T)
ans = len(S)
for i in range(len(S) - x + 1):
  U = S[i:i+x]
  cost = sum(1 if U[k] != T[k] else 0 for k in range(x))
  ans = min(ans, cost)
print(ans)


Measured memory_bytes: 9112
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	double r;
	cin >> r;
	printf("%.8lf %.8lf\n",r*r*4*atan(1),2*r*4*atan(1));
	return 0;
}

Measured memory_bytes: 3172
#include <iostream>

using namespace std;

int main()
{
   int r ,d ,x,a;
   cin >>r>>d>>x;
if (r>=2 && r<=5 && d>=1 && d<=100 && x>d && x<=200){
   for (int counter=0;counter<10;counter++ ){
      x=(r*x)-d;
      cout<<x;
      cout<<endl;
      a=x;

   }
}

}

Measured memory_bytes: 256
const funcA = (input: string): void => {
    const message = (): string => {
        switch (Number(input)) {
            case 22: return 'Christmas Eve Eve Eve'
            case 23: return 'Christmas Eve Eve'
            case 24: return 'Christmas Eve'
            case 25: return 'Christmas'
        }
    }
    console.log(message());
}
funcA(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
x,n=[int(x) for x in input().split()]
p=[int(x) for x in input().split()]

def func1():
    #最初Xそのものがあるか
    if p.count(x)==0:
        print(x)
        return

    for i in range(100):
        if p.count(x-i)==0:
            print(x-i)
            return
        if p.count(x+i)==0:
            print(x+i)
            return
func1()

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 
// abc125c
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int main() {
// observation lcd(a,b...,z) = a*b..*z/gcd(a,b,..z)
// gcd = prod / lcd

  int n; cin >> n;
  vi a(n); 
  rep(i,n) cin >> a[i];
  vector<ll> lGCD(n), rGCD(n); 
  lGCD[0]=a[0];
  rGCD[n-1]=a.back();
  for (int i=1; i<n;i++) {
    lGCD[i] = gcd(lGCD[i-1], a[i-1]);
  }
  for (int i=n-2; i>=0; i--) {
    rGCD[i] = gcd(rGCD[i+1], a[i+1]);
  }
  lGCD[0] = rGCD[0];
  rGCD[n-1] = lGCD[n-1];
  ll ans = 0;
  rep(i,n) {
    ll now = gcd(lGCD[i], rGCD[i]);
    chmax(ans, now);
  } 
  cout << ans << endl;
  return 0;
}

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

using ll = std::int64_t;

int main() {
  int N;
  std::cin >> N;
  std::map<std::pair<int, int>, ll> cnt;
  auto get_head = [](int i) {
    while (i / 10) i /= 10;
    return i;
  };
  for (int i = 1; i <= N; i++) {
    int head = get_head(i);
    int tail = i % 10;
    cnt[std::make_pair(head, tail)]++;
  }
  ll ans = 0;
  for (auto &&e : cnt) {
    int h, t;
    std::tie(h, t) = e.first;
    ll p1 = e.second;
    ll p2 = cnt[std::make_pair(t, h)];
    ans += p1 * p2;
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long long dist(long long x1,
               long long y1,
               long long x2,
               long long y2) {
    
    return abs(x1 - x2) + abs(y1 - y2);
}

int main()
{
    int n, m; cin >> n >> m;
    
    vector<long long> a(n), b(n), c(m), d(m);
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> c[i] >> d[i];
    }

    vector<int> ans(n, 0);

    for (int i = 0; i < n; i++) {
        long long minDist = 9223372036854775807LL; 
        for (int j = 0; j < m; j++) {
            long long tmpDist = dist(a[i], b[i], c[j], d[j]);
            if (chmin(minDist,tmpDist)) {
                ans[i] = j;
            }
        }
    }

    for (int i = 0; i < n; i++) cout << ans[i] + 1 << endl;
 
    return 0;
}

Measured memory_bytes: 256