akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define CERR if(false) cerr
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;

typedef long long ll;

int c2i(char c){
    return c - '0';
}

int main(){

    int n,p;
    cin >> n >> p;

    string s;
    cin >> s;

    if(p == 2){

        ll ans = 0;

        rep(i, n){
            if((s[i] - '0') % 2 == 0) ans += (i + 1);
        }

        cout << ans << endl;

    }else if(p == 5){

        ll ans = 0;

        rep(i, n){
            if((s[i] - '0') % 5 == 0) ans += (i + 1);
        }

        cout << ans << endl;

    }else{

    vector<int> pow10modp(n + 1, 1);
    pow10modp[0] = 0;

    for(int i = 2; i < n + 1; i++){
        pow10modp[i] = pow10modp[i - 1] * 10 % p;
    }

    if(p == 2 || p == 5){
        for(int i = 2; i < n + 1; i++){
            pow10modp[i] = 1;
        }
    }

    /*
    for(int i = n; i >= 1; i--){
        CERR << pow10modp[i] << " ";
    }
    CERR << endl;
    */

    vector<int> simple_each_digit_mod(n + 1, 0);

    for(int i = 1; i <= n; i++){
        int tmp = c2i(s[n - i]);
        simple_each_digit_mod[i] = tmp % p;
    }

    /*
    for(int i = n; i >= 1; i--){
        CERR << simple_each_digit_mod[i] << " ";
    }
    CERR << endl;
    */

    vector<int> each_digit_mod(n + 1, 0);

    for(int i = 1; i <= n; i++){
        each_digit_mod[i] = (each_digit_mod[i - 1] + simple_each_digit_mod[i] * pow10modp[i]) % p;
    }

    /*
    for(int i = n; i >= 1; i--){
        CERR << each_digit_mod[i] << " ";
    }
    CERR << endl;
    */


    vector<ll> count(p, 0);

    for(int i = 0; i < n + 1; i++){
        count[each_digit_mod[i]]++;
    }

    ll ans = 0;

    for(int i = 0; i < p; i++){
        ans += count[i] * (count[i] - 1) / 2;
    }

    cout << ans << endl;

    }



    return 0;
}


Measured memory_bytes: 2948
#include<bits/stdc++.h>
using namespace std;
#define BOOST ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(0)
#define fo(i,a,n) for(int i=a;i<n;i++)
#define fc(i,a,n,c) for(int i=a;i<n;i+=c)
#define fi(i,n,a) for(int i=n-1;i>=a;i--)
#define in cin>>
#define out cout<<
#define ll long long
#define el <<"\n"
#define es <<" "

int main(){
  int a,b,c;
  in a>>b>>c;
  if(a==b && a!=c)  out "Yes";
  else if(a==c && a!=b)  out "Yes";
  else if(b==c && b!=a)  out "Yes";
  else out "No";
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner cin = new Scanner(System.in);
        int N = cin.nextInt();
        
        boolean ans = false;
        for(int i = 1; i <= 9; i++)
            for(int j = 1; j <= 9; j++)
                if(i * j == N) ans = true;
            
        System.out.println(ans ? "Yes" : "No");

        cin.close();
    }
}

Measured memory_bytes: 23764
N,A,B = map(int,input().split())
H = []
for _ in range(N):
    H.append(int(input()))
H = sorted(H)
def check(x):
    cnt = 0
    for h in H:
        if h > x * B:
            tmp = (h - x*B) // (A-B)
            #切り上げ
            if tmp * (A-B) != h - x*B: tmp += 1
            cnt += tmp
    if cnt <= x:
        return True
    else:
        return False
# (l,r]
def bisect(l,r):
    if r - l == 1: return r
    mid = (l+r) // 2
    if check(mid):
        return bisect(l,mid)
    else:
        return bisect(mid,r)
    
print(bisect(0,10**28))


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

using namespace std;
typedef long long ll;

int w, h;
vector<vector<int> > c;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};


void dfs(int x, int y, int px=-1, int py=-1) {
    c[x][y] = 0;
    for (int i = 0; i < 8; i++) {
        int nx = x + dx[i];
        int ny = y + dy[i];
        if (nx == px && ny == py) continue;
        if (nx < 0 || nx >= h) continue;
        if (ny < 0 || ny >= w) continue;
        if (c[nx][ny] == 0) continue;
        dfs(nx, ny, x, y);
    }
}

int main() {
    while (true) {
        cin >> w >> h;
        if (w == 0 && h == 0) break;
        c.resize(h);
        for (int i = 0; i < h; i++) {
            c[i].resize(w);
            for (int j = 0; j < w; j++) {
                cin >> c[i][j];
            }
        }

        int ans = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (c[i][j] == 0) continue;
                dfs(i, j);
                ans++;
            }
        }
        cout << ans << endl;
    }
}



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

using namespace std;

int a, b;

