akhauriyash/Code-Regression huggingface dataset:
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	int[] C;
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int A[] = new int[n];
		for(int i = 0; i < n; i++) {
			A[i] = sc.nextInt();
			if(max < A[i]) max = A[i];
		}
		int[] B = new int[n+1]; 
		CountingSort(A,B,max);
		StringBuilder ans = new StringBuilder();
		for(int i = 1; i < n; i++) {
			ans.append(B[i]);
			ans.append(" ");
		}
		ans.append(B[n]);
		System.out.println(ans.toString());
		sc.close();
	}
	
	void CountingSort(int[] A,int[] B,int k) {
		C = new int[k + 1];
		Arrays.fill(C, 0);
		for (int i = 0; i < A.length; i++) {
			C[A[i]]++;
		}
		for(int j = 1; j <= k; j++) {
			C[j] = C[j] + C[j-1];
		}
		for(int i = A.length-1; i >= 0; i--) {
			B[C[A[i]]] =A[i];
			C[A[i]]--;
		}
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}


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

using namespace std;

using ll = long long;

int cnt_ab(const string& s) {
    int n = s.size();
    int res = 0;
    for (int i = 1; i < n; i++) {
        if (s[i - 1] == 'A' && s[i] == 'B') res++;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    ll ans = 0;
    int cnt_ba = 0, cnt_xa = 0, cnt_bx = 0;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        if (s[0] == 'B' && s.back() == 'A') cnt_ba++;
        else if (s[0] == 'B') cnt_bx++;
        else if (s.back() == 'A') cnt_xa++;
        ans += cnt_ab(s);
    }

    if (cnt_ba > 0) {
        ans += cnt_ba - 1;
        if (cnt_xa > 0) {
            ans++;
            cnt_xa--;
        }

        if (cnt_bx > 0) {
            ans++;
            cnt_bx--;
        }
    }

    ans += min(cnt_bx, cnt_xa);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/* COMPETITIVE PROGRAMMING C++ TEMPLATE */

#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>
#include <iostream>
#include <stack>
#include <queue>
#include <climits>
#include <iomanip>

#define all(x) x.begin(), x.end()
#define MOD 1000000007
#define debug(x) cout << #x << " = " << x << "\n"

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;


void solve()
{
    //code here.
    string s;
    cin >> s;
    
    ll count = 0;
    ll n = s.size();
    for (ll i=0; i<n; i++)
    {
        
        count += s[i]-'0';
        
    }
    if (count % 9 == 0)
    {
        cout << "Yes";
        return;
    }
    cout << "No";
    
    

    


    

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

    ll T = 1;
    //cin >> T; // If only one test case then you can comment this line out.

    while (T--)
    {
        solve();

    }
    return 0;
}

Measured memory_bytes: 3736
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a,b,x;cin>>a>>b>>x;
  double ho = 2.0*x/(a*a);
  double ans;
  if(ho > b){
    ans = atan(2.0*(b-x/(a*a))/a);
  }else if(ho == b){
    ans = atan(b/a);
  }else{
    ans = atan(a*b*b/(2*x));
  }
  printf("%.10f\n",ans*180.0/acos(-1));
  return 0;
}


Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);


            var s = Console.ReadLine().ToArray();
            var t = Console.ReadLine().ToArray();
            s = s.OrderBy(r => r).ToArray();
            t = t.OrderByDescending(r => r).ToArray();
           
            var ss =new string(s);
            var tt =new string(t);

            if (string.Compare(ss, tt, StringComparison.Ordinal) < 0)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");

        
   

           



            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 13268
# coding: utf-8
# Your code here!

def pin(type=int):
    return map(type,input().split())
#1行ごとに読み込んでいる
#変数一個だけのときはカンマを入れるだけ、input()相当。ちょろい。
#sum関数などintを相手にした関数を書く時に便利なのでデフォルトをint型にする

N,M = pin() 
p=[0 for j in range(0,M)]
S=[0 for j in range(0,M)]
for j in range(0,M):
    p[j],S[j] =pin(str) #p_i,S_iにそれぞれ対応
    #print("sah")
# O(3M)...?
#print(p)
#print(p,S)
#ACした問題番号と各々の問題（後々AC下かを考えない）ペナ数を問題番号別にまとめた配列
AC=[0 for i in range(0,N)]
Penalties = [0 for i in range(0,N)]

#問題番号iと回答番号jについて,
"""
for i in range(0,N):
    for j in range(0,M):
    
        #jがiの回答である時に,WAだったらPenaltiesに1個加算
        if int(p[j])-1==i:
            if (S[j]) == 'WA':
                Penalties[int(p[j])-1] += 1
            else:#それが初めてのACならば、AC数に1を足してcontinueで次の問題i+1へ移る
                AC[int(p[j])-1] = 1
                break
            #print(AC,Penalties)
"""
#double-loop だと　TLEしてしまう O(n^2)はだめみたい

