akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,K,Q;
    cin>>N>>K>>Q;
    vector<ll> A(N,0);
    ll a;
    FOR(i,0,Q){
        cin>>a;a--;
        A[a]++;
    }

    
    FOR(i,0,N){
        if(K-Q+A[i]<=0)cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }

    return 0;
}

Measured memory_bytes: 1536
W,H,*L = map(int, open(0).read().split())
ls = [0]*(W+H)
for i,c in enumerate(L):
  if i<W:
    ls[i] = (c,0)
  else:
    ls[i] = (c,1)
ls.sort()
P = 0
Q = 0
cnt = (W+1)*(H+1)-1
ans = 0
for c,s in ls:
  if s:
    m = min(cnt,W+1-P)
    cnt -= m
    ans += m*c
    Q += 1
  else:
    m = min(cnt,H+1-Q)
    cnt -= m
    ans += m*c
    P += 1
  if cnt==0:
    print(ans)
    break

Measured memory_bytes: 99148
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int a, b;
    cin >> a >> b;
    cout << max({a+b,a-b,a*b}) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a;
	for (int i = 0; i < n; i++) a.push_back(2 * i);
	for (int i = 0; i < m; i++) a.push_back(2 * i + 1);
	int ans = 0;
	for (int i = 0; i < n + m - 1; i++) {
		for (int j = i + 1; j < n + m; j++) {
			if ((a[i] + a[j]) % 2 == 0) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

int main()
{
    int a, p;
    cin >> a >> p;

    p += a*3;
    int cnt = 0;
    while (p > 1)
    {
        cnt++;
        p -= 2;
    }
    cout << cnt;
}

Measured memory_bytes: 3512
#include<bits/stdc++.h>
#define int long long
#define sd(a) scanf("%lld",&a)
#define pd(a) printf("%lld",a)
using namespace std;
const int maxn=1e3+10;
int a[maxn][maxn];
int dur[maxn];
bool vis[maxn];
main(){
    int n;
    sd(n);
    for(int i=1;i<=n;++i)dur[i]=1ll;
    for(int i=1;i<=n;++i)
    for(int j=1;j<n;++j)sd(a[i][j]);
    int day=0;
    while(1){
        day++;
        memset(vis,false,sizeof(vis));
        bool flag=true;
        for(int i=1;i<=n;++i){
            int to=a[i][dur[i]];
            if(dur[i]!=n&&dur[to]==n)break;
            if(dur[i]==n||vis[i]||vis[to]||a[to][dur[to]]!=i||dur[to]==n)continue;
            else {
                flag=false;
                vis[i]=true;
                vis[to]=true;
                dur[i]++;
                dur[to]++;
            }
        }
        if(flag)break;
    }
    for(int i=1;i<=n;++i){
        if(dur[i]!=n){
            puts("-1");
            return 0;
        }
    }
    pd(day-1);
    puts("");
}


Measured memory_bytes: 8192
#include <iostream>

using namespace std;

int main( void ) {

	string str;
	cin >> str;

	bool found = false;
	for ( int i = 0 ; i < str.length() ; ++i ) {
		for ( int j = i + 1 ; j < str.length() ; ++j ) {
			if ( str[i] == 'C' and str[j] == 'F' ) {
				found = true;
			}
		}
	}

	cout << ( found ? "Yes" : "No" ) << endl;
	return 0;
}

Measured memory_bytes: 256
def row_sharp(w)
  for i in 1..w
    if i%2 == 0
      print "."
    else
      print "#"
    end
  end
end

def row_dot(w)
  for i in 1..w
    if i%2 == 0
      print "#"
    else
      print "."
    end
  end
end


input_values = []
while true
  input_value  = gets.chomp.split.map(&:to_i)
  if input_value == [0,0]
    break
  end
  input_values.push(input_value)
end

num_of_chessboard = (input_values.length)

for i in 0..(num_of_chessboard-1)
    h = input_values[i][0]
    w = input_values[i][1]
    for j in 0..(h-1)
      rows = []
      if j%2 == 0
        rows.push(row_sharp(w))
      else
        rows.push(row_dot(w))
      end
      rows.delete_at(-1)
      puts rows.join('\n')
    end
    puts"\n"
end

Measured memory_bytes: 8636
str = gets.chomp

W = str.split(' ')[0].to_i
H = str.split(' ')[1].to_i
x = str.split(' ')[2].to_i
y = str.split(' ')[3].to_i
r = str.split(' ')[4].to_i

if (x-r >= 0) && (x+r <= W) && (y-r >= 0) && (y+r <= H) then
	puts 'Yes'
else
	puts 'No'
end

Measured memory_bytes: 6100
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
using ll = long long int;

const ll T_MAX = 1E+12;

int n;
ll k;
vector<ll> A, F;

int main(){
    cin >> n >> k;
    A.resize(n);
    F.resize(n);
    ll S = 0;
    for(int i = 0; i < n; i++){
        cin >> A[i];
        S += A[i];
    }
    for(int i = 0; i < n; i++)cin >> F[i];
    if (S <= k){
        cout << 0 << endl;
        return 0;
    }
    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<ll>());

    ll lb = 0;
    ll ub = T_MAX;
    while(ub - lb > 1){
        ll mid = (lb + ub) / 2;
        S = 0;
        for(int i = 0; i < n; i++){
            ll need = mid / F[i];
            ll sub = max(0LL, A[i] - need);
            S += sub;
        }
        if (S <= k)ub = mid;
        else lb = mid;
    }
    cout << ub << endl;
    return 0;
}

Measured memory_bytes: 6000
#include<iostream>

using namespace std;

typedef long long ll;

ll A,B,C,D;

int main(){
  cin >>A>>B>>C>>D;
  ll tmp;
  ll C1=C;
  ll D1=D;
  if(D<C){
    tmp = D;
    D = C;
    C = tmp;
  }
  ll r;
  ll x = C*D;
  r = D % C;
  while(r!=0){
    D = C;
    C = r;
    r = D % C;
  }
  ll ss = x/C;
 
  ll n = B/C1+B/D1-B/ss;
  ll m = A/C1+A/D1-A/ss;

  if(A%C1==0||A%D1==0||A%ss==0){
     cout << B-A+1-n+m-1 << endl;
  }else  cout << B-A+1-n+m << endl;
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,x,y;
	cin>>a>>b>>c>>x>>y;
	int sum1,sum2,sum3;
	sum1=a+b;
	sum2=c*2;
	if(sum2<sum1)
	{
		sum3=sum2*min(x,y);
		if(x<y) 
		{
			int z;
			z=x;
			x=y;
			y=z;
			int d;
			d=a;
			a=b;
			b=d; 
		}
		if((x-y)*a<(x-y)*sum2)
		{
			cout<<sum3+(x-y)*a;
		}
		else
		{
			cout<<sum3+(x-y)*sum2;
		}
	}
	else{
		cout<<x*a+y*b;
	}
	return 0;
}

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
char chlit(char c){return c+32;}
char chbig(char c){return c-32;}

int main(){
  int a,b;cin >> a >> b;
  cout << gcd(a,b) << endl;
  return 0;
}



Measured memory_bytes: 3088
#include <stdio.h>

int main(void){
    long long int a, b, k;
    scanf("%lld%lld%lld", &a, &b, &k);

    if(a >= k){
        printf("%lld %lld\n", a-k, b);
    }else if(a + b >= k){
        printf("%lld %lld\n", 0, b - (k - a));
    }else{
        printf("0 0\n");
    }
    return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  I a,b;
  cin >> a >> b;
  if (a < 10 && b < 10){
    cout << a * b << endl;
  }else{
    cout << -1 << endl;
  }
  return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""
k = int(input())
under, upper = map(int, input().split())
ans = 'NG'
for i in range(under, upper + 1):
    if i % k == 0:
        ans = 'OK'
        break

print(ans)

Measured memory_bytes: 9176
use proconio::input;

const INF: usize = 1_000_000;

struct Helper {
  pub n: usize,
  pub memo: Vec<usize>
}

impl Helper {
  pub fn new(n: usize) -> Helper {
    Helper {
      n: n,
      memo: vec![INF;n+1]
    }
  }
  
  pub fn traverse(&mut self, left: usize) -> usize {
    if left == 0 {
      return 0
    }

    if self.memo[left] != INF {
      return self.memo[left]
    }
    let mut res = INF;

    let mut nine = 1;
    while nine <= left {
      res = std::cmp::min(self.traverse(left - nine) + 1, res);
      nine *= 9;
    }
    
    let mut six = 1;
    while six <= left {
      res = std::cmp::min(self.traverse(left - six) + 1, res);
      six *= 6;
    }

    self.memo[left] = res;
    res
  }
}

fn main() {
  input! {
    n: usize,
  }

  let mut helper = Helper::new(n);  
  println!("{}", helper.traverse(n));
}

Measured memory_bytes: 7460
#include<iostream>
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
    double r;
    cin>>r;
    cout<<fixed<<setprecision(8)<<r*r*4*atan(1)<<" "<<fixed<<setprecision(8)<<2*r*4*atan(1)<<endl;
    
}


Measured memory_bytes: 3276
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

a =  a.sort

ll = []
ll[0] = a[0]

n.times do |i|
  next if i == 0

  ll[i] = ll[i-1] + a[i]
end

ans = n



ll.reverse!

0.upto(n-2) do |i|
  next if ll[i] - ll[i+1] <= ll[i+1] * 2

  ans = i + 1
  break

end

puts ans


Measured memory_bytes: 11256
package main

import "fmt"

func main() {
	// Code for B - AtCoder Alloy
	var N, H, W int
	fmt.Scanf("%d %d %d", &N, &H, &W)

	var A, B int
	var ans int
	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d", &A, &B)
		if A >= H && B >= W {
			ans++
		}
	}

	fmt.Println(ans)
}


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

