akhauriyash/Code-Regression huggingface dataset:
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<long double, long double>;
 
#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
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);}
 
ll pow_mod(ll a, ll b, ll mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  ll x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;



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

  ll n;
  std::cin>>n;

  std::vector<std::complex<long double>> point(n);
  rep(i,0,n){
    ll a,b;
    std::cin>>a>>b;
    point[i].real(a);
    point[i].imag(b);
  }

  std::vector<ll> per(n);
  rep(i,0,n)per[i]=i;

  long double ans=0;

  do{
    rep(i,1,n){
      ans+=std::abs(point[per[i]]-point[per[i-1]]);
    }
  }while(std::next_permutation(all(per)));

  rep(i,1,n+1)ans/=(long double)i;

  std::cout<<std::setprecision(10)<<std::fixed<<ans;

  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <numeric>
using namespace std;
typedef long long ll;

long long lcm(long long a, long long b) {
	ll r, x, tmp;

	x = a * b;

	/* 自然数 a > b を確認・入替 */
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return x / b;

}

void func_c() {
	ll A, B, C, D;
	cin >> A >> B >> C >> D;
	ll div_d = ((B / D) - ((A-1) / D));
	ll div_c = ((B / C) - ((A-1) / C));
	ll div_dc = ((B / lcm(D,C)) - ((A-1) / lcm(D,C)));
	ll div = div_d + div_c - div_dc;

	cout << (B - A+1) - div << endl;
}

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

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

using namespace std;

int main()
{
    int x1,y1,x2,y2,x3,y3,x4,y4;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << x2-(y2-y1) << " " << y2+(x2-x1) << " " << x2-(y2-y1+x2-x1) << " " << y2+(x2-x1-(y2-y1)) << endl;
    return 0;
}


Measured memory_bytes: 256
// Abhishek Katara
// Indian Institute of Information Technology, Vadodara

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
 
int main(){
	ll a, b, c;
	cin >> a >> b >> c;
	if(a == b && b == c && c == a){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
}


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

int gcd(int a, int b){
    int ans = 1;
    for(int i=1; i<=min(a,b); i++){
        if((a%i==0)&&(b%i==0)) ans = i;
    }
    return ans;
}

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

    if(C%gcd(A, B) == 0) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LL long long
#define LD long double
#define REP(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define RREP(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define int LL
#define PR(arr,a,b) REP(unique,a,b) cout<<arr[unique]<<" \n"[unique==b] 
#define V(x) int x;cin>>x
#define V2(a,b) int a,b;cin>>a>>b
#define V3(a,b,c) int a,b,c;cin>>a>>b>>c
#define SC(arr,a,b) REP(unique,a,b) cin>>arr[unique]
using namespace std;

typedef pair<int,int> PII;
typedef pair<int,PII> PIII;
typedef vector<int> VI;

const int MX = 1e6+1;
const int MOD = 1e9+7;

//void pre();


signed main()
{
   // pre();
   
    string s;
    cin>>s;

    string test = "2019/04/30";
   
    if(test.compare(s)>=0)
        cout<<"Heisei";
    else
        cout<<"TBD";

    return 0;
}

/*
void pre()
{
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  

}
*/

Measured memory_bytes: 256
import sys

def solve(a, b, c):
    if a > c > b or a < c < b:
        return 'Yes'
    return 'No'

if __name__ == '__main__':

    a, b, c = map(int, sys.stdin.readline().strip().split(" "))
    ans = solve(a, b, c)
    print ans

Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,zx,xc,pas;
map <string, long long> m;
map <string, long long>::iterator it;
string s;
int main(){
    cin>>a;
    for(i=1; i<=a; i++){
        cin>>s;
        sort(s.begin(),s.end());
        m[s]++;
    }
    for(it=m.begin(); it!=m.end(); it++){
        c=(*it).second;
        pas+=c*(c-1)/2;
    }
    cout<<pas;
    return 0;
}

Measured memory_bytes: 11136
let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  const [target, ...lines] = content.trim().split('\n');
  const words = flatten(
    lines
      .join(' ')
      .split('.')
      .map(sentence => sentence.split(' '))
  ).slice(0, -1);
  const count = words.filter(w => w.toLowerCase() === target).length;
  console.log(count);
});

const flatten = arr => arr.reduce((prev, cur) => [...prev, ...cur]);


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

int s, n, t, m, p;

bool minutes[7 * 24 * 60];

int wbits, tbits;

double ck(int start){
  int cnt = 0;
  for(int i = 0; i < m; i++, start += t){
    bool flag = true;
    for(int j = 0; j <= s; j++){
      if(!minutes[(start + j) % (7 * 24 * 60)]){
        flag = false;
        break;
      }
    }
    cnt += flag;
  }
  return( 1.0 - pow( 1.0 - 1.0/p, (double)cnt * n));
}


