akhauriyash/Code-Regression huggingface dataset:
coin = int(input())
fivet_yen = 0
five_yen = 0
if coin == 0:
    print(0)
else:
   while(coin > 0):
    if coin >= 500:
        coin = coin - 500
        fivet_yen = fivet_yen + 1000
    else:
        if coin >= 5:
            coin = coin - 5
            five_yen   = five_yen + 5
        else:  
            coin = coin - 1
   print(fivet_yen + five_yen)


       
    
       

Measured memory_bytes: 3060
inf=10**10
n,m=map(int,input().split())
x=[inf]*n
con=[[] for _ in range(n)]
for i in range(m):
	l,r,d=map(int,input().split())
	con[l-1].append((r-1,d))
	con[r-1].append((l-1,-d))
from collections import deque
for i in range(n):
	if x[i]==inf:
		x[i]=0
		q=deque([i])
		while q:
			e=q.pop()
			for j,k in con[e]:
				if x[j]==inf:
					q.append(j)
					x[j]=x[e]+k
				elif x[j]!=x[e]+k:
					print("No")
					exit()
print("Yes")

Measured memory_bytes: 66316
#include<stdio.h>
int N;
typedef struct{
  char m;
  int n;
  int o;
}Card;
Card c[100000];
 
int partition(int p, int r);
void quickSort(int p,int r);
 
int main(){
  int i,stable=1;
  char s[1];
 
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%s%d",s,&c[i].n);
    c[i].m=s[0];
    c[i].o=i;
  }
 
  quickSort(0,N-1);
 
  for(i=0;i<N;i++) 
      if(i>0 && c[i].n==c[i-1].n && c[i].o<c[i-1].o){
        printf("Not stable\n");
        break;
      }
      if(i==N)
      printf("Stable\n");
 
  for(i=0;i<N;i++)
    printf("%c %d\n",c[i].m,c[i].n);
  return 0;
}
int partition(int p, int r){
  int i,j;
  Card x,tmp;
  x = c[r];
  i = p-1;
  for (j =p;j<r;j++){
    if (c[j].n <= x.n){
      i = i+1;
      tmp=c[i];
      c[i]=c[j];
      c[j]=tmp;
    }
  }
 
  tmp=c[r];
  c[r]=c[i+1];
  c[i+1]=tmp;
 
  return i+1;
}
 
void quickSort(int p,int r){
  int q;
 
  if( p < r){
     q = partition(p, r);
     quickSort(p, q-1);
     quickSort( q+1, r);
  }
}


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

int n;
int square;
vector<int> juttu;
int main(){
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> square;
    juttu.push_back(square);
  }
  int maxi = 0;
  int pera = 0;
  for(int i = 1; i <= juttu.size()-1; i++){
    if(juttu[i] <= juttu[i-1]) pera++;
    else{
      maxi = max(pera,maxi);
      pera = 0;
    }
  }
  maxi = max(pera,maxi);
  cout << maxi << "\n";
}


Measured memory_bytes: 892
#include <stdio.h>
#include <math.h>

int po10(int x){
	return (int)pow(10,x);
}

int main(void){
	int N,M;
  	scanf("%d %d",&N,&M);
  	int s[M],c[M],re[N],flg[N];
  	for(int i=0;i<N;i++){
  		re[i]=0;
    	flg[i]=0;
  	}
  	for(int i=0;i<M;i++){
  		scanf("%d %d",&s[i],&c[i]);
  		if(flg[s[i]-1]==0){
    		re[s[i]-1]=c[i];
    		flg[s[i]-1]=1;
    	}else if(re[s[i]-1]!=c[i]){
      		printf("-1");
        	return 0;
    	}
  	}
  	if(re[0]==0&&N>1){
      	if(flg[0]==1){
      		printf("-1");
      		return 0;
    	}else{
        	re[0]=1;
        }
    }
  	int result=0;
  	for(int i=0;i<N;i++){
  		result+=re[N-i-1]*po10(i);
  	}
    printf("%d",result);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int max3(int a, int b, int c){
    if(a>=b && a>=c) return a;
    if(b>=c && b>=a) return b;
    if(c>=b && c>=a) return c;
}

int main(){
    int x,y,a,b,c; cin >> x >> y >> a >> b >> c;
    vector<ll> p(a),q(b),r(c);
    ll redsum=0; ll greensum=0;
    rep(i,a) cin >> p[i];
    rep(i,b) cin >> q[i];
    rep(i,c) cin >> r[i];
    sort(all(p));
    reverse(all(p));
    sort(all(q));
    reverse(all(q));
    vector<ll> red(x),green(y);
    rep(i,x) red[i]=p[i];
    rep(j,y) green[j]=q[j];
    red.insert(red.end(),all(green));
    red.insert(red.end(),all(r));
    sort(all(red));
    reverse(all(red));

    ll ans=0;
    rep(i,x+y) ans+=red[i];

    cout << ans << endl;
    
return 0;
}


Measured memory_bytes: 7104
N = int(input())
H = list(map(int,input().split()))
count=0

for i in range(N):
    while H[i] != 0:
        for j in range(i,N):
            if H[j] == 0:
                break
            else:
                H[j] -= 1
        count += 1
    
print(count)

Measured memory_bytes: 3060
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader in = new FastReader(System.in);
        StringBuilder sb = new StringBuilder();
        DecimalFormat df=new DecimalFormat("0.0000");
        double r=in.nextInt();
        double ans=2*r*Math.PI;
        System.out.println(df.format(ans));
    }
}
class FastReader {

    byte[] buf = new byte[2048];
    int index, total;
    InputStream in;

    FastReader(InputStream is) {
        in = is;
    }

