akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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

	int h = scan.nextInt();
	int w = scan.nextInt();
	/* マスの状態 */
	/* 番兵的に作成 */
	String[] s = new String[h+2];
	/* 下準備 */
	s[0] = "#";
	s[h+1] = "#";
	for(int i = 0; i < h+2; i++){
	    if(i == 0 || i == h+1){
		for(int j = 0; j < w+1; j++){
		    s[i] += "#";
		}
	    }else{
		s[i] = scan.next();
		s[i] = "#"+s[i]+"#";
	    }
	}

	/* デバッグ */
	/*
	for(int i = 0; i < h+2; i++){
	    for(int j = 0; j < w+2; j++){
		System.out.print(s[i].charAt(j));
	    }
	    System.out.println();
	}
	System.out.println();
	*/

	int[][] board = new int[h+2][w+2];

	for(int i = 1; i < h+1; i++){
	    for(int j = 1; j < w+1; j++){
		/* 左上から半時計回りにチェックしていく */
		if(s[i].charAt(j) == '#'){
		    board[i][j] = -1;
		    if(s[i-1].charAt(j-1) == '.'){
			board[i-1][j-1]++;  //左上
		    }
		    if(s[i-1].charAt(j) == '.'){
			board[i-1][j]++;  //上
		    }
		    if(s[i-1].charAt(j+1) == '.'){
			board[i-1][j+1]++;  //右上
		    }
		    if(s[i].charAt(j+1) == '.'){
			board[i][j+1]++;  //右
		    }
		    if(s[i+1].charAt(j+1) == '.'){
			board[i+1][j+1]++;  //右下
		    }
		    if(s[i+1].charAt(j) == '.'){
			board[i+1][j]++;  //下
		    }
		    if(s[i+1].charAt(j-1) == '.'){
			board[i+1][j-1]++;  //左下
		    }
		    if(s[i].charAt(j-1) == '.'){
			board[i][j-1]++;  //左
		    }
		}
	    }
	}

	for(int i = 1; i < h+1; i++){
	    for(int j = 1; j < w+1; j++){
		if(board[i][j] == -1){
		    System.out.print('#');
		}else{
		    System.out.print(board[i][j]);
		}
	    }
	    System.out.println();
	}
    }
}


Measured memory_bytes: 22612
n=int(input())
a=list(map(int,input().split()))
sum_r=sum(a)
sum_l=0
ans=10**20
for i in range(n-1):
    sum_l+=a[i]
    sum_r-=a[i]
    if abs(sum_r-sum_l)<ans:
        ans=abs(sum_r-sum_l)
print(ans)


Measured memory_bytes: 26224
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A[] = new int[N+1];

        for (int i=0;i<N+1;i++) {
            A[i] = sc.nextInt();
        }

        long ans = 0;
        for (int i=0;i<N;i++) {
            int Bi = sc.nextInt();
            if (A[i] >= Bi) {
                ans += Bi;
            } else {
                ans += A[i];
                Bi -= A[i];
                if (A[i+1] >= Bi) {
                    ans += Bi;
                    A[i+1] -= Bi;
                } else {
                    ans += A[i+1];
                    A[i+1] = 0;
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 64348
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,LL>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL V<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define SE second
#define PI acos(-1.00)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define edl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v,w,zz;
map<LL,LL>ww,u,st;
V<LL>uuu[500005];
V<pair<LL,LL> >uu;
map<pair<LL,LL>,LL> vo,vu,uh,ve;
set<LL>uo;
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    char ch;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
//    cin>>tt;
    while(tt--)
    {
       cin>>n>>m;
       cout<<n*m<<endl;
    }
    return 0;
}


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

int main() {
  char  w[200];
  cin >> w;
 int b = strlen(w);
   for(int i=b-2; i ; i-=2){
        if(strncmp(w,w+i/2,i/2)==0){
          
            cout << i << endl;
            return 0; 
   }
}
}
          
       
     
   


Measured memory_bytes: 256
// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <array>
// stream
//#include <istream>
#include <sstream>
//#include <ostream>
#include <fstream>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
//#include <chrono>
#include <random>
#include <numeric>
using namespace std;
 
int main()
{
  int N;
  long sum=0;
  cin >> N;
  vector<int> L(N);
  for(int i = 0; i < N; i++)
    cin >> L[i];
  sort(L.begin(), L.end());
  for(int i = 0; i < N-1; i++)
    sum += L[i];
  if(L[N-1] < sum)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define f(i,st,n) for(i=st;i<n;i++)
#define qu queue
#define ps(x) push(x)
#define vec vector
#define ft() front()
#define mst(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define sfl(x) scanf("%lld",&x)
#define pfl(x) printf("%lld\n",x)
#define pf(x) printf("%lld",x)
#define mpr make_pair
#define fs first
#define se second
#define inf LLONG_MAX
 
 
 
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }                     
    return gcd(b%a,a);
}
ll power(ll x,ll y){            
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=(res*x);
        }
        x=(x*x);
        y=y/2;
    }
    return res;
}
 


