akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;

//map<string>a
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
//組み合わせ
void recursive_comb(vector<int> indexes, int s, int rest, std::function<void(vector<int>)> f) {
	if (rest == 0) {
		f(indexes);
	}
	else {
		if (s < 0) return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(vector<int>)> f) {
	vector<int>indexes(k);
	recursive_comb(indexes, n - 1, k, f);
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
int main() {
	ll N;
	map<ll,int>A;
	cin >> N;
	vector<ll>a(N);
	for (int i = 0; i < N; i++) {
		cin>>a[i];
		A[a[i]]++;
	}
	ll min = 100000000;
	ll tmp;

	if (N%2==0) {
		
		tmp = N/2;
		rep(i, tmp) {

			if (A[i * 2+1] != 2) {


				cout << 0;
				return 0;
			}

		}
	}
	else {

		tmp = (N-1) / 2;
		rep(i, tmp) {

			if (A[(i+1)* 2] != 2) {


				cout << 0;
				return 0;
			}

		}
	}
	ll ans = 1;
	ll tmp2;
	for(int i = 0; i < tmp; i++) {

		ans *= 2;
		ans = ans % mod;
/*
		if (ans >= mod) {
			ans=ans% mod;
			ans *= tmp /(i+1);
			ans = ans % mod;
			tmp2=t
		}*/
	}
	cout << ans;
}


Measured memory_bytes: 4992
#include <algorithm>
#include <string>
#include <set>
#include <iostream>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

string solve(string& s, int k) {
  set<string> ss;
  for (int i = 0; i < s.size(); ++i) {
    for (int k = 1; k <= 5; ++k) {
      ss.insert(s.substr(i, k));
    }
  }
  int pos{};
  for (auto e : ss) {
    if (pos == k - 1)
      return e;
    ++pos;
  }
  return "-1";
}

int main() {
  string s;
  int k;
  cin >> s >> k;
  cout << solve(s, k) << endl;
}


Measured memory_bytes: 1664
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def sum_between(a, b):
    if a > b:a, b = b, a
    return (b-a+1) * (b+a) // 2

def run():
    N = int(input())
    n_dots = 0
    for i in range(1, N+1):
        n_dots += (1+i) * i // 2
    #print(n_dots)
    ans = (N-1) * (N+1) * N // 2
    #print(ans)
    for i in range(N-1):
        l, r = map(int, input().split())
        if l > r: l,r = r,l
        tmp = 0
        if l > 1: tmp += sum_between(r-1, r-l+1)
        tmp += r-l
        tmp += sum_between(N-l, 1)
        #print(tmp)
        ans -= tmp

    print(n_dots - ans)


    ans = (N-1) * N * N


if __name__ == "__main__":
    run()

Measured memory_bytes: 9264
import numpy as np
N=int(input())

str_list = input().split(' ')
A = [int(x) for x in str_list]
A = np.array(A)

while len(A)>1:
    first_min = A[A.argmin()]
    #print(first_min)
    A = np.delete(A, A.argmin())
    second_min = A[A.argmin()]
    #print(second_min)
    A = np.delete(A, A.argmin())
    mean = (first_min+second_min)/2.0
    A = np.append(A, mean)
    #print(A)
print(mean)


Measured memory_bytes: 13520
n, m, l = [int(_) for _ in input().split()]

a = []
b = []
for _ in range(n):
  a.append([int(__) for __ in input().split()])

for _ in range(m):
  b.append([int(__) for __ in input().split()])

output_list = []
for ac in a:
  output = []
  for bc in zip(*b):
    output.append(sum([acc*bcc for acc, bcc in zip(ac,bc)]))
  output_list.append(output)

for olist in output_list:
  print(" ".join([str(_) for _ in olist]))

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

using namespace std;

long long gcd(long long a, long long b) {
	if(b == 0) return a;
	else return gcd(b, a%b);
}


int main() {
	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		long long a, b, c, d;
		cin >> a >> b >> c >> d;
		if(a < b) puts("No");
		else if(d < b) puts("No");
		else {
			long long v = c - b + 1;
			long long x = a;
			x %= gcd(b, d);
			x -= gcd(b, d);
			if(v <= x && x < 0) puts("No");
			else puts("Yes");

		}


	}
}


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;
  	cin >> n;
  	while(1){
      int flag=1;
      for(int i=2;i<=sqrt(n);i++){
		if(n%i==0){
          flag=0;
          break;
        }
      }
      if(flag)break;
      else n++;
    }
  cout << n << endl;
}

