akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

using namespace std;

#define MAX_N 1 << 9

int main() {
	int n; 
	cin >> n;
	cout << n << ":";
	for (int i = 2; i * i <= n; i++)
		while (n % i == 0) {
			cout << " " << i;
			n /= i;
		}
	if (n != 1)
		cout << " " << n;
	cout << endl;
	return 0;
}

Measured memory_bytes: 1168
#include<iostream>

using namespace std;

int main(){

    int A, B, C;

    cin >> A >> B >> C;

    if(A==7 && B==5 && C==5){
        cout << "YES";
    }else if(A==5 && B==5 && C==7){
        cout << "YES";
    }else if(A==5 && B==7 && C==5){
        cout << "YES";
    }else{
        cout << "NO";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int num,limit,remain;
  cin >> num >> limit >> remain;
  int count = 0;
  for(int i = 0;i<num;i++){
    int broad;
    cin >> broad;
    int now = 1;
    while(now<=limit){
      count++;
      now += broad;
    }
  }
  cout << count + remain << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n, m, x, y = map(int, input().split())
xx = list(map(int, input().split()))
yy = list(map(int, input().split()))
cnt=0

for i in range(x+1,y+1):
    for j in range(0,n):
        if xx[j]<i:
            cnt+=1

    for j in range(0,m):
        if yy[j]>=i:
            cnt+=1
    if cnt==n+m:
        print('No War')
        exit()
    cnt=0
print('War')


Measured memory_bytes: 3064
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n-1];
        for(int i = 0;i<n-1;i++){
            b[i] = sc.nextInt();
        }
        for(int i =0;i<n;i++){
            if(i==0){
                a[i]=b[i];
            } else if(i==n-1){
                a[i]=b[i-1];
            }else {
                a[i]=Math.min(b[i],b[i-1]);
            }
        }
        int sum = 0;
        for(int i =0;i<n;i++){
            sum += a[i];
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define int long long

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'

int n, l;

signed main()
{
    cin >> n >> l;

    int sum = 0;

    FOR(i, l, n+l){
        sum += i;
    }
    // DEBUG(sum);
    if (l < 0){
        if (n > -l){
            sum -= 0; 
        } else {
            sum -= n+l-1;
        }
    } else {
        sum -= l;
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
void solve() {
  int n;
  long long k;
  cin >> n >> k;
  vector<int>v(n);
  for(int i = 0; i < n; ++i){
    cin >> v[i];
    v[i]--;
  }
  vector<int>vstd(n, 0);
  vector<int>vstd2(n, 0);
  vector<int>ord;
  vector<int>loop;
  int fl = -1;
  int cur = 0;
  while(true) {
    if(vstd[cur])break;
    vstd[cur] = 1;
    ord.push_back(cur);
    cur = v[cur];
  }
  while(true) {
    if(vstd2[cur])break;
    vstd2[cur] = 1;
    loop.push_back(cur);
    cur = v[cur];
  }
  if(DEBUG) {
    for(auto u : ord)cout << u + 1 << " ";
    cout << endl;
    for(auto u : loop)cout << u + 1 << " ";
    cout << endl;
  }
  if(k < (long long )ord.size()) {
    cout << ord[(int)k] + 1 << endl;
  } else {
    k -= (long long)ord.size();
    if(DEBUG)cout << "k = " << k << endl;
    long long lsz = (long long)loop.size();
    long long pos = k%lsz;
    if(DEBUG)cout << "pos = " << pos << endl;
    cout << loop[(int)pos] + 1 << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tc = 1;
  // cin >> tc;
  for(int i = 1; i <= tc; ++i) {
    // cout << "Case #" << i <<": ";
    solve();
  }
  return 0;
}

Measured memory_bytes: 7896
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;


const double EPS = 1e-10;
const double PI = acos(-1.0);

struct PT {
  ll x, y;
  int id;
  PT() {}
  PT(ll x_, ll y_): x(x_), y(y_), id(-1) {}
  ll len2() const {
    return x * x + y * y;
  }
  double len() const {
    return sqrt(len2());
  }
  PT operator - (const PT &b) const {
    return PT(x - b.x, y - b.y);
  }
  ll operator * (const PT &b) const {
    return x * b.x + y * b.y;
  }
  ll operator % (const PT &b) const {
    return x * b.y - y * b.x;
  }
  bool operator < (const PT &b) const {
    return tie(x, y) < tie(b.x, b.y);
  }
};

const int MAXN = 123;
PT in[MAXN];
double ans[MAXN];

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    in[i].x = x;
    in[i].y = y;
    in[i].id = i;
  }
  sort(in, in + N);
  vector<PT> st;
  for (int i = 0; i < N; i++) {
    while (SZ(st) >= 2 && (st[SZ(st) - 1] - st[SZ(st) - 2]) % (in[i] - st[SZ(st) - 1]) < 0)
      st.pop_back();
    st.PB(in[i]);
  }
  if (SZ(st) == 2) {
    ans[st[0].id] = 0.5;
    ans[st[1].id] = 0.5;
  }
  for (int i = N - 2; i >= 0; i--) {
    while (SZ(st) >= 2 && (st[SZ(st) - 1] - st[SZ(st) - 2]) % (in[i] - st[SZ(st) - 1]) < 0)
      st.pop_back();
    st.PB(in[i]);
  }
  if (SZ(st) == 2)
    goto finish;
  for (int i = 0; i < N; i++)
    ans[i] = 0;
  debug("SZ %d\n", SZ(st));
  st.PB(st[1]);
  debug("!\n");
  for (int i = 1; i < SZ(st) - 1; i++) {
    debug("i = %d\n", i);
    PT A = st[i - 1] - st[i];
    PT B = st[i + 1] - st[i];
    debug("%f %f\n", A.len(), B.len());
    double tmp = A * B / (A.len() * B.len());
    debug("! %d %f\n", i, tmp);
    double ang = PI - acos(tmp);
    ans[st[i].id] = ang / (2 * PI);
  }
  finish:
  for (int i = 0; i < N; i++)
    printf("%.10f\n", ans[i]);
  double sum = 0;
  for (int i = 0; i < N; i++)
    sum += ans[i];
//  assert(fabs(sum - 1.0) < EPS);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int H;
	int N;
	int A = 0;
	int buf;
	std::cin >> H;
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		std::cin >> buf;
		A += buf;
	}
	if (A<H) {
		std::cout << "No";
	}else{
		std::cout << "Yes";
	}
}

Measured memory_bytes: 256
import Data.List


main = do
  (a:b:c:d:e:f:_) <- getLine >>= return . map read . words :: IO [Int]

  let
    sugar = func c d f
    water = func (100*a) (100*b) f

    (ws, s) = maximumBy (\(x1,y1) (x2,y2) -> compare (divint y1 x1) (divint y2 x2)) (tail [(w+s,s) | w <- water, s <- sugar, w + s <= f, (div w 100) * e >= s])

  putStr $ show ws
  putStr " "
  putStrLn $ show s

  where
    divint a b = (fromIntegral a) / (fromIntegral b)
    func a b n = nub $ sort $ concat $ map (\x -> takeWhile(<=n) (iterate (+b) x)) $ takeWhile (<=n) (iterate (+a) 0)


Measured memory_bytes: 28924
#include <stdio.h>

int main(){
	int num[3],i,j,swp;

	for(i = 0; i < 3; i++){
		scanf("%d",&num[i]);
	}

	for(i = 0; i < 3; i++){
		for(j = 1; j < 3; j++){
			if(i < j && num[i] < num[j]){
				swp = num[i];
				num[i] = num[j];
				num[j] = swp;
			}
		}
	}

	printf("%d",(num[0]-num[1])+(num[1]-num[2]));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M,C,tmp,count=0,tmp_score=0;
  vector<int> B;
  vector<vector<int>> A;
  
  cin >>N >>M >>C;
  for(int i =0; i<M;i++){
    cin >>tmp;
    B.push_back(tmp);
  }
  for(int i=0;i<N;i++){
    A.emplace_back();
    for(int j=0;j<M;j++){
      cin >>tmp;
      A[i].push_back(tmp);
    }
  }
  
  for(int i=0;i<N;i++){
    tmp_score=0;
    for(int j=0;j<M;j++){
      tmp_score += B[j]*A[i][j];
    }
    tmp_score+=C;
    if(tmp_score>0)count++;
  }
  
  cout<< count;
}

Measured memory_bytes: 256
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
c = 0
for i in range(q):
    l = 0
    r = n
    t = T[i]
    while r-l > 1:
        m = (r + l)//2
        if (S[m] > t):
            r = m
        else:
            l = m
    if (S[l] == T[i]):
        c += 1
print(c)


Measured memory_bytes: 16704
using System;
using System.Linq;

class Plogram
{
    static void Main()
    {

        int num = int.Parse(Console.ReadLine());
        int[] height = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        int count = 0;
        int max = 0;

        for (int i = 0;i<num;i++)
        {
            if(height[i] >= max)
            {
                count++;
                max = height[i];
            }
        }
        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,n,h) for(int i = n; i < h; ++i)
#define rep3(l,n,h) for(int l = n; l <= h; ++l)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf
 
typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;
 
 
int main() {
    string s;
    char ans = '1';
    int k,i = 0;
    cin >> s >> k;
    while(i < k) {
        if(s[i] != '1') {
            ans = s[i];
            break;
        }
        i++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int number= 0;
    String li[] = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    for(int i=0;i<7;i++){
      if(S.equals(li[i])){
        number = 7-i;
      }
    } 
    System.out.println(number);
  }
}       

Measured memory_bytes: 21716
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
char s[SIZE];
int main(){
    RS(s);
    int n=LEN(s);
    if(n<26){
        bool u[128]={};
        REP(i,n){
            u[(int)s[i]]=1;
        }
        FOR(c,'a','z'){
            if(!u[c]){
                printf("%s%c\n",s,(char)c);
                return 0;
            }
        }
    }
    else{
        if(strcmp("zyxwvutsrqponmlkjihgfedcba",s)==0){
            W(-1);
            return 0;
        }
        char t[32];
        REP(i,n)t[i]=s[i];
        next_permutation(t,t+26);
        REPP(i,1,27){
            char c=0;
            swap(c,t[i]);
            if(strcmp(s,t)<0){
                puts(t);
                return 0;
            }
            swap(c,t[i]);
        }
    }
    return 0;
}


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

int main(void)
{
  int a[3];
  int dist[3];
  int remain[2];
  scanf("%d %d %d",&a[0],&a[1],&a[2]);
  dist[0]=abs(a[0]-a[1]);
  dist[1]=abs(a[1]-a[2]);
  dist[2]=abs(a[0]-a[2]);

  int max=dist[0];

  for(int i=1;i<=2;i++){
    if(dist[i]>max){
      remain[i-1]=max;
      max=dist[i];
    }else{
      remain[i-1]=dist[i];
    }
  }
  printf("%d\n",remain[0]+remain[1]);
  return 0;
}


Measured memory_bytes: 128
h,w = map(int,input().split())
coin = [list(map(int,input().split())) for i in range(h)]
ans = []
c = 0
for i in range(h):
  for j in range(w-1):
    if coin[i][j] % 2:
      coin[i][j+1] += 1
      ans.append([i+1,j+1,i+1,j+2])
      c += 1
 
for k in range(h-1):
  if coin[k][w-1] % 2:
    coin[k+1][w-1] += 1
    ans.append([k+1,w,k+2,w])
    c += 1
    
print(c)
for i in range(c):
  print(ans[i][0],ans[i][1],ans[i][2],ans[i][3])

Measured memory_bytes: 30256
A, B, K = map(int, input().split())

while True:
    if K == 0:
        break
    if A % 2 == 1:
        A -= 1
    A //= 2
    B += A
    K -= 1

    if K == 0:
        break
    if B % 2 == 1:
        B -= 1
    B //= 2
    A += B
    K -= 1

print(A, B)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
// #include <atcoder/all>

using namespace std;
// using namespace atcoder;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    ll ans = 0;
    rep2(a, 1, N + 1) {
        ans += (N - 1) / a;
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 3608
// https://atcoder.jp/contests/abc167/tasks/abc167_e

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define FORR(i,b,e) for(int i=(b); i>=(int)(e); i--)

#define DEBUG 1
#if DEBUG
  #define _GLIBCXX_DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

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

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

//------------------------------------------------------------------------------
const int F_MAX = 2e5;

ll fact[F_MAX + 1];
ll fact_inv[F_MAX + 1];

void init_fact(int m) {
  fact[0] = 1;
  FOR(i, 1, F_MAX) fact[i] = fact[i - 1] * i % m;
  fact_inv[F_MAX] = mod_inverse(fact[F_MAX], m);
  FORR(i, F_MAX - 1, 0) fact_inv[i] = fact_inv[i + 1] * (i + 1) % m;
}

ll mod_comb_fast(ll n, ll k, ll mod) {
  if (n < 0 || k < 0 || n < k) return 0;
  ll a = fact[n];
  ll b = fact_inv[k] * fact_inv[n - k] % mod;
  ll ret = a * b % mod;
  return ret;
}

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

const int N_MAX = 2*1e5;
const int M_MAX = 2*1e5;
const int MOD = 998244353;

int N, M, K;

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

  init_fact(MOD);

  ll ans = 0;
  FOR(k, 0, K) {
    ll tmp = M;
    tmp = tmp * mod_comb_fast(N - 1, k, MOD) % MOD;
    tmp = tmp * mod_pow(M - 1, N - 1 - k, MOD) % MOD;
    ans = (ans + tmp) % MOD;
  }

  cout << ans << endl;
}


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

int main(){
  int a;
  cin >> a;
  vector<double>N(a);
  for(int i=0; i<a; i++){
    cin >> N.at(i);
  }
  
  vector<double>A(a);
  double B=0;
  for(int i=0; i<a; i++){
    A.at(i)=1/N.at(i);
  }
  for(double i=0; i<a; i++){
    B+=A.at(i);
  }
  cout << 1/B << endl;
}

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

int main(){
	int n,m;
	cin>>n>>m;
	int i,j,x=2,k,h,d,t;
	char a[101][101],b[101][101];
	char c;
	for(i=0;i<n;i++){
		for(j=0;j<n;j++)
		cin>>a[i][j];
	}
	for(i=0;i<m;i++){
		for(j=0;j<m;j++)
		cin>>b[i][j];
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			x=2;
			if(a[i][j]==b[0][0]&&k+m<=n&&h+m<=n){
				x=0;
			for(d=0;d<m;d++){
				for(t=0;t<m;t++){
					if(a[d+i][t+j]!=b[d][t]){
						x=1;
						break;
					}
				}
			}
			}
			if(x==1)
			continue;
			else if(x==0){
			cout<<"Yes"<<endl;	
			return 0;
			}
			
		}
	}
	cout<<"No"<<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 N=sc.nextInt();
        int K=sc.nextInt();
        double result=0;
        for(int i=1;i<=N;i++){
            if(i<K){
                int count=(int)(Math.ceil((Math.log10((double)K/(double)i)/Math.log10(2.0)))+0.01);
                result+=Math.pow(0.5,count);
            }else{

                result+=1;
            }
        }

        System.out.println(result/N);

    }
    static boolean isMonth(int a){
        return a>0&&a<13;
    }

}


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

int main(){
    int N; cin >> N;
    int W[101];
    for(int i=0; i<N; i++){
        cin >> W[i];
    }
    int ans =100100;
    for(int i=0; i<N-1; i++){
        int S1=0, S2=0;
        for(int j=0; j<=i; j++){
            S1+=W[j];
        }
        for(int j=i+1; j<N; j++){
            S2+=W[j];
        }
        ans =min(ans, abs(S1-S2) );
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        a = a^b;
        b = a^b;
        a = a^b;
    }
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }
    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}