inline int todays(int i){
  return(i / (24 * 60));
}
inline bool totime(int i){
  int tm = i % (24 * 60) / 24;
  return(tm >= 18 || tm < 6);
}

int main(){
  string weekday, time ;
  while( cin >> s >> n >> t >> weekday >> time >> p >> m, m){
    if(weekday == "All") wbits = (1 << 7) - 1;
    else wbits = 1 ;
    if(time == "Night") tbits = 1;
    else if(time == "Day") tbits = 2;
    else tbits = 3; 

    double ans = 0.0;
    for(int i = 7 * 24 * 60 - 1; i >= 0; i--){
    
      if((wbits & (1 << i/1440)) && (tbits & (1 << ((i/360+1)%4/2)))) minutes[i] = true;
      else minutes[i] = false;
    }

    for(int i = 24 * 60 - 1; i >= 0; i--){
      ans = max( ans, ck(i));
    }
    cout << fixed << setprecision(16) << ans << endl;
  }
}

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

using namespace std;

#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int, int>

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

  int n;
  cin >> n;
  vi a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  int c = 0;
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      for (int k = j + 1; k < n; k++) {
        if (a[i] + a[j] > a[k] && a[i] != a[j] && a[j] != a[k] && a[i] != a[k])
          c++;
      }
    }
  }
  cout << c << "\n";

  return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
typedef long long ll;
using namespace std;

int main() {
    ll n, x;
    cin >> n >> x;
    ll a[100];
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a, a+n);

    ll sum=0;
    for(int i=0; i<n; i++) sum += a[i];
    if(sum==x) cout << n << endl;
    else if(sum<x) cout << n-1 << endl;
    else {
        sum=0;
        int i=0;
        for(; i<n; i++) {
            if(sum+a[i]>x) break;
            sum += a[i];
        }
        cout << i << endl;
    }
    return 0;
}


Measured memory_bytes: 256
<?php
/**
 * ABC124
 * A - Buttons
 */

fscanf(STDIN, "%d %d", $a, $b);

if ($a - $b >= 2) {
    $result = $a * 2 - 1;
} elseif ($b - $a >= 2) {
    $result = $b * 2 - 1;
} else {
    $result = $a + $b;
}
 
echo $result, PHP_EOL;


Measured memory_bytes: 4856
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <vector>
#include <climits>
#include <queue>
#include <utility>
#include <iomanip>
#include <sstream> 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template<typename T1, typename T2>
inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2>
inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
const ll MOD = 1000000007;
const ll INF = 1LL << 60;



int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> p(n);
	rep(i, n) {
		cin >> p[i];
	}

	sort(p.begin(), p.end());

	int ans = 0;
	rep(i, k) {
		ans += p[i];
	}

	cout << ans;
	
}




Measured memory_bytes: 3628
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int N = scan.nextInt();
        int K = scan.nextInt();
        int p[] = new int[N];
        for(int i = 0; i < N ; i++)
            p[i] = scan.nextInt();

        int i = 0;
        double ans = 0;
        double window = 0;
        for(i = 0; i < K; i++) {
            window += prob(p[i]);
        }

        ans = window;

        for(; i < N; i++) {
            window -= prob(p[i-K]);
            window += prob(p[i]);
            ans = Math.max(window, ans);
        }

        os.println(ans);
    }

    static double prob(int p) {
        return (double)((p+1)*p)/(double)(2*p);
    }
}

