akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define __V vector
#define all(x) x.begin(), x.end()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}
template<typename X, typename Y>
istream& operator>>(istream& in, pair<X, Y> &a) {
	in >> a.first >> a.second;
	return in;
}
template<typename T>
void getv(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv(vector<T>& v, int n, Ns ... ns) {
	v.resize(n);
	for (auto& i : v)
		getv(i, ns...);
}
template<typename T>
void getv1(T& i) {
	cin >> i;
}
template<typename T, typename ... Ns>
void getv1(vector<T>& v, int n, Ns ... ns) {
	v.resize(n + 1);
	for (int i = 1; i <= n; i++)
		getv(v[i], ns...);
}
#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
inline void getch(char &x) {
	while (x = getchar_unlocked(), x < 33) {
		;
	}
}
inline void getstr(string &str) {
	str.clear();
	char cur;
	while (cur = getchar_unlocked(), cur < 33) {
		;
	}
	while (cur > 32) {
		str += cur;
		cur = getchar_unlocked();
	}
}
template<typename T> inline bool sc(T &num) {
	bool neg = 0;
	int c;
	num = 0;
	while (c = getchar_unlocked(), c < 33) {
		if (c == EOF)
			return false;
	}
	if (c == '-') {
		neg = 1;
		c = getchar_unlocked();
	}
	for (; c > 47; c = getchar_unlocked())
		num = num * 10 + c - 48;
	if (neg)
		num *= -1;
	return true;
}
typedef unsigned long long ull;
typedef long long ll;
typedef float ld;
typedef int _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
using AntonTsypko = void;
using arsijo = AntonTsypko;
using god = arsijo;
uniform_real_distribution<double> double_dist(0, 1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll q, t, a, b, sl, sr, base = 0;
multiset<ll> r;
multiset<ll, greater<ll>> l;

void push() {
	cin >> a >> b;
	base += b;
	sl += a;
	l.insert(a);
	while (l.size() > r.size()) {
		a = *l.begin();
		sl -= a;
		sr += a;
		r.insert(a);
		l.erase(l.begin());
	}
	while (!l.empty() && !r.empty() && *l.begin() > *r.begin()) {
		a = *l.begin();
		b = *r.begin();
		l.erase(l.begin());
		sl -= a;
		r.erase(r.begin());
		sr -= b;
		l.insert(b);
		sl += b;
		r.insert(a);
		sr += a;
	}
}

void eval() {
	ll ans = (*r.begin()) * l.size() - sl + sr - (*r.begin()) * r.size();
	cout << (l.size() == r.size() ? *l.begin() : *r.begin()) << " "
			<< base + ans << "\n";
}

int main() {
	doin();
	cin >> q;
	while (q--) {
		cin >> t;
		if (t == 1)
			push();
		else
			eval();
	}
	return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//(a+b-1)/b

signed main(){
	ll n; cin>>n;
      vl dp(1001000,MOD*10);
     dp[0]=0;
  //dp[1]=1;
  rep(i,0,n+1){
    chmin(dp[i+1],dp[i]+1);
    ll a=6,b=9;
    while(a+i<=n){
      chmin(dp[i+a],dp[i]+1);
      a*=6;
    }
    while(b+i<=n){
      chmin(dp[i+b],dp[i]+1);
      b*=9;
    }
  }
  cout<<dp[n]<<endl;
				
	
	return 0;
}


Measured memory_bytes: 11108
#include <bits/stdc++.h>
using namespace std;
#define int long long
int cnt;

signed main() {
	int n,mi;
	cin>>n;
	vector<char>vec(n);
	for(int i=0;i<n;i++){
		cin>>vec[i];
		if(i!=0&&vec[i]=='E'){
			cnt++;
		}
	}
	mi=cnt;
	for(int i=1;i<n;i++){
		if(vec[i-1]=='W'){
			cnt++;
		}
		if(vec[i]=='E'){
			cnt--;
		}
		/*cout<<cnt<<endl;*/
		mi=min(mi,cnt);
	}
	cout<<mi<<endl;
}

Measured memory_bytes: 512
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

// fn read<T: std::str::FromStr>() -> T {
//     let mut s = String::new();
//     std::io::stdin().read_line(&mut s).ok();
//     s.trim().parse().ok().unwrap()
// }

fn main() {
    loop{
        let v:Vec<i32> = read_vec();
        if v[0] == 0 && v[1] == 0 {
            break;
        }

        for _i in 0..v[0] {
            for _j in 0..v[1] {
                print!("#");
            }
            println!("");
        }
        println!("");
    }
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    if (a == 1) {
        if (b == 2)
            cout << "3\n";
        else
            cout << "2\n";  
    }else if (a == 2) {
        if (b == 1)
            cout << "3\n";
        else
            cout << "1\n";  
    }else if (a == 3) {
        if (b == 1)
            cout << "2\n";
        else
            cout << "1\n";  
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define LEN 100005/*length of queue*/

typedef struct pp{/*ppは構造体タグ名。*/
    char name[100];
    int t;
} P;/*Pが型名。int みたいな感じで呼び出せる*/


int head,tail,n;/*tailは最後の要素の一つ後ろを指す*/
P Q[LEN];


void enqueue(P x){
    Q[tail]=x;
    tail=(tail+1)%LEN;
}

P dequeue(){
    P x=Q[head];
    head=(head+1)%LEN;
    return x;
}

int main(){
    int elaps=0;
    int i,q;
    P u;

    scanf("%d %d",&n,&q);
    
    for(i=1;i<=n;i++){
        scanf("%s",Q[i].name);
        scanf("%d",&Q[i].t);
    }
    
    head=1;
    tail=n+1;
    
    while(head!=tail){
        u=dequeue();
        if (u.t-q>0){
            elaps+=q;
            u.t-=q;
            enqueue(u);
        }else{
            elaps+=u.t;
            printf("%s %d\n",u.name,elaps);
        }
    }
    return 0;
}


Measured memory_bytes: 11868
from copy import deepcopy

N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]

graph = deepcopy(A)
for k in range(N):
    for i in range(N):
        for j in range(N):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])

ans = 0
for u in range(N):
    if ans < 0:
        break
    for v in range(N):
        if graph[u][v] < A[u][v]:
            ans = -1
            break
            
        flg = True
        for w in range(N):
            if w == u or w == v:
                continue
            flg &= graph[u][v] < graph[u][w] + graph[w][v]
        
        if flg:
            ans += graph[u][v]

print(ans // 2)



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

int main(){
    int N;
    cin >> N;
    int A[N];
    int ans=0;
    int check=0;
    for(int i=0;i<N;i++){
        cin >> A[i];
        if(A[i]%2==0){
            check++;
           if(A[i]%3==0 || A[i]%5==0) ans++;
        }
    }
    if(check ==0 || check==ans) cout << "APPROVED" <<endl;
    else cout << "DENIED" << endl;

}


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

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


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    ll  h;
    int n;
    cin >> h >> n;
    ll sum = 0;

    rep(i, n) {
        int tmp;
        cin >> tmp;
        sum = sum + tmp;
    }

    if (h > sum) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main(string[] args) {
        //入力
        //int N = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        int X = int.Parse(s.Split(' ')[0]);
        int A = int.Parse(s.Split(' ')[1]);

        //出力
        if (X < A) {
            Console.WriteLine("0");
        } else {
            Console.WriteLine("10");
        }



    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
string a,b,c;
map<int,int>M; int n;
int main(){
	cin>>n>>c>>a>>b;
	int ans = 0;
	rep(i,a.size()){
		M.clear();
		int mx = 0;
		M[a[i]]++; mx = max(mx,M[a[i]]);
		M[b[i]]++; mx = max(mx,M[b[i]]);
		M[c[i]]++; mx = max(mx,M[c[i]]);
		ans += 3-mx;
	}
	cout<<ans<<endl;
}

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

int main()
{
    int i, j, k ;
    map<char,int>mp;
    string s;
    cin >> s;
    for(i=0; i<s.size(); i++)
    {
        mp[s[i]]++;
    }
    j=0;
    for(i=0; i<s.size(); i++)
    {
        if(mp[s[i]]%2!=0)
        {
            j=1;

            break;
        }
    }
    if(j)
        cout << "No";
    else
        cout << "Yes";

    return 0;
}

Measured memory_bytes: 3576
import bisect

S = list(input())
N = len(S)
RL_list = []
ans_list = [0] * N

for i in range(N-1):
    if S[i] == 'R' and S[i+1] == 'L':
        RL_list.append(i)

for i in range(N):
    if S[i] == 'R':
        index = RL_list[bisect.bisect_left(RL_list,i)]
        distance = index - i
    elif S[i] == 'L':
        index = RL_list[bisect.bisect_right(RL_list,i)-1]
        distance = index - i
    
    if distance % 2 == 0:
        ans_list[index] += 1
    else:
        ans_list[index+1] += 1

print(*list(ans_list))

Measured memory_bytes: 8980
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

/**
 * equeue
 */
public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            int K = sc.nextInt();
            long[] V = new long[N];
            for (int i = 0; i < N; i++) {
                V[i] = sc.nextLong();
            }

            long max = 0;

            for (int a = 0; a <= N; a++) {
                for (int b = 0; b <= N - a; b++) {
                    if (a + b > K) {
                        break;
                    }

                    long value = 0;
                    List<Long> minus = new ArrayList<>();

                    for (int i = -b; i < a; i++) {
                        long v = V[(N + i) % N];
                        value += v;

                        if (v < 0) {
                            int pos = Collections.binarySearch(minus, v);
                            if (pos < 0) {
                                pos = -(pos + 1);
                            }
                            minus.add(pos, v);
                        }
                    }

                    for (int i = 0; i < K - a - b; i++) {
                        if (minus.size() <= i) {
                            break;
                        }

                        value -= minus.get(i);
                    }

                    max = Math.max(max, value);
                }
            }

            System.out.println(max);
        }
    }

}


Measured memory_bytes: 23892
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  ll ans = 0;
  cin>>n;
  std::map<ll, ll> mp;
  rep(i,n){
    cin>>v;
    mp[v]++;
  }
  for(auto it = mp.begin(); it != mp.end(); it++){
        if(it -> second >= it -> first) ans += it -> second - it -> first;
        else ans += it -> second;
    }
    cout << ans << endl;


}

