akhauriyash/Code-Regression huggingface dataset:
n,q = map(int,input().split())
process = []
for i in range(n):
    name,time = input().split()
    process.append([name,int(time)])
elap = 0
out = []
while len(process) > 0:
    name,time = process.pop(0)
    temp_q = q
    while True:
        if time <= 0:
            out.append([name,elap])
            break
        if temp_q <= 0:
            process.append([name,time])
            break
        time -= 1
        temp_q -= 1
        elap += 1
for name,time in out:
    print(name,time)


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

int A,B,ax[100009],ay[100009];
int R;

vector<int>v[100009];

int main(){
  while(cin>>A>>B>>R){
    if(!A && !B)break;
    r(i,100009) v[i].clear();
    long long sum=0;
    R*=4;
    r(i,A)cin>>ax[i]>>ay[i];
    r(i,B){
      int x,y;
      cin>>x>>y;
      v[x].push_back(y);
    }
    r(i,100009) sort(v[i].begin(),v[i].end());
    r(ii,A){
      int x=ax[ii] , y=ay[ii];
      for(int i=-R;i<=R;i++){
	if(x+i<0)continue;
	double r = R*R - i*i;
	r = sqrt(r);
	int rr = r; 
	sum += upper_bound(v[x+i].begin(),v[x+i].end(),y+rr) - lower_bound(v[x+i].begin(),v[x+i].end(),y-rr);
	
      }
    }
    cout<<sum<<endl;
  }
}


Measured memory_bytes: 7612
//----------------------------おまじない
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")
//----------------------------
#define FOR(i,j,n) for (int i=(j);i<(n);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define REPN(i,n) for (int i=(n);i>0;i--)
#define I(n) scanf("%d", &(n))
#define LL(n) scanf("%lld", &(n))
#define pb(n) push_back((n))
#define mp(i,j) make_pair((i),(j))
#define eb(i,j) emplace_back((i),(j))
#include <bits/stdc++.h>
using namespace std;
//------------------------------typedef集
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
typedef vector<vpi> vvpi;
typedef vector<vvi> vvvi;
typedef long long ll;
const int mod = 1000000009;

int n;
vector<ll> a;
ll med,ans;

int main(){
    I(n);
    a.resize(n);
    REP(i,n){
        I(a[i]);
        a[i] -= i+1;
    }
    sort(a.begin(),a.end());

    if(n%2){
        med = a[n/2];
    } else {
        med = (a[n/2-1]+a[n/2]) /2 ;
    }

    for (auto v: a) ans += abs(v-med);
    cout << ans << endl;
}

Measured memory_bytes: 1792
using System;
using System.Linq;
using System.Collections.Generic;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var count = 0;

            for (int i = ab[0]; i <= ab[1]; i++)
            {
                if (IsPalindromic(i.ToString()))
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }

        public static bool IsPalindromic(string s)
        {
            var n = s.Count();

            for (int i = 0; i < n; i++)
            {
                if(s[i] != s[s.Count()-1-i])
                {
                    return false;
                }
            }
            return true;
        }
    }
}


Measured memory_bytes: 15440
n,m=map(int,input().split())
h=list(map(int,input().split()))
x=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  x[a-1].append(b-1)
  x[b-1].append(a-1)
c=0
for i in range(n):
  f=1
  maxh=0
  for j in x[i]:
    maxh=max(maxh,h[j])
  if maxh>=h[i]:
    f=0
  c+=f
print(c)

Measured memory_bytes: 92788
import java.util.Scanner

object Main{
  def main(args: Array[String]): Unit = {
    val scan = new Scanner(System.in)
    val N = scan.nextInt()
    
    if (N == 1) {
      println("Hello World")
    } else {
      val A = scan.nextInt()
      val B = scan.nextInt()
      println(A + B)
    }
  }
}

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

