akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int a = reader.nextInt();
		int b = reader.nextInt();
		int c = reader.nextInt();

		int[] list = new int[] { a, b, c };
		int result = 1000000;
		
		for (int i = 0; i < list.length; i++) {
			for (int j = 0; j < list.length; j++) {
				if (i == j) {
					continue;
				}
				
				if (result > list[i] + list[j]) {
					result = list[i] + list[j];
				}
			}
		}

		System.out.println(result);
		reader.close();
	}
}

Measured memory_bytes: 21844
#include <cstdio>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <queue>
#include <stack>
#include <bitset>
#include <map>
using namespace std;
template <typename _TP> inline void read(_TP &x){
	x = 0;int f = 1;char c = getchar();
	for(;c < '0' || '9' < c; c = getchar()) if(c == '-') f = -1;
	for(;'0' <= c && c <= '9'; c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	x *= f;return;
}
template <typename _TP> inline void print(_TP x){
	if(x < 0) putchar('-'),x = -x;
	if(x > 9) print(x / 10);
	putchar(x % 10 + 48);
	return;
}
#define rg register
#define ll long long
#define r_2(a,b) read(a),read(b)
#define r_3(a,b,c) read(a),read(b),read(c)
#define print_n(a) print(a),puts("")
#define print_(a) print(a),putchar(' ')
const int inf = 2147483647;
const int maxn = 3e5 + 7;
const ll Mod = 998244353;
ll n,a,b,k,ans,lit;
ll fact[maxn],inv[maxn];
inline ll Pow(ll x,ll y){
	ll Ans = 1;
	while(y){
		if(y & 1) (Ans *= x) %= Mod;
		(x *= x) %= Mod;
		y >>= 1;
	}
	return Ans;
}
void fact_init(){
	fact[0] = fact[1] = 1;
	for(rg ll i = 2;i <= n; i++) fact[i] = fact[i - 1] * i % Mod;
	return;
}
void inv_init(){
	inv[n] = Pow(fact[n],Mod - 2);
	for(rg ll i = n - 1;i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % Mod;
	return;
}
inline ll C(ll x,ll y) {return fact[x] * inv[x - y] % Mod * inv[y] % Mod;}
int main()
{
	r_2(n,a);r_2(b,k);
	if(k == 0) {puts("1");return 0;}
	lit = min(n,k / a);
	fact_init();inv_init();
	for(rg ll i = 0;i <= lit; i++){
		if((k - i * a) % b) continue;
		ll num = (k - i * a) / b;
		if(num <= n) (ans += C(n,i) * C(n,num) % Mod) %= Mod;
	}
	print((ans + Mod) % Mod);
	return 0;
}

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

int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
    cin>>s;
    char ch;
    if(s.length()==1)
    {
        cout <<0<<endl;
        return 0;
    }
    else
    {
        ch=s[0];
        int t=0;
        int cnt=0;
        for(int i=1;i<s.length();i++)
        {
            if(s[i]==s[t])
            {

            }
            else
            {
                cnt++;
                t=i;
            }
        }
        cout <<cnt<<endl;
    }
    return 0;
}


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

#define ll long long
#define ull unsigned long long

int main(void) {
    ll prices[5];
    ll minimum = LONG_MAX;
    ll minimumIndex = 0;
    for(ll i = 0;i < 5;i++) {
        cin >> prices[i];
        ll temp = prices[i] % 10;
        if(temp != 0 && temp < minimum) {
            minimum = temp;
            minimumIndex = i;
        }
    }
    ll sum = 0;
    for(ll i = 0;i < 5;i++) {
        if(minimum == LONG_MAX || i != minimumIndex) {
            sum += 10 * ceil(prices[i] / 10.0);
        }
    }
    if(minimum != LONG_MAX) sum += prices[minimumIndex];
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n,r;
int main(){FAST;
cin>>n>>r;
if(n<10){
  cout<<r+100*(10-n);
}
else{
  cout<<r;
}
return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  char odd[100], even[100], mix[200];
  int i;
  scanf("%s %s", odd, even);
  i=0;
  do {
    mix[2*i] = odd[i];
    mix[2*i+1] = even[i];
  } while(mix[2*(i++)+1]!='\0');
  printf("%s\n", mix);
  return 0;
}


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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

void get_pair(int k, int &a, int &b, int m) {
    int mask = (1 << m) - 1;
    if (k == mask) {
        a = mask - 1;
        b = 1;
    } else {
        a = (~k) & mask;
        b = mask;
    }
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int mx = 1 << n;
    if (mx <= k || (n == 1 && k == 1)) {
        cout << -1 << endl;
        return 0;
    }

    if (k == 0) {
        REP(i, 0, mx) {
            cout << i << " " << i << " \n"[i + 1 == mx];
        }
        return 0;
    }
    vector<int> par;
    int a, b;
    get_pair(k, a, b, n);
    dump(a);
    dump(b);
    set<int> s;
    REP(i, 0, mx){
        s.insert(i);
    }
    s.erase(a);
    s.erase(b);
    s.erase(0);
    s.erase(k);
    par.push_back(0);
    for (auto &e : s) {
        par.push_back(e);
    }
    par.push_back(k);
    for (auto it = s.rbegin(); it != s.rend();it++) {
        par.push_back(*it);
    }
    par.push_back(0);
    par.push_back(a);
    par.push_back(b);
    par.push_back(k);
    par.push_back(b);
    par.push_back(a);
    REP (i, 0, 2 * mx) {
        cout << par[i] << " \n"[i + 1 == 2 * mx];
    }
    return 0;
}


Measured memory_bytes: 9080
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a * b / gcd(a, b); }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll n,a;
	pair<ll, ll> tmp;
	in(n);

	vector<pair<ll, ll>> vp(n);
	rep(i, 0, n) {
		in(a);
		tmp.first = a;
		tmp.second = i + 1;
		vp[i] = tmp;
	}

	sort(vp.begin(), vp.end());
	rep(i, 0, n) {
		outs(vp[i].second);
	}
	
	outn("");
	return 0;

}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define INF 1000000000
#define MOD 998244353
#define EPSILON 0.00001
#define MAX_N 305

