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

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;

    int sz=s.size();
    for(int i=0;i<sz;i++)
    {
        if((s[i]+n) > 'Z')
            {
            int x=s[i]+n;
            x=x-90;
            s[i]='A'+x-1;
            }
        else
        {
           s[i]=s[i]+n;
        }
    }

     for(int i=0;i<sz;i++)
    {
        cout<<s[i];
    }



    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define pii pair <int, int>
#define all(vv) (vv).begin(), (vv).end()
#define rep(ii, jj, ll, ss) for(int ii = jj; ii < ll; ii += ss)
#define time cerr << '\n' << (double)clock()/CLOCKS_PER_SEC << '\n'; return 0;
#define get(vv, times) for(int ii = 0; ii < times; ++ii) {int jj; cin >> jj; (vv).pb(jj);}

int n, m, ans;
priority_queue <int> pq;

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	ans = 0;
	cin >> n >> m;
	rep(i, 0, n, 1) {
		int x; cin >> x;
		pq.push(x);
	}
	rep(i, 0, m, 1) {
		int mx = pq.top();
		// apply discount be like
		pq.pop();
		pq.push(mx/2);
	}
	rep(i, 0, n, 1) {
		ans += pq.top();
		pq.pop();
	}
	cout << ans;
}

Measured memory_bytes: 4212
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<vector<ll> > a(n,vector<ll>(n));
	REP(i,n) {
		REP(j,n) cin>>a[i][j];
	}
	bool d=false;
	vector<vector<ll> > e(n,vector<ll>(n,0));
	REP(i,n) {
		FOR(j,i+1,n) {
			priority_queue<P,vector<P>,greater<P> > q;
			REP(k,n) {
				if(k==i||k==j) continue;
				if(a[i][j]>a[i][k]+a[k][j]) {
					d=true;
					break;
				}
				if(a[i][j]==a[i][k]+a[k][j]) {
					q.push(P(a[i][k],k));
				}
			}
			ll bf=0,bp=i;
			if(q.size()==0) {
				e[i][j]=a[i][j];
			}
			while(!q.empty()) {
				P p=q.top();
				q.pop();
				if(e[bp][p.second]!=0&&e[bp][p.second]!=p.first-bf) {
					d=true;
					break;
				}
				e[bp][p.second]=p.first-bf;
				bf=p.first;
				bp=p.second;
			}
		}
	}
	if(d) {
		cout<<-1<<endl;
		return 0;
	}
	else {
		ll res=0;
		REP(i,n) {
			FOR(j,i+1,n) res+=e[i][j];
		}
		cout<<res<<endl;
	}
}


Measured memory_bytes: 1664
open Hashtbl
let n = read_int ()
let ss = Array.init n @@ fun _ -> read_line ()
let h, cs, ans = create 5, Array.make 5 0, ref 0
let _ = List.iteri (fun i c -> add h c i) ['M'; 'A'; 'R'; 'C'; 'H']; Array.iter (fun s -> try let i = find h s.[0] in cs.(i) <- cs.(i) + 1 with _ -> ()) ss;
  for i = 0 to 4 do for j = i + 1 to 4 do for k = j + 1 to 4 do ans := !ans + cs.(i) * cs.(j) * cs.(k) done done done; Printf.printf "%d\n" !ans

Measured memory_bytes: 6016
import copy
N = int(input())
A = list(map(int, input().split()))
B = []
for _ in range(N):
    cand = []
    for i, a in enumerate(A):
        if a == i + 1:
            cand.append(i)
    if len(cand) > 0:
        ind = cand[-1]
        B.append(A[ind])
        del(A[ind])
    else:
        print(-1)
        exit()
if len(B) < N:
    print(-1)
else:
    B.reverse()
    for b in B:
        print(b)

Measured memory_bytes: 40240
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import defaultdict, deque
    n, m = map(int, readline().split())
    edge = defaultdict(list)
    for _ in range(m):
        a, b = map(int, readline().split())
        edge[a].append(b)
        edge[b].append(a)

    q = int(readline())
    mat = [[] for _ in range(q)]

    for i in range(q):
        mat[i] = list(map(int, readline().split()))

    dp = [[0] * 11 for _ in range(n + 1)]

    for v, d, c in mat[::-1]:
        if dp[v][d] != 0:
            continue
        que = deque()
        que.append((v, d, c))
        while que:
            cur, dist, color = que.popleft()
            for i in range(dist, -1, -1):
                if dp[cur][i] == 0:
                    dp[cur][i] = color
                else:
                    break
            if dist > 0:
                for nx in edge[cur]:
                    if dp[nx][dist - 1] != 0:
                        continue
                    else:
                        que.append((nx, dist - 1, color))

    for i in range(1, n + 1):
        print(dp[i][0])


if __name__ == '__main__':
    main()


Measured memory_bytes: 155696
from sys import stdin

N = int(stdin.readline().rstrip())

text = [chr(i) for i in range(97, 97+26)]
result = [] 

