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

using namespace std;

#define int long long
#define rep(i,x) for(int i=0;i<x;++i)
#define rrep(i,x) for(int i=x-1;i>=0;--i)
#define rep1(i,x) for(int i=1;i<=x;++i)
#define rrep1(i,x) for(int i=x;i>=1;--i)
#define fst first
#define scd second
#define PB push_back
#define PPB pop_back
#define all(a) begin(a),end(a)

using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;

vi G[100010];
int d[100010];

int dfs(int v) {
    if (G[v].empty()) return 0; // leaf

    vector<int> depth;

    for (int u : G[v]) {
        depth.PB(dfs(u));
    }

    sort(all(depth));

    int ma = 0;

    int n = depth.size();
    rep(i, n) {
        ma = max(ma, depth[i] + (n - 1 - i));
    }

    return ma + 1;
}

signed main()
{
    int N;

    cin >> N;

    rep(i, N - 1) {
        int a; cin >> a;

        --a;

        G[a].PB(i + 1);
    }

    queue<int> q;
    q.push(0);
    fill_n(d,N + 1, 1000000);
    d[0] = 0;

    while (q.size()) {
        int v = q.front(); q.pop();

        for (int u : G[v]) {
            if (d[u] > d[v] + 1) {
                d[u] = d[v] + 1;
                q.push(u);
            }
        }
    }

    cout << dfs(0) << endl;
}


Measured memory_bytes: 14336
#include<stdio.h>
int main()
{
    char day[3];
    scanf("%s",day);
    if(*day=='M')
    {
        printf("6");
    }
    else if(*day=='W')
    {
        printf("4");
    }
    else if(*day=='F')
    {
        printf("2");
    }
    else if(*day=='T')
    {
        if(*(day+1)=='H')
        {
            printf("3");
        }
        else
        {
            printf("5");
        }
    }
    else
    {
        if(*(day+1)=='A')
        {
            printf("1");
        }
        else
        {
            printf("7");
        }
    }
    return 0;
}


Measured memory_bytes: 128
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B, K;

int main() {
	vector<ll> ans;
	scanf("%lld %lld %lld", &A, &B, &K);
	for(int i = 1; i <= min(A, B); i++) {
		if(!(A % i) && !(B % i)) {
			ans.push_back(i);
		}
	}
	reverse(ans.begin(), ans.end());
	printf("%lld\n", ans[K - 1]);

	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();

      if((a+b)%2==0) {
        System.out.println((a+b)/2);
      } else {
        System.out.println("IMPOSSIBLE");
      }
      
    
    }
}

Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
def solve():
    X = int(input())
    L = [0 for _ in range(X+1)]
    L[0] = 1
    for a in range(100, 106):
        for b in range(a, X+1):
            L[b] = L[b-a] or L[b]
    return str(L[-1])

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


Measured memory_bytes: 3912
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: usize,
        m: usize,
        k: usize,
        a: [u64; n],
    }
    let mut dp = a.clone();
    let mut d = vec![(0, 0); n];
    for i in 1..k {
        let mut f = 0;
        let mut b = 0;
        d[b] = (i - 1, dp[i - 1]);
        b += 1;
        for (j, (dp, a)) in dp[i..].iter_mut().zip(a[i..].iter()).enumerate() {
            let j = j + i;
            if d[f].0  + m + 1 == j {
                f += 1;
            }
            let v = d[f].1 + (i + 1) as u64 * *a;
            while f < b && d[b - 1].1 <= *dp {
                b -= 1;
            }
            d[b] = (j, *dp);
            b += 1;
            *dp = v;
        }
    }
    let ans = dp[(k - 1)..].iter().max().unwrap();
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 8444
import sys
n,k=map(int,input().split())
s=list(input())
ct=0
for i in range(n-1):
  if s[i]=='R' and s[i+1]=='L':ct+=1
if ct<=k-1:
  print(n-1)
  sys.exit()
ans=n-ct*2
ans+=2*k
if s[0]=='L':
  ans-=1
if s[n-1]=='R':
  ans-=1
print(ans)

