akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int r; cin >> r;
    cout << 3 * r * r << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int k;
    cin >> k;
    string s;
    cin >> s;
    if(s.length()<=k)std::cout << s << "\n";
    else std::cout << s.substr(0,k)+"..." << std::endl;
}


Measured memory_bytes: 3624
#include<stdio.h>

int main(void)
{
	int i,n;
	double a;
	double sum=0,pro=1;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf",&a);
		sum+=1/a;
	}
	printf("%lf",1/sum);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

#define PI acos(-1.0)

int main() {
	int n; cin >> n;
	vector<pair<int, int> > xy(n);
	for (int i = 0; i < n; ++i) cin >> xy[i].first >> xy[i].second;
	sort(xy.begin(), xy.end());
	double alpha = 0, ans = 1e18;
	do {
		alpha = atan2(xy[0].second, xy[0].first);
		if (alpha < 0) alpha += 2 * PI;
		double tmp = min(abs(alpha), 2 * PI - abs(alpha));
		for (int i = 1; i < n; ++i) {
			double t = atan2(xy[i].second - xy[i - 1].second, xy[i].first - xy[i - 1].first);
			if (t < 0) t += 2 * PI;
			tmp += min(abs(alpha - t),2*PI- abs(t - alpha));
			alpha = t;
		}
		double t = atan2(-xy[n - 1].second, -xy[n - 1].first);
		if (t < 0) t += 2 * PI;
		tmp += min(abs(alpha - t), 2 * PI - abs(t - alpha));
		ans = min(ans, tmp);
	} while (next_permutation(xy.begin(), xy.end()));
	printf("%.10f\n", ans * 180.0 / PI);


	return 0;
}


Measured memory_bytes: 3408
#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

typedef pair<int, int> Point;

const int N = 20000;

int n, m;
pair<int, Point> data[N];
bool vis[N+1];