count=1
while True:
    if N > pow(26,count):
        N -= pow(26,count)
        count +=1
    else:
        break

N-=1
while True:
    if N!=0:
        result.append(text[N%26])
        N=N//26
    elif count!=len(result):
        result.append(text[0])
    else:
        break

print(''.join(result[::-1]))

Measured memory_bytes: 9204
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
#define rep(i,n) for(int i=0; i<n; i++)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてから使う
#define INF 2147483647
#define LLINF 9223372036854775807LL

int main(){
  int n; cin >> n;
  vector<int> L(n);
  rep(i,n) cin >> L[i];
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i=0; i<n-2; i++){
    for (int j=i+1; j<n-1; j++){
      for (int k=j+1; k<n; k++){
        if (L[k] < L[i] + L[j]) ans++;
      }
    }
  }
  cout << ans << endl;
}

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



int main()
{
    string S, T;
    cin >> S >> T;
    int count = 0;
    rep(i, 3)
    {
        if(S[i] == T[i])
            count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include<cmath>
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// --------------------------------------------------------------------------


int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B(N);
  ll sum_A=0,sum_B=0;
  for(int i=0; i<N; i++){
    cin >> A[i];
    sum_A += A[i];
  }
  for(int i=0; i<N; i++){
    cin >> B[i];
    sum_B += B[i];
  }
  if(sum_A > sum_B){
    cout << "No\n";
    return 0;
  }
  ll cnt = sum_B - sum_A;
  ll cnt_B=0,cnt_A=0;
  for(int i=0; i<N; i++){
    if(A[i]%2 != B[i]%2){
      cnt_B++;
      B[i]++;
    }
    if(A[i] > B[i]){
      cnt_B += A[i] - B[i];
      B[i] = A[i];
    }
    if(A[i] < B[i]){
      cnt_A += (B[i] - A[i])/2;
      A[i] = B[i];
    }
  }
  if(cnt_A <= cnt && cnt_B <= cnt){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }
  return 0;
}


Measured memory_bytes: 3756
#include<stdio.h>

#define H 500000

int n;

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}


void maxHeapify(int *A,int i){
  int l,r,largest,temp;

  l=left(i);
  r=right(i);

  if(l<=n && A[l]>A[i]) largest=l;
  else largest=i;

  if(r<=n && A[r]>A[largest]) largest=r;

  if(largest!=i){
    temp=A[i];
    A[i]=A[largest];
    A[largest]=temp;

    maxHeapify(A,largest);
  }

  return;
}

void buildMaxHeap(int *A){
  int i;

  for(i=n/2;i>0;i--){
    maxHeapify(A,i);
  }

  return;
}

int main(){
  int i,A[H];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&A[i+1]);
  }

  buildMaxHeap(A);

  for(i=0;i<n;i++){
    printf(" %d",A[i+1]);
  }

  printf("\n");

  return 0;
}		      
  
			



Measured memory_bytes: 3664
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int numOfFacts = scanner.nextInt();

        long LowerestRank = 0;
        long scores = 0;
        while(numOfFacts > 0) {
            long rank = scanner.nextInt();
            long score = scanner.nextInt();
            if (rank > LowerestRank) {
                LowerestRank = rank;
                scores = score;
            }
            numOfFacts--;
        }

        System.out.println(LowerestRank + scores);

    }
}

Measured memory_bytes: 63172
N = int(input())
B = list(map(int, input().split()))

SUM = 0
A = [0]*N

for i in range(N-1):
    if i == 0:
        A[i] = B[i]

        if len(B) <= 1:
            A[i + 1] = B[i]
        else:
            if B[i] > B[i+1]:
                A[i+1] = B[i+1]
            else:
                A[i+1] = B[i]
        continue

    if i < N-2:
        if B[i] > B[i+1]:
            A[i+1] = B[i+1]
        else:
            A[i+1] = B[i]
    else:
        A[i+1] = B[i]