#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define pll pair<ll,ll>
#define sl set<ll>
#define sll set<pll>
#define mp make_pair
#define ff first
#define ss second
#define rep(i,m,n) for(ll i=(m);i<=(n);i++)
#define rem(i,m,n) for(ll i=(m);i>=(n);i--)
#define FOR(i,v) for(auto &(i) : (v))
#define ub upper_bound
#define lb lower_bound
#define mset(x,val) memset((x),(val),sizeof((x)))
#define MAP map<ll,ll>
#define MAPs map<ll,sl>
#define MAPv map<ll,vl>

const ll   INF = 0x7f7f7f7f7f7f7f7f;
const ll NINF = -INF;
const ll MAXN  = 1e+6 + 8;

int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

//<---------------------Declare global variables here------------------>//

//<---------------------Implement functions here------------------------->//



//<----------------------------Start of solve()------------------------------->//

void solve()
{
    ll n;
    cin>>n;
    vl v(n);
    rep(i,0,n-1)
    {
        cin>>v[i];
    }
    ll maxi = v[0],stool=0;

    rep(i,1,n-1)
    {
        if(v[i]<maxi)
        stool += maxi - v[i];
        maxi = max(maxi,v[i]);
    }

    cout<<stool;
    

}


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

#ifndef ONLINE_JUDGE
    cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