int main(){
	string s;
	cin >> s;
	bool is_A = (s[0] == 'A');
	
	
	for(int i = 0 ; i < s.size() ; i++){
		if(is_A && s[i] != 'A'){
			cout << "Yes" << endl;
			return 0;
		}
		if(!is_A && s[i] != 'B'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PCI(X) __builtin_popcount((X))
#define PCL(X) __builtin_popcountll((X))
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (ll I = (A); I < (B); ++I)
#define REPC(I, A, B, C) for (ll I = (A); I < (B); I = I + (C))
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VB vector<bool>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second

#define VVI vector<vector<int> >
#define VVPII vector<vector<pair<int,int> > >

typedef long long ll;
using namespace std;

// link: https://atcoder.jp/contests/abc173/tasks/abc173_f

void boost()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // cout << fixed << setprecision(10);
}


void solve()
{
    ll n;
    cin >> n;
    
    ll ans = 0;
    REPP(i, 1, n + 1) ans += i*(n - i + 1);

    ll a, b, c, d;
    REP(i, n - 1) {
        cin >> a >> b;
        c = min(a, b);
        d = max(a, b);
        ans -= c*(n - d + 1);
    }

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

int main()
{
    boost();
    int T;
    T = 1;
    
    while (T--) {
    	solve();
    }
}


Measured memory_bytes: 3640
#include<stdio.h>
int main(void)
{
	int a,b;
	scanf("%d",&a);
	scanf("%d",&b);
	
	if(a==b)
		printf("a == b\n");
	else if(a<b)
		printf("a < b\n");
	else
		printf("a > b\n");

	return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010;

int n, k, q;
int a[N];

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

    for(int i = 1; i <= n; i++)
        if(a[i] + k - q > 0) puts("Yes");
        else puts("No");
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"a < b"<<endl;
    }
    if(a>b){
        cout<<"a > b"<<endl;
    }
    if(a==b){
        cout<<"a == b"<<endl;
    }
}


Measured memory_bytes: 3072
N,L = list(map(int,input().split()))
A = [0]*N

for i in range(N):
    A[i] = L+i
   
aji = 0

if A[0] > 0:
    for i in range(1,N):
        aji = aji + A[i]
elif A[N-1] < 0:
    for i in range(0,N-1):
        aji = aji + A[i]
else:
    for i in range(N):
        aji = aji + A[i]
        
print(aji)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))
 
typedef long long ll;
typedef struct {
    ll indx, height;
} Pair;
 
int cmp(const Pair *x, const Pair *y);
 
ll n;
ll is_island[100005];
Pair p[100005];
 
int main()
{
    ll island_nums;
    ll ans;
    ll i;
 
    scanf("%lld", &n);
    for (i = 1; i <= n; i++) {
        scanf("%lld", &p[i].height);
        p[i].indx = i;
    }
 
    qsort(p + 1, n, sizeof(Pair), (int (*)(const void *, const void *))cmp);
 
    p[0].height = -1;
    p[n + 1].height = -1;
     
 
    island_nums = 0;
    ans = 0;
    i = 1;
    while (i <= n) {
 
        do {
            if (p[i].height > 0) {
                ll indx = p[i].indx;
                is_island[indx] = 1;
 
                if (is_island[indx - 1] && is_island[indx + 1]) {
                    island_nums--;
                } else if (!is_island[indx - 1] && !is_island[indx + 1]) {
                    island_nums++;
                }
            }
 
            i++;
        } while(p[i].height == p[i - 1].height);
 
        ans = max(island_nums, ans);
    }
 
    printf("%lld\n", ans);
 
    return 0;
}
 
int cmp(const Pair *x, const Pair *y)
{
    if (x->height > y->height) {
        return -1;
    } else if (x->height == y->height) {
        return 0;
    } else {
        return 1;
    }
}


Measured memory_bytes: 4588
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
   int n,m,k;
   cin >> n >> m>> k;
   vvll gura(n);
   vvll buro(n);
   for(int i=0;i<m;i++){
      int z,zz;
      cin >> z >>zz;
      z--; zz--;
      gura.at(z).push_back(zz);
      gura.at(zz).push_back(z);
   }
   for(int i=0;i<k;i++){
      int z,zz;
      cin >> z >>zz;
      z--; zz--;
      buro.at(z).push_back(zz);
      buro.at(zz).push_back(z);
   }
   map<ll,ll>oya;
   vector<bool>seen(n,false);
   vvll kyotu(n);
   for(int i=0;i<n;i++){
      if(oya.count(i))continue;
      queue<pair<ll,ll>>que;
      que.push(make_pair(i,i));
      oya[i]=i;
      seen.at(i)=true;
      while(!que.empty()){
         ll f = que.front().first;
         ll b = que.front().second;
         que.pop();
         for(int j=0;j<gura.at(f).size();j++){
            ll z = gura.at(f).at(j);
            if(seen.at(z))continue;
            oya[z]=b;
            seen.at(z)=true;
            kyotu.at(b).push_back(z);
            que.push(make_pair(z,b));
         }
      }
   }
   for(int i=0;i<n;i++){
      ll num = oya.at(i);
      ll ren = kyotu.at(num).size();
      ren-=gura.at(i).size();
      for(int j=0;j<buro.at(i).size();j++){
         ll che = buro.at(i).at(j);
         if(oya.at(che)==num)ren--;
      }
      cout <<ren<<" ";
   }
}
    



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