    int scan() throws IOException {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0) {
                return -1;
            }
        }
        return buf[index++];
    }

    String next() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }
    String nextLine() throws IOException {
        int c;
        for (c = scan(); c <= 32; c = scan());
        StringBuilder sb = new StringBuilder();
        for (; c !=10 && c!=13; c = scan()) {
            sb.append((char) c);
        }
        return sb.toString();
    }
    char nextChar() throws IOException{
        int c;
        for (c = scan(); c <= 32; c = scan());
        return (char)c;
    }

    int nextInt() throws IOException {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }

    long nextLong() throws IOException {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan());
        boolean neg = c == '-';
        if (c == '-' || c == '+') {
            c = scan();
        }
        for (; c >= '0' && c <= '9'; c = scan()) {
            val = (val << 3) + (val << 1) + (c & 15);
        }
        return neg ? -val : val;
    }
}


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

const split = (str: string): string[] =>
  str.split(" ").map((v: string) => v.trim());
const split_number = (str: string): number[] =>
  split(str).map((v: string) => +v);

export function main(input: string) {
  const lines = input.split("\n");
  const n = lines[0].split('');

  let check = "";
  for (let i = 0; i < n.length; i++) {
    if (i > 0 && n[i] !== check) {
      return "Yes";
    } else {
      check = n[i];
    }
  }

  return "No";
}

if (!process.env.LOCAL_DEBUG) {
  console.log(main(fs.readFileSync("/dev/stdin", "utf8")));
}


Measured memory_bytes: 7372
#include <stdio.h>

#define MAX 26

int main(void)
{
	char c;
	int i, sum;
	int cnt[MAX] = {0};

	while (1) {
		sum = 0;
		while ((c = getchar()) != '\n') {
			sum += (c-'0');
		}
		if (sum == 0) {
			break;
		}
		else {
			printf("%d\n",sum);
		}
	}
	return 0;
}




Measured memory_bytes: 2684
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

string nums[10] = {
	"0111111",
	"0000110",
	"1011011",
	"1001111",
	"1100110",
	"1101101",
	"1111101",
	"0100111",
	"1111111",
	"1101111"
};

