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

using namespace std;

const int mxs =  2 * 1e4 + 10;
using ll = long long;

int n;
// vector<ll> w, s, v;

// ll solve(ll mslack, string mask){
//     if(stoi(mask) == 0 || mslack == 0) return 0; // ok for only small value of mask (int)
//     ll res = -1;
//     for(int i = 0; i < n; i++){
//         if((mask[i] - '0') && w[i] <= mslack){
//             string tmp = mask;
//             tmp[i] = '0';
//             res = max(res, v[i] + solve(min(mslack - w[i], s[i]), tmp));
//         }
//     }
//     return res;
// }

struct box{
    ll w, s, v;
    bool operator< (const box& b){
        return w + s > b.w + b.s; //decreasing order
    }
};

vector<box> arr;
vector<vector<ll>> memo;

ll solve(int idx, ll mslack){
    if(idx == n || mslack == 0) return 0;
    if(memo[idx][mslack] != -1) return memo[idx][mslack];
    ll res;
    if(mslack >= arr[idx].w){
        res = max(arr[idx].v + solve(idx+1, min(arr[idx].s, mslack - arr[idx].w)), solve(idx+1, mslack));
    }else{
        res = solve(idx+1, mslack);
    }
    return memo[idx][mslack] = res;
}

int main(){
    cin>>n;
    arr.resize(n);
    for(int i = 0; i < n; i++){
        ll x, y, z;
        cin>>x>>y>>z;
        arr[i] = box();
        arr[i].w = x, arr[i].s = y, arr[i].v = z;
    }
    sort(arr.begin(), arr.end());
    // for(int i = 0; i < n; i++){
    //     cout<<arr[i].v<<endl;
    // }
    // w.resize(n); s.resize(n); v.resize(n);
    // for(int i = 0; i < n; i++){
    //     cin>>w[i]>>s[i]>>v[i];
    // }
    // string mask(n, '1');
    // ll res = solve((ll)1e5, mask);

   
    // vector<ll> mslack(n), dp(n);
    // for(int i = 0; i < n; i++){
    //     dp[i] = arr[i].v;
    //     mslack[i] = arr[i].s;
    // }
    // for(int i = 1; i < n; i++){
    //     for(int j = 0; j < i; j++){
    //         if(mslack[j] >= arr[i].w){
    //             if(arr[i].v + dp[j] > dp[i]){
    //                 dp[i] = arr[i].v + dp[j];
    //                 mslack[i] = min(arr[i].s, mslack[j] - arr[i].w);
    //             }
    //         }
    //     }
    // }
    // ll res = -1;
    // for(auto x : dp){
    //     res = max(res, x);
    // }
    memo.resize(n, vector<ll>(mxs, -1));
    ll res = solve(0, mxs-1);

    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 160512
#include<stdio.h>

int main() {
	int N;
	int S[14] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13 };
	int H[14] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13 };
	int C[14] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13 };
	int D[14] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13 };
	char s[10];
	int n;

	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%s %d",s,&n);
		if (s[0] == 'S') {
			S[n] = 0;
		}
		else if (s[0] == 'H') {
			H[n] = 0;
		}
		else if (s[0] == 'C') {
			C[n] = 0;
		}
		else {
			D[n] = 0;
		}
	}
	for (int i = 1; i < 14; i++) {
		if (S[i]) printf("S %d\n", S[i]);
	}
	for (int i = 1; i < 14; i++) {
		if (H[i]) printf("H %d\n", H[i]);
	}
	for (int i = 1; i < 14; i++) {
		if (C[i]) printf("C %d\n", C[i]);
	}
	for (int i = 1; i < 14; i++) {
		if (D[i]) printf("D %d\n", D[i]);
	}

	return 0;
}


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

int main(){
    int a,b;
    char op;

    while(1){
        cin >> a >> op >> b;

    if( op == '+'){
        int c;
        c=a+b;
        cout << c << endl;
    }else if(op == '-'){
        int c;
        c=a-b;
        cout << c << endl;
    }else if(op =='*'){
        int c;
        c=a*b;
        cout << c << endl;
    }else if(op =='/'){
        int c;
        c=a/b;
        cout << c << endl;
    }else{
        break;
    }

    }

    return 0;

}


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

#define MAXN 1000

using namespace std;

string S, T;