#singleloopしかないねぇ
#回答番号jに着目する
for j in range (0,M):
    if S[j] == "AC":
        if AC[int(p[j])-1]==1:
            continue
        else:
            AC[int(p[j])-1]=1
    else:#wa or something
        if AC[int(p[j])-1]==1:
            continue
        else:
            Penalties[int(p[j])-1]+=1
  # print(AC,Penalties)

for i in range(0,N):
    if AC[i] == 0:
        Penalties[i]=0
#print("///////")    
#print(AC,Penalties)    



#ACリスト内の1の数を数えるのは iter.countだね
print(AC.count(1),sum(Penalties))

Measured memory_bytes: 17296
#include<iostream>
using namespace std;
string s;
int a=110,b;
int main() {
	cin>>s;
	for(int i=0; i<s.size(); i++) {
		if(s[i]=='C')a=min(a,i);
		if(s[i]=='F')b=max(b,i);
	}
	if(a<b)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

int main() {
	int n;
	std::cin >> n;
	int l;
	std::vector<int> c, v;
	for (int i = 0; i < n; i++)
	{
		std::cin >> l;
		v.push_back(l);
	}
	for (int i = 0; i < n; i++)
	{
		std::cin >> l;
		c.push_back(l);
	}
	std::vector<int> result;
	for (int i = 0; i < n; i++)
	{
		result.push_back(v[i] - c[i]);
	}
	std::sort(result.begin(), result.end());
	int max = 0;
	for (unsigned int i = 0; i < result.size(); i++)
	{
		if (result[i] <= 0)
		{
			continue;
		}
		max += result[i];
	}

	std::cout << max << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())

int main()
{
    string s; cin >> s;
    int a=0,z=0,flg=1;
    rep(i,s.size()){
        if(s[i] == 'A' && flg) {a = i; flg=0;}
        if(s[i] == 'Z') z = i;
    }
    cout << z-a+1 << endl;
}

/*
Ctrl+@
g++ a.cpp
./a.out
*/

Measured memory_bytes: 640
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) (a > b ? a - b : b - a)

int main(void) {
	uint32_t A[3];

	scanf("%"PRIu32" %"PRIu32" %"PRIu32, &A[0], &A[1], &A[2]);

	uint32_t min = ABSS(A[0], A[1]) + ABSS(A[1], A[2]);
	uint32_t cost = ABSS(A[0], A[2]) + ABSS(A[2], A[1]);
	if (cost < min) {
		min = cost;
	}
	cost = ABSS(A[1], A[0]) + ABSS(A[0], A[2]);
	if (cost < min) {
		min = cost;
	}
	cost = ABSS(A[1], A[2]) + ABSS(A[2], A[0]);
	if (cost < min) {
		min = cost;
	}
	cost = ABSS(A[2], A[0]) + ABSS(A[0], A[1]);
	if (cost < min) {
		min = cost;
	}
	cost = ABSS(A[2], A[1]) + ABSS(A[1], A[0]);
	if (cost < min) {
		min = cost;
	}

	printf("%"PRIu32"\n", min);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
#include<cstring>
using namespace std;
long long int mod = 1e9 + 7;
template <class T>
void inputV(vector<T> &x, int n){
  for(int i=0; i<n; i++) cin >> x[i];
}

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

  int ans = 0;
  while(n >= 3) {
    ans++;
    n-=3;
  }
  cout << ans << endl;

  return 0;
}

//


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define piii pair<int,pii>
#define pll pair<ll,ll>
#define plii pair<ll,pii>
#define vi vector<int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mx 100001
#define eps 0.00000000001
#define mod 1000000007
#define pi acos(-1)
#define inf 100000000
#define loop(i,b,n) for(int i=b;i<n;++i)
#define rev_loop(i,b,n) for(int i=b;i>=n;--i)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    fio;
    string s1,s2;
    cin>>s1>>s2;
    int k = s1.size();
    int ans = 0 ;
    loop(i,0,k)
    {
        if(s1[i]!=s2[i])
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 3788
h,w=map(int,input().split())
s=[list(input().replace(".","0")) for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      for k in range(-1,2):
        for l in range(-1,2):
          if 0<=i+k<h and 0<=j+l<w and s[i+k][j+l]!="#":
              s[i+k][j+l]=str(int(s[i+k][j+l])+1)
for i in range(h):
  for j in range(w):
    print(s[i][j], end="")
  print()

Measured memory_bytes: 3444
#include <iostream>
#include <cstdio>
#define N 1005
#define R 1000000007
using namespace std;

typedef long long ll;
ll n, s, cnt[N];
int main()
{
	ll i, j, k;
	cin >> n;
	for (i = 2; i <= n; i++) {
		k = i;
		for(j=2; k>1; ) {
			if(k%j==0) cnt[j]++, k /= j;
			else j++;
		}
	}
	s = 1;
	for (i = 1; i <= n; i++) {
		cnt[i]++;
		s = (s * cnt[i]) % R;
	}
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
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 ) * } } ; }
#[allow(unused_macros)]
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 ) * } } ; }
#[allow(unused_macros)]
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" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input! {s:chars}
    println!("{}", s.iter().filter(|&x| *x=='1').count());
}


