akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, 0, n){
        string s, t;
        cin >> s >> t;
        if(s == "insert"){
            mp[t]++;
        }else{
            if(mp[t] != 0) cout << "yes" << endl;
            else cout << "no" << endl;
        }
    }
}

Measured memory_bytes: 47512
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}

ll fact[3000005];

ll mod_fact(ll n,ll p,ll& e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0){
		return res*(p-fact[n%p])%p;
	}
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}



int solve(int sx,int sy,int x,int y){
	int r1=sx+sy,r2=sx;
	int u1=sx+sy,u2=sx;
	int sum=mod_comb(r1,r2,MOD);
	int ans=sum;
	for(int i=sx+sy;i+1<x+y;i++){
		sum=sum+sum;
		if(sum>=MOD){
			sum-=MOD;
		}
		if((i-sx-sy)<(x-sx)){
			sum+=mod_comb(r1,r2+1,MOD);
			if(sum>=MOD){
				sum-=MOD;
			}
			r1++;
			r2++;
		}else{
			sum+=MOD-mod_comb(r1,r2,MOD);
			if(sum>=MOD){
				sum-=MOD;
			}
			r1++;
		}
		if((i-sx-sy)<(y-sy)){
			sum+=mod_comb(u1,u2-1,MOD);
			if(sum>=MOD){
				sum-=MOD;
			}
			u1++;
		}else{
			sum+=MOD-mod_comb(u1,u2,MOD);
			if(sum>=MOD){
				sum-=MOD;
			}
			u1++;
			u2++;
		}
		ans+=sum;
		//printf("%lld\n",sum);
		if(ans>=MOD){
			ans-=MOD;
		}
	}
	if(sx!=x || sy!=y)ans+=mod_comb(x+y,x,MOD);
	if(ans>=MOD){
		ans-=MOD;
	}
	return ans;
}

int main(void){
	fact[0]=1;
	for(ll i=1;i<=3000003;i++){
		fact[i]=fact[i-1]*i%MOD;
	}
	int r1,r2;
	int c1,c2;
	scanf("%d%d",&r1,&c1);
	scanf("%d%d",&r2,&c2);
	printf("%d\n",solve(r1,c1,r2,c2));
	return 0;
}


Measured memory_bytes: 23680
open System

[<EntryPoint>]
let main argv =
    let n = Console.ReadLine() |> int
    let st = Console.ReadLine().Split(' ')
    let s, t = st.[0], st.[1]
    let rec ans i (str : String) =
        if i = n then
            str
        else
            ans (i + 1) (sprintf "%s%c%c" str s.[i] t.[i])
    printfn "%s" (ans 0 "")
    0


Measured memory_bytes: 11996
/**
 *  The Secret Number (PKU 2030)
 *  by Kenji Inoue, 2007-01-02
 **/

#include <iostream>
#include <string>

using namespace std;

#define isdigit(x) ('0' <= (x) && (x) <= '9')

char f[71][71]; // field
string t[71][71]; // table
int w, h;

string max(string s1, string s2) {
  if (s1.size() > s2.size()) {
    return s1;
  } else if (s1.size() < s2.size()) {
    return s2;
  }

  if (s1 > s2) {
    return s1;
  }
  return s2;
}

string rec(int x, int y) {
  if (x < 0 || y < 0) { return ""; }
  if (!isdigit(f[y][x])) { return ""; }
  if (t[y][x] != "-") { return t[y][x]; }

  t[y][x] = max(rec(x, y-1), rec(x-1, y)) + f[y][x];
  if (t[y][x] == "0") { t[y][x] = ""; }

  return t[y][x];
}

