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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#else
#define db(...) true
#endif
template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c; return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;


int a, b;

int main() {
	#ifdef LOCAL
	auto stTime = clock();
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	cin >> a >> b;
	cout << max(a + b, max(a - b, a * b)) << '\n';


	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms\n";
	#endif
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

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

	int n, T, H, l;
	cin >> n >> T >> H >> l;

	vector<int> t(n), h(n);
	for(int i = 0; i < n; ++i)
		cin >> t[i] >> h[i];

	int win;
	int in = 0;

	for(;;) {
		for(int i = 0; i < n; ++i) {
			if(t[i]) {
				--t[i];
				++T;
				in += 10;
				if(T > l) {
					win = i + 1;
					goto end;
				}
			}
			else if(h[i]) {
				--h[i];
				in += 100;
			}
			else {
				win = i + 1;
				goto end;
			}

			if(in >= 90) {
				int change = (in - 90) % 100 / 10;
				T -= change;
				t[i] += change;
				in = 0;

				if(T < 0) {
					win = i + 1;
					goto end;
				}
			}
		}
	}

	end:;

	cout << win << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define inf 1000000000000000000

using namespace std;

signed main(){
    string s;
    int k;
    cin>>s;
    cin>>k;
    char c;
    bool f=true;
    int j;
    rep(i,s.length()){
        if(s[i]!='1'){
            f=false;
            c=s[i];
            j=i;
            break;
        }
    }
    if(f&&k<=100)cout<<1<<endl;
    else if(k<j+1)cout<<1<<endl;
    else cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
using namespace std;
int A[100009]={};
int B[100009]={};
int C[100009]={};

int main(){
  int N;
  cin>>N;
  for(int in =1 ;in<=N ;in++){
    cin>>A[in]>>B[in]>>C[in];
  }
 int dp[100009][3];
  dp[0][0]=0;
  dp[0][1]=0;
  dp[0][2]=0;
  
  for(int day=1;day<=N;day++){
    dp[day][0]=max(dp[day-1][2],dp[day-1][1])+A[day];
    dp[day][1]=max(dp[day-1][0],dp[day-1][2])+B[day];
    dp[day][2]=max(dp[day-1][1],dp[day-1][0])+C[day];
  }
  int ans=max(dp[N][0],dp[N][1]);
  ans = max(ans,dp[N][2]);
  cout<<ans<<endl;
  
  
  return 0;
}




Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#define ll long long int
using namespace std;

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    while (m--) {
        int a;
        scanf("%d", &a);
        n-=a;
    }
    if (n<0) printf("-1\n");
    else printf("%d\n", n);
}


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

LL modinv(LL a) {
    LL b = MOD, u = 1, v = 0;
    while (b) {
        LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= MOD;
    if (u < 0) u += MOD;
    return u;
}

LL moddev(LL a, LL b){
	return a * modinv(b) % MOD;
}

int n;
VI result;
void func(int p, int m){

    REP(i,m+2){
        result[p] = i;
        if(p == n-1){
            REP(j,n){
                cout<<(char)(result[j]+'a');
            }
            cout<<endl;
        }
        if(p != n-1){
            func(p+1,max(i,m));
        }
    }

}

void Main()
{
    cin>>n;

    if(n==1){
        cout<<"a"<<endl;
        return;
    }

    result.resize(n);

    func(1,0);

	return;
}

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

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define MOD (long long)(1e9+7)
typedef long long int ll;
typedef unsigned long long int ull;

ll modularExponentiation(ll x, ll y, ll  p){
  ll res = 1;
  x = x % p;
  while (y > 0){
      if (y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
  }
  return res;
}

bool isPrime(ll n){
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll T=1;
  // cin>>T;
  for(int _case=0;_case<T;_case++){
    double n;
    cin>>n;
    cout<<2*double(104348/33215.)*n;
  }
  return 0;
}


Measured memory_bytes: 3804
unittest
{
	assert( [ "4" ].parse.expand.solve == "0.500000" );
	assert( [ "5" ].parse.expand.solve == "0.600000" );
	assert( [ "1" ].parse.expand.solve == "1.000000" );
}



import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	return tuple( n );
}

auto solve( long n )
{
	return format( "%0.6f", ( n / 2 + n % 2 ) / cast( real ) n );
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#define ll long long
#define ull unsigned ll
#define pll pair<ll, ll>
using namespace std;
ll w[210], K, U[210];
int cnt;
map<ull, int>Map;
vector<pll>V[50100];
int BASE = 18273;
int n;
struct point {
	ll a, b;
	bool operator< (const point &p)const {
		return b < p.b;
	}
}P[210];
int Count(ll a) {
	if (!a)return 0;
	return Count(a >> 1) + (a & 1);
}
int Small(ll b, ll e) {
	int i, res = 1e9;
	for (i = 0;; i++) {
		if (((e >> i) << i) < b)break;
		res = min(res, Count(e >> i));
	}
	return res;
}
void Make(ll C) {
	if (C < 0)return;
	int i;
	sort(U, U + n);
	if (U[0] < 0)return;
	pll r = { max(U[0] - C, 0ll), U[0] };
	ull s = 0;
	for (i = 0; i < n - 1; i++) {
		s = s*BASE + (U[i + 1] - U[i] + 1);
	}
	if (!Map.count(s))Map[s] = ++cnt;
	V[Map[s]].push_back(r);
}
void Do(int d) {
	int i, j;
	for (i = 0; i < n; i++) {
		P[i].a = (w[i] >> d);
		P[i].b = w[i] - (P[i].a << d);
	}
	sort(P, P + n);
	for (i = 0; i < n; i++)U[i] = P[i].a;
	Make(K - d);
	for (i = 0; i < n - 1; i++) {
		if (P[i].b < P[i + 1].b) {
			int g = Small(P[i].b + 1, P[i + 1].b);
			if (K - g - d >= 0) {
				for (j = 0; j < n; j++) {
					U[j] = P[j].a;
					if (j <= i)U[j]--;
				}
				Make(K - g - d);
			}
		}
	}
}
int main() {
	int i;
	scanf("%d%lld", &n, &K);
	for (i = 0; i < n; i++) {
		scanf("%lld", &w[i]);
	}
	sort(w, w + n);
	for (i = 0; i <= 60; i++) {
		Do(i);
	}
	ll res = 0, Mod = 1000000007;
	for (i = 1; i <= cnt; i++) {
		sort(V[i].begin(), V[i].end());
		ll b = -1e9 + 1, e = -1e9;
		for (auto &t : V[i]) {
			if (e < t.first) {
				res = (res + e - b + 1) % Mod;
				b = t.first;
			}
			e = max(e, t.second);
		}
		res = (res + e - b + 1) % Mod;
	}
	printf("%lld\n", res);
}

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

int main() {
  int n,k,a=1,b,c;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    b=a*2;
    c=a+k;
    if(b<=c)
      a=b;
    else
      a=c;
  }
  cout<<a<<endl;
}


Measured memory_bytes: 256
n = int(input().strip())
a = list(map(int, input().split()))
reps = []

a.sort()
tmp = 0
for e in a:
    if e == tmp:
        reps.append(e)
        tmp = 0
    else:
        tmp = e
if len(reps) < 2:
    print(0)
else:
    print(reps[-1] * reps[-2])


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

int k, a, b;
 
int main()
{
	cin >> k >> a >> b;
	for (int i = a; i <= b; i++)
	{
		if (i % k == 0)
		{
			cout << "OK" << endl;
			exit(0);
		}
	}
	cout << "NG" << endl;
	return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define LIMIT 100010
//union-find
int uniroot[LIMIT+10],unicnt[LIMIT+10];
void ufinit(int n){for(int i=0;i<n;i++){uniroot[i]=i;}}//unicnt[i]=1;}}
int root(int x){return uniroot[x]!=x?uniroot[x]=root(uniroot[x]):x;}
int same(int x,int y){return root(x)==root(y);}
void uni(int x,int y){if((x=root(x))==(y=root(y)))return;uniroot[x]=y;}//unicnt[y]+=unicnt[x];}

int a[100010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	ufinit(n+1);
	rep(i,0,n){
		int t;
		scanf("%d",&t);
		a[t]=i+1;
	}
	rep(i,0,m){
		int p,q;
		scanf("%d%d",&p,&q);
		uni(p,q);
	}
	ll ans=0;
	rep(i,1,n+1)if(same(a[i],i))ans++;
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 896
import sys


N, M = map(int, input().split())

max_l = 0
min_r = sys.maxsize

for _ in range(M):
  l, r = map(int, input().split())
  max_l = max(max_l, l)
  min_r = min(min_r, r)
  
print(sum(
  max_l <= i <= min_r
  for i in range(1, N + 1)
))

Measured memory_bytes: 44888
N, M = map(int, input().split())
 
L = [0] * M
R = [0] * M
for i in range(M):
    L[i], R[i] = map(int, input().split())
 
if max(L) > min(R):
    print("0")
else:
    print(min(R) - max(L) + 1)

Measured memory_bytes: 16644
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  int div_R = N / R;
  int div_G = N / G;
  int ans = 0;
 
  for (int r = 0; r <= div_R; r++) {
    for (int g = 0; g <= div_G; g++) {
      int left = (N - (R * r + G * g));
      if (left % B == 0 && left / B >= 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
typedef long long lli;
int A, B;

void ReadInput()
{
    cin >> A >> B;
}

void Solve()
{
    if(A <= 9 && B <= 9)
        cout << A * B << '\n';
    else cout << "-1\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ReadInput();
    Solve();
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    long M = 1_000_000_007;
    int N = scanner.nextInt();
    int[][] a = new int[N + 1][N];
    for (int i = 1; i <= N; i++) for (int j = 0; j < N; j++) a[i][j] = scanner.nextInt();

    long[][] dp = new long[N + 1][1 << N];
    dp[0][0] = 1;

    for (int j = 1; j < 1 << N; j++) {
      int cnt = 0;
      int n = j;
      while (n > 0) {
        if (n % 2 == 1) cnt++;
        n >>= 1;
      }
      for (int i = 0; i < N; i++) {
        if ((j & (1 << i)) != 0) {
          dp[cnt][j] += dp[cnt - 1][j ^ (1 << i)] * a[cnt][i];
          if (dp[cnt][j] > M) dp[cnt][j] -= M;
        }
      }
    }
    System.out.println(dp[N][(1 << N) - 1]);
  }
}


Measured memory_bytes: 383956
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int mod=998244353;
int fac[200004];
int modInverse(int a, int m) 
{ 
    int m0 = m; 
    int y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        // q is quotient 
        int q = a / m; 
        int t = m; 
  
        // m is remainder now, process same as 
        // Euclid's algo 
        m = a % m, a = t; 
        t = y; 
  
        // Update y and x 
        y = x - q * y; 
        x = t; 
    } 
  
    // Make x positive 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 
  

int ncr(int n,int r)
{
  if(n<r)
    return 0;
  int z=fac[n];
  z=(z*modInverse(fac[r],mod))%mod;
  z=(z*modInverse(fac[n-r],mod))%mod;
  return z;
}

int power[200005];
signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(0);   

  #ifndef ONLINE_JUDGE
      if(fopen("INPUT.txt","r"))
      {
      freopen ("INPUT.txt" , "r" , stdin);
      freopen ("OUTPUT.txt" , "w" , stdout);
      }
  #endif

  power[0]=1;
  int n,m,k;
  cin>>n>>m>>k;
  fac[0]=1;
  for(int i=1;i<=200000;i++)
  {
    power[i]=(power[i-1]*(m-1))%mod;
    fac[i]=(fac[i-1]*i)%mod;
  }
  int ans=0;
  for(int i=0;i<=k;i++)
  {
    ans+=(ncr(n-1,i)*((m*(power[n-1-i]))%mod))%mod;
    ans%=mod;
  }
  cout<<ans;
}


Measured memory_bytes: 6764
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;

int main() {
    ll A, B;
    cin >> A >> B;
    ll b = B;
    ll div = 2;
    ll div2 = 4;
    ll result = 0;
    ll x = (A / 2) & 1;
    ll y = ((B + 1) / 2) & 1;
    if (x != y) {
        result += 1;
    }

    do {
        ll y = 0;
        ll y0 = B % div2;
        if (y0 >= div) {
            y = (y0 + 1) & 1;
        }
        ll x = 0;
        ll x0 = (A - 1) % div2;
        if (x0 >= div) {
            x = (x0 + 1) & 1;
        }

        if (x != y) {
            result += div;
        }

        // cout << div2 << " " << x0 << " " << x << " " << y0 << " " << y << ":" << result << endl; 


        div = div << 1;
        div2 = div2 << 1;
    } while (div <= B);
    cout << result << endl;
    
}


Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    XI=[(x-1,i) for i,x in enumerate(MI())]
    XI.sort()
    remain = [N-i-1 for i in range(N)]
    idx = 0
    ans = [None]*(N*N)
    ok = True
    for x,i in XI:
        for _ in range(i):
            while(idx<N*N and ans[idx] is not None):
                idx += 1
            if(idx >= x):
                ok = False
                break
            ans[idx] = i
            idx += 1
        ans[x] = i
        # print(ans,ok)
    for x,i in XI:
        for _ in range(remain[i]):
            while(idx<N*N and ans[idx] is not None):
                idx += 1
            if(idx < x):
                ok = False
            ans[idx] = i
            idx += 1
        # print(ans)
    if(not ok):
        print("No")
        return 
    print("Yes")
    print(*[a+1 for a in ans])
if __name__ == '__main__':
    main()

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int l, r;
	cin >> l >> r;
	if (r - l > 2019)r = l + 2019;
	int ans = 2020;
	for (int i = l; i <= r; i++) {
		for (int j = i + 1; j <= r; j++) {
			int x = i % 2019;
			int y = j % 2019;
			ans = min(ans, x * y % 2019);
			//ans = min(ans, ((i % 2019) * (j % 2019)) % 2019);
		}
	}
	cout << ans << endl;
	return 0;
}



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

const int MAX_N = (int)(2 * 1e5 + 5);
const int MAX_K = (int)1e5 + 5;
const int MAX_L = (int)1e5 + 5;

int n, k, l;

map<pair<int, int>, int> cntr;

/////////////////////////////////////////////////////////
class UnionFind {
private:
  int uf_par[MAX_N];
  int uf_rank[MAX_N];
public:
    UnionFind(int n) {
      uf_init(n);
    }

    void uf_init(int n) {
      for (int i = 0; i < n; ++i) {
        uf_par[i] = i;
        uf_rank[i] = 0;
      }
    }

    int uf_find (int x) {
      if (uf_par[x] == x) {return x;}
      else {
        return uf_par[x] = uf_find(uf_par[x]);
      }
    }

    void uf_unite(int x, int y) {
      x = uf_find(x);
      y = uf_find(y);

      if (x == y) {return;}
      if (uf_rank[x] < uf_rank[y]) {uf_par[x] = y;}
      else {
        uf_par[y] = x;
        if (uf_rank[x] == uf_rank[y]) uf_rank[x] += 1;
      }
    }

    bool uf_same(int x, int y) {
      return uf_find(x) == uf_find(y);
    }
};
/////////////////////////////////////////////////////////

int main(void) {
  // Here your code !
  scanf("%d %d %d", &n, &k, &l);

  UnionFind uf_pq(n + 3);
  UnionFind uf_rs(n + 3);

  for (int i = 0; i < k; ++i) {
    int tp, tq;
    scanf("%d %d", &tp, &tq);
    uf_pq.uf_unite(tp, tq);
  }

  for (int i = 0; i < l; ++i) {
    int tr, ts;
    scanf("%d %d", &tr, &ts);
    uf_rs.uf_unite(tr, ts);
  }

  for (int i = 1; i <= n; ++i) {
    pair<int, int> tpr(uf_pq.uf_find(i), uf_rs.uf_find(i));
    cntr[tpr] += 1;
  }

  for (int i = 1; i <= n; ++i) {
    pair<int, int> tpr(uf_pq.uf_find(i), uf_rs.uf_find(i));
    printf("%d ", cntr[tpr]);
  }
  printf("\n");

	return 0;
}

Measured memory_bytes: 15232
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+5;
typedef long long ll;
int vis[maxn];
int main(){
    int n;
    cin>>n;
    int x;
    for(int i=2;i<=n;i++){
        cin>>x;
        vis[x]++;
    }
    for(int i=1;i<=n;i++){
       cout<<vis[i]<<endl;
    }

    return 0;
}

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

bool arr[10001];
int x,n,a,i;

int main(){
	cin >> x >> n;
	for(i=0; i<n; i++){
		cin >> a;
		arr[a] = true;
	}
	
	if(n==0){
		cout << x << endl;
	}else {
		for(i=0; i<=100; i++){
			if(arr[x-i] == false){
				cout << x-i << endl;
				break;
			}else if(arr[x+i] == false){
				cout << x+i << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int K;
  cin >> K;
  
  int A, B;
  cin >> A >> B;
  
  int dis = B - A;
  int cnt = 0;
  
  if(dis >= K){
    cout << "OK" << endl;
  }
  else{
    for(int i = A; i < B+1; i++){
      if(i % K == 0){
        cnt++;
      }
    }
    if(cnt > 0){
      cout << "OK" << endl;
    }
    else{
      cout << "NG" << endl;
    }
  }
}

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

int main(){
    string o, e;
    cin >> o >> e;
    rep(i, e.size()){
        cout << o[i] << e[i];
    }
    if(o.size()-e.size()==1){
        cout << o[o.size()-1];
    cout << endl;
    return 0;
    }
}

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

const int Max=1e9+100;

int ara[12][1100];
int n,m,k;

int fun(int id,int mask,int mark[],int el)
{
    if(id>m) return 0;
    int temp[el];
    memset(temp,0,sizeof temp);

    int last=1,ct=0;

    while(last<=n)
    {
        if(ara[last][id]==1) ++temp[ct];
        ++last;
        while(last<=n && ((bool)(mask & (1<<(last-2))))==false){
            if(ara[last][id]==1) ++temp[ct];
            ++last;
        }
        ++ct;
    }

    bool bl=true;
    for(int i=0;i<el;i++){
        if((mark[i]+temp[i])>k) {
            bl=false;
        }
        if(temp[i]>k) return Max;
    }

    int counter=(!bl) ? 1 : 0;
    for(int i=0;i<el;i++){
        mark[i]=(!bl) ? temp[i] : (temp[i]+mark[i]);
    }

    return (counter+fun(id+1,mask,mark,el));
}

int main()
{
    int p,q,x,i,j,y,a,b,c;

    cin>>n>>m>>k;
    string str[n];
    for(i=0;i<n;i++) cin>>str[i];

    for(i=1;i<=n;i++)  for(j=1;j<=m;j++)  ara[i][j]=str[i-1][j-1]-'0';

    int mx=n*m;

    int last=(1<<(n-1));
    for(int mask=0;mask<last;mask++)
    {
        int el=1;
        for(i=0;i<n-1;i++){
           if((bool)(mask & (1<<i))==1) ++el;
        }
        int mark[el];
        memset(mark,0,sizeof mark);

        int tot=fun(1,mask,mark,el);
        mx=min(mx, tot+(el-1));
    }

    cout<<mx<<'\n';
}


Measured memory_bytes: 3696
N = int(input())
lucas = [0 for i in range(N+1)]
def luca(a):
    if a == 0:
        return 2
    elif a == 1:
        return 1
    else:
        if lucas[a] != 0:
            return lucas[a]
        else:
            lucas[a] = luca(a-1) + luca(a-2)
            return lucas[a]
print(luca(N))


Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
import math


def read():
    N = int(input().strip())
    return N,


def f(x, y, z):
    return x**2 + y**2 + z**2 + x * y + y * z + z * x


def solve(N):
    T = [0 for i in range(N+1)]
    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                n = f(x, y, z)
                if n <= N:
                    T[n] += 1
    for i in range(1, N+1):
        print(T[i])


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 9304
#include <cstdio>
#include <cstring>
#include <iostream>

using namespace std;

int main() {
    int a, b, c;
    
    cin >> a >> b >> c ;
    if(a < b && b < c){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    
    return 0;
}

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

#define int            long long int
#define float          long double
#define setbits(x)     __builtin_popcountll(x)
#define zrobits(x)     __builtin_ctzll(x)
#define mod            1000000007
#define inf            1e18
#define set_pre(x,y)   fixed<<setprecision(y)<<x
#define w(t)           int t; cin>>t; while(t--)
#define pi             3.14159265358979323
using namespace std;

int32_t main()
{
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(s.length()<=k)
        cout<<s;
    else
    {
        for(int i=0;i<k;i++)
            cout<<s[i];
        cout<<"...";
    }

}

Measured memory_bytes: 3592
def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  print((a-1)*(b-1))

if __name__ == '__main__':
  main()

Measured memory_bytes: 2940
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, long long A, std::vector<long long> x){
    ll X=A;
    rep(i, N) X = max(X, x[i]);
    ll NX = X*X;
    vector<vll> dp(N+1, vll(2*NX+1, 0));

    rep(i, N){
        x[i] -= A;
    }

    dp[0][NX] = 1;
    for(ll j=0; j< N; j++){
        for(ll t=0; t<= 2*NX; t++){
            dp[j+1][t] = dp[j][t];
            if(0<= t-x[j] && t-x[j]<= 2*NX)
                dp[j+1][t] += dp[j][t-x[j]];
        }
    }

    cout << dp[N][NX]-1 << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    std::vector<long long> x(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
    }
    solve(N, A, std::move(x));
    return 0;
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans=0;
    for (int i=0; i<N-2; i++) {
        string s = S.substr(i, 3);
        if (s=="ABC") ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int h,w;
  while(1){
    scanf("%d %d",&h,&w);
    if ( w == 0 && h == 0 )break;
    else{
      for(int i=0;i<h;i++){
        for (int j=0;j<w;j++)
        {
          if(j == 0 || j == w-1 || i == 0 || i == h-1){
            printf("#");
          }else{
            printf(".");
          }
        }
        printf("\n");
      }
    }
    printf("\n");
  }
  

  return 0;
}


Measured memory_bytes: 2004
#include<bits/stdc++.h> 
using namespace std;
int A[12],a[52],b[52],c[52],d[52];
int n,m,q,ans=-1;
void score()
{
	int sum=0;
	for(int i=1;i<=q;i++)
		if(A[b[i]]-A[a[i]]==c[i])
			sum+=d[i];
	ans=max(ans,sum);
}
int main()
{  
	cin>>n>>m>>q;
	for(int i=1;i<=q;i++)
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	for(int i1=1;i1<=m;i1++){
		A[1]=i1;
		if(1==n)	score();
		if(n==1&&i1==m) break;
		for(int i2=i1;i2<=m;i2++){
			A[2]=i2;
			if(2==n)	score();
			if(n==2&&i2==m) break;
			for(int i3=i2;i3<=m;i3++){
				A[3]=i3;
				if(3==n)	score();
				if(n==3&&i3==m) break;
				for(int i4=i3;i4<=m;i4++){
					A[4]=i4;
					if(4==n)	score();
					if(n==4&&i4==m) break;
					for(int i5=i4;i5<=m;i5++){
						A[5]=i5;
						if(5==n)	score();
						if(n==5&&i5==m) break;
						for(int i6=i5;i6<=m;i6++){
							A[6]=i6;
							if(6==n)	score();
							if(n==6&&i6==m) break;
							for(int i7=i6;i7<=m;i7++){
								A[7]=i7;
								if(7==n)	score();
								if(n==7&&i7==m) break;	
								for(int i8=i7;i8<=m;i8++){
									A[8]=i8;
									if(8==n)	score();
									if(n==8&&i8==m) break;	
									for(int i9=i8;i9<=m;i9++){
										A[9]=i9;
										if(9==n)	score();
										if(n==9&&i9==m) break;	
										for(int i10=i9;i10<=m;i10++){
											A[10]=i10;
											if(10==n)	score();
											if(n==10&&i10==m) break;	
										}
									}
								}
							}
						}
					}
				}
			}			
		}			
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int H,W;
    cin>>H>>W;
    string S[60];
    int dx[]={1,1,0,-1,-1,-1,0,1},dy[]={0,1,1,1,0,-1,-1,-1};
    for(int i=0;i<H;i++)cin>>S[i];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(S[i][j]=='.'){
                int cnt=0;
                for(int k=0;k<8;k++){
                    int x=i+dx[k];
                    int y=j+dy[k];
                    if(x>=0&&x<H&&
                    y>=0&&y<W&&
                    S[x][y]=='#')cnt++;
                }
                S[i][j]='0'+cnt;
            }
        }
    }
    for(int i=0;i<H;i++)cout<<S[i]<<endl;
}

Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>

int main(){
  int n;
  char s[1000];
  scanf("%d",&n);
  scanf("%s",s);
  int count=0;
  for(int i=0;i<n-2;i++){
  	if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') count++;
  }
  printf("%d",count);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define X first
#define Y second
typedef long long ll;
using namespace std;

const int MOD = 1e9 + 7;
const ll INF = 1e18;

int main () {

	int n, k;
	cin >> n >> k;
	cout << n-k+1;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    int a;
    bool ok = true;
    for(int i=0;i<n;++i) {
        cin >> a;
        if(a % 2) {
            continue;
        } else {
            if(a % 3 == 0 || a % 5 == 0) {

            } else {
                ok = false;
                break;
            }
        }
    }

    cout << (ok?"APPROVED":"DENIED") << endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/dp/tasks/dp_i
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define pr pair<ll, ll>
#define infinity (ll)4e18
#define tp tuple<ll, ll, ll>
using namespace std;
long long int mod = 1e9 + 7;

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

    ll n;
    cin >> n;
    ld p[n + 1];
    for (ll i = 1; i < n + 1; i++)
        cin >> p[i];
    ld dp[n + 1][n + 1];
    dp[0][0] = 1;
    for (ll i = 1; i < n + 1; i++)
        dp[0][i] = 0;
    for (ll i = 1; i < n + 1; i++)
        dp[i][0] = dp[i - 1][0] * (1 - p[i]);
    for (ll i = 1; i < n + 1; i++)
        for (ll j = 1; j < n + 1; j++)
            dp[i][j] = p[i] * dp[i - 1][j - 1] + (1 - p[i]) * dp[i - 1][j];
    ld ans = 0.0;
    for (ll i = n / 2 + 1; i < n + 1; i++)
        ans += dp[n][i];
    printf("%0.10Lf\n", ans);
    return 0;
}

Measured memory_bytes: 140928
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;

int main() {
	long int s,sum;
	cin >> s;
	int dif=1000;
	long int tmp = s * 10;
	int t[11];
	for(int i=0;i<11;i++){
		tmp = tmp/10;
		t[10-i]=tmp%10;
//		cout << t[10-i] << " ";
	}
	for(int i=0;i<9;i++){
		int sum = 100*t[i] + 10*t[i+1] + t[i+2]; 
		if(abs(sum - 753)<dif){
			dif = abs(sum - 753);	
			tmp = sum;
		}
	}
	cout << dif << endl;

	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
//Shift+Command+bでデバッグ
//その後ターミナルで./a.outを実行
//入力を貼り付ける

//////////////////
//  A
/*int main(void){
    int n,k;
    string s;
    cin >> n>>k>>s;

    for(int i=0 ;i<n;i++){
        if(i+1==k){
            if(s[i]=='A') cout<<'a';
            else if(s[i]=='B') cout<<'b';
            else cout<<'c';
        }else{
            cout<<s[i];
        }
    }
    cout<<endl;

    return 0;
}*/
//////////////////
//  B
int main(void){
    string s;
    cin >> s;
    int a=stoi(s)/100,b=stoi(s)%100;

    if(a==0){
        if(b==0) cout << "NA" <<endl;
        else if(b<=12) cout << "YYMM" <<endl;
        else cout<<"NA"<<endl;
    }else if(a<=12){
        if(b==0) cout << "MMYY" <<endl;
        else if(b<=12) cout << "AMBIGUOUS" <<endl;
        else cout<<"MMYY"<<endl;
    }else{
        if(b==0) cout << "NA" <<endl;
        else if(b<=12) cout << "YYMM" <<endl;
        else cout<<"NA"<<endl;
    }
    return 0;
}
//////////////////
//  C
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/
//////////////////
//  E
/*int main(void){

    return 0;
}*/
//////////////////
//  F
/*int main(void){

    return 0;
}*/


Measured memory_bytes: 256
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
sr, sc = sr - 1, sc - 1
S = input()
T = input()
D = ['L', 'R', 'U', 'D']
rev = {'L': 'R', 'R': 'L', 'U': 'D', 'D': 'U'}
d = {'L': (0, -1), 'R': (0, 1), 'U': (-1, 0), 'D': (1, 0)}
for K in D:
    tr, tc = sr, sc
    for j in range(N):
        if S[j] == K:
            tr, tc = tr + d[K][0], tc + d[K][1]
            if not (0 <= tr < H and 0 <= tc < W):
                print('NO')
                exit()
        if T[j] == rev[K]:
            tr, tc = tr + d[rev[K]][0], tc + d[rev[K]][1]
            if tr == H:
                tr -= 1
            elif tr == -1:
                tr += 1

            if tc == W:
                tc -= 1
            elif tc == -1:
                tc += 1


print('YES')


Measured memory_bytes: 45112
#include <stdio.h>

int main() {
        int a[3][3];
        int n;
        int b[10];
        int i, j, k;

        for (i = 0; i < 3; i++) {
                for (j = 0; j < 3; j++) {
                        scanf(" %d", &a[i][j]);
                }
        }

        scanf(" %d", &n);

        for (k = 0; k < n; k++) {
                scanf(" %d", &b[k]);
        }

        for (i = 0; i < 3; i++) {
                for (j = 0; j < 3; j++) {
                        for (k = 0; k < n; k++) {
                                if (a[i][j] == b[k]) {
                                        a[i][j] = 0;
                                        break;
                                }
                        }
                }
        }

        if ( ((a[0][0] == 0) && (a[0][1] == 0) && (a[0][2] == 0)) ||
                        ((a[1][0] == 0) && (a[1][1] == 0) && (a[1][2] == 0)) ||
                        ((a[2][0] == 0) && (a[2][1] == 0) && (a[2][2] == 0)) ||
                        ((a[0][0] == 0) && (a[1][0] == 0) && (a[2][0] == 0)) ||
                        ((a[0][1] == 0) && (a[1][1] == 0) && (a[2][1] == 0)) ||
                        ((a[0][2] == 0) && (a[1][2] == 0) && (a[2][2] == 0)) ||
                        ((a[0][0] == 0) && (a[1][1] == 0) && (a[2][2] == 0)) ||
                        ((a[0][2] == 0) && (a[1][1] == 0) && (a[2][0] == 0)) )
        {
                printf("Yes\n");
        } else {
                printf("No\n");
        }

        return 0;
}


Measured memory_bytes: 128
#include  <iostream>
#include  <cstdlib>

#define pass()


int main(void)
{
	int rate;
	int ans = 0;

	std::cin >> rate;

	if(rate < 400)
		pass();
	else if(rate < 600)
		ans = 8;
	else if(rate < 800)
		ans = 7;
	else if(rate < 1000)
		ans = 6;
	else if(rate < 1200)
		ans = 5;
	else if(rate < 1400)
		ans = 4;
	else if(rate < 1600)
		ans = 3;
	else if(rate < 1800)
		ans = 2;
	else if(rate < 2000)
		ans = 1;

	std::cout << ans << std::endl;


	return EXIT_SUCCESS;
}


Measured memory_bytes: 3616
#N = int(input())
#A = [int(x) for x in input().split()]
#a, b, c = map(int, input().split())
#name1 = str(input())
#alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
a, b, c = map(str, input().split(","))
print(a, b, c)


Measured memory_bytes: 2940
/*input
6 5
8 6 9 1 2 1
1 3
4 2
4 3
4 6
4 6
*/
#include "bits/stdc++.h"
using namespace std;
int a[1000005];
vector<int> v[100002];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, m; cin >> n >> m;
	for(int i = 1; i <= n; cin >> a[i++]);

	for(int x, y; m--;){
		cin >> x >> y;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	
	int ans = 0;
	for(int i = 1; i <= n; ++i){
		int mn = 0;
		for(int j: v[i])
			mn = max(mn, a[j]);

		if(mn < a[i]) ++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 9176
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();
		long[][] G = new long[N][2];
		for (int i = 0; i < N; i++) {
			long[] temp = new long[2];
			temp[0] = sc.nextInt();
			temp[1] = sc.nextInt();
			G[i] = temp;
		}
		long[][] C = new long[M][2];
		for (int i = 0; i < M; i++) {
			long[] temp = new long[2];
			temp[0] = sc.nextInt();
			temp[1] = sc.nextInt();
			C[i] = temp;
		}
		for (int i = 0; i < N; i++) {
			int near = 0;
			long range = Long.MAX_VALUE;
			for (int j = 0; j < M; j++) {
				long distance = Math.abs(G[i][0] - C[j][0]) + Math.abs(G[i][1] - C[j][1]);
				if (distance < range) {
					range = distance;
					near = j;
				}
			}
			System.out.println(near + 1);
		}
	}

}

Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <set>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 100000007

int main() {
	int n, y;
	cin >> n >> y;
	y /= 1000;

	int m = 0, g = 0, s = 0;

	for (int i = 0; i <= n; i++) {
		for (int j = 0; i + j <= n; j++) {
			int z = n - i - j;
			if (i * 10 + j * 5 + z == y)
			{
				m = i; g = j; s = z;
				goto end;
			}
		}
	}
	m = s = g = -1;
end: 
	cout << m << " " << g << " " << s << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	ll n; cin>>n;
	ll sm = 0;
	ll g[n+1];
	forn1(i,n) g[i] = 2;
	//g[1] = 0;
	for(ll i=2;i<=n;i++)
	{
		for(ll j=2*i;j<=n;j+=i) g[j]++;
	}
	for(ll i=1;i<=n;i++)
	{
		sm += i*g[i];
	}

	cout<<sm-1;
	
	return 0;
}


Measured memory_bytes: 81756
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
int L[100000], R[100000];
typedef pair<int, int> P;
P lp[100000], rp[100000];


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> L[i] >> R[i];
        lp[i] = P(L[i], i);
        rp[i] = P(R[i], i);
    }
    sort(lp, lp+N, greater<P>());
    sort(rp, rp+N);
    int ans = 0;
    if(lp[0].second == rp[0].second){
        int m = -10;
        for(int i = 1; i < N; i++){
            int idx = lp[i].second;
            m = max(m, R[idx]-L[idx]+1);
        }
        ans = max(0, rp[0].first-lp[0].first+1)+m;
    }else{
        int lidx = lp[0].second;
        int ridx = rp[0].second;
        for(int i = 0; i < N; i++){
            if(lp[i].first == lp[0].first){
                int idx = lp[i].second;
                if(R[idx] < R[lidx]) lidx = idx;
            }
        }
        for(int i = 0; i < N; i++){
            if(rp[i].first == rp[0].first){
                int idx = rp[i].second;
                if(L[idx] > R[lidx]) ridx = idx;
            }
        }
        int lmax = L[ridx];
        int rmin = R[lidx];
        int tmp = -100;
        // rが小さい順に見る
       // cout << lp[0].first << ' ' << rmin << endl;
        for(int i = 0; i < N;i++){
            int idx = rp[i].second;
            //if(idx != lidx && idx != ridx){
            if(true){
                if(R[idx] > rmin) break;
                int score = max(0, rp[i].first-lp[0].first+1)+max(0, rp[0].first-lmax+1);
                tmp = max(tmp, score);
                if(idx != lidx && idx != ridx){
                    lmax = max(lmax, L[idx]);
                    //cout << rp[i].first << ' ' << lmax << endl;
                    if(i == N-1){
                        //cout << 'H' << endl;
                        score = max(0, rmin-lp[0].first+1)+max(0, rp[0].first-lmax+1);
                        tmp = max(tmp, score);
                    }
                }
            }
        }

        int sect2 = max(0, R[ridx]-L[lidx]+1);
        int tmp2 = 0;
        for(int i = 0; i < N;i++){
            int idx = rp[i].second;
            if(idx != lidx && idx != ridx){
                int idx = rp[i].second;
                tmp2 = max(tmp2, sect2 + R[idx]-L[idx]+1);
                //cout << idx << ' ' << R[idx] - L[idx] << endl;
            }
        }
        // cout << sect2 << endl;
        // cout << lidx << ' ' << ridx << endl;
        // cout << tmp << ' ' << tmp2 << endl;
        ans = max(tmp, tmp2);
    }
    cout << ans  << endl;
}

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

int main() {
    int k; cin >> k;
    string s; cin >> s;
    if (s.size() <= k) cout << s;
    else {
        for (int i = 0; i < k; i++) {
            cout << s[i];
        }
        cout << "..." << endl;
    }
}


Measured memory_bytes: 3616
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <iterator>

using namespace std;

using P = pair<int, int>;
using i64 = int64_t;
i64 mod = 1000000007;
int int_max = 2147483647;
int max_n = 1e5;


int main(int argc, char **argv) {
    int a,b,x;
    cin >> a >> b >> x;

    double mass = a * a * b;
    double residual = mass - x;

    if (residual < x) {
        double height = residual / (a*a) * 2;
        cout << setprecision(10)<< atan2(height, (double)a) * (180/M_PI) << endl;
    } else {
        double height = (double)x / (a*b) * 2;
        cout << setprecision(10)<< (90. - atan2(height, (double)b) * (180/M_PI)) << endl;
    }
    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  rep(i, 0, N) cin >> a[i];
  vector<ll> D;
  rep(i, 0, N) {
    ll tmp = 0;
    rep(j, i, N) {
      tmp += a[j];
      D.push_back(tmp);
    }
  }
  ll mask = 0;
  ll ans = 0;
  for(int i = 50; i > -1; i--) {
    ll bit = 1LL << i;
    bit |= mask;
    int cnt = 0;
    rep(j, 0, D.size()) {
      if((D[j] | bit) == D[j]) cnt++;
    }
    if(cnt >= K) mask = bit;
  }
  cout << mask << endl;
  return 0;
}


Measured memory_bytes: 6388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << endl;}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
void solve() {
	var(int, h, w);
	vv(int, v, h + 1, w + 1, 0);
	rep(i, 1, h + 1) {
		rep(j, 1, w + 1) {
			cin >> v[i][j];
		}
	}
	vector<vi> ans;
	rep(i, 1, h) {
		rep(j, 1, w + 1) {
			if (v[i][j] & 1) {
				ans.eb(vi{i, j, i + 1, j});
				++v[i + 1][j];
			}
		}
	}
	rep(j, 1, w) {
		if (v[h][j] & 1) {
			ans.eb(vi{h, j, h, j + 1});
			++v[h][j + 1];
		}
	}
	print(len(ans));
	each(a, ans) {
		print(a[0], a[1], a[2], a[3]);
	}
}
int main() {
	solve();
	return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vi>

typedef long long ll;

int main() {
  int A, B, ans = 0;
  cin >> A >> B;
  if (A >= 13) {
    ans = B;
  } else if (A >= 6) {
    ans = B / 2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto memo = new int[](51);
  foreach (i; 0..10)
    foreach (j; 0..10)
      ++memo[i + j];

  string line;
  while ((line = readln) !is null) {
    auto n = line.chomp.to!int;
    auto r = 0;
    foreach (i; 0..n+1)
      r += memo[i] * memo[n - i];
    writeln(r);
  }
}

Measured memory_bytes: 2432