int main(){
  solve();
  return 0;
}


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

using namespace std;

int main()
{
  int N, K, T, U, V, L;
  int carrot[10001] = {};

  cin >> N >> K >> T >> U >> V >> L;
  while(N--) {
    int D;
    cin >> D;
    carrot[D]++;
  }

  double time = 0;
  int mod = 0, hav = 0;
  for(int i = 1; i <= L; ++i) {
    if(mod > 0) {
      --mod;
      time += 1.0 / V;
    } else {
      time += 1.0 / U;
    }

    if(hav && mod == 0) {
      --hav;
      mod = V * T;
    }

    if(carrot[i]) {
      if(mod == 0) {
        --carrot[i];
        mod = V * T;
      }
      if(hav + carrot[i] > K) {
        --carrot[i];
        mod = V * T;
        hav = K;
      } else {
        hav += carrot[i];
      }
    }
  }

  cout << fixed << setprecision(10) << time << endl;
}

Measured memory_bytes: 1280
import java.util.Scanner;
import java.io.*;

public class Main{	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int w,n,tmp;
		String[] s;
		int []a;
		int []b;
		int []number;
		w = sc.nextInt();
		n = sc.nextInt();
		a = new int[n];
		b = new int[n];
		number = new int[w];
		for(int i=0;i<w;i++){
			number[i]=i+1;
		}
		for(int i=0;i<n;i++){
			s=sc.next().split(",");
			a[i]=Integer.valueOf(s[0]).intValue();
			b[i]=Integer.valueOf(s[1]).intValue();
		}
		for(int i=0;i<n;i++){
			tmp=number[a[i]-1];
			number[a[i]-1]=number[b[i]-1];
			number[b[i]-1]=tmp;
		}
		for(int i=0;i<w;i++){
			System.out.println(number[i]);
		}
		sc.close();
	}
}