#endif

    return 0;
}

Measured memory_bytes: 4756
n = str(input())

nn = n[-1]
k = int(nn)

if(k==2 or k==4 or k==5 or k==7 or k==9):
    print('hon')
elif(k==0 or k==1 or k==6 or k==8):
    print('pon')
else:
    print("bon")


Measured memory_bytes: 9116
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,X;cin>>N>>X;
  vector<int> m(N);
  cin>>m[0];
  X-=m[0];
  int n=m[0];
  for(int i=1; i<N; i++){
    cin>>m[i];
    n=min(n,m[i]);
    X-=m[i];
  }
  cout<< N+X/n <<endl;
}

Measured memory_bytes: 256
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn gcd(a: usize, b: usize) -> usize {
    if b != 0 {
        gcd(b, a % b)
    } else {
        a
    }
}

fn main() {
    input! {
        k: usize,
    }

    let mut sum = 0;
    for i in 1..k + 1 {
        for j in 1..k + 1 {
            for l in 1..k + 1 {
                sum += gcd(i, gcd(j, l));
            }
        }
    }
    println!("{}", sum);
}


Measured memory_bytes: 2132
def solve(cu_num):
    if cu_num < 4:
        return False
    if cu_num % 4 == 0 or cu_num % 7 == 0:
        return True
    return solve(cu_num-4) or solve(cu_num-7)


num = int(input())

if solve(num):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    char s[1000];
    int a[100], i, j;
    while ( scanf("%s", s) != EOF ) {
        for ( i = 0; i < 10; i++ ) {
            if ( s[i] == '0') a[i] = 0;
            if ( s[i] == '1') a[i] = 1;
            if ( s[i] == '2') a[i] = 2;
            if ( s[i] == '3') a[i] = 3;
            if ( s[i] == '4') a[i] = 4;
            if ( s[i] == '5') a[i] = 5;
            if ( s[i] == '6') a[i] = 6;
            if ( s[i] == '7') a[i] = 7;
            if ( s[i] == '8') a[i] = 8;
            if ( s[i] == '9') a[i] = 9;
            /*printf("%d ", a[i]);*/
        }        
        for ( i = 10; i < 19; i++ ) a[i] = ( a[i - 10] + a[i - 9] ) % 10;  
        for ( i = 19; i < 27; i++ ) a[i] = ( a[i - 9] + a[i - 8] ) % 10; 
        for ( i = 27; i < 34; i++ ) a[i] = ( a[i - 8] + a[i - 7] ) % 10; 
        for ( i = 34; i < 40; i++ ) a[i] = ( a[i - 7] + a[i - 6] ) % 10; 
        for ( i = 40; i < 45; i++ ) a[i] = ( a[i - 6] + a[i - 5] ) % 10; 
        for ( i = 45; i < 49; i++ ) a[i] = ( a[i - 5] + a[i - 4] ) % 10; 
        for ( i = 49; i < 52; i++ ) a[i] = ( a[i - 4] + a[i - 3] ) % 10; 
        for ( i = 52; i < 54; i++ ) a[i] = ( a[i - 3] + a[i - 2] ) % 10; 
        for ( i = 54; i == 54; i++ ) a[i] = ( a[i - 2] + a[i - 1])  % 10;
        printf("%d\n", a[54]);
    }
    return 0;
}

