akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    i32 n; cin >> n; cout << n + n*n + n*n*n << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3540
a, v = list(map(int, input().split()))
b, w = list(map(int, input().split()))
t = int(input())

if v != w:
  if b - a > 0:
    dt = (b - a) / (v - w)
    print( "YES" if 0 < dt and dt <= t else "NO")
  else:
    dt = (b - a) / (w - v)
    print( "YES" if 0 < dt and dt <= t else "NO")
else:
  print("NO")

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

void nextnum(int n, vector<int> &a){
    int x,s;
    vector<int> v(n);
    rep(i,n-1){
        x=n-i-1;
        v[i]=a[x];
        if(a[x-1]<a[x]){
            s=a[x-1];
            rep(j,i+1){
                if(s<v[j]){
                    swap(s,v[j]);
                    a[x-1]=s;
                    break;
                }
            }
            sort(v.begin(),v.end());
            rep(k,i+1){
                a[x+k]=v[n-i-1+k];
            }
            break;
        }
    }
}


int main(){
    int n,c1=0,c2=0;
    cin>>n;
    vector<int> p(n),p2(n),q2(n),q(n);
    set<int> se;
    rep(i,n){
        cin>>p[i];
    }
    rep(i,n){
        cin>>q[i];
    }
    rep(i,n){
        p2[i]=i+1;
        q2[i]=i+1;
    }
    while(p!=p2){
        nextnum(n,p2);
        c1++;
    }
    while(q!=q2){
        nextnum(n,q2);
        c2++;
    }
    cout<<abs(c1-c2)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
class Main{


	static final int MOD = 1000000007;

	static int MAX = 10000000;
	static	ArrayList<TreeNode> tree;
	static HashSet<Integer> set;
	static long ans;

	static HashSet<Integer> memo;
	static HashMap<Integer, TreeNode> map;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int k = sc.nextInt();
		int m = (n-1)*(n-2)/2;
		if(k > m){				//不可能
			System.out.println(-1);
		}else{
			System.out.println(m-k+n-1);
			int count = 0;
			for(int i = 2;i <= n;i++){
				System.out.println(1 + " " + i);
			}
			for(int i = 2;i <= n;i++){
				if(m-count==k){
					return;
				}
				for(int j = i+1;j <= n;j++){
					System.out.println(i + " " + j);
					count++;
					if(m-count==k){
						return;
					}
				}
			}

			
		}



	}












	static long fac[] = new long[MAX];
	static long finv[] = new long[MAX];
	static long inv[] = new long[MAX];



	//テーブルの作成
	static void COMinit() {
		fac[0] = fac[1] = 1;
		finv[0] = finv[1] = 1;
		inv[1] = 1;
		for (int i = 2; i < MAX; i++){
			fac[i] = fac[i - 1] * i % MOD;
			inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
			finv[i] = finv[i - 1] * inv[i] % MOD;
		}
	}

	// 二項係数計算
	static	long COM(int n, int k){
		if (n < k) return 0;
		if (n < 0 || k < 0) return 0;
		return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
	}








	static int upperbond(int k,ArrayList<Integer> data){		//k以下で最大の値をdataの中から探し、返す二分探索
		if(data == null){
			return -1;
		}
		int max = data.size();
		int min = -1;
		while(max-min > 1){
			int mid = (max+min)/2;
			if(data.get(mid) <= k){
				min = mid;
			}else{
				max = mid;
			}
		}


		//		if(min != -1){
		//			min = data.get(min);
		//		}

		//		System.out.println(max);
		return min;					//indexを返している
	}

	static int lowerbond(int k,ArrayList<Integer> data){		//k以上で最小の値をdataの中から探し、返す二分探索
		if(data == null){
			return -1;
		}
		//		System.out.println("lo");
		//		System.out.println("lo");
		int max = data.size();
		int min = -1;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data.get(mid) >= k){
				max = mid;
			}else{
				min = mid;
			}
		}

		return max;			//indexを返している
	}



	static int gcd(int a,int b){				//最大公約数を返す
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}
	static long gcd(long a,long b){
		if(b == 0){
			return a;
		}else{
			return gcd(b, a%b);
		}
	}



	static long lcm (long a, long b) {
		long g = gcd(a,b);
		return a/g*b;
	}
}



class TreeNode{
	int value;
	ArrayList<TreeNode> children;
	boolean root;
	boolean fchild;

	public TreeNode(int value,ArrayList<TreeNode> children,boolean root) {
		this.value = value;
		this.children = children;
		this.root = root;
	}


}

class Pair implements Comparable{
	int from;
	int end;
	public Pair(int from,int end) {
		this.from = from;
		this.end = end;
		// TODO 自動生成されたコンストラクター・スタブ
	}

	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return  from - otherpair.from;
	}








}