#define FOR(i, a, b) for (int i=(a); i<=(b); i++)
#define F0R(i, a) for (ll i=0; i<(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

int N, M;
queue<int> people[MAX_N];
int events[MAX_N];
bool eventGone[MAX_N];

int main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);

    cin >> N >> M;

    F0R(i, N){
        F0R(j, M){
            int ev;
            cin >> ev;
            people[i].push(ev-1);
        }
    }

    int minAmt = N;

    int maxNum = 0;
    int maxEv = 0;

    F0R(i, M){
        memset(events, 0, sizeof events);
        maxNum = 0;
        maxEv = 0;
        F0R(j, N){
            int event = people[j].front();
            events[event]++;
            if(events[event] > maxNum){
                maxNum = events[event];
                maxEv = event;
            }
        }

        //cout << "max event is " << maxEv << " and maxnum is " << maxNum << "\n";

        minAmt = min(minAmt, maxNum);
        eventGone[maxEv] = true;
        F0R(j, N){
            while(!people[j].empty() && eventGone[people[j].front()]){
                people[j].pop();
                //cout << "popping\n";
            }
        }
    }

    cout << minAmt << "\n";

    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 4005;

int n;
char s[N];
int a[N];
int pref[N][5], suf[N][5];

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> s[i];
		if(s[i] == 'R')
			a[i] = 0;
		else if(s[i] == 'G')
			a[i] = 1;
		else
			a[i] = 2;
	}
	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j <= 2; j++)
			pref[i][j] = pref[i - 1][j];
		pref[i][a[i]]++;
	}
	int ans = pref[n][0] * pref[n][1] * pref[n][2];
	for(int i = 2; i < n; i++)
	{
		int k = 1;
		while(i - k >= 1 && i + k <= n)
		{
			map<int, int> f;
			f[a[i]]++;
			f[a[i - k]]++;
			f[a[i + k]]++;
			if(f.size() == 3)
				ans--;
			k++;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3756
/**
 *  Author1: low-equipped w_udixixi
 *  Author2: Sher丶lock
 *  Date :2019-08-20
 **/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<queue>
#include<map>
#define ll long long
#define pb push_back
#define rep(x,a,b) for (int x=a;x<=b;x++)
#define repp(x,a,b) for (int x=a;x<b;x++)
#define pi 3.14159265358979323846
#define mem(a,x) memset(a,x,sizeof a)
#define lson rt<<1,l,mid
#define rson rt<<1|1,mid+1,r
using namespace std;
const int maxn=2e6+7;
const int INF=1e9;
const ll INFF=1e18;
int a[maxn];
int dp[maxn];
int n,k;
int main()
{
    scanf("%d%d",&n,&k);
    rep(i,1,n)scanf("%d",&a[i]);
    rep(i,1,n)
        dp[i]=i==1?0:dp[i]=INF;
    rep(i,1,n)
        for (int j=k;j>=1;j--)
            if (i+j<=n)
                dp[i+j]=min(dp[i+j],dp[i]+abs(a[i]-a[i+j]));
    //rep(i,1,n)cout<<dp[i]<<endl;
    cout<<dp[n]<<endl;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define rep3(i, s, n) for (int i = s; i > (int)n; i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int K; cin >> K;
	vi A(K); rep(i, K) cin >> A.at(i);
	ll m = 2, M = 2;
	rep3(i, K - 1, -1) {
		int Ai = A.at(i);
		m = ((m + Ai - 1) / Ai) * Ai;
		M = (M / Ai) * Ai;
		M += Ai - 1;
	}
	if (m > M) {
		cout << -1 << endl;
	} else {
		cout << m << " " << M << endl;
	}	
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
int n = 26;
int D;
ll c[26];
ll s[365][26];
set<int> st[26];
int last[26];
int res[365];

void climing(){
    int day = rnd()%365;
    int cha = rnd()%26;
}
void init(){
    //初期解
    rep(i,D){
        ll mx = 0;
        rep(j,26){
            if(chmax(mx,s[i][j]+ c[i]*(i-last[j]))){
                res[i] = j;
            }
        }
        last[res[i]] = i;
        st[res[i]].insert(i);
    }
    return;
}
int main(){
    std::chrono::system_clock::time_point  start, end; // 型は auto で可
    start = std::chrono::system_clock::now(); // 計測開始時間
    cin >> D;
    rep(i,n){
        cin >> c[i];
    }
    rep(i,D){
        rep(j,26){
            cin >> s[i][j];
        }
    }
    init();
    // while(1){
    //     end = std::chrono::system_clock::now();  // 計測終了時間
    //     int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count(); 
    //     if(elapsed >= 1950)break;
    // }
    rep(i,D){
        cout << res[i]+1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 3280
#include<stdio.h>
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int h,w,n,i,j,k,l;
int kan[1201][1201];
int dp[1201][1201];
int main(void){
	scanf("%d %d %d",&h,&w,&n);
	while(h!=0 && w!=0 && n!=0){
		for(i=1;i<=1200;i++){
			for(j=1;j<=1200;j++){
				dp[i][j]=0;
				kan[i][j]=0;
			}
		}
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				scanf("%d",&kan[i][j]);	//kan=kanbann
			}
		}
		dp[1][1]=n-1;
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				if(kan[i][j]==1){
					if(dp[i][j]%2==1){
						dp[i][j+1]=dp[i][j+1]+dp[i][j]/2+1;
						dp[i+1][j]+=(dp[i][j]/2);
					}
					else if(dp[i][j]%2==0){
						/*if(i==2 && j==2){
							printf("%d %d\n",dp[i][j],dp[i+1][j]);
						}*/
						dp[i][j+1]+=dp[i][j]/2;
						dp[i+1][j]+=dp[i][j]/2;
					}
				}
				else if(kan[i][j]==0){
					if(dp[i][j]%2==1){
						dp[i][j+1]+=(dp[i][j]/2);
						dp[i+1][j]=dp[i+1][j]+(dp[i][j]/2)+1;
					}
					else if(dp[i][j]%2==0){
						dp[i][j+1]+=dp[i][j]/2;
						dp[i+1][j]+=dp[i][j]/2;
					}
				}
			}
			/*for(l=1;l<=h;l++){
				for(k=1;k<=w;k++){
					printf("%d ",dp[l][k]);
				}
				printf("\n");
			}*/
		}
		for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				if(dp[i][j]!=0){
					if(dp[i][j]%2==1){
						if(kan[i][j]==0){
							kan[i][j]=1;
						}
						else if(kan[i][j]==1){
							kan[i][j]=0;
						}
					}
				}
			}
		}
		i=1;
		j=1;
		while(1){
			if(kan[i][j]==1){
				j++;
			}
			else if(kan[i][j]==0){
				i++;
			}
			if(i==h+1 || j==w+1){
				break;
			}
		}
		printf("%d %d\n",i,j);	
		/*for(i=1;i<=h;i++){
			for(j=1;j<=w;j++){
				printf("%d ",dp[i][j]);		
			}
			printf("\n");
		}*/
		scanf("%d %d %d",&h,&w,&n);
	}
	return 0;
}

