akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define time clock_t tStart = clock();
#define show printf("Time taken: %.6fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
#define ll                    long long int
#define loop(a,b)             for(int i=a;i<=b;++i)
#define count_1(n)            __builtin_popcountll(n)
#define pb                    push_back
#define F                     first
#define S                     second
#define mp                    make_pair
#define MOD                   1000000007
#define itoc(c)               ((char)(((int)'0')+c))
#define vi                    vector<int>
#define vll                   vector<ll>
#define pll                   pair<ll,ll>
#define pii                   pair<int,int>
#define all(p)                p.begin(),p.end()
#define mid(s,e)              (s+(e-s)/2)
#define tcase()               ll t,n; cin>>t;n=t; while(t--)
#define iscn(num)             scanf("%d",&num);
#define eb                    emplace_back
#define ull                   unsigned long long
#define KAMEHAMEHA            ios_base::sync_with_stdio(0);
#define RASENGAN              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
    KAMEHAMEHA
//    #ifdef _soumik
//        freopen("input.txt", "r", stdin);
//    #endif
    int n,temp;
    vi a,a1;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>temp;
        a.eb(temp);
        a1.eb(temp);
    }
    sort(all(a1));
    for(int i=0;i<n;i++)
    {
        if(a[i]==a1[n-1])
            cout<<a1[n-2]<<endl;
        else
            cout<<a1[n-1]<<endl;
    }
    return 0;
}




Measured memory_bytes: 3436
import Data.List
import Text.Printf

mins [] = []
mins (h:m:r) = (h*60+m):(mins r)

str m =
  let sh = m `div` 60
      sm = m `mod` 60
  in
    printf "%d:%02d" sh sm

ans :: [[Int]] -> [String]
ans d = map str $ nub $ sort $ concat $ map mins $ map tail d

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  putStrLn $ unwords o



Measured memory_bytes: 4280
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
inline int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x;
}
int n,k,a[2000000];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>n>>k;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=k;i<n;i++){
        if(a[i-k]<a[i]) cout<<"Yes\n";
        else cout<<"No\n";
    }
	return 0;
}



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

import sys
sys.setrecursionlimit(300000)


def solve(N: int, a: "List[int]"):
    target = 1
    ret = 0
    for v in a:
        if v != target:
            ret += 1
        else:
            target += 1
    if target == 1:
        ret = -1
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 26356
n = gets.to_i
sp = Hash.new{|hash,key| hash[key] = []}
n.times do |i| 
    s,pp = gets.chomp.split
    sp[s] << [i+1, pp.to_i]
end

sp.each{|_,value| value.sort_by!{|e| -e[1]}}
sp = sp.to_a.sort_by!{|e| e[0]}
puts sp.map{|e| e[1].map{|e| e[0]}}


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

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


Measured memory_bytes: 256
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())

d = defaultdict(int)
sqrtN = int(math.sqrt(N)+1)
for x in range(1, sqrtN+1):
    for y in range(1, sqrtN+1):
        for z in range(1, sqrtN+1):
            ret = x**2 + y**2 + z**2 + x*y + y*z + z*x
            d[ret] += 1
for num in range(1, N+1):
    print(d[num])

Measured memory_bytes: 72732
#include<stdio.h>

int N,H;
int x[100],y[100],h[100];

int ab(int x){
	if(x<0)return -x;
	return x;
}