int main() {
  while (cin >> w >> h, (w || h)) {
    for (int y=0; y<h; y++) {
      cin >> f[y];
      for (int x=0; x<w; x++) { t[y][x] = "-"; }
    }

    string ans = "";
    for (int y=0; y<h; y++) {
      for (int x=0; x<w; x++) {
        if ( (y == h-1 || !isdigit(f[y+1][x]) ) &&
             (x == w-1 || !isdigit(f[y][x+1]) ) ) {
          ans = max(ans, rec(x, y));
        }
      }
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 1072
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep**(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
int a,b,c;
  in(a>>b>>c);
  if(a*c<=b) out(c);
  else out(b/a);
  
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, x;
    cin >> n >> x;

    vector<int> a(n);
    REP(i, n) cin >> a[i];

    sort(all(a));
    int ans = 0;
    REP(i, n){
        if(x < a[i]) break;
        x -= a[i];
        ans++;
    }
    
    if(ans == n && x > 0) ans--;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include <cmath>
#include <limits>
#include<set>

using namespace std;
#define int long  long int
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

signed main()
{
	int N, K, Q;
	cin >> N >> K >> Q;
	vector<int>v(N, K - Q);
	vector<int>A(Q);
	for (int i = 0; i < Q; i++)cin >> A[i];
	for (int i = 0; i < Q; i++)
	{
		v[A[i] - 1]++;
	}
	for (int i = 0; i < N; i++)
	{
		if (v[i] <= 0)cout << "No" << endl;
		else cout << "Yes" << endl;
	}
}

Measured memory_bytes: 2176
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main() {
        Scanner cin = new Scanner();
        string S = Console.ReadLine();

        long ans = 0;
        for (int i = 0; i < (1 << S.Length - 1); i++) {
            string tmp = "";
            for (int j = 0; j < S.Length - 1; j++) {
                tmp += S.Substring(j, 1);
                if ((i >> j & 1) == 1) tmp += "+";
            }
            tmp += S.Substring(S.Length - 1);
            var list = tmp.Split('+').Select(long.Parse).ToList();
            ans += list.Sum();
        }
        Console.WriteLine(ans);
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13396
N = int(input())
T = [int(input()) for _ in range(N)]
  
 # 最大公約数
def gcd(a, b):
   while b > 0:
      a, b = b, a%b
   return a
  
 # 最小公倍数
def lcm(a, b):
   return a*b//gcd(a, b)
  
 # 逐次的にlcmを計算する
ans = T[0]
for i in range(N):
    ans = lcm(ans, T[i])
    
print(ans)

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

int main(){
	int a,b; cin>>a>>b;
	int cnt=0;
	for(int i=a; i<=b; i++){
		string s1=to_string(i);
		string s2=to_string(i);
		reverse(s1.begin(),s1.end());
		if(s1==s2) cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3680
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

h,w = MI()
a = [list(input()) for i in range(h)]
d = deque()
dx = [1,-1,0,0]
dy = [0,0,1,-1]
dist = [[-1]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            d.append([i,j])
            dist[i][j] = 0
while d:
    s = d.popleft()
    x= s[0]
    y= s[1]
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx < 0 or ny < 0 or nx >= h or ny >= w:
            continue
        else:
            if dist[nx][ny] == -1:
                dist[nx][ny] = dist[x][y] + 1
                d.append([nx,ny])
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,dist[i][j])
print(ans)


Measured memory_bytes: 222240
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;

const int maxn = 2e5 + 10;

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

Measured memory_bytes: 3588
//knapsack
#include<bits/stdc++.h>
#define ll long long
using namespace std;

ll go(int n,int w,vector<int>wt,vector<int>prices){
	vector<vector<ll> >dp(n+1,vector<ll>(w+1,0));
	for(int i=0;i<=n;i++){
		for(int j=0;j<=w;j++){
			if(i==0||j==0){
				dp[i][j]=0;
			}
			else if(j-wt[i-1]>=0){
				dp[i][j]=max(dp[i-1][j-wt[i-1]]+prices[i-1],dp[i-1][j]);
			}
			else{
				dp[i][j]=dp[i-1][j];
			}
		}
	}
	return dp[n][w];
}
int main(){
	int n,w;
	cin>>n>>w;
	vector<int>wt(n+1);
	vector<int>prices(n+1);
	for(int i=0;i<n;i++){
		cin>>wt[i]>>prices[i];
	}
	cout<<go(n,w,wt,prices);
}

Measured memory_bytes: 83008
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = INT_MAX / 2;

int main() {
    int N; cin >> N;
    vector<vector<bool>> f(N, vector<bool>(10));
    vector<vector<ll>> p(N, vector<ll>(11));

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            int F; cin >> F;
            if(F==1) f[i][j] = true;
            else f[i][j] = false;
        }
    }
    
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j <= 10; j++)
        {
            cin >> p[i][j];
        }
    }

    ll ans = -INF;
    for (int i = 1; i < (1<<10); i++)
    {
        vector<int> nopen(N, 0);
        for (int j = 0; j < 10; j++)
        {
            if(!((i >> j) & 1)) continue;
            for (int k = 0; k < N; k++)
            {
                if(f[k][j]) nopen[k]++; 
            }
        }
        ll score = 0;
        for (int j = 0; j < N; j++)
        {
            score += p[j][nopen[j]];
        }
        ans = max(ans, score);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String word = sc.next();

        int max_ans = 0;
        int count = 0;
        for (int i=0; i<word.length(); i++) {
            if (isATGC(word.charAt(i))) {
                count++;
                max_ans = Math.max(count, max_ans);
            } else {
                count = 0;
            }
        }
        System.out.print(max_ans);
    }

    public static boolean isATGC(char c) {
        boolean result;
        result = c=='A' || c=='T' || c=='G' || c=='C';
        return result;
    }
}

Measured memory_bytes: 22996
import scala.io.StdIn.readLine

object Main {

  def d(i:Int) = (15+i)%15

  def getIndex(s:String) = s match {
    case "Rock" => 0 case "Fire" => 1 case "Scissors" => 2 case "Snake" => 3
    case "Human" => 4 case "Tree" => 5 case "Wolf" => 6 case "Sponge" => 7
    case "Paper" => 8 case "Air" => 9 case "Water" => 10 case "Dragon" => 11
    case "Devil" => 12 case "Lightning" => 13 case "Gun" => 14
  }

  val gestures = Array("Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", "Dragon", "Devil", "Lightning", "Gun")

  def scan(list:Array[Int],i:Int,n:Int):String = {
    if(i==n) "Draw"
    else {
      val win = d(list((i+1)%n)-list(i))
      val j = if(i>0) i-1 else n-1
      val lose = d(list(i)-list(j))
      if(win<=7 && lose>7) gestures(list(i))
      else scan(list,i+1,n)
    }
  }

  def main(args:Array[String]) = {
    var n = 0
    while({n=readLine.trim.toInt;n}!=0) {
      val list = {for(i<-1 to n) yield getIndex(readLine.trim)}.toArray.sorted
      println(scan(list,0,list.length))
    }
  }
}

Measured memory_bytes: 54604
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	ss := strings.Split(sc.Text(), " ")
	h, _ := strconv.Atoi(ss[0])
	a, _ := strconv.Atoi(ss[1])

	cnt := h / a

	if h%a != 0 {
		cnt += 1
	}
	fmt.Println(cnt)

}


Measured memory_bytes: 640
#include <iostream>
using namespace std;
const int maxx = 100001;
int main() 
{
	int n, ans = 0;
	int tab[maxx];
	cin >> n;
	for(auto i =0; i<n; ++i)
		cin>>tab[i];
	for(auto i =0; i<n; ++i)
	{
		if( i+1 == tab[tab[i]-1])
			++ans;
	}
	cout<< ans/2<<endl;
	return 0;
}

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

int main() {
  int N;
  cin>>N;
  if(N==0){
    cout<<2<<endl;
    return 0;
  }
  if(N==1){
    cout<<1<<endl;
    return 0;
  }
  vector<long long> lucas(N+1,0);
  lucas.at(0)=2;
  lucas.at(1)=1;
  for(int i=2;i<N+1;i++){
    lucas.at(i)=lucas.at(i-1)+lucas.at(i-2);
    if(i==N){
      cout<<lucas.at(i)<<endl;
    }
  }
}




Measured memory_bytes: 3640
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on
using pll = pair<ll, ll>;

ll dfs(ll left, ll right, vector<pll> &AA, vector<vector<ll>> &dp) {
    // 活発度が大きいものから順に、一番右または一番左のどちらかに移動させる
    if (left > right) {
        return 0;
    }
    if (dp[left][right] >= 0) {
        return dp[left][right];
    }
    ll i = AA.size() - right + left - 1;
    ll leftscore = AA[i].second * abs(AA[i].first - left) + dfs(left + 1, right, AA, dp);
    ll rightscore = AA[i].second * abs(AA[i].first - right) + dfs(left, right - 1, AA, dp);
    dp[left][right] = max(leftscore, rightscore);
    return dp[left][right];
}

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<pll> AA(N);
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
        AA[i] = {i, A[i]};
    }
    vector<vector<ll>> dp(N, vector<ll>(N, -1));
    sort(AA.begin(), AA.end(), [](pll a, pll b) { return a.second > b.second; });
    dfs(0, N - 1, AA, dp);

    ll maxscore = 0;
    for (auto row : dp) {
        for (auto score : row) {
            maxscore = max(maxscore, score);
        }
    }
    print(maxscore);
}