Measured memory_bytes: 12296
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
 
 
class Program
{
 
 
    static void Main(string[] args)
    {
 
		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };
 
        //int val = int.Parse(Console.ReadLine());
        //int[] vals = parseAry(Console.ReadLine().Split(cs));
        //string str = Console.ReadLine();
        //string[] strs = Console.ReadLine().Split(cs);
 
        //string res="";
        //int res = 0; ;
        //int t = int.Parse(Console.ReadLine());
        //string str = Console.ReadLine();
        //int[] vals = parseAry(Console.ReadLine().Split(cs));
        //int n = int.Parse(Console.ReadLine());
		//string res="";
		string res = "No";
 
		int[] vals = parseAry(Console.ReadLine().Split(cs));
 
		if ( vals[0] < vals[2] && vals[2] < vals[1] ) { res = "Yes"; }
		if ( vals[0] > vals[2] && vals[2] > vals[1] ) { res = "Yes"; }
		
			Console.WriteLine(res);
 
 
        return;
    }
 
    //　String[]  ----->  int[]
    static int[] parseAry(string[] str)
    {
        int[] nums = new int[str.Length];
        for (int i = 0; i < str.Length; i++) { nums[i] = int.Parse(str[i]); }
        return nums;
    }
    //　String[]  ----->  long[]
    static long[] parseAryL(string[] str)
    {
        long[] nums = new long[str.Length];
        for (int i = 0; i < str.Length; i++) { nums[i] = long.Parse(str[i]); }
        return nums;
    }
 
    //文字列を1文字ずつString[]に入れる
    static string[] strAry(String str)
    {
        string[] re = new string[str.Length];
        for (int i = 0; i < str.Length; i++) { re[i] = str[i].ToString(); }
        return re;
    }
 
}

Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
using namespace std;
int n,k,a[111111];
int main()
{
	scanf("%d%d",&n,&k);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	n--;k--;
	if (n%k==0) cout<<n/k<<endl;
	else cout<<n/k+1<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;

typedef pair <int, int> pii;

set <pii> s1, s2;
int a[200010], b[200010], ans[200010];
int pos[200010], cnt[200010];

set <pii> :: iterator get_pre(set <pii> :: iterator it) {
	it--;
	return it;
}

int main () {
	int n; scanf("%d", &n);
	memset(pos, -1, sizeof(pos));
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (pos[a[i]] == -1) pos[a[i]] = i;
		cnt[a[i]]++;
	}
	for (int i = 1; i <= n; i++) {
		if (cnt[i]) s1.insert(mp(cnt[i], i));
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &b[i]);
		cnt[b[i]]++;
	}
	for (int i = 1; i <= n; i++) {
		if (cnt[i] > n) {
			printf("No\n");
			return 0;
		}
	}
	memset(cnt, 0, sizeof(cnt));
	for (int i = 0; i < n; i++) {
		cnt[b[i]]++;
	}
	for (int i = 1; i <= n; i++) {
		if (cnt[i]) s2.insert(mp(cnt[i], i));
	}
	for (int i = 0; i < n; i++) {
		set <pii> :: iterator it = s1.end(); it--;
		if (it == s1.begin() || get_pre(it)->fi != it->fi) {
			pii tmp = *it; s1.erase(tmp);
			tmp.fi--;
			if (tmp.fi) s1.insert(tmp);
			it = s2.lower_bound(mp(get_pre(s2.end())->fi, -1));
			if (it->se == tmp.se) {
				it++;
				if (it == s2.end()) it--, it--;
			}
			pii ttt = *it; s2.erase(ttt);
			ttt.fi--;
			if (ttt.fi) s2.insert(ttt);
			ans[pos[tmp.se]++] = ttt.se;
		} else {
			it = s2.end(); it--;
			pii tmp = *it; s2.erase(tmp);
			tmp.fi--;
			if (tmp.fi) s2.insert(tmp);
			it = s1.lower_bound(mp(get_pre(s1.end())->fi, -1));
			if (it->se == tmp.se) {
				it++;
				if (it == s1.end()) {
					it--, it--;
				}
			}
			pii ttt = *it; s1.erase(ttt);
			ttt.fi--;
			if (ttt.fi) s1.insert(ttt);
			ans[pos[ttt.se]++] = tmp.se;
		}
	}
	printf("Yes\n");
	for (int i = 0; i < n; i++) {
		printf("%d ", ans[i]);
	}
	printf("\n");
	return 0;
}


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

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = m - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout<<fixed<<setprecision(10);
  ll res=0,buf=0;
  bool judge = true;
  string s;cin>>s;
  ans1(s.size()>=4&&s.substr(0,4)=="YAKI");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long