int main(){
	scanf("%d",&N);
	for(int i=0;i<N;i++)scanf("%d%d%d",&x[i],&y[i],&h[i]);
	
	//sort
	int r=N;
	int swapped=0;
	while(r>1 || swapped==1){
		if(r>1)r=r*10/13;
		swapped=0;
		for(int i=0;i<N-r;i++){
			if(h[i]<h[i+r]){
				int tmp=h[i];
				h[i]=h[i+r];
				h[i+r]=tmp;
				tmp=x[i];
				x[i]=x[i+r];
				x[i+r]=tmp;
				tmp=y[i];
				y[i]=y[i+r];
				y[i+r]=tmp;
				swapped=1;
			}
		}
	}
	
	for(int i=0;i<=100;i++){
		for(int j=0;j<=100;j++){
			H=ab(i-x[0])+ab(j-y[0])+h[0];
			int flag=1;
			for(int k=1;k<N;k++){
				int dist=ab(i-x[k])+ab(j-y[k]);
				if((h[k]==0 && dist<H) || (h[k]>0 && dist!=H-h[k])){
					flag=0;
					break;
				}
			}
			if(flag==1){
				printf("%d %d %d\n",i,j,H);
				return 0;
			}
		}
	}
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((ll)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll mod = 998244353;
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; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 



int main()
{
    int L;
    cin >> L;
    double l = L;
    
    if (L % 3 == 0){
        L/=3;
        cout << L * L * L;
        return 0;
    } 
    
    int a;
    double b;
    if (L % 3 == 1){
        L/=3;
        a = L*L*L + L*L+ L/3;
        b = L%3/3.0 + 1/27.0;
    } else {
        L/=3;
        a = L*L*L + L*L*2+ L*4/3;
        b = L*4%3/3.0 + 8.0/27.0;
    }
    fprintf(stdout, "%.10f\n", a +b);        

    return 0;
}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit
from operator import itemgetter

setrecursionlimit(10 ** 9)
INF = 1 << 60


def input():
    return stdin.readline().strip()


class UnionFind:
    # Reference: https://note.nkmk.me/python-union-find/
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)


N = int(input())
P = [0] * N
for i in range(N):
    x, y = map(int, input().split())
    P[i] = (i, x, y)

edges = []
for i in (1, 2):
    P.sort(key=itemgetter(i))
    for j in range(N - 1):
        edges.append((P[j][0], P[j + 1][0], P[j + 1][i] - P[j][i]))

edges.sort(key=itemgetter(2))
uf = UnionFind(N)
ans = 0
cities = 1
for i, j, c in edges:
    if not uf.same(i, j):
        uf.union(i, j)
        ans += c
        cities += 1
        if cities == N:
            break

print(ans)


Measured memory_bytes: 120652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    rep(i, 365) {
        cout << rand() % 26 + 1 << endl;
    }
}

Measured memory_bytes: 3616
#include<cstdio>
#include<deque>
#include<algorithm>
using namespace std;
main(){
	int n,i;
	deque<int>h;
	while(~scanf("%d",&n))
		h.push_back(n);
	sort(h.begin(),h.end());
	for(i=9;i>6;)
		printf("%d\n",h[i--]);
}

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

const long N=100000;

int main(){
	long n, w, h;
	long tate[N+1], yoko[N+1];
	
	memset(tate, 0, sizeof(tate));
	memset(yoko, 0, sizeof(yoko));
	
	scanf(" %ld %ld %ld", &n, &w, &h);
	
	for(long i=0; i<n; ++i){
		long x, y, z;
		scanf(" %ld %ld %ld", &x, &y, &z);
		
		//tate direct
		long ta=x-z+1, tb=x+z;
		if(ta<1) ta=1;
		if(tb>w) tb=w;
		tate[ta]++;
		tate[tb+1]--;
		
		//yoko direct
		long ya=y-z+1, yb=y+z;
		if(ya<1) ya=1;
		if(yb>h) yb=h;
		yoko[ya]++;
		yoko[yb+1]--;
	}
	
	for(long i=0; i<=w; ++i) tate[i+1]+=tate[i];
	for(long i=0; i<=h; ++i) yoko[i+1]+=yoko[i];
	
	/*
	for(long i=0; i<=w; ++i) printf("tate[%ld]=%d\n", i, tate[i]);
	for(long i=0; i<=h; ++i) printf("yoko[%ld]=%d\n", i, yoko[i]);
	*/
	
	bool ans=true;
	for(long i=1; i<=w; ++i){
		if(tate[i]<=0){
			ans=false;
			break;	
		}	
	}
	
	if(!ans){
		ans=true;
		for(long i=1; i<=h; ++i){
			if(yoko[i]<=0){
				ans=false;
				break;	
			}	
		}
	}
	if(ans) printf("Yes\n");
	else printf("No\n");
	
}


Measured memory_bytes: 4720
#include <iostream>
#include <iomanip>
#include <stdlib.h>
#include <vector>
#include <iterator>
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>

using namespace std;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(){
	uint64_t L, R;
    cin >> L >> R;
    uint64_t res = 2019;

    for(uint64_t i = L;i < R;i++){
        for(uint64_t j = i + 1;j <= R;j++){
            uint64_t tmp = (i * j) % 2019;
            if(tmp < res) res = tmp;
            if(res == 0){
                break;
            }
        }
        if(res == 0) break;
    }

    cout << res << endl;

	return 0;
}