int main(){

    cin>>a>>b;

    int t=0;

    for(int i=0;i<2;i++){
        if(a>=b){
            t+=a;
            a--;
        }
        else{
            t+=b;
            b--;
        }
    }

    cout<<t;

    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<math.h>

int main(){
  long N, sum = 0;
  scanf("%ld", &N);

  double max = sqrt(N);

  long i;

  for(i = 1; i < max; i++){
    if(N % i == 0) sum += N / i - 1;
  }

  if(i * (i - 1) == N) sum -= i - 1;

  printf("%ld\n", sum);

  return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int M = sc.nextInt();

    sc.close();

    long mod = 1000000007;

    long result = 0;

    if (Math.abs(N - M) < 2) {
      if (N == M) {
        result += count(N) * count(M) * 2;
      } else {
        result += count(N) * count(M);
      } 
    }

    System.out.println(result % mod);

  }

  public static long count(int n) {
    
    long v = 1;

    for (int i = 0; i < n; i++) {
      v *= i + 1;
      v %= 1000000007;
    }
    
    return v;

  }

}


Measured memory_bytes: 23380
import math

N = int(input())


def F(a, b):
    a = int(math.log10(a)) + 1
    b = int(math.log10(b)) + 1
    return max(a, b)


ans = float('inf')
for i in range(1, int(math.sqrt(N)) + 1):
    if N % i != 0:
        continue
    a, b = i, N // i
    ans = min(ans, F(a, b))
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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 ALL(v) v.begin(), v.end()
typedef long long ll;

int main(){
    int m,n,ans=0;
    cin >> n >> m;
    ll a[n];
    double sum;

    for(int i=0;i<n;i++){
        cin >> a[i];
        sum = sum + a[i];
    }
    
    for(int i=0;i<n;i++){
        if(a[i] >= sum/(4*m))ans++;
    }

    if(ans >= m)cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;

}


Measured memory_bytes: 3636
a, b, c, x = [int(input()) for _ in range(4)]
ans = 0
for i in range(a + 1):
  for j in range(b + 1):
    for k in range(c + 1):
      if i * 500 + j * 100 + k * 50 == x:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <cstring>
#include <cstdio>
#include<algorithm>
#include <queue>
#include <cmath>
#include <limits>
#include <map>
using namespace std;

int main(){
  int n;
  cin >> n;
  long long int monst[n+1];
  long long int defeat[n];
  long long int def = 0;
  for(int i = 0;i<=n;i++){
    cin >> monst[i];
  }
  for(int i = 0;i<n;i++){
    cin >> defeat[i];
  }
  
  for(int i = 0;i<n;i++){
    if(monst[i]<defeat[i]){
      int pow =  defeat[i] - monst[i];
      def += monst[i];
      if(monst[i+1]<pow){
         def += monst[i+1];
      monst[i+1] = 0;
      }else{
        monst[i+1] -= pow;
        def += pow;
      }
    }else{
      monst[i] = monst[i] - defeat[i];
      def += defeat[i];
    }
    
  }
  cout << def << endl;
return 0;
}

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

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

#define INF (1e9)

int X, A;

