akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

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

const int mo = 1e9 + 7;

int N;
vector<map<string, int>> dp;

string S = "ACGT";
string out[3] = {"AGC", "ACG", "GAC"};
vector<string> pattern;

bool is_ok(string s)
{
	return s != out[0] and s != out[1] and s != out[2];
}

void f(string s, int d)
{
	if (d == 3) {
		pattern.push_back(s);
		return;
	}

	rep(i, S.size()) {
		f(s + S[i], d + 1);
	}
}

bool check(string s)
{
	string tmp = s;
	rep(i, 3) {
		swap(tmp[i], tmp[i+1]);
		if (tmp.substr(0, 3) == "AGC" or tmp.substr(1, 3) == "AGC") {
			return false;
		}
		swap(tmp[i], tmp[i+1]);
	}

	return true;
}

signed main()
{
	cin >> N;
	dp.resize(N+1);

	f("", 0);

	for (string &s : pattern) {
		if (is_ok(s)) {
			dp[3][s] = 1;
		}
	}

	for (int i = 4; i <= N; ++i) {
		for (string &s : pattern) {
			if (!is_ok(s)) continue;
			for (string &t : pattern) {
				if (!is_ok(t)) continue;

				if (s[0] != t[1] or s[1] != t[2]) continue;

				string u = t + s[2];
				if (check(u)) {
					dp[i][s] += dp[i-1][t];
					dp[i][s] %= mo;
				}
			}
		}
	}

	int ans = 0;

	for (string &s : pattern) {
		ans += dp[N][s];
		ans %= mo;
	}

	cout << ans << endl;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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 bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    cin >> N >> M;
    vector<ll> from(M),to(M);
    rep(i,M){
        cin >> from[i] >> to[i];
        from[i]--;
        to[i]--;
    }
    vector<ll> ball(N,1);
    vector<bool> red(N);
    red[0] = 1;
    rep(i,M){
        if(red[from[i]]){
            red[to[i]] = 1;
        }
        if(ball[from[i]] == 1){
            red[from[i]] = 0;
        }
        ball[from[i]]--;
        ball[to[i]]++;
    }
    ll ans = 0;
    rep(i,N){
        if(red[i])ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5544
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,a,b,x=0,y=0;cin>>N;N/=2;
  int A[N],B[N];
  for(int i=0;i<N;i++)cin>>A[i]>>B[i];
  sort(A,A+N);sort(B,B+N);
  for(int i=0;i<N;i=upper_bound(A,A+N,A[i])-A)if(x<upper_bound(A,A+N,A[i])-lower_bound(A,A+N,A[i]))a=A[i],x=upper_bound(A,A+N,A[i])-lower_bound(A,A+N,A[i]);
  for(int i=0;i<N;i=upper_bound(B,B+N,B[i])-B)if(y<upper_bound(B,B+N,B[i])-lower_bound(B,B+N,B[i]))b=B[i],y=upper_bound(B,B+N,B[i])-lower_bound(B,B+N,B[i]);
  if(a==b){
    int MA=0,MB=0;
    for(int i=0;i<N;i=upper_bound(A,A+N,A[i])-A)if(a!=A[i]&&MA<upper_bound(A,A+N,A[i])-lower_bound(A,A+N,A[i]))MA=upper_bound(A,A+N,A[i])-lower_bound(A,A+N,A[i]);
    for(int i=0;i<N;i=upper_bound(B,B+N,B[i])-B)if(b!=B[i]&&MB<upper_bound(B,B+N,B[i])-lower_bound(B,B+N,B[i]))MB=upper_bound(B,B+N,B[i])-lower_bound(B,B+N,B[i]);
    cout<<2*N-max(x+MB,y+MA)<<endl;
  }
  else cout<<2*N-x-y<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  int count = 0;
  int ans = 0;
  for (int i = 1; i < N; i++) {
    if (H.at(i - 1) >= H.at(i)) count++;
    else count = 0;
    ans = max(ans, count);
  }
  
  cout << ans << endl;
}

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 mod 1000000007
#define int long long
#define ll long long
#define EPS 0.00000000000001
#define ld long double
#define inf 20000000
#define N 100001


int32_t main()
{
    IOS;

    int n,k;
    cin >> n >> k;
    int ans = 0;
    for(int i = 0;i < n;i++)
    {
        int a;
        cin >> a;
        if(a >= k)
            ans++;
    }
    cout << ans;

    return 0;
}
 
 

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef long long int lli;
typedef long double float64;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define tr(container, it) \
    for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) 

// #define sz(a) int((a).size())
// #define pb push_back
// #define fill(a,v) memset(a,v,sizeof a)


#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