int main(){
	int n;
	while(cin >> n && n >= 0){
		string s = "0000000";
		int num;
		for(int i = 0; i < n; i++){
			cin >> num;
			string s2;
			string next = nums[num];
			for(int j = 0; j < 7; j++){
				if(next[j] == s[j]){
					s2.push_back('0');
				}else{
					s2.push_back('1');
				}
			}
			s = next;
			cout << s2 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
char c[N]; pii e[N];
int main()
{	scanf("%s",c+1); int n=strlen(c+1),P=1,cur=1,sz=1,tot=0;
	if(c[n]=='1'||c[1]=='0') return !printf("-1");
	for(rint i=1;i<n;i++) if(c[i]!=c[n-i]) return !printf("-1");
	for(rint i=1;i<=n;i++)
	if(c[i]=='1')
	{	e[++tot]=mp(++P,cur); int rt=P;// debug(sz);
		for(rint j=sz+1;j<=i;j++) e[++tot]=mp(cur,++P);
		cur=rt; sz=i+1;
	}
	for(rint i=1;i<=tot;i++) printf("%d %d\n",e[i].first,e[i].second);
	return 0;
}


Measured memory_bytes: 4224
///A drunk man will find his way home, but a drunk bird may get lost forever...i
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair <int, int> pii;
#define pb push_back
#define pf push_front
#define f first
#define s second
#define sz(x) (int)x.size()
#define smin(x , y) x = min(x , y)
//const int mx = 2000 * 100 + 5;
int32_t main(){		
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	cout.tie(0);
	int n;
	cin >> n;
	if(n % 2){
		cout << 0 << endl;
		return 0;
	}
	int x = 10, ans = 0;
	while(x <= n){
		ans += n / x;
		x *= 5;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int,input().split())
P = [int(i) for i in input().split()]
e = [0]*N
L = [0]*(N-K+1)
for i in range(N):
  e[i] = (P[i]*(P[i]+1)/2)/P[i]
for i in range(K):
  L[0] += e[i]
for i in range(K,N):
  L[i-K+1] = L[i-K]-e[i-K]+e[i]
print(max(L))

Measured memory_bytes: 25188
#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

#define sz 103

int ara[sz + 3];

int main(){

    int i, j, sum, ans;
    int n, mx, mn;

    scanf("%d", &n);
    mx = 0;
    mn = 105;

    for(i = 0; i < n; i++){

        scanf("%d", &ara[i]);

        if(ara[i] > mx) mx = ara[i];

        if(ara[i] < mn) mn = ara[i];
    }

    //printf("%d %d\n", mx, mn);

    ans = 100000000;

    for(i = mn; i <= mx; i++){

        sum = 0;

        for(j = 0; j < n; j++){

            sum += ((ara[j] - i) * (ara[j] - i));
        }
        if(sum < ans) ans = sum;
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
// 有點不耐煩會破壞偉大的計劃

#include <bits/stdc++.h>

#define append push_back

using namespace std;
using ll = long long;

const int N = 1e5 + 3;
const int M = 1e6 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 22, BL = 400;
const double EPS = 1e-9, PI = acos(-1);
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};

void debug() {
	cerr << "\n";
}
template<typename Type1, typename... Type2>
void debug(Type1 a, Type2... b) {
    cerr << a << " ";
    debug(b...);
}

int main() {
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    long long n, m, c, ans = 0; cin >> n >> m >> c;

    vector<long long> b(m);
    for(long long i = 0; i < m; i++) {
        cin >> b[i];
    }

    vector<vector<long long>> a(n, vector<long long>(m));
    for(long long i = 0; i < n; i++) {
        for(long long j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }

    for(long long i = 0; i < n; i++) {
        long long res = 0;
        for(long long j = 0; j < m; j++) {
            res += (a[i][j] * b[j]);
        }
        res += c;
        if(res > 0) ans++;
    }

    cout << ans;

    return 0;
}


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

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<ll> C(N);

    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    REP(i,N) cin >> C[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    ll p;
    ll cnt = 0;
    ll numA=0, numC=0; 
    REP(i,N){
        p = B[i]; 
        while(A[numA] < p && numA < N){
            numA++;
        }
        while(C[numC] <= p && numC < N){
            numC++;
        }
        //cnt += min(0, (numA-1)) * (N-min(0, (numC-1)));
        cnt += numA * (N-numC);
        //printf("A:%d   C:%d\n", numA, numC);
        //cout << cnt << endl;
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;


int32_t main() {
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    oneforall
    
    ini(n);
    FOR(i,1,n+1){
        if(i*(i+1)/2 >=n){
            out(i);return 0;
        }
    }
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
  int xy[15][15]={};
  int main(){
	  int x,y,s,i,j,num=0;
	  while(scanf("%d,%d,%d",&x,&y,&s) != EOF){
		  if(s==1){
			  xy[x][y]++;
			  xy[x-1][y]++;
			  xy[x+1][y]++;
			  xy[x][y-1]++;
			  xy[x][y+1]++;
		  }else if(s==2){
			  xy[x-1][y-1]++;
			  xy[x-1][y]++;
			  xy[x-1][y+1]++;
			  xy[x][y-1]++;
			  xy[x][y]++;
			  xy[x][y+1]++;
			  xy[x+1][y-1]++;
			  xy[x+1][y]++;
			  xy[x+1][y+1]++;
		  }else if(s==3){
			  xy[x-2][y]++;
			  xy[x-1][y-1]++;
			  xy[x-1][y]++;
			  xy[x-1][y+1]++;
			  xy[x][y-2]++;
			  xy[x][y-1]++;
			  xy[x][y]++;
			  xy[x][y+1]++;
			  xy[x][y+2]++;
			  xy[x+1][y-1]++;
			  xy[x+1][y]++;
			  xy[x+1][y+1]++;
			  xy[x+2][y]++;
		  }
	  }
	  int max=xy[0][0];
	  for(i=0;i<10;i++){
		  for(j=0;j<10;j++){
			  if(xy[i][j]==0) num++;
			  if(xy[i][j]>max) max=xy[i][j];
		  }
	  }
	  printf("%d\n%d\n",num,max);
	  return 0;
  }

Measured memory_bytes: 1028
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){

    int N;
    cin >> N;
    vector<int> d(N);
    for(int i=0;i<N;i++)
        cin >> d[i];

    sort(d.begin(), d.end());
    reverse(d.begin(),d.end());
    
    int tmp = 0;
    int ans = 0;
    
    for(int i=0; i<N; i++){
        if(tmp != d[i])
            ans++;
        tmp = d[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main()
{
	int N, D, i, n,m;
	int array[10][11];
	int sum = 0;
	int count = 0;
	double kyori;

	scanf("%d%d", &N, &D);

	for (i = 1; i <= N; i++) {
		for (m = 1; m <= D; m++) {
			scanf("%d", &array[i][m]);
		}
	}

	for (i = 1; i<N; i++) {
		for (n = i + 1; n <= N; n++) {
          sum = 0;
			for (m = 1; m <= D; m++) {
				sum += pow(array[i][m] - array[n][m], 2);
			}
			kyori = pow(sum, 0.5);
			if (ceil(kyori) == floor(kyori)) {
				count++;
				sum = 0;
			}
		}
	}
	printf("%d\n", count);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 100000000;
const ll half_inf = 0x3f3f3f3f;
const ll inf = 0x7fffffff;
const ll mod = 998244353;
const ll maxn = 2000005;
int d[1005],a[1005],sum=0,b[1005]={0};
int main(){
    int n,k;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=k;i++){
    	scanf("%d",&d[i]);
    	for(int j=1;j<=d[i];j++){
    		scanf("%d",&a[j]);
    		b[a[j]]=1;
    	}
    }
    for(int i=1;i<=n;i++){
    	if(b[i]==0) sum++;
    }
    printf("%d",sum);
 	return 0;
}




Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define  rep(i,a,b)for(int i=a;i<b;++i)
#define  rrep(i,a,b)for(int i=a;i>=b;--i)
#define  yesno(flag)if(flag)cout<<"Yes"<<endl; else cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const int INF=1000000000LL;
const ll r197=1000000007;
typedef pair<int,int>P;
typedef pair<int,P>Pa;


int main() {
	ll n,a,b;
	cin>>n;
	if(n==1){
		cout<<"Hello World"<<endl;
	}else{
		cin>>a>>b;
		cout<<a+b<<endl;
	}
	return 0;
}


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

#define Rep(i, n) for ( int i = 0; i < (n); i++ )

int board[7][7][7];
int n, m, p;
int color = 1;
int winner = -1;
int en = -1;

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

  while ( cin >> n >> m >> p, n | m | p ) {
    color = 1;
    winner = -1;    
    memset(board, -1, sizeof(board));
    
    Rep(i, p) {
      int ix, iy;
      cin >> ix >> iy;
      ix--; iy--;

      if ( winner != -1 ) continue;

      Rep(j, n) {
	if ( board[ix][iy][j] == -1 ) {
	  board[ix][iy][j] = color;
	  break;
	}
      }

      Rep(x, n) Rep(y, n) Rep(z, n) {
	if ( board[x][y][z] != color ) continue;
	for ( int dx = -1; dx <= 1; dx++ ) {
	  for ( int dy = -1; dy <= 1; dy++ ) {
	    for ( int dz = -1; dz <= 1; dz++ ) {
	      if ( dx == 0 && dy == 0 && dz == 0 ) continue;
	      int cnt = 0;
	      int nx = x, ny = y, nz = z;
	      while ( 1 ) {
		if ( nx < 0 || ny < 0 || nz < 0 || nx >= n || ny >= n || nz >= n ) break;
		if ( board[nx][ny][nz] != color ) break;		
		cnt++;
		nx += dx; ny += dy; nz += dz;
		if ( cnt >= m ) break;
	      }

	      if ( cnt >= m ) {
		winner = color;
		en = i;		
	      }
	    
	    }
	  }
	}
      }

      color ^= 1;
    }

    if ( winner == -1 ) {
      cout << "Draw" << endl;
    } else {
      if ( winner == 0 ) cout << "White ";
      else cout << "Black ";
      cout << en+1 << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3020
N, K = map(int, input().split())
ans = 0
for b in range(K+1, N+1):
    H = N // b
    n = b - K
    Last = N % b
    ans += H * n + max(Last - K + 1, 0)
    if K == 0:
        ans -= 1
print(ans)

Measured memory_bytes: 39408
import sys
S = list(input())
S.insert(0,"X")

#文字列の奇数番目をチェック
for i in range(1,len(S),2):
  if S[i] == "L":
    print("No")
    sys.exit()
#文字列の偶数番目をチェック
for j in range(2,len(S),2):
  if S[j] == "R":
    print("No")
    sys.exit()
print("Yes")

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

using namespace std;

string shuffle(string str, int h);

int main(void)
{
	string deck;
	int m, h;
	int i;

	cin >> deck;
	while (deck != "-")
	{
		cin >> m;
		for (i = 0; i < m; i++)
		{
			cin >> h;
			deck = shuffle(deck, h);
		}
		cout << deck << endl;
		cin >> deck;
	}
	return 0;
}

string shuffle(string str, int h)
{
	string temp;
	temp = str.substr(0, h);
	str.erase(0, h);
	str.append(temp);
	return str;
}


Measured memory_bytes: 3196
#! /usr/bin/env python3

h, w = map(int, input().split())

a = []
for i in range(h):
    a.append([int(i) % 2 for i in input().split()])

res = []
prev = []
status = False

for y in range(h):
    for xx in range(w):
        if y % 2 == 1:
            x = w - xx - 1
        else:
            x = xx
        if status == True:
            res.append([prev[0] + 1, prev[1] + 1, y + 1, x + 1])
        if a[y][x] == 1:
            status = not status

        prev = [y, x]

print(len(res))
for arr in res:
    print(arr[0], arr[1], arr[2], arr[3])


Measured memory_bytes: 31824
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

operation = sum(B) - sum(A)

cntp = 0
cntn = 0
for a, b in zip(A, B):
    c = b - a
    if c > 0:
        cntp += c
        if c % 2 != 0:
            operation -= 1
    elif c < 0:
        cntn += -c


if operation >= cntn:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 41072
#include <iostream>
using namespace std;
int many(int, int);
int main() 
{
	int a, b, c;
	cin >> a;
	cin >> b;
	while (a != 0 || b != 0) {
		c = many(a, b);
		cout << c << endl;
		cin >> a;
		cin >> b;
	}
	return 0;
}

int many(int x, int y) 
{
	int n, m, r, p, q = 0;
	for (n = 1; n <= x; n++) {
		for (m = 1; m <= x; m++) {
			for (r = 1; r <= x; r++) {
				if (n < m && m < r) {
					p = n + m + r;
					if (p == y) {
						q = q + 1;
					}
				}
			}
		}
	}
	return q;
}

Measured memory_bytes: 3084
N = int(input())

def sieve(N):
    p = 0
    prime = []
    is_prime = [1 for _ in range(N + 1)]
    is_prime[0], is_prime[1] = 0, 0
    for i in range(2, N + 1):
        if is_prime[i]:
            p += 1
            temp = i
            prime.append(i)
            while(temp <= N):
                is_prime[temp] = 0
                temp += i
            is_prime[i] = 1
    return p, prime

def fact_prime(n, p):
    ret = 0
    temp = p
    while(n >= p):
        ret += n // p
        p *= temp
    return ret

_, prime_list = sieve(N)
ans = 0

for a in prime_list:
    for b in prime_list:
        for c in prime_list:
            if a != b and b < c and a != c:
                if fact_prime(N, a) >= 2 and fact_prime(N, b) >= 4 and fact_prime(N, c) >= 4:
                    ans += 1
                    
for a in prime_list:
    for b in prime_list:
        if b != a:
            if fact_prime(N, a) >= 24 and fact_prime(N, b) >= 2:
                ans += 1
            if fact_prime(N, a) >= 4 and fact_prime(N, b) >= 14:
                ans += 1
                
for a in prime_list:
    if fact_prime(N, a) >= 74:
        ans += 1    

print(ans)

Measured memory_bytes: 73492
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000001

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a<b){
		if(b>c&&c>a){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}else{
		if(c>b&&c<a){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
    string s;
    cin>>s;
    vector<char>v(s.size());
    int index=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]!='B'){
            v[index]=s[i];
            index++;
        }
        else{
            if(index>0)
                index--;
        }
    }
    for(int i=0;i<index;i++)
    {
        cout<<v[i];
    }
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
#define MAX 100000

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

int main() {
	int H, i, A[MAX + 1];

	cin >> H;
	for (i = 1; i <= H; i++) cin >> A[i];

	for (i = 1; i <= H; i++) {
		cout << "node " << i << ": key = " << A[i] << ", ";
		if (parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
		if (left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
		if (right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
		cout << endl;
	}

	return 0;
}



Measured memory_bytes: 3100
#include <stdio.h>
#include <math.h>

int main(void)
{
  int n = 0, result = 0;
  char s[3];
  scanf("%s", &s);
  
  if( s[0] == 'R' ){
      n++;
      result = 1;
  } else {
      n = 0;
      
  }
  if( s[1] == 'R' ){
      n++;
      result = 1;
      if( n == 2 ){
          result = 2;
      }
  } else {
      n = 0;
  }
  if( s[2] == 'R' ){
      n++;
  } else {
      n = 0;
  }
  
  if( result >= n ){
      printf("%d\n", result);
  } else {
      printf("%d\n", n);
  }
  
  return 0;
}

Measured memory_bytes: 1732
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
def main():
    N,K = map(int,input().split())
    print(len(str(Base_10_to_n(N,K))))
main()

Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(' ').map(String::toInt)
    val max3 = 3 * Math.max(a, Math.max(b, c))
    val sum = a + b + c
    if ((max3 % 2 == 1) && (sum % 2 == 0)
            || (max3 % 2 == 0) && (sum % 2 == 1)) {
        println((max3 + 3 - sum) / 2)
    } else {
        println((max3 - sum) / 2)
    }
}

Measured memory_bytes: 38300
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a!=c)
	cout<<c<<endl;
	if(a==c&a!=b)
		cout<<b<<endl;
	if(b==c&&b!=a)
		cout<<a<<endl;
}

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

int main(){
	// sengen
	LL n,a[5];
	// nyuryoku
	cin >> n >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	// keisan
	LL ans = 4;
	LL plus = 0;
	if(n%a[0] == 0){
		plus = n/a[0];
	}else{
		plus = n/a[0] + 1;
	}
	for(int i=1;i<5;i++){
		if(n%a[i] == 0){
			plus = max(plus,n/a[i]);
		}else{
			plus = max(plus,n/a[i] + 1);
		}
	}
	// syutsuryoku
	cout << plus + ans << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool check(ll y){
    ll x=sqrt(y);
    for(ll i=x-1;i<=x+1;i++){
        if(i*i == y)
            return true;
        }
        return false;
}   
int main()
{
    ll n,b,d,i,j,k,x;
    cin>>n;
    ll a[n+4];
    ll sum1[200005]={0},sum2[200005]={0};
    for(i=0;i<n;i++){
        cin>>a[i];
        
        if(i%2)
            sum1[i]=(sum1[i-1]+a[i]);
        else{    
            if(i)
            sum1[i]=(sum1[i-1]-a[i]);
            else
                sum1[i]=-a[i];
        }
        if(i%2)
            sum2[i]=sum2[i-1]-(a[i]);
        else    {
            if(i)
            sum2[i]=(sum2[i-1]+a[i]);
            else
                sum2[i]=a[i];
            
            
        }
        
    }
    
    vector<ll> v;
    for(i=0;i<n;i++){
        ll sum=0;
        if(i==0){
            cout<<sum2[n-1]<<' ';
        }
        else if(i==n-1){
            cout<<sum1[n-1]+a[i]+a[i]<<' ';
        }
        else if((i+1)%2){
            cout<<sum2[n-1]-sum2[i]+sum1[i-1]+a[i]<<' ';
        }
        else{
            cout<<sum1[n-1]-sum1[i]+sum2[i-1]+a[i]<<' ';
        }
        
    }
    
    
}


Measured memory_bytes: 5248
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

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

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = 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(Node u){
  if(u == NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u == NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x, a;
  char com[20],A[20][20];
  Node t;
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if(strcmp(com,"find") == 0){
      scanf("%d",&a);
      t = find(root,a);
      if(t != NIL)printf("yes\n");
      else printf("no\n");
    }
    else if(strcmp(com,"insert") == 0){
      scanf("%d",&x);
      insert(x);
    }
    else if(strcmp(com,"print") == 0){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 20448
n = int(input())
a = list(map(int, input().split()))
a.sort()

import bisect
import numpy as np
amax = a[-1]
cent = amax // 2

idx = bisect.bisect_left(a, cent)
if idx == len(a)-1:
    print(amax, a[-2])
else:
    max_idx = np.argmin([abs(a[idx]-cent), abs(a[idx-1]-cent)])
    if max_idx:
        print(amax, a[idx-1])
    else:
        print(amax, a[idx])


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

#define BR "\n"
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n;
	string s;
	cin >> n >> s;
	if (n % 2 == 1) {
		cout << "No" << BR;
		return 0;
	}
	if (s.substr(0, n / 2) == s.substr(n / 2,  n / 2)) {
		cout << "Yes" << BR;
		return 0;
	} else {
		cout << "No" << BR;
		return 0;
	}

}

Measured memory_bytes: 256
r[9],i;b(int n,int p){for(i=0;i<8;)r[i++]=n%2,n/=2;for(i=p;i;)printf("%d",r[i---1]);}double n,a;main(){for(;scanf("%lf",&n),a=(n-(int)n)*16,n>=0;)if((int)n<256 && a==(int)a)b(n,8),printf("."),b(a,4),puts("");else puts("NA");exit(0);}

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

long long x;
long long now;

int main(){
    cin >> x;
    int ans = 0;
    now = 100;
    for (;;) {
        if (x <= now)
            break;
        now = now+now/100;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main(){

    int n,d1,d2,ans=0;
    scanf("%d", &n);

    for(;n>0;n--){
      scanf("%d %d", &d1, &d2);
      if(d1==d2){
        ans++;
      }else if(ans>=3){        
      }else{
      	ans=0;
      }
        
    }
    if (ans < 3){
      printf("No");
    }else{
      printf("Yes");
    }
  return 0;
}


Measured memory_bytes: 1732
import java.util.Scanner;

public class Main {

	public static int[][] dice_bottom_update( int[][] map, int num) {
		map[0][2] = num;
		map[2][0] = num;
		map[2][4] = num;
		map[4][2] = num;
		return map;
	}

	public static int[][] map_roll_n( int[][] map ) {
		for ( int i = 0 ; i < 4 ; i++ ) {
			map[2][i] = map[2][i+1];
		}
		map = dice_bottom_update( map, map[2][0] );
		return map;
	}

	public static int[][] map_roll_s( int[][] map ) {
		for ( int i = 4 ; i > 0 ; i-- ) {
			map[2][i] = map[2][i-1];
		}
		map = dice_bottom_update( map, map[2][4] );
		return map;
	}

	public static int[][] map_roll_w( int[][] map ) {
		for ( int i = 0 ; i < 4 ; i++ ) {
			map[i][2] = map[i+1][2];
		}
		map = dice_bottom_update( map, map[0][2] );
		return map;
	}

	public static int[][] map_roll_e( int[][] map ) {
		for ( int i = 4 ; i > 0 ; i-- ) {
			map[i][2] = map[i-1][2];
		}
		map = dice_bottom_update( map, map[4][2] );
		return map;
	}

	static class Dice {
		private int[] num;
		private int[][] dice_map = new int[5][5];

		/* *** dice_map
           0   1   2   3   4 x
        0  -   -  [6]  -   -
        1  -   -  [5]  -   -
        2 [6] [4] [1] [3] [6]
        3  -   -  [2]  -   -
        4  -   -  [6]  -   -
        y

        top : dice_map[2][2]
        bottom : dice_map[0][2] = dice_map[2][0] = dice_map[2][4] = dice_map[4][2]
		*** */

		public Dice() {
			this( new int[]{1,2,3,4,5,6} );
		}

		public Dice(int input_num[]) {
			num = new int[6];
			num[0] = input_num[0];
			num[1] = input_num[1];
			num[2] = input_num[2];
			num[3] = input_num[3];
			num[4] = input_num[4];
			num[5] = input_num[5];
		}

		public void init() {
			//1(top)
			dice_map[2][2] = num[0];
			//2
			dice_map[2][3] = num[1];
			//3
			dice_map[3][2] = num[2];
			//4
			dice_map[1][2] = num[3];
			//5
			dice_map[2][1] = num[4];
			//6(bottom)
			dice_map = dice_bottom_update( dice_map, num[5] );
		}

		public int get_no() {
			return dice_map[2][2];
		}

		public void roll(char dc) {
			switch( dc ) {
			case 'N' :
				dice_map = map_roll_n( dice_map );
				break;
			case 'S' :
				dice_map = map_roll_s( dice_map );
				break;
			case 'E' :
				dice_map = map_roll_e( dice_map );
				break;
			case 'W' :
				dice_map = map_roll_w( dice_map );
				break;
			}
		}
	}


	public static void main(String[] args) {

		int dice_face_num = 6;
		int[] input_num = new int[dice_face_num];
		String roll_str ="";

		Scanner sc= new Scanner( System.in );

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

		roll_str = sc.next();

		Dice dice = new Main.Dice(input_num);

		dice.init();

		for( int i = 0 ; i < roll_str.length(); i++ ) {
			dice.roll(roll_str.charAt(i));
		}
		System.out.println( dice.get_no() );
		sc.close();
	}
}


Measured memory_bytes: 26368
#include<string>
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<map>
using namespace std;
typedef long long int llint;
typedef bool izryt;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
const llint mod=10007;
const llint big=1e18;
const llint red=0xE869120;
const llint pro=1002001;
const llint eiya=5498513;
llint solve(llint num){
	//num?????§??????????????¨??????????????°????¨????
	//num???15????????°+10??????90<=num
	llint ans=5,i,j,gen=100,fu;
	ans+=4*(num/3+num/5);
	for(i=2;gen%10==0&&gen<=num;gen*=10){
		ans+=8*(i*(gen-gen/10)/15);i++;
		fu=gen;
	}
	ans+=8*(i*(num-fu)/15);
	return ans;
}
int main(void){
	llint s,bmin=6,bmax=3.5e16,gen;
	string out;
	cin>>s;
	if(s>1000){
	while(bmax-bmin!=1){
		gen=(bmax+bmin)/2;
		if(solve(gen*15+10)<s){bmin=gen;}
		else{bmax=gen;}}
	}
	llint start=bmin-3,stl=solve(start*15+10),i=0;
	//cout<<stl<<endl;
	i=start*15+11;
	if(s<=1000){i=1;start=1;stl=0;}
	for(;stl+out.size()<s+20;i++){
		if(i%15==0){out+="FizzBuzz";}
		else if(i%3==0){out+="Fizz";}
		else if(i%5==0){out+="Buzz";}
		else{out+=to_string(i);}
	}
	for(i=0;i<20;i++){cout<<out[s-1+i-stl];}
	cout<<endl;
	return 0;
}

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

long long mod = 1000000007;

int main () {
  
  vector<long long> kai(3030);
  vector<long long> gkai(3030);
  long long bk = 1;
  long long bkt;
  long long bkmod;
  for (int i=1; i<3030; i++) {
    bk *= i;
    bk %= mod;
    kai[i] = bk;
    bkmod = bk;
    for (int i=0; i<9; i++) {
      bkt = bkmod;
      for (int j=0; j<9; j++) {
        bkmod *= bkt;
        bkmod %= mod;
      }
    }
    for (int i=0; i<5; i++) {
      bkmod *= bk;
      bkmod %= mod;
    }
    gkai[i] = bkmod;
  }
  kai[0] = kai[1];
  gkai[0] = gkai[1];
  
  int N,M;
  string S;
  cin >> N >> M >> S;
  vector<long long> l(M+1,N+1),r(M+1,N+1);
  for (int i=0; i<M; i++) {
    cin >> l[i] >> r[i];
    if (i >= 1) {
      if (l[i] == l[i-1]) {
        l[i-1] = -1;
        r[i] = max(r[i],r[i-1]);
      }
    }
  }
  vector<int> n1(N+1,0);
  for (int i=0; i<N; i++) {
    if (S[i] == '1') {
      n1[i+1] = n1[i] + 1;
    }
    else {
      n1[i+1] = n1[i];
    }
  }
  long long L=0;
  long long R=0;
  long long com;
  vector<vector<long long>> dp(N+1,vector<long long>(N+1,0));
  for (int i=0; i<M+1; i++) {
    if (l[i] == -1) {
      continue;
    }
    if(L == 0) {
      dp[l[i]-1][n1[l[i]-1]] = 1;
      L = l[i];
      R = r[i];
      continue;
    }
    if (R < l[i]) {
      for (int j=n1[R]-(R-L+1); j<n1[R]+1; j++) {
        if (j<0) continue;
        com = kai[R-L+1] * gkai[n1[R]-j] % mod * gkai[(R-L+1)-(n1[R]-j)] % mod;
        dp[l[i]-1][n1[l[i]-1]] += dp[L-1][j] * com % mod;
      }
      dp[l[i]-1][n1[l[i]-1]] %= mod;
      L = l[i];
      R = r[i];
      continue;
    }
    for (int j=n1[R]-(R-l[i]+1); j<n1[R]+1; j++) {
      for (int k=0; k<=l[i]-L; k++) {
        if (j-k < 0) continue;
        com = kai[l[i]-L] * gkai[k] % mod * gkai[l[i]-L-k] % mod;
        dp[l[i]-1][j] += dp[L-1][j-k] * com % mod;
      }
      dp[l[i]-1][j] %= mod;
    }
    L = l[i];
    R = max(r[i],R);
  }
  cout << dp[N][n1[N]] << endl;
  return 0;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define Maxn 100010
#define INF 10010
inline int read()
{
	char c=getchar();re ll f=1,s=0;
	while(!isdigit(c)){if(c=='-')f=-1,c=getchar();}
	while(isdigit(c)){s=s*10+c-48;c=getchar();}
	return f*s;
}
bool cmp(int a,int b){
	return a>b;
}
int main()
{
	int s,a[51],n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n,cmp);
    for(int i=0;i<k;i++) s+=a[i];
    cout<<s;
	return 0;
}

Measured memory_bytes: 256
#Shift only
N = int(input())
A = list(map(int,input().split()))
count = [0]*N
for a in range(N):
    count_local = 0
    while A[a]%2 == 0:
        A[a] = A[a]/2
        count_local += 1
        if count_local >= count[a]:
            count[a] = count_local

print(min(count))

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

int main() {
    int a, b ,c;
    cin >> a >> b >> c;
    int mx, mn;
    mx = max(a, max(b, c));
    mn = min(a, min(b, c));
    cout << mn << " " << mx << endl;
}


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

int main() {
	int n,a[4]={0};
    char c[3];
    while(EOF!=scanf("%d,%s",&n,c)){
        if(c[0]=='A'&&c[1]!='B')a[0]++;
        if(c[1]=='B')a[2]++;
        if(c[0]=='B')a[1]++;
        if(c[0]=='O')a[3]++;
    }
    printf("%d\n%d\n%d\n%d\n",a[0],a[1],a[2],a[3]);
	return 0;
}

Measured memory_bytes: 1188
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	string s,t;
	cin>>s>>t;
	REP(i,s.size()){
		if(s[i]!=t[i]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 3628
t;main(a,b,c,d,e,f){for(;~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);printf("%.3f %.3f\n",(c*e-b*f+0.)/t+0.,(a*f-c*d+0.)/t))t=a*e-b*d;}

Measured memory_bytes: 0
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,K = mi()
hlis = li()

inf = 10 **13 + 7
dp = [[inf]*n for _ in range(n)]
for i in range(n):
    dp[0][i] = hlis[i]

for i in range(1,n):
    for k in range(i,n):
        #dp[i][k] = min(dp[i][k],dp[i-1][l] + abs)
        for l in range(k):
            dp[i][k] = min(dp[i][k],dp[i-1][l] + max(0,hlis[k] - hlis[l]))

tukau = n - K
ans = inf
if K == n:
    print(0)
    exit()
for i in range(tukau-1,n):
    ans = min(ans,dp[tukau-1][i])
print(ans)



Measured memory_bytes: 44144
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
sur = [0] * 5

for i in range(len(l)):
    if l[i] % 10 != 0:
        sur[i] = 10 - (l[i]%10)

ans = sum(l) + sum(sur) - max(sur)
print(ans)

Measured memory_bytes: 3064
while True:
    a, b = map(int, input().split())
    if a == 0 or b == 0:
        break

    if a == 1:
        print("#" * b)
    else:
        print("#" * b)
        for i in range(a - 2):
            print("#" + ("." * (b - 2)) + "#")
        print("#" * b)
    print()


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

int	main()
{
	int	A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	int	best_solution = 100 * A, best_solute = 0;
	int	solution, solute, solvent;
	for (int i = 0; i * 100 * A <= F; ++i) {
		for (int j = 0; i * 100 * A + j * 100 * B <= F; ++j) {
			solvent = i * 100 * A + j * 100 * B;
			for (int k = 0; solvent + k * C <= F; ++k) {
				for (int l = (F - solvent - k * C) / D; l >= 0; --l) {
					solute = k * C + l * D;
					solution = solute + solvent;
					if (100 * solute > solvent * E)
						continue;
					if (solute * best_solution > best_solute * solution) {
						best_solution = solution;
						best_solute = solute;
					}
					break;
				}
			}
		}
	}
	cout << best_solution << " " << best_solute << endl;
}


			


Measured memory_bytes: 256
<?php
// B
fscanf(STDIN, '%d %d %d', $n, $m, $x);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));
$c0 = $cn = 0;
for ($i = 0; $i < $m; $i++) {
    if ($a[$i] < $x) $c0++;
    else $cn++;
}
echo min($c0, $cn);

Measured memory_bytes: 4604
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
  string s;
  cin>>s;
  bool ok=true;
  for(int i=1;i<s.size();i++){
    if(s[i]-'0'<9){ok=false;s[i]='9';}
  }
  if(!ok){s[0]=(s[0]-'0'-1)+'0';}
  int count=0;
  for(int i=0;i<s.size();i++){
    count+=s[i]-'0';
  }
  
  cout<<count<<endl;
  return 0;}

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define popcnt __builtin_popcount
#define getBit(x, k) ((x >> k) & 1)
#define all(x) (x).begin(),(x).end()
// ---------------------------------

void Main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> q;
  for (int i = 0; i < n; i++) {
    int t; cin >> t;
    q.push(t);
  }
  for (int i = 0; i < m; i++) {
    int j = q.top(); q.pop();
    q.push(j / 2);
  }
  int ans = 0;
  while (q.size()) {
    ans += q.top(); q.pop();
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  cerr << "i love ------- <3 \n";
#endif
  cin.tie(0)->sync_with_stdio(0);
  int T = 1;
  // cin >> T;
  while (T--) Main();
}


Measured memory_bytes: 4172
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    		Scanner scan =new Scanner(System.in);
    		int[] array=new int[3];
    		array[0]=Integer.parseInt(scan.next());
    		array[1]=Integer.parseInt(scan.next());
    		array[2]=Integer.parseInt(scan.next());
    		Arrays.sort(array);
    		if(array[0]+array[1]==array[2]) {
    			System.out.print("Yes");
    		}else {
    			System.out.print("No");
    		}
    		
    }
     
    }

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define mset(a,x) memset(a,x,sizeof(a))
#define OUT(x) cout<<(x)<<"\n"
#define SZ(x) (int)(x).size()
#define FASTIO cin.tie(0),ios::sync_with_stdio(0)

// nCr
ll C[55][55];

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    vector<ll> v(n);
    for(auto&& i : v) cin >> i;

    sort(RALL(v));
    double ave = 0;
    rep(i, a) {
        ave += 1.0 * v[i] / a;
    }

    int x = 0, y = 0;
    rep(i, n) {
        if(v[i] == v[a - 1]) {
            ++x;
            if(i < a) ++y;
        }
    }

    rep(i, n + 1) rep(j, i + 1) {
        if(j == 0 || j == i) C[i][j] = 1LL;
        else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
    }


    ll cnt = 0;
    if(v[0] == v[a - 1]) {
        FOR(i, a, b + 1) cnt += C[x][i];
    }
    else {
        cnt += C[x][y];
    }

    printf("%.10f\n", ave);
    printf("%lld\n", cnt);

    return 0;
}

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

using namespace std;
typedef long long ll;
#define mp make_pair

const int N = 60;
const ll INF = 1e18;
ll a[N];
ll q[N];
ll r[N];
ll tmp[N];
ll k = 0;

int main() {
	//	freopen("input.txt", "r", stdin);
	//	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr);	
	ll n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		q[i] = a[i] / (n + 1);
		r[i] = a[i] % (n + 1);
	}
	while (true) {
		for (int i = 0; i < n; i++)
			tmp[i] = q[i];
		sort(tmp, tmp + n);
		ll m1 = tmp[n - 1];
		ll m2 = -INF;
		ll t = 0;
		for (int i = n - 1; i >= 0; i--) {
			if (tmp[i] == m1)
				t = n - i;
			else {
				m2 = tmp[i];
				break;
			}
		}
		ll sub = min(m1 - m2, (m1 * (n + 1) + k - n) / (n + 1 - t) - 2);
		if (sub < 0)
			break;
		for (int i = 0; i < n; i++) {
			if (q[i] == m1)
				q[i] -= sub;
		}
		k += sub * t;
		if (sub != m1 - m2)
			break;
	}
	for (int i = 0; i < n; i++)
		a[i] = q[i] * (n + 1) + r[i] + k;
	while (true) {
		ll m = -INF;
		ll cur = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > m) {
				m = a[i];
				cur = i;
			}
		}
		if (m <= n - 1) {
			cout << k << endl;
			return 0;
		}
		for (int i = 0; i < n; i++)
			a[i]++;
		a[cur] -= n + 1;
		k++;
	}
	throw;
	return 0;
}


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

int main(){
    int n,m,s[200001],g[200001],i,ans=0,x,y;
    for(i=0;i<200001;i++){
        s[i] = 0;
        g[i] = 0;
    }
    scanf("%d %d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d %d",&x,&y);
        if(x==1){
            s[y] ++;
        }
        if(y==n){
            g[x] ++;
        }
    }
    for(i=1;i<n;i++){
        if(s[i]+g[i]==2){
            ans = 1;
            break;
        }
    }
    if(ans == 1){
        printf("POSSIBLE\n");
    } else {
        printf("IMPOSSIBLE\n");
    }
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    int counter=0;
    int ccounter=0;
    while(A>0){
        A-=D;
        counter++;
    }
    while(C>0){
        C-=B;
        ccounter++;
    }
    if(counter>=ccounter) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

ll mymul(ll a, ll b) {
	if (a > LL_INF / b) return LL_INF;
	return min(LL_INF, a*b);
}
ll mypow(ll a, ll b) {
	ll rv = 1;
	while (b) {
		if (b % 2) rv = mymul(rv, a);
		a = mymul(a, a);
		b /= 2;
	}
	return rv;
}

void aa(int N, int K, ll v) {
	if (mypow(N, K) <= 1e18) {
		ll c = 0, i, j;
		for (i = 1; i <= K; i++) c += mypow(N, i);

		ll x = (c+1) / 2 + v;
		x--;
		for (i = K; i >= 1; i--) {
			if (i == 1) {
				printf("%lld ", x + 1);
				break;
			}
			
			ll t1 = x / (c / N);
			printf("%lld ", t1 + 1);
			ll t2 = x % (c / N);
			if (t2 == 0) break;
			x = t2 - 1;
			c = c / N - 1;
		}
		printf("\n");
		return;
	}

	printf("%d ", (N+1) / 2);
	if (K % 2 == 0) aa(N, K-1, v - 1);
	else aa(N, K - 1, v);
}
int main() {
	int N, K, i;
	scanf("%d %d", &N, &K);
	if (N % 2 == 0) {
		printf("%d ", N / 2);
		for (int i = 1; i < K; i++) printf("%d ", N);
		return !printf("\n");
	}
	if (N == 1) {
		for (i = 1; i <= (K + 1) / 2; i++) printf("1 ");
		return !printf("\n");
	}

	aa(N, K, 0);
	return 0;
}

Measured memory_bytes: 2304