akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
queue<P> que;


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

  int N, D, A;
  cin >> N >> D >> A;
  vector<P> p(N);
  rep(i,N) cin >> p[i].first >> p[i].second;
  sort(p.begin(), p.end());
  int cou1 = 0;
  priority_queue<P, vector<P>, greater<P>> que;
  int ans = 0;

  for(int i=0;i<N;i++){
    while(true){
      if(!que.empty()){
        if(que.top().first < p[i].first){
          cou1 -= que.top().second;
          que.pop();
        }
        else break;
      }
      else break;
    }
    int W = p[i].second - cou1*A;
    if(W > 0){
      int k = (W+A-1)/A;
      ans += k;
      cou1 += k;
      que.push(P(p[i].first + (2*D), k));
    }
  }
  cout << ans << endl;
}

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

ll N;
vector<ll> H;

void solve() {
  ll res = 1;
  for (int i = 1; i < N; i++) {
    ll tmp = H[i];
    bool check = true;
    for (int j = 0; j < i; j++) {
      if (H[j] > tmp) {
        check = false;
      }
    }
    if (check) {
      res++;
    }
  }
  cout << res << "\n";
  return;
}

int main() {
  cin >> N;
  H.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int sum,s,ans;
int sbsum(int i,int s,int num){
  if(s == sum && num == 0)
    {ans++; return 0;}
  if(i == 10)
    return 0;
  if(num == -1)
    return 0;
  sbsum(i+1,s,num);
  sbsum(i+1,s+i,num-1);
}

int main(){
  int num;
  while(cin >> num >> sum && !(num == 0 && sum == 0)){ 
    ans=0;
    sbsum(0,0,num);
    cout << ans << endl;
  }
}

Measured memory_bytes: 1160
n = int(input())
ps = list(map(int, input().split()))
sikori = []
for ind in range(n):
    point = ind+1
    if ps[ind] == point:
        sikori.append(point)

if len(sikori) == 0:
    print(0)
elif len(sikori) == 1:
    print(1)
else:
    count = 0
    loc = 0
    while loc != len(sikori):
        if (loc <= len(sikori)-2)and(sikori[loc] + 1 == sikori[loc+1]):
                count += 1
                loc += 2
        else:
            count += 1
            loc += 1
    print(count)

Measured memory_bytes: 56556
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var map= new int[2, n];
        for (int i = 0; i < 2; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < n; j++) map[i, j] = int.Parse(line[j]);
        }
        var dp = new int[2, n];
        dp[0, 0] = map[0, 0];  dp[1, 0] = dp[0, 0] + map[1, 0];
        for (int i = 1; i < n; i++)
            dp[0, i] = map[0, i] + dp[0, i - 1];
        for (int i = 1; i < n; i++)
            dp[1, i] = Math.Max(dp[1, i - 1], dp[0, i]) + map[1, i];
        Console.WriteLine(dp[1, n - 1]);
    }
}

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

int main(){
	int h,n;
	cin>>h>>n;
	int k=0;
	rep(i,n) {int a; cin>>a; k+=a;}
	if(k>=h) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 3600
#include "bits/stdc++.h"

typedef long long ll;
using namespace std;

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

    int n = 2;
    while (true) {
        bool ok = true;
        for (int i = 2; i * i < n; ++i) {
            if (n % i == 0) {
                ok = false;
                break;
            }
        }
        if (ok && x <= n) {
            cout << n;
            return 0;
        }
        n++;
    }
}


Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long LL;
LL gcd(LL a,LL b){
	if (a>b)return gcd(b,a);
	if (a==0) return b;
	return gcd(a,b%a);
}

int main(){
	LL a,b,c;
	scanf("%lld%lld",&a,&b);
	//c=gcd(a,b);
	if (b==0){
		printf("%lld\n",a*2);
		return 0;
	}
	
	if (a%b==0){
		printf("-1\n");
		return 0;
	}
	LL k=2;
	while (a*k%b==0)k++;
	
	
	printf("%lld\n",(a*k));
}
//

Measured memory_bytes: 128
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#ans = [0]*n
n = input()
flag = 0

for i in range(len(n)):
    if n[i] == "7":
        flag = 1

if flag == 1:
    print("Yes")
else :
    print("No")