#define trace3(x,y,z) cout<< '>' << #x << ':' << x \
        << " | " << #y << ':' << y <<" | " << #z << ':' << z << endl;

#define trace4(x,y,z,w) cout<< '>' << #x << ':' << x \
    << " | " << #y << ':' << y <<" | " << #z << ':' << z << " | " << #w << ':' << w << endl;


inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

/////////////////////////////////////////////////////////////////////

/*bool sortbysec(const pair<int,int> &a,const pair<int,int> &b)
{
    return (a.second < b.second);
}*/

template<class T> inline T gcd(T a,T b) //NOTES:__gcd(0,0) gives exception
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}



const int MAX_N = 200001;

ll arr[MAX_N];
ll rox[MAX_N];

vector<ll> V;

int main() {
    ll N,K;
    ll ans=0;
    memset(rox,0,sizeof rox);
    scanf("%lld%lld",&N,&K);
    for(ll i=1;i<=N;i++){
        scanf("%lld",arr+i);
        rox[arr[i]]++;
    }
    for(ll i=0;i<MAX_N;i++){
        if(rox[i]>0){
            V.push_back(rox[i]);
        }
    }
    //DEBUG(V.size());
    if(V.size()<=K){
        printf("0\n");
        return 0;
    }
    sort(V.begin(),V.end());
    for(ll i=0;i<(V.size()-K);i++){
        //DEBUG(V[i]);
        ans+=V[i];
    }
    printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 5492
a=65280; b=61680; c=52428; d=43690; e=65535
QS = [[] for i in range(17)]
QS[1] = [a, b, c, d]
L = {a: 1, b: 1, c: 1, d: 1, e: 1, e: 1, 0: 1}
H = []
get = L.get
push = H.append
for l in range(1, 16):
    Q = QS[l]
    li = 13-l; l3 = l+3; l1 = l+1
    pop = Q.pop
    pushQN = QS[l1].append
    while Q:
        p = pop()
        if L[p] < l: continue
        if l < 13:
            if l1 < get(p ^ e, 17):
                L[p ^ e] = l1
                pushQN(p ^ e)
            for q, r in H:
                if r < li:
                    if l3+r < get(p & q, 17): L[p & q] = l3+r; QS[l3+r].append(p & q)
                    if l3+r < get(p ^ q, 17): L[p ^ q] = l3+r; QS[l3+r].append(p ^ q)
                elif r == li:
                    if p & q not in L: L[p & q] = 16
                    if p ^ q not in L: L[p ^ q] = 16
                else: break
            l < 7 and push((p, l))
        elif l1 < get(p ^ e, 17): L[p ^ e] = l1
print(*map(L.__getitem__, eval("e&"+",e&".join(open(0).read().replace(*"-~").replace(*"*&").replace(*"1e").split()[:-1]))),sep='\n')

Measured memory_bytes: 8336
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int CardJudge(char player1[], char player2[]);
void StrToLower(char* str);
void InitStr(char* str, int len);

#define strMAX 100
#define nMAX 1000

int main(void)
{
	char taro_card[strMAX];	//太郎のカード
	char hana_card[strMAX];	//花子のカード
	int n = 0;				//カードの枚数
	int taro_point = 0;		//太郎のポイント
	int hana_point = 0;		//花子のポイント

	//配列を初期化する
	InitStr(taro_card, strMAX);
	InitStr(hana_card, strMAX);

	//カードの数を入力する
	scanf("%d", &n);

	while(n > 0)
	{
		//カードの情報を入力する
		scanf("%s%s", taro_card, hana_card);

		if (CardJudge(taro_card, hana_card) > 0)
		{
			taro_point += 3;
		}
		else if(CardJudge(taro_card, hana_card) < 0)
		{
			hana_point += 3;
		}
		else
		{
			taro_point++;
			hana_point++;
		}

		//配列を初期化する
		InitStr(taro_card, strMAX);
		InitStr(hana_card, strMAX);

		n--;
	}

	//結果を出力する
	printf("%d %d\n", taro_point, hana_point);

	return 0;
}

int CardJudge(char player1[], char player2[])
{
	int i;
	StrToLower(player1);
	StrToLower(player2);

	if (strcmp(player1, player2) > 0)
	{
		return 1;
	}
	else if (strcmp(player1, player2) < 0)
	{
		return -1;
	}
	else
	{
		return 0;
	}
}

void StrToLower(char* str)
{
	int n;
	for (n = 0; n < strlen(str); n++)
	{
		str[n] = tolower(str[n]);
	}
}

void InitStr(char* str, int len)
{
	int n;
	for (n = 0; n < len; n++)
	{
		str[n] = '\0';
	}
}


Measured memory_bytes: 2084
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<vector<char>> c(3,vector<char>(3));
  for(int i=0;i<3;i++){
  string S;
    cin>>S;
    for(int j=0;j<3;j++){
  c.at(i).at(j)=S.at(j);
  }
  }
  string s="";
  s+=c.at(0).at(0);
  s+=c.at(1).at(1);
  s+=c.at(2).at(2);
  cout<<s<<endl;
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    long long n,c[5];
    
    for(int i=0;i<5;i++){c[i]=0;}
    char name[11];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        //scanf("%s",name);
        cin>>name;
        if(name[0]=='M')c[0]++;
        else if(name[0]=='A')c[1]++;
        else if(name[0]=='R')c[2]++;
        else if(name[0]=='C')c[3]++;
        else if(name[0]=='H')c[4]++;
    }
    long long x=0;
    for(int i=0;i<5;i++)
    {
        for(int j=0;j<5;j++)
        {
            for(int k=0;k<5;k++)
            {
                if(i!=j&&j!=k&&k!=i)
                    x+=c[i]*c[j]*c[k];
            }
        }
    }
    cout<<x/6<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