class Main{
	public static void main(String[] args){
		int num;
		int[] a = new int[3];
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String line = br.readLine();
			StringTokenizer st = new StringTokenizer(line," ");
			int w = Integer.parseInt(st.nextToken());
			int h = Integer.parseInt(st.nextToken());
			int x = Integer.parseInt(st.nextToken());
			int y = Integer.parseInt(st.nextToken());
			int r = Integer.parseInt(st.nextToken());
			
			if(x-r < 0 || y-r < 0 || x+r >w || y+r > h){
				System.out.println("No");
			}
			else{
				System.out.println("Yes");
			}
		}
		catch(Exception e){
			System.out.println(e);
		}
	}
}

Measured memory_bytes: 24392
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

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

	private static void execute19_1() {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int k = sc.nextInt();
			int[] t = new int[n];

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

			int min = 0;
			int max = 1010010010;

			while (max - min > 1) {
				int middle = (max + min) / 2;
				long count = 0;
				for (int i = 0; i < n; i++) {
					count += (t[i] - 1) / middle;
				}
				if (count > k) {
					min = middle;
				} else {
					max = middle;
				}
			}
			System.out.println(max);
		}
	}
}

Measured memory_bytes: 50260
#include <cstring>
#include <algorithm>
#include <map>
#include <stack>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <iostream>
#include <set>
#define MP make_pair
#define F first
#define PB push_back
#define S second
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef unsigned long long ull;
const int maxn = 5e5 + 5;
const int mod = 1e9 + 7;
const ll inf = (1ll << 62);
const int sq = 750;

int a[200];

int main() {
    ios_base::sync_with_stdio (false);
    int n;
    cin >> n;
    n *= 2;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort (a, a + n);
    ll ans = 0;
    for (int i = 0; i < n; i += 2)
        ans += a[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
   int H, W;
   int dx[] = {1, 1, 1, 0, 0, -1, -1, -1};
   int dy[] = {1, 0, -1, 1, -1, 1, 0, -1};
   string S[50];
   cin >> H >> W;
   for(int i = 0; i < H; i++) cin >> S[i];

   for(int i = 0; i < H; i++){
       for(int j = 0; j < W; j++){
           for(int k = 0; k < 8; k++) {
               if (S[i][j] == '#')
                   if (0 <= i + dx[k] && i + dx[k] < H)
                       if (0 <= j + dy[k] && j + dy[k] < W)
                           if (S[i + dx[k]][j + dy[k]] == '.')
                               S[i + dx[k]][j + dy[k]] = '1';
                           else if(S[i + dx[k]][j + dy[k]] != '#')
                               S[i + dx[k]][j + dy[k]] += 1;
           }
       }
   }
   for(int i = 0; i < H; i++) {
       for (int j = 0; j < W; j++) {
           if (S[i][j] == '.') cout << '0';
           else cout << S[i][j];
       }
       cout << '\n';
   }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	int a, b;
	cin >> a >> b;
	a*b % 2 == 0 ? puts("Even") : puts("Odd");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
int n,k;
string s[12];
int f[12][8],dig[12];
int a[10],now[12],p10[8],al[26];
bool nozero[10],use[10];
int mxnum(int id,int cnt){
	int ret=0;
	rep(i,dig[id]){
		ret*=10;
		if(f[id][dig[id]-1-i]<cnt) ret+=a[f[id][dig[id]-1-i]];
		else ret+=9;
	}
	return ret;
}
int mnnum(int id,int cnt){
	int ret=0;
	rep(i,dig[id]){
		ret*=10;
		if(f[id][dig[id]-1-i]<cnt) ret+=a[f[id][dig[id]-1-i]];
		else ret+=0;
	}
	return ret;
}
int dfs(int cnt){
	if(cnt==k){
		int sum=0;
		rep(i,n-1) sum+=mxnum(i,cnt);
		if(sum==mxnum(n-1,cnt)) return 1;
	}
	int sum=0;
	rep(i,n-1) sum+=mxnum(i,cnt);
	if(sum<mnnum(n-1,cnt)) return 0;
	sum=0;
	rep(i,n-1) sum+=mnnum(i,cnt);
	if(sum>mxnum(n-1,cnt)) return 0;

	int ret=0;
	rep(i,10){
		if(use[i]) continue;
		if(i==0 && nozero[cnt]) continue;
		a[cnt]=i;
		use[i]=true;
		ret+=dfs(cnt+1);
		use[i]=false;
	}
	return ret;
}
int main(){
	p10[0]=1;
	rep(i,7) p10[i+1]=p10[i]*10;
	while(true){
		cin>>n;
		if(n==0)break;
		rep(i,10) nozero[i]=0;
		rep(i,26) al[i]=-1;
		rep(i,n) cin>>s[i];
		rep(i,n) dig[i]=s[i].size();
		int it=0;
		for(int i=n-1;i>=0;i--){
			rep(j,dig[i]){
				if(al[s[i][j]-'A']==-1) al[s[i][j]-'A']=it,it++;
				f[i][dig[i]-1-j]=al[s[i][j]-'A'];
			}
		}
		rep(i,n) if(dig[i]!=1) nozero[f[i][dig[i]-1]]=1;
		k=it;
		cout << dfs(0) << endl;
	}
}

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



int main ()
{
    int n;
    cin>>n;
    long long int L[n];

    for(int i=0;i<n;i++){
    cin>>L[i];
    }
        int sum=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){

                if((L[i]+L[j]>L[k])&&(L[i]+L[k]>L[j])&&(L[k]+L[j]>L[i])&&(L[i]!=L[j])&&(L[j]!=L[k])&&(L[i]!=L[k])){
                    sum++;
                }
            }
        }
    }
    cout<<sum;
}







