akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

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

	int y = b - a;
	if (y <= 0) {
		cout << "delicious" << endl;
	} else if (y <= x) {
		cout << "safe" << endl;
	} else {
		cout << "dangerous" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int x[100][100];
    int y[100];
    int n, m;
    int j, q;
    int c = 0;
    
    
    scanf("%d %d", &n, &m);
    for(j = 0; j < n; j++){
        for(q = 0; q < m; q++){
            scanf(" %d", &x[j][q]);
            //printf("%d\n", x[j][q]);
        }
    }
    for(j = 0; j < m; j++){
        scanf(" %d", &y[j]);
    }
    
    for(j = 0; j < n; j++){
        for(q = 0; q < m; q++){
            c += x[j][q] * y[q];
        }
        printf("%d\n", c);
        c = 0;
    }
    return 0;
}



Measured memory_bytes: 2140
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) cout<<"Case #"<<i<<": "
using namespace std;
typedef long long int ll;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 4e18;



int main() {
	int n; scanf("%d", &n);
	vector<int> a(n); vector<pair<int, int>> ans;
	rep(i, 0, n) scanf("%d", &a[i]);
	int maxx = *max_element(a.begin(), a.end());
	int mini = *min_element(a.begin(), a.end());
	if (maxx > -mini) {
		int maxitr = max_element(a.begin(), a.end()) - a.begin();
		rep(i, 1, n+1) {
			if (i != maxitr+1) ans.push_back({ maxitr+1,i });
		}
		rep(i, 1, n) {
			ans.push_back({ i,i + 1 });
		}
	}
	else {
		int minitr = min_element(a.begin(), a.end()) - a.begin();
		rep(i, 1, n+1) {
			if (i != minitr+1) ans.push_back({ minitr+1,i });
		}
		rep(i, 1, n) {
			ans.push_back({ n+1-i,n-i });
		}
	}
	printf("%d\n", ans.size());
	rep(i, 0, ans.size()) {
		printf("%d %d\n", ans[i].first, ans[i].second);
	}
	return 0;
}

Measured memory_bytes: 256
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, m, h[MAXN];
vector<int> a[MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) cin >> h[i];
    FOR(i,1,m) {
        int u, v;
        cin >> u >> v;
        a[u].push_back(v);
        a[v].push_back(u);
    }
    int res = 0;
    FOR(u,1,n) {
        bool co = true;
        for (int v : a[u])
            if (h[v] >= h[u]) co = false;
        res += co;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 9140
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
			　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <iostream>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <algorithm>
#include <memory>
#include <iomanip>

#define rep(i, n) for(Int (i) = 0; (i) < (n); ++(i))
#define debug(var) std::cout << #var << ": " << var << "\n"
using Int = int64_t;


void calc() {

	std::string S; std::cin >> S;
	if (S[2] == S[3] && S[4] == S[5])std::cout << "Yes";
	else std::cout << "No";

}


int main() {

	calc();

	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
import itertools

def solve(S: str):
    N = len(S) 
    answer = [0]*N
    R_count = 0
    for i in range(N):
        if S[i]== "L":
            answer[i]+= R_count//2
            answer[i-1]+=(R_count+1)//2
            R_count = 0
        else:
            R_count+=1
    
    L_count = 0
    for i in range(N-1,-1,-1):
        if S[i]=="R":
            answer[i]+=L_count//2
            answer[i+1]+=(L_count+1)//2
            L_count=0
        else:
            L_count+=1
    
    print(*answer)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 6528
def bubbleSort(A, N):
    c = 0
    flag = 1
    i = 0
    while flag:
        flag = 0
        for j in range(N - 1, i, -1):
            if A[j] < A[j - 1]:
                tmp = A[j]
                A[j] = A[j - 1]
                A[j - 1] = tmp
                flag = 1
                c += 1
        i += 1
    return c

n = int(input())
A = list(map(int, input().split()))
c = bubbleSort(A, n)
for i in range(n):
    if i == n - 1:
        print(A[i])
    else:
        print(A[i], end=' ')
print(c)


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    a[t - 1] = i + 1;
  }
  for (int i = 0; i < n; ++i) {
    cout << a[i];
    if (i == n - 1)
      cout << endl;
    else
      cout << " ";
  }
  return 0;
}


Measured memory_bytes: 1152
#ABC_049_C_Daydream.py
S = input()
Srev = S[::-1]
# List=["dream","dreamer","erase","eraser"]
Listrev = ["maerd", "remaerd", "esare", "resare"]
can = True
while can == True:
	if Srev == "":
		break
	can = False
	for i in range(4):
		rev=Listrev[i]
		length = len(rev)
		if Srev[0:length] == rev:
			can = True
			Srev=Srev[length:]
if can == True:
	print("YES")
else:
	print("NO")


Measured memory_bytes: 79576
N, M = map(int, input().split())
a = [0] * N
for _ in range(M):
    a[int(input())-1] = '!'