#define lli long long int

using namespace std;
using P = pair<int,int>;

int N, M, ans, pena;

int main(){

  cin >> N >> M;
  vector<int> AC(N+1);
  vector<int> WA(N+1);

  vector<pair<int, string>> p(M);
  for (int i = 0; i < M; i++) {
    cin >> p[i].first >> p[i].second;
  }

  for (int i = 0; i < M; i++) {
    int n = p[i].first;
    if(p[i].second == "WA"){
      if(AC.at(n) != 1) WA.at(n) += 1;
    }else if(p[i].second == "AC"){
      if(AC.at(n) != 1) AC.at(n) = 1;
    }
  }

  for (int i = 1; i <= N; i++) {
    if(AC.at(i) != 1) WA.at(i) = 0;
  }

  for (int i = 1; i <= N; i++) {
    ans += AC.at(i);
    pena += WA.at(i);
  }

  cout << ans << " " << pena << endl;

  return 0;
}



Measured memory_bytes: 7856
N = int(input().strip())
A = [int(str) for str in input().strip().split()]

def checkIncludeNum2(num):
    ret = 0
    while num % 2 == 0:
        num /= 2
        ret += 1
    
    return ret

print(sum([checkIncludeNum2(i) for i in A]))

Measured memory_bytes: 4148
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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



int main(void) {
	long long int n;
	

	cin >> n;
	vector<long long int>h(n + 1);
	vector<long long int>cost(n+1, LLINF);
	LFOR(i, 1, n) {
		cin >> h[i];
	}

	cost[1] = 0;

	LFOR(i, 1, n) {
		if (i + 1 <= n) {
			cost[i + 1] = min(cost[i + 1], cost[i] + abs(h[i] - h[i + 1]));
		}
		if (i + 2 <= n) {
			cost[i + 2] = min(cost[i + 2], cost[i] + abs(h[i] - h[i + 2]));
		}
	}

	cout << cost[n] << endl;
	

	return 0;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

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


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

int main() {
  int a,b,c;
  b=0;
  c=0;
  cin>>a;
  char d;
  for(int i=0;i<a;i++){
    cin>>d;
    if(d=='R'){
      b++;
    }
    else {
      c++;
    }
  }
  if(b>c){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;

int n;
int a[200010];


int main(){

    fill(a, a+200010, INF);

    int _max = -1, max_index = 0;

    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(_max < a[i]){
            _max = a[i];
            max_index = i;
        }
    }

    sort(a, a+200010);

    // for(int i = 0; i < n; i++) cout << a[i] << endl;

    int ans = -1;

    for(int i = 0; i < n; i++){
        if(i == max_index){
            cout << a[n-2] << endl;
        }
        else{
            cout << a[n-1] << endl;
        }
    }

    return 0;
}

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

long long N;
long long A[100005];
long long B[100005];

int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		cin >> A[N - 1 - i] >> B[N - 1 - i];
	}

	long long cur = 0;
	for(long long i = 0; i < N; i++){
		long long num = (B[i] - ((A[i] + cur)% B[i]))%B[i];
		cur += num;
	}
	cout << cur << endl;

}