Measured memory_bytes: 3632
#include <stdio.h>
int main()
{
    int n, a;
    int ans = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a);
        if (i % 2 == 0 && a % 2 == 1)
        {
            ans++;
        }
    }
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 1728
#include<iostream>
#include<string>
using namespace std;
int a[8][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
int main(){
	string s[55];
	int h,w,i,j,k,x,y,z;
	cin >> h >> w;
	for(i=0;i<h;i++){
		cin >> s[i];
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(s[i][j]=='.'){
				z=0;
				for(k=0;k<8;k++){
					x=i+a[k][0];
					y=j+a[k][1];
					if(x<0 || y<0 || x>=h || y>=w)
						continue;
					if(s[x][y]=='#')
						z++;
				}
				s[i][j]=z+'0';
			}
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			cout << s[i][j];
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
arr = [list(map(int,input().split())) for i in range(N-1)]
for i in range(N):
  t = 0
  for j in range(i, N-1):
    if t < arr[j][1]:
      t = arr[j][1]
    else:
      if t%arr[j][2]==0:
        t = t
      else:
        t = t+arr[j][2]-t%arr[j][2]
    t += arr[j][0]
  print(t)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int x;
    cin >> x;
    
    int a = x/500;
    a=a*1000;
    
    int b = x%500;
    b/=5;
    b*=5;
    
    cout << a+b << endl;
    
	return 0;
    
}

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

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

Measured memory_bytes: 3676
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 111111;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w;
    cin>>h>>w;
    vector<int> a[505];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int k;
            cin>>k;
            a[i].push_back(k);
        }
    }
    int cnt=0;
    vector<int> v[4];
    for(int i=0;i<h;i++){
        if(i%2==0){
            for(int j=0;j<w;j++){
                if(a[i][j]%2==1){
                    if(j!=w-1){
                        cnt++;
                        a[i][j+1]++;
                        v[0].push_back(i);
                        v[1].push_back(j);
                        v[2].push_back(i);
                        v[3].push_back(j+1);
                    }
                    else if(i!=h-1){
                        cnt++;
                        a[i+1][j]++;
                        v[0].push_back(i);
                        v[1].push_back(j);
                        v[2].push_back(i+1);
                        v[3].push_back(j);
                    }
                }
            }
        }
        else{
            for(int j=w-1;j>=0;j--){
                if(a[i][j]%2==1){
                    if(j!=0){
                        cnt++;
                        a[i][j-1]++;
                        v[0].push_back(i);
                        v[1].push_back(j);
                        v[2].push_back(i);
                        v[3].push_back(j-1);
                    }
                    else if(i!=h-1){
                        cnt++;
                        a[i+1][j]++;
                        v[0].push_back(i);
                        v[1].push_back(j);
                        v[2].push_back(i+1);
                        v[3].push_back(j);
                    }
                }
            }
        }
    }
    cout<<cnt<<endl;
    for(int i=0;i<cnt;i++){
        cout<<v[0][i]+1<<' '<<v[1][i]+1<<' '<<v[2][i]+1<<' '<<v[3][i]+1<<endl;
    }
}

Measured memory_bytes: 8240
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int T = sc.nextInt();
		int min = 10000;
		int t = 0;
		int c = 0;

		for (int i = 0; i < N; i++) {
			c = sc.nextInt();
			t = sc.nextInt();
			if (t <= T) {
				if (c < min) {
					min = c;
				}
			}
		}

		if (min == 10000) {
			System.out.println("TLE");
		} else {
			System.out.println(min);
		}
	}
}


Measured memory_bytes: 23764
n = int(input())
a = list(map(int, input().split()))
c = 1
mul = 1
if 0 in a:
    print(0)
    c = 0
else:
    for i in range(n):
        mul *= a[i]
        if mul > 10**18:
            c = 0
            print('-1')
            break
if c == 1:
    print(mul)


