akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
template<class T> inline void YES(T condition) { 
    if(condition) cout << "YES" << endl;
    else cout << "NO" << endl;
}
template<class T> inline void Yes(T condition) {
    if(condition) cout << "Yes" << endl;
    else cout << "No" << endl;
}
template<class T> T gcd(T a, T b) {
    if(a && b) { return gcd(min(a, b), max(a, b) % min(a, b)); }
    else { return a; }
}
template<class T> T lcm(T a, T b){
    return a / gcd(a, b) * b;
}
const int MOD = 2019;
long long qpow(long long a, long long b) {
    if (b == 0) return 1;
    long long res = 1;
    while (b) {
        if (b & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        b >>= 1;
    }
    return res;
}

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

    int n, a, b, c;
    cin >> n >> a >> b >> c;
    vector<string> s(n);
    for (int i = 0; i < n; i++) cin >> s[i];
    map<string, vector<char>> m;
    m["AB"] = {'A', 'B'};
    m["AC"] = {'A', 'C'};
    m["BC"] = {'B', 'C'};
    map<char, int> cnt;
    cnt['A'] = a;
    cnt['B'] = b;
    cnt['C'] = c;
    bool ok = true;
    vector<char> res;
    for (int i = 0; i < n; i++) {
        vector<char> cur = m[s[i]];
        char ch1 = cur[0], ch2 = cur[1];
        int cnt1 = cnt[ch1], cnt2 = cnt[ch2];
        if (cnt1 > cnt2) swap(ch1, ch2); 
        if (cnt1 == cnt2) {
            if (cnt1 == 0) {ok = false; break;}
            if (i + 1 < n && s[i + 1].find(ch2) < (int)s[i + 1].size()) {
                swap(ch1, ch2);
            }
        }
        res.push_back(ch1);
        cnt[ch1]++;
        cnt[ch2]--;
    }
    if (!ok) cout << "No" << '\n';
    else {
        cout << "Yes" << '\n';
        for (char& ch: res) {
            cout << ch << '\n';
        }
    }
    

    return 0;
}


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

using namespace std;

void test()
{
    int n,d;
    cin>>n>>d;

    long long x,y;
    int res=0;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;

        x=abs(x);
        y=abs(y);

        if(sqrt(x*x+y*y)<=d)
            res++;
    }

    cout<<res<<endl;
}

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

    test();

    return 0;
}


Measured memory_bytes: 3668
def p(x):
  return bin(x).count('1')

def f(x):
  if x == 0:
    return 0
  return f(x%p(x)) + 1

N = int(input())
X = input()
cnt = X.count('1')
x = int(X,2)
a = x % (cnt + 1)
if cnt != 1:
  b = x % (cnt - 1)

for i in range(N):
  if X[i] == '0':
    k = a
    k += pow(2,N-i-1,cnt+1)
    k %= cnt+1
  else:
    if cnt == 1:
      print(0)
      continue
    k = b
    k -= pow(2,N-i-1,cnt-1) 
    k %= cnt-1  
  print(f(k)+1)

Measured memory_bytes: 9484
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	set<ll> s;
	ll N; cin >> N;
	for (int i = 0; i < N;i++) {
		ll A; cin >> A;
		if (s.find(A) == s.end()) {
			s.insert(A);
		}
		else {
			s.erase(A);
		}
	}
	cout << s.size() << endl;
	return 0;
}

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int gcd(int x, int y){
    if(y == 0) return x;
    return gcd(y, x%y);
}

int main()
{
    int x, y; cin >> x >> y;
    cout << gcd(x, y) << endl;
}


Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
        long long int n,g;
        g=__gcd(a,b);
        n=(a/g)*b;
        printf("%lld\n",n);

    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;
using ll = long long;
using namespace std;