Measured memory_bytes: 256
import copy

# a = get_int()
def get_int():
    return int(input())

# a = get_string()
def get_string():
    return input()

# a_list = get_int_list()
def get_int_list():
    return [int(x) for x in input().split()]

# a_list = get_string_list():
def get_string_list():
    return input().split()

# a, b = get_int_multi()
def get_int_multi():  # a, b = get_int_multi()
    return map(int, input().split())

# a_list = get_string_char_list()
def get_string_char_list():
    return list(str(input()))

# print("{} {}".format(a, b))
# for num in range(0, a):
# a_list[idx]
# a_list = [0] * a
'''
while (idx < n) and ():

    idx += 1
'''

ans = 0

def recu(ori, ban, idx, h, w, k, ans):
    if idx == h + w:
        count = 0
        for m in range(h):
            for n in range(w):
                if ban[m][n] == "#":
                    count += 1
        if count == k:
            ans += 1
        return ans

    ans = recu(ori, ban, idx+1, h, w, k, ans)

    ban2 = copy.deepcopy(ban)

    if (idx < h):
        ban2[idx] = ["r"] * w
    else:
        for row in range(h):
            ban2[row][idx-h] = "r"

    ans = recu(ori, ban2, idx+1, h, w, k, ans)

    return ans

def main():
    h, w, k = get_int_multi()

    ans = 0
    ori_ban = []
    for num in range(h):
        ori_ban.append(get_string_char_list())

    print(recu(ori_ban, ori_ban, 0, h, w, k, 0))

if __name__ == '__main__':
    main()




Measured memory_bytes: 9300
#include<stdio.h>

int main(void){
  int eye[2][4]={{}};
  double num;
  int i=0,j,k;
  while(scanf("%lf",&num)!=EOF){
    if(num>=1.1) eye[i][0]++;
    else if(num>=0.6) eye[i][1]++;
    else if(num>=0.2) eye[i][2]++;
    else eye[i][3]++;
    i++;
    i%=2;
  }

  for(i=0;i<4;i++){
    for(j=0;j<2;j++){
      printf("%d%c",eye[j][i],j==1?'\n':' ');
    }
  }
  return 0;
}

	  

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


#define INF 1000000000000


signed main()
 {
string s;
cin>>s;
if(s=="ABC")cout<<"ARC";
else cout<<"ABC";


}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; 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 ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  int a, b, c;
  cin >> a >> b >> c;
  if(b - a == c - b) cout << "YES";
  else cout << "NO";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a[9];
  int n, b, cnt = 0;
  
  for (int i = 0; i < 9; i++)
    scanf("%d", &a[i]);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b);
    for (int j = 0; j < 9; j++)
      if (a[j] == b)
        a[j] = 0;
  }
  
  if (a[0] == 0 && a[1] == 0 && a[2] == 0)
    cnt++;
  if (a[0] == 0 && a[4] == 0 && a[8] == 0)
    cnt++;
  if (a[0] == 0 && a[3] == 0 && a[6] == 0)
    cnt++;
  if (a[1] == 0 && a[4] == 0 && a[7] == 0)
    cnt++;
  if (a[2] == 0 && a[5] == 0 && a[8] == 0)
    cnt++;
  if (a[2] == 0 && a[4] == 0 && a[6] == 0)
    cnt++;
  if (a[3] == 0 && a[4] == 0 && a[5] == 0)
    cnt++;
  if (a[6] == 0 && a[7] == 0 && a[8] == 0)
    cnt++;
  
  if (cnt)
    puts("Yes");
  else
    puts("No");
  
  return 0;
}

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

int main()
{
	string s;
	int total = 700;
	int topping = 0;

	cin >> s;

	for (int i = 0; i < 3; ++i)
	{
		if (s[i] == 'o')
		{
			topping += 100;
		}
	}

	cout << total + topping << endl;
}

Measured memory_bytes: 256
#! /usr/bin/python3
"""  ABC/ARC """

x = int(input())


