akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

int main()
{
    int no_of_operations, A, B;
    cin >> no_of_operations >> A >> B;

    long long max_biscuits = 0;

    if(B <= A + 2)
    {
        max_biscuits = no_of_operations + 1;
    }
    else if(B > A)
    {
        if(no_of_operations <= A)
        {
            max_biscuits = no_of_operations + 1;
        }
        else
        {
            max_biscuits = B;
            no_of_operations -= (A + 1);// cout << max_biscuits << " " << no_of_operations << endl;

            int no_of_cycles = no_of_operations/2;
            max_biscuits += no_of_cycles*1LL*(B - A);

            no_of_operations %= 2; //cout << max_biscuits << " " << no_of_operations << endl;

            while(no_of_operations > 0)
            {
                max_biscuits++;

                no_of_operations--;
            }// cout << max_biscuits << " " << no_of_operations << endl;
        }
    }

    cout << max_biscuits;
    return 0;
}


Measured memory_bytes: 256
S = list(input())
LI = [[]]
for i in range(len(S)):
    if S[i] == 'A':
        LI[-1].append(0)
    elif S[i] == 'B':
        if i != len(S)-1:
            if S[i+1] == 'C':
                LI[-1].append(1)
            else:
                LI.append([])
    elif S[i] == 'C':
        if i != 0:
            if S[i-1] != 'B':
                LI.append([])
ansl = []
for i in range(len(LI)):
    cnt = 0
    for j in range(len(LI[i])):
        if LI[i][j] == 0:
            ansl.append(0)
            cnt += 1
        else:
            ansl.append(cnt)
ans = sum(ansl)
print(ans)

Measured memory_bytes: 18880
s = input()
def isp(str): return 1 if str == str[::-1] else 0

x_cnt=0
nox_s=[]
for c in s:
    if c=="x":
        x_cnt+=1
    else:
        nox_s.append(c)

if not isp(nox_s):
    print("-1")
    exit()

x_lis=[]
cnt=0
for c in s:
    if c=="x":
        cnt+=1
    else:
        x_lis.append(cnt)
        cnt=0
x_lis.append(cnt)
ans=0

for i in range(len(x_lis)):
    if x_lis[i] != x_lis[-i-1]:
        ans+= abs(x_lis[i] - x_lis[-i-1])