Measured memory_bytes: 1736
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template<int Modulo = MOD>
struct Mint {

	lint val;
	constexpr Mint(lint v = 0) noexcept : val(v % Modulo) { if (val < 0) val += Modulo; }

	constexpr Mint& operator += (const Mint &r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint &r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint &r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint &r) noexcept {
		lint a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			lint t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}

	constexpr Mint operator + (const Mint &r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint &r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint &r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint &r) const noexcept { return Mint(*this) /= r; }

	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }

	constexpr bool operator == (const Mint &r) const noexcept { return val == r.val; }
	constexpr bool operator != (const Mint &r) const noexcept { return val != r.val; }

	friend ostream &operator << (ostream &os, const Mint<Modulo> &x) noexcept { return os << x.val; }
	friend istream &operator >> (istream &is, Mint<Modulo> &x) noexcept {
		lint tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo> &a, lint n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<lint> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	mint ans = 0;
	for (int bit = 0; bit < 61; bit++) {

		mint cnt = 0;
		for (int i = 0; i < N; i++) {
			if ((1LL << bit) & A[i]) cnt += 1;
		}

		ans += cnt * ((mint)N - cnt) * (1LL << bit);

	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 2560
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<cstdio>
#include<algorithm>
using namespace std;
int n,k,ans=0;
char c[100005];
inline int read(){
	char ch=getchar();
	int x=0,f=1;
	while(ch<'0' || ch>'9')	{if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9') {x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int main(){
    n=read(),k=read();
    for(int i=1;i<=n;i++){
		scanf("%c",&c[i]);
		if(c[i]==c[i-1]){
			ans++;
		}
    }
    printf("%d\n",min(n,k*2+ans+1)-1);
	return 0;
}



Measured memory_bytes: 256
#include <cstdio>

const int cnt=0;

int BinarySearch(int a[],int n,int key){
  int left=0,right=n,flag=0;
  while(left<right){
    int mid=(left+right)/2;
    if(a[mid]==key) {
      flag++;
      break;
    }
    else if(key<a[mid]) right=mid;
    else left=mid+1;
  }
  return flag;
}

int main(){
  int n,q,a[100000],key,cnt=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++) scanf("%d",&a[i]);
  scanf("%d",&q);
  for(int j=0;j<q;j++){
    scanf("%d",&key);
    cnt+=BinarySearch(a,n,key);
  }
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 1420
import fractions

N = int(input())

total = 0

for i in range(1, N + 1):
  total += i

for i in range(1, N + 1):
  for j in range(i + 1, N + 1):
    tmp = fractions.gcd(i, j)
    total += (tmp * 6)
    for k in range(j + 1, N + 1):
      total += (fractions.gcd(tmp, k) * 6)

print(total)

Measured memory_bytes: 10584
#include <stdio.h>
#include <string.h>
int main(void){
  int n,a,ans;
  ans=0;
  scanf("%d",&n);
  for(int i=1;i<n+1;i++){
    scanf("%d",&a);
    if(i%2==1){
      if(a%2==1){
        ans++;
      }
    }
  }
  printf("%d",ans);
  return 0;
}

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

int syc(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	int n;
	double t,a;
	cin >> n;
	cin >> t >> a;
	double b[n];
	double ans = 0,sa=1001001001,x,abs;
	
	for(int i=0;i<n;i++){
		cin >> b[i];
		x=t-b[i]*0.006;
		abs=(a-x)*(a-x);
		if(sa>abs){
			sa=abs;
			ans=i+1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  

  cin >>s;
  
  if(s.size()<26){
  int a[30] ={0};
    for(int i=0;i<s.size();i++)a[s[i]-'a']++;
    
    for(int i=0;i<26;i++){
      if (a[i]==0){
        s+='a'+i;
        break;
      }
    }
    
    cout << s <<endl;
  }
  
  else{
    if (s=="zyxwvutsrqponmlkjihgfedcba")cout << -1 <<endl;
    else{
      int ans=0;
      for(int i=s.size()-1;i>=0;i--){
        
        if(s[i-1]>s[i])ans++;
        
        else break;
      }
      s.erase(s.end()-1-ans,s.end());
      
      int a[30]={0};
      
      
      for(int i=0;i<s.size();i++)a[s[i]-'a']++;
      
      for(int i=0;i<26;i++){
        if (a[i]==0 && s[s.size()-1]<'a'+i){
          s.pop_back();
          s+='a'+i;
          break;
        }
      }
      cout <<s <<endl;
    }
  }
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_set>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;
const int maxn = 100005;

int n,m;
vector<int>e[maxn];
int ret;
int path[maxn],sz;

int dfs_2(int x,int fa) {
  int ret=1;
  for(int i=0; i<e[x].size(); i++) {
    int v=e[x][i];
    if(v==fa)continue;
    ret+=dfs_2(v,x);
  }
  return ret;
}

bool dfs(int x,int fa,int d){
  if(x==n){
    path[d]=x;
    sz=d;
    return true;
  }
  for(int i=0;i<e[x].size();i++){
    int v=e[x][i];
    if(v==fa)continue;
    if(dfs(v,x,d+1)){
      path[d]=x;
      return true;
    }
  }
  return false;
}


int main() {
#ifdef suiyuan2009
  freopen("in.cpp","r",stdin);
#endif // suiyuan2009
  cin>>n;
  for(int i=1; i<n; i++) {
    int x,y;
    cin>>x>>y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  dfs(1,0,1);
  for(int i=1;i<=(sz+1)/2;i++){
    int x=path[i];
    ret++;
    for(int j=0;j<e[x].size();j++){
      int v=e[x][j];
      if((i>1&&v==path[i-1])||v==path[i+1])continue;
      ret+=dfs_2(v,x);
    }
  }
  if(ret-1>=n-ret)cout<<"Fennec"<<endl;
  else cout<<"Snuke"<<endl;
  return 0;
}


Measured memory_bytes: 12288
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def main():
    a = input()
    b = input()
    c = input()
    
    print(a[0] + b[1] + c[2])
    
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 38384
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define all(x) (x).begin(),(x).end()
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;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int k; cin >> k;
	int ans = 0;
	if (k % 2 == 0) {
		ans = (k / 2)*(k / 2);
	}
	else {
		ans = (k / 2)*(k / 2 + 1);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
xor = a[0]
sm = a[0]
r = 1
ans = 0
for l in range(n):
  if l == r:
    xor = a[r]
    sm = a[r]
    r += 1
  while sm == xor and r <= n-1:
    xor = xor^a[r]
    sm = sm+a[r]
    ans += r-l
    r += 1
  if sm == xor:
    ans += 1
  xor = xor^a[l]
  sm = sm-a[l]
print(ans)

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N,K;
    cin>>N>>K;
    vector<int> X(N);
    REP(i,N) cin>>X[i];
    ll ans = INF;
    REP(i,N-K+1) {
        int l = i;
        int r = i + K - 1;
        ll temp1 = abs(X[l]) + abs(X[r] - X[l]);
        ll temp2 = abs(X[r]) + abs(X[r] - X[l]);
        ans = min(ans,min(temp1,temp2));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

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

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int main(){
	int n;
	double h;
	int nums[6];
	cin >> n;
	fill(nums, nums + 6, 0);
	rep(i, n){
		cin >> h;
		if(h < 165.0){
			nums[0]++;
		}else if(h < 170.0){
			nums[1]++;
		}else if(h < 175.0){
			nums[2]++;
		}else if(h < 180.0){
			nums[3]++;
		}else if(h < 185.0){
			nums[4]++;
		}else{
			nums[5]++;
		}
	}
	rep(i, 6){
		cout << i + 1 << ":";
		rep(j, nums[i]) cout << '*';
		cout << endl;
	}
	return 0;
}

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

int main () {
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long int a,b;
	while(cin>>a>>b)
	{
		int sum=0;
		for(long long int i=a;i<=b;i*=2)
		{
			sum++;
		}
		cout<<sum<<"\n";
	}

	return 0;
}



Measured memory_bytes: 256
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 21, mod = 1e9 + 7;
bool a[N][N];
short n;
ll dp[1 << N];
pair < int, int > mask[1 << N];
int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> a[i][j];
        }
    }
    dp[0] = 1;
    for(int mask = 0; mask < (1 << n); mask++){
        int man = __builtin_popcount(mask);
        for(int woman = 0; woman < n; woman++){
            if(((mask >> woman) & 1) || !a[man][woman])continue;
            int next_mask = mask | (1 << woman);
            dp[next_mask] += dp[mask]; 
            if(dp[next_mask] >= mod)dp[next_mask] -= mod; 
        }
    }
    cout << dp[(1 << n) - 1] << endl;
}

Measured memory_bytes: 16640
#include<iostream>
#include<functional>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>Q;
int n, m, k, a[100000], b[100000], c[100000], r[10000], dist[10000];
vector<pair<int, int>>x[10000];
void dijkstra() {
	for (int i = 1; i <= n; i++) dist[i] = 999999999;
	for (int i = 0; i < k; i++) { dist[r[i]] = 0; Q.push(make_pair(0, r[i])); }
	while (!Q.empty()) {
		int a1 = Q.top().first, a2 = Q.top().second; Q.pop();
		for (int i = 0; i < x[a2].size(); i++) {
			if (dist[x[a2][i].first] > a1 + x[a2][i].second) {
				dist[x[a2][i].first] = a1 + x[a2][i].second;
				Q.push(make_pair(dist[x[a2][i].first], x[a2][i].first));
			}
		}
	}
}
int main() {
	cin >> n >> m >> k;
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i] >> c[i]; 
		x[a[i]].push_back(make_pair(b[i], c[i]));
		x[b[i]].push_back(make_pair(a[i], c[i]));
	}
	for (int i = 0; i < k; i++)cin >> r[i];
	dijkstra();
	int maxn = 0;
	for (int i = 0; i < m; i++) {
		int R1 = min(dist[a[i]], dist[b[i]]);
		int R2 = (c[i] + abs(dist[a[i]] - dist[b[i]]) + 1) / 2;
		maxn = max(maxn, R1 + R2);
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 7020
#include<bits/stdc++.h>
using namespace std;
int a[1001][2],h,w;
int main()
{
	int i,n,t=0;
	scanf("%d %d %d",&n,&h,&w);
	for(i=1;i<=n;i++)
	{
		scanf("%d %d",&a[i][0],&a[i][1]);
		while(a[i][0]>=h&&a[i][1]>=w)
		{
			a[i][0]-=h;
			a[i][1]-=w;
			t++; 
		}
	}
	printf("%d",t);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  ll ans = 1;
  rep2(i, 1, n + 1) {
    ans *= i;
    ans %= 1000000007;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const double PI = acos(-1);

int main() {
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	double a_theta = 2 * PI * (h * 60 + m) / (12 * 60);
	double b_theta = 2 * PI * m / 60;
	double x = abs(a_theta-b_theta);
	if (x > PI) x = 2*PI - x;
	double ans = sqrt(abs(a*a + b*b - 2 * a * b * cos(x))); 
	cout << fixed << setprecision(20) << ans << endl;
	return 0;
}

Measured memory_bytes: 4164
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T iabs(const T& x) { return max(x, -x); }
// #define abs gabs

const i64 mod = 1e9 + 7;
i64 ipow(i64 a, i64 b) {
    i64 x = a, y = 1;
    for (; b > 0; b >>= 1) {
        if (b & 1) (y *= x) %= mod;
        (x *= x) %= mod;
    }
    return y;
}
i64 inv(i64 x) {
    return ipow(x, mod - 2);
}

int main() {
    int n;
    cin >> n;
    vector<i64> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];

    map<i64, i64> mp;
    for (i64 x : a) {
        for (i64 y = 2; y * y <= x; ++y) {
            i64 c = 0;
            while (x % y == 0) {
                c++;
                x /= y;
            }
            if (c > 0) {
                mp[y] = max(mp[y], c);
            }
        }
        if (x > 1) {
            mp[x] = max(mp[x], i64(1));
        }
    }

    i64 y = 1;
    for (auto p : mp) {
        (y *= ipow(p.first, p.second)) %= mod;
    }

    i64 ans = 0;
    for (i64 x : a) {
        ans += y * inv(x) % mod;
    }
    ans %= mod;

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

Measured memory_bytes: 896
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
    char W[10], str[1000];
    int i, count=0;
    scanf("%s", W);
    while(1){
        scanf("%s", str);
        if(strcmp(str, "END_OF_TEXT")==0){
            break;
        }
        for(i=0; i<1000; i++){
            str[i]=tolower(str[i]);
        }
        if(strcmp(str, W)==0){
            count++;
        }
    }
    printf("%d\n", count);
  
    return 0;
}


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

int main() {
  string S;cin>>S;
  if((S.at(2)==S.at(3))&&(S.at(4)==S.at(5))){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
     
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = []

import itertools
import numpy as np
import collections


Dist = np.array([[0]*N]*N)

for i in range (0, M):
	B, C = map(int, input().split())
	Dist[B-1][C-1] = 1
	Dist[C-1][B-1] = 1

V = collections.deque(itertools.permutations(range(0, N), N))

count = 0

while V:
	P = V.popleft()
	if P[0] == 0:
		d = 0
		for i in range (1, N):
			if Dist[P[i]][P[i-1]] == 1:
				d+=1
			else:
				break
		if d == N-1:
			count+=1
	else:
		continue        

print(count)

Measured memory_bytes: 31060
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    L = [int(l) for l in input().split()]
    count = 0
    if N <= 2: print(0)
    else:
        for i in range(N - 2):
            for j in range(i + 1, N - 1):
                for k in range(j + 1, N):
                    if L[i] != L[j] and L[j] != L[k] and L[k] != L[i]:
                        tri = [L[i], L[j], L[k]]
                        tri.sort()
                        if tri[0] + tri[1] > tri[2]: count += 1
    
        print(count)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 9216
import java.util.Scanner;

public class Main {
	
	public static int GCD(int a, int b) {
		int greater;
		int lesser;
		if (a >= b) {
			greater = a;
			lesser = b;
		}
		else {
			greater = b;
			lesser = a;
		}
		if (greater%lesser == 0) {
			return lesser;
		}
		else {
			return GCD(lesser,greater%lesser);
		}
	}
	
	public static void main(String[] args) {
		Scanner comp = new Scanner(System.in);
		int a = comp.nextInt();
		int b = comp.nextInt();
		int result = GCD(a, b);
		comp.close();
		System.out.println(result);
	}
}



Measured memory_bytes: 26268
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int X;

int main() {
  //
  cin >> X;
  if (X >= 30) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(){
   int i,b,r,n;
   char s[101];
    
   scanf("%d",&n);
   scanf("%s",s);
   for (i=r=b=0;i<n;i++)
      if (s[i]=='R') r++;
      else           b++;
   if (r>b) puts("Yes");
   else     puts("No");
   return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main (void)
{
	int d,i,m1,m2,m3;
	m1=m2=m3=0;
	for(i=0;i<10;i++){
		scanf("%d",&d);
		if(m1<=d){
			m3=m2;
			m2=m1;
			m1=d;
		}else{
			if(m2<=d){
				m3=m2;
				m2=d;
			}else{
				if(m3<=d){
					m3=d;
				}
			}
		}
	}
	printf("%d\n%d\n%d\n",m1,m2,m3);
	return 0;
}

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

int quick(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}

int main(void) {
  int n, p[102], a, b, ans = 0, flag = 1;

  if(scanf("%d %d %d", &n, &a, &b) == 1);

  for(int i = 0; i < n; i++) {
    if(scanf("%d", &p[i]) == 1);
  }

  qsort(p, n, sizeof(int), quick);

  for(int i = 0; i < n; i++) {
    if(p[i] >= 0 && p[i] <= a) {
      for(int j = i + 1; j < n; j++) {
        if(p[j] > a && p[j] <= b) {
          for(int k = j + 1; k < n; k++) {
            if(p[k] > b) {
              ans++;
              p[i] = p[j] = p[k] = - 1;
              k = j = 99;
            }
          }
        }
      }
    } else {
      break;
    }
  }

  printf("%d", ans);


  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;



int main()
{
	cin >> a;
	cout << "ABC" << a << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

public class Main {

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

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int pre = 4280;
		while (true) {
			int cost = scanner.nextInt();
			if (cost == -1)
				break;
			int ans = 1150;
			if (cost > 10)
				ans += (cost - 10) * 125;
			if (cost > 20)
				ans += (cost - 20) * 15;
			if (cost > 30)
				ans += (cost - 30) * 20;
			System.out.println(pre - ans);
		}
	}
}

Measured memory_bytes: 18600
s=str(input())
if s[0]!="A":
    print("WA")
    exit()
    
if s.count("C")!=1:
    print("WA")
    exit()
    
else:
    x=s.index("C")
    if x>=2 and x<=len(s)-2:
        y=s.replace("A","a")
        z=y.replace("C","c")
        if z.islower():
          print("AC")
        else:
          print("WA")
    else:
        print("WA")
               
    
        

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> strs;
    string s;
    for(int i = 0; i < n; i++) {
        cin >> s;
        strs.push_back(s);
    }
    sort(strs.begin(), strs.end());
    string ans = "";
    for(auto s: strs) {
        ans += s;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3672
N=int(input())
S=input()
L=list(S)
x=0
l=list()
for n in range(N):
  if L[n]=='I':
    x+=1
    l.append(x)
  elif L[n]=='D':
    x-=1
    l.append(x)
X=max(l)
print(max(X,0))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
// #define mod 1000000007LL
#define fi first
#define se second
const ll p = 1000000007;
const ll mod = 1000000007;
int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll i;
    ll pro = 1;
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a.begin(),a.end());
    if(a[0]==0){
        cout<<0;
        return 0;
    }
    for(i=0;i<n;i++)
        pro = pro*a[i];
    if(pro<=0 || pro>1000000000000000000)
        cout<<-1;
    else{
        for(i=0;i<n;i++)
            if(pro<a[i])
            {
                cout<<-1;
                return 0;
            }
        cout<<pro;  
    }
}   


Measured memory_bytes: 4000
#include <iostream>
#include <stdio.h>
using namespace std;
#define MAX 100

int main()
{
  int is[MAX];
  int i, j,v,N;
  scanf("%d", &N);
      for (i = 0; i<N;i++)
	    {scanf("%d", &is[i]);}
    for(int a = 0;a<N-1;a++)
              {printf("%d", is[a]);
              printf(" ");}
              printf("%d\n", is[N-1]);
  for(i = 1; i<N; i++)
    {
      v = is[i];
      j = i-1;
      while(j >= 0 &&is[j] > v)
          {is[j+1] = is[j];
          is[j] = v;
          j--;
          }
          for(int a = 0;a<N-1;a++)
              {printf("%d", is[a]);
              printf(" ");}
          printf("%d\n", is[N-1]);
  }
  
  return 0;
} 


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

int main(){
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	long long x, sum = 0;
	cin>>x;

	
	sum += x / 500 * 1000;
	x = x % 500;
	
	sum += x / 5 * 5;
	cout<<sum<<endl;
	return 0;
}


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

int dx[8] = {1,1,0,-1,-1,-1,0,1}, dy[8] = {0,1,1,1,0,-1,-1,-1};

int main() {
  ll H,W; cin >> H >> W;
  vector<string> S(H);
  rep(i,H) cin >> S[i];

  rep(i,H)rep(j,W){
    if(S[i][j] == '#') continue;
    int count = 0;
    rep(k,8){
      int nx = j + dy[k], ny = i + dx[k];
      if(nx >= 0 && ny >= 0 && nx < W && ny < H)if(S[ny][nx] == '#') count++;
    }
    S[i][j] = '0' + count;
  }

  rep(i,H){
    rep(j,W) cout << S[i][j];
    cout << endl;
  }

}

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

int main() {
	long x, ans = 0;
	size_t N;
	cin >> N >> x;
	vector<long> a(N);
	for (auto& x : a) cin >> x;
	for (size_t i = 1; i < N; ++i) {
		if (a.at(i - 1) + a.at(i) > x) {
			if (a.at(i - 1) <= x) {
				ans += a.at(i - 1) + a.at(i) - x;
				a.at(i) = x - a.at(i - 1);
			}
			else {
				ans += a.at(i - 1) - x;
				a.at(i - 1) = x;
				ans += a.at(i);
				a.at(i) = 0;
			}
		}
	}
	cout << ans;
}

Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        
        if(a + b == c || a + c == b || b + c == a) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 9812
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main()
{
	int n;
	scanf("%d", &n);
	string s;
	cin >> s;
	int count = 0;
	rep(i, n - 2) {
		if(s[i] == 'A'&& s[i + 1] == 'B'&& s[i + 2] == 'C') count++;
	}
	printf("%d\n", count);
	return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using ll = long long;
using ull = unsigned long long;


int main(void)
{
    IOS
    int n;
    cin >> n;
    vector<int> v(n);
    REP(i,n) cin >> v[i];

    sort(ALL(v));
    int h = n / 2 -1;
    int ans = v[h+1] - v[h];

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 768
import sys
#input = sys.stdin.buffer.readline

def main():
    s = str(input())
    ans = 1
    now,bef = "",s[0]
    l = len(s)
    for i in range(1,l):
        now += s[i]
        if now != bef:
            ans += 1
            bef = now
            now = ""
            
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 3500