akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import defaultdict

input = sys.stdin.readline
n, m = map(int, input().split())

xx = set([0]); yy = set([0]);
aa = []; bb = []; cc = []; dd = []; ee = []; ff = []; 
for _ in range(n):
    a, b, c = map(int, input().split())
    xx.add(a)
    xx.add(b)
    yy.add(c)
    aa.append(a); bb.append(b); cc.append(c); 
for _ in range(m):
    d, e, f = map(int, input().split())
    xx.add(d)
    yy.add(e)
    yy.add(f)
    dd.append(d); ee.append(e); ff.append(f); 
xx = sorted(list(xx))
yy = sorted(list(yy))
xp = defaultdict(int)
yp = defaultdict(int)

for i, v in enumerate(xx):
    xp[v] = i
for i, v in enumerate(yy):
    yp[v] = i

h = len(xx) - 1
w = len(yy) - 1
lx = [[0 for _ in range(w + 1)] for _ in range(h + 1)]
ly = [[0 for _ in range(w + 1)] for _ in range(h + 1)]

for i in range(n):
    a, b, c = aa[i], bb[i], cc[i]
    for x in range(xp[a], xp[b]):
        lx[x][yp[c]] = 1

for i in range(m):
    d, e, f = dd[i], ee[i], ff[i]
    for y in range(yp[e], yp[f]):
        ly[xp[d]][y] = 1

visited = [[False for _ in range(w)] for _ in range(h)]
sx, sy = min(xp[0], h - 1), min(yp[0], w - 1)
visited[sx][sy] = True
q = [(sx, sy)]
ans = 0

while q:
    x, y = q.pop()
    ans += (xx[x + 1] - xx[x]) * (yy[y + 1] - yy[y])
    if ly[x][y] == 0:
        if x == 0:
            print('INF'); exit();
        if not visited[x - 1][y]:
            visited[x - 1][y] = True
            q.append((x - 1, y))
    if lx[x][y] == 0:
        if y == 0:
            print('INF'); exit();
        if not visited[x][y - 1]:
            visited[x][y - 1] = True
            q.append((x, y - 1))
    if ly[x + 1][y] == 0:
        if x == h - 1:
            print('INF'); exit();
        if not visited[x + 1][y]:
            visited[x + 1][y] = True
            q.append((x + 1, y))
    if lx[x][y + 1] == 0:
        if y == w - 1:
            print('INF'); exit();
        if not visited[x][y + 1]:
            visited[x][y + 1] = True
            q.append((x, y + 1))

print(ans)


Measured memory_bytes: 562432
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T> using treap = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, unordered_map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

const int INF = 1e18;
signed main() {
  int A, B; cin >> A >> B;
  int ans = INF;
  REPI (z, 1, A + 1) {
    int y = A - (B * z % A);
    if (y == A) y = 0;
    assert((y + B * z) % A == 0);
    int x = (y + B * z) / A;
    if (x < y + z) chmin(ans, A * x);
  }
  cout << (ans == INF ? -1 : ans) << endl;
}



Measured memory_bytes: 3208
#include <stdio.h>

int main() {

int x,i,c,d;
long long int b=0;

scanf("%d\n",&x);
long long int a[x];

for (i = 0; i < x; i++) 
{
  scanf("%lld ",&a[i]);
}


for (i = 0; i < x; i++) 
{
  b=b+a[i];
}



c=a[0];
for (i = 1; i < x; i++) 
{
    if (c<a[i]) 
    {
      c=a[i];
    }
}



d=a[0];
for (i = 1; i < x; i++) 
{
    if (d>a[i]) 
    {
      d=a[i];
    }
}



printf("%d %d %lld\n",d,c,b );
  
  return 0;
}


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

int main() 
{
	string s;
	cin>>s;
	if(s[0] == s[1] && s[1] == s[2])
	{
		cout<<"No"<<endl;
	}
	else
	{
		cout<<"Yes"<<endl;
	}
	 
	return 0;
}

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

int main() {
	double x1, y1, x2, y2, ans;
	cin >> x1 >> y1 >> x2 >> y2;
	double X = pow((x1 - x2), 2);
	double Y = pow((y1 - y2), 2);

	ans = sqrt(X + Y);

	printf("%f", ans);
	return 0;
}


Measured memory_bytes: 3252
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int p[20];
long long dp[20][1<<16];