Measured memory_bytes: 1792
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]

card = [[0 for _ in range(3)] for _ in range(3)]


for i in range(N):
    for x in range(3):
        for y in range(3):
            if A[x][y] == b[i]:
                card[x][y] = 1

ans = "No"

for i in range(3):
    if sum(card[i]) == 3:
        ans = "Yes"

if sum([card[i][i] for i in range(3)]) == 3:
    ans = "Yes"

if sum([card[i][2 - i] for i in range(3)]) == 3:
    ans = "Yes"

for i in range(3):
    if sum([card[j][i] for j in range(3)]) == 3:
        ans = "Yes"

print(ans)


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

#define int long long

const int maxn = 1e5 + 10;
int n, a[maxn];
int c0, c1, cnt, GCD;

bool solve() {
	c1 = 0, c0 = 0, cnt = 0, GCD = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 1) {
			c1++;
			cnt++;
			continue;
		}
		if (a[i] % 2) {
			c1++;
			a[i]--;
		}
		else
			c0++;
		GCD = __gcd(GCD, a[i]);
	}
	if (c0 % 2) 		 return 1;
	if (cnt || c1 > 1) return 0;
	for (int i = 0; i < n; i++) a[i] /= GCD;
	return !solve();
}
int32_t main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	if (solve())
		cout << "First";
	else
		cout << "Second";
	return 0;
}

Measured memory_bytes: 4380
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	A
# CreatedDate:  2020-02-22 21:00:25 +0900
# LastModified: 2020-02-22 21:05:21 +0900
#


import os
import sys
import numpy as np


def main():
    N,R = map(int,input().split())
    if N>9:
        print(R)
        return
    else:
        print(R+100*(10-N))


if __name__ == "__main__":
    main()


Measured memory_bytes: 21640
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()


using namespace std;

int A, B, X[10] = { 1,2,3,2,1,2,3,3,2,1 };
char op;
int N, M,C;


int main(){
	cin >> A >> B;
//	vector <int> AAA(N);
	int t;
	
	
	if (A > 8 || B > 8) cout << ":(" << endl;
	else cout << "Yay!" << endl;
	   


}
		
		




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


int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, m;
	ll k;
  	cin>>n>>m>>k;

  	vector<ll> a(n), b(m), p1(n), p2(m);

  	for(int i = 0; i < n; i++) {
  		cin>>a[i];
  		if(i == 0) p1[i] = a[i];
  		else p1[i] = p1[i - 1] + a[i];
  	}
  	
  	for(int i = 0; i < m; i++) {
  		cin>>b[i];
  		if(i == 0) p2[i] = b[i];
  		else p2[i] = p2[i - 1] + b[i];
  	}

  	
  	int ans = 0;
  	for(int i = 0; i < p1.size(); i++) {
  		if(k - p1[i] < 0) break;
  		auto ct = upper_bound(p2.begin(), p2.end(), k - p1[i]);
  		if(ct == p2.end()) ans = max(ans, i + m + 1);
  		else{
  			int x = ct - p2.begin();
  			ans = max(ans, i + x + 1);
  		}
  	}

  	auto ct = upper_bound(p2.begin(), p2.end() , k );
  	if(ct == p2.end()) ans = max(ans, m);
	else{
		int x = ct - p2.begin();
		ans = max(ans, x);
	}


  	cout<<ans<<endl;
}

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


void solve(vector<long long> a, long long e){
    sort(a.begin(), a.end());
    if(abs(a[a.size()-1]-a[0]) > e) cout << ":(" << endl;
    else cout << "Yay!" << endl;
}

int main(){
    vector<long long> a(5);
    long long e;
    for(int i = 0; i < 5; i++){
        cin >> a[i];
    }
    cin >> e;
    solve(a, e);
    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	N := nextInt()
	A := make([]int, N)
	for i := 0; i < N; i++ {
		A[i] = nextInt()
	}

	ans := Gcd(A)

	fmt.Println(ans)
}

func gcdBase(a, b int) int {
	if b == 0 {
		return a
	}

	return gcdBase(b, a%b)
}

