akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vecll>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define endl "\n"
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
#define MM " "
// #define INF 100000000
using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
string stin() {string s;cin>>s;return s;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}



int ans=INT_MAX;
bool f(string s,string t){
    int n=min(s.size(),t.size());
    bool flag=true;
    rep(i,n) flag&= (s[i]=='?' or t[i]=='?' or s[i]==t[i]);
    return flag;
}
void solve(string a,string b,string c){
    int A=a.size(),B=b.size(),C=c.size();
    vec ab(A+1),ac(A+1),bc(B+1);
    rep(i,A+1)ab[i] = f(a.substr(i,A-i),b);
    rep(i,A+1)ac[i] = f(a.substr(i,A-i),c);
    rep(i,B+1)bc[i] = f(b.substr(i,B-i),c);
    rep(i,A+1){
        rep2(j,i,i+max(A,B)){
            if(ab[i] and (j>A or ac[j]) and (j-i>B or bc[j-i])) chmin(ans,max({A,B+(int)i,C+(int)j}));
        }
    }
}


int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);cout<<fixed<<setprecision(15);

    string a[3];
    rep(i,3)cin>>a[i];
    sort(a,a+3);
    do{
        solve(a[0],a[1],a[2]);
    }while(next_permutation(a,a+3));
    cout << ans <<endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a[3];
	for(int i=0;i<3;i++){
		cin >> a[i];
	}
	sort(a,a+3);
	cout << a[0] << " " << a[1] << " " << a[2] << endl;
return 0;
}

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

int main() { 
    int n, ans = 0, ma = 1000000;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i) cin >> a[i];

    for(int i = 0; i < n; ++i) {
        if(a[i] <= ma) ans++;
        ma = min(a[i], ma);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
using std::swap;
int main()
{
	int a, b, k;
	int n = 0,c[100];
	cin >> a >> b >> k;
	if (a > b)swap(a, b);
	for (int i = 1; i < a + 1; ++i) {
		if (a%i == 0 && b%i == 0) { 
			c[n] = i; 
			++n;
		}
	}
	cout << c[n-k] << "\n";
	return 0;
}

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

int main(int argc, char *argv[]) {
  int n,m,wa_count=0,ac_count=0;
  cin >> n >> m;
  vector<int> ac(n),wa(n);
  for(int i=0; i<m; i++){
    int id;
    string ans;
    cin >> id >> ans;
    if(ans == "WA"){
      wa.at(id-1)++;
    }else{
      if(ac.at(id-1) == 0){
        wa_count += wa.at(id-1);
        ac.at(id-1) = 1;
        ac_count++;
      }
    }
  }
  
  cout << ac_count << ' ' << wa_count << endl;
  
}

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

using namespace std;

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

    string s, t;
    cin >> s >> t;

    int ans = 0;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == t[i]) ++ans;
    }

    cout << ans;

    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  int n,z,w;
  cin >> n >> z >> w;
  vector<ll> v(n);
  rep(i,n)cin >> v[i];
  ll res = abs(v.back()-w);
  for(int i = n-2;i >= 0;i--){
    ll res_ = 1e18;
    for(int j = i+1;j < n;j++){
      if(j != n-1)res_ = min(res_,abs(v[j]-v.back()));
      else res_ = min(res_,abs(v[i]-v[j]));
    }
    res = max(res,res_);
  }
  cout << res << endl;


  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  int sum = 0;
  
  for (int i = 0; i < N; i++)
  {
    int x;
  	cin >> x;
    if (x >= K-x) sum += 2*(K-x);
    else sum += 2*x;
  }
  cout << sum << endl;
  
}

Measured memory_bytes: 256
[n,m]=list(map(int,input().split()))
ab=[]
for i in range(n):
    ab.append(list(map(int,input().split())))
cd=[]
for i in range(m):
    cd.append(list(map(int,input().split())))
ans=[]
for i in range(n):
    kyorimin=10**9
    for j in range(m):
        kyori=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if kyorimin>kyori:
            goal=j+1
            kyorimin=kyori
    ans.append(goal)
for i in range(len(ans)):
    print(ans[i])

Measured memory_bytes: 3064
import sys
S = input()
T = "AKIHABARA"
posS = 0
posT = 0
while True:
    if posS == len(S):
        if posT >= len(T)-1:
            print("YES")
        else:
            print("NO")
        sys.exit()
    if posT >= len(T):
        print("NO")
        sys.exit()
    if S[posS] == T[posT]:
        posS += 1
        posT += 1
    elif T[posT] == 'A':
        posT += 1
    else:
        print("NO")
        sys.exit()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_
void debug_out() {cerr << endl;}
template<typename Head,typename... Tail> void debug_out(Head H,Tail... T){cerr << ' ' << H; debug_out(T...);}
#define debug(...) cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:",debug_out(__VA_ARGS__)
#define dump(x) cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << endl;
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int x; cin >> x;
    debug(x);
    cout << 1 - x << '\n';
    return 0;
}

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