Measured memory_bytes: 34936
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

int main(int argc, char const* argv[])
{
  while (true) {
    int n, m;
    std::cin >> n >> m;
    if (n == 0 && m == 0)
      break;
    std::vector<int> taro(n);
    std::vector<int> hanako(m);
    for (int i = 0; i < n; ++i)
      std::cin >> taro[i];
    for (int i = 0; i < m; ++i)
      std::cin >> hanako[i];
    std::sort(taro.begin(), taro.end());
    std::sort(hanako.begin(), hanako.begin());
    int taro_score = std::accumulate(taro.begin(), taro.end(), 0);
    int hanako_score = std::accumulate(hanako.begin(), hanako.end(), 0);
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        int x = taro[i], y = hanako[j];
        if (taro_score - x + y == hanako_score - y + x) {
          std::cout << x << " " << y << std::endl;
          goto finish;
        }
      }
    }
    std::cout << "-1" << std::endl;
finish:
    1+1;
  }
  return 0;
}

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

using namespace std;

using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)

#define CHMIN(a,b) (a)=min((a),(b))
#define CHMAX(a,b) (a)=max((a),(b))
#define ALL(v) (v).begin(),(v).end()

#define DEBUG(x) cerr<<#x<<": "<<(x)<<endl
#define DEBUG_VEC(v) cerr<<#v<<": ";REP(__i,(v).size())cerr<<((v)[__i])<<", ";cerr<<endl

const ll MOD = 1000000007ll;

int m,k;