// Gcd return Greatest common divisor
func Gcd(args []int) int {
	b := args[0]

	for _, a := range args {
		b = gcdBase(a, b)
	}
	return b
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(_v) for(auto _x:_v){cout<<_x<<" ";}cout<<endl
#define printVS(_vs) for(auto _x : _vs){cout << _x << endl;}
#define printVV(_vv) for(auto _v:_vv){for(auto _x:_v){cout<<_x<<" ";}cout<<endl;} cout << endl;
#define printP(_p) cout << _p.first << " " << _p.second << endl
#define printVP(_vp) for(auto _p : _vp) printP(_p);

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<Pii> vp;
const int inf = 1e9;
const int mod = 1e9 + 7;
typedef vvi Graph;

int n, m;
Graph G;
vector<bool> visited;

void dfs(int v) {
    if (visited[v]) return;
    visited[v] = true;
    for (auto u : G[v]) {
        dfs(u);
    }
}

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

    cin >> n >> m;
    G.resize(n + m);
    rep(i, n) {
        int k;
        cin >> k;
        rep(j, k) {
            int l;
            cin >> l;
            l--;
            G[i].emplace_back(n + l);
            G[n + l].emplace_back(i);
        }
    }

    visited.resize(n + m);
    dfs(0);

    rep(i, n) {
        if (!visited[i]) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

}


Measured memory_bytes: 8948
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <math.h>
#include <unordered_map>
#include <numeric>
#include <sstream>
#include <functional>
using namespace std;

int main()
{
	int r, d , x, tmp;

	cin >> r >> d >> x;

	tmp=x;

	for (int i = 0; i < 10; i++)
	{
		tmp = r*tmp-d;
		cout << tmp << endl;
	}
	

	return 0;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		if(A.Sum() < B.Sum()){
			Console.WriteLine(-1);
			return;
		}
		
		long lose = 0;
		List<long> gain = new List<long>();
		int cnt = 0;
		for(int i=0;i<N;i++){
			if(A[i] < B[i]){
				cnt++;
				lose += B[i] - A[i];
			} else {
				gain.Add(A[i] - B[i]);
			}
		}
		
		gain.Sort();
		gain.Reverse();
		for(int i=0;i<gain.Count;i++){
			if(lose <= 0) break;
			cnt++;
			lose -= gain[i];
		}
		
		Console.WriteLine(cnt);
	}
	
	
	
	int N;
	long[] A;
	long[] B;
	public Sol(){
		N = ri();
		A = rla();
		B = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 35932
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
typedef priority_queue<ll> PQ_HIGH;
typedef priority_queue<ll,VL,greater<ll>> PQ_LOW;//昇順

int main(){
  ll a,b,c,k;cin>>a>>b>>c>>k;
  if(a>=k){
    cout<<k<<endl;
  }
  else if(a+b>=k){
    cout<<a<<endl;
  }
  else{
    cout<<2*a+b-k<<endl;
  }
}


Measured memory_bytes: 3164
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[M];
		for (int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		// 0の飛び石は1通り
		// 01と2つ連なっているときは1通り
		// 012と3つ連なっているとそこの進み方は2通りある
		// 0123と4つの時02,13は片方満たすと選べないので3通り
		// 01234の時02,13,24で4通り
		// 012345の時02,13,24,35と02,35で7通り
		// 0123456の時02,13,24,35,46と02,35と02,46と13,46で9通り
		// 調べた．1歩進んでN-1からNになると，
		// 2歩進んでN-2からNになるわけだからフィボナッチ数列か
		// フィボナッチ数は12くらいで桁溢れを起こすので
		// モッドにしろって言ってるわけだ
		// 石を飛ぶときはN-2から行くしかないから一通りか
		// というかそこを0にすればいいはず

		for (int i = 0; i < M - 1; i++) {
			if (a[i] + 1 == a[i + 1]) {
				System.out.println(0);
				return;
			}
		}

		long oldAns2 = 0;
		long oldAns1 = 1;
		long ans = 1;
		int mId = 0;
		for (int i = 1; i <= N; i++) {
			if (mId < M) {
				if (i == a[mId]) {
					oldAns2 = oldAns1;
					oldAns1 = 0;
					mId++;
				} else {
					ans = (oldAns1 + oldAns2) % 1000000007;
					oldAns2 = oldAns1;
					oldAns1 = ans;
				}
			} else {
				ans = (oldAns1 + oldAns2) % 1000000007;
				oldAns2 = oldAns1;
				oldAns1 = ans;
			}
		}
		System.out.println(ans);

	}
}

Measured memory_bytes: 50732
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,flag=0;
ll po(ll k ,ll n,ll ans,ll temp,ll ans1){
    if(n==0)return ans;
    while(temp<=n){
        ans*=ans1;ans%=mod;ans1=ans1*ans1;ans1%=mod;n=n-temp;temp*=2;
    }
    return po(k,n,ans,1,k)%mod;
    //eg. po(2,78,1,1,2);
}
ll min(ll a,ll b){if(a>b)return b;else return a;}
ll max(ll a,ll b){if(a>b)return a;else return b;}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    //cin>>t;
    t=1;
    while(t--){
        
        string s;
        cin>>s;
        ll l=s.size();
        flag=0;
        fo(i,l)if(s[i]!=s[l-1-i])flag=1;
        fo(i,l/2){
            if(s[i]!=s[l/2 -1 - i ])flag=1;
            if(s[i+ l/2+1]!=s[l-1-i])flag=1;
        }
        if(flag==1)cout<<"No";
        else cout<<"Yes";
    }

    return 0;
}


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