s=deque(list(input()))
q=int(input())
rev=0
for i in range(q):
    t=list(input().split())
    if t[0]=="1":
        rev=rev+1
    else:
        if t[1]=="1":
            if rev%2==0:
                s.appendleft(t[2])
            else:
                s.append(t[2])
        else:
            if rev%2==0:
                s.append(t[2])
            else:
                s.appendleft(t[2])
if rev%2==0:
    print("".join(s))
else:
    s.reverse()
    print("".join(s))



Measured memory_bytes: 8420
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
char s[N];
int l[N],r[N];
int main(){
	scanf("%s",s);
	int n=strlen(s)+1;
	l[n]=0;r[n]=n;
	for (int i=n-1;i;i--)
		if (s[i-1]=='<')l[i]=0,r[i]=r[i+1]-1;
		else l[i]=l[i+1]+1,r[i]=n;
	int now=l[1];long long ans=now;
	for (int i=2;i<=n;i++)
		if (s[i-2]=='<')now=max(now+1,l[i]),ans+=now;
		else now=l[i],ans+=now;
	printf("%lld\n",ans);
}

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

int main(){
  char a,b;
  cin >> a >> b;
  if(a == 'D' && b == 'H'){
    b = 'D';
  }
  else if(a == 'D' && b == 'D'){
    b = 'H';
  }
  printf("%c\n",b);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
void solve()
{
	ll n;
	cin>>n;
	ll ans=1;
	for(ll i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		ans=lcm(ans,x);
	}
	cout<<ans;
		
	return;
}


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


Measured memory_bytes: 3580
def main():
    MOD = 998244353
    N, S = list(map(int, input().split()))
    A = list(map(int, input().split()))
    dp = [[0] * (S + 1) for _ in range(N + 1)]
    dp[0][0] = 1
    for n in range(1, N + 1):
        a = A[n - 1]
        dp[n][0] = dp[n - 1][0] + 1
        for s in range(1, S):
            # dp[n][s]: n個目で和がちょうどsになるインデックスの組における
            #           L のパターン数
            v = dp[n - 1][s]
            if s - a >= 0:
                v += dp[n - 1][s - a]
            dp[n][s] = v % MOD
        if S - a >= 0:
            # n個目で和がちょうどSになる時にRのパターン数をかけておく
            dp[n][S] = dp[n - 1][S - a] * (N - n + 1) % MOD
    print(sum(dp[n][S] for n in range(N + 1)) % MOD)


if __name__ == '__main__':
    main()

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

int main() {
	
	/*
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;

	int answer;
	if (a < 0) {
		answer = -a * c + d + b * e;
	}
	if (a > 0) {
		answer = (b - a)*e;
	}

	cout << answer << endl;
	*/

	/*
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int answer;
	if (a < 40) {
		a = 40;
	}
	if (b < 40) {
		b = 40;
	}
	if (c < 40) {
		c = 40;
	}
	if (d < 40) {
		d = 40;
	}
	if (e < 40) {
		e = 40;
	}
	answer = (a + b + c + d + e) / 5;
	cout << answer << endl;
	*/

	/*
	int a, b, c, d, e, f, answer;
	cin >> a >> b >> c >> d >> e >> f;
	if (a <= b&&a <= c&&a <= d) {
		answer = b + c + d;
	}
	if (b <= a&&b <= c&&b <= d) {
		answer = a + c + d;
	}
	if (c <= a && c <= b && c <= d) {
		answer = a + b + d;
	}
	if (d <= a && d <= b && d <= c) {
		answer = a + b + c;
	}
	if (e <= f) {
		answer = answer + f;
	}
	if (e > f) {
		answer = answer + e;
	}
	cout<<answer<< endl;
	*/

	/*
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	cout << a + b + c + d + e + f - min({ a,b,c,d }) - min({ e,f }) << endl;
	*/

	int a, b, c, d, p;
	cin >> a >> b >> c >> d >> p;
	cout << min(a*p, b + max(0, (p - c)*d)) << endl;

	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxX = 1000000000000000000;

int main() {
	ll X, Y;  cin >> X >> Y;
	if (X%Y == 0) {
		cout << -1 << endl;
		return 0;
	}

	ll val = X;
	while (val <= maxX) {
		if (X%Y != 0) {
			cout << val << endl;
			return 0;
		}
		else {
			val += X;
		}
	}

	cout << -1 << endl;
}


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

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<int, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < n; i++)
        {
            var L = int.Parse(line[i]);
            if (d.ContainsKey(L)) d[L]++;
            else d[L] = 1;
        }
        getAns(d);
    }
    static void getAns(Dictionary<int, int> d)
    {
        var dc = d.Count();
        if (dc <= 2) { Console.WriteLine(0); return; }
        var a = new List<int>();
        foreach (var x in d) a.Add(x.Key);
        var count = 0;
        for (int i = 0; i < dc - 2; i++)
            for (int j = i + 1; j < dc - 1; j++)
                for (int k = j + 1; k < dc; k++)
                    if (check(a[i], a[j], a[k])) count += d[a[i]] * d[a[j]] * d[a[k]];
        Console.WriteLine(count);
    }
    static bool check(int a, int b, int c)
    {
        if (b + c <= a) return false;
        if (a + c <= b) return false;
        if (a + b <= c) return false;
        return true;
    }
}