Measured memory_bytes: 261076
//ALDS1_1_C: Prime Numbers
//C
#include <stdio.h>
int isPrime(int x){//0非?数 1?数 
    int i;
    if(x<2)return 0;
    else if(x==2)return 1;
    if(x%2==0)return 0;
    for(i=3;i*i<=x;i+=2)//+2速度又快了很多 
        if(x%i==0)
            return 0;
    return 1;
}
int main(){
    int i,n,cnt=0,x;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&x);
        if(isPrime(x))cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}

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

using namespace std;

int main(){
    string s="";
    for(int i=0; i<4; i++){
        int x; cin>>x;
        s.push_back((char)x+'0');
    }
    sort(s.begin(),s.end());
    if(s=="1479"){
        cout << "YES";
    } else cout << "NO";
    return 0;
}


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

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int a[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(str[i]);
		}

		int q = Integer.parseInt(br.readLine());
		int m[] = new int[q];

		str = br.readLine().split(" ");
		for (int i = 0; i < q; i++) {
			m[i] = Integer.parseInt(str[i]);
		}

		boolean flag[] = new boolean[q];

		for (int i = 0; i < Math.pow(2, n); i++) {
			int sum = 0;

			for (int j = 0; j < n; j++) {
				if ((i & (1 << j)) != 0) {
					sum += a[j];
				}
			}
			for (int j = 0; j < q; j++) {
				if (sum == m[j] && !flag[j]) {
					flag[j] = true;
				}
			}
		}

		for (int i = 0; i < q; i++) {
			if (flag[i]) {
				System.out.println("yes");
			} else {
				System.out.println("no");
			}
		}
	}
}


Measured memory_bytes: 25876
x = int(input())

ans = 0

def prime(x):
    y = x//2+1
    cnt = 0
    for i in range(2,y+1):
        if x%i==0:
            cnt += 1
            
    if x==2:
        return 2
    else:
        if cnt==0:
            return x
        else:
            return 0
            
while ans == 0:
    ans = prime(x)
    x += 1
    

print(ans)

Measured memory_bytes: 3064
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut points = vec![];
    for i in 0..n {
        let v = read_vec::<i64>();
        let (x, y, p) = (v[0], v[1], v[2]);
        points.push((x, y, p));
    }

    let mut answers = vec![std::i64::MAX; n + 1];
    for state in 0..1 << n {
        let mut xs = vec![];
        let mut ys = vec![];
        for j in 0..n {
            if (state >> j) & 1 == 1 {
                xs.push(j);
            } else {
                ys.push(j);
            }
        }

        let mut xs = xs
            .iter()
            .map(|&x| (points[x].0, points[x].2))
            .collect::<Vec<_>>();
        xs.sort();
        let mut ys = ys
            .iter()
            .map(|&x| (points[x].1, points[x].2))
            .collect::<Vec<_>>();
        ys.sort();

        let dp_x = solve_two(&xs);
        let dp_y = solve_two(&ys);

        for xi in 0..dp_x.len() {
            for yi in 0..dp_y.len() {
                if xi + yi > n {
                    break;
                }
                answers[xi + yi] = min(answers[xi + yi], dp_x[xi] + dp_y[yi]);
            }
        }
    }
    assert_eq!(answers[n], 0);
    for ans in answers {
        println!("{}", ans);
    }
}

fn solve_two(xs: &Vec<(i64, i64)>) -> Vec<i64> {
    let n = xs.len();
    let mut dp = vec![vec![std::i64::MAX; n + 1]; n + 1];
    dp[0][0] = 0;

    for l in 0..n {
        for r in l + 1..n + 1 {
            let mut min_cost = std::i64::MAX;
            for k in l..r {
                let cost = (l..r)
                    .map(|i| (xs[i].0 - xs[k].0).abs() * xs[i].1)
                    .sum::<i64>();
                min_cost = min(cost, min_cost);
            }
            for ki in 0..n {
                if dp[l][ki] == std::i64::MAX {
                    continue;
                }
                dp[r][ki + 1] = min(dp[r][ki + 1], dp[l][ki] + min_cost);
            }
            let no_use_cost = (l..r).map(|i| xs[i].0.abs() * xs[i].1).sum::<i64>();
            for ki in 0..n + 1 {
                if dp[l][ki] == std::i64::MAX {
                    continue;
                }
                dp[r][ki] = min(dp[r][ki], dp[l][ki] + no_use_cost);
            }
        }
    }
    dp[n].clone()
}
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 read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2132
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
 
using namespace std;


	
int main()
{ 
	int s, w;
	cin>>s>>w;
	if(w>=s)cout<<"unsafe"<<endl;
	else cout<<"safe"<<endl;
	return 0;
}
	
	


Measured memory_bytes: 3620
import collections

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


n = int(input())
c = collections.Counter(prime_factorize(n))
l = c.values()
ans=0
for i in list(l):
    temp = i
    j=1
    while temp > 0:
        if temp < j:
            break
        temp -= j
        j += 1
        ans += 1