main(){
  while(cin >> n >> m && (n|m)){
    for(int i=0;i<m;i++){
      cin >> data[i].first >> (data[i].second).first >> (data[i].second).second;
    }
    sort(data, data+m);
    fill(vis, vis+n+1, false);
    vis[1] = true;
    for(int i=0;i<m;i++){
      int a = (data[i].second).first;
      int b = (data[i].second).second;
      if(vis[a]) vis[b] = true;
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
      if(vis[i]) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1120
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	var l, ol string
	sc := bufio.NewReader(os.Stdin)
	l, _ = sc.ReadString('\n')
	for _, r := range l {
		ur := strings.ToUpper(string(r))
		lr := strings.ToLower(string(r))
		if string(r) != ur {
			ol += ur
		} else {
			ol += lr
		}
	}
	fmt.Printf("%s", ol)
	return
}



Measured memory_bytes: 1856
n = int(input())
a = list(map(int, input().split()))
cnt4 = 0
cnto = 0
for i in range(n):
	if a[i]%4==0:
		cnt4 += 1
	if a[i]%2==1:
		cnto += 1
print("Yes" if (cnt4+cnto==n and cnt4+1>=cnto) or cnt4>=cnto else "No")

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

int n,m,r,q;
vector<pii> g[125252];
vl dist[12];

void dijkstra(vl &dist,int p){
  dist.assign(n+r,(ll)1e18);
  priority_queue<pll> Q;
  Q.push(pll(-0, p));
  dist[p] = 0;
  while(!Q.empty()){
    pll P = Q.top(); Q.pop();
    int p = P.second;
    ll d = dist[p];
    for(pii S : g[p]){
      int to = S.first;
      ll cost = S.second;
      ll nd = d + cost;
      if(dist[to] <= nd)continue;
      dist[to] = nd;
      Q.push(pll(-nd, to));
    }
  }
}

int main(){
  scanf("%d%d%d%d",&n,&m,&r,&q);
  REP(i,m){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    --a;--b;
    g[b].push_back(pii(a,c));
  }
  REP(x,r){
    REP(i,n)if((i+1)%r==x){
      g[n+x].push_back(pii(i,0));
    }
  }
  REP(x,r)dijkstra(dist[x],n+x);
  ll ans = 0;
  while(q--){
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);
    --x;--y;
    ll mincost = (ll)1e18;
    REP(to,r){
      ll cost = dist[to][x] + dist[to][y];
      CHMIN(mincost, cost);
    }
    if(z - mincost >= 0){
      ans += z - mincost;
    }
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 18036
#include<bits/stdc++.h>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n,p[200001];
int mn;
int main(){
	cin>>n;
	rep(i,n)
	cin>>p[i];
	mn=n+1;
	int ans=0;
	rep(i,n){
		if(p[i]<mn){
			ans++;
			mn=p[i];
		}
	}
	cout<<ans;
	re 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string.h>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

int main() { 
	int a, b; cin >> a >> b;
	if (a != b) {
		cout << max(a, b) * 2 - 1 << endl;
	}
	else {
		cout << a * 2 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
S=[0]*m
C=[0]*m
for i in range(m):
  S[i],C[i] = map(int,input().split())  
  
ans = -1
for i in range(10**n):
  s = str(i)
  c = 0
  for j in range(m):
    if S[j] > len(s):
      break
    if s[S[j]-1] == str(C[j]):
      c += 1  
  if c == m and len(str(i))==n :
    ans = i
    break
print(ans)  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n,m;
  cin >> n >> m;
  vector<int> x(m);
  rep(i,0,m) cin >> x[i];
  if (n >= m) {
    cout << 0 << endl;
    return 0;
  }
  sort(all(x));
  vector<int> d(m-1);
  int ans = 0;
  rep(i,0,m-1) {
    d[i] = x[i+1] - x[i];
    ans += d[i];
  }
  sort(rall(d));
  rep(i,0,n-1) ans -= d[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3960
import math
a, b, x = map(int, input().split())
theta = 0
if x * 2 >= a ** 2 * b:
    ans = (2/a) * (b - x / a**2)
else:
    ans = (a * b ** 2)/(2 * x)
print(math.degrees(math.atan(ans)))


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

/*-------------------------------------------*/

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

    int n;
    cin >> n;
    int k;
    cin >> k;
    int sum = 0;
    int a[n];
    rep(i, n) cin >> a[i], sum += a[i];
    int ans = 0;
    for(int i = 1; i * i <= sum; i++) {
        if(sum % i) continue;
        {
            int x = 0;
            int b[n];
            rep(j, n) b[j] = a[j] % i, x += b[j];
            sort(b, b + n);
            x /= i;
            int s = 0;
            rep(j, n - x) s += b[j];
            if(s <= k) chmax(ans, i);
        }
        {
            int I = sum / i;
            int x = 0;
            int b[n];
            rep(j, n) b[j] = a[j] % I, x += b[j];
            sort(b, b + n);
            x /= I;
            int s = 0;
            rep(j, n - x) s += b[j];
            if(s <= k) chmax(ans, I);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())
A = [0] * Q
Nvec = [0] * N
for i in range(Q):
    A[i] = int(input()) - 1
    Nvec[A[i]] += 1
for n in range(N):
    if (K-Q+Nvec[n])>0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 77100
#include <iostream>
#include <cmath>
#include <set>
#define MAX 100000

using namespace std;

int v[MAX + 5], dp[MAX + 5];
int main()
{
    int n, k;

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

    cin >> n >> k;

    for(int i = 0; i < n; i++)
        cin >> v[i];

    dp[0] = 0;

    for(int i = 1; i < n; i++)
    {
        dp[i] = 2e9;
        for(int j = max(0, i - k); j < i; j++)
            dp[i] = min(dp[i], dp[j] + abs(v[i] - v[j]));
    }

    cout << dp[n - 1];

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
long long f[81],a[81];
int main()
{
	int n,k,i;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	f[1]=1000;
	for(int i=2;i<=n;i++)
	{
		f[i]=f[i-1];
		for(int j=1;j<i;j++)
		{
			f[i]=max(f[i],f[j]+(a[i]-a[j])*(f[j]/a[j]));
		}
	}
	//for(int i=1;i<=n;i++)
	//	printf("%lld\n",f[i]);
	printf("%lld\n",f[n]);
	return 0;
 } 

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(),x.end()

int main(){
  ll n,a=0;
  cin >> n;
  priority_queue<ll> pq;
  vector<ll> h(n);
  for(ll i=0;i<n;i++){
    cin >> h.at(i);
  }
  for(ll i=0;i<n-1;i++){
    if(h.at(i)>=h.at(i+1)){
      a++;
    }
    else{
      pq.push(a);
      a=0;
    }
  }
  pq.push(a);
  cout << pq.top() << endl;
}


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

typedef long long int ll;

bool check(string S){
   int n = S.size();
   bool frag = 0;
   if(n <= 6){
      return false;
   }
   for(int i = 0;i < n - 6;i++){
      if(S.substr(i,7) == "keyence"){
         frag = true;
         break;
      }
   }
   return frag;
}

int main(){
   string S;
   cin >> S;
   bool frag = 0;
   int n = S.size();
   /*if(n == 7){
      if(S == "keyence"){
         cout << "YES" << endl;
      }else{
         cout << "NO" << endl;
      }
      return 0;
   }*/
   for(int i = 0;i < n;i++){
      for(int j = i;j < n;j++){
         /*cout << S.substr(0,i) << "/" << S.substr(j,n) << endl;*/
         string T = S.substr(0,i) + S.substr(j,n);
         if(T == "keyence"){
            frag = 1;
            break;
         }
      }
      if(frag){
         break;
      }
   }
   if(frag){
      cout << "YES" << endl;
   }else{
      cout << "NO" << endl;
   }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int dp[5050][5050];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int N;
	string S;
	cin >> N >> S;
	int ans = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = i+1; j <= N; j++) {
			if (S[i-1] == S[j-1])dp[i][j] = dp[i - 1][j - 1] + 1;
			else dp[i][j] = 0;
			ans = max(ans,min(dp[i][j],j-i));
		}
	}
	puts(ans);
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> cs(n), vs(n);
    for (int i = 0; i < n; i++) cin >> vs[i];
    for (int i = 0; i < n; i++) cin >> cs[i];
    int ans = 0;
    for (int i = 0; i < 1 << n; i++) {
        int tmp = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                tmp += vs[j];
                tmp -= cs[j];
            }
        }
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
  #define pb push_back
#define f first
#define s second
  #define MAXN 100005
using namespace std;
int arr[MAXN];
int main()
{
	std::ios::sync_with_stdio(false);
	string l;
	cin>>l;
	int n=l.length();
	for(int i=0; i<n; i++) {
		for(int j=0; j<n-i; j++) {
			string lol=l.substr(i,j);
			// start mn 0 htal i-1;
			// start i+j+1 , n;
			string loll=l.substr(0,max(i-1,0))+l.substr(min(i+j,n),n-min(i+j,n));
			if(loll=="keyence") {

				cout<<"YES"<<endl;
				exit(0);
			}
		}
	}
	cout<<"NO"<<endl;

	return 0;
}


Measured memory_bytes: 256
import sys
from pprint import pprint
import itertools

n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]

ans = 0
for comb in itertools.combinations_with_replacement(list(range(1, m + 1)), n):
    l = list(comb)
    l.sort()
    tmp = 0

    for a, b, c, d in abcd:
        a -= 1
        b -= 1

        if l[b] - l[a] == c:
            tmp += d

    ans = max(ans, tmp)

print(ans)

Measured memory_bytes: 69708
#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int H, W;

    for (;;) {
        scanf("%d%d", &H, &W);
        if ((H == 0) && (W == 0)) {
            break;
        }
        for (int i = 0; i < W; i++) {
            printf("#");
        }
        printf("\n");
        for (int i = 0; i < H - 2; i++) {
            printf("#");
            for (int j = 0; j < W - 2; j++) {
                printf(".");            
            }
            printf("#\n");
        }
        for (int i = 0; i < W; i++) {
            printf("#");
        }
        printf("\n");
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 2008
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    X, Y, TX, TY = map(int, input().split())
    DX = TX - X
    DY = TY - Y
    result = ''
    result += 'U' * DY + 'R' * DX
    result += 'D' * DY + 'L' * DX
    result += 'L' + 'U' * (DY + 1) + 'R' * (DX + 1) + 'D'
    result += 'R' + 'D' * (DY + 1) + 'L' * (DX + 1) + 'U'
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const MAXN = 2e5 + 5;
int a[MAXN], Ans[MAXN];
int top;
int stk[MAXN];
struct Edges { int to, next; } e[MAXN * 2];
int head[MAXN], tot;

inline void addedge(int from, int to) {
  e[++tot] = (Edges){to, head[from]};
  head[from] = tot;
  e[++tot] = (Edges){from, head[to]};
  head[to] = tot;
}

void Dfs(int now, int fa) {
  int pos = lower_bound(stk + 1, stk + 1 + top, a[now]) - stk;
  int curstk = stk[pos], curtop = top;
  stk[pos] = a[now];
  top = max(top, pos);
  Ans[now] = top;
  for (RI i = head[now]; i; i = e[i].next)
    if (e[i].to != fa)
      Dfs(e[i].to, now);
  top = curtop;
  stk[pos] = curstk;
}

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int n; read(n);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  for (RI i = 1, x, y; i < n; ++i)
    read(x), read(y), addedge(x, y);
  memset(stk, 0x7f, sizeof(stk));
  Dfs(1, 0);
  for (RI i = 1; i <= n; ++i)
    printf("%d\n", Ans[i]);

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 25140
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
long long dp[110000];
int main(){
	int a,b;scanf("%d",&b);
  a=3;
	long long ret=0;
	for(int i=b;i>=1;i--){
		dp[i]=pw(b/i,a);
		for(int j=i+i;j<=b;j+=i){
			dp[i]=(dp[i]+mod-dp[j])%mod;
		}
		ret+=dp[i]*i%mod;
	}
	ret%=mod;
	printf("%lld\n",ret);
}

Measured memory_bytes: 1696
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long a,b;
    scan(a,b);
    if(a <= 5)
        writeln(0);
    else if(a <= 12)
        writeln(b / 2);
    else
        writeln(b);
}

Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(double &x){
  scanf("%lf",&x);
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(double x){
  printf("%.15f",x);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
template<class T> inline T pow2_L(T a){
  return a*a;
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
double X[50];
double Y[50];
double dist[50];
int main(){
  int e98WHCEY;
  int i;
  int j;
  int k;
  double cx = 0;
  double cy = 0;
  double mv = 1;
  double r = 0.999;
  double res = 1e150;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(X[Lj4PdHRW]);
      rd(Y[Lj4PdHRW]);
    }
  }
  for(e98WHCEY=(0);e98WHCEY<(100000);e98WHCEY++){
    for(i=(0);i<(N);i++){
      dist[i] =pow2_L((X[i]-cx))+pow2_L((Y[i]-cy));
    }
    {
      int WYIGIcGE;
      double t_ynMSdg;
      if(N==0){
        t_ynMSdg = 0;
      }
      else{
        t_ynMSdg = dist[0];
        for(WYIGIcGE=(1);WYIGIcGE<(N);WYIGIcGE++){
          t_ynMSdg = max_L(t_ynMSdg, dist[WYIGIcGE]);
        }
      }
      chmin(res, t_ynMSdg);
    }
    {
      int a2conNHc;
      int hCmBdyQB = 0;
      double V9aVTaxx;
      double APIVbQlN;
      int YREPHmFM;
      for(a2conNHc=(0);a2conNHc<(((N)-1)+1);a2conNHc++){
        APIVbQlN = dist[a2conNHc];
        if(hCmBdyQB==0 || V9aVTaxx<APIVbQlN){
          V9aVTaxx = APIVbQlN;
          hCmBdyQB = 1;
          YREPHmFM = a2conNHc;
        }
      }
      k =YREPHmFM;
    }
    cx += mv * (X[k] - cx);
    cy += mv * (Y[k] - cy);
    mv *= r;
  }
  wt_L(sqrt(res));
  wt_L('\n');
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define MOD 1000000007
bool fun(lli n)
{
	if (n <= 1ll)
		return false;
	if (n <= 3ll)
		return true;
	if (n % 2 == 0ll || n % 3 == 0ll)
		return false;
	for (lli i = 5ll; i * i <= n; i += 6ll)
	{
		if (n % i == 0ll || n % (i + 2ll) == 0ll)
			return false;
	}
	return true;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	lli x = 0ll, i = 0ll;
	cin >> x;
	for (i = x; i > 1ll; ++i)
	{
		if (fun(i))
			break;
	}
	cout << i;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int valueNum = Integer.parseInt(in.nextLine());
		int[] values = new int[valueNum];
		String[] tokens = in.nextLine().split(" ");
		for (int i = 0; i < valueNum; ++i) {
			values[i] = Integer.parseInt(tokens[i]);
		}
		int result = 0;
		while (true) {
			if (0L != Arrays.stream(values).filter(x -> x % 2 != 0).count()) {
				break;
			}
			result++;
			for (int i = 0; i < valueNum; ++i) {
				values[i] = values[i] / 2;
			}
		}
		System.out.println(result);
		in.close();
	}
}

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

using namespace std;

const int mod = 1e9 + 7;

long long add(long long a, long long b) {
    long long res = a + b;
    if (res >= mod) res -= mod;
    return res;
}

long long sub(long long a, long long b) {
    long long res = a - b + mod;
    if (res >= mod) res -= mod;
    return res;
}

long long mul(long long a, long long b) {
    return (((a % mod) * (b % mod)) % mod);
}

long long gcd(long long x, long long y){
    if(y == 0){
        return x;
    }
    if(x > y){
         return gcd(y, x % y);
    }
    else{
         return gcd(x, y % x);
    }
}

void dfs(vector<vector<int>> &v, vector<int> &visited, int node, int &ans){
    if(visited[node]){
        return;
    }
    visited[node] = 1;
    ans++;
    for(auto i : v[node]){
        dfs(v, visited, i, ans);
    }
}

/*bool good(vector<int> &v, int d, int mid){
    vector<int> p(v.size());
    p[0] = v[0] - mid;
    for(int i = 1;i < v.size();i++){
        p[i] = p[i - 1] + (v[i] - mid);
    }
    vector<int> m(v.size());
    m[0] = p[0];
    int mi = m[0];
    for(int i = 1;i < v.size();i++){
        mi = min(mi, p[i]);
        m[i] = mi;
    }
    for(int r = 0;r < v.size();r++){
        if(r - d > 0){
            if(m[r - d - 1] <= p[r]){
                L = r - d;
                R = r;
                return true;
            }
        }
    }
    return false;
}*/

bool comp(pair<int, int> x, pair<int, int> y){
    if(x.first < y.first)return true;
    else if(x.first == y.first){
        if(x.second < y.second)return true;
        else return false;
    }
    else{
        return false;
    }
}

long long a[100001], b[100001], c[100001], dp[100001][3];

int main(){
    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 1;i <= n;i++){
        dp[i][0] += max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        dp[i][1] += max(dp[i - 1][0], dp[i - 1][2]) + b[i];
        dp[i][2] += max(dp[i - 1][1], dp[i - 1][0]) + c[i];
    }
    cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2])) << endl;
 }
/*
5 2
-1 -2 -3 4 5
2 3
4

-3 -2 -1 4 5
2 3
5 + (-3) = 2
4 + -2 = 2
ans = 4

-3 -2 -1 4 5
3 2
5 + -3 = 2
4 + -1 = 3
ans = 5
*/


Measured memory_bytes: 8124
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main( void ) {
	
	string decks[3];
	for( int i = 0; i < 3; i++ ) {
		char deck[120];
		scanf("%s", deck);
		
		decks[i] = string(deck);
		reverse(decks[i].begin(), decks[i].end());
	}
	
	int cur = 0;
	while( true ) {
		if( decks[cur].empty() ) {
			printf("%c\n", cur + 'A');
			break;
		} else {
			int c = decks[cur].back(); decks[cur].pop_back();
			cur = c - 'a';
		}
	}
	
	return 0;
}

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

using namespace std;

const int SHIFT = 10000;
const int INF = 1 << 29;

int N, A, B, C, M;
int color[10000], small[10005];
vector< int > g[10005];
pair< int, int > v[3][10005];

void solve(int start, int id)
{
  queue< int > que;
  v[id][start] = {0, small[start]};
  que.emplace(start);
  while(!que.empty()) {
    int p = que.front();
    que.pop();
    for(auto &to : g[p]) {
      if(v[id][p].first + 1 == v[id][to].first) {
        v[id][to].second = min(v[id][to].second, v[id][p].second);
      } else if(v[id][p].first + 1 < v[id][to].first) {
        v[id][to] = {v[id][p].first + 1, min(small[to], v[id][p].second)};
        que.emplace(to);
      }
    }
  }
}

int main()
{
  memset(color, -1, sizeof(color));
  fill_n(small, 10005, INF);

  scanf("%d %d %d %d", &N, &A, &B, &C);
  for(int i = 0; i < N; i++) small[i] = i;
  for(int i = 0; i < A + B + C; i++) {
    int K;
    scanf("%d", &K);
    --K;
    if(i < A) color[K] = 0;
    else if(i < A + B) color[K] = 1;
    else color[K] = 2;
    small[color[K] + SHIFT] = min(small[color[K] + SHIFT], K);
  }

  scanf("%d", &M);
  while(M--) {
    int a, b;
    scanf("%d %d", &a, &b);
    --a, --b;
    if(~color[a]) a = color[a] + SHIFT;
    if(~color[b]) b = color[b] + SHIFT;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  for(int i = 0; i < 10005; i++) {
    sort(begin(g[i]), end(g[i]));
    g[i].erase(unique(begin(g[i]), end(g[i])), end(g[i]));
  }

  fill_n(*v, 3 * 10005, make_pair(INF, INF));
  solve(SHIFT, 0);
  solve(SHIFT + 1, 1);
  solve(SHIFT + 2, 2);

  vector< int > vertex;
  vertex.push_back(SHIFT);
  vertex.push_back(SHIFT + 1);
  vertex.push_back(SHIFT + 2);
  for(int i = 0; i < N; i++) {
    if(~color[i]) continue;
    vertex.push_back(i);
  }
  int ret = 114514, beet;
  for(auto &i : vertex) {
    int cost = v[0][i].first + v[1][i].first + v[2][i].first;
    int latte = min({v[0][i].second, v[1][i].second, v[2][i].second});
    if(cost < ret) ret = cost, beet = latte;
    else if(cost == ret) beet = min(beet, latte);
  }
  printf("%d %d\n", ret, beet + 1);
}

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

int main(){
	int a , b;
	cin >> a >> b;
	int num = 1;
	for( int i = 0; i < a; i++ ){
		if( num < b ){
			num *= 2;
		}
		else{
			num += b;
		}
	}
	cout << num;
}


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

ct = []
for i in range(N):
    ct.append(list(map(int,input().split())))

cost=[]
for i in range(N):
    if ct[i][1] <= T:
        cost.append(ct[i][0])

if len(cost)==0:
    print('TLE')
else:
    print(min(cost))

Measured memory_bytes: 38384
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long
#define mod 1000000007

ll N, M, Q;
vector<pair<int, int>> one, two;
int a, b, c;

int uf[1<<20];
int height[1<<20];

void initialize() {
	for(int i = 0;i < N;i++) uf[i] = i, height[i] = 1;
}

int root(int i) {
	while (i != uf[i]) {
		i = uf[i];
	}
	return i;
}

bool same_component(int i, int j) {
	if(root(i) == root(j)) return true;
	return false;
}

void add_component(int i, int j) {
	if(same_component(i, j)) return;
	int ri = root(i);
	int rj = root(j);
	if(height[ri] == height[rj]) {
		uf[ri] = rj;
		height[rj]++;
	} else {
		(height[ri] < height[rj]) ? uf[ri] = rj : uf[rj] = ri;
	}
}

int main() {
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);
  cin >> N >> M >> Q;
  for(int i = 0;i < Q;i++) {
    cin >> a >> b >> c;
    if(c == 0) one.push_back({a, b});
    else two.push_back({a, b});
  }

  if(M < (N-1)) {
    cout << "No" << endl;
    return 0;
  }

  if(M == (N-1)) {
    if(two.size() == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
  }

  initialize();
  for(auto &ab : one) {
    add_component(ab.first, ab.second);
  }

  for(auto &ab : two) {
    if(same_component(ab.first, ab.second)) {
      cout << "No" << endl;
      return 0;
    }
  }

  ll k = 0;
  for(int i = 0;i < N;i++) if(uf[i] == i) k++;

  if(k <= 2) cout << "No" << endl;
  else if(M <= (N + (k*(k-3)/2))) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3700
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = n / 3600;
        int m = n % 3600 / 60;
        int s = n % 3600 % 60;
        System.out.println(h + ":" + m + ":" + s);
	}
}


Measured memory_bytes: 26200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#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 rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define rev(v) reverse(v.begin(), v.end())
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define dab(v) for(auto i:v) cout << i << ' ' << endl;
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vin2(v, w) for (ll i = 0; i < v.size(); ++i) cin >> v[i] >> w[i];
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return 1; } return 0; }
int dx[] = { 0, 0, -1, 1 };
int dy[] = { 1, -1, 0, 0 };
int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } }

