akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,int>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    int n,q; cin >> n >> q;
    vector<T> rw(n);
    rep(i,n){
        int a,b,c; cin >> a >> b >> c;
        rw[i]=T(c,a,b);
    }
    sort(all(rw));
    map<int,int> index;

    vector<int> t(q+2);
    t[0]=-INF;
    t[q+1]=INF;
    rep(i,q){
        cin >> t[i+1];
        index[t[i+1]]=i;
    }

    vector<int> ans(q,-1);

    rep(i,n){
        int a,b,c;
        tie(a,b,c)=rw[i];
        b-=a;
        c=c-a;
        int left,right;
        int l,r;
        l=0;
        r=t.size()-1;
        while(r!=l){
            int cen=(r+l)/2;
            if(t[cen]>=b) r=cen;
            else l=cen+1;
        }
        left=l;
        l=0;
        r=t.size()-1;
        while(r!=l){
            int cen=(r+l)/2;
            if(t[cen]>=c) r=cen;
            else l=cen+1;
        }
        right=l-1;
        for(int j=left; j<=right; j++){
            ans[index[t[j]]]=a;
        }
        while(right-left+1>0){
            t.erase(t.begin()+left);
            right--;
        }
    }

    rep(i,q) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 16464
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
	string s;
	cin >> s;
	s[3]='8';
	cout << s;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

struct edge{ll from,to,cost;};
struct graph{
    ll V; //1番でかい頂点番号+1
    vector<edge> es; //辺
    vector<ll> d; //最短距離
 
    graph(ll n){
        init(n);
    }
 
    void init(ll n){ //n:頂点数
        V=n+1; //1-origin
        d.resize(V);
        rep1(i,V-1) d[i]=INF; //1~n
    }
 
    void add_edge(ll from,ll to,ll cost){
        edge e;
        e.from=from;
        e.to=to;
        e.cost=cost;
 
        es.pb(e);
    }
 
    bool bellman_ford(ll s){//O(|V||E|)
        bool loop=false;
        rep1(i,V-1) d[i]=INF;
        d[s]=0;
        
        rep1(i,(V-1)*2){
            bool update=false;
            rep(j,sz(es)){
                edge e=es[j];
                if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost){
                    d[e.to]=d[e.from]+e.cost;
                    if(i>=V-1){
                        d[e.to]=-INF;
                        loop=true;
                    }
 
                    update=true;
                }
            }
            if(!update) break;
        }
 
        if(loop) return true;
        else return false;
    }
};
/*
 bool(BellmanFord)がtrue:負閉路あり
                    false:負閉路なし
 graph.d[目的地]が-INF:目的地に関与する負の閉路あり
 */

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N,M; cin>>N>>M;
    graph G(N);
    rep(i,M){
        ll A,B,C; cin>>A>>B>>C;
        G.add_edge(A,B,-C);
    }
    G.bellman_ford(1);
    
    if(G.d[N]==-INF) cout<<"inf";
    else cout<<-G.d[N];
}



Measured memory_bytes: 3648
// ITP1_4_C Simple Calculator
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 
int main() {
  
  // 初期値
  int a, b;
  char op;
  
  // メインループ
  while(1) {
  	cin >> a >> op >> b;
    if (op == '?'){
  	  break;
  	} else if (op == '+') {
      cout << a + b << endl;
    } else if (op == '-') {
      cout << a - b << endl;
    } else if (op == '*') {
      cout << a * b << endl;
    } else if (op == '/') {
      cout << a / b << endl;
    }
  }
  return 0;
}



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

class UnionFind {
public:
  vector<ll> par,siz;
  UnionFind(ll sz_) : par(sz_), siz(sz_,1) {
    for(int i=0; i<sz_; ++i) par[i]=i;
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.assign(sz_,1);
    for(ll i=0; i<sz_; ++i) par[i]=i;
  }

  ll root(ll x) {
    while(x!=par[x]) {
      x = par[x] = par[par[x]];
    }
    return x;
  }

  void merge(ll x, ll y) {
    x = root(x);
    y = root(y);
    if(x!=y) {
      if(siz[x]<siz[y]) swap(x,y);
      siz[x]+=siz[y];
      par[y]=x;
    }
  }

  bool issame(ll x, ll y) {
    return root(x) == root(y);
  }

  ll size(ll x) {
    return siz[root(x)];
  }
};

