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

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int w = sc.nextInt();
        int h = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();
        
        boolean ans = false;
  
        if (x - r >= 0 && x + r <= w &&
            y - r >= 0 && y + r <= h) {
            ans = true;
        }
        
        System.out.println(ans?"Yes":"No");
    }
}


Measured memory_bytes: 26240
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(in);
long s= sc.nextLong();
long[] a=new long[11];
long[] b=new long[11];
long ans=0;
b[0]=1;
int j=1;
    for (int i = 0; i <10; i++) {
        a[i]=s%10;
        s/=10;
        if(i>0){
            b[i]=b[i-1]*10+j;
            j*=2;
        }
    }
    ans=a[0];
    int k=1;
    while(a[k]!=0){
        ans=ans*2+a[k]*b[k];
        k++;
    }
    out.println(ans);
}}

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

int D;
double V[16];
double interpolate(int n, int E){
	double sum = 0.0;
	for(int k = 0; k < D + 3; ++k){
		if(k == n || k == E) continue;
		double p = V[k];
		for(int i = 0; i < D + 3; ++i){
			if(!(i == k || i == n || i == E)) p *= (double)(n - i)/(double)(k-i);
		}
		sum += p;
	}
	return sum;
}

bool outlier(int E){
	for(int i = 0; i < D + 3; ++i){
		if(i == E) continue;
		double p = interpolate(i, E);
		// cout << p - V[i] << endl;
		if(fabs(p - V[i]) > 0.1) return false;
	}
	return true;
}

int main(){
	while (cin >> D && D){
		for(int i = 0; i < D + 3; ++i) cin >> V[i];
		for(int i = 0; i < D + 3; ++i){
			if(outlier(i)){
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1232
import java.util.Scanner;

class A {
    public static void main(String... args) {
        final Scanner sc = new Scanner(System.in);
        final char[] S = sc.next().toCharArray();
        System.out.println(S[2] == S[3] && S[4] == S[5] ? "Yes" : "No");
    }
}
public class Main {
    public static void main(String... args) {
        A.main();
    }
}


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

string s;
int res = 700;
int main() {
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin >> s;
	for (int i = 0; i < 3; i++)
		if (s[i] == 'o')
			res += 100;
	cout << res;
}


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

const int N = 1e5 + 5;
char s[N], t[N];
int c1[N], c2[N];
int n, m, q;

int main() {
    scanf("%s", s+1);
    scanf("%s", t+1);
    n = strlen(s+1);
    m = strlen(t+1);
    for (int i=1; i<=n; ++i) c1[i] = c1[i-1] + (s[i] == 'B');
    for (int i=1; i<=m; ++i) c2[i] = c2[i-1] + (t[i] == 'B');
    scanf("%d", &q);
    for (int i=1; i<=q; ++i) {
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        int res1 = c1[b] - c1[a-1];
        res1 += (b-a+1-res1) * 2;
        int res2 = c2[d] - c2[c-1];
        res2 += (d-c+1-res2) * 2;
        if ((res1 - res2) % 3 == 0) puts("YES");
        else puts("NO");
    }
    return 0;
}


Measured memory_bytes: 1536
#2019-04-09 2100 start

N,M,C= map(int, input().split())
B = input().split()
sumN = 0
count = 0

for i in range(N):
    A = input().split()
    for j in range(M):
        sumN = sumN + int(A[j])* int(B[j])
    if sumN + C > 0:
        count = count + 1
    elif sumN + C <= 0:
        count = count
    sumN = 0


print(count)







Measured memory_bytes: 3060
n = int(input())
s = input()
wh = [0] * n
bl = [0] * n

w , b = 0,0
for i in range(n):
  if s[i] == '.':
    w += 1
  else:
    b += 1
  wh[i] = w
  bl[i] = b
ans = n
wtot = wh[-1]
btot = bl[-1]
for i in range(n):
  x = (wtot - wh[i]) + bl[i]
  # print (bl[i], (wtot - wh[i]))
  ans = min(ans, x)
ans = min(ans, wtot)
print (ans)

Measured memory_bytes: 18588
n,m=map(int,input().split())
cnt=[-1]*n
ans=0
for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0 and n!=1:
        ans=-1
        break
    elif cnt[s-1]==-1:
        cnt[s-1]=c
    elif c!=cnt[s-1]:
        ans=-1
        break
if ans==-1:
    print(ans)
elif n==1 and m==0:
    print(0)
else:
    for i in range(n):
        if i==0 and cnt[0]==-1:
            cnt[0]=1
        elif cnt[i]==-1:
            cnt[i]=0
        ans+=cnt[i]*10**(n-i-1)
    print(ans)

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"

#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)

#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#define LOCAL_OUTPUT do{FILE *stream2;\
stream2 = freopen("out.txt", "w", stdout);\
if (stream2 == nullptr) return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << x << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

template <typename T> bool chmin(T &a, T b){return a>b?(a=b,true):false;}

template <typename T> bool chmax(T &a, T b){return a<b?(a=b,true):false;}

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
ll MOD = (ll)1e9 + 7;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int n;
bool past[301][301][301];
double dp[301][301][301];


double memo(int a, int b, int c) {
    if (past[a][b][c]) return dp[a][b][c];
    if (a == 0 && b == 0 && c == 0) {
        dp[a][b][c] = 0.0;
    } else {
        dp[a][b][c] = 0.0;
        if (a > 0) dp[a][b][c] += a * memo(a - 1, b, c);
        if (b > 0) dp[a][b][c] += b * memo(a + 1, b - 1, c);
        if (c > 0) dp[a][b][c] += c * memo(a, b + 1, c - 1);
        dp[a][b][c] += n;
        dp[a][b][c] /= (a + b + c);
    }
    past[a][b][c] = true;
    return dp[a][b][c];
}

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
//    LOCAL_OUTPUT; // ファイルに出力したいときのみ
    show(MOD);
#endif
    cin >> n;
    int one = 0, two = 0, three = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a == 1) one++;
        else if (a == 2) two++;
        else three++;
    }
    cout << memo(one, two, three) << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
#endif
    return 0;
}

Measured memory_bytes: 240000
use std::io;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let n:i32 = v[0];
	let v:Vec<i32> = procon_read();
	let h:Vec<i32> = v.clone();
	let mut cnt = 1;
	for i in 1..n {
		cnt += 1;
		for j in 0..i {
			if h[i as usize]  < h[j as usize] {
				cnt += -1;
				break;
			}
		}
	}
	println!("{}", cnt);
}

