akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(string, S);
  S[3] = '8';
  print(S);
}


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

int main() {
    long N;
    cin >> N;
    vector<pair<long, long>> A;
    for (long i = 0; i < N; i++) {
        long a, b;
        cin >> a >> b;
        A.push_back(make_pair(b, a));
    }

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

    long cnt_time = 0;
    bool is_possible = true;
    for (long i = 0; i < N; i++) {
        cnt_time += A[i].second;
        if (cnt_time > A[i].first) {
            is_possible = false;
            break;
        }
    }
    if (is_possible == true) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;;
    }

}


Measured memory_bytes: 6512
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

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

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    rep(i, k) {
        bool ok = true;  // 全ての電球の強さがnならtrue
        rep(i, n) {
            if(a[i] < n) {
                ok = false;
            }
        }
        if(ok) {
            break;
        }
        vl b(n+1);  // b[i] : 座標iを照らす電球の個数
        rep(i, n) {
            b[max(0LL, i - a[i])]++;
            b[min(n, i + a[i] + 1)]--;
        }
        rep(i, n) {
            b[i+1] += b[i]; 
        }
        rep(i, n) {
            a[i] = b[i];
        }
    }

    rep(i, n) {
        cout << a[i];
        if(i < n-1) {
            cout << " ";
        }
    }

    cout << endl;
    re0;
}

Measured memory_bytes: 6340
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long int;