vi naive(int m, int k){
    int n = 1<<m;
    vi v(2*n);
    REP(i,n)v[2*i] = v[2*i+1] = i;
    do{
        bool ok = true;
        REP(i,n){
            bool f = false;
            int z=0;
            REP(j,2*n){
                if(f)z ^= v[j];
                if(v[j]==i){
                    if(!f)z ^= v[j];
                    f = !f;
                }
            }
            if(z != k){
                ok = false; break;
            }
        }
        if(ok){
            return v;
        }
    }while(next_permutation(ALL(v)));
    return vi();
}

int main(){
    cin>>m>>k;
    if(k >= (1<<m)){
        puts("-1"); return 0;
    }
    // naive
    // vi ans = naive(m,k);
    // DEBUG_VEC(ans);
    int n = 1<<m;
    if(k==0){
        REP(i,2*n)printf("%d%c",i/2," \n"[i==2*n-1]);
    }else if(m==1){
        puts("-1");
    }else{
        REP(i,n)if(i!=k)printf("%d ",i);
        printf("%d ",k);
        FORR(i,0,n)if(i!=k)printf("%d ",i);
        printf("%d\n",k);
    }
    return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long int ll;

using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int i,j,k;
    long n,m,tmp;
    long l,r;
    int min=2018;
    string s[200000];

    cin >> l;
    cin >> r;
    if(abs(l-r)>2019){
        cout<< '0'<<endl;
        
    }else{
        l=l%2019;
        r=r%2019;
        for(int i=l;i<=r;i++){
            for(int j=i+1;j<=r;j++){
                if(i*j%2019<min){
                    min=i*j%2019;
                }
            }
        }
        cout<<min<<endl;
    }


    return 0;
}

Measured memory_bytes: 1792
n ,t = list(map(int, input().split()))
min_c = 10000
for i in range(n):
  c, t_i = list(map(int, input().split()))
  if t_i > t:
    continue
  else:
    min_c = min(min_c, c)
if min_c == 10000:
  print("TLE")
else:
  print(min_c)
  

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	int ans = 0, cnt = 1;
	while(cnt < b){
		cnt += a - 1;
		ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;
 
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;
}


ll gcd(ll n, ll m) {
    ll tmp;
    while (m!=0) {
        tmp = n % m;
        n = m;
        m = tmp;
    }
    return n;
}
 
ll lcm(ll n, ll m) {
    return abs(n) / gcd(n, m)*abs(m);//gl=xy
}

using namespace std;

using int128=__int128_t;

istream &operator>>(istream &is,int128 &x){
	string s;
	is>>s;
	x=0;
	for(int i=0;i<(int)s.size();i++){
		if(isdigit(s[i])){
			x*=10;
			x+=(s[i]-'0');
		}
	}
	if(s[0]=='-'){
		x*=-1;
	}
	return is;
}

ostream &operator<<(ostream &os,const int128 &x){
	if(x==0){
		return (os<<"0");
	}
	int128 n=x;
	if(x<0){
		os<<"-";
		n=-n;
	}
	string s="";
	while(n>0){
		s+=(char)((n%10)+'0');
		n/=10;
	}
	reverse(s.begin(),s.end());
	return (os<<s);
}

void solve()
{
	int n;
	cin>>n;
	vector<int128>a(n);
	rep(i,n)cin>>a[i];
	rep(i,n){
		if(a[i]==0){
			cout<<0;
			return;
		}
	}
	const int128 m=1000000000000000000;
	int128 mul=1;
	rep(i,n){
		mul*=a[i];
		if(mul>m){
			cout<<-1;
			return;
		}
	}
	cout<<mul;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 4764
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];
        for (int i = 0; i < N; ++i) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        System.out.println(solve(x, y));

        sc.close();
    }

    static long solve(int[] x, int[] y) {
        int N = x.length;

        Map<Integer, List<Integer>> xValueToIndices = new HashMap<>();
        Map<Integer, List<Integer>> yValueToIndices = new HashMap<>();
        for (int i = 0; i < N; ++i) {
            if (!xValueToIndices.containsKey(x[i])) {
                xValueToIndices.put(x[i], new ArrayList<>());
            }
            xValueToIndices.get(x[i]).add(i);

            if (!yValueToIndices.containsKey(y[i])) {
                yValueToIndices.put(y[i], new ArrayList<>());
            }
            yValueToIndices.get(y[i]).add(i);
        }

        @SuppressWarnings("unchecked")
        List<Integer>[] adjLists = new List[N];
        for (int i = 0; i < adjLists.length; ++i) {
            adjLists[i] = new ArrayList<>();
        }

        for (List<Integer> indices : Stream.concat(xValueToIndices.values().stream(), yValueToIndices.values().stream())
                .collect(Collectors.toList())) {
            for (int i = 0; i < indices.size(); ++i) {
                if (i != 0) {
                    adjLists[indices.get(i)].add(indices.get(i - 1));
                }
                if (i != indices.size() - 1) {
                    adjLists[indices.get(i)].add(indices.get(i + 1));
                }
            }
        }

        long result = 0;
        boolean[] visited = new boolean[N];
        for (int i = 0; i < N; ++i) {
            if (!visited[i]) {
                List<Integer> group = new ArrayList<>();
                search(group, adjLists, visited, i);

                int xValueNum = (int) group.stream().mapToInt(index -> x[index]).distinct().count();
                int yValueNum = (int) group.stream().mapToInt(index -> y[index]).distinct().count();

                result += (long) xValueNum * yValueNum - group.size();
            }
        }

        return result;
    }

    static void search(List<Integer> group, List<Integer>[] adjLists, boolean[] visited, int node) {
        group.add(node);
        visited[node] = true;

        for (int adj : adjLists[node]) {
            if (!visited[adj]) {
                search(group, adjLists, visited, adj);
            }
        }
    }
}

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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