void solve(void){
    int n,t,a;
    cin >> n >> t >> a;
    int h;
    int ans;
    double dic = (double)INF;
    rep(i,0,n){
        cin >> h;
        if(dic > min((double)dic,fabs(a- t+h*0.006))){
            ans = i+1;
            dic = fabs(a- t+h*0.006);
        }
    }

    cout << ans << endl;
}


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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int N = 0;
		String s;
		Scanner sc = new Scanner(System.in);
		N = Integer.parseInt(sc.next());
		s = sc.next();
		int n;
		int R = 0;
		int B = 0;
		String S;
		for (n = 0; n < N; n++) {
			S = String.valueOf(s.charAt(n));
			if (S.equals("R")) {
				R++;
			} else {
				B++;
			}
		}
		if (R > B)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}

Measured memory_bytes: 25172
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int a = scan.nextInt();
    int b = scan.nextInt();
    int c = scan.nextInt();
    int cnt = 0;

    for (int i = a; i <= b; i++) {
      if (c % i == 0) {
        cnt++;
      }
    }
    System.out.println(cnt);

  }
}



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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;
    ll x[n];
    NREP() {
        cin >> x[i];
    }

    ll min = LONG_LONG_MAX;

    for (int j = 0; j <= 100; ++j) {
        ll cost = 0;
        NREP() {
            cost += pow(x[i] - j, 2);
        }
        if (cost <= min) min = cost;
    }

    MSG(min)
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/arc069/tasks/arc069_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define CEIL(a, b) ((a - 1) / b + 1)