Measured memory_bytes: 26044
def func(N):
    tmp=N
    arr=[]
    for i in range(2,int((N**0.5//1))+1):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
            
    if tmp!=1 or arr==[]:
        arr.append([tmp, 1])
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)
    
            

Measured memory_bytes: 9480
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
#define INF 2000000000
#define REP(i,b,n) for(int i = (b); i < n; i++)
#define rREP(i,b,n) for(int i = n; i >= b; i--)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
const string lowercase = "abcdefghijklmnopqrstuvwxyz";
const string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int gcd(int a, int b){return b ? gcd(b, a % b): a;}

int main()
{
    ll n;
    ll a[100000];
    cin >> n;
    REP(i,0,n){
        cin >> a[i];
    }
    int ans = a[0];
    REP(i,1,n){
        ans = gcd(ans, a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

const int a = 'z'-'a'+1;

int opt(int h, const vector<int> &dp){
    int res = dp[h];
    REP(i, a){
        res = min(res, dp[h^(1<<i)]);
    }
    return res;
}

int main(){
    string S;
    cin >> S;
    int n = S.size();
    vector<int> dp(1<<a, n);
    dp[0] = 0;
    int hash = 0;
    REP(i, n){
        hash ^= 1<<(S[i]-'a');
        int tmp = opt(hash, dp);
        dp[hash] = min(dp[hash], tmp+1);
    }
    cout << opt(hash, dp)+1 << endl;
    return 0;
}


Measured memory_bytes: 262780
const main = (input) => {
  const [a, ...b] = input.trim().split('\n')

  const [n, m, x] = a.split(' ').map(Number)

  let ans = Infinity

  const r = (idx, arr, sum) => {
    if (arr.every(v => v >= x)) {
      ans = Math.min(sum, ans)
      return null
    }
    if (idx > n-1) return null

    const book = b[idx].split(' ').map(Number)

    const newSum = sum + book.shift()
    const newArr = arr.map((v, i) => v + book[i])

    r(idx+1, newArr, newSum)
    r(idx+1, arr, sum)
  }

  r(0, new Array(m).fill(0), 0)

  return console.log(ans === Infinity ? -1 : ans)
}

process.env.MYTEST
  ? (process.env.MYTEST === 'test' ? test() : main(require('fs').readFileSync('dev/stdin', 'utf8')))
  : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 35400
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      ArrayList<Integer> b = new ArrayList<>(n);
      ArrayList<Integer> a = new ArrayList<>();
      for(int i = 0;i < n;i++)b.add(sc.nextInt());
      while(b.size()!=0){
      	int r = -1;
        for(int i = 0;i < b.size();i++)if(b.get(i)==i+1)r=i;
        if(r==-1){
          System.out.println(-1);
          return;
        }
        b.remove(r);
        a.add(r+1);
      }
      Collections.reverse(a);
      for(int c:a)System.out.println(c);
    }
}

Measured memory_bytes: 23636
S = list(input())
T = list(input())
MAX_LEN = 3007
dp = [[0] * MAX_LEN for _ in range(MAX_LEN)]

for i in range(len(S)):
    for j in range(len(T)):
        ii = i + 1
        jj = j + 1
        if S[i] == T[j]:
            dp[ii][jj] = dp[ii - 1][jj - 1] + 1
        else:

            dp[ii][jj] = max(dp[ii - 1][jj],
                             dp[ii][jj - 1]
                             )

i = len(S)
j = len(T)
from collections import deque

ans = deque(maxlen=dp[i][j])
while i > 0 and j > 0:
    if dp[i][j] == dp[i][j - 1]:
        j -= 1
    elif dp[i][j] == dp[i - 1][j]:
        i -= 1
    else:
        ans.appendleft(S[i - 1])
        i -= 1
        j -= 1
print(*ans, sep='')


Measured memory_bytes: 115420
#include <stdio.h>
#include <stdlib.h>
#define N 110

int main()
{
    int x, n, p[N], check[N], min, sub = -1;
    for (int i = 0; i < N; i++)
        check[i] = 0;

    scanf("%d %d", &x, &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &p[i]);
        check[p[i]] = 1;
    }

    if (n == 0)
    {
        printf("%d", x);
        return 0;
    }

    for (int i = 0; i < N; i++)
    {
        if (check[i] == 0)
        {
            if (abs(x - i) < sub || sub == -1)
            {
                min = i;
                sub = abs(x - i);
            }
        }
    }

    printf("%d", min);
    return 0;
}

Measured memory_bytes: 1736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp11
{
    class Class43
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var A = new long[N];
            var B = new long[N];
            for(int i = 0; i < N; i++)
            {
                var read = Console.ReadLine().Split().Select(long.Parse).ToArray();
                A[i] = read[0];
                B[i] = read[1];
            }
            Array.Sort(A, B);
            Console.WriteLine(A[N - 1] + B[N - 1]);
        }
    }
}