Measured memory_bytes: 256
import java.util.*;

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

        int N = sc.nextInt();
        int K = sc.nextInt();
        boolean[] A = new boolean[10];
        for(int i = 0; i < K; ++i) {
            int D = sc.nextInt();
            A[D] = true;
        }

        for(int i = N; ; ++i) {
            if (check(i, A, K)) {
                System.out.println(i);
                return;
            }
        }
    }

    static boolean check(int N, boolean[] A, int K) {
        while(N > 0) {
            if (A[N % 10]) {
                return false;
            }
            N /= 10;
        }
        return true;
    }
}


Measured memory_bytes: 21844
#! /usr/local/bin/python3
# coding: utf-8

from math import inf

c = 0

def merge(A, left, mid, right):
    global c
    
    # print(A, left, mid, right)
    L = A[left:mid]; L.append(inf)
    R = A[mid:right]; R.append(inf)
    # print(L)
    # print(R)
    i = iter(L); l = next(i)
    j = iter(R); r = next(j)
    for k in range(left, right):
        # print(l, r)
        c += 1
        if l < r:
            A[k] = l
            l = next(i)
        else:
            A[k] = r
            r = next(j)

def merge_sort(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        merge_sort(A, left, mid)
        merge_sort(A, mid, right)
        merge(A, left, mid, right)

def main():
    n = int(input())
    S = [int(x) for x in input().split()]
    merge_sort(S, 0, n)
    print(*S)
    print(c)

main()



Measured memory_bytes: 65640
#155 Poll
n = int(input())
words = {}
for i in range(n):
    name = input()
    if name not in words:
        words[name] = 1
    elif name in words:
        words[name] += 1

num = max(words.values())
max_k_list = [kv[0] for kv in words.items() if kv[1] == num]
max_k_list.sort()
print('\n'.join(max_k_list))

Measured memory_bytes: 34140
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n<10)
    {
    if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon"<<endl;
        else if(n==0||n==1||n==6||n==8)
        cout<<"pon"<<endl;
        else if(n==3)
        cout<<"bon"<<endl;
    }
    else if(n>=10&&n<=99)
    {
        n=n%10;
        if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon"<<endl;
        else if(n==0||n==1||n==6||n==8)
        cout<<"pon"<<endl;
        else if(n==3)
        cout<<"bon"<<endl;
    }
    else if(n>=100&&n<=999)
    {
        n=n%100;
        n=n%10;
        if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon"<<endl;
        else if(n==0||n==1||n==6||n==8)
        cout<<"pon"<<endl;
        else if(n==3)
        cout<<"bon"<<endl;
    }
    }
    


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

using namespace std;

string s;
int cnt;

int main()
{
    int n;
    cin>>n;
    cin>>s;
    for(auto i:s)
    {
        if(i=='R') cnt++;
        else cnt--;
    }
    cout<<(cnt>0?"Yes":"No")<<'\n';
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main(){

    input!{
        a: usize,
        b: usize,
    }

    if a<=9 && b<=9{
        println!("{}", a*b);
    } else {
        println!("-1");
    }

}

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

using namespace std;

int calc_gcd(int a, int b)
{
  if (b == 0)
    return a;
  return calc_gcd(b, a%b);
}

int main()
{
  int n,x;
  
  cin >> n >> x;
  
  int l[n];
  for (int i=0;i<n;++i) {
    cin >> l[i];
  }
  
  int d = 0;
  long long ans = 1;
  for (int i=0;i<n;i++) {
    d = d + l[i];
    if (x < d) {
      break;
    }
    //cout << d << endl;
    ans++;
  }
    
  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 P = pair<int, int>;
using ll = long long;

vector<int> to[1000005];
int n;

vector<int> dist;

void dfs(int v, int d = 0, int p = -1){
	dist[v] = d;
  	for(int u : to[v]){
    	if(u == p) continue;
      	dfs(u, d+1, v);
    }
}

vector<int> calcDist(int s){
	dist = vector<int>(n);
  	dfs(s);
  	return dist;
}

int main(){
  	cin >> n;
  	int s, t;
  	cin >> s >> t;
  	s--; t--;
  
  	rep(i, n-1){
    	int a, b;
      	cin >> a >> b;
      	a--; b--;
      	to[a].push_back(b);
        to[b].push_back(a);
    }
  
  	vector<int> distS = calcDist(s);
   	vector<int> distT = calcDist(t);
  
  	int mx = 0;
  	rep(i, n){
    	if(distS[i] < distT[i]){
        	mx = max(mx, distT[i]);
        }
    }
  int ans = mx - 1;
  cout << ans << endl;
}

Measured memory_bytes: 31864
import java.io.*;
import java.util.*;
import java.lang.*;

class Main{
  public static void main(String[] args) throws IOException{
    for(int i=1;i<=9;i++){
      for(int j=1;j<=9;j++){
        System.out.println(i+"x"+j+"="+(i*j));
      }
    }
  }
}


Measured memory_bytes: 23944
// Problem : B - Multiplication 2
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//Mmmmmm......
#include<bits/stdc++.h>
using namespace std;

#define w cout
#define e '\n'
#define int long long
#define sz(x) (int)x.size()
#define re return 
#define vi vector<int>
#define vii vector<pair<int ,int > >
#define F first
#define S second
#define pussy push_back
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

const int N = 1e6 , mod = 1e9 + 7;

void solve() {
	int n; cin >> n;
	vi v(n); cin >> v;
	int ans = v[0];
	sort(begin(v),end(v));
	if(v[0]==0){
		w << 0 ;
		re;
	}
	//a*b = 1e18
	//b < 1e18/a
	int cant = 1e18 + 1;
	for(int i = 1; i < n; i++) {
		if(ans >= cant){
			w << -1;
			re;
		}
		int aa = cant/ans;
		if(v[i] > aa){
			w << -1;
			re;
		}
		ans *= v[i];
	}
	w << ans << e;
}

signed main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}	
}