string mov(string str, int N)
{
    string strr = str;
    int i = 0, j;
    while(i < N)
    {
        char c = strr[strr.length() - 1];
        for(j = strr.length() - 1; j >  0; j--)
        {
            strr[j] = strr[j - 1];
        }
        strr[0] = c;
        i++;
    }
    return strr;
}
int main()
{
    cin>>S;
    cin>>T;
    for(int i = 0; i < S.length(); i++ )
    {
        if(mov(S, i) == T)
        {
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
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;}

const ll INF = 1000000000;

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

    ll ans = 0;
    while(1){
        n /= k;
        ans++;
        if(n == 0) break;
    }
    
    cout << ans << endl;
    
    return 0;
}


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

template<typename A, typename B> bool chmin(A &a, const B &b){ return b < a && (a = b, true); }
template<typename A, typename B> bool chmax(A &a, const B &b){ return a < b && (a = b, true); }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
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;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;



void solve(){
	int n,k;
	cin>>n>>k;
	vector<int>l(k),r(k);
	rep(i,k)cin>>l[i]>>r[i];
	constexpr ll m=998244353;
	vector<ll>dp(n+5),sum(n+5);
	dp[1]=1;
	rep(i,n){
		rep(j,k){
			if(i-l[j]+1>=0)dp[i+1]+=sum[i-l[j]+1]-sum[max(0,i-r[j])];
			dp[i+1]=(dp[i+1]+m)%m;
		}
		sum[i+1]=sum[i]+dp[i+1];
		sum[i+1]=(sum[i+1]+m)%m;
	}
	cout<<dp[n];
}


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


Measured memory_bytes: 6308
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  bitset<100000> mlt = 0;
  for (int i = 0; i < 2 * m; i++) {
    int tmp;
    cin >> tmp;
    tmp--;
    mlt ^= 1 << tmp;
  }
  bool flag = false;
  for (int i = 0; i < n; i++) {
    if (mlt[i]) {
      flag = true;
      break;
    }
  }
  if (!flag) {
    cout << "YES" << '\n';
  } else {
    cout << "NO" << '\n';
  }
  return 0;
}

Measured memory_bytes: 256
k=0
u=0
p=0
c=0
x=0

n=input()

for i in n:
    if i=='K':
        k+=1
    elif  i=='U':
        u+=1
    elif i=='P':
        p+=1
    elif i=='C':
        c+=1
            
    
for j in range(len(n)):
    if k>=1 and u>=1 and p>=1 and c>=1:
        x+=1
        k-=1
        u-=1
        p-=1
        c-=1
    else:
        break
print(x)

    


Measured memory_bytes: 5556
import java.util.BitSet;
import java.util.Scanner;

class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Scanner sc) {
		String S = sc.next();
		int K = sc.nextInt();

		String S2 = S + S;
		BitSet bits = new BitSet(S2.length());
		char[] chars = S2.toCharArray();
		for (int i = 1; i < chars.length; i++) {
			bits.set(i, !bits.get(i - 1) && chars[i - 1] == chars[i]);
		}
		long result;
		if (bits.get(S.length()) == bits.get(S2.length() - 1)) {
			result = bits.cardinality() * (K / 2L);
			result += Math.min(bits.get(0, S.length()).cardinality(), bits.get(S.length(), S2.length()).cardinality()) * (K % 2L);
		} else {
			result = bits.get(0, S.length()).cardinality();
			result += bits.get(S.length(), S2.length()).cardinality() * (K - 1L);
		}
		System.out.println(result);
	}
}

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

		Solver.INSTANCE.solve(in);

		in.close();
	}
}

Measured memory_bytes: 23764
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	a=a*b;
	if(a%2==0)
	{
		cout<<"Even"<<endl;
	}
	else if(a%2==1)
	{
		cout<<"Odd"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 1001
#define inf 1000
int n, M[N][N];
int color[N], d[N], f[N], t;
int Q[2*N], head=0, tail=0;

void enqueue(int x){
  Q[tail++] = x;
}
int dequeue(){
  int x;
  x = Q[head++];
  return x;
}
void bfs(int s){
  int i, u, v;
  enqueue(s);
  for(i = 1; i <= n; i++) d[i] = inf;
  d[s] = 0;
  while(head != tail){
    u = dequeue();
    for(v = 1; v <= n; v++){
      if(M[u][v] == 0) continue;
      if(d[v] != inf) continue;
      d[v] = d[u] + 1;
      enqueue(v);
    }
  }
}

int main(){
  int u, k, v, i, j;
  scanf("%d", &n);
  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      M[i][j] = 0;
    }
  }
  for(i = 0; i < n; i++){
    scanf("%d %d",&u, &k);
    for(j = 0; j < k; j++){
      scanf("%d",&v);
      M[u][v] = 1;
    }
  }
  bfs(1);
  for(i = 1; i <= n; i++){
    if(d[i] == inf) d[i] = -1;
    printf("%d %d\n",i, d[i]);
  }
  return 0;
}

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

namespace agc023_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Dictionary<long, long> dic = new Dictionary<long, long>();
            long sum = 0;
            dic[0] = 1;
            for (int i = 0; i < n; i++)
            {
                sum += x[i];
                if (!dic.ContainsKey(sum)) dic[sum] = 0;
                dic[sum]++;
            }
            long ret = 0;
            foreach (var item in dic) ret += item.Value * (item.Value - 1) / 2;
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 41004
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}
local K = read.n()
print(a[K])