template <typename T, typename F>
T binarySearch(T ok, T ng, F isOK, T bound = 1) {
    while (abs(ng - ok) > bound) {
        T m = (ng + ok) / 2;
        if (isOK(m))
            ok = m;
        else
            ng = m;
    }
    return ok;
}

void solve() {
    int N, M;
    cin >> N >> M;
    auto fn = [&](int t) {
        // t組作る
        int ccnt = M;
        if (N < t) {
            ccnt -= (t - N) * 2;
        }
        // SがT個、CがT*2個作れるならOK
        return ccnt >= t * 2;
    };
    int ok = 0, ng = 1e12 + 1;
    cout << binarySearch(ok, ng, fn) << endl;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
	int N; cin>>N;
	
	vector<int> A(N);
	for(int i=0;i<N;i++)cin>>A[i];
	sort(A.begin(),A.end());
	int test=1;
	for(int i=0;i<18;i++)test*=10;
	test++;
	vector<long double> lo(N);
	long double tmp=0;
	for(int i=0;i<N;i++){
		if(A[i]!=0)lo[i]=log10(A[i]);
		tmp+=lo[i];
	}
	if(A[0]!=0 and tmp>18.0){
		cout<<-1<<endl;
		return 0;
	}
	unsigned long long ans=A[0];
	for(int i=1;i<N;i++){
		ans*=A[i];
		if(ans>=test or ans<0){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
}


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

// syntax sugar: `for (int i = 0; i < N; ++i)`
#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
// syntax sugar: `for (int i = 0; i < N; ++i)`
#define REP(type, name, beginValue, endCondValue) \
  for (type name = beginValue; name < endCondValue; ++name)
// syntax sugar: 多次元vector
#define VECTOR_DIM3(T, name, d1, d2, d3, initValue) \
    std::vector<std::vector<std::vector<T>>> name(d1, std::vector<std::vector<T>>(d2, std::vector<int>(d3, initValue)));
#define VECTOR_DIM2(T, name, d1, d2, initValue) \
    std::vector<std::vector<T>> name(d1, std::vector<T>(d2, initValue));
#define VECTOR_DIM1(T, name, d1, initValue) \
    std::vector<T> name(d1, initValue);
#define ll long long
#define ld long double


// ABC093C - Same Integers
int main(){
  int a[3]; // 0 <= n <= 50
  vector<int> d(3, 0);
  cin >> d[0] >> d[1] >> d[2];

  std::sort(d.begin(), d.end(), greater<int>());
  const int maxNum = d[0];
  const int diff = 3 * maxNum - (d[0] + d[1] + d[2]);

  int num = 0;
  if (d[1] > d[2]) {
    const int inc = (d[1] - d[2]) / 2;
    d[2] += 2 * inc;
    num += inc;
  }
  if (d[0] > d[1]) {
    const int inc = (d[0] - d[1]);
    d[1] += inc;
    d[2] += inc;
    num += inc;
  }
  if (d[0] == d[1] && d[1] == d[2]) {
    cout << num << endl;
  } else {
    cout << num + 2 << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    priority_queue<pair<ll, ll> > q;
    for (ll i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        q.push(make_pair(b, a));
    }
    ll t = q.top().first;
    while (!q.empty())
    {
        if (q.top().first < t)
        {
            t = q.top().first;
        }

        t -= q.top().second;
        q.pop();

        if (t < 0)
        {
            cout << "No" << endl;
            exit(0);
        }
    }
    cout << "Yes" << endl;
}

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

using namespace std;

int main() {
	char a;
	cin >> a;
	if (a == 'A') a = 'T';
	else if (a == 'T') a = 'A';
	if (a == 'C') a = 'G';
	else if (a == 'G') a = 'C';
	cout << a << endl;
	return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define pb push_back

template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
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;
}

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using vpint = vector<pint>;
using vpll = vector<pll>;
using setint = unordered_set<int32_t>;
using setstr = unordered_set<string>;
using qint = queue<int32_t>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    ll n;
    cin >> n;
    if (n % 2 == 0)
        cout << n << endl;
    else
        cout << n * 2 << endl;
}

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


Measured memory_bytes: 256
#include<stdio.h>
int min(int a,int b)
{
	if(a>b) return b;
	else    return a;
}
int max(int a,int b)
{
	if(a>b) return a;
	else    return b;
}
int main()
{
	int N,A,B;
	while(scanf("%d%d%d",&N,&A,&B)!=EOF)
	{
		if(N==1)
			printf("%d %d",max(A,B),max(A,B));
		else
		{
			if(A+B>N)
			{
				printf("%d %d",min(A,B),A+B-N);
			}
			else
			{
				printf("%d 0",min(A,B));
			}
		}
		printf("\n");
	}
	return 0;
}

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



int main() {
  long long n;
  cin>>n;

long long a;
  a=n*100;
  a=a/108;

long long b,g,h;
g=a*1.08;
b = a+1;
h=b*1.08;
if(n==g){
  cout<<a<<endl;
}else if(n==h){
  cout<<b<<endl;
}else{
  cout<<":("<<endl;
}
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if(a>=k)
	{
		cout<<k;
		return 0;
	}
	if(a+b>=k)
	{
		cout<<a;
		return 0;
	}
	cout<<a-(k-a-b);
	
	return 0;
}

Measured memory_bytes: 3644
n = int(input())
ls = [[int(x) for x in input().split()] for _ in range(n)]

dp = [[0]*3 for _ in range(n+1)]

for i in range(1,n+1):

    dp[i][0] = ls[i-1][0] + max(dp[i-1][1],dp[i-1][2])
    dp[i][1] = ls[i-1][1] + max(dp[i-1][0],dp[i-1][2])
    dp[i][2] = ls[i-1][2] + max(dp[i-1][0],dp[i-1][1])

print(max(dp[n]))


Measured memory_bytes: 74328
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    ll A,B,C,K;
    cin>>A>>B>>C>>K;
    while (K-- && A>=B)
    {
        B=B*2;
    }
    K++;
    while (K-- && B>=C)
    {
        C=C*2;
    }
    if(A<B && B<C)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    

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


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3736
N = int(input())
count = 0
count2  =0
for i in range(N):
  a,b= map(int,input().split())
  if a == b :
    count +=1
    if count >=3:
      count2 =1
  else:
    count =0
if count2 ==1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9192
Sd = input()
T = input()
flag = False
t = len(T)
answers = set()
if len(Sd) < t: pass
else:
    for i in range(0, len(Sd)+1-t):
        for j in range(0,t):
            if Sd[i+j] in (T[j], '?'):
                if j == t-1: flag = True
            else: break
        if flag:
            answers.add(Sd[:i].replace('?','a')+T+Sd[i+t:].replace('?','a'))
        flag = False

if answers:
    print(min(answers))
else:
    print('UNRESTORABLE')

Measured memory_bytes: 3064
n = input()
N = list(n)
m = int(n)
if len(N) <= 2:
  if m >= 10:
    print(9)
  else:
    print(m)
    
elif 3 <= len(N) <= 4:
  if m >= 1000:
    print(9 + 900)
  else:
    print(9+m-99)
elif 5 <= len(N) <= 6:
  if m >= 100000:
    print(9 + 900 + 90000)
  else:
    print(9+ 900 + m - 9999)

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

#define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <string_view>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout(a) cout << fixed << setprecision((int)(a))

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1'000'000'007;
constexpr ll MOD2   = 998'244'353;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define reps(i, n)      for(int i = 1; (i) <= (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define CtoI(c)         int((c)) - int('0')
#define ItoC(c)         char((c) + '0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/

int dp[100'005];

/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n; cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < n; ++i){
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[n - 1] << endl;

return 0;
}

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

using namespace std;

#define M 1000000007
#define pb push_back
#define f first
#define s second
#define rep(i, st, ed) for(int i=st; i<ed; i++)
#define repn(i, st, ed) for(int i=st; i<=ed; i++)
#define repb(i, ed, st) for(int i=ed; i>=st; i--)

typedef long long ll;
typedef unsigned long long int llt;
typedef long double ld;

const long double PI  =3.141592653589793238463;
const int N = 5e5 + 10;

vector<int> g[N];
bool viss[N];
int vis[N];

// Normal DFS
void dfs(int curr, int par)
{
  for(auto x: g[curr])
    if(x != par)
      dfs(x, curr);
}

// DFS with visiting status
void dfs1(int curr, int par)
{
  viss[curr] = 1;
  for(auto x: g[curr])
    if(!viss[x])
      dfs1(x, curr);
}

// DFS with strongly connected component
void dfs2(int curr, int par, int num)
{
  vis[curr] = num;
  for(auto x: g[curr])
    if(vis[x] == 0)
      dfs2(x, curr, num);
}

// XOR from 0 to n
ll fxor(ll n)
{
  if(n < 0) return 0;
  if(n % 4 == 3) return 0;
  else if(n % 4 == 0) return n;
  else if(n % 4 == 1) return n^(n-1);
  else if(n%4 == 2) return n^(n-1)^(n-2);
}

// Power in logn with mod 1000000007
llt ppow(llt x, llt y)
{
  llt res = 1;
  while(y > 0){
    if(y&1)
      res = (res * x)%M;
    y = y >> 1;
    x = (x * x)%M;
  }
  return res;
}

// Factorial with dp
llt factdp[N];
llt fact(llt x)
{
  if(x == 0) return 1;
  if(x == 1) return 1;
  if(factdp[x] != -1) return factdp[x];
  return factdp[x] = (x*fact(x-1))%M;
}

// String return to base b
string ansConv ="";
void convert10tob(llt N, int b)
{
     if (N == 0)
        return;
     int x = N % b;
     N /= b;
     if (x < 0)
        N += 1;
     convert10tob(N, b);
     ansConv += to_string(x);
     return;
}

// Convert string to num wiht base b
llt convertstrtob(string a, int b)
{
  llt aa = 0;
  llt mul = 1;
  for(int i=a.length()-1; i>=0; i--)
  {
    int curr = a[i] - '0';
    aa += (curr * mul);
    mul *= b;
  }
  return aa;
}

// Union Find algo with array
// Find()
int findpar(int curr, int arr[])
{
  while(arr[curr] != curr) curr = arr[curr];
  return curr;
}
// Union()
void Union(int b, int spa, int arr[])
{
  while(arr[b] != b)
  {
    int c = arr[b];
    arr[b] = spa;
    b = c;
  }
  arr[b] = spa;
}

// Main Code
int n;

ll findans(int arr[], int curr, int sign)
{
  ll moves = 0;
  ll sum = 0;
  rep(i, 0, n)
  {
    sum += arr[i];
    if(sum*sign <= 0)
    {
      if(sign < 0)
      {
        moves += (sum + 1);
        sum = -1;
      }
      else
      {
        moves += (1 - sum);
        sum = 1;
      }
    }
    sign = 0 - sign;
  }
  return moves;
}

int main()
{

  cin>>n;
  int arr[n];
  rep(i,0, n) cin>>arr[i];
  ll pos = findans(arr, arr[0], 1);
  ll neg = findans(arr, arr[0], -1);
  cout<<min(pos, neg)<<endl;
  return 0;
}


Measured memory_bytes: 12544
N = int(input())
AB_list = []
for i in range(N):
    AB = list(map(int, input().split()))
    AB_list.append(AB)
    
AB_list = sorted(AB_list, key=lambda x:x[1])
sum_worktime = 0
flag = True
for i in range(N):
    sum_worktime += AB_list[i][0]
    if sum_worktime > AB_list[i][1]:
        flag = False
        break

if flag == True:
    print("Yes")
else:
    print("No")

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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<typename T=int>inline T get(){
   char c=getchar(); bool neg=(c=='-');
   T res=neg?0:c-'0'; while(isdigit(c=getchar()))res=res*10+(c-'0');
   return neg?-res:res;
}
template<typename T=int>inline void put(T x,char c='\n'){
   if(x<0)putchar('-'),x*=-1; int d[20],i=0;
   do{d[i++]=x%10;}while(x/=10); while(i--)putchar('0'+d[i]);
   putchar(c);
}
//end



int main(){
   ll a,b,n; cin>>a>>b>>n;
   if(n<b){
      cout<<(a*n/b)-a*(n/b)<<endl;
   }
   else{
      cout<<(a*(b-1)/b)<<endl;
   }
   return 0;
}

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



int main()
{
	string S,n;
	int ans;
    ans=0;
	cin >> S;
	for (int i = 0; i < 4 ; i++){
		n = S.substr(i, 1);
		if (n == "+"){
			ans++;
		}
		else ans--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Array.Unboxed

main :: IO ()
main = do
  d <- getl toInt
  unless (d == 0) $ do
    n <- getl toInt
    m <- getl toInt
    ss <- replicateM (n-1) (getl toInt)
    hs <- replicateM m (getl toInt)
    print $ solve d n (0: (sort ss)) hs
    main

solve :: Int -> Int -> [Int] -> [Int] -> Int
solve d n ss = sum . map f
  where
    sa = listArray (0,n-1) ss :: Array Int Int
    dst x y = let z = abs (x - y) in min z (d - z)
    f h
      | h > sa ! (n-1) = min (dst h 0) (dst h (sa ! (n-1)))
      | otherwise = minimum $ map (dst h) $ search 0 (n-1) h
    search l r x
      | l + 1 == r = [sa ! l,sa ! r]
      | sa ! m > x = search l m x
      | otherwise = search m r x
      where
        m = (l + r) `div` 2

toInt :: String -> Int
toInt = read

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 78020
s=input()

j = 0
if int(s[0:4]) < 2019:
    j=1
elif (int(s[0:4]) == 2019) and (int(s[5:7]) <= 4):
    j=1
else:
    pass

if j==1:
    print('Heisei')
else:
    print('TBD')

Measured memory_bytes: 3064
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  var list = myconv(input[1],4);
  var count = {};
  for(var i = 0; i < N; i++){
    if(count[list[i]] == null){
       count[list[i]] = 1;
    }else{
       count[list[i]]++;
    }
  }
  var useSet = Array.from(Object.keys(count));
  useSet.sort(function(a,b){
  	return myconv(a,1) - myconv(b,1);
  });
  //優先的に食べるのは、複数回出現した数。これを小さい数値・大きい数値両端から攻めてく
  //どっちかあぶれたら不足分は他の出現数1からとって食う
  var mae = 0;
  var ato = useSet.length -1;
  while(true){
    var maeCount = count[useSet[mae]];
    if(maeCount <= 1){mae++; continue;}
    var atoCount = count[useSet[ato]];
    if(atoCount <= 1){ato--; continue;}
    if(mae >= ato){
       //処理終了
      if(maeCount >= 2){
         if(maeCount % 2 == 1){
            count[useSet[mae]] = 1;
         }else{
           count[useSet[mae]] = 0;
         }
      }
      break;
    }else{
      count[useSet[mae]]--;
      count[useSet[ato]]--;
    }
  }
  var output = 0;
  for(var i = 0; i < useSet.length; i++){
    if(count[useSet[i]] == 1){
       output++;
    }
  }
  myout(output);
}
Main(myin());


Measured memory_bytes: 33284
n, d = gets.split.map(&:to_i)
dots = []
n.times do
  dots.push(gets.split.map(&:to_i))
end

count = 0
dot_pairs = dots.combination(2).to_a
sq = []
(1..40).each do |j|
  sq << j**2
end

dot_pairs.each do |pair|
  sum = 0
  (0...d).each do |i|
    sum += (pair[0][i] - pair[1][i])**2
  end
  if Math.sqrt(sum) % 1 == 0
    count += 1
  end
end

puts count

Measured memory_bytes: 1788
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int p[200000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    memset(p, -1, sizeof(p));
    for (int i = 3; i < 200000; i+=2)
        if (p[i])
            for (int j = 3*i; j < 200000; j+=2*i)
                p[j] = 0;

    int n = gi();
    if (n == 2) {
        printf("2\n");
        return 0;
    }
    if (n%2 == 0)
        n++;

    for (int i = n; ; i+=2)
        if (p[i]) {
            printf("%d\n", i);
            break;
        }

    return 0;
}


Measured memory_bytes: 1024
// C++ program to demonstrate working of stoi() 
// Work only if compiler supports C++11 or above. 
#include <iostream> 
#include <string> 
using namespace std; 

int main() 
{ 
    float d,t,s;
    cin>>d>>t>>s;
    float tim = d/s;
    if(tim<=t)
        cout<<"Yes\n";
    else cout<<"No\n";
    return 0; 
} 



Measured memory_bytes: 3688
import java.util.Scanner;

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

		String tmp = in.nextLine();
		char[][] input = new char[3][];
		input[0] = tmp.toCharArray();
		tmp = in.nextLine();
		input[1] = tmp.toCharArray();
		tmp = in.nextLine();
		input[2] = tmp.toCharArray();

		String ans = "";
		int id = 0;
		int[] n = new int[3];
		while (true) {
			n[id] = n[id] + 1;
			if (n[0] > input[0].length) {
				ans = "A";
				break;

			}
			if (n[1] > input[1].length) {
				ans = "B";
				break;

			}
			if (n[2] > input[2].length) {
				ans = "C";
				break;
			}

			char next = input[id][n[id]-1];
			if (next == 'a') {
				id = 0;
			}
			if (next == 'b') {
				id = 1;
			}
			if (next == 'c') {
				id = 2;
			}
		}

		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

N,M = m()

data = [[0 for i in range(N)] for j in range(N)]

for i in range(M):
    a,b = m()
    a -= 1
    b -= 1
    data[a][b] += 1
    data[b][a] += 1
for i in range(N):
    print(sum(data[i]))



Measured memory_bytes: 66988