Measured memory_bytes: 3988
import numpy as np
a=[0,0,0,0,0]
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
a10=[0,0,0,0,0]
for i in range(5):
    a10[i] = (10-a[i]%10)%10
k = np.argmax(a10)
l = [0,0,0,0,0]
for i in range(5):
    if a[i]%10 == 0:
        l[i]=0
    else:
        l[i]=10-a[i]%10
ans = sum(a)+sum(l)-l[k]
print(ans)


Measured memory_bytes: 12460
# -*- coding: utf-8 -*-
s = int(input())

mod = 10 ** 9 + 7

memo = [0 for _ in range(max(s - 5, 4))]
memo[0] = 2
memo[1] = 3
memo[2] = 4

for i in range(3, s-5):
    memo[i] = memo[i-1] + memo[i-3]
    memo[i] %= mod

if s <= 2:
    print(0)
elif s <= 5:
    print(1)
else:
    print(memo[s-6])



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

ll dist(ll x, ll y){
    return min(abs(x - y), 24 - abs(x - y));
}

void solve(long long N, std::vector<long long> D){
    D.push_back(0); // Add takahashi
    ll ans = 0;
    for(ll i = 0; i < (1 << 11); ++i){
        vector<ll> tmp(24, 0);
        REP(j, D.size()){
            if(D.at(j) == 0){
                tmp.at(0)++;
            }else if(D.at(j) == 12){
                tmp.at(12)++;
            }else{
                if(tmp.at(D.at(j)) == 0 && tmp.at(24 - D.at(j)) == 0){
                    if((i >> (D.at(j) - 1)) & 1){
                        tmp.at(D.at(j))++;
                    }else{
                        tmp.at(24 - D.at(j))++;
                    }
                }else if(tmp.at(D.at(j)) == 0){
                    tmp.at(D.at(j))++;
                }else if(tmp.at(24 - D.at(j)) == 0){
                    tmp.at(24 - D.at(j))++;
                }else{
                    cout << 0 << endl;
                    return;
                }
            }
        }

        ll mindiff = 24;
        REP(k, tmp.size()){
            if(tmp.at(k) == 0){ continue; }
            if(tmp.at(k) >= 2){
                mindiff = 0;
                break;
            }
            for(ll l = k + 1; l < tmp.size(); ++l){
                if(tmp.at(l) == 0){ continue; }
                mindiff = min(mindiff, dist(k, l));
            }
        }
        ans = max(ans, mindiff);
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> D(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&D[i]);
    }
    solve(N, std::move(D));
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(_) for _ in input().split()]

import collections

c = collections.Counter(A)
xs = [x for x, n in c.items() if n >= 2]
xs.sort()

if len(xs) >= 1 and c[xs[-1]] >= 4:
    print(xs[-1] ** 2)
elif len(xs) >= 2:
    print(xs[-1] * xs[-2])
else:
    print(0)


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

using namespace std;

