akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))


if(sum(a) < sum(b)):
    print(-1)
    exit()

loss = 0
count = 0
c = n*[0]
for i in range(n):
    if(a[i] < b[i]):
        loss += b[i] - a[i]
        count += 1
    else: c[i] = a[i] - b[i]


c.sort(reverse=True)
for i in range(n):
    if(loss <= 0): break
    count += 1
    loss -= c[i]

print(count)

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> mii;
typedef map<ll,int> mli;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;  ///1e9+7

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define sp <<' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=2;ii<=mx;ii++)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///


const int mx=101;
ll i,v[mx],siz[mx],dp[mx][100001],n,w;

ll recdp(ll curi,ll cursiz)
{
    if(curi<0) return 0;
    if(dp[curi][cursiz]!=-1) return dp[curi][cursiz];
    ll opt1=0,opt2=0;
    if(siz[curi]+cursiz<=w) opt1=v[curi]+recdp(curi-1,siz[curi]+cursiz);
    opt2=recdp(curi-1,cursiz);
    dp[curi][cursiz]=max(opt1,opt2);
    return dp[curi][cursiz];
}

main()
{
    fastio();
    memset(dp,-1,sizeof(dp));
    cin>>n>>w;
    for(i=0;i<n;i++) cin>>siz[i]>>v[i];
    cout<<recdp(n-1,0)<<endl;
}


///Thank you.


///Brainless_Loco Terminates Here!


Measured memory_bytes: 82448
#include <iostream>
#define LL long long
using namespace std;
const LL MOD = 1000000007;

//N^P をMで割った剰余を返す
LL mod_pow(LL n, LL m){
  LL ret = 1;
  for(; m>0; m>>=1, n=(n*n)%MOD){
    if(m%2 == 1)
      ret = ret*n%MOD;
  }
  return ret;
}


//組み合わせを10^9+7で割った剰余を返す
LL combination(LL n, LL r){
  LL X = 1; //分子
  LL Y = 1; //分母
  LL res = 0;
  LL i;
  //cout << n << "C" << r << endl;

  //分子の計算 % MOD
  for(i=n; i>=n-r+1; i--)
    X = (X * i) % MOD;
    
  //cout << "分子：X = " << X << endl;
  
  //分母の計算 % MOD
  //r!の計算 % MOD
  for(i=1; i<=r; i++)
    Y = Y * i % MOD;
  //cout << "r! = " << Y << endl;
  Y = mod_pow(Y, MOD-2);

  //cout << "分母：Y = " << Y << endl;
  
  res = X * Y % MOD;
  
  //cout << "res = " << res << endl;
    
  return res;
}


