akhauriyash/Code-Regression huggingface dataset:
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using mcl = map<char, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

void _yn(bool p) {
	p ? _y() : _n();
}

void _YN(bool p) {
	p ? _Y() : _N();
}


LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 



/*****************************************************************************/

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

	int n, a, b;
	cin >> n >> a >> b;
	n = b - a - 1;
	if (n % 2 == 0) {
		cout << "Borys";
	}
	else {
		cout << "Alice";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
struct point{
double x;
double y;
};
int main(){
point *p = new point[4];
int n;
cin >> n;
for(;n;n--){
cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y >> p[2].x >> p[2].y >> p[3].x >> p[3].y;
if((p[0].y-p[1].y)/(p[0].x-p[1].x)==(p[2].y-p[3].y)/(p[2].x-p[3].x))
cout << "YES" << endl;
else
cout << "NO" << endl;
}
delete []p;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
 
#define INF (1e9)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
 

 
int vector_finder(std::vector<int> vec, int number) {
  size_t index = std::distance( vec.begin(), std::find(vec.begin(), vec.end(), number) );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int gcd(int a,int b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

int N;

int main()
{
	cin >> N;
	int A[N];
	REP(i,N){
		cin >> A[i];
		A[i]-=i;
	}
	sort(A, A + N);
	ll ans = 0;
	if (N % 2 != 0)
	{
		int index = (N + 1) / 2 - 1;
		int nn = A[index];
		REP(i,N){
			ans += abs(A[i] - nn);
		}
	}else{
		int index = N / 2;
		int nn = A[index];
		ll ans1 = 0;
		REP(i, N)
		{
			ans1 += abs(A[i] - nn);
		}
		nn = A[index - 1];
		ll ans2= 0;
		REP(i, N)
		{
			ans2 += abs(A[i] - nn);
		}
		ans = min(ans1, ans2);
	}

	cout<< ans << endl;

	return 0;
}

Measured memory_bytes: 1024
/*
// 枝狩り無し全探索だと流石にきついか？ -> 普通に0.43secで通った
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

vector<pair<int,int>> v;
int m, ans;

void dfs(int pos, int res){
    if(res == 0){
        ans++;
        return;
    }
    if(pos == m)    return;
    for(int j = min(v[pos].second, res/v[pos].first); j >= 0; j--){
        dfs(pos+1, res-j*v[pos].first);
    }
}

int main(){
    while(cin >> m, m){
        v.resize(m);
        for(int i = 0; i < m; i++)  cin >> v[i].first >> v[i].second;
        sort(v.rbegin(), v.rend());
        int g, n;
        cin >> g;
        while(g-- > 0){
            cin >> n;
            ans = 0;
            dfs(0, n);
            cout << ans << endl;
        }
    }
    return 0;
}
*/

// 恐らく想定解であるDP
#include<iostream>
using namespace std;

int main(){
    int m;
    while(cin >> m, m){
        int a, b, dp[1001] = {}, g, n;
        dp[0] = 1;
        for(int i = 0; i < m; i++){
            cin >> a >> b;
            for(int j = 1000; j >= 0; j--){
                for(int k = 1; k <= b; k++){
                    if(j-a*k < 0)   break;
                    dp[j] += dp[j-a*k];
                }
            }
        }
        cin >> g;
        while(g-- > 0){
            cin >> n;
            cout << dp[n] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3040
use std::io::stdin;
use std::str::FromStr;
#[allow(dead_code, unused_mut)]
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().parse().ok().expect("1")
}
#[allow(dead_code, unused_mut)]
fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().expect("2"))
        .collect()
}
#[allow(dead_code, unused_mut)]
fn read_two<T: FromStr>() -> (T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code, unused_mut)]
fn read_three<T: FromStr>() -> (T, T, T) {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    let mut x = s.split_whitespace().map(|x| x.parse().ok().unwrap());
    (x.next().unwrap(), x.next().unwrap(), x.next().unwrap())
}
#[allow(dead_code)]
fn remove_whitespace(s: &str) -> String {
    s.chars().filter(|c| !c.is_whitespace()).collect()
}
use std::io::{Write, stdout};
fn main() {
    let s: String = read();
    let mut a = 0;
    let mut ans: Vec<i32> = Vec::new();
    for i in s.chars() {
        if i == 'A' || i == 'T' || i == 'G' || i == 'C' {
            a += 1;
        } else {
            ans.push(a);
            a = 0;
        }
    }
    ans.push(a);
    ans.sort();
    println!("{}", ans.last().unwrap());
}

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

using namespace std;

int main(void) {
  int N, D;
  cin >> N >> D;
  int answer = N / (2 * D + 1);
  if (N % (2 * D + 1) != 0) {
   	answer++; 
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
def inpl(): return map(int, input().split())
N, C = inpl()

S = [tuple(inpl()) for _ in range(N)]

R1 = [0]*N
R2 = [0]*N
L1 = [0]*N
L2 = [0]*N

cal = 0
nak = 0
ans1 = 0
ans2 = 0
for i, (x, v) in enumerate(S):
    cal += v
    ans1 = max(ans1, cal-x)
    ans2 = max(ans2, cal-2*x)
    R1[i] = ans1
    R2[i] = ans2


cal = 0
nak = 0
ans1 = 0
ans2 = 0
for i, (x, v) in enumerate(S[::-1]):
    x = C-x
    cal += v
    ans1 = max(ans1, cal-x)
    ans2 = max(ans2, cal-2*x)
    L1[-1-i] = ans1
    L2[-1-i] = ans2


ans = 0

for i in range(N-1):
    ans = max(ans, R2[i]+L1[i+1], R1[i]+L2[i+1])

ans = max(ans, R1[-1], L1[0])
print(ans)

Measured memory_bytes: 29932
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    N = input()
    if N == N[::-1]:
        print(Yes)
    else:
        print(No)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3948
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <utility>
#include <complex>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <tuple>
#include <bitset>
#include <limits>
#include <algorithm>
#include <array>
#include <random>
#include <complex>
#include <regex>
#include <iomanip>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fcout cout << fixed << setprecision(10)
#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define all(x) x.begin(), x.end()
const ll inf = 1e18;
const ll mod = 1e9 + 7;

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

// mod. m での a の逆元 a^(-1) を計算する。
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int query[60][5];
int n, m, q, ans=0;
int a[11] = {0};

void dfs(int index, int lastnum){
    a[index] = lastnum;
    if(index == n-1){
        int tmp=0;
        rep(i,q){
            if(a[query[i][1]] - a[query[i][0]] == query[i][2]) tmp += query[i][3];
        }
        // rep(i,n) cout << a[i] << " ";
        // cout << "tmp = " << tmp << endl;
        ans = max(ans, tmp);
    }else{
        for(int i=lastnum; i<=m; i++){
            dfs(index+1, i);
        }
    }
}

int main(){
    cin >> n >> m >> q;
    rep(i,q){
        int a, b;
        cin >> a >> b >> query[i][2] >> query[i][3];
        query[i][0] = a-1;
        query[i][1] = b-1;
    }
    dfs(0, 1);
    cout << ans << endl;
}



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

#define pb push_back
#define vi vector < int >
#define ii pair < int, int >
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define ll long long
#define x first
#define y second
#define mp make_pair
#define FOR( i, lo, hi ) for( int i = (lo);i < (hi);i++ )
#define DFOR( i, hi, lo ) for( int i = (hi);i >= (lo);i-- )
#define pqueue priority_queue

using namespace std;

const long long int MOD = 1e9 + 7;

ll REM( ll a )
{
	a %= MOD;
	if ( a < 0 ) a += MOD;
	return a;
}

ll ADD( ll a, ll b )
{
	return REM( REM( a ) + REM( b ) );
}

ll SUB( ll a, ll b )
{
	return REM( REM( a ) - REM( b ) );
}

ll MUL( ll a, ll b )
{
	return REM( REM( a ) * REM( b ) );
}

ll POT( ll n, ll k )
{
	if ( k == 0 ) return 1;

	ll ret = POT( n, k / 2 );
	ret = MUL( ret, ret );

	if ( k % 2 ) return MUL( ret, n );
	return ret;
}

ll DIV( ll a, ll b )
{
   return MUL( a, POT( b, MOD - 2 ) );
}

bool isPrime( ll x )
{
   if ( x == 1 )
	   return 0;
	for ( ll i = 2;i <= sqrt( x ); i++ )
		if ( x % i == 0 )
		   return 0;
	return 1;
}

const int MAXN = 2e5 + 10;

string s;
int n;

int main()
{
   ios_base::sync_with_stdio( false );
   cin.tie( 0 );
   
	cin >> n;
	cin >> s;
	int ans = 0;
	FOR( i, 0, n - 2 )
	{
		if ( s[ i ] == 'A' && s[ i + 1 ] == 'B' && s[ i + 2 ] == 'C' )
			ans++;
	}
	cout << ans << "\n";

   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int R,G,B,N; cin>>R>>G>>B>>N;
  int cnt=0;
  for(int i=0;i<=N;i++){
      for(int j=0;j<=N;j++){
          int k=N-(i*R+j*G);
          if(k>=0 && k%B==0) cnt++;
      }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
s = input()
t = input()
ans = len(t)

for i in range(len(s)):
    if i+len(t) > len(s):
        break
    u = s[i:i+len(t)]
    cnt = 0
    for j in range(len(t)):
        if t[j] != u[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

Measured memory_bytes: 73476
#include<iostream>

using namespace std;

long long N,M;
int i,j;
long long a[105];
long long b[105];
/*
void solver(long long n){
//	cout<<endl<<M<<"&"<<endl;
	if(n==1){
		i++;
		b[i]=M--;
		return ;
	}
	if(n&1) {
		i++;
		b[i]=M--;
//		cout<<i<<"*";
		solver(n>>=1);
		
	}
	else{
		j++;
		a[j]=M--;
		solver(n-1);
	}
}
*/
int main()
{
	long long N;
	cin>>N;
	M=100;
	long long x=N;
	while(x>0){
		if(x&1){
			b[++i]=M--;
			x>>=1;
		}
		else {
			a[++j]=M--;
			x-=1;
		}
	}	
//	solver(N);
	cout<<2*(i+j)<<endl;
	for(int m=1;m<=j;m++){
		cout<<a[m]<<" ";
	}
	for(int m=i;m>=1;m--){
		cout<<b[m]<<" ";
	}
	
//	cout<<" ! "<<i<<" ! "<<j<<"!";
	for(int m=101-i-j;m<=100;m++){
		cout<<m<<" ";
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int d[10]={};
bool f;
void dfs(int l,int r, int s){
  if(s==10) f=true;
  //cout << l << r << d[s] << endl;
  if(l<d[s]){
    dfs(d[s],r,s+1);
  }
  if(r<d[s]){
    dfs(l,d[s],s+1);
  }
}
int main(){
  int n;cin >> n;
  while(n--){
    int r=0,l=0;
    f=false;
    for(int i=0;i<10;i++){
      cin >> d[i];
      //cout << l << ":" << r << endl;
    }
    dfs(0,0,0);
    if(!f) cout << "NO" << endl;
    else cout << "YES" << endl;
  }  
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  int a[110];
  cin >> N;
//  cout << N;
  for (int i=0;i<N;i++){
    cin >> a[i];
//    cout << a[i];
  }
  sort(a,a + N,greater<int>());
  int mycount = 0;
  for (int i=0 ;i<N-2;i++){
    for (int j=i+1;j<N-1;j++){
      for(int k=j+1;k<N;k++)
        if(a[i]<(a[j]+a[k])){
          if (a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k]){
          mycount++;
//          cout << a[i] << " " << a[j] << " " << a[k] << endl;
          }
        }
     }
   }
  cout << mycount << endl;
   return 0;
 }

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

int main()
{
	int n;
	cin >> n;
	vector<int> hs(n);
	for (auto &h : hs)
	{
		cin >> h;
	}
	vector<int> now(n, 0);
	int ans = 0;
	while (now != hs)
	{
		int l = 0, r = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = i; j < n; j++)
			{
				bool f = true;
				for (int k = i; k <= j; k++)
				{
					f &= now[k] < hs[k];
				}
				if (f && r - l + 1 <= j - i + 1)
				{
					l = i;
					r = j;
				}
			}
		}
		for (int i = l; i <= r; i++)
		{
			now[i]++;
		}
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

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

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

const ll mod = 1000000007;
const int INF = 1<<29;

int main(){
  int N, M; cin >> N >> M;
  vector<int> s(M);
  vector<int> c(M);
  rep(i, M) cin >> s[i] >> c[i];

  int res = 0;
  if (N == 3){
    int a, b, d;
    bool flag_1 = false, flag_2 = false, flag_3 = false;
    for (int i = 0; i < M; ++i){
      if (s[i] == 1 && c[i] == 0) {cout << -1 << endl; return 0;}
      for (int j = i + 1; j < M; ++j){
        if (s[i] == s[j] && c[i] != c[j]) {cout << -1 << endl; return 0;}
      }
      if (s[i] == 1) {a = c[i]; flag_1 = true;}
      else if (s[i] == 2) {b = c[i]; flag_2 = true;}
      else {d = c[i]; flag_3 = true;}
    }
    if (!flag_1) a = 1;
    if (!flag_2) b = 0;
    if (!flag_3) d = 0;
    res = 100 * a + 10 * b + d;
  }
  else if (N == 2){
    int a, b;
    bool flag_1 = false, flag_2 = false;
    for (int i = 0; i < M; ++i){
      if (s[i] == 1 && c[i] == 0) {cout << -1 << endl; return 0;}
      for (int j = i + 1; j < M; ++j){
        if (s[i] == s[j] && c[i] != c[j]) {cout << -1 << endl; return 0;}
      }
      if (s[i] == 1) {a = c[i]; flag_1 = true;}
      else {b = c[i]; flag_2 = true;}
    }
    if (!flag_1) a = 1;
    if (!flag_2) b = 0;
    res = 10 * a + b;
  }
  else{
    int a;
    bool flag_1 = false;
    for (int i = 0; i < M; ++i){
      for (int j = i + 1; j < M; ++j){
        if (s[i] == s[j] && c[i] != c[j]) {cout << -1 << endl; return 0;}
      }
      if (s[i] == 1) {a = c[i]; flag_1 = true;}
    }
    if (!flag_1) a = 0;
    res = a;
  }


  cout << res << endl;
}


Measured memory_bytes: 256
a, b, c, x, y = gets.split.map(&:to_i)

ans = 0
if a + b > 2 * c
  c_count = [x, y].min
  ans += c_count * 2 * c
  x -= c_count
  y -= c_count

  if x > 0
    if a > 2 * c
      ans += x * 2 * c 
    else
      ans += x * a 
    end
  elsif y > 0
    if b > 2 * c
      ans += y * 2 * c 
    else
      ans += y * b 
    end
  end
else
  ans = a * x + b * y
end

puts ans

Measured memory_bytes: 1788
w, h, a = input().split()
w, h= int(w), int(h)
for i in range(h):
    if i in {0, h -1}:print("+" + "-" * (w - 2) + "+")
    else:print("|" + "." * ((w - 2) // 2) + a + "." * ((w - 2) // 2) + "|" if i == h // 2 else "|" + "." * (w - 2) + "|")


Measured memory_bytes: 5604
# -*- coding: utf-8 -*-
from sys import stdin, stdout


def read():
    x0 = stdin.readline().rstrip()
    return x0


def __main__():

    n, m = map(int, read().split())
    a = [int(i) for i in read().split()]

    sa = sum(a)
    min_p = sa / (4*m)

    b = 0
    for j in a:
        if j >= min_p:
            b += 1

    if b < m:
        print('No')
    else:
        print('Yes')

__main__()

Measured memory_bytes: 38256
#include <stdio.h>

int main(void)
{
	int a, b;
	
	scanf("%d %d", &a, &b);
	
	if (a > b) printf("a > b\n");
	else
	if (a < b) printf("a < b\n");
	else
	printf("a == b\n");
		
	return 0;
}

Measured memory_bytes: 580
/*
* @Author: Kabid
* @Date:   {{create_time}}
* @Last Modified by:   Kabid
* @Last Modified time: 2020-09-19 13:41:17
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define  in(x) scanf("%d",&x);
#define out(x) printf("%d",x);
#define  ins(x)  scanf("%s",x);
#define outs(x) printf("%s",x);
#define lin puts("");
#define _ putchar(' ');

int t;       //test cases
ll i, j;	 //iterators
ll n, k , p, q,  d, m, c, c1, c2, d1; //variables;
ll mx = LLONG_MIN, mn = LLONG_MAX;		// max min
string s, s1, s2;		// string
ll a [1000001], b [200001] , mox [200001];	// array
map <int, int > mp;
vector <vector<ll>> vc;
vector <ll> v;
set <ll> st;
bool r;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cin >> t; q = t;
	t = 1;
	while (t--) {


		/*cin >> s;
		n = s.size();
		for (i = n - 1; i > 0; i--) {
			for (j = i - 1; j >= 0; j--) {
				if (s[i] > s[j]) {
					swap(s[i], s[j]);
					cout << s << endl;
					break;
				}
			}
			if(j!=-1) break;
		}
		if (i == 0) {
			cout << "no answer" << endl;
		}*/
		cin >> n;
		//n=s.size();
		
		cout<<!n<<endl;
	}


	return 0;

}

Measured memory_bytes: 3540
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}()

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = nextInt()
	}
	return ints
}

func breakBrick(bricks []int) (brokenCount int, isSuccess bool) {
	bi := 1 //仮想的なインデックス
	for _, v := range bricks {
		if bi == v {
			bi++
			continue
		}
		brokenCount++
	}
	if len(bricks) != brokenCount {
		isSuccess = true
	}
	return
}

func main() {
	n := nextInt()
	ints := nextInts(n)
	bc, ok := breakBrick(ints)
	if ok {
		fmt.Println(bc)
	} else {
		fmt.Println(-1)
	}
}


Measured memory_bytes: 3840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

class Main{
	static int map[][];
	static int fl[][] = {{4, 2}, {2, 4}};
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		Main app = new Main();
		String string, str[];
		
		int w, h, n, t[][], c, d, x, y;
		boolean visit[][], judge;
		while(!(string = reader.readLine()).equals("0 0")){
			str = string.split(" ");
			w = Integer.valueOf(str[0]);
			h = Integer.valueOf(str[1]);
			
			map = new int[w][h];
			visit = new boolean[w][h];
			judge = false;
			
			t = new int[2][2];
			for(int i = 0; i < 2; i++){
				str = reader.readLine().split(" ");
				t[i][0] = Integer.valueOf(str[0]) - 1;
				t[i][1] = Integer.valueOf(str[1]) - 1;
			}
			n = Integer.valueOf(reader.readLine());
			for(int i = 0; i < n; i++){
				str = reader.readLine().split(" ");
				c = Integer.valueOf(str[0]);
				d = Integer.valueOf(str[1]);
				x = Integer.valueOf(str[2]) - 1;
				y = Integer.valueOf(str[3]) - 1;
				
				app.set(c, d, x, y);
			}
			
			Stack<int[]> s = new Stack<int[]>();
			s.push(t[0]);
			
			int sign = map[t[0][0]][t[0][1]];
			while(!s.isEmpty()){
				int now[] = s.pop();
				
				if(now[0] < 0 || now[0] >= w || now[1] < 0 || now[1] >= h || visit[now[0]][now[1]] || map[now[0]][now[1]] != sign) continue;
				visit[now[0]][now[1]] = true;
				
				if(now[0] == t[1][0] && now[1] == t[1][1]){
					judge = true;
					break;
				}
				
				s.push(new int[]{now[0] + 1, now[1]});
				s.push(new int[]{now[0] - 1, now[1]});
				s.push(new int[]{now[0], now[1] + 1});
				s.push(new int[]{now[0], now[1] - 1});
			}
			
			System.out.println(judge ? "OK" : "NG");
		}
		reader.close();
	}
	
	public void set(int c, int d, int x, int y){
		for(int i = 0; i < fl[d][0]; i++){
			for(int j = 0; j < fl[d][1]; j++){
				map[x + i][y + j] = c;
			}
		}
	}
}

Measured memory_bytes: 25884
#include <iostream>
#include <string.h>
using namespace std;

int main() {
	int t_z=0, t_a=0;
	char s[200005];
	cin >> s;
	for(int i=0;i<=strlen(s);i++){
		if(s[i] == 'Z'){
			t_z = i+1;
		}
	}
	for(int i=strlen(s);i>=0;i--){
		if(s[i] == 'A'){
			t_a = i+1;
		}
	}
	
	cout << t_z - t_a + 1 << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

main()
{
        int a,b,c; cin>>a>>b>>c;
        int cnt=0;
        bool poison=false;
        while(true)
        {
                if(!poison && c>0)
                {
                        c--;
                        cnt++;
                        poison=true;
                }else if(b>0)
                {
                        b--;
                        cnt++;
                        poison=false;
                }else if(a>0)
                {
                        a--;
                        poison=false;
                }

                if(c+b==0)break;
                if(poison && a+b==0)break;
        }

        cout<<cnt<<endl;
}


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

int main(void) {
  int N, ma = -1;
  string S;
  cin >> N >> S;
  for (int i = 1; i < N; i++) {
    set<char> l;
    set<char> r;
    int count = 0;
    for (int j = 0; j < i; j++) l.insert(S[j]);
    for (int j = i; j < N; j++) r.insert(S[j]);
    for (auto c : l) {
      if (r.find(c) != end(r)) count++;
    }
    ma = max(ma, count);
  }
  cout << ma << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define ff first
#define ss second
#define pb push_back
#define mod 1000000007
#define pl pair<lli,lli>
#define vl vector<lli>
#define vvl vector<vl>
#define INF (lli)1e15

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli t=1;
    //cin>>t;
    while(t--)
    {
        lli n,i,ans=INF;        
        cin>>n;
        lli a[n+1];
        lli dp[n+1];
        dp[1]=dp[0]=0;
        a[0]=INF;
        cin>>a[1];
        for(i=2;i<=n;i++)
        {
            cin>>a[i];
            dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
        }
        cout<<dp[n]<<"\n";
    }
    return 0;
}

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

int main() {
    while(1){
        int H, W;
        cin >> H >> W;
        if (H == 0 && W == 0){
            break;
        }

        for(int i = 0; i < W ; i++){
            cout << "#";
        }
        cout << endl;
        for(int j = 1; j < H - 1; j++){
            cout << "#";
            for(int i = 1; i < W -1 ; i++){
                cout << ".";
            }
            cout << "#" << endl;
        }
        for(int i = 0; i < W ; i++){
            cout << "#";
        }
        cout << endl;
        cout << endl;
    }
}

Measured memory_bytes: 1152
/**-------------------------
|--------From A.R.A--------|
-------------------------**/

#include <bits/stdc++.h>

#define ll            long long int
#define pb            push_back
#define ull           unsigned long long int
#define endl          "\n"
#define sz(c)         (c).size()
#define sall(c)       sort((c).begin(),(c).end())
#define rsall(c)      sort((c).rbegin(),(c).rend())
#define rev(c)        reverse((c).begin(),(c).end())
#define FOR(i,n)      for(ll i=0;i<n;i++)
#define max3(a,b,c)   max(max(a,b),c)
#define min3(a,b,c)   min(min(a,b),c)
#define input(a,i,n)  for(ll i=1;i<=n;i++){     cin>>a[i];}
#define output(a,i,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}

using namespace std;
int64_t R=1;
void solution(){
    int64_t n,ans=0;
    long double d=0;
    cin>>n>>d;
    for(int i=0;i<n;i++){
        int64_t x,y;
        cin>>x>>y;
        long double d1=sqrt(x*x+y*y);
        if(d1<=d){ans++;}
    }
    cout<<ans<<endl;
}
int main()
{
    //cin>>R;
    FOR(i,R){solution();}
    return 0;
}


Measured memory_bytes: 3716
import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main {

static long[] list=new long[87];

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

   String nyuA=sc.nextLine();
//  String nyuB=sc.nextLine(); 
 

   String[] s=sc.nextLine().split(" ");
 //    String[] t=sc.nextLine().split("");

int N=Integer.parseInt(nyuA);
int D=Integer.parseInt(s[0]);
int X=Integer.parseInt(s[1]);

int res=0;
for(int i=0;i<N;i++){
int temp=Integer.parseInt(sc.nextLine());

int count=0;

while(true){
if(count*temp+1<=D){
res++;
}else{
break;
}
count++;
}

}

System.out.println(res+X);



}

}



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

int n;

void add_self(ll& a,ll b){
    a+=b;
    if(a>=mod)
        a%=mod;
}

vector<vector<ll>> mul(vector<vector<ll>> a,vector<vector<ll>> b){
    vector<vector<ll>> res(n,vector<ll>(n));

    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                res[i][k]+=(a[i][j]*b[j][k])%mod;
                res[i][k]%=mod;
            }
        }
    }
    return res;
}

int main()
{
    ll k;

    cin>>n>>k;

    vector<vector<ll>>edges (n,vector<ll>(n));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++)
            cin>>edges[i][j];
    }
    vector<vector<ll>> res(n,vector<ll>(n));
    for(int i=0;i<n;i++) res[i][i]=1;
     while(k){
        if(k%2) res=mul(res,edges);
          edges=mul(edges,edges);
        k/=2;
     }
    ll answer=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
        add_self(answer,res[i][j]);
        }
    }
    cout<<answer;

}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

