akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rp(i, k, n) for (int i = k; i < n; i++)
typedef long long ll;

ll mod = 1e9 + 7;
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; }
const ll inf = 1ll << 60;

int main() {
    int n, m;
    scanf("%d%d", &n, &m);
    int r = m / n;
    while(m % r != 0) r--;
    printf("%d", r);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int64 long long int
int calc(int A,int B){
	int res = 1111111;
	for(int i=1; i<=A; i++){
		int64 S1 = (int64)(A-i)*B;

		int64 S3 = (int64)i/2*B, S4 = (int64)(i-i/2)*B;
		int64 maxS = max(max(S1, S3),S4);
		int64 minS = min(min(S1, S3),S4);
		if(maxS - minS < res)res = maxS - minS;

		S3 = (int64)i*(B/2), S4 = (int64)i*(B-B/2);
		maxS = max(max(S1, S3),S4);
		minS = min(min(S1, S3),S4);
		if(maxS - minS < res)res = maxS - minS;
	}
	return res;
}
int main(){
	int A,B;
	scanf("%d%d",&A,&B);
	printf("%d\n",min(calc(A,B),calc(B,A)));
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int n, S[500000], call;
int l[500000/2 + 2], r[500000/2 + 2];
void merge(int n, int left,int mid,int right)
{
  int n1, n2;
  n1 = mid - left;
  n2 = right - mid;
  for(int m=0; m<n1; m++) l[m] = S[left + m];
  for(int m=0; m<n2; m++) r[m] = S[mid + m];
  l[n1] = 999999999;
  r[n2] = 999999999;
  int i = 0;
  int j = 0;
  for(int k = left; k<right; k++)
  {
    call++;
    if(l[i] <= r[j])
    {
      S[k] = l[i];
      i++;
    }
    else
    {
      S[k] = r[j];
      j++;
    }
  }
}

void ms(int n ,int left, int right)
{
  int mid;
  if(left+1 < right)
  {
    mid = (left + right) /2;
    ms(n, left, mid);
    ms(n, mid, right);
    merge(n, left, mid, right);
  }
}

int main()
{
  int right;
  int left =0;
  int mid = 0;
  scanf("%d", &n);
  for(int i=0; i<n; i++) scanf("%d", &S[i]);
  right = n;
  ms(n, left, right);
  for(int i=0; i<n; i++)
  {
    printf("%d", S[i]);
    if(i!=n-1) printf(" ");
  }
  printf("\n%d\n", call);
  return 0;
}


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

using namespace std;

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000
#define pb push_back
#define mk make_pair

#define flu(i, s, e) for(int i = s; i < e; i++)
#define fld(i, s, e) for(int i = s; i >= e; i--)


int main(){
	fast;

	// freopen("input.txt", "r", stdin);
	// freopen("myoutput.txt", "w", stdout);

	char arr[101];
	int k; scanf("%d %s", &k, arr);
	int n = strlen(arr);
	
	flu(i, 0, min(k, n)) printf("%c", arr[i]);
	if(k < n) printf("...");

	return 0;
}

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

int main() {
	int N,a,b,c,d;
  	cin >> N;
  	a = N/1000;
    b = N%1000/100;
  	c = N%100/10;
  	d = N%10;
  	if ( (a == b && b == c) || (b == c && c == d) ){
      cout <<"Yes" << endl;
    }
  
  	else{
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5+5, inf = 1e18+5;
int n, A[N], rt1, rt2, l, r, mid;
int get(int x){ for(int i=0;i<n;i++) x=x/A[i]*A[i]; return(x); }
int32_t main(){
    scanf("%lld", &n);
    for(int i=0;i<n;i++) scanf("%lld", &A[i]);
    l = 2, r = inf;
    while(l<r){
        mid = ((l+r)>>1LL);
        if(get(mid)>=2) r = mid;
        else l = mid+1;
    }
    rt1 = l;
    l = 2, r = inf;
    while(l<r){
        mid = ((l+r+1LL)>>1LL);
        if(get(mid)<=2) l = mid;
        else r = mid-1;
    }
    rt2 = l;
    if(get(rt2)^2) return !printf("-1");
    printf("%lld %lld", rt1, rt2);
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,i,a[100]={0}; //100個
    cin >> n;
    for(i=0; i<n; i++){
       cin >> a[i];
    }
    cout << a[n-1];
    for(i=1; i<n; i++){
       int j=(n-1)-i;
       cout << " " << a[j];
    }
    cout << endl;
}



Measured memory_bytes: 3068
#include <stdio.h>

int main(void){
	int i, j, k, n, flag, counter = 0;
	int A[100];
	scanf("%d", &n);
	for(i = 0; i < n; i++){
		scanf("%d", &A[i]);
	}
	flag = 1;
	while(flag){
		flag = 0;
		for(j = n-1; j >= 1; j--){
			if(A[j] < A[j-1]){
				int temp = A[j];
				A[j] = A[j-1];
				A[j-1] = temp;
				flag = 1;
				counter++;
			}
		}
	}

	printf("%d", A[0]);
	for(k = 1; k < n; k++){
		printf(" %d", A[k]);
	}
	printf("\n");
	printf("%d\n", counter);
	return 0;
}


Measured memory_bytes: 1964
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(ll i=0;i<n;i++)
#define repp(j, n) for(ll j=0;j<n;j++)
#define reppp(i, m, n) for(ll i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

int n, k;

bool check(vector<int> b, int aa){
    vector< vector<bool> > dp(n-1, vector<bool>(k, false));
    dp[0][0] = true;
    if(b[0] < k) dp[0][b[0]] = true;
    reppp(i, 1, n-2){
        repp(j, k){
            if(dp[i-1][j]){
                dp[i][j] = true;
                if(b[i] < k-j) dp[i][j+b[i]] = true;
            }
        }
    }

    reppp(j, max(0, k-aa), k-1){
        if(dp[n-2][j]) return true;
    }
    return false;
}

signed main(){
    cin >> n >> k;
    vector<int> a(n);
    rep(n){
        cin >> a[i];
    }

    if(n == 1){
        if(a[0] >= k){
            cout << 0;
        }else{
            cout << 1;
        }
        return 0;
    }

    sort(all(a));

    int ok = n, ng = -1, m;
    while(ok - ng > 1){
        m = (ok+ng)/2;
        vector<int> b;
        rep(n){
            if(i == m) continue;
            b.pb(a[i]);
        }
        if(check(b, a[m])){
            ok = m;
        }else{
            ng = m;
        }
        //cout << m << endl;
        //cout << ng << " " << ok << endl;
    }
    
    cout << ng+1;
    return 0;
}

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

int main()
{
    
    string s;
    string t;
    cin >> s >> t;
    int flag=0;
    for (int i = 0; i < s.length(); i++)
    {
        /* code */
        if(s[i]!=t[i])
        flag=1;
    }
    if(flag==1)
    cout << "No" << endl;
    else
    {
        cout << "Yes" << endl;
    }
    
    


}

Measured memory_bytes: 3560
N, K = map(int, input().split())
if N >= 3 and K >= 3:
    print((N-2)*(K-2))
elif N == 1 or K == 1:
    ans = max(N, K) - 2
    if ans >= 0:
        print(ans)
    else:
        print(1)
else:
    print(0)


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

#define int long long

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	string s;
	cin >> s;
	s[1] = s[1]^'R'^'B';
	cout << s << '\n';
				
	return 0;
}


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

int main ( )
{
	string tmp;
	cin >> tmp;
	char s2 = tmp[2];
	char s3 = tmp[3];
	char s4 = tmp[4];
	char s5 = tmp[5];

	if ( ( s2 == s3 ) && ( s4 == s5 ) ){
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}

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

int main(){
  ll n, p;
  cin >> n >> p;
  ll x = p;
  map<ll,ll> m;
  for(ll i = 2; i*i <= p; i++) {
    while(x % i == 0) {
      x /= i;
      m[i]++;
    }
  }
  m[x]++;
  ll ans = 1;
  for(auto x : m) {
    ans *= pow(x.first,x.second/n);
  }
  cout << ans << endl;
  return 0;
}

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

using Int = int;
using namespace std;

#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; };
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; };
template<class T> T th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

int main(){
	int n;
	int x[112];
	cin >> n;
	RC(i, n) cin >> x[i];
	int av = 0;
	RC(i, n) av += x[i];
	av /= n;
	int ans1 = 0;
	RC(i, n) ans1 += (x[i] - av) * (x[i] - av);
	++av;
	int ans2 = 0;
	RC(i, n) ans2 += (x[i] - av) * (x[i] - av);
	cout << ont(ans1, ans2) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<iomanip>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
int main(){
  int a, b, c = 0;
  cin >> a >> b;
  if(a >= 2){
    c += a * (a - 1) / 2;
  }
  if(b >= 2){
    c += b * (b - 1) / 2;
  }
  
  cout << c << "\n";
}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace atcoder
{
    class test
    {
        static void Main(string[] args)
        {
            int N=int.Parse(Console.ReadLine());
            string[] B=Console.ReadLine().Split(' ');
            
            List<string> stringB=new List<string>();
            List<int> intB=new List<int>();


            stringB.AddRange(B);
            intB=stringB.ConvertAll(x=>int.Parse(x));


            int value=0;
          	value+=intB[0];
            for(int i=1; i<N-1; i++)
            {
                if(intB[i]<intB[i-1])
                {
                    value+=intB[i];
                }
                else
                {
                    value+=intB[i-1];
                }
            }
            value+=intB[N-2];
            Console.WriteLine(value);




            

        }
    }
}

Measured memory_bytes: 11220
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M, K = map(int, input().split())
Network = UnionFind(N)
Friend = [0] * N
BlockInNetwork = [0] * N

for _ in range(M):
    a, b = map(int, input().split())
    Network.union(a-1, b-1)
    Friend[a-1] += 1
    Friend[b-1] += 1

for _ in range(K):
    c, d = map(int, input().split())
    if Network.same(c-1, d-1):
        BlockInNetwork[c-1] += 1
        BlockInNetwork[d-1] += 1

out = [0]*N
for i in range(N):
    out[i]=Network.size(i)-Friend[i]-BlockInNetwork[i] - 1
print(*out)

Measured memory_bytes: 83576
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i = s; i < t ; ++i)
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define UNIQ(a) a.erase(unique(ALL(a)),a.end())
#define debug(a) cerr<<#a":="<<a<<endl;
#define SZ(a) (int)a.size()
using LL = long long; template<class T> using V = vector <T>; template <class T> using VV = V<V<T>>;


LL powmod(LL a, LL x, LL mod) {
	LL ret = 1;
	while (x) {
		if (x % 2) {
			ret *= a;
			ret %= mod;
		}
		a *= a;
		a %= mod;
		x >>= 1;
	}
	return ret;
}
string spa(const string &s) {
	string ret = "";
	FOR(i, 0, SZ(s)) {
		if (s[i] != ' ') {
			ret += string(1, s[i]);
		}
	}
	return ret;
}
LL getnum(string & s, int &i) {
	LL ret = 0;
	while (isdigit(s[i])) {
		ret *= 10;
		ret += s[i] - '0';
		i++;
	}

	return ret;
}

int flag;

LL expr0(string&, int&, LL);
LL expr1(string&, int&, LL);
LL expr2(string&, int&, LL);

LL expr0(string& s, int& i, LL mod) {
	LL ret = expr1(s, i, mod);
	while (s[i] == '+' || s[i] == '-') {
		if (s[i] == '+')ret += expr1(s, ++i, mod);
		if(s[i]=='-')ret -= expr1(s, ++i, mod);
		ret += mod;
		ret %= mod;
	}
	return ret;
}
LL expr1(string& s, int& i, LL mod) {
	LL ret = expr2(s, i, mod);
	while (s[i] == '*' || s[i] == '/') {
		if (s[i] == '*')ret *= expr2(s, ++i, mod);
		if (s[i] == '/') {
			LL si = expr2(s, ++i, mod);

			if (si%mod == 0) {
				flag = 1;
			}
			else {
				ret *= powmod(si, mod - 2,mod);
			}
		}
		ret %= mod;
	}
	return ret;
}
LL expr2(string& s, int& i, LL mod) {
	if (s[i] == '(') {
		i++;
		LL num = expr0(s, i, mod);
		i++;
		return num;
	}
	else {
		return getnum(s, i) % mod;
	}

}


int main() {

	string s;
	while (getline(cin,s), s[0] != '0') {
		string t = spa(s);
		int i = 0;
		LL mod = getnum(t, i);
		i++;
		t = t.substr(i);
		string sub = t;
		i = 0;
		flag = 0;
		LL ans = expr0(t, i,mod);
		if (flag) {
			cout << "NG" << endl;
		}
		else {
			cout << sub ;
			cout << " = " << ans << " (mod " << mod << ")" << endl;
		}

	}

	return 0;
}



Measured memory_bytes: 3264
a, b = io.read("*n", "*n")
h, m = io.read("*n", "*n")

angle = h * 30 + m * 0.5

angle = angle * math.pi / 180

ax, ay = a * math.cos(angle), a * math.sin(angle)

z = m * 6
z = z * math.pi / 180

bx, by = b * math.cos(z), b * math.sin(z)

ret = (ax - bx) * (ax - bx) + (ay - by) * (ay - by)
ret = math.sqrt(ret)
print(string.format("%.10f", ret))


Measured memory_bytes: 3192
n = gets.to_i
words = Array.new(n){gets.chomp}
# p words
for i in 0..words.length-2
  if words[i][-1] != words[i+1][0]
    puts "No"
    exit
  end
end

for i in 0..words.length-1
  if words.count(words[i]) > 1
    puts "No"
    exit
  end
end

puts "Yes"


Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void c_p_c(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll knapsack1(vector<pair<ll,ll> >v,int n,int w){
	ll dp[n][w+1];
	for(int i=0;i<n;i++){
		for(int j=0;j<=w;j++){
			if(j==0)
				dp[i][j] = 0;
			else if(i==0){
				if(j<v[i].first)
					dp[i][j] = 0;
				else
					dp[i][j] = v[i].second;
			}
			else if(j<v[i].first)
				dp[i][j] = dp[i-1][j];
			else
				dp[i][j] = max(dp[i-1][j], v[i].second+dp[i-1][j-v[i].first]);
		}
	}
	return dp[n-1][w];
}
int main()
{
	c_p_c();
	int n,w;
	cin>>n>>w;
	vector<pair<ll, ll> >v;
	for(int i=0;i<n;i++){
		ll wt,val;
		cin>>wt>>val;
		v.push_back({wt,val});
	}
	sort(v.begin(),v.end());
	cout<<knapsack1(v,n,w);
}

Measured memory_bytes: 78336
#include <iostream>
#include <algorithm>
using namespace std;
int a[3];
int main()
{
  for (int i = 0; i < 3;i++)
  {
    cin >> a[i];
  }
  if(a[0]==a[1] &&a[1]==a[2])
  {
    cout << 0 << endl;
    return 0;
  }
  sort(a, a + 3);
  int d = a[0] + a[1] + a[2];
  if((a[2]*3-d)%2==0)
    cout << (a[2] * 3 - d) / 2 << endl;
  else
    cout << ((a[2]+1) * 3 - d) / 2 << endl;
}

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

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

for(int i = 0; i <= 25; i++){ 
     for(int j = 0; 7 * j + 4 * i <= 100; j++){ 
          if(4 * i + 7 * j == N){
              cout << "Yes" << endl;
              return 0;
          } 
     }
}
cout << "No" << endl; 
}

Measured memory_bytes: 256
class FeTree
    def initialize(n)
        @n = n
        @f = Array.new(@n+1,0)
    end

    def add(i, x)
        while i <= @n
            @f[i] += x
            i += i & -i
        end
    end

    def sum(i)
        s = 0
        while i > 0
            s += @f[i]
            i &= i-1
        end
        s
    end
end

n, q = gets.split.map &:to_i
a = gets.split.map &:to_i

ft = FeTree.new(n)
a.each_with_index {|e,i| ft.add(i+1, e)}

q.times do
    t, x, y = gets.split.map &:to_i
    if t == 0
        ft.add(x+1, y)
    else
        puts ft.sum(y) - ft.sum(x)
    end
end

Measured memory_bytes: 57444
n, m = [int(s) for s in input().split()]
a = [0 for _ in range(n)]
for i in range(m):
  p, res = input().split()
  p = int(p) - 1
  if a[p]%2==0:
  	a[p] += 2 if res=='WA' else 1
  
print(sum([tmp%2 for tmp in a]), sum([tmp//2 if tmp%2==1 else 0 for tmp in a]))

Measured memory_bytes: 4724
import java.util.*;


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

		for (int i = 0; i < n; i++) {
			String city = sc.next();
			int point = sc.nextInt();
			sp[i] = city + "_" + (1100 - point) + "_" + (i + 1);
		}

		Arrays.sort(sp);

		for (String s : sp) {
			String ans = s.split("_")[2];
			System.out.println(ans);
		}

		
	}
}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> A;
	A.push_back(1);
	int a;
	for(int i = 1; i <= m; i++)
	{
		cin >> a;
		A.push_back(a);
	}
	A.push_back(n);
	int ans = 0;
	for(int i = 1; i < A.size(); i++)
	{
		int tmp;
		if(i == 1 || i == A.size() - 1)
			tmp = A[i] - A[i - 1];
		else
			tmp = (A[i] - A[i - 1]) / 2;
		ans = max(tmp, ans);
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
	int a, b, c, x;
	int count = 0;
	cin >> a >> b >> c >> x;

	for (int i = 0; i <= a; i++) {
		for (int j = 0; j <= b; j++) {
			for (int k = 0; k <= c; k++) {
				if (x == i * 500 + j * 100 + k * 50) {
					count++;
				}
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

vector<long long> LISLDS(long long N, long long A, long long B) {
    vector<long long> res;
    for (long long i = B-1; i >= 0; --i) res.push_back(i);
    
    if (A == 1) return res;
    
    long long rem = N - B;
    long long p = rem / (A-1);
    long long r = rem % (A-1);
    
    long long b = r;
    long long c = A-1-r;
    
    for (int i = 0; i < b; ++i) {
        int size = (int)res.size();
        for (int j = 0; j < p+1; ++j) {
            res.push_back(size + p - j);
        }
    }
    for (int i = 0; i < c; ++i) {
        int size = (int)res.size();
        for (int j = 0; j < p; ++j) {
            res.push_back(size + p-1 - j);
        }
    }
    
    return res;
}

void solve(){
    ll N, A, B;
    cin >> N >> A >> B;
    if(!(A + B <= N+1 && A * B >= N)){
        cout << -1 << endl;
        return;
    }
    auto res = LISLDS(N, A, B);
    for(auto x : res) cout << x + 1 << " ";
    cout << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}

Measured memory_bytes: 6512
#include<stdio.h>

int main(void){
  int N,M,i;
  
  scanf("%d%d", &N,&M);
  scanf("*c");
  int A[M];
  for(i=0;i<M;i++){
    scanf("%d",&A[i]);
  }
  int val=N;
  for(i=0;i<M;i++){
    val-=A[i];
  }
  
  if(val<0) val=-1;
  printf("%d", val);
  return 0;
}

Measured memory_bytes: 1764
n=int(input())
l=[int(i) for i in input().split()]
cou=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      if l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]:
        a=max(l[i],l[j],l[k])
        if a<l[i]+l[j]+l[k]-a:
          cou+=1
print(cou)

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

using namespace std; 
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>; 

#define INF 100000000
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

int main(){
  vector<int>a(5);
  for(int i=0;i<5;i++)cin>>a[i];
  int Min=INF;
  do{
    vector<int>m(5);
    for(int i=0;i<5;i++)m[i]=a[i];
    for(int i=0;i<4;i++)while(m[i]%10)m[i]++;
    int sum=0;
    for(int i=0;i<5;i++)sum+=m[i];
    Min=min(Min,sum);
  }
  while(next_permutation(rng(a)));
  cout<<Min<<endl;
  return 0;
}




Measured memory_bytes: 256
N =int(input())
A,B,C =[input()for i in range(3)]
def check(a,b,c):
    n1 =[a,b,c].count(a)
    n2 =[a,b,c].count(b)
    n3 =[a,b,c].count(c)
    n =max(n1,n2,n3)
    return 3-n
ans = 0
for i in range(N):
    ans += check(A[i],B[i],C[i])
print(ans)

Measured memory_bytes: 3064
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll buka[200001];

void solve_abc_c() {
	ll n;
	ll ans = 0;

	cin >> n;

	map<string, ll> s;
	string tmp;
	rep(i, n) {
		cin >> tmp;
		s.insert(make_pair(tmp, i));
	}

	cout << s.size() << "\n";
}

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

	solve_abc_c();

	return 0;
}

Measured memory_bytes: 19200
/*input
10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
*/

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

int main() {
    ll n, m;
    cin >> n >> m;
    priority_queue<ll> que;
    rep(i, n) {
        ll a;
        cin >> a;
        que.push(a);
    }
    rep(i, m) {
        ll a = que.top(); que.pop();
        que.push(a/2);
    }
    ll ans = 0;
    while (!que.empty()) {
        ans += que.top(); que.pop();
    }
    cout << ans << endl;
}

Measured memory_bytes: 1400
#include <stdio.h>
int main(void){
    int S;
    int h,m,s;
    scanf("%d",&S);
    h=S/3600;
    S%=3600;
    m=S/60;
    S%=60;
    s=S;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}



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

int main (void){
  int n = 0,a = 0,b = 0;

  cin >> n >> a >> b;

  if(a * n >= b){
    cout << b << endl;
  }else{
    cout << a * n << endl;
  }

  return 0;
}

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

int main(){

  int N,ans=0;
  cin >> N;
  int A[N],B[N],C[N-1];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) cin >> B[i];
  for(int i=0; i<N-1; i++) cin >> C[i];

  for(int i=0; i<N; i++) ans += B[i];
  for(int i=0; i<N-1; i++){
    if(A[i+1]==A[i]+1) ans += C[A[i]-1];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <functional>
#include <cmath>
#include <map>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	vector<int>v{ 0 };
	for (int i = 1; i <= n; i++) {
		int a; cin >> a;
		if (a == 0)v.push_back(i);
	}
	v.push_back(n + 1);
	int Max = 0;
	rep(i, v.size() - 1) {
		Max = max(Max, v[i + 1] - v[i]);
	}
	cout << Max << endl;
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int iy[]={0, 0, 1, -1};
int ix[]={1, -1, 0, 0};

string s,t;

int main(){
	cin >> s >> t;
	if(s[0] > t[0]){
		cout << ">" << endl;	
	}else if(s[0] < t[0]){
		cout << "<" << endl;	
	}else{
		cout << "=" << endl;	
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vector<ll>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const ll INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(ll i=0;i<(ll)(s.size());++i) {
    cout << s[i];
    if(i == (ll)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll n; cin >> n;
  ll sz = 1;
  for(ll i=0;i<n;++i) {
    sz *= 2;
  }
  vector<ll> a(sz);
  for(ll i=0;i<sz;++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  vector<ll> nowv = {a[0]};
  vector<ll> sel(sz, false);
  sel[0] = true;
  ll now = 1;
  bool ok = true;
  while(now < sz) {
    sort(nowv.begin(), nowv.end());
    reverse(nowv.begin(), nowv.end());
    ll pos = 0;
    for(ll i=0;i<sz;++i) {
      if(pos == now) break;
      if(sel[i]) continue;
      if(a[i] < nowv[pos]) {
        sel[i] = true;
        nowv.push_back(a[i]);
        pos++;
      }
    }
    if(pos != now) {
      ok = false;
      break;
    }
    now *= 2;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 6516
#include <cstdio>
#include <algorithm>
using namespace std;
inline int read(){
    int x(0),w(1); char c = getchar();
    while(c^'-' && (c<'0'||c>'9')) c = getchar(); if(c == '-') w = -1, c = getchar();
    while(c>='0' && c<='9') x = (x<<3) + (x<<1) + c - '0', c = getchar();
	return x*w;
}
int n,K,ans;
int a[60],dp[60][60][110];
inline int DP(int i, int j, int k){
	if(k <= 0) return 0;
	if(i == j){
		if(k==0) return 0;
		return max(a[i],0);
	}
	return dp[i][j][k];
}
int main(){
//	freopen(".in","r",stdin);
	n = read();
	K = read();
	for(int i = 1; i <= n; ++i) a[i] = read();
	for(int i = n; i >= 1; --i){
		for(int j = i; j <= n; ++j){
			for(int k = 0; k <= K; ++k){
				dp[i][j][k] = max(DP(i+1,j,k-2),DP(i,j-1,k-2));
				dp[i][j][k] = max(DP(i,j-1,k-1)+a[j],dp[i][j][k]);
				dp[i][j][k] = max(DP(i+1,j,k-1)+a[i],dp[i][j][k]);
//				printf("dp(%d,%d,%d) = %d\n",i,j,k,dp[i][j][k]);
				if(i==1 && j==n) ans = max(ans,dp[i][j][k]);
			}
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 896
# -*- coding: utf-8 -*-
# problem C2

## N! = 1 * 2 * ... * N
## N! = 2~e2 + 3~e3 + 5~e5 + ... + prime~eprime
## e2 = ord2(1) + ord2(2) + ... + ord2(N)
## ans = (e2 + 1)(e3 + 1)(e5 + 1)...
## e2 = [N/2] + [N/4] + [N/8] + [N/16] +...

from math import floor as gs
N = int(input())

## creating prime numbers until N
def fun_prime(k):
    counter = 0
    primes = [2, 3]

    for n in range(5, k+1, 2):
        isprime = True
        for i in range(1, len(primes)):
            if primes[i] ** 2 > n:
                break
            if n % primes[i] == 0:
                isprime = False
                break
        if isprime == True:
            primes.append(n)
    return(primes)
primes_N = fun_prime(N)

ans = 1
if N == 1:
    print(int(ans))
else:
    for prime in primes_N:
        e = 0
        power = prime
        while power <= N:
            e += gs(N/power)
            power = power * prime
        ans = ans * (e + 1)
    ans = ans % (10 ** 9 + 7)
    print(int(ans)) 

Measured memory_bytes: 3188
#include<iostream>
#include<cstring>
#include<cstdio>
#define LL long long
using namespace std;
int n;
LL ans;
const int N=300010,mod=1e9+7;
int f[N][3][3];
char s[N];
int main()
{
    scanf("%s",s+1);n=strlen(s+1);
    f[0][0][0]=1;
    for(int i=0;i<n;++i)
    	for(int j=0;j<3;++j)
    		for(int k=0;k<3;++k)
    		{
    			if(s[i+1]!='0')
    			{
    				if(k)(f[i+1][j][k-1]+=f[i][j][k])%=mod;
    				else (f[i+1][min(j+1,2)][k]+=f[i][j][k])%=mod;
				}
				if(s[i+1]!='1')
    			{
    				if(k==2)(f[i+1][j][1]+=f[i][j][k])%=mod;
    				else (f[i+1][j][k+1]+=f[i][j][k])%=mod;
				}
			}
	for(int i=0;i<3;++i)
		for(int j=0;j<=i;++j)(ans+=f[n][i][j])%=mod;
	cout<<ans;
	return 0;
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i_len=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back
#define mp make_pair

int main()
{
    ll N, K;
    cin >> N >> K;
    ll m = MIN(abs(N-(N/K+1)*K),abs(N-(N/K)*K));
    PR(m);

    return 0;
}

/*



*/

Measured memory_bytes: 3640
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {

	/**
	 * ???????????????????????´??????????????¨?????????????????´?????¢????????????
	 * @param firstYear
	 * @param lastYear
	 * @return
	 */
	public List<Integer> findTheLeapYear(int firstYear, int lastYear){

		List<Integer> leapYears = new ArrayList<Integer>();

		//?????´?????¨??????????????´??§????????????????????????????????????????????§????????°?????????????????????????????´???????????????
		for(int thisYear = firstYear; thisYear <= lastYear; thisYear++){
			if(isLeapYear(thisYear)){
				leapYears.add(thisYear);
			}
		}
		return leapYears;
	}

	/**
	 * ?????´??????????????´???????????????????????§????????°???true??????????????§???????????°???false????????????
	 * @param thisYear
	 * @return
	 */
	public boolean isLeapYear(int thisYear){
		if(thisYear % 4 != 0){
			return false;
		} else if(thisYear % 100 == 0 && thisYear % 400 != 0) {
			return false;
		} else {
			return true;
		}
	}


	public static void main(String[] args){

		Main leapYear = new Main();

		Scanner input = new Scanner(System.in);

		String[] terminalYears = input.nextLine().split(" ");
		int firstYear = Integer.parseInt(terminalYears[0]);
		int lastYear = Integer.parseInt(terminalYears[1]);
		if(firstYear == 0 && lastYear == 0)	input.reset();

		while(input.hasNextLine()){

			if(firstYear > lastYear || firstYear <= 0 || lastYear >= 3000)	continue;

			//????????´????????????????????´??????????????????????????????????´???????
			List<Integer> leapYears = leapYear.findTheLeapYear(firstYear, lastYear);

			//?????´????????????????????????????????????????????????????????????????????´?????°???????????????
			int numYears = leapYears.size();

			if(numYears == 0){
				System.out.println("NA");
			} else {
				for(int iYear = 0; iYear < numYears; iYear++)
					System.out.println(leapYears.get(iYear));
			}
			//??\??????????????°????????????????????´?????????
			terminalYears = input.nextLine().split(" ");
			firstYear = Integer.parseInt(terminalYears[0]);
			lastYear = Integer.parseInt(terminalYears[1]);

			if(firstYear == 0 && lastYear == 0)	break;
			System.out.println();
		}
		input.close();
	}
}

Measured memory_bytes: 27384
fun main(args: Array<String>) {
    val n = readInt()
    var sen = 0
    for (i in 1 .. 1000) {
        sen = 1000 * i
        if (sen >= n) {
            println(sen - n)
            return
        }
    }


}


private fun read() = readLine()!!

private fun readInt() = read().toInt()

private fun readLong() = read().toLong()

private fun readDouble() = read().toDouble()

private fun readStringList() = read().split(" ")

private fun readIntList() = readStringList().map { it.toInt() }

private fun readLongList() = readStringList().map { it.toLong() }

private fun readDoubleList() = readStringList().map { it.toDouble() }

private fun readStringMatrix(n: Int): List<List<String>> {
    val matrix = mutableListOf<List<String>>()
    for (i in 0 until n) {
        val list = readStringList()
        matrix.add(list)
    }
    return matrix
}

private fun readIntMatrix(n: Int): List<List<Int>> {
    val matrix = mutableListOf<List<Int>>()
    for (i in 0 until n) {
        val list = readIntList()
        matrix.add(list)
    }
    return matrix
}

private fun readDoubleMatrix(n: Int): List<List<Double>> {
    val matrix = mutableListOf<List<Double>>()
    for (i in 0 until n) {
        val list = readDoubleList()
        matrix.add(list)
    }
    return matrix
}

private fun readLongMatrix(n: Int): List<List<Long>> {
    val matrix = mutableListOf<List<Long>>()
    for (i in 0 until n) {
        val list = readLongList()
        matrix.add(list)
    }
    return matrix
}



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

int main(){
    std::string s, t;
    std::cin >> s >> t;
    std::sort(s.begin(), s.end());
    std::sort(t.begin(), t.end(), std::greater<char>());
    if(s < t) std::cout << "Yes" << std::endl;
    else std::cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 256
x,y=gets.strip.split.map(&:to_i)
if(x+y)%3!=0
  p 0;exit
end

k=x-(x+y)/3
l=y-(x+y)/3

MOD = 10**9+7
 
def power(x, n)
  return 1 if n.zero?
 
  if n.even?
    return power(x*x, n/2) % MOD
  else
    return x*power(x, n/2)**2 % MOD
  end
end

$fac = []
$fac[0] = $fac[1] = 1
2.upto(k+l) do |num|
  $fac[num] = num * $fac[num-1] % MOD
end

$ifac = []
$ifac[0] = $ifac[1] = 1
$ifac[k+l] = power($fac[k+l], (MOD-2)) % MOD
(k+l-1).downto(2) do |num|
  $ifac[num] = $ifac[num+1] * (num+1) % MOD
end

def comb(n,k)
  return 0 if n<k || n<0 || k<0
  $fac[n] * ($ifac[n-k] * $ifac[k] % MOD) % MOD
end

p comb(k+l,k)

Measured memory_bytes: 13636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x;
ll cz(ll a){
    if(a==0)return 2;
    else return cz(a-1)*2+2;
}
int main(){
    cin>>x;
    cout<<cz(x)<<endl;
    return 0;
}

Measured memory_bytes: 256
import unittest


class TestA(unittest.TestCase):
    def test_1(self):
        self.assertEqual(think(4, 2, 9), 8)

    def test_2(self):
        self.assertEqual(think(4, 2, 7), 7)

    def test_3(self):
        self.assertEqual(think(4, 2, 8), 8)


def solve():
    n, a, b = read_int(3)
    result = think(n, a, b)
    write(result)


def read():
    return read_int(3)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(n, a, b):
    return min(b, a * n)


def write(result):
    print(result)


if __name__ == '__main__':
    # unittest.main()
    solve()

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

int main() {
  int r,g,b;
  cin >> r >> g >> b;
  if ((g*10+b)%4 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}
  

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

int main() {
    int n;cin>>n;
    double ans=0;

    rep(i,n){
        double a;cin>>a;
        ans+=1/a;
    }

    ans=1/ans;

    cout<<setprecision(16)<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
    #include <stdio.h>
    #include <string>
    #include <math.h>
    #include<algorithm>
    #include <numeric>
    using namespace std;
     
    int main(){
      long long N;
      cin >> N;
      long long a[N+1];
      for(int i=1;i<=N;i++){
       cin >> a[i]; 
      }
      a[0]=0;
      sort(a,a+N+1);
      long long pos=1;
      long long ans=0;
      for(int i=1;i<=a[N];i++){
        long long subpos=pos;
       while(a[subpos]==i){
        subpos++;
       }
        if(subpos-pos>=i){
         ans+=subpos-pos-i; 
        }
        else{
         ans+=subpos-pos; 
        }
        pos=subpos;
      }
      cout << ans << endl;
          return 0;}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

int main(){
	std::string s; cin >> s;
	
	int c = 0;
	bool f = (s[0] != 'A');
	for(int i = 2; i < s.size() - 1; i++) {
		if('a' <= s[i] and s[i] <= 'z') continue;
		if(s[i] == 'C') c++;
	}
	f |= !('a' <= s[1] and s[1] <= 'z');
	f |= !('a' <= s.back() and s.back() <= 'z');
	
	if(f or c != 1) cout << "WA" << endl;
	else cout << "AC" << endl;
	return 0;
}


Measured memory_bytes: 256
s = input()
sa = [i for i in s]
r = 0
for i in range(2**(len(s)-1)):  # 状態数
    si = sa[0]
    for j in range(len(s) - 1):
        t = 2 ** j  # 2^jなので常に2の倍数、
        if i & t:  # どこのビットが1か判定できる 2進数のビット判定を10進数のままやってるイメージ
            si += '+'  # 1なら+を挿入
        si += sa[j+1]
    r += eval(si)  # evalは文の実行なので文字列を都合よく数字に解釈してくれる

print(r)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define INF 0x3f3f3f3f
using namespace std;
int a,b,c;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>a>>b>>c;
	if (c>a && c<b) cout<<"Yes";
	else if (c>b && c<a) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 896
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int N, a, b, f, vis[222]; string z; vector<int> G[222];
void rec(int pos, int c, int s) {
	if (pos == s && c) { f = 1; return; }
	if (c) vis[pos] = 1;
	for (auto &e : G[pos]) {
		if (!vis[e]) rec(e, c + 1, s);
	}
}
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a >> z >> b; a--; b--;
		if (z == "lock") G[b + 100].push_back(a);
		else G[a].push_back(b + 100);
	}
	for (int i = 0; i < 200; i++) {
		fill(vis, vis + 200, 0);
		rec(i, 0, i);
	}
	cout << f << endl;
	return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
long long positivef[4005];
long long negativef[4005];

long long quickpow(long long a,long long b) {
  long long res=1;
  while(b!=0) {
    if(b&1) {
      res=res*a;
    }
    a=a*a;
    b>>=1;
  }
  return res;
}

int main() {
  for(int i=1;i<=4000;i++) {
    positivef[i]=quickpow(i,5);
  }
  for(int i=-4000;i<=-1;i++) {
    negativef[-i]=quickpow(i,5);
    //cout<<negativef[-i]<<endl;
  }
  long long x;
  cin>>x;
  for(int i=-4000;i<=4000;i++) {
    for(int j=-4000;j<=4000;j++) {
      long long tr=0;
      if(i<0) {
        tr+=negativef[-i];
      }else {
        tr+=positivef[i];
      }
      if(j<0) {
        tr-=negativef[-j];
      }else {
        tr-=positivef[j];
      }
      if(tr==x) {
        cout<<i<<' '<<j<<endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3612
# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

from math import ceil

def solve():
    a, b, c, d = MI()

    aoki = ceil(a / d)
    taka = ceil(c / b)
    # print(taka, aoki)

    if taka > aoki:
        print('No')
    else:   # taka <= aoki
        print('Yes')



if __name__ == '__main__':
    solve()


Measured memory_bytes: 9200
def main():
    A, B, C, X, Y = map(int, input().split())

    judge = 0
    price = 0
#同じ枚数なのは何枚か数える
    same_num = X - Y
    if same_num < 0:
        judge = -1
        same_num = -same_num
    elif same_num > 0:
        judge = 1

    if 2*C > (A + B):
        price += (max(X,Y)-same_num)*(A + B)
    elif 2*C < (A + B):
        price += (max(X,Y)-same_num)*C*2
    elif 2*C == (A + B):
        price += (max(X,Y)-same_num)*C*2

    if judge == 1:
        if 2*C > A:
            price += A*same_num
        elif 2*C < A:
            price += 2*C*same_num
        elif 2*C == A:
            price += A*same_num

    elif judge == -1:
        if 2*C > B:
            price += B*same_num
        elif 2*C < B:
            price += 2*C*same_num
        elif 2*C == B:
            price += B*same_num
    return price

print(main())


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

const int MAX_V = 1e6;
//演算の内容
ll f(ll a, ll b){return a|b;}
//何で初期化するか
ll other = 0;

struct segment_tree{
    ll n, seg[2*MAX_V];
    //要素数N(0〜N-1)の初期化されたセグメント木を構築
    segment_tree(int N){
        n = 1;
        while(n < N) n *= 2;
        fill_n(seg, 2*n-1, other);
    }
    //i番目の要素をxに変更(0番目から数える)
    void update(int i, ll x){
        i += n-1;
        seg[i] = x;
        while(i > 0){
            i = (i-1)/2;
            seg[i] = f(seg[2*i+1], seg[2*i+2]);
        }
    }
    //query(a, b)で[a, b)における演算の結果を取得
    ll query(int a, int b, int i = 0, int l = 0, int r = -1){
        if(r < 0) r = n;
        if(a >= r || b <= l) return other;
        elif(a <= l && r <= b) return seg[i];
        else{
            ll vl = query(a, b, 2*i+1, l, (l+r)/2);
            ll vr = query(a, b, 2*i+2, (l+r)/2, r);
            return f(vl, vr);
        }
    }
};

int main(){
    map<char, int> mp;
    rep(i, 26){
        mp[alpha[i]] = i;
    }
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    segment_tree seg(N);
    rep(i, N){
        seg.update(i, 1<<(mp[S[i]]));
    }
    rep(i, Q){
        int x;
        cin >> x;
        if(x == 1){
            int i;
            char c;
            cin >> i >> c;
            i--;
            seg.update(i, 1<<mp[c]);
        }
        else{
            int l, r;
            cin >> l >> r;
            l--, r--;
            ll res = seg.query(l, r+1);
            cout << __builtin_popcount(res) << endl;
        }
    }
}

Measured memory_bytes: 11140
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define n_max 1000
#define bit_keta 50

int main(){
    int n;
    cin >>n;
    int k;
    cin >> k;
    llong A[n_max+3];
    REP(i,n){
        scanf("%lld",&A[i]);
    }
    llong ruiseki[n_max+3];
    ruiseki[0]=0;
    REP(i,n){
        ruiseki[i+1]=ruiseki[i] + A[i];
    }
    
    int nC2 = (n)*(n+1)/2;
    llong bubun[(n_max)*(n_max+1)/2 +5];
    int ind=0;
    REP(i,n){
        FOR(j,i,n){
            bubun[ind] = ruiseki[j+1] - ruiseki[i];
            ind += 1;
        }
    }
    
    llong ans=0;
    llong bit =1;
    REP(i,bit_keta){
        bit*=llong(2);
    } 
    int tmp_cnt;
    while(1){
        bit/=llong(2);
        if(bit==0) break;
        tmp_cnt=0;
        REP(i,nC2){
            if( (bit & bubun[i] )) tmp_cnt+=1;
            if(tmp_cnt >= k) break;
        }

        if(tmp_cnt >=k){
            ans+=bit;
            REP(i,nC2){

                if( (bit & bubun[i]) == 0){
                    bubun[i] = 0;
                }
            }


        }

    }
    cout << ans << endl;


}



Measured memory_bytes: 4224
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 100000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

ll gcd(ll x, ll y) {
  if(y==0) return x;
  else return gcd(y, x%y);
}

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
//提出するときC++に帰る
//--------------------------

int main() {

  string s;
  cin >> s;

  if(s=="ABC") cout << "ARC" << endl;
  else cout << "ABC" << endl;

  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector<long long> vll;
typedef vector<pair<int,int> > vii;
#define ll long long
#define pb push_back
#define mp  make_pair
#define ff first
#define ss second
#define pq priority_queue
#define sf1(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sf3(x,y,z) scanf("%d %d %d",&x,&y,&z)
ll inf = (1e9) + 7;


int main(){



	int n;
	cin >> n;
	int k;
	cin >> k;

	printf("%d\n",max(0,n*n - k));

	
}	

Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;
class Main{
    public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	while(true) {
	    int n = sc.nextInt();
	    if (n == 0) break;
	    int count = 0;
	    for(int i=n+1;i<=2*n;i++){
	        if (isPrime(i))
		    count++;
	    }
	    System.out.println(count);
	}
    }
    static boolean isPrime(int n){
	if(n==1 || n==2)return true;
	double pow =Math.pow(n,0.5)+1;
	for(int i = 2; i<pow; i++){
	    if(n % i == 0) return false;
	}
	return true;
    }
}

Measured memory_bytes: 20100
#include <bits/stdc++.h>
#define N 20
#define N2 65634
using namespace std;

int V, E;
int i, u, v, w;
int G[N][N];
int f[N2][N];
int in[N2], out[N][N2], ans;

void up(int &x, const int y) {x < y ? x = y : 0;}

int main(){
	scanf("%d%d", &V, &E);
	for(i = 0; i < E; ++i){
		scanf("%d%d%d", &u, &v, &w); --u; --v;
		G[u][v] = G[v][u] = w; ans += w;
	}
	for(i = 0; i < 1 << V; ++i)
		for(u = 0; u < V; ++u) if(i >> u & 1)
			for(v = u + 1; v < V; ++v) if(i >> v & 1)
				in[i] += G[u][v];
	for(i = 0; i < 1 << V; ++i)
		for(u = 0; u < V; ++u) if(!(i >> u & 1))
			for(v = 0; v < V; ++v) if(i >> v & 1)
				out[u][i] += G[u][v];
	memset(f, 128, sizeof f);
	f[1][0] = 0;
	for(i = 1; i < 1 << V; ++i)
		for(u = 0; u < V; ++u) if((i >> u & 1) && f[i][u] >= 0){
			for(v = 0; v < V; ++v) if(!(i >> v & 1) && G[u][v])
				up(f[i | 1 << v][v], f[i][u] + G[u][v]);
			v = ~(-1 << V | i);
			for(; v; v = v - 1 & ~i)
				up(f[i | v][u], f[i][u] + out[u][v] + in[v  ]);
		}
	printf("%d\n", ans -= f[(1 << V) - 1][V - 1]);
	return 0;
}


Measured memory_bytes: 9728