akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long K = sc.nextLong();
		long[] a = new long[100001];
		for(int i = 0; i < N; i++)
			a[sc.nextInt()] += sc.nextInt();
		long n = 0;
		for(int i = 1; i <= 100000; i++) {
			n += a[i];
			if(n >= K) {
				System.out.println(i);
				break;
			}
		}

	}

}

Measured memory_bytes: 84620
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by Santa.
 */
public class Main {

  static int N;
  static int K;
  static long Q;
  static int A;
  static long B;
  static long C;
  static double min = 9999999;
  static long ans = 0;




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

    double t = scanner.nextDouble();
    double x = scanner.nextDouble();
    
    System.out.println(t / x);
  }

}


Measured memory_bytes: 24532
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
typedef pair<int, int>P;


int main()
{
    string s;
    cin >> s;

    int k = s.size();

    int ans = 0;

    for (int i = 0; i < k/2; i++)
    {
        if (s[i] != s[k - i - 1])
        {
            ans++;
        }

    }


    cout << ans << endl;

    return 0;
    
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)

int A,B,V,W,T;

int main(){
	fast;
	
	cin>>A>>V>>B>>W>>T;
	
	int d = abs(A - B);
	
	int v2 = V - W;
	
	if (v2 <= 0){
		if (d == 0) cout<<"YES";
		else cout<<"NO";
		return 0;
	}
	
	int t = ceil((double)d / (double)v2);
	//cout<<t<<' ';
	if (T >= t) cout<<"YES";
	else cout<<"NO";
	
	
}



Measured memory_bytes: 3692
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200010


int main() {
	vector<int>a[20];
	int b[20];
	int n, k;
	int x, y, z;
	long long s, ans;
	bool v = true;
	ans = 0;
	scanf("%d %d %d", &n, &x, &y);
	z = x ^ y;
	k = 0;
	while (z > 0) {
		if (z % 2 == 1)k++;
		z /= 2;
	}
	if (k%2==0) {
		printf("NO\n");
		return 0;
	}
	z = x ^ y;
	f(i, 20) {
		b[i] = z % 2;
		z /= 2;
	}
	k = 0;
	a[0].push_back(0);
	f(i, 17) {
		if (k == 0 && b[i] == 0) {
			f(j, a[i].size()) {
				a[i + 1].push_back(a[i][j]);
			}
			f(j, a[i].size()) {
				a[i + 1].push_back(a[i][a[i].size() - j - 1] + (a[i].size()));
			}
		}
		else if (k == 0 && b[i] == 1) {
			k++;
			f(j, a[i].size()) {
				a[i + 1].push_back(a[i][j]);
			}
			f(j, a[i].size()) {
				a[i + 1].push_back(a[i][a[i].size() - j - 1] + (a[i].size()));
			}
		}
		else if (k % 2 == 1 && b[i] == 0) {
			f(j, a[i].size()) {
				if (j % 2 == 0) {
					a[i + 1].push_back(a[i][j]);
					a[i + 1].push_back(a[i][j]+a[i].size());
				}
				else {
					a[i + 1].push_back(a[i][j] + a[i].size());
					a[i + 1].push_back(a[i][j]);
				}
			}
		}
		else if (k % 2 == 1 && b[i] == 1) {
			k++;
			f(j, a[i].size()) {
				a[i + 1].push_back(a[i][j]);
			}
			f(j, a[i].size()) {
				a[i + 1].push_back(a[i][a[i].size() - j - 1] + (a[i].size()));
			}
		}
		else if (k % 2 == 0) {
			if (b[i] == 1)k++;
			f(j, a[i].size()/2) {
				if (j % 2 == 0) {
					a[i + 1].push_back(a[i][j]);
					a[i + 1].push_back(a[i][j] + a[i].size());
				}
				else {
					a[i + 1].push_back(a[i][j] + a[i].size());
					a[i + 1].push_back(a[i][j]);
				}
			}
			f(j, a[i].size()/2) {
				a[i + 1].push_back(a[i][(a[i].size() / 2)+j]);
			}
			f(j, a[i].size()/2) {
				a[i + 1].push_back(a[i][a[i].size() - j - 1] + (a[i].size()));
			}
		}
	}
	printf("YES\n");
	f(i, a[n].size()) {
		printf("%d", a[n][i]^x);
		if (i < (a[n].size() - 1))printf(" ");
		else printf("\n");
	}




	return 0;
}

Measured memory_bytes: 2232
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    lli n,p,a,ans;
    vector<lli> gvec,kvec;
    lli i,j;
    cin>>n>>p;
    rep(i,0,n){
        cin>>a;
        if(a%2==0){
            gvec.push_back(a);
        }
    }
    if(p==0){
        if(gvec.size()==n){
            ans=pow(2,n);
        }
        else{
            ans=pow(2,n-1);
        }
    }
    else{
        if(gvec.size()==n){
            ans=0;
        }
        else{
            ans=pow(2,n-1);
        }
    }
    cout<<ans<<endl;
}


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

int main(){
  ll x;
  cin >>x;
  int ans = 0;
  ll yokin = 100;
  while(yokin<x){
    ans++;
    yokin += 0.01*yokin;
  }
  cout << ans << endl;
}


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

using namespace std;