using namespace std;
const int MAX_N=17;
typedef vector<int> vec;
int N,A,B;
vec slv(int n,int a,int b){
	vec ret(1<<n);
	if(n==1){
		ret[0]=a;
		ret[1]=b;
	}else{
		int c=a^b;
		vec v,u;
		if(c<(1<<(n-1))){
			v=slv(n-1,0,c);
			u=slv(n-1,0,v[1]);
			for(auto &i:u){
				i|=1<<(n-1);
			}
			ret[0]=0;
			REP(i,1<<(n-1)){
				ret[i+1]=u[i];
			}
			REP(i,(1<<(n-1))-1){
				ret[(1<<(n-1))+1+i]=v[i+1];
			}
		}else{
			v=slv(n-1,0,1);
			u=slv(n-1,1,c-(1<<(n-1)));
			REP(i,1<<(n-1)){
				ret[i]=v[i];
			}
			REP(i,1<<(n-1)){
				ret[i+(1<<(n-1))]=u[i]+(1<<(n-1));
			}
		}
		REP(i,1<<n){
			ret[i]^=a;
		}
	}
	return ret;
}
			
int main(){
	scanf("%d %d %d",&N,&A,&B);
	int acnt,bcnt;
	acnt=bcnt=0;
	REP(i,N){
		if((A>>i)&1){
			acnt++;
		}
		if((B>>i)&1){
			bcnt++;
		}
	}
	if((bcnt-acnt)%2==0){
		puts("NO");
	}else{
		puts("YES");
		vec ans=slv(N,A,B);
		REP(i,1<<N){
			if(i)putchar(' ');
			printf("%d",ans[i]);
		}
		putchar('\n');
	}
}

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

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> p(N);

    vector<double> exp(1001);

    double sum = 0;

    for (int i = 1; i < 1001; i++)
    {
        for (int j = 1; j < i + 1; j++)
        {
            exp[i] += j;
        }
        exp[i] /= i;
    }

    for (int i = 0; i < N; i++)
    {
        cin >> p[i];

        if (i < K)
        {
            sum += exp[p[i]];
        }
    }

    vector<double> sums(N + 1, 0);

    sums[K - 1] = sum;

    for (int i = K; i < N; i++)
    {
        sum += exp[p[i]] - exp[p[i - K]];
        sums[i] = sum;
    }

    sort(sums.begin(), sums.end(), greater<double>());

    cout << fixed << setprecision(10) << sums[0] << endl;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reprev(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    ll q, q1, q2, fo_i, la_i;
    string s;
    bool reverse = false;
    cin >> s >> q;

    char fo[q];
    char la[q];
    fo_i = 0;
    la_i = 0;

    rep(i, q)
    {
        cin >> q1;
        if (q1 == 1)
        {
            reverse = !reverse;
        }
        else
        {
            char c;
            cin >> q2 >> c;

            if (q2 == 1)
            {
                if (reverse)
                {
                    la[la_i] = c;
                    la_i++;
                }
                else
                {
                    fo[fo_i] = c;
                    fo_i++;
                }
            }
            else
            {
                if (reverse)
                {
                    fo[fo_i] = c;
                    fo_i++;
                }
                else
                {
                    la[la_i] = c;
                    la_i++;
                }
            }
        }
    }

    fo[fo_i] = '\0';
    la[la_i] = '\0';
    string fos = string(fo);
    string las = string(la);
    if (reverse)
    {
        std::reverse(all(las));
        std::reverse(all(s));
        cout << las;
        cout << s;
        cout << fos << endl;
    }
    else
    {
        std::reverse(all(fos));
        cout << fos;
        cout << s;
        cout << las << endl;
    }
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <algorithm>
#include<string>
using namespace std;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int a[7] = {1, 3, 5, 7, 8, 10, 12};
    int b[4] = {4, 6, 9, 11};
    int x, y;
    cin >> x >> y;
    int count_a = 0;
    int count_b = 0;
    for (int i = 0; i < 7; ++i) {
        if (x == a[i]) ++count_a;
        if (y == a[i]) ++count_a;
    }

    for (int i = 0; i < 4; ++i) {
        if (x == b[i]) ++count_b;
        if (y == b[i]) ++count_b;
    }

    if (count_a == 2 || count_b == 2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
   char s[4];
   scanf("%s", s);
  
   int ans = 0;
   for(int i = 0; i < 3; i++) {
      if(s[i] == s[i+1]) {
         ans++;
      }
   }

   if(ans == 0) {
      printf("Good");
   } else {
      printf("Bad");
   }
}


Measured memory_bytes: 1708
n = int(input())
ans = [0 for _ in range(10004)]
for i in range(1,102):
    for j in range(1,102):
        for k in range(1,102):
            v=i*i+j*j+k*k+i*j+j*k+k*i
            if(v<10004):
                ans[v]+=1
for i in range(1,n+1):
    print(ans[i])

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

int main(){
	int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int topVote = 0, allVote = 0;
  int input;
  rep(i, n){
    cin >> input;
	a.push_back(input);
    allVote+=input;
  }
  sort(a.begin(), a.end(), greater<int>());
//  rep(i, n) cout << a[i] << " ";
//  cout << endl;
  float border = allVote / (4.0 * m);
//  cout << "border:" << border << endl;
  rep(i, m){
 //   cout << a[i] << " " << border << " " << allVote << endl;
    if(a[i] < border){
      cout << "No" << endl;
	  return 0;
    }
  }
  cout << "Yes" << endl;
}

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

int main() {
 
  int n;
  string s;
  cin >> n >> s;
  
  string ans;
  string tmp = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for(int i = 0; i < s.size(); i++) {
    for(int j = 0; j < 26; j++) {
      if(s.at(i) == tmp.at(j)) {
        ans = ans + tmp.at(j+n);
        break;
      }
    }
  }
  cout << ans << endl;
}

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

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

    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])  cout << "Bad";
    else cout << "Good";
}


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