int main() {
  int N, M; cin >> N >> M;
  vector<pair<ll, ll>> edges(M);
  UnionFind graph(N);
  for(int i=0; i<M; ++i) {
    ll a,b; cin>>a>>b;
    a--; b--;
    edges[i] = {a,b};
  }
  int cnt=0;
  for(int i=0; i<M; i++) {
    graph.init(N);
    for(int j=0; j<M; j++) {
      if(i==j) continue;
      graph.merge(edges[j].first, edges[j].second);
    }
    if(graph.size(0)!=N) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3608
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

int memo(int x, vector<vector<int>> &edges, vector<int> &path_length) {
	if (path_length[x] != -1) {
		return path_length[x];
	}
	int maxx = -1;
	for (auto to : edges[x]) {
		maxx = max(maxx, memo(to, edges, path_length));
	}
	return (path_length[x] = maxx + 1);
}


int main()
{
	int n, m;
	cin >> n >> m;
	vector<vector<int>> edges(n);
	for (int i = 0; i < m; i++)
	{
		int x, y;
		cin >> x >> y;
		x--, y--;
		edges[x].push_back(y);
	}

	int maxx = 0;
	vector<int> path_length(n, -1);
	for (int i = 0; i < n; i++) {
		maxx = max(maxx, memo(i, edges, path_length));
	}
	
	cout << maxx << endl;


	return 0;
}

Measured memory_bytes: 8832
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    A, B = MAP()
    lcm_base = lambda x, y: (x * y) // gcd(x, y)
    lcm = lambda *number: reduce(lcm_base, number, 1)
    print(lcm(A, B))


if __name__ == '__main__':
        main()

Measured memory_bytes: 63980
#include<stdio.h>

int main(){
	int i,min_i,min=10001,max_i,max=0,io[3];
	scanf("%d %d %d",&io[0],&io[1],&io[2]);
	for(i=0;i<3;i++){
		if(io[i]<=min){
			min=io[i];
			min_i=i;
		}
	}
	for(i=0;i<3;i++){
		if(io[i]>=max){
			max=io[i];
			max_i=i;
		}
	}
	printf("%d %d %d\n", min, (min_i+max_i==1) ? io[2] : (min_i+max_i==2) ? io[1]:io[0], max);
    return 0;
}

Measured memory_bytes: 596
#include <cstdio>
int n, k, s[100], b[100];
int main() {
    while (scanf("%d%d",&n,&k)) {
        if (!n&&!k) break;
        for (int i=0; i<k; i++) {
            scanf("%d",&s[i]);
            b[i]=0;
        }
        for (int i=0; i<n; i++) for (int j=0; j<k; j++) {
            int x; scanf("%d",&x);
            b[j]+=x;
        }
        bool flag=true;
        for (int i=0; i<k; i++) if (s[i]<b[i]) flag=false;
        if (flag) puts("Yes");
        else puts("No");
    }
}

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

// ====================================================================

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];

  // Grundy数的なやつ
  vector<bool> dp(k + 1);
  for (int i = 0; i <= k; i++) {
    if (dp[i]) continue;
    for (int j = 0; j < n; j++) {
      if (i + v[j] > k) continue;
      dp[i + v[j]] = true;
    }
  }

  cout << ((dp[k]) ? "First" : "Second") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char** argv)
{
  int r,d,x;
  scanf("%d %d %d", &r, &d, &x);
  
  for(int i=0;i<10;++i){
    x = r * x - d;
    printf("%d\n", x);
  }
  return 0;
}


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

int N, ans;
multiset<int> S;