int main(){
	int n; cin >> n;
	map<int, int> mp;
	while( n-- ){
		int t; cin >> t;
		++mp[t];
	}
	int ans = 0;
	for( auto p : mp ){
		if( p.first <= p.second ){
			ans += p.second-p.first;
		} else {
			ans += p.second;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 4736
//only Allah knows everything//
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef pair<int,int>pii;
#define N        1e9+7;
#define pb       push_back
#define pf       push_front
#define pi       acos(-1)
#define all(x)   x.begin(),x.end()
#define fast     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF      0x3f3f3f3f
ll mx=10000001;
ll p[10000005];
void sive()
{
    int i,j;
    for(i=1; i<mx; i++)
        p[i]=i;
    for(i=4; i<mx; i+=2)
        p[i]=2;
    for(i=3; i*i<=mx; i+=2)
    {
        if(p[i]==i)
        {
            for(j=i*i; j<=mx; j+=i)
            {
                if(p[j]==j)
                {
                    p[j]=i;
                }
            }
        }
    }
}
ll div(ll n)
{
    ll cunt=1;
    while(n!=1)
    {
        ll ct=1;
        ll tem=p[n];
        while(p[n]==tem)
        {
            ct++;
            n=n/p[n];
        }
        cunt*=ct;
    }
    return cunt;
}
ll  seive(ll n)
{
    ll i,j,m,cunt,sum;
    sum=1;
    for(i=2; i<=n; i++)
    {
        ll tem=div(i);
        sum+=(i*tem);
    }
    return sum;
}

int main()
{

    fast;
    sive();
    ll n;
    cin>>n;

    cout<<seive(n)<<endl;

    return 0;

}


Measured memory_bytes: 81732
n = int(input())
a = tuple(int(x) for x in input().split())

memo = tuple([None] * n for _ in range(n))
for i in range(n):
    memo[i][i] = a[i]

for l in range(n - 2, -1, -1):
    for r in range(l + 1, n):
        memo[l][r] = max(a[l] - memo[l + 1][r], a[r] - memo[l][r - 1])

print(memo[0][n - 1])

# [l,r]を
# l:=配列aの右端から左にシフト
# r:=lと一致する位置からn-1まで右にシフト
# と考えると、l==rは既にメモ化済みなので、l=n-2以前、r=l+1以降を調べればよい
# 漸化式で使う値は、
# lがより右にいるときの計算結果（前のループで計算済み）と
# rがより左にいるときの計算結果（一番左でもl==rなので計算済み）
# なので、参照する値がNoneになることはなく、Noneのチェックは不要になる

# if __name__ == '__main__':を辞めた


Measured memory_bytes: 162952
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define mk make_pair
#define pb push_back
#define vi vector<int>
#define fi first
#define se second
#define ms(a,b)  memset(a, b, sizeof(a))
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define M 1000005
vector<int> graph[M];
int col[M][2],MOD=1000000007;
// 0 black 1 white
int sm(int a,int b){return (a%MOD + b%MOD)%MOD;}
int pr(int a,int b){return (a%MOD * b%MOD)%MOD;}
void dfs(int x,int p){
    int u;
    for(int i=0;i<graph[x].size();i++){
        u=graph[x][i];
        if(u!=p){
            dfs(u,x);
            col[x][0]=pr(col[x][0],col[u][1]);
            col[x][1]=pr(col[x][1],sm(col[u][1],col[u][0]));
        }
    }
    return;
}
signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    int n,u,v;
    cin>>n;
    for(int i=0;i<n;i++)col[i][0]=col[i][1]=1;
    for(int i=0;i<n-1;i++)cin>>u>>v,u--,v--,graph[u].pb(v),graph[v].pb(u);
    dfs(0,-1);
    cout<<sm(col[0][0],col[0][1])<<endl;
    return 0;
}

Measured memory_bytes: 36608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
Int a[216000];
Int n, m;

bool ok(int border){
  Int sum = (border + n) * 2 - 1;
  for(int j = border * 2;j < 2*n;j++){
    if(a[j] + a[sum - j] < m)return false;
  }
  return true;
}

int main(){
  cin >> n >> m;
  for(int i = 0;i < n * 2;i++){
    cin >> a[i];
  }
  sort(a, a + n*2);
  int bottom = 0, top = n;
  if(ok(0))top = 0;
  while(top - bottom > 1){
    int mid = (top + bottom) / 2;
    if(ok(mid))top = mid;
    else bottom = mid;
  }
  Int res = 0;
  for(int i = 0;i < 2*n;i++){
    if(i < 2 * top){
      res = max(res, (a[i] + a[2 * top - 1 - i]) % m);
    }
    else{
      res = max(res, (a[i] + a[ 2 * (n + top) - 1 - i]) % m);
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int top,stack[200];
void push(int x){
	stack[++top]=x;
}

int pop(){
	int temp = stack[top];
	stack[top--]='\0';
	return temp;
}

int main(){
	top=-1;
	int a,b;
	int calc=0;
	char str[200];
	int i;
	while(scanf("%s",str)!=EOF){
		if(str[0]=='+'){
			b=pop();
			a=pop();
			push(a+b);
		}else if(str[0]=='-'){
			b=pop();
			a=pop();
			push(a-b);
		}else if(str[0]=='*'){
			b=pop();
			a=pop();
			push(a*b);
		}else{
			push(atoi(str));
		}
	}
	printf("%d\n",pop());
	return 0;
}

Measured memory_bytes: 548
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        
        String S = sc.nextLine();
        String[] SS = S.split("");
        
        int count = 0;
        int iw = 0;
        
        int count1 = 0;
        
            
        if(SS[0].equals("A")){
            
            for(int i=2; i<S.length()-1; i++){
                if(SS[i].equals("C")){
                   count++; 
                   iw = i;
                }
            }
            
        }
        
        
        for(int i=0; i<S.length(); i++){
            if(count == 1){
               if(Character.isUpperCase(S.charAt( i ))){
                   count1++;
               }
            }
        }
        
        if(count1 == 2){
            System.out.println("AC");
        }else{
            System.out.println("WA");
        }
        
    }
        
}


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

int main(int argc, char **argv)
{
	ll w, h;
	cin >> w >> h;
	double x, y;
	cin >> x >> y;

	double res = static_cast<double>(w) * h / 2;
	std::cout << fixed << setprecision(10) << res <<  std::endl;

	if (2*x == w && 2*y == h) std::cout << 1 << std::endl;
	else std::cout << 0 << std::endl;
		
}

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

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

Measured memory_bytes: 3768
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

N = I()

ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    s = str(input())
    if s == 'AC':
        ac += 1
    elif s == 'WA':
        wa += 1
    elif s == 'TLE':
        tle += 1
    else:
        re += 1

print('AC x',ac)
print('WA x',wa)
print('TLE x',tle)
print('RE x',re)

Measured memory_bytes: 85240
#include <iostream>
#include <math.h>
#include <string.h>

using namespace std;

int N,M;
int* k;
int** s;
int* p;

int check_all_lamp(int* state){
    bool all_on = true;
    for (int i = 0; i < M; i++)
    {   
        int sum = 0;
        for (int j = 0; j < k[i]; j++)
        {
            sum += state[s[i][j]-1];
        }
        if (sum%2!=p[i])all_on = false;
    }
    return all_on?1:0;
}

int dfs(int depth,int* state){
    if(depth==N) return check_all_lamp(state);
    else{
        int* s0 = (int*)malloc(sizeof(int)*N);
        int* s1 = (int*)malloc(sizeof(int)*N);
        memcpy(s0,state,sizeof(int)*N);
        memcpy(s1,state,sizeof(int)*N);
        s0[depth] = 0;
        s1[depth] = 1;
        return dfs(depth+1,s0)+dfs(depth+1,s1);
    }
}

int main(){
    cin >> N >> M;
    k = (int*)malloc(sizeof(int)*M);
    s = (int**)malloc(sizeof(int*)*M);
    for (int i = 0; i < M; i++)
    {
        cin >> k[i];
        s[i] = (int*)malloc(sizeof(int)*k[i]);
        for (int j = 0; j < k[i]; j++)
        {
            cin >> s[i][j];
        }
        
    }
    p = (int*)malloc(sizeof(int)*M);
    for (int i = 0; i < M; i++)
    {
        cin >> p[i];
    }
    
    int* state = (int*)calloc(N,sizeof(int));
    int rlt = dfs(0,state);
    
    std::cout << rlt << endl;

    return 0;
    
}

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

using namespace std;

using int64 = long long;

int N, A[100000];

bool check()
{
  int even = 0, odd = 0;
  for(int i = 0; i < N; i++) {
    if(A[i] & 1) ++odd;
    else ++even;
  }
  if(even & 1) return (true);
  if(odd > 1) return (false);
  for(int i = 0; i < N; i++) {
    if(A[i] == 1) return (false);
    if(A[i] & 1) --A[i];
  }
  int gcd = 0;
  for(int i = 0; i < N; i++) {
    gcd = __gcd(gcd, A[i]);
  }
  for(int i = 0; i < N; i++) {
    A[i] /= gcd;
  }
  return !check();
}

int main()
{
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  if(check()) cout << "First" << endl;
  else cout << "Second" << endl;
}

Measured memory_bytes: 640
#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 ll mod = 1000000007;
const double eps = 1e-8;

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    int N, P; string S;
    cin >> N >> P >> S;

    vector<int> d(N);
    for (int i=0; i<N; ++i) d[i] = S[i] - '0';

    if (P == 2 || P == 5) {
        ll res = 0;
        for (int i=0; i<N; ++i) {
            if (d[i] % P == 0) res += i+1;
        }
        cout << res << endl;
        return 0;
    }

    ll res = 0;
    map<int,int> modp;
    modp[0] = 1;
    
    ll r = 0, r10 = 1;
    for (int i=N-1; i>=0; --i) {
        (r += d[i] * r10) %= P;
        res += modp[r];
        modp[r] ++;
        (r10 *= 10) %= P;
    }
    cout << res << endl;

    return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const double PI = atan(1.0) * 4.0;
// const int MOD = 998244353;
const ll LINF = 9e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};

ll N;
VL H;

signed main() {
    cin >> N;
    REP(i, N) {
        LCIN(h);
        if(i && h > H[i - 1]) {
            H.emplace_back(h - 1);
        } else
            H.emplace_back(h);
    }
    REP(i, N - 1) {
        if(H[i + 1] < H[i]) eputs("No");
    }
    puts("Yes");
}

Measured memory_bytes: 1400
#include<iostream>
#include<stdio.h>
#include<iomanip>
using namespace std;

int main() {

  int a, b, c;
  cin >> a >> b >>c;
  if(a+b>=c){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int card[255][14]={{0}};
int main(void){
 int n;
 cin>>n;
 for(int i=0; i<n; i++){
     char c;
     int num;
     cin>>c>>num;
     card[(int)c][num]=1;
 }
 for(int i=1; i<=13; i++){
     if(card[(int)'S'][i]==0){
         cout<<"S "<<i<<endl;
     }
 }
 for(int i=1; i<=13; i++){
     if(card[(int)'H'][i]==0){
         cout<<"H "<<i<<endl;
     }
 }
 for(int i=1; i<=13; i++){
     if(card[(int)'C'][i]==0){
         cout<<"C "<<i<<endl;
     }
 }
 for(int i=1; i<=13; i++){
     if(card[(int)'D'][i]==0){
         cout<<"D "<<i<<endl;
     }
 }
}


Measured memory_bytes: 3088
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int gcd (int a, int b)
{
	if (a > b){
		swap(a,b);
	} // end if
	while (b % a != 0){
		b = b % a;
		if (a > b){
			swap(a,b);
		} // end if
	} // end while

	return a;
}
long lcm (int a, int b)
{
	long res = a/gcd(a,b);
 	res *= b;
	return res;
}
int main()
{
//	cut here before submit 
//	freopen("testcase.gl", "r", stdin);
	string str = "";

	while (getline (cin, str )){
		int a, b;
		stringstream ss(str);
		ss >> a >> b;
		cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
	} // end for

	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define rep1(i,s,e) for(int i=s;i<e;i++)
#define rep2(i,s,e,c) for(int i=s;i>=e;i--)
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define pfn() printf("\n")
#define pfs() printf(" ")
#define sfi(x) scanf("%d",&x)
#define sfi1(x,y) scanf("%d%d",&x,&y)
#define sff(x) scanf("%lf",&x)
#define sfl(x) scanf("%lld",&x)
#define memset1(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
const int MAX = 1e4 + 50;
const int mod = 996873654;
int main(){
	ll n;
	sfl(n);
	ll ans=n*(n-1)/2;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
	int n, i, tmp;
	vector<int> p;
	int mini = 2 * 100000 + 1, answer = 0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> tmp;
		p.push_back(tmp);
	}

	for (i = 0; i < n; i++) {
		if (mini > p[i]) {
			answer++;
			mini = p[i];
		}
	}

	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;

struct P {
  double x, y;
};

vector<P> p;

double dist(P a, P b) {
  double dx = a.x - b.x;
  double dy = a.y - b.y;
  return sqrt(dx * dx + dy * dy);
}
double f(double x, double y) {  // 一番遠い点との距離
  double res = .0;
  rep(i, 0, N - 1) { chmax(res, dist((P){x, y}, p[i])); }
  return res;
}
void input() {
  ;
  cin >> N;
  p = vector<P>(N);
  rep(i, 0, N - 1) { cin >> p[i].x >> p[i].y; };
}

double g(double x) {
  double l = .0, r = 1000.0;
  rep(i, 0, 80) {
    double c1 = (l * 2 + r) / 3;
    double c2 = (l + r * 2) / 3;
    if (f(x, c1) > f(x, c2)) {
      l = c1;
    } else {
      r = c2;
    }
  }
  return f(x, l);
}
void solve() {
  // 三分探索
  double l = .0, r = 1000.0;
  rep(i, 0, 80) {
    double c1 = (l * 2 + r) / 3;
    double c2 = (l + r * 2) / 3;
    if (g(c1) > g(c2)) {
      l = c1;
    } else {
      r = c2;
    }
  }

  double ans = g(l);
  printf("%.10f\n", ans);
  ;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
 
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int main() {
    
    int n;
    cin >> n;
    double pi = 3.14 * 2;
    cout << pi * n;
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
template<class T>
void dump(vector<T> &vec){
	for(int i=0;i<vec.size();i++){
		cout << vec[i];
		if(i+1<vec.size())cout << ' ';
		else cout << endl;
	}
	return;
}
int H,W;
string s[10];
int a[10],b[10];
int main(){
	cin >> H >> W;
	for(int i=0;i<H;i++){
		cin >> s[i];
	}
	for(int i=0;i<H;i++){
		a[i] = 100;
		b[i] = -1;
		for(int j=0;j<W;j++){
			if(b[i]!=-1&&b[i]+1<j&&s[i][j]=='#'){
				cout << "Impossible" << endl;
				return 0;
			}
			if(s[i][j] == '#'){
				a[i] = min(j,a[i]);
				b[i] = max(j,b[i]);
			}
		}
	}
	for(int i=1;i<H;i++){
		if(a[i]!=b[i-1]){
				cout << "Impossible" << endl;
				return 0;
		}
	}
	cout << "Possible" << endl;	
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;

#define rep(var,n)  for(int var=0;var<(n);++var)
#define ALL(c)  (c).begin(),(c).end()

ll solve1(ll L, int N, vll& x, vll& _x) {
    vll ax(N+1), a_x(N+1);
    ax[0] = a_x[0] = 0;
    rep(i,N) {
        ax[i+1] = ax[i] + x[i];
        a_x[i+1] = a_x[i] + _x[i];
    }

    ll best = 0;
    for (int n=1; n<=N; ++n) {
        int pos = n+(N-n)/2, neg = N-pos;
        ll curr = 2*(ax[pos]-ax[n-1]) + 2*(a_x[neg]-a_x[0]);
        if ((N-n) % 2){
            curr -= _x[neg-1];
        } else {
            curr -= x[pos-1];
        }
        best = max(best, curr);
    }
    return best;
}

int main() {
    ll L; int N; scanf("%lld%d", &L, &N);

    vll X(N);
    rep(i,N) scanf("%lld", &X[i]);

    vll _X(N);
    rep(i,N) _X[i] = L - X[N-1-i];

    ll a = solve1(L,N,X,_X);
    ll b = solve1(L,N,_X,X);
    cout << max(a,b) << endl;
    return 0;
}


Measured memory_bytes: 6528
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	int a[400], b, c, x, y, n = 0, m = 0;
	for(int i = 0; i <= 320; i++)
	{
		a[i] = i * i;
		}
		scanf("%d %d", &b, &c);
		x = b;
		y = c;
		do
		{
			y = y / 10;
				m++;
			}while(y != 0);
			for(int i = 0; i < m; i++)
			{
				b = b * 10;
				}
				y = b + c;
				for(int i = 0; i <= 320; i++)
				{
					if(y == a[i])
					{
						printf("Yes\n");
						return 0;
						}
					}
					printf("No\n");
					return 0;
	}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
        String s;
        int m, h;
        Scanner sc = new Scanner(System.in);
        while(true){
            s = sc.next();
            if(s.equals("-")) break;
            m = sc.nextInt();
            for(int i = 0; i < m; i ++){
                h = sc.nextInt();
                s = s.substring(h) + s.substring(0, h);
            }
            System.out.println(s);
        }

    }
}


Measured memory_bytes: 26568
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Stack;
import java.util.Scanner;
import java.util.Queue;

/**
 * @author yoshikyoto
 */
class Main{
	static final boolean DEBUG = false;
	static Scanner sc = new Scanner(new InputStreamReader(System.in));
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public static void main(String args[]) throws Exception{
		int n = parseInt(readLine());
		for(int i = 0; i < n; i++){
			int t[] = parseInt(readLine().split(" "));
			Arrays.sort(t);
			t[0] *= t[0]; t[1] *= t[1]; t[2] *= t[2];
			if(t[0] + t[1] == t[2]){
				p("YES");
			}else{
				p("NO");
			}
		}
	}

	public static String readLine() throws IOException{return br.readLine();}
	public static int readInt(){return sc.nextInt();}
	public static void pa(Object[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(int[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(double[] arr){System.out.println(Arrays.toString(arr));}
	public static void pa(boolean[] arr){System.out.println(Arrays.toString(arr));}
	public static void p(Object o){System.out.println(o.toString());}
	public static void d(Object o){if(DEBUG)System.out.println(o.toString());}
	public static void da(int[] arr){if(DEBUG)System.out.println(Arrays.toString(arr));}
	public static void sort(int[] a){Arrays.sort(a);}
	public static int[] parseInt(String[] arr){
		int[] res = new int[arr.length];
		for(int i = 0; i < arr.length; i++)res[i] = Integer.parseInt(arr[i]);
		return res;
	}
	public static int parseInt(Object o){return Integer.parseInt(o.toString());}
	public static int digit(int n){return String.valueOf(n).length();}
}

class MyHashMap<E> extends HashMap<E, Integer>{
	ArrayList<E> keyArray = new ArrayList<E>();
	public void add(E key){add(key, 1);}
	public void add(E key, Integer value){
		if(containsKey(key)){
			value += get(key);
		}else{
			keyArray.add(key);
		}
		put(key, value);
	}
}

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

using namespace std;

int main()
{
	int r,g,b;
	int num=0;
	cin>>r>>g>>b;
	num=r*100+g*10+b;
	if(num%4==0)
	{
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import sys
import numpy as np
# from decimal import Decimal
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

w, h, n = map(int, readline().split())
left = 0
right = w
up = h
down = 0

s = w * h
for i in range(n):
    x, y, a = map(int, readline().split())
    if (a == 1):
        left = max(x, left)
    elif (a == 2):
        right = min(x, right)
    elif (a == 3):
        down = max(y, down)
    else:
        up = min(y, up)

    if (right - left <= 0) or (up - down <= 0):
        print(0)
        exit()

ans = (right - left) * (up - down)
print(ans)


Measured memory_bytes: 27172
#include<stdio.h>

int main()
{
	int a,b,c;
	int tmp;

	scanf("%d%d%d", &a, &b, &c);
	if (a > b) tmp = a, a = b, b = tmp;
	if (b > c) {
		tmp = b, b = c, c = tmp;
		if (a > b) tmp = a, a = b, b = tmp;
	}
	printf("%d %d %d\n", a, b, c);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <complex>
#include <utility>
using namespace std;

typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;

#define X real()
#define Y imag()

double dot(Vector a, Vector b){
    return a.X * b.X + a.Y * b.Y;
}

double norm(Vector a){
    return a.X * a.X + a.Y * a.Y;
}

Point project(Segment s, Point p){
    Vector base = s.second - s.first;
    double r = dot(p - s.first, base) / norm(base);
    return s.first + base * r;
}

int main(){
    double x1, y1, x2, y2; cin>>x1>>y1>>x2>>y2;
    Line li = {Point(x1, y1), Point(x2, y2)};
    int q; cin>>q;
    while(q--){
        double x, y; cin>>x>>y;
        Point ansp = project(li, Point(x, y));
        printf("%.10f %.10f\n", ansp.X, ansp.Y);
    }
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  REP(i, N){
    cin >> a[i];
  }
  REP(i, N){
    if(a[i] % 2){
      cout << "first" << endl;
      return 0;
    }
  }
  cout << "second" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <iostream>
using namespace std;

#define rp(i,t) for(int i=0;i<(t);i++)
#define rep(i,s,t) for(int i=(s);i<=(t);i++)
#define rsp(i,s,t) for(int i=(s);i<(t);i++)
#define rrp(i,t,s) for(int i=(t);i>=(s);i--)
#define rcp(i,s,b,d) for(int i=(s);b;d)
#define mst(a,x) memset(a,x,sizeof(a))
#define INF 0x3f3f3f3f
#define N 502

#define Dp puts("")
#define Dw printf
#define Ds printf("#")

typedef long long ll;
bool b[N][N];
char ch;
int n,m;

inline void read(int &x){x=0;do{ch=getchar();}while(ch<'0'||'9'<ch);do{x=x*10+ch-'0';ch=getchar();}while('0'<=ch&&ch<='9');}
inline void read(char &c){do{c=getchar();}while(c!='.'&&c!='#');}

int main(void)
{
	read(n),read(m);
	rep(i,1,n)rep(j,1,m)
	{
		read(ch);
		if(ch=='#')b[i][j]=true;
	}
	rep(i,1,n)
	{
		printf("#");
		rsp(j,2,m)
		{
			if((i&1)||b[i][j])printf("#");
			else printf(".");
		}
		printf(".\n");
	}
	printf("\n");
	rep(i,1,n)
	{
		printf(".");
		rsp(j,2,m)
		{
			if((i&1)==0||b[i][j])printf("#");
			else printf(".");
		}
		printf("#\n");
	}
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        String c[] = sc.next().split("");

        int right = c.length-1;
        int left = 0;

        int count = 0;

        while (left < right) {
            if (c[left].equals("R")) {
                left++;
            }
            if (c[right].equals("W")) {
                right--;
            }

            if (left >= right) {
                break;
            }
            if (c[left].equals("W") && c[right].equals("R")) {
                String s = c[left];
                c[left] = c[right];
                c[right] = s;
                count++;
            }
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 66640
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    int N,Ma,Mb;
    int a[57]={},b[57]={},c[57]={};//57は素数
    int dp[41][410][410];
    REP(i,41){REP(j,410){REP(k,410){dp[i][j][k]=INF;}}}
    dp[0][0][0]=0;
    cin >> N >> Ma >> Mb;
    OREP(i,N){
        cin >> a[i] >> b[i] >> c[i];
    }
    OREP(i,N){
        REP(j,N*10){
            REP(k,N*10){
                if(j-a[i]>=0&&k-b[i]>=0){
                    dp[i][j][k]=min(dp[i-1][j][k],dp[i-1][j-a[i]][k-b[i]]+c[i]);
                }else{
                    dp[i][j][k]=dp[i-1][j][k];
                }
            }
        }
    }
  	REP(i,N+1){
  		REP(j,7){
      		REP(k,7){
        		int y=dp[i][j][k];
        		if(y==INF){cerr << "INF ";}else{cerr << y << " ";}
      		}cerr << endl;
    	}cerr << endl << endl;
    }cerr << endl;
    int Ans=INF;
    for(int i=1;i<=N;i++){
        Ans=min(Ans,dp[N][i*Ma][i*Mb]);
    }
    out(Ans!=INF,Ans,-1);
    return 0;
}   


Measured memory_bytes: 54144
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int A[1];
int size=1;
int m=2;
#define N 101
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)
/*
bool prime(ll n){if(n==1)return false;for(ll i=2;i*i<=n;i++)if(n%i==0){return false;}return true;}
void prime_fact(int n){for(int i=2;i*i<=n;i++){int count=0;if(n%i==0){while(n%i==0)n/=i,count++;cout<<i<<"^"<<count<<" ";}}if(n>1)cout<<n<<"^1";}
ll power(ll base ,ll pow){ll res=1;while(pow>0){if(pow&1)res*=base,pow-=1;else base*=base,pow/=2;}return res;}
void prime_fact_seieve(int n){for(int i=2;i<=size;i++){if(A[i]==0)for(ll j=i;j<=size;j+=i)if(A[i]==0)A[j]=i;}while(n>2){cout<<A[n]<<"*";n/=A[n];}}
template <class X> X gcd(X a , X b) { return b==0?a: gcd( b, a%b); }
template <class X> X lcm(X a , X b) { return a/gcd(a,b) * b ; }
ll Ab[N][N],I[N][N];  // identity matrix and a matrix to store result
void multiply(ll I[][N],ll A[][N],int dim)
{   int res[dim+1][dim+1];
    for(int i=0;i<dim;i++)
    {  for(int j=0;j<dim;j++)
        {
           res[i][j]=0;
           for(int k=0;k<dim;k++)
           {  res[i][j]+=((I[i][k]%mod)*(A[k][j])%mod)%mod;}}}

        for(int i=0;i<dim;i++)
            for(int j=0;j<dim;j++)
                I[i][j]=res[i][j];}
void powerMat(ll A[][N],int dim,int n)
{   for(int i=0;i<dim;i++)
    for(int j=0;j<dim;j++)
    {if(i==j) I[i][j]=1;
     else     I[i][j]=0;}
     while(n>0)
     {
         if(n%2)
         multiply(I,A,dim),n--;
         else
         multiply(A,A,dim),n/=2;
     }
     for(int i=0;i<dim;i++)
         for(int j=0;j<dim;j++)
             A[i][j]=I[i][j];
}
void printMat(ll A[][N],int dim)
{
    for(int i=0;i<dim;i++)
    {for(int j=0;j<dim;j++)
        {
            cout<<A[i][j]<<" ";
        }cout<<"\n";}
}
// REMEMBER PREFIX SUM SUFFIX SUM OR GCD VERY INTERESTING QUESTIONS
ll power(ll base ,ll pow,ll mo){ll res=1;while(pow>0){if(pow&1)res=(res%mo*base%mo)%mo,pow-=1;else base=(base%mo*base%mo)%mo,pow/=2;}return res;}*/
bool Binary(vector<int> arr,int n,int ele,int b)
{  int l=0,r=n-1,m;
   while(l<=r)
   {
       m=l+(r-l)/2;
       if(arr[m]==ele)
       {arr[m]=b;return true;}
       else if(arr[m]>ele)
           r=m-1;
       else
           l=r+1;
   }
    return false;

}

int main() {
    fast;
    string str1,str2;
    cin>>str1>>str2;
    int count=0;
    f(i,str1.size())
    {if(str1[i]!=str2[i])
        count++;
        
    }
    cout<<count;



}


Measured memory_bytes: 3808
//0620
#include<stdio.h>
int main(void){
	int a[101],n,m,i,b,t;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(i=1;i<=m;i++){
		b=1;
		while(b!=n){
			if(a[b]%i>a[b+1]%i){
				t=a[b];
				a[b]=a[b+1];
				a[b+1]=t;
			}
			b++;
		}
	}
	for(i=1;i<=n;i++){
		printf("%d\n",a[i]);
	}
	return 0;
}

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

typedef long long ll;
#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(a) (a).begin(), (a).end()
using namespace std;

int main() {
    int N;
    ll L[87] = {2, 1};
    cin >> N;
    FOR(i, 2, N + 1) L[i] = L[i - 1] + L[i - 2];
    cout << L[N] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<int> t(n+1),x(n+1),y(n+1);
  rep(i,n) cin >> t[i+1] >> x[i+1] >> y[i+1];
  
  rep(i,n){
    int d = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
    int dt = t[i+1]-t[i];
    if(d>dt || dt%2!=d%2){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  
  int i = 0;
  int sum = 0;
  
  int x = max(2*a -1,2*b-1);
  
  int wao = max(x,a+b-1);
  
  int ans = max(wao,a+b);
    
  cout << ans;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	int i, limit;
     	int[] distance = new int[5];
      	for(i = 0; i < 5; i++) distance[i] = Integer.parseInt(sc.next());
      	limit = Integer.parseInt(sc.next());
      	if(distance[4] - distance[0] > limit) System.out.println(":(");
      	else System.out.println("Yay!");
    }
}


Measured memory_bytes: 23764
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val n = readString()
    println(if (n.contains('7')) "Yes" else "No")
}


Measured memory_bytes: 35752
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define tarce(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define scan2() int n,k; cin>>n>>k ; int a[n+1]; for(int i = 1 ; i<=n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define mem(a,v) memset(a,v,sizeof(a))
#define pii pair<int,int>
#define mkp make_pair
using namespace std;
#define N 10000008

int f[N];

void sieve(){
    int i,j;
    for(i=1; i<N; i++)f[i]=1;
    for(i=2; i<=N; i++){
        for(j=i; j<N; j+=i){
            f[j]++;
        }
    }
    // for(i=1; i<N; i++){
    //     trace2(i,f[i]);
    // }
}

void solve(){
    sieve();
    int n;
    cin >> n;
    int ans=0,i,j;
    for(i=1; i<=n; i++){
        ans=ans+(i*f[i]);
    }
    cout << ans << '\n';
}




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

        int tt;
        tt=1;
      //  cin >> tt;
        while(tt--){
            solve();
        }
        

}

Measured memory_bytes: 81740
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
    int n, m, t;
    cin>>n>>m>>t;
    map<int, multiset<int>>p1;
    map<int, multiset<int>>p2;
    map<pair<int, int>, int>u;
    int mx1 = 0, mx2 = 0, id1 = 0, id2 = 0;
    for(int i = 0; i < t; i++){
        int h, w;
        cin>>h>>w;
        u[{h, w}]++;
        p1[h].in(w);
        p2[w].in(h);
        mx1=max(sz(p1[h]), mx1);
        mx2=max(sz(p2[w]), mx2);
    }   
    int aa=mx1+mx2;
    vi a, b;
    map<pair<int, int>, int>ans;
    for(auto i:p1){
        if(sz(i.s)==mx1)a.pb(i.f);
    }
    for(auto i:p2){
        if(sz(i.s)==mx2)b.pb(i.f);
    }
    for(int i = 0; i < sz(a); i++){
        for(int j = 0; j < sz(b); j++){
            if(!u[{a[i], b[j]}]){
                cout<<aa;
                return;
            }
        }
    }
    cout<<aa-1;
}
signed main(){
    speed;
    int t=1;
    //cin>>t;
    while(t--)solve();
}

Measured memory_bytes: 114676
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    N = i_input()
    A = i_list()

    def solve(f):
        acc = 0
        cnt = 0
        for a in A:
            acc += a
            if f and acc <= 0:
                 cnt += 1 - acc
                 acc = 1
            elif not f and acc >= 0:
                cnt += acc + 1
                acc = -1
            f = not f
        return cnt

    print(min(solve(True), solve(False)))






if __name__=="__main__":
    main()


Measured memory_bytes: 90512
#include<iostream>
#include<cstdio>
#include<map>
#include<sstream>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    int n,k,x,y;
    cin >> n >>k >>x >> y;
    int ans = 0;
    for(int i = 1; i <= n; i ++)
    {
        if(i<=k)ans+=x;
        else ans+=y;
    }
    cout << ans << endl;
    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		try{
			String era = null;		// ??´???
			int eraYear = 0;		// ??´????????´??°

			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String oneline = null;

			for(;(oneline = br.readLine()) != null ;){
//				oneline = br.readLine();
				String[] line = oneline.split(" ");	// 0 -> ??´??????1 -> ??????2 -> ??\
				int[] d = {0, 0, 0};
				for(int i=0; i<3; i++){
					d[i] = Integer.parseInt(line[i]);
				}

				if(d[0]>=1990 || (d[0]==1989 && d[1]>=2) || (d[0]==1989 && d[1]==1 && d[2]>=8)){
					era = "heisei";
					eraYear = d[0]-1989+1;
					System.out.println(era+ " "+ eraYear+ " "+ d[1]+ " "+ d[2]);
				}
				else if(d[0]>=1927 || (d[0]==1926 && d[1]==12 && d[2]>=25) ){
					era = "showa";
					eraYear = d[0]-1926+1;
					System.out.println(era+ " "+ eraYear+ " "+ d[1]+ " "+ d[2]);
				}
				else if(d[0]>=1913 || (d[0]==1912 && d[1]>=8) || (d[0]==1912 && d[1]==7 && d[2]>=30)){
					era = "taisho";
					eraYear = d[0]-1912+1;
					System.out.println(era+ " "+ eraYear+ " "+ d[1]+ " "+ d[2]);
				}
				else if(d[0]>=1869 || (d[0]==1868 && d[1]>=10) || (d[0]==1868 && d[1]==9 && d[2]>=8)){
					era = "meiji";
					eraYear = d[0]-1868+1;
					System.out.println(era+ " "+ eraYear+ " "+ d[1]+ " "+ d[2]);
				}
				else{
					System.out.println("pre-meiji");
				}			
			}
		}

		catch(IOException e){
			System.out.println(e);
		}
	}

}

Measured memory_bytes: 24140
a = [list(map(int, input().split())) for _ in range(5)]
mod = 9
ans = 0
c = 0
 
for i in range(5):
    modi = (a[i][0]%10)
    if modi != 0:
        mod = min(mod, modi)
    else:
        c += 1
    ref = (0 - -a[i][0]//10)*10
    ans += ref
if c != 5:
    mod = 10 - mod
    ans = ans - mod
print(ans)

Measured memory_bytes: 3064