string s;

int main()
{
    cin>>s;
    if (s=="SUN") cout<<7;
    else if (s=="SAT") cout<<1;
    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;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <sstream>
#include <vector>
#include <stdio.h>
#define ll              long long
#define fr(i,j,p)       for(int i=j; i<p ;i++)
#define frr(i,j,p)      for(int i=j; i>=p ;i--)
#define PI              3.14159265358979323846
#define print(m)        std::cout << std::fixed << std::setprecision(11) << m <<endl;
#define mkp             make_pair
#define pb              push_back
#define M               32
#define lbindex(a,x)    (int)(lower_bound(a.begin(), a.end(),x)-a.begin());
#define upindex(a,x)    (int)(upper_bound(a.begin(), a.end(),x)-a.begin());
#define all(a)          (a).begin(),(a).end()
#define mem(b,a,n)      memset(b,a,sizeof(b[0])*n);
#define meme(b,a,n,m)   memset(b,a,sizeof(b[0][0])*n*m);
#define ff              first
#define ss              second
#define endl            '\n'

//ll md=1000000007;
//ll mdd=998244353;

using namespace std;

typedef vector<ll> vl;		typedef vector<int> vi;
typedef vector<vl> vvl;	  	typedef vector<vi> vvi;
typedef pair<ll, ll> pll;	typedef pair<int, int> pii;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);  cout.tie(NULL);
    int n;  cin>>n;
    n=n%1000;
    if(n==0)    cout<<0;
    else cout<<1000-n;
    return 0;

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
string s[N];
char ans[N];
int n,a,b,c;
void dfs(int id,int a,int b,int c){
    if(a<0 || b<0 || c<0) return;
    if(id==n){
        puts("Yes");
        for(int i=0;i<n;i++) cout<<ans[i]<<endl;
        exit(0);
    }
    else{
        if(s[id]=="AB"){
            ans[id]='A';
            dfs(id+1,a+1,b-1,c);
            ans[id]='B';
            dfs(id+1,a-1,b+1,c);
        }
        else if(s[id]=="AC"){
            ans[id]='A';
            dfs(id+1,a+1,b,c-1);
            ans[id]='C';
            dfs(id+1,a-1,b,c+1);
        }
        else if(s[id]=="BC"){
            ans[id]='B';
            dfs(id+1,a,b+1,c-1);
            ans[id]='C';
            dfs(id+1,a,b-1,c+1);
        }
    }
}
main()
{
    cin>>n>>a>>b>>c;
    for(int i=0;i<n;i++) cin>>s[i];
    dfs(0,a,b,c);
    puts("No");
    return 0;
}


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

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

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

const double PI = acos(-1);

double calc(int a,int b,double c){
    double ans = sqrt(a*a + b*b - 2*a*b*cos(c));
    return ans;
}

int main(){
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double c=abs((double(m)/60*2*PI)-(double(h*60+m)/720*2*PI));
    double ans=calc(a,b,c);
    printf("%.20f\n",ans);
    return 0;
}

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

typedef long long 		ll;
typedef vector<ll> 		vll;
typedef pair<ll,ll> 	pll;
typedef vector<pll> 	vpll;
typedef vector<int> 	vi;
typedef pair<int,int> 	pii;
typedef vector<pii> 	vpii;

#define fi				first
#define se 				second
#define pb 				push_back
#define mp 				make_pair
#define all(v)			v.begin(),v.end()
#define sz(v)			s.size()
#define rep(i,a,b) 		for(int i=a;i<=b;i++)
#define per(i,a,b) 		for(int i=a;i>=b;i--)
#define fill(a,v)		memset(a,v,sizeof(a))
#define tc				int T;cin>>T;while(T--)
#define nl				printf("\n")
#define aya				cerr<<"yaha aya"<<"\n"
#define debug(x,y)		printf("%d %d\n",x,y)
#define fast_io			ios_base::sync_with_stdio(false);cin.tie(NULL);
#define grt				greater<int>()

const int mod = 1e9+7;
const int mod2= 1e9+9;

