akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

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 RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

#ifdef false

int calc(VI a, int n) {
    if (a.size() == 1) {
        return a[0];
    }
    assert(a.size() != 2);
    if (a.size() == 3) {
        SORT(a);
        return a[1];
    }
    REP(i, 3) {
        v.EB(a[i + n]);
    }
    SORT(v);
    return
}

int main(void) {
    VI a(5);
    vector<pair<int, VI> > va;
    iota(ALL(a), 1);
    do {
        va.EB(MP(calc(a), a));
    } while (next_permutation(ALL(a)));
    SORT(va);
    int n = 0;
    FORE(el, va) {
        if (n != el.first) {
            n = el.first;
            cout << endl;
        }
        cout << el.first << " = ";
        FORE(e, el.second) {
            cout << e << " ";
        }cout << endl;
    }
}

#else

int main(void) {
    int N, x;
    cin >> N >> x;
    if (x == 1 || x == (2 * N) - 1) {
         cout << "No" << endl;
         return 0;
    }else {
        cout << "Yes" << endl;
    }
    int all = (2 * N - 1);
    int mid = (all / 2) + 1;
    if (mid == x) {
        REP(i, all) {
            cout << i + 1 << endl;
        }
    } else if (mid < x) {
        int buf = 0;
        REP(i, all / 2) {
            cout << i + 1 << endl;
            buf = i + 1;
        }
        cout << x << endl;
        RREP(i, all) {
            if (i + 1 == x) continue;
            if (i + 1 == buf) break;
            cout << i + 1 << endl;
        }
    } else {
        int buf = 0;
        RREP(i, mid) {
            if (i + 1 == x) continue;
            cout << i + 1 << endl;
        }
        cout << x << endl;
        FOR(i, mid, all) {
            cout << i + 1 << endl;
        }
    }
}

#endif


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define MAX 300000
using namespace std;
vector<int> l[MAX+10];
int c[MAX+10];
multiset<int,greater<int>> st;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m,k;
	cin>>n>>m>>k;
	while(k--)
	{
		int x,y;
		cin>>x>>y;
		l[x].push_back(y);
		c[y]++;
	}
	for(int i=0;i<=m;++i)
		if(c[i])
			st.insert(c[i]);
	int ans = 1;
	for(int i=0;i<=n;++i)	
	{
		for(int y:l[i])
		{
			st.erase(st.find(c[y]));
			st.insert(c[y]-1);
		}
		ans = max(ans,*st.begin()+(int)l[i].size());
		for(int y:l[i])
		{
			st.erase(st.find(c[y]-1));
			st.insert(c[y]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 35196
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main(){
    int N; cin >> N;
    int x[N + 1], y[N + 1];
    for (int i = 0; i < N; i++) { 
        cin >> x[i] >> y[i];
    }
    double d = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = i + 1; j < N; j++) {
            double dx = x[j] - x[i], dy = y[j] - y[i];
            d += pow(dx * dx + dy * dy, 0.5) * 2 / N;
        }
    }
    cout << setprecision(11) << d << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define ull uint64_t
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod =  1e9 + 7;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}
ull Pow(ull a , ull b){
	if(b == 0) return 1 ;
	ull c = Pow(a , b / 2) ;
	if(b % 2) return (a * ((c * c) % mod)) % mod;
	return (c * c) % mod ;
}
vi Digit(ll x){
	vi res ;
	while(x){
		res.pb(x % 10) ;
		x /= 10 ;
	}
	return res ;
}
		

int main(){
	IOS;
	cout.precision(30) ;
	int n , x  ; cin >> n >> x;
	vi a(n) ; for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	sort(a.begin() , a.end()) ;
	int gcd= abs(x - a[0]) ;
	for(int i = 1 ; i < n ; i++) gcd = __gcd(gcd , a[i] - a[i - 1]) ;
	cout << gcd << endl ;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define P pair<ll, ll>
#define VI vector<ll>
#define int long long
using namespace std;

int N, M;
priority_queue<P, vector<P>, greater<P>> que;

void solve() {
  int ans = 0;
  vector<bool> ok(M, false);
  vector<int> acc;
  while(!que.empty()) {
    P p = que.top(); que.pop();
    /* cout << p.first << ' ' << p.second << endl; */
    if (p.second < M && !ok[p.second]) {
      for (int left: acc) {
        ok[left] = true;
      }
      acc.clear();
      ans++;
      continue;
    }
    if (p.second >= M) {
      acc.push_back(p.second - M);
    }
  }
  cout << ans << endl;
}

signed main() {
  cin >> N >> M;
  REP (i, M) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    que.push(P(a, M + i));
    que.push(P(b, i));
  }

  solve();
}


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

using namespace std;

int main () {
  vector<int> vec(3);
  
  cin >> vec.at(0) >> vec.at(1) >> vec.at(2);
  sort(vec.begin(), vec.end());
  
  cout << vec.at(0) + vec.at(1) <<endl;
  
}

Measured memory_bytes: 256
from collections import *
ans = 0
def calc(l):
	global ans
	res = 0
	for i in q:
		if l[i[1]-1]-l[i[0]-1] == i[2]:
			res += i[3]
	ans = max(ans,res)
def rec(ind,p,l):
	if(ind == n):
		calc(l)
		return
	for i in range(p,m+1):
		l.append(i)
		rec(ind+1,i,l)
		l.pop()
n,m,Q = map(int,input().split())
q = []
for i in range(Q):
	q.append(list(map(int,input().split())))
rec(0,1,[])
print(ans)

Measured memory_bytes: 76840
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> v(n), c(n);
    REP(i, n) cin >> v[i];
    REP(i, n) cin >> c[i];
    int ans = 0;
    REP(i, n){
        if (v[i] > c[i]) ans += v[i] - c[i];
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
X, Y, A, B, C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))