const int MOD = 1000000007;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define copy(from, to) copy(from.begin(), from.end(), back_inserter(to))
#define _sort(a) sort(a.begin(), a.end())
#define _sortd(a) sort(a.rbegin(), a.rend())
#define reverse(s) reverse(s.begin(), s.end())
#define p(s) cout << (s) << endl

typedef long long ll;
using namespace std;

template<class T>
void load(vector<T> &v, int n) {
  for (int i = 0; i < n; ++i) {
    T t;
    cin >> t;
    v.push_back(t);
  }
}

template<class T>
T max(vector<T> &v) {
  return *max_element(v.begin(), v.end());
}

template<class T>
T min(vector<T> &v) {
  return *min_element(v.begin(), v.end());
}

void py(bool isUpper = false) {
  if (isUpper) {
    p("YES");
  } else {
    p("Yes");
  }
}

void pn(bool isUpper = false) {
  if (isUpper) {
    p("NO");
  } else {
    p("No");
  }
}

ll calc(int x, int y) {
  ll result = 1;
  for (int i = 1; i <= y; i++) {
    result *= x;
    result = result % MOD;
  }
  return result;
}

int main() {
  ll n;
  cin >> n;
  ll result = ((calc(10, n) - calc(9, n)) * 2 - (calc(10, n) - calc(8, n))) % MOD;
  if (result < 0) {
    result = MOD + result;
  }
  cout << result << endl;
}

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