int main()
{
	//printf("使用可能な最大スレッド数：%d\n", omp_get_max_threads());

	string S, T;
	cin >> S >> T;
	int max_match = -1;
	rep(i, S.size() - T.size() + 1){
		int cnt = 0;
		rep(j, T.size()){
			if(S.at(i + j) == T.at(j))cnt++;
		}
		//cout << cnt << endl;
		max_match = max(max_match, cnt);
	}
	cout << T.size() - max_match <<endl;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>

#define N 200
#define C 10000

int s[N], sp, ssp;

int pop();
void push(int);
int pops();

int main(){

  int i;
  int count = 0, n = 0;
  char in[N][C];
  int out;

  i = 0;
  while(scanf("%s", in[i]) != EOF){
    
    count++;
    i++;
  }
  
  for(i = 0; i < count; i++){
    
    
    
    if(in[i][0] == '+'){

      out = pop() + pop();
      push(out);
	
    }
    
    else if(in[i][0] == '-'){

      out = pop() - pop();
      out *= -1;
      push(out);

    }
    
    else if(in[i][0] == '*'){
      out = pop() * pop();
      push(out);

    }
    else {
      out = atoi(in[i]);
      push(atoi(in[i]));
    }

    //printf("%d %d\n", sp ,out);

  }
  
  printf("%d\n", out);

  return 0;
}

int pop(){

  sp--;

  return s[sp];
}


void push(int d){

  s[sp] = d;

  sp++;

}

int pops(){

  ssp--;

  return s[ssp + 1];
}

Measured memory_bytes: 1348
import sys

N,M,K = map(int,input().split())

"""

それぞれA,B回押すとすると
A*(N-B) + B*(M-A) == K

AはM以下
.##
.##
#..
#..

"""

for A in range(M+1):

    for B in range(N+1):

        if A*(N-B) + B*(M-A) == K:
            print ("Yes")
            sys.exit()

print ("No")


Measured memory_bytes: 38768
def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    H, N = read_values()
    M = [read_list() for _ in range(N)]

    dp = [10 ** 12] * (H + max(M, key=lambda m: m[0])[0] + 10)
    dp[0] = 0
    for h in range(H + 1):
        for a, b in M:
            dp[h + a] = min(dp[h + a], dp[h] + b)
    
    print(min(dp[H:]))


if __name__ == "__main__":
    main()


Measured memory_bytes: 42336
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
#define min(a,b) a > b ?  b : a

int main(){
    ll n, k;
    cin >> n >> k;
    ll tmp = n / k;

    n -= tmp * k;
    ll ans = 1e18;

    ans = min(n, abs(n-k));
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
#include <numeric>
#include <stack>
#include <queue>
#include <cassert>
#include <forward_list>
#include <chrono>
#include <deque>
#include <list>
#include <random>
#include <cstdio>
#include <sstream>

using namespace std;

int main()
{
	int n; cin >> n;
	if (n == 1) { cout << "Hello World" << endl; }
	else
	{
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}

	return 0;
}

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

using namespace std;

int main(){
	int n;
	cin >> n;
	
	vector<int> x;
	vector<int> sortx;
	for(int i = 0;i < n;i++){
		int tx;
		cin >> tx;
		x.push_back(tx);
		sortx.push_back(tx);
	}
	
	sort(sortx.begin(),sortx.end());

	int medl = sortx[n/2 -1];
	int medr = sortx[n/2];
	
	for(int i = 0;i < n;i++){
		if(x[i] <= medl){
			cout << medr << endl;
		}else if(medr <= x[i]){
			cout << medl << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3948
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 65
#define LL long long
int a[MAXN],ra,b[MAXN],rb,flag;
LL ans,A,B;
LL Count(int i)
{
	LL ret=0;
	for(;i>0;i--)
		ret=ret*2+a[i];
	return ret;
}
int main()
{
	scanf("%lld%lld",&A,&B);
	ans=B-A+1;
	while(B)
	{
		b[++rb]=B&1;
		B>>=1;
	}
	while(A)
	{
		a[++ra]=A&1;
		A>>=1;
	}
	while(b[rb]==a[rb]&&rb>0) rb--,ra--;
	for(int i=rb-1;i>0;i--)
		if(b[i]==0&&a[i]==0)
		{
			ans+=1LL<<(i-1);
		}
		else if(b[i]==0&&a[i]==1)
		{
			if(flag) ans+=1LL<<(i-1);
			else
			{
				ans+=(1LL<<(i-1))-Count(i-1);
				while(b[i]==0&&i>0) i--;
				for(int j=i;j;j--)
					if(b[j]==0)
					{
						ans+=1LL<<(j-1);
					}
				break;
			}
		}
		else flag=1;
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>

#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORN(i, a, b) for (int i = a; i <= b; i++)
#define P(s) cout << s << endl
#define PC(condition, _true, _false) if (condition) _true; else _false;
#define toInt(_char) _char - '0'

using namespace std;
//
// Created by karayuu on 2018-12-18.
//

int main() {
    int n = 0;
    int m = 0;
    cin >> n >> m;

    int a[100][100] = {0};
    FOR(i, 0, n) {
        FOR(j, 0, m) {
            cin >> a[i][j];
        }
    }

    int b[100] = {0};
    FOR(i, 0, m) {
        cin >> b[i];
    }

    FOR(i, 0, n) {
        int sum = 0;
        FOR(j, 0, m) {
            sum += a[i][j] * b[j];
        }
        P(sum);
    }
}


Measured memory_bytes: 3128
#include <iostream>

using namespace std;

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

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main() {
  int n;
  scanf("%d", &n);
  int ans = 123456;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    ans = min(ans, a[i]);
  }
  int cnt = 0;
  bool ok = true;
  for (int i = 0; i < n; i++) {
    ok &= a[i] <= ans + 1;
    if (a[i] == ans) {
      cnt++;
    }
  }
  if (cnt == n) {
    if (ans == n - 1 || ans * 2 <= n) {
      printf("Yes\n");
    } else {
      printf("No\n");
    }
    return 0;
  }
  int add = ans - cnt;
  ok &= ans >= cnt;
  ok &= add <= (n - cnt) / 2;
  ok &= ans + 1 <= n - 1 - add;
  if (ok) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <vector>
#include <cmath>

using namespace std;

#define INF 1000005

long long N;
bool isPrime[INF];
vector <int> primes;
int ans;

int main() {
    scanf("%lld", &N);
    for (int i = 2; i <= INF; i++) isPrime[i] = true;
    for (long long i = 2; i <= INF; i++) {
        if (isPrime[i]) {
            for (long long j = i * i; j <= INF; j += i) {
                isPrime[j] = false;
            }
        }
    }
    for (long long i = 2; i <= INF; i++) {
        if (isPrime[i]) primes.push_back(i);
    }
    for (int prime : primes) {
        int cur = prime;
        while (N % cur == 0) {
            //printf("%d\n", cur);
            ans++;
            N /= cur;
            cur *= prime;
        }
        if (N == 1) break;
    }
    //printf("%d\n", N);
    if (N > INF) ans++;
    printf("%d\n", ans);
    return 0;
}
/*
2 * 4 * 3 * 9 * 5 * 25 * 6079
*/


Measured memory_bytes: 4504
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for (int i=a;i<=b;i++)
#define Rep(i,a,b) for (int i=b;i>=a;i--)
using namespace std;
ll n,m,a[100100],b[100100],c[100100],sum;
inline ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int main()
{
	n=read();m=read();a[1]=read();
	For(i,2,n)
	{
		a[i]=read();
		if(a[i]>a[i-1])
		{
			sum+=a[i]-a[i-1];
			b[a[i-1]+1]+=a[i-1]+1;
			b[a[i]+1]-=a[i-1]+1;
			++c[a[i-1]+1];
			--c[a[i]+1];
		}
		else
		{
			sum+=m-a[i-1]+a[i];
			b[a[i-1]+1]+=a[i-1]+1;
			++c[a[i-1]+1];
			b[1]-=m-a[i-1]-1;
			++c[1];
			b[a[i]+1]+=m-a[i-1]-1;
			--c[a[i]+1];
		}
	}
	For(i,1,m)b[i]+=b[i-1],c[i]+=c[i-1];
	ll ans=0;
	For(i,1,m)
		ans=max(ans,i*1LL*c[i]-b[i]);
	sum-=ans;
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 2560
package main

import "fmt"

func inputSlice(inputNums int) []int {
	var ary []int
	for i := 0; i < inputNums; i++ {
		var in int
		fmt.Scan(&in)
		ary = append(ary, in)
	}
	return ary
}

func check(ary []int) string {
	for i := len(ary) - 1; i > 0; i-- {
		if ary[i] == ary[i-1]-1 {
			ary[i-1]--
		}
	}
	for i := 0; i < len(ary)-1; i++ {
		if ary[i] > ary[i+1] {
			return "No"
		}
	}
	return "Yes"
}

func main() {
	var n int
	fmt.Scan(&n)
	ary := inputSlice(n)
	fmt.Println(check(ary))
}


Measured memory_bytes: 5504
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <cctype>
using namespace std;
int n,x,t;
int main()
{
	cin>>n>>x>>t;
	if(n%x==0)cout<<n/x*t<<endl;
	else cout<<(n/x+1)*t<<endl;
	return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
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_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> void mmax(T &m, const T q) { if (m < q) m = q; }
template<typename T> void mmin(T &m, const T q) { if (m > q) m = q; }
template<typename T1, typename T2> pair<T1, T2> operator+(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(pair<T1, T2> &l, pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;


int main()
{
    lint K;
    cin >> K;
    lint A;
    cin >> A;
    lint B;
    cin >> B;
    lint res = 1 + K;
    if (B - A > 2)
    {
        if (K >= A - 1) mmax(res, (K - A + 1) / 2 * (B - A) + A + (K - A + 1) % 2);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256