akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>

constexpr int MAX = 1010;

int levenshtein_distance(char* s, char* t,
                         int incost = 1, int rmcost = 1, int recost = 1)
{
    int N = strlen(s), M = strlen(t);
    int dp[N + 1][M + 1];

    for (int i = 0; i <= N; i++) {
        dp[i][0] = i * incost;
    }
    
    for (int i = 0; i <= M; i++) {
        dp[0][i] = i * rmcost;
    }
    
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            int rcost = (s[i - 1] == t[j - 1] ? 0 : recost);
            dp[i][j] = std::min(dp[i - 1][j] + incost,
                       std::min(dp[i][j - 1] + rmcost, dp[i - 1][j - 1] + rcost));
        }
    }
    return dp[N][M];
}

int main()
{
    char s[MAX], t[MAX];
    std::cin >> s >> t;
    std::cout << levenshtein_distance(s, t) << std::endl;
    return 0;
}

Measured memory_bytes: 7016
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <utility>
#include <vector>

using namespace std;

int main() {
    int res = 0;
    for (int i = 0; i < 4; i++) {
        char c;
        cin >> c;
        if (c == '+') {
            res++;
        } else {
            res--;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inp(X) cin >> X
#define out(X) cout << X << endl
#define out16(X) cout << setprecision(16) << X << endl
#define rep(i,n) for(int i=0;i<n;i++ )
#define rep2(i,f,n) for(int i=f;i<n;i++ )
#define MAX(A) *max_element(A.begin(),A.end())
#define MIN(A) *min_element(A.begin(),A.end())
#define SORT(A) sort(A.begin(),A.end())
#define REV(A) reverse(A.begin(),A.end())
typedef long long int ll;
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vd = std::vector<double>;
using vvd = std::vector<std::vector<double>>;
using vll = std::vector<ll>;
using vvll = std::vector<std::vector<ll>>;
using namespace std;
#define MOD 1000000007
#define INF 1000000001
#define LL_INF 1001001001001001001

int main(void) {
	int h,n; cin >> h >> n;
	vi a(n),b(n); rep(i,n) cin >> a[i] >> b[i];
	int a_mx = MAX(a);
	vi dp(h+1+a_mx,INF); dp[0]=0;
	for(int i=0; i<=h+a_mx; i++){
		rep(j,n){
			if(i-a[j]>=0)dp[i] = min(dp[i],dp[i-a[j]]+b[j]);
		}
	}
	int ans = INF;
	for(int i=h; i<=h+a_mx; i++) ans = min(ans,dp[i]);
	out(ans);
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;

const int mx = 200010;
int n;
int q;
vector<int> g[mx];
long long cnt[mx];
long long ans[mx];

void dfs(int v = 0, int p = -1, int now = 0){
    now += cnt[v];
    ans[v] += now;
    for(int i : g[v]){
        if(i != p)dfs(i, v, now);
    }
}

// AtCoder Beginner Contest 138
//オーバーフローに注意！！
//焦らずに！！
int main(){

    cin >> n >> q;
    rep(i, n - 1){
        int a, b; cin >> a >> b; a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    rep(i, q){
        int p; cin >> p; p--;
        long long x; cin >> x;
        cnt[p] += x;
    }

    dfs();
    rep(i, n){
        if(i)cout << ' ';
        cout << ans[i];
    }
    cout << endl;

}


Measured memory_bytes: 25600
#include<stdio.h>
#include<math.h>

int main(void){
    int n,wa=0;
    scanf("%d",&n);
    int m=n;
    if(m/10==0){
        wa=m%10;
    }else{
        for(;m/10!=0;){
            wa+=m%10;
            m=m/10;
            if(m/10==0){
                wa=wa+m;
            }
        }
    }

    if(n%wa==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=2000005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll f(ll n){
	return n*(n+1)/2;
}

ll n;

int main(){
	cin>>n;
	ll res=0;
	for(ll i=1;i<=n;i++){
		res+=f(n/i)*i;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

ll dp[1000+1][100000+1];
vector<int> A,B;
ll n,h;

void solve() {
  for(ll i=0;i<n;++i) {
    for(ll j=1;j<=h;++j) {
      if(dp[i][j]==0) dp[i+1][j]=dp[i+1][j-A[i]]+B[i];
      else dp[i+1][j]=min(dp[i][j],dp[i+1][j-A[i]]+B[i]);
    }
  }
  print(dp[n][h]);
  return;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin>>h>>n;
  A.resize(n,0), B.resize(n,0);
  rep(i,n) {cin>>A[i]>>B[i];}
  solve();
  return 0;
}

Measured memory_bytes: 778880
import sys

readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

import queue


n,m = readints()
path  =[[] for i in range(n)]

for i in range(m):
    a,b = readints()
    a-=1
    b-=1
    path[a].append(b)
    path[b].append(a)
d = [[] for i in range(n)]
d[0].append(0)

q = queue.Queue()
q.put(0)
visited = [-1]*n
visited[0]=0

ans = [0]*n

while not q.empty():
    p = q.get()
    for x in path[p]:
        if visited[x]==-1:
            visited[x]=visited[p]+1
            d[visited[x]].append(x)
            q.put(x)
            ans[x]=p+1

print('Yes')
printrows(ans[1:])




Measured memory_bytes: 109736
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    answers=[0]
    n = int(input())
    S = input()
    x=0

    for s in S:
        if "I" in s:
            x+=1
            answers.append(x)
        elif "D" in s:
            x-=1
            answers.append(x)
    print(max(answers))

if __name__=="__main__":
    main()

Measured memory_bytes: 9064
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
long long n,a[250001],b[250001],ans=0;

string s;

void gb(int l,int r)
{
    if(l==r)	return;
    int mid=(l+r)>>1;	
    gb(l,mid);
    gb(mid+1,r);
    int i=l,j=mid+1,top=l-1,k;
    while(i<=mid&&j<=r)
    {
        if(a[i]>a[j])
        {
            b[++top]=a[j];
            ans+=mid-i+1;
            j++;
        }	
        else
        {
            b[++top]=a[i];	
            i++;
        }
    }
    for(k=i;k<=mid;k++)
        b[++top]=a[k];
    for(k=j;k<=r;k++)
        b[++top]=a[k];
    for(k=l;k<=r;k++)
        a[k]=b[k];
    return;
}

int main()
{
	cin>>s;
	n=s.length();
    for(int k=1;k<=n;k++)
        a[k]=(s[k-1]=='B');
    gb(1,n);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
using namespace std;
#define repl(i,x,n) for(long long i=(long long)(x);i<(long long)(n);i++)
#define rep(i,x,n) for(long i=long(x);i<long(n);i++)
int main() 
{
    //ifstream cin("input.in");
    //ofstream cout("output.out");
    ios::sync_with_stdio(0);cin.tie(0);
    string s,p="YAKI";
    cin>>s;
    long l=s.size();
    long i=0,j=0;
    while(i<s.size() && i<4)
    {
        if(s[i]==p[i])
            i++;
        else
        {
            cout<<"No";
            return 0;
        }
    }
    if(i==4)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,i,ans=0;
  int p[21];
  scanf("%d",&n);
  for(i=0;i<n;i++){
  	scanf("%d",&p[i]);
  }
  for(int j=1;j<n-1;j++){
  	if((p[j-1]<p[j]&&p[j]<=p[j+1])||(p[j+1]<p[j]&&p[j]<=p[j-1])){
    	ans++;
    }
  }
  printf("%d",ans);
  return 0;
}



Measured memory_bytes: 128
// Vicfred
// https://atcoder.jp/contests/abc164/tasks/abc164_c
// set
use std::io;
use std::collections::BTreeSet;

fn main() {
    let mut n = String::new();

    io::stdin()
        .read_line(&mut n)
        .unwrap();

    let n: i64 = n.trim().parse().unwrap();

    let mut kinds = BTreeSet::new();
    for _ in 0..n {
        let mut s = String::new();

        io::stdin()
            .read_line(&mut s)
            .unwrap();

        kinds.insert(s);
    }
    
    println!("{}", kinds.len());
}



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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmin(T & ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T & ref, const T value) {
    if (ref < value) ref = value;
}

const ll mod = 1000000007;

struct UnionFind {
public:
	vector <ll> par; // 
	vector <ll> siz; // 

	ll answer;

	UnionFind() {}

	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i;
		answer = sz_ * (sz_ - 1) / 2;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);
		for (ll i = 0; i < sz_; ++i) par[i] = i;
		answer = sz_ * (sz_ - 1) / 2;
	}

	ll root(ll x) {
		while (par[x] != x) {
			x = par[x] = par[par[x]];
		}
		return x;
	}

	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		if (siz[x] < siz[y]) swap(x, y);
		answer -= (siz[x] * siz[y]);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	ll query() const {
		return answer;
	}

	bool issame(ll x, ll y) {
		return root(x) == root(y);
	}

	ll size(ll x) {
		return siz[root(x)];
	}
};

int main() {
	ll n, m;
	cin >> n >> m;
	vector<P> edges(m);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		edges[i] = { a,b };
	}
	vector<ll> ans(m);
	UnionFind uf(n);
	for (int i = m - 1; i >= 0; i--) {
		ans[i] = uf.query();
		uf.merge(edges[i].first, edges[i].second);
	}
	for (auto a : ans) {
		cout << a << endl;
	}
	return 0;
}



Measured memory_bytes: 7148
N=int(input())
r=0
l=0
S = input()
li_S = []
count = 0

for i in range(N):
    if S[i]==")":
         r += 1
         li_S.append(")")
    else:
        l += 1
        li_S.append("(")
    if r > l :
        li_S.insert(0,"(")
        l += 1

for i in range(l-r):
    li_S.append(")")
print("".join(li_S))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt()+1;
		int c=scan.nextInt();
		int sum=0;
		for(int i=0;i<c;i++) {
			sum+=scan.nextInt();
		}
		if(sum%n>0) {
			System.out.println(sum/n+1);
		}
		else {
			System.out.println(sum/n);
		}
	}
}



Measured memory_bytes: 26408
'use strict'

const INF = 900719925474099;
function mapint(temp){
    return temp.split(' ').map((v)=>parseInt(v));
}

function lower_bound(d,a,b,e){
    for(var c;1<b-a;)
        d[c=0|(a+b)/2]<e ? a=c : b=c;
    return d[a]<e?b:a
};

const MOD = 1000000007;

function Main(input){
    let temp = input.trim().split('\n');
    let n = parseInt(temp[0]);
    
    let ab = new Array(n);
    let tt;
    for(let i=0;i<n;i++){
      tt = mapint(temp[i+1]);
      ab[i] = {a:tt[0],b:tt[1]};
    }
    ab.sort((c,d)=>c.b-d.b);
    let sum = 0;
    let f = true;
    for(let i=0;i<n;i++){
      sum += ab[i].a;
      if(sum > ab[i].b){
        f=false;
        break;
      }
    }
    //console.log(ab.map((v)=>v.a + ' ' + v.b));
    if(f) console.log('Yes');
    else console.log('No');

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));



Measured memory_bytes: 62804
//
//  main.cpp
//  CoderWork
//
//  Created by Minoru Hayashi on 2020/02/29.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//

#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)

using ll = long long;
using P = pair<int,int>;

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

const ll INF = 1LL<<60;

//#define __DBG__



void solve(void){

  int N;
  string S;
  cin >> N >> S;
  
  int count = 0;

  REP(i,N-2) {
    string A=S.substr(i,3);
    if(A=="ABC"){
      count++;
    }
  }
  


  cout << count << endl;
  
  return;
}

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


    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    solve();
 
    return 0;
}





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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  ll N;
  cin >> N;

  string ans = "";
  while (N > 26) {
    char c = (N % 26 == 0 ? 'z' : 'a' + (N % 26 - 1));
    ans += c;
    if (N % 26 == 0) {
      N = N / 26 - 1;
    } else {
      N /= 26;
    }
  }
  char c = (N % 26 == 0 ? 'z' : 'a' + (N % 26 - 1));
  ans += c;

  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a=a%b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e10+10;
struct Edge{int to,weight;};

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

signed main(){
  int n;
  cin>>n;
  vector<int> a(n+1),b(n);
  rep(i,n+1) cin>>a[i];
  rep(i,n) cin>>b[i];
  
  int ans=0;

  rep(i,n){
    // l=a[i];r=a[i+1];
    if(a[i]>b[i]){
      ans+=b[i];
    }else{
      ans+=a[i];
      b[i]-=a[i];
      ans+=min(b[i],a[i+1]);
      a[i+1]-=min(b[i],a[i+1]);
    }    
  }

  cout<<ans<<endl;;
  
  return 0;
}

Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var n, m, sum int
	fmt.Scan(&n, &m)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
		sum += as[i]
	}

	var cnt int
	for _, a := range as {
		if a*4*m >= sum {
			cnt++
		}
	}

	if cnt >= m {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}


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

using namespace std;

int h[100100];

int main()
{
    int n,i,k,d=1e9;
    cin >> n >> k;
    for(i=0;i<n;i++)
    {
        cin >> h[i];
    }
    sort(h,h+n);
    for(i=0;i<n-k+1;i++)
    {
        d=min(d,h[i+k-1]-h[i]);
    }
    cout << d << endl;
    return 0;
}

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

#define INF 1LL << 60
#define pb push_back
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

int main() {
    ll N, tmp, a = INF;
    cin >> N;
    REP(i, 5) {
        cin >> tmp;
        a = min(a, tmp);
    }
    ll ans = ceil((double)N / a) + 4;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
<?php
$n = trim(fgets(STDIN));

$min = INF;
$p = -INF;
for ($i = 0; $i < $n; $i++) {
    $r = trim(fgets(STDIN));

    if ($r - $min > $p) {
        $p = $r - $min;
    }

    if ($r < $min) {
        $min = $r;
    }
}

echo $p . PHP_EOL;


Measured memory_bytes: 9212
n, m = gets.split.map(&:to_i)
g = Array.new(n + 1) { [] }
count = 0

m.times do
  a, b = gets.split.map(&:to_i)
  g[a] << b
  g[b] << a
end

[*2..n].permutation(n - 1) do |p|
  s = 1

  count += 1 if p.all? { |e| s = e if g[s].member?(e) }
end

puts count

Measured memory_bytes: 14328
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int ans = 0;
  int minimum = N;
  for(int i = 0; i < N; i++) {
    int P;
    cin >> P;
    if(P <= minimum) {
      minimum = P;
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def root(x):
        if x == p[x]:
            return x
        p[x] = root(p[x])
        return p[x]
    def unite(x,y):
        x = root(x)
        y = root(y)
        if r[x] < r[y]:
            p[x] = y
        else:
            p[y] = x
            if r[x] == r[y]:
                r[x] += 1

    n,m,k = LI()
    p = [i for i in range(n)]
    r = [0]*n
    f = [0]*n
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        if root(a) != root(b):
            unite(a,b)
        f[a] += 1
        f[b] += 1
    for i in range(k):
        a,b = LI()
        a -= 1
        b -= 1
        if root(a) == root(b):
            f[a] += 1
            f[b] += 1
    d = defaultdict(lambda : 0)
    for i in range(n):
        d[root(i)] += 1
    ans = []
    for i in range(n):
        ans.append(d[root(i)]-f[i]-1)
    print(*ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 98796
#include<iostream>


using namespace std;

int main(){
 int a,b;
  cin >> a >> b;
  
  if(a<=0&&0<=b) cout << "Zero" << endl; 
  else if(a>0||(b-a+1)%2==0) cout  << "Positive" << endl;
  else cout  << "Negative" << endl;
  
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

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


Measured memory_bytes: 3564
import sys
input = sys.stdin.readline
N = int(input())
res = [[0] * x for x in range(N - 1, 0, -1)]
for x in range(N - 1):
  for y in range(N - 1 - x):
    b = 0
    for k in range(10):
      if (y + 1) & (1 << k):
        b = k + 1
        break
    res[x][y] = b
for r in res: print(*r)

Measured memory_bytes: 47324
#include <bits/stdc++.h>
using namespace std;
int main () {
	long long N;
	cin >> N;
	vector<long long> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	long long mod = 1000000007;
	vector<int> v[100000];
	for (int i = 0; i < N; i++) {
		v[A[i]].push_back(i);
	}
	long long d;
	switch(v[0].size()) {
		case 0:
			d = 0;
		case 1:
			d = 3;
			break;
		case 2:
			d = 6;
			break;
		case 3:
			d = 6;
			break;
		default:
			d = 0;
	}
	for (int i = 1; i < N; i++) {
		long long dd = 1;
		for (int j = 0; j < (v[i].size()); j++) {
			dd *= (lower_bound(v[i-1].begin(), v[i-1].end(), v[i][j]) - v[i-1].begin()) - j;
		}
		d = (d * dd) % mod;
	}
	cout << d << endl;
}

Measured memory_bytes: 6528
use std::io::*;
use std::str::*;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

fn main() {
    let x: i32 = read();
    let y: i32 = read();

    if x == 1 && y == 1 {
        println!("1000000")
    } else {
        let mut ans = 0;
        ans += match x {
            1 => 300000,
            2 => 200000,
            3 => 100000,
            _ => 0,
        };
        ans += match y {
            1 => 300000,
            2 => 200000,
            3 => 100000,
            _ => 0,
        };
        println!("{}", ans)
    }
}


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

int main(){
	int D, N;
	cin >> D >> N;
	int base = 1;
	for(int i = 0; i < D; i++) base *= 100;
	if(N == 100) cout << base * 101 << endl;
	else cout << base * N << endl;
	return 0;
}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define MAX 1000005
#define pb push_back
#define vi vector<int>
#define endl '\n'
using namespace std;
// cnt total no. of elements between range from a to b which contains digit d exactly k times
string b;
int k;
vi num;
int dp[105][4][2];		//dp[pos][cnt][f]	f=if number has become less or not 
int call(int pos,int cnt,int f)
{
	if(cnt>k)
		return 0;
	if(num.size()==pos){
		if(cnt==k)
			return 1;
		return 0;
	}
	int limit,res=0;
	
	if(dp[pos][cnt][f]!=-1)
		return dp[pos][cnt][f];
	if(f==0)
		limit=num[pos];
	else
		limit=9;
		
	for(int i=0;i<=limit;i++)
	{
		int nf=f;
		int ncnt=cnt;
		if(i<limit)
			nf=1;
		if(i!=0)
			ncnt++;
		if(cnt<=k)
			res+=call(pos+1,ncnt,nf);
	}
	return dp[pos][cnt][f]=res;
}		

int solve(string b)
{
	num.clear();
	for(int i=0;i<b.length();i++)
	{
		num.pb(b[i]-'0');
	}
	memset(dp,-1,sizeof(dp));
	int res=call(0,0,0);
	return res;
}
signed main()
{
	fastio;
	cin>>b>>k;
	int res=solve(b);
	cout<<res<<endl;
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lint long long
#define P pair<int, int>

int main(){
    int N, K;
    cin >> N >> K;
    
    int A[N];
    map<int, int> Cnt;
    
    for(int i = 0; i < N; ++i){
        cin >> A[i];
        Cnt[A[i]]++;
    }
    
    vector<P> List;
    
    for(auto e : Cnt){
        List.push_back(make_pair(e.second, e.first));
    }
    
    sort(List.begin(), List.end());
    
    if(List.size() > K){
        int ans = 0;
        for(int i = 0; i < List.size() - K; ++i){
            ans += List[i].first;
        }
        
        cout << ans << endl;
        return 0;
    } else {
        cout << "0" << endl;
        return 0;
    }
    
}

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

using namespace std;

namespace FFT {
	const int MX = (1 << 23);
	
	int md, root;
	
	const int md1 = 998244353, root1 = 31;
	const int md2 = 167772161, root2 = 4;

	int pow(int x, int p) {
		int r = 1;
		while (p) {
			if (p % 2 == 1) r = r * 1ll * x % md;
			x = x * 1ll * x % md;
			p /= 2;
		}
		return r;
	}

	int rev[MX], N = -1;

	void init(int n) {
		assert((n & -n) == n && n <= MX);
		int log_n = 0;
		while ((n >> log_n) > 1) log_n++;
		
		for (int i = 0; i < n; i++) {
			rev[i] = 0;
			for (int j = 0; j < log_n; j++)
				rev[i] |= (i >> j & 1) << (log_n - 1 - j);
			
			if (rev[i] < i) rev[i] = i;
		}
		
		N = n;
	}

	void fft(int a[], int n, bool invert) {
		assert(n == N);
		static int w_pow[MX];
		for (int i = 0; i < n; i++) swap(a[i], a[rev[i]]);
		for (int len = 1; len < n; len *= 2) {
			w_pow[0] = 1;
			w_pow[1] = pow(root, MX / (2 * len));
			if (invert) w_pow[1] = pow(w_pow[1], md - 2);
			for (int i = 2; i < len; i++) w_pow[i] = w_pow[i - 1] * 1ll * w_pow[1] % md;
			for (int i = 0; i < n; i += 2 * len)
				for (int j = i, k = i + len; j < i + len; j++, k++) {
					int t = a[k] * 1ll * w_pow[j - i] % md, u = a[j];
					a[k] = u - t < 0 ? u - t + md : u - t;
					a[j] = u + t >= md ? u + t - md : u + t;
				}
		}
		if (invert) {
			int n_inv = pow(n, md - 2);
			for (int i = 0; i < n; i++) a[i] = a[i] * 1ll * n_inv % md;
		}
	}
}

const int P = 200003;

int deg[P];

int getSize(int g, bool forP = false) {
	deg[1] = 0;
	
	int d = 1;
	for (int k = g; k != 1; d++) {
		deg[k] = d;
		
		k = k * 1LL * g % P;
	}
	
	return d;
}

const int SZ = 1 << 19;

int cnt1[SZ], cnt2[SZ];

int main() {
	int g = 2;
	while (getSize(g) != P - 1) g++;
	
	int n;
	long long ans = 0;
	ignore = scanf("%d", &n);
	//n = 200000;
	for (int i = 0, x; i < n; i++) {
		ignore = scanf("%d", &x);
		//x = 1;
		if (x == 0) continue;
		
		cnt1[deg[x]]++;
		cnt2[deg[x]]++;
		
		ans -= (x * 1LL * x) % P;
	}
	
	FFT::init(SZ);
	
	FFT::md = FFT::md1;
	FFT::root = FFT::root1;
	FFT::fft(cnt1, SZ, false);
	
	FFT::md = FFT::md2;
	FFT::root = FFT::root2;
	FFT::fft(cnt2, SZ, false);
	
	for (int i = 0; i < SZ; i++) {
		cnt1[i] = cnt1[i] * 1LL * cnt1[i] % FFT::md1;
		cnt2[i] = cnt2[i] * 1LL * cnt2[i] % FFT::md2;
	}
	
	FFT::md = FFT::md1;
	FFT::root = FFT::root1;
	FFT::fft(cnt1, SZ, true);
	
	FFT::md = FFT::md2;
	FFT::root = FFT::root2;
	FFT::fft(cnt2, SZ, true);
	
	long long inv = FFT::pow(FFT::md1, FFT::md2 - 2);
	
	for (int i = 0, x = 1; i < SZ; i++, x = x * 1LL * g % P) {
		// cnt = cnt1[i] (mod md1)
		// cnt = cnt2[i] (mod md2)
		// cnt = cnt1[i] + md1 * (cnt2[i] - cnt1[i]) * (md1^-1 mod md2)
		
		long long mult = (cnt2[i] - cnt1[i]) * inv % FFT::md2;
		if (mult < 0) mult += FFT::md2;
		long long cnt = cnt1[i] + FFT::md1 * mult;
		
		ans += x * cnt;
	}
	
	assert(ans % 2 == 0);
	ans /= 2;
	
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 11712
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

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

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n+1)
	b := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i <= n; i++ {
		a[i] = nextInt(sc)
	}
	for i := 0; i < n; i++ {
		b[i] = nextInt(sc)
	}
	cnt := 0
	for i := 0; i < n; i++ { // 前からなるべく多くのモンスターを倒していく
		// 勇者iは合計b[i]隊までのモンスターを倒せる
		// まずa[i]を出来るだけ多く倒し、さらに倒せそうならa[i+1]のモンスターを出来るだけ倒す
		w0 := min(b[i], a[i])
		cnt += w0
		b[i] -= w0
		if b[i] > 0 {
			w1 := min(b[i], a[i+1])
			a[i+1] -= w1
			cnt += w1
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 5120
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    
    if(s.equals("AAA") || s.equals("BBB"))
      System.out.println("No");
    else
      System.out.println("Yes");
    
  }
}

Measured memory_bytes: 21844
#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import math,sys

x = int(sys.stdin.readline())

if x == 0:
    print(1)
else:
    print(0)


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


typedef __int128 int128_t;
long long cnt[70];
int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long ans = 0;
	long long n;
	cin >> n;
	
	fill(cnt,cnt+70,0);
	for(int i = 0;i < n;i++){
		long long x;
		cin >> x;
		long long c = 0;
		while(x > 0){
			if(x % 2ll == 1ll) cnt[c]++;
			c++;
			x /= 2ll;
		}
	}
	
	for(long long i = 0ll;i < 62ll;i++){
		if(cnt[i] == 0) continue;
		
		long long a = (n - cnt[i]) * cnt[i];
		a %= mod;
		//cout << cnt[i] << " " << i << " " << a << "\n";
		long long b = (1ll << i);
		b %= mod;
		
		a *= b;
		a %= mod;
		
		ans += a;
		ans %= mod;
	}
	
	cout << ans;
	
	
	
	
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n, m;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n >> m;
	set<pair<int, int> > st;
	FOR(i, m) {
		int a, b;
		cin >> a >> b;
		st.insert({a-1, b-1});
		st.insert({b-1, a-1});
	}
	vector<int> v(n-1);
	FOR(i, n-1) v[i] = i+1;
	int cnt = 0;
	do {
		int s = 0;
		bool ok = true;
		FOR(i, v.size()) {
			if (!st.count({s, v[i]}) && !st.count({v[i], s})) ok = false;
			s = v[i];
		}
		if (ok) cnt++;
	} while (next_permutation(ALL(v)));
	cout << cnt << endl;
	return 0;
}

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

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

  int N, P; cin >> N >> P;
  string S; cin >> S;

  long long ans = 0;

  if (P == 2 || P == 5) {
    for (int i = 0; i < N; i++)
      if ((S[i]-'0') % P == 0) ans += i + 1;
    cout << ans << "\n";
    return 0;
  }

  vector<int> v(P);
  int x = 1, y = 0;
  for (int i = N-1; i >= 0; i--) {
    y = ((S[i]-'0') * x + y) % P;
    ans += y ? v[y]++ : ++v[y];
    x = x * 10 % P;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 720
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1173&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int LPAR, RPAR, LBRACE, RBRACE;
bool isBalance=true;
vector<char> vec; 

void init()
{
	LPAR=0, RPAR=0, LBRACE=0, RBRACE=0;
	isBalance=true;
	vec.clear();
}

void check(char word)
{				
	if(word == '('){ LPAR++; vec.push_back(word); }
	if(word == ')')
	{
		if(vec.empty()){
			isBalance=false;
		}else{
			char tmp = vec.back();
			vec.pop_back();
			if(tmp != '('){ isBalance=false; }
			RPAR++;
		}

	}
	if(word == '['){ LBRACE++; vec.push_back(word); }
	if(word == ']')
	{
		if(vec.empty()){
			isBalance=false;
		}else{
			char tmp = vec.back();
			vec.pop_back();
			if(tmp != '['){ isBalance=false; }
			RBRACE++;
		}
	}
}

int main() {

	string line;

	while(true)
	{
		init();
		getline(cin, line);
		//dump(line); //DEBUG
		if(line == "."){ break; }

		rep(i,line.size())
		{
			check(line[i]);
			if(RPAR > LPAR){ isBalance=false; }
			if(RBRACE > LBRACE){ isBalance=false; }
			
			if(LPAR && line[i] == ')'){ LPAR--; RPAR--;}
			if(LBRACE && line[i] == ']'){ LBRACE--; RBRACE--; }
		}

		if(!LPAR && !RPAR && !LBRACE && !RBRACE)
		{
			//Do Nothing...
		}else{
			isBalance = false;
		}

		if(isBalance){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}

	return 0;
}

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

public class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		HashMap<Integer,Integer> d = new HashMap<Integer,Integer>();
		for(int i=0;i<n;i++){
			int x = sc.nextInt();
			if(d.containsKey(x)){
				int y = d.get(x);
				d.remove(x);
				d.put(x,y+1);
			}
			else{
				d.put(x,1);
			}
		}
		int m = sc.nextInt();
		int[] t = new int[m];
		for(int i=0;i<m;i++){
			t[i] = sc.nextInt();
		}
		boolean judge = true;
		for(int i=0;i<m;i++){
			if(d.containsKey(t[i])){
				if(d.get(t[i])==0){
					judge = false;
					break;
				}
				else{
					int y = d.get(t[i]);
					d.remove(t[i]);
					d.put(t[i],y-1);
				}
			}
			else{
				judge = false;
				break;
			}
		}
		if(judge){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 156416
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef unsigned long long ll;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const ll inf = 1e18;
const ll N = 1e5+9;
ll A[N];

void solve() {
	ll a, b, n;
	cin>>n;
	int zero=0;
	for(int i=1;i<=n;++i) {
		cin>>A[i];
		if(A[i]==0) zero=1;
	}
	if(zero) {
		cout<<0<<endl;
		return;
	}

	int ok=1;
	ll prod=1;
	for(int i=1;i<=n;++i) {
		if(A[i]<=inf/prod) {
			prod*=A[i];
		}
		else ok=0;
	}
	if(ok) cout<<prod<<endl;
	else cout<<-1<<endl;
}
int main() {
    ios_base::sync_with_stdio(0);
    int T=1 ,cas=0;
    while(T--) {
    	solve();
    }
    return 0;
}

// ll, reset, 1, bottom


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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    ll res=0;
    queue<ll> q;
    q.push(0);
    for(ll i=0;i<N;i++){
        while(i<N && S[i]=='0') i++;
        if(i>0) q.push(i);
        while(i<N && S[i]=='1') i++;
        if(q.size()>K){
            auto istart = q.front(); q.pop();
            res = max(res, i-istart);
        }
    }
    if(res==0){
        cout<<N<<endl;
    }else{
        cout<<res<<endl;
    }

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long a,b,c,d;
    cin>>a>>b>>c>>d;
    a*=4;
    b*=2;
    vector<long long >a1;
    vector<long long > b1;
    a1.push_back(a);
    a1.push_back(b);
    a1.push_back(c);
    b1.push_back(a*2);
    b1.push_back(b*2);
    b1.push_back(c*2);
    b1.push_back(d);
    sort(a1.begin(),a1.end());
    sort(b1.begin(),b1.end());
    long long val;
    cin>>val;
    if(val==1)
    {
    cout<<*min_element(a1.begin(),a1.end());
    }
    else
    {
        if(val%2==0)
        {
        cout<<(*min_element(b1.begin(),b1.end()))*val/2;
        }
        else
        {
            cout<<((*min_element(b1.begin(),b1.end()))*(val/2))+(*min_element(a1.begin(),a1.end()));
    }
    }

     return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

  int x, y;
  cin >> x >> y;
  lol a, b, c, d;
  a = (x <= y ? y - x : LINF);
  b = (x <= y * -1 ? 1 + ((y * -1) - x) : LINF);
  c = (x * -1 <= y ? 1 + (y - (x * -1)) : LINF);
  d = (x * -1 <= y * -1 ? 2 + (y * -1 - x * -1) : LINF);
  cout << min(min(a, b), min(c, d)) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define cinsc ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOR(i,k,n)  for(int64 i=k;i<n;i++)
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define SQ(x) ((x)*(x))
const double pi=acos(-1.0);
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
 
int64 powr(int64 x,int64 y,int64 p)  
{  
    int res = 1;    
    x = x % p; 
    if (x == 0) return 0;
    while (y > 0){   
        if (y & 1)  
            res = (res*x) % p;   
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
} 
 
void  in_o(){
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	cinsc;
}
 


 
int main(){
	//in_o();
	int a,b;
	cin>>a>>b;
	int ans;
	for(int i=0;i<INT_MAX;i++){
		if(a*i-i+1>=b){
			return cout<<i<<endl,0;
		}
	}
	return 0;
}


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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);
const ll        MOD=1000000007;                 ///1e9+7
ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};



#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'
#define gap ' '
#define print(a) {for(auto x:a)cout<<x<<" ";cout<<endl;}
#define mem(a,b) memset(a, b, sizeof(a))
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) (a)*(a)
#define r return 0

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){ll p=MOD;a%=p;if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;pr%=p;--b;}a*=a;a%=p;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
void seive(bool a[]){ll mx=sqrt(N),ii,jj;for(ii=3;ii<=mx;ii+=2)if(!a[ii])for(jj=ii*ii;jj<=N;jj+=2*ii)a[jj]=true;}
void numofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]++; else a[jj]+=2;}}}
void sumofdiv(ll a[]){ll mx=sqrt(N),ii,jj;for(ii=1;ii<=mx;ii++){for(jj=ii*ii;jj<=N;jj+=ii){if(jj==ii*ii) a[jj]+=ii; else a[jj]+=ii+jj/ii;}}}

///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///

 int main()
 { int co=0,N,i;string s;
 cin>>N>>s;
 N=s.size();
 for(i=0;i<=N-3;i++)
 {
     if(s[i]=='A')
     {
         if(s[i+1]=='B')
         {
             if(s[i+2]=='C')
             {
                 co++;
                 i=i+2;
             }
         }
     }
 }
 cout<<co<<endl;


 r;


}


///Thanking you by Roxy





Measured memory_bytes: 3628
from collections import deque

def bfs(s, t):
    dist = [-1] * (3 * n + 1)
    q = deque()
    q.append(s)
    dist[s] = 0
    while q:
        p = q.popleft()
        for i in G[p]:
            if dist[i] == -1:
                dist[i] = dist[p] + 1
                q.append(i)
    return dist[t]

n, m = map(int, input().split())
G = [[] for _ in range(3 * n + 1)]
for _ in range(m):
    u, v = map(int, input().split())
    G[u].append(v + n)
    G[u + n].append(v + 2 * n)
    G[u + 2 * n].append(v)
s, t = map(int, input().split())
ans = bfs(s, t)
print(ans // 3 if not ans == -1 else ans)

Measured memory_bytes: 60164
n= int(input())
*a,=map(int, input().split( ))
flag = True

b1 = []
b2 = []

for i in range(n):
    if flag:
        b1.append(a[i])
    else:
        b2.append(a[i])
    flag ^= 1
b2.reverse()
ans = b2+b1
if not flag:
    ans.reverse()
print(*ans)

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

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


Measured memory_bytes: 3596
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int shu=0;
	long long N,D;
	cin>>N>>D;
	for(int i=1;i<=N;i++)
	{
		long long x,y;
		cin>>x>>y;
		if(x*x+y*y<=D*D)
		shu++;
	}
	cout<<shu;
	return 0;
}

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

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define MAXX 100005

#define PI 3.14159265358979323846264338327950

#define ll signed long long int

ll t , n, a[MAXX], b[MAXX], c[MAXX];
vector<ll> adj[MAXX];
set<string> s;
vector< pair<int , int> > v[MAXX];
bool used[MAXX];
multiset<int> ms;
map<string , int> m;
set<string>::iterator it;

signed main()
{
	FAST;
	ll   r; string str;
	cin >> n;
	for(ll i = 1; i <= n; i++){
		cin >> str >> r;
		s.insert(str);
		if(!(m[str])) m[str] = i;
		v[m[str]].push_back({r , i});
	}
	
	for(it = s.begin(); it != s.end(); it++){
		string k = (*it);
		sort(v[m[k]].begin() , v[m[k]].end());
        reverse(v[m[k]].begin() , v[m[k]].end());
	}
	for(it = s.begin(); it != s.end(); it++){
		string k = (*it);
		sort(v[m[k]].begin() , v[m[k]].end());
        reverse(v[m[k]].begin() , v[m[k]].end());
        for(int i = 0; i < v[m[k]].size(); i++){
            cout << v[m[k]][i].second << endl;
        }
	}
	
}

Measured memory_bytes: 6272
n = gets.to_i
numbers = gets.split(" ").map(&:to_i)
minus_count = numbers.count{|item| item <= 0}
sum = 0
numbers.each_with_index do |number, index|
  sum += number.abs
  if number < 0
    numbers[index] *= -1
  end
end
if minus_count.odd?
  sum -= numbers.min.abs * 2
end
puts sum

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

string S;
char c;

int main(){
  
  cin >> S;

  c = S.at(0);
  if( c=='a' || c=='e' || c== 'i' || c=='o' || c=='u')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;

  return 0;
}


Measured memory_bytes: 3636
n=gets.to_i
j=[]
n.times do
  a,b=gets.split.map(&:to_i)
  j << [a,b]
end
j.sort!{|j1,j2|j1[1]<=>j2[1]}
sum=0
for i in 0...n do
  sum+=j[i][0]
  if sum>j[i][1]
    puts "No"
    exit
  end
end
puts"Yes"
  

Measured memory_bytes: 18552
n = int(input())

ans = [0]*10001

for a in range(1,101):
    for b in range(1,101):
        for c in range(1,101):
            x = a**2+b**2+c**2+a*b+b*c+a*c
            if x<10001:
                ans[x] += 1
            else:
                break

for i in range(1,n+1):
    print(ans[i])

Measured memory_bytes: 9424
#include <iostream>
#include <string>
#include <queue>
#define llint long long

using namespace std;

llint n;
llint a[100005];

void GaussianElimination(llint a[], int n)
{
	llint r = 0;
	for(int i = 59; i >= 0 && r < n; i--){
		if((a[r]&(1LL<<i)) == 0){
			int p = -1;
			for(int j = r+1; j < n; j++){
				if(a[j] & (1LL<<i)){
					p = j;
					break;
				}
			}
			if(p == -1) goto end;
			swap(a[r], a[p]);
		}
		for(int j = 0; j < n; j++){
			if(j == r) continue;
			if(a[j]&(1LL<<i)) a[j] ^= a[r];
		}
		r++;
		end:;
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	
	llint ans = 0;
	for(int i = 0; i < 60; i++){
		llint cnt = 0;
		for(int j = 0; j < n; j++) if(a[j] & (1LL<<i)) cnt++;
		if(cnt % 2){
			ans += (1LL<<i);
			for(int j = 0; j < n; j++) a[j] &= ~(1LL<<i);
		}
	}
	
	/*for(int i = 0; i < n; i++){
		for(int j = 20; j >= 0; j--){
			cout << ((a[i]>>j)&1);
		}
		cout << endl;
	}
	cout << endl;*/
	
	GaussianElimination(a, n);
	
	/*for(int i = 0; i < n; i++){
		for(int j = 20; j >= 0; j--){
			cout << ((a[i]>>j)&1);
		}
		cout << endl;
	}*/
	
	llint tmp = 0;
	for(int i = 59; i >= 0; i--){
		if(tmp & (1LL<<i)) continue;
		for(int j = 0; j < n; j++){
			for(int k = 59; k >= i+1; k--){
				if(a[j] & (1LL<<k)) goto pass;
			}
			if(a[j] & (1LL<<i)) tmp ^= a[j];
			break;
			pass:;
		}
	}
	//cout << tmp << endl;
	ans += tmp * 2;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1024
(defvar C)
(setf C 0)

(do
  ((x 1 (1+ x))
   (l (loop :repeat (read) :collect (read))
      (cdr l)) )
  ((null l))
  (if (/= x (car l)) (incf C)) )

(princ (if (< C 3) "YES" "NO" ))

Measured memory_bytes: 4072
import java.util.*
import java.math.*
import kotlin.math.*

fun readLn()=readLine()!!
fun readInt()=readLn().toInt()
fun readInts()=readLn().split(" ").map{it.toInt()}
fun readLong()=readLn().toLong()
fun readLongs()=readLn().split(" ").map{it.toLong()}

val out=mutableListOf<String>()
fun printLine(s:String){out.add(s)}
fun output(){println(out.joinToString("\n"))}

fun main(){
    var a=readLn()
    if(a[1]=='B')printLine("ARC")
    else printLine("ABC")
    output()
}

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		sc.close();
		for (int i = 1; i <= 1000; i++) {
            int result = i * k;
            if (a <= result && result <= b) {
                System.out.println("OK");
                return;
			}
		}
			System.out.println("NG");
	}

}


Measured memory_bytes: 35704
#include <iostream>
#include <cstdio>
#include <climits>
#include <vector>
using namespace std;

#define SENTINEL (LONG_MAX)

template <typename T>
void print(vector<T> &x) {
	for(long i=0;i<x.size();++i) {
		if (i!=0) cout << " ";
		cout << x[i];
	}
	cout << endl;
}

long Merge(vector<long> &A, long left, long mid, long right) {
	long n1 = mid - left;
	long n2 = right - mid;
	vector<long> L(n1+1,0), R(n2+1,0);
	for(long i=0;i<n1;++i) {
		L[i] = A[left+i];
	}
	for(long i=0;i<n2;++i) {
		R[i] = A[mid+i];
	}
	L[n1] = SENTINEL; 
	R[n2] = SENTINEL; 
	long i,j;
	i = j = 0;
	long count = 0;
	for (long k=left; k<right; ++k) {
		if (L[i] <= R[j]) {
			A[k] = L[i];
			i++;
		} else {
			count += n1 - i;//思いつかなかった 
			A[k] = R[j];
			j++;
		}
	}
	//cout << "count = " << count << ", lmr : " << left << " " << mid << " " << right << endl;
	//print(A);
	return count; 
}

long MergeSort(vector<long> &A, long left, long right) {
	long count = 0;
	if ((left + 1) < right) {
		long mid = (left + right) / 2;
		count += MergeSort(A, left, mid);
		count += MergeSort(A, mid, right);
		count += Merge(A, left, mid, right); 
	}
	return count;
}

int main() {
	long n;
	cin >> n;// 1 <= n <= 200000
	vector<long > a(n,0);
	for (long i=0; i<n; ++i) scanf("%ld", &a[i]);

	// find the number of inversions
	long ans = MergeSort(a,0,a.size());	
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 6004
n = int(input())

c = [0] * (n-1)
s = [0] * (n-1)
f = [0] * (n-1)
for i in range(n-1):
    c[i], s[i], f[i] = list(map(int, input().split()))

for i in range(n):
    t = 0
    for j in range(i, n-1):
        if t < s[j]:
            t += (s[j] - t) + c[j]
        else:
            tmp = (t - s[j]) % f[j]
            if tmp == 0:
                t += c[j]
            else:
                t += (f[j] - tmp) + c[j]
    print(t)


Measured memory_bytes: 3188
import math
a=[int(input()) for i in range(5)]

b=[]
c=[]

for i in range(5):
  p=math.ceil(a[i]/10)*10
  b.append(p)
  c.append(list(str(a[i]-1)))

d=[]
for i in range(5):
  d.append(int(c[i][-1]))

print(sum(b)-(10-min(d)-1))  

Measured memory_bytes: 9104