akhauriyash/Code-Regression huggingface dataset:
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

typedef long long ll;

const int mod = 998244353;

const int nax = 3e5 + 5;
int mul(int a, int b) { return (ll) a * b % mod; }

int my_pow(int a, int b) {
	int r = 1;
	while(b) {
		if(b % 2) r = mul(r, a);
		a = mul(a, a);
		b /= 2;
	}
	return r;
}
int my_inv(int a) { return my_pow(a, mod - 2); }

int fac[nax], inv_fac[nax];

int C(int a, int b) {
	return (ll) fac[a] * inv_fac[b] % mod * inv_fac[a-b] % mod;
}

int main() {
	ll n, A, B, k;
	cin >> n >> A >> B >> k;
	fac[0] = inv_fac[0] = 1;
	for(int i = 1; i <= n; ++i) {
		fac[i] = mul(fac[i-1], i);
		inv_fac[i] = my_inv(fac[i]);
	}
	int answer = 0;
	for(ll a = 0; a <= n; ++a) {
		ll rem = k - a * A;
		if(rem < 0 || rem % B) continue;
		ll b = rem / B;
		if(b > n) continue;
		debug() << imie(a) imie(b);
		answer = (answer + (ll) C(n, a) * C(n, b)) % mod;
	}
	cout << answer << endl;
}


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

int main(){
    int n,h[6] = {0};
    float temp;
	
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>temp;

        if(temp < 165.0) h[0]++;
        else if(temp < 170.0) h[1]++;
        else if(temp < 175.0) h[2]++;
        else if(temp < 180.0) h[3]++;
        else if(temp < 185.0) h[4]++;
        else h[5]++;
    }

    for(int i=0;i<6;i++){
        cout<<i+1<<":";
        for(int j=0;j<h[i];j++)
            cout<<"*";
        cout<<endl;
    }
    return 0;
}

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

using namespace std;