int main() {
    cin >> X >> A;

    int ans = X < A ? 0 : 10;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
  {
  string str;
  cin>>str;
  int n=str.length();
  if(n<=100 && n>=1)
    {
    for(int i=0;i<n;i++)
      {
      if((int)str[i]>=97 &&(int)str[i]<=122) 
        str[i]='x';
      }
    }
  cout<<str;
  return 0;
  }

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<functional>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

set<string> ans;

void dfs(int idx, string str, bool used[]) {
	if (idx == str.size()) {
		//cout << "insert:" << str << endl;
		ans.insert(str);
		return;
	}

	if (str[idx] != 'z' && !used[str[idx] - 'a' + 1]) {
		str[idx]++;
		used[str[idx] - 'a'] = true;

		dfs(idx + 1, str, used);

		used[str[idx] - 'a'] = false;
		str[idx]--;
	}

	if (used[str[idx] - 'a']) dfs(idx + 1, str, used);

	return;
}

int main()
{
	string str;
	while (cin >> str, str != "#") {
		ans.clear();
		bool used[26] = {};
		used[0] = true;

		dfs(0, str, used);

		cout << ans.size() << endl;
		
		if (ans.size() < 10) {
			for (auto itr : ans) cout << itr << endl;
		}
		else {
			auto front = ans.begin();
			auto back = ans.end();
			REP(i, 0, 5) back--;

			REP(i, 0, 5) {
				cout << *front << endl;
				front++;
			}
			REP(i, 0, 5) {
				cout << *back << endl;
				back++;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 4928
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end())
#define vecmin(A) *min_element(A.begin(),A.end())
#define vecmax(A) *max_element(A.begin(),A.end())
typedef long long ll;

string solve(string s){
  map<char,int> mp;
  for(char c : s) mp[c]++;
  for(auto p : mp) if(p.second%2) return "No";
  return "Yes";
}

int main(){
  string w;
  cin >> w;
  cout << solve(w) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll k;cin >> k;
  ll a[32] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  cout << a[k-1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!


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

ll _find(ll one,ll two,ll N){
    if(N&1){
        return one + _find(one,two,N-1);
    }
    return min(N*one,N/2 * two);
}
void solve(){
    ll a,b,one,two;
    cin>>a>>b>>one>>two;
    
    b=min(b,2*a);
    one=min(one,2*b);
    
    ll N;
    cin>>N;
    
    cout<<_find(one,two,N);
    
}

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

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main() {
	long long a, b, x;
	cin >> a >> b >> x;
	if (a == 0) {
		cout <<( b / x)+1 << endl;
		return 0;
	}
	long long count = b / x - (a - 1) / x;
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
use strict;
use warnings;

main();

sub main{
	my $step = <stdin>;
	chomp($step);
	my $xc = 0;
	my $yc = 0;
	my $timec = 0;
	my $xp = 0;
	my $yp = 0;
	my $timep = 0;
	
	foreach(1..$step){
		($timec, $xc, $yc) = split" ",<stdin>;
		my $tmpTime = $timec-$timep;
		my $tmpPos = abs($xc+$yc-$xp-$yp);

		if($tmpTime%2 != $tmpPos%2 || $tmpTime < $tmpPos){ print "No\n"; return; }
		($timep, $xp, $yp) = ($timec,$xc, $yc);
	}
	print "Yes\n";
}
1;


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

int K, N;
int a[210];

int main() {
    while (cin >> K >> N) {
        for (int i = 0; i < N; ++i) cin >> a[i];
        sort(a, a+N, greater<int>());
        int sum = 0;
        for (int i = 1; i < N; ++i) sum += a[i];
        if (sum >= a[0]-1) cout << 0 << endl;
        else cout << a[0]-1-sum << endl;
    }
}

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

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

    if (A >= B) {
        X += A;
        A -= 1;
    } else {
        X += B;
        B -= 1;
    }

    if (A >= B) {
        X += A;
        A -= 1;
    } else {
        X += B;
        B -= 1;
    }

    cout << X << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
#include<boost/rational.hpp>
#include<boost/multiprecision/cpp_dec_float.hpp>

int main(){
    using namespace std;
    using real = boost::rational<boost::multiprecision::cpp_int>;
    using point = complex<real>;
    using circle = pair<point, real>;
    unsigned long N;
    cin >> N;
    vector<point> p(N);
    for(auto& i : p){
        unsigned long im, re;
        cin >> im >> re;
        i.imag(real(im));
        i.real(real(re));
    }
    {
        mt19937_64 mt{random_device{}()};
        shuffle(p.begin(), p.end(), mt);
    }
    const auto& circle_from_diameter = [](const point& a, const point& b) -> circle {
        auto center = (a + b) / real(2);
        return {center, norm(a - center)};
    };
    const auto& circle_from_triangle = [](const point& a, const point& b, const point& c) -> circle {
        if(((a - b) / (a - c)).imag() == 0)return circle{};
        auto center = ((a - b) * norm(c) + (b - c) * norm(a) + (c - a) * norm(b)) / ((a - b) * conj(c) + (b - c) * conj(a) + (c - a) * conj(b));
        return {center, norm(a - center)};
    };
    const auto& is_included = [](const circle& c, const point& a) -> bool {
        return norm(a - c.first) <= c.second;
    };
    const auto& is_all_include = [&p, &is_included](const circle& c) -> bool {
        return all_of(p.begin(), p.end(), [&c, &is_included](const point& a){return is_included(c, a);});
    };
    auto c = circle_from_diameter(p[0], p[1]);
    for(unsigned long i{2}; i < N; ++i)if(!is_included(c, p[i])){
        c = circle_from_diameter(p[0], p[i]);
        for(unsigned long j{1}; j < i; ++j)if(!is_included(c, p[j])){
            c = circle_from_diameter(p[i], p[j]);
            for(unsigned long k{0}; k < j; ++k)if(!is_included(c, p[k]))c = circle_from_triangle(p[i], p[j], p[k]);
        }
    }
    boost::multiprecision::cpp_dec_float_100 t = boost::multiprecision::sqrt(boost::rational_cast<boost::multiprecision::cpp_dec_float_100>(c.second));
    cout << t.str() << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main (String args[]) {
		
		Scanner sc = new Scanner(System.in);
		int i = sc.nextInt();
		if (1 <= i && i <= 1000000) {
			if (i % 2 == 0) {
				i = i / 2 - 1;
			} else {
				i = (i - 1) / 2;
			}
		}
        System.out.println(i);
		sc.close();
	}
}


Measured memory_bytes: 23892
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Main {
//  ??¨?????????????????????
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int a = in.nextInt();
      int b = in.nextInt();
      out.println(a*b+" "+(2*a+2*b));
    }
  }

  public static void main(String[] args) throws IOException {
//    ??????
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
//    ??\???
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
//      ?????????????????????
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
//    ????????????????????????
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

using namespace std;

#define MAX_H 100005

LL H, W;

int main()
{
  cin >> H >> W;

  LL ans = INF_LL_MAX;
  for (int h = 1; h < H; h++) {
    LL a = h*W, b = (H-h)*(W/2), c = (H-h)*(W/2 + W%2);

    ans = min(ans, max(c, max(a, b)) - min(a, min(b, c)));

    b = (H-h)/2 * W, c = ((H-h)/2 + (H-h)%2) * W;
    ans = min(ans, max(c, max(a, b)) - min(a, min(b, c)));
  }

  for (int w = 1; w < W; w++) {
    LL a = w*H, b = (W-w)*(H/2), c = (W-w)*(H/2 + H%2);

    ans = min(ans, max(c, max(a, b)) - min(a, min(b, c)));

    b = (W-w)/2 * H, c = ((W-w)/2 + (W-w)%2) * H;

    ans = min(ans, max(c, max(a, b)) - min(a, min(b, c)));
  }

  cout << ans << endl;

  return 0;
}


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

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

constexpr int W = 4;
constexpr int H = 5;
constexpr int N = W * H;

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

bool out(int x, int y) {
	return x < 0 || y < 0 || x >= W || y >= H;
}

int get_index(int x, int y) {
	return x + y * W;
}

int ans;

void dfs(const vector<int> &cards) {
	ans = min<int>(ans, cards.size());

	rep(i, cards.size()) {
		const int x = i % W;
		const int y = i / W;

		rep(d, 4) {
			const int nx = x + dx[d];
			const int ny = y + dy[d];
			const int idx = get_index(nx, ny);

			if(out(nx, ny) || idx >= cards.size()) continue;

			if(cards[i] == cards[idx]) {
				vector<int> tmp(cards);
				const int a = min(i, idx);
				const int b = max(i, idx);
				tmp.erase(tmp.begin() + b);
				tmp.erase(tmp.begin() + a);
				dfs(tmp);
			}
		}
	}
}

void solve() {
	vector<int> cards(N);
	for(auto &e : cards) cin >> e;

	ans = N;
	dfs(cards);
	cout << ans << endl;
}

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

	int t;
	cin >> t;
	while(t--) solve();

	return EXIT_SUCCESS;
}

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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, l, r)  (a).begin()+(l),(a).begin()+(r)

int main() {
	long double a, b;
	cin >> a >> b;
	ll res = floor(a*b);
	pv(res);
	return(0);
}

Measured memory_bytes: 3736
# -*- coding utf-8 -*-
N = int(input())
AN = list(map(int, input().split()))

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

LN = [0] * (N)
LN[0] = AN[0]
for i in range(N - 1):
    LN[i + 1] = gcd(LN[i], AN[i + 1])

RN = [0] * (N)
RN[N - 1] = AN[N - 1]
for i in range(N - 1, 0, -1):
    RN[i - 1] = gcd(RN[i], AN[i - 1])


LN = [0] + LN + [0]
RN = [0] + RN + [0]
ans = 0
for i in range(1, N + 1):
    ans = max(ans, gcd(LN[i - 1], RN[i + 1]))
print(ans)

Measured memory_bytes: 14076
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

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

    int count = 0;

    for(int i = 2; i < S.length() - 1; i++) {
        if(S[i] == 'C')
            count++;
        else if(S[i] < 'a' || S[i] > 'z') {
            cout << "WA" << endl;
            return 0;
        }
    }

    if(S[1] < 'a' || S[1] > 'z' || S[S.length() - 1] < 'a' || S[S.length() - 1] > 'z') {
        cout << "WA" << endl;
        return 0;
    }


    if(count != 1)
        cout << "WA" << endl;
    else
        cout << "AC" << endl;    
    
}   

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import math
n, k = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    if i < k:
        quotient = k / i
        base = math.ceil(math.log2(k / i))
        ans = ans + (1 / (2 ** base) / n)
    else:
        ans = ans + 1 / n

print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
 
 
 
void change(char *str){
  int len=strlen(str);
  int i;
  for(i=0;i<len;i++){
    if('a'<=str[i]&&str[i]<='z'){
      str[i]-=32;
    }
  }
}
 
int main(){
  char t[10000];
  char key[10000];
  char eofstr[]={"END_OF_TEXT"};
  int ans=0;
 
  scanf("%s",key);
  change(key);
 
  while(1){
    scanf("%s",t);
    if(strcmp(t,eofstr)==0){
      break;
    }
    change(t);
    if(strcmp(t,key)==0){
      ans++;
    }
  }
 
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 2052
S = [int(x) for x in input()]
K = int(input())
if S[0] != 1:
    one = 0
    answer = S[0]
else:
    one = 0
    for i in range(len(S)):
        if S[i] == 1:
            one += 1
        else:
            break
    if one >= K:
        answer = 1
    else:
        answer = S[one]
print(answer)

Measured memory_bytes: 3064
//============================================================================
// Name        : c.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int n,k;cin>>n>>k;
	vector<long long> h(n);
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	long long ans=0;
	sort(h.begin(),h.end());
	for(int i=0;i<n-k;i++){
		ans+=h[i];
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#!/usr/bin/env python3
# import math
n = int(input())

ans = [-1]*(n+1)

ans[0] = 0
for i in range(1, n+1):
    num = i
    data = ans[i-1]+1
    for j in range(8):
        index = i-6**j
        if index < 0:
            break
        data = min(data, ans[index]+1)
    for j in range(8):
        index = i-9**j
        if index < 0:
            break
        data = min(data, ans[index]+1)
    ans[i] = data
print(ans[-1])


Measured memory_bytes: 9656
package main

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

const mod = 998244353
const facNum = 300001
const INF = 2 << 31

func main() {
	sc := newScanner(os.Stdin)
	N := sc.i()
	A := sc.is(N)
	//ans := make([]int, N)
	x1 := 0
	for i := 1; i < N; i++ {
		x1 ^= A[i]
	}
	fmt.Printf("%d", x1)
	for i := 1; i < N; i++ {
		x := A[0] ^ A[i]
		fmt.Printf(" %d", x1^x)
	}
	fmt.Print("\n")

	//for i := 0; i < N; i++ {
	//	ans := 0
	//	for j := 0; j < N; j++ {
	//		if i == j {
	//			continue
	//		}
	//		ans ^= A[j]
	//	}
	//	if i == N-1 {
	//		fmt.Printf("%d\n", ans)
	//	} else {
	//		fmt.Printf("%d ", ans)
	//	}
	//}
	//fmt.Printf(strings.Join(anss, " "))
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}

//------------------------------

//const factorial = new
func Pow(a, n int) int {
	ans := 1
	for n > 0 {
		if (n & 1) == 1 {
			ans = ans * a % mod
		}
		a = a * a % mod
		n = n >> 1
	}
	return ans
}

func Gcd(a, b int) int {
	if a < b {
		return Gcd(b, a)
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

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

func combination(n, k int, fac, ifac []int) int {
	if n < k || n < 0 {
		return 0
	}
	if k == 0 {
		return 1
	}
	//while n != 0
	ans := ifac[k] * ifac[n-k] % mod
	return ans * fac[n] % mod
}

func abs(i int) int {
	if i < 0 {
		return -i
	}
	return i
}

// 階乗: factorial
// コンビネーションを計算する際に前もって計算しておく
// fac[k] => k! (mod M)
// ifac[k] => k!^(M-2) (mod M)
// n: ex. 2 * 10^5 => 200001
// fac, ifac := factorial()
func factorial() (fac []int, ifac []int) {
	fac = make([]int, facNum)
	fac[0] = 1
	ifac = make([]int, facNum)
	ifac[0] = 1
	for i := 1; i < facNum; i++ {
		fac[i] = fac[i-1] * i % mod
		ifac[i] = ifac[i-1] * Pow(i, mod-2) % mod
	}
	return
}

// vs: sorted slice int value
func lowerBound(vs []int, v int) (index int) {
	n := len(vs) / 2
	m := len(vs)
	for m != n {
		if vs[n] < v {
			n = (m-n+1)/2 + n
			//m = m
		} else {
			m = n
			n = n / 2
		}
	}
	return n
}

func IntSlice(n, init int) []int {
	r := make([]int, n)
	for i := range r {
		r[i] = init
	}
	return r
}


Measured memory_bytes: 7228
/*      Author : Kaustubh Gangwar
        Institute : IIITA        */
#include <bits/stdc++.h>
using namespace std;
#define modo 1000000007
#define F first
#define S second 
#define pb push_back
#define gcd __gcd
#define vi vector<int>
#define vll vector<long long>
#define all(x) (x).begin(),(x).end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define CODING ios_base::sync_with_stdio(false); 
#define SAMRAT cin.tie(0),cout.tie(0);
#define mii map<int,int>
#define nl '\n'
typedef long long  ll;
typedef pair<int,int> pii;
 
ll bpow(ll a, ll b) {
    a=a; ll ans = 1;
    while(b){
        if (b & 1)
        ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}

int32_t main()
{ 
   CODING SAMRAT
   int test=1;
   //cin>>test;
   while(test--)
   {
    ll x,k,d;
    cin>>x>>k>>d;
    ll ans;
    ll temp=abs(x);
    ll c=temp/d;
    if(k>c)
    {   if(c%2==k%2)
        ans=abs(abs(x)-c*d);
        else
        ans=abs(abs(x)-(c+1)*d);
        
    }
    else
    {
        ans=temp-k*d;
    }
    
    
        cout<<ans<<nl;
   }

return 0;
}

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

using namespace std;

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

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

double yma[4];
double ymi[4];
double xma[4];
double xmi[4];
string str = "UDLR";

double calBoxArea(double time){
	double y_max = -1000000000;
	double y_min = 1000000000;
	double x_max = -1000000000;
	double x_min = 1000000000;
	// U
	y_max = max(y_max, yma[0] + time);
	y_min = min(y_min, ymi[0] + time);
	x_max = max(x_max, xma[0]);
	x_min = min(x_min, xmi[0]);
	// D
	y_max = max(y_max, yma[1] - time);
	y_min = min(y_min, ymi[1] - time);
	x_max = max(x_max, xma[1]);
	x_min = min(x_min, xmi[1]);
	// L
	y_max = max(y_max, yma[2]);
	y_min = min(y_min, ymi[2]);
	x_max = max(x_max, xma[2] - time);
	x_min = min(x_min, xmi[2] - time);
	// R
	y_max = max(y_max, yma[3]);
	y_min = min(y_min, ymi[3]);
	x_max = max(x_max, xma[3] + time);
	x_min = min(x_min, xmi[3] + time);

	return (y_max - y_min) * (x_max - x_min);
}

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

	REP(i, 4){
		yma[i] = -1000000000;
		ymi[i] = 1000000000;
		xma[i] = -1000000000;
		xmi[i] = 1000000000;
	}

	ll n;cin >> n;
	REP(i, n){
		double x, y;
		char c;
		cin >> x >> y >> c;
		REP(j, 4)if(str[j] == c){
			yma[j] = max(yma[j], y);
			xma[j] = max(xma[j], x);
			ymi[j] = min(ymi[j], y);
			xmi[j] = min(xmi[j], x);
		}
	}

	double ans = 1000000000000000000;
	REP(i, 200000000 + 1)ans = min(ans, calBoxArea((double)i / 2));

	cout << Decimal << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int m,d;
	scanf("%d%d",&m,&d);
	int ans=0;
	for(int i=1;i<=m;i++){
		for(int j=10;j<=d;j++){
			int shi=j/10;
			int ge=j%10;
			if(shi*ge==i&&shi>1&&ge>1){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()

int main() {
ll N,M;
  cin>>N>>M;
  
vector<vector<ll>> vec(N,vector<ll>(0));
  for(ll i=0;i<M;i++) {
ll a,b;
    cin>>a>>b;
    vec[a-1].push_back(b);
    vec[b-1].push_back(a);
  }
  
  vector<ll> A(N);
  for(ll i=0;i<N;i++) {
A[i]=i+1;
  }
  
  
  sort(all(A));
  ll ans=0;
  do {
    if(A[0]!=1) {
break;
    }
    
    bool b=true;
    for(ll i=0;i<N-1;i++) {
ll k=A[i];
      ll n=A[i+1];
      bool a=false;
      for(auto x:vec[k-1]) {
if(x==n) {
a=true;
}
      }
      if(!a) {
b=false;
        break;
      }
    }
    
    
    if(b) {
ans++;
    }
  }
  
    while(next_permutation(all(A)));
    
    cout<<ans<<endl;
  }
      
      
        
        
        
        
        

Measured memory_bytes: 3636
import queue
n=int(input())
INF=10**18
e=[[] for _ in range(n+1)]
d=[INF]*(n+1)
for i in range(n-1):
  a,b,c=map(int,input().split())
  e[a].append((b,c))
  e[b].append((a,c))
q,k=map(int,input().split())
que=queue.Queue()
que.put(k)
d[k]=0
while not que.empty():
  x=que.get()
  for i,c in e[x]:
    if d[i]==INF:
      que.put(i)
      d[i]=d[x]+c
for _ in range(q):
  x,y=map(int,input().split())
  print(d[x]+d[y])

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

ll dp[500050][2];
const ll MOD=1e9+7;

int main(){
    ll n,m;cin>>n>>m;
    dp[1][0]=n-1;
    dp[1][1]=m-n;
    rep(i,1,n){
        dp[i+1][0]+=dp[i][0]*(n-i-1);
        dp[i+1][1]+=dp[i][0]*(m-n+1);
        dp[i+1][0]%=MOD;
        dp[i+1][1]%=MOD;
        dp[i+1][0]+=dp[i][1]*(n-i-1);
        dp[i+1][1]+=dp[i][1]*(m-n);
        dp[i+1][0]%=MOD;
        dp[i+1][1]%=MOD;
    }
    ll an=dp[n][0]+dp[n][1];
    an%=MOD;
    for(ll i=m;i>=m-n+1;i--){
        an*=i;
        an%=MOD;
    }
    cout<<an<<endl;
}

    









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

struct mob{ long long int le[101], ri[101], ll[101], rr[101]; };

int n;
mob mm;
bool flg[101]; 

int gcd(long long int a,long long int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(long long int x,long long int y){
    return (x*y/gcd(x,y));
}

int minc(long long int x){
	long long int w,lef,rig;
	if(mm.ll[x]==0)lef=1;
	else lef=minc(mm.ll[x]);
	if(mm.rr[x]==0)rig=1;
	else rig=minc(mm.rr[x]);
	w=lcm(lef*mm.le[x],rig*mm.ri[x]);
	return w/mm.le[x]+w/mm.ri[x];
}


int main(void){
	long long int ans;
	while(1){
		cin >> n;
		ans=0;
		if(n==0)break;
		memset(flg,0,sizeof(flg));
		for(int a=1;a<=n;a++){
			scanf("%d%d%d%d",&mm.le[a],&mm.ri[a],&mm.ll[a],&mm.rr[a]);
			flg[mm.ll[a]]=1;
			flg[mm.rr[a]]=1;
		}
		for(int a=1;a<=n;a++){
			if(flg[a]==0)ans=minc(a);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }



int main() {
	int n;
	cin >> n;
	vector<double> a(n);
	rep(i, n) {
		cin >> a[i];
	}
	double c = 0;
	rep(i, n) {
		c += 1 / a[i];
	}
	cout << 1 / c << endl;
}



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

typedef int Weight;
struct Edge {
    int src,dst;
    Weight cost;
    Edge(int s,int d,Weight c) : src(s), dst(d), cost(c) {}
};
bool operator<(const Edge &e,const Edge &f) {
    return (e.cost != f.cost) ? e.cost > f.cost : e.src < f.src;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

const Weight inf = 1<<29;

void dijkstra(const Graph &g,int s,vector<Weight> &dist,vector<int> &prev) {
    const int n = g.size();
    dist.resize(n);
    prev.resize(n);
    for(int i=0; i<n; ++i)
        dist[i] = inf, prev[i] = -1;

    priority_queue<Edge> q;
    q.push(Edge(-2,s,0));
    dist[s] = 0;
    while(!q.empty()) {
        Edge e = q.top(); q.pop();
        if(prev[e.dst] != -1) continue;
        prev[e.dst] = e.src;

        for(int i=0; i<g[e.dst].size(); ++i) {
            int w = g[e.dst][i].dst;
            if(dist[w] > dist[e.dst] + g[e.dst][i].cost) {
                dist[w] = dist[e.dst] + g[e.dst][i].cost;
                q.push(Edge(e.dst,w,dist[w]));
            }
        }
    }
}

int L;
inline int idx(int a,int l) { return a*L+l; }

int main() {
    int n,m,l;
    int a,b,e,d;
    while(cin>>n>>m>>l, n|m) {
        L = l+1;
        Graph g(n*L);
        for(int i=0; i<m; ++i) {
            cin>>a>>b>>d>>e; a--,b--;
            for(int j=0; j<L; ++j) {
                g[idx(a,j)].push_back(Edge(idx(a,j),idx(b,j),e));
                g[idx(b,j)].push_back(Edge(idx(b,j),idx(a,j),e));
                if(j>=d) {
                    g[idx(a,j)].push_back(Edge(idx(a,j),idx(b,j-d),0));
                    g[idx(b,j)].push_back(Edge(idx(b,j),idx(a,j-d),0));
                }
            }
        }

        vector<int> dist(n*L,0), prev(n*L,0);
        dijkstra(g,l,dist,prev);

        int ans = 1<<29;
        for(int i=0; i<=l; ++i)
            ans = min(ans, dist[idx(n-1,i)]);
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 9200
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n, t = i_map()
    num_list = i_list()

    ans = n * t

    for i in range(n-1):
        if num_list[i+1] - num_list[i] < t:
            ans -= t - num_list[i+1] + num_list[i]

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 108436
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int main(){
    string S; cin>>S;
    int N=S.size();
    int ansl=-2, ansr=-2;

    

   
    for(int i=0;i<N-1;i++){
        if(i!=N-2) {if(S.at(i)==S.at(i+2)) {ansl=i; ansr=i+2; break;}}
        if(S.at(i)==S.at(i+1)) {ansl=i; ansr=i+1; break;}
    }

    cout<<ansl+1<<' '<<ansr+1<<endl;
        
    
}

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

int main() {
	int n;
	cin >> n;
	long long res = 0;
	for (int i = 1; i <= n; ++i) {
		if (i % 3 == 0 || i % 5 == 0)
			continue;
		res += i;
	}
	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 3492
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<cmath>
#include<deque>
#include<set>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define INF 1LL << 60
#define MAX 1000000000
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
int main() {
	deque<char> A, B, C;
	char t;
	while(1) {
		scanf("%c", &t);
		if (t == '\n')break;
		A.push_front(t);
	}
	while (1) {
		scanf("%c", &t);
		if (t == '\n')break;
		B.push_front(t);
	}
	while (1) {
		scanf("%c", &t);
		if (t == '\n')break;
		C.push_front(t);
	}
	t ='a';
	while (1) {
		if (t == 'a') {
			if (!A.size()) { puts("A"); return 0; }
			t = A.back(), A.pop_back();
		}
		if (t == 'b') {
			if (!B.size()) { puts("B"); return 0; }
			t = B.back(), B.pop_back();
		}
		if (t == 'c') {
			if (!C.size()) { puts("C"); return 0; }
			t = C.back(), C.pop_back();
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
#include <string>
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define fors(i, a, b) for(int i = a; i < b; i++)
#define fori(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pair<int, int> > vpi;
typedef vector<pair<string, int> > vpsi;
typedef map<string, int> msi;
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi v(n+1);
    fori(i,n-1)
    {
        cin >> v[i+2];
    }
    vi v2(n+1);
    fors(i,1,n+1)
    {
        v2[v[i]]++;
    }
    fori(i,n)
    {
        cout << v2[i+1] << endl;
    }
    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
using namespace std;
//using ll=long long;

int main(){
    int N;
    cin >> N;
    if(N == 1){
        cout << "Hello World" << endl;
    } else {
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        char[] cs = s.toCharArray();
        char[] ct = t.toCharArray();
        char[] x = change(cs);
        cs = change(cs);
        ct = change2(ct);

        String name1= new String(cs);
        String name2= new String(ct);
        //System.out.println("name1= " + name1);
        //System.out.println("name2= " + name2);
        if(name1.compareTo(name2) < 0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
    public static char[] change(char[] cs){
        char x;
        for(int i = 0;i < cs.length;i++){
            for(int j = i+1;j < cs.length;j++){
                if(cs[i] > cs[j]){
                    x = cs[i];
                    cs[i] = cs[j];
                    cs[j] = x;
                }
            }
        }
        //System.out.println(cs);
        return cs;
    }
    public static char[] change2(char[] cs){
        char x;
        for(int i = 0;i < cs.length;i++){
            for(int j = i+1;j < cs.length;j++){
                if(cs[i] < cs[j]){
                    x = cs[i];
                    cs[i] = cs[j];
                    cs[j] = x;
                }
            }
        }
        //System.out.println(cs);
        return cs;
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <new>
#include <map>

using namespace std;
 
int main() {
	int r,g,b,val,ans;
	cin >> r >> g >> b;
	val = 100*r+g*10+b;
	ans = val % 4;
	if(ans == 0){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef pair<int,int> P;

const int INF=1000000;
char field[101][101];
int d[101][101];
int N,M;
int sx,sy;
int gx,gy;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const int MAX_V=100;
const int MAX_N=100;


int main(){
	
	int v[8];
	int p[8][8]={{4,1,4,1,2,1,2,1},{4,1,2,1,2,1,4,1},{2,1,4,1,4,1,2,1},{2,1,2,1,4,1,4,1},{1,4,1,4,1,2,1,2},{1,4,1,2,1,2,1,4},{1,2,1,4,1,4,1,2}
		,{1,2,1,2,1,4,1,4}};
	
	while(cin>>v[0]){
		REP(i,1,8)
			cin>>v[i];
		int k=0;
		long long max=1000000;
		rep(i,8){
			int	sum=0;
			rep(j,8){
				//debug(v[j]);
				//debug(p[i][j]);
				if(v[j]-p[i][j]>0)
					sum+=v[j]-p[i][j];
				//debug(sum);
		}
			if(max>=sum){
				max=sum;
				k=i;
				//debug(k);
			}
		}
		cout<<p[k][0];
		REP(i,1,8)
			cout<<" "<<p[k][i];
		cout<<endl;
	}
	
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,mod=1,pos=0,num=0;
	cin>>a>>b;
	if (b==100)
	{
		if (a==0)  cout<<101<<endl;
		else if (a==1)  cout<<10100<<endl;
		else if (a==2)  cout<<1010000<<endl;
		return 0;
	}
	for (int i=1;i<=a;i++)  mod*=100;
	while (1)
	{
		pos++;
		if (pos%mod==0)  num++;
		if (num==b)
		{
			cout<<pos<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
	int n,a,b;
	cin >> n >> a >> b;
	vector<int> h(n+1);
	int maxh=0;
	for(int i=1;i<=n;i++){
		cin >> h[i];
		if(maxh<h[i]) maxh=h[i];
	}
	int i;
	int m=1,M=maxh/b+1;
	while(m!=M){
		i=(m+M)/2;
		long long extra=0;
		for(int j=1;j<=n;j++){
			if(h[j]>b*i) extra+=ceil((double)(h[j]-b*i)/(a-b));
		}
		if(extra<=i) M=i;
		else m=i+1;
	}
	cout << m << endl;
}


Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>    
#include <iostream>
#include <vector>
#include <queue>
// #include <map>
#include <iomanip>
#include <cstring>
#include <cmath>
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int uii;
typedef pair<int,int> pii;
typedef unsigned long long uLL; 
typedef vector<int> vii; 
const int maxn = 1e5;
LL d[maxn + 10], v[maxn + 10], w[maxn + 10];
const int inf = 1e9 + 7; 
int main(int argc, char const *argv[])
{
#ifndef ONLINE_JUDGE
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	LL n, W;
	cin >> n >> W;
	for(int i = 0; i < n; ++i){
		cin >> v[i] >> w[i];
	}
	fill(d + 1, d + maxn + 1, inf);
	for(int i = 0; i < n; ++i){
		for(int j = maxn; j >= 0; --j){
			if(w[i] <= j){
				d[j] = min(d[j], d[j - w[i]] + v[i]);
			}
		} 
	}

	for(int i = maxn; i >= 0; --i){
		if(d[i] <= W){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
a,b = map(int,input().split())

vr_total = 4*a
diff = vr_total - b
turu = diff / 2
kame = a -turu
if turu != int(turu):
  print("No")
  exit()
if turu>=0 and kame>=0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9172
using System;

namespace atcorder
{
    class Program
    {
        public static void Main()
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int k = int.Parse(In[1]);
            int val = 1;
            int cnt = 0;
            while (n>=val)
            {
                cnt++;
                val *= k;
            }
            Console.WriteLine(cnt);
        }
    }
}


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

bool arrEqual(vector<int> &a, vector<int> &b)
{
    int n = a.size();
    for (int i = 0; i < n; i++)
    {
        if (a[i] != b[i])
        {
            return false;
        }
    }

    return true;
}

int main()
{
    int n;

    cin >> n;

    vector<int> t1(n);
    vector<int> t2(n);
    for (int i = 0; i < n; i++)
    {
        cin >> t1[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> t2[i];
    }

    vector<int> a(n);

    for (int i = 0; i < n; i++)
    {
        a[i] = i + 1;
    }

    int n1, n2;
    int count = 0;

    do
    {
        if (arrEqual(a, t1))
        {
            n1 = count;
        }
        if (arrEqual(a, t2))
        {
            n2 = count;
        }
        count++;
    } while (next_permutation(a.begin(), a.end()));

    cout << abs(n1 - n2) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include<algorithm>
using namespace std;
int main(){
	int A, B;
	cin >> A >> B;
	int plus, minus, multiple;
	plus = A + B;
	minus = A - B;
	multiple = A * B;
	cout << max({ plus,minus,multiple })<<endl;
    return 0;
}

Measured memory_bytes: 256