Measured memory_bytes: 4352
#include<iostream>
#include<cmath>

using namespace std;

int main(){
	int N,D,X;
	int chocolate=0;
	cin >> N;
	cin >> D >> X;
	for(int i=0;i<N;i++){
		int A;
		cin >> A;
		chocolate+=floor((D-1.0)/A)+1;
	}
	chocolate+=X;

	cout << chocolate << endl;
	return 0;
}


Measured memory_bytes: 256
i = input().split()
n = int(i[0])
m = int(i[1])

i2 = input().split()
a = [int(i2) for i2 in i2]
m2 = sum(a) / (4 * m)
c = sum([1 if i3 >= m2 else 0 for i3 in a])
print("Yes" if c >= m else "No", end='')

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

int main()
{
    std::string s;
    std::cin >> s;
    int count = 0;
    int Maxdays = 0;
    for(char c : s){
        if(c == 'R'){
            count++;
        }else{
            if(Maxdays < count) Maxdays = count;
            count = 0;
        }
    }
    if(Maxdays < count) Maxdays = count;
    std::cout << Maxdays << '\n';
    return 0;
}

Measured memory_bytes: 3620
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	K, N := getInt(), getInt()
	a := make([]int, N+1)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	a[N] = K
	sort.Ints(a)
	a[N] = K + a[0]
	//out(a)

	m := 0
	for i := 0; i < N; i++ {
		m = max(m, a[i+1]-a[i])
	}
	//out(m)
	out(K - m)
}


Measured memory_bytes: 3840
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define int long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#define forn(i,n) rep(i,1,n)
#define rep0(i,n) rep(i,0,n-1)
using namespace std;
typedef pair<int,int>pii;
int n,m,v,p;
vector<int>a;
int ans,sum;
signed main(){
	cin>>n>>m>>v>>p;
	for(int i=0,x;i<n;i++)cin>>x,a.pb(x);
	sort(a.rbegin(),a.rend());
	ans=n;
	for(int i=0;i<n-p;i++){
		sum+=(a[i+p-1]-a[i+p])*(i+1);
		if(max(a[p-1]-a[i+p],(sum+n-v-1)/(n-v))>m){
			ans=i+p;
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define N 100010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define pp pop_back
#define mapiter map<int, int>::iterator
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, n)	for(int i = n - 1; i >= 0; --i)
#define forr1(i, n)	for(int i = n; i >= 1; --i)
#define r0 return 0
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lld long double
#define elif else if
 
const ll inf = 1e12 + 7;
const lld EPS = 0.00000001;
const ll modw = 1e9 + 7;

using namespace std;

int dp[N];
bool used[N];
vector<int> top;
vector<int> v[N], vx[N];
vector<int> cur;

void dfs(int x)
{
	used[x] = 1;
	for(auto i:v[x])	if(!used[i])	dfs(i);
	cur.pb(x);
}

int main()
{
	barnarnar
	int n, m;
	cin >> n >> m;
	forn(i, m)
	{
		int t1, t2;
		cin >> t1 >> t2;
		v[t1].pb(t2);
		vx[t2].pb(t1);
	}
	forn1(k, n)
	{
		if(!used[k])
		{
			cur.clear();
			dfs(k);
			//reverse(all(cur));
			for(auto lol:cur)	top.pb(lol);
		}
	}
	for(auto i:top)
	{
		for(auto j:v[i])
		{
			dp[i] = max(dp[i], dp[j] + 1);
		}
	}
	int ans = 0;
	forn1(i, n)	ans = max(ans, dp[i]);
	//cout << endl;
	cout << ans;
	return 0;
}



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

int main()
{
	int n,m,c,temp,count,ans=0;
	cin>>n>>m>>c;
	int B[m];
	for(int i=0; i<m; i++)
	{
		cin>>temp;
		B[i] = temp;
	}
	for(int i=0; i<n; i++)
	{
		count = 0;
		for(int j=0; j<m; j++)
		{
			cin>>temp;
			count = count + temp * B[j]; 
		}
		count = count + c;
		if(count>0)
		{
			ans = ans + 1;
		}
	}
	
	cout<<ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    string str[N];
    //int s,e;
    //int flag = 0;
    for( int i=0; i<N; i++){
        cin >> str[i];
    }
    for( int i=1; i<N; i++){
        if(str[i-1].at(str[i-1].size()-1) != str[i].at(0)){
            cout << "No" << endl;
            return 0;
        }
        for(int j=0; j<i; j++){
            if(str[i] == str[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;

}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush=
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var N = cin.ReadInt;
			var K = cin.ReadInt;
			var any = new bool[N];
			for(int i = 0; i<K; i++) {
				var d = cin.ReadInt;
				var Ai = cin.ReadIntArray(d);
				foreach(var j in Ai) {
					any[j-1]=true;
				}
			}
			Console.WriteLine(any.Count(b=>!b));
		}
	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator=separator;
			this._stream=stream;
			inputStream=new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count!=0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i<tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i<N; ++i)
				ret[i]=Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i<N; ++i) ret[i]=ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i<N; ++i) ret[i]=ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i<N; ++i) ret[i]=ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek()==-1; }
		}
	}
}