Measured memory_bytes: 4352
import math
n = int(input())
A = []
sum = 0
for i in range(n) :
  a,s = (int(x) for x in input().split())
  A.append((a,s))
for i in A:
  for i2 in A:
    sum+=math.sqrt((i[0]-i2[0])**2+(i[1]-i2[1])**2)
print(sum/n)

Measured memory_bytes: 3064
n = int(input()) #waiting_for_pudging
b = list(map(int, input().split())) #waiting_for_pudging
summ = b[0] #waiting_for_pudging

for i in range(1, len(b)): #pudging
    summ += min(b[i-1], b[i]) #pudging
print(summ + b[-1]) #pugding
#accepted


Measured memory_bytes: 2940
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::{i32, i64, u32, u64, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};

fn main() {
    input! {
        n: usize,
        p: i64,
        arr: [i64; n],
    }
    let e = arr.iter().filter(|&a| a % 2 == 0).count();
    let o = n - e;
    if o == 0 { println!("{}", (1 - p) << n); }
    else { println!("{}", 1u64 << (n - 1)); }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n=0,m,a,b,c,d,e;
	long double z,w;
	string str,str2,str3;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b;
	cout<<(a-1)*(b-1);




	cout<<endl;
} 


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[][] atower = new int[3][10];
		int[][] btower = new int[3][10];
		int[][] ctower = new int[3][10];
		int[][] dtower = new int[3][10];
		
		for (int i = 0; i < n; i++) {
			int b = scan.nextInt();
			int f = scan.nextInt();
			int r = scan.nextInt();
			int v = scan.nextInt();
			
			if (b == 1) {
				atower[f-1][r-1] += v;
			}
			else if (b == 2) {
				btower[f-1][r-1] += v;
			}
			else if (b == 3) {
				ctower[f-1][r-1] += v;
			}
			else if (b == 4) {
				dtower[f-1][r-1] += v;
			}
		}
		for (int k = 0; k < 3; k++) {
			for (int m = 0; m < 10; m++) {
				System.out.print(" " + atower[k][m]);
			}
			System.out.println();
		}
		System.out.println("####################");
		for (int k = 0; k < 3; k++) {
			for (int m = 0; m < 10; m++) {
				System.out.print(" " + btower[k][m]);
			}
			System.out.println();
		}
		System.out.println("####################");
		for (int k = 0; k < 3; k++) {
			for (int m = 0; m < 10; m++) {
				System.out.print(" " + ctower[k][m]);
			}
			System.out.println();
		}
		System.out.println("####################");
		for (int k = 0; k < 3; k++) {
			for (int m = 0; m < 10; m++) {
				System.out.print(" " + dtower[k][m]);
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 29348
// Problem : B - Golden Coins
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cp-editor)

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
#define fio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ull unsigned long long
#define ll long long
#define inf INT_MAX
#define mninf INT_MIN
#define infl 1e18+5
#define mninfl -1e18-5
#define Mod 1000000007
#define newmod  998244353
int ah=911382323;
int bh=972663749;
#define endl "\n"
#define cp(x) cout<<(x)<<" "
#define cl(x) cout<<(x)<<endl
#define ct(x,y) cout<<(x)<<" "<<(y)<<endl;
#define nl   cout<<endl
//const long double pi=acos(-1);
//looping
#define int long long
#define For(i,a,b) for(int i=a;i<b;i++)
#define test(t)  int (t); cin>>(t); while((t)--)
#define array(a,n) int (n); cin>>(n); int a[n]; for(int i=0;i<(n);i++) cin>>a[i];
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pa(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' ';  cout<<endl
#define pv(v)  for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";  cout<<endl
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}
#define deb(x) cerr << #x << " = " << x << endl;
#define deb2(x,y)  cerr << #x << " = " << x <<"   "<< #y << " = " << y << endl;
//containers
#define F first
#define S second
#define pb emplace_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mkp make_pair
#define all(v) (v).begin(),(v).end()
int dx[8]={1,-1,0,0,1,1,-1,-1};
int dy[8]={0,0,1,-1,1,-1,1,-1};
typedef vector<int> vi;
typedef vector< vector< int > > vvi;
typedef vector < pair <int, int> > vpii;
/*/----------------------------Code begins----------------------------------/*/
int32_t main(){
fio;
int x;
cin>>x;
int sum=x/500*1000;
x%=500;
sum+=(x/5*5);
cl(sum);



}




























Measured memory_bytes: 256
int_n = int(input())
ar_int_a = list(map(int, input().split()))
ar_int_b = [-1] * int_n


idx = (int_n // 2)
ar_int_b[idx] = ar_int_a[0]

if int_n % 2 == 0:
    # 偶数
    for i in range(1, int_n):
        if i % 2 == 0:
            idx = idx + i
        else:
            idx = idx + (-1 * i)
        ar_int_b[idx] = ar_int_a[i]
else:
    # 奇数
    for i in range(1, int_n):
        if i % 2 == 0:
            idx = idx + (-1 * i)
        else:
            idx = idx + i
        ar_int_b[idx] = ar_int_a[i]


print(" ".join(map(str, ar_int_b)))


Measured memory_bytes: 29764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll x,n;
  cin >> x >> n;
  ll a[n];
  for(int i=0;i<n;i++)	cin >> a[i];
  sort(a,a+n);
  int ans1=12009, ans2=669669, i;
  for(i=x; binary_search(a,a+n,i); i--){}
  ans1=i;
  for(i=x; binary_search(a,a+n,i); i++){}
  ans2=i;
  int diff1=abs(x-ans1);
  int diff2=abs(x-ans2);
  if(min(diff1,diff2)==diff1)	cout << ans1 << endl;
  else	cout << ans2 << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

int main() {
    ll n, w;
    cin(n); cin(w);

    vector<ll> weight(n), value(n);
    rep2(i, n) {
        cin(weight[i]);
        cin(value[i]);
    }

    ll sumOfValue = accumulate(value.begin(), value.end(), 0);
    vector<vector<ll>> dp(n + 1, vector<ll>(sumOfValue + 1, 1000000000000));

    dp[0][0] = 0;

    erep3(i, 1, n) {
        ll wi = weight[i - 1];
        ll vi = value[i - 1];

        erep2(j, sumOfValue) {
            if (j - vi >= 0) {
                dp[i][j] = min(dp[i - 1][j - vi] + wi, dp[i - 1][j]);
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }

    errep(i, sumOfValue, 0) {
        if (dp[n][i] <= w) {
            print(i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 80256
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <math.h>
using namespace std;

/* define const */
int Smax = 100000;
/* end up defineing const */

string S;

int main()
{
  cin >> S;

  int ans = 0;
  for (int i = 1; i < S.length(); i++) {
    if (S[i-1] != S[i]) ans++;
  }
  cout << ans << endl;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(x) x.begin(),x.end()
typedef long long ll;
ll mod = 1000000007;
ll inf = 1e18;
int main(){

    int n;
    string s;
    cin >> n >> s;
    vector<int> c(n);
    ll count=0;
    rep(i,n){
        if(s[i]=='R') c[i]=0;
        if(s[i]=='G') c[i]=1;
        if(s[i]=='B'){
            c[i]=2;
            count++;
        }
    }
    // cout << count << endl;
    // rep(i,n) cout << c[i];
    // cout << endl;

    ll ans=0;
    rep(i,n){
        if(c[i]!=0) continue;
        // cout << i << endl;
        rep(j,n){
            if(c[j]!=1) continue;
            ans+=count;
            int n1=i,n2=j;
            if(n1>n2) swap(n1,n2);
            int n3=abs(n1-n2);
            // cout << n1 << ' ' << n2 << ' ' << n3 << endl;
            if(n1-n3>=0){
                if(c[n1-n3]==2) ans--;
            }
            if(n2+n3<n){
                if(c[n2+n3]==2) ans--;
            }
            if((n2-n1)%2==0){
                if(c[n1+(n2-n1)/2]==2) ans--;
            }
            // cout << ans << endl;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3628
n, k = map(int, input().split())

d = []
a = []

for i in range(k):
    di = int(input())
    ai = list(map(int, input().split()))
    d.append(di)
    a.append(ai)
dic = {}
for al in a:
    for aln in al:
        if aln not in dic:
            dic[aln] = aln    
print(n-len(dic))            

Measured memory_bytes: 9200
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
//    ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
    
    int N; cin >> N;
    int n111=111;

    int i=1;
    for(; i<10; ++i){
        if(N<=n111*i){ break; }
    }
    cout << n111*i << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>         //可以处理负权边
using namespace std;
const int INF =  0x3f3f3f;
#define rep(i,n) for( i = 0; i < n; i++)
#define rep2(i,n) for(i = n-1; i >= 0; i--)
#define rep3(i,n,m) for(i = m; i < n; i++)
#define CloseIo   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
typedef long long ll;
const int N = 100000+50;
typedef pair<int, int> P;
typedef vector<P> vctp;
int arry[N] = {0};
int main(){
    string a;
    cin>>a;
    int n = a.length();
    int sum = 0;
    stack<char> st;
    st.push(a[0]);
    for(int i = 1; i < n;i++){
      if(st.empty()){
        st.push(a[i]);
      }else if(a[i] == st.top()){
        st.push(a[i]);
      }else{
          st.pop();
          sum++;
          // cout<<sum<<endl;
      }
    }
    cout<<sum*2<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define nmod         -1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define xxx         exit(0);
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) 
{
    return (ll)(log(x)/log(base));
}
ll n,m,dp[1005][1005]; char s[1005][1005]; bool vis[1005][1005];
ll cc(ll x,ll y)
{
	if(x<0 || y<0 || x>=n || y>=m || s[x][y]=='#') return 0;
	if(x==0 && y==0) return 1;
	if(vis[x][y]) return dp[x][y];
	vis[x][y]=true;
	dp[x][y] = (cc(x-1,y) + cc(x,y-1))%mod;
	return dp[x][y];
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS; 
    while(TESTS--)
    {
    	ll i,l,j,x1,y1,x,y,z,q,h;
    	cin>>n>>m;
    	rep(i,0,n){
    		rep(j,0,m)
    		{
    			cin>>s[i][j];
    			dp[i][j]=0;
    			vis[i][j]=false;
			}
		}
		dp[0][0]=1;
		cc(n-1,m-1);
		cout<<dp[n-1][m-1];
	}
	return 0;
}


Measured memory_bytes: 13508
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] x = new int[n];
		int sum = 0;
		for (int i = 0; i < n; i++) {
			x[i] = sc.nextInt();
			if (x[i] <= k - x[i]) {
				sum += 2 * x[i];
			} else {
				sum += 2 * (k - x[i]);
			}
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define REP(i,a,b) for (int i = a ; i <= b ; i++)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

const int OO = 1e9+7;
const int MOD = 1e9+7;
const int N = 1e5+7;



int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int a,b,c;
    ll k;
    cin >> a >> b >> c >> k;
    if (k%2==0)
    {
        cout << a-b << endl;
    }
    else
    {
        cout << b-a << endl;
    }

    return 0;
}


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

public class Main {

  // int n = sc.nextInt();
  // long m = sc.nextLong();
  // String s = sc.next();

  // // 最大公約数
  // public static long gcd (long m,long n) {
  //   if (m < n) return gcd(n,m);
  //   if (n == 0) return m;
  //   return gcd(n,m%n);
  // }
  //
  // // 最小公倍数
  // public static long lcm (long m,long n) {
  //   return m*n/gcd(m,n);
  // }
  //
  // // 素数判定
  // public static boolean isPrime (long n) {
  //   if (n == 2) return true;
  //   if (n < 2 || n%2 == 0) return false;
  //   double d = Math.sqrt(n);
  //   for (int i = 3; i <= d; i+=2) {
  //     if (n%i == 0) {
  //       return false;
  //     }
  //   }
  //   return true;
  // }
  //
  // public static final long gcd3(long[] param) {
  //   int len = param.length;
  //   long g = gcd(param[0], param[1]);    //gcd(a, b) は以前作ったもの
  //   for (int i = 1; i < len - 1; i++) {
  //       g = gcd(g, param[i + 1]);       //gcd(a, b) は以前作ったもの
  //   }
  //   return g;
  // }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double r = sc.nextDouble();

    System.out.println(2*r*3.14);

  }

}


Measured memory_bytes: 37376
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n;
cin>>n;
int a[n],cnt=0;
for(int i=0;i<n;i++)
{
	cin>>a[i];
}
int mini=a[0];
for(int i=0;i<n;i++)
{
	mini=min(mini,a[i]);
if(mini==a[i])
	cnt++;
}
cout<<cnt;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main() 
{
    fast();
    string s,t;
    cin>>s>>t;
    ll a=0;
    for(ll i=0;i<sz(s);i++)
    {
        if(s[i]!=t[i])
            a++;
    }
    cout<<a<<nl;
}


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

int main() {
 int n,dis=0;
 cin >> n;
  vector<int> x(n+2);
  vector<int> ans(n+2);
  x[0]=0;x[n+1]=0;
  for(int i=1;i<n+1;i++){
  cin >> x[i];
    dis+=abs(x[i]-x[i-1]);
  }
  dis+=abs(x[n]);

  for(int i=1;i<n+1;i++){
    if((x[i-1]<=x[i] && x[i]<=x[i+1])||(x[i-1]>=x[i] && x[i]>=x[i+1])){
      ans[i]=dis;
    }
    else{
      ans[i]=dis-abs(x[i]-x[i-1])-abs(x[i]-x[i+1])+abs(x[i-1]-x[i+1]);
    }
  }
  for(int i=1;i<=n;i++){
  cout << ans[i] << endl;
  }
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int maxn=2e5+10;
const int inf=1e9+10;

class segmentTree{
	public:
	int tree[maxn*8],tag[maxn*8];
	void init(){
		for(int i=0;i<maxn*8;i++) tree[i]=inf,tag[i]=0;
	}
	void pushdown(int x){
		if(tag[x]==0) return;
		tree[x<<1]=tree[x<<1|1]=tag[x];
		tag[x<<1]=tag[x<<1|1]=tag[x];
		tag[x]=0;
	}
	void update(int x,int l,int r,int pos,int val){
		if(l==r){
			tree[x]=val;
			return;
		}
		pushdown(x);
		int mid=(l+r)>>1;
		if(pos<=mid) update(x<<1,l,mid,pos,val);
		else update(x<<1|1,mid+1,r,pos,val);
		tree[x]=min(tree[x<<1],tree[x<<1|1]);
	} 
	void update(int x,int l,int r,int cl,int cr,int val){
		if(cr<l||r<cl) return;
		if(cl<=l&&r<=cr){
		//	cout<<l<<" "<<r<<" "<<cl<<" "<<cr<<endl;
			pushdown(x);
			tree[x]=tag[x]=val;
			return;
		}
		pushdown(x);
		int mid=(l+r)>>1;
		update(x<<1,l,mid,cl,cr,val);
		update(x<<1|1,mid+1,r,cl,cr,val);
		tree[x]=min(tree[x<<1],tree[x<<1|1]);
	}
	int getval(int x,int l,int r,int cl,int cr){
		if(cr<l||r<cl) return inf;
		if(cl<=l&&r<=cr) return tree[x];
		pushdown(x);
		int mid=(l+r)>>1;
		int val1=getval(x<<1,l,mid,cl,cr);
		int val2=getval(x<<1|1,mid+1,r,cl,cr);
		return min(val1,val2);
	}
	int getval(int x,int l,int r,int pos){
		if(l==r) return tree[x];
		pushdown(x);
		int mid=(l+r)>>1;
		if(pos<=mid) return getval(x<<1,l,mid,pos);
		else return getval(x<<1|1,mid+1,r,pos);
	}
}seg1,seg2;

int ans[maxn],n,m;
pair<int,int> p[maxn];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++) scanf("%d%d",&p[i].fst,&p[i].snd),p[i].fst--,p[i].snd--;
	seg1.init(); seg2.init();
	for(int i=0;i<m;i++){
		seg1.update(1,0,m-1,i,0);
		seg2.update(1,0,m-1,i,-i);
	}
	for(int i=0;i<n;i++){	
		int val=seg2.getval(1,0,m-1,0,min(p[i].snd+1,m-1))+p[i].snd+1;
		seg1.update(1,0,m-1,p[i].fst,p[i].snd,inf);
		seg2.update(1,0,m-1,p[i].fst,p[i].snd,inf);
		if(p[i].snd+1<m) seg1.update(1,0,m-1,p[i].snd+1,val);
		if(p[i].snd+1<m) seg2.update(1,0,m-1,p[i].snd+1,val-p[i].snd-1);	
		ans[i]=seg1.getval(1,0,m-1,0,m-1)+i+1;
	//	cout<<seg1.getval(1,0,m-1,0,m-1)<<endl;
		if(ans[i]>=n+m+100) ans[i]=-1;	
	//	for(int j=0;j<m;j++) cout<<seg1.getval(1,0,m-1,j)<<" "; cout<<endl;
	}
	for(int i=0;i<n;i++) printf("%d\n",ans[i]); 
	return 0;
}

/*
5 6
1 6
2 4
3 4
3 4
3 4
*/


Measured memory_bytes: 31080
#include<stdio.h>

int main(){
  int i, n, m;

  while(1){
    scanf("%d", &n);
    if(n == 0) break;

    for(i=0; i<9; i++){
      scanf("%d", &m);
      n -= m;
    }

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

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,k,i;
  int flag=0;
  cin>>k>>a>>b;
  for(i=a;i<=b;i++){
    if(i%k==0){flag=1;}
  }
   if(flag==0){cout<<"NG"<<endl;}
   else{cout<<"OK"<<endl;}
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

int main(void)
{
    int count = 0;
    string s;
    cin >> s;
    for(int i = 0; i < 4;i++)
    {
        if(s[i] == '+'){count++;}
        else{count--;}
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
namespace mul
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int cntX = 1; cntX < 10; cntX++)
            {
                for (int cntY = 1; cntY < 10; cntY++)
                    System.Console.WriteLine("{0}x{1}={2}", cntX, cntY, cntX * cntY);
            }
        }
    }
}

Measured memory_bytes: 9032
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

// mint
template<int64_t Prime>
struct mod_int {
  int64_t v_;
  mod_int(int64_t x=0) : v_(x) { normalize(); }
  void normalize() { ((v_ %= Prime) += Prime) %= Prime; }
  mod_int operator+=(mod_int const& r){ (v_ += r.v_) %= Prime; return *this; }
  mod_int operator-=(mod_int const& r){ (v_ += Prime - r.v_) %= Prime; return *this; }
  mod_int operator*=(mod_int const& r){ (v_ *= r.v_) %= Prime; return *this; }
  mod_int operator+(mod_int const& r) { mod_int res(*this); return res += r; }
  mod_int operator-(mod_int const& r) { mod_int res(*this); return res -= r; }
  mod_int operator*(mod_int const& r) { mod_int res(*this); return res *= r; }
  mod_int pow(int x) const {
    int64_t res = 1, v = v_;
    while(x > 0) {
      if(x&1) (res *= v) %= Prime;
      x/=2; (v *= v) %= Prime;
    }
    return mod_int(res);
  }
  mod_int inv() const { return pow(Prime-2); }
};

int64_t const MOD = 1e9+7;
typedef mod_int<MOD> mint;

int main() {
  int N, M; std::cin >> N >> M;
  std::vector<int> S(N), T(M);
  for(int i = 0; i < N; ++i) std::cin >> S[i];
  for(int i = 0; i < M; ++i) std::cin >> T[i];
  std::vector<std::vector<mint>> sum(N+1, std::vector<mint>(M+1));
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < M; ++j) {
      mint tmp = sum[i][j+1] + sum[i+1][j];
      if(S[i] == T[j]) sum[i+1][j+1] = tmp+1;
      else sum[i+1][j+1] = tmp - sum[i][j];
    }
  }
  fin((sum[N][M]+1).v_);
  return 0;
}


Measured memory_bytes: 31616
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
#include<cmath>
#include<cstring>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF = 1<<30;
const ll LINF = 1LL<<61;
const int MOD = 1e9+7;

int main(){
    int T,D,L;
    while(cin >> T >> D >> L,T|D|L){
        int wet = 0;
        int res = 0;
        vector<int> wave(T);
        for (int i = 0;i<T;i++){
            cin >> wave[i];
        }
        for (int t = 0; t < T-1; t++)
        {
            if (wave[t] >= L)
            {
                wet = D;
            }
            if (wet > 0)
                res++;
            wet--;
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3460
#include<iostream>
#include<algorithm>
#include<set>
#include<stack>
#define pb push_back
#define sz size()
#define For(i,a) for(int i=0;i<(int)a;i++)
using namespace std;

typedef pair<int,int> P;

string grid[1100];
bool v[1100][1100];
int w,h,n;
stack<P> q;
set<P> s;

bool dfs(int y,int x){
  q.push(P(y,x));

  while(q.size()){
    int y = q.top().first, x = q.top().second;
    q.pop();
    
    if(grid[y][x] == 't')return true;
    
    v[y][x] = true;
    int dy[] = {-1,0,1,0},dx[] = {0,1,0,-1};
    
    For(i,4){
      int sy = y + dy[i] , sx = x + dx[i];
      if(sy<0 || sx<0 || h<=sy || w<=sx || v[sy][sx])continue;
      if(grid[sy][sx] == '#'){
	s.insert(P(sy,sx));
	continue;
      }
      q.push(P(sy,sx));
    }
  }
  return false;
}

int main(){
  int x,y;
  cin >> w >> h;

  For(i,h)cin >> grid[i];
  For(i,h)For(j,w)v[i][j] = false;

  while(q.sz)q.pop();
  s.clear();

  if(dfs(0,0))cout << 0 << endl;
  else{
    cin >> n;
    For(i,n){
      cin >> x >> y;
      if(grid[y][x]=='#'){
	grid[y][x] = '.';

	int s1 = s.sz;
	s.insert(P(y,x));
	int s2 = s.sz;
	s.erase(P(y,x));
	if(s1==s2){
	  if(dfs(y,x)){
	    cout << i+1 << endl;
	    return 0;
	  }
	}
      }
    }
    cout << -1 << endl;
  }
}

Measured memory_bytes: 9000
n = gets
l = gets.split(" ").map(&:to_i)

c = 0
l.each{|i|
  if i %2 == 0 then
    if i %5 == 0 || i %3 == 0 then
    else
      c += 1
    end
  end
}

if c == 0 then
  print "APPROVED"
else
  print "DENIED"
end

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    private static int res = int.MaxValue;
    static void Main(string[] args)
    {
        var nabc = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ls = new int[nabc[0]];
        for (var i = 0; i < nabc[0]; i++)
            ls[i] = ToInt32(ReadLine());
        for(var i = 1; i < Pow(2, nabc[0]); i++)
        {
            var list = new List<int>();
            for (var j = 0; j < nabc[0]; j++)
                if(((i>>j)&1)==1)
                    list.Add(ls[j]);
            if (list.Count < 3) continue;
            for (var j = 0; j < 3; j++)
                dfs(list, new List<int>[] { new List<int>(), new List<int>(), new List<int>() }, j, 0, new[] { nabc[1], nabc[2], nabc[3] });

        }
        WriteLine(res);
    }
    private static void dfs(List<int> sele,List<int>[] psele,int index,int de,int[] abc)
    {
        if (de == sele.Count)
        {
            var sum = int.MaxValue;
            for (var i = 0; i < 3; i++)
                if (psele[i].Count == 0) return;
            var s = new[] { psele[0].Sum(), psele[1].Sum(), psele[2].Sum() };
            for (var i = 0; i < 3; i++) {
                for (var j = 0; j < 3; j++)
                {
                    if (i == j) continue;
                    sum = Min(sum, Abs(abc[0] - s[i]) + Abs(abc[1] - s[j]) + Abs(abc[2] - s[3-i-j]));
                }
            }
            res = Min(res, sum + (sele.Count - 3) * 10);
            return;
        }
        psele[index].Add(sele[de]);
        for (var i = 0; i < 3; i++)
            if(i==0||de!=sele.Count)
                dfs(sele, psele, i,de + 1,abc);
        psele[index].RemoveAt(psele[index].Count - 1);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}

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

#define ll long long

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

    int n,m;
    cin>>n>>m;
    int ans = n/m;
    if(n%m)
    	ans++;
    cout<<ans;

}

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

ans = 0
for i in range(N):
    a = min(A[i], B[i])
    ans += a
    B[i] -= a
    b = min(A[i+1], B[i])
    ans += b
    A[i+1] -= b
print(ans)


Measured memory_bytes: 18624
def solve():
  n,l = map(int,input().split())
  
  length = [int(input()) for i in range(n)]
  pare = [(length[i], i) for i in range(n)]
  pare.sort(reverse=True)
  ind = [p[1] for p in pare]
  dp = [0] * (n + 1)
  for i in ind:
    if i == 0:
      dp[i] = dp[i + 1] + (l - length[i])
    else:
      dp[i] = max(dp[i - 1], dp[i + 1]) + (l - length[i])
  print(max(dp))
solve()


Measured memory_bytes: 24784
stdin.ReadLine()
|> fun x -> x.Split() |> Array.map int |> fun x -> (x.[0], x.[1])
|> fun (n, q) ->
  (
    List.init (n - 1) (fun _ -> stdin.ReadLine() |> fun x -> x.Split() |> Array.map int |> fun x -> (x.[0], x.[1])),
    List.init q       (fun _ -> stdin.ReadLine() |> fun x -> x.Split() |> Array.map int |> fun x -> (x.[0], x.[1]))
  )
  |> fun (nabs, qpxs) ->
    (
      (
        (Array.create (n + 1) [])
        |> fun (edges: int list array) ->
          nabs
          |> List.iter (
            fun  (a, b) ->
              (
                (edges.[a] <- b::edges.[a]),
                (edges.[b] <- a::edges.[b])
              )
              |> ignore
          )
          |> fun () -> edges
      ),
      (
        (Array.zeroCreate (n + 1))
        |> fun (points: int array) ->
          qpxs
          |> List.iter (
            fun (p, x) ->
              (points.[p] <- points.[p] + x)
          )
          |> fun () -> points
      )
    )
  |> fun (edges, points) ->
    (
      [| [(0, 1)] |],
      Array.zeroCreate (n + 1)
    )
    |> fun ((stack: (int * int) list array), (ans: int array)) ->
      Seq.initInfinite (
        fun _ ->
          match stack.[0] with
          | [] -> ()
          | (pi, ci)::ts ->
            (ans.[ci] <- ans.[pi] + points.[ci])
            |> fun () ->
              match edges.[ci] with
              | [] -> (stack.[0] <- ts)
              | cs ->
                cs
                |> List.filter ((<>) pi)
                |> List.map (fun i -> (ci, i))
                |> fun hs -> (stack.[0] <- (hs @ ts))
      )
      |> Seq.takeWhile (fun _ -> stack.[0] |> List.isEmpty |> not)
      |> Seq.length
    |> fun _ -> ans
|> fun ans ->
  ans
  |> Array.skip 1
  |> Array.map string
  |> String.concat " "
|> printfn "%s"

// -----

// 4 3
// 1 4
// 1 3
// 2 3
// 2 10
// 1 100
// 3 1

// edges: [|[]; [3; 4]; [3]; [2; 1]; [1]|]
// points: [|0; 100; 10; 1; 0|]
// ans: [|0; 0; 0; 0; 0|]

// pi: 0, ci: 1, stack: [(0, 1)]
//   ans: [|0; 100; 0; 0; 0|]
//   cs: [3; 4]
// pi: 1, ci: 3, stack: [(1, 3); (1, 4)]
//   ans: [|0; 100; 0; 101; 0|]
//   cs: [2; 1]
// pi: 3, ci: 2, stack: [(3, 2); (3, 1); (1, 4)]
//   ans: [|0; 100; 111; 101; 0|]
//   cs: [3]
// pi: 1, ci: 4, stack: [(1, 4)]
//   ans: [|0; 100; 111; 101; 100|]
//   cs: [1]

// 100 111 101 100

// -----


Measured memory_bytes: 97876
import sys
def main():
    input = sys.stdin.readline
    N,M=map(int, input().split())
    AB=[tuple(map(int, input().split())) for _ in range(M)]
    from operator import itemgetter
    AB.sort(key=itemgetter(1))
    ans=0
    last=-1
    for a,b in AB:
        if last<=a:
            ans+=1
            last=b
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 56924
#include <stdio.h>

int main()
{
	int K,A,B;
	int flag=0;

	scanf("%d",&K);
	scanf("%d" "%d",&A,&B);

	for(int i=A/K;i<=B/K;i++)
	{
		if(A<=K*i && K*i<=B)
			flag=1;
	}

	if(flag==1)
		printf("OK");
	else
		printf("NG");
	
	return 0;
}

Measured memory_bytes: 1732
from math import ceil
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

def possible(x):
    count = 0
    for a in A:
        if a <= x:
            return True
        count += int(ceil(a/x)) - 1
        if count > K:
            return False
    return True

def solve():
    lo, hi = 0, A[0]
    while lo < hi-1:
        mi = (hi + lo) // 2
        if possible(mi):
            hi = mi
        else:
            lo = mi
    return hi

if __name__ == "__main__":
    print(solve())


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

int main() {
  char a;
  cin >> a;
 
  if (a=='A'||a=='B'||a=='C'||a=='D'||a=='E'||a=='F'||a=='G'||a=='H'||a=='I'||a=='J'||a=='K'||a=='L'||a=='M'||a=='N'||a=='O'||a=='P'||a=='Q'||a=='R'||a=='S'||a=='T'||a=='U'||a=='V'||a=='W'||a=='X'||a=='Y'||a=='Z'){
    cout << 'A' << endl;
  }
  else {
    cout << 'a' << endl;
  }
}

Measured memory_bytes: 3620
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    switch (A){
    case 1:
      if (B==2){
        System.out.println("3");
      } else {
        System.out.println("2");
      }
      break;
    case 2:
      if (B==1){
        System.out.println("3");
      } else {
        System.out.println("1");
      }
      break;
    case 3:
      if (B==1){
        System.out.println("2");
      } else {
        System.out.println("1");
      }
      break;
    }
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include <cstring>
using namespace std;
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int x;
    cin>>x;
    string s;
    map<char,ll>m;
    for (int i=0;i<x;i++){
        cin>>s;
        m[s[0]]++;
    }
    ll ans=0;
    ll y[5];
    y[0]=m['A'];
    y[1]=m['C'];
    y[2]=m['H'];
    y[3]=m['M'];
    y[4]=m['R'];
    for (int i=0;i<3;i++)
        for (int j=i+1;j<4;j++)
        for (int k=j+1;k<5;k++)
        ans+=y[i]*y[j]*y[k];
    cout<<ans<<endl;
    return 0;
}


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

int main(void) {
    unsigned long long x;
    cin >> x;
    unsigned long long yen = 100;
    int count = 0;
    while (1) {
        yen *= 1.01;
        count++;
        if (yen >= x) {
            break;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3636
//clear adj and visited vector declared globally after each test case
//check for long long overflow
//while adding and subs check if mod becomes -ve
//while using an integer directly in a builtin function add ll

#include <bits/stdc++.h>
#define int long long
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);cout.precision(dbl::max_digits10);
#define pb push_back
#define mod 1000000007 //998244353
#define lld long double
#define mii map<int, int>
#define mci map<char, int>
#define msi map<string, int>
#define pii pair<int, int>
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rep(i,x,y) for(int i=x; i<y; i++)
#define fill(a,b) memset(a, b, sizeof(a))
#define vi vector<int>
#define setbits(x) __builtin_popcountll(x)
typedef std::numeric_limits< double > dbl;
using namespace std;
const long long N=200005, INF=2000000000000000000;
int power(int a, int b, int p)
    {
        if(a==0)
        return 0;
        int res=1;
        a%=p;
        while(b>0)
        {
            if(b&1)
            res=(res*a)%p;
            b>>=1;
            a=(a*a)%p;
        }
        return res;
    }

int32_t main()
{
    IOS;
    int n,ans=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            for(int k=1;k<=n;k++)
            {
                ans+=__gcd(i, __gcd(j, k));
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ULL;
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ULL X,Y;
	cin >> X >> Y;
	ULL t = X;
	ULL cnt = 0;
	while(t<=Y) {
		cnt++;
		t *= 2;
	}
	cout << cnt << endl;
	return 0;
}


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

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

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

    string s;
    cin >> s;

    int cnt = 0;
    REP(0, i, N) {
        if (s[i] == 'R') {
            cnt++;
        }
    }

    if (2 * cnt > N) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256