akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(n,v) cout<<#v<<":";for(int i=0;i<n;i++)cout<<v[i]<<" ";cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

ll dp[60][60][60*60],ans;
int main(){
    int n,a;
    cin>>n>>a;
    int x[60];
    rep(i,n){
        cin>>x[i];
    }
    //dp[i][j][k]:=index iまででj枚を使って総和をkにする
    dp[0][0][0]=1;
    rep(i,n){
        rep(j,n){
            rep(k,50*50){
                dp[i+1][j][k]+=dp[i][j][k];
                dp[i+1][j+1][k+x[i]]+=dp[i][j][k];
            }
        }
    }
    rep(i,n+1){
        if(i==0) continue;
        ans+=dp[n][i][i*a];
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
#define ll long long int

int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n+1]={0};
    while(k--)
    {
        ll m;
        cin>>m;
        ll b[m];
        for(int i=0;i<m;i++)
        {
            cin>>b[i];
            a[b[i]]++;
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]==0)
            ans++;
    }
    cout<<ans;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define ll long long
#define ljc 924844033
using namespace std;
#ifdef Fading
#define gc getchar
#endif
#ifndef Fading
inline char gc(){
    static char now[1<<16],*S,*T;
    if (T==S){T=(S=now)+fread(now,1,1<<16,stdin);if (T==S) return EOF;}
    return *S++;
}
#endif
inline ll read(){
    register ll x=0,f=1;char ch=gc();
    while (!isdigit(ch)){if(ch=='-')f=-1;ch=gc();}
    while (isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=gc();}
    return (f==1)?x:-x;
}
ll ans,n,K,tot,Q[10101],Sum[10101],inv[10101],fac[10101],sum[10101];
inline ll C(ll n,ll m){
	if (n<0||m<0) return 0;
	if (m>n) return 0;
	return fac[n]*inv[m]%ljc*inv[n-m]%ljc;
}
signed main(){
	n=read(),K=read();
	fac[0]=1;
	inv[0]=inv[1]=fac[1]=fac[0]=1;
	for (ll i=2;i<=n+2;i++) fac[i]=fac[i-1]*i%ljc;
	for (ll i=2;i<=n+2;i++) inv[i]=(ljc-(ljc/i)*inv[ljc%i]%ljc)%ljc;
	for (ll i=2;i<=n+2;i++) inv[i]=inv[i-1]*inv[i]%ljc;
	for (int i=1;i<=K;i++){
		tot++;
		for (int j=i,cnt=1;j<=n;j+=K,cnt++){
			Sum[tot]=cnt-1;
		}
		tot++;
		for (int j=i,cnt=1;j<=n;j+=K,cnt++){
			Sum[tot]=cnt-1;
		}
	} 
	sum[0]=1;
	ll MA=0;
	for (int i=1;i<=tot;i++){
		memset(Q,0,sizeof Q);
		for (int j=MA;j>=0;j--){
			for (int k=0;k<=Sum[i];k++){
				(Q[j+k]+=sum[j]*C(Sum[i]-k+1,k)%ljc)%=ljc;
			}
		}
		MA+=Sum[i];MA=min(MA,n);
		for (int i=0;i<=MA;i++) sum[i]=Q[i]; 
	}
	ll one=1;
	for (int i=0;i<=n;i++,one=ljc-one){
		ans=(ans+sum[i]*one%ljc*fac[n-i]%ljc)%ljc;
	}	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3676
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N = i()
F = [l() for _ in range(N)]
P = [l() for _ in range(N)]
ans = INF*-1
for bit in range(1,1<<10):
    nans = 0
    B = [(bit>>i)&1 for i in range(10)]
    for i in range(N):
        cnt = 0
        for j in range(10):
            if B[j] == 1 and F[i][j] == 1:
                cnt += 1
        nans += P[i][cnt]
    ans = max(ans,nans)
print(ans)

Measured memory_bytes: 79068
#include<iostream>
#include<string>
using namespace std;
int main(){
    string S,T,S1;
    int i,j,k,t=0;
    cin>>S>>T;
    S1=S;
    for(i=0;i<S.size();i++){
    for(j=0;j<S.size()-1;j++){
        S1[j+1]=S[j];
    }
    S1[0]=S[S.size()-1];
    S=S1;
    if(S==T){
        cout<<"Yes";
        t=1;
        break;
    }
    }

    if(i==S.size()){
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3464
import java.util.*;

public class Main{
  
  public static void main (String[] args){
  
  	Scanner scanner = new Scanner (System.in);
  
   	int N = scanner.nextInt();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    
    int plan1 = N*A;
    int plan2 = B;
    
    if (plan1 > plan2){
      System.out.println(plan2);
    } if (plan1 <= plan2){
      System.out.println(plan1);
    }
  }
}

Measured memory_bytes: 23764
<?php

$n = (int)trim(fgets(STDIN));
$s = trim(fgets(STDIN));

$red = 0;
$blue = 0;
for ($i=0; $i < $n; $i++) { 
	if ($s[$i] == 'R') {
		++$red;
	}else{
		++$blue;
	}
}
if ($red > $blue) {
	echo 'Yes';
}else{
	echo "No";
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define _ << ' ' <<
using namespace std;
using ll = long long;

ll a[200000];
int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int br = 0;
  for(int  i = 0; i < n-1; i++) {
  	if(a[i] == a[i+1])
      br++;
  }
  if(br > 0)
    cout << "NO";
	else
    cout << "YES";

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#define pb push_back
#define mp make_pair


int getint() { //10進数字の入力をint型で返す関数
    char C;
    while (!isdigit(C = getchar())); //10進数字でない入力を飛ばす部分
    int x = C - '0'; //1桁目を入力、数字のASCIIコードの引き算でint型へ変換
    while (isdigit(C = getchar())) x = x * 10 + C - '0'; //次の桁の数字を処理、以前の入力を10倍した上で次の入力を加算している。
    return x;
}


int main() {
    cin.tie(0); //iostreamスピードアップ
    ios::sync_with_stdio(false); //iostreamスピードアップ


    int N, Q;
    N = getint();
    Q = getint();
    char S[200000]; //標準入力の最大値2*10^5
    rep(i, N) S[i] = getchar(); //charの配列に標準入力を1文字ずつ格納
    char T[200000], D[200000]; //tとdを格納する配列
    rep(i, Q) {
        getchar(); //標準入力の改行を飛ばす部分
        T[i] = getchar(); 
        getchar(); //標準入力のスペースを飛ばす部分
        D[i] = getchar();;
    }
    int L = 0; //生き残っているゴーレムの左端のスライス
    int R = N-1; //生き残っているゴーレムの右端のスライス
    for (int i = Q - 1; i >= 0; i--) { //標準入力を逆からたどり、生き残るゴーレムの左端と右端を動かしていく、O(Q)で終了
        if (R >= 0 && D[i] == 'R' && S[R] == T[i]) R--;
        else if (R < N - 1 && D[i] == 'L' && S[R + 1] == T[i]) R++;
        if (L > 0 && D[i] == 'R' && S[L - 1] == T[i]) L--;
        else if (L < N && D[i] == 'L' && S[L] == T[i]) L++;
    }
    co(R - L + 1);
    return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const ll MOD = 1000000007;

int main() {
    ll n; cin >> n;
    vll a(n+10, 0), b(n+10, 0);
    rep(i, n-1)
        cin >> b[i];
    a[0] = b[0];
    b[n-1] = b[n-2];
    rep(i, n)
        a[i+1] = min(b[i], b[i+1]);
    ll ans = 0;
    rep(i, n)
        ans += a[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define llong long long
#define mp make_pair
#define f first
#define s second

using namespace::std;

int main()
{
    ios::sync_with_stdio(false);
    ifstream fin("input.txt");
    string str;
    cin >> str;
    int N = str.size();

    int answ = 10000;

    for (int i = 0; i < str.size(); i++) {
        char a = str[i];
        //cout << a << "\n";
        vector<bool> arr(N, 0);
        for (int j = 0; j < N; j++) {
            if (str[j] == a) {
                arr[j] = 1;
            }
        }
        for (int k = 0; k < N - 1; k++) {
            bool stat = 1;
            for (int j = 0; j < arr.size(); j++) {
                if (arr[j] == 0) {
                    stat = 0;
                }
            }
            if (stat) {
                answ = min(answ, k);
                break;
            }

            vector<bool> next(arr.size() - 1);
            for (int j = 0; j < next.size(); j++) {
                if (arr[j] == 1 || arr[j + 1] == 1) {
                    next[j] = 1;
                }
            }
            arr = next;
        }
    }
    if (answ == 10000) {
        cout << "0\n";
return 0;
    }
    cout << answ << "\n";
}


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

using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0; i < 4; i++) {
        if(s.at(i) == '+') {
            ans++;
        } else {
            ans--;
        }
    }

    cout << ans << endl;

    return 0;
}


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

table = [[0]*10 for _ in range(10)]
for i in range(1, n+1):
    a = i
    a_head = int(str(a)[0])
    a_tail = a % 10
    table[a_head][a_tail] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += table[i][j] * table[j][i]

print(ans)

Measured memory_bytes: 40300
#include <bits/stdc++.h>
using namespace std;
long gcd(long a, long b)
{
	long A = max(a, b);
	long B = min(a, b);
	if (A%B == 0) {
		return B;
	}
	else {
		return gcd(B, A%B);
	}
}

int main()
{
	long N, X;
	cin >> N >> X;
	vector<long> x(N);
	vector<long> d(N);
	for (int i = 0; i < N; i++)
	{
		cin >> x[i];
		d[i] = abs(x[i] - X);
	}
  	long D;
    if (N == 1)
        D = d[0];
    else
    {
		D = gcd(d[0],d[1]);
		for (int i = 0; i < N; i++)
		{
			D = gcd(D, d[i]);
		}
    }
	cout << D << endl;
	return 0;
}

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

int main () {
  int a,b;
  cin >> a >> b;
  
  if (b==1) {
    cout << 0 << endl;
    return 0;
  }
  int xa=a;
  int count=1;
  while (xa<b) {
    count++;
    xa+=a-1;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int q;
    cin >> q;
    while(q--){
        int k;
        cin >> k;
        deque<P> dq;
        ll ans = 0;
        ll sum = 0;
        ll c = 0;
        rep(i,n){
            if(!dq.empty()){
                if(dq[0].first<=i-k){
                    sum -= dq[0].second;
                    dq.pop_front();
                }
            }

            if(s[i]=='D'){
                dq.push_back(P(i,-c));
                sum += -c;
            }else if(s[i]=='M'){
                ++c;
            }else if(s[i]=='C'){
                ans += sum + (ll)(dq.size())*c;
            }

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

Measured memory_bytes: 12428
#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 N;
  cin >> N;

  double ans;
  double A;
  rep(i, N) {
    cin >> A;
    ans += (double)1 / A;
  }
  cout << setprecision(10) << 1 / ans << endl;
  return 0;
}

Measured memory_bytes: 3712
#include <stdio.h>
     
    int main(){
      int a, b;
      scanf("%d %d", &a, &b);
     
      if(a+b==15){
        printf("+");
      }else if(a*b==15){
        printf("*");
      }else{
        printf("x");
      }
     
      return 0;
    }

Measured memory_bytes: 128
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint(), K = getint();
	int dp[101], h[101] = {};
	dp[K] = 0;
	rep(i, K) dp[i] = 1e9;

	int H = getint();
	int kotae = 0;
	rep(i, N - 1) {
		h[i % K] = H;
		dp[i % K] = kotae;
		H = getint();
		kotae = 1e9;
		rep(j, K) chmin(kotae, dp[j] + abs(h[j] - H));
	}

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
use std::vec::Vec;
use std::cmp::max;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
  let n: usize = read();
  let s: Vec<char> = read::<String>().chars().collect();
  let mut x: i64 = 0;
  let mut ans: i64 = 0;

  for &c in &s {
    if c == 'I' {
       x += 1;
    } else {
      x -= 1;
    }

    ans = max(x, ans);
  }

  println!("{}", ans);
}



Measured memory_bytes: 4352
str = gets.split
N,K = str[0].to_i, str[1].to_i
mod = 1000000007

a = Array.new(0)
b = Array.new(0)
size = 0

i = 1
while i <= N/i
    a.push(i)
    b.push(N/i)
    i += 1
end
i = 0
size = a.size
if a[a.size-1] == b[b.size-1]
    i += 1
end
while i < size
    a.push(b[size-1-i])
    b.push(a[size-1-i])
    i += 1
end

c = Array.new(a.size,1)
for x in 1...c.size do
    c[x] = a[x] - a[x-1]
end

d = Array.new(2){Array.new(a.size)}
for x in 0...a.size do
    d[0][x] = a[x]
end
for x in 1...K do
    x0 = x%2
    x1 = (x-1)%2
    d[x0][0] = d[x1][a.size-1]
    for y in 1...a.size do
        d[x0][y] = (d[x0][y-1] + d[x1][a.size-1-y] * c[y]) % mod
    end
end

puts d[(K-1)%2][a.size-1]

Measured memory_bytes: 4400
use io::*;

fn main() {
    let input = read_string();
    let mut sc = Scanner::new(&input);
    let h: usize = sc.next();
    let w: usize = sc.next();
    let n: usize = sc.next();
    let mut av: Vec<usize> = sc.next_vec(n);
    let mut idx = 0;
    for i in 0..h {
        let mut s:Vec<usize> = Vec::new();
        loop {
            if av[idx] == 0 {
                idx += 1;
            }
            s.push(idx+1);
            av[idx] -= 1;
            if s.len() == w {
                break;
            }
        }
        if i % 2 == 1 {
            s.reverse();
        }
        print!("{}", s[0]);
        for x in s[1..].iter() {
            print!(" {}", x);
        }
        print!("\n");
    }
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }

        pub fn next_mat<T: FromStr>(&mut self, w: usize, h: usize) -> Vec<Vec<T>> {
            (0..h).map(|_| self.next_vec(w)).collect()
        }

        pub fn next_vec_char(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }

        pub fn next_mat_char(&mut self, n: usize) -> Vec<Vec<char>> {
            (0..n).map(|_| self.next_vec_char()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 4352
def prime_factorization(num)
  prime_factor = 2
  arr = []

  until num == 1
    if num % prime_factor == 0
      arr << prime_factor

      num /= prime_factor
    else
      if prime?(num)
        arr << num
        break
      end

      prime_factor += prime_factor == 2 ? 1 : 2
    end
  end

  arr
end

def prime?(i)
  num = 3

  while num <= Math.sqrt(i)
    return false if i % num == 0

    num += 2
  end

  true
end

n = gets.to_i

puts "#{n}: #{prime_factorization(n).join(' ')}"

Measured memory_bytes: 8700
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>

using namespace std;

int main(){
    long long int n,l;
    cin >> n >> l;
    long long int _sum=0,min_abs=400, _min;
    for(int i=1;i<=n;i++){
        _sum+=l+i-1;
        if(min_abs>abs(l+i-1)){
            min_abs=abs(l+i-1);
            _min = l+i-1;
        }
    }
    cout << _sum - _min << endl;
}


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

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

   vector<vector<int>> s(m,(vector<int>(10)));
   vector<int> k(m),p(m);

  rep(i,m){
    cin >> k[i];
    rep(j,k[i]){
      cin >> s.at(i).at(j);
    }
  }
  rep(i,m)cin >> p[i];
  
  int sum,num,ans=0;
  for(int tmp=0;tmp<(1 << n);tmp++){
    bitset<10> b(tmp);
    num = 0;
      rep(i,m){
        sum = 0;
        rep(j,k[i]){
          if(b.test(s[i][j]-1)){
            sum ++;}
        }
       if(sum % 2 == p[i])num ++;
       }
	if(num == m)ans ++;
  }
	cout << ans;
           
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define nl '\n'
#define sp ' '
#define zero '0'
#define r(a,b,c) for(ll a=(b);a<(c);++a)
#define v(a,b,c) for(ll a=(b);a>(c);--a)
#define f(a) cout<<fixed<<setprecision(10)<<a
#define d(a,b,c) cout<<setfill(a)<<setw(b)<<right<<c
#define hasten cin.tie(0);ios::sync_with_stdio(false)
ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y,z;

const int prime[15]=
{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};

inline void in(){}
template<class T,class...A>
inline void in(T&&t,A&&...a){cin>>t;in(move(a)...);}

template <class T>inline void out(T t){cout<<t<<nl;}
template <class T, class...A>
inline void out(T t,A...a){cout<<t<<' ';out(move(a)...);}

inline ll dig(ll a){ll d=1;while(a/=10)++d;return d;}

inline ll gcd(ll a,ll b)
{ll c;while(a){c=a;a=b%a;b=c;}return b;}

inline bool isp(ll a){
	if(a<48){r(i,0,15)if(prime[i]==a)return 1;}
	else if(a<2809)return gcd(614889782588491410,a)==1;
	else {out("Error:Argument is Over-2808!");exit(1);}
	return 0;
}

int main(){
	hasten;
	in(a,b);
	
	r(i,0,a+1)r(j,0,a-i+1)if(i*10000+j*5000+(a-i-j)*1000==b){
		out(i,j,a-i-j);
		return 0;
	}
	
	out(-1,-1,-1);
	

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char s[3];
    scanf("%c %c %c",&s[0],&s[1],&s[2]);

    if ((s[0] == 'A' && s[1] == 'A' &&s[2] == 'A') || (s[0] == 'B' && s[1] == 'B' &&s[2] == 'B')){
        printf("No\n");
    }else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define x first
#define y second
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //assert(freopen("input.txt","r",stdin));
    //assert(freopen("output.txt","w",stdout));
    ll n,d;
    cin>>n>>d;
    int i,ans=0;
    for(i=1;i<=n;i++){
        ll x,y;
        cin>>x>>y;
        if(x*x+y*y<=d*d)
            ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3656
s = input()
s = [i for i in s]
w_count = s.count('W')
ans = 0
if w_count == 0:
    print(0)
else:
    number = [i for i in range(w_count)]
    w_element = [i for i,j in enumerate(s) if j=='W']
    for i in range(w_count):
        ans += abs(number[i]-w_element[i])
    print(ans)


Measured memory_bytes: 20644
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    ll n, t;
    cin >> n >> t;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<ll> sell(n);

    ll ma = 0;
    for(int i = n - 1; i >= 0; i--){
        sell[i] = ma;
        ma = max(ma, a[i]);
    }

    vector<ll> profit(n);
    ll maxprof = 0;
    rep(i, n){
        profit[i] = (sell[i] - a[i]) * (t / 2);
        maxprof = max(maxprof, profit[i]);
    }

    int ans = 0;
    rep(i, n){
        if(profit[i] == maxprof) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 2688
n = int(input())
a = map(int, input().split())
counter = 0

# xが２で何回割れるかの関数
def how_much_time_divisible(x):
    ans = 0
    
    while x % 2 == 0:
        x /= 2
        ans += 1
    return ans

# リストaの要素すべてに対して、2で何回割れるかの値に置き換えたい（ｂがその置き換わったリストである）
b = map(how_much_time_divisible, a)
# bの要素で最も小さいものが答えである
print(min(b))

Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <bitset>
#include <map>
#include <math.h>
#include <utility>

using namespace std;

const double PI = acos(-1);

int main(){

    int N, K;
    cin >> N >> K;

    vector<int> d(K);
    vector<bool> have(N, false);
    for (int i = 0; i < K; i++){
        int d;
        cin >> d;
        for (int j = 0; j < d; j++){
            int a;
            cin >> a;
            have[a-1] = true;
        }
    }

    int ans = 0;
    for (int i = 0; i < N; i++){
        if (!have[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3204
size = [int(i) for i in input().split()]
W = size[0]
H = size[1]
x = size[2]
y = size[3]
r = size[4]

if x - r < 0 or x + r > W:
    print('No')
elif y - r < 0 or y + r > H:
    print('No')
else :
    print('Yes')


Measured memory_bytes: 5604
#!ruby -pal
h={AAA:[35.5,71],AA:[37.5,77],A:[40,83],B:[43,89],C:[50,105],D:[55,116],E:[70,148]}
$_=h.keys.find{|k|$F.zip(h[k]).all?{|i,j|i.to_f<j}}||:NA

Measured memory_bytes: 6128
#include <iostream>
#include <stdio.h>

using namespace std;

#define MAX 1000
#define NIL -1

struct Node {
	int parent, left, right;
};

Node *binaryTreeArray;
int *depthBinaryArray, *heightBinaryArray;

void SetDepth (int id, int depth) {
	if (id == NIL) {
		return;
	}

	depthBinaryArray[id] = depth;

	SetDepth(binaryTreeArray[id].left , depth + 1);
	SetDepth (binaryTreeArray[id].right , depth + 1);
}

int SetHeight (int id) {
	int h1 = 0, h2 = 0;

	if (binaryTreeArray[id].left != NIL) {
		h1 = SetHeight(binaryTreeArray[id].left) + 1;
	}

	if (binaryTreeArray[id].right != NIL) {
		h2 = SetHeight (binaryTreeArray[id].right) + 1;
	}

	return heightBinaryArray[id] = (h1 > h2) ? h1 : h2;
}

int GetSiblings (int id) {
	if (binaryTreeArray[id].parent == NIL) {
		return NIL;
	}
	if (binaryTreeArray[binaryTreeArray[id].parent].left != id && binaryTreeArray[binaryTreeArray[id].parent].left != NIL) {
		return binaryTreeArray[binaryTreeArray[id].parent].left;
	}
	if (binaryTreeArray[binaryTreeArray[id].parent].right != id && binaryTreeArray[binaryTreeArray[id].parent].right != NIL) {
		return binaryTreeArray[binaryTreeArray[id].parent].right;
	}

	return NIL;
}

void ScanningBinaryTree (int n) {
	int id, left, right;
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d", &id, &left, &right);

		binaryTreeArray[id].left = left;
		binaryTreeArray[id].right = right;

		if (left != NIL) {
			binaryTreeArray[left].parent = id;
		}
		if (right != NIL) {
			binaryTreeArray[right].parent = id;
		}

	}
}

void PrintBinaryTree (int id) {
	printf ("node %d: ", id);
	printf ("parent = %d, ", binaryTreeArray[id].parent);
	printf ("sibling = %d, ", GetSiblings(id) );

	int branchNumber = 0;

	if (binaryTreeArray[id].left != NIL) {
		branchNumber++;
	}
	if (binaryTreeArray[id].right != NIL) {
		branchNumber++;
	}

	printf ("degree = %d, ", branchNumber);
	printf ("depth = %d, ", depthBinaryArray[id]);
	printf ("height = %d, ", heightBinaryArray[id]);

	if (binaryTreeArray[id].parent == NIL) {
		printf("root\n");
	}
	else if (binaryTreeArray[id].left == NIL && binaryTreeArray[id].right == NIL) {
		printf("leaf\n");
	}
	else {
		printf("internal node\n");
	}

}

int main() {

	int n, root = 0;

	scanf("%d", &n);

	binaryTreeArray = new Node[n];
	depthBinaryArray = new int[n], heightBinaryArray = new int[n];

	for (int i = 0; i < n; i++) {
		binaryTreeArray[i].parent = NIL;
	}

	ScanningBinaryTree(n);

	for (int i = 0; i < n; i++) {
		if (binaryTreeArray[i].parent == NIL) {
			root = i;
		}
	}

	SetDepth(root, 0);
	SetHeight(root);

	for (int i = 0; i < n; i++) {
		PrintBinaryTree(i);
	}

	return 0;
}


Measured memory_bytes: 3192
// https://atcoder.jp/contests/abc153/tasks/abc153_e
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)
const int INF = 1e10;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, N;
    cin >> H >> N;
    vector<pair<int, int>> v(N);
    REP(i, N) {
        int a, b;
        cin >> a >> b;
        v[i] = {a, b};
    }
    sort(ALL(v), [](const pair<int, int> &a, const pair<int, int> &b) {
        return a.first * b.second > b.first * a.second;
    });
    vector<int> dp(2e4, INF);
    dp[0] = 0;
    for (auto &x : v) {
        REP(i, 1e4) {
            if (dp[i] != INF && i + x.first < 2e4) {
                dp[i + x.first] = min(dp[i + x.first], dp[i] + x.second);
            }
        }
    }
    int minv = INF;
    FOR(i, H, 2e4) { minv = min(minv, dp[i]); }
    cout << minv << endl;

    return 0;
}

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

int main() {
  ll L, R;
  ll ans = 2019;
  cin >> L >> R;
  if(R - L >= 2019) {
    cout << 0 << endl;
    return 0;
  }
  for (ll i = L; i < R; i++){
    for (ll j = i + 1; j <= R; j++){
      ans = min(ans, (i  * j)  % mod);
    }
  }
  cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> d(n);
    for (int i = 0; i < n; i++) cin >> d[i];
    sort(d.begin(), d.end());

    cout << d[d.size() / 2] - d[d.size() / 2 - 1] << endl;
    return 0; 
}

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

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int r=0,b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') r++;
        else b++;
    }
    if(r>b){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;

    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define pb push_back
#define Max(x,y,z) max(x,max(y,z))
#define f first
#define s second
#define lbd lower_bound
#define sz(x)       (ll)x.size()
#define pi 3.1415926536
#define mod 1000000007
using namespace std;

void solve()
{
    ll n,m,k,x,y,res=0,l,a=0,b=0,c=0,d=0,cnt=0,sum=0,z;
    string s;
    cin>>n;
    cin>>s;
    cin>>k;
    rep(i,0,n)
        if(s[i]!=s[k-1])
            s[i]='*';
    cout<<s;


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


Measured memory_bytes: 256
function gets(str){
  this._s = str.split("\n");
  this._y = 0;
};
gets.prototype = {
  a: function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y] = s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  },
  l: function(f){
    var s = this._s[this._y++].split(" ");
    return f?s:s.map(a=>+a);
  },
  m: function(n,f){
    var s = this._s, y = this._y, r = [], i = 0;
    if(f)for(;i < n; i++)r[i] = s[y+i].split(" ");
    else for(;i < n; i++)r[i] = s[y+i].split(" ").map(a=>+a);
    this._y += n;
    return r;
  },
};
var o=new gets(require("fs").readFileSync("/dev/stdin","utf8"));

function inv(a){
  var n = a.length;
  var m = 0;
  for(var i = 1; i < n; i <<= 1){
    var b = [];
    for(var j = 0; j < n;){
      var l = j, r = Math.min(n,l+i), l2 = r, r2 = Math.min(n,r+i);
      while(l < l2 && r < r2){
        if(a[l] > a[r]){m+=l2-l;b[j++]=a[r++];}
        else b[j++]=a[l++];
      }
      while(l < l2)b[j++]=a[l++];
      while(r < r2)b[j++]=a[r++];
    }
    a = b;
  }
  return m;
}

console.log(main());
function main(){
  var n = o.a();
  var a = o.l();
  if(n <= 2)return Math.max(...a);
  var p = Math.floor(n * (n+1) / 4 + 1);
  var l = 2, r = 1e9+1;
  while(l < r){
    var m = l + r >> 1;
    var b = [0];
    for(var i = 0; i < n; i++){
      b[i+1] = b[i];
      if(a[i] < m)b[i+1]--;else b[i+1]++;
    }
    if(inv(b) < p)l = m+1; else r = m;
  }
  return l-1;
}

Measured memory_bytes: 69364
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//

const lint MOD = (lint)1e9 + 7;

lint powMod(lint x, lint k) {
	if (k <= 0) return 1LL;
	lint res = 1;
	while (k) {
		if (k&1) modMul(res, x, MOD);
		modMul(x, x, MOD);
		k >>= 1;
	}
	return res;
}

int main() {
	int N;
	cin >> N;
	
	Vec< lint > T(N), A(N);
	for_(i,0,N) cin >> T[i];
	for_(i,0,N) cin >> A[i];
	
	Vec< lint > min_h(N);
	for_(i,0,N) min_h[i] = min(T[i], A[i]);
	
	lint amx = max(*max_element(allof(T)), *max_element(allof(A))), mx = *max_element(allof(min_h));
	if (amx > mx) {
		puts("0");
		return 0;
	}
	
	lint ans = 1, prv = -1, len = 0;
	for_(i,0,N) {
		if (prv != min_h[i]) {
			modMul(ans, powMod(prv, len-(prv == mx ? 2 : 1)), MOD);
			prv = min_h[i];
			len = 1;
		} else {
			++len;
		}
	}
	modMul(ans, powMod(prv, len-(prv == mx ? 2 : 1)), MOD);
	cout << ans << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//


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


int main(){
  int64_t N,m=0;
  cin >> N;
  vector<string> S(N);
  vector<int64_t> U(N,0);
  queue<int64_t> Q;
  for(int64_t i=0;i<N;i++){
    cin >> S.at(i);
  }
  U.at(0)=1;
  Q.push(0);
  while(!Q.empty()){
    int64_t q=Q.front();
    Q.pop();
    for(int64_t i=0;i<N;i++){
      if(S.at(q).at(i)=='1'&&U.at(i)==0){
        U.at(i)=3-U.at(q);
        Q.push(i);
      }else if(S.at(q).at(i)=='1'&&U.at(i)!=3-U.at(q)){
        cout << -1 << endl;
        return 0;
      }
    }
  }
  for(int64_t i=0;i<N;i++){
    for(int64_t j=0;j<N;j++){
      U.at(j)=0;
    }
    U.at(i)=1;
    Q.push(i);
    while(!Q.empty()){
      int64_t q=Q.front();
      Q.pop();
      for(int64_t j=0;j<N;j++){
        if(S.at(q).at(j)=='1'&&U.at(j)==0){
          U.at(j)=U.at(q)+1;
          Q.push(j);
          m=max(U.at(j),m);
        }
      }
    }
  }
  cout << m << endl;   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
#define fil(x) memset(x, 0, sizeof(x))
#define fillb(x) memset(x,false,sizeof(x))
#define fillm(x) memset(x, -1, sizeof(x))
#define mp make_pair
#define pll pair<int, int>
#define pf printf
#define sf scanf
#define all(x) x.begin(),x.end()
#define pb push_back
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define np std::string::npos
#define fo(i,n) for(int i=0;i<n;i++)
#define of(i,n) for(int i=n-1;i>=0;i--)
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(),v.end())
#define maxv(v) *max_element(v.begin(),v.end())
#define cases(cs,t) for(int cs=1;cs<=t;cs++)
#define PI acos(-1)
#define nl endl

typedef unsigned long long lll;
typedef long long ll;
int knigtx8[] = {2, 2, -2, -2, 1, 1, -1, -1}; ///knight move in chess
int knigty8[] = {1, -1, 1, -1, 2, -2, 2, -2}; ///knight move in chess
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; ///for 8 directions
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1}; ///for 8 directions
int dx4[] = {0, 0, 1, -1}; ///for 4 directions
int dy4[] = {1, -1, 0, 0}; ///for 4 directions
const int maxx=100005;

//this fuction sorts vector pair according to first element in descending order.
bool sortinrev(const pair<int,int> &a,const pair<int,int> &b)
{
    return a.first>b.first;
}

int atoz(){
    int frnt,bck,nibo,present,i;string s;
        frnt = abs(s[i]-present);
        bck = 26-frnt;
        nibo = min(frnt,bck);
}

template<typename T>inline T Bigmod(T base, T power, T MOD){
    T ret=1;
    while(power)
    {
        if(power & 1)ret=(ret*base)%MOD;
        base=(base*base)%MOD;
        power>>=1;
    }
    return ret;
}

int main()
{
    IOS;
    string s;
    cin>>s;
    fo(i,s.size()){
        if(s[i]=='7'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  int na=a.size();
  int nb=b.size();
  int nc=c.size();
  int aa=0;
  int bb=0;
  int cc=0;
  char x='a';
  char ans;
  rep(i,na+nb+nc){
    if(aa==na && x=='a'){
      ans='A';
      break;
    }
    else if(bb==nb && x=='b'){
      ans='B';
      break;
    }
    else if(cc==nc && x=='c'){
      ans='C';
      break;
    }
    else if(x=='a'){
      x=a.at(aa);
      aa++;
      
    }
    else if(x=='b'){
      x=b.at(bb);
      bb++;
      
    }
    else if(x=='c'){
      x=c.at(cc);
      cc++;
      
    }
  }
  cout << ans << endl;
}


    
   


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<17,INF=1<<30;

int bit[MAX+1],M;

//1-indexed

int sum(int i){
    int s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}

//sからtの和=sum(t)-sum(s-1)

void add(int i,int x){
    while(i<=M){
        bit[i]+=x;
        i+=i&-i;
    }
}


int main(){
    
    int N;cin>>N;M=N+1;
    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    
    int left=0,right=INF;
    
    while(right-left>1){
        int mid=(left+right)/2;
        vector<int> B(N+1,0);
        for(int i=1;i<=N;i++){
            if(A[i-1]>=mid) B[i]=1;
            else B[i]=-1;
            B[i]+=B[i-1];
        }
        vector<int> id(N+1);
        iota(id.begin(),id.end(),0);
        sort(id.begin(),id.end(),[&](int i,int j){
            if(B[i]!=B[j]) return B[i] > B[j];
            return i>j;
        });
        
        for(int i=0;i<=MAX;i++){
            bit[i]=0;
        }
        
        ll cnt=0;
        
        for(int i=0;i<N+1;i++){
            cnt+=sum(N+1)-sum(id[i]+1);
            add(id[i]+1,1);
        }
        
        if(cnt>=(ll(N+1)*ll(N)/2+1)/2) left=mid;
        else right=mid;
    }
    
    cout<<left<<endl;
}



Measured memory_bytes: 1984
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;


int main()
{
	int a, b, c;
	string s, t;
	cin >> a >> s;
	bool flag = true;
	if (a % 2 == 1)flag = false;
	b = a / 2;
	for (int i = 0; i < b; i++)
	{
		if (s[i] != s[i + b])flag = false;
	}
	cout << (flag ? "Yes" : "No");
}


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

int main(){
  int A, B, C, X, Y;
  long long minprice = 1000000000000;
  cin >> A >> B >> C >> X >> Y;
  for(int i = 0; i < 200000; i++){
    int price = 0;
    price = 2 * C * i + max(0, (X-i) * A) + max(0, (Y-i)*B);
    if(minprice > price) minprice = price;
  }
  cout << minprice << '\n';
  return 0;
}

Measured memory_bytes: 3588
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
A, B = [0], [0]
for i in range(n):
    A.append(A[i] + a[i])
for i in range(m):
    B.append(B[i] + b[i])
    
ans, j = 0, m
for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

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

string s;
int k, mod = 1e9+7;
int newdp[105], olddp[105];
int dp[100005][105][2];

int go(int pos, int sum, int isbigger){
    if(pos == s.size()) return (sum == 0);
    if(dp[pos][sum][isbigger] != -1) return dp[pos][sum][isbigger];
    int res = 0;
    for(int i = (isbigger ? s[pos]-'0' : 9); i >= 0; i--)
        res = (res+go(pos+1, (sum + i)%k, (isbigger&(i == (s[pos]-'0')))))%mod;
    return dp[pos][sum][isbigger] = res;
}

int main(){
    memset(dp, -1, sizeof dp);
    cin >> s >> k;
    int res = (go(0,0,1)-1+mod)%mod;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 83072
import math

a, b, x = map(int, input().split())
v = a*a*b
if v == x:
    print(0)
elif v/2 <= x < v:
    h = 2*(v-x)/a**2
    ans = math.atan(h/a)
    print(math.degrees(ans))
else:
    h = 2*x/(b*a)
    ans = math.atan(h/b)
    print(90-math.degrees(ans))


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

using namespace std;

typedef long long int lli;

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

    int n;
    cin >> n;
    vector<int> a(n);

    for (int i=0; i<n; i++) cin >> a[i];
    auto tmp = a;
    sort(a.begin(), a.end(), greater<int>());
    
    for (auto x : tmp) {
        cout << ((x == a[0]) ? a[1] : a[0]) << endl;
    }

    return 0;
}


Measured memory_bytes: 3200
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools

def main():
    num = int(input())
    s = input()

    if num >= 3200:
        print(s)
    else:
        print('red')




if __name__ == '__main__':
    main()



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

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a + b > c + d) cout << "Left" << endl;
	else if (a + b == c + d) cout << "Balanced" << endl;
	else cout << "Right" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    string hairetu = "abcdefghijklmnopqrstuvwxyz";
    vector<vector<string>>arr(11,vector<string>(0));
    arr[1].push_back("a");
    int N;cin >> N;
    for(int i =2;i <=N;i++)
    {
        int SIZE = arr[i-1].size();
        for(int j = 0;j<SIZE;j++)
        {
            string s = arr[i-1][j];
            int MAX = 0;
            for(int l =0;l<s.size();l++)
            {
                MAX = max(MAX,s[l]-'a'+2);
            }
            for(int k =0;k<MAX;k++)
            {
                string PUT = arr[i-1][j] + hairetu[k];
                arr[i].push_back(PUT);
            }
        }
    }
    for(int i =0;i < arr[N].size();i++)
    {
        cout << arr[N][i] << endl;    
    }
}


Measured memory_bytes: 9588
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int N, K;
string P[10005];

signed main() {
	cout << setprecision(20) << fixed;
	cin >> N >> K;
	priority_queue<pair<int,int>> que;
	int cnt[30] = {};
	rep(i, N) {
		cin >> P[i];
		cnt[P[i][0] - 'A']++;
	}
	rep(i, 30) {
		if(cnt[i]) que.push({ cnt[i], i });
	}
	int ans = 0;
	while (que.size() >= K) {
		vector<pair<int, int>> a;
		rep(i, K) {
			a.push_back(que.top());
			que.pop();
		}
		if (test) {
			rep(i, K) {
				cerr << (char)(a[i].second + 'A') << " ";
				cerr << a[i].first << endl;
			}
		}
		rep(i, K) {
			if (a[i].first >= 2) {
				que.push({ a[i].first - 1,a[i].second });
			}
		}
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 896
p,r=input,range
A=sum([list(map(int,p().split()))for _ in r(3)],[])
b=[int(p())for _ in r(int(p()))]
print('YNeos'[all([sum(1<<i for i in r(9)if A[i]in b)&v!=v for v in[7,56,73,84,146,273,292,448]])::2])

Measured memory_bytes: 9204
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <math.h>
#include <stdlib.h>
#include <numeric>


int main(){
	int n, x, l, t;
	std::cin >> n >> x;
	for(int i = 0; i < n; i++){
		std::cin >> l;
		if(l <= x){
			t = i;
			x -= l;
		}else{
			break;
		}
	}
	std::cout << t + 2 << std::endl;
	return 0;
}


Measured memory_bytes: 256
N, K = [int(n) for n in input().split()]

Heights = [int(n) for n in input().split()]
Costs = [float('inf') for n in range(N)]

for i in range(N):
    if i == 0:
        Costs[i] = 0
    elif i < K:
        for j in range(i+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))
    else:
        #Costs[i] = min(Costs[i-1] + abs(Heights[i] - Heights[i-1]), Costs[i-2] + abs(Heights[i] - Heights[i-2]))
        for j in range(K+1):
            Costs[i] = min(Costs[i], Costs[i-j] + abs(Heights[i] - Heights[i-j]))

print(Costs[-1])


Measured memory_bytes: 57312
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;
 
#define Endl endl
 
 
/*--------------------template--------------------*/
 
int main()
{
	cin >> n >> m;
        cout<<(n>m?n-m:0)<<endl;
}

Measured memory_bytes: 256
<?php
 fscanf(STDIN,"%d%d",$n,$m);
$citys = array();
 for($i=0;$i<$m;$i++){
   $p_y = explode(" ",trim(fgets(STDIN)));
   $pref[$p_y[0]][] = $p_y[1];
   $py_li[] = $p_y;
 }
 

//昇順にする
$p_y_key_li = array_keys($pref);
for($i=0;$i<count($p_y_key_li);$i++){
  sort($pref[$p_y_key_li[$i]]);
}

$memo = array();

//print_r($pref);
$memo = [];
foreach($pref as $key => $list){
    foreach($pref[$key] as $num => $year){
        $memo[$year] = $num+1;
    }
}

//print_r($memo);
  


foreach($py_li as $py){
  $x = $memo[$py[1]];
  for($i=0;$i<6-strlen($py[0]);$i++){
    echo "0";
  }
  echo $py[0];
   for($i=0;$i<6-strlen($x);$i++){
    echo "0";
  }
  echo ($x)."\n";
}
//print_r($pref);

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


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

vector<string> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int H, W;
bool seen[510][510];

void dfs(int h, int w)
{
    seen[h][w] = true;
    for (int dir = 0; dir < 4;dir++)
    {
            int nh = h + dx[dir];
            int nw = w + dy[dir];
        
        if(nh < 0|| nh >= H || nw < 0 || nw >= W){
            continue;
        }
        if(field[nh][nw] == '#'){
            continue;
        }
        if(seen[nh][nw]){
            continue;
        }
        dfs(nh, nw);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed << setprecision(15);
    int N, Y;
    cin >> N >> Y;
    int x = -1,y = -1,z = -1;
    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N;j++)
        {
            int k = N - i - j;
            if(k >= 0){
                if(i*10000 + j * 5000 + k * 1000 == Y){
                    x = i;
                    y = j;
                    z = k;
                }
            }
        }
    }
    cout << x << " " << y << " " << z << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;

vector <int> a[500];

int main() {
  int n;
  scanf("%d",&n);
  for(int i=1;i<500;i++)
    if ((i*(i-1)>>1)==n) {
    	int cnt=0;
    	for(int j=1;j<i;j++)
    	  for(int k=j+1;k<=i;k++) {
    	  	cnt++;
    	  	a[j].push_back(cnt);
    	  	a[k].push_back(cnt);
		  }
		printf("Yes\n%d\n",i);
		for(int j=1;j<=i;j++) {
			printf("%d ",a[j].size());
			for(int k=0;k<a[j].size();k++) printf("%d ",a[j][k]);
			printf("\n");
		}
		return 0;
	}
  puts("No");
  return 0;
}

Measured memory_bytes: 2304