ll gcd(ll a, ll b)
{
    if (a % b == 0)
        return(b);
    else
        return(gcd(b, a % b));
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main(void) 
{
    int A, B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		Console.WriteLine(L.Zip(R,(l,r) => r - l + 1).Sum());
		
	}
	int N;
	int[] L,R;
	public Sol(){
		N = ri();
		L = new int[N];
		R = new int[N];
		for(int i=0;i<N;i++){
			var d = ria();
			L[i] = d[0]; R[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

int main(void)
{
	int n, count = 0, new_h, h = 0, max = 0;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &new_h);

		if (i != 0)
		{
			if (new_h <= h)count++;
			else count = 0;

			if (max < count)max = count;
		}

		h = new_h;
	}

	printf("%d", max);

	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll n;
    cin >> n;
    ll p[n];
    rep(i,n)cin >> p[i];
    ll cnt=0;
    rep(i, n-1)if(p[i] == i+1){
        ll tmp = p[i];
        p[i] = p[i+1];
        p[i+1] = tmp;
        cnt++;
    }
    if(p[n-1] == n)cnt++;
    cout << cnt;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

#define MOD 1000000007
#define PI 3.14159265358979

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

using namespace std;

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;

template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(11);
	}
};
initializer _____;

int N, M, K, T, Q, A, B, C;
vector< ll > h;
bool check(ll m) {
	vector< ll > h2 = h;
	rep(i, N) h2[i] -= B * m;
	rep(i, N) {
		if (h2[i] > 0) {
			m -= (h2[i] - 1) / C + 1;
		}
		if (m < 0)
			return false;
	}
	return true;
}
int main() {
	cin >> N >> A >> B;
	C = A - B;
	h.resize(N);
	rep(i, N) cin >> h[i];
	int l = 0, r = INT_MAX / 2 - 10;
	while (r - l > 1) {
		int m = (l + r) / 2;
		if (check(m)) {
			r = m;
		} else {
			l = m;
		}
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 1792
from collections import deque
h,w = map(int,input().split())
sy,sx = map(int,input().split())
gy,gx = map(int,input().split())
maze =["#"*(w+4) for i in range(2)] + ["##"+input()+"##" for i in range(h)] + ["#"*(w+4) for i in range(2)]
temp = [[-1]*(w+4) for i in range(h+4)]
# print(maze)

q = deque([(sy+1,sx+1)])
temp[sy+1][sx+1] = 0
# print(temp)
opt = [(0,1),(0,-1),(1,0),(-1,0)]
while q:
    y,x = q.popleft()
    # print(y,x)
    for i in opt:
        ty,tx = y+i[0],x+i[1]
        if maze[ty][tx] == "#":
            continue
        if (temp[ty][tx] == -1 or temp[ty][tx] > temp[y][x]):
            temp[ty][tx] = temp[y][x]
            q.appendleft((ty,tx))
    for i in range(-2,3):
        for j in range(-2,3):
            ty,tx = y+i,x+j
            if maze[ty][tx] == "#":
                continue
            if temp[ty][tx] == -1 or temp[ty][tx] > temp[y][x]+1:
                temp[ty][tx] = temp[y][x]+1
                q.append((ty,tx))

    # print(q)
# for i in temp:
#     print(i)
print(temp[gy+1][gx+1])

Measured memory_bytes: 88016
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var t = Console.ReadLine().Trim();
        var d = new Dictionary<char, char>();
        var d2 = new Dictionary<char, char>();
        if (dcheck(d, s, t) && dcheck(d2, t, s)) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
    public static bool dcheck (Dictionary<char, char> d , string s, string t)
    {
        for (int i = 0; i < s.Length; i++)
            if (d.ContainsKey(s[i]) && d[s[i]] != t[i]) return false;
            else if (!d.ContainsKey(s[i])) d[s[i]] = t[i];
        return true;
    }
}


Measured memory_bytes: 14688
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<iomanip>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
int main() {
    string s; cin >> s;
    if (stoi(s.substr(0, 4)) <= 2018) cout << "Heisei" << endl;
    else if (stoi(s.substr(0, 4)) >= 2020) cout << "TBD" << endl;
    else {
        if (stoi(s.substr(5, 2)) <= 4) cout << "Heisei" << endl;
        else cout << "TBD" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=0,x;scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		ans+=(i%2&&x%2);
	}
	printf("%d",ans);
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

string f(int a, int b) {
  string res = "";
  rep(i, b) { res += (char)('0' + a); }
  return res;
}

int main() {
  int a, b;
  cin >> a >> b;
  string s = f(a, b);
  string t = f(b, a);
  cout << (s < t ? s : t) << endl;
}


Measured memory_bytes: 256
local n = io.read("*n")
local a = {}
for i = 1, n do
    a[i] = io.read("*n")
end

local alice_sum, bob_sum = 0, 0
table.sort(a, function(x, y) return x > y end)
for i = 1, n do
    if i % 2 == 1 then
        alice_sum = alice_sum + a[i]
    else
        bob_sum   = bob_sum   + a[i]
    end
end

print(alice_sum - bob_sum)

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define pb push_back
// #define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1000000007
#define hell2 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll unsigned long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cerr << (#x) << " is " << (x) << endl
#define INF 1e9
#define LL_MAX 1e18
// memset(array, -1, sizeof(array[0][0]) * row * count)
using namespace std;
 
ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 
bool isPerfectSquare(long double x) {long double sr = sqrt(x); return ((sr - floor(sr)) == 0); }
bool check(ll i,ll j,ll n){return (i>=0 && i<n && j>=0 &&  j<n);} //matrix boundary checking
 
 
ll ceil(const ll &a, const ll &b){return (a - 1)/b + 1;}
 
// max({a, b, c, d})
// cout << fixed for removing e notation
 
bool comp(pair<ll, ll>a, pair<ll, ll>b)
{
    if(a.se*b.fi + b.se > b.se*a.fi + a.se) return true;
    else return false;
}
 
void convert(int arr[], int n) 
{ 
    int temp[n+1];
    for(int i=1;i<=n;i++)
        temp[i] = arr[i]; 
    // memcpy(temp, arr, n*sizeof(int)); 
  
    sort(temp+1, temp+n+1);   
    unordered_map<int, int> umap;
    int val = 1; 
    for (int i = 1; i <= n; i++) 
        umap[temp[i]] = val++;
    for (int i = 1; i <= n; i++) 
        arr[i] = umap[arr[i]]; 
}
 
bool prime[10000005];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime)); 
    prime[0] = prime[1] = 0;
    for (int p=2; p*p<=n; p++) 
    {
        if (prime[p] == true) 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
    }
}

int foo(int a, int b, int c)
{
    return (abs(a-b) + abs(b-c) + abs(a-c));
}


ll getFirstSetBitPos(ll n) 
{ 
    return log2(n & -n) + 1; 
} 

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

    int ok = 0;
    for(int i=1;i<=9;i++)
    {
        if(n%i == 0 && n/i <= 9)
        {
            ok++;
        }
    }

    if(ok) cout << "Yes\n";
    else cout << "No\n";
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d", $N);
fscanf(STDIN, "%s", $S);
$ch = str_split($S);
$total_w = 0;
$total_b = 0;
$arr = [];
$min = 200100;
$now;
for ($i=0; $i < $N; $i++) { 

	$now = $ch[$i];
	if ($now == '.') {
		$total_w++;
	}else{
		$total_b++;
	}
	$arr[$i][0]=$total_w;
	$arr[$i][1]=$total_b;
}

for ($j=0; $j < $N; $j++) { 
	$cal = $total_w - $arr[$j][0] + $arr[$j][1];
	if ($min > $cal) {
		$min = $cal;
	}
}