Measured memory_bytes: 21588
n = int(input())
A = list(map(int,input().split()))
A = sorted(A)
Alice_card = []
Bob_card = []
for i in range(n):
        if i%2 == 0:
                Alice_card.append(A[i])
        else:
                Bob_card.append(A[i])
Alice_total = sum(Alice_card)
Bob_total = sum(Bob_card)
print(abs(Alice_total - Bob_total))

Measured memory_bytes: 3064
N = int(input())
l = list(map(int, input().split()))

up_down_list = []
init = True
for i in range(len(l)):
    
    ai = l[i] 
    
    if init:
        up_down_list.append(-2)
        tmp_ai = ai
        init = False
        continue
        

    
    if ai > tmp_ai:
        up_down_list.append(1)
        
    elif ai == tmp_ai:
        up_down_list.append(0)
        
    else:
        up_down_list.append(-1)
    
    
    tmp_ai = ai
    
uri = []
kai = []

s_flag = False
for n in range(len(up_down_list)):
    
    inv_n = len(up_down_list) - (n + 1)
    
    if s_flag == False:
        if up_down_list[inv_n] == 1:
            s_flag = True
            uri.append(inv_n)
            continue
    else:
        
        if up_down_list[inv_n] < 0:
            
            kai.append(inv_n)
            s_flag = False
        
        
        

s = 0
yen = 1000

for k in range(len(kai)):
    
    inv_k = len(kai) - (k+1)
    
    kaine = l[kai[inv_k]]
    urine = l[uri[inv_k]]
    
    s=int(yen / kaine)
    yen = yen - kaine * s
    
    yen = yen + urine * s

print(yen)

Measured memory_bytes: 9264
#include<iostream>
#include<queue>

using namespace std;

#define N 100
#define INFTY 99999999

int n,
// 隣接行列
M[N][N];
// 距離 colorも同時に管理する
int d[N];