for i in range(N):
    if i == 0:
        if a[i] != '!':
            a[i] = 1
        else:
            a[i] = 0
    elif i == 1:
        if a[i] != '!':
            a[i] = a[i-1] + 1
        else:
            a[i] = 0
    else:
        if a[i] != '!':
            a[i] = (a[i-1] + a[i-2]) % 1000000007
        else:
            a[i] = 0

print(a[N-1] % 1000000007)


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

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

    long long x = 0;
    for (int i = 1; i <= k; i++){
        x = (x * 10) % k;
        x = (x + 7) % k;

        if (x == 0){
            cout << i << '\n';
            return 0;
        }
    }

    cout << -1 << '\n';

    return 0;
}


Measured memory_bytes: 3640
import math
N = int(input())
X = list(map(int,input().split()))
ave_h=math.ceil(sum(X)/N)
ave_l=math.floor(sum(X)/N)
count_1=0
count_2=0
for i in range(N):
    count_1+=(X[i]-ave_h)**2
    count_2+=(X[i]-ave_l)**2
print(min(count_1,count_2))

Measured memory_bytes: 3064
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_056_A.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(3).
    01 a      PIC X(1).
    01 b      PIC X(1).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO a b.

    IF a = 'H' THEN
        DISPLAY b
    ELSE
        IF b = 'H' THEN
            DISPLAY 'D'
        ELSE
            DISPLAY 'H'
        END-IF
    END-IF.

    STOP RUN.


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

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

        int[][] dp = new int[s.length()+1][t.length()+1];
        for(int row = 0 ; row <= s.length() ; row++) {
            dp[row][0] = 0;
        }
        for(int col = 0 ; col <= t.length() ; col++) {
            dp[0][col] = 0;
        }
        for(int row = 1 ; row <= s.length() ; row++) {
            for(int col = 1 ; col <= t.length() ; col++) {
                if(s.charAt(row-1) == t.charAt(col-1)){
                    dp[row][col] = dp[row-1][col-1]+1;
                } else {
                    dp[row][col] = Math.max(dp[row-1][col], dp[row][col-1]);
                }
            }
        }
        StringBuilder sb = new StringBuilder();
        int row = s.length();
        int col = t.length();
        for( ; row > 0 && col > 0;) {
            if(dp[row][col] == dp[row-1][col]){
                row--;
            } else if(dp[row][col] == dp[row][col-1]){
                col--;
            } else {
                sb.append(s.charAt(row-1));
                row--;
                col--;
            }
        }
        System.out.println(sb.reverse().toString());
    }
}


Measured memory_bytes: 85800
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N;
  cin>>N;
  
  vector<ll>a(N);
  vector<ll>ans(N);
  
  rep(i,N){
    cin>>a[i];
  }
  
  ll sum=1;
  
  ll sum2=0;

  if(N%2==0){
    for(ll i=0;i<N;i++){ 
      if(N-1-i*2>0){
      ans[i]=a[N-1-i*2];
      }
else if(N-i*2==0){
  ans[i]=a[0];
}
      else{
        if(sum*2<=N-1){
        ans[i]=a[0+sum*2];
        sum++;
        }
      }
    }
    }

  else{
rep(i,N){
  if(N-1-i*2>1){
      ans[i]=a[N-1-i*2];
      }
else if(N-i*2==1){
  ans[i]=a[0];
}
      else{
        if(sum2*2<=N){
        ans[i]=a[1+sum2*2];
        sum2++;
        }
      }
  
}
  }

      rep(i,N){
cout<<ans[i]<<" ";
      }
  cout<<endl;
      
    }
    
    

    

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

int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  double ans_upp = 1;
  double ans_down = 0;
  double part_sum = 1;
  for(int i=0;i<N;i++){
    part_sum = 1;
    for(int j=0;j<N;j++){
      if(j!=i){
        part_sum *= A[j];
      }
    }
    ans_down += part_sum;
    ans_upp *= A[i];
  }
  double ans = ans_upp/ans_down;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
#include <assert.h>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;

// typedef long long ll;
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


void Main(){
    ll N, A, B;
    cin >> N >> A >> B;
    mint n = N;
    mint a = A;
    mint b = B;
    mint total = 2;
    total = total.pow(N);
    mint comb_na = 1;
    mint comb_na_denom = 1;
    mint comb_nb = 1;
    mint comb_nb_denom = 1;

    for(ll i=0;i<A;i++){
        comb_na *= n-i;
        comb_na_denom *= (i+1);
    }
    comb_na /= comb_na_denom;
    for(ll i=0;i<B;i++){
        comb_nb *= n-i;
        comb_nb_denom *= (i+1);
    }
    comb_nb /= comb_nb_denom;
    cout << total - comb_na - comb_nb - 1 <<endl;

    

}

int main(){
    Main();
}