Measured memory_bytes: 28300
#include <bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
	pair<ll,ll> a[100000];
	static unsigned ll N,M;
	static unsigned ll c,d;
	static unsigned ll ans=0;

	cin>>N>>M;
	for(ll i=0;i<N;i++){
		cin>>c>>d;
		a[i]=make_pair(c,d);
	}
	
	sort(a,a+N);

	ll i=0;

	while(M){
		if(a[i].second>=M){
			ans+=a[i].first*M;
			M=0;
		}else{
			ans+=a[i].first*a[i].second;
			M-=a[i].second;
		}
		//cout<<"残り本数"<<M<<endl;
		i++;
	}

	cout<<ans<<endl;
	
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <map>
#include <queue>
#include <algorithm>
#define ri register int 
#define ll long long
using namespace std;
const int maxn=200005;
const int inf=0x7fffffff;
template <class T>inline void read(T &x){
	x=0;int ne=0;char c;
	while(!isdigit(c=getchar()))ne=c=='-';
	x=c-48;
	while(isdigit(c=getchar()))x=(x<<3)+(x<<1)+c-48;
	x=ne?-x:x;
	return ;
}
int n;
ll a[maxn];
ll sum=0;
inline ll solve(int k){
	ll cnt=0;
	for(ri i=1;i<=n;i++)cnt+=abs(a[i]-k);
	return cnt;
}
int main(){
    read(n);
    for(ri i=1;i<=n;i++){
	   read(a[i]);
	   a[i]=a[i]-i;
    }
    ll ans,lmid,rmid;
    ll l=-1e9,r=1e9;
    while(l<r-1){
	    lmid=(l+r)>>1,rmid=(lmid+r)>>1;    
    	if(solve(lmid)>solve(rmid))l=lmid;
    	else r=rmid;
    }
    if(solve(l)<solve(r))ans=l;
    else ans=r;
	printf("%lld\n",solve(ans));
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N;
  cin >> N;

  if (N == 1)
    cout << "Hello World" << endl;
  else
  {
    ll A, B;
    cin >> A >> B;
    cout << A + B << endl;
  }
}

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

#define IOS cin.tie(0);ios_base::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)     for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?" ":"\n"); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
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 NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    CIN(N,K,Q);
    vi A(N,0);
    rep(i,Q){
        int a;cin>>a;
        A[a-1]++;
    }
    rep(i,N)Yes(Q-A[i]<K);    

    return 0;
}


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

int v[50];
int c[50];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	for (int i = 0; i < n; ++i)
		cin >> c[i];
	int a = 0;
	for (int i = 0; i < n; ++i)
	{
		if (v[i] > c[i])
		{
			a = a + (v[i] - c[i]);
		}
	}
	cout << a;
}

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