Measured memory_bytes: 1008
#include <bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define faster ios::sync_with_stdio(false)
#define ll long long int
#define sz 200005
#define mp(x,y) make_pair(x,y) 
#define pii pair<long long int,long long int>
#define tor ::iterator
#define letsgo long long  int i,j,k,q=0,t,tmp,n,flg=0,cntr=0,maxxer = 0
#define fi first
#define se second
#define be begin()
#define en end()
#define mod 1000000007
#define debug(x) cout<<" "<<x<<endl

ll dp[105][100005] ;
ll knapsack(ll i,ll w,ll wt[],ll v[],ll n){
	// cout<<i<<"   "<<w<<"   "<<endl;
	if(i==n)
		return 0;
	if(dp[i][w]!=-1)
		return dp[i][w];
	if( wt[i]<= w){
		dp[i][w] = max(knapsack(i+1,w,wt,v,n)
			,knapsack(i+1,w-wt[i],wt,v,n)+v[i]);
	}
	else 
		dp[i][w] = knapsack(i+1,w,wt,v,n);
	return dp[i][w];
}
int main(){
	faster;
	letsgo; 
	ll w;
	ll m;
	cin>>n>>m;
	ll l= -1,r =INT_MAX;
	for(i=0;i<m;i++){
		cin>>k>>j;
		l = max(l,k);
		r = min(r,j);
	}
	if(r-l>= 0)
		cout<<r-l+1;
	else
		cout<<0;
}

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

int main(void){
  int N;
  cin >> N;
  int ans=0;
  int mnum=0;
  for(int i=0; i<N; i++){
    int tmp;
    cin >> tmp;
    ans+=tmp;
    mnum=max(mnum, tmp);
  }
  ans -= mnum/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

adj = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    adj[a].append(b)
    adj[b].append(a)

from collections import deque
q = deque([])
q.append(0)
ps = [0] * N
ps[0] = K
visited = [False] * N
visited[0] = True
while len(q) > 0:
    v = q.popleft()
    now = K - 2
    if v == 0:
        now = K - 1
    for u in adj[v]:
        if visited[u]:
            continue
        visited[u] = True
        ps[u] = now
        now -= 1
        q.append(u)
ans = 1
for p in ps:
    ans *= p
    ans %= MOD
print(ans % MOD)



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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	string S;
	cin >> S;
	cout << S.substr(0, 3) << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define sfi(a) scanf("%d",&a)
#define m_p make_pair
#define inf 1e9
#define ff first
#define ss second
#define pi(x) pair<x,x>
#define mem(x) memset(x,-1,sizeof(x))
#define TEST_CASE(t) for(int z=1 ; z<=t ; z++)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)
#define FAST  ios_base::sync_with_stdio(0);cout.tie(0)

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
const int maxn = 100010;
const ll M = 1e9+7;

int arr[101][101];

int nCr(int n,int r){
    if(n<r) return arr[n][r] = 0;
    else if(n==r || r==0) return arr[n][r] = 1;
    else if(r==1) return arr[n][r] = n;
    else if(arr[n][r]!=-1) return arr[n][r];
    else {
        arr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
        return arr[n][r];
    }
}

int main()
{
    memset(arr,-1,sizeof arr);
    int n,m;
    cin >> n >> m;
    int ans = 0;
    ans += nCr(n,2);
    ans += nCr(m,2);
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}
ll box[2];
int main() {
	for (int i = 0; i < 3; i++) {
		cin >> box[i];
	}
	if (box[0] % 2 == 0 || box[1] % 2 == 0 || box[2] % 2 == 0) {
		cout << "0" << endl;
	}
	else {
		sort(box, box + 3);
		
		cout << box[0] * box[1] << endl;

	}
	return 0;
}

Measured memory_bytes: 256
h;w;f(y){y=w/3;return fmin(w%3-1|y<h?fmax(h/2,y)+y+1:h+y,h%2?h:h/2);}main(){scanf("%d%d",&h,&w);printf("%.f",h%3&&w%3?fmin(f(h^=w^=h^=w),f()):0);}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;
public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 26;
	static int MOD = 998244353;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		int n = 100010;
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int[] c = new int[n-1], s = new int[n-1], f = new int[n-1];
			for (int i = 0; i < n-1; i++) {
				c[i] = in.nextInt();
				s[i] = in.nextInt();
				f[i] = in.nextInt();
			}

			for (int i = 0; i < n-1; i++) {
				int now = s[i];
				for (int j = i; j < n-1; j++) {
					now += c[j];

					if (j >= n-2) {
						break;
					}
					int x = Math.max((now - s[j+1] + f[j+1] -1)/f[j+1], 0);
					now = Math.max(now, s[j+1] + f[j+1]*x);
				}
				out.println(now);
			}
			out.println(0);

		}
	}




	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}
}

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

//const int maxn=1e5+5;
char s[10];
int main()
{
    scanf("%s",s);
    if(s[0]=='S')
        printf("Cloudy");
    else if(s[0]=='C')
        printf("Rainy");
    else if(s[0]=='R')
    printf("Sunny");
    return 0;
}