inline int pow_(ll a, int n, int p=mod){
	int r=1;while(n){if(n&1)r=r*a%p;n>>=1;a=a*a%p;}return r;
}

const int MAX = 3e2+1;
const int LG = 30+1;
const int INF = 1e9+1;

int g[MAX][MAX];
ll d[MAX][MAX];
ll refills[MAX][MAX];

int main(void)
{
	int n,m;
	ll l;
	cin>>n>>m>>l;
	rep(i,1,n) rep(j,1,n) d[i][j] = (i==j ? 0 : INF);
	rep(i,1,m)
	{
		int u,v;
		ll w;
		cin>>u>>v>>w;
		g[u][v] = g[v][u] = w;
		d[u][v] = min(d[u][v], w);
		d[v][u] = min(d[v][u], w);		
	}


	rep(k,1,n)
		rep(i,1,n)
			rep(j,1,n)
			{
				// if(i == j) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}

	rep(i,1,n)
		rep(j,1,n)
		{
			refills[i][j] = (d[i][j] <= l ? 1 : INF);
			if(i == j) refills[i][j] = 0;
		}

	rep(k,1,n)
		rep(i,1,n)
			rep(j,1,n)
				refills[i][j] = min(refills[i][j], refills[i][k] + refills[k][j]);

	int q;cin>>q;
	while(q--)
	{
		int s,t;cin>>s>>t;
		ll ans = refills[s][t];
		if (ans >= INF) ans = -1;		
		else ans--;
		cout<<ans<<"\n";
	}
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=2019;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=200005;
//i_am_noob
int n,a,ans[maxn]={0};

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n-1){
		cin >> a;
		ans[a-1]++;
	}
	rep(n) print1(ans[i]);
	return 0;
}

Measured memory_bytes: 5136
a,b = map(int,input().split())

flag = 1

for i in range(100):
    if i == 1:
        if a >= b:
            print(1)
            break
        else:
            continue
    else:
        tap = (a-1)*(i-1) + a
        if tap >= b:
            print(i)
            break


Measured memory_bytes: 2940
#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	
	using namespace std;

	vector<vector<ll>> v;
	ll dp[3][100005] = {0};


	ll maxPoints(ll n, ll i, bool A, bool B, bool C) {
		if(i == n-1) {
			if(C) {
				return max(v[i][0],v[i][1]);
			}
			else if(B) {
				return max(v[i][0],v[i][2]);
			}
			else {
				return max(v[i][1],v[i][2]);	
			}
		}

		if(A) {
				if(!dp[1][i]) {
					dp[1][i] = v[i][1] + maxPoints(n,i+1,false,true,false);
				}
				if(!dp[2][i]) {
					dp[2][i] = v[i][2] + maxPoints(n,i+1,false,false,true);
				}
				return max(dp[1][i],dp[2][i]);
			
		}

		else if(B) {
			if(!dp[0][i]) {
				dp[0][i] = v[i][0] + maxPoints(n,i+1,true,false,false);
			}
			if(!dp[2][i]) {
				dp[2][i] = v[i][2] + maxPoints(n,i+1,false,false,true);
			}
			return max(dp[0][i],dp[2][i]);
		}

			if(!dp[0][i]) {
				dp[0][i] = v[i][0] + maxPoints(n,i+1,true,false,false);
			}
			if(!dp[1][i]) {
				dp[1][i] = v[i][1] + maxPoints(n,i+1,false,true,false);
			}
			return max(dp[0][i],dp[1][i]);


	}

	int main()
	{
		std::ios::sync_with_stdio(false);
		
		ll n;
		cin>>n;

		

		for(ll i=0; i<n; i++) {
			ll a,b,c;
			cin>>a>>b>>c;
			v.push_back({a,b,c});
		}

		

		cout<<max(maxPoints(n,0,true,false,false), max(maxPoints(n,0,false,true,false), maxPoints(n,0,false,false,true)))<<endl;

		return 0;
	}


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


