akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

"""
参考：https://qiita.com/drken/items/03c7db44ccd27820ea0d
・メモ化再帰でもやってみる。
"""

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()
nodes = [[] for i in range(N)]
edges = [None] * M
for i in range(M):
    x, y = MAP()
    nodes[x-1].append(y-1)
    edges[i] = ((x-1, y-1))

memo = [-1] * N
# メモ化再帰
def dfs(cur):
    if memo[cur] != -1:
        return memo[cur]
    mx = 0
    for dest in nodes[cur]:
        mx = max(mx, dfs(dest)+1)
    memo[cur] = mx
    return mx

ans = 0
for i in range(N):
    # メモはグローバルに持っているので、
    # 全ノードについてdfsしても無駄に潜ることはない。
    ans = max(ans, dfs(i))
print(ans)


Measured memory_bytes: 74516
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
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() {
  string s;
  cin >> s;
  cout << (s[0] == s[2] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3588
n = int(input())
a = list(map(int, input().split()))
la = len(a)
res = [0] * la
s = 0
l = la - 1
if la % 2 == 0:
    for i in range(la)[::-1]:
        if i % 2 != 0:
            res[s] = a[i]
            s += 1
        else:
            res[l] = a[i]
            l -= 1
else:
    for i in range(1, la)[::-1]:
        if i % 2 == 0:
            res[s] = a[i]
            s += 1
        else:
            res[l] = a[i]
            l -= 1
    res[s] = a[0]
print(" ".join([str(i) for i in res]))

Measured memory_bytes: 29732
#include<stdio.h>
#include<string>
#include<iostream>
#include<math.h>
using namespace std;

int main(void) {
	int N;
	cin >> N;
	if (N == 1 || N == 2)cout << 0 << endl;
	else cout << N / 3 << endl;

    return 0;

}

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


int main(void){
  long long a,j=0;
  long long i=10;
  cin>>a;
  if(a%2!=0)cout<<0<<endl;
  else{
      j+=a/i;
    while(i<=a){
      i*=5;
      j+=a/i;

    }
  cout<<j<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

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

Measured memory_bytes: 256
import sys

l = [2 ** i for i in range(10)]
for line in sys.stdin:
	blist = list(bin(int(line))[2:])
	blist.reverse()
	#print(blist)
	anslist = []
	for i in range(len(blist)):
		if blist[i] == "1":
			anslist.append(str(l[i]))
	print(' '.join(anslist))

Measured memory_bytes: 7628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		System.out.println(n * (n - 1) / 2 + m * (m - 1) / 2);
	}
}

Measured memory_bytes: 35336
#include<iostream>
using namespace std;
int main(){
  int N;
  cin >> N;
  long long A[N];
  for(int i=0;i<N;i++)cin >> A[i];
  long long B[200100]={0};
  for(int i=0;i<N;i++){
    int c=i+1-A[i];
    if(c<=0)continue;
    B[c]++;
  }
  long long count=0;
  for(int i=0;i<N;i++){
    int b=i+1+A[i];
    if(b<200100) count+=B[b];
  }
  cout << count << endl;
}

Measured memory_bytes: 6768
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <chrono>
#include <random>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define tisic 47
#define soclose 1e-8
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
using uint = unsigned int;
using cat = long long;
using dbl = long double;
constexpr dbl pi = 3.14159265358979323846;
using namespace std;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(10);
	int N, M;
	cin >> N >> M;
	cat mod = 1000000007;
	vector<cat> cnt(M+1, 0);
	for(int i = 1; i <= M; i++) cnt[i] = 1;
	vector<cat> pw(M+1, 1), pw_inv(M+1, 1);
	for(int i = 1; i <= M; i++) pw[i] = 2 * pw[i-1] % mod;
	cat inv = (mod+1)/2; // 2*inv % mod == 1
	for(int i = 1; i <= M; i++) pw_inv[i] = inv * pw_inv[i-1] % mod;
	for(int i = 0; i < N; i++) {
		vector<cat> cnt_nw(M+1, 0);
		cat s = 0;
		for(int j = 1; j <= M; j++) {
			s += cnt[j-1] * pw_inv[j-1] % mod * (j-1);
			cnt_nw[j] = (s % mod * pw[j-1] + cnt[j] * (j+1)) % mod;
		}
		cnt = cnt_nw;
	}
	cout << cnt[M] << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 3768
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll q, h, s, d, n;
	cin >> q >> h >> s >> d >> n;
	ll ans = q * n * 4;
	chmin(ans, h*n*2);
	chmin(ans, s*n);
	chmin(ans, (n/2)*d + (n%2)*min({q*4,h*2,s}));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 410000;

int n,m=800;

int fa[maxn];
int findfa(const int x){return fa[x]==x?x:fa[x]=findfa(fa[x]);}

int d[maxn],v[maxn],ok[maxn];

int main()
{
	scanf("%d%*d",&n);
	for(int i=1;i<m;i++) fa[i]=i;
	for(int i=1;i<=n;i++)
	{
		int a,b,c,D,l,r; scanf("%d%d%d%d",&a,&b,&c,&D);
		l=!c?a:-c;
		r=!D?-b:D;
		l+=400,r+=400;
		d[l]++,d[r]--; v[l]=v[r]=1;
		fa[findfa(l)]=findfa(r);
	}
	for(int i=1;i<=400;i++) if(d[i]>0) return puts("NO"),0;
	for(int i=400;i<m;i++)  if(d[i]<0) return puts("NO"),0;
	
	for(int i=1;i<m;i++) if(d[i]) ok[findfa(i)]=1;
	for(int i=1;i<m;i++) v[findfa(i)]|=v[i];
	
	for(int i=1;i<m;i++) if(i==findfa(i)&&v[i]&&!ok[i]) 
		return puts("NO"),0;
	puts("YES");
	
	return 0;
}


Measured memory_bytes: 4352
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
a=list(map(int,input().split()))
ans=0
g=lcm_list(a)-1
for i in a:
    ans+=g%i
print(ans)

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

//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long

using namespace std;

const int NN = 1e6 + 7;
const int N = 2e5 + 7;
const int M = 20;
const ll mod = 1e9 + 7;
const ll inf = 1e18 + 7;

void solve1()
{
	int n, m, s = 0;
	cin >> n >> m;
	for(int i = 1; i < n; i++)
		s += i;
	for(int i = 1; i < m; i++)
		s += i;
	cout << s;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 256
def iread():
    return int(input())


def sread():
    return input()


def aread_int():
    tmp = input().split()
    ret = [int(i) for i in tmp]
    return ret


def aread_str():
    return input().split()


if __name__ == '__main__':
    nums = aread_int()
    if (nums[0] + nums[1]) % 2:
        print("IMPOSSIBLE")
    else:
        ans = int(((nums[0] + nums[1]) / 2))
        print(ans)

Measured memory_bytes: 3060
nv,ne = [int(i) for i in input().split()]

g = [[] for i in range(nv)]

for i in range(ne):
    s,t = [int(j) for j in input().split()]
    g[s].append(t)

visited = []
f = 0

def pursue_from(index, origin):

    if visited[index]:
        return

    visited[index] = True

    for next_index in g[index]:

        if next_index == origin:
            global f
            f = 1
            return
        pursue_from(next_index, origin)

for i in range(nv):
    visited = [False for i in range(nv)]

    pursue_from(i, i)

    if f == 1:
         break

print(f)



Measured memory_bytes: 5620
#include <bits/stdc++.h>
 
//BIAR MANTAB LAH YA
#define Willy using
#define Indrayana namespace
#define Komara std
 
Willy Indrayana Komara;

using ll = long long int;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] - '0' == 7)
        {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

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

int main(){
    int N,M;cin>>N>>M;
    vector<int> lst(N,0);
    int ans_wa=0,ans_ac=0;
    rep(i,M){
        int p;
        string ans;
        cin>>p>>ans;p--;
        if(lst[p]==1)continue;
        if(ans == "WA"){
            ans_wa++;
            lst[p]--;
        }else{
            ans_ac++;
            lst[p]=1;
        }
    }
    rep(i,N){
        if(lst[i]<0){
            ans_wa-=abs(lst[i]);
        }
    }
    cout<<ans_ac<<' '<<ans_wa<<endl;
    return 0;
}
/*
WAし続けて、結局ACしなかった問題はWAを数えないというルールを忘れていた。
アホすぎぃ！
*/

Measured memory_bytes: 640
s = gets.chomp
slast = s.length
lpoint = []
result = []
s.length.times do |i|
  lpoint[i] = -1
  result[i] = 0
end

i = 0
lp = 0
lefti = 0
lefts = "R"
s.each_char do |si|
  if (lefts == "R" && si == "L")
    lp = i
  end
  if (lefts == "L" && si == "R" )
    lefti.upto(i-1) do |li|
      lpoint[li] = lp
    end
    lefti = i
  end
  lefts = si
  i += 1
  if (i == slast)
    lefti.upto(i-1) do |li|
      lpoint[li] = lp if lpoint[li] == -1
    end
  end
end

s.length.times do |si|
  lp = lpoint[si]
  cost = (lp - si)%2
  if cost == 0
    result[lp] += 1
  else
    result[lp-1] += 1
  end
end
puts result.join(" ")

Measured memory_bytes: 4076
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
	ll N,K; cin >> N >> K;
	ll now = 1;
	int ans = 0;
	while(now <= N){
		ans++;
		now *= K;
	}
	cout << ans << endl;

}



Measured memory_bytes: 256
// BEGINNING WITH THE NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin >> a >> b;
  (a+b > 9) ? cout<<"error": cout<<a+b;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>
#include <tuple>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

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

int main()
{
	FAST;

    int n; // <= 100
    cin >> n;

	int x[n], y[n];
	int h[n];
 
	rep(i,n) cin >> x[i] >> y[i] >> h[i];
 
    int index = -1;
    // hが1以上の点を1点もとめる
    for (int i = 0; i < n; i++) {
        if(h[i] > 0) {
            index = i;
            break;
        }
    }
 
    for (int cx = 0; cx <= 100; cx++) {
        for (int cy = 0; cy <= 100; cy++) {
            bool isTop = true;
            // 代表点と比較して中央の高さを決定
            int ch;
            if (index != -1) {
                ch = h[index] + abs(cx-x[index]) + abs(cy-y[index]);
            } else {
                ch = 1;
            }
            for (int i = 0; i < n; i++) {
                if (h[i] != max(ch - abs(cx-x[i]) - abs(cy-y[i]), 0)) {
                    isTop = false;
                    break;
                }
            }
 
            if(isTop) {
                cout << cx << " " << cy << " " << ch << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<string>
#include<set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<n; i++)
#define per(i, n) for(int i=n-1; i>=0; i--)
#define reps(i, n) for(int i=1; i<n; i++)
#define pers(i, n)  for(int i=n-1; i>=1; i--)

const int INF = 1001001001;

void solve(){
  int k, n; cin >> k >> n;
  vector<int> vi(n);
  int ma = 0;
  cin >> vi[0];
  reps(i, n){
    cin >> vi[i];
    ma = max(ma, vi[i]-vi[i-1]);
  }
  ma = max(ma, k+vi[0]-vi[n-1]);
  cout << k-ma << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main() {
  int k;
  string s;
  cin >> k >> s;
  if (s.size() <= k) {
    cout << s << endl;
  }
  else {
    cout << s.substr(0, k) << "..." << endl;
  }
  return(0);
}


Measured memory_bytes: 3632
import sys
s = input()
a = 'qwertyuiopasdfghjklzxcvbnm'
for i in a:
    for n in range(len(s)-1):
        if i+i == s[n:n+2]:
            print(n+1,n+2)
            sys.exit()
    for n in range(len(s)-2):
        if i == s[n] and i == s[n+2]:
            print(n+1,n+3)
            sys.exit()
print(-1,-1)

Measured memory_bytes: 3316
def main():
    import sys
    input = sys.stdin.buffer.readline
    N, K = map(int, input().split())
    A = list(map(lambda x: int(x)-1, input().split()))
    now = 0
    dict_ = {}
    stack = []
    for i in range(N):
        if now not in dict_:
            dict_[now] = A[now]
            stack.append(now)
            now = A[now]
        else:
            idx = stack.index(now)
            mod = i - idx
            break
    idx = idx + (K-idx) % mod
    idx = min(K, idx)
    print(stack[idx]+1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 36964
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = -100100100;
typedef pair<int,int> P;

int main(){
    ll n,k;
    ll ans;
    cin >> n >> k;
    n%=k;
    ans = min(n, abs(n-k));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
  string input;
  cin >> input;
  if(input.at(2)==input.at(3)&&input.at(4)==input.at(5))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

bool pal(string s)
{
    for (int i = 0; i < s.size(); ++i)
        if (s[i] != s[s.size() - i - 1])
            return false;
    return true;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n = s.size() / 2;
    string z = s.substr(0, n);
    string w = s.substr(n + 1);
    if (pal(z) && pal(w) && pal(s))
        cout << "Yes";
    else
        cout << "No";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
	int n;
	int sol[3];
	cin >> n;
	int a[n][3];
	for(int i=0; i<n; i++) {
		for(int j=0; j<3; j++) {
			cin >> a[i][j];
		}
	}
	for(int i=0; i<3; i++) {sol[i] = 0;}
	for(int i=0; i<n; i++) {
		int temp0 =  a[i][0] + max (sol[1] , sol[2]);
		int temp1 =  a[i][1] + max (sol[0] , sol[2]);
		int temp2 =  a[i][2] + max (sol[0] , sol[1]);
		sol[0] = temp0;
		sol[1] = temp1;
		sol[2] = temp2;
	}
	cout << max(sol[0], max(sol[1],sol[2]));
	return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str;
        int a,i;
        int[] x,y;
        double ans,m;
        str = scan.nextLine();
        a = Integer.valueOf(str);
        x = new int[a];
        y = new int[a];
        ans = 0;
        str = scan.nextLine();
        String[] num1 = str.split(" ", 0);
        for(i=0;i<a;i++){
            x[i] = Integer.valueOf(num1[i]);
        }
        str = scan.nextLine();
        String[] num2 = str.split(" ", 0);
        for(i=0;i<a;i++){
            y[i] = Integer.valueOf(num2[i]);
        }
        for(i=0;i<a;i++){
            ans += Math.abs(x[i]-y[i]);
        }
        System.out.println(ans);
        ans = 0;
        for(i=0;i<a;i++){
            ans += Math.pow(Math.abs(x[i]-y[i]), 2);
        }
        System.out.println(Math.sqrt(ans));
        ans = 0;
        for(i=0;i<a;i++){
            ans += Math.pow(Math.abs(x[i]-y[i]), 3);
        }
        System.out.println(Math.cbrt(ans));
        ans = 0;
        for(i=0;i<a;i++){
            if(Math.abs(x[i]-y[i])>ans){
                ans = Math.abs(x[i]-y[i]);
            }
        }
        System.out.println(ans);
        scan.close();
    }
}



Measured memory_bytes: 26484
<?php
	$result = array();
	while(true) {
		$stdin = trim(fgets(STDIN));
		if ($stdin == 0) break;

		$result[] = $stdin;
	}

	foreach($result as $key => $value) {
		echo "Case " . ++$key . ": " . $value . PHP_EOL;
	}

Measured memory_bytes: 16748
a,b=map(int,input().split())

if (a>0 and b<0) or (a<0 and b>0):
  ans="Zero"
elif a==0 or b==0:
  ans="Zero"
elif a>0 and b>0:
  ans="Positive"
elif a<0 and b<0:
  if (a%2==0 and b%2==0) or (a%2!=0 and b%2!=0):
    ans="Negative"
  else:
    ans="Positive"
    
print(ans)


Measured memory_bytes: 9068
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <fstream>
#include<cstdio>
#include<iomanip>

#define REP(i, n) for(int i=0;i<n;i++)
#define REP_1(i, n) for(int i=1;i<n+1;i++)
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef long double ld;


int main() {
    int a, b, c;
    cin >> a >> b >> c;
    a = a % b;
    bool ans = false;
    REP(i, b) {
        int e = a * i;
        if (e % b == c) {
            ans = true;
            break;
        }
    }
    if (ans) { cout << "YES" << endl; }
    else { cout << "NO" << endl; }
}

Measured memory_bytes: 256
import collections
import numpy as np

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())

c = collections.Counter(prime_factorize(N))
X = np.array([])
for i in c.values():
    X = np.append(X,i)

ans = 0

for i in range(1,10**6):
    if len(X) == 0:
        print(ans)
        exit()
    X -= i
    X = X[X>=0]
    ans += len(X)


Measured memory_bytes: 27168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5+7;
const int INF = 1e9+7;
const double eps = 1e-5;
#define pb push_back

int main(){
    int n, m, a[MAX];
    cin >> n >> m;
    int sum = 0;
    for(int i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }
    int g;
    if(sum % 4*m == 0){
        g = sum/(4*m);
    }
    else{
        g = (sum/(4*m))+1;
    }
    sort(a, a+n);
    reverse(a, a+n);
    int s = 0;
    for(int i = 0;i < n;i++){
        if(a[i] >= g){
            s++;
        }
    }
    if(s >= m)
        cout << "Yes\n";
    else
        cout << "No\n";


}
/*

*/


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

public class Main {
    
    public static void solve(){
        Scanner scan = new Scanner(System.in);
        String expression;
        
        expression = scan.nextLine();
        String[] symbols = expression.split(" ");
        Stack<Integer> operands = new Stack<Integer>();
        
        for(String s: symbols){
            if(s.equals("+")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b + a;
                operands.push(res);
            }else if(s.equals("-")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b - a;
                operands.push(res);
            }else if(s.equals("*")){
                int a = operands.pop();
                int b = operands.pop();
                int res = b * a;
                operands.push(res);
            }else{
                int x = (int)Integer.parseInt(s);
                operands.push(x);
            }
        }
        int x = operands.pop();
        System.out.println(x);
    }
    
    public static void main(String[] args) {
        solve();
    }
    
}



Measured memory_bytes: 26264
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>

using namespace std;
const int N = 1e6 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1LL << 57;
const int LN = 22;
const int SN = 320;

long long n, m, u, v, k, t, q, x, d, p, a, b, c, s;

string sa, sb;
int arr[N], cnt[N];
int main() {
   ios::sync_with_stdio(false);cin.tie(0);
   cin >> n;
   cout << n * (n - 1LL) / 2LL << endl;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, K: int, S: str):
    s = list(S)
    s[K-1] = {"A": "a", "B": "b", "C": "c"}[s[K-1]]
    return ''.join(s)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    result = solve(N, K, S)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5948
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n=0,d=0) Array.new(n,d)end
def na2(n=0,m=0,d=0) Array.new(n){Array.new(m,d)}end
def na3(n=0,m=0,l=0,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.chomp.split(" ").map(&:to_i)end
a,b,c = inp
if(c <= b and a<=c)
  puts "Yes"
else
  puts "No"
end

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

int main(){
    int height, width;
    cin >> height >> width;

    while(height!=0 || width!=0){
        for(int i=1; i<=height; i++){
            for(int j=1; j<=width; j++){
                if(j==1 || j==width || i==1 || i==height){
                    cout << "#";
                } else {cout << ".";
                }
            }
                cout << endl;
            }
        cout << endl;
        cin >> height >> width;
    }

    return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  int A, B, M;
  cin >> A >> B >> M;
  vector<int> a(A), b(B);
  for (int i = 0; i < A; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < B; i++) {
    cin >> b[i];
  }

  vector<int> x(M), y(M), c(M);
  for (int i = 0; i < M; i++) {
    cin >> x[i] >> y[i] >> c[i];
    x[i]--;
    y[i]--;
  }

  ll ans = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());
  for (int i = 0; i < M; i++) {
    ll tmp = a[x[i]] + b[y[i]] - c[i];
    if (ans > tmp) {
      ans = tmp;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		Integer a = sc.nextInt() % 500;
		if ( a > sc.nextInt()) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}


	}

}


Measured memory_bytes: 35820
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
S = []
c = 0
s = sum(A)
table = [0] * 100001
 
for i in A:
    table[i] += 1
 
for i in range(Q):
    B, C = map(int,input().split())
    c = table[B]
    s += (C - B) * c
    table[C] += table[B]
    table[B] = 0
    S.append(s)

for s in S:
    print(s)


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

int main() {
  int a,b,c;
  cin >> a >>b>>c;

  if (a*b > c) {
  int x=c;
  cin >> x ;
    cout << c <<endl;
    
  }
  else {
    int x=a*b;
    cin>>x;  
  cout << x << endl;
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<n+1;i++)

using namespace std;
using std::swap;

//vector<long long int> p;
vector<long long int> v;
vector<long long int> w;



int main() {
	int N;
	cin >> N ;
	
	cout << N/2+N%2 <<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int N = s.length();
		int[] child = new int[N];
		Arrays.fill(child, 0);
		
		int[] R = new int[N];
		Arrays.fill(R, 1);
		int[] L = new int[N];
		Arrays.fill(L, 1);
		
		for(int i = 0; i < N - 2; i++) {
			if(s.charAt(i)=='R') {
				if(s.charAt(i + 1) == 'R') {
					if(s.charAt(i + 2) == 'R') {
						R[i + 2] += R[i];
						R[i] = 0;
					}
					else {
						child[i + 2] += R[i];
					}
				}
				else {
					child[i] += R[i];
				}
			}
			else {
				R[i] = 0;
			}
		}
		if(s.charAt(N - 2) == 'L') {
			R[N - 2] = 0;
		}
		else {
			child[N - 2] += R[N - 2];
		}
		
		for(int i = N - 1; i > 1; i--) {
			if(s.charAt(i)=='L') {
				if(s.charAt(i - 1) == 'L') {
					if(s.charAt(i - 2) == 'L') {
						L[i - 2] += L[i];
						L[i] = 0;
					}
					else {
						child[i - 2] += L[i];
					}
				}
				else {
					child[i] += L[i];
				}
			}
			else {
				L[i] = 0;
			}
		}
		if(s.charAt(1) == 'R')L[1] = 0;
		else {
			child[1] += L[1];
		}
		
		for(int i = 0; i < N; i++) {
			System.out.print(child[i]+((i != N-1)?" ":""));
		}
		
	 }
}

Measured memory_bytes: 44040
#include<iostream>
#include<cstdio>
#define INF 1<<30
#define FinishFunction return 0
#define MAX 1000000
using namespace std;
  
  
struct edge {
  int from,to,cost,k;
};
  
edge es[MAX];
  
  
  
int main(){
  int n,u,k,E,c,v;
  E = 0;
  scanf("%d",&n);
  
  for(int i=0;i<n;i++){
    scanf("%d %d",&u,&k);
     
    for(int j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      es[E].from = u;
      es[E].to = v;
      es[E++].cost = c;
    }
  }
  
    
  int d[MAX];
  for(int i=0;i<n;i++)d[i] = INF;
  d[0] = 0;
  while(true){
    bool update = false;
    for(int i=0;i<E;i++){
      edge e = es[i];
      if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
    d[e.to] = d[e.from] + e.cost;
    update = true;
      }
    }
    if(!update)break;
  
  
  }
  
  for(int i=0;i<n;i++)cout << i << " " << d[i] << endl;
  
  FinishFunction;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

typedef long long ll;

int main() {
  string s;
  cin >> s;
  ll K;
  cin >> K;

  // 文字列sを辞書順に並べたとき、
  // K文字より大きい部分文字列はk番以内に入ることはない
  vector<string> substrings;
  for (ll i = 0; i < (ll)s.size(); i++) {
    for (ll j = 1; j <= K; j++) {
      substrings.push_back(s.substr(i,j));
    }
  }
  // 重複排除
  sort(substrings.begin(), substrings.end());
  substrings.erase(unique(substrings.begin(), substrings.end()), substrings.end());

  // 辞書順でk番目の連続する部分文字列
  cout << substrings[K - 1] << endl;
  return 0;
}


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


int kouyakusu(int a,int b){
  if (a > b){
    int c = a;
    a = b;
    b = c;
  }
  
  if (b%a == 0)
  return a;
    
  return kouyakusu(b%a,a);
}


int saidai(int X[],int size){
  int maxv = INT_MIN;

  for (int i=0; i<size ;i++){
    if(X[i] > maxv)
      maxv = X[i];
       }

  return maxv;
}


int main (){
  int n,i,j;
  cin >> n;
  int a[n];
  int K[n];
  int S[n],E[n];

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

  S[0] = a[0];
  E[0] = a[n-1];
  
  for(i=1;i<n-1;i++){
  S[i] = kouyakusu(S[i-1],a[i]);
  E[i] = kouyakusu(E[i-1],a[n-i-1]);
  }
  
  for(i=1;i<n-1;i++){
    K[i] = kouyakusu(S[i-1],E[n-i-2]);
  }

  K[0] = E[n-2];
  K[n-1] = S[n-2];

      
  cout << saidai(K,n) << endl;
  	
}


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

int main(){
    int n,A[ 100 ];
    cin >> n;
    for ( int i = 0; i < n; i++ ) cin >> A[i];
    
    for ( int i = n-1; i >= 0; i-- ) {
      if ( i != n-1 ) cout << " ";
      cout << A[i];
}
 cout << endl;
    
  return 0;
}    

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;
#define debug(x) cerr << #x << ": " << (x) << "\n";

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  rep(i, 0, n) ret *= x;
  return ret;
};

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

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

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

  string s;
  cin >> s;
  string t;
  cin >> t;
  if (s == t) {
    cout << "Yes" << endl;
    return 0;
  }
  rep(i, 0, s.size()) {
    s = s[s.size()-1] + s.substr(0, (int)s.size()-1);
    if (s == t) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
};


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

const long long mod = 1e9 + 7;

int main() {
    int n;
    string s;
    cin >> n >> s;
    string ans = "";
    ans += s[0];
    rep(i, n - 1) {
        if(s[i] == s[i + 1])
            continue;
        else {
            ans += s[i + 1];
        }
    }

    cout << ans.size() << endl;
    return 0;
}

Measured memory_bytes: 3720
use io::*;

fn main() {
    let input = read_string();
    let mut sc = Scanner::new(&input);
    let n: usize = sc.next();
    let s = sc.next_vec_char();
    let _s = sc.next_vec_char();
    let mut s2: Vec<u8> = Vec::new();
    let mut prevc = '?';
    for c in s {
        if c == prevc {
            let l = s2.len();
            s2[l - 1] += 1;
        } else {
            s2.push(0);
            prevc = c;
        }
    }
    let m = 1000000007;
    let mut prev = s2[0];
    let mut ans: usize = if s2[0] == 0 { 3 } else { 6 };
    for i in 1..s2.len() {
        ans *= match (prev,s2[i]) {
            (0,_) => 2,
            (1,0) => 1,
            (1,1) => 3,
            _ => 1
        };
        ans %= m;
        prev = s2[i];
    }
    println!("{}",ans);
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }

        pub fn next_mat<T: FromStr>(&mut self, w: usize, h: usize) -> Vec<Vec<T>> {
            (0..h).map(|_| self.next_vec(w)).collect()
        }

        pub fn next_vec_char(&mut self) -> Vec<char> {
            self.next::<String>().chars().collect()
        }

        pub fn next_mat_char(&mut self, n: usize) -> Vec<Vec<char>> {
            (0..n).map(|_| self.next_vec_char()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define loop for(;;)
typedef std::vector<long> LI;
template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   void solve() {
      long n; scan(n);
      if( n == 0 ) exit(0);
      getchar();
      std::string str; std::getline(std::cin, str);
      long count[26] = {};
      for(long i = 0; i < n; ++i) {
         count[str[2*i] - 'A'] += 1;
         std::vector<std::pair<long, long>> xs;
         for(long k = 0; k < 26; ++k) {
            xs.push_back(std::make_pair(count[k], k));
         }
         std::sort(xs.begin(), xs.end());
         std::reverse(xs.begin(), xs.end());
         long rem = n - i - 1;
         if( xs[1].first + rem < xs[0].first ) {
            printf("%c %ld\n", (char)(xs[0].second + 'A'), i + 1);
            return;
         }
      }
      puts("TIE");
   }
};

int main() {
   loop std::shared_ptr<Solver>()->solve();
}

Measured memory_bytes: 3352
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
//#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int s,w; cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>

int gcd(int a, int b)
{
    int tmp;

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

    return (a);
}

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

int main(void)
{
    int n;
    int lcmn;
    int i;
    int tmp;

    scanf("%d", &n);
    lcmn = 1;
    for (i = 0; i < n; i++){
        scanf("%d", &tmp);
        lcmn = lcm(lcmn, tmp);
    }
    printf("%d\n", lcmn);

    return (0);
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100005  //check the limits, man
int main()
{
    ll i,j,k,x,n,f=0;
    ll ans=0;
    string str;
    llin(str);
    n=str.size();
    rep(i,n)
    {
        x=0;
        lp(j,i,n)
        {
            k=max(i-1,f)+max(n-j-2,f);
            x*=10,x+=(str[j]-'0');
            ans+=(x<<k);
        }
    }
    llout(ans);
}


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

using namespace std;

const int N=100005;
int n,m,p[N],a[N],r[N],tmp[N];
long long k;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&p[i]);
	for(int i=1;i<n;i++)a[i]=r[i]=i;
	scanf("%d%lld",&m,&k);
	for(int i=1,x;i<=m;i++)scanf("%d",&x),swap(a[x-1],a[x]);
	while(k){
		if(k&1)for(int i=1;i<n;i++)r[i]=a[r[i]];
		for(int i=1;i<n;i++)tmp[i]=a[a[i]];memcpy(a,tmp,n<<2);k>>=1;
	}
	long long x=p[1];
	for(int i=1;i<=n;i++)printf("%lld.0\n",x),x+=p[r[i]+1]-p[r[i]];
	return 0;
}

Measured memory_bytes: 3072
#include <bits//stdc++.h>
#define rep(i,k) for(int i=0;i<k;i++)
#define int long long
using namespace std;
signed main(void){
    int n,m,a,b,c,ans;
    cin>>n;
    ans=0;
    rep(i,9){
        if(n%(i+1)==0&&n/(i+1)<10)
        ans=1;
    }
    if(ans)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#define ll long long
#include<bits/stdc++.h>
using namespace std;
ll arr[300];
ll brr[300];
ll crr[30];
int main()
{
    ll n,sum=0,mx=0,mn=1e12,i,j;

    cin>>n;

    for(i=1;i<n;i++)
    {
        cin>>arr[i];
    }

     brr[1]=arr[1];
     brr[2]=arr[1];

    for(i=3;i<=n;i++)
    {
        brr[i]=arr[i-1];
    }

    for(i=2;i<n;i++)
    {
        if(brr[i]>brr[i+1])
            brr[i]=brr[i+1];
    }
  for(i=1;i<=n;i++)
  {
      sum+=brr[i];
  }
  cout<<sum<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <iterator>
#include <climits>
#include <unordered_map>
#include <functional>
#include <queue>

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

#define p2(a, b) cout << a << "\t" << b << endl
#define p3(a, b, c) cout << a << "\t" << b << "\t" << c << endl

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

inline int ctoi(char c) {
    return (int)(c -'0');
}

// ----------------------------------------------------------

int main() {
    ll n,a;
    cin >> n >> a;
    cout << n*n-a << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, W; cin >> n >> W;
    V<int> w(n); vll v(n);
    for (int i = 0; i < n; i++) cin >> w[i] >> v[i];
    vvll dp(2, vll(W + 1, 0));
    for (int i = 0; i < n; i++) {
        dp[1] = vll(W + 1, 0);
        for (int j = 0; j <= W; j++) {
            chmax(dp[1][j], dp[0][j]);
            if (j + w[i] <= W) chmax(dp[1][j + w[i]], dp[0][j] + v[i]);
        }
        swap(dp[0], dp[1]);
    }
    cout << *max_element(ALL(dp[0])) << '\n';
    return 0;
}


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

using namespace std;

#define INF 0x3f3f3f3f
typedef long long LL;
const int N = 1e5 + 10;

void solve()
{
	int n,d;
	cin>>n>>d;
	int ans=0;
	for(int i=1;i<=n;++i){
		double dis=0;
		LL x,y;
		cin>>x>>y;
		dis=sqrt(x*x+y*y);
		if(dis<=d) ans++;
	}
	cout<<ans<<endl;
}
int main()
{
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    // freopen("data1.txt", "r", stdin);
    // freopen("data2.txt", "w", stdout);
    int _ = 1;
    // cin >> _;
    for (int i = 1; i <= _; ++i)
        solve();
    // system("pause");
}

Measured memory_bytes: 3652
#include <iostream>
#
using namespace std;
int main(void){
	int a,b,c;
	cin>>a>>b>>c;
	if(a>b){
		int t=a;
		a=b;
		b=t;
	}
	else{
	}
	if(b>c){
		int t=b;
		b=c;
		c=t;
	}
	else{
	}
	if(a>b){
		int t=a;
		a=b;
		b=t;
	}
	else{
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}

Measured memory_bytes: 1164