Measured memory_bytes: 256
import sys
from functools import reduce
n=int(input())
s=[input() for i in range(n)]
t=[2*(i.count("("))-len(i) for i in s]
if sum(t)!=0:
    print("No")
    sys.exit()
st=[[t[i]] for i in range(n)]

for i in range(n):
    now,mi=0,0
    for j in s[i]:
        if j=="(":
            now+=1
        else:
            now-=1
        mi=min(mi,now)
    st[i].append(mi)

now2=sum(map(lambda x:x[0],filter(lambda x:x[1]>=0,st)))
v,w=list(filter(lambda x:x[1]<0 and x[0]>=0,st)),list(filter(lambda x:x[1]<0 and x[0]<0,st))
v.sort(reverse=True,key=lambda z:z[1])
w.sort(key=lambda z:z[0]-z[1],reverse=True)
#print(now2)
for vsub in v:
    if now2+vsub[1]<0:
        print("No")
        sys.exit()
    now2+=vsub[0]
for wsub in w:
    if now2+wsub[1]<0:
        print("No")
        sys.exit()
    now2+=wsub[0]
print("Yes")

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

using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

int main() {
  int n;
  cin >> n;
  vector<Bint> vec(n);
  for(int i = 0; i < n; i++) {
    Bint a;
    cin >> a;
    vec[i] = a;
    if(vec[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  Bint ans = 1;
  Bint b = 1000000000000000000;


  for(int j = 0; j < n; j++) {
    ans *= vec[j];
    if(ans > b) {
      cout << -1 << endl;
      return 0;
    }
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6496
#include <bits/stdc++.h>
#define FOR(i,k,n) for(ll i=(k);i<(ll)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)
 
using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int h1,m1,h2,m2;
  int k;
  cin>>h1>>m1>>h2>>m2>>k;
  int t1 = h1*60+m1;
  int t2 = h2*60+m2;
  cout<<max(0,t2-t1-k)<<endl;
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <map>

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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,n,s) for(int i=(int)(s);i<(int)(n);++i)
#define RREP(i,n,s) for(int i=(int)(s);i>=(int)(n);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
int a,b,c,d;cin>>a>>b>>c>>d;
if(abs(a-c) <= d || (abs(a-b) <= d && abs(b-c) <= d)) cout << "Yes" << endl;
else cout << "No" << endl;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
#include<string>
#include<cmath>

using namespace std;

#define ll long long int
#define ld long double
#define loop(i, n) for (int i = 0; i < n; i++)
#define loops(i, s, n) for (int i = s; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007

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

    int n;
    cin>>n;
    ll a[n];
    map<ll,ll> mp;
    ll sum = 0;
    for(int i = 0; i<n; i++){
        cin>>a[i];
        sum+=a[i];
        mp[a[i]]++;
    }
    int q;
    cin>>q;
    while(q--){
        int b,c;
        cin>>b>>c;
        if(mp[b] > 0){
            sum-=(mp[b]*b);
            sum+=(mp[b]*c);
            mp[c] += mp[b];
            mp[b] = 0;
        }
        cout<<sum<<"\n";
    }
}

Measured memory_bytes: 9992
N, T = map(int, input().split())
c=[]
t=[]
for i in range(N):
    tmp=input().split()
    c.append(int(tmp[0]))
    t.append(int(tmp[1]))

INF=2**51+1
ans=INF
for k in range(N):
    if t[k]<= T:
        ans = min(ans, c[k])
        
if ans==INF:
    print("TLE")
else:
    print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<vector>
#include<new>

int main()
{
	int n, table[201]{}, count = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i += 2)
	{
		for (int j = 1; j <= i; j += 2)
		{
			if (!(i % j))
				table[i]++;
		}
		if (table[i] == 8)
			count++;
	}
	printf("%d\n", count);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  ll c = a + b;
  ll ans = 0;
  ans += (n / c) * a;
  ans += min(n % c, a);
  cout << ans << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(M);
  int sum = 0;
  for (int i = 0; i < M; i++) {
    cin >> vec.at(i);
    sum += vec.at(i);
  }
  if (N >= sum) cout << N - sum << endl;
  else cout << "-1" << endl;
}


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

int main(){
  int N;long K;cin>>N>>K;
  vector<long> A(N);
  for(int i=0;i<N;i++) cin>>A.at(i);
  sort(A.begin(),A.end());
  long left=1;
  long right=1000000000;
  while(left<right){
    long X=(right+left)/2;
    long count=0;
    for(int i=0;i<N;i++){
      count+=A.at(i)/X;
      if(A.at(i)%X==0) count--;
    }
    if(count>K) left=X+1;
    else right=X;
  }
  cout<<right<<endl;
}
    


Measured memory_bytes: 4836
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
template<typename T,typename E>using hash_map=__gnu_pbds::gp_hash_table<T,E>;
int main() {
    int N, Ma, Mb; cin >> N >> Ma >> Mb;
    int A[41], B[41], C[41];
    rep(i,N) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        A[i] = a;
        B[i] = b;
        C[i] = c;
    }
    int H1 = N / 2;
    int H2 = N - H1;
    int mi = INT32_MAX;

    // (MbA0−MaB0)+(MbA1−MaB1)=0
    // MbA0 - MaB0 = MaB1 - MbA1
    
    map<int,int> M1;
    for (int bit = 1; bit < pow(2,H1); bit++) {
        int a = 0, b = 0, c = 0;
        for (int i = 0; i < H1; i++) {
            if (bit & (1 << i)) {
                a += A[i];
                b += B[i];
                c += C[i];
            }
        }
        int s = Mb * a - Ma * b;
        if (M1[s] == 0) M1[s] = c; // Can't be zero
        else M1[s] = min(M1[s], c);
        if (s == 0) mi = min(mi, c);
    }

    hash_map<int,int> M2;
    for (int bit = 1; bit < pow(2,H2); bit++) {
        int a = 0, b = 0, c = 0;
        for (int i = 0; i < H2; i++) {
            if (bit & (1 << i)) {
                a += A[H1 + i];
                b += B[H1 + i];
                c += C[H1 + i];
            }
        }
        int s = Ma * b - Mb * a;
        if (M2[s] == 0) M2[s] = c;
        else M2[s] = min(M2[s], c);
        if (s == 0) mi = min(mi, c);
    }

    for (auto x : M1) {
        if (M2.find(x.first)!=M2.end()) {
            mi = min(mi, x.second + M2[x.first]);
        }
    }

    if (mi == INT32_MAX) {
        cout << -1 << endl;
    } else {
        cout << mi << endl;
    }
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
const int IMAX = 200010;
constexpr ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}
class unko_for_ABC156_no_Emondai {
public:
	int fac[IMAX + 1], ifac[IMAX + 1], A[IMAX + 1], B[IMAX + 1];
	constexpr unko_for_ABC156_no_Emondai() : fac(), ifac(), A(), B() {
		fac[0] = 1;
		rep1(i, IMAX) fac[i] = ll(fac[i - 1]) * i % mod;
		ifac[IMAX] = modpow(fac[IMAX], mod - 2);
		for (int i = IMAX; i > 0; i--) ifac[i - 1] = ll(ifac[i]) * i % mod;
		rep(i, IMAX) A[i] = ll(ifac[i]) * ifac[i] % mod;
		rep1(i, IMAX - 1) B[i] = ll(ifac[i]) * ifac[i - 1] % mod;
	}
} f;

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


	int N, K;
	scanf("%d %d", &N, &K);

	ll kotae = 0;
	rep(i, min(N, K + 1)) {
		kotae += ll(f.A[i]) * f.B[N - i] % mod;
	}

	kotae %= mod;
	kotae = kotae * f.fac[N - 1] % mod;
	kotae = kotae * f.fac[N] % mod;

	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
#define ls(x) (x<<1)
#define rs(x) (ls(x)|1)
#define eps 1e-11
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef double db;
const int mod = 998244353;
const int N = 1e6 + 5;
const int M = 1e3 + 5;
ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; }
ll lcm(ll a,ll b){ return a*b/gcd(a,b); }
inline ll qsm(ll x,ll y){ ll res=1; while(y){if(y&1) res=res*x%mod;
x=x*x%mod; y>>=1;} return res; }
int n, m, k;
int a[105];