print(ans)

    


Measured memory_bytes: 9468
from heapq import heappop, heappush
import sys
input = sys.stdin.readline
INF = 10**100
MAX = 2500
N, M, S = map(int, input().split())
S = min(S, MAX)
G = [[] for _ in [0]*N]
C = []
for _ in [0]*M:
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    G[v].append((u, a, b))
    G[u].append((v, a, b))

for i in range(N):
    a, b = map(int, input().split())
    C.append((a, b))

# dijkstra
dp = [[INF]*MAX for _ in [0]*N]
q = []
def push(t, s, v):
    if s < 0:
        return
    if s >= MAX:
        s = MAX-1
    if dp[v][s] <= t:
        return
    dp[v][s] = t
    heappush(q, (t, s, v))

push(0, S, 0)

while q:
    t, s, v = heappop(q)
    if dp[v][s] != t:
        continue

    c, d = C[v]
    push(t+d, s+c, v)

    for u, a, b in G[v]:
        push(t+b, s-a, u)

# output
for d in dp[1:]:
    ans = INF
    for s in range(MAX):
        if ans > d[s]:
            ans = d[s]
    print(ans)


Measured memory_bytes: 24120
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

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

    vector<int> v1, v2;
    int ans = s.length();
    rep(i,0,s.length()) {
        if(s[i] == 'S') v1.pb(i);
        else if(s[i] == 'T') v2.pb(i);
    }

    int i = 0, j = 0;
    while(i != v1.size() && j != v2.size()) {
        // printf("%d %d\n", v1[i], v2[j]);
        if(v1[i] < v2[j]) {
            ans -= 2;
            i++; j++;
        }
        else j++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1532
n = int(input())
d1, d2 = [], []
for i in range(n):
    a, b = input().split()
    d1.append(int(a))
    d2.append(int(b))

count = 0
for a, b in zip(d1, d2):
    if a == b:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        break

if count != 3:
    print('No')

Measured memory_bytes: 9188
N = int(input())
p = list(map(int, input().split()))

a = [i * (N) for i in range(1, N+1)]
b = [(N-(i-1)) * (N) for i in range(1, N+1)]
for i in range(N):
	b[p[i]-1] += i

print(" ".join(map(str, a)))
print(" ".join(map(str, b)))


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, K;
    cin >> N >> K;
    vec p(N);
    REP(i,0,N) {
        cin >> p[i];
        ++p[i];
    }

    ll sum = 0;
    REP(i,0,K) sum += p[i];
    ll m = sum;
    REP(i,0,N-K) {
        sum = sum - p[i] + p[i+K];
        m = MAX(m,sum);
    }
    cout << setprecision(12) << m * 0.5 << endl;

    return 0;
}

/*



*/

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

long long int n,i,a[60],x;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	for (i=1;i<n+1;i++) cin>>a[i];
	x=0;
	for (i=1;i<n+1;i++) if (a[i]==i) x++;
	if (x==n || x==n-2) cout<<"YES";else cout<<"NO";
}


Measured memory_bytes: 256
import java.util.*;
class Main
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int number=sc.nextInt();
		long []numberBox=new long[number];
		int error=0;
		for(int i=0;i<number;i++)
		{
			numberBox[i]=sc.nextInt();
			if(numberBox[i]==0)
			{
				error=1;
			}	
		}
		if(error==0)
		{
			checkEven(numberBox,number);
		}	
		else
		{
			System.out.print("0");
		}	
		
	}
	static void checkEven(long[] box,int num)
	{
		int countTimes=0;
		while(true)
		{
			int count=0;
			for(int i=0;i<num;i++)
			{
				if(box[i]%2==0)
					count++;
			}
			if(count==num)
			{
				for(int j=0;j<num;j++)
				{
					box[j]/=2;
				}
				countTimes++;
			}
			else
			{
				System.out.print(countTimes);
				break;
			}
		}	
	}
}

Measured memory_bytes: 21844
a,b,c,d=map(int,input().split())

if ((a<=b) and (b<=c)) or ((c<=b) and (b<=a)):
  if (abs(a-b)<=d) and (abs(b-c)<=d):
    print("Yes")
  else:
    print("No")