int main(){
	init_C(110000);
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<b;i++){
		scanf("%d",p+i);p[i]--;
	}
	p[b]=(1<<a);
	dp[0][0]=1;
	int now=1;
	for(int i=0;i<b+1;i++){
		int t=p[i]-now;
		// printf("%d\n",t);
		for(int j=0;j<a;j++){
			for(int k=0;k<(1<<a);k++){
				if(k&(1<<j))dp[i][k]=(dp[i][k]+dp[i][k-(1<<j)])%mod;
			}
		}
		// for(int j=0;j<(1<<a);j++)printf("%d %d: %lld\n",i+1,j,dp[i+1][j]);
		for(int j=0;j<(1<<a);j++){
			if(j>=p[i]-1)dp[i+1][j]=dp[i][j]*fact[j-now+1]%mod*finv[j-now+1-t]%mod;
			// printf("%d %d: %lld\n",i+1,j,dp[i+1][j]);
		}

		for(int j=0;j<a;j++){
			for(int k=0;k<(1<<a);k++){
				if(k&(1<<j))dp[i+1][k]=(dp[i+1][k]-dp[i+1][k-(1<<j)]+mod)%mod;
			}
		}
		if(i==b)break;
		for(int j=0;j<(1<<a);j++){
			// printf("%d %d: %lld\n",i+1,j,dp[i+1][j]);
			if(p[i]<=j)dp[i+1][j]=dp[i+1][j]*(1+j-p[i])%mod;
			else dp[i+1][j]=0;
		}
		// for(int j=0;j<(1<<a);j++)printf("%d %d: %lld\n",i+1,j,dp[i+1][j]);
		now=p[i]+1;
	}
	long long ret=dp[b+1][(1<<a)-1];
	ret=ret*(1<<a)%mod;
	printf("%lld\n",ret);
}


Measured memory_bytes: 20608
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl
#define NL <<"\n"

using namespace std;
using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
//#undef NUIP
#ifdef NUIP
#include "benri.h"
#else
#define out(args...)
#endif
#ifdef __cpp_init_captures
template<typename T>vector<T> table(int n, T v){ return vector<T>(n, v);}
template <class... Args> auto table(int n, Args... args){auto val = table(args...); return vector<decltype(val)>(n, move(val));}
#endif
const ll MOD=1e9+7; //998244353

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout<<fixed<<setprecision(0);
	int n;
	cin>>n;
	vector<string> re;
	if(n<=2){
		re.pb("0");
		if(n==2) re.pb("11");
	}else{
		reps(i,2,n+1) re.pb("1"+string(i-2,'0')+"1");
	}
	cout<<re.size() NL;
	for(auto &s:re) cout<<s NL;
  return 0;
}



Measured memory_bytes: 3340
import math
n = input()
c = 0


for i in range(int(n)):
    x = int(input())
    if x == 1:
        x = 0
    for j in range(2,math.floor(math.sqrt(float(x)))+ 1):
        if x % j == 0:
            x = 0
            break
    if x != 0:
        c += 1	
print(c)

Measured memory_bytes: 7664
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int N =0;
		int sum =0;
		N = scan.nextInt();

		int[] array = new int[N];
		for(int i=0; i<N; i++) {
			array[i] = scan.nextInt();
		}

		Arrays.sort(array);
		for(int i = 0;i<N-1;i++) {
			sum += array[i];
		}
		if(array[N-1]<sum) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 35720
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int dp[202020];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k;
    cin>>n>>k;

    REP(i,n){
        char c;
        cin>>c;
        if(i==k-1) cout<<char(tolower(c));
        else cout<<c;
    }
    cout<<endl;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

#素因数分解
def prime_factorize(n):
    if n == 1:
        return [1]
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
n = inp()
c = Counter(prime_factorize(n))
res = 0
# print(c)
for k,v in c.items():
    if k == 1: continue
    cnt = 0
    for now in range(1,150000):
        cnt += now
        if cnt > v:
            res += now-1
            break
print(res)

Measured memory_bytes: 10448
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    string a,b;
    while(cin>>x>>y)
    {
        y=2*y;
        y=x-y;
        if(y<0) cout<<0<<en;
        else cout<<y<<en;

    }
}



Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K == 0:
    print(max(A))
    quit()