Measured memory_bytes: 80000
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int D, G;
    cin >> D >> G;
    int p[11], c[11];
    rep(i, D) cin >> p[i] >> c[i];
    int ans = INF;
    rep(bit, (1 << D)) {
        rep(i, D) {
            int score = 0;
            int cnt = 0;
            rep(j, D) {
                if (i == j) continue;
                if (bit & (1 << j)) {
                    score += p[j] * (j + 1) * 100;
                    score += c[j];
                    cnt += p[j];
                }
            }
            int tmp = p[i];
            //cout << bit << " " << score << " " << cnt << endl;
            while(score < G && tmp > 0) {
                score += (i + 1) * 100;
                tmp--;
                cnt++;
            }
            if(tmp == 0) score += c[i];
            //cout << bit << " " << score << " " << cnt << endl;
            if(score >= G) ans = min(ans, cnt);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
A,B,C,X,Y = map(int,input().split())
if A+B > 2*C:
    tot = 2*C*min(X,Y)
    if X < Y:
        tot += min(B,2*C)*(Y-X)
    else:
        tot += min(A,2*C)*(X-Y)

else:
    tot = (A+B)*min(X,Y)
    if X < Y:
        tot += min(B,2*C)*(Y-X)
    else:
        tot += min(A,2*C)*(X-Y)

print(tot)

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

const static ll MOD = (1e+9)+7;

int main(){
    string S,T;cin>>S>>T;
    for(int i = S.size()-T.size();i>-1;i--){
        bool flg = 0;
        for(int j = 0;j<T.size();j++){
            if(S[i+j] != '?' && S[i+j] != T[j]){
                flg = 1;
            }
        }
        if(flg == 0){
            //あり得るということ!!
            for(int j = 0;j<T.size();j++){
                S[i+j] = T[j];
            }
            rep(j,S.size()){
                if(S[j] == '?')S[j]='a';
            }
            cout<<S<<endl;
            return 0;
        }
    }
    cout<<"UNRESTORABLE"<<endl;
    return 0;
}

Measured memory_bytes: 256
#--TAKOYAKII FESTIVAL 2019

N = int(input())
hp = [int(i) for i in input().split()]

pure = 0
for i in range(N):
  for j in range(N):
    if(i != j):
      pure = pure + hp[i] * hp[j]
    else:
      pass

print(int(pure/2))



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

int main() {
  int x, y;
  cin >> x >> y;
  int n1[7] = {1,3,5,7,8,10,12}, n2[4] = {4,6,9,11}, n3 = 2;
  int xn = 0, yn = 0;
  if (x == n1[0]) xn = 1;
  if (x == n1[1]) xn = 1;
  if (x == n1[2]) xn = 1;
  if (x == n1[3]) xn = 1;
  if (x == n1[4]) xn = 1;
  if (x == n1[5]) xn = 1;
  if (x == n1[6]) xn = 1;
  if (x == n2[0]) xn = 2;
  if (x == n2[1]) xn = 2;
  if (x == n2[2]) xn = 2;
  if (x == n2[3]) xn = 2;
  if (x == n3) xn = 3;
  if (y == n1[0]) yn = 1;
  if (y == n1[1]) yn = 1;
  if (y == n1[2]) yn = 1;
  if (y == n1[3]) yn = 1;
  if (y == n1[4]) yn = 1;
  if (y == n1[5]) yn = 1;
  if (y == n1[6]) yn = 1;
  if (y == n2[0]) yn = 2;
  if (y == n2[1]) yn = 2;
  if (y == n2[2]) yn = 2;
  if (y == n2[3]) yn = 2;
  if (y == n3) yn = 3;
  if (xn == yn) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
while n = gets.split.map(& :to_i)
  if n[0] == 0 && n[1] == 0
    break
  end
  n[1].times do
    print "#"
  end
  puts ""
  (n[0] - 2).times do
    print "#"
    (n[1] - 2).times do
      print "." 
    end
    print "#\n"
  end
  n[1].times do
    print "#"
  end
  puts ""
  puts ""
end

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

bool judge(string & s){
  bool three=false;
  bool five=false;
  bool seven=false;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='3'){
      three=true;
    }else if(s.at(i)=='5'){
      five=true;
    }else if(s.at(i)=='7'){
      seven=true;
    }
  }
  return three&&five&&seven;
}

int main(){
  int N;
  cin >> N;
  int ans=0;
  string tfs="357";
  queue<string> que;
  que.push("3");
  que.push("5");
  que.push("7");
  string s;
  while(1){
    s=que.front();
    que.pop();
    if(s.size()>=10){
      break;
    }
    if(stoi(s)<=N){
      if(judge(s)){
        ans++;
      }
    }else{
      break;
    }
    for(auto c:tfs){
      que.push(s+c);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5500
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<58;
const ll mod=1e9+7;

vector<int> V[101010];
vector<int> E[101010];
vector<int> col(101010);
vector<int> cc(101010);
map<P,int> ma;

void dfs(int cu, int pa = -1) {
    int cnt=0;
    for(int to:E[cu]) {
        if(pa==to) continue;
        cnt++;
        if (cnt == col[cu]) cnt++;
        col[to]=cnt;
        cc[ma[P(cu,to)]]=cnt;
        dfs(to,cu);
    }
}

int main(){
  int i,j;
  int n;
  cin>>n;
  for(i=0;i<n-1;i++){
    int a,b;
    cin>>a>>b;
    a--; b--;
    E[a].pb(b);
    E[b].pb(a);
    ma[P(a,b)]=i;
  }

  col[0]=-1;
  dfs(0,-1);
  int m=0;
  for(i=0;i<n-1;i++){
    m=max(m,cc[i]);
  }
  cout<<m<<endl;
  for(i=0;i<n-1;i++) cout<<cc[i]<<endl;

}

Measured memory_bytes: 18688
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  if(A >= K){
    cout << K << endl;
  } else if (A < K && A + B >= K){
    cout << A << endl;
  } else if (A + B < K){
    cout << 2*A + B - K << endl;
  }
}
  

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

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

    int N, M;
    void Solve()
    {
        N = cin.Nextint;
        M = cin.Nextint;
        var X = cin.Scanlong;
        var Y = cin.Scanlong;
        long X_SUM = 0, Y_SUM = 0;
        long X_CNT = 0, Y_CNT = 0;
        long X_RES = 0, Y_RES = 0;
 
        for (int i = 0; i < N; i++)
        {
            X_SUM = (X_SUM + X[i]) % mod;

        }
        for (int i = 0; i < M; i++)
        {
            Y_SUM = (Y_SUM + Y[i]) % mod;
        }

        for (int i = 0; i < N - 1; i++)
        {
            X_CNT = (X_CNT + X[i]) % mod;
            X_RES = (X_RES + X_SUM - X_CNT) % mod;
            X_RES = (X_RES - (N - 1 - i) * X[i]) % mod;
        }

        for (int i = 0; i < M - 1; i++)
        {
            Y_CNT = (Y_CNT + Y[i]) % mod;
            Y_RES = (Y_RES + Y_SUM - Y_CNT) % mod;
            Y_RES = (Y_RES - (M - 1 - i) * Y[i]) % mod;
        }
        /*while (X_RES < 0)
        {
            X_RES += mod;
        }*/


        /*while (Y_RES < 0)
        {
            Y_RES += mod;
        }*/

        //WriteLine(X_RES);
        //WriteLine(Y_RES);
        WriteLine(X_RES * Y_RES % mod);
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

Measured memory_bytes: 31448
#include<bits/stdc++.h>
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define LSOne(i) (i&(-i))
#define rep(i,a,b) for(int(i)=(a);(i)<(b);i++)
#define BUG(x) {cout<<#x<<" = "<<x<<endl;}
#define left(x) (x<<1)
#define right(x) ((x<<1) +1)
#define middle(s,e)(s+(e-s)/2)
#define size_tree(n) 2*(int)pow(2,ceil(log2(n)))
#define CL(A,I) (memset(A,I,sizeof(A)))
#define endl '\n'
#define PHAS(_n) (pbits[(_n)>>5] & (1u << ((_n) & 0x1f)))
#define PSET(_n) (pbits[(_n)>>5] |= (1u << ((_n) & 0x1f)))
//unsigned int pbits[200000000/32+1];

static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const long double epsilon = 1e-15;
static const long double pi = acos((long double) -1);
using namespace std;
inline void init_io(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef long long ll;
const int MAX_N = 300001;

/*
struct data{
  int l,r,c;
  data():l(0), r(0),c(0){};
  data(int w, int i, int c_) : l(w),r(i),c(c_){};
  bool operator < (data other) const {
	if(l==other.l)
		return r<other.r;
    return l < other.l;
  }
};
*/



int arr[MAX_N];
int alph[27];

int main()
{

        int n;
        int k;
        string s;
        cin>>n>>k>>s;
s[k-1]=tolower(s[k-1]);        
        cout<<s<<endl;

        return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,a,b;
	cin>>n;
	cin>>b;
	for(int i=0;i<n-1;i++){
		cin>>a;
		int ans=a*b;
		while(true){
			if(a>b)
				a-=b;
			if(a<b)
				b-=a;
			if(a==b)
				break;
		}
		ans/=a;
		b=ans;
	}
	cout<<b<<endl;
	return 0;
}

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

using ll = long long;

constexpr int MAX_N = 1e5;
int A[MAX_N+1];
int B[MAX_N];

int main() {
  int N; cin >> N;
  for (int i{}; i < N+1; ++i) cin >> A[i];
  for (int i{}; i < N; ++i) cin >> B[i];

  ll ans{};
  for (int i{N-1}; i >= 0; --i) {
    int d = min(A[i+1], B[i]);
    ans += d;
    B[i] -= d;
    d = min(A[i], B[i]);
    ans += d;
    A[i] -= d;
  }

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


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

int main(){
    int n, x;
    cin >> n >> x;
    int a[n];
    for(int i= 0; i<n; ++i){
        cin >> a[i];
    }
    sort(a,a+n);
    int result = 0;
    for(; a[result] <= x && result < n-1; ++result){
        x -= a[result];
    }
    if(x == a[n-1]) ++result;
    cout << result << endl; return 0;
}

Measured memory_bytes: 256
n=int(input())
a,b=1,1
from math import ceil
from decimal import Decimal as D
from fractions import Fraction as F
# ans=0
for i in range(n):
    x,y=map(int,input().split())
    base= max(ceil(F(b,y)),ceil(F(a,x)))
    a= base*x ; b=base*y 
    # print(a,b)
print(a+b)


Measured memory_bytes: 10460
n, x, y = map(int, input().split())
l = [0]*(n - 1)

for i in range(1, n):
    for j in range(i + 1, n + 1):
        a = abs(j - i)
        b = abs(x - i) + abs(y - j) + 1
        d = min(a, b)
        l[d - 1] += 1

for i in l:
    print(i)

Measured memory_bytes: 3444
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue


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

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

int N; string S;
bool ani[100010];
bool greedy(bool f1, bool f2) {
	ani[0] = f1;
	ani[1] = f2;
	for (int i = 2; i < N; ++i) {
		ani[i] = ((S[i - 1] == 'o') ^ ani[i - 1]) ^ ani[i - 2];
	}
	return (ani[1] ^ ani[N - 1]) ^ (S[0] == 'o') == ani[0] && (ani[N - 2] ^ ani[0]) ^ (S[N - 1] == 'o') == ani[N - 1];
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> S;
	bool flag = false;
	for (int i = 0; i < 4; ++i) {
		if (greedy(i < 2, i % 2 < 1)) {
			flag = true;
			break;
		}
	}
	if (flag) {
		for (int i = 0; i < N; ++i) cout << (ani[i] ? 'S' : 'W');
		cout << endl;
	}
	else cout << -1 << endl;
	return 0;
}

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

string to_binString(int value, int length) {
  string h;
  if (value == 0) {
    h = "0";  
  }  
  while (value != 0) {
    if ((value & 1) == 0) {
      h.insert(h.begin(), '0');  
    }    
    else {
      h.insert(h.begin(), '1');  
    }
    value >>= 1;
  }
  // hを0詰めする
  while (length != h.size()) {
    h.insert(h.begin(), '0');  
  }
  return h;
}

int main () {
  string h;
  cin >> h;
  if (h.size() == 1) {
    cout << stoi(h) << endl;
    return 0;  
  }
  long long forloop = 1;
  for (int i = 0; i < h.size() - 1; i++) {
    forloop *= 2;  
  }
  long long ans = 0;
  for (long long i = 0; i < forloop; i++) {
    string s = to_binString(i, h.size() - 1);
    long long before = 0;
    long long sub = 0;
    for (long long j = 0; j < s.size(); j++) {
      if (s[j] == '1') {
        sub += stol(h.substr(before, j - before + 1));
        before = j + 1;     
      }  
    }
    sub += stol(h.substr(before, h.size() - before));
    ans = ans + sub;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque

H,W = map(int,input().split())
c =[]
c.append(['#' for _ in range(W+2)])
ans = [[0 for _ in range(W+2)]for _ in range(H+2)]
score = 0
for i in range(H):
    tmp = list('#'+input()+'#')
    c.append(tmp)
    for j in range(W+2):
        if tmp[j] == '.':
            score += 1

c.append(['#' for _ in range(W+2)])
q = deque()

def bfs(x,y):
    q.append([x,y])
    while q:
        x,y = q.popleft()
        if [x,y] == [W,H]:
            return ans[H][W]
        if c[y][x-1] == '.':
            q.append([x-1,y])
            ans[y][x-1] = ans[y][x] + 1
            c[y][x-1] = '#'
        if c[y][x+1] == '.':
            q.append([x+1,y])
            ans[y][x+1] = ans[y][x] + 1
            c[y][x+1] = '#'
        if c[y-1][x] == '.':
            q.append([x,y-1])
            ans[y-1][x] = ans[y][x] + 1
            c[y-1][x] = '#'
        if c[y+1][x] == '.':
            q.append([x,y+1])
            ans[y+1][x] = ans[y][x] + 1
            c[y+1][x] = '#'
    return -1

tmp = bfs(1,1)
if tmp == -1:
    print(-1)
else:
    print(score - tmp - 1)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define MOD             1000000007
#define INF             1e18
#define endl "\n"
#define lli long long int


void radib()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
}
int main(){
	radib();
	lli x;
	cin>>x;
	lli amount=100;
	lli count=0;
	while(amount<x && amount>0){
		amount+=floor(amount/100);
		count++;
	}
	cout<<count;
}

Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	if (a>b) printf("safe\n");else printf("unsafe\n");
return 0;	
}

Measured memory_bytes: 3764
import math
a,b,x = map(int,input().split())

if x >= (a * a * b) / 2:
    S = (a * a * b - x) / a
    print(math.degrees(math.atan(S * 2 / (a * a))))
else:
    S = x  / a
    print(math.degrees(math.atan(b * b / (2 * S))))


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


using namespace std;

int main(){

  int x;
  cin>>x;

    if(x>1799 && x<=1999) cout<<"1"<<endl;

    else if(x>1599 && x<=1799) cout<<"2"<<endl;

    else if(x>1399 && x<=1599) cout<<"3"<<endl;

    else if(x>1199 && x<=1399) cout<<"4"<<endl;

    else if(x>999 && x<=1199) cout<<"5"<<endl;

    else if(x>799 && x<=999) cout<<"6"<<endl;

    else if(x>599 && x<=799) cout<<"7"<<endl;

    else if(x>399 && x<=599) cout<<"8"<<endl;





  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
using namespace std;
#define N 262145
#define mod 998244353
inline int M(int x){return (x>=mod)?(x-mod):x;}
inline int M1(int x){return (x<0)?(x+mod):x;}
inline int ksm(int p,int k){int res=1;while(k){if(k&1)res=1ll*res*p%mod;k>>=1;p=1ll*p*p%mod;}return res;}
struct num{
	int a,b;
	inline num(int aa=0,int bb=0){a=aa;b=bb;}
	inline num operator+(const num &y)const{return num(M(a+y.a),M(b+y.b));}
	inline num operator-(const num &y)const{return num(M1(a-y.a),M1(b-y.b));}
	inline num operator*(const int &y)const{return num(1ll*a*y%mod,1ll*b*y%mod);}
}f[N];
inline void FWT(int f[],int len)
{
	int i,j,x,y;
	for(j=1;j<len;j<<=1)
	for(i=0;i<len;i++)if(i&j){x=f[i^j];y=f[i];f[i^j]=M(x+y);f[i]=M1(x-y);}
}
inline void IFWT(num f[],int len)
{
	int i,j,iv;num x,y;
	for(j=1;j<len;j<<=1)
	for(i=0;i<len;i++)if(i&j){x=f[i^j];y=f[i];f[i^j]=x+y;f[i]=x-y;}iv=ksm(len,mod-2);
	for(i=0;i<len;i++)f[i]=f[i]*iv;
}
int n,len,A[N],all=0,X,ans;
int main(){
	scanf("%d",&n);len=1<<n;int i;
	for(i=0;i<len;i++)scanf("%d",&A[i]),all=M(all+A[i]);all=ksm(all,mod-2);
	for(i=0;i<len;i++)A[i]=1ll*A[i]*all%mod;A[0]=M1(A[0]-1);FWT(A,len);
	for(i=1;i<len;i++)f[i].b=1ll*len*ksm(A[i],mod-2)%mod;f[0].a=1;IFWT(f,len);
	X=1ll*M1(-f[0].b)*ksm(f[0].a,mod-2)%mod;
	for(i=0;i<len;i++)ans=(1ll*f[i].a*X+f[i].b)%mod,printf("%d\n",ans);return 0;
}

Measured memory_bytes: 6148
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
using namespace std;
char a[10050];
int main(){
	scanf("%s",a+1);
	if(a[1]!=a[2]&&a[2]!=a[3]&&a[1]!=a[3]) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int n;
  double s = 0;
  cin >> n;
  double a[n];
  for(int i = 0;i < n;i++) cin >> a[i];
  for(int i = 0;i < n;i++) s += 1/a[i];
  cout << setprecision(10) << 1/s << endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
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; }
const long long INF = 1LL << 60;
const int INT_INF = 1LL << 30;

int main(){
  ll N, M;
  cin >> N >> M;
  vll A(N), B(M), C(M);
  priority_queue<Pll> que;
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
    que.push(Pll(A.at(i), 1));
  }
  for(int i = 0; i < M; i++){
    cin >> B.at(i) >> C.at(i);
    que.push(Pll(C.at(i), B.at(i)));
  }
  ll counter = 0;
  ll ans = 0;
  while(true){
    if(counter + que.top().second < N){
      counter += que.top().second;
      ans += que.top().first * que.top().second;
    }
    else{
      ans += (N-counter) * que.top().first;
      break;
    }
    que.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 8816
line = input().split(" ")
#展望台の個数
N = int(line[0])
#道の個数
M = int(line[1])

isnum = [True] * N

h_list = input().split(" ")
count = 0
for i in range (M):
  a = input().split(" ")
  if int(h_list[int(a[0])-1]) == int(h_list[int(a[1])-1]):
    isnum[int(a[0]) - 1] = False
    isnum[int(a[1]) - 1] = False
    continue
  elif int(h_list[int(a[0])-1]) < int(h_list[int(a[1])-1]):
    isnum[int(a[0]) - 1] = False
  elif int(h_list[int(a[0])-1]) > int(h_list[int(a[1])-1]):
    isnum[int(a[1]) - 1] = False
n = sum(x==True for x in isnum)
print(n)

Measured memory_bytes: 17788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll fact[200001];
ll finv[200001];
ll mod = 1e9+7;

ll mpow(ll a, ll b) {
    ll ret = 1;
    while (b > 0) {
        if (b&1) ret = ret * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return ret;
}

ll c(ll n, ll k) {
    return fact[n] * finv[n-k] % mod * finv[k] % mod;    
}

int main() {
    int h, w, a, b; cin >> h >> w >> a >> b;
    fact[0] = fact[1] = 1;
    for (int i = 2; i <= h+w; i++) fact[i] = fact[i-1] * i % mod;
    finv[h+w] = mpow(fact[h+w], mod-2);
    for (int i = h+w-1; i >= 0; i--) finv[i] = finv[i+1] * (i+1) % mod;
    ll ans = 0;
    for (int i = b; i < w; i++) {
        ans = (ans + c(h-a-1+i, i) * c(a-1+w-i-1,w-i-1) % mod) % mod;
    }
    cout << ans << endl;
    return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)
int cum_w[2 * pow10(5)];

void solve()
{
    int N;
    cin >> N;
    string S;
    cin >> S;

    REP0 (i, N)
    {
        cum_w[i] = (S[i] == '.');
        if (i != 0)
            cum_w[i] += cum_w[i - 1];
        // cout << cum_w[i] << endl;
    }

    // 全部 blackに変える
    int ans = cum_w[N - 1];

    // i番目までを white にする
    REP0 (i, N)
    {
        int to_w = (i + 1) - cum_w[i];
        int to_b = cum_w[N - 1] - cum_w[i];
        ans = min(ans, to_w + to_b);
    }
    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


Measured memory_bytes: 1300
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    
    prod = 1
    for a in A:
        prod *= a
        if prod > 10**18:
            print(-1)
            return
    print(prod)
    
main ()

Measured memory_bytes: 21600
#include <bits/stdc++.h>
	  #define endl "\n"
	  #define ll long long int
	  #define mod 1000000007
	  #define inf 1000000000000000001;
	  using namespace std;
	  int main()
	  {
	    //  #ifndef ONLINE_JUDGE
	    //  // for getting input from input.txt
	    //  freopen("input.txt", "r", stdin);
	    //  // for writing output to output.txt
	    //  freopen("output.txt", "w", stdout);
	    // #endif
	    std::ios::sync_with_stdio(false);
	    cin.tie(NULL);
	    int n,k,sum=0;
	    cin>>n>>k;
	    std::vector<int> v(n,0);
	    for (int i = 0; i < n; ++i)
	    {
	    	/* code */
	    	cin>>v[i];
	    }
	    sort(v.begin(), v.end());
	    for (int i = 0; i < k; ++i)
	    {
	    	sum = sum + v[i];
	    }
	    cout<<sum<<endl;
	    return 0;
	  }


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

using namespace std;

const int max_n = 100111, inf = 1000111222;

int n, m;
string a, b;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m >> a >> b;
    long long len = n / __gcd(n, m);
    len *= m;
    vector<long long> v1, v2;
    for (int i = 0; i < n; ++i) {
        v1.push_back((len / n) * i);
    }
    for (int i = 0; i < m; ++i) {
        v2.push_back((len / m) * i);
    }
    int pos1 = 0, pos2 = 0;
    while (pos1 < v1.size() && pos2 < v2.size()) {
        if (v1[pos1] == v2[pos2]) {
            if (a[pos1] != b[pos2]) {
                cout << -1 << "\n";
                return 0;
            }
            ++pos1;
            ++pos2;
        } else if (v1[pos1] < v2[pos2]) {
            ++pos1;
        } else {
            ++pos2;
        }
    }
    cout << len << "\n";
    return 0;
}


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

int main(){
    ll n,a,b;
    cin>>n>>a>>b;

    if((b-a)%2==0){
        cout<<(b-a)/2<<"\n";
        return 0;
    }
    else{
        cout<<min(a-1,n-b)+1+(b-a-1)/2<<"\n";
        return 0;
    }
}

Measured memory_bytes: 3624
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf
# @pysnooper.snoop()
#import pysnooper # debug

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    a, b = list(input().split())
    a = int(a)
    b = int(b.replace('.', ''))
    ans = a * b
    if ans < 100:
        print(0)
    else:
        print(str(ans)[:-2])

    #print('\33[32m' + 'end' + '\033[0m') # debug


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
constexpr int DX[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int sgn(int x) { return (x > 0) - (x < 0); }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    int X;
    cin >> X;
    if (X >= 30) { cout << "Yes" << endl; }
    else { cout << "No" << endl; }

}

Measured memory_bytes: 3632
#include <stdio.h>
int gcd(int ,int);
int main(void){
    int a,b,x,r;
    long int i;
    while(scanf("%d %d",&a,&b)!=EOF){
        if(a<b){
            x=a;
            a=b;
            b=x;
        }
        i=(long)a*b;
        r=gcd(a,b);
        printf("%d %ld\n",r,i/(long)r);
        
    }
    return 0;
}

int gcd(int a,int b){
    int x=1;
    while(x!=0){
        x=a%b;
        a=b;
        b=x;
    }
    return a;
}


Measured memory_bytes: 2036
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <math.h>
#include <queue>
#include <map>
#include <set>
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;


int main(){
  long long N,A,B,C,D,E,minimum,tmp;
  cin>>N>>A>>B>>C>>D>>E;
  minimum=A;
  if(minimum>B){
    minimum=B;
  }
  if(minimum>C){
    minimum=C;
  }
  if(minimum>D){
    minimum=D;
  }
  if(minimum>E){
    minimum=E;
  }
  //律速の計算
  if(N%minimum==0){
    cout<<4+N/minimum<<"\n";
  }
  else{
    cout<<5+N/minimum<<"\n";
  }
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(x,n) for(int i=x;i<n;i++)
#define REP(y,n) for(int j=y;j<n;j++)
#define vi vector<int>
#define vvi vector<vector<int>>
signed main(){
  int n,m,l,count=0;
  cin>>n>>m>>l;
  int A[n][m],B[m][l];
  rep(0,n)REP(0,m)cin>>A[i][j];
  rep(0,m)REP(0,l)cin>>B[i][j];
  rep(0,n){
    REP(0,l){
      for(int k=0;k<m;k++){
        count+=A[i][k]*B[k][j];
      }
      cout<<count;
      if(j!=l-1)cout<<' ';
      count=0;
    }
    cout<<endl;
  }
}



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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    string s;
    cin>>s;
    if(s=="ABC")
    {
        cout<<"ARC"<<endl;
    }
    else 
    {
        cout<<"ABC"<<endl;
    }
    
    return 0;
}

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

int main()
{
     string s;
    cin >> s;
    int cnta = 0 , cntb = 0 , cntc = 0;
    int sz = s.size();
    for(int i = 0 ; i < sz ; i++)
    {
        if(s[i] == 'a')
        {
            cnta++;
        }
        if(s[i] == 'b')
        {
            cntb++;
        }
        if(s[i] == 'c')
        {
            cntc++;
        }
    }
    if(cnta > 0 && cntb > 0 && cntc > 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  int N, K;
  int a=1;
  cin >> N >> K;
  for (int i=0; i<N; i++){
    if(a*2 < a+K){
      a *= 2;
    }
    else{
      a += K;
    }
  }
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 384
import heapq

def main():
    n,k = map(int,input().split())
    tree_heights = []

    for i in range(n):
        tree_heights.append(int(input()))
    tree_heights.sort()
    #print(tree_heights)

    mn = 1000000000000000000000000000000
    for i in range(n-k+1):
        #print(i,abs(tree_heights[i]-tree_heights[i+k-1]))
        mn = min(abs(tree_heights[i]-tree_heights[i+k-1]),mn)
    print(mn)

    #print(tree_heights)
    #print(tree_diffs)
    #print(sum(tree_diffs[0:k]))





if __name__ == '__main__':
    main()


Measured memory_bytes: 7556
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}

int main(void){
	int n=in(),a,f[100010]={},i,ans=0;
	rep(i,n){
		a=in();
		if(a)f[a-1]++;
		f[a]++;
		f[a+1]++;
	}
	rep(i,100002)ans=max(ans,f[i]);
	print(ans);
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main(){
	int n,q;
	int input;
	int a[10000];
	int counter=0;

	cin >> n;
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	cin >> q;
	for(int i=1;i<=q;i++){
		cin >> input;
		for(int j=0;j<n;j++){
			if(input == a[j]){
				counter++;
				break;
			}
		}
	}
	cout << counter << endl;
	return 0;
}


Measured memory_bytes: 3128
n,k=map(int,input().split())
h=[]
for i in range(n):
    h1=int(input())
    h.append(h1)
h.sort()
s=10000000000
for i in range(n-k+1):
    if s>h[i+k-1]-h[i]:
        s=h[i+k-1]-h[i]
print(s)

Measured memory_bytes: 80944
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll A[200000] = {1};
ll pow_mod(ll a, ll b) {
    if (b == 0) return 1;
    ll k = pow_mod(a, b/2);
    k = (k*k) % mod;
    if (b % 2 == 0) return k;
    return (a*k) % mod;
}
ll nCm(ll n, ll m) {
    ll X = A[n], Y = (A[m]*A[n-m]) % mod;
    return (X*pow_mod(Y, mod-2)) % mod;
}
int main() {
    for (int i = 1; i < 200000; i++) A[i] = (A[i-1]*i) % mod;
    ll N, M;
    cin >> N >> M;
    ll ans = 1;
    for (int i = 2; i <= 100000; i++) {
        int k = 0;
        while (M % i == 0) {
            M /= i;
            k++;
        }
        ans *= nCm(N-1 + k, k);
        ans %= mod;
    }
    if (M != 1) {
        ans *= N;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5168
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D: XOR World
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

ll f(ll n) {
  ll bits = 0;
  for (ll b0 = 1, b1 = 2; b0 < n; b0 <<= 1, b1 <<= 1) {
    ll r = n % b1;
    ll k = n / b1 * b0 + ((r > b0) ? r - b0 : 0);
    if (k & 1) bits |= b0;
  }
  return bits;
}

/* main */

int main() {
  ll a, b;
  scanf("%lld%lld", &a, &b);
  b++;

  printf("%lld\n", f(a) ^ f(b));
  return 0;
}


Measured memory_bytes: 256
x1, y1, x2, y2 = [int(i) for i in input().split()]

x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)

x4 = x1 - (y2 - y1)
y4 = y1 + (x2 - x1)

print(x3, y3, x4, y4)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int N,M;cin>>N>>M;
  int Y=0;
  Y=pow(2,M)*(100*(N-M)+1900*M);
  P(Y);
  return 0;
}


Measured memory_bytes: 256