int main()
{
    int n,m;
    cin>>n>>m;
    int A[n],cou=0,i;
    double sum=0,avg;
    for(i=0; i<n; i++)
    {
        cin>>A[i];
        sum+=A[i];
    }

    avg=sum/(4*m);
    for(i=0; i<n; i++)
    {
        if(A[i]>=avg)
            cou++;
    }
    if(cou>=m)
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

using namespace std;

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

	int n = (int)s.size();
	long long sum = 0;

	for (int bit = 0; bit < (1 << (n - 1)); bit++) {
		string s2 = s;
		long long num = 0;
		int temp = 0;
		for (int i = 0; i < n - 1; i++) {
			if (bit & (1 << i)) {
				temp++;
				s2.insert(i + temp, "+");
			}
		}
		for (int i = 0; i < s2.size() + 1; i++) {
			if (s2[i] == '+' || s2[i] == '\0') {
				sum += num;
				num = 0;
			}
			else {
				num = num * 10 + (s2[i] - '0');
			}
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3600
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int K = Integer.parseInt(sc.next());
    String S = sc.next();
    if(S.length() <= K)
      System.out.println(S);
    else
      System.out.println(S.substring(0,K) + "...");
  }
}

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

typedef long long ll;
typedef long double ld;

int pre[1000005];
int suf[1000005];

int main(){
    ios_base::sync_with_stdio(false);
    cout.precision(10);
    cout<<fixed;

    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i=1; i<=n; i++){
        if(s[i-1] == 'W') pre[i]++;
        pre[i] += pre[i-1];
    }
    for(int i=n; i>=1; i--){
        if(s[i-1] == 'E') suf[i]++;
        suf[i] += suf[i+1];
    }
    int mn = n-1;
    for(int i=1; i<=n; i++){
        mn = min(mn, pre[i-1] + suf[i+1]);
    }
    cout << mn;
    return 0;
}