def main():
    """ xが1200未満では'ARC', 1200以上なら'ABC'と出力 """
    if x < 1200:
        print('ABC')
    else:
        print('ARC')


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
const ll MAX = 1e15 + 1;
int main() {
  int N;
  string S;
  cin >> N;
  vector<int> J(4,0);
  rep(i,N){
    cin >> S;
    if(S.at(0) == 'A'){
      J.at(0) ++;
      continue;
    }
    if(S.at(0) == 'W'){
      J.at(1) ++;
      continue;
    }
    if(S.at(0) == 'T'){
      J.at(2) ++;
      continue;
    }
    if(S.at(0) == 'R'){
      J.at(3) ++;
      continue;
    }
  }
  cout << "AC x " << J.at(0) << endl;
  cout << "WA x " << J.at(1) << endl;
  cout << "TLE x " << J.at(2) << endl;
  cout << "RE x " << J.at(3) << endl;
  return 0;
}

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

vector< pair <int, int> > vect;

int main(){
    int N, M;
    cin >> N >> M;
    int A, B;
    for(int i = 0; i < N; i++){
        cin >> A >> B;
        vect.push_back( make_pair(A,B) );
    }

    sort(vect.begin(), vect.end()); 
    unsigned long long price = 0;
    unsigned long long ta, tb;
    int id = 0;
    while(M > 0){
        if(M > vect[id].second){
            ta = vect[id].first;
            tb = vect[id].second;
            price += (ta*tb);
            // price += (vect[id].first * vect[id].second);
            M -= vect[id].second;
        }else{
            ta = vect[id].first;
            tb = M;
            price += (ta*tb);
            // price += (vect[id].first * M);
            M = 0;
        }
        id++;
    }

    cout << price;
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    for (int i = 0; S[i] != '\0'; i++) {
        S[i] = (S[i] - 'A' + N) % 26 + 'A';
    }
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    int A,B,C,D; cin >> A>> B>>C>>D;
    while (true) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            return 0;
        }

        
    }
    



}

   

    
    



    
                

 













































































































































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

int main(){
  vector<int> A(5);
  rep(i,5) cin >> A[i];
  int k;
  cin >> k;
  if(A[4] - A[0] > k){
    puts(":(");
    return 0;
  }
  puts("Yay!");
  return 0;
}


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