else:
  if abs(a-c)<=d:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long K = sc.nextLong();
		long S = sc.nextLong();
		long count = 0;

		for (int i = 0; i <= K; i++) {
			for (int j = 0; j <= K; j++) {
				if (S - i - j <= K && 0 <= S - i - j) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21712
s=list(input())
if len(s)%2==1:
    s=s[:-1]
else:
    s=s[:-2]

while True:
    l=len(s)//2
    s0=s[:l]
    s1=s[l:]
    if s0==s1:
        print(l*2)
        exit()
    else:
        s=s[:-2]
        #print(s)

Measured memory_bytes: 38384
D, G = map(int, input().split())

P = {}
C = {}
for i in range(D):
    P[i], C[i] = map(int, input().split())

ans = float('inf')

for j in range(2**D):
    total_tmp = 0
    count = 0
    not_done = []
    for k in range(D):
#         print(bin(j))
        if (j>>k)&1:
            total_tmp += P[k]*100*(k+1)
            total_tmp += C[k]
            count += P[k]
#             print(total_tmp)
        else:
            not_done.append(k)
    ## Gを超えたら、最小のカウント数
    if total_tmp >= G:
        ans = min(ans, count)
    ## Gを超えなかったら、まだカウントしていない最大の問題から順に足していく
    else:
#         print(sorted(not_done, reverse=True))
        for y in sorted(not_done, reverse=True):
            for x in range(P[y]):
                count += 1
                total_tmp += 100*(y+1)
#                 print(count)
                if total_tmp >= G:
#                     print(total_tmp)
                    ans = min(ans, count)
                    break
        
print(ans)

Measured memory_bytes: 3188
#include <iostream>

using namespace std;

int main() {

  int a,b,c,x;

  cin >> a >> b >> c >> x;

  int a_num, b_num;

  a_num = x / 500;
  b_num = (x%500) / 100;
  
  //int answer = 1;

  //answer += a_num*5;

  int i,j;
  int answer = 0;

  for(i=0; i<=a_num; i++) {
    if(i>a) {
      break;
    }
    for(j=0; j<=(a_num-i)*5+b_num; j++) {
      if(j <=b && (((a_num-i)*5+b_num)-j)*2 + (x%100)/50 <=c)
	answer++;
    }
  }

  cout << answer << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<cstring>
#include<string>
#include<ctime>


using namespace std;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1.0);
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define all(v) v.begin(), v.end()
const long MOD = pow(10, 9) + 7;

char alfa[] = { 'A','B' ,'C','D' ,'E' ,'F' ,'G' ,'H' ,'I' ,'J' ,'K' ,'L' ,'M' ,'N' ,'O' ,'P' ,'Q' ,'R' ,'S' ,'T' ,'U' ,'V' ,'W' ,'X' ,'Y','Z' };

inline void finish() {
	cout << -1 << endl;
	exit(0);
}

unsigned GetDigit(unsigned num) {
	return log10(num) + 1;
}

ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

class Mod {
public:
	static inline ll Add(ll a, ll b) {
		return (a + b) % MOD;
	}

	static inline ll Sub(ll a, ll b) {
		ll ans = (a - b) % MOD;
		return (ans < 0) ? (ans + MOD) : ans;
	}

	static inline ll Mul(ll a, ll b) {
		return (a * b) % MOD;
	}

	static inline ll Div(ll a, ll b) {
		return (a % MOD) * modinv(b, MOD) % MOD;
	}
};



template <typename T>
inline void debug(vector<T> v) {
	cout << "[";
	for (ll i = 0; i < v.size() - 1; ++i) {
		cout << v[i] << ", ";
	}
	cout << v[v.size() - 1] << "]" << endl;
}

void Main();
inline void DebugMain() {
	while (true) {
		Main();
	}
}

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

	bool debug = false;
	if (debug) {
		cout << "\x1b[41m" << "Debug Mode " << endl;
	}
	(debug) ? DebugMain() : Main();
	return 0;
}

class man
{
public:
	int A;
	vector<pii> X;
	bool HeIsTrue;
private:

};

inline void Main() {
	ll X, Y, N;
	vector<ll> A;
	ll M1, D1, M2, D2;
	ll ans;
	ll sum = 0, count = 0;
	string S;
	string T;
	string Ans = "";
	int b[60];
	bool flag = false;

	cin >> N >> S >> T;

	for (int i = 0; i < 2*N; i++) {
		if (i % 2 == 0) {
			Ans += S[i / 2];
		}
		else {
			Ans += T[(i - 1) / 2];
		}
	}

	cout << Ans;



}



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

using namespace std;


int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	bool flag=false;
	int c=0;
	int mi=100000009;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		if(a[i]<0)
			c++;
		if(abs(a[i])<mi)
			mi=abs(a[i]);
		ans+=abs(a[i]);
	}

	if(c%2==1)
		ans-=(mi*2);
	
	cout << ans << endl;
}


	



Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <functional>
#include <map>
#include <set>
#include <cmath>
#include <string>
#define SIZE 200005
#define INF 1000000005LL

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int N;
ll A,X[52];
ll dp[52][52*52][52];