Measured memory_bytes: 5908
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <utility>
#include <cmath>

using namespace std;

typedef pair <int, int> ii;

int dirr[2] = {-1, 0}, dirc[2] = {0, -1};

int H, W;
int A[85][85], B[85][85];
bool possible[85][85][70000];

int main()
{
    scanf("%d%d", &H, &W);
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) scanf("%d", &A[i][j]);
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) scanf("%d", &B[i][j]);
    possible[0][0][(int) abs(A[0][0] - B[0][0])] = true;
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++)
    {
        for (int k = 0; k < 2; k++)
        {
            ii v = ii(i + dirr[k], j + dirc[k]);
            if (v.first < 0 || v.second < 0) continue;
            for (int l = 0; l < 70000; l++)
            {
                if (possible[v.first][v.second][l])
                {
                    int val1 = abs(l + A[i][j] - B[i][j]);
                    int val2 = abs(l + B[i][j] - A[i][j]);
                    possible[i][j][val1] = true;
                    possible[i][j][val2] = true;
                }
            }
        }
    }
    for (int i = 0; i < 70000; i++)
    {
        if (possible[H - 1][W - 1][i])
        {
            printf("%d\n", i);
            return 0;
        }
    }
}


Measured memory_bytes: 463232
nmx = input('')
n = int(nmx.split(' ')[0])
m = int(nmx.split(' ')[1])
x = int(nmx.split(' ')[2])