int main(){
  
  string S;
  cin >> S;
  for (int i = 0; i < S.length(); i++){
    if (i % 2 == 0){
      if (S.at(i) == 'L'){
        cout << "No";
        return 0;
      }
    } else{
      if (S.at(i) == 'R'){
        cout << "No";
        return 0;
      }
    }
  }
  
  cout << "Yes";
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

// 最大公約数
long calc_gcd(long a, long b) { while (true) if (a) b %= a, swap(a, b); else return b; }

void solve() {
  long A, B;
  cin >> A >> B;
  long x = calc_gcd(A, B);
  // cout << "x: " << x << endl;
  unordered_map<long, long> mp;
  while (x % 2 == 0) {
    mp[2]++;
    x /= 2;
  }
  for (long i = 3; i * i <= x; i+= 2) {
    while (x % i == 0) {
      mp[i]++;
      x /= i;
    }
  }
  if (x != 1) mp[x]++;
  /*
  for (auto it: mp) {
    cout << it.first << " : " << it.second << endl;
  }
  */
  long ans = 1;
  for (auto it: mp) ans += 1;
  cout << ans << endl;

}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int main() {
    int sx, sy, gx, gy;
    scanf("%d %d %d %d", &sx, &sy, &gx, &gy);
    for(int i = 1; i <= gy - sy; i++)
        printf("U");
    for(int i = 1; i <= gx - sx; i++)
        printf("R");
    for(int i = 1; i <= gy - sy; i++)
        printf("D");
    for(int i = 0; i <= gx - sx; i++)
        printf("L");
    for(int i = 0; i <= gy - sy; i++)
        printf("U");
    for(int i = 0; i <= gx - sx; i++)
        printf("R");
    printf("DR");
    for(int i = 0; i <= gy - sy; i++)
        printf("D");
    for(int i = 0; i <= gx - sx; i++)
        printf("L");
    printf("U\n");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

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

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

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int n; cin >> n;
    int maxv = 0;
    int minv = 100000;

    for(int i=0; i<n; i++){
        int a; cin >> a;
        maxv = max(maxv, a);
        minv = min(minv, a);
    }

    cout << maxv - minv << endl;
}

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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

int n;

int32_t main(){
	fastio;
	int k;
	cin>> n>> k;
	vector<double> p(n+1);
	for(int i = 1; i <= n; ++i){
		cin>> p[i];
		p[i] += p[i-1];
	}
	double ans = 0;
	for(int i = k; i <= n; ++i) ans = max(p[i] - p[i-k], ans);
	cout << fixed << setprecision(7) << (ans+k)/2.0 << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
#include<unordered_map>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;
#define rep(i,n) for(int i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-8;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV int(1e9+7)
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;}
/* Coding Space*/
struct Edge{
  int from,to,cost;
};
vector<Edge> G;
 
#define Nodes 200020
class UF{
public:
  int value[Nodes];
  int over[Nodes]; // When over < 0, 'over' keep number of node(using negative number). -1 means this tree is a node.
  int root(int index){
    int t = index;
    while(over[t] >= 0)
      t = over[t];
    if(index!=t)over[index] = t;// reconnect
    return t;
  }
  bool merge(int a,int b){
    if(this->root(a) == this->root(b)) return false;
    over[root(a)] += over[root(b)]; // 'over' have a number of nodes.
    over[root(b)] = root(a);
    return true;
  }
  UF(){rep(i,Nodes) over[i] = -1;}
};
 
int v,e;
 
ll kruskal(){
  ll ans = 0;
  sort(ALL(G),[](Edge a, Edge b){return a.cost < b.cost;});
  UF u;
  rep(i,(int)G.size()){
    if(u.root(G[i].from) == u.root(G[i].to))
      continue;
    else{
      u.merge(G[i].from,G[i].to);
      ans += G[i].cost;
    }
  }
  return ans;
}

typedef tuple<int,int,int> tiii;
int main(){
  int n; cin >> n;
  vector<tiii> v1;
  vector<tiii> v2;
  rep(i,n){
    int x,y; cin >> x >> y;
    v1.pb(tiii{x,y,i});
    v2.pb(tiii{y,x,i});
  }
  sort(ALL(v1));
  sort(ALL(v2));
  for(int i = 1; i < n; i++){
    int x,y,ii,nx,ny,nii;
    tie(x,y,ii) = v1[i-1];
    tie(nx,ny,nii) = v1[i];
    G.pb(Edge{ii,nii,min(abs(x-nx),abs(y-ny))});
  }
  for(int i = 1; i < n; i++){
    int x,y,ii,nx,ny,nii;
    tie(y,x,ii) = v2[i-1];
    tie(ny,nx,nii) = v2[i];
    G.pb(Edge{ii,nii,min(abs(x-nx),abs(y-ny))});
  }
  cerr << G.size() << endl;
  cout << kruskal() << endl;
}

Measured memory_bytes: 7340
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
string t[50];
bool vd[50][50];
bool flg[50][50];
int r[12];
int h,w,d,n;
int x,y,size;
int cntA,cntB;
int Dy,Dx;
void init();
void delete_flg();
void count_flg();
void dfs(int y,int x);
void print(){
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cout<<(int)flg[i][j];
    }
    cout<<endl;
  }
  cout<<endl;
}
int main(){
  cin>>h>>w>>d>>n;
  for(int i=0;i<h;i++)cin>>t[i];
  for(int i=1;i<=d;i++)cin>>r[i];
  init();
  for(int i=0;i<n;i++){
    cin>>x>>y>>size;
    delete_flg();
    //print();
  }
  count_flg();
  dfs(Dy,Dx);
  if(cntB==0)cout<<"Broken"<<endl;
  else if(cntA==0)cout<<"No"<<endl;
  else if(cntA==cntB)cout<<"Yes"<<endl;
  else cout<<"Unknown"<<endl;
  
  return 0;
}

void init(){
  r[0]=-1;
  r[d+1]=10000;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      flg[i][j]=(t[i][j]!='#');
      vd[i][j]=(t[i][j]=='#');
      if(t[i][j]=='D'){
	Dx=j;
	Dy=i;
      }
    }
  }
  cntA=cntB=0;
}

void delete_flg(){
  int nr;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      nr=max(abs(i-y),abs(j-x));
      if(r[size]<nr&&nr<=r[size+1]){}
      else flg[i][j]=false;
    }
  }
}

void count_flg(){
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(flg[i][j])cntB++;
}
void dfs(int y,int x){
  vd[y][x]=true;
  if(flg[y][x])cntA++;
  if(y>0&&!vd[y-1][x])dfs(y-1,x);
  if(x>0&&!vd[y][x-1])dfs(y,x-1);
  if(y+1<h&&!vd[y+1][x])dfs(y+1,x);
  if(x+1<w&&!vd[y][x+1])dfs(y,x+1);
}

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