void bfs(int s){
    queue<int> q;
    q.push(s);
    
    // 距離を初期化
    for(int i = 0;i < n;++i){
        d[i] = INFTY;
    }
    d[s] = 0;
    // 対象の頂点番号
    int u;
    
    while(!q.empty()){
        u = q.front();
        q.pop();
        
        for(int v = 0;v < n;++v){
            // 頂点が隣接しているかつ未訪問
            if(M[u][v] == 1 && d[v] == INFTY){
                // 対象の頂点の距離は前の頂点 + 1
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }
    
}

int main(){
    int u,k,v;
    
    cin >> n;
    
    // 隣接行列を初期化
    for(int i = 0;i < n;++i){
        for(int j = 0;j < n;++j){
            M[i][j] = 0;
        }
    }
    
    for(int i = 0;i < n;++i){
        cin >> u >> k;
        // 頂点を移動する
        u--;
        // 頂点の数だけ回す
        for(int j = 0;j < k;++j){
            cin >> v;
            --v;    // ずらす
            M[u][v] = 1;
        }
    }
    
    bfs(0);

    for(int i = 0;i < n;++i){
        cout << i + 1 << " " << ((d[i] == INFTY) ? (-1) : d[i]) << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3144
def main():
    N = int(input())
    zoro = 0
    dice = []
    for _ in range(N):
        dice.append(list(map(int, input().split())))

    
    for d1, d2 in dice:
        if d1 == d2:
            zoro += 1
        else:
            zoro = 0
        if zoro > 2:
            break
    
    ans = "Yes" if zoro > 2 else "No"
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;

//define
#define INF 100000000
#define NUM 1000000007


int main() {
	int n;
	int cnt = 0;
	cin >> n;
	VC s(n);
	VI a(26);
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}

	for (int i = 0; i < n; i++) {
		a[s[i] - 'A']++;
	}

	for (int i = 0; i < 26; i++) {
		if (a[i] > 0) cnt++;
	}
	if (cnt == 4) cout << "Four" << endl;
	else cout << "Three" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

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

  // 0 := A, 1 := B, 2 := C
  string s[3]; cin >> s[0] >> s[1] >> s[2];
  int now = 0;
  while(true) {
    if(s[now] == "") {
      cout << (char)(now+'A') << '\n';
      return 0;
    }
    char c = s[now][0];
    s[now].erase(s[now].begin());
    now = c-'a';
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <list>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <numeric>
 
using namespace std;

const int maxn = 102;
int arr[maxn] = {};

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

    int N, K;
    string S;
    cin >> N >> K;
    cin >> S;

    int count = 0;
    for (int i = 0; i < N-1; i++) {
        if (S[i] == S[i+1]) count++;
    }
    
    N--;
    cout << min(count+2*K, N) << endl;

}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
struct node{int x,y,c;}; 
int main(){
  int w,h;
  while(cin>>w>>h,w+h){
    vector<int> w1[33],w2[33];
    for(int i=0;i<h;i++){
      for(int j=0;j<w-1;j++){
	int a;
	cin>>a;
	w1[i].push_back(a);
      }
      w1[i].push_back(1);
      if(i==h-1){
	for(int j=0;j<w;j++)
	  w2[i].push_back(1);
      }else{
	for(int j=0;j<w;j++){
	  int a;
	  cin>>a;
	  w2[i].push_back(a);
	}
      }
    }
    int ma[33][33]={};
    queue<node> que;
    que.push((node){0,0,1});
    while(!que.empty()){
      int x=que.front().x;
      int y=que.front().y;
      int c=que.front().c;
      que.pop();
      if(ma[x][y])continue;
      ma[x][y]=c;
      if(w1[x][y]==0)que.push((node){x,y+1,c+1});
      if(w2[x][y]==0)que.push((node){x+1,y,c+1});
      if(y!=0&&w1[x][y-1]==0)que.push((node){x,y-1,c+1});
      if(x!=0&&w2[x-1][y]==0)que.push((node){x-1,y,c+1});
    }
    cout<<ma[h-1][w-1]<<endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, l; cin >> n >> l;
    vector<string> s(n);
    rep(i, n) cin >> s[i];
    sort(all(s));
    rep(i, n) cout << s[i];
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
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;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}

uintmax_t comb(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
using Graph = vector<vector<int>>;




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

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

if(k <= a) cout << k << endl;
else if((k-a) <= b) cout << a << endl;
else cout << a-(k-a-b) << endl;


//////////////////////////////////////////////////////
return 0;}


Measured memory_bytes: 3652
/*
    Author : Ritesh Singh
*/
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds; 
using namespace std;
#define lct long long int t;cin>>t;while(t--)
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define rep(i,a,n) for (int i=a;i<n;i++)
#define el '\n'
#define IOS ios_base::sync_with_stdio(false), cin.tie(NULL)
const int mod = 1e9+7;
typedef long long ll;

typedef tree<string, null_type, less<string>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
 
int32_t main()
{
    IOS;
    string s; cin>>s;
    if(s=="SUN") cout<<7;
    else if(s=="MON") cout<<6;
    else if(s=="TUE") cout<<5;
    else if(s=="WED") cout<<4;
    else if(s=="THU") cout<<3;
    else if(s=="FRI") cout<<2;
    else if(s=="SAT") cout<<1;
}



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

using ll=long long int;
ll n,x,m;

int main()
{
    cin>>n>>x>>m;
    vector<ll>cnt(m,0);
    queue<ll>rem;
    ll idx=1,sum=x,ans=0,next=(x*x)%m,loop=0;
    cnt[x]=idx;
    rem.push(x);
    while(1)
    {
        if (cnt[next] != 0) 
            break;
        cnt[next] = ++idx;
        rem.push(next);
        sum += next, next = (next * next) % m;
    }
    for (auto i = 1; i < cnt[next]; i++) 
    {
        ans += rem.front();
        rem.pop();
    }

    loop = rem.size(), n -= (cnt[next] - 1),
    ans += (n / loop) * (sum - ans);
    for (auto i = 0; i < n % loop; i++) 
    {
        ans += rem.front();
        rem.pop();
    }
    cout << ans << endl;
}



Measured memory_bytes: 4456
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

ll modinv(ll a, ll m){
  return modpow(a, m-2, m);
}

ll com(ll n ,ll k){
  ll rep = 1;
  for(ll i=1;i<=k;i++){
    rep = (rep * (n-(i-1)) % MOD * modinv(i,MOD)) % MOD;
  }
  return rep;
}


int main(){
  ll n,a,b; cin >> n >> a >> b;
  ll ans = 0;
  ans += modpow(2, n, MOD);
  ans = ((ans - 1) + MOD) % MOD;
  ans = (ans - com(n,a) + MOD) % MOD;
  ans = (ans - com(n,b) + MOD) % MOD;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
//#define all(x , n) x+1,x+n+1
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

//#define int ll

const int N = 5000+54, mod = 1e9 + 7, mod1 = 998244353;
const int MAX = 1e5 + 11 , T = 2000;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const long double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const int LOG = 20;
const double EPS = 1e-4;
const double PI = acos(-1.0);

template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;        // #include <ext/pb_ds/assoc_container.hpp>
typedef pair <ll, ll> pll;         // #include <ext/pb_ds/tree_policy.hpp>
typedef vector <int> vi;          // #include <ext/rope>
                // #include <ext/rope>
                                 // #include <ext/rope>
bool prime(int n) {             // template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
    for(int i=2;i<=sqrt(n);i++){
        if(n%i==0){return 0;}
    }return 1;}
bool query = 0;
ll bp(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
///////////////////////////////////////////////////////////


void solve() {
    int x,  n;
    cin >> x >> n;
    set<int> st;
    for(int i = 1; i <= n; i ++) {
        int p;
        cin >> p;
        st.ins(p);
    }
    int x1 = x;
    while(1) {
        if(!st.count(x)) {
            cout << x;
            return;
        }
        if(!st.count(x1)) {
            cout << x1;
            return;
        }
        x --;
        x1 ++;
    }
}

/*
*/

main() {
    ios;
    int tt = 1;
    if(query)
        cin >> tt;
    while(tt --) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
int main()
{
  double ans=0;
  int n;
  cin>>n;double num;
  string ss;
  for(int i=0;i<n;i++)
  {
      cin>>num>>ss;
      if(ss=="JPY")
         ans+=num;
      else ans+=(num/1.0)*380000;
  }
    printf("%.5lf\n",ans);
}


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

using namespace std;

int main() {
int n,count=0;
cin>>n;
    for (int i = 1; i <=n ; ++i) {
        int x;
        cin>>x;
        if(x%2!=0&i%2!=0)
            count++;
    }
    cout<<count;
}




Measured memory_bytes: 3568
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    b = readline().strip()
    
    print(b.translate(str.maketrans('ACGT','TGCA')))
    
    return


if __name__ == '__main__':
    main()


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

long long a[55];
vector<pair<int,int>> ans;

int main() {
  int n, bi=1;
  scanf("%d",&n);
  for(int i=1;i<=n;i++) {
    scanf("%lld",a+i);
    if(abs(a[i]) > abs(a[bi])) bi = i;
  }
  if(a[bi] == 0) {
    puts("0");
    return 0;
  }
  if(a[bi] > 0) {
    while(a[1] < a[bi]) {
      a[1] += a[bi];
      ans.emplace_back(bi,1);
    }
    for(int i=2;i<=n;i++) {
      while(a[i-1] > a[i]) {
        a[i] += a[i-1];
        ans.emplace_back(i-1,i);
      }
    }
  } else {
    while(a[n] > a[bi]) {
      a[n] += a[bi];
      ans.emplace_back(bi,n);
    }
    for(int i=n-1;i;i--) {
      while(a[i] > a[i+1]) {
        a[i] += a[i+1];
        ans.emplace_back(i+1,i);
      }
    }
  }


  printf("%d\n",ans.size());
  for(auto p : ans)
    printf("%d %d\n",p.first, p.second);
}


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

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> a,b;
    rep(i,0,n){
        int x,y;
        cin>>x>>y;
        a.push_back(make_pair(y,x));
    }
    rep(i,0,n){
        int x,y;
        cin>>x>>y;
        b.push_back(make_pair(x,y));
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    rep(i,0,n){
        int x,y;
        x=a.at(i).second;
        y=a.at(i).first;
        a.at(i)=make_pair(x,y);
    }

    int numPair=0;
    rep(i,0,n){ //blue
        _rep(j,n-1,0){ //red
            if(a.at(j).first<b.at(i).first && a.at(j).second<b.at(i).second){
                numPair++;
                a.at(j)=make_pair(2*n,2*n);
                break;
            }
        }
    }

    cout<<numPair<<endl;
}

Measured memory_bytes: 256
time = []
last = 10

for i in range(5):
    time.append(int(input()))
    if(time[i] % 10 > 0 and time[i] % 10 < last):
        last = time[i] % 10

sum = 0
for i in range(5):
    sum += time[i]
    if(time[i] % 10 != 0):
        sum += (10 - (time[i] % 10))

print(sum + last - 10)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>


using namespace std;
int main()
{
	int n,ans;
	cin >> n;
	if (n < 105) ans = 0;
	else if (n < 135) ans = 1;
	else if (n < 165) ans = 2;
	else if (n < 189) ans = 3;
	else if (n < 195) ans = 4;
	else ans = 5;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

num = a[0]
for i in range(1, n):
    num = gcd(num, a[i])

if k > max(a):
    print("IMPOSSIBLE")
    exit()

if k % num == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 14224
package main

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

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,1000000)}
  n,k := input.NextInts()
  v := input.NextIntArray()
  l := make([]int,n+1)
  for i:=0;i<n;i++ { l[i+1] = l[i]+v[i] }
  r := make([]int,n+1)
  for i:=n-1;i>-1;i-- { r[i] = r[i+1]+v[i] }
  m := 0
  for i:=1;i<k+1;i++ {
    for j:=0;j<i+1;j++ {
      if j > n-1 || n-(i-j) < 0 || j > n-(i-j) { continue }
      t := l[j]+r[n-(i-j)]
      var u []int
      for x:=0;x<j;x++ {
        if v[x] < 0 { u = append(u,v[x]) }
      }
      for y:=n-1;y>n-(i-j);y-- {
        if v[y] < 0 { u = append(u,v[y]) }
      }
      sort.Ints(u)
      for z:=min(len(u),k-i)-1;z>-1;z-- { t -= u[z] }
      if m < t { m = t }
    }
  }
  fmt.Println(m)
}
func min(n,m int) int {
  if n < m { return n }
  return m
}

type Input struct {
  reader *bufio.Reader
}
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInts() (int,int) {
  s := strings.Split(i.NextLine()," ")
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) NextIntArray() []int {
  s := strings.Split(i.NextLine()," ")
  a := make([]int,len(s))
  for i:=0;i<len(s);i++ { a[i],_ = strconv.Atoi(s[i]) }
  return a
}

Measured memory_bytes: 1664
//競技プログラミング　テンプレ
//
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	string n;
	cin >> n;
 if(n.at(0)==n.at(1)&&n.at(1)==n.at(2)||n.at(1)==n.at(2)&&n.at(2)==n.at(3)){
  cout << "Yes" <<endl;}
  

  else cout <<"No" << endl;


	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)
using i64 = int64_t;
using ll = long long;
int main() {
  int n,l;
  cin >> n >>l;
  int t = n*l + n*(n-1)/2;//n個のあじ
  if(0<=-l && -l <= n-1){
    cout << t << endl;
  }
  else if(l > 0){
    cout << t-l <<endl;
  }
  else{
    cout << t-(l+n-1) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main() {

  int i, j, num, count, min, min_index, temp;
  int ary[110];

  std::cin >> num;

  for (i = 0; i <= num - 1; i++) std::cin >> ary[i];

  count = 0;

  for (i = 0; i <= num - 2; i++) {

    min       = ary[i];
    min_index = i;

    for (j = i; j <= num - 1; j++) {

      if (min > ary[j]) {

        min       = ary[j];
        min_index = j;

      }
    }

    if (ary[i] != ary[min_index]) {

      temp           = ary[i];
      ary[i]         = ary[min_index];
      ary[min_index] = temp;

      count ++;
    }
  }

  for (i = 0; i <= num - 2; i++) std::cout << ary[i] << " ";
  std::cout << ary[num - 1] << std::endl;
  std::cout << count << std::endl;

  return 0;
}



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

using namespace std;

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

int main(){
    int a,b,c,d;cin>>a>>b>>c>>d;
    cout<<max(0,min(b,d)-max(a,c))<<endl;
    return 0;
}

Measured memory_bytes: 256
import math

a, b, c, x = map(int, (input(), input(), input(), input()))


total = 0

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

print(total)


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = 1e9 + 7;
const int INF = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N, A, B;
	cin >> N >> A >> B;
	if ((B - A) % 2 == 0)cout << "Alice" << endl;
	else cout << "Borys" << endl;
	return 0;
}


Measured memory_bytes: 256
/*
  NAME : RISHABH SINGH
  INSTITUTION : DELHI TECHNOLOGICAL UNIVERSITY
*/
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int, int>
#define bi __builtin_inf()
#define ll long long
#define mp make_pair
#define ss second
#define pb push_back
#define ff first
#define speed_cubing ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define um unordered_map
#define us unordered_set
#define bp __builtin_popcount
#define ld long double
#define rep(n) for (int i = 0; i < n; i++)
#define pll pair<ll, ll>
#define mx = 1e18;
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define PI 3.1415926535
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
#define sz(v) (int)v.size()
#define endl '\n'
const int mod = 998244353;
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}
const int N = 1e6+5;

int32_t main(){
   
   speed_cubing
   
   int cnt = 0;

   int n;
   cin>>n;
  

   for(int i=2;i*i<=n;i++){

      for(int j=i;j<=n;j*=i){
         if(n%j==0)
           cnt++,n/=j;
         else  
           break;
      }

      while(n%i==0){
           n/=i;
      }

   }

   if(n>1)
     cnt++;

   cout<<cnt;  
     
 
   return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
int main(){
    int n,m,a[200001],b[200001],c[1001][13];
    cin>>n>>m;
    rep(i,m){
        cin>>a[i]>>b[i];
        rep(j,b[i]) cin>>c[i][j];
    }
    int dp[1<<n],INF=1e9;
    fill(dp,dp+(1<<n),INF);
    dp[(1<<n)-1]=0;
    for(int i=(1<<n)-2;i>=0;i--)rep(j,m){
        int x=0;
        rep(k,b[j]) x=x|1<<c[j][k]-1;
        if(~i&x) dp[i]=min(dp[i],dp[i|x]+a[j]);
    }
    if(dp[0]==INF) cout<<-1;
    else cout<<dp[0];
}

Measured memory_bytes: 384