int main(){
    int n,m,x,cost1=0,cost2=0;
    scanf("%d%d%d",&n,&m,&x);
    int a[m];
    for(int i=0;i<m ; ++i){
        scanf("%d",&a[i]);
    }
    for(int i=x;i<=n;++i){
        for(int j=0;j<m ; j++){
            if(a[j]==i && i!=x){
                cost1++;
            }
        }
    }
    for(int i=x;i>=0;--i){
        for(int j=0;j<m ; j++){
            if(a[j]==i && i!=x){
                cost2++;
            }
        }
    }
    if(cost1<cost2){
        printf("%d\n",cost1);
    }else {
        printf("%d\n",cost2);
    }
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int d,n,cnt=0,cntn=0,s,u=0;
    cin >> d >> n;
    u = 1 * pow(100, d);
    for (int i = (1*pow(100,d)); i < 1000000000; i += u) {
        cnt = 0;
        s = i;
        while (s % 100 == 0) {
            cnt++;
            s /= 100;
        }
        if (cnt == d)cntn++;
        if (cntn == n) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <map>
#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 <<endl
#define cs(x) cout << x <<" "
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
using namespace std;
int mod = 1e9 + 7;

int main()
{
	ll x;
	cin >> x;
	ll set = ceil((double)x / (double)11);
	if (x <= 11 * set - 5)
	{
		co(2 * set - 1);
	}
	else
	{
		co(2 * set);
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<complex>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second

int n,m,x1[300],yy1[300],x2[2000],y2[2000];
bool input(){
    scanf("%d",&m);
    if(m == 0)
        return false;
    REP(i,m)
        scanf("%d%d",x1 + i,yy1 + i);

    scanf("%d",&n);
    REP(i,n)
        scanf("%d%d",x2 + i,y2 + i);
    return true;
}

void solve(){
    REP(i,n){
        int x = x2[i] - x1[0];int y = y2[i] - yy1[0];
        int c = 0;
        REP(j,n){
            REP(k,m){
                if(x1[k] + x == x2[j] && yy1[k] + y == y2[j]){
                    c++;break;
                }
            }
        }
        if(c == m){
            printf("%d %d\n",x,y);
            break;
        }
    }
}

int main(){
    while(input())
        solve();
    return 0;
}

Measured memory_bytes: 3224
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

void Get_Val(int &Ret)
{
	Ret = 0;
	char ch;
	while (ch = getchar(), ch > '9' || ch < '0')
		;
	do
	{
		(Ret *= 10) += ch - '0';
	}
	while (ch = getchar(), ch >= '0' && ch <= '9');
}

const int Max_N(305);
const int MOD(1000000000 + 7);

struct xz
{
	xz(const int &_l = 0, const int &_x = 0) : l(_l), x(_x) {}
	int l, x;
};

inline bool comp(const xz &a, const xz &b)
{
	return a.l < b.l;
}

int N, M;
vector<xz> V[Max_N];

void init()
{
	Get_Val(N), Get_Val(M);
	int l, r, x;
	while (M--)
	{
		Get_Val(l), Get_Val(r), Get_Val(x);
		V[r].push_back(xz(l, x));
	}
}

inline void update(int &a, const int &b)
{
	(a += b) %= MOD;
}

bool check(const int &pos, const int &a, const int &b, const int &c)
{
	for (int i = 0, l, x;i != V[pos].size();++i)
	{
		l = V[pos][i].l, x = V[pos][i].x;
		if ((a >= l) + (b >= l) + (c >= l) != x)
			return false;
	}
	return true;
}

int F[Max_N][Max_N][Max_N];
void work()
{
	if (check(1, 0, 0, 1))
	{
		F[1][0][0] = 1;
		F[0][1][0] = 1;
		F[0][0][1] = 1;
	}
	for (int Max = 1, a, b, c;Max <= N - 1;++Max)
	{
		a = Max;
		for (b = 0;b <= a - 1;++b)
			for (int c = 0;c <= a - 1;++c)
			{
				if (b != 0 && b == c)
					continue;
				if (check(Max + 1, Max + 1, b, c))
					update(F[Max + 1][b][c], F[a][b][c]);
				if (check(Max + 1, a, Max + 1, c))
					update(F[a][Max + 1][c], F[a][b][c]);
				if (check(Max + 1, a, b, Max + 1))
					update(F[a][b][Max + 1], F[a][b][c]);
			}
		b = Max;
		for (a = 0;a <= b - 1;++a)
			for (c = 0;c <= b - 1;++c)
			{
				if (a != 0 && a == c)
					continue;
				if (check(Max + 1, Max + 1, b, c))
					update(F[Max + 1][b][c], F[a][b][c]);
				if (check(Max + 1, a, Max + 1, c))
					update(F[a][Max + 1][c], F[a][b][c]);
				if (check(Max + 1, a, b, Max + 1))
					update(F[a][b][Max + 1], F[a][b][c]);
			}
		c = Max;
		for (a = 0;a <= c - 1;++a)
			for (b = 0;b <= c - 1;++b)
			{
				if (a != 0 && a == b)
					continue;
				if (check(Max + 1, Max + 1, b, c))
					update(F[Max + 1][b][c], F[a][b][c]);
				if (check(Max + 1, a, Max + 1, c))
					update(F[a][Max + 1][c], F[a][b][c]);
				if (check(Max + 1, a, b, Max + 1))
					update(F[a][b][Max + 1], F[a][b][c]);
			}
	}
	int Ans(0);
	for (int a = 0;a <= N;++a)
		for (int b = 0;b <= N;++b)
			for (int c = 0;c <= N;++c)
				if (a == N || b == N || c == N)
					update(Ans, F[a][b][c]);
	printf("%d", Ans);
}

int main()
{
	init();
	work();
	return 0;
}

Measured memory_bytes: 110848
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> can(N);
    for(int i = 0; i < N; i++) cin >> can[i];
    int l = 0, r = K-1;
    int cost = INF_INT;
    while(r < N){
        cost = min(cost,min(abs(can[l]) + abs(can[l] - can[r]),abs(can[r]) + abs(can[l] - can[r])));
        l++;r++;
    }
    cout << cost << endl;
    return 0;
}


Measured memory_bytes: 3720
N, M = map(int,input().split())
t_mid = set()
f_mid = set()
for _ in range(M):
    f, t = map(int,input().split())
    if f == 1:
        t_mid.add(t)
    elif t == N:
        f_mid.add(f)

if t_mid & f_mid:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


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

int match(int l1, int r1, int l2, int r2) {
	if(l1 == 5 && r1 == 5) return -1;

	if(l1 != 5) {
		if(l2 != 5) {
			if(-match(min(l2 + l1, 5), r2, l1, r1) == 1) return 1;
		}
		if(r2 != 5) {
			if(-match(l2, min(r2 + l1, 5), l1, r1) == 1) return 1;
		}
	}
	if(r1 != 5) {
		if(l2 != 5) {
			if(-match(min(l2 + r1, 5), r2, l1, r1) == 1) return 1;
		}
		if(r2 != 5) {
			if(-match(l2, min(r2 + r1, 5), l1, r1) == 1) return 1;
		}
	}
	return -1;
}

int main() {
	int l1, r1, l2, r2;
	cin >> l1 >> r1 >> l2 >> r2;
	if(match(l1, r1, l2, r2) == 1) {
		cout << "ISONO" << endl;
	}
	else {
		cout << "NAKAJIMA" << endl;
	}
}

Measured memory_bytes: 1160
use io::*;

fn main() {

    let con = read_string();
    let mut sc = Scanner::new(&con);

    let r: usize = sc.next();

    if r < 1200 { println!("ABC"); }
    else if r < 2800 { println!("ARC"); }
    else {println!("AGC");}

}

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 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
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int a,b;
    cin>>a>>b;
    cout<<a*b<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 3656
import java.util.Scanner;


public class Main {
	
	public static boolean is_big_month(final int y, final int m){
		if(y % 3 == 0){ return true; }
		if(m % 2 == 0){ return true; }
		return false;
	}
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		
		for(int tt = 0; tt < n; tt++){
			final int y = sc.nextInt();
			final int m = sc.nextInt() - 1;
			final int d = sc.nextInt() - 1;
			
			int count = 0;
			
			int cur_d = d, cur_m = m;
			for(int cur_y = y; cur_y < 1000; cur_y++){
				if(cur_d > 0){
					count += (is_big_month(cur_y, cur_m) ? 20 : 19) - cur_d;
					cur_d = 0;
					cur_m ++;
					
					if(cur_m >= 10){
						cur_m = 0;
						continue;
					}
				}
				
				while(cur_m < 10){
					count += (is_big_month(cur_y, cur_m) ? 20 : 19);
					cur_m++;
				}
				
				if(cur_m >= 10){
					cur_m = 0;
					continue;
				}
			}
			
			System.out.println(count);
		}
		
		
	}
}

Measured memory_bytes: 20456
#include<stdio.h>
int n,A[50];
int solve(int i,int m){
  if(m==0) return 1;
  if(i>=n) return 0;
  int res = solve(i+1,m)||solve(i+1,m-A[i]);
  return res;
}
int main(){
  int q,M,i;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
  scanf("%d",&M);
  if(solve(0,M)) printf("yes\n");
  else printf("no\n");
  }
  return 0;
}



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

int parse(string a){
int s=0;
for(char b:a){
	s*=10;
	s+=b-48;
}
return s;
}
vector<int>split(string a){
	vector<int>b;
	string c="";
	for(char d:a){
		if(d==','){b.push_back(parse(c));c="";}
		else c+=d;
	}
	b.push_back(parse(c));
	return b;
}
int main(){
	int a[30];
	int b,c;
	scanf("%d%d",&b,&c);
	for(int d=0;d<b;d++){
		a[d]=d;
	}
	for(int e=0;e<c;e++){
		string f;
		cin>>f;
		vector<int>g=split(f);
		int h=a[g[0]-1];
		a[g[0]-1]=a[g[1]-1];
		a[g[1]-1]=h;
	}
	for(int x=0;x<b;x++){
		printf("%d\n",a[x]+1);
	}
}

Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int m,n,k,i;
	scanf("%d %d %d",&m,&n,&k);
	for(i=m;i<=(m+k-1>n?n:m+k-1);i++)
	{
		printf("%d\n",i);
	}
	for(i=(n-k+1>m+k-1?n-k+1:m+k-1+1);i<=n;i++)
	{
		printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int numofdig(long long int n,long long int k)
{
    long long int dig=0;
    while(n!=0)
    {
        n/=k;
        dig++;
    }
    return dig;
}
int main()
{
    long long int i,j,x,n,k;
    cin>>n>>k;
    cout<<numofdig(n,k)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e5;
typedef long long ll;

int main(){
	int l, r, d;
	cin >> l >> r >> d;
	int s = d, ans = 0;;
	while(s <= r){
		if(s >= l) ans++;
		s += d;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
signed main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    int best = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            best = max(best, abs(a[i] - a[j]));
        }
    }
    put(best);

    return 0;
}

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

int main()
{
    int A, B, M;
    cin >> A >> B >> M;
  
    vector<int> a(A);
    vector<int> b(B);
    
    rep(i, A)
    {
      cin >> a[i];
    }
  
    rep(i, B)
    {
      cin >> b[i];
    }
  
	int min_a = *min_element(a.begin(), a.end());
	int min_b = *min_element(b.begin(), b.end());

  	int min_price = min_a + min_b;
  
    rep(i, M)
    {
      int x, y, c;
      cin >> x >> y >> c;
      x--;
      y--;
      
      min_price = min(min_price, a[x] + b[y] - c);
    }

    cout << min_price << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
  int t[4];
  int n[4];
  for(int i=0;i<4;i++){
    cin >>t[i]>>n[i];
  }
  for(int i=0;i<4;i++){
    if(t[i]==1) cout <<6000*n[i]<<endl;
    if(t[i]==2) cout <<4000*n[i]<<endl;
    if(t[i]==3) cout <<3000*n[i]<<endl;
    if(t[i]==4) cout <<2000*n[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3108
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

//long long a[1002];


int main()
{
	long long N, K, cnt = 0, tmp, ans = 0;
	string S;
	cin >> S;
	vector<int> sum(S.size());
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A' || S[i] == 'C' || S[i] == 'T' || S[i] == 'G') {
			cnt++;
		}
		else {
			cnt = 0;
		}
		sum[i] = cnt;
	}

	sort(sum.begin(), sum.end());

	cout << sum[S.size() - 1];

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 256
<?php
// $n = (int)trim(fgets(STDIN));
$input = explode(' ', trim(fgets(STDIN)));

$a = (int)$input[0];
$b = (int)$input[1];

if ($a <= 5) {
	$result = 0;
}elseif ($a <= 12) {
	$result = (int)floor($b/2);
}else{
	$result = $b;
}
echo $result;

Measured memory_bytes: 4728
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)

using namespace std;
using ll = __int64_t;

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

void solve(){
  int x[11];
  cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4];
  x[5] = x[0];
  x[6] = x[1];
  x[7] = x[2];
  x[8] = x[3];
  x[9] = x[4];
  int res = 1000;

  for(int i = 0; i < 5; i++){
    int time = 0;
    for(int j = i; j < i+5; j++){
      time += x[j];
      if(time%10 != 0 && j != i+4){
        time += 10 - (time%10);
      }
    }
    if(res > time){
      res = time;
    }
  }
  cout << res << endl;
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <bitset>
#include <complex>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int main() {
	multiset<int> s;
	int q; cin >> q;
	rep(i, q) {
		int t, x;
		cin >> t;

		switch (t) {
		case 0:
			cin >> x;
			s.insert(x);
			Cout(sz(s));
			break;
		case 1:
			cin >> x;
			Cout(s.count(x));
			break;
		case 2:
			cin >> x;
			s.erase(x);
			break;
		case 3:
			int l, r; cin >> l >> r;
			auto it = s.lower_bound(l);
			auto last = s.upper_bound(r);
			while (it != last) {
				Cout(*it);
				it++;
			}
		}
	}
}


Measured memory_bytes: 12384
#include<iostream>
#include<vector>
 
using namespace std;
 
int calc(int a, int b, char c){
 
  if(c == '+') return a+b;
  if(c == '-') return a-b;
  if(c == '*') return a*b;
  if(c == '/') return a/b;
 
}
 
int main(){
  int ans;
  cin >> ans;
 
  char c;
  while(1){
    cin >> c;
    if(c == '=') break;
    int a;
    cin >> a;
    ans = calc(ans,a,c);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1160
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 X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

R, D = I()
if R <= 8 and D <= 8:
    print("Yay!")
else:
    print(":(")


Measured memory_bytes: 10000
#include<iostream>
#include<math.h>
#include<string>

using namespace std;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string s, t;
    cin>>s>>t;

    int n = s.size();
    int m = t.size();

    int minChange = 2147483647;

    for(int i=0;i<n-m+1;i++){

        string sub = s.substr(i, m);
        int change = 0;
        for(int j = 0; j<sub.size();j++)
            if(sub[j]!=t[j])
                change++;

        minChange = min(minChange, change);
    }

    cout<<minChange;


    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <deque>
#include <cctype>
using namespace std;

class BigInt {
    static const int base = 10;
    public:
    deque<int> digits;
    BigInt() {
    }
    BigInt operator +(BigInt x) {
        BigInt c;

        // add
        auto di = digits.begin(), xi = x.digits.begin(), end = digits.end();
        for (; di != end && xi != x.digits.end(); di++, xi++)
            c.digits.push_back(*di + *xi);

        // set rest
        if (di == digits.end()) {
            di = xi;
            end = x.digits.end();
        }


        for (; di != end; di++)
            c.digits.push_back(*di);

        // nomalize
        int carry = 0;
        for (int i = 0; i < c.size(); i++) {
            c.digits[i] += carry;
            carry = c.digits[i] / base;
            c.digits[i] %= base;
        }
        if (carry)
            c.digits.push_back(carry);

        return c;
    }
    int size() {
        return digits.size();
    }
    istream &read(istream &is) {
        digits.clear();
        cin.ignore();

        int s;
        while (s = cin.get(), isdigit(s))
            digits.push_front(s - '0');
        is.putback(s);

        return is;
    }
    ostream &write(ostream &os) {
        for (auto di = digits.rbegin(); di != digits.rend(); di++)
            cout << *di;
        return os;
    }
};

istream &operator>>(istream &is, BigInt &b) { return b.read(is); }
ostream &operator<<(ostream &os, BigInt &b) { return b.write(os); }

int main()
{
    for (int n; cin >> n;)
        for (BigInt a, b, c; n-- && cin >> a >> b;) {
            c = a + b;
            if (c.size() <= 80)
                cout << c << endl;
            else
                cout << "overflow" << endl;
        }

    return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int main()
{
	int n;
	cin >> n;
	vector<ll> c(n);
	for(auto &i:c)cin >> i;
	c.erase(unique(c.begin(),c.end()),c.end());
	//for(auto &i:c)cout<<i<<endl;
	vector<int> tmp(200001,0);
	
	tmp[c[0]]=1;
	for(int i = 1;i<c.size();i++)
	{
		if(tmp[c[i]])
		{
			(tmp[c[i]] += tmp[c[i-1]])%=MOD;
		}
		else
		{
			(tmp[c[i]] = tmp[c[i-1]])%=MOD;
		}
	}
	cout<<tmp[c.back()]<<endl;
}

Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main () {
	int a, b, c, d, p;
	int priceA, priceB;
	cin >> a >> b >> c >> d >> p;
	priceA = a * p;
	if (p <= c) {
		priceB = b;
	} else {
		priceB = b + (p - c) * d;
	}
	cout << min(priceA, priceB) << endl;
	return 0;
}

Measured memory_bytes: 3084
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<deque>
using namespace std;
typedef long long int ll;

#define MAX_A 1000000
const ll MOD = 1e9+7;

ll rep(int n){

    ll a = 1;
    for(int i = 1;i <= n;i++){
        a = a*i%(MOD);
    }

    return a;

}


int main(){

    int n,m;
    cin  >> n >> m;
    if(abs(n-m) >= 2){
        cout << "0" << endl;
        return 0;
    }
    int a = 1,b = 1;

    a = rep(n);//cout << a << endl;
    b = rep(m);//cout << b << endl;

    ll ans = 0;
    if(abs(n-m) == 1){
        ans = (a*(b%(MOD)))%MOD;

    }else{
        ans = (a*(b*2%MOD))%MOD;
        //ans = a*b*2%MOD;
    }

    cout << ans << endl;  

    return 0;

}

Measured memory_bytes: 256
while True:
	H,W = list(map(int, input().split()))
	if (H == 0 and W == 0):
		break
	else:
		for n in range(H):
			s = ""
			for m in range(W):
				if ((n % 2 == 1) and (m % 2 == 0)) or ((n % 2 == 0) and (m % 2 == 1)):
					s += "."
				else:
					s += "#"
			print(s)
		print("")

Measured memory_bytes: 7688
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            string O = Console.ReadLine();
            string E = Console.ReadLine();

            for(int i = 1;i < O.Length + E.Length+1 ; i++)
            {
                if(i%2 == 1)
                {
                    Console.Write(O[i / 2]);
                }
                else
                {
                    Console.Write(E[(i-1) / 2]);
                }
            }
        }
    }
    struct Vector2
    {
        public Vector2(long x, long y)
        {
            this.x = x;
            this.y = y;
        }
        public long x;
        public long y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << endl;}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
string solve() {
	var(int, n);
	string s0, s;
	cin >> s0;
	set<string> ss;
	ss.em(s0);
	rep(i, 0, n - 1) {
		cin >> s;
		if (s0.back() != s[0] || ss.find(s) != ss.end())
			return "No";
		ss.em(s);
		s0 = s;
	}
	return "Yes";
}
int main() {
	print(solve());
	return 0;
}


Measured memory_bytes: 384
while(1):
    h,w = [int(i) for i in input().split()]
    if h == 0 and w == 0:
        break
    for i in range(h):
        if i%2 == 0:
            print("#."*(w//2)+"#"*(w%2))
        else:
            print(".#"*(w//2)+"."*(w%2))
    print("")
    


Measured memory_bytes: 5616
//51
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int rec(string a,string b){
  int f;
  for(f=0;f<a.size()&&a[f]==b[f];f++);
  int l;
  for(l=a.size()-1;0<=l&&a[l]==b[l];l--);
  a=a.substr(f,l+1-f);
  b=b.substr(f,l+1-f);
  if(a.empty()){
    return 0;
  }else{
    int d=(b[0]-a[0]+10)%10;
    int m=1<<30;
    for(int j=1;j<=a.size();j++){
      string c=a;
      for(int i=0;i<j;i++){
	c[i]=(a[i]-'0'+d)%10+'0';
      }
      m=min(m,rec(c,b));
    }
    return m+1;
  }
}

int main(){
  for(int k;cin>>k,k;){
    string i,u;
    cin>>i>>u;
    cout<<rec(i,u)<<endl;
  }
  return 0;
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
   string s1,s2;
   string s="";
   int n;
   cin>>n;
   cin>>s1>>s2;
   for(int i=0;i<n;i++)
   {
       s+=s1[i];
       s+=s2[i];
   }
   cout<<s;

}


Measured memory_bytes: 3624
//連想配列
//ABC91B
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define LINT long long

int main(){
  int N, M;
  string work;
  //stringがキー，intの値を持つ連想配列
  //値は0で初期化されている？
  map<string, int> mp;

  cin >> N;
  REP(i, N){
    cin >> work;
    mp[work] += 1;
  }
  cin >> M;
  REP(i, M){
    cin >> work;
    mp[work] -= 1;
  }

  //連想配列を全部みる
  //for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
  //      std::cout << "key = " << itr->first           // キーを表示
  //                      << ", val = " << itr->second << "\n";    // 値を表示
  //}

  int maximum=0;
  for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
    maximum = max(maximum, itr->second);
  }

  cout << maximum << endl;
  return 0;
}


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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ld long double
#define mem(x,y) memset(x,y,sizeof x)

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
/*
 * Be careful of overflow
 * Array bounds
 * Assert a!=0 when performing x/a
 * Check base condition for recursion
 * Iterator -> O(1), Element -> O(log n) while using erase
 * 1LL<<x when x>32
 * Be sure of what you are going to code (exception dp)
 * Don't try fancy tricks during contest
 * You can always make a bad round to a good enough round
 */ 

void solve()
{
	string s;
	cin>>s;
	int sum=0;
	for(auto u:s) sum+=(u-'0');
	sum%=9;
	if(sum==0) cout<<"Yes";
	else cout<<"No";
}

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


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

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    ll ans;

    if(b<0&&c>0)ans=b*c;
    else if (a>0&&d<0)ans=a*d;
    else ans=max(a*c,b*d);
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
 
using namespace std;
int main() {
  string s1, s2;
  cin >> s1 >> s2;
  if (s1[0] == s2[2] && s1[1] == s2[1] && s1[2] == s2[0])
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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

int main(){
  int N,K;
  int s = 1;
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    if(s *2 < s + K){
      s = s * 2;
    }
    else{
      s = s + K;
    }
  }
  cout << s << endl;
}

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

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 6
#define maxNC 300

int n, c, i;
int L[maxN];
int ord[maxN], wh[maxN];

ll dp[maxNC + 1][1 << maxN][maxNC]; //! [pos][conf][last]
ll ans;

ll solve() {
    int pos, conf, last, i;
    int lim_nc = n * c;
    int lim_conf = 1 << n;

    int fin_id;
    int fin_block;
    int fin_frac;

    int act_id;
    int act_block;
    int act_frac;

    int act_fin_block;
    int best;

    memset(dp, 0, sizeof(dp));
    for (i = 0; i < n; i++) wh[ord[i]] = i;

    dp[0][1][0] = 1;
    for (pos = 0; pos < lim_nc; pos++) {
        for (conf = 0; conf < lim_conf; conf++) {
            for (last = 0; last < lim_nc; last++) {
                if (dp[pos][conf][last] == 0) continue;

                dp[pos + 1][conf][last] += dp[pos][conf][last];
                act_id = ord[pos % n];
                if ((conf >> act_id) & 1) continue;

                fin_id = ord[last % n];
                fin_block = (last / n) + L[fin_id];
                fin_frac = last % n;

                act_block = pos / n;
                act_fin_block = act_block + L[act_id];
                act_frac = pos % n;

                if (fin_block < act_block) continue;
                if (fin_block == act_block && fin_frac < act_frac) continue;

                best = pos;
                if (act_fin_block < fin_block) best = last;
                if (act_fin_block == fin_block && act_frac < fin_frac) best = last;

                dp[pos + 1][conf | (1 << act_id)][best] += dp[pos][conf][last];
            }
        }
    }

    ll ans = 0;
    for (pos = 0; pos < lim_nc; pos++) {
        act_id = ord[pos % n];
        act_block = (pos / n) + L[act_id];

        if (act_block >= c)
            ans += dp[lim_nc][lim_conf - 1][pos];
    }

    return ans;
}

int main()
{
   // freopen("test.in","r",stdin);

    scanf("%d%d", &n, &c);
    for (i = 0; i < n; i++) scanf("%d", &L[i]), ord[i] = i;
    sort(L, L + n);
    reverse(L, L + n);

    do {
        ans += solve();
    } while (next_permutation(ord + 1, ord + n));


    double sol = 1.00 * ans;
    for (i = 1; i < n; i++) sol /= 1.00 * i;
    for (i = 1; i < n; i++) sol /= 1.00 * c;

    printf("%.20lf", sol);


    return 0;
}


Measured memory_bytes: 45440
#include <cstdio>
#include <algorithm>
const int N = 105;
using LL = long long;
int n, x, a[N], pos;
LL sum[N];
int main() {
	std::scanf("%d%d", &n, &x);
	for (int i = 1; i <= n; i++) std::scanf("%d", &a[i]);
	std::sort(a + 1, a + n + 1);
	for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
	for (int i = 1; i <= n; i++) if (sum[i] <= x) pos = i;
	if (pos == n) std::printf("%d\n", sum[n] == x ? n : n - 1);
	else std::printf("%d\n", pos);
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define MAX 25
#define NIL -1

struct Node {
    int p, l, r;
};

Node T[MAX];

void preorder(int n) {
    printf(" %d", n);
    if (T[n].l!=-1) {
        preorder(T[n].l);
    }
    if (T[n].r!=-1) {
        preorder(T[n].r);
    }
}

void inorder(int n) {
    if (T[n].l!=-1) {
        inorder(T[n].l);
    }
    printf(" %d", n);
    if (T[n].r!=-1) {
        inorder(T[n].r);
    }
}

void postorder(int n) {
    if (T[n].l!=-1) {
        postorder(T[n].l);
    }
    if (T[n].r!=-1) {
        postorder(T[n].r);
    }
    printf(" %d", n);
}

int main() {
    int num, i, j, n;
    scanf("%d", &n);

    for (i=0; i<n; i++) T[i].p=T[i].l=T[i].r=-1;

    for (i=0; i<n; i++) {
        scanf("%d", &j);
        scanf("%d", &num);
        T[j].l = num;
        T[T[j].l].p = j;
        scanf("%d", &num);
        T[j].r = num;
        T[T[j].r].p = j;
    }

    while (T[num].p!=-1) num = T[num].p;

    printf("Preorder\n");
    preorder(num);
    printf("\n");
    printf("");
    printf("Inorder\n");
    inorder(num);
    printf("\n");
    printf("");
    printf("Postorder\n");
    postorder(num);
    printf("\n");
    printf("");

    return 0;
}


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

using namespace std;
using Graph = vector<vector<int>>;
using Grid= vector<vector<char>>;
using vin= vector<int>;
using ll=long long;
using vll= vector<ll>;
using vbl=vector<bool>;
using vch=vector<char>;
using pinin=pair<int ,int>;

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

string yes="Yes",no="No";

int main() {
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if(s==u) cout<<a-1<<" "<<b<<endl;
    if(t==u) cout<<a<<" "<<b-1<<endl;
    
    

}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
using namespace std;
 
#define rep for(int i = 0;i<n;i++)
const int MOD = 1000000007;
 
int main(){
    int a,b;cin >> a >> b;
    string ans;
    if(a<=0 and b>=0 ){
        ans = "Zero";
    }else if(a< 0 and b<0 &&  (a-b)%2== 0){
        ans = "Negative";
    }else{
        ans = "Positive";
    }
    cout << ans << endl;
}

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

bool sankaku(int x, int y, int z) {
  if (x == y || y == z || z == x ) {
    return false;
  }
  if (x + y > z && y + z > x && z + x > y ) {
    return true;
  }
  return false;
}
 
int main() {
  int n;
  cin >> n;
  if (n < 3) {
    cout << 0 << endl;
    return 0;
  }
  int count = 0;
  map<int, int> L;
  for (int i = 0; i < n; i++){
    int l;
    cin >> l;
    L[i] = l;
  }
  for (int i = 0; i < n; i++){
    for (int j = i+1; j < n; j++){
      for (int k = j+1; k < n; k++){
        if (sankaku(L[i], L[j], L[k])) {
          count++;
        }
      }
    }
  } 
  cout << count << endl;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k; cin>>k;
  cout<<a[k-1];
  return 0;
}

Measured memory_bytes: 3636
def resolve():
    s = input()
    if s == "SUN":
        print(7)
    elif s == "MON":
        print(6)
    elif s == "TUE":
        print(5)
    elif s == "WED":
        print(4)
    elif s == "THU":
        print(3)
    elif s == "FRI":
        print(2)
    elif s == "SAT":
        print(1)
resolve()

Measured memory_bytes: 38484
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		List<Integer> list = new ArrayList<>();
		list.add(sc.nextInt());
		list.add(sc.nextInt());
		System.out.println(!list.contains(1) ? 1 : (!list.contains(2) ? 2 : 3));
	}
}


Measured memory_bytes: 35512
#include <cmath>
#include <iostream>
#include <cstdio>
#include <set>

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

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

char getInput(){
  char c[2];
  scanf("%s", c);
  return c[0];
}

char s[100][32];
int t[100];

int main(){
  const int n = getInt();
  const int h = getInt();

  REP(i,n){
    scanf("%s", s[i]);
    t[i] = getInt();
  }

  int hp = h;
  int cp = 0;
  int type = 0;
  int wrong = 0;

  int ws = 0;
  int cs = 0;

  while(true){
    string ss = s[cp];
    REP(i,type) ss[i] = '_';
    printf("? %s\n", ss.c_str()); fflush(stdout);

    const char c = getInput();
    if(tolower(c) == tolower(s[cp][type])){
      type++;
      cs++;
    }else{
      wrong++;
      ws++;
    }

    if(s[cp][type] == '\0'){
      cp++; type = 0; wrong = 0;
    }else if(wrong > t[cp]){
      cp++; type = 0; wrong = 0;
      hp--;
    }

    if(hp == 0){
      printf("! Game Over\n"); fflush(stdout);
      break;
    }else if(cp == n){
      printf("! Game Clear %.1f\n", floor((double)cs * 1000 / (ws + cs)) / 10); fflush(stdout);
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 1304
n, m, _ = gets.split.map(&:to_i)
r = gets.split.map { |z| z.to_i - 1 }
max = 1e10
d = Array.new(n) { Array.new(n, max) }
m.times do
  a, b, c = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  d[a][b] = c
  d[b][a] = c
end
n.times do |k|
  dk = d[k]
  n.times do |i|
    next if i == k
    di = d[i]
    dik = di[k]
    (0...n).each do |j|
      tmp = dik + dk[j]
      di[j] = tmp if tmp < di[j]
    end
  end
end

ans = r.permutation.map do |perm|
  perm.each_cons(2).inject(0) { |sum, (x, y)| sum + d[x][y] }
end.min

p ans


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

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

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

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

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

vector<string> split_naive(const string &s, char delim) {
	vector<string> elems;
	string item;
	for(char ch:s){
		if(ch==delim){
			if(!item.empty()) elems.push_back(item);
			item.clear();
		}
		else{
			item += ch;
		}
	}
	if(!item.empty()) elems.push_back(item);
	return elems;
}

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

	char S[1000];
	while(cin.getline(S,sizeof(S))){
		auto SS=split_naive(S,' ');
		stack<string> Stack;
		for(int i=0,ei=SS.size();i<ei;i++){
			char str[1000];
			if(SS[i]=="+"){
				auto r = Stack.top();
				Stack.pop();
				auto l = Stack.top();
				Stack.pop();
				double vr,vl;
				sscanf(r.c_str(),"%lf",&vr);
				sscanf(l.c_str(),"%lf",&vl);
				sprintf(str,"%.10lf",vr+vl);
				Stack.push(str);
			}
			else if(SS[i]=="-"){
				auto r = Stack.top();
				Stack.pop();
				auto l = Stack.top();
				Stack.pop();
				double vr,vl;
				sscanf(r.c_str(),"%lf",&vr);
				sscanf(l.c_str(),"%lf",&vl);
				sprintf(str,"%.10lf",vl-vr);
				Stack.push(str);
			}
			else if(SS[i]=="*"){
				auto r = Stack.top();
				Stack.pop();
				auto l = Stack.top();
				Stack.pop();
				double vr,vl;
				sscanf(r.c_str(),"%lf",&vr);
				sscanf(l.c_str(),"%lf",&vl);
				sprintf(str,"%.10lf",vl*vr);
				Stack.push(str);
			}
			else if(SS[i]=="/"){
				auto r = Stack.top();
				Stack.pop();
				auto l = Stack.top();
				Stack.pop();
				double vr,vl;
				sscanf(r.c_str(),"%lf",&vr);
				sscanf(l.c_str(),"%lf",&vl);
				sprintf(str,"%.10lf",vl/vr);
				Stack.push(str);
			}
			else Stack.push(SS[i]);
		}
		auto v = Stack.top();
		double d;
		sscanf(v.c_str(),"%lf",&d);
		if(abs(d)<=1e-7) d=0;
		printf("%.6lf\n",d);
	}
	return 0;
}


Measured memory_bytes: 3268
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=20005;
int n,a[N];
bool vis[N*2];
vector<int>v1,v2;
int main()
{
    scanf("%d",&n);
    if(n==3)
    {
        cout<<2<<' '<<5<<' '<<63<<endl;
        return 0;
    }
    if(n==4)
    {
        cout<<2<<' '<<5<<' '<<20<<' '<<63<<endl;
        return 0;
    }
    a[1]=2;a[2]=3;a[3]=30;
    int now=4;
    for(int now=4;now<=30000;now++)
        if(now%2==0||now%3==0)
    {
        if(now==2||now==3||now==30) continue;
        if(now&1) v1.push_back(now);
        else v2.push_back(now);
    }
    int si=3,i=0,j=0;
    a[++si]=v1[i++];
    while(si<n-1)
    {
        if(si+2<n&&i+2<=v1.size()) a[++si]=v1[i++],a[++si]=v1[i++];
        else if(si+1<n&&j+1<=v2.size()) a[++si]=v2[j++];
        else break;
    }
    ll sum=0;
    for(int i=1;i<n;i++)
        sum+=a[i];
    for(;j<v2.size();j++)
        if((sum+v2[j])%3==0)
    {
        a[++si]=v2[j];
        sum+=v2[j];
        break;
    }
    assert(si==n);
    for(int i=1;i<=n;i++)
        assert(__gcd(sum-a[i],(ll)a[i])!=1);
    for(int i=1;i<=n;i++)
        printf(i==n?"%d\n":"%d ",a[i]);
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
typedef vector<unsigned int>vec;
typedef vector<vec> mat;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, P;
    cin >> N >> P;
    vector<int> A(N);
    ll even = 0, odd = 0;
    REP(i,N){
        int A;
        cin >> A;
        if(A%2==0) even++;
        else odd++;
    }
    ll ans = 0;
    if(odd == 0){
        if(P==1) cout << 0 << endl;
        else{
            ans = pow(2,N);
            cout << ans << endl;
        }
    }
    else{
        ans = pow(2,N-1);
        cout << ans << endl;
    }
}


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

pos = 0
neg = 0

for i in range(n):
    dif = b[i]-a[i]

    if dif > 0:
        pos += dif//2
    elif dif < 0:
        neg += dif

neg = abs(neg)

print("Yes" if pos >= neg else "No")

Measured memory_bytes: 10560