namespace B_Popular_Vote
{
    class Program
    {
        static void Main(string[] args)
        {
            string ans = "No";
            int count = 0;

            //入力++++++++++++++++++++++++++++++++++++++++++++++++
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            string[] str2 = Console.ReadLine().Split(' ');
            int[] a = { };
            a = new int[n];
            for (int j = 0; j < n; j++)
            {
                a[j] = int.Parse(str2[j]);
            }
            //++++++++++++++++++++++++++++++++++++++++++++++++++++
            
            double shor = a.Sum() / (4.0 * (double)m);
            for (int i = 0; i < n; i++)
            {
                if (shor <= a[i])
                {
                    count++;
                    if (count >= m)
                    {
                        ans = "Yes";
                    }
                }
            }
            
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  long long N, sp = 0;

  std::cin >> N;

  for (long long n = N; n; n /= 10)
    sp += n % 10;

  for (long long x = 10; x <= N; x *= 10) {
    long long n = N / x * x - 1, s = 0;

    for ( ; n; n /= 10)
      s += n % 10;

    sp = std::max(s, sp);
  }

  std::cout << sp << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
ll f[1010101], invf[1010101];//iの階乗、iの階乗の逆元
ll inv(ll x) {//逆元計算 =>（inf-2)乗
    ll res = 1;
    ll k = inf - 2;
    ll y = x;
    while (k) {     //繰り返しニ乗法
        if (k & 1) res = (res * y) % inf; //最右が1ならyをかける
        y = (y * y) % inf;  //yを二乗
        k >>= 1;  //右に1シフト
    }
    return res;
}
void init() { //階乗計算O(101010)
    f[0] = 1;
    rep(i, 1, 1010101) f[i] = (f[i - 1] * i) % inf;
    rep(i, 0, 1010101) invf[i] = inv(f[i]);
}
ll comb(int n, int k) {
  if(k<0||k>n)return 0;
    ll a = f[n]; // = n!
    ll b = invf[n-k]; // = /(n-k)!
    ll c = invf[k]; // = /k!

    ll bc = (b * c) % inf;

    return (a * bc) % inf;
}

int main(){cout<<fixed<<setprecision(10);
		   //O(NlogN)(sort)
           ll n,k;
           cin>>n>>k;
           vll a(n);
           rep(i,0,n)cin>>a[i];
           sort(all(a));
           ll ans=0;
           init();
           rep(i,0,n){
            ans-=a[i]*comb(n-1-i,k-1);
            ans%=inf;
            ans+=a[n-1-i]*comb(n-1-i,k-1);
             ans%=inf;
           }
           
           
           
           cout<<(ans+inf)%inf<<endl;
}

Measured memory_bytes: 19800
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<i64> a(n + 1);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i + 1];
        a[i + 1] += a[i];
    }

    i64 ret = std::numeric_limits<i64>::max();
    for (int i = 1; i < n; i++) {
        i64 x = a[i], y = a[n] - x;
        if (x < y) std::swap(x, y);
        ret = std::min(ret, x - y);
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
int n,k,cnt=0;
cin>>n>>k;
for(int i=0;i<n;i++){
    int num;
    cin>>num;
    if(num>=k)cnt++;
}
cout<<cnt;
return 0;
}


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

#pragma warning(disable : 4996)

typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))
#define min3(x, y, z) min(x, min(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif

using namespace std;
//#define int long long;