int main()
{
	scanf("%d %lld",&N,&A);
	for(int i=1;i<=N;i++)scanf("%lld",&X[i]);
	for(int i=0;i<=N;i++)dp[i][0][0]=1;
	for(int i=1;i<=N;i++){
		for(ll j=1;j<=(50*50);j++){
		//for(ll j=1;j<=(36);j++){
			for(int k=1;k<=N;k++){
				ll v1=0,v2;
				if(j-X[i]>=0)v1 = dp[i-1][j-X[i]][k-1];
				v2 = dp[i-1][j][k];
				dp[i][j][k] = v1+v2;
				//printf("(%d,%lld,%d,%lld)",i,j,k,(v1+v2));
			}
		}
	}
	ll ans=0;
	for(int i=1;i<=N;i++){
		if(i*A>2500)break;
		else ans += dp[N][i*A][i];
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 55040
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;


namespace AtCoderDotNetCore
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			var xy = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
			long x = xy[0];
			long y = xy[1];
			long a = x;
			var count = 1;
			for (var i = 1; i < y / x; ++i) {
				a *= 2;
				if (a > y) {
					break;
				}

				++count;
			}

			Console.WriteLine($"{count}");
		}
	}
}

Measured memory_bytes: 28008
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
 
typedef vector<int> vi;;
typedef vector<ll> vll;

#define l() length()
#define sz() size()
 
#define b() begin()
#define e() end()
#define all(x) x.begin(), x.end()
 
#define pb(i) push_back(i)
#define PB() pop_back()
 
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
#define mp make_pair
#define Fi first
#define Se second
 
const int maxx=1e6+9;
 
// Happy Coding!