Measured memory_bytes: 18996
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N, W;
    cin>>N>>W;
    long long w[N], sum=0;
    int val[N];
    for(int i=0; i<N; i++){
        cin>>w[i]>>val[i];
        sum += val[i];
    }
    long long dp[sum+1]; dp[0] = 0;
    for(int i=1; i<sum+1; i++)
        dp[i] = 10000000007;
    for(int i=0; i<N; i++){
        for(int j=sum; j>=val[i]; j--){
            dp[j] = min(dp[j], dp[j-val[i]]+w[i]);
        }
    }
    int ans = 0;
    for(int i=0; i<=sum; i++){
        if(dp[i] <= W && dp[i] != 10000000007)
            ans = i;
    }
    cout<<ans;
}


Measured memory_bytes: 1024
s=input()
if s[len(s)-7:len(s)]=='keyence':
    print('YES')
elif s[0:1]=='k' and s[len(s)-6:len(s)]=='eyence':
  print('YES')
elif s[0:2]=='ke' and s[len(s)-5:len(s)]=='yence':
  print('YES')
elif s[0:3]=='key' and s[len(s)-4:len(s)]=='ence':
  print('YES')
elif s[0:4]=='keye' and s[len(s)-3:len(s)]=='nce':
  print('YES')
elif s[0:5]=='keyen' and s[len(s)-2:len(s)]=='ce':
  print('YES')
elif s[0:6]=='keyenc' and s[len(s)-1:len(s)]=='e':
  print('YES')
elif s[0:7]=='keyence':
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(a,n) for (int a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
typedef vector<vector<ll> > Graph;
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; }
const ll INF = 1e18;