def check(x):
    count = 0
    for a in A:
        count += -(-a // x) - 1
        if count > K:
            return False
    return True


left = 0 # False
right = 10**10 # True
while left + 1 < right:
    mid = (left + right) // 2
    if check(mid):
        right = mid
    else:
        left = mid

print(right)

Measured memory_bytes: 30896
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector
;
#define vvec(s) vector<vector
> ;
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(bool x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(),s.end()
void vout(vector<int> v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    char s;
    cin >> s;
    if(s=='A')
        cout << 'T';
    else if(s=='T')
        cout << 'A';
    else if(s=='G')
        cout <<'C';
    else
        cout << 'G';

    cout << endl;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define sortrev(x)       sort(all(x), greater<int>())
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
#define ld               long double
#define endl 			 "\n";
#define mp 				 make_pair
#define pii 			 <int, int>
#define lb 				 lower_bound
#define ub				 upper_bound
#define len(a)           int((a).size())
#define prec(n)          fixed<<setprecision(n)
#define cnt(n)           __builtin_popcountll(n)
#define pi               pair<int, int>
const int mod = 1000000007;
using namespace std;
// const int N = 1e5 + 5; 
// int n;
// int a[N];



int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
int t;
t = 1;
// cin >>t;
while(t--){

int n;cin >>n;
int a[n];
// map<int,int, greater <int>>mp;
int sum = 0;
vi v;

for(int i = 0 ;i<n;i++){
	int a;cin >> a;
	v.pb(a);
	// mp[a[i]]++;

}

sort(all(v), greater<int>());
sum += v[0];

for(int i = 1; i<n/2; i++){
	sum += (2*v[i]);
}
if(n&1){
	sum += v[n/2];
}

// cout << sum <<
// for(auto x : mp){
// 	cout << x.first << " " << x.second << endl;
// }
// while(1){
// 	cout << "d" <<endl;
// }
// sort(a,a+n);
// int flag = 0;
// int cnt  = 0;
// for(int i = n-1;/ i >=0; i--){
	// int y = mp[a[i]]+1;
	// while(y--){
	// if(cnt == n){
		// break;
	// }
		// cnt++;
		// sum += a[i];
		// debug(sum)
	// }

// }
// 
cout << sum <<endl;
}
return 0;

}
// cout << sum - a[0] << endl;



	// cnt+=mp[a[i]]*2;
	// if(cnt > n){
	// 	flag =1;
	// 	// cnt = n;
	// 	// debug(cnt)
	// }
	// if(flag){
	// 	// debug(cnt)
	// 	sum += (cnt- n)*a[i];
	// 	break;
	// }
	// else{

	// sum += (mp[a[i]]+1)*a[i];
	// }
	// if(cnt == n){
	// 	break;
	// }
// 	// cnt+= (x.second+1);
// 	// if(x.second == 1){
// 		// sum += x.first *2;
// 	// }
// 	// else{
// 		sum += x.first* (x.second +1);
// 	cnt += (x.second + 1);
// 	// }
// 	if(cnt >= n)
// 	{
// 		break;
	// }
// }
// // int cnt= 0;
// // for(int i = n-1 ; i>=0;i--){
// // 	cnt++;
// // 	if(cnt == n-1){
// // 		break;
// // 	}
// // 	sum += a[i]
// // debug(a[n-1])

Measured memory_bytes: 5304
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
 
const ll MOD=1e9+7;
const ll INF=1e18;
 
int dx[]={0, 1, 0, -1};
int dy[]={-1, 0, 1, 0};

map<int,int> m;

int n,d[30][30],abosum[30],ans;
bool abo[30][30],exist[30];

int check(bool tmp[30]){
	int ret = 0,bit = 1;
	for(int i = 1;i <= n;i++){
		if(tmp[i] == true){
			ret += bit;
		}
		bit *= 2;
	}
	return ret;
}

void solve(int tmpans,bool texist[30],int tabosum[30]){
	ans = max(ans,tmpans);
	int bit = check(texist);
	auto itr = m.find(bit);
	if(itr != m.end()) return;
	m[bit] = 1;
	for(int i = 1;i <= n;i++){
		for(int j = i+1;j <= n;j++){
			if(texist[i] == false || texist[j] == false)continue;
			if(tabosum[i] != 0 || tabosum[j] != 0) continue;
			if(d[i][3] != d[j][3]) continue;
			texist[i] = false; texist[j] = false;
			bit = check(texist);
			auto itr = m.find(bit);
			texist[i] = true; texist[j] = true;
			if(itr != m.end()) continue;
			bool tmpexist[30];
			for(int k = 1;k <= n;k++){
				tmpexist[k] = texist[k];
				if(k == i || k == j) tmpexist[k] = false;
			}
			int tmpabosum[30];
			for(int k = 1;k <= n;k++){
				tmpabosum[k] = tabosum[k];
				if( abo[i][k] == true && i < k )tmpabosum[k]--;
				if( abo[j][k] == true && j < k )tmpabosum[k]--;
			}
			solve(tmpans+2,tmpexist,tmpabosum);
		}
	}
}

int main(){
	while(true){
		cin >> n;
		if(n == 0)break;
		ans = 0;
		m.clear();
		for(int i = 1;i <= n;i++){
			for(int j = 1;j <= n;j++){
				abo[i][j] = false;
			}
		}
		for(int i = 1;i <= n;i++){
			exist[i] = true;
			abosum[i] = 0;
			for(int j = 0;j < 4;j++){
				scanf("%d",&d[i][j]);
				//cin >> d[i][j];
			}
		}
		for(int i = 1;i <= n;i++){
			for(int j = i+1;j <= n;j++){
				if(  (d[i][0]-d[j][0])*(d[i][0]-d[j][0]) + (d[i][1]-d[j][1])*(d[i][1]-d[j][1]) < (d[i][2]+d[j][2])*(d[i][2]+d[j][2])    ){
					abo[i][j] = true; abo[j][i] = true;
					abosum[j]++;
				}
			}
		}
		solve(0,exist,abosum);
	//	for(int i = 1;i <= n;i++) cout << "abo" << i << " " << abosum[i] << endl;
/*
		bool flag = true;
		while(flag == true){
			flag = false;
			for(int i = 1;i <= n;i++){
				for(int j = i+1;j <= n;j++){
					if(exist[i] == false || exist[j] == false)continue;
					if(abosum[i] != 0 || abosum[j] != 0) continue;
					if(d[i][3] != d[j][3]) continue;
					ans += 2;
					exist[i] = false; exist[j] = false;
					flag = true;
					for(int k = i+1;k <= n;k++){
						if(abo[i][k] == true){
							abosum[k]--;
						}
					}
					for(int k = j+1;k <= n;k++){
						if(abo[j][k] == true){
							abosum[k]--;
						}
					}
				}
			}
		}
		*/
		cout << ans << endl;
	}
}


Measured memory_bytes: 52308
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif m + f < 30:
        print('F')
    elif m + f >= 80:
            print('A')
    elif 80 > m + f >= 65:
            print('B')
    elif 50 > m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('C')



Measured memory_bytes: 5592
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Map<String, Integer> S = new HashMap<String, Integer>();

        for (int i = 0; i < N; i++) {
            String target = sc.next();
            if (S.get(target) == null) {
                S.put(target, 0);
            }
        }
        System.out.println(S.size());
    }
}