Measured memory_bytes: 28328
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    int h,high=0,cnt=0;
    rep(i,n){
        cin>>h;
        if(h>=high) cnt++;
        high=max(high,h);
    }
    cout<<cnt;
}

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

int main (){
	
	string s;
	
	cin>>s;
	
	int x = s.length();
	
	int b=0;
	for(int i=0; i<x; i++){
		if(s[i] != s[x-i-1]){
			b++;
		}
		
	}
	
	int a = b/2;
	
	cout<<a<<endl;
}

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

using namespace std;

int main(){
    long long a,tot = 1;
    cin >> a;
    while(a >= 1){
        tot *= a;
        a -= 1;
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265359
using namespace std;

int main()
{
  // input
  int n, m, a, atotal = 0;
  int rest;
  cin >> n >> m;
  rep(i, m) {
    cin >> a;
    atotal += a;
  }

  // calc
  rest = n - atotal;

  // output
  cout << ((rest < 0) ? -1 : rest) << endl;

  return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	int n;
	ll ans = 0;
	cin >> n;
  	int a[1000000],b[1000000],c[1000000];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> c[i];
	}
	sort(a, a + n);
	sort(c, c + n);
	for(int i=0;i<n;i++){
    ans+=(c+n-upper_bound(c,c+n,b[i]))*(lower_bound(a,a+n,b[i])-a);
    }
	cout << ans << endl;
}



Measured memory_bytes: 8832
#include <cstdio>
#include <cstring>
const int N=100005;
char a[N];
int main (){
  scanf ("%s",a+1);
  int n=strlen(a+1);
  if (n==2) {
    if (a[1]==a[2]) puts("1 2");
    else puts("-1 -1");
    return 0;
  }
  for (int i=1;i<=n-2;i++)
    if ((a[i]==a[i+1])||(a[i]==a[i+2])||(a[i+1]==a[i+2])){
      printf ("%d %d",i,i+2);return 0;
  	}
  puts("-1 -1");
  return 0;
}

Measured memory_bytes: 384
import collections as coll
n,m=map(int,input().split())
road=coll.defaultdict(list)
for _ in range(m):
    a,b=map(int,input().split())
    road[a].append(b)
    road[b].append(a)
for i in range(1,n+1): print(len(road[i]))

Measured memory_bytes: 3316
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;
int n,m,q;
vector<int> g[501];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>m>>q;
    
    int x,y;
    for (int i = 0; i < m; i++){
        cin>>x>>y;
        g[x].push_back(y);
    }
    
    for (int i = 1; i <= n; i++){
        sort(g[i].begin(), g[i].end());
    }
    
    int p1,p2, ans = 0;
    for (int i = 0; i < q; i++){
        ans = 0;
        cin>>p1>>p2;
        for (int j = p1; j <= p2; j++){
            ans += upper_bound(g[j].begin(), g[j].end(), p2) - g[j].begin();
        }
        cout<<ans<<endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 2176
/*
* じょえチャンネル
* 高評価・チャンネル登録よろしくおねがいします！
* https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
*/

#include <bits/stdc++.h>


#define f(i,n) for(int i=0;i<(n);i++)


#define inf (int)(3e18)
#define int long long
#define mod (int)(1000000007)

#define intt long long
#define P pair<int,int>

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)

using namespace std;

//Library
//モッドパウ
int modpow(int x, int y, int m = mod) {
    int res = 1;
    while (y) {
        if (y % 2) {
            res *= x;
            res %= m;
        }
        x = x * x % mod;
        y /= 2;
    }
    return res;
}

int mypow(int x, int y) {
    int res = 1;
    while (y) {
        if (y % 2) {
            res *= x;
        }
        x = x * x;
        y /= 2;
    }
    return res;
}
//is the number (x) a prime number?
bool prime(int x) {
    for (int i = 2; i * i <= x; i++) {
        if (!(x % i)) {
            return false;
        }
    }
    return true;
}


//saidai-kouyakusuu
inline int gcd(int x, int y) {
    if (!y) {
        return x;
    }
    return gcd(y, x % y);
}


//number of keta
int keta(int x) {
    int ans = 0;
    while (x) {
        x /= 10;
        ans++;
    }
    return ans;
}

//sum of keta
int ketasum(int x) {
    int ans = 0;
    while (x) {
        ans += x % 10;
        x /= 10;
    }
    return ans;
}

inline int lcm(int x, int y) {
    int ans = x / gcd(x, y) * y;
    return ans;
}
int twobeki(int x) {
    int ans = 0;
    while (1) {
        if (!(x & 1)) {
            ans++;
            x /= 2;
        }
        else {
            break;
        }
    }
    return ans;
}


template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
    if (lhs < rhs) {
        lhs = rhs;
        return 1;
    }
    return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
    if (lhs > rhs) {
        lhs = rhs;
        return 1;
    }
    return 0;
}
void Yes(){
    cout<<"Yes"<<endl;
}
void No(){
    cout<<"No"<<endl;
}
void YES(){
    cout<<"YES"<<endl;
}
void NO(){
    cout<<"NO"<<endl;
}