int main(){
    int a;
    scanf("%d", &N);
    for (int i=1; i<=N; i++) {
        scanf("%d", &a);
        S.insert(a);
    }
    while (!S.empty()){
        int t = *(--S.end()), k;
        S.erase(--S.end());
        for (k=1; k<=t; k<<=1);
        if (S.find(k-t) != S.end()){
            ans++;
            S.erase(S.find(k-t));
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

int main(){
    int n;
    cin>>n;
    string success = "No";
    for (int i=0;i<=n/7;i++){
        if ((n - 7 * i) % 4 == 0){
            success = "Yes";
            break;
        }
    }
    cout<<success<<endl;
    return 0;
}


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


void solve(long long K){
    int a[] = {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};
    printf("%d\n",a[K-1]);

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m;
long long inv[500010];
long long qpow(long long a,long long b){
	long long ans=1,base=a;
	while(b){
		if(b&1){
			ans*=base;
			ans%=998244353;
		}
		base*=base;
		base%=998244353;
		b>>=1;
	}
	return ans;
}
long long cn[500010];
long long cm[500010];
long long ans;
long long jc[500010];
long long m_[500010];
long long n_[500010];
int main(){
	cin>>n>>m;
	inv[1]=1;
	for(long long i=2;i<=max(n,m);i++){
		inv[i]=(998244353ll-998244353ll/i)*inv[998244353ll%i]%998244353ll;
	}
	jc[0]=jc[1]=1;
	for(long long i=2;i<=max(n,m);i++){
		jc[i]=jc[i-1]*i%998244353ll;
	}
	cn[0]=1;
	for(long long i=0;i<n;i++){
		cn[i+1]=cn[i]*(n-i)%998244353ll*inv[i+1]%998244353ll;
	}
	cm[0]=1;
	for(long long i=0;i<m;i++){
		cm[i+1]=cm[i]*(m-i)%998244353ll*inv[i+1]%998244353ll;
	}
	m_[0]=n_[0]=1;
	for(long long i=1;i<=max(m,n);i++){
		m_[i]=m_[i-1]*(m+1)%998244353ll;
		n_[i]=n_[i-1]*(n+1)%998244353ll;
	}
	for(long long i=0;i<=min(n,m);i++){
		long long s=cn[i]*cm[i]%998244353ll*jc[i]%998244353ll*m_[n-i]%998244353ll*n_[m-i]%998244353ll;
		ans=i&1?(ans-s):(ans+s);
		ans=(ans%998244353ll+998244353ll)%998244353ll;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 27064
import math
import sys
sys.setrecursionlimit(10 ** 6 + 10)
from collections import defaultdict




def main():
    num_switch, num_ligh = map(int, input().split())

    ligh_data = [list(map(int, input().split())) for i in range(num_ligh)]
    # print(ligh_data)
    for i in range(num_ligh):
        ligh_data[i] = ligh_data[i][1:]

    flg_data = list(map(int, input().split()))

    ans = 0

    for i in range(2 ** num_switch):
        data = list(map(int, list(bin(i)[2:])))
        data = [0 for i in range(num_switch - len(data))] + data

        flg = 1

        for j in range(num_ligh):
            kari = 0
            # print(ligh_data)
            for ele in ligh_data[j]:

                kari += data[ele - 1]
            if kari % 2 != flg_data[j]:
                flg = 0
                break

        if flg:
            ans += 1

    print(ans)




if __name__ == '__main__':
    main()


Measured memory_bytes: 42716
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pair<int,int> > vpii; typedef long long ll;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	string S;
	cin >> S;
	int x = 0;
	string ans;
	rep(i, S.size()) {
		if(S[i] == "AZ"[x % 2]) {
			++ x;
			ans += S[i];
		}
	}
	if(!ans.empty() && ans[x-1] == 'A')
		ans = ans.substr(0, ans.size() - 1);
	if(ans.empty()) {
		puts("-1");
	}else {
		puts(ans.c_str());
	}
	return 0;
}

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

using namespace std;


int main(){
    
    int N;
    cin >> N;
    vector<int> C(N-1), S(N-1), F(N-1);
    
    for (int i = 0; i < N-1; i++) {
        cin >> C[i] >> S[i] >> F[i];
    }
    
    for (int i = 0; i < N; i++) {
        
        int t = 0;
        
        for (int j = i; j < N-1; j++) {
            
            if (t < S[j]) {
                t = S[j];
                t += C[j];
            }else{
                
                if (t % F[j] == 0) {
                    t += C[j];
                }else{
                    int a = t%F[j];
                    t = t-a+F[j];
                    t += C[j];
                    
                }
                
            }
        }
        
        
        
        cout << t << endl;
    }
    
    
    
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;

  int ans = 0;
  ans += (x == 3 ? 1e5 : x == 2 ? 2e5 : x == 1 ? 3e5 : 0);
  ans += (y == 3 ? 1e5 : y == 2 ? 2e5 : y == 1 ? 3e5 : 0);
  ans += (x == 1 && y == 1 ? 4e5 : 0);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int q,x,k;
int r[N];
struct node
{
	int a,t,op,y;
	friend bool operator < (const node &aa,const node &bb)
	{
		return aa.t<bb.t;
	}
}p[N*2];
int ans[N];
int main()
{
	scanf("%d%d",&x,&k);
	for(int i=1;i<=k;i++)scanf("%d",&r[i]),p[i].t=r[i],p[i].op=1;
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	{
		p[i+k].op=2;p[i+k].y=i;
		scanf("%d%d",&p[i+k].t,&p[i+k].a);
	}
	sort(p+1,p+q+k+1);
	int t1=x,t2=0,ts=0;
	int now=1;
	for(int i=1;i<=k+q;i++)
	{
		if(now==1)
		{
			t1-=p[i].t-p[i-1].t;
			t2-=p[i].t-p[i-1].t;
			if(t1<0)t1=0;
			if(t2<0)t2=0;
		}
		else 
		{
			t1+=p[i].t-p[i-1].t;
			t2+=p[i].t-p[i-1].t;
			if(t1>x)ts+=t1-x,t1=x;
			if(t2>x)t2=x;
			if(ts>x)ts=x;
		}
		if(p[i].op==1)now^=1;
		else 
		{
			int tmp=x-p[i].a;
			int tt=max(0,min(t1,t1-tmp+ts));
			if(tt<t2)tt=t2;
			ans[p[i].y]=tt;
		}
	}
	for(int i=1;i<=q;i++)
	{
		printf("%d\n",ans[i]);
	}
	return 0;
}


Measured memory_bytes: 5120
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int l = sc.nextInt();
        int r = sc.nextInt();
        int d = sc.nextInt();
        int count = 0;
        for(int i = l; i <= r; i++)
            if(i % d == 0)
                count++;
            System.out.println(count);
    }

}

Measured memory_bytes: 35636
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
#define SORTPairSecond(v, n) sort(v, v+n, pairCompareSecond);
#define int long long    // %d=>%lld, 1<<n  => 1LL<<n
#define pb push_back

using namespace std;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
bool pairCompareSecond(const pii& firstEl, const pii& secondEl) {
    return firstEl.second > secondEl.second;
}

const ll MOD = 1000000007;
const int INF = 1000000007;
// const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
// const ll LLINF = 1LL << 50;
const double PI = acos(-1);
const double EPS = 0.000000001;


const int MAX_n = 100002;
int n, a[MAX_n];
int memo[MAX_n];

signed main(){

    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        for(int j = 0;j < 3;j++){
            memo[a[i]+j]++;
        }
    }

    int ans=0;
    for(int i = 0;i < MAX_n;i++){
        if(ans<memo[i]){
            ans = memo[i];
        }
    }

    cout<< ans<< endl;

    return 0;
}

Measured memory_bytes: 1792
n, k = map(int, input().split())
d = input().split()
for r in range(n, n*10):
    s = "{}".format(r)
    for x in d:
        if x in s:
            break
#for else構文 for 文が全て終わった時に実行される
    else:
        print(r)
        break


Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
ll get(ll x)
{
	ll an=0;
	while(x)
	{
		an+=x%10;
		x/=10;
	}
	return an;
}
int main()
{
	ll n;
	SPEED;
	cin>>n;
	ll ans=INF;
	for(int i=1;i<n;i++)
	{
		ans=min(ans,get(i)+get(n-i));
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    for (int i = 0; i < 5; i++)
    {
        int x;
        cin >> x;

        if (x == 0)
        {
            cout << i + 1 << endl;
        }
    }
}


Measured memory_bytes: 3632
#include<iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
    int a,b;

    cin>>a>>b;
    if(a<=b){
        cout<<a<<endl;
    }else{
        cout<<a-1<<endl;
    }
    return 0;
}

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



int main() {
    int n, m;
    cin >> n >> m;
    
    cout << n * (n-1) / 2 + m * (m-1) / 2 << endl;
    
    return 0;
}




Measured memory_bytes: 3612
#include<bits/stdc++.h>
#include <iomanip>
#include <iostream>
using namespace std;
using ll = long long;
ll INF = 9999999999999999;

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;
}

ll gcf(ll a, ll b){
    if(b == 0) return a;
    return gcf(b, a%b);
}

ll lcm(ll a, ll b){
    ll g = gcf(a, b);
    return a/g * b;
}
int main(void){
    int N; cin >> N;
    vector<ll> A(N); for(int i = 0; i < N; i++) cin >> A[i];
    
    ll ans = 0;
    int minas_count = 0;
    for(int i = 0; i < N; i++){
        ans += max(A[i], -A[i]);
        if(A[i] < 0) minas_count++;
    }
    
    if(minas_count % 2 == 0){
        cout << ans << endl;
        return 0;
    }
    else{
        ll abs_min = 99999999999999;
        for(int i = 0; i < N; i++){
            abs_min = min(abs_min, abs(A[i]));
        }
        ans -= 2 * abs_min;
        cout << ans << endl;
        return 0;
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int x; cin >> x;int cnt = 0;
	for(int i = 0; i <= a; i ++) {
		for(int j = 0; j <= b; j ++) {
			for(int k = 0 ; k <= c; k ++) {
				if(i * 500 + j * 100 + k * 50 == x) {
					cnt ++;
				}
			}
		}
	} 
	cout << cnt << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 2e5+5;
const ll mod = 998244353;

ll fact[L];
ll invfact[L];

ll C(ll n, ll r)
{
    ll num = fact[n] % mod;
    ll den = (invfact[r] * invfact[n-r]) % mod;

    return (num * den) % mod;
}

void factorial()
{
    fact[0] = 1;
    invfact[0] = 1;

    for(ll i=1; i<L; i++)
    {
        fact[i] = (fact[i-1] * i)%mod;
        invfact[i] = modexp(fact[i], mod-2, mod);
    }
}

ll foo(ll ind, ll m)
{

}

void solve()
{
    factorial();

    ll n = nxt(), m = nxt(), k = nxt();

    ll ans = 0;

    for(ll i=0; i<=k; i++)
    {
        ll temp = modexp(m-1, n-i-1, mod) * m;
        temp %= mod;

        ans += ((temp * C(n-1, i)) % mod);
        ans %= mod;
    }

    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 6760
#include <iostream>

using namespace std;

int main()
{
    int b,t,s,time,sum=0;
    cin>>s>>b>>t;
    time = t+0.5;
    if(time<s)
        cout <<"0"<< endl;
    else
    {
        for(int i=s;i<=time;i=i+s)
        {
           sum= sum+b;
        }
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b>c+d)
		cout<<"Left"<<endl;
	else
		if(a+b==c+d)
			cout<<"Balanced"<<endl;
		else
			if(a+b<c+d)
				cout<<"Right"<<endl;
}

Measured memory_bytes: 256
n = int(input())

w = list(map(int,input().split()))

s = sum(w)

t1 = [0]*(n+1)
t2 = [0]*(n+1)
t2[0]=s

for i in range(n):
  t1[i+1] =t1[i] + w[i]
  t2[i+1] =t2[i] - w[i]

t = [abs(t1[j]-t2[j]) for j in range(n+1)]

print(min(t))

Measured memory_bytes: 3064
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>   
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
typedef tuple<int,int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[2][7]={
    {0,1,1,0,-1,-1,0},
    {0,1,1,0,-1,-1,0}
};
int dy[2][7]={
    {1,0,-1,-1,-1,0,0},
    {1,1,0,-1,0,1,0}
};
 
Def d[220][220][6];
class DIJ{
    public: 
    struct edge{
        Def x,y,cost,t;
    };
    Def lx,ly;
    vvi G;
    DIJ(vvi tG,int x,int y){
        lx=x,ly=y;
        G=tG;
    }
    void dij(Def sx,Def sy,Def gx,Def gy){
        rep(i,220)rep(j,220)rep(k,6)
            d[i][j][k]=inf;
 
        d[110+sx][110+sy][0]=0;
        priority_queue<tp> q;
        q.push(tp(0,110+sx,110+sy,0));
        while(!q.empty()){
            Def cost,x,y,t;
            tie(cost,x,y,t)=q.top();
            cost*=-1;
            q.pop();
            if(cost>d[x][y][t])continue;
            rep(i,7){
                Def nx=x+dx[x%2][i];
                Def ny=y+dy[x%2][i];
                if(abs(nx-110)>lx||abs(ny-110)>ly)continue;
                if(G[nx][ny])continue;
                Def nt=(t+1)%6;
                Def ncost=cost+(i!=(abs((x-110)*(y-110)*t)%6));
                if(ncost<d[nx][ny][nt]){
                    d[nx][ny][nt]=ncost;
                    q.push(tp(-ncost,nx,ny,nt));
                }
            }
        }
        int out=inf;
        rep(i,6)out=min(out,d[110+gx][110+gy][i]);
        if(out==inf)out=-1;
        cout<<out<<endl;
    }
     
};
 
int main(){
    int sx,sy,gx,gy,n;
    cin>>sx>>sy>>gx>>gy>>n;
    vvi G(220,vi(220));
    rep(i,n){
        int a,b;cin>>a>>b;
        G[a+110][b+110]=true;
    }
    int lx,ly;
    cin>>lx>>ly;
    DIJ dij(G,lx,ly);
    dij.dij(sx,sy,gx,gy);
}


Measured memory_bytes: 4768
#include <iostream>
#include <queue>

using namespace std;
const int MAX_N = 90;
const int MAX_M = 90;
struct map {
    int maze[MAX_N + 1][MAX_M + 1];
    int skcount[MAX_M];
}mapmap[5];
int X[4] = {0, 0, 1, -1};
int Y[4] = {1, -1, 0, 0};
int m[5];
int n[5];
int k, l;
int res = 0;
struct node{
    int x, y;
    int step;
    bool last[MAX_N][MAX_M];
}Node;
queue<node> q;

bool test(int x, int y, node S,int f){
    if(x >= n[f] || x < 0 || y >= m[f] || y < 0) return false;
    if(mapmap[f].maze[x][y] == 0) return false;
    if(S.last[x][y] == true) return false;
    return true;
}

void BFS(node S,int f){
    q.push(S);
    node top = q.front();
    q.pop();
    for(int i = 0; i < 4; i++) {
        int newX = top.x + X[i];
        int newY = top.y + Y[i];
        if (test(newX, newY, Node,f)) {
            Node.x = newX, Node.y = newY;
            Node.step = top.step + 1;
            mapmap[f].skcount[Node.step]++;
            Node.last[newX][newY] = true;
            BFS(Node,f);
        }
    }
    Node.last[top.x][top.y] = false;
    return;
}

int main() {
    for(int f = 0; f < 5; f++) {
        cin >> m[f];
        cin >> n[f];
        for (int i = 0; i < n[f]; i++) {
            for (int j = 0; j < m[f]; j++) {
                cin >> mapmap[f].maze[i][j];
            }
        }
        for (k = 0; k < n[f]; k++) {
            for (l = 0; l < m[f]; l++) {
                if (mapmap[f].maze[k][l] == 1) {
                    node S;
                    S.x = k;
                    S.y = l;
                    Node.last[k][l] = true;
                    S.step = 1;
                    mapmap[f].skcount[S.step]++;
                    BFS(S,f);
                }
            }
        }
        if(m[f] == 0 || n[f] == 0) break;
        res++;
    }
    for(int f = 0; f < res; f++){
        for (int i = 1; i < MAX_M; i++) {
            if (mapmap[f].skcount[i] == 0) {
                cout << i - 1;
                break;
            }
        }
        cout << '\n';
    }
    return 0;
}


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

int main(){
  int n, k, i;
  cin >> n;
  cin >> k;
  int a[n];
  for(i = 0; i < n; i++) cin >> a[i];
  for(i = 0; i < n; i++){
    if(a[i] > k - a[i]) a[i] = k - a[i];
  }
  int sum = 0;
  for(i = 0; i < n; i++) sum += a[i];
  sum *= 2;
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ch = char;
using st = string;

int main(void){
    st a,b;
    cin >> a >> b;
    // cout << "a, b: " << a << b << endl;
    if(a == "1" && b == "1"){
        cout << "Draw" << endl;
        return 0;
    }else if(b == "1"){
        cout << "Bob" << endl;
        return 0;
    }else if(a == "1"){
        cout << "Alice" << endl;
        return 0;
    }
    if(a == b){
        cout << "Draw" << endl;
    }
    else if(stoi(a) < stoi(b)){
        cout << "Bob" << endl;
    }else{
        cout << "Alice" << endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
long long int a,b,c,x,y;
int total = 0,n;
int main(void)
{
    cin >> a >> b >> c >> x >> y;
    n = x + y;
    if(a + b > 2*c){
        if(x < y){
            total += x * 2 * c;
            n = y - x;
            if(b > 2 * c) cout << total + 2 * c * n;
            else cout << total + b *n;
        }else{
            total += y * 2 * c;
            n = x - y;
            if(a > 2 * c) cout << total + 2 * c * n;
            else cout << total + a *n;
        }
    }else{
        cout << x*a + y*b;
    }
    return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> l(n);
    rep(i, 0, n) cin >> l[i];

    int ans = 0;
    rep(i, 0, n) {
        rep(j, i + 1, n) {
            rep(k, j + 1, n) {
                if (l[i] != l[j] && l[j] != l[k] && l[i] != l[k]) {
                    ll len = l[i] + l[j] + l[k];
                    ll ma = max(l[i], max(l[j], l[k]));
                    ll rest = len - ma;
                    if (ma < rest) {
                        ans++;
                    }
                }

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


Measured memory_bytes: 3660
N=int(input())
K=int(input())
ans=float('inf')
for i in range(2**N):
    bi=list(format(i,'b').zfill(N))
    now=1
    for b in bi:
        if b=='0':
            now*=2
        else:
            now+=K
    if now<ans:
        ans=now
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false); 
    int a,sum;
    cin>>a;
    sum=a;
    sum+=pow(a,2);
    sum+=pow(a,3);
    cout<<sum;
	return 0; 
}

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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define MP make_pair
#define FI first
#define SE second
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;

const double EPS = 1e-9;
const double PI = acos(-1);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

ll addMod(ll a, ll b){
	return (a+b) % MOD;
}

ll mulMod(ll a, ll b){
	return (a*b) % MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp, tmp);
	if(b & 1) tmp = mulMod(tmp, a);
	return tmp;
}

/////////////////////////////////////////////////////////



int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int a,b;
	cin >> a >> b;
	bool flag = false;
	REP(i,max(b-a+1,-1000000),min(b+a-1, 1000000)){
		if(flag) cout << " ";
		cout << i;
		flag = true;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
    int n,x,t;
    Int(n,x,t);
    int s=0;
    for(int j=t; ;j+=t){
      s+=x;
      if(s>=n){
        printf("%d\n", j);
        return 0;
      }
    }

    return 0;
}






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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 998244353
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef unsigned long long ull;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	int n,a,b,c1=0,c2=0,c3=0;
	cin>>n>>a>>b;
	int arr[n];
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	
	for(int i=0;i<n;i++){
		if(arr[i]<=a)	c1++;
		else if(arr[i]>a&&arr[i]<=b)	c2++;
		else if(arr[i]>b) c3++;
	}
	int ans=min(min(c1,c2),c3);
	cout<<ans<<'\n';
	
	return 0;
}


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

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

    long long cnt=1;
    while (s != 4 && s != 2 && s != 1) {
        if (s%2==0) s /= 2;
        else s = 3*s + 1;
        ++cnt;
    }
    cout << cnt + 3 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#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++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000000
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

int main(){
  ll N;
  cin >> N;
  vector<P> R(N), B(N);
  rep(i, N){
    cin >> R.at(i).first >> R.at(i).second;
  }
  rep(i, N){
    cin >> B.at(i).first >> B.at(i).second;
  }
  sort(all(R));
  sort(all(B));
  vector<bool> used(N, false);
  ll cnt = 0;
  P tmp = make_pair(-1, -1);
  rep(i, N){
    rep(j, N){
      if(R.at(j).first < B.at(i).first && R.at(j).second < B.at(i).second && !used.at(j)){
        if(chmax(tmp.second, R.at(j).second)){
          tmp.first = j;
        }
      }
    }
    if(tmp.first != -1){
      used.at(tmp.first) = true;
      cnt++;
    }
    tmp.first = -1;
    tmp.second = -1;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    int i, A[N];
    for(i=0; i<N; i++) {
        cin >> A[i];
    }

    // cout << A[0] << endl;

    int flag=1, count=0;

while(flag) {
    for(i=0; i<N; i++) {
        if(A[i]%2==0) {
            A[i] /= 2;
        } else {
            flag = 0;
            break;
        }
    }
    if(flag) {
        count += 1;
    }
}
    cout << count << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int x;
  cin >> x;
  if(x >= 400 && x <= 599)	cout << 8 << endl;
  else if(x >= 600  && x <= 799)  cout << 7 << endl;
  else if(x >= 800  && x <= 999)  cout << 6 << endl;
  else if(x >= 1000 && x <= 1199) cout << 5 << endl;
  else if(x >= 1200 && x <= 1399) cout << 4 << endl;
  else if(x >= 1400 && x <= 1599) cout << 3 << endl;
  else if(x >= 1600 && x <= 1799) cout << 2 << endl;
  else if(x >= 1800 && x <= 1999) cout << 1 << endl;
  
  return 0;
}


Measured memory_bytes: 3620
def main():
    N = int(input())
    A = list(map(int, input().split()))

    B = []
    for a in A:
        count = 0
        while (a%2) == 0:
            count += 1
            a = int(a/2)

        B.append(count)

    print (min(B))

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

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

#define VIN(v) for(auto&elem_: (v) )cin>>elem_
#define VOUT(v, sep) for(_loop_int idx=0; idx<(_loop_int)v.size(); idx++) {cout<<v[idx]; if(idx<v.size()-1) cout<<sep;} cout<<endl

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(debugidx,v.size())cout<<" "<<v[debugidx];cout<<endl
#define DEBUG_ARR(v,n) cout<<#v<<":";REP(debugidx,n)cout<<" "<<v[debugidx];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
const int IINF = numeric_limits<int>::max()/2-1;
const ll LINF = numeric_limits<ll>::max()/2-1;
#define FIX(a) ((a)%MOD+MOD)%MOD
int a,b,h,m;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    //a:時 b:分　針
    cin>>a>>b>>h>>m;
    //a^2=b^2+c^2-2bccosA
    //1分間に
    //長針は6°進む。
    //短針は0.5°進む
    //DEBUG2(h*(0.5*60), m*6);
    double deg = abs((h*(0.5f*60)+(0.5f*m)) - m*6);
    deg = min(deg, 360.f-deg);
    double rad = deg*(M_PI/180.f);
    //DEBUG2(deg,cos(rad));
    double ans = pow(a,2) + pow(b,2) - (2*a*b*cos(rad));
    ans = sqrt(ans);
    cout <<fixed << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 4168
from bisect import*
q,*n=map(int,open(0))
can=[]
for i in range(1,10**5+1):
    p=[]
    for j in range(1,int(i**.5)+1):
        if i%j<1:
            p+=[j,i//j]
    *p,e=sorted(p)
    for j in range(len(p)-1):p[j+1]*=p[j]
    if p[-1]>=e*2:
        can+=i,
for i in n:print(bisect(can,i))


Measured memory_bytes: 12492
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  int x1,y1,x2,y2,x1_x2,y1_y2;
  int x3,y3,x4,y4;
  cin >> x1 >> y1 >> x2 >> y2;
  x1_x2 = x2 - x1;
  y1_y2 = y2 - y1;
  x3 = x2 - y1_y2;
  y3 = y2 + x1_x2;
  
  x4 = x3 - x1_x2;
  y4 = y3 - y1_y2;

  //cout << x1_x2 << " " << y1_y2 << endl;
  
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;

int GCD(int x, int y) {
	return x ? GCD(y % x, x) : y;
//xが0以外なら、GCD(y % x, x) の結果を返し
//xが0ならyを返す
}
int main() {
	int a, b,q;
	cin >>a >> b >> q;
	vector<long long int>s(a), t(b), x(q),dis(b),dis1(a);
	rep(i, a)cin >> s[i];
	sort(s.begin(), s.end());
	rep(i, b) {
		cin >> t[i];
	}
	sort(t.begin(), t.end());
	rep(i, a) {
		long long int diss = 1e9;
		 int ite = lower_bound(t.begin(), t.end(), s[i]) - t.begin();
		//cout << ite << endl;
		if (ite < t.size()) {
			diss = abs(*lower_bound(t.begin(), t.end(), s[i]) - s[i]);
			if (ite > 0) {
				if (diss >= abs(*(lower_bound(t.begin(), t.end(), s[i]) - 1) - s[i])) {
					diss = abs(*(lower_bound(t.begin(), t.end(), s[i]) - 1) - s[i]);
				}
			}
		}
		else {
			diss = abs(t[t.size() - 1] - s[i]);
		}
		dis1[i] = diss;
		//cout << "dis1 " << diss << endl;
	}
	rep(i, b) {
		long long int diss = 1e9;
		int ite = lower_bound(s.begin(), s.end(), t[i]) - s.begin();
		if (ite>=0&&ite < s.size()) {
			diss = abs(*lower_bound(s.begin(), s.end(), t[i]) - t[i]);
			if (ite > 0) {
				if (diss >= abs(*(lower_bound(s.begin(), s.end(), t[i]) - 1) - t[i])) {
					diss = abs(*(lower_bound(s.begin(), s.end(), t[i]) - 1) - t[i]);
				}
			}
		}
		else {
			diss = abs(s[s.size() - 1] - t[i]);
		}
		dis[i] = diss;
		//cout <<"diss"<< diss << endl;
		
	}
	
	
	rep(i, q) {
		cin >> x[i];
		long long int ans = 0;
		long long  int ans1 = 0;
		int c=lower_bound(t.begin(), t.end(), x[i]) - t.begin();
		if (c < t.size()) {
			ans = abs(x[i] - t[c]) + dis[c];
			if (c > 0) {
				c--;
				if (ans > abs(x[i] - t[c]) + dis[c]) {
					ans = abs(x[i] - t[c]) + dis[c];
				}
			}
		}
		else {
			ans = abs(x[i] - t[t.size() - 1])+dis[t.size()-1];
		}
		//cout << ans << "ans" << endl;
		int d = lower_bound(s.begin(), s.end(), x[i]) - s.begin();
		if (d < s.size()) {
			ans1 = abs(x[i] - s[d]) + dis1[d];
          if (d > 0) {
			  d--;
				if (ans1 > abs(x[i] - s[d]) + dis1[d]) {
					ans1 = abs(x[i] - s[d]) + dis1[d];
					//cout << ans1 << endl;
				}
			}
		}
		else {
			ans1 = abs(x[i] - s[s.size() - 1]) + dis1[s.size() - 1];
		}
		//cout << ans1 << "ans1" << endl;
		cout << min(ans, ans1) << endl;
	}

}

Measured memory_bytes: 5248
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var XY = ReadSplit();
            if (char.Parse(XY[0]) == char.Parse(XY[1])) Println("=");
            else if (char.Parse(XY[0]) < char.Parse(XY[1])) Println("<");
            else if (char.Parse(XY[0]) > char.Parse(XY[1])) Println(">");
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 13140