int main(){
 
 /*#ifndef ONLINE_JUDGE
    
   freopen("input.txt", "r", stdin);
   
   freopen("output.txt", "w", stdout);
   #endif*/
   ll n,i;
   sfl(n);
   string s;
  cin>>s;

  stack<char>st;


  f(i,0,n){
   if(st.empty()||st.top()!=s[i])st.push(s[i]);
   else continue;

  }
  cout<<st.size();













   return 0;
 }

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a; i< (int)(b); ++i)
using namespace std;

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

    int n;
    cin >> n;
    double a[n];
    rep(i,0,n) cin >> a[i];
    set<double> SET;
    rep(i,0,n){
    	SET.insert(a[i]);
    }
    if(n > SET.size()) cout << "NO" << "\n";
    else cout << "YES" << "\n";

}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    int count=0;
    for(int i=0;i<k;i++)
        count+=a[i];
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 3816
#include "iostream"
#include "random"
#include "string"
#include "bitset"
#include "algorithm"
#include "map"
#include "queue"
#include "list"
#include "set"
#include "climits"
#include "iomanip"
#include "complex"
#include "cassert"

using namespace std;
using ll = long long int;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int> f(100), a(100), t(100), x(100), y(100);
	for (int i = 0; i < N; i++) {
		cin >> f[i] >> a[i] >> t[i] >> x[i] >> y[i];
	}
	double maxA = -1, maxB = -1;
	double tA = -60, tB = -60;
	for (int i = 0; i + 1 < N; i++) {
		if (t[i] != t[i + 1] || a[i] == a[i + 1]) continue;
		double d = sqrt(pow(x[i] - x[i + 1], 2) + pow(y[i] - y[i + 1], 2));
		if (t[i] == 0) {
			if (maxA < d) {
				maxA = d;
				tA = f[i + 1] - f[i];
			}
			else if (maxA == d) {
				if (tA >(f[i + 1] - f[i])) tA = f[i + 1] - f[i];
			}
		}
		else {
			if (maxB < d) {
				maxB = d;
				tB = f[i + 1] - f[i];
			}
			else if (maxB == d) {
				if (tB >(f[i + 1] - f[i])) tB = f[i + 1] - f[i];
			}
		}
	}
	printf("%.15lf %.15lf\n", maxA, tA / 60);
	printf("%.15lf %.15lf\n", maxB, tB / 60);

}


Measured memory_bytes: 3264
n, m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0] * n
ac_c = [False] * n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == 'AC':
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Measured memory_bytes: 38628
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

lint calc(int i,int j, int N){
  lint ret=0;
  if(i==j and i<=N)ret++;
  REP(m,5){
    int M=1;
    REP(mi,m)M*=10;
    REP(k,M){
      if((M*i+k)*10+j<=N)ret++;
      // cerr<<i<<" "<<j<<" "<<(M*i+k)*10+j<<endl;
    }
  }

  return ret;
}

int main(){
  int N;
  cin>>N;
  lint ans=0;
  FOR(i,1,10)FOR(j,1,10){
    // cerr<<i<<" "<<j<<" "<<calc(i,j,N)<<" "<<calc(j,i,N)<<endl;
    ans+=calc(i,j,N)*calc(j,i,N);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100000
#define SENTINEL 1000000000
struct Card{
  char suit;
  int value;
};
struct Card L[MAX/2+2],R[MAX/2+2];
int partition(struct Card A[], int n,int p,int r){
  int i,j;
  struct Card temp,x;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j].value<=x.value){
      i++;
      temp=A[i];
      A[i]=A[j];
      A[j]=temp;
    }
  }
  temp=A[i+1];
  A[i+1]=A[r];
  A[r]=temp;
  return i+1;
}
void Merge(struct Card A[],int n,int left,int mid,int right){
  int n1=mid-left;
  int n2=right-mid;
  int i,j,k;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }
  L[n1].value=SENTINEL;
  R[n2].value=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i].value<=R[j].value){
      A[k]=L[i];
      i++;
    }
    else{
      A[k]=R[j];
      j++;
    }
  }
}
void Merge_Sort(struct Card A[],int n,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    Merge_Sort(A,n,left,mid);
    Merge_Sort(A,n,mid,right);
    Merge(A,n,left,mid,right);
  }
}
void Quick_Sort(struct Card A[],int n,int p,int r){
  int q;
  if(p<r){
    q=partition(A,n,p,r);
    Quick_Sort(A,n,p,q-1);
    Quick_Sort(A,n,q+1,r);
  }
}
int main(){
  int n,i,v;
  struct Card A[MAX],B[MAX];
  char str[10];
  int stable=1;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %d",str,&v);
    A[i].suit=str[0];
    B[i].suit=str[0];
    A[i].value=v;
    B[i].value=v;
  }
  Merge_Sort(A,n,0,n);
  Quick_Sort(B,n,0,n-1);
  for(i=0;i<n;i++){
    if(A[i].suit!=B[i].suit) stable=0;
  }
  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",B[i].suit,B[i].value);
  }
  return 0;
}

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