bool _find(vi &freq){
    for(int i=0;i<26;i++){
        if(freq[i]&1)
            return false;
    }
    return 1;
}
void solve(){
    string str;
    cin>>str;
    vi freq(26,0);
    for(char ch:str){
        freq[ch-'a']++;
    }
    if(_find(freq)){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}



int main() {
    faster;
    int t=1;
    // cin>>t;
    while(t-->0){
        solve();
    }
	return 0;
}

Measured memory_bytes: 3596
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<utility>//pair
#include<list>
#include<vector>//可変長配列
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define all(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<ll,ll>
#define F first
#define S second
int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
int dy[8] = { 0,1,0,-1,1,1,-1,-1 };


int a, b;

int main() {
	cin >> a >> b;
	if (a <= b)
		cout << "unsafe\n";
	else
		cout << "safe\n";

	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

/*
 * if there are only n elements and it is a permutation the solution is just
 * nc1, nc2, nc3 ... ncn for all k = 1, 2, 3 .... n.
 * 1 3 2 4 2 5
 * First take all the possible subsequences of length k
 * Now remove the extra ones
 */

ll power(ll a, ll b, ll c) {
	ll res = 1;
	while(b != 0) {
		if (b & 1)
			res = (res * a) % c;
		a = (a * a) % c;
		b /= 2;
	}
	return res;
}
ll inv(ll x) {
	return power(x, MOD - 2, MOD);
}
ll sub(ll x, ll y) {
	return (x % MOD - y % MOD + MOD) % MOD;
}
int main() {
	int n;
	cin >> n;
	vector <int> mp(n + 1);
	int d = -1;
	for (int i = 1; i <= n + 1; i++) {
		int x;
		cin >> x;
		if (mp[x] == 0) {
			mp[x] = i;
		} 
		else {
			d = (n + 1) - (i - mp[x]);
		}
	}
	const int N = 100 * 1000 + 5;
	vector <ll> fact(N);
	fact[0] = 1;
	for (int i = 1; i < N; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
	}
	auto C = [&](ll nn, ll rr) {
		if (nn < rr)
			return 0LL;
		return fact[nn] * inv(fact[rr]) % MOD * inv(fact[nn - rr]) % MOD;
	};
	for (int i = 1; i <= n + 1; i++) {
		ll total = C(n + 1, i);
		total = sub(total, C(d - 1, i - 1));
		cout << total << "\n";
	}
	
}


Measured memory_bytes: 2432
import java.util.Scanner;

public class Main {
    public static void main(String[]args){
        
        Scanner sc = new Scanner(System.in);
        
        long num = 0;
        long min =  1000000;  
        long max = -1000000;  
        long sum = 0; 
       
        int n = sc.nextInt();
         
      
        for(int i = 0; i < n; i++){
            num = sc.nextLong();
         
     
        if(num < min )
            min = num;
             

        if(max < num)
            max = num;
         
      
        sum += num;
        }
       
        System.out.println(min + " " + max + " " + sum);
    }

	}

Measured memory_bytes: 41496
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define T int t;cin>>t;while(t--)
#define f(i,n) for (int i=0;i<n;i++)
#define fa(i,a,b) for (int i=a;i<b;i++)
#define b(i,a,b) for (int i=a;i>=b;i--)
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define fi first    
#define se second
#define SZ(x) ((int)(x).size())
#define debug(x) cout<<">"<<#x<<" = "<<x<<endl;
// #define MOD 1000000007
#define ce cout<<"\n"

int main()
{
    double r;
    cin>>r;
    cout<<setprecision(10)<<r*r;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 998244353LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> PP;

class segtree{
public:
	static const int N=1<<18;
	int dp[1<<19];
	segtree(){
		memset(dp,0,sizeof(dp));
	}
	void update(int k,int v){
		k+=N-1;
		dp[k]+=v;
		while(k>0){
			k=(k-1)/2;
			dp[k]=dp[k*2+1]+dp[k*2+2];
		}
	}

	int query(int a,int b,int k=0,int l=0,int r=N){
		if(b<=l || r<=a)return 0;
		if(a<=l && r<=b)return dp[k];
		int mid=(l+r)/2;
		int vl=query(a,b,k*2+1,l,mid);
		int vr=query(a,b,k*2+2,mid,r);
		return vl+vr;
	}
};

int n;
int x[200005],y[200005];
vector<int> xi;
vector<int> yi;
int cnt[2][200005][2];
segtree seg;
PP p[200005];

ll mod_pow(ll x,ll n){
	ll ans=1;
	while(n>0){
		if(n&1){
			ans=ans*x%MOD;
		}
		x=x*x%MOD;
		n>>=1;
	}
	return ans;
}

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",&x[i],&y[i]);
		xi.push_back(x[i]);
		yi.push_back(y[i]);
	}
	sort(xi.begin(),xi.end());
	sort(yi.begin(),yi.end());

	for(int i=0;i<n;i++){
		x[i]=lower_bound(xi.begin(),xi.end(),x[i])-xi.begin();
		y[i]=lower_bound(yi.begin(),yi.end(),y[i])-yi.begin();
		p[i].first=P(x[i],y[i]);
		p[i].second=i;
	}
	sort(p,p+n);
	for(int i=0;i<n;i++){
		int v=p[i].second;
		cnt[0][v][0]=seg.query(0,p[i].first.second);
		cnt[0][v][1]=seg.query(p[i].first.second,n);
		seg.update(p[i].first.second,1);
	}
	memset(seg.dp,0,sizeof(seg.dp));
	for(int i=n-1;i>=0;i--){
		int v=p[i].second;
		cnt[1][v][0]=seg.query(0,p[i].first.second);
		cnt[1][v][1]=seg.query(p[i].first.second,n);
		seg.update(p[i].first.second,1);
	}
	ll ans=(ll)n*mod_pow(2,n-1)%MOD;
	for(int i=0;i<n;i++){
		//printf("%lld %d %d %d %d\n",ans,cnt[0][i][0],cnt[0][i][1],cnt[1][i][0],cnt[1][i][1]);
		ll val=(mod_pow(2,cnt[0][i][0])-1LL)*(mod_pow(2,cnt[1][i][1])-1LL)%MOD;
		ll val2=(mod_pow(2,cnt[0][i][1])-1LL)*(mod_pow(2,cnt[1][i][0])-1LL)%MOD;
		ans+=MOD-(val*val2)%MOD;
		ans%=MOD;
		ans+=val*mod_pow(2,cnt[0][i][1]+cnt[1][i][0])%MOD;
		ans%=MOD;
		ans+=val2*mod_pow(2,cnt[0][i][0]+cnt[1][i][1])%MOD;
		ans%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}


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

bool compair(pair<int, int> x, pair<int, int> y){
    return x.second < y.second;
}

int main(){
    int h ,w;
    int n;

    cin >> h >> w >> n;

    vector<pair<int, int> > a;

    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        a.push_back(make_pair(i+1, x));
    }

    sort(a.begin(), a.end(), compair);

    int maze[h+1][w+1];

    int y = 1;
    int x = 1;
    while(y <= h){
        if(y % 2 == 1){
            while(x <= w){
                
                maze[y][x] = a[0].first;
                //printf("%d ", maze[y][x]);
                a[0].second -= 1;
                if(a[0].second == 0){
                    a.erase(a.begin());
                }
                x++;
            }
            //printf("\n");
            //printf("x %d", x);
            x = w;
        }
        else if(y % 2 == 0){
            while(x >= 1){
                
                maze[y][x] = a[0].first;
                //printf("%d ", maze[y][x]);
                a[0].second -= 1;
                if(a[0].second == 0){
                    a.erase(a.begin());
                }
                x--;
            }
            //printf("\n");
            x = 1;
        }

        y++;
    }

    for(int j = 1; j <= h; j++){
        for(int i = 1; i <= w; i++){
            printf("%d ", maze[j][i]);
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
long double pi = 2 * acos(0.0);
const ll mod = 1e9 + 7;

ll modpow(ll a, ll p) {
    ll res = 1;
    while(p) {
        if(p & 1) res = (res * a) % mod;
        p >>= 1;
        a = (a * a) % mod;
    }
    return res;
}

void solve() {
    ll n;
    cin >> n;
    if(n == 1) {
        cout << "0\n";
        return;
    }
    ll total = modpow(10, n), no09 = modpow(8, n), no0 = modpow(9, n);
    total = (total - no0 + mod) % mod;
    total = (total - no0 + mod) % mod;
    total = (total + no09 + mod) % mod;
    cout << total << "\n";
}

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(nullptr);   
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

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

int main() {
  int A;
  cin >> A;
 
  if(A%2==0){
    std::cout <<1.0/2 << std::endl;
  }
  else{
    std::cout <<(double)((A+1)/2)/A << std::endl;
  }
}


Measured memory_bytes: 256
#![allow(unused_macros)]

// cf. [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita](https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8)
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! {
        N: usize,
        S: [String; N],
    }
    use std::collections::HashSet;
    let mut set = HashSet::new();
    for i in 0..N {
        set.insert(S[i].clone());
    }
    if set.len() == 3 {
        println!("Three");
    } else {
        println!("Four");
    }
}


Measured memory_bytes: 4352
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

M = 10**5

N = int(input())
A = list(map(int, input().split()))

cnt = [0]*(M+2)
for a in A:
    cnt[a] += 1

ans = 0
for i in range(1,M):
    ans = max(ans, cnt[i-1]+cnt[i]+cnt[i+1])

print(ans)

Measured memory_bytes: 23472
n=int(input())
l=[]
for _ in range(n):
    l.append(input().split())
x=input()
ll=list(l[i][0] for i in range(n))
lll=list(int(l[i][1]) for i in range(n))
k=ll.index(x)
print(sum(lll[k+1:n]))

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


int n,k;

int a[100005],dp[100005];


int func(int i)
{
    if(i+1==n)return 0;

    int p=1e9,q=1e9;

    if(dp[i]!=-1)return dp[i];

    for(int j=1;j<=k;j++)
    {
     if(j+i<n)p=min(p,abs(a[i]-a[i+j])+func(i+j));
    }


    return dp[i]=p;

}


int main()
{
    scanf("%d%d",&n,&k);
    memset(dp,-1,sizeof dp);

    for(int i=0;i<n;i++)scanf("%d",a+i);

    printf("%d\n",func(0));

    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
 
signed main(){
 
	lli k,a,b;
	cin>>k>>a>>b;

	lli ans=0;
	if(a+2>b){
		cout <<k+1<<endl;
		return 0;
	}
	/*a<=bの場合、ビスケットをa枚作った後*/
	/*ひたすらビスケットa枚を1円→b枚に交換し*/
	/*できたa枚をまた1円→b枚に交換するのが最適解*/
	/*a -> 1円 -> bにするには2回行動回数が必要*/
	/*そのため、aにまずするための行動回数はいくつか?*/
	lli toACnt = a-1;
	lli leftA1BCnt = k - toACnt;
	ans = a;
	/*(残りの回数÷2)*(b-a)ずつ増やす*/
	/*(残りの回数)が奇数の場合は1つ答えに増やす*/ 
	ans += (leftA1BCnt)/2 * (b-a);
	if(leftA1BCnt%2)ans++;
	cout<<ans<<endl;

	return 0;
}

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

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

int ans = 0, N, M, Q;
vi A, B, C, D, num;

int checkReq(vi tmp){
    int res = 0;

    rep(i, Q){
        if(tmp[B[i]] - tmp[A[i]] == C[i]) res += D[i];
    }

    return res;
}


void dfs(vi tmp){
    int n = tmp.size();

    if(n==N){
        // rep(i, N)
        //     cout << tmp[i+1] << " ";
        // cout << endl;
        ans = max(ans, checkReq(tmp));
    } else {
        tmp.push_back(tmp[n-1]);
        while(tmp[n] <= M){
            dfs(tmp);
            tmp[n]++;
        }
        tmp.pop_back();
    }
}

void solve(){

    rep(i, M){
        num.push_back(i+1);
        dfs(num);
        num.pop_back();
    }

    cout << ans << endl;
}

int main(){
    cin >> N >> M >> Q;
    A.resize(Q);
    B.resize(Q);
    C.resize(Q);
    D.resize(Q);

    rep(i, Q) {
        cin >> A[i] >> B[i] >> C[i] >> D[i];
        --A[i], --B[i];
    }
    
    solve();
}


Measured memory_bytes: 3576
N = 6
ARR = [
    ["khabarovsk", 20],
    ["moscow", 10],
    ["kazan", 50],
    ["kazan", 35],
    ["moscow", 60],
    ["khabarovsk", 40]
]
N = int(input())
ARR = []

for i in range(N):
    arr = input().split()
    ARR.append([arr[0], int(arr[1])])


def calculate(n, arr):
    dict = {}
    for i in range(N):
        if dict.get(arr[i][0]) == None:
            dict.__setitem__(arr[i][0], [[arr[i][1], i]])
        else:
            rates = dict.get(arr[i][0])
            rates.append([arr[i][1], i])
            rates = sorted(rates, key=lambda x: -x[0])
            dict.__setitem__(arr[i][0], rates)

    keys = sorted(dict.keys())

    for key in keys:
        aaa = dict.get(key)
        for a in aaa:
            print(a[1] + 1)


calculate(N, ARR)


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

bool isLowerCase(char ch){
    if(ch>='a' && ch<='z')
        return true;
    return false;
}

bool isAC(const string& s){
    if(s[0]!='A')
        return false;

    int cnt=0;

    for(int i=2; i<s.size()-1; i++)
        if(s[i]=='C')
            cnt++;

    if(cnt!=1)
        return false;

    for(int i=1; i<s.size(); i++)
        if(!isLowerCase(s[i]) && s[i]!='C')
            return false;

    return true;
}

int main(){
    string s;

    while(cin>>s){
        if(isAC(s))
            puts("AC");
        else
            puts("WA");
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
typedef long long ll;
const ll MOD=pow(10,9)+7;
int main()
{
    string s;
    cin >> s;
    
    if(s.at(s.size()-1)=='s'){
        s += "es";
    }
    else{
        s += 's';
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3628
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Mon Dec 31 17:08:48 2018
//
package main

import "fmt"

func main() {
	var X, A, B int
	_, _ = fmt.Scan(&X, &A, &B)

	fmt.Println((X - A) % B)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
using Graph = vector<vector<int>>;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k ;
  cin >> n >> k ;
  vint num(200000+1) ;
  vint num2 ;
  int ans = 0 ;
  set<int> S ;
  REP(i,n){
    int a ;
    cin >> a ;
    num[a]++ ;
    S.insert(a) ;
  }
  REP(i,200000+1){
    int b = num[i] ;
    if(b!=0){
      num2.PB(b) ;
    }
  }
  
  sort(ALL(num2)) ;
  
  REP(i,SZ(S)-k){
    ans += num2[i] ;
  }
  cout << ans <<endl ;
  
  
    
  
  
  
  
  return 0 ;
}

Measured memory_bytes: 11640
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

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

    int n;
    cin>>n;

    set<int> s;
    for(int i=1;i<=n;i++){
        int d;
        cin>>d;
        s.insert(d);
    }

    cout<<s.size()<<"\n";

    return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

void solve()
{
    int A, B, C, X; cin >> A >> B >> C >> X;
    int ans = 0;
    for(int a = 0; a <= A; a++)
    {
        for(int b = 0; b <= B; b++)
        {
            for(int c = 0; c <= C; c++)
            {
                if(500*a + 100*b + 50*c == X) ans++;
            }
        }
    }
    cout << ans << endl;
}

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

    solve();

    return 0;
}

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

using namespace std;

#define ll  long long
#define vi  vector<int>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b == 0) return b;
  else gcd(b, a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

int main(){

  string s;
  cin >>s;
  int ans = 700;
  rep(i,s.length()){
    if(s[i] == 'o')ans+=100;
  }

  pr(ans);

  return 0;
}


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

const int M=1e5+5;
int h[M],dp[M];

int main()
{
	int n,k; scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	for(int i=2;i<=n;i++)
	{
		dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
		for(int j=2;j<=k&&i-j>=1;j++)
			dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
	}
	printf("%d\n",dp[n]);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    string s;
    cin>>s;
    for(int i=0; i<s.size(); i+=2){
        if(s.substr(i,2)=="hi"){

        }else{
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes";
}

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

int main(){

    string S;
    cin >>S;
    int num=stoi(S);
    int lower=num%100;
    int upper=num/100;
    string ans;
    if((upper>12||upper==0)&&(lower>0&&lower<13))ans="YYMM";
    else if((lower>12||lower==0)&&(upper>0&&upper<13))ans="MMYY";
    else if((upper>0&&upper<13)&&(lower>0&&lower<13)) ans="AMBIGUOUS";
    else ans="NA";
    cout<<ans<<endl;

}


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

// clang-format off
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); --(i))

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using int32 = int;
using int64 = long long;

const int   mod   = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
  int N = input();
  vector<int> b(N), ans;

  cin >> b;

  range(i, 0, N) {
    rrange(j, 0, b.size()) {
      if (b[j] == j + 1) {
        ans.push_back(b[j]);
        range(k, j, (int)b.size() - 1) b[k] = b[k + 1];
        b.pop_back();
        break;
      }
    }

    // cerr << b << endl;
  }

  if (ans.size() == N) {
    whole(reverse, ans);
    range(i, 0, N) cout << ans[i] << endl;
  }
  else {
    cout << -1 << endl;
  }
}

signed main(int argc, char *argv[]) {
  solver();
}

Measured memory_bytes: 256