clist=[]
alist=[]
for i in range(n):
    ca = input('')
    c = ca.split(' ')[0]
    clist.append(c)
    a = []
    for j in range(1,m+1):
        a.append(ca.split(' ')[j])
    alist.append(a)

min_price=99999999999
for i in range(2**n):
    skilllist=[0]*m
    buylist = [0]*n
    cost=0
    for j in range(n):
        if (i>>j )&1:
            buylist[j]=1
            cost+=int(clist[j])
            a = alist[j]
            for k in range(m):
                skilllist[k]+=int(a[k])

    ok = True
    for skill in skilllist:
        if skill < x:
            ok = False
    if ok and cost < min_price:
        min_price=cost
#    print('{}:\\{} :{} ->{} [{}]'.format(i,cost,buylist,skilllist,min_price))
if min_price == 99999999999:
    min_price=-1
print(min_price)



Measured memory_bytes: 9136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a,b,c,x,y,ans,ans0,ans1,ans2;
  	
  	cin>>a>>b>>c>>x>>y;
  	map<ll,ll> mp;
  	mp[x]=a;
  	mp[y]=b;
  	
		ans0=a*x+b*y;
		ans1=c*2*min(x,y)+mp[max(x,y)]*abs(x-y);
        ans2=c*2*max(x,y);
      	ans=min({ans0,ans1,ans2});
    	cout<<ans<<endl;
      return 0;
    
}	

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> p(n);
  vector<int> q(n);
  rep(i,n) cin >> p[i];
  rep(i,n) cin >> q[i];
  vector<int> s(n);
  rep(i,n) s[i]= i+1;
  map<int,vector<int>> mp;
  mp[0] = s;
  int first, second;
  int o=0;
  do {
    mp[o] =s;
    if(s==p) first =o;
    if(s==q) second =o;
    o++;
  } while (next_permutation(s.begin(), s.end()));
  cout << abs(second - first)  << endl;
}


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