Measured memory_bytes: 4084
#include<stdio.h>
#include<math.h>
int main(){
int a,b;
scanf("%d%d",&a,&b);
if(b>=100)a=a*1000+b;
else if(b>=10)a=a*100+b;
else a=a*10+b;
b=sqrt(a+0.1);
if(b*b==a)puts("Yes");
else puts("No");
return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
const ll mod = 1e9+7;
#define INFL 0x3f3f3f3f3f3f3f3fLL
 
//-------------------------<MATH>-------------------------------------------------------//
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;
ll c = (a * b)%mod;
//cout << a << " " << b << endl;
return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(5e5 + 5)] , inv_fac[(int)(5e5 + 5)];
void precomp_factorial(int M){fac[0] = 1;for(int i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(int i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int lo[(int)(1e3 + 6)];
void sieve(int M){for(int i = 2 ; i < M ; i++){ if(lo[i]) continue; for(int j = i ; j < M ; j += i)lo[j] = i;}}
int max_expo_prime_n_fac(ll N , int prime){int ress = 0;while(N){ress += (N/prime);N /= prime;}return ress;}
//-------------------------</MATH>-------------------------------------------------------//
 
//-------------------------<STRING>-------------------------------------------------------//
string get_prefix(string x , int MAX){return x.substr(0 , min((int)x.size() , MAX));}
string get_suffix(string x,int MAX){int dn=1;for(int i=x.size()-1;i>=0;i--){if(dn==MAX)return x.substr(i);dn++;}return x;}
string convert_to_binary(int x,int len) {string ans=""; while(x){if(x&1){ans='1'+ans;}
    else{ans ='0'+ans;}x/=2;}int k = ans.size();while(k < len){ans = '0' + ans;k++;}return ans;}
//-------------------------</STRING>-------------------------------------------------------//
 
ull llrand() {ull r = 0;for(int i = 0; i < 5; ++i){r = (r << 15)|(rand() & 0x7FFF);}return r & 0xFFFFFFFFFFFFFFFFULL;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
 
ll dp[213456][9]; 
 
int valid(vector <char> vec){
    if(vec[0] == 'L' && vec[2] == 'R') return 1;
    if(vec[0] == 'R' && vec[2] == 'L') return 1;
    if(vec[0] == 'R' && vec[1] == 'L') return 1;
    if(vec[1] == 'R' && vec[2] == 'L') return 1;
    return 0;
}
 
char change(char c, int val){
    if(val)
    return c == 'L'? 'R': 'L';
    return c;
}
 
int main(){

   string s;
   cin >> s;
   ll sum = 0;

   for(int i = 0; i < s.size(); i++){
       sum += s[i] - '0';
   }
   if(sum%9 == 0) cout << "Yes";
   else cout << "No";
   
}

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

using namespace std;

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

    bool Ok = true;

    while(n--)
    {
        int x;  scanf("%d", &x);

        if(x % 2 == 0)  Ok &= (x % 3 == 0 || x % 5 == 0);
    }

    puts(Ok ? "APPROVED" : "DENIED");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (true) {
      int m = sc.nextInt();
      int f = sc.nextInt();
      int r = sc.nextInt();
      if (m == -1 && f == -1 && r == -1) {
        break;
      } else {
        if (m == -1 || f == -1) 
          System.out.println("F");
        else if (m + f >= 80) 
          System.out.println("A");
        else if (m + f >= 65 && m + f < 80)
          System.out.println("B");
        else if (m + f >= 50 && m + f < 65)
          System.out.println("C");
        else if (m + f >= 30 && m + f < 50)
          if (r >= 50) 
            System.out.println("C");
          else 
            System.out.println("D");
        else 
          System.out.println("F");
      }
    }
    sc.close();
  }
}


Measured memory_bytes: 26356
#include<iostream>
#include<cstdio>
#include<algorithm>
#define INF 1000000000
using namespace std;

int d[20];
int cost[20][20];
bool done[20];

int N, M, x1, x2, y1, y2;

void dj(int s)
{
  fill(d, d + 20, INF);
  fill(done, done + 20, 0);
  d[s] = 0;
  while(1)
  {
    int v = -1;
    for(int i = 0; i < N; i++)
      if(!done[i] && (v == -1 || d[i] < d[v]))
          v = i;
    if(v == -1)
      break;
    done[v] = 1;
    for(int i = 0; i < N; i++)
      d[i] = min(d[i], d[v] + cost[v][i]);
  }
}

int main()
{
  fill((int*)cost, (int*)cost + 400, 100);
  cin >> N >> M;
  for(int i = 0; i < M; i++)
  {
    int a, b, c, d;
    scanf("%d,%d,%d,%d", &a, &b, &c, &d);
    a--; b--;
    cost[a][b] = c;
    cost[b][a] = d;
  }
  scanf("%d,%d,%d,%d", &x1, &x2, &y1, &y2);
  x1--; x2--;

  int ans = y1 - y2;
  dj(x1);
  ans -= d[x2];
  dj(x2);
  ans -= d[x1];
  cout << ans << endl;
}

Measured memory_bytes: 1244
x, y = gets.split.map(&:to_i)
if y.odd?
  puts 'No'
elsif (y/x > 4) || (y/x < 2)
  puts 'No'
elsif (y/x.to_f == 4) || (y/x.to_f == 2)
  puts 'Yes'
else
  x.times do |i|
    return puts 'Yes' if 4*(x-i-1) + 2*(i+1) == y
  end
  puts 'No'
end

Measured memory_bytes: 14400
s=list(input())
mod=2019
A=[0]*2019
a=0
b=1
for i in range(len(s)):
  a=(a+int(s[-1-i])*b)%mod
  A[a]+=1
  b=b*10%mod
ans=A[0]*(A[0]+1)//2
for i in range(1,2019):
  if A[i]!=0:
    ans=ans+(A[i]-1)*A[i]//2
print(ans)

Measured memory_bytes: 82512
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define elif else if
#define pl(state) cout << state << endl;
int main(){
    int five=0,seven=0;
    for(int i = 0;i < 3;i++){
        int x;
        cin >> x;
        if(x == 5){
            five++;
        }
        elif(x == 7){
            seven++;
        }
    }
    if(five == 2 && seven == 1){
        pl("YES");
    }
    else{
        pl("NO");
    }
    return 0;
}




Measured memory_bytes: 256
if __name__ == "__main__":
    N = int(input())
    for bit in range(0, 1 << 20):
        ans = "0" * 64
        ans = list(ans)
        res = 0

        base = 1
        idx = 0
        tmp_bit = bit
        while (tmp_bit > 0):
            if tmp_bit % 2 != 0:
                res += base
                ans[idx] = '1'
            tmp_bit = tmp_bit >> 1
            base *= 4
            idx += 2
        if N > res:
            continue
        
    
        for x in range(41, 0, -2):
            base = 2 ** x
            base *= -1
            if res + base >= N:
                res += base
                ans[x] = '1'
        if res == N:
            ans = "".join(reversed(ans))
            for i in range(len(ans)):
                if ans[i] == '1':
                    print (ans[i:])
                    exit(0)
            print (0)
            exit(0)

    
            


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

int main() {
    int N; cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; i++) {
        cin >> v.at(i);
        if (i == 0) {}
        else {

            for (int j = 0; j < i; j++) {
                if (v.at(i) == v.at(j)) {
                    v.at(i) = 0;
                    v.at(j) = 0;
                    }
            }
        }
    }

    vector <int> big(N,0);
    for (int i = 0; i < N; i++) {
        int count = 0;
        for (int j = 0; j < N; j++) {
            if (v.at(i) < v.at(j)) count++;
        }
        big.at(count) = v.at(i);
    } //大きい順に並び替え完了

    int ans = 0;

    for (int i = 0; i < N; i++) {
        if ((i % 2) == 0) ans += big.at(i);
        else ans -= big.at(i);
    }

    cout << ans << endl;

}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N;
  cin>>N;
  int CMAX=100/4;
  int DMAX=100/7;
  for(int i=0;i<=CMAX;i++){
    for(int j=0;j<=DMAX;j++){
      if(i*4+j*7==N){cout<<"Yes"<<endl;
      return 0;
      }
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
	int N;
	cin>>N;
	vector<int> T(N,0);
	int i;
	for (i=0;i<N;i++){
		cin>>T[i];
	}
	int M;
	int P,X;
	cin>>M;
	for (i=0;i<M;i++){
		cin>>P>>X;
		int tmp=T[P-1];
		T[P-1]=X;
		int aw=0;
		for (int j=0;j<N;j++){
			aw+=T[j];
		}
		T[P-1]=tmp;
		cout<<aw<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    // string s[]={"AC","WA","TLE","RE"};
    int count[4]={0};
    int n;
    cin>>n;
    string r;
    for(int i=0; i<n; i++){
        cin>>r;
        if(r=="AC")
        count[0]++;
        else if(r=="WA")
        count[1]++;
        else if(r=="TLE")
        count[2]++;
        else if(r=="RE")
        count[3]++;
    }
    cout<<"AC x "<<count[0]<<endl;
    cout<<"WA x "<<count[1]<<endl;
    cout<<"TLE x "<<count[2]<<endl;
    cout<<"RE x "<<count[3]<<endl;
    return 0;
}

Measured memory_bytes: 3624
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

Nums=get_nsp.map(&:to_i)
n=3
sign=array(3)
(2**n).times do|bit|
    sign=array(3)
    n.times do|i|
        unless (bit&(2**i)).zero?
          sign[i]="+"
        else
          sign[i]="-"
        end
    end
    res=Nums[0]
    3.times do|i|
        if sign[i]=="+"
            res+=Nums[i+1]
        else
            res-=Nums[i+1]
        end
    end
    break if res==7
end
ans=""
ans+=Nums[0].to_s
3.times do|i|
    ans+=sign[i]+Nums[i+1].to_s
end
ans+="=7"
puts ans

Measured memory_bytes: 1788
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T& v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  ll n, a, b;in(n),in(a),in(b);
  ll d = a-b;
  vector<ll> H(n);
  loop(i,0,n) in(H[i]);
  
  auto f = [&](ll x, vector<ll> C) {
    loop(i,0,n) C[i] -= x*b;
    loop(i,0,n) {
      if (C[i] > 0) {
        ll y = C[i]/d + (C[i]%d!=0);
        if (y>x) return false;
        x -= y;
        C[i] -= d*y;
      }
    }
    return true;
  };
  
  ll ng = 0, ok = 10000000000;
  while (ng + 1 < ok) {
    ll x  = (ng+ok)/2;
    if (f(x, H)) ok = x;
    else ng = x;
  }
  print(ok);
  return 0;
}


Measured memory_bytes: 4820
using System;



 class Program
 {
     static void Main(string[] args)
     {
         double result;
         double sec,min,hour;
         string nyuryoku;
         nyuryoku = Console.ReadLine();
         result = Double.Parse(nyuryoku);
         sec = result % 60;
         min = (result - sec) / 60;
         result = min % 60;
         hour = (min - result) / 60;
         min = result;

         Console.WriteLine("{0}:{1}:{2}",hour,min,sec);
     }
 }



Measured memory_bytes: 17952
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int _b=(b),i=(a);i<_b;++i)
#define ROF(i, b, a) for(int _a=(a),i=(b);i>_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(), (x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long int ll; typedef pair<int,int> PII;typedef unsigned long long int ull;
typedef vector<int>VI; typedef vector<ll> VL; typedef vector<PII> VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}