Measured memory_bytes: 3200
#include <iostream>
using namespace std;
bool call(int x) {
    bool ret = false;
    if (x%3==0) ret = true;
    else {
        while(x) {
            if (x%10==3){
                ret = true;
                break;
            }
            x/=10;
        }
    }
    return ret;
}
int main() {
    int n,i,x;
    cin>>n;
    for (i=1;i<=n;i++) {
        if (call(i)) cout << " " << i;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
// #define vec(v) vector<int>(v)
// #define be(v) (v).begin(), (v).end()
// #define pb(q) push_back(q)
// #define mapci(mp) map<char*,int>(mp)
// #define mapcc(mp) map<char*,char*>(mp)
// typedef long long ll;
using namespace std;

int main(){

    int x,a;
    cin>>x>>a;
    if(x<a) cout<<0<<endl;
    else    cout<<10<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <limits.h>

using namespace std;

int N;
int F[100][10];
int P[100][11];

int main(){
    long long max = LLONG_MIN;
    cin >> N;
    for(int i=0;i<N;i++){
        for(int j=0;j<10;j++){
            cin >> F[i][j];
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<11;j++){
            cin >> P[i][j];
        }
    }
    int count;
    long long m;
    for(int i=1;i<1024;i++){
        bitset<10> bs(i);
        m = 0;
        for(int j=0;j<N;j++){
            count = 0;
            for(int k=0;k<10;k++){
                if(bs[k] && F[j][k]==1) count++;
            }
            m += P[j][count];
        }
        if(m > max) max = m;
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
using namespace std;
int main(void){
    string S,T;
    cin >> S >> T;
    char s;
    if(S == T){
        cout << "Yes" << endl; 
        return 0;
    }
    for(int i = 0; i < S.size(); i++){
        s = S[0];
        for(int j = 0; j < S.size()-1; j++){
            S[j] = S[j+1];
        }
        S[S.size()-1] = s;
        if(S == T){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <climits>

using namespace std;

typedef signed long long ll;

int main(void)
{
    int N = 5;
    int count = 0;

    cin >> N;

    vector<int> A(N, 0);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    for (int i = 0, flg = 1; flg; i++)
    {
        flg = 0;
        for (int j = N - 1; j > i; j--)
        {
            if (A[j - 1] > A[j])
            {
                swap(A[j - 1], A[j]);
                count++;
                flg = 1;
            }
        }
    }

    for (int i = 0; i < N; i++)
    {
        if (i > 0)
        {
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int ans = 0;
	rep(i, n - 1) {
		if (a[i] == a[i + 1]) {
			ans++;
			i++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"
#define fcout cout << fixed << setprecision(18)

#define MOD 1000000007 // 1e9+7
#define PI 3.1415926535
/*
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
*/
#define ll long long int // 10^18
#define INF 1000000001 // 1e9+1
#define LINF 1000000000000000001 // 1e18+1

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;cin>>n;
  if(n%2==0) {
    P(n);
  }else{
    P(2*n);
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int x,a,b;
	cin >> x >> a >> b;
	if(a >= b){
		cout << "delicious" <<endl;
	}
	else if(a+x >=b){
		cout << "safe" <<endl;
	}
	else{
		cout <<"dangerous" <<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, m;
vector<i64> a;
int main() {
  cin >> n >> m;
  priority_queue<i64> pq;
  for (i64 i = 0; i < n; ++i) {
    i64 x;
    cin >> x;
    pq.push(x);
  }
  for (i64 i = 0; i < m; ++i) {
    i64 x = pq.top();
    pq.pop();
    pq.push(x / 2);
  }
  i64 ans = 0;
  while (!pq.empty()) {
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	int H, W;
	while (true){
		cin >> H >> W;
		if (H != 0 && W != 0) {
			for (int i=0; i<H; i++){
				for (int j=0; j<W; j++){
					cout << '#';
				}
				cout << endl;
			}
			cout << endl;
		}
		else
			break; 
	}
	return 0;
}


Measured memory_bytes: 3076
S = input()
T = input()
len_s = len(S)
len_t = len(T)

ans = 0
for i in range(len_s-len_t+1):
    c = 0
    for j in range(len_t):
        if S[i+j] == T[j]:
            c += 1
    ans = max(ans,c)
print(len_t-ans)

Measured memory_bytes: 9056
def fizzbuzz(n):
	if n%15==0: return "FizzBuzz"
	if n%5==0: return "Buzz"
	if n%3==0: return "Fizz"
	return str(n)
while 1:
	try:
		m,n=map(int,raw_input().split())
		if m==0:break
		player=range(1,m+1)
		p=0
		for i in range(n):
			if fizzbuzz(i+1)!=raw_input():
				del player[p]
				if len(player)==1:
					break
				p%=len(player)
			else:
				p=(p+1)%len(player)
		print " ".join(map(str,player))
	except:
		pass

Measured memory_bytes: 4564
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int n=sc.I;
		int[] a=sc.Ia2;
		int l=sc.I;
		int[] tr=new int[n+1];
		int[] kr=new int[n+1];
		int m=n,t=0,b=0;
		for(int i = n-1;i>0;i--) {
			while(a[m]-a[i]>l){m--;}
			tr[i]=m;
			kr[i]=kr[m]+1;
			t=Math.Max(t,kr[i]);
		}
		m=1;
		while(m<t){m<<=1;b++;}
		if(b==0){b=1;}
		int[][] h=new int[b][];
		h[0]=new int[n+1];
		for(int j = 0;j<=n;j++) {h[0][j]=tr[j];}
		h[0][n]=n;
		for(int i = 1;i<b;i++) {
			h[i]=new int[n+1];
			for(int j = 0;j<=n;j++) {
				h[i][j]=h[i-1][h[i-1][j]];
			}
		}
		int q=sc.I;
		int[] ans=new int[q];
		for(int i = 0;i<q;i++) {
			int[] e=sc.Ia;
			if(e[0]>e[1]){e[0]^=e[1];e[1]^=e[0];e[0]^=e[1];}
			int p=e[0],r=b-1;
			while(ans[i]==0){
				for(;r>=0;r--) {
					if(h[r][p]==e[1]){
						ans[i]=kr[e[0]]-kr[e[1]];
						break;
					}
					else if(h[r][p]<e[1]){
						p=h[r][p];
						r--;
						break;
					}
				}
				if(r==-1){
					ans[i]=kr[e[0]]-kr[h[0][p]];
					break;
				}
			}
		}
		Console.WriteLine("{0}",String.Join("\n",ans));
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}


Measured memory_bytes: 31764
#include <stdio.h>
#include <string.h>
#include <math.h>

int sosu(int n){
	int i;
	if(n<=1)return 0;;
	for(i=2; i<=sqrt(n); i++){
		if(n%i==0)return 0;
	}
	return 1;
}

int main(){
	int n,i;
	int ans;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		ans=0;
		for(i=n+1; i<=n*2; i++){
			if(sosu(i))ans++;
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 600
def resolve():
    N,M = map(int,input().split())
    H = list(map(int,input().split()))
    connections=[[] for i in range(N)]
    for _ in range(M):
        A,B = map(int,input().split())
        connections[A-1].append(B-1)
        connections[B-1].append(A-1)
    ans = 0
    for num,con in enumerate(connections):
        my_height = H[num]
        for nei in con:
            if my_height <= H[nei]:
                break
        else:
            ans+=1
    print(ans)





if __name__ == "__main__":
    resolve()

Measured memory_bytes: 29440
#include <stdio.h>

int main() {
  long long int times, number_n, temp = 0;
  scanf("%lld %lld", &times, &number_n);
  if(number_n == 100) {
    temp = 1;
  }
  if(times == 0) {
    printf("%lld\n", temp + number_n);
  } else if(times == 1) {
    printf("%lld\n", (temp + number_n) * 100);
  } else if(times == 2) {
    printf("%lld\n", (temp + number_n) * 10000);
  }
  return 0;
}


Measured memory_bytes: 128
x, y = gets.split.map(&:to_i)
l = []

a, b = x, y
l << b - a if b >= a

a, b = -x, y
l << b- a + 1 if b >= a

a, b = x, -y
l << b - a + 1 if b >= a

a, b = -x, -y
l << b - a + 2 if b >= a

puts l.min

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

public class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		while(true){
			int n = in.nextInt();
			if(n==0) return ;
			int xs[] = new int[n], ys[] = new int[n], fs[] = new int[n];
			for(int i=0; i<n; i++){
				xs[i] = in.nextInt();
				ys[i] = in.nextInt();
				fs[i] = 0;
			}
			int cx = 10, cy = 10;
			int m = in.nextInt();
			for(int i=0; i<m; i++){
				String d = in.next();
				int dis = in.nextInt();
				for(int j=0; j<dis; j++){
					if(d.equals("N")) cy+=1;
					else if(d.equals("S")) cy-=1;
					else if(d.equals("E")) cx+=1;
					else if(d.equals("W")) cx-=1;
					for(int k=0; k<n; k++){
						if(xs[k] == cx && ys[k] == cy){
							fs[k] = 1;
						}
					}
				}
			}
			int cnt=0;
			for(int i=0; i<n; i++){
				cnt += fs[i];
			}
			System.out.println((cnt==n)?"Yes":"No");
		}
	}
}

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

int main()
{
  int i, n, cnt = 1;
  cin >> n;
  int a[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  i = 1;
  while (cnt <= n) {
    if (a[i] == 2) {
      cout << cnt << endl;
      return 0;
    }
    i = a[i];
    cnt++;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 2e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

void solve() {
    int n;
    cin >> n;
    double a[n];
    double sum = 1;
    REP(i,n) {
        cin >> a[i];
        sum *= a[i];
    }
    double ss = 0;
    REP(i,n) {
        ss += sum / a[i];
    }
    cout << setprecision(20) << sum / ss << endl;
}

int main(int argc, char *argv[]){
    // /* Regular */
    // int case_num = 1;
    // if (argc > 1 && stoi(argv[1])) cin >> case_num;
    // REP(case_no, case_num) {
    //   cerr << endl << "case " << case_no + 1 << endl;
    //   solve();
    // }
    /* AOJ */
    solve();
    return 0;
}

Measured memory_bytes: 256
//This is getting accepted!
// I HATE BUG
// God Of The Bugs
// 12/11/2016
#include<bits/stdc++.h>

using namespace std;

#define ms(s, n) memset(s, n, sizeof(s))
#define FI first
#define SE second
#define pb push_back
#define mp make_pair
#define ll long long
#define sz(a) ((int)(a).size())
#define __builtin_popcount __builtin_popcounll
#define ld long double

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> ppi;

const double PI = acos(0) * 2;
const double EPS = 1e-8;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 5;
const int oo = 1e9;
const double foo = 1e30;

template<class T> int getbit(T s, int i) { return (s >> i) & 1; }
template<class T> T onbit(T s, int i) { return s | (T(1) << i); }
template<class T> T offbit(T s, int i) { return s & (~(T(1) << i)); }
template<class T> int cntbit(T s) { return __builtin_popcounll(s);}
template<class T> T sqr(T x) { return x * x; }

inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}

int n, a[MAXN], has[MAXN];

int main() {
//#ifndef ONLINE_JUDGE
//    freopen("inp.txt", "r", stdin);
////    freopen("out.txt", "w", stdout);
//#endif

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

	int tot = 0, pre = -1;
	for (int i=1; i<n; i++) {
		if (has[i] > 0) {
			tot++;
			if ((~pre && pre != i - 1) || tot >= 3) {
				cout << "No";
				return 0;
			}
			pre = i;
		}
	}
	assert(tot < 3);
	int ok = 1;
	
	int find = -1;
	for (int i=1; i<n; i++) {
		if (has[i] > 0) {
			find = i;
			break;
		}
	}
	
	if (tot == 2) {
		int rem = n - has[find];
		int gg = find + 1 - has[find];
		if (rem / 2 < gg) ok = 0;
		if (gg <= 0) ok = 0;
		if (find + 2 == n && has[find + 1] > 2) ok = 0;
	}
	else {
		if (find == n - 1) {
			
		}
		else
		if (n / 2 < find) ok = 0;
	}
	
	if (ok) puts("Yes");
	else puts("No");
	
	return 0;
}


Measured memory_bytes: 1024
N, K = map(int, input().split())
L = list(input())
L.insert(0, '')
L.append('')
num = 0
for n in range(1, N+1):
    if L[n] == 'L' and L[n - 1] == 'L':
        num += 1
    if L[n] == 'R' and L[n + 1] == 'R':
        num += 1
ans = min(num + K * 2, N - 1)
print(str(ans))

Measured memory_bytes: 4084
#include <algorithm>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
    ll N, M;
    ll ans = 0;

    cin >> N >> M;

    UnionFind tree(N + 1);

    for(ll i = 0; i < M; i++){
        ll X, Y, Z;
        cin >> X >> Y >> Z;

        tree.unite(X, Y);
    }

    for(ll i = 1; i < N + 1; i++){
        if(tree.par[i] == i){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i>=(a); i--)

vector<vector<vector<double>>> mem;

double dp(ll n, ll ones, ll twos, ll thres) {
	if (mem[ones][twos][thres] != -1) {
		return mem[ones][twos][thres];
	}
	if (ones == 0 && twos == 0 && thres == 0) {
		mem[0][0][0] = 0;
		return 0;
	}
	double ges = n;
	ll zero = n - ones - twos - thres;

	double p0 = zero / ges, p1 = ones / ges, p2 = twos / ges, p3 = thres / ges;

	double erg = 0;
	if (ones > 0) {
		erg = erg + p1 * (1 + dp(n, ones - 1, twos, thres));
	}
	if (twos > 0) {
		erg = erg + p2 * (1 + dp(n, ones + 1, twos - 1, thres));
	}
	if (thres > 0) {
		erg = erg + p3 * (1 + dp(n, ones, twos + 1, thres - 1));
	}
	if (zero != 0) {
		erg = erg + p0;
		erg = erg / (1 - p0);
	}

	mem[ones][twos][thres] = erg;

	return erg;
}


int main() {
	ios::sync_with_stdio(false);

	ll n; cin >> n;

	vl a(n);
	vl x(4,0);

	mem.assign(n+1, vector<vector<double>>(n+1,
					vector<double>(n+1, -1.0)));

	FOR(i,0,n) {
		cin >> a[i];
		x[a[i]]++;
	}

	cout << fixed << setprecision(10) << dp(n, x[1], x[2], x[3]) << endl;
	return 0;
}


Measured memory_bytes: 219008
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}


int main() {
    int N; cin >> N; 
    vel x(N), y(N); rep(i,N) cin >> x[i] >> y[i];

    map<l_l, int> mp;
    rep(i,N) repk(j,i+1,N) {
        if(i == j) continue;
        ll p = x[i] - x[j];
        ll q = y[i] - y[j];
        if (p < 0) {
            p *= -1;
            q *= -1;
        }
        else if (p == 0 and q < 0) q *= -1;
        mp[make_pair(p, q)]++;
    }
    int mx = 0;
   for (auto i: mp) mx = max(mx, i.sc);
   cout << N - mx << endl;
   return 0;
}


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

using namespace std;
typedef long long ll;

const ll MAX = (ll)1e5 + 55;
vector<ll> g[MAX];
vector<ll> in[MAX];
vector<ll> path(MAX, 0);
vector<ll> dp(MAX, -1);

ll func(ll node)
{
    if (dp[node] != -1)
    {
        return dp[node];
    }
    ll d = 0;
    for (auto x : g[node])
    {
        d = max(d, 1 + func(x));
    }
    dp[node] = d;
    return dp[node];
}

int main()
{
    ll n, m;
    cin >> n >> m;
    for (int x = 0; x < m; x++)
    {
        ll a, b;
        cin >> a >> b;
        g[a].push_back(b);
        in[b].push_back(a);
    }

    for (int x = 1; x <= n; x++)
    {
        if (in[x].size() == 0)
        {
            func(x);
        }
    }
    ll ans = 0;
    for (int x = 1; x <= n; x++)
    {
        ans = max(ans, dp[x]);
    }
    cout << ans << endl;
}

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

int n, m, k;

int main() {
  cin >> n >> m >> k;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= m; ++j) {
      int now = m * i;
      now += j * (n - 2 * i);
      if (now == k) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n;
ll M=1e5+1;

//bit全探索
vi bt;
void setbit(ll i){
  bt.clear();
  for(ll tmp=0;i>0;i/=2){
    if (i%2==1) bt.push_back(tmp);
    tmp++;
  }
}




int main(){
  ll ans=0,q;
  cin >>n;
  n++;
  ll nlg=ceil(log2(n));
  vi V(n),W(n);
  REP(i,n-1) cin>>V[i+1]>>W[i+1];

  cin >>q;
  vi u(q),L(q);
  REP(i,q) cin>>u[i]>>L[i];

  //上半分
  ll nhi=nlg-(nlg/2);
  if (nhi==9)nhi=10;
  vvi data(1LL<<nhi, vi(M));  // N * M の2次元配列

  for(ll i=1;i<(1LL<<nhi);i++){
    for(ll j=0;j<M;j++){
      if ((j-W[i])>=0)
      {
        data[i][j]=max(data[i/2][j-W[i]]+V[i],data[i/2][j]);
      }
      else
      {
        data[i][j]=data[i/2][j];
      }
    }
  }


int uiv[10];
int wuiv=0;


//下半分
for(ll loop=0;loop<q;loop++){
  ll uidx=u[loop];
  if (uidx<(1LL<<nhi)){
    cout<<data[uidx][L[loop]]<<endl;
  }else{//上＋下
    ll maxval=0;
    //vi uiv;
    int nn=0;
    wuiv=0;
    for(;;uidx/=2){
      if (uidx<(1LL<<nhi))break;
      uiv[wuiv]=uidx;
      wuiv++;
      nn++;
    }

    int bn=1<<nn;
    for(int i=0;i<bn;i++){
      //setbit(i);
      ll tmpw=0;
      ll tmpv=0;
      for(int j=0;j<nn;j++){
        if (i&(1<<j)){
          tmpv+=V[uiv[j]];
          tmpw+=W[uiv[j]];
        }
      }
      //for (auto j : bt) {
        //tmpv+=V[uiv[j]];
        //tmpw+=W[uiv[j]];
      //}
      if (tmpw<=L[loop]){
        maxval=max(data[uidx][L[loop]-tmpw]+tmpv,maxval);
      }
    }

    cout<<maxval<<endl;
  }












}


  return 0;
}

Measured memory_bytes: 408124
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] s = new int[3];
        for (int i = 0; i < s.length; i++) {
            s[i] = sc.nextInt();
        }
        Arrays.sort(s);
        System.out.println(s[0] + s[1]);
    }
}

Measured memory_bytes: 35704
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  long long y;
  bool ans = false;

  cin >>n >> y;
  for(int a = 0; a <= n; a++){
    for(int b=0, c=0; b<= n; b++){
      if(a+ b <= n){
        c = n - (a+b);
        if(a*10000+b*5000+c*1000 == y){
          ans = true;
          cout << a << " " << b<< " " << c << endl;
          return 0;
        }
      }
    }
  }

cout << "-1 -1 -1" << endl;

    return 0;
}


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

using namespace std;

typedef short sho;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
typedef string str; 
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll; 
typedef pair<ld,ld> pld;
 
typedef vector<int> vi; 
typedef vector<ll> vl; 
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<pld> vpd;

#define STDIO
#define mp make_pair 
#define FF first
#define SS second
#define sz(x) (int)x.size()
#define begin(x) (x).begin() 
#define end(x) (x).end()
#define rbegin(x) (x).rbegin()
#define rend(x) (x).rend()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front 
#define pb push_back
#define pp push
#define lb lower_bound 
#define ub upper_bound

inline void checkmin(int &x, int y){x = min(x, y);}
inline void checkmax(int &x, int y){x = max(x, y);}

int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() 
{
	#ifndef STDIO
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /* start code */
    int k;
    cin>>k;
    --k;
    cout<<a[k]<<endl;
    /* end code */
	return 0;
}

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

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

ll mod = 1e9 + 7;
int inf = 1e9 + 7;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    string s;
    cin >> s;
    if (s.at(0) == s.at(1)) {
        if (s.at(0) != s.at(2) and s.at(2) == s.at(3)) printf("Yes");
        else printf("No");
    } 
    else if (s.at(0) == s.at(2)) {
        if (s.at(1) == s.at(3)) printf("Yes");
        else printf("No");
    }
    else if (s.at(0) == s.at(3)) {
        if (s.at(1) == s.at(2)) printf("Yes");
        else printf("No");
    } else printf("No");
    return 0;
} 

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()){	
			int a = scanner.nextInt();
			int b = scanner.nextInt();
			int sum = a+b;
			if(sum<10){
				System.out.println("1");
			}
			if(sum<100 && sum>9){
				System.out.println("2");
			}
			if(sum<1000 && sum>99){
				System.out.println("3");
			}
			if(sum<10000 && sum>999){
				System.out.println("4");
			}
			if(sum<100000 && sum>9999){
				System.out.println("5");
			}
			if(sum<1000000 && sum>99999){
				System.out.println("6");
			}
			if(sum<10000000 && sum>999999){
				System.out.println("7");
			}
		}
	}
}

Measured memory_bytes: 26060
#include <stdio.h>
#include <iostream>
#include <cmath>

int main(){
  int a,b,c;

  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);

  int t;

  t = std::min((a-b),c);

  c = c - t;

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

  return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int A, B, C, D;
	long MOD = 998244353L;
	long[][] cell;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		A = Integer.parseInt(tokens[0]);
		B = Integer.parseInt(tokens[1]);
		C = Integer.parseInt(tokens[2]);
		D = Integer.parseInt(tokens[3]);
		cell = new long[C][D];
		for (int i = 0; i < C; ++i) {
			Arrays.fill(cell[i], 0L);
		}
		cell[A - 1][B - 1] = 1L;
		for (int i = A; i < C; ++i) {
			cell[i][B - 1] = cell[i - 1][B - 1] * B % MOD;
		}
		for (int i = B; i < D; ++i) {
			cell[A - 1][i] = cell[A - 1][i - 1] * A % MOD;
		}
	}

	void calc() {
		for (int i = A; i < C; ++i) {
			for (int j = B; j < D; ++j) {
				// このマスが白の場合: 例えば，左のパターン * 下一列のいずれかが黒
				cell[i][j] = cell[i - 1][j] * (long) j;
				cell[i][j] %= MOD;
				cell[i][j] += cell[i][j - 1] * (long) i;
				cell[i][j] %= MOD;
				long val = cell[i - 1][j - 1] * (long) i;
				val %= MOD;
				val *= (long) j;
				val %= MOD;
				cell[i][j] -= val;
				cell[i][j] += MOD;
				cell[i][j] %= MOD;
				cell[i][j] += cell[i - 1][j];
				cell[i][j] %= MOD;
				cell[i][j] += cell[i][j - 1];
				cell[i][j] %= MOD;
			}
		}
	}

	void showCell() {
		for (int i = 0; i < C; ++i) {
			for (int j = 0; j < D; ++j) {
				System.out.print(cell[i][j] + " ");
			}
			System.out.println("");
		}
	}

	void showResult() {
		System.out.println(cell[C - 1][D - 1]);
		// showCell();
	}
}

Measured memory_bytes: 104708
import sys
input = sys.stdin.readline

def matDot(A,B,MOD):
    N,M,L = len(A),len(A[0]),len(B[0])
    
    res = [[0]*L for i in range(N)]

    for i in range(N):
        for j in range(L):
            s = 0
            for k in range(M):
                s = (s + A[i][k]*B[k][j]) % MOD
            res[i][j] = s
    
    return res

def matPow(A,x,MOD):
    N = len(A)
    res = [[0]*N for i in range(N)]
    
    for i in range(N):
        res[i][i] = 1
    
    for i in range(x.bit_length()):
        if (x>>i) & 1:
            res = matDot(res,A,MOD)
        A = matDot(A,A,MOD)
    
    return res

n,k = map(int,input().split())
mod = 10**9+7

a = []
for i in range(n):
    a.append(list(map(int,input().split())))

b = matPow(a,k,mod)

ans = 0
for i in range(n):
    for j in range(n):
        ans = (ans+b[i][j])%mod

print(ans)

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

int main()
{
	int n,a[100005],sum = 0,ans = 0;
	
	cin >> n;
	for(int i = 0;i < n;i++) cin >> a[i];
	
	for(int i = 1;i < n;i++){
		if(a[i] <= a[i - 1]) sum++;
		else sum = 0;
		ans = max(ans,sum);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using ll = long long;


int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++)cin >> a[i];
    vector<ll> sum(n + 1);
    for(ll i = 0; i < n; i++)sum[i + 1] = sum[i] + a[i];


    ll ans = 1e18;
    for(ll i = 2; i < n - 1; i++) {
        // i = n;
        ll a, b, c, d;

        {//front
            ll fsum = sum[i];
            auto kug = lower_bound(sum.begin(), sum.begin() + i, fsum / 2) - sum.begin();
            ll ta = sum[kug];
            ll tb = sum[i] - sum[kug];
            a = sum[kug + 1];
            b = sum[i] - sum[kug + 1];
            // cerr << a << " -- -" << b << endl;
            if(abs(ta - tb) < abs(a - b)) {
                a = ta, b = tb;
            }
            ta = sum[kug - 1];
            tb = sum[i] - sum[kug - 1];
            if(abs(ta - tb) < abs(a - b)) {
                a = ta, b = tb;
            }
        }

        {//back
            ll bsum = sum[n] - sum[i];
            auto kug = lower_bound(sum.begin() + i, sum.end(), bsum / 2 + sum[i]) - sum.begin();
            ll ta = sum[kug] - sum[i];
            ll tb = sum[n] - sum[kug];
            c = sum[kug + 1] - sum[i];
            d = sum[n] - sum[kug + 1];
            if(abs(ta - tb) < abs(c - d)) {
                c = ta, d = tb;
            }
            ta = sum[kug - 1] - sum[i];
            tb = sum[n] - sum[kug - 1];
            if(abs(ta - tb) < abs(c - d)) {
                c = ta, d = tb;
            }
        }
        // cerr << a << " - " << b << " - " << c << " - " << d << endl;
        ans = min(ans, max({a,b,c,d}) - min({a,b,c,d}));
        // cerr << a << " - " <<  b << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6376
'use strict'

function main(s) {

  s = s.split('\n');
  const n = Number(s[0]);
  const cards = s[1].split(' ').map(x => Number(x));
  cards.sort((a, b) => b - a);

  let alice = 0;
  let bob   = 0;

  for (var i = 0; i < n; i++) {
    if ((i % 2) === 0) {
      alice += cards.shift();
    } else {
      bob += cards.shift();
    }
  }

  const ans = alice - bob;
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
#include<limits.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
typedef pair<ll,ll> PL;
typedef pair<ll,pair<ll,ll>> PLL;
static const int IINF=INT32_MAX;
static const ll LINF=INT64_MAX;
static const ll mod=1e9+7;
static const double eps=1e-13;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}

int N;
ll K;
ll A[200005],F[200005];
vector<PL> V;

bool ok(ll m){
    ll cost=0;
    for(int i=0; i<N; i++){
        if(F[i]*A[i]<=m)continue;
        cost+=A[i]-m/F[i];
    }
    return (cost<=K);
}

int main(){
    cin>>N>>K;
    for(int i=0;i<N;++i)cin>>A[i];
    for(int i=0;i<N;++i)cin>>F[i];
    sort(A,A+N);
    sort(F,F+N,greater<int>());
    for(int i=0;i<N;++i)V.push_back(PL(A[i]*F[i],i));
    sort(V.begin(),V.end());
    ll l=0,r=1e18;
    ll mid;
    int T=100;
    while(T--){
        mid=(l+r)/2;
        //cout<<"l="<<l<<" r="<<r<<endl;
        if(ok(mid))r=mid;
        else l=mid;
    }
    if(ok(l))cout<<l<<endl;
    else cout<<r<<endl;
}

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
 
#define mod 1000000007
typedef long long int LL;
const int MAX = 105;
const int INF = 1e9;


int main() {
	string x;
	int ans = 7;
	cin >> x;
	if (x == "MON")
		ans = 6;
	if (x == "TUE")
		ans = 5;
	if (x == "WED")
		ans = 4;
	if (x == "THU")
		ans = 3;
	if (x == "FRI")
		ans = 2;
	if (x == "SAT")
		ans = 1;
	printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void){
	string str;
	
	while(getline(cin,str)){
		int begin=0;
		int length=0;
		int n = str.size();
		vector<string> ret;
		string tmp="";
		
		for(int i=0;i<n;i++){
			if(str[i] == ' ' || str[i] == ',' || str[i] == '.'){
				if(3 <= length && length <= 6){
					ret.push_back(tmp);
				}
				length = 0;
				tmp.clear();
			}else{
				tmp += str[i];
				length++;
			}
		}
		for(int i=0;i<ret.size();i++){
			if(i == ret.size()-1){
				cout << ret[i] << endl;
			}else{
				cout << ret[i] << " ";
			}
		}
	}
}

Measured memory_bytes: 0