akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
const int N = 2e5 + 500;
#define ll long long
int main(){
	double n;
	cin >> n;	
	double ans = 2 * 3.14 * n;
	cout << ans << endl;
}

Measured memory_bytes: 3788
import java.util.*;


public class Main {
    
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int num = sc.nextInt();
        int sum;
        int um = (int)Math.pow(2,num);
        
        if (a>b && a>c){
            sum = a * um + b + c;
        }else if(b>a && b>c){
            sum = b * um + a + c;
        }else{
            sum = c * um + a + b;
        }
        
        System.out.println(sum);
    }
}

Measured memory_bytes: 23124
#include <stdio.h>
int main(void)
{
    int H,W,i,j;
    while(1)
    {
        scanf("%d%d",&H,&W);
        if(H==0&&W==0) break;
        for(i=0;i<H;i++)
        {
            for(j=0;j<W;j++)
            {
                if(i%2==1&&j%2==1)
                {
                    printf("#");
                }
                else if(i%2==0&&j%2==0)
                {
                    printf("#");
                }
                else if(i%2==1&&j%2==0)
                {
                    printf(".");
                }
                else printf(".");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
using namespace std;
using in6 = int64_t;
using ind = double;
using vi = vector<in6>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<in6,in6>;
using psi = pair<string,in6>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)
#define mod 1000000007

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 n,m;
  cin >> n >> m;
  vpi data(m);
  rep(i,m) cin >> data[i].first >> data[i].second;
  in6 left = data[0].first, right = data[0].second;
  repa(i,1,m) {
    if(left < data[i].first) left = data[i].first;
    if(right > data[i].second) right = data[i].second;
  }
  in6 ans = right - left + 1;
  if(ans < 0) cout << 0;
  else cout << ans;
  hinata;
}

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

int main() {
  long long N,A,B;
  cin >> N >> A >> B;
  
  long long ans = min(B-1,N-A);
  if((B-A)%2==0) ans = min(ans,(B-A)/2);
  else{
    ans = min(ans,(B-A)/2+A);
    ans = min(ans,(B-A)/2+N-B+1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

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


	int ans = INF;
	int di = s.size() - t.size();

	rep(i, di + 1) {
		int c = 0;
		rep(j, t.size()) {
			if (s[i+j] != t[j]) {
				c++;
			}
		}
		ans = min(ans, c);
	}


	cout << ans << endl;

	return 0;
}


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

#define int long long
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 (b<a) { a=b; return 1; } return 0; }
#include <bits/stdc++.h>
using namespace std;

std::ostream &operator<<(std::ostream &dest, __int128_t value) {
  std::ostream::sentry s(dest);
  if (s) {
    __uint128_t tmp = value < 0 ? -value : value;
    char buffer[128];
    char *d = std::end(buffer);
    do {
      --d;
      *d = "0123456789"[tmp % 10];
      tmp /= 10;
    } while (tmp != 0);
    if (value < 0) {
      --d;
      *d = '-';
    }
    int len = std::end(buffer) - d;
    if (dest.rdbuf()->sputn(d, len) != len) {
      dest.setstate(std::ios_base::badbit);
    }
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
    if ('0' <= s[i] && s[i] <= '9')
      ret = 10 * ret + s[i] - '0';
  return ret;
}

signed main(){
	int n;
	cin >> n;
	int a[100010];
	bool zero = false;
	for(int i = 0;i < n;i++){
		cin >> a[i];
		zero = zero || a[i] == 0; 
	}
	if(zero){
		cout << 0 << endl;
		return 0;
	}
	__int128 ans = 1;
	for(int i = 0;i < n;i++){
		ans *= a[i];
		if(ans > (long long)1e18){
			cout << -1 << endl;
			return 0;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4380
#include<iostream>
 
using namespace std;
int main()
{
    int N;
    int t1,t2;
    bool seven;
    seven = false;
    
    
 
    cin >> N;
    t1 = N/10;
    t2 = N/100;
    
    if((N % 10) == 7){
        seven = true;
    }else if((t1 % 10) == 7){
        seven = true;
    }else if((t2 % 10) == 7){
        seven = true;
    }
 
    if(seven == true){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
 
   
    return 0;
    
}


Measured memory_bytes: 3032
import sys
import bisect
import numpy as np
input = sys.stdin.readline
N=int(input())
A=[0]*N
B=[0]*N
for i in range(N):
    A[i],B[i]=[int(x) for x in input().split()]
matrix = np.vstack((np.array(A),np.array(B)))
matrix = matrix[:, np.argsort(matrix[1])]
time=0
capacity=0
for a,b in zip(matrix[0],matrix[1]):
    capacity += (b-time) - a
    time = b
    if capacity <0:
        print('No')
        sys.exit()
    #print(capacity,a,b)
print('Yes')

Measured memory_bytes: 34300
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1005;
const int maxm = 7005;

int a[maxn], b[maxn], c[maxn], d[maxn], e[maxn], f[maxn];
vector <int> vx, vy;
int dx[] = {0, 0, -1, 1}, dy[] = {-1, 1, 0, 0};
bool vis[maxm][maxm], ma[maxm][maxm];

int get_x(int val){
    return lower_bound(vx.begin(), vx.end(), val) - vx.begin();
}

int get_y(int val){
    return lower_bound(vy.begin(), vy.end(), val) - vy.begin();
}

int main(){
    int n, m; scanf("%d%d", &n, &m);
    vx.push_back(0), vy.push_back(0);
    vx.push_back(-1.1e9), vy.push_back(-1.1e9);

    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> c[i];
        vx.push_back(a[i]), vx.push_back(b[i]);
        vy.push_back(c[i]);
    }

    for(int i = 0; i < m; i++){
        cin >> d[i] >> e[i] >> f[i];
        vy.push_back(e[i]), vy.push_back(f[i]);
        vx.push_back(d[i]);
    }

    sort(vx.begin(), vx.end()), vx.erase(unique(vx.begin(), vx.end()), vx.end());

    sort(vy.begin(), vy.end()), vy.erase(unique(vy.begin(), vy.end()), vy.end());


    for(int i = 0; i < n; i++){
        a[i] = get_x(a[i]), b[i] = get_x(b[i]), c[i] = get_y(c[i]);
        for(int j = a[i]*2 - 1; j < 2 * b[i]; j++)
            ma[j][2*c[i] - 1] = true;
    }

    for(int i = 0; i < m; i++){
        d[i] = get_x(d[i]), e[i] = get_y(e[i]), f[i] = get_y(f[i]);
        for(int j = e[i]*2-1; j < f[i]*2; j++)
            ma[2*d[i]-1][j] = true;
    }

    int sx = get_x(0)*2 - 1, sy = get_y(0)*2 - 1;

    queue<pair<int, int>> qu;
    qu.push({sx, sy}), vis[sx][sy] = true;
    ll ans = 0;
    bool flag = false;
    while(!qu.empty()){
        int ux = qu.front().first, uy = qu.front().second; qu.pop();
        if(ux == maxm-1 || uy == maxm-1 || ux == 0 || uy == 0){
            flag = true;
            break;
        }
        if(ux % 2 == 0 && uy % 2 == 0){
            int x = ux / 2, y = uy / 2;
            ans += 1ll * (vx[x + 1] - vx[x]) * (vy[y + 1] - vy[y]);
        }
        for(int i = 0; i < 4; i++){
            int xx = ux + dx[i], yy = uy + dy[i];
            if(xx >= maxm || xx < 0 || yy >= maxm || yy < 0 || ma[xx][yy] || vis[xx][yy]) continue;
            qu.push({xx, yy});
            vis[xx][yy] = true;
        }
    }
    if(flag) printf("INF\n");
    else printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 89024
#include <iostream>
#include <sstream>
#include <stdio.h>
//#define _USE_MATH_DEFINES
#include <math.h>
#include <set>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <bitset>
#include <stack>
#include <queue>
#include <ctype.h>

typedef long long int lli;
#define rep(i,s,N) for(int i=s;i<N;i++)
#define MOD 1000000007
#define more(a,b) (((a)>(b))?(a):(b))
#define less(a,b) (((a)<(b))?(a):(b))

using namespace std;

int main(void)
{
	int N; cin >> N;
	string S; cin >> S;
	lli ans = 0;
	vector<map<char, int>> cnt(N + 1);
	cnt[N]['R'] = 0; cnt[N]['G'] = 0; cnt[N]['B'] = 0;
	for (int i = N - 1; i >= 0; i--) {
		cnt[i][S[i]]++;
		cnt[i]['R'] += cnt[i + 1]['R'];
		cnt[i]['G'] += cnt[i + 1]['G'];
		cnt[i]['B'] += cnt[i + 1]['B'];
	}

	rep(i, 0, N) {
		rep(j, i + 1, N) {
			if (S[i] != S[j]) {
				char c = 'R' + 'G' + 'B' - S[i] - S[j];
				ans += cnt[j + 1][c];
			}
		}
	}

	rep(d, 1, (N - 1) / 2 + 1) {
		for (int f = 0; f + d * 2 < N; f++) {
			if (S[f] != S[f + d] && S[f + d] != S[f + 2 * d] && S[f] != S[f + 2 * d])ans--;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4164
#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, M, S; cin >> N >> M >> S;
  using Tuple = tuple<ll, ll, ll>;
  vector nbr(N, vector<Tuple>());
  vector<ll> A(M);
  for (ll i = 0; i < M; i++) {
    ll u, v, a, b; cin >> u >> v >> a >> b; u--; v--;
    nbr.at(u).emplace_back(v, a, b);
    nbr.at(v).emplace_back(u, a, b);
    A.at(i) = a;
  }
  sort(A.begin(), A.end(), greater<>());
  ll lim = 1;
  for (ll i = 0; i < N-1; i++) lim += A.at(i);
  vector<ll> C(N), D(N);
  for (ll i = 0; i < N; i++) {
    ll c, d; cin >> c >> d;
    C.at(i) = c;
    D.at(i) = d;
  }
  vector rec(N, vector(lim, LLONG_MAX));
  priority_queue<Tuple, vector<Tuple>, greater<Tuple>> pque;
  if (S >= lim) S = lim - 1;
  ll cnt = 1;
  auto check = [&](ll t, ll n, ll s) -> void {
    if (!(0 <= s && s < lim && t < rec.at(n).at(s))) return;
    pque.emplace(t, n, s);
    if (rec.at(n).at(0) == LLONG_MAX) cnt++;
    for (ll y = s; y >= 0 && t < rec.at(n).at(y); y--) rec.at(n).at(y) = t;
  };
  rec.at(0).at(S) = 0;
  pque.emplace(0, 0, S);
  ll curT = 0;
  ll cIdx = 1;
  auto done = [&]() -> bool {
    while (cIdx < N && rec.at(cIdx).at(0) <= curT) cIdx++;
    return cIdx == N;
  };
  while (!done()) {
    auto [t, i, s] = pque.top(); pque.pop();
    curT = t;
    if (rec.at(i).at(s) < t) continue;
    check(t + D.at(i), i, s + C.at(i));
    for (auto [j, a, b] : nbr.at(i)) {
      check(t + b, j, s - a);
    }
  }
  for (ll j = 1; j < N; j++) {
    cout << rec.at(j).at(0) << "\n";
  }

  return 0;
}



Measured memory_bytes: 4204
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
ll const mod=998244353;
//ll const mod=1e9+7;
const ll MAX=300000;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


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


int main(){
    int n,m,l;
    cin>>n>>m>>l;
    vvi dp(n,vi(n,INF));
    rep(i,n)dp[i][i]=0;
    rep(i,m){
      int a,b,c;
      cin>>a>>b>>c;
      
      a--,b--;
      dp[a][b]=c;
      dp[b][a]=c;
    }
    rep(k,n)rep(i,n)rep(j,n)chmin(dp[i][j],dp[i][k]+dp[k][j]);
    vvi dp2(n,vi(n,INF));
    rep(i,n)rep(j,n){
      if(dp[i][j]<=l)dp2[i][j]=1;
    }
    rep(k,n)rep(i,n)rep(j,n)chmin(dp2[i][j],dp2[i][k]+dp2[k][j]);
    int q;
    cin>>q;
    rep(i,q){
      int s,t;
      cin>>s>>t;
      --s;--t;
      int ans=dp2[s][t];
      if(ans==INF)cout<<-1<<endl;
      else cout<<ans-1<<endl;
    }
    return 0;
}

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

int main(){
  int A,B;
  cin>>A>>B;
  int N[B];
  int c = 0;
  for(int i = 0;i < B;i++){
    cin>>N[i];
    c += N[i];
  }
  if(A-c >= 0)cout<<A-c;
  else cout<<"-1";
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>
#define INF 1000000000;
using namespace std;
int n,m,a[11];
vector <int> coin;
int used[11];
void mk_coin(int sum,int k){
  for(int i=k;i<n;i++) {
    if(used[i]==1) continue;
    used[i]=1;
    coin.push_back(sum+a[i]);
    mk_coin(sum+a[i],i+1);
    used[i] = 0;
  }
}
 
int main() {
  while(1){
    cin >> n >> m;
    if(n==0&&m==0) break;
    coin.clear();
    for(int i=0;i<n;i++)cin >> a[i];
    mk_coin(0,0);
    
    int dp[100010]={};
    for(int i=1;i<=m;i++) dp[i] = INF;
    for(int i=0;i<coin.size();i++)
      for(int j=0;j<=m-coin[i];j++) dp[j+coin[i]] = min(dp[j]+1,dp[j+coin[i]]); 
    cout <<dp[m]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1616
n,m=map(int, input().split())
prefecture=[]
for i in range(m):
    pk,yk=map(int, input().split())
    prefecture.append([pk,yk,i])

prefecture.sort(key=lambda x:(x[0],x[1])) # x[0]:pで整理したうえでx[1]:yで整理
p_num=prefecture[0][0]
city_num=1
for i in range(m):
    if(prefecture[i][0]!=p_num):
        p_num=prefecture[i][0]
        city_num=1

    prefecture[i].append(city_num)
    city_num+=1

prefecture.sort(key=lambda x:x[2])

for i in range(m):
    print('{0:06d}{1:06d}'.format(prefecture[i][0], prefecture[i][3]))


Measured memory_bytes: 35768
K, N = gets.split.map(&:to_i)

if K % 2 == 0
    arr = [K/2] + Array.new(N-1, K)
    puts arr.join(' ')
    exit
end

node_dead = [0]
node_live = [1]
node = Array.new(N, 10**10)
node[0] = 1
(1..N).each do |i|
    node_dead[i] = node_live[i-1]
    node_live[i] = node_live[i-1] * K
    node[i] = node[i-1] - node_live[i-1] + node_dead[i] + node_live[i]
    break if node[i] > N
end

arr = []
diff = 0
depth = 0
while node[N-depth-1] > diff + 1
    arr.push((K+1)/2)
    diff += 1 if depth > 0
    depth += 1
end

loop do
    target = (node[N-depth]-diff+1)/2
    left = depth == 0 ? 0 : 1
    num = (target-1-left)/node[N-depth-1] + 1
    arr.push(num) if num > 0
    depth += 1
    if num == 0 || depth == N
        puts arr.join(' ')
        exit
    else
        diff -= (K-2*num+1)*node[N-depth] - left
    end
end


Measured memory_bytes: 11516
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N, M;
    cin >> N >> M;

    int c = 0;
    REP(i, M) {
        int a = i + 1;
        int b = N - i;

        if (N % 2 == 0 && b - a <= N - b + a) c = 1;

        cout << a << " " << b - c << endl;
    }
    
}


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

using namespace std;

const int M = 1e9+7;
int n;

inline int power(int base, int x) {
	int k = 1;
	while (x > 0) {
		if (x & 1) k = (long long)k * base % M;
		base = (long long)base * base % M;
		x >>= 1;
	}
	return k;
}

inline void solve() {
//	if (n < 2) {
//		puts("0");
//		return;
//	}
	int e10 = power(10, n), e9 = M - power(9, n), e8 = power(8, n);
	printf("%lld\n", ((long long) e10 + e9 * 2 + e8) % M);
}

int main() {
	scanf("%d", &n);
	solve();
	return 0;
}


Measured memory_bytes: 3812
from collections import deque
n = int(input())
mins = [1000 for i in range(n+1)]
used = [0 for i in range(n+1)]
deq = deque()
deq.append((1,1))
while deq:
  x,cnt = deq.popleft()
  mins[x] = min(mins[x],cnt)
  used[x] = 1
  if used[10*x%n] == 0:
    deq.appendleft((10*x%n,cnt))
  if used[(x+1)%n] == 0:
    deq.append(((x+1)%n,cnt+1))
print(mins[0])

Measured memory_bytes: 11724
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

//const int mod = 1000000007;
const int mod = 998244353;

struct mint {
    int64_t x;
    mint(int64_t x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(int64_t t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    int n;
    cin >> n;
    vector<P> d(n);
    rep(i, n) {
        int dd;
        cin >> dd;
        d[i] = P(dd, i);
    }

    sort(all(d));
    map<int, int> mp;
    bool x = true;
    rep(i, n) {
        if(!i and d[i] != P(0, 0)) {
            x = false;
        }
        if(i and !(d[i].first == d[i-1].first or d[i].first == d[i-1].first+1)) x = false;
        mp[d[i].first]++;
    }
    if(mp[0] != 1) x = false;

   mint ans = (ll)x;
   if(ans.x) {
       rep(i, mp.size()) {
           if(!i) continue;
           ans *= mint(mp[i-1]).pow(mp[i]);
       }
   }

   cout << ans << endl;
}

Measured memory_bytes: 5760
def main():
    k, s = map(int, input().split())
    cnt = 0
    for x in range(k+1):
        for y in range(k+1):
            if s - x - y >= 0 and s - x - y <= k:
                    # print(x, y, s-x-y)
                    cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 2940
N, M = map(int, input().split())
A = sorted([int(i) for i in input().split()])
BC = sorted([[int(i) for i in input().split()] for i in range(M)], reverse = True, 
           key = lambda x: x[1])
 
cnt = 0
D = []
for i in range(M):
    if cnt > N:
        break
    D += [BC[i][1]] * BC[i][0]
    cnt += BC[i][0]
    
x = min(N, len(D))

for i in range(x):
    A[i] = max(A[i], D[i])
    
print(sum(A))

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

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

    return gcd(b,a%b);
}

void solve()
{
   string s;
   cin>>s;

   if(s[2]==s[3] && s[4]==s[5])
    cout<<"Yes";
   else
    cout<<"No";
}

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

    solve();
    return 0;
}


Measured memory_bytes: 256
# AOJ通らなかった...何故かはわからん
N = int(input())
for i in range(N):
    a = list(map(int, input().split(" ")))
    a.sort()
    #print(a)
    if(a[2]**2 == a[0]**2 + a[1]**2):
        print("YES")
    else:
        print("NO")



Measured memory_bytes: 5596
#include<stdio.h>
int main ()
{
    int n,a[105],i,j,k ,x=0,y=0;
    scanf("%d",&n);
    for(i=0; i<n; i++)
        scanf("%d",&a[i]);
    j=1;
    k=n-2;
    x=a[0];
    y=a[n-1];
    while(j<=k)
    {
        if(x<=y)
        {
            x+=a[j];
            j+=1;
        }
        else
        {
            y+=a[k];
            k-=1;
        }
    }
    if(x>=y)
        printf("%d\n",x-y);
    else
        printf("%d\n",y-x);

}


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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>void add(T &a, const T &b){a += b; a %= mod;}

class ModCase{ // modの元での場合の数
public:
  vector<ll> fact, finv;

  static ll mod_pow(ll a, ll n){
    if(n == 0) return 1;
    if(n % 2 == 0) return mod_pow((a * a) % mod, n/2);
    return (a * mod_pow(a, n-1) % mod);
  }

  ModCase(ll N):fact(N+1), finv(N+1){ // O(N)で初期化
    fact[0] = 1;
    FOR(i, 1, N+1) fact[i] = (i * fact[i-1]) % mod;
    finv[N] = mod_pow(fact[N],mod-2);
    ROF(i, N, 0) finv[i] = finv[i+1] * (i+1) % mod;
  }

  ll C(ll n, ll r){ // nCr
    if(r < 0 or n < r) return 0;
    return fact[n] * finv[r] % mod * finv[n-r] % mod;
  }

  ll P(ll n, ll r){ // nPr
    if(r < 0 or n < r) return 0;
    return fact[n] * finv[n-r] % mod;
  }

  ll H(ll n, ll r){ // nHr
    return C(n+r-1,r);
  }
};

signed main(){
  int n, m, k; cin >> n >> m >> k;

  ModCase mc(n*m);

  int ans = 0;
  FOR(d,1,n){
    ans += d*(n-d)*m*m;
    ans %= mod;
  }
  FOR(d,1,m){
    ans += d*(m-d)*n*n;
    ans %= mod;
  }
  ans *= mc.C(n*m-2,k-2);
  ans %= mod;
  cout << ans << endl;
}


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

typedef long long LL;
const int MAXN=1e5+5;
const int MAXM=1e5+5;
const int mod=1e9+7;
const double eps=1e-9;

int n,x[4][MAXN];
LL dp[4][MAXN];

int main(){
	scanf("%d",&n);
	memset(dp,0,sizeof(dp));
	LL ans=0;
	for(int i=1;i<=n;i++) dp[1][i]=1;
	for(int i=1;i<=3;i++){
		for(int j=1;j<=n;j++)
			scanf("%d",&x[i][j]);
		sort(x[i]+1,x[i]+n+1);
		if (i==1) continue;
		int pos=0;
		for(int j=1;j<=n;j++){
			dp[i][j]=dp[i][j-1];
			for(int k=pos+1;k<=n;k++){
				if (x[i-1][k]>=x[i][j]) break;
				dp[i][j]+=dp[i-1][k];
				pos=k;
			}
			if (i==3) ans+=dp[i][j];
		}
	}
	printf("%lld\n",ans);
    return 0;
}


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

int main(){
	int n;
	cin >> n;
	rep(i,30){
		rep(j,16){
			if((4 * i + j * 7) == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main() {
  int N,A[200],dmin = 100;cin>>N;
  for(int i=0;i<N;i++){int A;
  cin>>A;
  int d=0;
  while (A % 2 == 0){A /= 2;
                    d++;}
  dmin = min (dmin, d);
                      }
  cout<<dmin<<endl;
}


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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define inf 0x3f3f3f3f
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

/* 
 * * stuff you should look for
 * * int overflow, array bounds
 * * special cases (n=1?), set tle
 * */

int main(){
    fcin;

    string a, b;
    cin >> a >> b;

    int aa, bb;
    cin >> aa >> bb;

    string t;
    cin >> t;

    if(t == a) cout << aa - 1 << " " << bb << endl;
    else cout << aa << " " << bb - 1 << endl;
    return 0;
}



Measured memory_bytes: 256
from sys import stdin

# Binary Indexed Tree
class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n+1)

    def sum(self, i):
        res = 0
        while i > 0:
            res += self.tree[i]
            i -= i & (-i)

        return res

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & (-i)

# Inversion Number
def inversion_num(A):
    count = 0
    bit = BIT(max(A))
    for j in range(len(A)):
        count += j-bit.sum(A[j])
        bit.add(A[j], 1)

    return count

n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]
dic = {}
for i, a_i in enumerate(sorted(a), 1):
    dic[a_i] = i

# 数の大小関係を保つように、a_iが何番目に小さいかを表すリストに変形
a = [dic[a_i] for a_i in a]
print(inversion_num(a))



Measured memory_bytes: 38696
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 200005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

ll dp[105][105];

ll recur(ll pos, ll rem) {

  if (rem < 0)
    return -inf;
  if (pos == 0) {
    return (rem == 0) ? 0 : -inf;
  }

  ll &ans = dp[pos][rem];

  if (ans != -1)
    return ans;

  ans = -inf;
  ans = max(ans, max(1 + recur(pos - 1, rem - pos), recur(pos - 1, rem)));
  return ans;
}

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

  ll n;
  cin >> n;

  vector<ll> arr;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      ll cnt = 0;
      while (n % i == 0) {
        cnt++;
        n /= i;
      }
      arr.push_back(cnt);
    }
  }
  if (n > 1)
    arr.push_back(1);

  memset(dp, -1, sizeof(dp));

  ll res = 0;
  for (ll &x : arr) {
    res += recur(100, x);
  }

  cout << res << en;
  return 0;
}


Measured memory_bytes: 3740
import collections

def getGreatestCommonDivisor(x, y):
    if x < y:
        x, y = y, x
    if y == 0:
        return x
    return getGreatestCommonDivisor(y, x % y)


N = int(input())
fishes = []
for _ in range(N):
    fishes.append([int(s) for s in input().split()])

# fishes = [
#           (3, 2),
# (3, 2),
# (-1 ,1),
# (2 ,-1),
# (-3 ,-9),
# (-8 ,12),
# (7 ,7),
# (8, 1),
# (8 ,2),
# (8, 4),
# ]

# fishes = [
#           (3, 0),
#           (0, 1),
#           (0, 0),
#           (0, 0),
# ]


slopeCount = collections.defaultdict(int)
for x, y in fishes:
    if x == 0 and y == 0:
        pass
    elif x == 0:
        y = 1
    elif y == 0:
        x = 1
    else:
        gcl = getGreatestCommonDivisor(abs(x), abs(y))
        x //= gcl
        y //= gcl
    if x < 0:
        x = -x
        y = -y
    slopeCount[(x, y)] += 1

# print(slopeCount)

reversedPairs = dict()
independentCount = 0
zeroCount = 0
for slope, count in slopeCount.items():
    x, y = slope
    if (x, y) == (0, 0):
        zeroCount += count
        continue
    if x == 0:
        rx, ry = 1, 0
    elif y == 0:
        rx, ry = 0, 1
    else:
        rx, ry = (y, -x) if y >= 0 else (-y, x)
    if (x, y) in reversedPairs or (rx, ry) in reversedPairs:
        continue
    if (rx, ry) not in slopeCount:
        independentCount += count
        continue
    reversedPairs[(x, y)] = (count, slopeCount[(rx, ry)])
    

# print(reversedPairs, independentCount)

M = 1000000007
def subsetNum(count):
    r = 1
    for _ in range(count):
        r *= 2
        r %= M
    return r

result = subsetNum(independentCount)
for c1, c2 in reversedPairs.values():
    result *= (subsetNum(c1) - 1 + subsetNum(c2) - 1 + 1)
    result %= M
if zeroCount > 0:
    result += zeroCount
result -= 1
result %= M
print(result)

Measured memory_bytes: 79892
N = int(input())
A = []
i = 1
n = N ** (1/2)
while i <= n:
	if round((N / i) % 1,6) == 0:
		A.append(i)
	i = i + 1
a = max(len(str(A[-1])),len(str(N // A[-1])))
print(a)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10000)
D, G = list(map(int, input().split(' ')))
left = {}
bonus = {}
for i in range(1, D+1):
    left[i], bonus[i] = list(map(int, input().split(' ')))
 
big = 9999999
 
probably_ans = big
memo = {}
def hogehoge(depth, index, pt, left, bonus, probably_ans):
    key = (depth, index, pt, str(left))
    if key in memo:
        return memo[key]
    if pt >= G:
        return depth
    if depth >= probably_ans or index > D:  # 遅いかも
        return big
    
    # 一つも引かない
    probably_ans = min(probably_ans, hogehoge(depth, index + 1, pt, left, bonus, probably_ans))
    
    # 全部引いて index reset
    for k in range(0, D - index + 1):
        if left[index + k]:
            temp = left[index + k]
            left[index + k] = 0
            probably_ans = min(probably_ans, hogehoge(depth+temp, 1, pt + (index + k) * 100 * temp + bonus[index + k], left, bonus, probably_ans))
            left[index + k] = temp

    # 歯抜け状態から行けそうならクリア
    if left[index]:
        if pt + index * 100 * left[index] + bonus[index] >= G:
            for i in range(1, left[index] + 1):
                left[index] = left[index] - i
                new_pt = pt + index * 100 * i + bonus[index] * (left[index] == 0)
                if (new_pt >= G):
                    probably_ans = min(probably_ans, hogehoge(depth+i, index+1, new_pt, left, bonus, probably_ans))
                left[index] = left[index] + i
    memo[key] = probably_ans
    return probably_ans
    
print(hogehoge(0, 1, 0, left, bonus, probably_ans))

Measured memory_bytes: 5684
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string S0 = "CODEFESTIVAL2016";
	string S;
	cin>>S;
	int n=0;
	for (int i=0;i<S.length();i++){
		if (S[i] != S0[i]){
			n++;
		}
	}
	cout<<n<<endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
grid=[]
for i in range(N):
   S_P=list(input().split())
   S_P.append(i+1)
   grid.append(S_P)

for i in range(N):
   grid[i][1]=int(grid[i][1])

grid.sort(key=lambda x:x[1],reverse=True)
grid.sort(key=lambda x:x[0])

for i in range(N):
   print(grid[i][2])

Measured memory_bytes: 3064
#include <stdio.h>

char *color_name[] = {"black",   "blue",    "lime",    "aqua",    "red",     "fuchsia", "yellow",  "white"};
char *color_code[] = {"#000000", "#0000ff", "#00ff00", "#00ffff", "#ff0000", "#ff00ff", "#ffff00", "#fffffff"};

int hex1(char h)
{
    if (h <= '9'){
        return (h - '0');
    }
    return (h - 'a' + 10);
}
    
int hex10(char h10, char h)
{
    return (hex1(h10) * 16 + hex1(h));
}

int distance(char *color1, char *color2)
{
    int r1, g1, b1;
    int r2, g2, b2;
    int d;
    
    r1 = hex10(color1[1], color1[2]);
    g1 = hex10(color1[3], color1[4]);
    b1 = hex10(color1[5], color1[6]);
    r2 = hex10(color2[1], color2[2]);
    g2 = hex10(color2[3], color2[4]);
    b2 = hex10(color2[5], color2[6]);
    
    d = (r1 - r2) * (r1 - r2) + (g1 - g2) * (g1 - g2) + (b1 - b2) * (b1 - b2);
    
    return (d);
}

int main(void)
{
    char color[8];
    int r, g, b;
    int i;
    int d;
    int min;
    
    while (1){
        scanf("%s", color);
        if (color[0] == '0'){
            break;
        }

        min = 0;
        for (i = 1; i <= 7; i++){
            if (distance(color, color_code[i]) < distance(color, color_code[min])){
                min = i;
            }
        }
        printf("%s\n", color_name[min]);
    }
    
    return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	ll x,a,b; cin>>x>>a>>b;
	ll c=b-a;
	if(0>=c) cout<<"delicious";
	else if(x>=c) cout<<"safe";
	else cout<<"dangerous";
	
	return 0;
}

Measured memory_bytes: 256
{-
ITP1_4-D
Discussion Solution Statistics Submit
 
Computation - Min, Max and Sum
Time Limit : 1 sec, Memory Limit : 65536 KB
????°????????????§??????????¨????

n
????????´??° ai(i=1,2,...n)

?????\?????????????????????????°????????????§??????????¨????????±???????????????°????????????????????????????????????
Input

??????????????´??°?????° n
???????????????????????????????????? n ????????´??° ai

????????????????????§?????????????????????
Output

????°????????????§??????????¨????????????????????????§????????????????????????????????????
Constraints

    0<n???10000

???1000000???ai???1000000

Sample Input

5
10 1 5 4 17

Sample Output

1 17 37
-}
import Data.List.Split
main = do
  s <- getLine
  t <- getLine
  putStrLn $ aux s t

aux :: String -> String -> String
aux s t = (show xmin) ++ " " ++ (show xmax) ++ " " ++ (show xsum)
  where
     xminLimit = -1000001 :: Int
     xmaxLimit =  1000001 :: Int
     n = read s :: Int
     f = map (\x->read x :: Int) $ splitOn " " t
     xmax = foldr (\x acc -> max x acc) xminLimit f
     xmin = foldr (\x acc -> min x acc) xmaxLimit f
     xsum = sum f :: Int

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

using namespace std;

typedef long long int ll;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    ll a[n],b[n];

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

    reverse(b,b+n);
    int p=0,q=n-1;

    for(int i=0 ; i<n ; i++)
    {
        if(a[i] == b[i] && p<q)
        {
            if(b[p]!=a[i] && b[i]!=a[p])
            {
                swap(b[p],b[i]);
                p++;
            }
            else if(b[q]!=a[i] && b[i]!=a[q])
            {
                 swap(b[q],b[i]);
                 q--;
            }
        }
    }
    bool f=0;
    for(int i=0 ;i<n ; i++)
    {
        if(a[i] == b[i])
        {
            f=1;
            break;
        }
    }
    if(f)
        cout << "No\n";
    else
    {
        cout << "Yes\n";
        for(int i=0 ; i<n ; i++)
            cout << b[i] << " ";
        cout << "\n";
    }


    return 0;
}


Measured memory_bytes: 6780
x, y, z, k = map(int, input().split())
alist = list(map(int, input().split()))
blist = list(map(int, input().split()))
clist = list(map(int, input().split()))

bclist=[]

for i in range(y):
    now=blist[i]
    for j in range(z):
        bclist.append(now+clist[j])

bclist=sorted(bclist)
bclist2=bclist[-k:]
#print(bclist2)

ng=len(bclist2)
abclist=[]

for i in range(ng):
    now=bclist2[i]
    for j in range(x):
        abclist.append(now+alist[j])

abclist=sorted(abclist)
for i in range(k):
    print(abclist[-1-i])

Measured memory_bytes: 148224
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<cstdlib> 
#include<string>
#include<math.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<set>
#include<stack>
#include<queue>
using namespace std;


/*int main(){

	int w,h;
	cin>>w>>h;
	int p[100000],q[100000];

	for(int i=0;i<w-1;i++)cin >>p[i];
	for(int i=0;i<h-1;i++)cin >>q[i];

	

	
	while(1);

	return 0;
}*/

int main(){

	unsigned long n,a[100000];
	cin >>n;
	for(int i=0;i<n;i++)cin >> a[i];

	unsigned long t=1,ans=0;
	for(int i=0;i<n;i++){
		if(a[i]>t){
			ans+=(a[i]-1)/t;
		}else if(a[i]==t){
			t=t+1;
		}
		if(i==0)t=2;
	}
	cout << ans << endl;

	//while(1);

}

/*int main(){
	int n,q,k[100000];
	string s[100000],p[100000];

	cin >> n;
	for(int i=0;i<n;i++)cin >> s[i];
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> k[i];
		cin >> p[i];
	}



}*/

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

#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define per(i,n) for (int i=(int)(n)-1;i>=0;i--)
#define For(i,n) for (int i=1;i<=(int)(n);i++)
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(x) (x).begin(),(x).end()
#define Max(a,b,c) max(a,max(b,c))
#define Min(a,b,c) min(a,min(b,c))
#define pii pair<int,int>
#define vi vector <int>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define pb push_back
#define re return
#define se second
#define fi first
const int INF=0x7fffffff;
const int MAXN=1e5+3;

int n,w,a,v;
ll f[MAXN],ans;

int main(){
	fill(f,f+MAXN,((ll)INF)*100);
	cin>>n>>w;
	f[0]=0;
	For(i,n){
		cin>>a>>v;
		for (int j=100000;j>0;j--){
			if (j>=v){
				f[j]=min(f[j],f[j-v]+a);
			}
		}
	}
	For(i,100000){
		if (f[i]<=w) ans=i;
	}
	cout<<ans<<endl;
	re 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

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

  int a,b,c;
  cin >> a >> b >> c;
  
  if(a <= c && b >= c) cout << "Yes" << endl;
  else                 cout << "No"  << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll n; cin>>n;
    vector<ll> a(n),b(n),c(10001);
    rep(i,n) cin>>a[i];
    rep(i,n) c[a[i]]++;
    rep(i,10000) c[i+1]+=c[i];
    for(ll i=n-1; i>=0; i--){
        b[c[a[i]]-1]=a[i];
        c[a[i]]--;
    }
    rep(i,n){
        if(i==0) cout<<b[i];
        else cout<<' '<<b[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 34172
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	if (n == 1)
	{
		puts("Hello World");
	}
	else
	{
		int a, b;
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define useCin
#define useCout
using namespace std;
#ifdef useCin
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
#endif
#ifdef useCout
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
#endif
#define rep(n) for(int i=0;i<(int)(n);i++)
#define rep_(n) for(int i=0;i<(int)(n-1);i++)
typedef long long lint;
#define SZ(x) ((int)(x).size())
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define MEMSET(v,h) memset((v),h,sizeof(h)
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
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(b<a){a=b;return 1;}return 0;}
const int MOD = 1000000007;
#define endl "\n"
int getInt(){int i;scanf("%d",&i);return i;}
void getInt(int* i){scanf("%d",i);}
double getDouble(){double d;scanf("%lf",&d);return d;}
void getDouble(double* d){scanf("%lf",d);}
char getChar(){char c;scanf("%c ",&c);return c;}
void getChar(char* c){scanf("%c ",c);}
string getStr(){string s;cin>>s;return s;}
void getStr(string* s){cin>>*s;}
int vector_finder(vector<string> vec,string val){auto itr=find(vec.begin(),vec.end(),val);size_t index=distance(vec.begin(),itr);if(index==vec.size()){return -1;}else{return index;}}

int main(void) {
	int n;
	lint ans = 0;
	getInt(&n);
	map<string, lint> m;
	rep(n) {
        string str = getStr();
        sort(str.begin(), str.end());
	    m[str]++;
        if(m[str] > 1) ans += (lint)m[str] - 1;
	}
    cout << ans;
	return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>

#define SQ(X) \
  ((X)*(X))
#define MIN(D,S) \
  (D) = ( (S) < (D) ? (S) : (D) )

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  for ( ; ; )
  {
    int x, y, z, R, n;

    scanf ( "%d%d%d", &x, &y, &z );
    if ( x == 0 && y == 0 && z == 0 ) break;

    R = SQ(x) + SQ(y);
    MIN( R, SQ(y) + SQ(z) );
    MIN( R, SQ(z) + SQ(x) );

    scanf ( "%d", &n );
    while ( n-- )
    {
      int r;

      scanf ( "%d", &r );
      puts ( SQ(r * 2) > R ? "OK" : "NA" );
    }
  }

  return ( 0 );
}

Measured memory_bytes: 0
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int vals[3] = {0};
    for(int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        if(temp%4==0){
            vals[0]++;
        }else if(temp%4==2){
            vals[1]++;
        }else{
            vals[2]++;
        }
    }
    int len = vals[1];
    if(len==0){
        if(vals[0]>=vals[2]-1){
            cout << "Yes" << "\n";
        }else{
            cout << "No" << "\n";
        }
    }else{
        if(vals[0]>=vals[2]){
            cout << "Yes" << "\n";
        }else{
            cout << "No" << "\n";
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define SORT(x) sort((x).begin(),(x).end())
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

void Solve(){
	const int mod=1000000007;
	int n,t,d[100000];
	cin >> n >> t;
	REP(i,0,n) cin >> d[i];
	sort(d,d+n);

	ll ans=1;
	REP(i,1,n) ans=ans*((d+i-lower_bound(d,d+i,d[i]-t))+1)%mod;
	cout << ans << endl;
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}

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

int main() {
    long k;

    cin >> k;

    if(k % 2 == 0 || k % 5 == 0) {
        cout << -1 << endl;
    } else {
        long l, r;
        int i;

        if(k % 7 == 0) {
            l = 9 * k / 7;
        } else {
            l = 9 * k;
        }
        r = 10 % l;

        for(i = 0; r != 1; i++) {
            r = (10 * r) % l;
        }
        
        cout << i + 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3596
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto S = readln.chomp;
    auto rs = S.dup;
    rs.reverse();
    if (S != rs) {
        writeln("No");
        return;
    }
    auto N = S.length;
    auto s = S[0..(N-1)/2];
    rs = s.dup;
    rs.reverse();
    if (s != rs) {
        writeln("No");
        return;
    }
    s = S[(N+3)/2-1..$];
    rs = s.dup;
    rs.reverse();
    if (s != rs) {
        writeln("No");
        return;
    }

    writeln("Yes");
}

Measured memory_bytes: 256
/**
 *      purpose : AGC 13 A
 *      author  : kyomukyomupurin
 *      created : 2018-12-11 16:49:33
**/

#pragma GCC optimize ("Ofast")
#include <iostream>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(x) cout << (x) << '\n'

inline void fastin(int &num) {
    bool neg = false;
    int c;
    num = 0;
    c = getchar();
    if (c == '-') {
        neg = true;
        c = getchar();
    }
    for (; (c > 47 && c < 58); c = getchar()) num = num * 10 + c - 48;
    if (neg) num *= -1;
}

int main(){
    
    int n; fastin(n);
    int a[n];
    rep(i, n) fastin(a[i]);

    char c = 'E';  // state Up, Down, Equal
    int cnt = 1;

    for (int i = 1; i < n; ++i){
        if (a[i] > a[i - 1]){
            if (c == 'U'){
                continue;
            }
            else if (c == 'E'){
                c = 'U';
            }
            else if (c == 'D'){
                ++cnt; c = 'E';
            }
        }
        else if (a[i] == a[i - 1]){
            continue;
        }
        else if (a[i] < a[i - 1]){
            if (c == 'U'){
                ++cnt; c = 'E';
            }
            else if (c == 'E'){
                c = 'D';
            }
            else if (c == 'D'){
                continue;
            }
        }
    }
    print(cnt);
    
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main(int argc, char const *argv[]) {

  int a,b;
  int x,r,tmp;

  scanf("%d%d",&a,&b);

  x = a * b;

  if( a < b ){
    tmp = a;
    a = b;
    b = tmp;
  }

  r = a % b;
  while( r != 0 ){
    a = b;
    b = r;
    r = a % b;
  }

  printf("%d\n",b);

  return 0;
}

Measured memory_bytes: 592
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

import numpy as np

N,K = map(int,input().split())
A = [int(x) for x in input().split()]

L = 1 << N
right = np.zeros(L,dtype=np.int64)
total = np.zeros(L,dtype=np.int64)

for i, v in enumerate(A):
    bit = 1 << i
    # print(bit)
    right[bit:2*bit] = np.maximum(right[:bit]+1,v)
    np.maximum(right[:bit], v, out=right[:bit])
    total[bit:2*bit] = (right[bit:2*bit] - v) + total[:bit]
    # print(right)
    # print(total)

# print(total)

popcount = np.zeros(L,dtype=np.int32)
rng = np.arange(L)

for _ in range(15):
    popcount += rng&1
    rng >>= 1

# print(popcount)

answer = total[popcount >= K].min()
print(answer)

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

int main() {
    long long int n1, n2;
    cin >> n1 >> n2;
    
    long long int gcd = 1;
    
    for(int i = 1; i <= n1 && i <= n2; i++) {
        if(n1 % i == 0 && n2 % i == 0) gcd = i;
    }
    
    long long int lcm = (n1 * n2) / gcd;
    cout << lcm << endl;
}

Measured memory_bytes: 256