int Progression(int *p) {
	int sum=0;
	while (1) {
		sum += ((*p) % 10);
		*p /= 10;
		if (*p == 0)break;
	}
	return sum;
}

int main()
{
	int N;
	int m;
	int a;
	cin >> N;
	m = N;
	a = Progression(&N);
	if (m%a == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  for (auto &v : vec)
    cin >> v;

  vector<int> pairvec(1000001, 0);
  for (auto &v : vec)
    pairvec[v] = 1;

  bool flag1 = false;
  for (int i = 2; i <= 1000000; ++i) {
    int cnt = 0;
    for (int j = i; j <= 1000000; j+=i) {
      cnt += pairvec[j];
      if (cnt == 2) {
        flag1 = true;
        break;
      }
    }
    if (flag1)
      break;
  }

  vector<int> maxvec(1000001, 0);
  for (auto &v : vec)
    ++maxvec[v];

  bool flag2 = *max_element(maxvec.begin() + 2, maxvec.end()) <= 1;


  if (!flag1 and flag2) {
    cout << "pairwise coprime" << endl;
    return EXIT_SUCCESS;
  }

  int v = vec[0];
  for (int i = 1; i < n; ++i)
    v = __gcd(v, vec[i]);

  if (v == 1)
    cout << "setwise coprime" << endl;
  else
    cout << "not coprime" << endl;
}


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

int main()
{
    int i,j,m,n;
    char a[100005];
    cin>>a;
    for(i=0;i<strlen(a);i++)
    {
        if((i+1)&1) cout<<a[i];
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 384
public class Main {
  public static void main(String[] args) {
    int k = 0;
    for (int i = 1; i < 10; i++) {
      for (int j = 1; j < 10; j++) {
        k = i * j;
        System.out.println(i + "x" + j + "=" + k);
      }
    }
  }
}

Measured memory_bytes: 16852
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
const long long mod = 1e9 + 7;
const int INF = 1 << 20;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;


int main()
{
    ll n,m; cin >> n >> m;
    ll x[m];
    for(int i = 0; i < m; i++){
        cin >> x[i];
    }
    ll fib[100005];
    fib[0] = 0;
    fib[1] = 1;
    for(int i = 2; i < 100005; i++){
        fib[i] = fib[i-1] + fib[i-2];
        fib[i] %= mod;
    }
    if(m==0){
        cout << fib[n+1];
    }else{
    ll ans = fib[x[0]];
    for(int i = 1; i < m; i++){
        ans %= mod;
        ans *= fib[x[i]-x[i-1]-1];
        ans %= mod;
    }
    ans *= fib[n-x[m-1]];
    ans %= mod;
    cout << ans;
    }
}

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

int memo[22][22]={0};

void fanc(int y,int x){
  if(y>=12 || x>=12 || y<0 || x<0 || memo[y][x]==0) return;
  if(memo[y][x]){
    memo[y][x]=0;
    fanc(y-1,x);
    fanc(y+1,x);
    fanc(y,x-1);
    fanc(y,x+1);
  }
  return ;
}

int DFS(){

  int cnt=0;
  for(int i=0;i<12;i++){
    for(int j=0;j<12;j++){
      if(memo[i][j]){
	fanc(i,j);
	cnt++;
      }
    }
  }
  return cnt;
}

int main(){
  
  int flg=1;
  while(flg){
    for(int i=0;i<12 && flg;i++){
      for(int j=0;j<12 && flg;j++){
	char c;
	if(scanf(" %c",&c) == EOF) flg=0;
	memo[i][j] = c-'0';
      }
    }
    if(flg) printf("%d\n",DFS());
  }
  return 0;
}

Measured memory_bytes: 1136
#include<iostream>
#include<string>
#include<algorithm>


using namespace std;

int main()
{
	long long N,M;
	long long answer = 0;
	cin >> N >> M;

	if (2*N <= M) {
		answer = N+ (M - 2 * N) / 4;
	}
	else {
		answer = M / 2;
	}
	
	cout << answer << endl;
	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int a = h1 * 60 + m1, b = h2 * 60 + m2;
  int c = b - a;

  cout << c - k << endl;

  return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int main() {
    ll n;
    cin >> n;
    int len = 1;
    ll k = 26;
    while (k < n) {
        n -= k;
        k *= 26;
        len++;
    }
    string ans ="";
    n -= 1;
    rep(i,len) {
        ans = (char)('a'+n%26) + ans;
        n /= 26;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<vector>

using namespace std;

#define MOD 1000000007

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

int main() {
	int a, b;
	cin >> a >> b;
	string str;
	for (int i = 0; i < b + 2; i++)
	{
		cout << "#";
	}
	cout << endl;
	for (int i = 0; i < a; i++)
	{
		cin >> str;
		cout << "#" + str + "#" << endl;
	}
	for (int i = 0; i < b + 2; i++)
	{
		cout << "#";
	}
	cout << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
l =[]
for i in range(K):
    input()
    l.extend(list(map(str,input().split())))
count = 0
for i in range(1,N+1):
             if str(i) not in l:
                     count+=1
             else:
                 pass
print(count)
   

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


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

typedef long long ll;
vector<pair<ll, int>> v;

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 0; i < n; i++){
        ll pr; 
        int am;
        scanf("%lld%d", &pr, &am);
        v.push_back({pr, am});
    }
    sort(v.begin(), v.end());
    ll ans = 0;
    int j = 0;
    while(m > 0){
        ans += min(m, v[j].se) * v[j].fi;
        m -= v[j].se;
        j++;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  int cnt=0;
  int minCnt=100000;
  
  for(int i=0;i<N;i++){
    int x;
    cin>>x;
    cnt=0;
    
    while(x%2==0){//まだ割れる//0は考えなくていい
      x/=2;
      cnt++;
    }
    if(cnt<minCnt){//割れた数最小を更新
      minCnt=cnt;
    }
  }
  cout<<minCnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

vector<int> e1[200000], e2[200000];
int par1[200000], par2[200000], visit1[200000], visit2[200000];

void dfs1(int now, int par){
    visit1[now] = 1;
    par1[now] = par;
    REP(i,e1[now].size()){
        int next = e1[now][i];
        if (visit1[next]) continue;
        dfs1(next, par);
    }
}

void dfs2(int now, int par){
    visit2[now] = 1;
    par2[now] = par;
    REP(i,e2[now].size()){
        int next = e2[now][i];
        if (visit2[next]) continue;
        dfs2(next, par);
    }
}

int main() {
    int n, k, l;
    cin >> n >> k >> l;
    REP(i,k){
        int p, q;
        scanf("%d %d", &p, &q);
        p--;
        q--;
        e1[p].push_back(q);
        e1[q].push_back(p);
    }
    REP(i,l){
        int p, q;
        scanf("%d %d", &p, &q);
        p--;
        q--;
        e2[p].push_back(q);
        e2[q].push_back(p);
    }

    REP(i,n){
        if (!visit1[i]) dfs1(i,i);
    }
    REP(i,n){
        if (!visit2[i]) dfs2(i,i);
    }

    map<pair<int, int>, int> mp;
    REP(i,n){
        mp[make_pair(par1[i], par2[i])]++;
    }

    REP(i,n){
        cout << mp[make_pair(par1[i], par2[i])] << " ";
    }
    cout << endl;

    return 0;
}

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

int main()
{
	const int n = 3;
	vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i];
	int k; cin >> k;

	int max_a = 0;
	int max_index;

	for (int i = 0; i < k; i++) {

		for (int j = 0; j < n; j++) {
			if (chmax(max_a, a[j])) max_index = j;
		}
		a[max_index] *= 2;
	
	}

	int ans = 0;
	for (int j = 0; j < n; j++) ans += a[j];

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

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int):
    ans = len(str(N))
    for i in range(1, N + 1):
        if i * i > N:
            break
        if N % i == 0:
            ans = min(ans, max(len(str(i)), len(str(N // i))))
    print(ans)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
s = input()
if len(s) <=4: 
  print('NO')
  exit()
  
if s[0] != 'A':
  s = 'A'+ s
if s[4] != 'A':
  s = s[0:4]+'A'+s[4:]
if s[6] !='A':
  s = s[0:6]+'A'+s[6:]
if s[-1] != 'A':
  s = s+'A'
if s == 'AKIHABARA':
 print('YES')
else: print('NO')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <string>

using namespace std;

double calc(int a, int t, int x){
    double calced = t - (x*0.006);
    return abs(a-calced);
}

void solve() {
    int n, t, a;
    cin >> n >> t >> a;
    int h; cin >> h;
    double minv = calc(a, t, h);
    int num = 0;

    for(int i = 1; i < n; i++){
        int tmp; cin >> tmp;
        double tmpv = calc(a,t,tmp);
        if(minv > tmpv){
            minv = tmpv;
            num = i;
        }
    }

    cout << num+1 << endl;
}

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

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

int main(){
	int x;double p;cin>>x>>p;p/=100;
	if(x%2)printf("%.12lf\n",(x/2)*(1/p)*p+(x/2+1)*(1/p)*(1-p)+1);
	else printf("%.12lf\n",(x/2)*(1/p));
}

Measured memory_bytes: 256
L=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(L[k-1])

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

int main(){
 int N,a,min,max;
 long int sum=0;
 cin >> N;
 for(int i =0; i<N;i++){
 cin >> a;
 sum += a;
 if(i == 0 || a < min) min = a;
 if(i == 0 || max < a) max = a;
 }
 cout <<min<<" "<<max<<" "<<sum<<endl;
}


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

#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define data pair<int,pii>
#define pos pii

int N, H, W, D, Q;
pos A[100010];
int cost[100010][30];

int dist(int s, int d)
{
    return abs(A[s].first - A[d].first) + abs(A[s].second - A[d].second);
}

signed main()
{
    cin >> H >> W >> D;
    rep(i, H)rep(j, W)
    {
        int a;
        cin >> a;
        A[a] = {i, j};
    }
    N = H * W;

    for(int i = 1; i <= N; i++)
    {
        if(i + D <= N)cost[i][0] = dist(i, i + D);
        else cost[i][0] = 0;
    }
    int tmp = 1;
    for(int i = 1; i < 30; i++)
    {
        for(int j = 1; j <= N; j++)
        {
            if(j + tmp * D <= N)cost[j][i] = cost[j][i - 1] + cost[j + tmp * D][i - 1];
            else cost[j][i] = cost[j][i - 1];
        }
        tmp *= 2;
    }

    cin >> Q;
    while(Q--)
    {
        int l, r;
        cin >> l >> r;
        int num = (r - l) / D;
        int ans = 0, now = l;
        rep(i, 30)
        {
            if(num & (1 << i))
            {
                ans += cost[now][i];
                now += (1 << i) * D;
            }
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 26092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
   int a,b,c,d; cin>>a>>b>>c>>d;
   while(a&&c){
       c-=b;
       if(c<=0) break;
       a-=d;
   }
   if(a>0) cout<<"Yes\n";
   else cout<<"No\n";
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(){
  int n,a[100],min,max,i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  max=a[0];
  min=a[0];
  for(i=1;i<n;i++){
    if(max<a[i]) max=a[i];
    if(min>a[i]) min=a[i];
  }
  printf("%d",max-min);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, a, b) for (int64_t i = (a); i < (b); ++i)
typedef long long ll;
const long long INF = 1LL << 60;

template <int MOD>
struct Fp {
  long long val;
  constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
    if (val < 0) val += MOD;
  }
  constexpr int getmod() { return MOD; }
  constexpr Fp operator-() const noexcept { return val ? MOD - val : 0; }
  constexpr Fp operator+(const Fp& r) const noexcept { return Fp(*this) += r; }
  constexpr Fp operator-(const Fp& r) const noexcept { return Fp(*this) -= r; }
  constexpr Fp operator*(const Fp& r) const noexcept { return Fp(*this) *= r; }
  constexpr Fp operator/(const Fp& r) const noexcept { return Fp(*this) /= r; }
  constexpr Fp& operator+=(const Fp& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  constexpr Fp& operator-=(const Fp& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr Fp& operator*=(const Fp& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  constexpr Fp& operator/=(const Fp& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  constexpr bool operator==(const Fp& r) const noexcept {
    return this->val == r.val;
  }
  constexpr bool operator!=(const Fp& r) const noexcept {
    return this->val != r.val;
  }
  friend constexpr ostream& operator<<(ostream& os, const Fp<MOD>& x) noexcept {
    return os << x.val;
  }
  friend constexpr Fp<MOD> modpow(const Fp<MOD>& a, long long n) noexcept {
    if (n == 0) return 1;
    auto t = modpow(a, n / 2);
    t = t * t;
    if (n & 1) t = t * a;
    return t;
  }
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(123);
  mint total = 1;
  for (int i = 0; i < n; i++) a[s[i]]++;

  for (int i = 97; i <= 122; i++) {
    total *= a[i] + 1;
  }
  cout << total - 1 << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	int a;
	cin>>a;
	if(a<1200)cout<<"ABC"<<endl;
	else if(a<2800)cout<<"ARC"<<endl;
	else cout<<"AGC"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
 
int main() {
  int A;
  string S;
  cin >> S;
 A = S.length();
  if (A == 2) {
    cout << S << endl;
  }
  else {
    string str = "reverse";

    reverse(S.begin(), S.end());
    cout << S << endl;
  }
}

Measured memory_bytes: 256
ABC = list(map(int,input().split()))
K = int(input())
#import numpy as np
#ABC[ABC.index(max(ABC))] = ABC[ABC.index(max(ABC))]*2*K
#print(sum(ABC))
ans = []
ABC.sort()

for i in range(K):
  ABC[-1]*=2
  
print(sum(ABC))  

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
#include<utility>

using namespace std;

int main(){

	long long int n;
	cin>>n;

	if(n%2==1){
		cout<<0<<endl;
		return 0;
	}

	long long int ans=0;

	long long int num5=1;
	for(int i=1;i<26;i++){
		num5=1;
		for(int j=1;j<=i;j++){
			num5*=5;
		}
		ans+=(n/num5)/2;

	}
	cout<<ans;

	cout<<endl;

	return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N, M, Q = na()
dp = [[0] * (N + 3) for _ in range(N + 3)]
for i in range(M):
    l, r = na()
    dp[1][r] += 1
    dp[l+1][r] -= 1
    dp[l][N+1] -= 1

for i in range(N+1):
    for j in range(N+1):
        dp[i][j+1] += dp[i][j]

for j in range(N+1):
    for i in range(N+1):
        dp[i+1][j] += dp[i][j]

for i in range(Q):
    p, q = na()
    print(dp[p][q])


Measured memory_bytes: 90280
#include <bits/stdc++.h>
using namespace std;
int solve(int h[],int s,int e,int dp[]){
	if(s==e)
	return 0;
	if(dp[s]!=-1)
	return dp[s];
	int so1=abs(h[s+1]-h[s])+solve(h,s+1,e,dp);
	if(s+2<=e){
	 int so2=abs(h[s+2]-h[s])+solve(h,s+2,e,dp);
	 so1=min(so1,so2);
	}
	dp[s]=so1;
	return so1;
}
int main() {
	int n;
	cin>>n;
	int h[n];
	for(int i=0;i<n;i++)
	cin>>h[i];
	int dp[n];
	memset(dp,-1,sizeof(dp));
	cout<<solve(h,0,n-1,dp)<<endl;
	// your code goes here
	return 0;
}

Measured memory_bytes: 10368
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
#define INF 20000000000000000
using ll = long long;

ll coutdp[101][100001]={};

int main(){
    ll N,W;
    cin >> N >> W;
    vector<ll> v(N),w(N);
    for(ll i=0;i<N;i++)    cin >> w[i] >> v[i];
    for(ll i=1;i<=N;i++){
        for(ll j=0;j<=W;j++){
            if(j>=w[i-1]){
                coutdp[i][j] = max(coutdp[i-1][j],coutdp[i-1][j-w[i-1]]+v[i-1]);
            } 
            else coutdp[i][j] = coutdp[i-1][j];
        }
    }
    cout << coutdp[N][W] << endl;
    return 0;
}

Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
main(){
  int n,k;cin >> n >> k;
  int64_t ans=k;
  for(int i=0;i<n-1;i++){
    ans*=(k-1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3644
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    read!(usize);
    let A = read![[i64]];

    let x = 1.0 / A.into_iter().map(|a| 1.0 / a as f64).sum::<f64>();

    println!("{}", x)
}


Measured memory_bytes: 4352
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define maxn 310
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
int n,m,p,f[maxn][maxn],C[maxn][maxn];
int add(int x,int y)
{
	x+=y;
	return x>=p? x-p:x;
}
int mul(int x,int y)
{
	return 1ll*x*y%p;
}
int main()
{
	read(n,m,p);
	C[0][0]=1;
	for(int i=1;i<=n+1;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=i;j++)
			C[i][j]=add(C[i-1][j],C[i-1][j-1]);
	}
	for(int i=0;i<=m;i++)
		f[1][i]=1;
	for(int i=2;i<=n+1;i++)
	{
		for(int k=1;k<i;k++)
		{
			int t=0,c=C[i-2][k-1];
			for(int j=m;j>=0;j--)
			{
				f[i][j]=add(f[i][j],mul(mul(c,t),f[i-k][j]));
				t=add(t,f[k][j]);
			}
		}
	}
	printf("%d\n",f[n+1][0]);
    return 0;
}


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

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

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

    ll n;
    cin >> n;
    vector<pair<ll,ll>> d(n);
    for (ll i = 0;i < n;i++){
        cin >> d[i].first >> d[i].second;
    }

    bool ans = false;

    for (ll i = 0; i < n-2; i++){
        if (d[i].first == d[i].second && d[i+1].first == d[i+1].second && d[i+2].first == d[i+2].second){
            ans = true;
            break;
        }
    }
    
    if (ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);
  
  string s;
  cin >> s;
  if (s == "Sunny") cout << "Cloudy" << endl;
  else if (s == "Cloudy") cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
H = [[0, []] for _ in range(N)]
tmp = list(map(int, input().split()))
H = [[i, set([])] for i in tmp]
for _ in range(M):
    a, b = map(int, input().split())
    H[a-1][1].add(b-1)
    H[b-1][1].add(a-1)
ans = 0
for h in H:
    flag = True
    for oh in h[1]:
        if h[0] <= H[oh][0]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)

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

int main(){
    int X, Y;
    cin >> X >> Y;
    bool ans_flag = false;

    for (int i = 0; i < X; i++){
        int K = 4 * X - 2 * i;
        int L = 2 * X + 2 * i;
        if (K == Y || L == Y){
            ans_flag = true;
            break;
        }
    }

    if (ans_flag){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

using namespace std;

#define endl "\n";
#define bit(x, i) (x&(1<<i))  //select the bit of position i of x
#define lowbit(x) ((x)&((x)^((x)-1))) //get the lowest bit of x; example: x=12;  1100 => 100 => 4
#define LL long long
#define ULL unsigned long long
LL inf = 1e9+7;
LL mod = 1e9+7;
#define PII pair<int, int>
#define V vector
#define VI vector<int>
#define VS vector<string>
#define ALL(x) x.begin(), x.end() //handy for function like "sort()"
#define pi 3.14159265358979323846
// set a to the maximum of a and b
#define REMAX(a,b) (a)=max((a),(b));
#define REMIN(a,b) (a)=min((a),(b));
// conversion
string removeZeros(string str) { return str.erase(0, min(str.find_first_not_of('0'), str.size()-1)); } // remove leading zeros
#define char2int(c) (c-'0')
#define int2char(i) (i+'0')
#define bin2int(bin) (bitset< 1001 >(bin).to_ulong())
#define int2bin(i) removeZeros(bitset< 1001 >( i ).to_string())
// str.erase(0, min(str.find_first_not_of('0'), str.size()-1)); // remove leading zeros

void reverseStr(string& str) { 
    int n = str.length(); 
    for (int i = 0; i < n / 2; i++) swap(str[i], str[n - i - 1]); 
} 

// works for unordered_set, unordered_map..
#define HMAP unordered_map
#define SET unordered_set
#define HAS(umap, key) (umap.find(key) != umap.end())
#define COUNTER(m, j) if (HAS(m, j)) { m[j]++; } else { m[j] = 1; }
// loop
#define FOREACH(vec, i) for (auto i = vec.begin(); i!= vec.end(); i++)
// read line
#define READ_INTS(vec, n) vector<LL> vec(n); for (LL i=0; i<n; i++) { cin >> vec[i]; }; cin.ignore();
#define READ_DOUBLES(vec, n) vector<double> vec (n); FOREACH(vec, i) { cin >> *i; }; cin.ignore();
#define READ_STRING(vec) string vec; getline(cin, vec);
#define READ_INT(i) LL i; cin >> i; cin.ignore();
// #define SPLIT_STRINGS(vec, str) istringstream iss(str); vector<string> vec((istream_iterator<string>(iss)), istream_iterator<string>());
// debug
#define dd(var) cerr << #var << "=" << (var) << " | "
#define ddv(vec) FOREACH(vec, i) { cout << *i << " "; } cout << endl;
#define ddvv(vec) for(auto& i:vec) { for(auto& j:i) { cout <<  j << " "; }; cout << endl };


void solve() {
    LL n;
    cin >> n;
    vector<double> p (n+1);
    for (LL i = 1; i <= n; i++) {
        cin >> p[i];
    }

    // dp
    // i = position, c=how many heads do we have
    // T(i, c) = T(i-1, c-1) * p[i] + T(i-1, c) * (1-p[i])

    vector<vector<double>> dp (n+1, vector<double> (n+1, 0));
    for (LL i = 0; i <= n; i++) {
        dp[i][0] = 1;
    }
    dp[0][0] = 1;
    for (LL i = 1; i <= n; i++) {
        for (LL c = 1; c <= n; c++) {
            dp[i][c] = dp[i-1][c-1] * p[i] + dp[i-1][c] * (1-p[i]);
        }
    }
    
    cout << setprecision(10) << dp[n][1 + ((n%2 == 0) ? n/2+1 : n/2)] << endl;
}   


int main()
{  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
//   READ_INT(t);
//   for (LL i = 0; i < t; i++) {
    solve();
//   }
  return 0;
}

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

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

#define roop(i, n) for(int i = 0;i < n;i++)

int main(void){

    int n;
    cin >> n;

    map<string, int> mp;

    roop(i, n){
        string s; cin >> s;
        mp[s];
    }

    cout << mp.size() << endl;

    return 0;
}


Measured memory_bytes: 19244
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <functional>
#include <numeric>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
	int N;
	cin >> N;
	int AC = 0 , WA=0, TLE=0, RE=0;
	for (int i = 0; i < N; i++) {
		string s;
		cin >> s;
		if (s == "AC") AC++;
		else if (s == "WA") WA++;
		else if (s == "TLE") TLE++;
		else RE++;
	}
	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x "<< TLE << endl;
	cout << "RE x " << RE << endl;
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<queue>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int buf;
  priority_queue<int> a;
  for(int i=0;i<n;i++){
    cin>>buf;
    a.push(buf);
  }
  int max;
  for(int i=0;i<m;i++){
    max=a.top();
    a.pop();
    max=max/2;
    a.push(max);
  }
  long long sum=0;
  while(!a.empty()){
    sum+=a.top();
    a.pop();
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <map>
#include <string>
#include <complex>
#include <vector>

using namespace std;

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

typedef complex<double> Point;

bool same2(vector<Point> const & a, vector<Point> b){
    int n = a.size(), m = b.size();
    if(n-m) return false;
    for(int i=n-1;i>=0;i--) b[i] -= b[0];
    for(int i=n-1;i>=0;i--) b[i] /= b[1];
    rep(i,n) if(abs(a[i]-b[i]) > 1e-8) return false;
    return true;
}

bool same(vector<Point> const & a, vector<Point> const & b){
    vector<Point> rb = b;
    rep(i,rb.size()/2) swap(rb[i],rb[rb.size()-i-1]);
    return same2(a,b) || same2(a,rb);
}

int main(){
    int n;
    while(cin >> n && n){
        int l;
        cin >> l;
        vector<Point> X(l);
        rep(i,l){
            int x,y;
            cin >> x >> y;
            X[i] = Point(x,y);
        }
        for(int i=l-1;i>=0;i--) X[i] -= X[0];
        for(int i=l-1;i>=0;i--) X[i] /= X[1];
        rep(i,n){
            int m;
            cin >> m;
            vector<Point> Y(m);
            rep(j,m){
                int x,y;
                cin >> x >> y;
                Y[j] = Point(x,y);
            }
            if(same(X,Y)) cout << i+1 << endl;
        }
        cout << "+++++" << endl;
    }
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,Y;
  cin>>X>>Y;
  for(int c=0;c<=X;c++){
    int t=X-c;
    int foot=c*2+t*4;
    if(foot==Y){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
     cout<<"No"<<endl;
     return 0;
}






Measured memory_bytes: 3596
#include<bits/stdc++.h>
int n,m,k,ans=0x3f3f3f3f;
char s[807][807];
int d[807][807],q[807*807][2],ql=0,qr=0;
void mins(int&a,int b){if(a>b)a=b;}
int min(int a,int b){return a<b?a:b;}
void push(int x,int y,int z){
	if(!d[x][y]&&s[x][y]=='.'&&z<=k+1){
		d[x][y]=z;
		q[++qr][0]=x;
		q[qr][1]=y;
	}
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;++i){
		scanf("%s",s[i]+1);
		for(int j=1;j<=m;++j)if(s[i][j]=='S')s[i][j]='.',push(i,j,1);
	}
	while(ql!=qr){
		int x=q[++ql][0],y=q[ql][1],z=d[x][y]+1;
		if(x>1)push(x-1,y,z);
		if(x<n)push(x+1,y,z);
		if(y>1)push(x,y-1,z);
		if(y<n)push(x,y+1,z);
		mins(ans,1+(min(min(x-1,n-x),min(y-1,m-y))+k-1)/k);
	}
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

signed main(){

	lli n;
	cin>>n;

	lli k;
	cin>>k;
	lli sum=0;

	REP(i,0,n){
		lli h;
		cin>>h;
		if(h>=k)sum++;
	}

	cout<<sum<<endl;

	return 0;
}

Measured memory_bytes: 256
def show (nums):
    for i in range(len(nums)):
        if i!=len(nums)-1:
            print(nums[i],end=' ')
        else :
            print(nums[i])
 
n=int(input())
nums=list(map(int,input().split()))
show(nums)
for i in range(1,n):
    v=nums[i]
    j=i-1
    while (j>=0 and nums[j]>v):
        nums[j+1]=nums[j]
        j-=1
    nums[j+1]=v
    show(nums)


Measured memory_bytes: 5976
import math


def GetScore(a, b, x):
    return math.floor(a*x/b)-a*math.floor(x/b)


A, B, C = map(int, input().split())
# for i in range(2*B):
#     print(math.floor(A*i/B)-A*math.floor(i/B))
if C < B:
    print(GetScore(A, B, C))
else:
    print(GetScore(A, B, B-1))


Measured memory_bytes: 9168
def this (x):
    if x>=400 and x<=599:
        return 8
    if x>=500 and x<=799:
        return 7
    if x>=800 and x<=999:
        return 6
    if x>=1000 and x<=1199:
        return 5
    if x>=1200  and x<=1399:
        return 4
    if x>=1400 and x<=1599:
        return 3
    if x>=1600 and x<=1799:
        return 2
    if x>=1800 and x<=1999:
        return 1
n=int(input())
print (this(n))

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

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

  for (int i = 0; i < 8; i++) {
    int p = pow(2, i);
    if (p > N) {
      cout << pow(2, i-1) << endl;
      break;
    }
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int Q;
    cin >> Q;
    rep(q, Q){
        ll A, B;
        cin >> A >> B;
        if(B > A) swap(A, B);
        ll ans = 0;
        if(A == 1) {
            ans = 0;
        }
        else {
            double s = (double)A * (double)B - 1.0;
            ll sq = (ll)sqrt(s);
            if((sq + 1) * (sq + 1) <= A * B - 1) sq++;
            if(sq * sq > A * B - 1) sq--;
            ans = sq * 2;
            if((A * B - 1) / sq == sq) ans--;
            if(sq < A) ans++;
            if(sq == B) ans--;
            if(sq > B) ans--;
            ans--;
        }
        output(ans);
    }
    
    
    
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int h, w;
  cin >> h >> w;
  vector< vector<int> > a( h, vector<int>(w) );
  for(int i = 0; i < h; ++i)
  {
    for(int j = 0; j < w; ++j)
    {
      cin >> a[i][j];
    }
  }

  int cnt = 0;
  vector<string> ans;
  for(int i = 0; i < h; ++i)
  {
    for(int j = 0; j < w; ++j)
    {
      if(a[i][j] & 1)
      {
        if (j < w - 1)
        {
          cnt++;
          a[i][j + 1]++;
          stringstream ss;
          ss << i + 1 << " " << j + 1 << " " << i + 1 << " " << j + 2 << endl;
          ans.emplace_back(ss.str());
        }
        else if (i < h - 1)
        {
          cnt++;
          a[i + 1][j]++;
          stringstream ss;
          ss << i + 1 << " " << j + 1 << " " << i + 2 << " " << j + 1 << endl;
          ans.emplace_back(ss.str());
        }
      }
    }
  }

  cout << cnt << endl;
  for(const auto& s : ans) cout << s;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 11956
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <map>
#include <set>
#include <vector>
#include <list>
#include <queue>
#include <sstream>
#include <cmath>
#include <functional>
#include <climits>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(s,i,n) for(int i=s;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define skip(i,n,p) for(int i=0;i<n;i+=p)
#define all(a)  (a).begin(),(a).end()
#define int64 long long
#define debug cerr << __FILE__ << ":" << __LINE__ << endl;
#define INF 2147483647

struct Init {
    Init() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
        cout << fixed;
        // setw(6) << setfill('0')
    }
} init;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {
    for(int i = 0; i < (int) v.size(); i++) {
        ostr << v[i] << (i + 1 != v.size() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const map<_K, _V>& v) {
    ostr << "{";
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << (*iter).first << ": " << (*iter).second << ", ";
    }
    ostr << "}";
    return ostr;
}

template <typename _K>
ostream& operator << (ostream& ostr, const set<_K>& v) {
    for (auto iter = v.begin(); iter != v.end(); ++iter) {
        ostr << *iter << (iter != v.end() ? " " : "");
    }
    return ostr;
}

template <typename _K, typename _V>
ostream& operator << (ostream& ostr, const pair<_K, _V>& v) {
    ostr << "(" << v.first << ", " << v.second << ")";
    return ostr;
}

int64 powmod(int64 n, int64 count, int64 mod) {
    if (count == 0) return 1;
    if (count % 2 == 0) {
        int64 t = powmod(n, count / 2, mod);
        return t * t % mod;
    }
    return n * powmod(n, count - 1, mod) % mod;
}

int64 ncr(int64 n, int64 r, int64 mod) {
    int64 a;
    if (n < r) a = min(n, r - n);
    else a = min(n - r, r);

    int64 res = 1;
    rep(i, a) {
        res = res * (n - i) % mod;
        res = res * powmod(i + 1, mod - 2, mod) % mod;
    }

    return res;
}

int main() {
    int n; cin >> n;
    string s; cin >> s;

    int ans = 0;
    rep(i, s.size()-2) {
        if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// C - Modulo Summation

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	int ans = 0;

	int a;
	for (int i=0; i<N; i++) {
		cin >> a;
		ans += a-1;
	}

	cout << ans << endl;

	return 0;
}

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

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

	int a;
	int b;
	int n;
	int total;

	cin >> a >> b;
	a--;
	n = 0;
	total = 1;
	while (total < b)
	{
		total += a;
		n++;
	}
	cout << n << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	cin >> N;

	int A[100000] = {};

	rep1(i, 100) rep1(j, 100) rep1(k, 100) {
		int tmp = i * i + j * j + k * k + i * j + j * k + i * k;

		A[tmp]++;
	}

	rep1(i, N) {
		co(A[i]);
	}


	Would you please return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<double> p(n), ans(n);
    rep(i, n){
        cin >> p.at(i);
        ans.at(i) = (p.at(i)+1)/2;
    }
    double d = 0, ma = -1;
    rep(i, n){
        if(i < k)d += ans.at(i);
        else{
            d -= ans.at(i-k);
            d += ans.at(i);
            ma = max(d, ma);
        }
    }
    cout << setprecision(15) << max(d, ma) << endl;
}

Measured memory_bytes: 6656