ll t[200000];

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

	ll N, T;
	cin >> N >> T;

	for(int i = 0; i < N; i++) {
		cin >> t[i];
	}
	t[N] = 1e18;

	ll sum = 0;
	for(int i = 0; i < N; i++) {
		ll d = t[i + 1] - t[i];
		sum += min(T, d);
	}


	cout << sum << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <cmath>

#define rep(i, n) for(int i=0; i<(int)(n);i++)
#define all(x) (x).begin(), (x).end()
#define debug(a) if(flagdebug){cout << "debug (" #a "):" << endl << (a) << endl;}

typedef uint64_t ulint;
typedef int64_t lint;

using namespace std;



lint a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;

bool flagdebug = false;

int main(){
//////////////////////////////////////////////////////
    // flagdebug = true;

    cin >> n;

    lint ans = 1;
    for(i = 1; i <= n ; i ++)
    {
        ans *= i;
        ans %= 1000000007;
    }

    cout <<  ans  << endl;


//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program {
	static void Main(string[] args) {
		new Calc().Solve();
	}
	public class Calc {
		private Utils.Scan cin = new Utils.Scan();
		public Calc() { }
		public void Solve() {
			var item=Console.ReadLine().Split(' ').ToArray();
			if (item[1][0] == item[0].Last() && item[1].Last() == item[2][0]) {
				Console.WriteLine("YES");
			} else {
				Console.WriteLine("NO");
			}
			return;
		}
	}
}
public static class Utils {
	public class Scan {
		public Scan() { }
		public int ReadInt() => Console.ReadLine().IntParse();
		public int[] ReadInt(char separator) => Console.ReadLine().Split(separator).Select(int.Parse).ToArray();
		public double ReadDouble() => double.Parse(Console.ReadLine());
		public double[] ReadDouble(char separator) => Console.ReadLine().Split(separator).Select(double.Parse).ToArray();
		public long ReadLong() => long.Parse(Console.ReadLine());
		public long[] ReadLong(char separator) => Console.ReadLine().Split(separator).Select(long.Parse).ToArray();
	}
	public static string Docking<T>(this IEnumerable<T> list, Func<T, string> filter = null) {
		StringBuilder sb = new StringBuilder();
		foreach (var item in list) {
			sb.Append(filter == null ? item.ToString() : filter(item));
		}
		return sb.ToString();
	}
	public static int IntParse(this string s) => int.Parse(s);
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int a, b;
	cin >> a >> b;
	cout << 2 * b - a << endl;

}