int main(){
	/*input*/ 
	char s[4]; cin >> s;
	/*calculation*/
	char a, b;
	bool flaga = false;	//true:AABB 
	bool flagb = false;	//true:ABBA
	bool flagc = false;	//true:ABAB
	bool ok = false;	//true:Yes false:No
	for(int i = 0; i < 4; i++){
		switch(i){
			case 0:	
				a = s[i];
			break;
			case 1:	
				if(a == s[i]){
					flaga = true;
				}else{
					b = s[i];
				}
			break;
			case 2:	
				if(flaga){
					if(a == s[i]){
						ok = false;
					}else{
						b = s[i];
					}
				}else{
					if(a == s[i]){
						flagc = true;
					}else if(b == s[i]){
						flagb = true;
					}else{
						ok = false;
					}
				}
			break;
			case 3:	
				if(flaga){
					if(s[i] == b){
						ok = true;
					}
				}else if(flagb){
					(a == s[i])?ok = true:ok = false;
				}else if(flagc){
					(b == s[i])?ok = true:ok = false; 
				}
			break;
		}
	}
	/*output*/
	(ok)?cout << "Yes" << endl : cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 256
//失敗するからこそそこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#include<bits/stdc++.h>
using namespace std;
 
#if defined(DAIJOBU)
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

vector<string> A(55), B(55);

int main(){
	FIO
	
	int n, m;cin >> n >> m;
	for(int i = 0; i < n; i++)cin >> A[i];
	for(int i = 0; i < m; i++)cin >> B[i];
	
	for(int i = 0; i <= n - m; i++){
		for(int j = 0; j <= n - m; j++){
			int c = 0;
			for(int k = i; k < i + m; k++){
				for(int l = j; l < j + m; l++){
					if(A[k][l] == B[k - i][l - j])c++;
				}
			}
			if(c == m * m){
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int S;
	int h, m, s;

	scanf("%d",&S);

	h = S / 3600;
	S %= 3600;

	m = S / 60;
	S %= 60;

	s = S;

	printf("%d:%d:%d\n",h,m,s);

	return 0;
}

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

void check(int x, int y){
  for(int i=0; i<=x; i++){
    int total = (i*2)+(x-i)*4;
    if(total == y){
      cout << "Yes" << endl;
      return;
    }
  }
  cout << "No" << endl;
}

int main(){
  int x, y;
  while(cin >> x >> y){
    check(x, y);
  }
}

Measured memory_bytes: 3632
import Control.Monad
import Data.List

main = do
    n <- readLn
    fs <- map length . group . sort . filter (`elem` "MARCH") . map head <$> replicateM n getLine
    let l = length fs
    print $ sum [(fs !! i) * (fs !! j) * (fs !! k)|i <- [0..l-3], j <- [i+1..l-2], k <- [j+1..l-1]]

Measured memory_bytes: 48508
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <string>
#include <limits>

using namespace std;

using i64 = int64_t;
using P = pair<i64, i64>;
i64 mod = 1000000007;
//i64 mod = 998244353;
int int_max = 2147483647;
i64 INF = 1e16;
int max_n = 1e5;


int main(int argc, char **argv) {
    i64 a,b,c,k;
    cin >> a >> b>> c >> k;

    while (a >= b) {
        b *= 2;
        --k;
    }
    while (b >= c) {
        c *= 2;
        --k;
    }

    cout << (k<0?"No":"Yes") << endl;

    return 0;
}

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

using namespace std;
string s[100];
int n;
map<char,int>q;
string s1;
int main()
{
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>s[i];
    }
    for(char i='a'; i<='z'; i++)
    {
        int flag=0;
        for(int j=0; j<n; j++)
        {
            if(s[j].find(i)==-1)
            {
                flag=1;
            }
        }
        if(flag==0)
        {
            int minn=100;
           // cout<<i<<endl;
            for(int j=0; j<n; j++)
            {
                int cnt=0;
                for(int z=0;z<s[j].size();z++)
                {
                    if(s[j][z]==i)
                    {
                        cnt++;
                    }
                }
                minn=min(minn,cnt);
            }
            for(int j=0;j<minn;j++)
            {
                s1+=i;
            }
        }
    }
    cout<<s1<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

int main()
{
	int n;
	ll *a[300];
	ll sum = 0;
	ll answer = 0;
	cin>>n;

	for (int i = 0; i < 300; i++) {
		a[i] = new ll[n];
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
			sum += a[i][j];
		}
	}
	sum /= 2;
	answer = sum;


	//for (int k = 0; k < n; k++) {
	//	for (int i = 0; i < n; i++) {
	//		for (int j = i+1; j < n; j++) {
	//			if (a[i][j] > a[i][k] + a[k][j]) {
	//				cout << -1;
	//				return 0;
	//			}
	//			else if (a[i][j] == a[i][k] + a[k][j]&&i!=k&&k!=j) {
	//				answer -= a[i][j];
	//			}
	//		}
	//	}
	//}
	answer = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			bool flug = true;
			for (int k = 0; k < n; k++) {
					if (a[i][j] > a[i][k] + a[k][j]) {
					cout << -1;
					return 0;
				}
				else if (a[i][j] == a[i][k] + a[k][j] && i != k&&k != j) {
					flug = false;
				}
			}
			if (flug) {
				answer += a[i][j];
			}
		}
	}


	cout << answer;
	return 0;
}

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

#define fin stdin
#define fout stdout

using namespace std;

//FILE *fin = fopen("x.in", "r"), *fout = fopen("x.out", "w");

typedef long long i64;

const int nmax = 1e5;
int t[nmax + 1], h[nmax + 1], sz[nmax + 1];
vector< int > g[nmax + 1];

void dfs (int nod) {
    sz[ nod ] = 1;
    for (auto i : g[ nod ]) {
        if (t[ i ] == -1) {
            t[ i ] = nod;
            h[ i ] = h[ nod ] + 1;
            dfs( i );

            sz[ nod ] += sz[ i ];
        }
    }
}

int main() {
    int n;
    fscanf(fin, "%d", &n);

    for (int i = 1; i < n; ++ i) {
        int x, y;
        fscanf(fin, "%d%d", &x, &y);
        g[ x ].push_back( y );
        g[ y ].push_back( x );
    }
    memset(t, -1, sizeof(t));
    t[ 1 ] = 0;
    dfs( 1 );

    bool ok = 1;
    int shp = n;
    while (shp != 1) {
        if (h[ shp ] > h[ n ] - h[ shp ]) {
            if (sz[ shp ] >= n - sz[ shp ]) {
                ok = 0;
            }
        }
        shp = t[ shp ];
    }

    if (ok) fprintf(fout, "Fennec");
    else    fprintf(fout, "Snuke");
    return 0;
}


Measured memory_bytes: 11520
S = input()
N = len(S)

def check_palindrome(s):
    s_ = s[::-1]
    return s == s_

s_list = [
    S[:],
    S[:int((N - 1) / 2)],
    S[int((N + 3) / 2) - 1:],
]
# print(s_list)

result = "Yes"
for s in s_list:
    if not check_palindrome(s):
        result = "No"
        break
print(result)

Measured memory_bytes: 3060
while(True):
  h, w = map(int, input().split())
  if h == 0 and w == 0:
    break
    
  for i in range(h):
    c =""
    for j in range(w):
      if (i == 0) or (i == h-1): 
        c += "#"
      elif (j == 0) or (j == w-1):
        c += "#"
      else :
        c += "."
    print(c)
  print("")


Measured memory_bytes: 5608
def main():
    N, W = [int(n) for n in input().split()]
    baggages = [[int(n) for n in input().split()] for i in range(N)]

    VALUE, WEIGHT = 1, 0
    dp = [[-1] * (W+1) for n in range(N)]
    # dp[baggage][weight] := baggage番目までの荷物を使ってweight以下に抑える
    dp[0] = [0 if weight < baggages[0][WEIGHT] else baggages[0][VALUE] for weight in range(W+1)]

    for baggage in range(N):
        for max_weight in range(W+1):
            if dp[baggage][max_weight] != -1:
                continue
            bag_w = baggages[baggage][WEIGHT]
            bag_v = baggages[baggage][VALUE]
            val1 = dp[baggage-1][max_weight]
            val2 = dp[baggage-1][max_weight-bag_w]+bag_v if max_weight >= bag_w else 0
            dp[baggage][max_weight] = max(val1, val2)
            
    print(dp[N-1][W])



if __name__ == "__main__":
    main()

Measured memory_bytes: 119148