print(sum(A))







Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, C;
	cin >> N >> C;
	vector<vector<pair<int, int>>> list(C);
	for (auto i = 0; i < N; ++i)
	{
		int s, t, c;
		cin >> s >> t >> c;
		--c;
		list[c].push_back({ s, t });
	}

	vector<int> sum(2 * (int)1e5 + 1);
	for (auto i = 0; i < C; ++i)
	{
		sort(list[i].begin(), list[i].end());
		for (auto j = 0; j < (int)list[i].size(); ++j)
		{
			auto right = j;
			auto s = list[i][j].first;
			auto t = list[i][j].second;
			for (auto k = j + 1; k < (int)list[i].size(); ++k)
			{
				auto tempS = list[i][k].first;
				if (tempS == t)
				{
					t = list[i][k].second;
					j = k;
				}
				else
				{
					break;
				}
			}

			++sum[2 * s - 1];
			--sum[2 * t];
		}
	}

	auto ans = 0;
	for (auto i = 0; i < (int)sum.size() - 1; ++i)
	{
		sum[i + 1] += sum[i];
		ans = max(ans, sum[i + 1]);
	}
	cout << ans << endl;

	return 0;
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static readonly int INFTY = int.MaxValue;

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[,] table = new int[n, n];

            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int u = int.Parse(input[0]);
                int k = int.Parse(input[1]);

                for (int j = 0; j < k; j++)
                {
                    int v = int.Parse(input[2 + j * 2]);
                    int c = int.Parse(input[3 + j * 2]);

                    table[u, v] = c;
                }
            }

            Dijkstra(table, n);
        }

        static void Dijkstra(int[,] table, int n)
        {
            int i, minCost;
            int[] minCostArr = Enumerable.Repeat(INFTY, n).ToArray();
            bool[] isVisit = new bool[n];

            minCostArr[0] = 0;

            while (true)
            {
                minCost = INFTY;
                int u = -1;

                for (i = 0; i < n; i++)
                {
                    if (!isVisit[i] && minCost > minCostArr[i])
                    {
                        u = i;
                        minCost = minCostArr[i];
                    }
                }

                if (u == -1) break;

                isVisit[u] = true;

                for (i = 0; i < n; i++)
                {
                    int w = table[u, i];

                    if (w > 0)
                    {
                        int c = minCostArr[u] + w;

                        if (c < minCostArr[i])
                        {
                            minCostArr[i] = c;
                        }
                    }
                }
            }

            StringBuilder sb = new StringBuilder();
            for (i = 0; i < n; i++)
            {
                sb.AppendLine(i + " " + minCostArr[i]);
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9552
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}


int solve(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> graph(n,vector<int>(0));
    rep(i,m){
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        graph.at(a).pb(b);
        graph.at(b).pb(a);
    }

    queue<int> q;
    vector<bool> checked(n,false);
    vector<int> depth(n,-1);
    vector<int> pre(n);
    depth[0] = 0;
    checked[0] = true;
    q.push(0);
    while(!q.empty()){
        int now = q.front(); q.pop();
        
        for(int next : graph[now]){
            if(checked[next]) continue;
            depth[next] = depth[now] + 1;
            checked[next] = true;
            pre[next] = now;
            q.push(next);
        }
    }

    cout << "Yes" << endl;
    
    for(int i = 1; i < n; ++i){
        cout << pre[i]+1 << endl;
    }

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 10560
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
const int NS = 1e5 + 100;
ll N, m, a[NS];

struct Tuple {
	ll c;
	ll n;
	Tuple(ll x, ll y) {
		c = x;
		n = y;
	}
};

void bp() {
}

int main() {
	ll sum = 0;
	std::vector<Tuple> z;
	cin >> N >> m;
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	sort(a, a + N);
	for (int i = 0; i < m; ++i) {
		ll a, b;
		cin >> a >> b;
		z.push_back(Tuple(a, b));
	}
	std::sort(z.begin(), z.end(), [](const Tuple &t1, const Tuple &t2) {
			return t1.n < t2.n;
			});
	int i = 0;
	for (; i < N; ++i) {
		Tuple t = z.back();
		if (a[i] >= t.n) { break; }
		sum += t.n;
		if (t.c == 1) {
			z.pop_back();
			if (z.size() == 0) {
				++i;
				break;
			}
			continue;
		}
		z.pop_back();
		z.push_back(Tuple(t.c - 1, t.n));
	}
	for (;i < N; ++i) {
		sum += a[i];
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    if (n == 1) {
        cout << 1 << endl;
        return 0;
    }
    ll dir = 0, ans = 1, bv = a[0];
    rep(i, n) {
        if (bv == a[i]) continue;
        if (dir == 0) {
            if (bv < a[i]) dir = 1;
            else dir = -1;
        }
        else if (dir == 1) {
            if (bv >= a[i]) {
                dir = 0;
                ans++;
            }
        }
        else {
            if (bv <= a[i]) {
                dir = 0;
                ans++;
            }
        }
        bv = a[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
works = [list(map(int, input().split())) for _ in range(N)]
works = sorted(works, key=lambda x: x[1])

ans = "Yes"
time = 0
for a, b in works:
    time += a
    if time > b:
        ans = "No"
        break
print(ans)


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

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

	int n;
	cin >> n;
	vector<int> a(n);
	for (int& i: a) cin >> i;

	int cnt = 0;
	for (int i = 1; i + 1 < n; i++) {
		vector<int> v = {a[i - 1], a[i], a[i + 1]};
		sort(all(v));
		if (a[i] == v[1]) {
			cnt++;
		}
	}

	cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {


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

		for (int i = 0; i < k; i++) {
			if (a_turn) {
				if (a % 2 == 1) {
					a--;
				}
				int given = a / 2;
				b+= given;
				a-= given;
			} else {
				if (b % 2 == 1) {
					b--;
				}
				int given = b / 2;
				a+= given;
				b-= given;
			}
			a_turn = !a_turn;
		}
		System.out.println(a + " " + b);
		reader.close();

	}

}


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

int main() {
	int m;
	while (cin >> m && m != 0) {
		int num[10];
		int sum = 0;
		for (int i = 1; i < 10; ++i) {
			cin >> num[i];
			sum += num[i];
		}
		cout << m - sum << endl;
	}
}

Measured memory_bytes: 2940
N = int(input())
ans = 0
import itertools
for i in range(1,10):
    for ptn in itertools.product('753',repeat=i):
        s = ''.join(ptn)
        if int(s) > N: continue
        if '3' not in s: continue
        if '5' not in s: continue
        if '7' not in s: continue
        ans += 1
print(ans)

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

using namespace std;

int main()
{
    long long int i,a,b;
    cin>>a>>b;
    long long x[a];
    for(i=0;i<a;i++)
    {
        cin>>x[i];
    }
    sort(x,x+i);
    if(a<b) { cout<<"0"<<endl;}
    else{
        long long int ans=0;
    for(i=0;i<a-b;i++)
    {

        ans+=x[i];
    }
    cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  long long N, K;
  cin >> N >> K;

  N = N%K;

  cout << min(N, abs(N-K)) << endl;


  return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;
static const ll MOD = (ll)1e9 + 7;
static const double EPS = 1e-9;

#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for(ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for(ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x)=((x) < 0) ? 0 : (x)

int run(istream& in, ostream& out) {
    ll N;
    in >> N;
    vector<ull> v(N);
    REP(i, N) {
        in >> v[i];
    }
    ll ans = 0;
    ll j = 0;
    ull bits = 0;
    REP(i, N) {
        if (j == i) {
            bits = v[i];
        }
        while(j < i) {
            ++j;
            bits = v[i];
        }
        while(j < N-1 && ((v[j+1] & bits) == 0)) {
            ++j;
            bits |= v[j];
        }
        ans += j - i + 1;
        bits &= ~v[i];
    }
    out << ans << endl;
    return 0;
}

int main() {
    return run(cin, cout);
}


Measured memory_bytes: 1792
S = str(input())

if (S[0]==S[1] and S[2]==S[3]) or (S[0]==S[2] and S[1]==S[3]) or (S[0]==S[3] and S[1]==S[2]):
  if S[0]==S[1] and S[1]==S[2] and S[2]==S[3]:
    print("No")
  else:
    print("Yes")
else:
  print("No")

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

int main()
{
	int n;
	cin >> n;
	vector<int> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	bool flag = true;

	for (auto &&a : as)
	{
		if (a % 2 == 0)
		{
			flag &= (a % 3 == 0) || (a % 5 == 0);
		}
	}

	cout << (flag ? "APPROVED" : "DENIED") << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 200000;
int N, K, L;

const int MAX_UF = MAX_N;

class UnionFind {
private:
  int par[MAX_UF];
  int rank[MAX_UF];
  
public:
  int find(int x);
  void init(int n);
  void unite(int x, int y);
  bool same (int x, int y);
};

void UnionFind::init(int n) {
  for (int i = 0; i < n; ++i) {
    par[i] = i;
    rank[i] = 0;
  }
}

int UnionFind::find(int x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

void UnionFind::unite(int x, int y) {
  x = find(x); y = find(y);
  if (x == y) {
    return;
  } else {
    if (rank[x] > rank[y]) {
      par[y] = x;
    } else {
      par[x] = y;
      if (rank[x] == rank[y]) ++rank[y];
    }
  }
}

bool UnionFind::same(int x, int y) {
  return find(x) == find(y);
}

int main() {
  cin >> N >> K >> L;

  UnionFind road_uinion;
  UnionFind rail_uinion;
  road_uinion.init(N);
  rail_uinion.init(N);
  for (int i = 0; i < K; ++i) {
    int p, q;
    cin >> p >> q;
    road_uinion.unite(--p, --q);
  }
  for (int i = 0; i < L; ++i) {
    int r, s;
    cin >> r >> s;
    rail_uinion.unite(--r,--s);
  }

  map<pii, int> group;
  for (int i = 0; i < N; ++i) {
    ++group[pii(road_uinion.find(i), rail_uinion.find(i))];
  }


  for (int i = 0; i < N; ++i) {
    cout << group[pii(road_uinion.find(i), rail_uinion.find(i))] << endl;
  }

}


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

using namespace std;

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

int main(){
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > p;
  REP(i, n){
    int a, b;
    cin >> a >> b;
    p.push_back(make_pair(a, b));
  }
  sort(p.begin(), p.end());
  priority_queue<int> q;
  int r = 0;
  int ix = 0;
  REP(d, m){
    while(ix < p.size()){
      if(p[ix].first == d + 1){
        q.push(p[ix].second);
        ++ix;
      }else{
        break;
      }
    }
    if(!q.empty()){
      r += q.top();
      q.pop();
    }
  }
  cout << r << endl;
  return 0;
}

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

int main(){
  int n,alice=0,bob=0;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  for(int i=0;i<n;i++){
    if(i%2 == 0){
      alice += a.at(i);
    }else{
      bob += a.at(i);
    }
  }
  cout<<alice - bob<<endl;
}

Measured memory_bytes: 256
H, W, K, *S = open(0).read().split()
H, W = int(H), int(W)

A = []
c = 0
for i, s in enumerate(S):
    T = []
    r = s.find("#")
    l = -1
    while r != -1:
        c += 1
        T += [c] * (r - l)
        l, r = r, s.find("#", r + 1)
    T += [c] * ((W - l - 1) % W)
    A.append(T)

for i in reversed(range(H - 1)):
    if not A[i]:
        A[i] = A[i + 1]

for i in range(1, H):
    if not A[i]:
        A[i] = A[i - 1]

for a in A:
    print(*a)

Measured memory_bytes: 7576
// ALDS1_12_A: Depth First Search
#include <iostream>
#include <vector>
#include <algorithm>
bool debug = false;

std::vector<std::pair<int,int>> runtime_memo;
std::vector<int> vertex_stat;
std::vector<std::vector<int>> adjacency_list;
int runtime = 0;

void init() {
    int total; std::cin >> total;
    /* Resize containers */
    runtime_memo.resize(total);
    vertex_stat.resize(total);
    adjacency_list.resize(total);
    for (int i=0;i<adjacency_list.size(); i++) {
        adjacency_list.at(i).resize(total);
    }
    for (int i=0; i<adjacency_list.size(); i++) {
        for (int j=0; j<adjacency_list.at(i).size(); j++) {
            adjacency_list.at(i).at(j) = 0;
        }
    }

    /* Set adjacency_list */
    int vertex, outdegree;
    for (int i=0; i<adjacency_list.size(); i++) {
        std::cin >> vertex >> outdegree;
        for (int j=0; j<outdegree; j++) {
            int tmp; std::cin >> tmp;
            adjacency_list.at(vertex-1).at(tmp-1) = 1;
        }
    }
}

void DepthFirstSearch(int vertex) {
    int tmp_vertex = vertex -1;
    vertex_stat.at(tmp_vertex) = 1;
    runtime++;
    runtime_memo.at(tmp_vertex).first = runtime;
    for (int i=0; i<adjacency_list.at(tmp_vertex).size(); i++) {
        if (adjacency_list.at(tmp_vertex).at(i) == 1) {
            if (vertex_stat.at(i) == 0) {
                if (debug) std::cout << "DepthFirstSearch(" << i+1 << ")" << "\n";
                DepthFirstSearch(i+1);
            }
        }
    }
    vertex_stat.at(tmp_vertex) = 2;
    runtime++;
    runtime_memo.at(tmp_vertex).second = runtime;
}

int main() {
    /* Initialization */
    init();
    /* Depth first search */
    for (int i=0; i<vertex_stat.size(); i++) {
        int id = i+1;
        if (vertex_stat.at(i) == 0) {
            DepthFirstSearch(id);
        }
    }
    /* Output */
    for (int i=0; i<adjacency_list.size(); i++) {
        int id = i+1;
        std::cout << id << " ";
        std::cout << runtime_memo.at(i).first << " ";
        std::cout << runtime_memo.at(i).second << "\n";
    }
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
const int inf = 1e9;

int dx[9]={1, 1, 1, 1, 1, 2, 2, 2, 3};
int dy[9]={2, 1, 0,-1,-2, 1, 0,-1, 0};

struct info{
	int y,x,lr,cost;
	info(int y, int x, int lr, int c):y(y),x(x),lr(lr),cost(c){}
};

namespace std{
	bool operator < (const info& a, const info& b){
		return b.cost < a.cost;
	}
}

int main(){
	while(1){
		int w,h;
		cin >> w >> h;
		if(w==0) break;
		
		vector<vector<char> > map(h+2, vector<char>(w));
		for(int i=0; i<h; i++){
			for(int j=0; j<w; j++){
				cin >> map[i][j];
			}
		}
		
		vector<vector<vector<vector<info> > > > adj(2,
			vector<vector<vector<info> > >(h, vector<vector<info> >(w)));
		for(int f=0; f<2; f++){
			for(int i=0; i<h; i++){
				for(int j=0; j<w; j++){
					if(map[i][j]=='X') continue;
					for(int d=0; d<9; d++){
						int dir = (f==0)? 1: -1;
						int ny = i+dy[d];
						int nx = j+dir*dx[d];
						if(0<=ny && ny<h && 0<=nx && nx<w){
							if(map[ny][nx]=='X') continue;
							int cost=0;
							if('0'<=map[ny][nx] && map[ny][nx]<='9'){
								cost = map[ny][nx]-'0';
							}
							adj[f][i][j].push_back(info(ny, nx, 1-f, cost));
						}
					}
				}
			}
		}
		
		priority_queue<info> wait;
		vector<vector<vector<int> > > mincost(2, vector<vector<int> >(h, vector<int>(w, inf)));
		for(int i=0; i<w; i++){
			if(map[h-1][i]=='S'){
				for(int f=0; f<2; f++){
					wait.push(info(h-1, i, f, 0));
					mincost[f][h-1][i] = 0;
				}
			}
		}
		
		while(!wait.empty()){
			int y = wait.top().y;
			int x = wait.top().x;
			int f = wait.top().lr;
			int cost = wait.top().cost;
			wait.pop();
			if(cost > mincost[f][y][x]) continue;
			if(map[y][x] == 'T') break;
			for(int i=0; i<(int)adj[f][y][x].size(); i++){
				info next = adj[f][y][x][i];
				if(cost +next.cost < mincost[next.lr][next.y][next.x]){
					mincost[next.lr][next.y][next.x] = cost+next.cost;
					next.cost += cost;
					wait.push(next);
				}
			}
		}
		
		int ans = inf;
		for(int i=0; i<w; i++){
			if(map[0][i]=='T'){
				ans = min(ans, min(mincost[0][0][i], mincost[1][0][i]));
			}
		}
		if(ans==inf){
			cout << -1 << endl;
		}else{
			cout << ans << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
bool check(char c)
{
	return c=='A'||c=='C'||c=='G'||c=='T';
}
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int fi=-1,se=-1;
	int ans=0;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(!check(s[i]))
		se=fi=i;
		else{
			fi=i;
			ans=max(ans,fi-se);
		}
	}
	cout<<ans<<endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int count = 0;
    bool flag = 0;
    for (int i = 1; i < n; i++){
        for (int j = 1; j < n; j++){
            if(i * j < n){
                count ++;
            }else break;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3592
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m = map(int, readline().split())
M = map(int, read().split())
edges = zip(M, M)

edges_from = [[] for _ in range(n)]
edges_to = [[] for _ in range(n)]

for _from, to in edges:
    edges_from[_from-1].append(to-1)

E_dist_to_goal = [0] * n
P_of_reaching = [0] * n
P_of_reaching[0] = 1

for v in range(n-2, -1, -1):
    routes = edges_from[v]
    for next_v in routes:
        E_dist_to_goal[v] += E_dist_to_goal[next_v] + 1
    E_dist_to_goal[v] /= len(routes)

for v in range(n-1):
    P_now = P_of_reaching[v]
    routes = edges_from[v]
    P_next = P_now / len(routes)
    for next_v in routes:
        P_of_reaching[next_v] += P_next

initial_ans = E_dist_to_goal[0]
cut = 0
for v in range(n-2):
    routes = edges_from[v]
    num_of_routes = len(routes)
    if num_of_routes == 1:
        continue
    not_cut_dist = E_dist_to_goal[v]
    longest_dist = max([E_dist_to_goal[next_v]+1 for next_v in routes])
    after_cut_dist = (not_cut_dist - longest_dist/num_of_routes) * num_of_routes / (num_of_routes-1)
    delta = (not_cut_dist - after_cut_dist) * P_of_reaching[v]
    cut = max(cut, delta)

ans = initial_ans - cut
print(ans)


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

using ll = long long;
#define REP(i, n) for(int (i)=0; (i)< (n); ++i)
#define REPR(i, n) for(int (i)=(n); (i)>=0; --i)
#define FOR(i, n, m) for(int (i)=(n); (i)<(m); ++i)
constexpr int INF = 1e9;
//constexpr ll INF = 1LL << 62;
constexpr int mod = 1e9+7;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  vector<vector<ll>> sum(3, vector<ll>(N+1, 0));
  REP(i, N){
    if(S[i] == 'R') sum[0][i+1]++;
    if(S[i] == 'G') sum[1][i+1]++;
    if(S[i] == 'B') sum[2][i+1]++;
  }
  REP(i, 3){
    REP(j, N){
      sum[i][j+1] += sum[i][j];
    }
  }
  ll ans = 0;
  FOR(i, 1, N-1){
    int id;
    if(S[i] =='R') id = 0;
    if(S[i] =='G') id = 1;
    if(S[i] =='B') id = 2;
    REP(l, 3){
      REP(r, 3){
        if(l==r || r== id || l == id) continue;
        ans += sum[l][i] * (sum[r][N] - sum[r][i+1]);
      }
    }
    //cerr << "roop:" << i << " ans:" << ans << endl;
    FOR(w, 1, N){
      if(i-w< 0 || i+w >= N) break;
      if(!(S[i] == S[i-w] || S[i] == S[i+w]|| S[i-w]==S[i+w])){
        ans--;
      }
    }
    //cerr << "roop:" << i << " ans:" << ans << endl;
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	int d;
	long sum;
	int n;

	while(cin >> d){
		sum = 0;
		n = 600 / d;

		for(int i=1;i<n;i++){
			sum += d * d*d*i*i;
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


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

    vector<ll>x(N);
    ll ans;
    rep(i,N){
        ll d;
        cin>>d;
        x[i]=abs(d-X);
    }
    ans=x[0];
    rep2(i,N-1){
        ans = gcd(ans,x[i]);
    }
    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 4060
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}



int main(){
  string s;cin>>s;
  for(int i = 0; s.size() > i; i++){
    if((i%2 && s[i] == 'R') || (!(i%2) && s[i] == 'L')){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  
}


Measured memory_bytes: 256
#include<iostream>
#include <map>
#include <cstring>
using namespace std;
int main(void){
//	freopen("f.txt","r",stdin);
	long long n,m;
	cin>>n>>m;
	if (n>=m/2) cout<<m/2<<endl;
	else {
		m=m-n;
		m=m-n;
		m=m/4;
		long long x;
		x=m+n;
		cout<<x<<endl;
	}
}

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

using namespace std;

const vector<int> dx = {1, 0}, dy = {0, 1};

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }
  vector<vector<int>> G(H, vector<int>(W, 1 << 28));
  queue<pair<int, pair<int, int>>> que;
  if (S[0][0] == '#') {
    G[0][0] = 1;
  } else {
    G[0][0] = 0;
  }
  que.push(make_pair(G[0][0], make_pair(0, 0)));
  while (!que.empty()) {
    auto q = que.front();
    que.pop();

    int c = q.first;
    int y = q.second.first, x = q.second.second;

    for (int i = 0; i < 2; i++) {
      int ny = y + dy[i], nx = x + dx[i];
      if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
      int nc = c + (S[y][x] == '.' && S[ny][nx] == '#' ? 1 : 0);
      if (chmin(G[ny][nx], nc)) {
        que.push(make_pair(nc, make_pair(ny, nx)));
      }
    }
  }
  cout << G[H - 1][W - 1] << '\n';
  return 0;
}


Measured memory_bytes: 384
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	ll N,K;
	cin >> N>>K;
	
	// 解法
	// a%b>=K, a<=N,b<=N
	ll ans = 0;
	for (ll b = K+1; b <= N; ++b){
		ans += (N/b)*(b-K);
		ll hasuu = N%b;
		if (K!=0){
			ans += max((ll)0, hasuu-K+1);
		}else{
			ans += max((ll)0, hasuu-K);
		}
		
		// printf("b %lld, N/b %lld, ans %lld\n", b, N/b, ans);
	}
	//出力
	cout << ans << endl;
}


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

int main()
{
int N;
int A;
int B;

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

	cin >> N;
	
	if( N == 1 )
	{
	cout << "Hello World"<< endl;

	return 0;
	}

	cin >> A;
	cin >> B;

	
	cout << A+B<< endl;

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include <algorithm>
#include <functional>
#include<iostream>
#include <string>
using namespace std;
typedef long long ll;
#define pb pushback
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,j,n) for(int i=j;i<n;i++)
#define ifr(i,n) for(int i=n-1;i>=0;i--)


int main() {
    int n,x,y;
	cin >> n>>x>>y;
    int ans[n];
  	int k;
  	fr(i,n){
      ans[i]=0;
    }
    fro(i,1,n){
      fro(j,i+1,n+1){
        ans[min(j-i,abs(j-y)+1+abs(x-i))]++;
      }
    }
    fro(i,1,n){
      cout << ans[i] << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define rep( i, s, t ) for( register int i = s; i <= t; ++ i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 1e6 + 5 ; 
int n, k, a[N] ; 
signed main()
{
	n = gi(), k = gi() ; 
	rep( i, 1, n ) a[i] = gi() ; 
	int ans = ceil( 1.0 * ( n - k ) / ( k - 1 ) ) ;
	cout << ans + 1 << endl ;
	return 0 ;
}

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

// 小数点以下桁数
// fixed << setprecision(i)

int64_t gcd(int64_t a,int64_t b){return (a%b==0?b:gcd(b, a%b));}
int64_t lcm(int a,int b){return (int64_t)a*b/gcd(a, b);}
int factorial(int a){int b=1;while(a){b*=a--;}return b;} //13以下対応
bool is_prime(int a){if(a<=1)return false;for(int i=2;(int64_t)i*i<=a;i++){if(a%i==0)return false;}return true;}
int get_adp(double x, int n){return (int)round((x-(int)x)*pow(10,n))%10;} // 小数点以下の指定桁の値を取得
int64_t sigma(int64_t s, int64_t n){return n*(2*s+n-1)/2;}

//順列の全列挙
// vector<int> v(N);
// iota(v.begin(), v.end(), 1);       // v に 1, 2, ... N を設定
// do {
//	for(auto x : v) cout << x << " "; cout << "\n";     // v の要素を表示
// } while( next_permutation(v.begin(), v.end()) ); 

//bit全探索
// for (int tmp = 0; tmp < (1 << ビット数); tmp++) {
//	bitset<ビット数> s(tmp);
//	// (ビット列sに対する処理)
// }

int main()
{
  int temp = 0, n, a, b;

  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> a >> b;
    if (temp >= 3 || a == b)
      temp++;
    else
      temp = 0;
  }
  cout << (temp >= 3 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll read()
{
	char c;
	ll w=1;
	while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
	ll ans=c-'0';
	while((c=getchar())>='0'&&c<='9')ans=(ans<<1)+(ans<<3)+c-'0';
	return ans*w;
}
int q;
ll cs;
ll op[1000005];
ll a[1000005];
ll b[1000005];
ll l,r;
vector<ll>v;
vector<ll>vs;
multiset<ll>s;
multiset<ll>::iterator it;
int jo;
ll ansq;
ll ansh;
int main(){
	q=read();
	for(int i=1;i<=q;i++)
	{
		op[i]=read();
		if(op[i]==1)
		{
			a[i]=read();
			b[i]=read();
			if(s.empty())
			{
				jo^=1;
				s.insert(a[i]);
				it=s.begin();
				ansq+=a[i];
			}
			else 
			{
				s.insert(a[i]);
				jo^=1;
				if(jo)
				{
					if(a[i]>=(*it))it++,ansh-=(*it),ansq+=(*it),ansh+=a[i];
					else ansq+=a[i];
				}
				else 
				{
//					cout<<*it<<" qqq"<<" "<<ansq<<endl;
					if(a[i]<(*it))ansh+=(*it),ansq-=(*it),ansq+=a[i],it--;
					else ansh+=a[i];
				}
			}
			cs+=b[i];
		}
		if(op[i]==2)
		{
//			cout<<ansh-s.size()/2ll*(*it)<<endl;
//			cout<<ansh<<endl;
//			cout<<cs<<endl;
			printf("%lld %lld\n",*it,ansh-s.size()/2ll*(*it)+(s.size()-s.size()/2ll)*(*it)-ansq+cs);
//			v.push_back(*it);
//			vs.push_back(0);
		}
	}
//	int w=0;
//	for(int i=1;i<=q;i++)
//	{
//		if(op[i]==1)
//		{
//			for(int j=w;j<v.size();j++)
//			{
//				vs[j]+=abs(v[j]-a[i]);
//			}
//			cs+=b[i];
//		}
//		if(op[i]==2)
//		{
//			printf("%lld %lld\n",v[w],vs[w]+cs);
//			w++;
//		}
//	}
	return 0;
}

Measured memory_bytes: 17652
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
long long n,mod=998244353,flag,bob;
long long d[101010],book[101010];
long long ans=1;
long long power(long long a,long long b,long long p)
{
	long long num=1%p;
	for(;b;b>>=1)
	{
		if(b&1)
			num=num%p*a%p;
		a=a%p*a%p;
	}
	return num%p;
}
int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&d[i]);
		if(d[1]!=0)
			bob=1;
		book[d[i]]++;
	}
	if((book[0]==0&&n>1)||(book[0]>1)||bob)
	{
		printf("0");
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		if(flag&&book[i])
		{
			printf("0");
			return 0;
		}
		if(book[i]==0)
			flag=1;
		ans=(ans%mod*power(book[i-1],book[i],mod)%mod)%mod;
	}
	printf("%lld",ans%mod);
	return 0;
}

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

int main(){

  string s;
  int n;
  char in;
  int num=0 , count=0;

  cin >> n;
  getchar();

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

    s = "";
    
    while(scanf("%c",&in)){
      if(in == '\n' ){ break; }

      else if(in == '0'){
 
	  if(num==2)
	    s += 'a'+(count-1)%3;
	  else if(num==3)
	    s += 'd'+(count-1)%3;
	  else if(num==4)
	    s += 'g'+(count-1)%3;
	  else if(num==5)
	    s += 'j'+(count-1)%3;
	  else if(num==6)
	    s += 'm'+(count-1)%3;
	  else if(num==7)
	    s += 'p'+(count-1)%4;
	  else if(num==8)
	    s += 't'+(count-1)%3;
	  else if(num==9)
	    s += 'w'+(count-1)%4;
	  else if(num==1){
	    switch((count-1)%5){
	    case 0: s+='.'; break;
	    case 1: s+=','; break;
	    case 2: s+='!'; break;
	    case 3: s+='?'; break;
	    default: s+=' ';
	    }
	  }

	  num = 0;
	  count = 0;

      }
      //kakutei

      else{
	if(in-'0' == num)
	  count ++;
	else{
	  num = in-'0';
	  count = 1;
	}
      }
    }
    //while

    cout << s << endl;

  }
	    
  return 0;
}

Measured memory_bytes: 1232
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

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

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

int main() {
	ll n;
	cin >> n;
	for (int i = 1; i < 1000; ++i) {
		if (pow(2, i) > n) {
			cout << pow(2, i) / 2 << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3456
#include <stdio.h>

int main(void) {
	int e[4];
	int i, j;
	for (i = 0; i < 4; i++) {
		if (scanf("%d", &e[i]) != 1) return 1;
	}
	for (i = 3; i > 0; i--) {
		for (j = 0; j < i; j++) {
			if (e[j] > e[j + 1]) {
				int t = e[j];
				e[j] = e[j + 1];
				e[j + 1] = t;
			}
		}
	}
	puts(e[0] == e[1] && e[2] == e[3] ? "yes" : "no");
	return 0;
}

Measured memory_bytes: 580