Measured memory_bytes: 256
H, W, M = map(int, input().split())

targets = []
n_target_h = [0] * H
n_target_w = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    targets.append((h, w))
    n_target_h[h - 1] += 1
    n_target_w[w - 1] += 1

h_max = max(n_target_h)
w_max = max(n_target_w)

bomb_h = [i + 1 for i, h in enumerate(n_target_h) if h == h_max]
bomb_w = [i + 1 for i, w in enumerate(n_target_w) if w == w_max]

count = len(bomb_h) * len(bomb_w)
for target in targets:
    if (n_target_h[target[0] - 1] == h_max) and (n_target_w[target[1] - 1] == w_max):
        count -= 1

if count > 0:
    ans = h_max + w_max
else:
    ans = h_max + w_max - 1

print(ans)

Measured memory_bytes: 77652
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int cnt = 0;
    for(int i=0;i<n;i++){
      int a = sc.nextInt();
      if(a%2==0)cnt++;
    }
    System.out.println((cnt!=n)?"first":"second");
  }
}

Measured memory_bytes: 48904
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
inline int read(){
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ x = x * 10 + (ch ^ 48); ch = getchar(); }
	return x * f;
}
long long n, x = 100;
int ans; 
int main(){
	scanf("%lld", &n);
	while(x < n){
		ans++;
		x = (long long)((double)x) * 1.01;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3760
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
 
 
#define rep(i,n) for(int i=0;i<(n);i++)
 
using namespace std;
const int INF = 100000000;
const double EPS = 0.0000001;
typedef pair<int,int> P;

int n;
//           999999
bool isPrime[1000003];

void solve() {
	int ans=0;
	for(int i=n+1;i<=n+n;i++) if(isPrime[i]) ans++;
	cout<<ans<<endl;
}

void init() {
	rep(i,1000003) isPrime[i]=true;
	isPrime[0]=isPrime[1]=false;

	for(int i=2;i<1000003;i++) {
		if(isPrime[i]) {
			for(int j=i+i;j<1000003;j+=i) isPrime[j]=false;
		}
	}


}

int main() {
	
	init();
	while (cin>>n)
	{
		if(n==0) return 0;
		solve();

	}
	return 0;
}

Measured memory_bytes: 2136
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);i--)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int n,m,p;
void solve(){
  
  vector<int> a(n);
  REP(i,n) cin >> a[i];

  if(a[m-1]) cout << accumulate(a.begin(),a.end(),0LL)*(100-p)*100/(100*a[m-1]) << endl;
  else cout << 0 << endl;

}

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

  //int q; cin >> q;
  //while(q--) solve();
  while(cin >> n >> m >> p, n) solve();

  return 0;
}


Measured memory_bytes: 3172
import numpy as np
N = int(input())
#temp = N//2
max_val1 = 0
max_val2 = 0
ans = 0
ans_temp = 1000000000000
for i in range(1, int(np.sqrt(N))+1):
    if N % i == 0:
        max_val1 = i
        max_val2 = N // i
        ans = max_val1 + max_val2 - 2
        if ans < ans_temp:
            ans_temp = ans
        else:
            break
        #print(ans)
        #print(max_val1)
        #print(max_val2)

#print(ans)
print(ans)

Measured memory_bytes: 13076