int main(){
  long long a,b,x;
  cin>>a>>b>>x;

  long long ans=0;
  if(0<a && a<x)a=x;
  while(a<=b){
    if(a%x==0){
      ans++;
      break;
    }
    a+=x-a%x;
  }

  if(a<b)ans+=(b-a)/x;

  cout<<ans<<endl;
}


Measured memory_bytes: 256
//#pragma  GCC optimize("Ofast")

//#ifdef  DEBUG
//#define _GLIBCXX_DEBUG
//#endif

// -Ofast
// -O3
// -O2
// -fsanitize=address
// -fsanitize=undefined

// add_compile_options()

#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <cmath>
#include <cassert>
#include <random>

using namespace std;

void solve();


int main() {
    srand(time(0));
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    solve();
    return 0;
}



const int maxN = 2e3 + 10, K = 1e6 + 10;

long long inf = 2e18 + 10, mod = 1e9 + 7;

#define int long long

bool cmp(pair < int, int > a, pair < int, int > b) {
    return a.first > b.first;
}

int n, dp[maxN][maxN];
pair < int, int > a[maxN];

void solve() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a, a + n, cmp);
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if ((i == 0 && j == 0) || (i + j > n)) continue;
            if (i) dp[i][j] = dp[i - 1][j] + abs(i - 1 - a[i + j - 1].second) * a[i + j - 1].first;
            if (j) dp[i][j] = max(dp[i][j], dp[i][j - 1] + abs(n - j - a[i + j - 1].second) * a[i + j - 1].first);
        }
    }
    int ans = 0;
    for (int i = 0; i <= n; i++) {
        ans = max(ans, dp[i][n - i]);
    }
    cout << ans;
}

Measured memory_bytes: 26288
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

vector<lol> ans;
lol n;

void dfs(lol num, lol bit){
  if(num > n){
    return;
  }
  if(bit == 7){
    ans.pu(num);
  }
  dfs(num * 10 + 3, (bit | (1 << 0)));
  dfs(num * 10 + 5, (bit | (1 << 1)));
  dfs(num * 10 + 7, (bit | (1 << 2)));
  return;
}
signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  cin >> n;
  dfs(0, 0);
  cout << ans.size() << '\n';
  return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-

n = input()
vote_t = 1
vote_a = 1
for i in range(n):
    t,a = map(int,raw_input().split())
    multiple_t = (vote_t+t-1) / t
    multiple_a = (vote_a+a-1) / a
    multiple = max(multiple_t,multiple_a)
    vote_t = t*multiple
    vote_a = a*multiple
print(vote_t + vote_a)
        
    

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


int main() {
    ll n;
    cin >> n;
    vector<ll> a(n, 0);
    map<ll, ll> m;
    rep1(i, n) cin >> a[i];
    rep1(i, n){
        if (m[a[i]]!=0){
            cout << "NO" << endl;
            return 0;
        }
        m[a[i]]++;
    }
    cout << "YES" << endl;
    //printf("%.12f", ans);
}

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