$ans = min($min, $total_w, $total_b);
printf("%d", $ans);

Measured memory_bytes: 101104
#include<iostream>
using namespace std;
#include<vector>
#include<set>
 
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> ans(n+1,0);
  for(int i = 0;i<m;i++){
    int a,b;
    cin>>a>>b;
    ans[a]++;
    ans[b]++;
  }
  for(int i = 0;i<n;i++){
    cout<<ans[i+1]<<endl;
  }
  return 0;
}

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


int main() {
	ll n,q,a[100010];
	cin>>n>>q;
	string s;
	cin>>s;
	for(int i=1;i<s.size();i++){
		a[i]=a[i-1];
		if(s[i-1]=='A'&&s[i]=='C'){
			a[i]++;
		}
	}
	for(int i=0;i<q;i++){
		ll l,r;
		cin>>l>>r;
		l--;r--;
		cout << a[r]-a[l]<<endl;
	}
}

Measured memory_bytes: 1792
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	n, k := nextInt(), nextInt()
	p := make([]int, n)
	var sum int
	for i := 0; i < n; i++ {
		p[i] = nextInt()
	}

	p = quickSort(p)

	for i := 0; i < k; i++ {
		sum += p[i]
	}
	fmt.Fprintf(out, "%d\n", sum)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func quickSort(val []int) []int {
	if len(val) < 2 {
		return val
	}

	pivot := val[0]

	left := []int{}
	right := []int{}

	for _, v := range val[1:] {
		if pivot > v {
			left = append(left, v)
		} else {
			right = append(right, v)
		}
	}

	left = quickSort(left)
	right = quickSort(right)

	ret := append(left, pivot)
	ret = append(ret, right...)

	return ret
}


Measured memory_bytes: 5904
N = int(input())
A = list(map(int, input().split()))
s = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            s = False
            break
print("APPROVED" if s else "DENIED")

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

int main() {
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    rep(i,n){
        ll h;
        cin>>h;
        if(h>=k)ans++;
    }
    cout<<ans<<endl;
}


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





int main()
{
    
    
    
    
    int num,n = 0,keta[10] = {0},kari,i = 0;
    
    scanf("%d",&num);
    kari = num;
    
    while(num > 0){
        keta[i] = num%10;
        num /= 10;
        i++;
    }
    
    
    
    for(int j = 0;j<i;j++)
        n += keta[j];
    
    
    
    if(kari % n == 0)
        printf("Yes\n");
    
    else
        printf("No\n");

return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main(){

	int n,m;
	while(cin>>n>>m&&!(n==0&&m==0)){
		vector<pair<string,int> > lucky;
		for(int i = 0; i < n; i++){
			string str;
			cin>>str;
			int money;
			cin>>money;
			lucky.push_back(make_pair(str,money));
		}
		vector<string> kuji;
		for(int j = 0; j < m; j++){
			string str;
			cin>>str;
			kuji.push_back(str);
		}
		// Çêª ½è©
		int sum=0;
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++){
				bool f=true;
				for(int k = 0; k < lucky[j].first.size(); k++){
					if(lucky[j].first[k]=='*'){
						continue;
					}
					else{
						if(lucky[j].first[k]!=kuji[i][k]){
							f=false;
							break;
						}
					}
				}
				// trueÈçÎ
				if(f){
					sum+=lucky[j].second;
					break;
				}
			}
		}
		cout<<sum<<endl;
	}	
	return 0;
}

Measured memory_bytes: 0
import sys
#import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
#import math
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))


n = ri()
a = rl()
a=a+a
a.sort()

a.pop()
ans=0
for i in range(n-1):
    ans+=a[-i-1]
print(ans)

Measured memory_bytes: 104344
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            List<int> lstS = new List<int>();
            string[] sS = Console.ReadLine().Trim().Split(' ');
            lstS.Add(int.Parse(sS[0]));
            lstS.Add(int.Parse(sS[1]));
            lstS.Add(int.Parse(sS[2]));
            sS = Console.ReadLine().Trim().Split(' ');
            int iK =  int.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            lstS.Sort(delegate (int mca1, int mca2) { return (int)(mca2 - mca1); });  // 降順
            for (int i = 0; i < iK; i++) { lstS[0] *= 2; }

            // 出力
            Console.WriteLine("{0}", lstS.Sum().ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


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

using namespace std;

int n, m, r, l, q, w, total;
vector <int> v;
int cnt = 0, minimo = 0, maximo = 100000;

int main(){
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> l >> r;
        minimo = max(l, minimo);
        maximo = min(r, maximo);
    }
    total = maximo - minimo + 1;
    if(total < 0){
      cout << "0";
    } else {
      cout << total;
    }
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>

#include <string.h>

using namespace std;

bool prime_check(int n)
{
	if (n == 1) { return false; }

	if (n % 2 == 0)
	{
		if (n == 2) { return true; }

		else { return false; }
	}

	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n % i == 0) { return false; }
	}

	return true;
}