int main(){
    string s,t;
    cin >> s >> t;
    int lens = s.size();
    int lent = t.size();
    ll ans = INF;
    for(int i=0;i+lent<=lens;i++){
        ll now = 0;
        string a = s.substr(i,lent);
        rep(j,lent){
            if(a[j]!=t[j])now++;
        }
        chmin(ans,now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
macro_rules! get {
    ($read:ident, $t:ty) => {
        {
            let mut line: String = String::new();
            $read.read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($read:ident, $($t:ty),*) => {
        {
            let mut line: String = String::new();
            $read.read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
             $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($read:ident, $t:ty; $n:expr) => {
        (0..$n).map(|_|
                get!($read, $t)
                ).collect::<Vec<_>>()
    };
    ($read:ident, $($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                get!($read, $($t),*)
                ).collect::<Vec<_>>()
    };
    ($read:ident, $t:ty ;;) => {
        {
            let mut line: String = String::new();
            $read.read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($read:ident, $t:ty ;; $n:expr) => {
        (0..$n).map(|_| get!($read, $t ;;)).collect::<Vec<_>>()
    };
}

fn main() {
    let read = std::io::stdin();
    let write = std::io::stdout();
    solve(read.lock(), write.lock());
}

fn solve<R: std::io::BufRead, W: std::io::Write>(mut read: R, mut write: W) {
    let n = get!(read, u64);
    let result = if n % 2 == 0 { n } else { n * 2 };
    println!("{}", result);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cctype>
#include <cstring>

using namespace std;

int main()
{
    int N,i,cou=0;
    string S;
    cin>>N;
    cout<<endl;
    cin>>S;
   if(N>=3&&N<=50){
        for(i=0;i<N;i++){
            S[i]=toupper(S[i]);}
    for(i=0;i + 2<N; i++) {
    if(((char)S[i]=='A')&&((char)S[i+1]=='B')&&((char)S[i+2]=='C') ) {
                cou++;
                i=i+2;
            }}

    }
    cout<<cou;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>

typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN 300000

int a[MAXN];
int n;
ll k;
int v[MAXN];

int main() {
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	
	memset(v, -1, sizeof(v));
	v[0] = 0;
	int pos = 0;
	int it = 0;
	while (true) {
		it++;
		pos = a[pos];
		if (it == k) {
			cout << pos + 1 << endl;
			return 0;
		}
		if (v[pos] >= 0) {
			int cyc = it - v[pos];
			int left = (k - it) % cyc;
//			cerr << cyc << " " << left << endl;
			for (int i = 0; i < left; i++) {
				pos = a[pos];
			}
			cout << pos + 1 << endl;
			return 0;
		}
		v[pos] = it;
	
	}

	return 0;
}


Measured memory_bytes: 5596
def main():
    W, H, N = map(int, input().split())
    xya = [
        list(map(int, input().split()))
        for _ in range(N)
    ]

    #f1(W, H, N, xya)
    f2(W, H, N, xya)


def f1(W, H, N, xya):
    rect = [[1] * W for _ in range(H)]

    for x, y, a in xya:
        x_range = range(W)
        y_range = range(H)
        if a == 1:
            x_range = range(x)
        elif a == 2:
            x_range = range(x, W)
        elif a == 3:
            y_range = range(y)
        elif a == 4:
            y_range = range(y, H)

        for i in y_range:
            for j in x_range:
                rect[i][j] = 0

    ans = sum(map(sum, rect))
    print(ans)


def f2(W, H, N, xya):
    x1, y1 = 0, 0
    x2, y2 = W, H

    for x, y, a in xya:
        if a == 1:
            x1 = max(x, x1)
        elif a == 2:
            x2 = min(x, x2)
        elif a == 3:
            y1 = max(y, y1)
        elif a == 4:
            y2 = min(y, y2)

    if x1 > x2 or y1 > y2:
        ans = 0
    else:
        ans = (x2 - x1) * (y2 - y1)

    #print((x1, y1), (x2, y2))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <vector>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <cmath>
 
int main(void){
  int N;
  std::cin >> N;
  std::vector<int> W(N, 0);
  for(int i = 0; i < N; ++i){
  	std::cin >> W[i];
  }
  
  std::vector<int> t = W, ps(N);
  std::partial_sum(t.begin(), t.end(), ps.begin());
  int sum = ps.back(); ps.pop_back();
  int min = 0x7FFFFFFF;
  for(int i = 0; i < N - 1; ++i){
    int a = ps[i], b = sum - ps[i];
    int diff = std::abs(a - b);
    if(min > diff) min = diff;
  }
  std::cout << min << std::endl;
}


Measured memory_bytes: 256
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readLong() = readLn().toLong()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map(String::toInt)
private fun readLongs() = readStrings().map(String::toLong)

fun main() {
    val m = 10000
    val cnt = IntArray(m + 1)
    for (x in 1..100)
        for (y in 1..100)
            for (z in 1..100) {
                val res = x * x + y * y + z * z + x * y + y * z + x * z
                if (res > m) continue
                cnt[res]++
            }
    val n = readInt()
    println(cnt.take(n + 1).takeLast(n).joinToString("\n"))
}

Measured memory_bytes: 40372
#include <iostream>
#include <map>
#include <string>
using namespace std;

map<char, int> data;
int ans;

void parse(string str) {
	ans = 0;
	for (int i=0; i<str.size(); i++) {
		int t1 = data[str[i]];
		int t2 = 0;
		if (i != str.size()-1) t2 = data[str[i+1]];
		if (t1 < t2) {
			ans += t2 - t1;
			i++;
		} else {
			ans += t1;
		}
	}
}

int main() {
	string in;

	data['I'] = 1;
	data['V'] = 5;
	data['X'] = 10;
	data['L'] = 50;
	data['C'] = 100;
	data['D'] = 500;
	data['M'] = 1000;
	
	while (cin >> in, !in.empty()) {
		parse(in);
		cout << ans << endl;
		in.clear();
	}
	return 0;
}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long h=scan.nextLong();
		long w=scan.nextLong();
		scan.close();

		long ans = 0;
		if(w % 2==0 || h%2==0) {
			ans = w*h/2;
		}else {
			ans = w*h/2+1;
		}
		if(w==1||h==1)ans=1;
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
import itertools
import copy
H,W,K= map(int,input().split())
List=[list(input()) for i in range(H)]
nums=[]
total=0
for i in range(1,H+W+1):
    nums.append(i)
for q in range(0,H+W+1):
    hoge=[]
    for balls in itertools.combinations(nums, q):
        hoge.append(balls)
    for p in range(0,len(hoge)):
        Listo=copy.deepcopy(List)
        for i in range(1,H+1):
            if i in hoge[p]:
                for j in range(0,W):
                    Listo[i-1][j]="x"
        for i in range(H+1,H+W+1):
            if i in hoge[p]:
                for j in range(0,H):
                    Listo[j][i-H-1]="x"
        s=0
        for i in range(0,H):
            for j in range(0,W):
                if Listo[i][j]=="#":
                    s+=1
        if s== K:
            total+=1
print(total)

Measured memory_bytes: 9452
#include<stdio.h>

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

  if( a == 5 && b == 7 && c == 5 ||a == 7 && b == 5 && c == 5 || a == 5 && b == 5 && c == 7){
    printf("YES");
  }else{
    printf("NO");
  }

  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

signed main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<int> A(N);
  vector<int> B(M);
  for( int i = 0; i < N; i++ ) cin >> A[i];
  for( int i = 0; i < M; i++ ) cin >> B[i];

  vector<int> C(N+1);
  vector<int> D(M+1);
  for( int i = 0; i < N; i++ ) C[i+1] = C[i]+A[i];
  for( int i = 0; i < M; i++ ) D[i+1] = D[i]+B[i];

  int ans = 0;
  int nowtime = 0;
  for( int i = 0; i <= N; i++ ){
    nowtime = C[i];
    if( nowtime > K ) break;
    auto Iter = upper_bound(D.begin(), D.end(), K-nowtime);
    int num = Iter - D.begin();
    ans = max(ans, i+num-1);
  }
  cout << ans << endl;

}


Measured memory_bytes: 9592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n % 2 == 1) cout << "No" << endl;
    else {
        rep(i, n/2) {
            if(s[i] != s[n/2+i]) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }
    return 0;
}

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

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

N = int(input())

V = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for bit in range(1 << N):
    sum = 0
    for i in range(N):
        if bit & (1 << i):
            sum += V[i]
            sum -= C[i]
    ans = max(ans, sum)

print(ans)


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

int main()
{
    ll test=1;
    //  cin>>test;
    while(test--)
    {
        ll n;
        cin>>n;
        ll ar[n];
        for(ll i=0;i<n;i++)
            cin>>ar[i];
        ll ans=0;
        for(ll i=0;i<n-1;i++)
        {
            for(ll j=i+1;j<n;j++)
            ans += ar[i]*ar[j];
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#define long long long

using namespace std;

const int MOD = 998244353;

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

  long sum = 0;
  vector<int> a(n);

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

  vector<vector<long>> dp(n+1, vector<long>(sum+1, 0));
  vector<vector<long>> dp2(n+1, vector<long>(sum+1, 0));

  dp[0][0] = 1;
  dp2[0][0] = 1;
  for (int i = 0; i < n; i++) {
    long ai = a[i];
    for (long j = 0; (j + ai) <= sum; j++) {
      // 新しいやつを赤にする場合
      dp[i+1][j+ai] += dp[i][j];
      dp[i+1][j+ai] %= MOD;
      // 新しいやつを緑または青にする場合
      dp[i+1][j] += 2 * dp[i][j];
      dp[i+1][j] %= MOD;

      dp2[i+1][j+ai] += dp2[i][j];
      dp2[i+1][j+ai] %= MOD;
      // 新しいやつを緑にする場合
      dp2[i+1][j] += dp2[i][j];
      dp2[i+1][j] %= MOD;
    }
  }

  long dp_sum = 0;
  for (long i = sum / 2 + 1; i <= sum; i++) {
    dp_sum += dp[n][i];
    dp_sum %= MOD;
  }
  
  long dp2_sum = 0;
  if (sum % 2 == 0) {
    dp_sum += dp[n][sum / 2];
    dp_sum %= MOD;
    dp2_sum += dp2[n][sum / 2];
    dp2_sum %= MOD;
  }

  long power_result = 1;
  for (int i = 0; i < n; i++) {
    power_result *= 3;
    power_result %= MOD;
  }

  long result;
  result = power_result - 3 * dp_sum + 3 * dp2_sum;
  result %= MOD;

  if (result < 0) {
    result += MOD;
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 423744
#include<iostream>
using namespace std;
int main(){
  int n,bell,most2,number,length1,length2,totallength[10000],most1=-1;
  while(1){
    most1=-1;
    most2=0;
    cin >> n;
    if(n==0){
      break;
    }
    for(int i=0;i<n;i++){
      cin >> number >> length1 >> length2;
      totallength[number]=length1+length2;
      if(most1<totallength[number]){
	most1=totallength[number];
	most2=number;
      }
    }
    cout << most2 << " " << most1 << endl;
  }
  return (0);
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>

#define X first
#define Y second
#define vsort(v) sort(v.begin(), v.end())
#define vrev(v) reverse(v.begin(), v.end())
#define P pair

// stoi(s): string to int
// stod(s): string to double

// INT_MAX
// INT_MIN
// LLONG_MAX
// LLONG_MIN
// DBL_MIN
// DBL_MAX
// LDBL_MIN
// LDBL_MAX

// A-Z: 65~90
// a-z: 97~122
// |a-z| = 26

using namespace std;
using ll = long long;

int main(int argc, const char *argv[])

{
    int n;
    cin >> n;
    vector<int> v(n + 1), ans;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    for (int i = n - 1; i >= 0; i--)
    {
        if (v[i] == i + 1)
        {
            ans.push_back(v[i]);
            v.erase(v.begin() + i);
            i = v.size() - 1;
        }
    }
    vrev(ans);
    if (ans.size() == n)
    {
        for (int i = 0; i < n; i++)
        {
            cout << ans[i] << endl;
        }
    }
    else
    {
        cout << -1 << endl;
    }
}


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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  vector<int> q(n);
  for (int i = 0; i < n; i++) {
    cin >> q[i];
  }
  
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    v[i] = i+1;
  }

  int i = 1, pi = 0, qi = 0;
  do {
    if (v == p) pi = i;
    if (v == q) qi = i;
    i++;
  } while (next_permutation(v.begin(), v.end()));

  cout << abs(pi - qi) << endl;
}

Measured memory_bytes: 256
def main():
    n, m, *a = map(int, open(0).read().split())
    t = {1: 2, 2: 5, 3: 5, 4: 4, 5: 5, 6: 6, 7: 3, 8: 7, 9: 6}
    a.sort(reverse=True)

    dp = [-float('Inf')] * (n + 10)
    dp[0] = 0
    for i in range(2, n + 1):
        for j in a:
            dp[i] = max(dp[i], dp[i - t[j]] + 1)

    nums = []
    k = dp[n]
    while n:
        for x in a:
            if dp[n - t[x]] == k - 1:
                nums.append(x)
                n -= t[x]
                break
        k -= 1

    ans = ''.join(map(str, nums))
    print(ans)


if __name__ == '__main__':
    main()


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

int main()
{
  int t,h,m,s;
  cin >> t;
  s=t%60;
  t=t-s;
  m=(t%3600)/60;
  h=(t-60*m)/3600;
  cout << h << ":"<< m <<":" << s << endl;
  return 0; 
}

Measured memory_bytes: 1168
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N = ii()

A = [0] * (N+1)

A[0] = 2
A[1] = 1

for i in range(2, N+1):
    A[i] = A[i-1] + A[i-2]

print(A[N])

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
using namespace std;
using ll = long long;
const int mod = 1000000007;

int main() {
	int h, w, n;
	cin >> n >> h >> w;
	cout << (n-h+1)*(n-w+1) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define REP(i, n) for(int i=0;i<n;++i)

typedef long long ll;
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll r, d, x;
    cin >> r >> d >> x;
    ll ans = x;
    for(int i=0;i<10;++i){
        ans = r*ans - d;
        cout << ans << "\n";
    }
    return 0;
}


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

int main()
{
  int a, b;
  cin >> a >> b;
  auto min = ((a < b) ? a : b);
  auto max = ((a < b) ? b : a);
  for (int i = 0; i < max; ++i)
    cout << min;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
N,M = list(map(int,input().split()))
A = []
X = 0
ans = 0
for i in range(N):
    A.append(list(map(int, input().split())))
B = sorted(A)
for i in range(N):
  if (X + B[i][1])<M:
    ans += B[i][0]*B[i][1]
    X += B[i][1]
  else:
    ans += B[i][0]*(M-X)
    break
print(ans)

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

using namespace std;

int main(void)
{
    string S;
    cin >> S;
    for(int i = 0; i < 3; i++){
        if(S[i] == S[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;n>i;++i)
using namespace std;
using ll=int64_t;
using vi=vector<int>;
using VI=vector<ll>;
using vis=vector<string>;
using vvi=vector<vi>;
int main(){
    int n;
    cin>>n;
    cout<<(n-2)*180<<endl;
}

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

int main(void){
    int N;cin>>N;
    vector<string>W(N);
    cin>>W[0];
    for(int i=1;i<N;i++){
        cin>>W[i];
        if(W[i].at(0)!=W[i-1].at(W[i-1].size()-1)){
            cout<<"No"<<endl;
            return 0;
        }
    }
    sort(W.begin(),W.end());
    for(int i=1;i<N;i++){
        if(W[i]==W[i-1]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3632
def main():
    N = int(input())
    h = list(map(int, input().split()))

    for i in range(N-1):
        if h[-(i+1)] < (h[-(i+2)]-1):
            return "No"
        elif h[-(i+1)] >= h[-(i+2)]:
            pass
        else:
            h[-(i + 2)] = h[-(i + 2)] - 1
    return "Yes"

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 14396
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

A,B=na()
if(A==B):
    print(A+B)
elif(A>B):
    if(A-1>B):
        print(A+A-1)
    else:
        print(A+B)
elif(B>A):
    if(B-1>A):
        print(B+B-1)
    else:
        print(A+B)


Measured memory_bytes: 3064
def gcd(n,m):
    if n%m==0:
        return m
    elif m%n==0:
        return n
    elif n>m:
        n=n%m
        return gcd(n,m)
    else:
        m=m%n
        return gcd(n,m)

N,X=map(int,input().split())
x=list(map(int,input().split()))
m=0
for i in range(0,N):
    if i==0:
        m=abs(X-x[i])
    else:
        m=gcd(m,abs(X-x[i]))
print(m)

Measured memory_bytes: 14252
n = int(input())
alist_s = input().rstrip().split(" ")
alist = []
for i in range(n):
    alist.append(int(alist_s[i]))
flag = True
c = 0
while flag == True:
    ac = 0
    for i in alist:
        if i % 2 == 0:
            ac += 1
        else:
            flag = False
    if ac == len(alist):
        c += 1
        for j in range(len(alist)):
            alist[j] = int(alist[j] / 2)
print(c)


Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String S = sc.next();
      String A = S.substring(0,1);
      String B = S.substring(1,2);
      String C = S.substring(2,3);
      String D = S.substring(3,4);
      if(A.equals(B)||B.equals(C)||C.equals(D)){
        System.out.println("Bad");
      }else{
        System.out.println("Good");
      }
    }
}

Measured memory_bytes: 35488
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {

    BufferedReader input = new BufferedReader(new InputStreamReader(System.in));

    double debt = 100_000;
    while (input.ready()) {
      int weeks = Integer.valueOf(input.readLine());
      for (int i = 0; i < weeks; i++) {
        debt += debt * 0.05;
        double hasuu = debt % 1000;
        if (hasuu > 0) {
          debt += 1000 - hasuu;
        }
      }
      System.out.println((int) debt);
    }
  }

}

Measured memory_bytes: 24176
x = int(input())
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9180
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int ans = 700;
        String S = reader.next();
        for (int i=0; i<3; i++) if (S.charAt(i) == 'o') ans += 100;
        System.out.println(ans);
    }

    // Read Class
    static class FS {
        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() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); 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 int nextInt() {
            return (int)nextLong();
        }
        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();
            }
        }
    }
}



Measured memory_bytes: 21076
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define REP(idx, N) for (u64 idx = 0; idx < N; idx++)

int main() {
  u32 N = 0;
  cin >> N;
  u64 ans = 1;
  u64 a;
  vector<u64> A;

  REP(i, N) {
    cin >> a;
    A.push_back(a);
  }

  if (std::find(A.begin(), A.end(), 0UL) != A.end()){
    cout << 0;
    return 0;
  }

  REP(i, N) {
    if (ans > 1000000000000000000 / A[i]) {
      cout << -1;
      return 0;
    }
    ans *= A[i];
  }

  cout << ans;
  return 0;
}


Measured memory_bytes: 4316