p.sort()
p.reverse()
q.sort()
q.reverse()
del p[X:]
del q[Y:]
p.extend(q)
p.extend(r)
p.sort()
p.reverse()
del p[X+Y:]
d = sum(p)
print(d)


Measured memory_bytes: 23328
import itertools
import math
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

# 2**18 == 262144
N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))
B = list(map(int, sys.stdin.buffer.readline().split()))


class BinaryIndexedTree:
    # http://hos.ac/slides/20140319_bit.pdf
    def __init__(self, size):
        """
        :param int size:
        """
        self._bit = [0] * size
        self._size = size

    def add(self, i, w):
        """
        i 番目に w を加える
        :param int i:
        :param int w:
        """
        x = i + 1
        while x <= self._size:
            self._bit[x - 1] += w
            x += x & -x

    def sum(self, i):
        """
        [0, i) の合計
        :param int i:
        """
        ret = 0
        while i > 0:
            ret += self._bit[i - 1]
            i -= i & -i
        return ret

    def __len__(self):
        return self._size


# 18C9 < 50000
# どれを偶数番目にするか決まれば回数も分かる
ans = INF
for evens_i in itertools.combinations(range(N), r=(N + 1) // 2):
    is_even = [False] * N
    for i in evens_i:
        is_even[i] = True
    evens = []
    odds = []
    for i, even in enumerate(is_even):
        if even:
            evens.append((A[i] if i % 2 == 0 else B[i], i))
        else:
            odds.append((A[i] if i % 2 == 1 else B[i], i))
    evens.sort()
    odds.sort()

    prev = -1
    # 転倒数
    bit = BinaryIndexedTree(size=N)
    ok = True
    cnt = 0
    for i in range(N):
        c, mi = [evens, odds][i % 2][i // 2]
        if c < prev:
            ok = False
            break
        prev = c
        cnt += i - bit.sum(mi)
        bit.add(mi, 1)
    if ok:
        ans = min(ans, cnt)
        # print(evens_i, cnt, evens, odds)
if ans == INF:
    print(-1)
else:
    print(int(ans))


Measured memory_bytes: 53212
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define REP(i,a,b) for(int i=int(a);i<(int)b;++i)
#define Graph vector<vecctor<ll>>
#define pairs vector<pair<ll,ll>>
#define pb push_back



using namespace std;
using ll = long long;
const ll INF = 1e18;
const double PI = acos(-1);

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


int main(void){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    int h,w,k;
    cin >> h >> w >> k;
    
    int s[h][w];
    rep(i,h){
        string input;
        cin >> input;
        rep(j,w){
            if(input[j] == '1')s[i][j] = 1;
            else s[i][j] = 0;
        }
    }
    int ans=1e8;
    rep(z,1<<(h-1)){
        int index = 0,num = 0;
        vector<vector<ll>>gra;
        vector<ll>a;
        for(ll j=1;j<1<<(h-1);j = j<<1){
            if(j & z){
                num++;
                a.pb(index);
                gra.pb(a);
                a.clear();
            }else{
                a.pb(index);
            }
            index++;
        }
        while(index < h){
            a.pb(index);
            index++;
        }
        gra.pb(a);
        
        vector<ll>n(gra.size());
        rep(i,w){
            bool flag = false;
            rep(j,gra.size()){
                for(ll y : gra[j]){
                    if(s[y][i] == 1)n[j]++;
                    if(n[j] > k){
                        flag = true;
                        break;
                    }
                }
                if(flag)break;

            }
            if(flag){
                num++;
                if(num >= ans || i == 0){
                    num = 1e8;
                    break;
                }
                rep(i,n.size())n[i] = 0;
                i--;
                continue;
            }
            
            
            
        }
        ans = min(ans,num);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
int a,b,c;

int  main(void){
	scanf("%d ",&a);
    scanf("%d",&b);
	
if(a<=9){
	if(b<=9){
		c=a*b;
		printf("%d",c);
	}else{
		printf("-1");
    }
}else{
	printf("-1");
}
}

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

int main() {
    int a[1000010]={};
    int s;
    cin >> s;
    a[s]++;
    for(int i=1;i<1000000;i++){
        if(s%2==0){
            if(a[s/2]==1){
                cout << i+1 << endl;
                return 0;
            }
            else{
                a[s/2]++;
                s /= 2;
            }
        }
        else{
            if(a[s*3+1]==1){
                cout << i+1 << endl;
                return 0;
            }
            else{
                a[s*3+1]++;
                s = 3*s +1;
            }
        }
    }
}



Measured memory_bytes: 4096
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,sse,sse2,ssse3,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ull unsigned long long
#define y1 asjdlfaskavslbcjasndscf
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter set< int >::iterator
#define iter1 multiset<int>::iterator
#define int long long
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=3000+7;
const int inf=1e18+1e9;
const int mod=998244353;
const ld eps=1e-9;

//const int MAX_MEM=4e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    if (mpos>=MAX_MEM){
//        cout<<"BAD"<<endl;
//        exit(0);
//    }
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

int dp[N][N];

int C(int n)
{
    int res=n*(n-1)/2;
    res%=mod;
    return res;
}

main ()
{
    ios;
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    dp[a][b]=1;
    for (int i=a;i<=c;++i){
        for (int j=b;j<=d;++j){
            if (i==a && j==b)continue;
            dp[i][j]+=(dp[i-1][j]*j)%mod;
            dp[i][j]+=(dp[i][j-1]*i)%mod;
//            if (i==c && j==d){
//                cout<<dp[i][j]<<endl;
//            }
            int f=(((i-1)*(j-1))%mod*dp[i-1][j-1])%mod;
            dp[i][j]=(dp[i][j]-f+mod)%mod;
        }
    }
//    for (int i=a;i<=c;++i){
//        for (int j=b;j<=d;++j){
//            cout<<i<<' '<<j<<' '<<dp[i][j]<<endl;
//        }
//    }
    cout<<dp[c][d]<<endl;
}

//18 10
//8 1 2 3 4 9 9 5 1 6 6 7 8 6 2 9 10 7
//1 2 3 4 5 6 7 8 9 10


Measured memory_bytes: 74012
import sys
from collections import defaultdict
# from collections import Counter
# from queue import PriorityQueue
# sys.setrecursionlimit(2000000)

def distance(X, Y, start, goal):
    ans = float('inf')

    tmp = goal - start
    if tmp < ans:
        ans = tmp

    # start ~ X ~ Y ~ goal,
    tmp = abs(X - start) + 1 + abs(goal - Y)
    if tmp < ans:
        ans = tmp

    # start ~ Y ~ X ~ goal
    tmp = abs(Y - start) + 1 + abs(goal - X)
    if tmp < ans:
        ans = tmp

    return ans

#     # 短絡パスを使える場合
#     if start <= X and Y <= goal

#     # 短絡パスを使えないならば、普通に距離を計算
#     if X < start:
#         return goal - start

#     # 短絡パスを使えても、隣のパスへの距離は1
#     if goal - start == 1:
#         return 1

#     # 短絡パスより手前だと使えない
#     if goal < Y:
#         return goal - start



    # return goal - start - 1

def main():
    # N = int(input())

    N, X, Y = [int(s) for s in input().split()]

    distance_dict = defaultdict(int)
    for i in range(1, N+1):
        for j in range(i + 1, N+1):
            d = distance(X, Y, i, j)
            # sys.stderr.write('{} to {} : d = {}\n'.format(i, j, d))
            # ditance_dict[(i, j)] = d
            distance_dict[d] += 1

    for k in range(1, N):
        # print(str(distance_dict[k]))
        print(distance_dict[k])

    # As = []
    # Bs = []
    # for i in range(N):
    #     A, B = [int(s) for s in input().split()]
    #     As.append(A)
    #     Bs.append(B)

    return 0

if __name__ == '__main__':
    sys.exit(main())


Measured memory_bytes: 51164
<?php
list($n, $m) = explode(" ", trim(fgets(STDIN)));
$check_array = array_fill(1, $n, true);
$height_array = explode(" ", trim(fgets(STDIN)));
for($i=0; $i<$m; $i++){
	list($way1, $way2) = explode(" ", trim(fgets(STDIN)));
	if($height_array[$way1-1] !==  $height_array[$way2-1]){
		$lower =  $height_array[$way1-1] < $height_array[$way2-1] ? $way1 :$way2;
		$check_array[$lower] = false;

	}else{
		$check_array[$way1] = false;
		$check_array[$way2] = false;
	}
	

}
$ans = 0;
foreach ($check_array as $value) {
	if($value){
		$ans += 1;
	}
}

echo $ans . "\n";


Measured memory_bytes: 26932
#include<iostream>
#include<cmath>
using namespace std;
#define rep(i,a,b) for(long long i = (a); i <= (b); i++)

int main(){
  long long L,R,res=2020;
  cin >> L >> R;
  if(R-L > 2019) R = L+2019;
  rep(i,L,R){
    long long i_res = i%2019;
    rep(j,i+1,R){
      long long j_res = j%2019;
      //res = min((i_res*j_res)%2019,res);
      res = min( i*j % 2019 , res);
    }
  }
  cout<<res<<endl;

}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()

#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

#define debug(x) {cerr <<#x <<" = " <<x <<endl; }
#define debug2(x,y) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y <<endl; } 
#define debug3(x,y,z) {cerr <<#x <<" = " <<x << ", "<<#y<<" = "<< y << ", " << #z << " = " << z <<endl; } 
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<endl; }}
#define debugt(t,n) {{cerr <<#t <<" = "; FOR(it,0,(n)) cerr <<t[it] <<", "; cerr <<endl; }}

#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue

#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}


using namespace std;

const int max_n = 1e5 + 5;
lint ans[max_n];

int main() {
	make(n);
	VI v; v.pb(0);
	readv(v, n);
	v.pb(0);
	lint sum = 0;
	FOR(i,0,v.size()-1) {
		sum += abs(v[i+1]-v[i]);
	}
	FOR(i,1,n+1) {
		ans[i] = sum - abs(v[i]-v[i-1]) - abs(v[i+1]-v[i]) + abs(v[i-1]-v[i+1]);
	}
	FOR(i,1,n+1) {
		printf("%lld\n", ans[i]);
	}

}


Measured memory_bytes: 2552
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
using ll = long long;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vec<ll> T(2),A(2),B(2);
    cin >> T[0] >> T[1];
    cin >> A[0] >> A[1];
    cin >> B[0] >> B[1];
    if(T[0]*(A[0]-B[0])+T[1]*(A[1]-B[1])==0){
        cout << "infinity" << endl;
        return 0;
    }

    if(T[0]*(A[0]-B[0])+T[1]*(A[1]-B[1])<0){
        swap(A[0],B[0]);
        swap(A[1],B[1]);
    }


    //Aの方が早い
    if(A[0]>B[0]){
        cout << 0 << endl;
        return 0;
    }

    ll a = T[0]*(B[0]-A[0]),b = T[0]*(A[0]-B[0])+T[1]*(A[1]-B[1]);
    ll k = a/b;
    if(a%b==0){
        cout << 2*k << endl;
    }else{
        cout << 2*k+1 << endl;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<queue>
#include<algorithm>
#include<cstring>
int main()
{
	int x,y;
	scanf("%x%x",&x,&y);
	if(x==y){
		printf("=");
	}
	if(x<y){
		printf("<");
	}
	if(x>y){
		printf(">");
	}
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  string ans = "No";
  int r = 0, b = 0;
  for (int i=0; i<n; i++) {
    if (s[i] == 'R') {
      r += 1;
    }
    else {
      b += 1;
    }
  }

  if (r > b) {
    ans = "Yes";
  }

  cout << ans << endl;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

ld p[10], h[10];
ld d;
ld calc(ld vx,ld dd) {
	return sqrt(dd*dd / (4.0*vx*vx) + vx * vx);
}
void solve() {
	cout << fixed << setprecision(5);
	int n, b;
	cin >> d >> n >> b;
	rep(i, n) {
		cin >> p[i] >> h[i];
	}
	ld ans = INF;
	rep(i, b+ 1) {
		ld dd = d / (i + 1);
		vector<vector<int>> v(i + 1);
		rep(j, n) {
			int u = (int)(p[j] / dd+eps);
			v[u].push_back(j);
		}
		ld vx = sqrt(dd / 2.0);
		bool f = true;
		rep(j, i + 1) {
			ld le = j * dd;
			rep(k, v[j].size()) {
				int id = v[j][k];
				ld hei = (p[id]-le) * (dd - (p[id]-le)) / (2.0 * vx*vx);
				if (hei < h[id]) {
					f = false;
				}
			}
		}
		if (f) {
			ans = min(ans, calc(vx,dd));
			//cout << calc(vx, dd) << endl;
		}
		else {
			rep(j, i + 1) {
				ld le = j * dd;
				rep(k, v[j].size()) {
					int id = v[j][k];
					ld z = sqrt((p[id] - le)*(dd - p[id] + le) / (2.0*h[id]));
					vx = min(vx, z);
				}
			}
			//cout << vx << endl;
			ans = min(ans, calc(vx,dd));
			//cout << i << " " << calc(vx, dd) << endl;
		}
	}
	cout << ans << endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}



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

using namespace std;

int main() {
	long long n, ans = 1, inf = 1000000007;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		ans = (ans*i) % inf;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
const LL INF=1e18;
const int MO=1e9+7;
int n,ts,b[500010],bs[500010];
LL A,B,a[500010],f[500010],fs[500010],tmp[500010],ans;
LL cal(){
	tmp[0]=-INF;
	tmp[ts+1]=INF*2;
	FOR(i,1,ts) if (tmp[i]-tmp[i-1]>=B) b[i]=1; else b[i]=0;
	FOR(i,1,ts) bs[i]=bs[i-1]+b[i];
	int l=1,r=0;
	FOR(i,1,ts){
		f[i]=0;
		if (bs[i-1]==i-1) ++f[i];
		while (r<i-2 && tmp[i]-tmp[r+1]>=A) ++r;
		while (l<i-2 && bs[i-1]-bs[l+1]!=(i-l-2)) ++l;
		if (l<=r) (f[i]+=fs[r]-fs[l-1])%=MO;
		fs[i]=fs[i-1];
		if (tmp[i+1]-tmp[i-1]>=B) (fs[i]+=f[i])%=MO;
	}
	LL ans=0;
	if (bs[ts]==ts) ++ans;
	FOR(i,1,ts){
		if (i<ts){
			if (tmp[i+1]-tmp[i-1]<B) continue;
			if (bs[ts]-bs[i+1]!=ts-i-1) continue;
		}
		(ans+=f[i])%=MO;
	}
	return ans;
}
int main(){
	cin>>n>>A>>B;
	if (A<B) swap(A,B);
	FOR(i,1,n) scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	tmp[ts=1]=a[1];
	ans=1;
	FOR(i,2,n) if (a[i]-a[i-1]>=A){
		ans=ans*cal()%MO;
		tmp[ts=1]=a[i];
	}
	else tmp[++ts]=a[i];
	ans=ans*cal()%MO;
	ans=(ans%MO+MO)%MO;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 17408
import java.util.*;

//update 2019/12/29

public class Main{

  static Scanner sc = new Scanner(System.in);

  public static void main(String[] args) {

    String b = next();

    if(b.equals("A")){
      System.out.println("T");
    }
    else if(b.equals("T")){
      System.out.println("A");
    }
    else if(b.equals("C")){
      System.out.println("G");
    }
    else if(b.equals("G")){
      System.out.println("C");
    }





  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char aaa){
    return aaa - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


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

#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define OUT(a) cout << (a) << "\n"
#define ll long long
#define uint unsigned int
#define ushort unsigned short
#define ulong unsigned long

ll MOD = 10e9 + 7;

int main() {
    string s;
    cin >> s;
    vector<char> a;
    a.push_back(s[0]);
    for(int i=1; i<4; i++) {
        int n = a.size();
        for(int j=0; j<n; j++) {
            if (s[i] == a[j]) break;
            if (j == (n-1)) a.push_back(s[i]);
        }
    }
    printf("%s\n", (a.size()==2)?"Yes":"No");
    return 0;
}


Measured memory_bytes: 256
function main(input) {
	var a = input.split('\n');
	var N = parseInt(a[0], 10);
	var S = a[1];
	var countmin = N;
	var countW = 0;
	var countE = 0;
	for(i=1;i<N;i++){
		var S1 = S.slice(i,i+1);
		if(S1==='W'){
			countW += 1;
		} else if(S1==='E'){
			countE += 1;
		}
	}
	countX = countE;
	countmin = countX;
	for(i=0;i<N;i++){
		var S0 = S.slice(i,i+1);
		if(i<N-1){
			var S1 = S.slice(i+1,i+2);
			if(S1 === 'E'){
				countX -= 1;
			}
		}
		if(S0 === 'W'){
			countX += 1;
		}
		countmin = Math.min(countmin,countX);
	}
	console.log(countmin);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 9528
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

long long MOD = 1000000007;

struct matrix
{
    vector<vector<ll>> mat;
    ll row;
    ll col;

    void resize( ll row, ll col, ll initial )
    {
        this->row = row;
        this->col = col;
        mat.resize( row, vector<ll>( col, initial ) );
    }
    void identity() // first resize with initial = 0
    {
        for ( ll i = 0; i < (ll)mat.size(); i++ ) mat[i][i] = 1;
    }

    matrix operator+( matrix &b ) const
    {
        matrix temp;
        temp.resize( row, col, 0 );

        for ( ll i = 0; i < row; i++ )
        {
            for ( ll j = 0; j < col; j++ )
            {
                temp.mat[i][j] = ( mat[i][j] % MOD ) + ( b.mat[i][j] % MOD );
                temp.mat[i][j] %= MOD;
            }
        }
        return temp;
    }

    matrix operator*( matrix &b ) const
    {
        matrix temp;
        ll ro, co;

        temp.resize( row, b.col, 0 );
        for ( ll i = 0; i < row; i++ )
        {
            for ( ll j = 0; j < b.col; j++ )
            {
                for ( ll k = 0; k < col; k++ )
                {
                    temp.mat[i][j] +=
                        ( ( mat[i][k] % MOD ) * ( b.mat[k][j] % MOD ) );
                    temp.mat[i][j] %= MOD;
                }
            }
        }
        return temp;
    }

    matrix power( ll b )
    {
        matrix a = matrix( *this );
        matrix ans;

        ans.resize( row, col, 0 );
        ans.identity();

        while ( b )
        {
            if ( b & (ll)1 ) { ans = ans * a; }
            a = a * a;
            b >>= 1;
        }
        return ans;
    }
};

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

    MOD = m;

    matrix ans;
    ans.resize( 1, 3, 0 );
    ans.mat[0][0] = a % MOD;
    ans.mat[0][1] = ( a + b ) % MOD;
    ans.mat[0][2] = 1;

    ll term = 1, d = 10;
    while ( term < l )
    {
        ll lo = max( (ll)0, ( ( d / 10 - 1 ) - a ) / b );
        ll hi = min( l - 1, max( ( d - 1 - a ) / b, (ll)0 ) );
        ll now = hi - lo;

        term += hi - lo;

        matrix temp;
        temp.resize( 3, 3, 0 );
        temp.mat[0][0] = d % MOD;
        temp.mat[1][0] = 1;
        temp.mat[1][1] = 1;
        temp.mat[2][1] = b % MOD;
        temp.mat[2][2] = 1;

        temp = temp.power( now );
        ans = ans * temp;

        d *= 10;
    }

    cout << ans.mat[0][0] << endl;

    return 0;
}


Measured memory_bytes: 256
h1=Hash.new(0)
max=""
arr=gets.chomp.split(nil)
arr.each do |item|
    h1[item]+=1
    max=item if (item.length>max.length)
end
h2=h1.sort{|a,b|a[1]<=>b[1]}.reverse!
puts "#{h2[0][0]} #{max}"

Measured memory_bytes: 8576
H, W = map(int,input().split())
a = [list(input()) for i in range(H)]
b = []
c = []
for y in range(H):
  if "#" in a[y]:
    b.append(a[y])
for row in zip(*b):
  if "#" in row:
    c.append(row)
for row in zip(*c):
  print("".join(row))

Measured memory_bytes: 3188
import java.util.Scanner;
public class Main {
	 public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
    String s = sc.next();

    //文字列から0を取り除く。
    s = s.replaceAll("0", "");

    //文字数を出力する。
    System.out.println(s.length());
	 }
}

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

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

struct Node
{
    int node, len;
    Node() {node = len = 0;}
    Node(int node, int len) {this -> node = node, this -> len = len;}
};
typedef vector<Node> vg;

#define MAX 1
#define NON 0
#define MOD 1000000007

#define FOR(type, i, a, b) for(type i = a; i < b; i++)
#define FORR(type, i, b, a) for(type i = b; i > a; i--)
#define FORE(type, i, a, b) for(type i = a; i <= b; i++)
#define FORRE(type, i, b, a) for(type i = b; i >= a; i--)

#define testBit(n, bit) ((n >> bit) & 1)
#define flipBit(n, bit) (n ^ (1ll << bit))

main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int r; cin >> r;
    cout << fixed << setprecision(5) << r * 2 * acos(-1);
}

Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
const int MAX=1e5+10;
typedef long long ll;
ll a[MAX],b[MAX],c[MAX];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%lld",&a[i]);
    int l=0,ans=0;
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&b[i]);
        if(a[i]>=b[i]) c[l++]=a[i]-b[i];
        else sum+=b[i]-a[i],ans++;
    }
    if(ans==0)
    {
        printf("0\n");
        return 0;
    }
    sort(c,c+l);
    int flag=0;
    for(int i=l-1;i>=0;i--)
    {
        sum-=c[i];
        ans++;
        if(sum<=0)
        {
            flag=1;
            break;
        }
    }
    if(flag==1) printf("%d\n",ans);
    else printf("-1\n");
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int k, n;
  cin >> k >> n;
  vi32 a(n);
  cin >> a;
  a.push_back(a[0] + k);
  int ma = 0;
  rep(i, n) {
    amax(ma, a[i + 1] - a[i]);
  }
  cout << k - ma << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 200200;
typedef long long ll;
const int mod = 1e9 + 7;
inline ll pow(ll a,int b,int ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1)
		ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
std::vector<int> ytx;
int n, k;
int dp[maxn];
inline void reduce(int & x) {
	x += x >> 31 & mod;
}
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> k;
	for(int i = 1;i * i <= n;++i) if(n % i == 0) {
		ytx.push_back(i);
		if(i * i != n) ytx.push_back(n / i);
	}
	sort(ytx.begin(), ytx.end());
	int lol = 0;
	rep(i, 0, ytx.size() - 1) {
		dp[i] = pow(k, ytx[i] + 1 >> 1);
		rep(j, 0, i - 1) if(ytx[i] % ytx[j] == 0) reduce(dp[i] -= dp[j]);
		lol = (lol + dp[i] * (ytx[i] & 1 ? ytx[i] : ytx[i] + 1ll >> 1)) % mod;
	}
	cout << lol << '\n';
}


Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
  public static void main(String args[]) {
    Scanner scanner = new Scanner(System.in);
    int N = Integer.parseInt(scanner.next());
    int A = Integer.parseInt(scanner.next());
    int B = Integer.parseInt(scanner.next());
    
    if(N*A<B){
      System.out.println(N*A);
    }else{
      System.out.println(B);
    }
  }
}

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

int main() {
  int X,Y;
  cin >> X >> Y;
  int a,b;
  bool c=true;
  for(int i=0;i<X+1;i++){
    a=i,b=X-i;
    if(4*a+2*b==Y){
      cout <<"Yes" << endl;
      c=false;
      break;
    }
  }
  if(c){
    cout << "No" << endl; 
  }
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    map<int, int> ma;
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        ++ma[a[i]];
    }
    int res = 0;
    for(auto i : ma) {
        if(i.second % 2) ++res;
    }
    
    cout << res << endl;
}


Measured memory_bytes: 5376
n = int(input())
a, b = [0] * n, [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
a.sort()
b.sort()
if n % 2:
    under = a[n // 2]
    upper = b[n // 2]
    print(upper - under + 1)
else:
    under = a[n // 2 - 1] + a[n // 2]
    upper = b[n // 2 - 1] + b[n // 2]
    print((upper - under) + 1)
"""
# 　どのx　もその中に持てない区間が何個あるかを累積和で持っておく。
aa, ba, aidx = zip(*sorted(zip(a, b, range(n))))  # aでソート
bb, ab, bidx = zip(*sorted(zip(b, a, range(n))))  # aでソート

if n % 2:
    print(bb[n // 2] - aa[n // 2] + 1)
else:
    if aidx[n // 2 - 1] == bidx[n // 2]:
        ans = (bb[n // 2 - 1] - aa[n // 2 - 1] + 1) * (bb[n // 2] - aa[n // 2] + 1)
    else:
        ans = (bb[n // 2 - 1] - aa[n // 2 - 1] + 1) * (bb[n // 2 - 1] - aa[n // 2] + 1)
    print(ans)"""


Measured memory_bytes: 25484
def solve_b(n, a_list, b_list, c_list):

    res = sum(b_list)

    for i in range(n - 1):
        if a_list[i] + 1 == a_list[i + 1]:
            res += c_list[a_list[i] - 1]

    return res


def main():

    n = int(input())
    a_list = list(map(int, input().split()))
    b_list = list(map(int, input().split()))
    c_list = list(map(int, input().split()))

    print(solve_b(n, a_list, b_list, c_list))


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<array>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


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


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

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

/******************************************************************************************/
typedef tuple<int,int,int> tpl;

template <typename T> bool next_combination(const T first, const T last, int k) {
    const T subset = first + k;
    // empty container | k = 0 | k == n 
    if (first == last || first == subset || last == subset) {
        return false;
    }
    T src = subset;
    while (first != src) {
        src--;
        if (*src < *(last - 1)) {
            T dest = subset;
            while (*src >= *dest) {
                dest++;
            }
            iter_swap(src, dest);
            rotate(src + 1, dest + 1, last);
            rotate(subset, subset + (last - dest) - 1, last);
            return true;
        }
    }
    // restore
    rotate(first, subset, last);
    return false;
}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	string s;
	cin >> s;
	for(int i = 0;i < s.size();i++){
		if(s[i] == '7'){
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;



	return 0;
}






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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 998244353;

LL modpow(LL a, LL n, LL mod) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N,first;
  cin >> N >> first;
  if(first!=0){
    cout << 0 << endl;
  }else{
    vector<LL> D(N, 0);
    LL mx = 0;
    D[0]++;
    REP(i, N - 1)
    {
      LL a;
      cin >> a;
      D[a]++;
      mx = max(mx, a);
    }
    if(D[0]!=1){
      cout<<0<<endl;
      return 0;
    }

    LL sum = 1;
    
    REP(i,mx){
      if(D[i+1]==0){
        cout << 0 << endl;
        return 0;
      }
      else
      {
        sum *= modpow(D[i], D[i + 1], mod);
        sum %= mod;
      }
    }
    
    cout<<sum%mod<<endl;
    return 0;
  }
}


Measured memory_bytes: 1152
import math

# 入力n以上の最小の2のべきを出力
# 2**(out-1) < (in) <= 2**(out)
# power2_larger(8) = 3
# power2_larger(9) = 4
def power2_larger(num):
        return len(str(bin(num-1))[2:])


N, K = map(int,input().split())

ans = 0.
for i in range(N):
  if (i+1) >= K:
    ans += 1.0 / N
  else:
    var = int((K + i) / (i+1))
    var2 = power2_larger(var)
    ans += 1.0 / N / 2**var2
    
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    const int ans = (r / d - (l - 1) / d);
    cout << ans << endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define read(x)	 freopen(x, "r", stdin);
#define write(x) freopen(x, "w", stdout);
 //#define xihaad

int main()
 {
#ifdef xihaad
	read("input.txt");
	// write("output.txt");
#endif

int n;
cin>>n;
int cnt=0;
for(int i=0;i<n;i++)
 {
   int l,p;
   cin>>l>>p;
   if(l!=p)
   cnt=0;
   else if(l==p)
    {
      cnt++;
    }
   if(cnt==3)
   {
      cout<<"Yes";
      return 0;
   }





 }
cout<<"No";

   return 0;

}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n,k,p[1010];
    cin>>n>>k;
    rep(i,n)cin>>p[i];
    sort(p,p+n);
    int ans=0;
    rep(i,k)ans+=p[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
/*
                    Author: Ankit Kaul
    **********************Code Belongs to Respective Author Only************************************
    */
    /*#pragma GCC optimize("O3")
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
    #include <bits/stdc++.h>
    #define endl       '\n'
    #define PI          3.141592653589
    #define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define M           1000000007
    #define int         long long int
    #define inf         INT_MAX
    #define pb          emplace_back
    #define pf          emplace_front
    #define pii         pair<int,int>
    #define vi          vector<int>
    #define vii         vector<pii>
    #define mi          map<int,int>
    #define mii         map<pii,int>
    #define all(a)      (a).begin(),(a).end()
    #define rall(a)     (a).rbegin(),(a).rend()
    using namespace std;
    int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
    int power(int x,int n){
        int result=1;
        while(n>0)
        {   if(n % 2 ==1)
            result=(result * x) % M;
            x=(x*x)% M;
            n=n/2;
        }
    return result % M;
    }      
    bool isPrime(int n) 
    { 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
    } 
int c[4];
signed main()
{   jaldi
    int n,m;
	cin>>n>>m;
	memset(c,-1,sizeof(c));
	int s=1;
	for(int i=0;i<m;i++) 
	{	int x,y;
		cin>>x>>y;
		if(c[x]!=-1 && c[x]!=y) s=0;
	    else 
	    c[x]=y;
	}
	if(c[1]==0 && n>1)
	s=0;
	if(s==0) 
	cout<<-1;
	else
	{   for(int i=1;i<=n;i++) 
	    {	if(c[i]==-1) 
	        {   if(i==1 && n!=1) 
	            cout<<1;
			    else 
			    cout<<0;
		    } 
		    else 
		    cout<<c[i];
	    }
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int h[10],i,j;
	
	for(i = 0; i < 10; i++){
		scanf("%d", &h[i]);
	}
	
	for(i = 0; i < 10; i++){
		if(h[i] < h[i+1]){
			j = h[i];
			h[i] = h[i+1];
			h[i+1] = j;
			
			i = -1;
		}
	}
	
	printf("%d\n%d\n%d\n", h[0], h[1], h[2]);
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
using namespace std;
#define N 1000

int main(){
    int a,b;
    cin>>a>>b;
    int count=0;
    if (a>=2) count+=(a-1)*a/2;
    if (b>=2) count+=(b-1)*b/2;
    cout<<count<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    H, W, A, B = map(int, input().split())
    for i in range(B):
        print('0'*A + '1'*(W-A))
    for i in range(H-B):
        print('1'*A + '0'*(W-A))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3956
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] V = new int[N];
		int[] C = new int[N];
		int ans = 0;
		for(int i = 0; i < N; i++) {
			V[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			C[i] = sc.nextInt();
		}
		for(int i = 0; i < N; i++) {
			if(V[i] > C[i]) {
				ans += V[i] - C[i];
			}
		}
		System.out.println(ans);
	}

}


Measured memory_bytes: 22612