int main()
{
	const int DATA_SETS = 10000;
	const int MAX_PRIME = 50000;

	int N[DATA_SETS], P[DATA_SETS], C = 0;

	bool I[MAX_PRIME + 1];

	memset(N, 0, sizeof(N));
	memset(P, 0, sizeof(P));
	memset(I, 0, sizeof(I));

	for (int i = 1; i <= MAX_PRIME; i++)
	{
		if (prime_check(i) == true)
		{
			I[i] = true;
		}
		else
		{
			I[i] = false;
		}
	}

	while (true)
	{
		cin >> N[C];

		if (N[C] == 0) { goto Exit; }

		C++;
	}

Exit:;

	for (int i = 0; i < C; i++)
	{
		for (int j = 2; j <= N[i] / 2; j++)
		{
			if (I[j] == true && I[N[i] - j] == true) { P[i]++; }
		}

		cout << P[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 1292
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		int a = 0;
		for(int i = 0; i < s.Length; i++)
		{
			if(s[i] == '+')
			{
				a++;
			}
			else
			{
				a--;
			}
		}
		Console.WriteLine(a);
	}

	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 11092
#include <iostream>
#include <algorithm>

using namespace std;

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

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

    sort(a, a + n, greater<int>());
    int alice = 0, bob = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) alice += a[i];
        else bob += a[i];
    }

    cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main() {
  char s[210000];
  int ap, zp;
  int ans = -1;
  int ssize;
  
  scanf("%s", s);

  ap = 0;
  zp = strlen(s);
  while(s[ap] != 'A') ap++;
  while(s[zp] != 'Z') zp--;
  
  printf("%d\n", zp - ap + 1);
  
  return 0;
}

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