double dist(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
ll idist(ll x1, ll y1, ll x2, ll y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

signed main() {
  ll N,k;
  cin >> N >> k;
  long double ans = 0.0;
  ll m;
  ll c;
  rep(i, N) {
    m = i+1;
    c = 0;
    while (m < k) {
      m *= 2;
      c++;
    }
    ans += powl(0.5, c);
  }
  ans /= N;
  cout << setprecision(15) << ans;
}


Measured memory_bytes: 3812
n, y =map(int, input().split())
for a in range(min(n + 1 , y // 10000 + 1)):
    for b in range(min(n - a + 1 , y // 5000 + 1)):
        c = n - a - b
        if a * 10000 + b * 5000 + c * 1000 == y:
            print(a,b,c)
            break
        else:
            continue
    else:
        continue
    break
else:
    print("-1 -1 -1")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <cstring>

#define test(t) while(t--)

#define ll  long long int

#define in  cin>>
#define out cout<<
#define en "\n"
#define sp " "

#define fast()  ios_base::sync_with_stdio(false);cin.tie(0);



using namespace std;

void solve()
{ ll a,b,c,k;
  in a>>b>>c>>k;
  ll mx = 0;
  if(a>k){
    mx=k;
  }
  else{

    mx = a;
    k=k-a;
    if(k>b)
    {k = k-b;

    mx-=k;}
    else{
        mx +=0;
    }
  }
  out mx<<en;
}

int main(){ fast()
             //freopen("input.txt","r",stdin);
             //freopen("output.txt","w",stdout);
             ll t=1;
            //cin>>t;
            test(t){
            solve();
            }
return 0;}


Measured memory_bytes: 3588
import bisect
from collections import deque
n = int(input())
a = [int(input()) for _ in range(n)]
tree = deque([]) 
tree.append(a[0])

for a in a[1:]:
  index = bisect.bisect_left(tree, a)
  if index == 0:
    tree.appendleft(a)
  else:
    tree[index-1] = a
print(len(tree))

    


    
    

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

using namespace std;

typedef struct V2D {
    double x;
    double y;
}vect2D;

vect2D make_vect2D(double, double);
double calc_CrossProductZ(vect2D *, vect2D *);

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double z1, z2, z3;
    vect2D v12, v23, v31, v1p, v2p, v3p;

    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        v12 = make_vect2D(x2 - x1, y2 - y1);
        v23 = make_vect2D(x3 - x2, y3 - y2);
        v31 = make_vect2D(x1 - x3, y1 - y3);
        v1p = make_vect2D(xp - x1, yp - y1);
        v2p = make_vect2D(xp - x2, yp - y2);
        v3p = make_vect2D(xp - x3, yp - y3);

        z1 = calc_CrossProductZ(&v12, &v2p);
        z2 = calc_CrossProductZ(&v23, &v3p);
        z3 = calc_CrossProductZ(&v31, &v1p);

        if((z1 > 0 && z2 > 0 && z3 > 0) || (z1 < 0 && z2 < 0 && z3 < 0)) { cout << "YES" << endl; }
        else { cout << "NO" << endl; }
    }
 
    return 0;
}
 
vect2D make_vect2D(double dx, double dy) {
    vect2D res;
     
    res.x = dx;
    res.y = dy;
 
    return res;
}
 
double calc_CrossProductZ(vect2D *a, vect2D *b) {
    return (a->x * b->y - b->x * a->y);
}


Measured memory_bytes: 3120
#include<iostream>

using namespace std;

int main(void)
{
	char s[100];

	int a[26];
	int i;

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

	cin >> s;
//	cout << s;

	i = 0;
	while (i < 26 && s[i] != '\0') {
		a[s[i] - 'a']++;
		i++;
	}

	for (i = 0; i < 26; i++) {
		if (a[i] >= 2) {
			cout << "no" << endl;
			return(0);
		}
	}

	cout << "yes" << endl;

	return(0);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class B {
    static void Main(string[] args) {
        string S = Console.ReadLine();
        int len = S.Length;

        for (int i = 0; i < len; i++) {
            Console.Write("x");
        }

        Console.WriteLine();

    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>

int main() {
	int a, b;
	std::cin >> a >> b;
	if ((a + b) % 2 == 0) {
		std::cout << (a + b) /2  << std::endl;
	}
	else {
		std::cout << (a + b) / 2 + 1 << std::endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;

template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T> >;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Kunitaka{
    template<
        typename TYPE,
        std::size_t SIZE
    >
    std::size_t array_length(const TYPE (&array)[SIZE])
    {
        return SIZE;
    }

    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; }
}
using namespace Kunitaka;
namespace Printer{
    void br(){
        cout << endl;
    }

    void loop_cnt(int i){
        cout << "i = " << i << endl;
    }

    void loop_cnt(int i, int j){
        cout << "i = " << i << ", " << "j = " << j << endl;
    }

    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T, class S>
    void print(T x, S y){
        cout << x << "," << y << endl;
    }

    template<class T, class S, class U>
    void print(T x, S y, U z){
        cout << x << "," << y << "," << z << endl;
    }

    template<class T, class S>
    void print(pair<T, S> p){
        cout << p.first << ", " << p.second << endl;
    }

    template<
        typename TYPE,
        std::size_t SIZE
    >
    void print(const TYPE (&array)[SIZE]){
        int lim = array_length(array);
        for(int i=0; i<lim; i++){
            if(i) cout << " ";
            cout << array[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<S> v){
        for(int i=0; i<v.size(); i++){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class S>
    void print(vector<vector<S> > vv){
        for(int i=0; i<vv.size(); i++){
            for(int j=0; j<vv[i].size(); j++){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void yesno(bool x){
        if(x) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
};
using namespace Printer;

int main(int argc, const char * argv[]) {
    //提出時、消す----//


    // input
    cout << fixed << setprecision(10);
    ll N, K; cin >> N >> K;

    N -= K * (N / K);

    ll ans = min(abs(N), abs(N - K));

    print(ans);
    
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;

int main(){
	
	cin>>N;
	
	cout<<N*(N+1)/2<<endl;
	
	return 0;

}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		
		ArrayList<Integer> list_l = new ArrayList<Integer>();


		for(int i = 0 ;i < N;i++){
			list_l.add(sc.nextInt());
			
		}

		ArrayList<Integer> list_b = new ArrayList<Integer>();
		list_b = (ArrayList<Integer>) list_l.clone();
		//ソート
		Collections.sort(list_l);

		int cnt = 0;
		for(int i = 0 ;i < N;i++){
			if(list_l.get(i)!=list_b.get(i)) {
				cnt ++;
			}
		}

		if(cnt == 2 | cnt == 0) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}

   		sc.close();
        return ;

    }
    
}



Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int W, H, x, y, r;
    cin>>W>>H>>x>>y>>r;
    if(x+r>W||x-r<0||y+r>H||y-r<0)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    
    return 0;
}



Measured memory_bytes: 3092
package main

import (
	"fmt"
)

func main() {
	var (
		n     int
		count int
	)

	fmt.Scan(&n)
	nums := make([]int, n)

	for i := 0; i < n; i++ {
		fmt.Scan(&nums[i])
	}

	flag := true
	for flag {
		for i := 0; i < n; i++ {
			if nums[i]%2 == 0 {
				nums[i] /= 2
			} else {
				flag = false
			}
		}
		if flag {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 1780