int a[204];
int main() {
	IO();
	cint1(N);
	int mx = INT_MIN, mn = INT_MAX, out = INT_MAX;
	FOR(i, 0, N) {
		cin >> a[i];
		if(a[i] > mx) mx = a[i];
		if(a[i] < mn) mn = a[i];
	}
	FOR(i, mn, mx + 1) {
		int ans = 0;
		FOR(j, 0, N) ans += (a[j] - i) * (a[j] - i);
		if (ans < out) {out = ans;}
	}
	cout << out << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9;

signed main(){
  int N; cin >> N;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  vector<int> dp(N, INF);
  for(int i = 0; i < N; i++){
    *lower_bound(dp.begin(), dp.end(), a[i]) = a[i];
  }
  int ans = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
  cout << ans << endl;
}


Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

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

    int ss = s.size(), ts = t.size();
    int dp[ss + 1][ts + 1];
    for(int i = 0; i <= ss; i++)
        for(int j = 0; j <= ts; j++) dp[i][j] = 0;

    for(int i = 0; i < ss; i++) {
        for(int j = 0; j < ts; j++) {
            dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            if(s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
        }
    }

    string ans;
    while(ss > 0 && ts > 0) {
        if(dp[ss][ts] == dp[ss - 1][ts]) {
            ss--;
        } else if(dp[ss][ts] == dp[ss][ts - 1]) {
            ts--;
        } else {
            ans = s[ss - 1] + ans;
            ss--;
            ts--;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 38760
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

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

	LL min = 99999;
	REP(i, 26) {
		LL max = 0;
		LL count = 0;
		REP(j, s.size()) {
			if (s[j] == 'a' + i) {
				count = 0;
			}
			else {
				count++;
				if (count > max) {
					max = count;
				}
			}
		}
		if (max < min) {
			min = max;
		}
	}
	cout << min << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define INFTY 999999


int main(void){
    int N;
    int H, W;

    scanf("%d",&N);
    scanf("%d",&H);
    scanf("%d",&W);

    int a;
    int b;

    int ans=0;
    for(int i=0;i<N;i++){
        scanf("%d",&a);
        scanf("%d",&b);
        if(H<=a && W<=b){
            ans++;
        }
    }

    printf("%d\n",ans);
    
    return 0;
    
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  cin >> n ;
  cout<<(n*n*n)<<endl;
  return 0;
}

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

int main() {
  vector<char> A(4);
  for (int i = 0; i < 4; i++) {
    cin >> A.at(i);
  }
  
  if ((A.at(0) == A.at(1)) ||(A.at(1) == A.at(2))||(A.at(2) == A.at(3))){
    
    cout << "Bad" << endl;
  }
  else if ((A.at(0) != A.at(1)) && (A.at(1) != A.at(2)) && (A.at(2) != A.at(3))){
    cout << "Good" << endl;
  }
}
  
  
 




Measured memory_bytes: 256
/*
Author : Xinyuan
*/
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define INF 1000000007
#define mod 1005
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef long long int  ll;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int nxt() {int x;scanf("%d", &x);return x;}


int main(){
    ll a,b,n;
    cin >> a >> b >> n;
    ll x = 0;
    x = min(n, b-1);
    cout << (a * x ) / b << endl;
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define asort(x) sort(x.begin(),x.end())

int main() {
    int a;
    cin >> a;
    cout << a + a * a + a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
using namespace std;
#define MAX 100000

int parent(int i){ return i / 2;}
int left(int i){ return 2 * i; }
int right(int i){ return 2 * i + 1;}

int main(){
  int H, i, A[MAX+1];

  cin >> H;
  for(i = 1; i <= H; i++) cin >> A[i];

  for(i = 1; i <= H; i++){
    cout << "node " << i << ": key = " << A[i] << ", ";
    if(parent(i) >= 1) cout << "parent key = " << A[parent(i)] << ", ";
    if(left(i) <= H) cout << "left key = " << A[left(i)] << ", ";
    if(right(i) <= H) cout << "right key = " << A[right(i)] << ", ";
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1164
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

class Main {

  public static void main(String[] args) {
    final FastScanner sc = new FastScanner();
    final PrintWriter writer = new PrintWriter(System.out);
    int n = sc.nextInt();
    List<String> song = new ArrayList<>();
    int[] length = new int[n];
    for (int i = 0; i < n; i++) {
      song.add(sc.next());
      length[i] = sc.nextInt();
    }
    String s = sc.next();
    int stop = song.indexOf(s);
    if (stop + 1 == n) {
      writer.println(0);
    } else {
      int total = 0;
      for (int i = stop + 1; i < n; i++) {
        total += length[i];
      }
      writer.println(total);
    }
    writer.flush();
    writer.close();
  }

  // FastScanner --
  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    public FastScanner() {
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

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

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

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

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

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

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

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

Measured memory_bytes: 22612
/* ex3_2
   shu_t */

#include<stdio.h>

int main(void){
  int pencil;
  int ones_place;
  //input the number of pencils
  scanf("%d",&pencil);
  //calculate ones place
  ones_place = pencil % 10;
  if(ones_place == 3){
    //ones place is 3
    printf("bon\n");
  }else if(ones_place == 0||ones_place == 1||ones_place == 6||ones_place == 8){
    //ones palce is 0 or 1 or 6 or 8
    printf("pon\n");
  }else{
    //ones palce is 2 or 4 or 5 or 7 or 9
    printf("hon\n");
  }
  return 0;
}

Measured memory_bytes: 1608
from itertools import combinations as comb

N = int(input())
n = N-1 if N%2 else N
m = N if N%2 else N+1
s = {(i, n+1-i) for i in range(1, N+1) if i<n+1-i}

l = [i for i in comb(range(1, N+1), 2) if not i in s]
print(len(l))
for i in l:
    print(*i)

Measured memory_bytes: 3996
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(n) begin(n),end(n)
using ll = long long;
using P = pair<int,int>;

int main() {
    int n;
    cin >> n;
    vector<int> a(1000005, 0);
    rep(i,n) {
        int b;
        cin >> b;
        a[b]++;
    }
    int ans = 0;
    for(int i = 1; i <= 1000005; i++){
        if(a[i]==1) ans++;
        if(a[i]==0) continue;
        for(int j = i; j <= 1000005; j+=i){
            a[j]=0;
        }
    }
    cout <<  ans << endl;
    return 0;
}

Measured memory_bytes: 7224
import java.io.InputStream;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		InputStream is = System.in;
		Scanner sc = new Scanner(is);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();
		sc.close();

		long d = a;
//		a = a-c;
		a = Math.max(0,a-c);
//		if(a<0) { a = 0; }
		c = c-d;
		if(c>0) { b = b-c; }
		if(b<0) { b = 0; }
		System.out.println(a+" "+b);
	}
}


Measured memory_bytes: 21844
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
using namespace std;
const double pi = acos(-1.0);
int main()
{
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	double tb=m*6;
	double ta=h*30+1.0*m/2;
	double t=abs(ta-tb);
	t=t*pi/180;
	double c=sqrt(a*a+b*b-2*a*b*cos(t));
	printf("%.20lf",c);
	return 0;
}

Measured memory_bytes: 4192
#include <iostream>
using namespace std;int main(){int s,i,p[10]={1,9,36,84,126,126,84,36,9,1};double t;char c[11];for(;cin>>c;cout<<s%10<<endl)for(s=0,i=10;i--;)s+=(c[i]-'0')*p[i];}

Measured memory_bytes: 1136
#include<bits/stdc++.h>
#define INF 0x3f3f3f3f 
using namespace std;
const int maxn = 11111;
int n, m;
struct edge
{
	int v, cost;
	edge(int _v=0,int _cost=0):v(_v),cost(_cost){}
};
vector<edge> g[maxn];
bool book[maxn];
int dis[maxn];
void myinit()
{
	memset(book, 0, sizeof(book));
	for (int i = 0; i < maxn; i++)
	{
		g[i].clear();
	}
	fill(dis, dis + maxn,INF);
}
void SPFA(int s)
{
	queue<int> q;
	q.push(s);
	book[s] = 1;//加入队列并标记 
	while (!q.empty())
	{
		int temp = q.front();
		q.pop();
		book[temp] = 0;//弹出队列并取消标记 
		for (int i = 0; i < g[temp].size(); i++)
		{
			if (g[temp][i].cost + dis[temp] < dis[g[temp][i].v])//比较 
			{
				dis[g[temp][i].v] = g[temp][i].cost + dis[temp];//更新路径 
				if (!book[g[temp][i].v])//若该点不在队列 
				{
					q.push(g[temp][i].v);
					book[g[temp][i].v] = 1;
				}
			}
		}
	}
}
void addedge(int u, int v, int w)
{
	g[u].push_back(edge(v, w));
}
int main()

{
	cin >> n;
	m = 0;
	myinit();
	for (int i = 0;i < n;i++)
	{
		int ve, en, co;
		int k;
		cin >> ve >> k;
		for (int j = 0;j < k;j++)
		{
			cin >> en >> co;
			addedge(ve, en, co);
		}
	}
	dis[0] = 0;
	SPFA(0);
	for (int i = 0;i < n;i++)
		cout << i << " " << dis[i] << endl;
	return 0;
}


Measured memory_bytes: 3396
program atcoder
    implicit none
    integer(8) :: N,Q,k,i,j,ans,D,M,DM,qq
    integer(8),allocatable,dimension(:) :: a
    character(1000007) S
    read(*,*)N,S,Q
    allocate( a(Q) )
    read(*,*)(a(i),i=1,Q)
    do qq = 1,Q
        k = a(qq)
        ans = 0
        D = 0
        M = 0
        DM = 0
        do i = 1,k
            if(S(i:i)=='D')then
                D = D+1
            else if(S(i:i)=='M')then
                M = M+1
                DM = DM + D
            else if(S(i:i)=='C')then
                ans = ans + DM
            endif
        enddo
        do i = k+1,N
            if(S(i-K:i-K)=='D')then
                D = D-1
                DM = DM-M
            else if(S(i-K:i-K)=='M')then
                M = M-1
            end if
            if(S(i:i)=='D')then
                D = D + 1
            else if(S(i:i)=='M')then
                M = M+1
                DM = DM+D
            else if(S(i:i)=='C')then
                ans = ans + DM
            endif
        enddo
        write(*,'(I0)')ans
    end do
end program atcoder

Measured memory_bytes: 3516
import java.util.*;
 
class Main{
	public static void main(String[] args){
      String answer = "";
		Scanner scan = new Scanner(System.in);
      	String s = scan.next();
      	 int l = s.length();
     	 String[] moji = new String[l];
      for(int i = 0;i < l;i++){
        moji[i]=String.valueOf(s.charAt(i));
	}
      for(String moj : moji){
        boolean is0 = moj.equals("0");
        boolean is1 = moj.equals("1");
        boolean isB = moj.equals("B");
        boolean isAns0 = answer.length()==0;
        
        if(is0){
          answer += "0";
        }else if(is1){
          answer += "1";
        }else if(isB && !isAns0){
          String t = answer;
          answer = answer.substring(0,t.length()-1);
        }
      }
        System.out.println(answer);
}
}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <set>
#include <cmath>
#include <unordered_map>
#include <algorithm>
#include <stack>
#include <unordered_set>
using namespace std;

int main () {
	
	int x, y, z, k;
	cin >> x >> y >> z >> k;
	vector<long long int> a, b, c;
	long long int temp;
	for (int i = 0; i < x; i++) {
		cin >> temp;
		a.push_back(temp);
	}
	for (int i = 0; i < y; i++) {
		cin >> temp;
		b.push_back(temp);
	}
	for (int i = 0; i < z; i++) {
		cin >> temp;
		c.push_back(temp);
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	unordered_set<string> us;
	priority_queue<pair<long long int, pair<int, pair<int, int> > > > pq;
	pq.push(make_pair(a[a.size() - 1] + b[b.size() - 1] + c[c.size() - 1], make_pair(a.size() - 1, make_pair(b.size() - 1, c.size() - 1))));
	for (int i = 0; i < k; i++) {
		auto t = pq.top();
		pq.pop();
		int p1 = t.second.first;
		int p2 = t.second.second.first;
		int p3 = t.second.second.second;
		string s = to_string(p1 - 1) + " " + to_string(p2) + " " + to_string(p3);
		if (p1 > 0 && us.find(s) == us.end()) {
			us.insert(s);
			pq.push(make_pair(a[p1 - 1] + b[p2] + c[p3], make_pair(p1 - 1, make_pair(p2, p3))));
		}
		s = to_string(p1) + " " + to_string(p2 - 1) + " " + to_string(p3);
		if (p2 > 0 && us.find(s) == us.end()) {
			us.insert(s);
			pq.push(make_pair(a[p1] + b[p2 - 1] + c[p3], make_pair(p1, make_pair(p2 - 1, p3))));
		}
		s = to_string(p1) + " " + to_string(p2) + " " + to_string(p3 - 1);
		if (p3 > 0 && us.find(s) == us.end()) {
			us.insert(s);
			pq.push(make_pair(a[p1] + b[p2] + c[p3 - 1], make_pair(p1, make_pair(p2, p3 - 1))));
		}
		cout << t.first << endl;
	}

}

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

int main() {
  int k;
  cin >> k;
  rep(i,k) cout << "ACL";
  cout << endl;
  return 0;
}

Measured memory_bytes: 3632
N, M = map(int, input().split())
LR_list = []
for i in range(M):
    L, R = map(int, input().split())
    LR_list.append([L, R])

L = 1
R = N
for LR in LR_list:
    if LR[0] > L:
        L = LR[0]
    if LR[1] < R:
        R = LR[1]
output = 0
if L <= R:
    output = R - L + 1
print (output)


Measured memory_bytes: 19600
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    long long n;
    long long a;
    long long b;
    long long ans=0;
    long long tmpa=0;
    long long tmpb=0;
    
    cin >> n >> a >> b;
    
    if((b-a)%2==0){
        
        ans = (b-a) / 2;
        
    } else {
        
        ans = min(n-a, b-1);
        tmpa = min(a-1, n-b);
        tmpb = ((b-a)+tmpa*2+1) / 2;
        ans = min(ans, tmpb);
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}

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

#define MAX_N 100000

int a[MAX_N];
priority_queue <int> edge;

int main(void)
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
        if (a[i] == a[i + 1]) {
            edge.push(a[i]);
            i++;
        }
    }
    int64_t ans = edge.size() >= 2;
    for (int i = 0; i < 2; i++) {
        if (edge.empty()) break;
        ans *= edge.top();
        edge.pop();
    }
    printf("%lld\n", ans);
    return 0;
}


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

int main()
{
    ll n, ans = 0;

    cin >> n;

    if(n % 2 == 1 || n < 10){
        cout << 0 << endl;
        return 0;
    }

    ll a = 5;

    while((n / a) > 0){
        ll b = (n / a) - 1;
        ans += (b + 1) / 2;

        //if(b % 2 == 1) ans++;

        a *= 5;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){



   int n ,m;
   cin>>n>>m;
   
   
   string  s;
   cin>>s;
   
   
  vector  < int > arr;
  for( int i=0 ; i < s.length(); i ++){
	  if(s[i]=='0')
	  arr.pb(i);
  }
  
  reverse(all(arr));
  if(s[0]=='1' || s[s.length() -1 ]== '1')
  {
	  cout<<-1;
	  return 0 ;
   }
   
   int sz = arr.size();
   for(int i =0 ; i < sz-1; i++){
	   
	   if( arr[i]-arr[i+1] > m){
		   cout<<-1<<endl;
		   return 0 ;
	   }
	   
   }
   
   int r = n ;
   vector< int >ans ;
   
   
   for( int i=0  ;i  < sz; i ++  ){
	   
	   while( r -arr[i] <= m && i <sz){
		   
		   i++;
	   }
	   
	   
	   i--;
	   ans.pb(r-arr[i]);
	   r=arr[i];
	   
	   
	   
	   
	   
   } 
 
 reverse(all (ans));
 
 
 for(auto it : ans ) 
 cout<<it << " ";   
   



return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    int K;
    cin >> K >> S;
    if(K >= S.size())cout << S << endl;
    else{
        for(int i = 0; i < K; i++){
            cout << S[i];
        }
        cout << "..." << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3624
// Last Change: 04/12/2020 21:01:28.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

int main() {
  string N;
  cin >> N;
  for (auto &&e : N) {
    if (e == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3036
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cmath>
#include <numeric>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <unordered_map>
#include <tuple>
#include <complex>


#define FOR(i, a, b)		for(int i = (int)(a); i < (int)(b); ++i)
#define FORE(i, a, b)		for(int i = (int)(a); i <= (int)(b); ++i)
#define REP(i, n)			FOR(i, 0, n)
#define REPE(i, n)			FORE(i, 0, n)
#define ALL(x)				(x).begin(),(x).end()
#define DEBUG_DC(x)			cout << #x << ": " << x << endl
#define VEC_TYPE			int	
#define INF					1e5+1

using namespace std;
typedef long long ll;
typedef vector<VEC_TYPE> vdef;
typedef vector<vdef> vvdef;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmaxE(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; }
template<class T> inline bool chminE(T& a, T b) { if (a >= b) { a = b; return 1; } return 0; }
template<typename T>inline T mygcd(T a, T b) { return b ? mygcd(b, a%b) : a; }
template<typename T>inline T mylcm(T a, T b) { return a * b / mygcd(a, b); }

int main()
{
	int n;
	cin >> n;
	int ans = (n - 2) * 180;


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

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

// clang-format off
template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); }
template <typename T> T lcm(T a, T b) { return a * b / gcd(a, b); }
template <typename T> T clamp(T val, T min, T max) { return val < min ? min : (max < val ? max : val); }
char capitalize(char c) { return static_cast<char>(std::toupper(static_cast<unsigned char>(c))); }
// template <typename T> size_t max_index(T begin, T end) { return distance(begin, max_element(begin, end)); }
// template <typename T> size_t min_index(T begin, T end) { return distance(begin, min_element(begin, end)); }
// clang-format on

// #define int long long
#define YES "YES"
#define NO  "NO"

using namespace std;

signed main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  int num = 0;
  // num = numeric_limits<int>::max();
  // num = numeric_limits<int>::min();
  bool flag = false;
  // flag = true;

  int x; cin >> x;
  if (x < 1200) cout << "ABC";
  else cout << "ARC";
  
  // cout << num << endl;
  // cout << (flag ? "H" : "D") << endl;
  
  return 0;
}


Measured memory_bytes: 256
from collections import Counter
S = list(reversed(input()))
l = len(S)
N = 0
counts = Counter([(N := N + (pow(10, i, 2019) * int(S[i])) % 2019) % 2019 for i in range(l)] + [0])
print(sum(n * (n - 1) // 2 for n in counts.values()))


Measured memory_bytes: 19868
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }

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

#include <set>
using namespace std;

int main(){
  int cnt[4] = {0, 0, 0, 0};
  REP(i,3){
    cnt[getInt() - 1]++;
    cnt[getInt() - 1]++;
  }
  REP(i,4) if(cnt[i] == 0 || cnt[i] == 3){
    puts("NO");
    return 0;
  }
  puts("YES");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int a[99],n;bool po=1,ne=1;
main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		po&=a[i]>=0;
		ne&=a[i]<=0;
	}
	cout<<(po||ne?n-1:2*n-2)<<endl;
	if(!po&&!ne)
	{
		int M=0,m=0,pi,ni;
		for(int i=0;i<n;i++)
		{
			if(M<=a[i])M=a[i],pi=i;
			else if(m>=a[i])m=a[i],ni=i;
		}
		if(M>-m)
		{
			for(int i=0;i<n;i++)if(pi!=i)cout<<pi+1<<" "<<i+1<<endl;
			po=1;
		}
		else
		{
			for(int i=0;i<n;i++)if(ni!=i)cout<<ni+1<<" "<<i+1<<endl;
			ne=1;
		}
	}
	if(po)
	{
		for(int i=1;i<n;i++)cout<<i<<" "<<i+1<<endl;
	}
	else if(ne)
	{
		for(int i=n;i>1;i--)cout<<i<<" "<<i-1<<endl;
	}
}

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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            Console.Write(input.Replace(",", " "));
        }
    }
}


Measured memory_bytes: 13140
//int a = s - '0'; 文字から数字
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;

//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

ll RS(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RS(N, P / 2, M);
		return t * t % M;
	}
	return N * RS(N, P - 1, M);
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main() {
	double d, t, s;cin >> d >> t >> s;
	if(d/s <= t) cout <<"Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 10992
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
	int n, a, b;
	cin >> n >> a >> b;
	cout << min(n * a, b) << endl;
	return 0;
}

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

// template {{{
/* vim: set foldmethod=marker: */

// constant
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
const double PI = acos(-1);
#define EPS 1e-14

// typedef
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

// input
inline int inputi(){ int x; scanf("%d", &x); return x; }
inline double inputd(){ double x; scanf("%lf", &x); return x; }
inline string inputs(){ string x; cin >> x; return x; }

// short
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define REPit(type, i, obj) for (type::iterator i = (obj).begin(); i != (obj).end(); i++)
#define RREPit(type, i, obj) for (type::iterator i = (obj).rbegin(); i != (obj).rend(); i++)

// container util
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define sz(obj) ((int)(obj).size())
#define sort(obj) sort(all(obj))
#define exist(obj, key) ((obj).find(key) != (obj).end())
#define clear(array) memset((array), 0, sizeof(array))

// print util
#define print(x) cout << (x) << endl
template <class T> inline void printall(vector<T> v){ REP(i, sz(v)) cout << v[i] << "\n "[i < sz(v) - 1]; }
#define dump(x) cerr << #x << ": " << (x) << endl
#define debug(x) cerr << #x << ": " << (x) << " (" << __LINE__ << ")" << endl

//template }}}

int main()
{
    int a, b;
    int dp[16][16];

    while (a = inputi(), b = inputi(), a || b){
        REP(i, a) REP(j, b) dp[i][j] = -1;

        int n = inputi();
        REP(i, n){
            int x = inputi(), y = inputi();
            dp[x - 1][y - 1] = 0;
        }

        bool flag = true;
        REP(i, a){
            if (dp[i][0] == 0) flag = false;
            dp[i][0] = flag;
        }
        flag = true;
        REP(j, b){
            if (dp[0][j] == 0) flag = false;
            dp[0][j] = flag;
        }

        FOR(i, 1, a){
            FOR(j, 1, b){
                if (dp[i][j] == -1){
                    dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                }
            }
        }
        print(dp[a - 1][b - 1]);
    }

    return 0;
}

Measured memory_bytes: 1208