int main() {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    int ans=0;
    while(a>=b){
        b *= 2;
        ans ++;
    }
    while(b>=c){
        c *= 2;
        ans ++;
    }

    if(ans <= k) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3628
use proconio::{input, fastout};

fn f(x:i64, a:i64, b:i64) -> i64 {
    return (a*x)/b - a*(x/b);
}

#[fastout]
fn main() {
    input! {
        (a, b, n): (i64, i64, i64),
    }
    println!("{}", f(std::cmp::min(n, b-1), a, b));
}


Measured memory_bytes: 2176
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    
    if(N%500<=A){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21844
import math
import sys
N = int(input())
if N == 1:
    print(0)
    sys.exit()
c, s, f = [0]*(N-1),[0]*(N-1),[0]*(N-1)
for i in range(N-1):
    c[i], s[i], f[i] = map(int, input().split())
for i in range(N):
    cur = 0
    for j in range(i, N-1):
        if cur <= s[j]:
            cur = s[j] + c[j]
        else:
            cur += (s[j]+f[j]*math.ceil((cur-s[j])/f[j])-cur) + c[j]
    print(cur)


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

int main(){
    string s,t; cin >> s >> t;
    int cnt = 0;
    rep(i,s.length()){
        if(s.at(i) != t.at(i)) cnt++;
    }
    cout << cnt << endl;

    return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

bool cmp(pair<ll, ll> &a, pair<ll, ll> &b){
  return b.second < a.second;
}

int main()
{
  ll n, m;
  cin >> n >> m;
  vector<ll> a(n);
  REP(i, n)
  {
    cin >> a[i];
  }

  vector<pair<ll, ll>> bc(m);
  ll b, c;
  REP(i, m){
    cin >> b >> c;
    bc[i]=make_pair(b, c);
  }
  // cout << "a" << endl;

  sort(a.begin(), a.end());
  sort(bc.begin(), bc.end(), cmp);
  // for (pair<ll, ll> p:bc){
  //   cout << p.second << endl;
  // }

  ll f = 0;

  REP(i, m) {
    ll tmpf = f;
    if(a[f]>bc[i].second)
      break;
    REP(j, bc[i].first){
      if(a[tmpf+j]>=bc[i].second)break;
      a[tmpf+j]=bc[i].second;
      f++;
    }
  }

  cout << accumulate(a.begin(), a.end(), 0LL) << endl;

  return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
    public static int A;
    public static int B;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        A = sc.nextInt();
        B = sc.nextInt();

        int max;

        if (A + B < A - B) max = A - B;
        else max = A + B;

        if (max < A * B) max = A * B;

        System.out.println(max);
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
int main(){
    int N; cin >> N;
    int cnt = 0;
    int ans = 0;
    for (int i = 1; i <= N; i+=2)
    {
        cnt = 0;
        for (int j = 1; j <= i; j++)
        {
            if(i%j == 0) cnt++;
        }
        if(cnt == 8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn is_month(x: usize) -> bool {
    1 <= x && x <= 12
}

fn main() {
    input! {
        s: usize,
    }
    let s1 = s / 100;
    let s2 = s % 100;
    if is_month(s1) && is_month(s2) {
        println!("AMBIGUOUS");
    } else if is_month(s1) {
        println!("MMYY");
    } else if is_month(s2) {
        println!("YYMM");
    } else {
        println!("NA");
    }
}


Measured memory_bytes: 4352
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        s: Bytes,
    }

    use num::{bigint::ToBigInt, BigInt};
    let mut x = BigInt::parse_bytes(&s[..], 10).unwrap();

    let mut res = vec![];
    while x != ToBigInt::to_bigint(&0).unwrap() {
        x -= ToBigInt::to_bigint(&1).unwrap();
        let y = x.clone() % ToBigInt::to_bigint(&26).unwrap();
        // println!("{}", y);
        res.push(*(y.to_bytes_le().1).get(0).unwrap_or(&0));
        x /= ToBigInt::to_bigint(&26).unwrap();
    }

    for x in res.iter().rev() {
        print!("{}", (x + b'a') as char);
    }
}


Measured memory_bytes: 2848
#include <cstdio>
#include <string>
#include <iostream>
#include <cmath>
#include <vector>
#include <stack>

using namespace std;


int main(void) {

	string str;
	int N, cntw = 0, cnte = 0, min;

	cin >> N;

	str.resize(N);

	cin >> str;

	for (int i = 0; i < N; i++) {
		if (str[i] == 'E')
			cnte++;
	}

	min = cnte;

	for (int i = 0; i < N; i++) {
		if (str[i] == 'W')
			cntw++;
		else
			cnte--;

		if (cntw + cnte < min)
			min = cntw + cnte;

	}

	cout << min << endl;

	return 0;
}


Measured memory_bytes: 512
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;
int n,k;
int a[3005];
int dp[3005][3005][2];
int find(int i,int j,int turn)
{
	if(j<i)return 0;
	if(dp[i][j][turn]!=-1)return dp[i][j][turn];
	if(turn==0)
	{
		return dp[i][j][turn]=max(a[i]+find(i+1,j,1-turn),a[j]+find(i,j-1,1-turn));
	}
	else
	return dp[i][j][turn]=min(find(i+1,j,1-turn)-a[i],find(i,j-1,1-turn)-a[j]);
	
}
void solve()
  {

	cin>>n;
	rep(i,3005)rep(j,3005)
	{dp[i][j][0]=-1;dp[i][j][1]=-1;}
	rep(i,n)cin>>a[i];
	cout<<find(0,n-1,0);

  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 144964
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int n;
	cin >> n;
	vi num(n);
	REP(i, n)
		cin >> num[i];
	int ans = -1;
	REP(i,n-1)
		FOR(j, i + 1, n) {
		int prod = num[i] * num[j];
		string ps = to_string(prod);
		bool seq = true;
		REP(i, ps.length() - 1)
			if (ps[i + 1] - ps[i] != 1)
				seq = false;
		if (seq) {
			ans = max(ans, prod);
		}
	}
	cout << ans << endl;

}

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

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

    string A, B, C;
    cin >> A >> B >> C;

    if (A[A.size()-1] == B[0] and B[B.size()-1] == C[0])
        cout << "YES" << "\n";
    else
        cout << "NO" << "\n";
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

long long int DP[4000] = {};

int main(){
	
	int N;
	cin >> N;
	
	string s;
	cin >> s;
	
	DP[0] = 1;
	
	for(int i = 0; i < N - 1; i++){
		if(s[i] == '<'){
			for(int j = i; j >= 0; j--){
				DP[j + 1] = DP[j];
			}
			DP[0] = 0;
			for(int j = 0; j <= i; j++){
				DP[j + 1] += DP[j];
				DP[j + 1] %= MOD;
			}
		}else{
			for(int j = i; j >= 0; j--){
				DP[j] += DP[j + 1];
				DP[j] %= MOD;
			}
		}
	}
	
	long long int ans = 0;
	
	for(int i = 0; i < N; i++){
		ans += DP[i];
		ans %= MOD;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cstring>
#include <bits/stdc++.h>
#include <search.h>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include<stack>
#include <utility>
using namespace std;
int main()
{
int arr[5],k,check=0;
for(int i=0;i<5;++i) cin>>arr[i];
cin>>k;
for(int i=0;i<5;i++){
    for(int j=i+1;j<5;j++){
        if(arr[j]-arr[i]>k) check=1;
    }
}
if(check==0) cout<<"Yay!";
else cout<<":(";
return 0;
}


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

bool is_draw(int* first, int* last) {
    bool used[3] = {false, false, false};
    for (int* p = first; p != last; p++) {
        used[*p - 1] = true;
    }
    int cnt = count(used, used + 3, true);
    return cnt == 1 || cnt == 3;
}

int get_win(int* first, int* last) {
    int mi = 5, ma = 0;
    for (int*p = first; p != last; p++) {
        mi = min(mi, *p);
        ma = max(ma, *p);
    }
    if (ma - mi == 1) return mi;
    return ma;
}

int main() {
    int hands[5];
    while (cin >> hands[0], hands[0]) {
        for (int i = 1; i < 5; i++) {
            cin >> hands[i];
        }
        if (is_draw(hands, hands + 5)) {
            for (int i = 0; i < 5; i++) {
                cout << 3 << endl;
            }
        }
        else {
            int win = get_win(hands, hands + 5);
            for (int i = 0; i < 5; i++) {
                if (hands[i] == win) {
                    cout << 1 << endl;
                }
                else {
                    cout << 2 << endl;
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    a=(14-a)%13;
    b=(14-b)%13;
    if(a==b)cout<<"Draw"<<endl;
    else if(a>b)cout<<"Bob"<<endl;
    else cout<<"Alice"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

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



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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	int n, input;
	cin >> n;
	vector<int> a(100001, 0);
	for(int i = 0; i < n; ++i)
	{
		cin >> input;
		a[input]++;
	}

	ll ans = 0;
	for(int i = 0; i <= 100001; ++i)
	{
		ans += a[i] * i;
	}

	int q, b, c;
	cin >> q;
	for(int i = 0; i < q; ++i)
	{
		cin >> b >> c;
		ans += (c - b) * a[b];
		cout << ans << endl;

		a[c] += a[b];
		a[b] = 0;
	}
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 3716
#include<iostream>
#include <cmath>

using namespace std;

void digitLength()
{
    int a, b;
    int number;
    
    while(cin>>a>>b) //input several test cases
    {
        number=log10(a+b)+1; //calculate the digit number; if can be divided by 10, then +1 
        cout<<number<<endl;
    }
   
    return;
}
  
int main(){
  
    digitLength();
    return 0;
}

Measured memory_bytes: 1200
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    set<char>s;
    string w;
    cin >> w;
    for(int i = 0; i < 3; i++){
        s.insert(w[i]);
    }
    if(s.size() == 3){
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    cout << endl;
}


Measured memory_bytes: 256
_,*a = map(int,open(0).read().split())
a.sort()
ans = 0
#M = 30
M = 10**6 + 1
l = [0] * (M)
ans = 0
for i in range(len(a)):
    if l[a[i]] == 0:
        l[a[i]] = 2
        ans += 1
        for x in range(a[i]*2, M, a[i]):
            l[x] = 1
    elif l[a[i]] == 2:
        ans -= 1
        l[a[i]] -= 1
print(ans)


Measured memory_bytes: 106188
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repbit(n) for(ll bit=0,bit<(1<<n),bit++)
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans*(b&1?a:1);
}
int main(){
    ll n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    vector<ll> l(100000),r(100000);
    rep(i,0,q) cin>>l[i]>>r[i];
    vector<ll> cnt(100000);
    rep(i,0,n-1) if((s[i]=='A')&&(s[i+1]=='C')) rep(j,i+1,n) cnt[j]++;
    rep(i,0,q) cout<<cnt[r[i]-1]-cnt[l[i]-1]<<'\n';
}

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

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int h1, m1, h2, m2, k; cin >> h1 >> m1 >> h2 >> m2 >> k;

    int h11 = h1*60 + m1;

    int h22 = h2*60 + m2;

    cout << (h22 - h11)-k << endl;

    return 0;
}



Measured memory_bytes: 3640
N = int(input())

S = [input() for _ in range(N)]

L = [0, 0, 0, 0, 0]

for i in S:
	if i[0] == "M":
		L[0] += 1
	elif i[0] == "A":
		L[1] += 1
	elif i[0] == "R":
		L[2] += 1
	elif i[0] == "C":
		L[3] += 1
	elif i[0] == "H":
		L[4] += 1

pattern = 0

for i in range(5):
	for j in range(5):
		for k in range(5):
			if i < j < k:
				pattern += L[i] * L[j] * L[k]

print(pattern)

Measured memory_bytes: 9776
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n=sc.nextInt();
		int []a=new int [n+1];
		for(int i=0;i<=n;i++)
			a[i]=sc.nextInt();
		long ans=0;
		for(int i=0;i<n;i++) {
			int x=sc.nextInt();
			long min=Math.min(x, a[i]);
			ans+=min;
			x-=min;
			min=Math.min(x, a[i+1]);
			a[i+1]-=min;
			ans+=min;
		}
		out.println(ans);
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

}

Measured memory_bytes: 44100
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i = (a); i <= (n); i++)
#define repr(i, a, n) for (int i = (a); i >= (n); i--)
#define repit(it, v) for (auto(it) = (v).begin(); (it) != (v).end(); (it)++)
#define sortt(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define co(x) cout << (x);
#define con(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define mkp make_pair
#define mkt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/******* Variable ***********************************/
const int maxn = 1e6 * 50;
const double inf = 0x3f3f3f3f3f;
/******* Function ***********************************/
template <typename TYPE, std::size_t SIZE> std::size_t array_length(const TYPE (&)[SIZE]) {
  return SIZE;
}

/******* Main ****************************************/
int main() {
  int x;
  int h = 0, m = 0, s = 0;
  cin >> x;
  h = x / 3600, m = x % 3600 / 60, s = x % 3600 % 60;
  cout << h << ":" << m << ":" << s << endl;
  return 0;
}


Measured memory_bytes: 3108
def pow2(n, mod):
    p = 2
    r = 1
    while n:
        if n % 2:
            r = r * p % mod
        p = (p * p) % mod
        n //= 2
    return r

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

def nCr(n, r, mod):
    t = 1
    r = min(r, n - r)
    for i in range(n - r + 1, n + 1):
        t = t * i % mod
    return t * g2[r] % mod



def prep(n, mod):
    for i in range(2, n):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod // i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)

def main():
    n, a, b = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    prep(2 * (10 ** 5) + 1, mod)
    print((pow2(n, mod) - 1 - nCr(n, a, mod) - nCr(n, b, mod))% mod)


main()


Measured memory_bytes: 26996
///
//  Author : Author
// Created On : Mon Dec 18 2017
//  File : a.cpp
//
#include <cstdint>
#include <iostream>

using namespace std;

int32_t main() {
  char X, Y;
  cin >> X >> Y;
  if (X == Y) {
    cout << "=" << endl;
  } else if (X < Y) {
    cout << "<" << endl;
  } else {
    cout << ">" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <atcoder/all>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define vc(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
// using namespace atcoder;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

int main() {
  int n;
  cin >> n;
  vl a(n), b(n);
  REP(i, n) {
    ll x, y;
    cin >> x >> y;
    a[i] = x+y;
    b[i] = x-y;
  }

  sort(all(a));
  sort(all(b));

  ll ans = max(a[n-1]-a[0], b[n-1]-b[0]);
  cout << ans << endl;

  return 0;
} 

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

int main(){
  int a,b;
  cin >> a >> b;
  if( (a + b) % 2 == 0){
    cout << (a + b)/2 << "\n";
  }else{
    cout << "IMPOSSIBLE\n";
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios>

using namespace std;

int main()
{
	double min, max;
  double x;

	cin >> x;
	min = x;
  max = x;

  while (cin >> x) {
    if (min > x) {
      min = x;
    } else if (max < x) {
      max = x;
    }
  }

	streamsize prec = cout.precision();
  cout << fixed << setprecision(1) << max - min 
       << setprecision(prec) << endl;

  return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
#define N 25
typedef struct{
  int p;
  int l;
  int r;
}Node;
 
void preorder(int);
void inorder(int);
void postorder(int);
 
Node T[N];
int main(){
  int n, i, j, id, left, right;
  scanf("%d\n",&n);
  for(i = 0 ; i < n ; i++){
    T[i].p =T[i].l =T[i].r =-1;
  }
  for(i = 0 ; i < n ; i++){
    scanf("%d%d%d", &id, &left, &right);
    T[id].l = left;
    T[left].p = id;
    T[id].r = right;
    T[right].p = id;
  }
  printf("Preorder\n");
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1){
      preorder(i);
    }
  }
  printf("\n");
  printf("Inorder\n");
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1){
      inorder(i);
    }
  }
  printf("\n");
  printf("Postorder\n");
  for(i = 0 ; i < n ; i++){
    if(T[i].p == -1){
      postorder(i);
    }
  }
  printf("\n");
  return 0;
}
 
void preorder(int u)
{
  if(u == -1) return;
  printf(" %d", u);
  preorder(T[u].l);
  preorder(T[u].r);
}
void inorder(int u)
{
  if(u == -1) return;
  inorder(T[u].l);
  printf(" %d", u);
  inorder(T[u].r);
}
 
void postorder(int u)
{
  if(u == -1) return;
  postorder(T[u].l);
  postorder(T[u].r);
  printf(" %d", u);
}

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    vector<pair<int, int>> p[n + 1];

    for (int i = 1; i <= n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int a, b;
            cin >> a >> b;

            p[i].push_back({a, b});
        }
    }

    int64_t ans = 0;
    for (int bit = 0; bit < (1 << n); bit++) {
        //1 means honest
        bool fl = true;
        for (int i = 1; i <= n; i++) {
            bool isHonest = bit & (1 << (i - 1));
            if (isHonest) {
                for (auto x: p[i]) {
                    int val = x.second;
                    int id = x.first - 1;
                    bool hon = bit & (1 << id);
                    if (hon != x.second)fl = false;
                }
            }
        }
        if (fl)ans = max(ans, (int64_t) __builtin_popcount(bit));
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 256