int main()
{
    string s;
    cin >> s;
    if (s[s.size() - 1] != 's')
    {
        cout << s + 's' << endl;
    }
    else
        cout << s + "es" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define mem(a,b)   memset(a,b,sizeof(a))
#define en         cout<<endl;
#define pb         push_back
#define gcd(n,m)   __gcd(n,m)
#define lcm(n,m)   ((n)/__gcd(n,m))*(m)
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define all(x)     (x).begin(),(x).end()
#define allr(x)    (x).rbegin(),(x).rend()
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long
#define PI         2*acos(0.0)

int main()
{
    ll t,n,g,k,m,mx=0,mn=1e9,c,res,c1,x,y,w,z,c2;
    ci>>n;
    vector<ll>a(n);
    f(0,n) ci>>a[i];
    c=0;
    f(0,n)
    {
        if((i+1)%2&&a[i]%2) c++;
    }
    co<<c;
    return 0;
}



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

int arr[101];
int psum[101];

int main()
{
    int n;
    cin>>n;
    int tot=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        tot+=arr[i];
    }
    if(tot%10){
        cout<<tot;
        return 0;
    }
    sort(arr,arr+n);
    for(int i=0;i<n;i++){
        if(arr[i]%10){
            tot-=arr[i];
            cout<<tot;
            return 0;
        }
    }
    cout<<0;
    return 0;


}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
//#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int power(int x, unsigned int y)
{
    int res = 1;

    x = x;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x);

        y = y>>1;
        x = (x*x);
    }
    return res;
}
bool isprime(int x)
{
      if(x<2)
        return false;
    for(int i=2;i*i<=x;i++)
     {
        if (x%i==0)
            return false;
    }
    return true;
}
vector<int>primeFactors(int n)
{
    vector<int>v;
    int x=0;
    while (n % 2 == 0)
    {
        x++;
        n = n/2;
        v.pb(2);
    }
    //if(x>0)
    //v.pb({2,x});
    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        int y=0;
        while (n % i == 0)
        {
            y++;
            n = n/i;
            v.pb(i);
        }
        //if(y>0)
        //v.pb({i,y});
    }
    if (n > 2)
        v.pb(n);
    return v;
}
vector<int> cnts(10000001ll, 1ll);
void CountDivisors(int n) {

    for (int i = 2; i <= n; ++i) {
        for (int j = i; j <= n; j += i) {
            cnts[j]++;
        }
    }
    }

void solve()
{
int n;
cin>>n;
CountDivisors(n);
int ans=0;
for(int i=1;i<=n;i++)
    ans+=i*cnts[i];
cout<<ans<<endl;
}
signed main()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;
//cin>>t;
t=1;
while(t--)
{
solve();
}
}



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

template <typename T>
void print(const T &v);

int main()
{
    int n;
    cin >> n;
    int c = 0;
    int i = 1;
    for (; c < n; i++)
    {
        c += i;
    }
    i--;
    if (c != n)
    {
        cout << "No" << endl;
        return 0;
    }
    vector<vector<int>> ans(i + 1, vector<int>(i, 0));
    int num = 1;
    for (int k = 0; k < i + 1; k++)
    {
        for (int j = k; j < i; j++)
        {
            ans[k][j] = num;
            ++num;
        }
    }
    num = 1;
    for (int x = 1; x < i + 1; x++)
    {
        for (int y = x; y < i + 1; y++)
        {
            // cout << y << ' ' << x - 1 << endl;
            ans[y][x - 1] = num;
            ++num;
        }
    }

    cout << "Yes" << endl;
    cout << ans.size() << endl;
    for (int j = 0; j < i + 1; j++)
    {
        for (int k = 0; k < i; k++)
        {
            if (!k)
            {
                cout << ans[j].size();
            }

            cout << ' ' << ans[j][k];
        }
        cout << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

Measured memory_bytes: 4228
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  ll res = 0;
  if(a + b >= c){
    res = c + b;
  }
  else{
    res = a + b + b + 1;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

h,w,k = m()

a = [1,1]

for i in range(98):
	a.append(a[-1] + a[-2])

l = [[0 for i in range(w+2)] for j in range(h+1)]
l[0][1] = 1

for i in range(h):
	for j in range(w):
		l[i+1][j+1] = (l[i][j]*(a[max(0,j-1)] * a[w - 1 - j]) +l[i][j+1]*(a[j] * a[w - 1 - j]) + l[i][j+2]*(a[j] * a[max(0,w - 2 - j)]))%(10**9+7)
print(l[h][k])


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

int main() {
  string s;
  vector<string> cand = {"dreamer", "eraser", "dream", "erase"};
  cin >> s;
  reverse(s.begin(), s.end());
  rep(i, 4) reverse(cand[i].begin(), cand[i].end());

  bool flag = true;
  while (flag) {
    flag = false;
    // cerr << s << endl;
    rep(i, 4) {
      if (s.substr(0, cand[i].size()) == cand[i]) {
        s.erase(0, cand[i].size());
        flag = true;
        break;
      }
    }
  }
  cout << (s.size() == 0 ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 3764
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    long x = sc.nextLong();
    long y = sc.nextLong();
    long[][] a = new long[(int)(n + 1)][(int)(n + 1)];
    for(int i = 1; i <= n; i++) {
      for(int j = i + 1; j <= n; j++) {
        a[i][j] = Math.min(Math.abs(i - j), Math.abs(i - x) + Math.abs(j - y) + 1);
        a[i][j] = Math.min(a[i][j], Math.abs(i - y) + Math.abs(j - x) + 1); 
      }
    }
    long[] ans = new long[(int)n];
    for(int i = 1; i <= n; i++) {
      for(int j = i + 1; j <= n; j++) {
        ans[(int)a[i][j]]++;
      }
    }
    for(int i = 1; i < n; i++) {
      System.out.println(ans[i]);
    }
  }
}


Measured memory_bytes: 80724
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val (N, P) = rd.readIntArray()
    val A = rd.readIntArray()
    val AMAX = 100
    val dp = Array(N+1){LongArray(AMAX*(N+1)+1){0} }

    dp[0][0] = 1L
    for (i in 0 until N) {
        for (j in 0 until AMAX*N+1) {
            dp[i+1][j+A[i]] += dp[i][j]
            dp[i+1][j] += dp[i][j]
        }
    }

    var ans = 0L
    for (j in P until AMAX*N+1 step 2) {
        ans += dp[N][j]
    }
    println(ans)
}


//val rd = debug.Reader("agc", "017", "a", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!!
    } catch (e: Exception) { throw e }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
}