int main() {

vector<int> vs(3);
for(int i=0; i<3; i++) cin >> vs[i];

sort(vs.begin(), vs.end());

cout << (vs[0] + vs[1] == vs[2] ? "Yes" : "No") << endl;

return 0;
}

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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		long long n, k;
		cin >> n >> k;
		vector<long long> a(n), b(n);
		for(int i=0; i<n; i++)cin >> a[i];
		for(int i=0; i<n; i++)cin >> b[i];
		sort(a.begin(), a.end());
		sort(b.begin(), b.end(), greater<long long>());
		long long ok = 1LL << 40, ng = -1;
		while(abs(ok-ng)>1){
			long long mid = (ok+ng)/2;
			bool flag = false;
			long long s = 0;
			for(int i=0; i < n; i++)s += max(a[i] - mid/b[i], 0LL);
			if(s <= k)flag = true;
			if(flag)ok=mid;
			else ng=mid;
		}
		cout << ok << endl;
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

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

int main(){
 string N;
  char a;
  int b;
  int e;
  e=0;
  cin>>N;
  a=N[0];
  for(int i=1;i<N.size();i++){
    if(N[i]=='9'){
      e+=9;
      if(i==N.size()-1){
        e+=N[0]-'0';
        cout<<e<<endl;
        return 0;
      }
      continue;
    }
    else{
      break;
    }
  }
  e=0;
  if(N.size()==1){
    cout<<N<<endl;
    return 0;
  }
  else{
  if(a!='1'){
    a=N[0];
    a=a-1;
    N[0]=a;
    for(int i=1;i<N.size();i++){
      N[i]='9';
    }
  }
  else{
    string c;
    c='9';
    for(int i=1;i<N.size()-1;i++){
      c=c+'9';
    }
    N=c;
  }
  }
      for(int i=0;i<N.size();i++){
      e+=N[i]-'0';
    }
  cout<<e<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
int main(){
    int nc;
    int student[31]={0};
    for(int i=0;i<28;i++){
        scanf("%d",&nc);
        student[nc]=1;
    }
    for(int i=1;i<31;i++){
        if(student[i]==0)
            printf("%d\n",i);
    }
    return 0;
}

Measured memory_bytes: 1188
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

int main(){
  LL N,M,i,ans=0;
  scanf("%lld%lld",&N,&M);
  LL s[M],c[M],k[N+1];
  FOR(i,0,M)scanf("%lld%lld",&s[i],&c[i]);
  FOR(i,1,N+1)k[i]=-1;
  if(N==1&&M==0){
    printf("0");
    return 0;
  }
  FOR(i,0,M){
    if(k[s[i]]!=-1&&k[s[i]]!=c[i]){
      printf("-1");
      return 0;
    }
    else k[s[i]]=c[i];
  }
  if(k[1]==0){
    if(N==1){
      printf("0");
      return 0;
    }
    printf("-1");
    return 0;
  }
  FOR(i,1,N+1){
    if(k[i]==-1&&i==1)k[i]=1;
    else if(k[i]==-1)k[i]=0;
    printf("%lld",k[i]);
  }

  //printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  std::string N;
  i64 K;
  std::cin >> N >> K;

  const i64 STRICT = 0;
  const i64 LOOSE = 1;
  std::vector<std::array<i64, 2>> dp(K + 1, std::array<i64, 2>({0, 0}));
  dp[1][STRICT] = 1;
  dp[1][LOOSE] = (N[0] - '0') - 1;

  for (i64 i = 1; i < static_cast<i64>(N.size()); ++i) {
    const i64 N_i = N[i] - '0';
    std::vector<std::array<i64, 2>> new_dp(K + 1, std::array<i64, 2>({0, 0}));
    new_dp[1][LOOSE] = 9;
    for (i64 j = 0; j <= K; ++j) {
      new_dp[j][STRICT] += dp[j][STRICT] * (N_i == 0 ? 1 : 0);
      new_dp[j][LOOSE] += dp[j][STRICT] * (N_i == 0 ? 0 : 1) + dp[j][LOOSE];
      if (j + 1 <= K) {
        new_dp[j + 1][STRICT] += dp[j][STRICT] * (N_i == 0 ? 0 : 1);
        new_dp[j + 1][LOOSE] += dp[j][STRICT] * (N_i == 0 ? 0 : N_i - 1) + dp[j][LOOSE] * 9;
      }
    }
    dp.swap(new_dp);
  }

  std::cout << dp[K][STRICT] + dp[K][LOOSE] << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,m,e,j,i;
	while(1){
		scanf("%d",&n);
		if(n==0){
			break;
		}
		for(i=0;i<n;i++){
			scanf("%d%d%d",&m,&e,&j);
			if(m==100||e==100||j==100||(m+e)/2>=90||(m+e+j)/3>=80){
				printf("A\n");
			}
			else if((m+e+j)/3>=70||(m+e+j)/3>=50&&m>=80||(m+e+j)/3>=50&&e>=80){
				printf("B\n");
			}
			else{
				printf("C\n");
			}
		}
	}
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=LONG_LONG_MAX;
const ll ms=(2e5)+5;

ll ar[ms];
ll br[ms]={0};
ll cr[ms]={0};

bool comp(ll x,ll y)
{
    return abs(x)<abs(y);
}


ll help(ll ar[ms],int k,int n)
{
    ll ans=1;
    ll e;
    while(k--)
    {
        e=(ar[n]+modo)%modo;
        ans=(e*ans)%modo;
        n--;
    }
    return ans;
}

int main()
{
    idfc;
    int n,k;
    cin>>n>>k;
    int i,j;
    for(i=1;i<=n;i++)cin>>ar[i];

    sort(ar+1,ar+n+1,comp);


    ll ans=help(ar,k,n);

    j=n;
    i=k;
    int tot=0;
    int z=0;
    int x=0;
    int y=0;
    while(i--)
    {
        if(ar[j]==0)z=1;
        else if(ar[j]<0)tot++;
        j--;
    }
    tot%=2;
    if(z||(!tot)){cout<<ans;return 0;}

    int a=-1;
    int b=-1;
    i=j;
    //cout<<"Sdsd"<<endl;

    while(i>=1)
    {
        if(ar[i]>=0)
        {
            a=i;break;
        }
        i--;
    }
    i=j+1;
    while(i<=n)
    {
        if(0>ar[i])
        {
            b=i;
            break;
        }
        i++;
    }
    ll x1;
    ll x2;
    ll y1;
    ll y2;
    if(a!=-1&&b!=-1)
    {
        x=1;
        x1=ar[a];
        x2=ar[b];
        for(i=1;i<=n;i++)br[i]=ar[i];
        swap(br[a],br[b]);
    }

    a=-1;
    b=-1;
    i=j;

    while(i>=1)
    {
        if(0>=ar[i])
        {
            a=i;
            break;
        }
        i--;
    }

    i=j+1;

    while(i<=n)
    {
        if(ar[i]>0)
        {
            b=i;
            break;
        }
        i++;
    }

    if(a!=-1&&b!=-1)
    {
        y=1;
        y1=ar[a];
        y2=ar[b];
        for(i=1;i<=n;i++)cr[i]=ar[i];
        swap(cr[a],cr[b]);
    }
    ll d;
    if(x&&y)
    {
        d=(x1*y2)-(y1*x2);
        if(d>=0)
        {
            ans=help(br,k,n);
        }
        else ans=help(cr,k,n);
    }
    else if(x)
    {
        ans=help(br,k,n);
    }
    else if(y)
    {
        ans=help(cr,k,n);
    }
    else{
        sort(ar+1,ar+n+1);
        ans=help(ar,k,n);
    }
    cout<<ans;



    return 0;
}

Measured memory_bytes: 8232
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

int main(){
	char S[101];
	while(cin>>S){
		for(int i=0;S[i]!='\0';i++){
			if(S[i]=='@'){
				for(int j=0;j<S[i+1]-'0';j++){
					printf("%c",S[i+2]);
				}
				i+=2;
			}
			else printf("%c",S[i]);
		}puts("");
	}
	return 0;
}

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

using ll = long long;
const ll MOD = 998244353;

int main() {
    ll N, K, ans;
    cin >> N >> K;
    if (K % 2) {
        ll q = N / K;
        ans = q * q * q;
    } else {
        ll q = N * 2 / K;
        ll r = (q + 1) / 2;
        ll s = q / 2;
        ans = r * r * r + s * s * s;
    }
    cout << ans << endl;
}
/*
a+b=dK
b+c=eK
c+a=fK
2(a+b+c)=(d+e+f)K
K=2xのときa+b+cはxの倍数だからa,b,cもxの倍数
a/x, b/x, c/xはすべて偶数かすべて奇数
Kが奇数のときa+b+cはKの倍数だからa,b,cもKの倍数
*/

Measured memory_bytes: 256
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N = int(input())
red = [list(map(int,input().split())) for i in range(N)]
blue = [list(map(int,input().split())) for i in range(N)]
red.sort()
blue.sort()

ans = 0
for c,d in blue:
    x = []
    for a,b in red:
        if a < c and b < d:
            x.append([a,b])
    if len(x) > 0:
        ans += 1
        x = sorted(x, key=lambda x:x[1])
        red.remove(x[-1])

print(ans)


Measured memory_bytes: 21492
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <string>

using namespace std;


int main() {
	string S;
	cin >> S;
	int N = S.length();
	int temp = 0;
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		if(S[i] == 'W'){
			ans = ans + (i - temp);
			temp++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 640
//writer：Sakura
//problem：Antennas on Tree
//id：Petrozavodsk Contest 001--E
//from：AtCoder

#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <bits/stdc++.h>
#define inf 1000000007
#define N 100005
using namespace std;

typedef long long ll;

vector<ll> vec[N];
ll f[N][2];

void init(){
	for(int i=0;i<N;i++)f[1][0]=inf,f[i][1]=inf;
}

void dfs(ll now,ll par){
	ll t=0,nod=0,tmp=0;
	for(int i=0;i<vec[now].size();i++){
		if(vec[now][i]!=par){
			dfs(vec[now][i],now);
			t+=f[vec[now][i]][1];
			tmp++;
			nod=max(nod,f[vec[now][i]][1]-f[vec[now][i]][0]);
		}
	}
	f[now][0]=t-nod;
	if(tmp>=2)f[now][1]=f[now][0];
	else{
		if(tmp==0)f[now][1]=1;
		else f[now][1]=t;
	}
}


int main(){
	//freopen("anrennas.in","r",stdin);
	//freopen("anrennas.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		vec[a].push_back(b);
		vec[b].push_back(a);
	}
	init();
	ll id=0,ma=0;
	for(int i=0;i<n;i++){
		if(ma<vec[i].size()){
			ma=vec[i].size();
			id=i;
		}
	}
	dfs(id,-1);
	ll ans=1;
	ans=max(ans,f[id][0]);
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 14976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
    {
        cout << "a > b" << endl;
    }
    else if (a < b)
    {
        cout << "a < b" << endl;
    }
    else
    {
        cout << "a == b" << endl;
    }
}



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

int main() {
    ios::sync_with_stdio(false);
    cout.precision(10);
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    int bw = -1, bs = -1;
    for(int x = 0; x <= 30; x++) {
        if(x * 100 * a > f) break;
        for(int y = 0; y <= 30; y++) {
            int water = x * 100 * a + y * 100 * b;
            if(water == 0) continue;
            if(water > f) break;
            for(int k = 0; k <= 3000; k++) {
                for(int l = 0; l <= 3000; l++) {
                    int sugar = k * c + l * d;
                    int total = water + sugar;
                    if(total > f) {
                        continue;
                    }
                    if(100 * sugar > e * water) {
                        continue;
                    }
                    if(bw == -1 || 100 * bs * (water + sugar) < 100 * sugar * (bs + bw)) {
                        bw = water;
                        bs = sugar;
                    }
                }
            }
        }
    }
    cout << bw + bs << " " << bs << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    cout << fixed << setprecision(8);
    double L; cin >> L;
    cout << pow(L / 3.0, 3.0) << endl;
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define N 2000001
#define NIL -1000

int n;
int a[N];

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

void heapIncreaseKey(int i, int key){
  int tmp;
  if(key < a[i]){
    return;
  }
  a[i] = key;
  while(i > 1 && a[parent(i)] < a[i]){
    tmp = a[i];
    a[i] = a[parent(i)];
    a[parent(i)] = tmp;
    i = parent(i);
  }
}

void maxHeapInsert(int key){
    n = n + 1;
    a[n] = NIL;
    heapIncreaseKey(n, key);
}


void maxHeapify(int i){
  int largest=0,tmp;
  int l,r;
  l = left(i);
  r = right(i);
  if(l <= n && a[l] > a[i]){
    largest = l;
  }
  else
    largest = i;
  if(r <= n && a[r] > a[largest]){
    largest = r;
  }
  if(largest != i){
    tmp = a[i];
    a[i] = a[largest];
    a[largest] = tmp;
    maxHeapify(largest);
  }
}


int heapExtractMax(){
  int max;
  if(n < 1){
    return 0;
  }
  max = a[1];
  a[1] = a[n];
  n = n-1;
  maxHeapify(1);
  return max;
} 

main(){
  int k;
  char b[12];
  while(1){
    scanf("%s",b);
    if(b[0] == 'i'){
      scanf("%d",&k);
      maxHeapInsert(k);
    }
    else if(b[0] == 'e' && strcmp(b,"extract") == 0){
      printf("%d\n",heapExtractMax());
     }
    else
      break;
       }
  return 0;
}

Measured memory_bytes: 4696
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <bitset>
#include <math.h>
#include <iomanip>
#include <queue>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
using namespace std;

typedef long long int ll;
#define MOD 1000000007
#define INF 1000000001

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

bool bfs(vector<vector<int>> g, vector<int> &dist, int sv)
{
	queue<int> q;
	q.push(sv);
	dist[sv]=0;
	while(!q.empty()){
		int now = q.front(); q.pop();
		for(auto v : g[now]){
			if(dist[v]!=-1) continue;
			dist[v] = dist[now]+1;
			q.push(v);
		}
	}
}

int main(void) {
	string s,t; cin >> s >> t;
	vector<vector<int>> dp(s.length()+1,vector<int>(t.length()+1,0));
	rep2(i,1,s.length()+1)rep2(j,1,t.length()+1){
		if(s[i-1]==t[j-1]) dp[i][j] = dp[i-1][j-1] + 1;
		else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
	}
	
 	string ans;
	int i=s.length();
	int j=t.length();
	while( dp[i][j]!=0 ){
		if(dp[i-1][j]==dp[i][j-1]&&dp[i][j-1]==dp[i-1][j-1] && dp[i-1][j-1]+1==dp[i][j]){
			ans+=s[i-1];
			i--;j--;
		}else if(dp[i-1][j]==dp[i-1][j-1] && dp[i-1][j]!=dp[i][j-1])j--;
		else i--;
	}
	reverse(ans.begin(),ans.end());
	out(ans);
}




Measured memory_bytes: 35584
n = int(input())
h = list(map(int, input().split()))

result = 0
tmp = 0
for i in range(n - 1):
    if h[i] >= h[i+1]:
        tmp += 1
    else:
        if tmp > result:
            result = tmp
        tmp = 0

if tmp > result:
    result = tmp

print(result)

Measured memory_bytes: 63984
#include <bits/stdc++.h>
using namespace std;
int n;
long long l[100];
int main() {
    cin >> n;
    l[0] = 2;
    l[1] = 1;
    for (int i = 2; i <= n; i++) {
        l[i] = l[i - 1] + l[i - 2];
    }
    cout << l[n];
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <string.h>
#include<math.h>
using namespace std;
long long N,A,B;
int main()
{
    cin>>N>>A>>B;
    if(N<1||(N==1&&A!=B)||(A>B)){
        cout<<0<<endl;
    }
    else{
        cout<<((N-2)*B-(N-2)*A+1)<<endl;
    }
    return 0;
}


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

int rr[6] = {100, 101, 102, 103, 104, 105};

int main(){
  int x;
  cin>>x;
  
  int r = x % 100;

  int cnt = 0;
  while(r != 0){
    if(r - 5 < 0)break;
    else {r -= 5; cnt++;}    
  }
  if(r != 0)cnt++;
  x -= cnt * 100;
  if(x < 0){
    cout<<0<<endl;
    return 0;
  }
  else{
    cout<<1<<endl;
    return 0;
  } 
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

struct Node{
	int key;
	struct Node *right, *left,*parent;
};

struct Node *root,*NIL;

struct Node *treeMinimum(struct Node *x){
	while(x->left!=NIL){
		x=x->left;
	}
	return x;
}

struct Node *find(struct Node *u,int k){
	while(u!=NIL && k!=u->key){
		if(k<u->key){
			u=u->left;
		}else {
			u=u->right;
		}
	}
	return u;
}

struct Node *treeSuccessor(struct Node *x){
	if(x->right!=NIL){
		return treeMinimum(x->right);
	}
	struct Node *y=x->parent;
	
	while(y!=NIL && x==y->right){
		x=y;
		y=y->parent;
	}
	return y;
}

void treeDelete(struct Node *z){
	struct Node *y;
	struct Node *x;
	if(z->left== NIL || z->right==NIL){
		y=z;
	}else {
		y=treeSuccessor(z);
	}
	
	if(y->left!=NIL){
		x=y->left;
	}else{
		x=y->right;
	}
	
	if(x!=NIL){
		x->parent=y->parent;
	}
	
	if(y->parent==NIL){
		root=x;
	}else{
		if(y==y->parent->left){
			y->parent->left=x;
		}else{
			y->parent->right=x;
		}
	}
	if(y!=z){
		z->key=y->key;
	}
	free(y);
}

void insert(int k){
	struct Node *y = NIL;
	struct Node *x = root;
	struct Node *z;
	
	z = (struct Node *)malloc(sizeof(struct Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	
	while( x != NIL){
		y = x;
		if(z->key < x->key){
			x = x->left;
		}else{
			x = x->right;
		}
	}
	z->parent = y;
	if(y == NIL){
		root = z;
	}else{
		if(z->key < y->key){
			y->left = z;
		}else{
			y->right = z;
		}
	}
}

void inorder(struct Node *u){
	if( u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}

void preorder(struct Node *u){
	if( u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main(void){
	int n,i,x;
	scanf("%d",&n);
	int d;
	char string[10];
	
	for(i=0;i<n;i++){
		scanf("%s %d",string,&d);
		if(string[0]=='i'){
			insert(d);
		}else if(string[0]=='p'){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}else if(string[0]=='f'){
			struct Node *t=find(root,d);
			if(t!=NIL){
				printf("yes\n");
			} else{
				printf("no\n");
			}
		}else if(string[0]=='d'){
			treeDelete(find(root,d));
		}
	}
	return 0;
}



Measured memory_bytes: 20444
# -*- coding: utf-8 -*-
import sys
from operator import itemgetter
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy
from collections import Counter, deque
import heapq
from functools import reduce
# local only
# if not __debug__:
#     fin = open('in_1.txt', 'r')
#     sys.stdin = fin
# local only
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template




def main():
    """
    6 7
6 8
6 9
6 10
6 13
6 14
6 15
6 19
6 20
6 25
    """
    A, B = mi()
    if B > (A - 1) ** 2:
        print(-1)
        sys.exit()
    if B % (A - 1) == 0:
        print(A * ceil(B / A))
    else:
        a = B // (A - 1)
        b = B % (A - 1)
        if a < b:
            print(A * ceil(B / A))
        else:
            print(-1)
    # dp1 = [float('inf')] * 100
    # dp2 = [float('inf')] * 100
    # dp1[0] = dp2[0] = 0
    # for i in range(1, 100):
    #     dp1[i] = min(dp1[i], dp1[i - 1] + 1)
    #     if i >= A:
    #         dp1[i] = min(dp1[i], dp1[i - A] + 1)
    #     if i >= B:
    #         dp1[i] = min(dp1[i], dp1[i - B] + 1)
    # for i in range(1, 100):
    #     if i >= B:
    #         dp2[i] = dp2[i - B] + 1
    #     elif i >= A:
    #         dp2[i] = dp2[i - A] + 1
    #     else:
    #         dp2[i] = dp2[i - 1] + 1
    # for i in range(100):
    #     if dp1[i] != dp2[i]:
    #         print(A, B)
    #         break
    # for i in range(100):
    #     if dp1[i] != dp2[i]:
    #         debug(i, dp1[i], dp2[i], "?")

if __name__ == '__main__':
    main()



Measured memory_bytes: 6904
#include <stdio.h>
int N, C;
int s[100000], t[100000], c[100000];
int sm[200002];
int tt[200002];
int main() {
  scanf("%d%d", &N, &C);
  for (int i = 0; i < N; i++)
    scanf("%d%d%d ", &s[i], &t[i], &c[i]);
  for (int i = 1; i <= C; i++) {
    for (int j = 0; j < 200002; j++)
      tt[j] = 0;
    for (int j = 0; j < N; j++)
      if (c[j] == i)
        tt[s[j] * 2 - 1]++, tt[t[j] * 2]--;
    for (int j = 1; j < 200002; j++)
      tt[j] += tt[j - 1];
    for (int j = 0; j < 200002; j++)
      if (tt[j] > 0)
        sm[j]++;
  }
  int mx = 0;
  for (int j = 0; j < 200002; j++)
    if (mx < sm[j])
      mx = sm[j];
  printf("%d\n ", mx);
}


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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    vector<int> A(N,0);
    vector<int> pq(N+1);
    for(int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    int ans = 0;
    for(int i = 0; i < N; i++) {
        pq.at(A.at(i)) = 1 + pq.at(A.at(i) - 1);
        ans = max(pq.at(A.at(i)),ans);
    }
    cout << N - ans << endl;
    

    return 0;
}

Measured memory_bytes: 4796
# -*- coding: utf-8 -*-
import sys
from collections import deque,defaultdict
sys.setrecursionlimit(10**5)

H,W,K=map(int, sys.stdin.readline().split())
ichigo=[]
cnt=0
h_visit=[0 for h in range(H)]  #縦軸にイチゴがない箇所は0、ある箇所は1

L=[ [] for h in range(H) ]
for h in range(H):
    s=sys.stdin.readline().strip()
    for w,x in enumerate(s):
        if x==".":
            L[h].append(0)
        elif x=="#":
            cnt+=1
            L[h].append(cnt)
            ichigo.append((h,w))
            h_visit[h]=1


D=(1,-1)

def yoko_dfs(h,w):  #縦座標、横座標
    for dw in D:
        if 0<=w+dw<=W-1 and L[h][w+dw]==0:
            L[h][w+dw]=L[h][w]
            yoko_dfs(h,w+dw)
    return

for h,w in ichigo:
    yoko_dfs(h,w)


def tate_dfs(h):  #縦座標
    for dh in D:
        if 0<=h+dh<=H-1:
            if h_visit[h+dh]==1: continue
            h_visit[h+dh]=1 #訪問済みにする
            L[h+dh]=L[h]
            tate_dfs(h+dh)

for h,w in ichigo:
    tate_dfs(h)

for l in L:
    for x in l:
        print x,
    print

Measured memory_bytes: 47132
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<cstring>
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < (n);++i)
#define reps(i,n) for(int i = 1;i <= (n);++i)
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k,x;
	cin >> k >> x;
	for(int i = x - (k - 1);i <= x + (k - 1);i++){
		cout << ((i == x-(k-1)) ? "" : " " ) << i;
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <iostream>//for cin cout endl
#include <cstdlib>//for abs()
using namespace std;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int N;
long long a[100010][3];
long long dp[100010][3];
int main(){

    int N;cin>>N;
    for (int i =0 ; i<N;++i){
        for (int j=0;j<3;++j)cin>>a[i][j];
    };

    for (int i=0;i<100010;++i){
        for (int j=0;j<3;++j){
            chmax(dp[i+1][0],dp[i][1]+a[i][0]);
            chmax(dp[i+1][0],dp[i][2]+a[i][0]);
            chmax(dp[i+1][1],dp[i][0]+a[i][1]);
            chmax(dp[i+1][1],dp[i][2]+a[i][1]);
            chmax(dp[i+1][2],dp[i][0]+a[i][2]);
            chmax(dp[i+1][2],dp[i][1]+a[i][2]);
        }

    }
    long long res=0;
    for (int i=0;i<3;++i){chmax(res,dp[N][i]);};
    cout<<res<<endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#define REP(i, n) for(long long i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main() {
	while(1) {
		int n, m;
		cin>>n>>m;
		if(n==0&&m==0) break;
		vector<int> mini(n, 0);
		vector<int> maxi(n, 0);
		REP(i, m) {
			int s, k;
			cin>>s>>k;
			REP(j, k) {
				int c;
				cin>>c;
				--c;
				if(k == 1) mini[c] += s;
				maxi[c] += s;
			}
		}
		int res = 0;
		REP(i, n) {
			REP(j, n) {
				if(i == j) continue;
				res = max(res, maxi[i] - mini[j]);
			}
		}
		cout<<res + 1<<endl;
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(3e5) + 5;
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir = "RDLU";
#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 SORT(v) sort((v).begin(), (v), end())
#define SORTR(v) sort((v).rbegin(), (v), rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    while (1) {
        int n, m, d[105][105]{};
        vector<int> g[105];
        cin >> n >> m;
        if(n==0)break;
        REP(i, n) fill(d[i], d[i] + n, IINF / 2);
        REP(i,n) d[i][i] = 0;
        REP(i, m) {
            int a, b, c;
            cin >> a >> b >> c;
            a--;
            b--;
            d[a][b] = c;
            d[b][a] = c;
            g[a].push_back(b);
            g[b].push_back(a);
        }
        REP(k, n) REP(i, n) REP(j, n) {
            d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
        int ans = d[0][n-1];
        REP(k, n) REP(j, g[k].size()) REP(i, j) {
            ans = min(ans,d[0][g[k][i]]+d[g[k][j]][n-1]);
            ans = min(ans,d[0][g[k][j]]+d[g[k][i]][n-1]);
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3196
import java.io.*;
import java.math.*;
import java.util.*;

class Main {
    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int[] nt = Arrays.stream(sc.nextLine().split(" +")).mapToInt(Integer::parseInt).toArray();
        int n = nt[0];
        int t = nt[1];

        int c = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int[] ct = Arrays.stream(sc.nextLine().split(" +")).mapToInt(Integer::parseInt).toArray();
            if (ct[1] <= t && c > ct[0]) c = ct[0];
        }

        if (c == Integer.MAX_VALUE) {
            System.out.println("TLE");
        }
        else {
            System.out.println(c);
        }
        sc.close();
    }
}


Measured memory_bytes: 27220
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const [X, A]: number[] = input[0].split(' ').map((x: string): number => +x);

if(X < A){
    console.log(0);
}else{
    console.log(10);
}


Measured memory_bytes: 7500
#include <cstdio>

typedef long long int ll;

int n, x, y, flagX, flagY, curX,  curY;
ll k, positive, negative;

int main() {
    scanf("%lld%d%d", &k , &x, &y);
    flagX = (x < 0) ? -1 : 1;
    flagY = (y < 0) ? -1 : 1;
    x *= flagX;
    y *= flagY;
    if (k % 2 ==0 && (x + y) & 1)
        printf("-1");
    else {
        if (k == x + y)
            n = 1;
        else {
            n = 2;
            while (n * k < x + y || (n * k - x - y) & 1) {
                ++n;
            }
        }
        positive = (n * k + x + y) >> 1;
        negative = (n * k - x - y) >> 1;
        printf("%d\n", n);
        while(n --) {
            if (negative) {
                if (negative >= k) {
                    if (x - curX <= y - curY)
                        curX -= k;
                    else
                        curY -= k;
                    negative -= k;
                }
                else {
                    if (x - curX <= y - curY) {
                        curX -= negative;
                        curY += (k - negative);
                    }
                    else {
                        curY -= negative;
                        curX += (k - negative);
                    }
                    negative = 0;
                }
            }
            else {
                if (curX < x) {
                    if (x - curX >= k)
                        curX += k;
                    else {
                        curY += (k - (x - curX));
                        curX = x;
                    }
                }
                else {
                    if (y - curY * flagY >= k)
                        curY += k;
                    else
                        curY = y;
                }
            }
            printf("%d %d\n", curX * flagX, curY * flagY);
        }
    }
    return 0;
}

Measured memory_bytes: 2176
using System;
using System.Linq;
using System.Text;

namespace ALDS1_1_A {
    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            StringBuilder sb = new StringBuilder();
            sb.AppendLine(ArrToString(A));
            for(int i = 1; i < n; i++) {
                int v = A[i];
                int j = i - 1;
                while (j >= 0 && A[j] > v) {
                    A[j + 1] = A[j];
                    j--;
                }
                A[j + 1] = v;
                sb.AppendLine(ArrToString(A));
            }
            Console.Write(sb);
        }

        static string ArrToString(int[] arr) {
            string ret = arr[0].ToString();
            for(int i = 1; i < arr.Length; i++) {
                ret += " " + arr[i];
            }
            return ret;
        }
    }
}

Measured memory_bytes: 10172
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 5;
const ld pi = 3.141592653;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll INF = __LONG_LONG_MAX__;

using namespace std;

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

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int T = 1;
        //cin>>T;
        while(T--)
        {
                int n, i, j, k, ans=0;
                cin>>n;
                vector<int> l(n);
                for(i=0; i<n; i++) cin>>l[i];
                for(i=0; i<n; i++){
                        for(j=i+1; j<n; j++){
                                for(k=j+1; k<n; k++){
                                        if(l[i]!=l[j] && l[j]!=l[k] && l[k]!=l[i]){
                                                if(l[i]+l[j]>l[k] && l[k]+l[i]>l[j] && l[k]+l[j]>l[i]) ans++;
                                        }
                                }
                        }
                }
                cout<<ans;
        }
        return 0;
}

Measured memory_bytes: 3668
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<pair<int, int>> as(N);
  F0R(i, N) {
    cin >> as[i].first >> as[i].second;
  }
  sort(rng(as), [](const pair<int, int>& l, const pair<int, int>& r) {
    return l.second < r.second;
  });

  i64 time = 0;
  F0R(i, N) {
    time += as[i].first;
    if (time > as[i].second) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
#endif


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

int n;
struct node
{
	int h,p,val;
	bool operator <(const node &a) const
	{
		return val < a.val;
	}
}a[5005];
long long dp[5005];

int main()
{
	scanf("%d",&n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d",&a[i].h,&a[i].p);
		a[i].val = a[i].h + a[i].p;
	}
	sort(a + 1,a + n + 1);
	dp[0] = 0;
	for (int i = 1; i <= n; i++)
	{
		dp[i] = 0x7fffffffffffffff;
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = i; j >= 1; j--)
		{
			if (dp[j - 1] <= a[i].h) dp[j] = min(dp[j],dp[j - 1] + a[i].p);
		}
	}
	int ans = -1;
	for (int i = 0; i <= n; i++)
	{
		if (dp[i] < 0x7fffffffffffffff) ans = i;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 3932
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

class city {
 public:
  int p;
  int y;
  int x;
};

int main() {
  vector<city> v;
  vector<int> xs;
  vector<city *> city_i;
  int n, m;

  cin >> n >> m;

  v.resize(m);

  for (int i = 0; i < m; i++) {
    cin >> v[i].p >> v[i].y;
    city_i.push_back(&v[i]);
  }

  sort(city_i.begin(), city_i.end(),
   [](const city *a, const city *b) { return a->y < b->y; });

  for (int i = 0; i < n; i++) xs.push_back(1);

  for (int i = 0; i < m; i++) {
    city_i[i]->x = xs[city_i[i]->p - 1];
    xs[city_i[i]->p - 1] += 1;
  }

  for (int i = 0; i < m; i++) {
    printf("%06d%06d\n", v[i].p, v[i].x);
  }

  return 0;
}


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

int main(){
    string S;cin>>S;
    if(S.at(0)!='A'){
        cout<<"WA"<<endl;
        return 0;
    }int count=0;int code;
    for(int i=1;i<S.size();i++){
        code=(int)S.at(i);
        if(code>=97){
            //cout<<code<<endl;
        }else if(i>1&&i<S.size()-1&&S.at(i)=='C'){
            count++;
        }else{
            cout<<"WA"<<endl;
            return 0;
        }
    }if(count!=1){
        cout<<"WA"<<endl;
        return 0;
    }cout<<"AC"<<endl;
}


Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
#define int long long
 
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF (LLONG_MAX - 1e5)
 
using namespace std;
 
int N, A[200005];
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    cin >> N;
    REP(i, N) {
        cin >> A[i];
        A[i] -= i + 1;
    }
    sort(A, A + N);
 
    int b = A[N / 2];
 
    int ans = 0;
    REP(i, N) { ans += abs(A[i] - b); }
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
using namespace std;
int x[100008];
int y[100008];
int z[100008];
int z2[100008];
pair<int,int> f[100008];

int main(){

int a,b,c;
int r=0,g=0;
for(int i=0;i<3;i++)
{
	int t;
	cin>>t;
	if(t==5)r++;
	if(t==7)g++;
}
if(r==2&&g==1)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
	return 0;
}



Measured memory_bytes: 256
# coding:UTF-8

# 入力値の受け取り
input_list = input().split()

num_A = int(input_list[0])
num_B = int(input_list[1])
num_T = int(input_list[2])

# 合計枚数の算出
output_answer = int((num_T + 0.5) // num_A * num_B)
print(output_answer)

Measured memory_bytes: 2940
n = int(input())
T, X, Y = [0], [0], [0]
for i in range(n):
    t, x, y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)
for i in range(n):
    d = abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])
    e = T[i + 1] - T[i]
    if d > e or (d + e) % 2 == 1:
        print('No')
        break
else:
    print('Yes')


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

typedef long long ll;


int main() {
    int N, K;
    cin >> N >> K;
    set<int>s;
    for (int i = 0; i < K; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++) {
            int A;
            cin >> A;
            s.insert(A);
        }
    }
    cout << N - s.size() << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
using namespace std;

int n;

int ans;

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

    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int x = i, dig = 0;
        while(x)
        {
            dig++;
            x /= 10;
        }
        if(dig & 1)
            ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define TRUE 1
#define FALSE 0

int solve(int,int);
int a[2000],s[2000];
int n,q;

int main(){
  int i,j;

  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++)scanf("%d",&s[i]);

  for(i=0;i<q;i++){
    if(solve(0,s[i]))printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m){
  if(m==0)return TRUE;
  if(i>=n)return FALSE;
  if(solve(i+1,m)||solve(i+1,m-a[i]))return TRUE;
}

Measured memory_bytes: 588
# coding=utf-8
line = input().split(" ")
n = int(line[0])
m = int(line[1])

if n==1:
    if m==1:
        print(1)
    elif m==2:
        print(0)
    else:
        print(m-2)
    exit()
if m==1:
    if n==1:
        print(1)
    elif n==2:
        print(0)
    else:
        print(n-2)
    exit()

print((n-2)*(m-2))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a[200007],b[200007];
bool cmp(int x,int y){
    return x>y;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    long long k;
    cin>>n>>k;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    for(int i=1;i<=n;++i)
        cin>>b[i];
    sort(a+1,a+1+n,cmp);
    sort(b+1,b+1+n);
    long long l=0,r=1e12;
    long long ans=-1;
    while(l<=r){
        long long mid=(l+r)>>1;
        long long tamp=0;
        for(int i=1;i<=n&&tamp<=k;++i)
            if(1ll*a[i]*b[i]>mid)
                tamp+=a[i]-mid/b[i];
        if(tamp<=k){
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

main(){
  int A, B;
  scanf("%d %d", &A, &B);
  int add, sub, mul;
  add = A + B;
  sub = A - B;
  mul = A * B;
  int max = add;
  if(sub > max) max = sub;
  if(mul > max) max = mul;
  printf("%d", max);
}

Measured memory_bytes: 128