print(int(ans/2))

Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n;
   cin>>n;
   vector<int>arr(n);
   for(int i=0;i<n;i++){
       cin>>arr[i];
       }
   vector<int>ans(n);
  ans[0]=0;
  ans[1]=abs(arr[0]-arr[1]);    
  for(int i=2;i<n;i++){
      ans[i]=min(ans[i-2]+abs(arr[i-2]-arr[i]),ans[i-1]+abs(arr[i-1]-arr[i]));
      }
  cout<<ans[n-1];     
    }

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define F2(i,a,b) for(int i=a;i<(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define dF2(i,a,b) for(int i=a;i>(b);--i)
#define eF(i,u) for(int i=h[u];i;i=nxt[i])
#define SZ(x) ((int)(x).size())
#define prts(x) return puts(x),0
#define pirtf(x) return printf("%d\n",x),0
#define re return
typedef long long LL;
typedef double ld;
typedef pair<int,int> pii;
inline int Gcd(int X,int Y){return Y?Gcd(Y,X%Y):X;}
inline LL Gcd(LL X,LL Y){return Y?Gcd(Y,X%Y):X;}
inline int Pow(int B,LL E,int M){if(!(B%=M))return 0;int A=1;for(;E;E>>=1,B=(LL)B*B%M)E&1?A=(LL)A*B%M:0;return A;}
inline LL Pow(LL B,LL E,LL M){if(!(B%=M))return 0;LL A=1;for(;E;E>>=1,B=B*B%M)E&1?A=A*B%M:0;return A;}
const int INF=0x3f3f3f3f;

map<int,int> mp;
set<int> st;

int n,q,m,k;
int a[300005],b[300005];
int f[300005],g[300005];
int M[3005][3005];
char str[300005];

int h[300005],nxt[600005],to[600005],tot;
inline void ins(int x,int y){nxt[++tot]=h[x];to[tot]=y;h[x]=tot;}

int main(){
	int A,T;
	scanf("%d%d%d",&n,&T,&A); A-=T;
	F(i,1,n) scanf("%d",a+i);
	int Ans=1e9; int Ai=0;
	F(i,1,n) if(abs(a[i]*6+A*1000)<Ans) Ai=i, Ans=abs(a[i]*6+A*1000);
	printf("%d\n",Ai);
	return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<stdlib.h>
#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
 
using namespace std;
 
 
int main(void) {
	long long int n;
	long long int a, b;
	int count = 100;
	int p = 100;
 
	cin >> n;
	for (long long int i=1; i*i<=n; i++) {
		if (n % i == 0) {
			a = i;
			b = n / i;
			FOR(t, 0, 100) {
				if ((a / (int)pow(10, t) <= 0)&&(b / (int)pow(10, t) <= 0)) {
					p = t;
					
					break;
				}
			}
			
			if (p < count) {
				count = p;
			}
		}
	}
 
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
A,B,M= map(int,input().split())
A_list = list(map(int,input().split()))
B_list = list(map(int,input().split()))
coupon = []
for _ in range(M):
  x,y,d = map(int,input().split())
  coupon.append([x,y,d])
mini = min(A_list) + min(B_list)
Answer = mini

for i in range(M):
  discount = A_list[coupon[i][0]-1] + B_list[coupon[i][1]-1] - coupon[i][2]
  if discount < Answer:
    Answer = discount
print(Answer)

Measured memory_bytes: 30764
#include<bits/stdc++.h>
using namespace std;
vector <int> g[100005];
struct edge{
    int x, y, i, c;
};
edge e[100005];
bool f1(edge a, edge b){
    return a.x<b.x;
}
bool f2(edge a, edge b){
    return a.i<b.i;
}
map <int, bool> col[100005];
int main(){
    int n, a, b;
    scanf("%d", &n);
    for(int i=0; i<n-1; ++i){
        scanf("%d%d", &a, &b);
        e[i].i=i;
        if(a>b){
            e[i].y=a;
            e[i].x=b;
        }
        else{
            e[i].x=a;
            e[i].y=b;
        }
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int mx=0;
    for(int i=1; i<=n; ++i) if(g[i].size()> mx) mx=g[i].size();
    printf("%d\n", mx);
    sort(e, e+n-1, f1);
    int j=0, c=1;
    for(int i=1; i<=n; ++i){// i mi je cvor j mi je broj grane

        while(e[j].x==i){
            while(col[e[j].x][c]) c++;
            e[j].c=c;
            col[e[j].y][c]=true;
            j++;
            c++;
        }
        c=1;
    }
    sort(e, e+n-1, f2);
    for(int i=0; i<n-1; ++i) printf("%d\n", e[i].c);
    return 0;
}


Measured memory_bytes: 21632
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int n;
	cin>>n;
	vi arr(n);
	for(int &i:arr)cin>>i;
	sort(arr.rbegin(),arr.rend());
	ll ans=1;
	int cnt = 0;
	for(int i=0;i<n-1;i++) {
		if(arr[i]==arr[i+1])ans*=arr[i],i++,cnt++;
		if(cnt==2)break;
	}
	if(cnt!=2)cout<<0;
	else
	cout<<ans;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3644
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
LL n, x;
int main() {
	cin >> n >> x;
	LL now = 0, ans = 1;
	for (LL gg, i = 1; i <= n; ++i) {
		scanf("%lld", &gg);
		now += gg;
		if (now <= x) ++ans; else break ;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define MOD  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
#define all(x) x.begin(),x.end()
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
int n,m;
vector<int> v[114514];
int dp[114514];
int dp2[114514];
int fact(int x,int y){
    if(y==0)return 1;
    else if(y==1)return x;
    else if(y%2==0)return fact(x*x%m,y/2)%m;
    else return fact(x*x%m,y/2)%m*x%m;
}
int dfs(int i,int par){
    int &res=dp[i];
    if(~res)return res;
    res=1;
    for(auto e:v[i]){
        if(e==par) continue;
        (res*=dfs(e,i)+1)%=m;
    }
    return res;
}
vector<int>front[114514],back[114114];
void dfs2(int i,int par,int carry){
    dp2[i]=carry*dp[i]%m;
    int h=v[i].size();
    front[i].resize(h+2);
    back[i].resize(h+2);
    front[i][0]=1;
    rep(j,0,h){
        if(v[i][j]==par)front[i][j+1]=front[i][j];
        else front[i][j+1]=front[i][j]*(dp[v[i][j]]+1)%m;
    }
    back[i][h+1]=1;
    for(int j=h;j>=1;j--){
        if(v[i][j-1]==par)back[i][j]=back[i][j+1];
        else back[i][j]=back[i][j+1]*(dp[v[i][j-1]]+1)%m;
    }
    //cout<<"Find"<<endl;
    for(int j=0;j<v[i].size();j++){
        if(v[i][j]==par)continue;
        int k=front[i][j]*back[i][j+2]%m*carry%m;
        dfs2(v[i][j],i,k+1);
    }
}
signed main(){
    cin>>n>>m;
    if(n==1){
        cout<<1<<endl;return 0;
    }
    rep(i,0,n-1){
        int a,b;cin>>a>>b;
        a--;b--;
        v[a].ps(b);v[b].ps(a);
    }
    fill(dp,dp+n,-1);
    dfs(0,-1);
    dfs2(0,-1,1);
    rep(i,0,n)cout<<dp2[i]<<endl;return 0;
}

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

ll n, m;

int main() {
    cin >> n >> m;
    Vl a(n);
    REP(i, n) cin >> a[i];

    Vl x(n+1);
    x[0] = 0;
    REP2(i, 1, n+1) {
        x[i] += x[i-1] + a[i-1];
        x[i] %= m;
    }

    Mll cnt;
    REP(i, n+1) {
        cnt[x[i]] += 1;
    }

    ll res = 0;
    for (auto x: cnt) {
        res += x.second * (x.second - 1) / 2;
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 5760
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$`&I!ES>v480@q58h!atm#yy9VRsPBOM1P1R4zjN;6H{*Uu)DfG;HPJ=@O?ts4jEja1J!?~Lt0nPD28hd~cF?bD=Xf%^5=(LPV;u<v!hiYAA)(~D@S(wK4OJMGmKogksHzD*O==oaXBc{y{`Fr`W8luZIog@8c76Wq+79@~t>c^(s~w9Rs`V`us@O@LyhqyPmKoCExGHNA#n5phT&7e`qhVbc=x4zF(|NT=~DGF(lOmEsIX(ws;WNT>a`v!FJ<dX0^CY!`6vkLphstf|Ghyk}ydX1u!R@-5#rU}V$73K#^S;7N@DFW7-)le`q#WIVQ`14Bv66J?Y)d#Z|jv4v55U(V)=(H7F+#YVNjas$(d2oDv=a<|rbybt=wdP8t{s)KuoJIX!8-F$@Ra>r_}w?$<gs;x7Jk!>Cy;51zfTT$iwsPi>V!e5yk9-B{lpk>lD|KRh>h5")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 9860
n = int(input())
aa = list(map(int, input().split()))

import fractions

head = {}
head[0] = aa[0]
for i in range(1, n):
    head[i] = fractions.gcd(head[i - 1], aa[i])

tail = {}
tail[n - 1] = aa[-1]
for i in range(n - 2, -1, -1):
    tail[i] = fractions.gcd(tail[i + 1], aa[i])

candidate = 1
for i in range(0, n):
    if i == 0:
        gcd2 = tail[i + 1]
        candidate = max(gcd2, candidate)
    elif i == n - 1:
        gcd1 = head[i - 1]
        candidate = max(gcd1, candidate)
    else:
        gcd1 = head[i - 1]
        gcd2 = tail[i + 1]
        candidate = max(fractions.gcd(gcd1, gcd2), candidate)

print(candidate)


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

void koch(double x0, double y0, double x1, double y1, int n)
{
	if (n == 0)
	{
		cout << x0 << " " << y0 << endl;
	}
	else
	{
		double c1x,c1y,c2x,c2y,c3x,c3y;
		double dx = x1 - x0;
		double dy = y1 - y0;
		//double L = sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
		c1x = x0 + dx / 3;
		c1y = y0 + dy / 3;
		c2x = (x0 + x1) / 2 - (dy * sqrt(3) / 6);
		c2y = (y0 + y1) / 2 + (dx * sqrt(3) / 6);
		c3x = x0 + dx * 2 / 3;
		c3y = y0 + dy * 2 / 3;

		koch(x0,y0,c1x,c1y,n-1);
		koch(c1x,c1y,c2x,c2y,n-1);
		koch(c2x,c2y,c3x,c3y,n-1);
		koch(c3x,c3y,x1,y1,n-1);
	}

}

int main()
{
	int n;
	cin >> n;
	koch(0,0,100,0,n);
	cout << 100 << " " << 0 << endl;
	return 0;
}


Measured memory_bytes: 3240
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n,k=MI()
lis=LI()
dp=[-1 for i in range(k+1)]
for i in range(lis[0]):
    dp[i]=0
def memo(x):
    if dp[x]!=-1:
        return dp[x]
    else:
        for i in range(n):
            if x-lis[i]<0:
                continue
            elif dp[x-lis[i]]!=-1:
                if dp[x-lis[i]]==0:
                    dp[x]=1
                    return 1
            else:
                if memo(x-lis[i])==0:
                    dp[x]=1
                    return 1
        dp[x]=0
        return 0
for i in range(k+1):
    memo(i)
#print(dp)
if dp[-1]==0:
    print("Second")
else:
    print("First")
            


Measured memory_bytes: 80900
#include <bits/stdc++.h>
#define int long long
#define INF 1000000007
#define P pair<int,int>
using namespace std;
bool prime(int n){
	for(int i=2;i<=sqrt(n);i++){
		if(n%i==0)return false;
	}
	return n!=1;
}
int pow_mod(int n,int k,int m){
	if(k==0)return 1;
	else if(k%2==1)return pow_mod(n,k-1,m)*n%m;
	else {
		int t=pow_mod(n,k/2,m);
		return t*t%m;
	}
}

signed main(){
	string s;
	cin>>s;
	int ans=0,cnt=0;
	for(int i=0;i<s.size();i++){
	    if(s[i]=='W'){
	        ans+=i-cnt;
	        cnt++;
	    }
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 644
import math
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, x = map(int, readline().split())

vol = (a ** 2) * b

if vol / 2 >= x:
    tan = 2 * x / a / (b ** 2)
    rad = math.atan(tan)
    deg = math.degrees(rad)
    ans = 90-deg
    print(ans)
else:
    tan = 2 * (a * b - x / a) / a ** 2
    rad = math.atan(tan)
    deg = math.degrees(rad)
    print(deg)


Measured memory_bytes: 9332
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     db(i)               cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int n; cin>>n;
    unordered_map<string, int> hmap;
    string s;
    for(int i = 0; i < n; ++i){
    	cin>>s;
    	hmap[s]++;
    }
    cout<<hmap.size()<<'\n';
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 17748
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func scanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		num = nextInt()
		nums = append(nums, num)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	x := nextInt()
	l := scanNums(n)
	length := 0
	bound := 1
	for i := 0; i < n; i++ {
		length += l[i]
		if length <= x {
			bound++
		} else {
			break
		}
	}
	fmt.Println(bound)
}


Measured memory_bytes: 640
Imports System
Imports System.Collections.Generic
class p
    shared sub main()
        dim s = Console.ReadLine().Split()
        dim a = Integer.Parse(s(0))
        dim b = Integer.Parse(s(1))
        dim x = Integer.Parse(s(2))
        
        if a + b >= x and a <= x then
            Console.WriteLine("YES")
        else
            Console.WriteLine("NO")
        end if
    end sub
end class


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

int main() {
	int x, n;
	cin >> x >> n;
	vector<int> p(n);
	bool flag = false;
	rep(i,n) {
		cin >> p.at(i);
		if (p.at(i) == x) flag = true;
	}
	if (!flag) {
		cout << x << "\n";
	}
	else {
		int prev_x = x - 1;
		int next_x = x + 1;
		
		while (true) {
			bool p_flag = false;
			bool n_flag = false;
			rep(i,n) {
				if (p.at(i) == prev_x) p_flag = true; 
				if (p.at(i) == next_x) n_flag = true;
			}
			if (!p_flag) {
				cout << prev_x << "\n";
				break; 
			}
			else if (!n_flag) {
				cout << next_x << "\n";
				break; 
			}
			prev_x--;
			next_x++;
		}
	}
	return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int list[] = new int[n];
		int sum = 0;

		for (int i = 0; i < n; i++) {
			list[i] = sc.nextInt();
		}

		for (int i = 0; i < list.length; i++) {
			for (int j = i + 1; j < list.length; j++) {
				sum += list[i] * list[j];
			}
		}

		System.out.println(sum);

		sc.close();

	}
}


Measured memory_bytes: 35676
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <set>
#include <stack>
#include <queue>
#include <list>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
// // // // // // // // // // // // // // // // // // // // // // 
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve(){

    return;
}


int main(){
    int n;
    cin >> n;
    int x = n % 10;
    if (x == 2 || x == 4 || x == 5 || x == 7 || x == 9){
        ctn("hon");
    }
    else if (x == 0 || x == 1 || x == 6|| x == 8){
        ctn("pon");
    }
    else{
        ctn("bon");
    }
    return 0;
}


Measured memory_bytes: 3580
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<iostream>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}
//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,m,sum=0;
    cin>>n>>m;
    
    rep(i,m){
        ll a;
        cin>>a;
        sum+=a;
    }
    if(n<sum) cout<<-1<<endl;
    else cout<<n-sum<<endl;
    return 0;
}


Measured memory_bytes: 3660
import sys
import time
st = time.perf_counter()
# ------------------------------

N, K = map(int, input().split())
A = list(map(int, input().split()))
A = [i-1 for i in A]

cnt = [-1] * N
cnt[0] = 0
now = 0
for i in range(1, 1001001001):
    now = A[now]
    if cnt[now] == -1:
        cnt[now] = i
    else:
        circle = i - cnt[now]
        t = cnt[now]
        break
if K - t > 0:
    amari = (K - t) % circle
    for _ in range(amari):
        now = A[now]
else:
    now = 0
    for i in range(K):
        now = A[now]
print(now + 1)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


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

using namespace std;

typedef vector<int> VI;
typedef long long LL;
#define PB push_back
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IN(v) cin>>v
#define OUT(v) cout<<v<<endl


int main() {
  int N, K;
  IN(N);
  IN(K);

  VI x(N), y(N);
  VI xary, yary;
  REP(i, N) {
    IN(x[i]);
    IN(y[i]);
    xary.PB(x[i]);
    yary.PB(y[i]);
  }
  SORT(xary);
  SORT(yary);
  LL ans = 1LL * (xary[N-1]-xary[0]) * (yary[N-1]-yary[0]);
  REP(i, N) {
    FOR(j, i+1, N) {
      REP(k, N) {
        FOR(l, k+1, N) {
          LL S = 1LL * (xary[j]-xary[i]) * (yary[l]-yary[k]);
          int count = 0;
          REP(_i, N) {
            if (xary[i] <= x[_i] && x[_i] <= xary[j] && yary[k] <= y[_i] && y[_i] <= yary[l])
              ++count;
          }
          if (count >= K)
            ans = min(ans, S);
        }
      }
    }
  }
  OUT(ans);
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
int n, m;

int main() {
	cin >> n >> m;
	cout << n - m + 1 << endl;
}

Measured memory_bytes: 764
n, c, k = map(int, input().split())
ttt = [int(input()) for _ in range(n)]
ttt.sort()
ans = 0
waiting_count = 0
waiting_first = -1

for t in ttt:
    if waiting_first == -1:
        waiting_count = 1
        waiting_first = t
    elif waiting_first + k < t:
        ans += 1
        waiting_count = 1
        waiting_first = t
    else:
        waiting_count += 1
    if waiting_count >= c:
        ans += 1
        waiting_count = 0
        waiting_first = -1
if waiting_count:
    ans += 1
print(ans)


Measured memory_bytes: 7420
# maintain overall min 
# iterate over two loops 
# find the absolute distance and before exiting the first maintain overall min
# also check the distance of last and first house
def findDistBetween(i,j):
    return abs(i - j)

def minDistfindDistBetweenLastAndFirstHouse(i,j):
    dist = findDistBetween(i, j)
    return K - dist 

K, N = input().split()
As = input().split()

K = int(K)
N = int(N)

# print ("As is")
# print (As)
# print (As.split())
A = [0] * len(As)
for i in range(len(As)):
    A[i] = int(As[i])
    
# A = list(map(lambda x: int(x), As))
# print (A)
# overAllMin = float('inf')
# minDist = 0 
# for i in range(N):
#     minDist = 0
#     for j in range(N):
#         # print (i, j)
#         minDist += findDistBetween(A[i], A[j])
#     # find the dist b/w last and first house
#     # minDist2 = minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1])
#     # minDist = min(minDist, minDist2)
#     print ("Min dist", minDist)
#     # print ("min dist2", minDist2)
#     overAllMin = min(overAllMin, minDist)

# print (overAllMin)
overAllMin = float('inf')
Arev = list(reversed(A))
dist1 = 0 
dist2 = 0
prevHouse = -1
for i in range(N):
    # print ("PRev house", prevHouse)
    # print ("Next house", A[i])

    dist1 = max(findDistBetween(A[i], prevHouse), dist1)
    prevHouse = A[i]
    

ma = max(dist1, minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1]))
print (K - ma)
# for i in range(N):
#     count = 0
#     curHouse = A[i]
#     j = i
#     flag0 = 0 
#     flag1 = 0
#     dist1 = 0 
#     dist2 = 0
#     while count < N:
#         if flag0 is 0:
#             dist1 += findDistBetween(curHouse, A[j])
#         curHouse = A[j]
#         j += 1
#         flag0 = 0
#         count += 1

#         if j == N and count < N: 
#             print ("in condition")
#             j = 0
#             dist1 += minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1])
#             flag0 = 1
        
        # count += 1

        # print ("dist1", dist1)

    # count = 0
    # curHouse = A[i]
    # j = i
    # while count < N:
    #     if flag1 is 0:
    #         dist2 += findDistBetween(curHouse, A[j])
    #     curHouse = A[j]
    #     j -= 1
    #     count += 1
    #     flag1 = 0
    #     if j == -1 and count < N: 
    #         j = N - 1 
    #         dist2 += minDistfindDistBetweenLastAndFirstHouse(A[0], A[-1])
    #         flag1 = 1
    #     # count += 1 
# overAllMin = min(dist1, K - findDistBetween(A[0], A[-1]), overAllMin)
# print (dist1,  K - findDistBetween(A[0], A[-1]), overAllMin)
        
# print (overAllMin)    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
     
    
    




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

using namespace std;
// #define int long long
mt19937 rnd(time(0));
typedef long long ll;
typedef long double ld;

// #define _GLIBCXX_DEBUG
#define f first
#define s second
#define pb push_back
#define pii pair<int, int> 
#define vi vector<int>

void solve(){
    int n;
    cin >> n;
    vector<pii> a[n];
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        a[i] = vector<pii>(k);
        for (int j = 0; j < k; ++j) {
            cin >> a[i][j].f >> a[i][j].s;
        }
    }
    int ans = 0;
    for (int mask = 1; mask < (1 << n); ++mask) {
        // cout << mask << endl;
        bool ok = 1;
        for (int i = 0; i < n; ++i) {
            if (mask & (1 << i))
            for (auto &j : a[i]) {
                if (j.s == 0) {
                    ok &= !(mask & (1 << j.f - 1));
                } else {
                    ok &= ((mask & (1 << j.f - 1)) > 0);
                }
            }
        }
        // cout << ok << ' ' << mask << endl;
        // cout << ok << endl;
        if (ok) {
            int temp = 0;
            for (int i = 0; i < n; ++i) {
                if ((1 << i) & mask)
                    temp++;
            }
            ans = std::max(ans, temp);
        }
    }
    cout << ans << endl;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
//
//  main.cpp
//  AtCoder
//
//  Created by atsushi on 2019/12/29.
//

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <bitset>

#define REP(i, N) for(int i=0; i<(N); i++)
#define ALL(N) (N).begin(), (N).end()
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;

using ll = long long;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
    in<int> N;
    vector<string> s;
    vector<int> t;
    string X;
    
    REP(i,N)
    {
        string ts;int tx;
        
        cin >> ts >> tx;
        s.push_back(ts);
        t.push_back(tx);
    }
    cin >> X;
    
    int r = 0;
    bool found = false;
    
    REP(i, N) {
        if (found)
            r += t[i];
        else if (s[i] == X)
            found = true;
    }


    return r;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }

int main(int argc, const char * argv[]) {
    // insert code here...
    plot(solve);
    return 0;
}


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

int main(){
  int n,d,x,ans=0;
  cin>>n>>d>>x;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin>>a[i];
  sort(a.begin(),a.end());
  for(int i=0; i<n; i++) {
    int k=1;
    while(k<=d) {
      ans++;
      k += a[i];
    }
  }
  cout<<ans+x;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        int answer = gcd(a, b);
        System.out.println(answer);
    }

    public static int gcd(int a,  int b){

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

}


Measured memory_bytes: 26224
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N, M;
    cin >> N >> M;

    ll r[N + 1];
    REP(i, N){
        r[i] = 0;
    }
    ll a, b;
    rep(i, M){
        cin >> a >> b;
        r[a]++;
        r[b]++;
    }

    REP(i, N){
        cout << r[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 3616
/*
for:
Hussien , Ayman , Emad
Abanob , George , Genawy
Ka8eem , Mosta7il , Stawro
Shahat , Omar
ICPC DREAM
*/
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include<bits/stdc++.h>
#include<chrono>
#include<unordered_map>
#include <random>
#include <complex> 
using namespace std;
#define ll long long
#define ld double
#define ull unsigned ll 
#define endl '\n'
#define mk make_pair
#define holla(x,y) cout <<"# holla "<<y<<" "<< #x << " is " << x << endl;
typedef complex<long double> point;
#define sz(a) ((int)(a).size())
#define all(n) (n).begin(), (n).end()
#define EPS 1e-9
#define OO 1e9
#define X real()
#define Y imag()
#define vec(a,b) ((b)-(a))
#define polar(r,t) ((r)*exp(point(0,(t))))
#define angle(v) (atan2((v).Y,(v).X))
#define length(v) ((long double)hypot((v).Y,(v).X))
#define lengthSqr(v) (dot(v,v))
#define dot(a,b) ((conj(a)*(b)).real())
#define cross(a,b) ((conj(a)*(b)).imag())
#define rotate(v,t) (polar(v,t))
#define rotateabout(v,t,a)  (rotate(vec(a,v),t)+(a))
#define reflect(p,m) ((conj((p)/(n)))*(n))
#define normalize(p) ((p)/length(p))
#define same(a,b) (lengthSqr(vec(a,b))<EPS)
#define mid(a,b) (((a)+(b))/point(2,0))
#define perp(a) (point(-(a).Y,(a).X))
#define colliner pointOnLine 
enum STATE { IN, OUT, BOUNDRY };
const double PI = acos(-1.0);
#ifndef ONLINE_JUDGE
int __builtin_popcount(int mask) {
	int cnt = 0;
	for (int i = 0; i < 23; i++)
		if (mask&(1 << i)) ++cnt;
	return cnt;
}
#endif
void fast_in_out() {
	std::ios_base::sync_with_stdio(NULL);
	cin.tie(NULL); cout.tie(NULL);
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
}
int dx[] = { 0,0,-1,1,-1,1,-1,1,0 };// remeber the secret ultimate move
int dy[] = { -1,1,0,0,-1,-1,1,1,0 };// the 0,0 not moving move 
int lx[] = { 2, 2, -1, 1, -2, -2, -1, 1,0 };
int ly[] = { -1, 1, 2, 2, 1, -1, -2, -2,0 };
const ld eps = 1e-9;
const int N = 1e5 + 50, M = 500 + 10, mod = 1e9 + 7;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int main() {
	fast_in_out();
	//cout << fixed << setprecision(9);
	//freopen("fetiera.in", "r", stdin);
	//kolo ray7 , ya 5rabyy
	int ar[] = { 300000,200000,100000 };
	int x, y;
	cin >> x >> y;
	int sum = 0;
	if (x == 1 && y == 1)
		sum += 400000;
	if (x <= 3)
		sum += ar[x - 1];
	if (y <= 3)sum += ar[y - 1];
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#import<bits/stdc++.h>
using namespace std;
long long i,j,k,m,n,t[60];
string x,s[60];
main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(;i++<n;)cin>>s[i]>>t[i];
	cin>>x;
	for(i=1;s[i]!=x;)i++;
	for(;i++<n;)k+=t[i];
	cout<<k;
}

Measured memory_bytes: 256
///============================================================================
/// Name        : Faisal.cpp
/// Author      : Faisal Ahmed
/// Version     :
/// Copyright   : Your copyright notice
/// Description : C++, Ansi-style
///============================================================================

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef long double ld;

struct Book{
    string name;
    int p;
    int s;
}arr[110];

bool cmp(Book a, Book b){
    if(a.name == b.name){
        return a.p > b.p;
    }
    else return a.name < b.name;
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	int n;

	cin >> n;
	for(int i = 0; i < n; i++){
        string str;
        int m;

        cin >> str >> m;
        arr[i].name = str;
        arr[i].p = m;
        arr[i].s = i + 1;
	}

	sort(arr, arr + n, cmp);

	for(int i = 0; i < n; i++){
        cout << arr[i].s << endl;
	}

	return 0;
}


Measured memory_bytes: 256
use std::io::stdin;

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let len = buf.trim().parse::<usize>().unwrap();
    let mut input: Vec<usize> = Vec::new();
    for _ in 0..len {
        let mut buf = String::new();
        stdin().read_line(&mut buf).unwrap();
        input.push(buf.trim().parse::<usize>().unwrap());
    }
    println!("{}", solve(input));
}

fn solve(input: Vec<usize>) -> i32{
    let mut counter = 1;
    let mut current = input[0];
    loop {
        if current == 2 {
            return counter;
        }
        if input.len() <= counter as usize {
            return -1;
        }
        current = input[current-1];
        counter += 1;
    }
}

Measured memory_bytes: 4352
import scala.io.{ StdIn => in}

object Main extends App {
  val out = new java.io.PrintWriter(System.out)
  val n = in.readInt
  val t = in.readLine.split(" ").map(_.toInt)
  val m = in.readInt

  Iterator.continually(in.readLine)
    .take(m)
    .map(_.split(" ").map(_.toInt))
    .foreach(arr => {
      val pi = arr(0) - 1
      val xi = arr(1)
      out.println(t.sum - t(pi) + xi)
    })
  out.flush
}

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

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    int n; cin >> n;
    double a[n];
    forn(i,n) cin >> a[i];
    vector<vector<double>> dp(n);
    forn(i,n) dp[i] = vector<double>(n+1);
    dforn(i,n){
        dp[i][0] = (1-a[i]) * (i+1 < n ? dp[i+1][0] : 1);
        forsn(j,1,n-i+1){
            double head = a[i] * (i+1 < n ? dp[i+1][j-1] : 1);
            double tail = (1-a[i]) * (i+1 < n ? dp[i+1][j] : 0);
            dp[i][j] = head + tail;
        }
    }
    double r = 0;
    forsn(i,n/2+1,n+1) r += dp[0][i];
    cout << fixed << setprecision(9) << r << endl;
    return 0;
}


Measured memory_bytes: 70656
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	n := readI()

	ans := 0
	for i := 1; i <= n; i++ {
		if !(i%3 == 0 || i%5 == 0) {
			ans += i
		}
	}
	fmt.Println(ans)
}

/*-----------Utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const maxBuf = 200100
	var buf []byte = make([]byte, maxBuf)
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error : There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

func readS() string {
	sc.Scan()
	return sc.Text()
}

func readSs(a int) []string {
	b := make([]string, a)
	for i := 0; i < a; i++ {
		b[i] = readS()
	}
	return b
}

func readI() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readIs(a int) []int {
	b := make([]int, a)
	for i := 0; i < a; i++ {
		b[i] = readI()
	}
	return b
}

func readF() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

func readFs(a int) []float64 {
	b := make([]float64, a)
	for i := 0; i < a; i++ {
		b[i] = readF()
	}
	return b
}


Measured memory_bytes: 1780
# include<bits/stdc++.h>
# define LL long long
using namespace std;
const int MAX=1e5+1;
int n,m;
struct p{
	int l,r;
	bool operator< (const p &a)
	const{
		return l<a.l;
	}
}b[MAX];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;++i)
	  cin>>b[i].l>>b[i].r;
	int ans=0;
	int hh=0;
	sort(b+1,b+1+m);
	for(int i=1;i<=m;++i)
	  {
	  	if(hh<=b[i].l) hh=b[i].r,++ans;
	  	else hh=min(hh,b[i].r);
	  }
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n;
  t = "ai1333";
  rep(i,0,n / 100)t += "3";
  cout << t << endl;
  return 0;
}


Measured memory_bytes: 3212
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)
def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g
def lcm_core(a,b):
    g = gcd_core(a,b)
    return (a*b)//g
def lcm(arr):
    l = lcm_core(arr[0],arr[1])
    for i in range(2,len(arr)):
        l = lcm_core(l,arr[i])
    return l
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def isprime(p):
    x = 2
    while x*x <= p:
        if p%x == 0:
            return False
        x += 1
    return True

A, B = map(int, input().split())
ans = 0
for i in set(divisor(A)) & set(divisor(B)):
    if isprime(i):
        ans += 1
print(ans)

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

#define rep(i,n) for(int i = 0; i < n; i++)

int main(){
	int n, m, A[100][100], b[100], c[100]={};

	cin >> n >> m;

	rep(i,n)
	rep(j,m){
		cin >> A[i][j];
	}

	rep(i,m)
	cin >> b[i];

	rep(i,n)
	rep(j,m){
		c[i] += A[i][j]*b[j];
	}

	rep(i,n)
	cout << c[i] << "\n";

	return 0;

}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n, k;
    cin >> n >> k;
    if (k == 1) {
        cout << 0 << endl;
        return;
    }
    cout << n - k << endl;        
}


Measured memory_bytes: 256
#include <stdio.h>
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")

#define NMAX 200010

int a[NMAX];
int imos[NMAX];

void reset(int n) {
    for(int i = 0; i < n; i++) imos[i] = 0;
}

int max(int a, int b) {
    if(a > b) return a;
    else return b;
}

int min(int a, int b) {
    if(a > b) return b;
    else return a;
}

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);

    for(int itr = 0; itr < k; itr++) {
        int f = 0;
        reset(n+1);
        for(int i = 0; i < n; i++){
            if(a[i] != n) f = 1;
            imos[max(0, i - a[i])]++;
            imos[min(n, i + a[i] + 1)]--;
        }
        int acc = 0;
        for(int i = 0; i < n; i++){
            acc += imos[i];
            a[i] = acc;
        }
        if(!f) break;
    }

    for(int i = 0; i < n; i++) printf("%d\n", a[i]);
    return 0;
}


Measured memory_bytes: 3284
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<n;i++)
int main(){
ll n;
cin>>n;
ll a[n];
REP(i,n)
cin>>a[i];
sort(a,a+n);
  cout<<a[n-1]-a[0];
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int a[19][19];

int main(){
  int n,m,x;
  cin>>n>>m>>x;
  vector<int>c(n);
  rep(i,n){
    cin>>c[i];
    rep(j,m)cin>>a[i][j];
  }

  int ans=INF;
  rep(s,1<<n){
    int cost=0;
    vector<int>d(m);
    rep(i,n){
      if(s>>i&1){
        cost+=c[i];
        rep(j,m)d[j]+=a[i][j];
      }
    }
    bool ok=true;
    rep(i,m)if(d[i]<x)ok=false;
    if(ok)chmin(ans,cost);
  }
  if(ans==INF)ans=-1;
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 3636