int main(void){
  LL n, a, b;
  cin >> n >> a >> b;

  LL ans = 0;
  ans = mod_pow(2, n)-1;
  //cout << "2^n = " << ans << endl; 
  ans = (ans + MOD - combination(n, a)) % MOD;
  ans = (ans + MOD - combination(n, b)) % MOD;
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

from collections import Counter
n = int(input())
list_N = []
ans = 0

for _ in range(n):
    s = sorted(input())
    list_N.append("".join(s))

list_M = list(Counter(list_N).values())

for i in list_M:
    if i != 1:
        ans += cmb(i, 2)
print(ans)

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

void print_one(int a, int b, int c, int d) {
  cout << a;
  if (b>=0) cout << "+" << b;
  else cout << "-" << -b;
  if (c>=0) cout << "+" << c;
  else cout << "-" << -c;
  if (d>=0) cout << "+" << d;
  else cout << "-" << -d;
  cout << "=7" << endl;
}

int f_b(int a, int b, int C, int D) {
  if (7 == a+b+C+D) {
    print_one(a, b, C, D);
    return 1;
  }
  if (7 == a-b+C+D) {
    print_one(a, -b, C, D);
    return 1;
  }
  return 0;
}

int f_c(int a, int b, int c, int D) {
  if (1 == f_b(a, b, c, D)) return 1;
  return f_b(a, b, -c, D);
}

int f(int a, int b, int c, int d) {
  if (1 == f_c(a, b, c, d)) return 1;
  return f_c(a, b, c, -d);
}

int main() {
  int A;
  cin >> A;
  int a,b,c,d;
  a=A/1000;
  b=(A/100) % 10;
  c=(A/10) % 10;
  d=A % 10;
  f(a, b, c, d);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static long bignum = 1000000000+7;

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		String[] ss = s.split("");
		String[] tt = t.split("");
		boolean flag = true;
		
		for(int i = 0;i<ss.length;i++) {
			if(!ss[i].equals(tt[i])) {
				flag = false;
				break;
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

	static long divn(int target, int times) {//10_9+7のあまり累乗版
		int sqtimes = (int)Math.sqrt(times);
		long ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		long holder = ans;
		ans = 1;
		for(int i =0;i<sqtimes;i++) {
			ans = (ans*holder)%(1000000000+7);
		}
		for(int i=0;i<times - sqtimes*sqtimes;i++) {
			ans = (ans * target)%(1000000000+7);
		}
		return ans;
	}

	static long div(long a) {//10_9+7のあまり
		if(a<0)a+=1000000000+7;
		return a%(1000000000+7);
	}

}
/*
class City{
	int order;
	int prefecture;
	int year;
	int number;
	City(int order,int prefecture, int year){
		this.order = order;
		this.prefecture = prefecture;
		this.year = year;
	}
}
*/


Measured memory_bytes: 35676
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int X = sc.nextInt();
		int A = sc.nextInt();
		if(X < A)
      System.out.println("0");
    else
      System.out.println("10");
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;

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

    ll table[10][10];
    REP(i,10)
        REP(j,10)
            table[i][j]=0;

    ll answer = 0;
    REP(i,n){
        string s = to_string(i+1);
        int msb = int(s[0] - '0');
        int lsb = int(s[s.length()-1] - '0');
        table[msb][lsb]++;
    }

    REP(i,n){
        string s = to_string(i+1);
        int msb = int(s[0] - '0');
        int lsb = int(s[s.length()-1] - '0');
        answer += table[lsb][msb];
    }

    cout << answer << endl;
    return 0;
}

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

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

int main(){
    string s; cin >> s;
    ll k; cin >> k;
    int i = 0;
    while(1){
        if(i+1 == k){
            cout << s[i] << endl;
            return 0;
        }
        if(s[i] != '1'){
            cout << s[i] << endl;
            break;
        }
        i++;
    }
}

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

int main(){
  int N,M,C;
  int cnt = 0;
  cin >> N >> M >> C;
  vector<int> B(M);
  vector<vector<int>> A(N, vector<int>(M));
  vector<int> sum(N);
  
  for (int i = 0; i < M; i++) {
    cin >> B[i];
  }
  
  for (int j = 0; j < N; j++) {
    for (int i = 0; i < M; i++) {
      cin >> A[j][i];
      sum[j] += B[i]*A[j][i];
    }
    sum[j] += C;
    if (sum[j] > 0) {
      cnt += 1;
    }
  }
  cout << cnt << endl;
}

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

using namespace std;
typedef  long long ll;

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

    ll A, B;
    vector<vector<ll>> V(M);
    for(ll i=0; i<N; ++i){
        cin >> A >> B;
        if(A > M) continue;
        V[M-A].push_back(B);
    }

    ll s = 0;
    priority_queue<ll> Q;
    for(ll i=M-1; i>=0; --i){
        for(auto b: V[i]) Q.push(b);
        if(!Q.empty()){
            s += Q.top();
            Q.pop();
        }
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 5632
n=int(input())
t=list(map(int,input().split()))
m=int(input())
px=[]
for _ in range(m):
  p,x=map(int,input().split())
  px.append((p-1,x))
for i in range(m):
  ans=0
  p,x=px[i]
  for j in range(n):
    if j==p:
      ans+=x
    else:
      ans+=t[j]
  print(ans)

Measured memory_bytes: 9148
program odd_subrectangles
  implicit none
  integer(8), parameter :: md = 998244353_8
  integer :: n, m, a(300,300) = 0, r, i, j
  read(*,*) n, m
  do i = 1, n
    read(*,*) a(i,1:m)
  end do
  r = rank(a(1:n,1:m))
  write(*,'(i0)') modulo(pow(2_8,n+m-1)-pow(2_8,n+m-r-1),md)
contains
  function pow(x,i) result(n)
    integer(8), intent(in) :: x
    integer, intent(in) :: i
    integer(8) :: n, p
    integer :: m
    n = 1_8
    p = x
    m = i
    do while (m > 0)
      if (btest(m,0)) n = mod(p*n,md)
      p = mod(p*p,md)
      m = rshift(m,1)
    end do
  end
  integer function rank(a)
    integer, intent(in) :: a(:,:)
    integer :: x(size(a,1),size(a,2))
    integer :: n, i
    x = a
    call normal_form(x)
    rank = 0
    n = size(a,1)
    do i = n, 1, -1
      if (sum(x(i,:)) == 0) cycle
      rank = i
      exit
    end do
  end
  subroutine normal_form(a)
    integer, intent(inout) :: a(:,:)
    integer :: n, m, i, j, k
    n = size(a,1)
    m = size(a,2)
    i = 1
    do j = 1, m
      if (sum(a(i:n,j)) == 0) cycle
      if (a(i,j) == 0) then
        do k = i+1, n
          if (a(k,j) == 1) then
            a(i,j:m) = mod(a(i,j:m)+a(k,j:m),2)
            exit
          end if
        end do
      end if
      do k = 1, n
        if (k == i) cycle
        if (a(k,j) == 0) cycle
        a(k,j:m) = mod(2+a(k,j:m)-a(i,j:m),2)
      end do
      i = i+1
      if (i > n) exit
    end do
  end
end program odd_subrectangles

Measured memory_bytes: 1152
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int cnt[51][27];
int mini[27];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string str;
		cin >> str;
		for(int j=0;j<str.size();j++){
			cnt[i][str[j]-'a']++;
		}
	}
	for(int i=0;i<26;i++){
		mini[i]=cnt[0][i];
		for(int j=1;j<n;j++){
			mini[i]=min(mini[i],cnt[j][i]);
		}
		for(int j=0;j<mini[i];j++){
			printf("%c",(i+'a'));
		}
	}
	printf("\n");
	return 0;
}


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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, K; cin >> N >> K;
    int A[N]; rep(i, N) cin >> A[i];
    sort(A, A+N);
    int ans = mod;
    for(int i = 0; i+K-1 < N; i++){
        ans = min(ans, A[i+K-1]-A[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main(void) {
    long long a1,a2,a3,a4,num,i;
    while (1) {
        scanf("%lld",&num);
        if (num==0) break;
        a1=1,a2=2,a3=4;
        if (num==1||num==2||num==3) {
            printf("1\n");
        } else {
            for (i=4; i<=num; i++) {
                a4=a1+a2+a3;
                a1=a2,a2=a3,a3=a4;
            }
            if (a4%3650==0) {
                printf("%lld\n",a4/3650);
            } else {
                printf("%lld\n",a4/3650+1);
            }
        }
    }
    return 0;
}

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

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


/*
int main(){
    int n, m, x;
    cin >>n>>m>>x;

    vector<int> c_v(n);
    vector<vector<int>> a_v(n, vector<int>(m,0));
    
    int s;
    for (int i=0; i<n; i++){
        cin >> s;
        c_v[i] = s;
        for(int j=0; j<m; j++){
            cin >> s;
            a_v[i][j] = s;
        }
    }
    int money, ans;
    ans = INF;
    for (int bit=1; bit < (1<<n); bit++){
        money = 0;
        bool tmp;
        tmp = false;
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                S.push_back(i);
            }
        }
        vector<int> x_v(m, x);
        for (int i = 0; i < (int)S.size(); ++i) {
            for (int j=0; j<m; j++){
                x_v[j] = x_v[j] - a_v[S[i]][j];
            }
            money += c_v[S[i]];
        }
        int i;
        for (int i=0; i<m; ++i) {
            if(x_v[i]>0) {
                tmp = true;
                break;
            }
        }
        if(tmp) continue;
        ans = min(money, ans);
    }
    if (ans == INF) ans = -1;
    cout << ans << endl;
    return 0;
}

*/
int a[12][12];

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


Measured memory_bytes: 3600
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n: i32 = read();
  let m: i32 = read();
  let a: i32 = (0..m).map(|_| read::<i32>()).sum();
  
  let ans: i32 = if n - a >= 0 {n - a} else {-1};
  println!("{}", ans);
}

Measured memory_bytes: 2124
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>*/
#include <bits/stdc++.h>

using namespace std;
//using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;
double PI = 4*atan(1);

vi divisors[500001];
ll hsh[500001], mult[500001], invmult[500001];

ll gethsh(int l, int r) {
	ll ret = (hsh[r]-hsh[l-1])*invmult[l] % MOD;
	ret = (ret+MOD) % MOD;
	return ret;
}

bool ok(int l, int r) {
	for (int a: divisors[r-l+1]) if (gethsh(l+a,r) == gethsh(l,r-a)) return 0;
	return 1;
}

int main() {
	FOR(i,1,500001) for (int j = 2*i; j <= 500000; j += i) divisors[j].pb(i);
	string w; cin >> w;
	bool f = 1;
	F0R(i,w.length()-1) if (w[i] != w[i+1]) f = 0;
	if (f) {
		cout << w.length() << "\n" << 1;
		return 0;
	}
	mult[0] = invmult[0] = 1;
	FOR(i,1,500001) {
		mult[i] = (241*mult[i-1]) % MOD;
		invmult[i] = (406639007*invmult[i-1]) % MOD;
	}
	F0R(i,w.length()) 
		hsh[i+1] = ((w[i]-'a'+1)*mult[i+1]+hsh[i]) % MOD;
		
	if (ok(1,w.length())) {
		cout << "1\n1";
		return 0;
	}
	
	int ans = 0;
	for (int i = 1; i < w.length(); ++i) if (ok(1,i) && ok(i+1,w.length())) ans++;
	cout << "2\n" << ans;
}

Measured memory_bytes: 68228
def check():
    for k in range(0,n):
        if h[k]!=0:
            break
    for i in range(0,101):
        for j in range(0,101):
            flag=True
            h1=abs(i-x[k])+abs(j-y[k])+h[k]
            for l in range(0,n):
                if h[l]!=max(h1-abs(i-x[l])-abs(j-y[l]),0):
                    flag=False
                    break
            if flag==True:
                print(i,j,h1)
                return
            
n=int(input())
x=[0 for i in range(0,n)]
y=[0 for i in range(0,n)]
h=[0 for i in range(0,n)]
for i in range(0,n):
    x[i],y[i],h[i]=map(int,input().split())
check()

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
const int N=1e3+14;
ll n,a[N],t; 
int main()
{
	ios::sync_with_stdio(false);
	cin>>t;
	cout<<(t==0?1:0)<<endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll n,k; cin >> n >> k;
  ll ans = 1;
  while(n--){
    if(ans>=k) ans += k;
    else ans *= 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// CPP program to find circumference of circle
#include<bits/stdc++.h>
using namespace std;

#define PI 3.1415

double circumference(double r)
{
	double cir = 2*PI*r;
	return cir;
}

// driver function
int main()
{

double r;
cin>>r;
cout <<circumference(r)<<endl;;
return 0;
}


Measured memory_bytes: 3732
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int r;
	scanf("%d",&r);
	if(r>=1200)cout<<"ARC"<<endl;
	else cout<<"ABC"<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long n, k;
long long num = 0;
long long ans = 0;
long long array[100005] = {};
long long a, b;

int main()
{

    cin >> n >> k;

    for (long long i = 0; i < n; i++) {
        cin >> a >> b;

        array[a] += b;
    }

    long long i = 0;
    while (i <= 100000 && num < k) {
        num += array[i];
        ans = i;

        i++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
long long a[100000];
long long b[100000];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) 
		cin >> a[i] >> b[i];
	long long sum = 0;
	for (int i = n - 1; i >= 0; i--) {
		if ((a[i]+sum )% b[i] != 0) {
			a[i] += sum;
			long long c = a[i] % b[i];
			c = b[i] - c;
			sum += c;
			a[i] += c;
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 1920
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

lli dp[2020][2020];
lli n;
lli a[N];
vector<pair<lli, lli> > v;

lli f(lli i, lli l, lli r) {

    if(i >= n) {
        return 0;
    }
    if(dp[i][l] != -1) {
        return dp[i][l];
    }

    lli x = (v[i].ff * (v[i].ss - l)) + f(i + 1, l + 1, r);
    lli y = (v[i].ff * (r - v[i].ss)) + f(i + 1, l, r - 1);

    return dp[i][l] = max(x, y);
}


void solve()
{
    cin>>n;
    for(int i = 0; i < n; i ++) {
        cin>>a[i];
        v.push_back({a[i], i});
    }
    sort(v.rbegin(), v.rend());
    for(int i = 0; i < 2020; i ++) {
        for(int  j = 0; j < 2020; j ++) {
            dp[i][j] = -1;
        }
    }
    cout<<f(0, 0, n - 1);
    cout<<"\n";
    return ;
}

/*
*/

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

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


Measured memory_bytes: 35740
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;

int main() {
    while(true) {
        int n; scanf("%d", &n);
        if(n==0) break;
        static int stk[100010];
        int stk_siz = 0;
        for(int i = 0; i < n; i++) {
            if(stk_siz == 0) {
                stk[stk_siz++] = 0;
                stk[stk_siz++] = 0;
            }
            int x; scanf("%d", &x);
            if(x ^ (stk_siz & 1)) {
                if(i & 1)
                    stk_siz--;
                else
                    stk[stk_siz++] = i;
            }
        }
        stk[stk_siz++] = n;
        stk[stk_siz++] = n;
        int c=0;
        for(int i = 0; i+2 <= stk_siz; i+=2) {
            c += stk[i+1] - stk[i];
        }
        printf("%d\n", n-c);
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(LL i=0; i<(n); i++)
#define FOR(i, m, n) for(LL i=(m);i<(n);i++)
#define SZ(x) ((int)(x).size())
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define MP make_pair
#define PB push_back
#define INF INT_MAX

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {

	int n;
	cin >> n;
	VI a(n);
	REP(i, n)cin >> a[i];
	SORT(a);
	REVE(a);

	int x = -1, y = -1, i = 0;
	while (i < n) {
		int elem = a[i], cnt = 0;
		while (i < n && a[i] == elem) { cnt++; i++; }
		//cout << elem << "は" << cnt << "個\n";
		if (cnt >= 4 && x == -1) { x = elem; y = elem; }
		if (cnt >= 2 && x == -1)x = elem;
		else if (cnt >= 2 && x != -1 && y == -1)y = elem;
		//cout << x << " " << y << endl;
	}
	if (y == -1)y = 0;
	cout << (LL)(x)*(LL)(y) << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    
    int a,b,c;
    cin>>a>>b>>c;

    int x=c-a+b;
    if(x<0)x=0;
    cout<<x<<endl;
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3628
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n, m;
	cin >> n >> m;
	Vec a(n);
	rep(i, n) cin >> a[i];
	sort(all(a));
	VecP b(m);
	rep(i, m) cin >> b[i].sc >> b[i].fs;
	sort(all(b), greater<P>());

	Vec c(n);
	ll pos = 0;
	rep(i, m){
		rep(j, b[i].sc){
			c[pos++] = b[i].fs;
			if(pos == n) break;
		}
		if(pos == n) break;
	}
	rep(i, n) chmax(a[i], c[i]);
	ll sum = 0;
	rep(i, n) sum += a[i];
	co(sum);

	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
#define ll long long
using namespace std;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  ll l[1000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }

  sort(l, l + n);

  ll ans = 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[i] != l[k] && l[j] != l[k]) {
          if (l[i] + l[j] > l[k]) {
            ans++;
          }
        }
      }
    }
  }
  cout << ans << "\n";

  return (0);
}


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

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

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}


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

const ll MAX_N = 400;
ll N;
ll a[MAX_N] = {}, s[MAX_N + 1] = {};
ll dp[MAX_N + 1][MAX_N + 1];

ll slime(ll n, ll m){
   //a[n],...,a[m]を合体させるコスト
   if (n == m) return 0;
   else if (dp[n][m] >= 0) return dp[n][m];
   else{
      ll ans = INF;
      FOR(k, n, m){
         chmin(ans, s[m + 1] - s[n] + slime(n, k) + slime(k + 1, m));
      }
      dp[n][m] = ans;
      return ans;
   }
}

int main(){
   cin >> N;
   REP(i, N) {
      //s[i + 1] = a[0] + ... + a[i]
      cin >> a[i];
      s[i + 1] = s[i] + a[i];
   }
   REP(i, N){
      REP(j, N){
         dp[i][j] = -1;
      }
   }
   cout << slime(0, N - 1) << endl;


}


Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1, 1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	map<P, ll> mp;
	for(int i = 0; i < n; i++)
	{
		ll x, y, w;
		cin >> x >> y >> w;
		mp[make_pair(x, y)] = w;
	}
	ll ans = 0;
	for(auto itr = mp.begin(); itr != mp.end(); itr++)
	{
		ll cnt = itr->second;
		queue<ll> que;
		for(int i = 0; i < 9; i++)
		{
			ll nx = itr->first.first + dx[i];
			ll ny = itr->first.second + dy[i];
			P tmp = make_pair(nx, ny);
			if(mp.count(tmp) > 0) cnt += mp[tmp];
			if(mp.find(tmp) != mp.end()) que.push(mp[tmp]);
			else que.push(0);
			if(que.size() == 3) 
			{
				ans = max(cnt, ans);
				for(int j = 0; j < 2; j++)
				{
					ll q = que.front(); que.pop();
					cnt -= q;
				}
			}
		}
		ans = max(cnt, ans);
	}
	cout << ans << " / " << 1 << endl;
	return 0;
}




Measured memory_bytes: 9400
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>
#include <stack>
#include <cassert>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;
using Graph = Vvec<int>;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

class UnionFind{ //連結判定
private:
    std::vector<int> parent; //parent[i] = parent of node i
    std::vector<int> rank;
    std::vector<int> size;
public:
    //constructor
    UnionFind(int N){
        for(int i=0; i<N; i++) parent.push_back(i); //parent = [0,1,..,N-1]
        for(int i=0; i<N; i++) rank.push_back(0); //rank = [0,0,..,0]
        for(int i=0; i<N; i++) size.push_back(1);
    }
    //initialize
    void init(int N){
        parent.clear();
        rank.clear();
        size.clear();
        for(int i=0; i<N; i++) parent.push_back(i); //parent = [0,1,..,N-1]
        for(int i=0; i<N; i++) rank.push_back(0); //rank = [0,0,..,0]
        for(int i=0; i<N; i++) size.push_back(1);
    }
    int root(int a){
        if(parent[a] == a) return a;
        return parent[a] = root(parent[a]); //親が自分自身になるまで再帰を呼び出す & 経路圧縮 
    }
    void unite(int a, int b){
        int rootA = root(a);
        int rootB = root(b);
        if(rootA == rootB) return; //ノードa, bがすでに連結しているとき
        //次数の大きい方を親として連結
        if(rank[rootA] < rank[rootB]){
            size[rootB] += size[rootA];
            parent[rootA] = rootB;
        }
        else{
            size[rootA] += size[rootB];
            parent[rootB] = rootA;
            if(rank[rootA] == rank[rootB]) rank[rootA]++;
        }
    }
    bool same(int a, int b){
        return root(a) == root(b); //ノードa, bが同じ木に属するかどうか
    }
    int get_size(int a){
        return size[root(a)];
    }
};

int main()
{
    int N, M;
    cin >> N >> M;
    vector<ll> a(N);
    UnionFind uf(N);
    for(auto& e: a) cin >> e;
    for(int i=0; i<M; i++){
        int u, v;
        cin >> u >> v;
        uf.unite(u, v);
    }

    int K = N - M - 1;
    if(N < 2*K){cout << "Impossible\n"; return 0;}
    if(K == 0){cout << 0 << endl; return 0;}

    Vvec<ll> v(N);
    for(int i=0; i<N; i++) v[uf.root(i)].emplace_back(a[i]);
    priority_queue<ll, vector<ll>, greater<ll> > pq;

    ll ans = 0;
    int sz = 0;
    for(int i=0; i<N; i++){
        auto& w = v[i];
        if(w.empty()) continue;
        sort(w.begin(), w.end());
        ans += w[0];
        for(int j=1; j<w.size(); j++){
            if(j >= K) break;
            pq.push(w[j]);
            sz++;
        }
    }

    if(sz < K-1){
        cout << "Impossible\n"; return 0;
    }

    for(int i=0; i<K-1; i++){
        ans += pq.top();
        pq.pop();
    }

    cout << ans << endl;
}

Measured memory_bytes: 9780
N, X, Y = map(int, input().split())
dist = [0]*N
for i in range(N):
    for k in range(i+1,N):
        if i == X - 1 and k == Y - 1:
            dist[1] += 1
            continue
        if X - 1 <= k <= Y - 1 and i <= X - 1:
            tmp = min(k-i,(X-1)-i+1+(Y-1-k))
            dist[tmp] += 1
            continue
        if X - 1 < i < Y - 1 and k >= Y - 1:
            tmp = min(k-i,i-(X-1)+1+k-(Y-1))
            dist[tmp] += 1
            continue
        if X - 1 <= k <= Y - 1 and X - 1 <= i <= Y - 1:
            tmp = min(k-i,i-(X-1)+1+(Y-1-k))
            dist[tmp] += 1
            continue
        if i <= X - 1 and k >= Y - 1:
            dist[k-i-(Y-X-1)] += 1
            continue
        dist[k-i] += 1
for i in range(1,N):
    print(dist[i])

Measured memory_bytes: 49500
N = parse(Int32, strip(readline()))
H = map(s -> parse(Int32, s), split(readline()))

result = 0
cnt = 0
for i in 1:N
   if i == N || H[i] < H[i + 1]
       global result = max(result, cnt)
       global cnt = 0
   else
       global cnt += 1
   end
end
println(result)

Measured memory_bytes: 135552
#include <iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<math.h>
#include<cmath>
#define ll long long
using namespace std;
long double pi = 3.14159265358979323846;
int arr[100005];
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,m,x;  cin >> n>>m;
	string s;
	ll sum = 0,count=0;
	set<int>se;
	for (int i = 1; i <= m; i++)
	{
		cin >> x >> s;
		if (s == "AC")
		{
			if (se.find(x) == se.end())
			{
				count++;
				se.insert(x);
				sum += arr[x];
			}
			
		}
		else
			arr[x]++;
	}
	cout << count << " " << sum;
		
		return 0;

}

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

using namespace std;

const double EPS = 1e-10;
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point {
public:
    double x, y;

    Point(double x = 0.0, double y = 0.0) : x(x), y(y) {}

    Point operator + (Point &p) { return Point(x + p.x, y + p.y); }

    Point operator - (Point &p) { return Point(x - p.x, y - p.y); }

    Point operator * (double k) { return Point(x * k, y * k); }

    Point operator / (double k) { return Point(x / k, y / k); }

    double norm() { return x * x + y * y; }

    double abs() { return sqrt(norm()); }

    bool operator < (const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator == (const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}


struct Segment {
    Point p1, p2;
};

typedef Segment Line;

class Circle {
public:
    Point c;
    double r;

    Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};

typedef vector<Point> Polygon;

bool isOrthgonal(Vector a, Vector b) {
    return equals(dot(a, b), 0.0);
}

bool isOrthgonal(Point a1, Point a2, Point b1, Point b2) {
    return isOrthgonal(a1 - a2, b1 - b2);
}

bool isOrthgonal(Segment s1, Segment s2) {
    return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

bool isParallel(Vector a, Vector b) {
    return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2) {
    return isParallel(a1 - a2, b1 - b2);
}

bool isParallel(Segment s1, Segment s2) {
    return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

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

    int q;
    cin >> q;
    int x0, y0, x1, y1, x2, y2, x3, y3;
    while (q--) {
        cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        Vector v0(x0 - x1, y0 - y1), v1(x2 - x3, y2 - y3);
        if (isParallel(v0, v1)) {
            cout << 2 << endl;
        } else if (isOrthgonal(v0, v1)) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    }
    return 0;
}

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


public class Main{

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		String[] line = s.nextLine().split(" ");
		int productCnt = Integer.parseInt(line[0]);
		int trackCnt = Integer.parseInt(line[1]);
		int[] weight = new int[productCnt];
		for(int i=0 ; i<productCnt ; i++) {
			weight[i] = Integer.parseInt(s.nextLine());
		}
		System.out.println(answer(trackCnt, weight));
	}

	// n*logn?????´???
	public static int answer(int trackCnt, int[] weight) {
		int left = 0;
		int right = 100000 * 10000;

		int point = 0;
		boolean can = true;
		while(left <= right) {
			can = true;
			//?????????????±????
			point = (left + right) / 2;
			int[] track = new int[trackCnt];
			int index = 0;
			for(int i=0 ; i<weight.length ; i++) {
				//???????????????????????´???
				if(track[index]+weight[i] <= point) {
					track[index] += weight[i];
				}
				//?¬??????????????????????????????????????????´???
				else if(trackCnt != (index+1) && track[index+1]+weight[i] <= point) {
					index++;
					track[index] += weight[i];
				}
				//???????????°?????????????????´???
				else {
					can = false;
					break;
				}
			}
			//??¨?????????????????°??????????????´???
			if(can) {
				right = point - 1;
			}
			else {
				left = point + 1;
			}
		}
			return left;

	}

	//n^2?????´???
	public static int solve(int trackCnt, int[] weight) {
		int p = 0;
		int index = 0;
		int[] track = new int[trackCnt];
		outer: for(; p<10000*weight.length ; p++) {
			index = 0;
			Arrays.fill(track, 0);
			inner: for(int i=0 ; i<weight.length ; i++) {
				if(track[index]+weight[i] > p && (trackCnt == index+1)) {
					continue outer;
				} else if(track[index]+weight[i] > p) {
					index++;
					i--;
				} else {
					track[index] += weight[i];
				}
			}
			break;
		}
		return p;
	}
}

Measured memory_bytes: 112432
import java.util.Arrays;
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc =new Scanner(System.in);
	int N=sc.nextInt();
	int K=sc.nextInt();
	long H[]=new long[N];
	for(int i=0;i<N;i++) {
		H[i]=sc.nextLong();
	}
	Arrays.sort(H);
	long sum=0;
	if(N-K>0) {
	for(int i=0;i<N-K;i++) {
		sum+=H[i];
	}}
	System.out.println(sum);


}
}

Measured memory_bytes: 65868
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
int cmp(ll a,ll b)
{
    return a>b;
}
int main()
{
    vector<ll>w;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    w.push_back(a*c);
    w.push_back(a*d);
    w.push_back(b*c);
    w.push_back(b*d);
    sort(w.begin(),w.end(),cmp);
    printf("%lld",w[0]);
    return 0;
}


Measured memory_bytes: 3668
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int main(){
    char c;
    cin >> c;
    char ans=c+1;
    cout<<ans<<endl;
    return 0;
}



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

using namespace std;

int n, m, q ;
string s ;
vector<string> b ;

void dfs_list(int d,int add,string s){
    if(d==n){
        b.push_back(s) ;
        return ;
    }
    for(int i=add;i<m;i++){
        dfs_list(d+1,i,s+to_string(i)) ;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int q ;
    cin >> n >> m >> q ;
    vector<int> A(q) ;
    vector<int> B(q) ;
    vector<int> C(q) ;
    vector<int> D(q) ;  
    
    for(int i=0;i<q;i++){
        cin >> A[i] >> B[i] >> C[i] >> D[i] ;
    }
    
    dfs_list(0,0,"") ;

    int ans = 0 ;
    
    for(int i=0;i<b.size();i++){
        int tmp = 0 ;
        for(int j=0;j<q;j++){
            if(b[i][B[j]-1]-b[i][A[j]-1]==C[j]){
                tmp += D[j] ;
            }
        }
        ans = max(ans,tmp) ;
    }
    cout << ans <<endl ;
    return 0;
}


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

using namespace std;

typedef unsigned uint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldbl;
typedef pair<int, int> pii;
typedef pair<uint, uint> puu;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<uint> vu;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pii> vpii;
typedef vector<puu> vpuu;
typedef vector<pll> vpll;
typedef vector<pull> vpull;
typedef vector<string> vstr;
typedef vector<double> vdbl;
typedef vector<ldbl> vldbl;
#define pb push_back
#define ppb pop_back
#define pfr push_front
#define ppfr pop_front
#define emp emplace
#define empb emplace_back
#define be begin
#define rbe rbegin
#define all(x) (x).be(), (x).end()
#define rall(x) (x).rbe(), (x).rend()
#define fir first
#define sec second
#define mkp make_pair
#define brif(cond) if (cond) break
#define ctif(cond) if (cond) continue
#define retif(cond) if (cond) return
void canhazfast() {ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);}
template<typename T> T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}
template<typename T> T extgcd(T a, T b, T &x, T &y)
{
    T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
    while (b) {
        T q = a/b; a %= b; swap(a, b);
        x0 -= q*x1; swap(x0, x1);
        y0 -= q*y1; swap(y0, y1);
    }
    x = x0; y = y0; return a;
}
int ctz(uint x) {return __builtin_ctz(x);}
int ctzll(ull x) {return __builtin_ctzll(x);}
int clz(uint x) {return __builtin_clz(x);}
int clzll(ull x) {return __builtin_clzll(x);}
int popcnt(uint x) {return __builtin_popcount(x);}
int popcntll(ull x) {return __builtin_popcountll(x);}
int bsr(uint x) {return 31^clz(x);}
int bsrll(ull x) {return 63^clzll(x);}

#define N 256

char a[N][N];
int d[N], q[N];

int bfs(int n, int s)
{
    int k = 0;
    int cnt = 0;

    //cerr << "bfs(" << s << ")\n";
    fill_n(d, n, 0);
    d[s] = 1;
    q[k++] = s;
    for (int i = 0; i < k; ++i) {
        int u = q[i];
        //cerr << "  u = " << u << " d = " << d[u] << '\n';
        cnt = max(cnt, d[u]);
        for (int v = 0; v < n; ++v) {
            ctif(a[u][v] == '0');
            //cerr << "    edge (" << u << ", " << v << ")\n";
            if (d[v]) {
                retif(d[v] != d[u]-1 && d[v] != d[u]+1) -1;
                continue;
            }
            d[v] = d[u]+1;
            q[k++] = v;
        }
    }
    return cnt;
}

int main()
{
    canhazfast();

    int n, ans = -1;

    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    for (int i = 0; i < n; ++i) ans = max(ans, bfs(n, i));
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256