Measured memory_bytes: 78776
#include<cstdio>
#include<iostream>
#define rtn return
using namespace std;
typedef long long ll;

int check(int x){
int cnt = 0;
while(x % 2 == 0) {
x /= 2;
cnt++;
}
rtn cnt;
}
int main(){
int n, a[200], ans = 100000;
cin >> n;
for(int i = 0;i < n;i++) cin >> a[i];

for(int i = 0;i < n;i++) {
if(check(a[i]) < ans) ans = check(a[i]);
}

cout << ans << "\n";
rtn 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int w1=0,w2,h1=0,h2;
int main(){
	int w,h,n,sum=0;
	cin>>w>>h>>n;
	w2=w;h2=h;
	while(n--){
		int x,y,a;
		cin>>x>>y>>a;
		if(a==1){
			w1=max(x,w1);
		}else if(a==2){
			w2=min(x,w2);
		}else if(a==3){
			h1=max(y,h1);
		}else if(a==4){
			h2=min(h2,y);
		}
	}
	if(w2-w1>0&&h2-h1>0) cout<<(w2-w1)*(h2-h1)<<endl;
	else cout<<'0'<<endl;
} 

Measured memory_bytes: 384
import heapq
n,m=map(int,input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
    ma=heapq.heappop(a)
    heapq.heappush(a,(-1)*((-ma)//2))
print(-sum(a))

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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

signed main() {
    char c;
    cin >> c;
    if ('a' <= c && c <= 'z') { cout << "a" << endl; }
    else { cout << "A" << endl; }
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,i,x,y;
	cin>>n>>m;
	int ara[n+1];
	for(i=1;i<=n;i++){
		ara[i]=-1;
	}
	if(m==0){
		if(n==1){
			cout<<0<<endl;
			return 0;
		}
		else{
		cout<<pow(10,n-1)<<endl;
		return 0;
	}
	}
	for(i=1;i<=m;i++){
		cin>>x>>y;
		if(ara[x]==-1||ara[x]==y){
			ara[x]=y;
		}
		else{
			cout<<-1<<endl;
			return 0;
		}
	}
	if(ara[1]==0&&n>=2){
		cout<<-1<<endl;
	}
	else{
		if(ara[1]==-1){
			cout<<1;
			for(i=2;i<=n;i++){
			cout<<max(ara[i],0);
		}
		cout<<endl;
		}
		else{
		for(i=1;i<=n;i++){
			cout<<max(ara[i],0);
		}
		cout<<endl;
	}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    while(true){
        int N; cin >> N;
        if(N==0) break;
        int A[N];
        int sum=0;
        rep(i,N) {cin >> A[i]; sum+=A[i];}
        int ave=sum/N;
        int cnt=0;
        rep(i,N){
            if(A[i]<=ave) cnt++;
        }
        cout << cnt << "\n";
    }
}


Measured memory_bytes: 3184
#include <cstdio>
#include <cstring>

int n, a[110], b[110];
bool ok(int i) {
    if (a[i + 1] != b[i + 1]) return false;
    if (a[i + 2] != b[i + 2]) return false;
    return true;
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d%d", a + i, b + i);
    for (int i = 0; i < n - 2; i++) {
        if (a[i] == b[i] && ok(i)) {
            printf("Yes");
            return 0;
        }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 3204
#!/usr/bin/perl

$line = 0;
while(<>) {
    chomp;
    if($line == 0) {
        $n = $_;
    } else {
        push @s, $_;
        $sum += $_;
    }
    $line++;
}

$min = 0;
foreach (sort{$a <=> $b} @s) {
    if($_ % 10 != 0) {
        $min = $_;
        last;
    }
}

if($sum % 10 != 0) {
    print "$sum\n";
} elsif($min == 0) {
    print "0\n";
} else {
    print $sum - $min, "\n";
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) a.begin(),a.end()
typedef complex<double> Point;
typedef vector<Point> VP;
#define X real()
#define Y imag()

VP c;
vector<double> r;
vector<VP> pg;
int N,M;

// rotation a->b [-pi,+pi]
double angle(Point a,Point b){
    double t = arg(b)-arg(a);
    while(t>+M_PI) t-=2*M_PI;
    while(t<-M_PI) t+=2*M_PI;
    return t;
}

bool inPolygon(Point p,VP& ps){
    int n = ps.size();
    double sumAngle=0;
    rep(i,n){
        sumAngle += angle(ps[i]-p, ps[(i+1)%n]-p);
    }
    return (abs(sumAngle) > 0.1);
}

bool notCross(Point p,Point q){
    bool inAnyCircle = false;
    rep(i,N){
        inAnyCircle |= abs(c[i]-p)<r[i];
        if((abs(c[i]-p)<r[i]) != (abs(c[i]-q)<r[i])) return false;
    }
    if(inAnyCircle) return true;
    
    rep(i,pg.size()){
        if(inPolygon(p,pg[i]) != inPolygon(q,pg[i])) return false;
    }
    return true;
}

int main(void){
    while(cin>>N>>M, N|M){
        c = VP(N);
        r = vector<double>(N);
        rep(i,N){
            double x,y;
            cin>>x>>y>>r[i];
            c[i] = {x,y};
        }

        vector<map<double,int>> G(N);
        rep(i,N)rep(j,N)if(i!=j){
            double d = abs(c[i]-c[j]);
            if(r[i]+r[j]>=d && abs(r[i]-r[j])<d){
                G[i][arg(c[j]-c[i])] = j;
                G[j][arg(c[i]-c[j])] = i;
            }
        }
        
        pg.clear();
        rep(start,N){
            while(G[start].size()){
                int pre = start;
                int cur = (G[start].begin())->second;
                G[start].erase(G[start].begin());
                VP ps = {c[pre]};
                while(cur!=start){
                    ps.push_back(c[cur]);
                    auto itr = G[cur].upper_bound(arg(c[pre]-c[cur]));
                    if(itr==G[cur].end()) itr = G[cur].begin();
                    pre = cur;
                    cur = itr->second;
                    G[pre].erase(itr);
                }
                pg.push_back(ps);
            }
        }

        rep(i,M){
            double px,py,qx,qy;
            cin>>px>>py>>qx>>qy;
            cout<<(notCross(Point(px,py),Point(qx,qy)) ? "YES" : "NO");
            cout<<(i<M-1 ? " " : "\n");
        }
    }

    return 0;
}

Measured memory_bytes: 3460
main :: IO ()
main = do
    str <- getLine
    let inputs = [read word :: Int | word <- words str]
    let a = head inputs
    let b = head $ tail inputs
    let c = head $ tail $ tail inputs

    putStrLn $ unwords $ map show $ order a b c

order :: Int -> Int -> Int -> [Int]
order a b c
    | a <= b = if b <= c then [a, b, c]
                else if c <= a then [c, a, b]
                  else [a, c, b]
    | otherwise = if a <= c then [b, a, c]
                else if c <= b then [c, b, a]
                  else [b, c ,a]

Measured memory_bytes: 3540
import sys
input = sys.stdin.readline
N = int(input())
a = []
x = -float("inf")
res = 0
for _ in range(N):
  x, l = map(int, input().split())
  a.append((x - l, x + l))
a.sort(key = lambda x: x[1])
x = -float("inf")
#print(a)
for i in range(N):
  if x <= a[i][0]:
    x = a[i][1]
    res += 1
print(res)

Measured memory_bytes: 52444
a = int(input())
b = int(input())
c = int(input())

x = int(input())

count = 0

for i in range(a + 1):
    for j in range(b + 1):
        for k in range(c + 1):
            if 500 * i + 100 * j + 50 * k == x:
                count += 1

print(count)

Measured memory_bytes: 3064
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <complex>
#include <iomanip>
#include <cmath>
using namespace std;
typedef long long ll;

int main()
{
  int n;
  cin >> n;
  int ans = 1;
  for (int i = 0; ans <= n; i++) {
    ans *= 2;
  }
  if (n == 1) ans = 2;
  cout << ans / 2 << endl;
}


Measured memory_bytes: 256
object Main extends App {
	val sc = new java.util.Scanner(System.in)
	val pw = new java.io.PrintWriter(System.out)
	
	val n = sc.nextInt
	val x = Seq.fill(n)(sc.nextInt)
	
	val a = x.sum / n
	
	def f(p: Int): Int = x.map(xi => (xi - p) * (xi - p)).sum

	pw.println(Math.min(f(a), f(a+1)))
	pw.flush()
}

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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

using ll = long long int;
using ull = unsigned long long int;
using vi = vector<ll>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;

long double a, b, x, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> a >> b >> x;
  cout << std::setprecision(12);
	x /= a;
	if (a * b / 2.0 > x) {
    	a = 2.0 * x / b;
    	cout << (180 * atan(b / a) / PI) << endl;
    } else {
    	x = (a * b) - x;
    	b = 2.0 * x / a;
    	cout << (180 * atan(b / a) / PI) << endl;
    }
}


Measured memory_bytes: 256
import bisect
A,B,Q = map(int,input().split()) 
INF = 10**18
S = [-INF]+[int(input()) for _ in range(A)]+[INF]
T = [-INF]+[int(input()) for _ in range(B) ]+[INF]
x = [int(input()) for _ in range(Q)]

for a in x:
    ans1 = 0
    ans2 = 0
    b = bisect.bisect_left(S,a)
    c = bisect.bisect_left(T,a)
    res = INF
    for s in [S[b-1],S[b]]:
        for t in [T[c-1],T[c]]:
            d1,d2 = abs(s-a)+abs(s-t),abs(t-a)+abs(s-t)
            res = min(res,d1,d2)
    print(res)

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

int main() {
  int N;
  cin >> N;
  vector <double> A(N);
  for (int i=0;i<N;i++){
  cin >> A.at(i);
  }
  sort (A.begin(),A.end());
  for (int i=0;i<N-1;i++){
   for (int j=0;j<N;j++){
   if (j==0){
    A.at(0)=(A.at(0)+A.at(1))/2;
   }
   else if (j==N-1){
    A.at(j)=0;
   }
   else {
    A.at(j)=A.at(j+1);
   }
   }
  }
  cout << A.at(0) << endl;
 }

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

int N;
int A[201];

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

  while (true){
    bool exist_odd = false;
    for(int i = 0;i < N;++i){
      if(A[i] % 2 != 0) exist_odd = true;
    }
    if(exist_odd) break;
    for(int i = 0;i < N;++i) A[i] /= 2;
    ++res;
  }
  cout << res << endl;

}

Measured memory_bytes: 256
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), C = sc.nextInt(), D = sc.nextInt();
		int t = Math.min(B,D)-Math.max(A,C);
		System.out.println(t<0 ? 0 : t);
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

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

const int MAX_N = 301;
vector<int> item;
int T[MAX_N];

void init() {
  for(int i = 1; i <= 17; ++i) item.push_back(i*i);
  fill(T, T+MAX_N, 0);
  T[0] = 1;
  for(int j = 0; j < item.size(); ++j) {
    for(int i = item[j]; i <= 300; ++i) {
      T[i] += T[i-item[j]];
    }
  }
}

int main() {
  int n;
  init();
  while(cin >> n && n) cout << T[n] << endl;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
 
using namespace std;
 
int main() {
  int a, b, c;
  string op;
  cin >> a >> op >> b;
  if(op == "+")
    c = a + b;
  else if(op == "-")
    c = a - b;
  cout << c << endl;
}

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

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

// 二項係数ライブラリ
long long combination(int n, int k){
    static const int maxi = 1e6+1;
    static vector<ll> fac(maxi,0),finv(maxi,0),inv(maxi,0);
    static const int mod = 1e9+7;
    if (fac[0]==0) {
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < maxi; 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;
        }
    }
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}


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

    vector<ll> As(N);
    REP(i,N) cin >> As[i];

    sort(ALL(As));

    ll sum_maxS = 0;
    // calc sum(maxS)
    FOR(i,K-1,N) {
        sum_maxS += As[i]*combination(i,K-1);
        sum_maxS %= ll(INF+7);
        if(sum_maxS < 0){
          sum_maxS += ll(INF+7);
        }
    }

    ll sum_minS = 0;
    // calc sum(minS)
    REP(i,N-(K-1)) {
        sum_minS += As[i]*combination(N-(i+1),K-1);
        sum_minS %= ll(INF+7);
        if(sum_minS < 0){
          sum_minS %= ll(INF+7);
        }
    }
    ll ans = (sum_maxS-sum_minS) % ll(INF+7);
    if(ans < 0){
      ans += ll(INF+7);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 24448
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline void print(T&& x){cout<<x<<endl;}// 改行付き出力
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int x,y;cin>>x>>y;
  int cnt = x * 2;
  rep(i,x){
    if(cnt == y){
      print("Yes");
      return 0;
    }
    
    cnt += 2;
  }
  if(cnt == y)print("Yes");
  else print("No");
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int64_t s[n + 1]  = {};
    s[0] = 2, s[1] = 1;

    int i;
    for(i = 2; i < n + 1; i++){
        s[i] = s[i - 1] + s[i - 2];
    }

    cout << s[n] << endl;
}


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

#define ll long long

using namespace std;

int main()
{
    string s;
    cin >> s;
    for(int i = 0; i < s.length(); i++)
    {
        if((i + 1) % 2 == 0)
        {
            if(s[i] == 'R') return cout << "No", 0;
        }
        if((i + 1) % 2 == 1)
        {
            if(s[i] == 'L') return cout << "No", 0;
        }
    }
    cout << "Yes";
}


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

int main() {
	ll n, k;
    cin >> n >> k;
    int p[n];
    for (int i = 0; i < n; ++i) {
        cin >> p[i]; p[i]--;
    }
    ll c[n];
    for (int i = 0; i < n; ++i) {
        cin >> c[i];
    }

    ll ans = -1e18;
    for (int st = 0; st < n; ++st) {
        ll rep = 0, cur = st;
        ll score = 0;
        while(true) {
            rep++;
            cur = p[cur];
            score += c[cur];
            if(cur == st) break;
        }
        if(k >= rep)
            ans = max(ans, k / rep * score);

        ll stp = 0;
        ll running = 0;
        while(true) {
            cur = p[cur];
            running += c[cur];
            stp++;
            if(k >= stp) {
                ans = max({ans, running, running + (k-stp)/rep * score});
            }
            if(cur == st) break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
using namespace std;
 
#define pb push_back
#define eb emplace_back

int main()
{
    string s; cin >> s;
    string prev = s.substr(0, 1);
    int ans = 1;

    for(int i = 1; i < s.size(); i++)
    {
        string cur = s.substr(i, 1);
        while(cur.compare(prev) == 0 && i + 1 < s.size())
        {
            i++;
            cur.push_back(s[i]);
        }
        if(cur.compare(prev)) ans++;
        prev = cur;
    }
    cout << ans << endl;

	return 0;
}
 
/* g++ wtf.cpp -o wtf -std=c++11 */

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

int main()
{
	string str;
	cin >> str;

	for( int i = 0; i < str.size()-1; i++ )
	{
		if( str[i] == str[i + 1] )
		{
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}

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

typedef long long ll; 
char c[100][100]; 

int main(){
        int a,b; 
        cin>>a>>b; 
        for(int i=0;i<100;i++) for(int j=0;j<100;j++) { if(i<50) c[i][j]='.'; else c[i][j]='#'; }
        int i=1,j=1; 
        while(b>1) {
                c[i][j]='#'; b--; j+=3; if(j>99) { i+=3; j=1; }
        }
        i=52,j=1; 
        while(a>1){
                c[i][j]='.'; j+=3; a--; if(j>99) { i+=3; j=1; }
        }
        cout<<"100 100"<<endl; 
        for(int i=0;i<100;i++){
                for(int j=0;j<100;j++){
                        cout<<c[i][j]; 
                }
                cout<<endl; 
        }

	return 0; 
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i=0; i < n; i++) cin >> a[i];
    for (int i=0; i < n; i++) cin >> b[i];
    int can = 0;
    int must = 0;
    for (int i=0; i < n; i++){
        if (a[i] > b[i]) must += a[i] - b[i];
        if (b[i] > a[i]){
            can += (b[i] - a[i]) / 2;
        }
    }
    if (must > can) cout << "No" << endl;
    else cout << "Yes" << endl;
    return 0;
}








Measured memory_bytes: 384
#flog2
n,k=map(int,input().split())
lists=list(map(int,input().split()))
mini_list=[0 for i in range(n+1)]
#mini_list[i]=iだんめに行くまでに払う最小のコスト
#帰るには一段上がるか、、、、、K段上がるかのK通りで、それぞれの値を計算してそれのmin値を採用すればいい
mini_list[1]=0
mini_list[2]=abs(lists[0]-lists[1])
for i in range(3,n+1):
    a=10**10
    for j in range(1,k+1):
        if   i>j :
            a=min(a,mini_list[i-j]+abs(lists[i-1]-lists[i-1-j]))
        else:
            break
    mini_list[i]=a
print(mini_list[-1])


Measured memory_bytes: 56544
S=input()
if S=='SUN':
  print(7)
if S=='MON':
  print(6)
if S=='TUE':
  print(5)
if S=='WED':
  print(4)
if S=='THU':
  print(3)
if S=='FRI':
  print(2)
if S=='SAT':
  print(1)

Measured memory_bytes: 3060
use std::io::BufReader;
use std::io::BufRead;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut stdin = BufReader::new(stdin.lock());
    let mut buf = String::new();
    let mut ans = "No";

    let _ = stdin.read_line(&mut buf);
    let n = buf.trim().parse::<i32>().unwrap();

    let max = n / 4 + 1;


    for i in 0..max {
        for j in 0..max {
            if n == i * 4 + j * 7 {
                ans = "Yes";
            }
        }
    }

    println!("{}", ans);
}


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

using namespace std;

#define loop(n) for(int lp=0; lp<(n); lp++)
#define ascent(i, a, b)  for(int (i)=(a); (i)<(b); (i)++)
#define descent(i, a, b) for(int (i)=(a); (i)<(b); (i)--)

#define N 300000

int main() {
  int n;
  vector<int> prime;
  bool flg[N];

  memset(flg, true, sizeof(flg));
  flg[0] = flg[1] = false;
  
  ascent(i, 2, N) {
    if(flg[i]) {
      prime.push_back(i);
      
      for(int j = i; j < N; j += i) {
	flg[j] = false;
      }
    }
  }

  while(cin >> n, n) {
    //  cout << *upper_bound(prime.begin(), prime.end(), n) << " " << *upper_bound(prime.begin(), prime.end(), 2*n) <<  " ";

    cout << upper_bound(prime.begin(), prime.end(), 2*n) - upper_bound(prime.begin(), prime.end(), n) << endl;
  }
  return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 A, B, N;
    cin >> A >> B >> N;

    if (B == 1 || A == 1) {
        cout << 0 << endl;
        return 0;
    }

    auto f = [&](i64 x) {
        return (A * x) / B - A * (x / B);
    };

    i64 x = min(N, B - 1);
    cout << f(x) << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long N, long long i){
    cout << (N - (i-1)) << endl;
}

int main(){

    long long N;
    scanf("%lld",&N);
    long long i;
    scanf("%lld",&i);
    solve(N, i);
    return 0;
}



Measured memory_bytes: 256