akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int mod = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct Edge{
    ll to, weight;
    Edge(ll t, ll w) : to(t), weight(w){}
};
using graph = vector<vector<ll>>;
using Graph = vector<vector<Edge>>;


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

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

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    string s;
    cin>>s;
    ll k;
    cin>>k;
    ll ans = s[0]-'0';
    for(ll i=0;i<k;++i){
        ll flag = s[i]-'0';
        if(s[i] != '1'){
            ans = flag;
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
while True:
    a, op, b = input().split()   # 3変数ともに文字列として読み込む
    a =int(a)                   # a を整数に変換
    b = int(b)                   # b を整数に変換


    if op=="?": # opが"?"の時は終了
        break
    else: 
        if op=="+":
            print(a + b)
        if  op=="-":
            print(a - b)
        if op=="*":
            print(a * b)
        if op=="/":
            print(a // b)


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

int max(int a,int b){
    if(a>b){
        return a;
    }
    return b;
}


int main() {
int n;
long long x=1,y=1;
cin>>n;
for(int i=0;i<n;i++){

    int t,a;
    cin>>t>>a;
    long long z=max(x/t,y/a);
    while(t*z<x||a*z<y){
        z++;
    }
    x=t*z;
    y=a*z;
    
}
cout<<x+y<<endl;





	return 0;
}

Measured memory_bytes: 256
//?????¢??????????????????
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	int H,W;
	cin >> H >> W;
	
	int DP[2][W];
	int Max=0;
	int tmp;
	
	for (int j=0;j<W;j++){
		cin >> tmp;
		DP[0][j]=1-tmp;
		Max=max(Max,DP[0][j]);
	}
	
	int row=1;
	
	for(int i=1;i<H;i++){
		cin >>tmp;
		DP[row][0]=1-tmp;
		Max=max(Max,DP[row][0]);
		for(int j=1;j<W;j++){
			cin >> tmp;
			if(tmp==0){
				DP[row][j]=min(min(DP[1-row][j],DP[row][j-1]),DP[1-row][j-1])+1;
				Max=max(Max,DP[row][j]);
			}else{
				DP[row][j]=0;
			}
		}
		row=1-row;
	}
	
	cout << Max*Max << endl;
	return 0;
}

Measured memory_bytes: 1168
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, A, B; cin >> N >> A >> B;
  int result;
  for (int i=1; i<=N; i++) {
    int dig = 0, tmp = i;
    while(tmp!=0) { dig+= tmp%10; tmp/=10; }
    if (dig>=A && dig<=B) result+=i;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;

public class Main {
    // field

    // method
    public static void main(String[] args) {
	//System.out.print("> ");
	java.util.Scanner scan = new java.util.Scanner(System.in);
	int arraySize = scan.nextInt();
	String[] input = new String[arraySize];
	int[] array = new int[arraySize];
	//System.out.print("> ");
	for (int i = 0; i < arraySize; i++){
	    array[i] = scan.nextInt();
	}
	
	BubbleSort bs = new BubbleSort(array.clone()); // バブルソート
	bs.bubbleSort(); // ソート
	bs.display();    // 表示
	System.out.println(bs.getCount());
    }
}
class BubbleSort {
    // -- field
    private int[] sort_array;
    protected int Count;
    
    
    // -- Constructor
    private BubbleSort() {}
    public BubbleSort(int[] sort_array) {
	this.sort_array = sort_array;
    }
    
    // -- Method
    public void display() {
	for (int i = 0; i < this.sort_array.length; i++) {
	    System.out.print(this.sort_array[i]);
	    if(i == this.sort_array.length-1) {
		break;
	    }
	    System.out.print(" ");
	}
	System.out.println();
    }

    public void swap(int x, int y) {
	int temp = this.sort_array[x];
	this.sort_array[x] = this.sort_array[y];
	this.sort_array[y] = temp;
    }

    public void bubbleSort() {
	for (int i = this.sort_array.length - 1; i > 0; i--) {
	    for (int j = 0; j < i; j++) {
		if (this.sort_array[j] > this.sort_array[j + 1]) {
		    swap(j, j + 1);
		    this.Count++;
		}
	    }
	}
    }

    public int getCount() {
    return this.Count;
    }
}



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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	int PA=0,PB=0;
	REP(i,N){
		string S=in<string>(),T=in<string>();
		if(S<T) PB+=3;
		else if(S>T) PA+=3;
		else{
			PA++;
			PB++;
		}
	}
	out(PA,PB);
	return 0;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   ll n,W;
   cin>>n>>W;
   ll v[n],w[n];
   for(ll i=0;i<n;i++)
   cin>>w[i]>>v[i];
   ll dp[n+1][W+1];
   for(ll i=0;i<=W;i++) dp[0][i] = 0;
   for(ll i=0;i<=n;i++) dp[i][0] =0;
   for(ll i=1;i<=n;i++)
   {
   	 for(ll j=1;j<=W;j++)
		{
			if(w[i-1]>j)
			dp[i][j] = dp[i-1][j];
			else
			 dp[i][j] = max(dp[i-1][j-w[i-1]]+v[i-1],dp[i-1][j]);
		 } 
   }
   cout<<dp[n][W]<<endl;
   return 0;	
}

Measured memory_bytes: 79104
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}

func Solve() {
  var a, b, c int
  NextInt(&a, &b, &c)
  d := 4 * a * b
  led, gtd := 1, 4 * MaxInt(a, b)
  for 1 < gtd - led {
    med := (gtd + led) / 2
    if d < med * med {
      gtd = med
    } else {
      led = med
    }
  }
  ans := "Yes"
  if c <= a + b + led { ans = "No" }
  Write(ans)
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	int n;
	cin >> n;
	long long int a[300002] = {};
	for(int i = 1; i <= 3 * n; i++){
		cin >> a[i];
	}
	long long int maxsum_from0[300002] = {};
	// maxsum_from0[i] : a[i]番目まででn個選んだ時の和の最大値
	priority_queue<long long int> qu;
	for(int i = 1; i <= 2 * n; i++){
		qu.push(-a[i]);
		long long int tmp = 0;
		if(qu.size() > n){
			tmp = qu.top();
			qu.pop();
		}
		maxsum_from0[i] = maxsum_from0[i - 1] + a[i] + tmp;
	}
	long long int minsum_from3n[300002] = {};
	qu = priority_queue<long long int>();
	for(int i = 3 * n; i > n; i--){
		qu.push(a[i]);
		long long int tmp = 0;
		if(qu.size() > n){
			tmp = qu.top();
			qu.pop();
		}
		minsum_from3n[i] = minsum_from3n[i + 1] + a[i] - tmp;
	}
	long long int ans = -(long long int)mod * 100000;
	for(int i = n; i <= 2 * n; i++){
		ans = max(ans, maxsum_from0[i] - minsum_from3n[i + 1]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9076
N = int(input())
x= [""]*(N+1)
u= [""]*(N+1)

for i in range(N):
  x[i],u[i] = input().split()

sum = 0
for i in range(N):
  sum += float(x[i]) if u[i] == "JPY" else float(x[i])*380000.0

  
print(sum)

Measured memory_bytes: 3064
N = int(input())

t, a = map(int, input().split())

for i in range(N - 1):
    nt, na = map(int, input().split())
    p = max(t // nt, a // na)
    pt = nt * p
    pa = na * p
    while pt < t or pa < a:
        pt += nt
        pa += na
    t = pt
    a = pa
print(t + a)


Measured memory_bytes: 38768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder s = new StringBuilder(sc.next());
		int n=s.length()-1;
		long sum=0;
		for(int i=0;i<Math.pow(2, n);i++) {
			int[] status = new int[n];
			int b=0;
			for(int j=0;j<n;j++) {//iを2進数にした場合にどこの桁が1になっているか判定し、1の場合はstatusに代入
				if((1&i>>j)==1) {
					status[j]=1;
				}
			}
			for(int j=0;j<n;j++) {
				if(status[j]==1) {
					sum+=Long.valueOf(s.substring(b, j+1));
					//System.out.println(s.substring(b, j+1));
					b=j+1;
				}
			}
			sum+=Long.valueOf(s.substring(b, n+1));
			//System.out.println("last:"+s.substring(b, n+1));
		}
		System.out.println(sum);

	}
}



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

const int LEN = 100005;
typedef struct {
    string name;
    int time;
} P;

P Q[LEN];
int head, tail, n, q;

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

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

int main() {
    int t = 0;
    cin >> n >> q;
    for (int i = 0; i < n; ++i) cin >> Q[i].name >> Q[i].time;

    head = 0;
    tail = n;

    while (head != tail) {
        P p = dequeue();
        if (p.time > q) {
            t += q;
            p.time -= q;
            enqueue(p);
        } else {
            t += p.time; 
            cout << p.name << " " << t << endl;
        }
    }
}


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

const int INF = (1 << 31) - 1;

struct segtree{
  int size;
  vector<int> dat,lazy;
  segtree(int n){
    size = 1;
    while(size<n) size *= 2;
    dat.assign(2*size-1,INF);
    lazy.assign(2*size-1,-1);
  }
  void lazy_evaluate(int k){
    if(lazy[k]<0) return;
    dat[k] = lazy[k];
    if(k<size-1){
      lazy[2*k+1] = lazy[k];
      lazy[2*k+2] = lazy[k];
    }
    lazy[k] = -1;
  }
  void update(int a,int b,int x,int k,int l,int r){
    lazy_evaluate(k);
    if(b<=l||r<=a) return;
    if(a<=l&&r<=b){
      lazy[k] = x;
      lazy_evaluate(k);
      return;
    }
    update(a,b,x,2*k+1,l,(l+r)/2);
    update(a,b,x,2*k+2,(l+r)/2,r);
    dat[k] = min(dat[2*k+1],dat[2*k+2]);
    return;
  }
  int query(int a,int b,int k,int l,int r){
    lazy_evaluate(k);
    if(b<=l||r<=a) return INF;
    else if(a<=l&&r<=b) return dat[k];
    else return min(query(a,b,2*k+1,l,(l+r)/2),query(a,b,2*k+2,(l+r)/2,r));
  }
};

int main(){
  int n,q;
  scanf("%d %d",&n,&q);
  segtree st(n);
  for(int i=0;i<q;i++){
    int cmd;
    scanf("%d",&cmd);
    if(cmd==0){
      int s,t,x;
      scanf("%d %d %d",&s,&t,&x);
      st.update(s,t+1,x,0,0,st.size);
    }else{
      int s,t;
      scanf("%d %d",&s,&t);
      printf("%d\n",st.query(s,t+1,0,0,st.size));
    }
  }
  return 0;
}

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

fn main() {
    let (aa, bb, cc) = get!(String, String, String);
    let a = aa.chars().collect::<Vec<char>>();
    let b = bb.chars().collect::<Vec<char>>();
    let c = cc.chars().collect::<Vec<char>>();
    if a.last() == b.first() && b.last() == c.first() {
        println!("YES");
    } else {
        println!("NO");
    }
}

Measured memory_bytes: 4352
L = input()
N = len(L)
MOD = 10**9 + 7

dpAll = [0] * (N + 1)
dpLess = [0] * (N + 1)

dpAll[0] = 1
dpLess[0] = 1

for d, b in enumerate(L[:: -1], start=1):
    dpAll[d] = dpAll[d - 1] * 3
    if b == '1':
        dpLess[d] = dpLess[d - 1] * 2 + dpAll[d - 1]
    else:
        dpLess[d] = dpLess[d - 1]
    dpAll[d] %= MOD
    dpLess[d] %= MOD

print(dpLess[N] % MOD)

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000ll
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,m;
	cin>>n>>m;
	string s;
	cin>>s;
	vector<set<ll>> g(n);
	vector<P> cnt(n,P(0,0));
	REP(i,m) {
		ll a,b;
		cin>>a>>b;
		a--;
		b--;
		if(a==b) {
			if(s[a]=='A') cnt[a].first++;
			else cnt[a].second++;
		} else {
			if(g[a].count(b)==0) {
				if(s[b]=='A') cnt[a].first++;
				else cnt[a].second++;
				g[a].insert(b);
			}
			if(g[b].count(a)==0) {
				if(s[a]=='A') cnt[b].first++;
				else cnt[b].second++;
				g[b].insert(a);
			}
		}
	}
	queue<ll> q;
	REP(i,n) {
		if(cnt[i].first==0||cnt[i].second==0) {
			q.push(i);
		}
	}
	vector<ll> used(n,true);
	while(!q.empty()) {
		ll p=q.front();
		q.pop();
		used[p]=false;
		for(auto x: g[p]) {
			g[x].erase(p);
			if(s[p]=='A') {
				cnt[x].first--;
				if(cnt[x].first==0) q.push(x);
			} else {
				cnt[x].second--;
				if(cnt[x].second==0) q.push(x);
			}
		}
	}
	bool ans=false;
	REP(i,n) {
		if(used[i]) {
			for(auto x: g[i]) {
				if(s[i]!=s[x]) ans=true;
			}
		}
	}
	if(ans) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 32592
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

void _main() {
  int N;
  cin >> N;

  int ans = 0;
  for (int i=N; i!=0; i/=10) {
    if (2 == i%10) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
int a, b, c;
int main() {
    DAU
    cin >> a >> b >> c;
    if (a + b + c >= 22)
        cout << "bust";
    else cout << "win";
    PLEC
}


Measured memory_bytes: 3616
function main(input) {
    let count = 0;
    const lines = input.split('\n');
    let freebie = {};
    for(let i = 1; i <= Number(lines[0]); i++){
        if(!(freebie[lines[i]])){
            freebie[lines[i]] = 0;
            count++;
        }
        freebie[lines[i]]++;
    }
    console.log(String(count));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 80184
word=gets.chomp
count=0
while true do
  l=gets.chomp
  if l=="END_OF_TEXT" then
    break
  end
  line=l.split
  for i in 0..line.length-1 do
    if word.downcase==line[i].downcase then
      count=count+1
    end
  end  
end
puts count

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

int main()
{
    ll N;
    cin >> N;
    ll A[N];
    REP(i, N) cin >> A[i];

    bool ret = true;
    REP(i, N) if (A[i]%2 != 0) { ret = false; break; }

    cout << (ret ? "second" : "first") << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong n,m,q,a[100],b[100],c[100],d[100],x[100],ans=0;
    cin >> n >> m >> q;
    for(int i=1;i<=q;i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
    for(x[1]=1;x[1]<=m;x[1]++){
        for(x[2]=x[1];x[2]<=m;x[2]++){
            for(x[3]=x[2];x[3]<=m;x[3]++){
                for(x[4]=x[3];x[4]<=m;x[4]++){
                    for(x[5]=x[4];x[5]<=m;x[5]++){
                        for(x[6]=x[5];x[6]<=m;x[6]++){
                            for(x[7]=x[6];x[7]<=m;x[7]++){
                                for(x[8]=x[7];x[8]<=m;x[8]++){
                                    for(x[9]=x[8];x[9]<=m;x[9]++){
                                        for(x[10]=x[9];x[10]<=m;x[10]++){
                                            llong sum = 0;
                                            for(llong i=1;i<=q;i++){
                                                if(x[b[i]]-x[a[i]] == c[i]) sum+=d[i];
                                            }
                                            ans = max(ans,sum);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3612
n,m =map(int,input().split())
s = []
e = []
for i in range(m):
    a,b = map(int,input().split())
    if a ==1:
        s.append(b)
    if b == n:
        e.append(a)
if set(s)&set(e):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 21836
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T>
inline bool chmax(T &a, T b) {if (a < b) {a = b; return true;} return false;}
template <class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) { return (a * b) / GCD(a, b);}

int main(){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> v(n, vector<int>(m));
    rep(i,n){
        cin >> c[i];
        rep(j, m) cin >> v[i][j];
    }
    int min = INF;
    for (int i = 0; i < (1 << n); i++){
        int csum = 0;
        vector<int> sum(m, 0);
        for (int j = 0; j < n;j++){
            if (i & (1<<j)){
                csum += c[j];
                for (int k = 0; k < m; k++){
                    sum[k] += v[j][k];
                }
            }
        }
        bool flag = true;
        rep(i,m){
            if (sum[i] < x)
                flag = false;
        }
        if(flag){
            chmin(min, csum);
        }
    }
    if(min==INF){
        cout << -1 << endl;
    }
    else
    {
        cout << min << endl;
    }
    
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 163577857;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
ll mpow(ll a, ll b){
	if(a==0) return 0;
	if(b >= (MOD-1)) b %= (MOD-1);
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}
 
ll mpow(ll a, ll b, ll p){
	if(a==0) return 0;
	if(b==0) return 1;
	ll t1 = mpow(a,b/2,p);
	t1 *= t1;
	t1 %= p;
	if(b%2) t1 *= a;
	t1 %= p;
	return t1;
}
 
ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}
 
ll range(ll l, ll r){
	return l + rand()%(r-l+1);
}
 
ll rev(ll v){
	return mpow(v,MOD-2);
}

void solve(){
	
}
 
int main()
{
	fast_cin();
    string s;
    cin >> s;
    cout << ((s == "ABC") ? "ARC" : "ABC");
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>



int descending_compare(const void *a, const void *b){
    if (*(int*)a > *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}

int ascending_compare(const void *a, const void *b){
    if (*(int*)a < *(int*)b){
        return -1;
    }else if (*(int*)a == *(int*)b){
        return 0;
    }else{
        return 1;
    }
}


int lower_bound(int *a, int n, int key){
    int left, mid, right;
    left = 0, right = n;
    mid = (left + right)/2;
    while ((left+1 != mid || mid+1 != right) && mid != left){
        if (key > a[mid]){
            left = mid;
        }else{
            right = mid+1;
        }
        mid = (left + right)/2;
    }
    if (a[left] >= key)return left;
    if (a[mid] >= key)return mid;
    if (a[right] >= key)return right;
    return n;
}

unsigned long  gcd(unsigned long x, unsigned long y)
{
        if (y == 0) {
                return x;
        } else {
                return gcd(y, x % y);
        }
}

long long factorial(int x){
    long long rtn = 1;
    int i;
    for (i = x; i > 1; i--){
        rtn = (rtn*i);
    }
    return rtn;
}




int main(void){
    int price[4];
    long long n;
    unsigned long long min = (unsigned long long)10000000000000000;
    int mini;
    unsigned long long ans = 0;
    for (int i = 0; i < 4; i++){
        scanf("%d", &price[i]);
    }
    scanf("%lld", &n);
    n *= 4;
    for (int i = 0; i < 3; i++){
        if (min > price[i]*(int)pow(2, 3-i)){
            min = (unsigned long long)price[i]*(int)pow(2, 3-i);
            mini = i;
        }
    }
    if (min > price[3]){
        ans = (unsigned long long)n/8*price[3]+(n%8)/(int)pow(2, mini)*price[mini];
    }else{
        ans = (unsigned long long)n/(int)pow(2, mini)*price[mini];
    }

    printf("%llu\n", ans);

    return 0;
}


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

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> l(n);
	for(auto& x:l){
		cin >> x;
	}
	sort(l.begin(), l.end());
	int sum = 0;
	for(int i = n-1; i>=(n-k); i--){
		sum += l.at(i);
	}
	cout << sum << endl;
}


Measured memory_bytes: 384
#include<iostream>

int main()
{
    int N,X,T = 0;
    int i = 1;
    int hasu,josan =0;

    std::cin >> N >> X >> T;
    
    josan = N / X;

    if( 0 < N % X )
    {
        josan++;       
    }    

    std::cout << T*josan;

    return 0;
}

Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.ExceptionServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = ReadLongs();
            var a = x[0];
            var b = x[1];
            var c = x[2];
            var d = x[3];

            var max = long.MinValue;
            max = Max(max, a * c);
            max = Max(max, a * d);
            max = Max(max, b * c);
            max = Max(max, b * d);

            WriteLine(max);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27540
#include<stdio.h>
int main(){
	int a,b,c,d,i;
	d=0;
	scanf("%d%d%d",&a,&b,&c);
for(i=a;i<=b;i++){
	

	if(c%i==0)
	{
		d++;
	}
	
	
}
printf("%d\n",d);

return 0;

}

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

int main(){
  char c;
  cin>>c;
  
  if(c=='a'||c=='i'||c=='u'||c=='e'||c=='o'){
    cout<<"vowel"<<endl;
  }
  else{
    cout<<"consonant"<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ld long double
#define mem(a,b) memset(a,b,sizeof(a) )
#define M 4000010
#define md 1000000007

ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}
//inline ll add(ll a,ll b){return (a+b)%md;}
//inline ll mul(ll a,ll b){return (a*b)%md;}
//ll f[M],iv[M];
//ll C(ll n,ll r){return mul(f[n],mul(iv[r],iv[n-r]));}
//void prep_fac(){
//    f[0]=1;
//    rep(i,1,M)f[i]=mul(i,f[i-1]);
//    iv[M-1]=power(f[M-1],md-2,md);
//    for(ll i=M-2;i>=0;--i)iv[i]=mul(i+1,iv[i+1]);
//}
//


int main()
{
	IOS;
	map<string,int>m;
	m["AC"]=0;
	m["WA"]=0;m["TLE"]=0;m["RE"]=0;
	int n;
	cin>>n;
	while(n--)
	{
		string s;
		cin>>s;
		m[s]++;
	}
	cout<<"AC "<<"x "<<m["AC"]<<endl;
	cout<<"WA "<<"x "<<m["WA"]<<endl;
	cout<<"TLE "<<"x "<<m["TLE"]<<endl;
	cout<<"RE "<<"x "<<m["RE"]<<endl;
	
}



Measured memory_bytes: 3660
#include <stdio.h>

int main(void)
{
    int n;
    scanf("%d", &n);

    long a[n];
    int i;
    for (i = 0; i < n; i++)
        scanf("%ld", &a[i]);
    
    int c = 0;
    while (1) {
        for (i = 0; i < n; i++) {
            if (a[i] % 2) {
                printf("%d\n", c);
                return 0;
            }
            else {
                a[i] /= 2;
            }
        }
        c++;
    }
    return 0;
}

Measured memory_bytes: 128
N = int(input())

B = list(map(int, input().split()))
A = [0] * N
for i in range(N-1):
    if i == 0:
        A[i] = B[i]
        A[i+1] = B[i]
    else:
        A[i] = min(A[i], B[i])
        A[i+1] = B[i]

print(sum(A))


Measured memory_bytes: 3060
#include <stdio.h>
#define HMAX 251
int main(){

	int i,H;
	int A[HMAX];

	scanf("%d",&H);
	for(i=1;i<=H;i++){
		scanf("%d",&A[i]);
	}

	for(i=1;i<=H;i++){
		printf("node %d: key = %d, ",i,A[i]);
		if(i!=1)
			printf("parent key = %d, ",A[i/2]);
		if(2*i<=H)
			printf("left key = %d, ",A[2*i]);
		if( ((2*i)+1)<=H )
			printf("right key = %d, ",A[((2*i)+1)]);
		printf("\n");
	}


	return 0;
}

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

using namespace std;

int main()
{
	int A1, A2, A3;
	cin >> A1 >> A2 >> A3;

	int sum = A1 + A2 + A3;

	if (sum >= 22) {
		cout << "bust" << endl;
	}
	else if (sum <= 21) {
		cout << "win" << endl;
	}


}






Measured memory_bytes: 3512
n, m = gets.chop.split.map(&:to_i)
c_get = Array.new(n, 0)
c_penalty = Array.new(n, 0)
tmp_penalty = Array.new(n, 0)

m.times do
  p, s = gets.chop.split
  p = p.to_i - 1
  if s == 'WA'
    tmp_penalty[p] += 1
    next
  else
    if c_get[p] == 0
      c_get[p] = 1
      c_penalty[p] = tmp_penalty[p]
    end
  end
end
puts "#{c_get.inject(:+)} #{c_penalty.inject(:+)}"

Measured memory_bytes: 4092
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int sort(const void *a, const void *b){
    return *(int*)a-*(int*)b ;
    }
    
int main(void){
    int a[3],ans=0;
    scanf("%d%d%d",&a[0],&a[1],&a[2]);
    qsort (a,3,sizeof(int),sort);   
    ans+=a[2]-a[1];
    if ((a[1]-a[0])%2==0){
        ans+=(a[1]-a[0])/2 ;
    } else {
        ans+=((a[1]-a[0]+1)/2)+1;
    }
    printf ("%d\n",ans);
    return 0 ;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<

int main() {
  int k, a, b;
  cin >> k >> a >> b;

  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define ff(i, n) for (int i = 1; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;



void solve(){
    int n, k, ans = 0;
    cin>>n>>k;
    f(i,n){
        int p;
        cin>>p;
        if(k <= p)ans++;
    }
    cout<<ans;
}



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


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        var x = TsuruKame(n[0], n[1]);
        if(x.Equals(new Tuple<int, int>(-1, -1)))
        {
            WriteLine("No");
        }
        else
        {
            WriteLine("Yes");
        }
    }

    public static Tuple<int, int> TsuruKame(int head, int foot)
    {
        return TsuruKame(head, foot, 2, 4);
    }

    public static Tuple<int, int> TsuruKame(int head, int foot, int tsuruFoot, int kameFoot)
    {
        if(head <= 0 || foot <= 0 || tsuruFoot <= 0 || kameFoot <= 0)
        {
            return new Tuple<int, int>(-1, -1);
        }
        float kame = (float)(foot - tsuruFoot * head) / (kameFoot - tsuruFoot);
        float tsuru = head - kame;
        if(0 <= tsuru && 0 <= kame && tsuru == (int)tsuru && kame == (int)kame)
        {
            return new Tuple<int, int>((int)tsuru, (int)kame);
        }
        else
        {
            return new Tuple<int, int>(-1, -1);
        }
    }
}


Measured memory_bytes: 19176
N = int(input())
a = list(map(int, input().split()))

n1 = sum([1 if A % 2 != 0 else 0 for A in a])
n4 = sum([1 if A % 4 == 0 else 0 for A in a])
n2 = N - n1 - n4

if n2 > 0:
    if n4 >= n1:
        print("Yes")
    else:
        print("No")
else:
    if n4 >= n1 - 1:
        print("Yes")
    else:
        print("No")


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

int main(void){
    int n;
    vector <int> a;
    int x;
    int c_min, c_max;
    int cnt;
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x;
        a.push_back(x);
    }
    
    cnt = 0;
    for(int i = 0; i < n; i++){
        if(a[i] < 400){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 400 && a[i] < 800){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 800 && a[i] < 1200){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 1200 && a[i] < 1600){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 1600 && a[i] < 2000){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 2000 && a[i] < 2400){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 2400 && a[i] < 2800){
            cnt++;
            break;
        }
    }
    
    for(int i = 0; i < n; i++){
        if(a[i] >= 2800 && a[i] < 3200){
            cnt++;
            break;
        }
    }
    
    c_min = cnt;
    
    int cnt2 = 0;
    for(int i = 0; i < n; i++){
        if(a[i] >= 3200){
            cnt2++;
        }
    }
    
    c_max = cnt + cnt2;
    
    if(c_min == 0)          c_min = 1;
    
    cout << c_min << " " << c_max << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
input=sys.stdin.readline


def solve():
    N = int(input())
    par = {i:[] for i in range(1, N+1)}

    for i in range(2, N+1):
        a = int(input())
        par[a].append(i)

    q = [1]
    l = []
    while q:
        s = q.pop()
        l.append(s)
        for t in par[s]:
            q.append(t)

    dp = defaultdict(int)
    for s in l[::-1]:
        depth = 1
        res = [dp[t] for t in par[s]]
        res.sort(reverse=True)
        for i, j in enumerate(res, start=1):
            depth = max(depth, i+j)
        dp[s] = depth

    print(dp[1]-1)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 110044
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int A, B;

  cin >> A >> B;

  cout << max({A+B, A-B, A*B}) << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <stdlib.h>
#include <queue>
#include <algorithm>
#include <vector>
#include<cstring>
using namespace std;
const int maxN = 4100;
int cost[maxN] = {};

vector<int> v1(1000);
vector<int> v2(2048);
//int open[maxM][12];

int sumTwo(int a, int b)
{
    if (a + b == 0)
        return 0;
    else
        return 1;
}
int strgPlus(int a, int b)
{
    int sum, p;
    for (int i = 11; i >= 0; i--)
    {
        p = pow(2, i);
        sum += p * sumTwo(a / p, b / p);
        a %= p;
        b %= p;
    }
    return sum;
}
int main()
{
    memset(cost,0,sizeof cost);
    int N, M, c, num, k, s = 0;

    scanf("%d %d", &N, &M);

    for (int i = 0; i < M; i++)
    {
        scanf("%d %d", &c, &num);

        for (int j = 0; j < num; j++)
        {
            scanf("%d", &k);
            s |= 1 << (k - 1);
        }
        v1[i] = s;

        if (cost[s] != 0)
            cost[s] = min(cost[s], c);
        else
            cost[s] = c;
        s = 0;
        c = 0;
    }
    for (int i = 0; i < M; i++)
    {
        for (int j = 1; j < (1 << N); j++)
        {
            if (cost[j] != 0)
            {
                if (cost[v1[i] | j] != 0)
                    cost[v1[i] | j] = min(cost[v1[i] | j], cost[v1[i]] + cost[j]);
                else
                    cost[v1[i] | j] = cost[v1[i]] + cost[j];
            }
        }
    }
    if (cost[(1 << N) - 1] == 0)
        printf("%d", -1);
    else
        printf("%d", cost[(1 << N) - 1]);
    //printf("%d %d", strgPlus(N, M), N | M);
}

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

int main() {
  int a, b;
  char c;
  cin >> a >> c >> b;
  while (c != '?') {
    switch (c) {
    case '+':
      cout << a + b << endl;
      break;
    case '-':
      cout << a - b << endl;
      break;
    case '*':
      cout << a * b << endl;
      break;
    case '/':
      cout << a / b << endl;
      break;
    }
    cin >> a >> c >> b;
  }
}



Measured memory_bytes: 3116
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <climits>
#include <tuple>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define el '\n'
 

 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	string s;
	int k = 0;
	cin >>s;
	for (char c: s){
		//cout << k<<endl;
		k = (k + (c - '0')) % 9;
	}
//	cout << k<<endl;
	if (k == 0){
		cout <<"Yes"<<el;
	} else{
		cout <<"No"<<el;
	}
	
    return 0;
}

Measured memory_bytes: 3488
n = int(input())
d = {'AC':0, 'TLE':0, 'WA':0, 'RE':0}
dk = ['AC', 'WA', 'TLE', 'RE']
for i in range(n):
  s = input()
  d[s] += 1
for k in dk:
  print("{} x {}".format(k, d[k]))

Measured memory_bytes: 9192
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

using f64 = double;
using i64 = long long;
using pii = pair<int, int>;

struct Pack {
	int t, x, y; };

vector<Pack> v;
int n;

int main() {
#ifdef HOME
	freopen("atc.in", "r", stdin);
	freopen("atc.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int t, x, y;

	cin >> n;
	v.resize(n);
	for (auto &i: v)
		cin >> i.t >> i.x >> i.y;

	x = y = t = 0;
	for (auto i: v) {
		if (abs(x - i.x) + abs(y - i.y) > i.t - t || (abs(x - i.x) + abs(y - i.y) + t) % 2 != i.t % 2) {
			cout << "No\n";
			return 0; }
		tie(x, y, t) = tie(i.x, i.y, i.t); }

	cout << "Yes\n";

	return 0; }


Measured memory_bytes: 1408
/* 
      Life before Death
      Strength before Weakness
      Journey before Destination
*/
                           
#include <bits/stdc++.h>
using namespace std;
                 
typedef long long ll;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define per(i,n,a) for (ll i=n;i>a;i--)
#define te ll t; std::cin >> t; while(t--)
#define SZ 500000
//# define M_PIl  3.141592653589793238462643383279502884L 
/*------Just DO IT--------------------------------------*/

ll dp[1500][1500],xmin,ymin;

ll solve(){
  ll n,s=0;
  cin>>n;
  ll a[n];
  rep(i,0,n) cin>>a[i] , s+=a[i];
  float cl,num = (1.0)*s/n , in = 0;
  cl = abs(a[0] - num);
 // cout<<cl<<endl;
  rep(i,1,n){
    if(abs(a[i]*(1.0)-num) < cl) in = i, cl = abs(a[i]-num);
  }
  cout<<in<<endl;
}

int main() {
  fastio;
   solve();
} 

Measured memory_bytes: 256
'use strict'
function main(inp) {
  inp = inp.trim().split('\n')
  const N = Number(inp.shift())
  inp = inp[0].split(' ').map(n => Number(n));

  let count = 0
  let num = 1

  for (let i = 0; i < N; i++) {
    if (inp[i] !== num) {
      count++
    } else {
      num++
    }
  }
  console.log(count === N ? -1 : count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 22244
n = int(input())
a = list(map(int, input().split()))


def t(num):
    cnt = 0
    while num % 2 == 0:
        num //= 2
        cnt += 1
    return cnt


ans = 0
for aa in a:
    if aa % 2 == 0:
        ans += t(aa)

print(ans)


Measured memory_bytes: 4148
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
template<class T>bool chmax(T &a, const T &b) {if(a<b){a = b; return 1;} return 0; };
template<class T>bool chmin(T &a, const T &b) {if(a>b){a = b; return 1;} return 0; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    ll a, b;cin >> a >> b;
    if(a * b <= 0) puts("Zero");
    else{
        if(a > 0) puts("Positive");
        else{
            if((b - a + 1)%2 == 1) puts("Negative");
            else puts("Positive");
        }
    }
    return 0;
}

Measured memory_bytes: 256
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
//#define endl "\n"
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

void solve(){
	string s,t; cin>>s>>t;
	int ans = INT_MAX;
	int n = s.length();
	int m = t.length();
	for(int i=0;i<=n-m;i++){
		int cur = 0;
		for(int j=0;j<m;j++){
			if(s[i+j] != t[j]) cur++;
		}
		ans = min(ans, cur);
	}
	cout<<ans<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> arr(5);
  for(int i=0;i<5;i++){
    cin >> arr.at(i);
  }
  for(int i=0;i<5;i++){
    if(arr.at(i)==0){
      cout << i+1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 3592