int main(int argc, char const *argv[])
{
  int a, b, c;
  cin >> a >> b >> c;
  int ans = 0;
  for(int i = a; i <= b; i++)
  {
    if(c%i == 0)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  sort(A.begin(),A.end());
  int count=1;
  for(int i=0;i<N-1;i++){
    if(A.at(i)!=A.at(i+1)){
      count++;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int v[100005],v1[100005],v2[100005];
int main(){
    int n,m;
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>v[i];
    int max1=0,f1=0,max2=0,f2=0;
    for(int i=1;i<=n;i+=2)
        v1[v[i]]++;
    for(int i=2;i<=n;i+=2)
        v2[v[i]]++;
    for(int i=1;i<=100000;i++){
        if(v1[i]>max1){
            max1=v1[i];
            f1=i;
        }
        if(v2[i]>max2){
            max2=v2[i];
            f2=i;
        }
    }
    sort(v1+1,v1+100000+1);
    sort(v2+1,v2+100000+1);

    if(f1==f2&&v1[100000]>v2[100000]){
        cout<<n-v1[100000]-v2[99999];
    }
    else if(f1==f2&&v1[100000]==v2[100000]){
        cout<<n-v1[100000]-max(v2[99999],v1[99999]);
    }
    else if(f1==f2&&v1[100000]<v2[100000]){
        cout<<n-v2[100000]-v1[99999];
    }
    else
        cout<<n-v1[100000]-v2[100000];
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>//cout << fixed << setprecision() <<
#include <set>
#include <map>
using ll = long long;
using namespace std;

double Mcos(double k){return cos(k*atan(1.0)*4/180);}
double Msin(double k){return sin(k*atan(1.0)*4/180);}

int main(void){
    int a,b;
    cin>>a>>b;
    for(int i=0;i<10000;i++){
        if(i/10==b && i*8/100==a){
            cout<<i;
            exit(0);
        }
    }
    cout<<"-1";
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

int m,n,a[N],ans;

int main() {
	qr(m);qr(n);
	for(int i=1;i<=n;i++) qr(a[i]),ans=max(ans,a[i]-a[i-1]);
	ans=max(ans,m-a[n]+a[1]);
	pr2(m-ans);
	return 0;
}



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

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


Measured memory_bytes: 3092
N = int(input())
h = list(map(int, input().split()))
hl = [h]
cnt = 0
while hl != []:
  h = hl.pop(0)
  z = [i for i, x in enumerate(h) if x == 0]
  #print(0, z)
  if z == []:
    h = [i-1 for i in h]
    cnt += 1
    if any(h) == True:
      #print(3, h)
      hl.append(h)
  else:
    #print(1, h[:z[0]], h[z[0]+1:])
    if h[:z[0]] != []:
      hl.append(h[:z[0]])
    if h[z[0]+1:] != []:
      hl.append(h[z[0]+1:])
  #print(2, cnt, h)

print(cnt)

Measured memory_bytes: 3064
N=gets.to_i
a=gets.chomp.split.map(&:to_i)
c1,c2,c4=0,0,0
a.each do |v|
  if v % 4 == 0
    c4 += 1
  elsif v % 2 == 0
    c2 += 1
  else
    c1 +=1
  end
end

if N.even?
  if c1 <= c4
    puts "Yes"
  else
    puts "No"
  end
else
  if (N/2+1==c1 && c1 == c4+1) || c1 <= c4
    puts "Yes"
  else
    puts "No"
  end
end

Measured memory_bytes: 9476
A,B=map(int,input().split())
if A%2:
    s1=((A+1)//2)%2
else:
    s1=((A//2)%2)^A
if B%2:
    s2=((B+1)//2)%2
else:
    s2=((B//2)%2)^B
print(s1^s2^A)

Measured memory_bytes: 9124
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

vector<ll>A;
int N;
int check(int mid) {
	ll sum = 0;
	for (int i = 0; i <= mid; i++)sum += A[i];
	for (int i = mid + 1; i < N; i++) {
		if(A[i] <= 2*sum)sum += A[i];
		else return 0;
	}
	return 1;
}

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


	cin >> N;
	A.resize(N);
	for (int i = 0; i < N; i++)cin >> A[i];
	sort(all(A));

	if (check(0)) {
		puts(N);
		return 0;
	}

	int ng = 0, ok = N-1;
	while (ok - ng > 1) {
		int mid = (ok + ng) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	puts(N - ok);


	return 0;
}

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

using namespace std;

typedef long long ll;

const int N = 1e5;
const int INF = 1e9;

ll dp[101][N + 1];

int main() {
    int n, m;
    cin >> n >> m;
    int v[n], w[n];
    for (int i = 0; i < n; i++)
        cin >> w[i] >> v[i];
    for (int i = 0; i <= n; i++)
        dp[i][0] = 0;
    for (int i = 0; i <= m; i++)
        dp[0][i] = 0;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            if (j - w[i - 1] >= 0)
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
            else
                dp[i][j] = dp[i - 1][j];
    cout << dp[n][m];
}



Measured memory_bytes: 79232
#include <iostream>

using namespace std;
int main()
{
    int a,b,c,d,N,M,H;
    cin>>a>>b>>c>>d;
    if(a>b)
        N=b;
        else
        N=a;
    if(c>d)
        M=d;
    else
        M=c;
    H=M+N;
    cout<<H;


	
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		int[] p = sc.nextIntArray(n);
		
		int res= 0;
		
		for(int i = 1; i < n-1; i++) {
			int[] a = {p[i],p[i-1],p[i+1]};
			Arrays.sort(a);

			if(a[1] == p[i]) {
				res++;
			}
		}
		
		out.println(res);
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
     }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 21332
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, min = 0;
    cin >> n;
    vector<char> s(n);
    for (int i = 0; i < n; ++i) {
        cin >> s.at(i);
        if (s.at(i) == 'E') ++min;
    }
    int now = min;
    for (int i = 0; i < n; ++i) {
        if (s.at(i) == 'W') ++now;
        if (s.at(i) == 'E') --now;
        if (min > now) min = now;
    }
    cout << min << endl;
    return 0;
}


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

int main(){
    long long  a=0,b=0,x=0;
    long long ans=0;

    cin>>a;
    cin>>b; 
    cin>>x;

    ans=(b/x)-(a/x);
    
    if(a%x==0)ans++;

    cout<<ans<<endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
#include <string>
#include <cmath>  //sqrt 
#include <iomanip> //setprecision
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define beg begin()
#define end end()


void _main(){
    int n; cin >> n;
    vector<int> backet(pow(10,5)+1,0);
    ll sum =0;
    rep(i,n){
        int a; cin >> a;
        sum += a;
        backet[a]++;
    }
    
    int q; cin >> q;
    rep(i,q){
        int b,c; cin >> b >> c;
        backet[c]+=backet[b];
        sum = sum + (c-b)*backet[b];
        backet[b]= 0;

        cout << sum << endl;
    }
    return;
}
int main() {
    cout << fixed << setprecision(10);
    _main();
    return 0;
}
    

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()

using namespace std;
signed main(){
  double a;
  cin>>a;
  double b;
  b=a/3;
  double c;
  c=b*b*b;
  cout<<fixed<<setprecision(10)<<c<<endl;
}

Measured memory_bytes: 256
using System;

public class hello
{

    public static void Main()
    {
        string[] s = Console.ReadLine().Trim().Split(' ');
        var x1 = double.Parse(s[0]);
        var y1 = double.Parse(s[1]);
        var x2 = double.Parse(s[2]);
        var y2 = double.Parse(s[3]);

        var buf = Math.Pow((y2 - y1), 2) + Math.Pow((x2 - x1), 2);
        var result = Math.Sqrt(buf);

        Console.WriteLine(result);
    }
}

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

int main(int argc, char **argv) {
  int A, B, C;
  cin >> A >> B >> C;

  int ans;
  if (A > B + C) {
    ans = 0;
  } else {
    ans = B + C - A;
  }

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
	int R[MAX], n;

	cin >> n;
	for (int i = 0; i < n; i++) cin >> R[i];

	int maxv = -2000000000;
	int minv = R[0];

	for (int i = 1; i < n; i++) {
		maxv = max(maxv, R[i] - minv);
		minv = min(minv, R[i]);
	}

	cout << maxv << endl;

	return 0;
}


Measured memory_bytes: 3852
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
#define MOD 1000000007
using namespace std;
using ll=int64_t;
using pii=pair<int,int>;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
//最大公約数
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
//最小公倍数
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
bool prime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)
        return false;
    }
    return true;
}
int main(){
    ll n; cin>>n;
    VI d(n);
    rep(i,n) cin>>d[i];
    sort(d.begin(),d.end());
    ll b=d.size()/2;
    if(d[b-1]==d[b]){
        cout<<"0"<<endl;
        return 0;
    }
    cout<<d[b]-d[b-1]<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define rep(i,n) for(ll (i)=0; i<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll h,a;cin>>h>>a;
  ll ans=h/a;
  if(h%a!=0) ans++;
  print(ans);
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include<functional>
#include<queue>
#include<regex>
#include<time.h>

using namespace std;


#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1050000000;


/*vectorの要素を全部確認するやつだよ。普通に拡張for文したほうがいいよ。

for (vector<int>::iterator itr = ans.begin(); itr != ans.end(); ++itr) {
	cout << *itr << " ";
}

*/


/*for文でx,yを上下左右確認するやつだよ。正直使いづらいよ。

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


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}

*/


/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}

*/


/*実行開始からの経過時間を表すよ。

while (clock() < 1900000) {  }

*/


/*まだ使えないテクニックのメモだよ。

for (int bit = 0; bit < (1<<n); ++bit)//bit全探索用のfor文だよ

*/


/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; ++i) {
	for (int j = 0; j < w; ++j) {

	}
}

*/

int main(){

	int n, l; cin >> n >> l;

	int a[205];

	int sum = 0;

	for (int i = 0; i < n; i++) {
		a[i] = i + l;
		sum += a[i];
	}

	int ans = INF;
	int x = INF;

	for (int i = 0; i < n; i++) {
		int c = 0;
		for (int j = 0; j < n; j++) {
			if (i == j) { continue; }
			c += a[j];
		}
		if (abs(sum - c) < ans) { ans = abs(sum - c); x = c; }
	}

	cout << x << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>   
#include <cmath>
using namespace std;
int main()
{
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    cout<<setiosflags(ios::fixed)<<setprecision(10)<<pow((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2),0.5)<<endl;
    return 0;
}


Measured memory_bytes: 3424
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  int N; cin >> N;
  vector<vector<int>> G(N);
  rep(i, N - 1) {
    int u, v; cin >> u >> v; u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  vector<int> par(N, -1);
  vector<int> dep(N);
  auto dfs = [&](auto dfs, int u, int p) -> void {
    for (int v : G[u]) if (v != p) {
      par[v] = u;
      dep[v] = dep[u] + 1;
      dfs(dfs, v, u);
    }
  };
  dfs(dfs, 0, -1);
  int M; cin >> M;
  vector<int> U(M), V(M);
  rep(i, M) cin >> U[i] >> V[i], U[i]--, V[i]--;
  ll ans = 0;
  vector<bool> used(N);
  rep(i, 1 << M) {
    int s = 1;
    fill(used.begin(), used.end(), false);
    rep(j, M) if (i >> j & 1) {
      s *= -1;
      int x = U[j];
      int y = V[j];
      while (x != y) {
        if (dep[x] > dep[y]) swap(x, y);
        used[y] = true;
        y = par[y];
      }
    }
    int cnt = count(used.begin(), used.end(), true);
    ll p = 1;
    rep(j, N - 1 - cnt) {
      p *= 2;
    }
    ans += p * s;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())
ans = a * x + b * y
other = min(x, y) * 2 * c
if x > y:
    other += (x - y) * a
else:
    other += (y - x) * b
other2 = max(x, y) * 2 * c
ans = min(ans, other, other2)
print(ans)


Measured memory_bytes: 3060
///#pragma GCC optimize ("O3")
///#include<bits/stdc++.h>
#include <iterator>
#include<algorithm>
#include<vector>
#include<complex>
#include<cmath>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<math.h>
#include<map>
#include<stack>
#include<sstream>
#include<queue>
#include<list>
#include<iomanip>
#include<bitset>
#include<limits.h>
#include <iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<set>
#include<math.h>
#include<map>
#include<stack>
#include<sstream>
#include<queue>
#include<list>
#include<iomanip>
#include<bitset>
#include<limits.h>
#include<map>
#include<sstream>
using namespace std;



/// Info.
///****************************************************************************************************************************************///
/// Coder               : BAHAA El_DEEN OSAMA SAYED.
/// Problem name        : A - Two Coins
/// Method              : IM
/// Date                : 1/3/2020
///****************************************************************************************************************************************///


#define rep0(i,x)         for(int i=0; i<x ;++i)
#define all(v)           ((v.begin()),((v.end())
#define mm(v,d)          memset(v,d,sizeof(v))
#define lp(i,v)          for(int i=0;i<sizeof(v);++i)
#define lpi(i,j,n)       for(int i=(j);i>=(int)n;++i)
#define lpd(i,j,n)       for(int i=(j);i>=(int)n;--i)
#define MP               make_pair
#define SZ(v)            ((int) ( (v).size() ) )
#define ull              unsigned long long
#define ll               long long
#define pi               3.1415926536
#define oo               1e9
#define OO               1e18
#define Fx(n)            fixed<<setprecision(n)
#define FasterIO           std::ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define RE0              return 0
#define RE1              return 1
#define mp(a,b)          make_pair(a,b)
#define X                first
#define Y                second
#define pii              pair(int a, int b)
#define rep1(i,x)        for(int i=1;i<x;++i)
#define rep2(i,x)        for(int i=2;i<x;++i)
#define RE               return
//#define LD               long double
#define all(v) ((v).begin()),((v).end())


const  int  N   = (int) 1e5+100;
const  int  M   = (int) 1e4+4;
const  int  INF = (int) 0x3f3f3f3f;
///const double ESP = 1e-7;
///const ll MOD=1e8+9;



int A=0,B=0,C=0;

void GalhO0O0O0O0O0M()
{
cin>>A>>B>>C;
(A+B>=C) ? cout <<"Yes" : cout<<"No";
}




int main()
{
FasterIO;
GalhO0O0O0O0O0M();
RE0;}


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

int main(){
  int n,m,a[1100],sum=0,cnt=0;
  cin>>n>>m;

  for(int i=0;i<n;i++){ cin>>a[i]; sum+=a[i]; }
  double j=(double)sum/(4*m);
  for(int i=0;i<n;i++){
    if(j<=a[i]) cnt++;
  }
  if(cnt>=m) cout<<"Yes";
  else cout<<"No";
}


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

int main()
{
	int i,j,k,len = 0,flag=0;
	char buf[1000] = { 0 };
	char stra[] = "apple", strp[] = "peach";
	
	fgets(buf, 1001,stdin);
	len = strlen(buf);
	//printf("%d ",len);

	for (i = 0; i < len - 1; i++)
	{
		if (buf[i] == 'p')
		{
			for (j = i + 1, k = 1; j < i + 5; j++, k++)
			{
				if (buf[j] != strp[k])
				{
					flag = 1;
					break;
				}
			}
			if (flag)
			{
				flag = 0;
			}
			else
			{
				for (j = i, k = 0; j < i + 5; j++, k++)
				{
					buf[j] = stra[k];

				}
			}
			continue;
		}

		if (buf[i] == 'a')
		{
			for (j = i + 1, k = 1; j < i + 5; j++, k++)
			{
				if (buf[j] != stra[k])
				{
					flag = 1;
					break;
				}
			}
			if (flag)
			{
				flag = 0;
			}
			else
			{
				for (j = i, k = 0; j < i + 5; j++, k++)
				{
					buf[j] = strp[k];

				}
			}
		}
	}

	printf("%s",buf);
	return 0;
}


Measured memory_bytes: 524
#include <set>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
string x = "22233344455566677778889999";
int n; string s;
int main() {
	while (cin >> n, n) {
		vector<string> b(n), r(n);
		for (int i = 0; i < n; i++) {
			cin >> b[i];
			for (int j = 0; j < b[i].size(); j++) r[i] += x[b[i][j] - 97];
		}
		cin >> s;
		vector<set<string> > dp(s.size() + 1);
		dp[0].insert("");
		for (int i = 1; i <= s.size(); i++) {
			for (int j = 0; j < n; j++) {
				if (i < b[j].size()) continue;
				if (s.substr(i - b[j].size(), b[j].size()) == r[j]) {
					if (i - b[j].size() == 0) dp[i].insert(b[j]);
					else {
						for (string k : dp[i - b[j].size()]) {
							dp[i].insert(k + " " + b[j]);
						}
					}
				}
			}
		}
		for (string k : dp[s.size()]) cout << k << "." << endl;
		cout << "--" << endl;
	}
	return 0;
}

Measured memory_bytes: 3136
let p = 1000000007

let pow a b =
  let rec f a b ret =
    if b = 0 then ret
    else if b mod 2 = 0 then f (a * a mod p) (b / 2) ret
    else f (a * a mod p) (b / 2) (ret * a mod p)
  in f a b 1

let mul s e =
  let rec f i ret =
    if i <= e then
      f (i+1) (ret * i mod p)
    else
      ret
  in f s 1

let fact n = mul 1 n

let nCr n r = mul (n-r+1) n * pow (fact r) (p-2) mod p

let ans x y =
  let sum = x + y in
  if sum mod 3 != 0 then 0
  else
    let m = (2*x-y)/3
    and n = (-x+2*y)/3
    in
    if n < 0 || m < 0 then 0
    else nCr (n+m) n
;;
Scanf.scanf "%d %d" (fun x y -> print_int (ans x y))


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

int main(){
	ll n,a,b;
	cin>>n>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%n==0){
			cout<<"OK"<<endl;
			return 0;
		}
	}
	cout<<"NG"<<endl;
	return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);
  int p[n], cnt = 0;
  for (size_t i = 0; i < n; i++) {
    scanf("%d", p+i);
  }
  for (size_t i = 0; i < n; i++) {
    if (p[i] != i+1) {
      cnt++;
    }
  }
  if (cnt <= 2) {
    printf("YES\n");
  }else {
    printf("NO\n");
  }
  return 0;
}


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

using namespace std;

int main(void) {
  int n, l;

  scanf("%d %d", &n, &l);
  vector<string> s(n);

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

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

  for(int i = 0; i < n; i++) {
    cout << s[i];
  }

  printf("\n");
  return 0;
}

Measured memory_bytes: 256
A = list()
for i in range(3):
    A.append(list(map(int, input().split())))

n = int(input())
bs = [int(input()) for i in range(n)]

bingo = [[False for i in range(3)] for j in range(3)]

def hit(b):
    for i in range(3):
        for j in range(3):
            if A[i][j] == b:
                return (i, j)
    return None
for b in bs:
    ret = hit(b)                
    if ret is None:
        continue
    else:
        bingo[ret[0]][ret[1]] = True

def detect():
    for i in range(3):
        if all(bingo[i]):
            return True
    
    for j in range(3):
        if all([bingo[i][j] for i in range(3)]):
            return True
    
    if bingo[0][0] and bingo[1][1] and bingo[2][2]:
        return True

    if bingo[2][0] and bingo[1][1] and bingo[0][2]:
        return True

    return False

if detect():
    print('Yes')
else:
    print('No')


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

int main()
{
  int n;
  cin >> n;
  int mx = 0;
  map<string, int> ms;
  for(int i = 0; i < n; i++) {
    string s;
    cin >> s;
    ms[s]++;
    mx = max(mx, ms[s]);
  }
  for (auto m : ms) {
    if (m.second == mx) {
      cout << m.first << endl;
    }
  }
}


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

class Card{
    public:
        char mark;
        int value;
};

void bubbleSort(int N, Card *A){
    for(int i=0; i<N; i++){
        for(int j=N-1; j>=i+1; j--){
            if(A[j-1].value > A[j].value){
                swap(A[j], A[j-1]);
            }
        }
    }
}

void selectionSort(int N, Card *A){
    for(int i=0; i<N; i++){
        int minj=i;
        for(int j=i; j<N; j++){
            if(A[minj].value > A[j].value)minj=j;
        }
        swap(A[i], A[minj]);
    }
}

bool isStable(int N, Card *in, Card *out){
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N; j++){
            for(int k=0; k<N; k++){
                for(int l=k+1; l<N; l++){
                    if(in[i].value==in[j].value
                        && in[i].mark==out[l].mark && in[i].value==out[l].value
                        && in[j].mark==out[k].mark && in[j].value==out[k].value
                    )
                        return false;
                    
                }
            }
        }
    }
    return true;
}

int main(){

    int N;
    cin >> N;

    Card in[N], outBub[N], outSel[N];
    for(int i=0; i!=N; i++){
        cin >> in[i].mark >> in[i].value;
        outBub[i]=outSel[i]=in[i];
        }
    
    bubbleSort(N, outBub);
    for(int i=0; i!=N; i++){
        cout << outBub[i].mark << outBub[i].value;
        if(i!=N-1)cout << " ";
    }
    cout << endl;

    cout << (isStable(N, in, outBub) ? "Stable" : "Not stable") << endl;

    selectionSort(N, outSel);
    for(int i=0; i!=N; i++){
        cout << outSel[i].mark << outSel[i].value;
        if(i!=N-1)cout << " ";
    }
    cout << endl;

    cout << (isStable(N, in, outSel) ? "Stable" : "Not stable") << endl;
    
    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::pair;

using std::vector;
using std::sort;

inline long f(long a,long b){
    long m=a*b;
    long sq=(long)sqrt(m);
    if(sq*sq==m){
        if(sq==a){
            return 2*(sq-1);
        }
        else{
            return 2*(sq-1)-1;
        }
    }
    else if(sq*(sq+1)<m){
        return 2*sq-1;
    }
    else{
        return 2*(sq-1);
    }
}

int main(){
    int Q;
    cin >> Q;
    for(int q=0;q<Q;q++){
        long a,b;
        cin >> a >> b;
        cout << f(a,b) << endl << std::flush;
    }
    return 0;
}



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

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	while(1)
	{
		c-=b;
		if(c<=0){
			cout<<"Yes"<<endl;
			return 0;
		}	
		else
		{
			a-=d;
			if(a<=0){
				cout<<"No"<<endl;
				return 0;	
			}
		}
	}
}

Measured memory_bytes: 3636
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int X = in.nextInt();

            int temp = X % 100;
            int count = 0;
            for (int i = 5; i > 0; i--) {
                if (temp / i > 0) {
                    count += temp / i;
                    temp %= i;
                }
            }
            int ret = (count <= X / 100) ? 1 : 0;
            out.println(ret);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22100
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			int sum = 0;
			int size;
			int weight;
			for(int i = 0;i < n;i++){
				size = scan.nextInt() + scan.nextInt() + scan.nextInt();
				weight = scan.nextInt();
				if(size <= 60 && weight <= 2){
					sum += 600;
				}else if(size <= 80 && weight <= 5){
					sum += 800;
				}else if(size <= 100 && weight <= 10){
					sum += 1000;
				}else if(size <= 120 && weight <= 15){
					sum += 1200;
				}else if(size <= 140 && weight <= 20){
					sum += 1400;
				}else if(size <= 160 && weight <= 25){
					sum += 1600;
				}
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 56608
#include<stdio.h>
#include<math.h>
int main()
{
    long long int a,b,p,l;
    int i;
    scanf("%lld %lld",&a,&b);
    if(b>a)
    {
        for(i=a;i<=b;i++)
            {p=fabs(a-i);
            l=fabs(b-i);
                if(p==l)
                   break;
        }
          if(p==l)
                printf("%d\n",i);
              else
             printf("IMPOSSIBLE\n");
            
        }
        else if(a>b)
    {
        for(i=b;i<=a;i++)
            {p=fabs(b-i);
            l=fabs(a-i);
             if(p==l)
        break;
        }
                if(p==l)
                    printf("%d\n",i);
                
             else
            printf("IMPOSSIBLE\n");
        }

return 0;}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N, W; cin >> N >> W;
  vector<ll> w(N), v(N);
  rep(i, N) cin >> w[i] >> v[i];

  vector<vector<ll>> dp(N + 10, vector<ll>(W + 10, -INF));
  rep(i, W + 10) dp[0][i] = 0;
  for (int i = 0; i < N; ++i){
    for (int j = 0; j <= W; ++j){
      chmax(dp[i + 1][j], dp[i][j]);
      if (j - w[i] >= 0) chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
    }
  }
  cout << dp[N][W] << endl;
}


Measured memory_bytes: 87296
#include <bits/stdc++.h>
using namespace std;
void Main();

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;

template <class T> using Vec = vector<T>;

/* 定数 */
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define ALL(v) v.begin(), v.end()

#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u64 N;
    u64 A, B;
    cin >> N >> A >> B;
    u64 l = N / (A + B);
    u64 blue = l * A;
    u64 r = N % (A + B);
    blue += (A < r)? A : r;
    cout << blue << endl;
}


Measured memory_bytes: 256