int main() {
  int x,num,ans=1;
  cin >> x;
  for(int i=2; i<32; i++) {
    num=i*i;
    while(num<=x) {
      ans=max(ans,num);
      num*=i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
(defmacro ch-pr (n)
  `(progn (princ "Christmas")
  (loop :repeat ,n :do(princ " Eve"))))
(case (read)
  ((22) (ch-pr 3))
  ((23) (ch-pr 2))
  ((24) (ch-pr 1))
  ((25) (ch-pr 0)))

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

using namespace std;

typedef long long LL;
const int maxn = 107;
const int maxm = maxn * maxn * 20;
const LL Inf = 1e18;
struct Edge{
	int to,last;
	LL res;
}E[maxm];
int cnt = 1;
int S,T;
int n;
LL sum;
int d[maxn];
int H[maxn];
int a[maxn];
int head[maxn];
int Bfs(){
	memset(d,0,sizeof d);
	d[S] = 1;queue<int>q;
	q.push(S);
	while(q.size()){
		int x = q.front();q.pop();
		for(int i = head[x],y; y = E[i].to,i; i = E[i].last){
			if(E[i].res && !d[y])d[y] = d[x] + 1,q.push(y);
		}
	}
	return d[T];
}
LL Dfs(int x,LL flow){
	if(x == T || !flow)return flow;
	LL tmp = flow;
	for(int& i = H[x],y; y = E[i].to,i; i = E[i].last){
		if(d[y] == d[x] + 1){
			LL a = Dfs(y,min(flow,E[i].res));
			E[i].res -= a;E[i ^ 1].res += a;
			flow -= a;
			if(!flow)break;
		}
	}
	return tmp - flow;
}
void Adde(int x,int y,LL z){
	E[++cnt] = (Edge){y,head[x],z};
	head[x] = cnt;
	E[++cnt] = (Edge){x,head[y],0};
	head[y] = cnt;
}
LL Dinic(){
	LL re = 0;
	while(Bfs())memcpy(H,head,sizeof head),re += Dfs(S,Inf);
	return re;
}
int main(){
	scanf("%d",&n);
	S = n + 1,T = S + 1;
	for(int i = 1; i <= n; ++i){
		scanf("%d",&a[i]);
		if(a[i] < 0)Adde(i,T,-a[i]);
		else Adde(S,i,a[i]),sum += a[i];
	}
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j < i; ++j)
			if(i % j == 0)Adde(i,j,Inf);
	printf("%lld\n",sum - Dinic());
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException{
		InputReader in = new InputReader(System.in);
		
		while (true) {
			int height = in.readInt();
			int width = in.readInt();
			if (height == 0 && width == 0) break;
			
			StringBuffer sBuffer = new StringBuffer(width);
			for (int j = 0; j < width; j++) {
				sBuffer.append("#");
			}
			for (int i = 0; i < height; i++) {
				System.out.println(sBuffer.toString());
			}
			System.out.println();
		}
	}
}

class InputReader{
	private BufferedReader br;
	private StringTokenizer buffer = null;	
	
	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));				
	}

	public String read() throws IOException {
		while(buffer == null || !buffer.hasMoreTokens()) {
			buffer = new StringTokenizer(br.readLine());
		}
		return buffer.nextToken();
	}
	
	public int readInt() throws IOException {
		while(buffer == null || !buffer.hasMoreTokens()) {
			buffer = new StringTokenizer(br.readLine());
		}
		return Integer.parseInt(buffer.nextToken());
	}
}


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

int main(){
    int N,T,A;

    cin >> N;
    cin >> T >> A;

    int x[N];
    double diff[N];
    double min_diff = 9999999.0;
    int ans;

    for(int i=0; i<N; i++){
        cin >> x[i];
        diff[i] = abs(A-(T - 0.006*float(x[i])));
        if(diff[i]<min_diff){
            min_diff = min(diff[i],min_diff);
            ans = i;
        }
    }

    cout << ans+1 << endl;
    
    return 0;

}

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

using namespace std;

int main(void){
  char a[3],b[3];
  int count = 0;
  cin >> a >> b;
  for(int i=0;i<3;i++){
    if(a[i]==b[i]) count++;
  }
  cout << count;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
string alp="abcdefghijklmnopqrstuvwxyz";

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

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    set<ll> s;
    map<ll,ll> m;
    rep(i,N){
        cin >> A[i];
        m[A[i]]++;
        s.insert(A[i]);
    }
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    ll ans=0;
    rep(i,N){
        if (m[A[i]]>0){
            m[A[i]]--;
            if (m[A[i]]==0){
                s.erase(A[i]);
            }
            ll j=1;
            while(true){
                if ((ll)pow(2,j)>A[i]){
                    break;
                }
                else {
                    j++;
                }
            }
            ll x=pow(2,j)-A[i];
            if (s.count(x)){
                ans++;
                m[x]--;
                if (m[x]==0){
                    s.erase(x);
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 23680
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProblemC
{
    class Program
    {
        static void Main(string[] args)
        {
            var read = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = read[0];
            var M = read[1];
            var Q = read[2];

            var abcds = new List<int[]>();

            for (int i = 0; i < Q; i++)
            {
                read = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                abcds.Add(read);
            }
            int maxScore = 0;
            var A_array = new int[N];
            GetMaxScore(N, M, abcds, 1, 0, ref maxScore, ref A_array);
            Console.WriteLine(maxScore);

        }

        static void GetMaxScore(int N, int M, List<int[]> abcds, int prev, int index, ref int maxScore, ref int[] A_array)
        {
            if(index + 1 == N)
            {
                for (int i = prev; i <= M; i++)
                {
                    A_array[index] = i;
                    maxScore = Math.Max(maxScore, CalcScore(A_array, abcds));
                }
            }
            else
            {
                index++;
                for (int i = prev; i <= M; i++)
                {
                    A_array[index - 1] = i;
                    GetMaxScore(N, M, abcds, i, index, ref maxScore, ref A_array);
                }
            }
        }

        static int CalcScore(int[] A_array, List<int[]> abcds)
        {
            int score = 0;
            foreach (var abcd in abcds)
            {
                if (A_array[abcd[1] - 1] - A_array[abcd[0] - 1] == abcd[2])
                    score += abcd[3];
            }
            return score;
        }

    }
}


Measured memory_bytes: 28284
#include<bits/stdc++.h>
#define lf double
#define ll long long
#define ii pair<int,int>
#define li pair<ll,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define pll pair<ll,ll>
#define ld long int
#define heap priority_queue
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(),x.end()
#define len(x) strlen(x)
#define sz(x) (int) x.size()
#define orta ((bas+son)/2)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000007
#define inf 1000000000
#define N 100005
#define LOG 17
#define M 2000000
#define EPS 0.000001
using namespace std;

int la,ls;
string res,les,ans,a,s;

string ar(int x) {

	string res;
	for(int i=0;i<=ls;i++) {
		if(i<x || i>(x+la)) {
			if(s[i]=='?') {
				res.pb('a');
			}
			else {
				res.pb(s[i]);
			}
		}
		else {
			res.pb(a[i-x]);
		}
	}
	return res;

}

string solve(int x) {

	int tut=0;
	for(int i=x;i<=ls;i++) {
		if(tut>la) {
			return ar(x);
		}
		if(s[i]=='?' || s[i]==a[tut]) {
			tut++;
		}
		else {
			return les;
		}
	}
	if(tut>la) return ar(x);
	return les;

}

int main() {

	for(int i=0;i<=55;i++) les.pb('z');
	ans=les;
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>s>>a;
	ls=sz(s)-1;
	la=sz(a)-1;
	for(int i=0;i<=ls;i++) {
		ans=min(ans,solve(i));
	}
	if(ans==les) {
		cout<<"UNRESTORABLE";
	}
	else {
		cout<<ans;
	}
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	string str;
    
    cin >> str;
    
    if (str.length() > 3) {
        cout << "No\n";
		return -1;
    }
    
	if (str[0] == str[1] || str[1] == str[2] || str[0] == str[2]) {
		cout << "No\n";
	}
	else {
		cout << "Yes\n";
	}
    return 0;
}

Measured memory_bytes: 256
n = gets.to_i

as = Array.new(10) { Array.new(10, 0) }

1.upto(n) do |i|
  x = i.to_s[0].to_i
  y = i.to_s[-1].to_i

  as[x][y] += 1
end

sum = 0

1.upto(9) do |i|
  1.upto(9) do |j|
    sum += as[i][j] * as[j][i]
  end
end

p sum



Measured memory_bytes: 1788
#pragma GCC optimize("Ofast") 
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define owo ios_base::sync_with_stdio(0);cin.tie(0);
#define INF (ll)(1e18)
#define MOD (ll)(1e9+7)
#define debug(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define time__(d) for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false);\
debug("%s time : %.4fs\n", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> PII;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;
typedef vector<vector<ll>> VII;
ll gcd(ll a,ll b){if(!b)return a;else return gcd(b,a%b);}
vector<ll> fact;
vector<ll> ifact;
ll add(ll a,ll b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
ll mult(ll a,ll b)
{
	return (a*1LL*b)%MOD;
}
ll binpow(ll a, ll b)
{
	ll r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
ll choose(ll a, ll b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	ll r = mult(ifact[b],ifact[a-b]);
	r = mult(r,fact[a]);
	return r;
}
ll inv(int a){return binpow(a,MOD-2);}
void init(ll n)
{
	fact.clear(); ifact.clear();
	fact.resize(n+1);
	ifact.resize(n+1);
	ifact[0]=1;
	fact[0]=1;
	for(int i=1;i<=n;i++){fact[i]=mult(fact[i-1],i);}
	ifact[n] = inv(fact[n]);
	for(int i=n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
}
ll rchoose(ll n,ll r){
	ll res = 1;
	for(int i=0;i<r;i++)res = mult(res,n-i);
	return res;
}
ll dp[2001];
int main()
{
	ll s;
	cin>>s;
	init(s);
	if(s<3)cout<<0<<'\n';
	else{
		dp[3] = 1;
		dp[0] = 1;
		for(int i=4;i<=s;i++){
			for(int j=0;i-j>=3;j++){
				dp[i]+=dp[j];
				dp[i]%=MOD;
			}
			
		}
		cout<<dp[s];
	}
}


Measured memory_bytes: 3676
#include <iostream>

bool isBuyable(int price, int moneyInHand);

int main() {
    int price = 0;
    int numOfOneYen = 0;
    std::cin >> price >> numOfOneYen;
    static const int INFINITE_COIN_YEN = 500; 
    
    int lastPrice = price % INFINITE_COIN_YEN;
    if (isBuyable(lastPrice, numOfOneYen)) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}
 
bool isBuyable(int price, int moneyInHand) {
    return moneyInHand >= price;
}

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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; }


int main()
{
    string s;
    cin >> s;
    
    int ans = 700;
    rep(i,3)
    {
        if( s[i] == 'o' ) ans += 100;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long i,j,t,n,k;
  cin>>n>>k;
  long long a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  t=0;
  for(i=0;i<k;i++)
    t+=a[i];
  cout<<t;
}

Measured memory_bytes: 3632
N, M, C = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
A = []

for i in range(0, N):
    A.append([int(i) for i in input().split()])

count = 0

for a in A:
    result = C
    for i in range(0, M):
        result += a[i] * B[i]
    if result > 0:
        count += 1

print(count)

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

int main(){

    int n, m, x, y;
    cin >> n >> m >> x >> y;

    vector<int> xx(n);
    vector<int> yy(m);

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

        cin >> xx[i];

    }

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

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

        cin >> yy[i];

    }

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

    if(xx[n-1] < yy[0] && xx[n-1] < y && x < yy[0])cout << "No War" << endl;
    else cout << "War" << endl;

    return 0;

}

Measured memory_bytes: 256
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define scan(n,v) v.resize(n); rep(i,n){ cin>>v[i];}
#define lim 1000000007ll
#define Yes(flag) cout<<((flag)? "Yes":"No");
#define YES(flag) cout<<((flag)? "YES":"NO");
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
template<class T>T 
chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T>T 
chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template <class T> T 
gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T 
lcm(T a, T b){return a * b / gcd(a, b);}

// header
string s;
void input(){
    cin>>s;
}
void src(){
    if(
    (
    (s.find('N')==string::npos and s.find('S')==string::npos )
    and (s.find('E')!=string::npos and s.find('W')!=string::npos )
    ) or
    (
    (s.find('N')!=string::npos and s.find('S')!=string::npos )
    and (s.find('E')==string::npos and s.find('W')==string::npos )
    ) or
    (
    (s.find('N')!=string::npos and s.find('S')!=string::npos )
    and (s.find('E')!=string::npos and s.find('W')!=string::npos )
    )){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}   
int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
 //   ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

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

  i64 N, R;
  cin >> N >> R;
  i64 D = max(0LL, 100 * (10 - N));
  cout << R + D << endl;

  return 0;
}


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

unsigned long long calcGCD(unsigned long long x, unsigned long long y)
{
    if (x < y)
    {
        swap(x, y);
    }
    unsigned long long remainder = x % y;
    while (remainder != 0)
    {
        x = y;
        y = remainder;
        remainder = x % y;
    }
    return y;
}

unsigned long long calcMultiGCD(std::vector<unsigned long long> x)
{
    if (x.size() < 2)
    {
        if (x.size() == 1)
        {
            return x[0];
        }
        else
        {
            return 0;
        }
    }

    unsigned long long gcd = calcGCD(x[0], x[1]);
    for (unsigned long long i = 2; i < x.size(); i++)
    {
        gcd = calcGCD(gcd, x[i]);
    }
    return gcd;
}

unsigned long long calcLCM(unsigned long long x, unsigned long long y)
{
    if (x < y)
    {
        swap(x, y);
    }
    unsigned long long ret = x / calcGCD(x, y);
    return ret * y;
}

unsigned long long calcMultiLCM(std::vector<unsigned long long> x)
{
    if (x.size() < 2)
    {
        if (x.size() == 1)
        {
            return x[0];
        }
        else
        {
            return 0;
        }
    }

    unsigned long long lcm = calcLCM(x[0], x[1]);
    for (unsigned long long i = 2; i < x.size(); i++)
    {
        lcm = calcLCM(lcm, x[i]);
    }
    return lcm;
}

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

    vector<unsigned long long> T(N);
    for (int i = 0; i < N; i++)
    {
        cin >> T[i];
    }

    cout << calcMultiLCM(T) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	char c;
	while((c=getchar())!='\n' && c!=EOF) {
		if(c>='a' && c<='z')
			printf("%c",c-'a'+'A');
		else
			printf("%c",c);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

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

		while(true){
			input=sc.nextLine().split(" ");
			int H = Integer.parseInt(input[0]);
			int W = Integer.parseInt(input[1]);
			if(H==0 && W==0){
				break;
			}
			for(int in1=0;in1<H;in1++){
				for(int in2 = 0;in2<W;in2++){
					if(in1%2==0){
						if(in2%2==0){
							System.out.print("#");
						}else{
							System.out.print(".");
						}
					}else{
							if(in2%2==0){
								System.out.print(".");
							}else{
								System.out.print("#");
							}
						
					}
					if(in2==W-1){
						System.out.println();
					}
				}
			}
			System.out.println();
		}
	}
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;


while(x != NIL){
    y = x;
    if (z->key < x->key){
      x = x->left;
    } else{
      x = x->right;
    }
  }

  z->parent = y;
  if (y == NIL){
    root = z;
  } else{
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }

}

void inorder(Node u){
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);

}
void preorder(Node u){
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
     if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



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

typedef long long ll;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18


int main() {
    int N,i; cin >> N >> i;
    cout << N-i+1 << endl;
    return 0;
}

Measured memory_bytes: 3576
n, m =map(int, input().split())
H=list(map(int, input().split()))
cnt=[0]*n

for i in range(m):
	a, b = map(int, input().split())
	if H[a-1]>H[b-1]:
		cnt[b-1]+=1
	elif H[b-1]>H[a-1]:
		cnt[a-1]+=1
	else:
		cnt[a-1]+=1
		cnt[b-1]+=1

print(cnt.count(0))

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

int main() {
	int N;
	cin>>N;
	vector<int> row(N);
	for(int i=0;i<N;i++){
		cin>>row[i];
	}
	sort(row.begin(),row.end());
	reverse(row.begin(),row.end());
	long long ans=1,X=0;
	for(int i = 0 ; i < N ; i++){
		X += row[i];
	}
	for(int i=0;i<N-1;i++){
			X-=row[i];
			if(X*2>=row[i]){
			ans++;
			}else
			break;
		}
	cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
  int N, A;
  cin >> N >> A;
  if (N % 500 <= A) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    int ans=0;
    rep(i,0,5){
        int a;
        cin >> a;
        if(a==0){
            ans = i;
        }
    }
    cout << ans+1 << endl;
  return 0;
}

Measured memory_bytes: 3568
#include "bits/stdc++.h"

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int A,B,ans;
    cin >> A >> B;
    ans=max(A+B,A-B);
    ans=max(ans,A*B);
    P(ans);
}

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

#define mp make_pair
#define pb push_back

#define int int64_t

const int MOD = 1e9+7;
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,p;
    cin>>n>>p;
    string s;
    cin>>s;
    vector<int> pre(n+1);
    pre[0]=0;
    vector<int> arr(p, 0);
    arr[0]++;
    if(p==2||p==5) {
        int ans=0;
        for(int i=0;i<n;i++) {
            if((s[i]-'0')%p==0) {
                ans+=(i+1);
            }
        }
        cout<<ans;
        return 0;
    }
    int k=0;
    int t=1;
    for(int i=n-1;i>=0;i--) {
        k+=(s[i]-'0')*t;
        k%=p;
        //cout<<k<<"\n";
        arr[k]++;
        t*=10;
        t%=p;
    }   

    int ans=0;
    for(int i=0;i<p;i++) {
        ans+=((arr[i]*(arr[i]-1))/2);
    }

    cout<<ans;

    return 0;
}


Measured memory_bytes: 2196
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int n;
int ans;
int a[100005];
int gcd(int a,int b){
	return a%b?gcd(b,a%b):b;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	ans=a[1];
	for(int i=1;i<n;i++)
		ans=1ll*ans*gcd(a[i+1],i)%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 768
def solve(a, n):
    vmax = 10000
    ans = 0
    all_min = min(a)
    b = sorted(a)
    v = [False] * n

    t = {}
    for i in range(n):
        t[b[i]] = i
    for i in range(n):
        if v[i]:
            continue
        cur = i
        w_sum = 0
        w_min = vmax
        an = 0
        while True:
            v[cur] = True
            an += 1
            v_cur = a[cur]
            w_min = min(w_min, v_cur)
            w_sum += v_cur
            cur = t[v_cur]
            if v[cur]:
                break
        ans += min(w_sum + (an-2) * w_min, w_min + w_sum + (an+1) * all_min)

    return ans


n = int(input())
a = [int(v) for v in input().split()]

ans = solve(a, n)
print(ans)


Measured memory_bytes: 5720
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INF = 2147483647;
const double PI = 3.14159265358979323846;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main(){
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int k, i, j, h, w, cnt;
	cin >> h >> w;
	vector2d(mp, char, h, w, 0);
	vector2d(flag, bool, h, w, false);
	for (i = 0; i < h; i++){
		string tmp;
		cin >> tmp;
		for (j = 0; j < w; j++) mp[i][j] = tmp[j];
	}
	for (k = 0; k < h; k++){
		for (i = 0; i < w; i++){
			if (mp[k][i] == '#') break;
		}
		if (i == w){
			for (i = 0; i < w; i++){
				flag[k][i] = true;
			}
		}
	}
	for (k = 0; k < w; k++){
		for (i = 0; i < h; i++){
			if (mp[i][k] == '#') break;
		}
		if (i == h){
			for (i = 0; i < h; i++){
				flag[i][k] = true;
			}
		}
	}
	for (i = 0; i < h; i++){
		cnt = 0;
		for (j = 0; j < w; j++){
			if (flag[i][j] == false){
				cout << mp[i][j];
				cnt++;
			}
		}
		if (cnt != 0) cout << endl;
	}
	return 0;
}


Measured memory_bytes: 256