#define fin(i) scanf("%lld",&i)
#define fout(i) printf("%lld",i)
#define fendl printf("\n")
//Library-End

int a,b;
char ans[104][104];
signed main() {
    cin>>a>>b;
    rep(i,50){
        rep(j,100){
            ans[i][j]='.';
        }
    }
    for(int i=50;i<100;i++){
        rep(j,100){
            ans[i][j]='#';
        }
    }
    a--;
    b--;
    for(int i=0;i<50;i+=2){
        rep(j,100){
            if (!b) {
                break;
            }
            if ((i+j)&1) {
                ans[i][j]='#';
                b--;
            }
        }
    }
    for(int i=99;i>=50;i-=2){
        rep(j,100){
            if (!a) {
                break;
            }
            if ((i+j)&1) {
                ans[i][j]='.';
                a--;
            }
        }
    }
    cout<<100<<' '<<100<<endl;
    rep(i,100){
        rep(j,100){
            printf("%c",ans[i][j]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
#endif

	ll a,u,b,v,t;
	cin>>a>>u>>b>>v>>t;
	if(u<=v )
	{
		cout<<"NO"<<endl;
	}
	else
	{
		if(a<b){
		if(u*t+a>=v*t+b)
		{
			cout<<"YES"<<endl;
		}
		else
		{
			cout<<"NO"<<endl;
		}
	   }

	    else
	    {
	    	if(-(v*t)+b>=-(u*t)+a)
	    	{
           cout<<"YES"<<endl;
		    }
		else
		{
			cout<<"NO"<<endl;
		}
	   }
	}
	return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
    int main()
    {
        int a,b,c;
        char s[101];
        // 整数の入力
        scanf("%d", &a);
        scanf("%d", &b);
        // 出力
      if(b==1){
      c=0;
      }else{
      c=a-b;
      }
        printf("%d",c);
        return 0;
    }

Measured memory_bytes: 128
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;


int sumdigit(int x){
   int sum = 0;
    while(x != 0){
        sum += x % 10;
        x /= 10;
    }
    return sum;
}
int main(){
    int N;
    cin >> N;
    vector<int> l(N),r(N);
    for(int i = 0; i < N; i++){
        cin >> l[i] >> r[i];
    }
int num = 0;
    for(int i = 0; i < N; i++){
        num += r[i] - l[i] + 1;
    }

    cout << num << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
using namespace std;

#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
typedef pair<int, int> P;
typedef long long ll;

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}

int n, m, a[2525], b[2525], ans = 0;
bool g[55][55];
bool used[55];

void dfs(int s) {
	used[s] = true;
	rep(i, n) {
		if (g[i][s] == false)continue;
		if (used[i] == true)continue;
		dfs(i);
	}
}

int main() {
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i] >> b[i];
		a[i]--, b[i]--;
		g[a[i]][b[i]] = true;
		g[b[i]][a[i]] = true;
	}
	rep(i, m) {
		g[a[i]][b[i]] = false;
		g[b[i]][a[i]] = false;
		rep(j, n)used[j] = false;
		dfs(0);
		rep(j, n) {
			if (used[j] == false) {
				ans++;
				break;
			}
		}
		g[a[i]][b[i]] = true;
		g[b[i]][a[i]] = true;
	}
	cout << ans << endl;
	return 0;
}

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

public class Main {
    FastScanner in;
    PrintWriter out;

    void solve() {
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = in.nextInt();
        }
        long[] dp = new long[n + 1];
        long[] ndp = new long[n + 1];
        for (int v : nums) {
            Arrays.fill(ndp, Long.MAX_VALUE / 2);
            for (int curMax = 0; curMax <= n; curMax++) {
                long cost = dp[curMax];
                if (v < curMax) {
                    ndp[curMax] = Math.min(ndp[curMax], cost + b);
                } else {
                    ndp[curMax] = Math.min(ndp[curMax], cost + a);
                    ndp[v] = Math.min(ndp[v], cost);
                }
            }
            long[] tmp = dp;
            dp = ndp;
            ndp = tmp;
        }
        long res = Long.MAX_VALUE;
        for (long z : dp) {
            res = Math.min(res, z);
        }
        out.println(res);
    }

    void run() {
        try {
            in = new FastScanner(new File("Main.in"));
            out = new PrintWriter(new File("Main.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

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

    public static void main(String[] args) {
        new Main().runIO();
    }
}

Measured memory_bytes: 23380
#include<stdio.h>

int A[1000000], n;

int binarySearch(int key){
    int left =0;
    int right=n;
    int mid;
    
    while(left<right){
        mid=(left+right)/2;
        if(key == A[mid]) return 1;
        if(key>A[mid]) left =mid+1;
        else if(key< A[mid]) right=mid;
    }
    return 0;
}

int main(){
    int i,q,k,sum=0;
    
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%d", &A[i]);
    }
    
    scanf("%d", &q);
    for(i=0; i<q; i++){
        scanf("%d",&k);
        if( binarySearch(k))  sum++; 
    }
    printf("%d\n", sum);
    
    return 0;
}


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

using namespace std;

#define ll long long
const ll mod = 1e9 + 7;

int main () {
    int k, a, b;
    cin >> k >> a >> b;
    if (a % k == 0 || b % k == 0) {
        puts ("OK");
        return 0;
    }
    if (a / k == b / k) 
        puts ("NG");
    else puts ("OK");
    return 0;   
}


Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <map>
#include <queue>
#include <set>
#include <stack>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
using namespace std;
const int MAXN=2e5+50;
const int inf=0x3f3f3f3f;
const int M=5000*4;
char ch[MAXN];
int cnt[MAXN];
int main()
{
	int n,p;
	cin>>n>>p;
	cin>>(ch+1);
	ll ans=0;
	if(p==2||p==5){
		for(int i=1;i<=n;i++){
			if((ch[i]-'0')%p==0)ans+=i;
		}
		cout<<ans<<endl;
		return 0;
	}
	int t=1,x=0;
	cnt[0]=1;
	for(int i=n;i>=1;i--){
		x=(x+(ch[i]-'0')*t)%p;
		
		ans+=cnt[x];
		cnt[x]++;

		t=t*10%p;
	}
	cout<<ans<<endl;
    return 0;
}
/*

*/



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

char N[100][10], b[10];
int M[100];
int main() {
	int n, m;
	while (scanf("%d%d", &n, &m), n) {
		rep(i, n)scanf("%s%d", N[i], &M[i]);
		int sum = 0;
		rep(i, m) {
			scanf("%s", b);
			rep(j, n) {
				bool ok = true;
				rep(k, 8) {
					if (N[j][k] != '*'&&N[j][k] != b[k])ok = false;
				}
				if (ok) {
					sum += M[j];
					break;
				}
			}
		}
		printf("%d\n", sum);
	}
}

Measured memory_bytes: 3160
#include <stdio.h>

int main(void){
	int price,num,i;
	int coin_set[6] = {500,100,50,10,5,1};
	while(1){
		scanf("%d",&price);
		if(price == 0){break;}
		num = 0;
		price = 1000 - price;
		for(i = 0; i < 6; i++){
			while(1){
				if(price >= coin_set[i]){
					num++;	
					price -= coin_set[i];
				}else{
					break;
				}
			} 
		}
		printf("%d\n",num);

	}

	return 0;
}

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

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

    int n;
    cin >> n;

    map<long long, long long> mp1, mp2;
    long long ans = 0;
    for(int i = 0; i < n; i++){
        long long a;
        cin >> a;
        ans += mp1[i + a];
        ans += mp2[i - a];
        mp1[i - a]++;
        mp2[i + a]++;
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 49084
//Code by: Nikhil Shukla, MMMUT GKP
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define V vector
#define pb push_back
#define all x x.begin(),x.end()
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc ll t; cin>>t; while(t--)
#define tc1 ll tt=1; while(tt--)
#define fir first
#define sec second
#define mod 998244353
#define out1(x) cout<<x<<"\n";
#define out2(x,y) cout<<x<<" "<<y<<"\n";
#define debug() cout<<"I am in\n";
#define Vll vector<long long>
#define FOR(i,x,n) for(ll i=x;i<n;i++)
#define RFOR(i,x,n) for(ll i=x;i>=n;i--)
////////////////////////////////////////////////////////////////////////////////////////
/*vector<ll>graph[100001];
vector<ll>temp;
vector<bool>visited(100001,false);
//long long count=0;
void dfs(long long node)
{
       // count++;
        temp.pb(node);
        visited[node]=1;
        for(ll i=0;i<graph[node].size();i++)
        {
            if(!visited[graph[node][i]])
            dfs(graph[node][i]);
        }
}*/
int main()
{
    fast()
    tc1
    {
        ll n,k,i,f;
        cin>>n;
        ll h[n];
        h[0]=0;
        FOR(i,0,n)
        cin>>h[i];
        ll dp[n];
        dp[0]=0;
        dp[1]=abs(h[1]-h[0]);
        FOR(i,2,n)
        {
            dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
        }
        cout<<dp[n-1]<<"\n";
    }
    return 0;
}


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

int n, a[(1 << 18) + 5], ans[(1 << 18) + 5];

int main() {
	scanf("%d", &n);
	n = 1 << n;

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

	for(int mask = 1; mask < n; mask++) {
		int x = a[0], y = 0;
		for(int msk = mask; msk > 0; msk = (msk - 1) & mask) {
			if(a[msk] > x) {
				y = x;
				x = a[msk];
			}

			else if(a[msk] > y)
				y = a[msk];
		}

		ans[mask] = x + y;
	}

	for(int i = 1; i < n; i++) {
		ans[i] = max(ans[i - 1], ans[i]);
		printf("%d\n", ans[i]);
	}

	return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <algorithm>

using namespace std;

int N, W, w[1010], v[1010];

int main(){
	int	dp[110][10010];

	cin >> N >> W;
	for(int i = 0;i < N;i++){
		cin >> v[i] >> w[i];
	}

	for(int i = 0;i < N;i++){
		for(int j = 0;j <= W;j++){
			if(j < w[i]){
				dp[i + 1][j] = dp[i][j];
			} else {
				dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
			}
		}
	}

	cout << dp[N][W] << endl;

	return 0;
}

Measured memory_bytes: 5304
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

int n;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		int p;
		cin >> p;
		if(p != i + 1) cnt++;
	}
	if(cnt == 2 || cnt == 0) cout << "YES\n";
	else cout << "NO\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int x;
    cin >> x;
    if (x == 0) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,s;
  cin>>k>>s;
  int ans=0;
  for(int i=0;i<=k;i++)
    for(int j=0;j<=k;j++)
      if(i+j<=s&&s-i-j<=k)ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>


int main()
{
	int N, A, B;
	scanf("%d%d%d", &N, &A, &B);
	int sum=0, ans=0;
	int i;
	int tmp;
	for (i = 1; i <= N; i++) {
		sum = 0;
		tmp = i;
		for (; tmp != 0; ) {
			sum += tmp%10;
			tmp /= 10;
		}
		if (sum >= A && sum <= B) {
			ans += i;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
//
// Created on 2020/08/10.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {

    int n;
    cin>>n;
    vector<int>L;
    int init;
    cin>>init;
    L.push_back({init});
    for (int i = 1; i < n; ++i) {
        int a;
        cin>>a;
        int ok = L.size() - 1;
        int ng = -1;
        int mid = (ok + ng) / 2;
        while(1 < abs(ok - ng)){
            if(L[mid] < a){
                ok = mid;
            }else{
                ng = mid;
            }
            mid = (ok + ng) / 2;
        }
        if(L[ok] < a){
            L[ok] = a;
        }else if(L[ok] >= a){
            L.push_back(a);
        }}
    cout<<L.size()<<endl;
    return 0;
}


Measured memory_bytes: 3884
#!/usr/bin/env python3
s = input()
a = list(map(str, range(1, 10)))
b = list(map(str, range(0, 3)))
mm = 0
ba = 0
for i in [0, 2]:
    if s[i] == "0" and s[i+1] in a:
        mm += 1
        ba = i
    elif s[i] == "1" and s[i+1] in b:
        mm += 1
        ba = i
if mm == 0:
    print("NA")
elif mm == 1 and ba == 0:
    print("MMYY")
elif mm == 1 and ba == 2:
    print("YYMM")
elif mm == 2:
    print("AMBIGUOUS")


Measured memory_bytes: 3064
/*
 * 2418.cc: Problem B War II
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;
const int JP = 9;

/* typedef */

/* global variables */

int ts[MAX_N], hs[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, t, h, l;
  cin >> n >> t >> h >> l;

  for (int i = 0; i < n; i++) cin >> ts[i] >> hs[i];

  int p = 0, sum = 0;
  for (;;) {
    if (ts[p] == 0 && hs[p] == 0) break;

    if (ts[p] > 0) ts[p]--, t++, sum++;
    else hs[p]--, h++, sum += 10;

    if (t > l) break;

    if (sum >= JP) {
      sum -= JP;
      if (sum > t + h * 10 || sum % 10 > t) break;
      int st = sum % 10;
      t -= st;
      ts[p] += st;
      sum -= st;

      while (sum > 0) {
	if (t >= 10) t -= 10, ts[p] += 10;
	else if (h > 0) h--, hs[p]++;
	else break;
	sum -= 10;
      }
    }

    p = (p + 1) % n;
  }

  printf("%d\n", p + 1);
  return 0;
}

Measured memory_bytes: 1144
#include <iostream>

using namespace std;

#define MAX 10000
#define NIL (-1)

struct Node
{
	int parent;
	int left;
	int right;
}T[MAX];

int n, D[MAX], H[MAX];

void setdepth(int u, int p)
{
	if(u == NIL)
	{
		return ;
	}
	D[u] = p;
	setdepth(T[u].left,p + 1);
	setdepth(T[u].right,p + 1);
}

int sethigh(int u)
{
	int h1 = 0, h2 = 0;
	if(T[u].left != NIL)
	{
		h1 = sethigh(T[u].left) + 1;
	}
	if(T[u].right != NIL)
	{
		h2 = sethigh(T[u].right) + 1;
	}
	return H[u] = h1 > h2 ? h1 : h2;
}

int getsibiling(int u)
{
	if(T[u].parent != NIL)
	{
		int t = T[u].parent;
		if(T[t].right != NIL && T[t].left != NIL)
		{
			if(T[t].left == u)
			{
				return T[t].right;
			}
			else
			{
				return T[t].left;
			}
		}
		else
		{
			return NIL;
		}
	}
	else
	{
		return NIL;
	}
}

int countingleaf(int u)
{
	if(T[u].left != NIL && T[u].right != NIL)
	{
		return 2;
	}
	else if(T[u].left == NIL && T[u].right == NIL)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

void print(int u)
{
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].parent << ", ";
	cout << "sibling = " << getsibiling(u) << ", ";
	cout << "degree = " << countingleaf(u) << ", ";
	cout << "depth = " << D[u] << ", ";
	cout << "height = " << H[u] << ", ";
	
	if(T[u].parent == NIL)
	{
		cout << "root" << endl;
	}
	else if(T[u].left == NIL && T[u].right == NIL)
	{
		cout << "leaf" << endl;
	}
	else
	{
		cout << "internal node" << endl;
	}
}

int main()
{
	int r, n, i, u, left, right;
	cin >> n;
	for(i = 0; i < n; i++)
	{
		T[i].left = T[i].parent = T[i].right = NIL;
	}
	for(i = 0; i < n; i++)
	{
		cin >> u >> left >> right;
		T[u].left = left;
		T[u].right = right;
		T[left].parent = T[right].parent = u;
	}
	
	for(i = 0; i < n; i++)
	{
		if(T[i].parent == NIL)
		{
			r = i;
			break;
		}
	}
	
	setdepth(r,0);
	sethigh(r);
	
	for(i = 0; i < n; i++)
	{
		print(i);
	}
	
	return 0;
}


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

int main() {
 int a , b;
  cin >> a >> b;
 int sum;
  for(int i=0; i<b;i++){
    int c;
    cin >> c;
    sum+=c;
  }
  if(a<=sum)
    cout << "Yes";
  else 
    cout << "No";
}


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

#define y1 as214
#define ii pair < int , int >
#define iii pair < int , ii >
#define iv pair < ii , ii >

#define fi first
#define se second
#define fr front()
#define pb push_back
#define t top()

#define FOR(i , x , n) for(int i = x ; i <= n ; ++i)
#define REP(i , n) for(int i = 0 ; i < n ; ++i)
#define FORD(i , x , n) for(int i = x ; i >= n ; --i)

#define ll long long
#define oo 2e9
#define int long long

const int N = 1e2 + 5;
int n , k , res , mod = 1e9 + 7;

struct Matrix
{
    int x[N][N];
    Matrix(){};
    Matrix operator * (Matrix const &b)
    {
        Matrix c;
        FOR(i , 1 , n)
            FOR(j , 1 , n)
            {
                c.x[i][j] = 0;
                FOR(k , 1 , n)
                    c.x[i][j] = (c.x[i][j] + x[i][k] * b.x[k][j]) % mod;
            }
        return c;
    }
    friend Matrix operator ^ (Matrix const &a , int const &b)
    {
        if(b == 1)
            return a;
        Matrix c = a ^ (b / 2);
        if(b & 1)
            return c * c * a;
        else
            return c * c;
    }
};

main()
{
    //freopen("R.inp","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    Matrix a;
    cin >> n >> k;
    FOR(i , 1 , n)
        FOR(j , 1 , n)
            cin >> a.x[i][j];
    Matrix A = a ^ k;
    FOR(i , 1 , n)
        FOR(j , 1 , n)
            res = (res + A.x[i][j]) % mod;
    cout << res;
}


Measured memory_bytes: 1792