int main() {
	int n,a,b,sum=0;
	scanf("%d",&n);
	scanf("%d %d",&a,&b);
	for(int i=0;i<n;i++){
		int x;
		scanf("%d",&x);
		sum+=(a-1)/x+1;
	}
	printf("%d",sum+b);
	
	return 0;
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    ll N; cin >> N;
    vector<ll> A(N); REP(i, N) cin >> A[i];
    SORT(A);
    map<string, bool> M;
    ll min_v = 0;
    ll max_v = 0;
    REP(i, N) {
        ll r = A[i];
        string cls;
        if (r >= 1 && r < 400) {
            cls = "e";
        } else if (r >= 400 && r < 800) {
            cls = "d";
        } else if (r >= 800 && r < 1200) {
            cls = "c";
        } else if (r >= 1200 && r < 1600) {
            cls = "b";
        } else if (r >= 1600 && r < 2000) {
            cls = "a";
        } else if (r >= 2000 && r < 2400) {
            cls = "s";
        } else if (r >= 2400 && r < 2800) {
            cls = "ss";
        } else if (r >= 2800 && r < 3200) {
            cls = "sss";
        } else if (r >= 3200) {
            cls = "tourist";
        }
        if(cls == "tourist") {
            if (!min_v) {
                min_v = 1;
            }
            max_v++;
            continue;
        }
        if(!M[cls]) {
            min_v++;
            max_v++;
            M[cls] = true;
        }
    }
    cout << min_v << " " << max_v << "\n";
}

Measured memory_bytes: 3596
#include <stdio.h>

int main(void)
{
	int m;
	int sign_x[200], sign_y[200];
	int n;
	int star_x[1000], star_y[1000];
	int diff_x, diff_y;
	int i, j, k;
	int count;
	
	while (1){
		scanf("%d", &m);
		if (m == 0){
			break;
		}
		
		for (i = 0; i < m; i++){
			scanf("%d%d", &sign_x[i], &sign_y[i]);
		}

		scanf("%d", &n);
		for (i = 0; i < n; i++){
			scanf("%d%d", &star_x[i], &star_y[i]);
		}
		
		
		for (i = 0; i < n; i++){
			count = 0;
			diff_x = star_x[i] - sign_x[0];
			diff_y = star_y[i] - sign_y[0];
		
			for (j = 0; j < m; j++){
				for (k = 0; k < n; k++){
					if (sign_x[j] + diff_x == star_x[k] &&
						sign_y[j] + diff_y == star_y[k]){
						count++;
						break;
					}
				}
			}
			if (count == m){
				printf("%d %d\n", diff_x, diff_y);
				break;
			}
		}
	}
	return (0);
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  int n;
  ll z,w;
  cin>>n>>z>>w;

  vector<ll> p(n);
  rep(i,n){
    cin>>p[i];
  }

  if(n==1) {
    cout << abs(p[0]-w) << endl;
  }
  else {
    cout << max(abs(p[n-1]-w),abs(p[n-1]-p[n-2])) << endl;
  }


}

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