Measured memory_bytes: 8876
#include<stdio.h>
int main(void)
{
	int a,b;
	char op;
	do{
	scanf("%d %c %d",&a,&op,&b);
	if(0<=a && b<=20000){
	if(op == '+'){
		printf("%d\n",a+b);
	}
	else if(op == '-'){
		printf("%d\n",a-b);
	}   
	else if(op == '*'){
		printf("%d\n",a*b);
	}   
	else if(op == '/'){
		printf("%d\n",a/b);
	}
	}
	}while(op != '?');
return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
void tbd() {
  cout << "TBD" << endl;
  exit(0);
}
 
int main() {
  char g; cin>>g>>g>>g>>g>>g>>g;
  if(g=='1') tbd(); 
  int x; cin>>x;
  if(5<=x) tbd();
  cout << "Heisei" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

struct Node {
  int key;
  struct Node *right, *left, *parent;
};

struct Node *root,*NIL;


void insert(int);
void inorder(struct Node*);
void preorder(struct Node*);

  
int main()
{
  int a,i,b;
  char com[20];
  
  scanf("%d", &a);

  for(i = 0; i < a; i++){
    
    scanf("%s", com);
    
    if(com[0] == 'i'){
      
      scanf("%d", &b);
      
      insert(b);
    }
    
    else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      
      printf("\n");
    }
  }

  return 0;
}


void insert(int s)
{
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node *)malloc(sizeof(struct Node));
  z->key = s;
  z->left = NIL;
  z->right = NIL;

  while(x!= NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    } else{
      x = x->right;
    }
  }
    
  z->parent = y;
  
  if(y == NIL){
    root = z;
  }
  else{
    if( z->key < y->key){
      y->left = z;
    }
    else{
      y->right = z;
    }
  }
}


void inorder(struct Node *t)
{
  if(t == NIL) return;
  
  inorder(t->left);
  
  printf(" %d", t->key);
  
  inorder(t->right);
}


void preorder(struct Node *u)
{
  if(u == NIL) return;
  
  printf(" %d", u->key);
  
  preorder(u->left);
  preorder(u->right);
}



Measured memory_bytes: 25244
#include <stdio.h>
#include <stdlib.h>

int GCD(int a, int b){
	if(b == 0){
		return a;
	}
	else{
		return GCD(b, a % b);
	}
}