Measured memory_bytes: 40056
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

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

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut ans: Vec<usize> = Vec::new();

    let mut sum = 0;
    let mut i = 1;
    while sum < n {
        sum += i;
        ans.push(i);
        i += 1;
    }

    let diff = sum - n;
    if diff > 0 {
        let position = ans.iter().position(|&x| x == diff).unwrap();
        ans.remove(position);
    }

    return ans.iter()
        .map(|x| x.to_string() + "\n")
        .collect::<String>()
        .trim()
        .to_string();
}


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

using namespace std;

typedef long long ll;

int gcd(int a, int b){
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a % b);
}

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

	int N;
	cin >> N;

	int A[N];
	rep(i, N) cin >> A[i];

	int d = gcd(A[0], A[1]);
	rep(i, N-2) d = gcd(d, A[i+2]);

	cout << d << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
    #define rep(i,n) for(int i = 0; i < (n); i++)
     
    using namespace std;  
    
    
    
    int main() {
     
     string str,s;
     cin >> str >> s;
     
     string doubled = str + str;
     
     rep(i,doubled.size()){
     	int a = i;
     	rep(j,s.size()){
     		if(doubled[a] == s[j]){
     			if(j == s.size() -1){
     				cout << "Yes" << '\n';
     				return 0;
     			}
     			a++;
     	   	  	continue;
     		} else{
     		 	break;
     		}
     	}
     }
     cout << "No"<< '\n';
     return 0;
    }
    


Measured memory_bytes: 3228
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

int main() {
	int N; cin >> N;
	vector<int> L(2*N);
	for (int i = 0; i < 2 * N; i++) {
		cin >> L[i];
	}

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

	int ans=0;
	for (int i = 0; i < 2 * N; i+=2) {
		ans += L[i];
	}

	cout << ans << endl;
}


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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("in_b.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int sum = 0;
    int A, B, C, X;

    cin >> A >> B >> C >> X;

    for (int i = 0; i <= A; i++)
    {
        int remain_500 = X;
        remain_500 -= 500*i;

        for (int j = 0; j <= B; j++)
        {
            int remain_100 = remain_500;
            remain_100 -= 100*j;
            for (int k = 0; k <= C; k++)
            {
                int remain_50 = remain_100;
                if ( (remain_50 - 50*k) == 0 )
                {
                    sum++;
                }
            }
        }


    }

    cout << sum;


    return 0;
}


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

using namespace std;