int main(){
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    printf("%d %d %d\n",x,y,z);
    return 0;
}
/*

*/
//
//                            _ooOoo_
//                           o8888888o
//                           88" . "88
//                           (| -_- |)
//                           O\  =  /O
//                        ____/`---'\____
//                      .'  \|     |//  `.
//                     /  \|||  :  |||//  \
//                    /  _||||| -:- |||||-  \
//                    |   | \  -  /// |   |
//                    | \_|  ''\---/''  |   |
//                    \  .-\__  `-`  ___/-. /
//                  ___`. .'  /--.--\  `. . __
//               ."" '<  `.___\_<|>_/___.'  >'"".
//              | | :  `- \`.;`\ _ /`;.`/ - ` : | |
//              \  \ `-.   \_ __\ /__ _/   .-` /  /
//         ======`-.____`-.___\_____/___.-`____.-'======
//                            `=---='
//        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//                     佛祖保佑      永无BUG


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define SP << " " 
#define LLi long long int

using namespace std;

int imax=2147483647;
long long int llimax=9223372036854775807;

//int型vectorを出力
void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

//LLi型vectorを出力
void PVL(vector<LLi> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

int main(){

	int a;
	cin>> a;

	cout<< 1-a << endl;
 
	return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define FAST ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define f(i,n) for(int i=0 ; i<n ; i++)
#define fll(i,n) for(ll i=0 ; i<n ; i++)
#define f1(a,b,i) for(ll i=a ; i<b ; i++)
#define fd(i,n) for(int i=n-1 ; i>=0 ; i--)
#define ll long long
#define ld long double
#define vi vector<int>
#define  pii pair<int,int>
#define vl vector<ll>
#define INF 1e9
#define epsn 1e-12

using namespace std ;
int M=1e9+7 ;
ll pow(ll a, ll b){
    if(b==0)return 1 ;
    else if(b%2)return a*pow(a,b-1) ;
    else return pow(a,b/2)*pow(a,b/2) ;
}

int main(){
    ll n,k ;
    cin>>n>>k ;
    vector<ll>h(n) ,dp(n,1e9);
    fll(i,n)cin>>h[i] ;
    dp[0]=0 ;
    fll(i,n)
        for(ll j=1 ; j<=k && i+j<n ; j++)
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i+j]-h[i])) ;

    cout<<dp[n-1]<<"\n" ;
    return 0 ;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N);
  rep(i, N) vec.at(i) = i + 1;
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int x;
      cin >> x;
      rep(i, N) {
        if (x == vec.at(i)) {
          vec.at(i) = 0;
        }
      }
    }
  }
  int ans = 0;
  rep(i, N) {
    if (vec.at(i) != 0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

struct cww{cww(){
    ios::sync_with_stdio(false);cin.tie(0);
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
template <typename T>inline void chmin(T &l,T r){l=min(l,r);}
template <typename T>inline void chmax(T &l,T r){l=max(l,r);}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
const int INF=114514;
int N;
char s[600][600];
int brack_row=0;
int solve(int r){
    int need=0;
    REP(i,N)need+=(s[r][i]=='.');
    int exist=0;
    REP(i,N)if(s[i][r]=='#')exist=1;
    if(exist==0){
        if(s[r][r]=='#')need++;
        need++;
    }
    return brack_row+need;
}

int main(){
    cin>>N;
    REP(i,N)cin>>s[i];
    int res=INF;
    int b=0;
    REP(i,N){
        int a=0;
        REP(j,N)if(s[j][i]=='.')a=1;else b=1;
        brack_row+=a;
    }
    if(b==0){
        cout<<-1<<endl;
        return 0;
    }
    REP(i,N)chmin(res,solve(i));
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 512
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n, k;
	while(cin >> n >> k) {
		using vi = vector<int>;
		vector<vi> wc(2*k+1,vi(2*k+1, 0));
		vector<vi> bc(2*k+1,vi(2*k+1, 0));
		REP(i, n){
			int x, y;
			char c;
			cin >> x >> y >> c;
			x %= 2*k;
			y %= 2*k;
			if(c == 'W') {
				wc[x+1][y+1] ++;
			} else {
				bc[x+1][y+1]++;
			}
		}
		REP(i, 2*k) REP(j, 2*k) {
			wc[i+1][j+1] += wc[i+1][j]+wc[i][j+1]-wc[i][j];
			bc[i+1][j+1] += bc[i+1][j]+bc[i][j+1]-bc[i][j];
		}
		// REP(i, SZ(wc)) {
		// 	dpite(ALL(wc[i]));
		// }
		auto sumw = [&](int i, int j, int x, int y) {
			// i++; j++;
			return wc[i][j]-wc[x][j]-wc[i][y]+wc[x][y];
		};
		auto sumb = [&](int i, int j, int x, int y) {
			// i++; j++;
			return bc[i][j]-bc[x][j]-bc[i][y]+bc[x][y];
		};
		int ans = 0;
		REP(i, k) REP(j, k) {
			DEBUG(i); DEBUG(j);
			int sum = sumb(i+k, j+k, i, j) + sumb(i, j, 0, 0) + sumb(2*k, 2*k, i+k, j+k)
						 + sumb(2*k, j ,i+k, 0) + sumb(i, 2*k, 0,j+k)
						+ sumw(i+k, j, i, 0) + sumw(i, j+k, 0, j) + sumw(2*k,j+k ,i+k, j) + sumw(i+k, 2*k,i ,j+k);
			DEBUG(sum);
			chmax(ans, sum);
		}
		swap(wc,bc);
		REP(i, k) REP(j, k) {
			DEBUG(i); DEBUG(j);
			int sum = sumb(i+k, j+k, i, j) + sumb(i, j, 0, 0) + sumb(2*k, 2*k, i+k, j+k)
						 + sumb(2*k, j ,i+k, 0) + sumb(i, 2*k, 0,j+k)
						+ sumw(i+k, j, i, 0) + sumw(i, j+k, 0, j) + sumw(2*k,j+k ,i+k, j) + sumw(i+k, 2*k,i ,j+k);
			DEBUG(sum);
			chmax(ans, sum);
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 31744
#include <stdio.h>
 
int main(void){
    double a,b,c,d,e,f,x,y;
    while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&e,&c,&d,&f) != EOF){
        x = (e*d - b*f)/(a*d - b*c);
        y = (a*f - e*c)/(a*d - b*c);
        if(x == 0) x = 0;
        if(y == 0) y = 0;
        printf("%.03lf %.03lf\n", x, y);
    }
    return 0;
}

Measured memory_bytes: 652
#include <iostream>

#define REP(i,n) for(int i=0; i<n; i++)
#define debug(x) cerr << #x << " = " << (x) << endl;

using namespace std;

int main(){
	int n, count=0;
	string input;
	cin >> n;
	REP(i,n){
		cin >> input;
		if (input[0]=='A') count++;
		else count--;
		if (count<0){
			cout << "NO" << endl;
			return 0;
		}
	}
	if (count==0){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}



Measured memory_bytes: 3148
#coding:utf-8
from collections import defaultdict
import sys
S=raw_input()
P=defaultdict(list)
for i,c in enumerate(S):
    P[c].append(i)
for c,v in P.items():
    v.sort()
    i=v[0]
    for ii in v[1:]:
        if ii-i==1 or ii-i==2:
            print("%d %d"%(i+1, ii+1))
            sys.exit(0)
        i=ii
print("%d %d"%(-1,-1))

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

typedef long long ll;
const int N = 2e5 + 10;
ll q[N];
int n;

int main()
{
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) scanf("%lld", &q[i]);
    ll res = 0;
    for(int i = 1; i <= n; i++) res ^= q[i];
    for(int i = 1; i <= n; i++) printf("%lld%c", res ^ q[i], " \n"[i == n]);
    return 0;
}

Measured memory_bytes: 5316
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  auto s = readln.stripRight[0 .. 3];
  writeln ((s.count ('A') < 3 && s.count('B') < 3) ? "Yes" : "No");
}



Measured memory_bytes: 256
S = input()

flag = 0

for index, i in enumerate(S):
	if not index:
		if not i == "A":
			print("WA")
			break
		continue

	if 1 < index and index < len(S) - 1:
		if i == "C":
			if not flag:
				flag = 1
				continue
			else:
				print("WA")
				break
	if not i.islower():
		print("WA")
		break

else:
	if flag:
		print("AC")
	else:
		print("WA")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
#define INF 99999999 
using namespace std;
 
int main()
{
    string S; cin >> S;
    int r = 0, l = 0, temp = 0, N = S.size();
    int A[N] = {0};
    char now = 'R';
    for (int i = 0; i < N; i++)
    {
        if(S[i] == 'R' and now == 'R'){
            r++;
        } 
        else if (S[i] == 'L' and now == 'R')
        {
            temp = i-1;
            l++;
            now = 'L';
        }
        else if (S[i] == 'L' and now == 'L')
        {
            l++;
        }
        else
        {
            A[temp] = (r+1)/2 + l/2;
            A[temp+1] = r/2 + (l+1)/2;
            r = 1; l = 0;
            now = 'R';
        }
        
    }
    A[temp] = (r+1)/2 + l/2;
    A[temp+1] = r/2 + (l+1)/2;
    
    for (int i = 0; i < N-1; i++)
    {
        cout << A[i] << " ";
    }
    cout << A[N-1] << endl;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
int dp[100010][2] = {0};
signed main(){


    string L;
    cin >> L;
    int n = L.size();
    if(L[n-1] == '0'){
        dp[0][0] = 1;
        dp[0][1] = 2;
    }else{
        dp[0][0] = 3;
        dp[0][1] = 0;
    }
    for(int i = 1;i < n;i++){
        if(L[n-1-i] == '1'){
            dp[i][0] = (3*dp[i-1][0] + dp[i-1][1])%MOD;
            dp[i][1] = (2*dp[i-1][1])%MOD;
        }else{
            dp[i][0] = (dp[i-1][0])%MOD;
            dp[i][1] = (2*dp[i-1][0] + 3*dp[i-1][1])%MOD;
        }
    }
    cout << dp[n-1][0] << endl;
    

    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc129.contest.atcoder.jp/tasks/abc129_a

Measured memory_bytes: 2048
#include <iostream>
using namespace std;
#include<bits/stdc++.h>
typedef long long ll;
#define int long long
#define ff first
#define ss second
#define md 1000000007
#define md1 998244353
#define pb push_back
#define in insert
#define mkp make_pair
#define f(i,yha,wha) for(ll i=yha;i<wha;i++)
#define rf(i,wha,yha) for(ll i=wha;i>=yha;i--)
#define f0(n) for(ll i=0;i<n;i++)
#define f1(n) for(ll i=1;i<=n;i++)
#define fg(i,yha,wha,gap) for(ll i=yha;i<wha;i+=gap)
#define mpll map<ll,ll>
#define len(p) (ll)p.size()
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()
#define mem(a,t) memset(a,t,sizeof(a))
#define endl "\n"
#define ar array
#define vl vector<ll>
#define vpll vector<pair<ll,ll>>


void flash()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}

void solve()
{
	ll n;
	cin>>n;
	float ans=2*n*(22*1.0/7);
	cout<<ans<<endl;
	
}


int32_t main()
{
  flash();
  int t;
  t = 1;
//  cin >> t;
  while (t--)
  {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3820
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using namespace std;

bool is_vowel(char c) {
    switch (c) {
        case 'a':
        case 'i':
        case 'u':
        case 'e':
        case 'o':
            return true;
        default:
            return false;
    }
}
int main() {
    while (true) {
        int n; cin >> n;
        if (n == 0) break;
        vector<string> code(n);
        repeat (i, n) {
            string s; cin >> s;
            code[i] += s[0];
            repeat (j, s.length() - 1) {
                if (is_vowel(s[j])) {
                    code[i] += s[j + 1];
                }
            }
        }
        constexpr int inf = 64;
        int k = 0;
        for (; k < inf; ++ k) {
            set<string> used;
            repeat (i, n) {
                used.insert(code[i].substr(0, min<int>(code[i].length(), k)));
            }
            if (used.size() == n) {
                break;
            }
        }
        printf("%d\n", k == inf ? -1 : k);
    }
    return 0;
}

Measured memory_bytes: 3172
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Calendar;


public class Main {

	public static void main(String[] a){

		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

		String tmpString = null;

		try {
			while(null != (tmpString = bf.readLine())){
				String[] tmp = tmpString.split(" ");
				if(tmp[0].equals("0"))break;
				Calendar cal = Calendar.getInstance();
				cal.set(2004, Integer.parseInt(tmp[0]) - 1, Integer.parseInt(tmp[1]));
				System.out.println(convert(cal));
			}
		} catch (IOException e) {
		}
	}

	private static String convert(Calendar cal){
		String[] week = {"", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
		int num = cal.get(Calendar.DAY_OF_WEEK);
		return week[num];
	}
}

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

using namespace std;

#define pb push_back
#define rep(i, a, b) for (int i = (a); i < (b); i++)

long long k;
vector<long long> has;

long long cal(long long u) {
  long long res = 0;
  while (u) {
    res += u % 10;
    u /= 10;
  }
  return res;
}

int main() {
  long long cur = 0;
  long long now = 1;
  long long po10 = 1;

  for (int i = 0; i < 15; i++) {
    now = now * 10;
    rep(j, 1, now + 1) {
      long long v = po10 * j + cur;
      long long u = po10 * (j + 1) + cur;
      if (v * cal(u) > u * cal(v)) break;
//      cout << v << endl;
      has.pb(v);
    }
    cur = cur * 10 + 9;
    po10 *= 10;
  }

  sort(has.begin(), has.end());
  vector<long long>::iterator it = unique(has.begin(), has.end());
  has.resize(distance(has.begin(), it));

//  cout << (int)has.size() << endl;
  
//  return 0;
  cin >> k;

  for (int i = 0; i < k; i++) cout << has[i] << '\n';

  return 0;
}



Measured memory_bytes: 256
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
void isPalindrome(string str) 
{ 
	// Start from leftmost and rightmost corners of str 
	int l = 0; 
	int h = str.size() - 1; 

	// Keep comparing characters while they are same 
	while (h > l) 
	{ 
		if (str[l++] != str[h--]) 
		{ 
			cout<<"No"; 
			return; 
		} 
	} 
	cout<<"Yes"; 
} 
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	string s;
	cin>>s;
	isPalindrome(s);
	return 0;
}


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

 using namespace std;

 int main() {
 int A, B; cin >> A >> B;
 int ans = 0;
 int outlet = 1;
 while (outlet < B) {
 --outlet;
 outlet += A;
 ++ans;
 }
 cout << ans << endl;
 
 return 0;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
vector<int> v;
int main() {
    cin >> n >> k >> s;
    for(int i = 0; i < n;) {
        char nowc = s.at(i);
        int cnt = 0;
        while(i < n && s.at(i) == nowc) {
            cnt++;
            i++;
        }
        v.push_back(cnt);
    }
    
    int vlen = v.size();
    int sum = 0;
    for(int i = 0; i < vlen; ++i) sum += v.at(i)-1;
    if(vlen % 2 == 0) {
        if(k < vlen/2) {
            for(int i = 0; i < k; ++i) sum += 2;
        }else {
            for(int i = 0; i < vlen-1; ++i) {
                if(i % 2 != 0) sum += 2;
            }
            sum += 1;
        }
    }else {
        if(k < vlen/2) {
            for(int i = 0; i < k; ++i) sum += 2;
        }else {
            for(int i = 0; i < vlen; ++i) {
                if(i % 2 != 0) sum += 2;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 1020
import java.util.Scanner;

public class Main {

    private static Scanner scan = new Scanner(System.in);

    public static void main(String[] args) {
	int A = Integer.parseInt(scan.next());
	int B = Integer.parseInt(scan.next());

	int total = A + B;
	String ans = (total >= 10 ? "error" : String.valueOf(total));
	
	System.out.println(ans);
	scan.close();
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,k;
    cin>>n>>k;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    vi dp(n,INF);
    dp[0]=0;
    REP(i,n){
        FOR(j,1,k+1){
            if(i+j<n)chmin(dp[i+j],dp[i]+abs(vec[i+j]-vec[i]));
        }
    }
    cout<<dp.back()<<endl;
    return 0;
}

Measured memory_bytes: 1024