int main(){
	int N, K, i, maxA = 0;
	scanf("%d%d", &N, &K);
	int *A = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &A[i]);
		if(maxA < A[i]){
			maxA = A[i];
		}
	}
	int gcd = A[0];
	for(i = 1; i < N; i++){
		gcd = GCD(A[i], gcd);
	}
	if(K <= maxA && K % gcd == 0){
		printf("POSSIBLE\n");
	}
	else{
		printf("IMPOSSIBLE\n");
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    int i = 0;
    while (1) {
        if (i%2 == 0) {
            c -= b;
            if (c <= 0) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        else {
            a -= d;
            if (a <= 0) {
                cout << "No" << endl;
                return 0;
            }
        }
        i++;
    }
}

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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	int N, a[3020];
	ll ans = 0;
	
	cin >> N;
	
	for(int i=0; i<N; i++){
		cin >> a[i];
		ans += a[i] - 1;
	}
	
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll A,B,C,D; cin>>A>>B>>C>>D;
  ll t=0, a=0;
  t=A/D;
  if(A%D>0)
    t++;
  a=C/B;
  if(C%B>0)
    a++;
  if(t>=a) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define Maxn 200000 + 5

int n,q;
char s[Maxn],t[Maxn],d[Maxn];

int Drop(int x){
	for(int i = 1;i <= q;i++){
		if (s[x] == t[i])
		   x += (d[i] == 'R') ? 1:-1;
		if (x > n) return -1;
		if (x < 1) return 1;
	}
	return 0;
}
int main(){
	cin >> n >> q;
	for(int i = 1;i <= n;i++)
		cin >> s[i];
	for(int i = 1;i <= q;i++)
		cin >> t[i] >> d[i];
	int l = 1,r = n,la = 0,ra = n + 1;
	while(l <= r){
		int mid = (l + r) >> 1;
		if (Drop(mid) == 1)
			la = mid,l = mid + 1;
		else
			r = mid - 1;			
	}
	l = 1,r = n;
	while(l <= r) {
		int mid = (l + r) >> 1;
		if (Drop(mid) == -1)
			ra = mid,r = mid - 1;
		else 
			l = mid + 1;
	}	
	cout << ra - la - 1 << endl;
	return 0;	
}

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
using namespace std;

int INF=1e9;

int main(){  
    int A,B;
    cin>>A>>B;
    int x=A-B;
    if(A!=1&&B!=1){
        if(x>0){
            cout<<"Alice"<<endl;
        }
        else if(x==0){
            cout<<"Draw"<<endl;
        }
        else{
            cout<<"Bob"<<endl;
        }
    }
    if(A==1||B==1){
        if(A==1&&B!=1){
            cout<<"Alice"<<endl;
        }
        else if(x==0){
            cout<<"Draw"<<endl;
        }
        else{
            cout<<"Bob"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import math
from functools import reduce

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def gcd(a, b):
    while b:
        #print(a,b)
        a, b = b, a % b
    return a

def acinput():
    return list(map(int, input().split(" ")))


A, B = acinput()

x=factorization(gcd(A,B))
if x[0][0]==1:
    n=1
else:
    n=len(x)+1

if n==1:
    print(1)
else:
    print(n)


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

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

	string s;cin >> s;
	if(s.size() == 1){
		cout << s << endl;
	}else{
		long long ans = stoll(s);
		for(int i = 1; i < pow(2,s.size()-1); i++){
			string sumstr = s.substr(0,1);
			for(int j = 0; j < s.size()-1; j++){
				if((i>>j)&1==1){
					ans += stoll(sumstr);
					sumstr = s.substr(j+1,1);
				}else{
					sumstr += s[j+1];
				}
			}
			ans += stoll(sumstr);
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 384
from collections import deque

N = int(input())
S = input()

def exists(length):
    que = deque()
    V = set()
    for left in range(N - length + 1):
        if left > length - 1:
            V.add(que.popleft())
        T = S[left: left + length]
        if T in V:
            return True
        que.append(T)
    return False

ok = 0
ng = N
while ng - ok > 1:
    mid = (ok + ng) // 2

    if exists(mid):
        ok = mid
    else:
        ng = mid

print(ok)



Measured memory_bytes: 11124
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

int main() {

	ll n;
	cin >> n;

	if (n / 10 == 0) {
		cout << n << endl;
		return 0;
	}

	bool ninefull = true;

	int ans = 0;
	while (n >=10) {
		
		ans += 9;

		if (n % 10 != 9) {
			ninefull = false;
		}

		n /= 10;
	}

	if (ninefull) {
		ans += n;
	}
	else {
		ans += n - 1;
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int N,a[1100];
  cin>>N;
  for(int i=0;i<N;i++) cin>>a[i];
  sort(a,a+N);

  cout<<a[N-1]-a[0]<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)
//#define MULTI_TEST
//#define GOOGLE
#ifdef LOCAL
#include "debugger.h"
#else
#define db(...)
#endif
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
const ll MOD = 1e9 + 7;
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }

void solve(int tc)
{
	int n, q;
	cin >> n >> q;
	map<ll, vector<p64>> hol;
	for (int i = 0; i < n; i++)
	{
		ll si, fi, xi;
		cin >> si >> fi >> xi;
		hol[xi].push_back({si, fi});
	}
	s64 peeps;
	map<ll, ll> ans;
	v64 D(q, 0);
	for (int i = 0; i < q; i++)
	{
		cin >> D[i];
		peeps.insert(D[i]);
	}
	for (auto itr : hol)
	{
		sort(itr.se.begin(), itr.se.end());
		for (auto x : itr.se)
		{
			ll si = x.fi, fi = x.se;
			ll xi = itr.fi;
			auto l = peeps.lower_bound(si - xi);
			auto r = peeps.upper_bound((2 * fi - 2 * xi - 1) / 2);
			if (r != peeps.begin())
				r--;
			else
				continue;
			queue<ll> rem;
			for (auto lol = l; lol != peeps.end() && *lol <= *r; lol++)
				ans[*lol] = xi, rem.push(*lol);
			while (sz(rem))
			{
				peeps.erase(rem.front());
				rem.pop();
			}
		}
	}
	for (ll x : D)
	{
		if (!ans.count(x))
			cout << -1 << ln;
		else
			cout << ans[x] << ln;
	}
	return;
}

int main()
{
#ifndef LOCAL
	FASTIO;
#endif
	int t = 1;
#ifdef LOCAL
	clock_t start, stop;
	start = clock();
#endif
#ifdef MULTI_TEST
	cin >> t;
#endif
	for (int tc = 1; tc < t + 1; tc++)
	{
#ifdef GOOGLE
		cout << "Case #" << tc << ": ";
#endif
		solve(tc);
	}
#ifdef LOCAL
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


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

int main(void)
{
	char c1, c2, c3;
	char d1, d2, d3;
	cin >> c1 >> c2 >> c3 >> d1 >> d2 >> d3;

	if (c1 == d3 && c2 == d2 && c3 == d1)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    ll X;
    cin >> X;
    ll ans = 0;
    if(X <= 6){
        ans = 1;
    }else{
        ans = X/11*2;
        ll sub = X%11;
        if(0 != sub){
            if(sub <= 6)ans++;
            else ans+=2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3580
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <queue>
using namespace std;
#define sd(n) scanf("%d", &n)
#define sdd(n, m) scanf("%d%d", &n, &m)
#define sddd(n, m, k) scanf("%d%d%d", &n, &m, &k)
#define pd(n) printf("%d\n", n)
#define pc(n) printf("%c", n)
#define pdd(n, m) printf("%d %d\n", n, m)
#define pddd(n, m, z) printf("%d %d %d\n", n, m, z)
#define pld(n) printf("%lld\n", n)
#define pldd(n, m) printf("%lld %lld\n", n, m)
#define plddd(n, m, z) printf("%lld %lld %lld\n", n, m, z)
#define sld(n) scanf("%lld", &n)
#define sldd(n, m) scanf("%lld%lld", &n, &m)
#define slddd(n, m, k) scanf("%lld%lld%lld", &n, &m, &k)
#define sf(n) scanf("%lf", &n)
#define sc(n) scanf("%c", &n)
#define sff(n, m) scanf("%lf%lf", &n, &m)
#define sfff(n, m, k) scanf("%lf%lf%lf", &n, &m, &k)
#define ss(str) scanf("%s", str)
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define per(i, a, n) for (int i = a; i >= n; i--)
#define mem(a, n) memset(a, n, sizeof(a))
#define debug(x) cout << #x << ": " << x << endl
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mod(x) ((x) % MOD)
#define gcd(a, b) __gcd(a, b)
#define lowbit(x) (x & -x)
typedef pair<int, int> PII;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
inline int read()
{
    int ret = 0, sgn = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            sgn = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        ret = ret * 10 + ch - '0';
        ch = getchar();
    }
    return ret * sgn;
}
inline void Out(int a) //ê?3?ía1ò
{
    if (a > 9)
        Out(a / 10);
    putchar(a % 10 + '0');
}

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
///快速幂m^k%mod
ll qpow(int x, int n)
{
    if (n == 0)
        return 1;
    ll res = qpow((x * x), n / 2);
    if (n & 1)
        res = (res * x);
    return res;
}

const int N = 2e5 + 10;
int a[N]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main()
{
    int n;
    sd(n);
    pd(a[n-1]);
    return 0;
}


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

#define MAXN 100020

long long dp[MAXN];

int main() {
  	int N; cin >> N;
  	long long h[MAXN];
  	for (int i = 0; i < N; i++) cin >> h[i];
	dp[0] = 0;
  	dp[1] = abs(h[1]-h[0]);
  	for (int i = 2; i < N; i++) {
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
  	cout << dp[N-1] << endl;
}

Measured memory_bytes: 1792
N, K = gets.chomp.split(" ").map(&:to_i)
p = 0 
dp = Array.new(K,K)
base = 1.0 / N
N.times do |i|
	n = N - i
	nk = n
	omote = 0
	while nk < K
		if dp[nk-1] == K
			nk = nk * 2
			omote += 1
		else
			omote += dp[nk-1]
			break
		end
	end
	dp[n-1] = omote
	p += base * (0.5**omote)
end

puts(p)

Measured memory_bytes: 4604
n = int(input())
a,b = map(int,input().split())
L = list(map(int,input().split()))

p,q,r = [],[],[]
for i in range(n):
    if 0<=L[i]<=a:
        p.append(L[i])
    elif a+1 <= L[i] <=b:
        q.append(L[i])
    else:
        r.append(L[i])
print(min(len(p),len(q),len(r)))

Measured memory_bytes: 9160
#include <iostream>

using namespace std;

int main() {
	int N;
	long long sum=0;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		if (!((i % 3 == 0) || (i % 5 == 0))) {
			sum += i;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<stack>
using namespace std;
using ll = long long;
int main() {
	ll N, A, B, ans;	cin >> N >> A >> B;
	if (N == 1) {
		if (A == B)ans = 1;
		else ans = 0;
	}
	else if (A > B)ans = 0;
	else ans = (N - 2)*(B - A) + 1;
	cout << ans << endl;
	cin >> N;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	static String NotFound(String s){
		char[] alph = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
		int num;
		for(int i=0; i<26; i++){
			num = 0; 
			for(int j=0; j<s.length(); j++){
				if(alph[i]==s.charAt(j))num++;
			}
			if(num==0)return String.valueOf(alph[i]);
		}
		return "None";
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		System.out.println(NotFound(S));
	}
}

Measured memory_bytes: 24280
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template <typename T>
struct ST{
  using F = function<T(T,T)>;
  int n;
  F f;
  T ti;
  vector<T> dat;
  ST(){};
  ST(F f,T ti):f(f),ti(ti){}
  void init(int n_){    
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }
  void build(const vector<T> &v){
    int n_=v.size();
    init(n_);
    for(int i=0;i<n_;i++) dat[n+i]=v[i];
    for(int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }
  void set_val(int k,T x){
    dat[k+=n]=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);    
  }
  T query(int a,int b){
    T vl=ti,vr=ti;
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[l++]);
      if(r&1) vr=f(dat[--r],vr);
    }
    return f(vl,vr);
  }
};
int main(){
    auto f=[](ll a,ll b){return gcd(a,b);};
    ll n;
    cin>>n;
    V<ll> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    ST<ll> seg(f,0ll);
    seg.build(a);
    ll ans=0;
    for(int i=0;i<n;i++)chmax(ans,gcd(seg.query(0,i),seg.query(i+1,n)));
    cout<<ans<<"\n";
}


Measured memory_bytes: 3072
#include<stdio.h>

#include<string.h>


int main(void){
	char s[16];
	int n;
	int i,c;

	scanf("%s",s);

	n = strlen(s);

	c= 0;

	for(i=0;i<n;i++){
		if(s[i] == 'o'){
			c++;
		}
	}

	if(n - 7 <= c){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    String number[] = new String[9999];
    int Sum=0;
    int i=0;

    do{
      number[i] = scanner.nextLine();
      i++;
    }while(!(number[i-1].charAt(0)=='0'));

    for (int j=0; j<i-1; j++) {
      Sum = 0;
      for(int k=0;k<number[j].length();k++){
				Sum += (number[j].charAt(k)) - 48;
			}
			System.out.println(Sum);
    }
}
}


Measured memory_bytes: 26452
#include <stdio.h>

int main(void)
{
	int n, a[10005], i;
	a[0] = 2;
	
	for (i = 1; i < 10000; i++){
		a[i] = a[i - 1] + i + 1;
	}
	
	while (scanf("%d", &n) != EOF){
	
		printf("%d\n", a[n - 1]);
	}
	
	return (0);
}

Measured memory_bytes: 632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}

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

    ll a, b, c;
    cin >> a >> b >> c;

    if(a == b  && b == c) cout << "Yes" << endl;
    else cout << "No" << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  char s[3]={};
  int i,ct=0;
  for(i=0;i<3;i++)
  {
    scanf("%c",s+i);
    if(s[i]!='0' && s[i]!='1')
    {
      i--;
    }
  }
  for(i=0;i<3;i++)
  {
    if(s[i]=='1')
    {
      ct++;
    }
  }
  printf("%d\n",ct);
  return 0;
}


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

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

  if((C-A) + (C-B) < 0){
    if(X >= Y){
      cout << min((2*C*Y + A*(X-Y)),(2*C*X)) << endl;
    } else{
      cout << min((2*C*X + B*(Y-X)),(2*C*Y)) << endl;
    }
  } else {
    cout << (A*X + B*Y) << endl;
  }
  return 0;
}


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


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

    int n,r=0;
    cin>>n;
    vector<ll> a(n);
    rep(i,n)cin>>a[i];
    
    ll s=0,x=0,ans=0;
    
    rep(l,n){
        if(r<l||l==0){
        r=l;
        x^=a[l];
        s+=a[l];
      }
        while(1+r<n && (s+a[r+1])==(x^a[r+1])){
            r++;
            s+=a[r];
            x^=a[r];

        }
        ans+=(r+1-l);
        s-=a[l];
        x^=a[l];
        
    }
    
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define fi first
#define se second
#define fr(i,s,e) for(i=s;i<e;i++)
#define ms(arr,val) memset(arr,val,sizeof(arr))
using namespace std;

const int mxn=2e5+1;

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

  int t=1;
//  cin>>t;
  int tt=1;
  while(t--){
     int n;
     int i;
     cin>>n;
     pair<int,int> arr[n];
     fr(i,0,n)
     {
      cin>>arr[i].fi>>arr[i].se;
     }
     sort(arr,arr+n);
     int remove=0;
     stack<int> st;
     for(int i=0;i<n;i++)
     {
      while(st.size() and arr[st.top()].fi+arr[st.top()].se>arr[i].fi-arr[i].se)
      {
        int value=arr[st.top()].fi+arr[st.top()].se;
        if(value>arr[i].fi+arr[i].se)
        {
          st.pop();
          st.push(i);
        }
        else break;
     }
       if(st.size()==0 or arr[st.top()].fi+arr[st.top()].se<=arr[i].fi-arr[i].se)
         st.push(i);
     }
     cout<<st.size();
    }
  return 0;
}



Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	vector<int>vs(26, -1), vt(26, -1);//aのとき0だから
	repp(i, 0, s.size()) {
		int a = s[i] - 'a';
		int b = t[i] - 'a';
		if (vs[a] != -1 || vt[b] != -1) {
			if (vs[a] != b || vt[b] != a) {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			vs[a] = b;
			vt[b] = a;
		}
	}
	cout << "Yes" << endl;
	return  0;
}


Measured memory_bytes: 776
#include<stdio.h>
#include<stdlib.h>//counting sort
void Countingsort(int *a, int *b,int *c,int n, int max){
    int i;
    for(i=0;i<n;i++){
        *(c+*(a+i))+=1;
    }
    for(i=1;i<=max;i++){
        *(c+i)=*(c+i)+*(c+i-1);
    }
    for(i=n-1;i>=0;i--){
        *(b+*(c+*(a+i)))=*(a+i);
        *(c+*(a+i))-=1;
    }
}
int main(void){
    int m,n,i,*a,*b,*c,max=0;
    scanf("%d",&n);
    m=n;
    a=malloc(sizeof(int)*n);
    b=malloc(sizeof(int)*2000000);
    for(i=0;i<n;i++){
        scanf("%d",(a+i));
        if(max<*(a+i)) max=*(a+i);
    }
    c=malloc(sizeof(int)*(max+1));
    Countingsort(a,b,c,n,max);
    for(i=1;i<n;i++){
        printf("%d ",*(b+i));
    }
    printf("%d\n",*(b+i));
    free(a);
    free(b);
    free(c);
    return 0;
}


Measured memory_bytes: 17052
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#define ll long long

using namespace std;

int a[108];

int out(int N) {
	cout << a[0];
	for (int i = 1; i < N; i++) {
		cout << " " << a[i];
	}
	cout << endl;
	return 0;
}

int main() {
	int N; cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	out(N);

	for (int i = 1; i < N; i++) {
		int v = a[i];
		for (int j = i - 1; j >= 0; j--) {
			if (a[j] <= v) {
				break;
			}
			a[j + 1] = a[j];
			a[j] = v;
		}
		out(N);
	}
}




Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int kouhosu = sc.nextInt();
    int kion = sc.nextInt();
    int kibou = sc.nextInt();
    double min = 100000;
    int index = 0;
    for(int i = 0; i < kouhosu; i++) {
      double dis = Math.abs(kibou - kion + sc.nextDouble() * 0.006);
      if(dis < min) {
        min = dis;
        index = i;
      }
    }
    System.out.println(index + 1);
  }

}


Measured memory_bytes: 28700
#include <bits/stdc++.h>
#define lli long long 
using namespace std;


typedef std::vector<lli> vi;
int main() {
	lli n,w;
	cin>>n>>w;
	vi dp(w+1,0);
	
	for(lli i=0;i<n;i++)
	{
	    lli a,b;
	    cin>>a>>b;
	    
	    for(lli j=w-a;j>=0;j--)
	    {
	        dp[j+a]=max(dp[j+a],dp[j]+b);
	    }
	}
	lli ans=0;
	for(lli i=0;i<=w;i++)
	{
	    ans=max(ans,dp[i]);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
using System;

namespace AOJ.Volume1
{
    public class Badminton
    {
        public static int Main()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (input == "0") { break; }

                int a = 0;
                int b = 0;
                int len = input.Length;
                for(int i = 1; i < len; i++)
                {
                    if(input[i] == 'A') { a++; }
                    else { b++; }
                }
                // ???????????????
                if (a > b) { a++; }
                else { b++; }

                Console.WriteLine(string.Format("{0} {1}", a, b));
            }
            return 0;
        }
    }
}

Measured memory_bytes: 9148
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;

struct mint {
  ll x; // typedef long long ll;
  mint(ll 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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void comb_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll com(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  vector<ll> v(n);
  rep(i, n) cin >> v[i];
  sort(ALL(v));
  mint res = 0;
  comb_init();
  for (int i = 0; i < n; ++i) {
    // cout << com(i, k-1) << endl;
    // cout << com(n-i-1, k-1) << endl;
    if(i >= k-1) res += com(i, k-1) * v[i];
    if(n-i-1 >= k-1) res -= com(n-i-1, k-1) * v[i];
    // cout << res << endl;
  }
  cout << res << endl;

}


Measured memory_bytes: 13056
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

a, b, c, d = map(int, input().split())

dif = b - a + 1

# divC = dif // c
# divD = dif // d
divC = 0
divD = 0

if a % c == 0:
    CF = a
else:
    CF = a + (c - (a % c))

if a % d == 0:
    DF = a
else:
    DF = a + (d - (a % d))

divC = (b - CF) // c + 1
divD = (b - DF) // d + 1


kobai = lcm(c, d)
if a % kobai == 0:
    KF = a
else:
    KF = a + (kobai - (a % kobai))

#divKobai = dif // kobai
divKobai = (b - KF) // kobai + 1

# print('# divC: ' + str(divC))
# print('# divD: ' + str(divD))
#print(divKobai)
print(dif - (divC + divD - divKobai))


Measured memory_bytes: 3064
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c,x,y;
    cin>>a>>b>>c;
    cin>>x>>y;
    ll res=1e18;
    for(int i=0;i<2*1e5+1;i+=2){
        ll temp=0;
        temp+=c*i;
        if(x-i/2>0){
            temp+=a*(x-i/2);
        }
        if(y-i/2>0){
            temp+=b*(y-i/2);
        }
        chmin(res,temp);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        if(N==0) out.println(1);
        else out.println(0);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 32936
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007


#A
a = LI()
i = a.count(5)
j = a.count(7)
if i == 2 and j == 1:
    print("YES")
else:
    print("NO")
#B

#C
"""
def check(n):
    n = list(map(int,list(str(n))))
    s = 0
    for i in n:
        s += f[i]
    return s == 0
n,k = LI()
d = LI()
f = [0 for i in range(10)]
for i in d:
    f[i] = 1
while 1:
    if check(n):
        print(n)
        quit()
    n += 1
"""
#D
"""
def f(x,y):
    return fact[x-1+h-y]*fact[y-1+w-x]*inv_fact[x-1]*inv_fact[y-1]*inv_fact[w-x]*inv_fact[h-y]%mod
h,w,a,b = LI()
fact = [1]*(h+w+1)
for i in range(h+w):
    fact[i+1] = fact[i]*(i+1)%mod
inv_fact = [0]*(h+w+1)
inv_fact[h+w] = pow(fact[-1],mod-2,mod)
for i in range(h+w)[::-1]:
    inv_fact[i] = inv_fact[i+1]*(i+1)%mod
ans = 0
for i in range(1,min(w-b,h-a)+1):
    ans += f(b+i,a+i)
    ans %= mod
print(ans)
"""


#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 38512
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}

fn main() {
    let n = read::<usize>();
    let mut pairs = vec![];
    for _ in 0..n {
        let v = read_vec::<i64>();
        pairs.push((v[0], v[1]));
    }
    let mut x = pairs[0].0;
    let mut y = pairs[0].1;
    for (t, a) in pairs.into_iter().skip(1) {
        let ratio = max((x + t - 1) / t, (y + a - 1) / a);
        x = t * ratio;
        y = a * ratio;
    }
    println!("{}", x + y);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

ll pow(ll a, ll b) {
    if (b == 0) return 1;
    if (b % 2) return a * pow(a, b - 1);
    return pow(a * a, b / 2);
}
//a^(-1)≡a^(p-2) (mod p) (but p is prime)
ll powMod(ll a, ll b, ll p) {
    if (b == 0) return 1;
    if (b % 2) return (a * powMod(a, b - 1, p)) % p;
    return powMod(a * a % p, b / 2, p);
}

ll combi(ll n, ll r) {
    ll ret = 1;
    for (int i = 0; i < r; ++i) {
        (ret *= n - i) %= MOD7;
        (ret *= powMod(i + 1, MOD7 - 2, MOD7)) %= MOD7;
    }
    return ret;
}

int main() {
    ll n, a, b, ans = 0;
    cin >> n >> a >> b;
    ans += powMod(2, n, MOD7);
    (ans += MOD7 - 1) %= MOD7;
    (ans += MOD7 - combi(n, a)) %= MOD7;
    (ans += MOD7 - combi(n, b)) %= MOD7;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 * Created by hiramekun at 20:10 on 2019-11-16.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

const int MAX = 5100000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

void solve() {
    ll x, y;
    cin >> x >> y;
    if ((x + y) % 3 != 0) {
        cout << 0 << '\n';
        return;
    }
    ll n = (2 * y - x) / 3, m = (2 * x - y) / 3;
    if (n < 0 || m < 0) {
        cout << 0 << '\n';
        return;
    }
    COMinit();
    ll ans = COM(n + m, n);
    cout << ans << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

using namespace std;

int main(){
    char a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"<"<<endl;
    }
    else if (a==b){
        cout<<"="<<endl;
    }else{
        cout<<">"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	//n := r.nextInt()
	r.Scan(true)
	l := r.nextStringArray().toInts()

	sort.Sort(sort.IntSlice(l))

	bFind := func(a []int, n int) int {
		return sort.Search(len(a), func(i int) bool {
			return n <= a[i]
		})
	}

	ans := 0
	for i := range l {
		for j, endJ := i+1, len(l)-1; j < endJ; j++ {
			x := bFind(l[j+1:], l[i]+l[j])
			ans += x
		}
	}
	fmt.Fprintln(stdout, ans)
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int R;
  cin >> R;

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

  return 0;
}


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

#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define int long long
#define ll long long

ll INF = (1LL << 60);
int mod = 1000000007;
using P = pair<int, int>;
using S = long long;
using F = long long;
S op(S a, S b) { return std::max(a, b); }
S e() { return 0; }
S mapping(F f, S x) { return f + x; }
F composition(F f, F g) { return f + g; }
F id() { return 0; }
int dp[300010];
signed main() {
	int N; cin >> N;
	int K; cin >> K;
	std::vector<S> v(N, 0);
	atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(v);
	vector<int>a(N); vector<P> b(N); for (int i = 0; i < N; i++) { cin >> a[i]; b[i] = { a[i],i }; }
	sort(b.begin(), b.end());
	vector<int>tmp(N);
	vector<int>now;
	for (int i = 0; i < N; i++) {
		tmp[b[i].second] = i;
		now.push_back(b[i].first);
	}
	for (int i = 0; i < N; i++) {
		int idx1 = lower_bound(now.begin(), now.end(), -K + a[i]) - now.begin();
		int idx2 = upper_bound(now.begin(), now.end(), K + a[i]) - now.begin();
		int now = seg.prod(idx1, idx2);
		dp[i] = now + 1;
		seg.set(tmp[i], dp[i]);
		tmp[i]--;
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans = max(ans, dp[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 32124