int main(){
    string s;
    int n,k;
    cin>>n>>s>>k;
    for (int i=0; i<n; i++) {
        if (s.at(i)!=s.at(k-1)) {
            s.at(i)='*';
        }
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod
#define AddMult(x, y, z) x = (x + (y) * (z)) % mod



signed main(){

    int N, Q; cin >> N >> Q;
    vec v(Q), w(Q);
    REP(i, Q) cin >> v[i] >> w[i];

    if(N == 1){
        REP(i, Q) cout << min(v[i], w[i]) << endl;
    }else{
        REP(i, Q){
            while(v[i] != w[i]){
                if(v[i] < w[i]) swap(v[i], w[i]);
                v[i] = (v[i] - 2) / N + 1;
            }
            cout << v[i] << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 2816
#include<iostream>
using namespace std;
#include<cmath>
#include<iomanip>

int main()
{
    double x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << fixed << setprecision(10) << sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0; i<n; i++)
#define reps(i, s, e) for(int i=s; i<e; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define reprs(i, s, e) for(int i=e-1; i>=s; i--)

const int MOD = 1e9+7;

int main(){

    int h, w, k; cin >> h >> w >> k;

    ll cnt[w];
    fill(cnt, cnt+w, 1);

    ll dist[w] = {};
    dist[0] = 1;
    ll disttemp[w] = {};
    ll distnext[w] = {};

    rep(i, h){

        rep(bit, (1<<w-1)){
            
            bool next = false;
            int path[w-1] = {};
            rep(j, w-1){
                if(bit & (1<<j)){
                    path[j] = 1;
                }
            }

            rep(j, w-1){
                if(path[j] == 1 && path[j+1] == 1){
                    next = true;
                    break;
                }
            }
            if(next) continue;

            // rep(j, w-1){
            //     cout << path[j];
            // }
            // cout << endl;

            copy(dist, dist+w, disttemp);
            rep(j, w-1){
                if(path[j] == 1){
                    swap(disttemp[j], disttemp[j+1]);
                }
            }

            rep(j, w){
                distnext[j] = (distnext[j] + disttemp[j]) % MOD;
            }
        }

        copy(distnext, distnext+w, dist);
        memset(distnext, 0, sizeof(distnext));
    }

    // rep(j, w){
    //     cout << dist[j] << " ";
    // }
    // cout << endl;

    cout << dist[k-1];

    return 0;
}

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

main(){
  double n,t,a,i;
  cin >> n >> t >> a;
  double h,ans,d=10000;
  for (i=1;i<=n;i++) {
    cin >> h;
    if (d>fabs(a-t+h*0.006)) {
      d=fabs(a-t+h*0.006);
      ans=i;
    }
  }
  cout << ans << endl;
}

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

 int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

 int main()
{
    long long int K, S, a;
    cin >> K;
    S = 0;
    for (int i=1;i<=K;i++) {
     for (int j=1; j<=K;j++) {
    for (int k=1; k<=K;k++){
        a = gcd(j, i);
        a = gcd(a, k);
        S += a;
     }}}
cout << S << endl;
        }

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

int main() {

	int n;
	cin >> n;
	int n1,n10,n100;
	n100 = n / 100;
	n10 = n / 10 - n100 * 10;
	n1 = n - n100 * 100 - n10 * 10;
	if(n100 == 9){
		cout << 1;
	}else{
		cout << 9;
	}
	if(n10 == 9){
		cout << 1;
	}else{
		cout << 9;
	}
	if(n1 == 9){
		cout << 1;
	}else{
		cout << 9;
	}
	
	cout << '\n';
	
	return 0;
}

Measured memory_bytes: 256
from collections import deque
n,c,k=map(int,input().split())
l=sorted([int(input()) for _ in range(n)],reverse=True)
ans=0
d=deque(l)
while len(d)!=0:
    ans+=1
    t=d.popleft()
    cnt=1
    while len(d)!=0 and d[0]>=t-k and cnt<c:
        d.popleft()
        cnt+=1
print(ans)

Measured memory_bytes: 54488
#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
	int n;cin>>n;
	for(int i=0;i<n;i++)solve();
}
void solve(){
	int a,b;
	scanf("%d:%d",&a,&b);
	double d=abs((a*30+(double)b/2)-b*6);
	d=min(d,360-d);
	if(d<30)cout<<"alert\n";
	else if(d<90)cout<<"warning\n";
	else cout<<"safe\n";
	return;
}

Measured memory_bytes: 3084
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list = input.trim().split('\n');
let [ n, q ] = list.shift().split(' ');
n = Number(n);
q = Number(q);

class Process {
  constructor(name, time) {
    this.name = name;
    this.time = time;
  }
}

const queue = [];
for (let i = 0; i < n; i++) {
  const [ name, time ] = list[i].split(' ');
  const p = new Process(name, Number(time));
  queue.push(p);
}

let totalTime = 0;
while (queue.length !== 0) {
  const p = queue.shift();
  const executeTime = Math.min(p.time, q);
  totalTime += executeTime;
  p.time -= executeTime;
  if (p.time) {
    queue.push(p);
  } else {
    console.log(p.name + ' ' + totalTime);
  }
}



Measured memory_bytes: 60928
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<class F, class S> istream& operator >> (istream& s, pair<F, S>& p)
{ cin >> p.first >> p.second; return s;}

#define MOD 1000000007

template<class T> vector<pair<T,T>> factorize(T n)
{
    vector<pair<T,T>> factors;

    T lim = sqrt(n) + 0.1;
    
    T c = 0;
    while (n % 2 == 0) {
        n /= 2;
        c++;
    }
    if (c != 0)
        factors.push_back(make_pair(2, c));

    for (T p = 3; p <= lim; p += 2) { //cout << "p:" << p << " n:" << n <<" lim:" << lim << endl;
        T c = 0;
        while (n % p == 0) {
            n /= p;
            c++;
        }
        if (c != 0)
            factors.push_back(make_pair(p, c));
    }
    if (n != 1) {
        factors.push_back(make_pair(n, 1));
    }
    
    return factors;
}

int main()
{
    int N, M; cin >> N >> M;

    vector<int> fact(N+50);
    vector<int> finv(fact.size());
    vector<int> inv(fact.size());
    
    fact[0] = fact[1] = 1;
    finv[0] = finv[1] = 1;
    inv[0] = 0; inv[1] = 1;
    for (int i = 2; i < fact.size(); i++) {
        fact[i] = (ll)fact[i-1] * i % MOD;
        inv[i] = (ll)MOD - (ll)inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (ll)finv[i - 1] * inv[i] % MOD;
    }

    auto C = [&](int n, int r) {
        return (ll)fact[n] * finv[n-r] % MOD * finv[r] % MOD;
    };

    ll ans = 1;
    vpii factors = factorize(M);
    for (const auto & f : factors) {
        const int& x = f.second;
        ans = ans * C(x + N - 1, x) % MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <map>
#include <set>
//#include <bits/stdc++.h>
#define ll  long long
#define cn(i,n,a) for(int i=0;i<n;i++)cin>>a[i];
#define co(i,n,a) for(int i=0;i<n;i++)cout<<a[i]<<" ";
#define lp(i,n) for(int i=0;i<n;i++)
const ll mod = 1e9 + 7;
using namespace std;
void right() {
	cout << "Yes\n";
	exit(0);
}
void fail() {
	cout << -1;
	exit(0);
}
ll gcd(int a, int b) {
	if (a == 0 || b == 0)
		return 0;
	else if (a == b)
		return a;
	else if (a > b)
		return gcd(a - b, b);
	else return gcd(a, b - a);
}
map<int, int>m;
int main()
{
	int n, k;
	cin >> n >> k;
	int mx = max(n, k);
	while (mx--) {
		cout << min(n, k);
	}
}

Measured memory_bytes: 256
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 200020;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;


void solve() {
	vector<int>v(3);
	REP(i, 3)cin >> v[i];
	VSORT(v);
	if(v[0]+v[1]==v[2])print("Yes");
	else print("No");
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// int q; cin >> q;
	// while (q--)
	solve();
}


Measured memory_bytes: 256
import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
for i in range(n):
    a[i] = a[i]*(-1)
heapq.heapify(a)
for i in range(m):
    b = heapq.heappop(a)
    if b % 2 == 0:
        b = b //2
    else:
        b = b//2 + 1
    #print(b)
    heapq.heappush(a,b)
ans = 0
for i in range(n):
    ans += (heapq.heappop(a))*(-1)
print(ans)

Measured memory_bytes: 14180
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
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 ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n,m; cin>>n>>m;
    ll a=1900*m+100*(n-m);
    cout<<a*pow(2,m)<<endl;
    return 0;
}


Measured memory_bytes: 4292
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<map>
#include<set>
#define ll long long int

using namespace std;
int n,m;
int x[100100];
int y[100100];
int main() {
  cin>>n>>m;
  vector<pair<int,char> >box;
  box.resize(n+1);
  for(int i=0;i<m;i++){
    cin>>x[i]>>y[i];
    box[x[i]].first = 1;
    box[y[i]].second = 'w';
  }
  box[1].second = 'r';
  for(int i=0;i<m;i++){
     if(box[x[i]].second=='r'){
       box[y[i]].second = 'r';
       if(box[x[i]].first==1){
         box[x[i]].second = 'w';
       }
     }
     box[y[i]].first+=1;
     box[x[i]].first-=1;
     //cout<<box[x[i]].second<<" "<<box[y[i]].second<<endl;
  }
  int cnt = 0;
  for(int i=1;i<=n;i++){
    if(box[i].second=='r'){
      cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 1792