void bfs(){
	int cnt = 0;
	priority_queue <ll, vector<ll>, greater<ll> > pq;
	for(int i = 1;i <= 9;i++) pq.push(i);
	while(!pq.empty()){
		ll x = pq.top();
		pq.pop();
		cnt++;
		if(cnt == n){
			printf("%lld\n",x);
			return ;
		}
		ll y = x * 10 + x % 10;
		pq.push(y);
		if(x % 10 > 0)
			pq.push(y-1);
		if(x % 10 < 9)
			pq.push(y+1);
	}
	return;
}
int main(){
	scanf("%d",&n);
	bfs();
    return 0;
}

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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main(){
	int n;
	cin >> n;
	int a[n];
	int sum=0;
	int col[9]={0,0,0,0,0,0,0,0,0};

	FOR(i,n){
		cin >>a[i];
		if(a[i] <400) col[0]++;
		else if(a[i] < 800) col[1]++;
		else if(a[i] <1200) col[2]++;
		else if(a[i] < 1600) col[3]++;
		else if(a[i] <2000) col[4]++;
		else if(a[i] <2400) col[5]++;
		else if(a[i] <2800) col[6]++;
		else if(a[i] <3200) col[7]++;
		else col[8]++;
	}
	FOR(i,8) if(col[i]>0)sum++;
	if(sum!=0)
	cout << sum <<" "<<sum+col[8] ;
	else 
	cout << 1 << " " << col[8];
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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(void){
  int n,k,r,s,p;
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  vector<char> prev(k);
  ll ans = 0;
  for(int i = 0; i < n; i++){
    if(t[i] == prev[i%k]){
      prev[i%k] = 'n';
      continue;
    }
    if(t[i] == 'r') ans += p;
    if(t[i] == 's') ans += r;
    if(t[i] == 'p') ans += s;
    prev[i%k] = t[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
N,X = map(int, input().split())
num, p = [1], [1]
index = 1
while N >= index:
    num.append(2*num[-1] + 3)
    p.append(2*p[-1] + 1)
    index +=1

def ans(n, x):
    if n == 0:
        return 1 if x > 0 else 0
    if x <= num[n-1]+1:
        return ans(n-1, x-1)
    else:
        return p[n-1] +1+ ans(n-1, x-2-num[n-1])

print(ans(N, X))

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
int main() {
	int l; // ??¬???????????\??°
	int a, b, c, d;
	int koku, san;
	std::cin  >> l >> a >> b >> c >> d;
	koku = b / d;
	san = a / c;
	if (b%d != 0) {
		koku++;
	}
	if (a%c != 0) {
		san++;
	}

	l = l - std::max(koku, san);
	
	std::cout << l << std::endl;

	return 0;
}

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

using namespace std;
#define rep(i, n) for (int i = 1; i <= (int)(n); i++)

int main(){
  int n;
  cin >> n;
  
  int sum=0;
  
  rep(i,n){
    rep(j,n){
      rep(k,n){
        sum+=gcd(gcd(i,j),k);
      }
    }
  }
  
  cout << sum << endl;
  
  return 0;
}
    

Measured memory_bytes: 3576
#include<algorithm>
#include<cstdio>
#include<functional>
#include<iostream>
#include<cfloat>
#include<climits>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<time.h>
#include<vector>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int res=0,x=0,y=0;
    bool flag=false;
    for(int i=0;i<n;i++)
    {
        int a,b,c;
        cin >> a >> b >> c;
        int d=a-res;
        res=a;
        int sum=abs(b-x)+abs(c-y);
        x=b;
		y=c;
        if(sum>d || (sum+d)%2==1) flag=true;
    }
    if(!flag) cout << "Yes\n";
    else cout << "No\n";
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <cstdio>

using namespace std;

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

    if(a == 1) {
        a = 14;
    }

    if(b == 1) {
        b = 14;
    }

    if(a > b) {
        cout << "Alice\n";
    }
    else {
        if(a == b) {
            cout << "Draw\n";
        }
        else {
            cout << "Bob\n";
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e10;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int T, D, L;
  while (cin >> T >> D >> L) {
    if (T == 0 && D == 0 && L == 0) break;
    int ans = 0, x, tmptime = -1;
    rep(i, T) {
      cin >> x;
      if (tmptime >= 0) ans++;
      if (x >= L) {
        tmptime = D;
      }
      tmptime--;
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    long long n=s.size();
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        sum+=s[i]-'0';
    }
    if(sum%9==0)
    {
        cout<<"Yes"<<endl;
    }
    else
        cout<<"No"<<endl;
        
}

Measured memory_bytes: 3728
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

#include <atcoder/all>
using namespace atcoder;

ll t, n, m, a, b;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> t;
    while (t--) {
        cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << "\n";
    }
    return 0;
}


Measured memory_bytes: 3664
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int t; cin >> t;
	while (t--) {
		int n; cin >> n;
		vector<ll> a(n);
		for (auto& i : a) {
			cin >> i;
		}
		string s; cin >> s;
		reverse(a.begin(), a.end());
		reverse(s.begin(), s.end());
		vector<ll> basis;
		bool p1win = false;
		for (int i = 0; i < n; ++i) {
			ll cur = a[i];
			for (auto& b : basis) {
				cur = min(cur, cur ^ b);
			}
			if (s[i] == '0') {
				if (cur) {
					basis.pb(cur);
				}
			} else {
				if (cur) {
					p1win = true;
					break;
				}
			}
		}
		cout << p1win << '\n';
	}
}

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

int main() {
    int n, k;
    cin >> n >> k;
    int a, b;
    int minval = 1;
    for (int i = 0; i < n; i++)
    {
        a = minval * 2;
        b = minval + k;
        minval = min(a, b);
    }
    cout << minval << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://abc064.contest.atcoder.jp/tasks/abc064_d>
問題文============================================================
 ( と ) で構成される N 文字の文字列 S が与えられる。S にいくつかの ( または ) を挿入することで正しい括弧列を作りたい。
 ただし、正しい括弧列は次のように定義されている：
 
 () は正しい括弧列である。
 X が正しい括弧列であるとき、(、X、) をこの順につなげたものは正しい括弧列である。
 X、Y が正しい括弧列であるとき、X と Y をこの順につなげたものは正しい括弧列である。
 それ以外の括弧列は正しくない。
 そのとき、作れる最も文字数が少ない正しい括弧列を求めなさい。このようなものが複数ある場合は、辞書順最小のものを求めなさい。
 
=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    string S; cin >> S;
    deque<char> dq;
    stack<char> st;
    for(int i = 0; i < N;i++){
        if(S[i] == '('){
            st.push('(');
            dq.push_back('(');
        }else{
            dq.push_back(')');
            if(st.empty()){
                dq.push_front('(');
            }else{
                st.pop();
            }
        }
    }
    while(!st.empty()) {dq.push_back(')'); st.pop(); }
    cout << string(dq.begin(),dq.end()) << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int a;
    cin >> a;
    if (a==1){
        cout << 1 << endl;
    }else if (a%2==0){
        cout << 0.5 << endl;
    }else{
        float ans = float(int(a*0.5) + 1) / a;
        cout << ans << endl;
    }
    
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
  public static void main(String args[])
  {
    Scanner sc= new Scanner(System.in);
    int ar[]= new int[5];
    for(int i=0;i<5;i++)
    {
      ar[i]=sc.nextInt();
    }
    for(int i=0;i<5;i++)
    {
      if(ar[i]==0)
      {
        System.out.println(i+1);
        break;
      }
    }
  }
}

Measured memory_bytes: 35612
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


Int isprime(Int x){
  if(x<=1) return 0;
  for(Int i=2;i*i<=x;i++)
    if(x%i==0) return 0;
  return 1;
}

//INSERT ABOVE HERE
const Int MAX = 303;
Int w[MAX]={},p[MAX]={},c[MAX]={};
Int ans=0;
using P = pair<Int, Int>;
vector<P> vs[MAX];

void dfs(Int x){
  if(x*x>=MAX){
    Int res=0;
    Int t[MAX]={};
    for(Int i=2;i<MAX;i++){
      Int used=1,flg=0;
      for(auto p:vs[i])
        if(c[p.first]<p.second) used=0,flg++;      

      if(used) res+=w[i];      
      if(flg==1) t[vs[i].back().first]+=w[i];      
    }
    for(Int i=x;i<MAX;i++)
      if(t[i]>0) res+=t[i];
    chmax(ans,res);
    return;
  }
  c[x]=0;
  for(Int a=1;a<MAX;a*=x){
    dfs(x+1);
    if(!p[x]) break;
    c[x]++;
  }
}

signed main(){
  Int q;
  cin>>q;
  for(Int i=0;i<q;i++){
    Int a,b;
    cin>>a>>b;
    w[a]+=b;
  }
  for(Int i=0;i<MAX;i++){
    p[i]=isprime(i);
    for(Int j=2;j<=i;j++){
      if(!p[j]) continue;
      if(i%j!=0) continue;
      vs[i].emplace_back(j,0);
      Int k=i;
      while(k%j==0) k/=j,vs[i].back().second++;
    }
  }
  dfs(2);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  if (A != 1 && B != 1) {
    cout << 1 << endl;
  } else if (A != 2 && B != 2) {
    cout << 2 << endl;
  } else if (A != 3 && B != 3) {
    cout << 3 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/ruby
# encoding: utf-8

S = gets.chomp

flg = 0
flgmax = 0

def isACGT c
  if (c == 'A') || (c == 'C') || (c == 'G') || (c == 'T') then
    return true
  end
  
  return false
end

(0..S.length-1).each do |i|

  if isACGT(S[i]) == true then 
    flg += 1

    if flgmax < flg 
      flgmax = flg
    end

  else
    flg = 0
  end
end

puts flgmax


Measured memory_bytes: 1788
import bisect

N = int(input())
A = [int(a) for a in input().split()]
A = sorted(A)

c = 0
for i in range(N - 1 , -1, -1):
    if A[i] == int(A[i]):
        b = 1
        while b <= A[i]:
            b <<= 1

        j = bisect.bisect_left(A, b - A[i])
        if i > j:
            if b - A[i] == A[j]:
                c += 1
                A[j] = A[j] - 0.5
                A[i] = A[i] + 0.5
print(c)


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

#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(a) (a).begin(), (a).end()

#define INF 1000000000

using namespace std;

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

    if (N % 500 <= A)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long N = sc.nextLong();
		long ans = N;
		if (N % 2 != 0) ans *= 2;
		System.out.println(ans);
	}

	private static class Is {
		int a;
		int b;
		Is (int a, int b) {
			this.a = a;
			this.b = b;
		}
	}

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

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

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


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

int main() {

	//float A, B, H, M,kaku;

	int x1,x2,x3,x4,x5;
	cin >> x1 >> x2 >> x3 >> x4 >> x5;

	for (int i = 0; i < 4; i++) {
		if (x1 == 0) {
			cout << "1" << endl;
			return 0;
		}
		if (x2 == 0) {
			cout << "2" << endl;
			return 0;
		}
		if (x3 == 0) {
			cout << "3" << endl;
			return 0;
		}
		if (x4 == 0) {
			cout << "4" << endl;
			return 0;
		}
		if (x5 == 0) {
			cout << "5" << endl;
			return 0;
		}
	}
	
	

}



Measured memory_bytes: 3588
#include <map>
#include <set>
#include <ctime>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring> 
#include <iostream>
#include <algorithm>
using namespace std;

long long n, D;
long long x, y;
long long ans = 0;

int main()
{
	cin >> n >> D;
	for(int i = 1;i <= n;++i)
	{
		cin >> x >> y;
		if(x * x + y * y <= D * D)
			++ans;
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 3768
// Danielxlr
// https://atcoder.jp/contests/abc174/tasks/abc174_d
// greedy

#include <iostream>
#include <string>
using namespace std;
 
int main() {
    int n, reds=0, ans=0 ;
    cin>>n;
    char cad[n];
    for(int i=0; i<n;i++){
        cin>>cad[i];
        if(cad[i] == 'R')
            reds++;
    }
    for(int i = 0; i < reds; i++){
        if(cad[i] == 'W')
            ans++;
    }
    cout<<ans;;
    return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int N;
    string S;
    cin >> N >> S;
    ll ans = 0;
    ll num_R = 0;
    ll num_G = 0;
    ll num_B = 0;
    ll num_R2 = 0;
    ll num_G2 = 0;
    ll num_B2 = 0;
    rep(0, i, N)
    {
        if (S[i] == 'R')
        {
            num_R++;
        }
        else if (S[i] == 'G')
        {
            num_G++;
        }
        else
        {
            num_B++;
        }
    }
    rep(0, i, N)
    {
        num_R2 = 0;
        num_G2 = 0;
        num_B2 = 0;
        rep(0, j, N)
        {
            if (S[j] == 'R')
            {
                num_R2++;
            }
            else if (S[j] == 'G')
            {
                num_G2++;
            }
            else
            {
                num_B2++;
            }
            if (j > i)
            {
                if (S[i] != S[j])
                {
                    if ((S[i] == 'R' && S[j] == 'G') || (S[i] == 'G' && S[j] == 'R'))
                    {
                        ans += num_B - num_B2;
                    }
                    else if (S[i] == 'G' && S[j] == 'B' || (S[i] == 'B' && S[j] == 'G'))
                    {
                        ans += num_R - num_R2;
                    }
                    else if (S[i] == 'B' && S[j] == 'R' || (S[i] == 'R' && S[j] == 'B'))
                    {
                        ans += num_G - num_G2;
                    }
                    if ((2 * j - i < N) && (S[i] != S[2 * j - i] && S[j] != S[2 * j - i]))
                    {
                        ans--;
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

static const string STATUS_TYPE[] = {"AC", "WA", "TLE", "RE"};

int main(void) {
    const int MAX_STATUS_COUNT = 4;
    
    int input_count = 0;
  	cin >> input_count;
    
    string input;
    int results[MAX_STATUS_COUNT] = {};
    for (int i = 0; i < input_count; ++i) {
		cin >> input;
        for (int j = 0; j < MAX_STATUS_COUNT; ++j) {
            if (STATUS_TYPE[j] == input) {
                ++results[j];
                continue;
            }
        }
    }
    
    for (int i = 0; i < MAX_STATUS_COUNT; ++i) {
   		cout << STATUS_TYPE[i] + " x " << results[i]  << endl;
    }

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int t=N,c=0;
  
  while(t > 0){
    c += t % 10;
    t /= 10;
  }
  
  if(N % c == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;



int main(){
	int n; cin >> n;
	int m = 100000;
	while(n--) {
		m *= 1.05;
		m = m / 1000 * 1000 + 1000 * (m % 1000 != 0);
	}
	cout<< m << endl;
	return 0;
}

Measured memory_bytes: 0