akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC168_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();
            int digit1 = int.Parse(N.Substring(N.Length - 1, 1));

            int[] hon = { 2, 4, 5, 7, 9 };
            int[] pon = { 0, 1, 6, 8 };
            int[] bon = { 3 };

            if (hon.Contains(digit1))
            {
                Console.WriteLine("hon");
            }
            else if (pon.Contains(digit1))
            {
                Console.WriteLine("pon");
            }
            else if (bon.Contains(digit1))
            {
                Console.WriteLine("bon");
            }
        }
    }
}

Measured memory_bytes: 27840
//Switching Railroad Cars

//vñF0ªüÍ³ê½çStack©çpopµÄ»êðoÍµëA»êÈOÍpushµÆ¯
//üÍª³µ¢±ÆÍÛá³êÄ¢é@¿ÈÝÉpush³êéàÌÍ1`10çµ¢

//ÅÍX^bNÍóÅ é

#include<iostream>
#include<stack>
using namespace std;

int main(void)
{
	stack<int> s;
	int x;
	while(cin >> x)
	{
		if(!x)
		{
			cout << s.top() << endl;
			s.pop();
		}
		else
			s.push(x);
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))

X = [0] * N
x_1 = sum(A) // 2 - sum(a for n, a in enumerate(A) if n % 2)
X[0] = x_1
for i in range(1, N):
    X[i] = A[i - 1] - X[i - 1]
X = map(lambda x: str(2 * x), X)
print(" ".join(X))


Measured memory_bytes: 18120
from sys import stdin
readline = stdin.readline

h,n=map(int, readline().split())
l=[list(map(int, readline().split())) for _ in range(n)]

inf=float('inf')
dp=[inf]*(h+1)
dp[0] = 0

for i in range(h):
    for a, b in l:
        x=i+a
        if x>h:
            x=h
        y=dp[i]+b
        if y<dp[x]:
            dp[x]=y

print(dp[h])

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

using namespace std;

int main(){
	int n,m;
	while(cin >> n >> m,n){
		vector<pair<int,pair<int,int>>> v;
		for(int i=0;i<m;i++){
			int t,s,d;
			cin >> t >> s >> d;
			v.emplace_back(make_pair(t,make_pair(s,d)));
		}
		bool infected[20000];
		for(int i=0;i<20000;i++) infected[i] = false;
		infected[0] = true;
		sort(v.begin(),v.end());
		for(auto x:v){
			if(infected[x.second.first-1]){
				infected[x.second.second-1] = true;
			}
		}
		int ans = 0;
		for(int i=0;i<20000;i++){
			if(infected[i]){
				//cout << i << endl;
				ans++;
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3368
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << " : " << x << endl

namespace atcoder {
	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;
}

using namespace atcoder;

int main() {
	int N;
	lli total_a = 0, total_b = 0;
	lli poor = 0;
	cin >> N;
	vector<lli>a(N), b(N), c(N);
	priority_queue<lli> p;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		total_a+= a[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> b[i];
		total_b+=b[i];
	}
	for (int i = 0; i < N; i++) {
		c[i] = a[i] - b[i];
		if (c[i] < 0) {
			poor++;
		}
		else {
			p.push(c[i]);
		}
	}
	if (total_a < total_b) {
		cout << -1 << endl;
		return 0;
	}
	lli v = 0;
	int ans= 0;
	lli moves = 0;
	for (int i = 0; i < N; i++) {
		if (c[i] < 0) {
			ans++;
			bool flag = false;
			while (1) {
				if (v == 0) {
					if (p.empty())
						break;
					v = p.top(); p.pop();
					ans++;
				}
				if (abs(c[i]) <= v) {
					v += c[i];
					moves -= c[i];
					c[i] = 0;
					flag = true;
					break;
				}
				else {
					c[i] += v;
					v = 0;
					moves += v;
				}
			}
			if (!flag) {
				cerr << "wtf" << endl;
				cout << -1 << endl;
				return 0;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3576
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);
		int amount = scan.nextInt();
		long[] num = new long[amount];
		for (int i = 0; i < amount; i++) {
			num[i] = scan.nextLong();
		}
		
		// Calculate Max
		long max = num[0];
		for (int i = 0; i < amount; i++) {
			if (num[i] >= max)
				max = num[i];
		}
		
		// Calculate min
		long min = num[0];
		for (int i = 0; i < amount; i++) {
			if (num[i] <= min)
				min = num[i];
		}
		
		// Calculate Sum
		long sum = 0;
		for (int i = 0; i < amount; i++) {
			sum += num[i];
		}
		
		System.out.println(min + " " + max + " " + sum);
	}
}

Measured memory_bytes: 31220
#include <stdio.h>

void insertionSort(int [], int);

void printArray(int *, int);

int main()
{
    int n, i, arr[100];
    scanf("%d", &n);
    for(i = 0; i < n; i++)
        scanf("%d", arr + i);
    printArray(arr, n);
    insertionSort(arr, n);
    return 0;
}


void insertionSort(int arr[], int n)
{
    int i, j, key;
    for (i = 1; i < n; i++) {
	key = arr[i];
	j = i - 1;
        while (0 <= j && key < arr[j]) {
	    arr[j + 1] = arr[j];
	    j--;
	};
	arr[j + 1] = key;
        printArray(arr, n);
    }	
}

void printArray(int arr[], int n)
{
    int i;
    for (i = 0; i < n; i++){
	printf("%d", arr[i]);
	if (i < n - 1) {
	    printf(" ");
        } else {
            printf("\n");
	}
    }
}




Measured memory_bytes: 2036
N,Y=list(map(int,input().split()))
flag=0
Y//=1000
z=Y%5
Y-=z
N-=z
for i in range(N+1):
    if flag==1:
        break
    for j in range(N+1-i):
        if flag==1:
            break
        k=N-i-j
        if i*10+j*5+k*1==Y:
            print(i,j,k+z)
            flag=1
if flag==0:
    print("-1 -1 -1")

Measured memory_bytes: 40812
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } 
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } 

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())

int n;
int cnt[100010];

void init() {
}

void input() {
	cin >> n;
	MSET(cnt, 0);
	REP(i, n) {
		int a;
		cin >> a;
		cnt[a+1]++;
	} 
}

void solve() {
	int res = 0;
	FOR(i, 1, 100010) {
		chmax(res, cnt[i-1]+cnt[i]+cnt[i+1]);
	}
	cout << res << endl;
}

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








Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#include <iomanip>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<complex>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;

//最大公約数
long long gcd(long long a, long long b)
{
	long long tmp, r;
	if (a < b)
	{
		tmp = a;
		a = b;
		b = tmp;
	}
	r = a % b;
	while (r != 0)
	{
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	ll n, k;
	cin >> n >> k;

	if (n >= k)
	{
		n %= k;
	}

	if (n == 0)
	{
		cout << 0 << endl;
		ret;
	}

	cout << min(n,k-n) << endl;

	debug;

	return 0;
}

Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define A(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
void _read();

const int nax = 1e5 + 11, mod = 1e9 + 7;
int n;
vector<int> adj[nax];
int dp[nax][2];

void dfs( int u = 1, int p = 1 ) {
      bool is = true;
      dp[u][0] = dp[u][1] = 1;
      for( int v : adj[u]) {
            if ( v == p ) continue; 
            dfs(v,u);
            (dp[u][0] *= (dp[v][0]+dp[v][1])%mod) %= mod;
            (dp[u][1] *= dp[v][0]) %= mod;
      }
}

main () { _read(); 
      cin >> n;
      for( int i = 1; i < n; i++) {
            int a,b;
            cin >> a >> b;
            adj[a].push_back(b); 
            adj[b].push_back(a);
      }
      dfs();
      cout << (dp[1][0] + dp[1][1]) % mod << '\n';
      return 0;
};

void _read() {
      ios_base :: sync_with_stdio(false);
      cin.tie(NULL);
      #ifdef LOCAL
      freopen("input.txt","r",stdin);
      #endif
}


Measured memory_bytes: 17512
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	str := [6]string{"abc", "acb", "bac", "bca", "cab", "cba"}

	for _, v := range str {
		if v == s {
			fmt.Println("Yes")
			return
		}
	}
	fmt.Println("No")
}

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

int main(){
    int n, d, e;
    cin >> n >> d;
    int ans = 1;
    int f = 0;
    e = 2 * d + 1; 
    while (e < n){
        ans++;
        e += 2 * d + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#define N 3003
using namespace std;
const int Mod = 998244353;

int n, X, f[N][N << 1], fac[N << 1], inv[N << 1];

inline int C(int x, int y) {
    return x < y ? 0 : 1LL * fac[x] * inv[y] % Mod * inv[x - y] % Mod;
}

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

    inv[0] = inv[1] = fac[0] = fac[1] = 1;
    for (int i = 2; i <= n; ++i)
        fac[i] = 1LL * fac[i - 1] * i % Mod,
        inv[i] = 1LL * inv[Mod % i] * (Mod - Mod / i) % Mod;

    for (int i = 1; i <= n; ++i)
        inv[i] = 1LL * inv[i - 1] * inv[i] % Mod;

    f[0][0] = 1;
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < 6000; ++j)
            (f[i + 1][j + 1] += f[i][j]) %= Mod,
            (f[i + 1][j + 2] += f[i][j]) %= Mod;

    long long ans = 1;
    for (int i = 1; i <= n; ++i) {
        long long tmp = 0;
        for (int j = 0; j < X; ++j)
            (tmp += f[i][j]) %= Mod;
        for (int j = X + 1; j <= 2 * i; j += 2) {
            if (j < i) continue;
            int p = i - (j - X + 1), q = X - 1 - (j - X + 1);
            if (j < 2 * X && p >= 0 && q >= 0) (tmp += f[p][q]) %= Mod;
        }
        if (i >= X && (X & 1))
            ++tmp;
        (ans += 1LL * tmp * C(n, i) % Mod) %= Mod;
    }
    cout << ans % Mod;
    return 0;
}


Measured memory_bytes: 70656
# -*- coding: utf-8 -*-
# C - ID
class CityClass:
    def __init__(self, pref, year):
        self.pref = pref
        self.year = year
        self.num = 0

    def __lt__(self, other):
         return self.year < other.year


city_order_list = []

n, m = map(int, input().split())
pref_list = []

for i in range(n):
    pref_list.append([])

for i in range(m):
    pref, year = map(int, input().split())
    new_city = CityClass(pref, year)
    pref_list[pref-1].append(new_city)
    #print('pref list {} len is {}'.format( pref-1, len(pref_list[pref-1])))
    
    city_order_list.append(new_city)

for city_list in pref_list:
    city_list.sort()

    num = 1
    for city in city_list:
        city.num = num
        num += 1 

for city in city_order_list:
    pref_num_str = str(city.pref).zfill(6)
    city_num_str = str(city.num).zfill(6)
    print('{}{}'.format(pref_num_str,city_num_str))

Measured memory_bytes: 39820
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    long long n,i,ans=1,g=500;
    cin>>n;
    long long arr[n];
    for(i=0;i<n;i++){cin>>arr[i];if(arr[i]==0){g=0;}}
    if(g==0){cout<<0;}
    else
    {
        for(i=0;i<n;i++){ans*=arr[i];if(ans>1000000000000000000||ans<=0){cout<<-1;g=12;break;}}
        if(g!=12){cout<<ans;}
    }
    return 0;
}


Measured memory_bytes: 4416
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

#define ll              long long int
#define vll             vector<ll>
#define vs              vector <string>                                    
#define mll             map<ll,ll>
#define pll             pair<ll, ll>
#define vpll            vector < pair<ll,ll> >
#define itr             vll::iterator
#define all(c)          c.begin(),c.end()
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define pb              push_back
#define mb              make_pair
#define ff              first
#define ss              second
#define max3(a,b,c)     max(max(a,b),c)                                    
#define min3(a,b,c)     min(min(a,b),c)  
#define mod             1000000007
#define inf             1000000000000000001
#define from(i, n)      for(__typeof(n) i = 0; i <  n; ++i)
#define fromj(i, j, n)  for(__typeof(n) i = a; i <  n; ++i)
#define printv(v)       from(i,v.size())cout<<v[i]<<" ";cout<<"\n";
#define w(x)            int x; cin>>x; while(x--)

using namespace std;
using namespace __gnu_pbds; 

void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
}
 
bool func(const pll &a, const pll &b){
    return a.ss < b.ss;
}

typedef tree<int, null_type, less<int >, rb_tree_tag, 
             tree_order_statistics_node_update> pbds; 

int main(){
    c_p_c();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n,k;
    cin>>n>>k;
    vll v(n);
    from(i,n)cin>>v[i];
    ll ar[n];
    ar[0]=0;
    for(ll i=1;i<n;i++){
        ar[i]=ar[i-1]+abs(v[i]-v[i-1]);
        for(ll j=2;j<=i&&j<=k;j++){
            ar[i]=min(ar[i],ar[i-j]+abs(v[i]-v[i-j]));
        }
    }
    //from(i,n)cout<<ar[i]<<" ";
    cout<<ar[n-1];
}    

Measured memory_bytes: 4788
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;


fn main() {
  let a = read::<i64>();
  let b = read::<i64>();
  let k = read::<i64>();

  if b - a + 1 <= 2 * k {
    for i in a..b + 1 {
      println!("{}", i);
    }
  } else {
    for i in a..a + k {
      println!("{}", i);
    }
    for i in b - k + 1..b + 1 {
      println!("{}", i);
    }
  }
}



Measured memory_bytes: 4352
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]


sabun = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            p = xy[i][0] - xy[j][0]
            q = xy[i][1] - xy[j][1]
            sabun.append([p,q])
count = [sabun.count(i)+sabun.count([-i[0],-i[1]]) for i in sabun]

if count == []:
    print("1")
else:
    print(int(N-(max(count))/2))


Measured memory_bytes: 3444
package main

import "fmt"

const mod int = 1e9 + 7

func main() {
	var n int
	fmt.Scan(&n)
	cs := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&cs[i])
	}

	dp := make([]int, n+1)
	dp[0] = 1
	pre := make(map[int]int)
	for i := 0; i < n; i++ {
		c := cs[i]
		a := 0
		if j, ok := pre[c]; ok && j != i {
			a = dp[j]
		}

		dp[i+1] = (dp[i] + a) % mod
		pre[c] = i + 1
	}

	fmt.Println(dp[n])
}


Measured memory_bytes: 15104
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int h,w,n;
    cin>>h>>w>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    int res[h][w];
    int now=0,cnt=a[0];
    for(int i=0;i<h;i++){
        if(i%2==0){
            for(int j=0;j<w;j++){
                res[i][j]=now;
                cnt--;
                if(cnt==0){
                    now++;
                    cnt=a[now];
                }
            }
        }else{
            for(int j=w-1;j>=0;j--){
                res[i][j]=now;
                cnt--;
                if(cnt==0){
                    now++;
                    cnt=a[now];
                }
            }
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout<<res[i][j]+1<<' ';
        }
        cout<<endl;
    }
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int len = Integer.parseInt(sc.nextLine());
		int[] line = Stream.of(sc.nextLine().split(" ", 0)).mapToInt(Integer::parseInt).toArray();
		Main main = new Main();

		int min = Integer.MAX_VALUE;
		int ans = 0;
		for (int i = 0; i < len; i++) {
			ans = main.factoring(line[i]);
			if (ans < min) {
				min =ans;
			}
		}
		System.out.println(min);

	}

	public int factoring(int num) {
      int combNum = num;
      int con = 0;

      while (true) {
        int factor = 0;

        //入力された値が素数であるか調べる
        int numsPiv = (int)Math.sqrt(combNum); //√N = numsPiv とする

        //合成数であれば約数をはじき出す
        for (int i = 2; i <= numsPiv; i++) {
          if (combNum % i == 0) {
            factor = i;
            break;

          }
        }
        if (factor == 2 || combNum == 2) {
          con++;
        }
        //入力値自身が素数になればbreak
        if (factor == 0) {
          break;

        }else {
          //はじき出した値で入力値を割って更新
          combNum = combNum / factor;
        }
      }
      return con;
	}



}

Measured memory_bytes: 36080
#include <bits/stdc++.h>
using namespace std;
int a,c,e;
char d;
string b,f;
int main()
{
	cin>>b;
	cin>>a;
	for(int i=0;i<a;i++)
	{
		cin>>c;
		if(c==1)
		e^=true;
		else
		{
			cin>>c;
			cin>>d;
			if((c==1&&e==0)||(c==2&&e==1))
			f.push_back(d);
			else
			b.push_back(d);
		}
	}
	reverse(f.begin(),f.end());
	b=f+b;
	if(e==1)
	reverse(b.begin(),b.end());
	cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 1116
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(I,0,n){cout<<(I ? " ":"")<<A[I]x;}cout<<endl;
#define pprint(A,y,m,n) rep(J,0,m){print(A[J],y,n);}
const long mod=998244353;
const int size=3e5+1;
const int inf=1e9;
int main(){
	int N,M; string s; cin>>N>>M>>s;
    vector<int> g[N];
	int cnt[N][2] = {};
	int a,b;
	rep(i,0,M){
		cin>>a>>b; a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
		cnt[a][s[b] - 'A']++;
		cnt[b][s[a] - 'A']++;
	}
	set<int> st; deque<int> dq;
	rep(i,0,N)if(cnt[i][0] == 0 || cnt[i][1] == 0) dq.push_back(i);
	int v;
	while(!dq.empty()){
		v = dq.front(); dq.pop_front();
		st.insert(v);
		for(int u:g[v]){
			if(!st.count(u)){
				cnt[u][s[v] - 'A']--;
				if(cnt[u][s[v] - 'A'] == 0) dq.push_back(u);
			}
		}
	}
	if(st.size() < N) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 20612
#include<stdio.h>

#define MAX 200

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

const int infty = 1<<22;

int main()
{
  while(true){
    int N;

    int minx = infty;
    int maxx = -infty;
    int miny = infty;
    int maxy = -infty;

    int tx[MAX];
    int ty[MAX];

    scanf("%d", &N);
    if( N == 0 )break;

    tx[0]=0;
    ty[0]=0;
    for(int i = 1; i < N; ++i){
      int num,d;
      scanf("%d%d", &num, &d);
      
      tx[i] = tx[num] + dx[d];
      ty[i] = ty[num] + dy[d];
    }

    for(int i = 0; i < N; ++i){
      if( minx > tx[i] ){ minx = tx[i]; }
      if( maxx < tx[i] ){ maxx = tx[i]; }
      if( miny > ty[i] ){ miny = ty[i]; }
      if( maxy < ty[i] ){ maxy = ty[i]; }
    }

    printf("%d %d\n", maxx - minx + 1, maxy - miny + 1 );
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,sum = 0;
    cin >> N;
    vector<int> V(N);
    rep(i,0,N){
        cin >> V[i];
        sum += V[i];
    }
    sort(V.rbegin(), V.rend());
    if(sum - V[0] > V[0])cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
  char c;
  cin >> c;
  
  if( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ){
    cout << "vowel" << endl;
  }else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
#include <string> 
using namespace std;
#include <string> 
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);
typedef long long ll;
#define MAX 1000000000
const int maxn=111111;
string ma="";
const ll MOD=1e9+7;
ll dp[1000][1000];
int main()
{
	fast;
    ll n,m,i,j,x,y;
    char c;
    cin>>n>>m;
    for(i=0;i<n;i++)
    {   
        for(j=0;j<m;j++){
            cin>>c;
            if(c=='#')
                dp[i][j]=-1;
        }
    }
    for(i=n-1;i>=0;i--)
        for(j=m-1;j>=0;j--)
        {
            if(dp[i][j]==-1)
                continue;
            if(i==n-1&&j==m-1)dp[i][j]=1;
            else if(i==n-1)dp[i][j]=(dp[i][j+1]==-1)?0:dp[i][j+1]%MOD;
            else if(j==m-1)dp[i][j]=(dp[i+1][j]==-1)?0:dp[i+1][j]%MOD;
            else dp[i][j]=(((dp[i+1][j]==-1)?0:dp[i+1][j])+((dp[i][j+1]==-1)?0:dp[i][j+1]))%MOD;
        }
    cout<<dp[0][0];
    return 0;
}


Measured memory_bytes: 8064
N, X, D = gets.split.map(&:to_i)

(puts X == 0 ? 1 : N + 1; exit) if D == 0
D < 0 ? (x, d = X, D) : (x, d = -X, -D)
h = Hash.new{|h, k| h[k] = []}
(0 .. N).each do |i|
  l = x*i + i*(i - 1)/2 * d
  r = x*i + i*(N - i + N - 1)/2 * d
  h[l % d] << [l/d, r/d + 1]
end
ans = 0
h.values.each do |a|
  lst = -10**18
  a.sort.each do |s, e|
    if lst < s
      ans += e - s
      lst = e
    end
    if lst < e
      ans += e - lst
      lst = e
    end
  end
end
puts ans

Measured memory_bytes: 39676
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
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; }
///////////////////////////////////////////////////////////////////////////////////

void solve(){
    Vi num(100030,0);
    ll ctr=0;
    repi(i,2,100010){
        if(i%2==0) continue;
        bool prime=true;
        for(ll j=2; j*j<=i; j++){
            if(i%j==0) {
                prime=false;
                break;
            }
            if(((i+1)/2)%j==0){
                prime=false;
                break;
            }
        }
        if(prime) ctr++;
        num[i]=ctr;
    }
    ll q;
    cin >> q;
    Vi ans;
    while(q--){
        ll l,r;
        cin >> l >> r;
        if(l==1){
            print(num[r]);
        }else{
            print(num[r]-num[l-2]);
        }
    }
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 3888
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
struct DSU
{
    int parts;
    vector<int> rt, sz;

    DSU(int n)
    {
        rt.resize(n + 1);
        sz.resize(n + 1, 1);
        iota(rt.begin(), rt.end(), 0);
        parts = n;
    }

    int root(int k)
    {
        while (k != rt[k])
            k = rt[k] = rt[rt[k]];
        return k;
    }

    void U(int u, int v)
    {
        int r1 = root(u), r2 = root(v);
        if (r1 == r2)
            return;
        parts--;
        if (sz[r1] > sz[r2])
            swap(r1, r2);
        sz[r2] += sz[r1];
        sz[r1] = 0;
        rt[r1] = rt[r2];
    }
};
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, m, ans = 0;
    cin >> n >> m;
    DSU d(n);
    while (m--)
    {
        ll u, v;
        cin >> u >> v;
        d.U(u, v);
    }
    for (ll e : d.sz)
        ans = max(ans, e);
    cout << ans;
}

Measured memory_bytes: 4776
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[10000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
int main(){
	long long n,a,b,ans;
	cin>>n>>a>>b;
	long long x[n+1];
	for(int i=0;i<n;i++) cin>>x[i];
	ans=0;
	for(int i=1;i<n;i++){
		long long tmp;
		tmp=(x[i]-x[i-1])*a;
		if(tmp>b) ans+=b;
		else ans+=tmp;
	}
	cout<<ans<<endl;
	return 0;
}

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

int minChange(int money)
{
	int coin[6]={500, 100, 50, 10, 5, 1};
	int n=0;
	while(money > 0)
	{
		for(int i=0; i<6; i++)
		{
			if(money >= coin[i])
			{
				money -= coin[i];
				n++;
				break;
			}
		}
	}
	return n;
}

int main(void)
{
	int money;
	while(1)
	{
		cin >> money;
		if(money == 0)return 0;

		cout << minChange(1000-money) << endl;
	}
	return 0;
}

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

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

  int N;
  cin >> N;

  map<int, int> m;
  int count = 0;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (m.find(a) == m.end()) {
      m[a] = 1;
      count++;
    } else {
      if (m[a] == 0) {
        m[a] = 1;
        count++;
      } else {
        m[a] = 0;
        count--;
      }
    }
  }
  cout << count << '\n';

  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    string s, t;
    cin >> s >> t;
    
    // calculation
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<>());  // int big -> small
    if (s == t) {
        cout << "No" << "\n";
    } else {
        string ans = (s<t)? "Yes": "No";
        cout << ans << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <set>
#include <iomanip>
using namespace std;

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

int main()
{
    ll output=1;
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (int i=0; i<N; i++){
        cin >> A[i];
        if (A[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    for (int i=0; i<N; i++){
        ll pre=output;
        output=A[i]*pre;
        if (output<pre || output>1000000000000000000){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << output << endl;

    return 0;
}


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

int main() {
  char S;
  bool as=false;
  bool bs=false;
  bool cs=false;

  for(int i=0; i<3; i++){
    cin >> S;
    if(S=='a'){
      as=true;
    }
    else if(S=='b'){
      bs=true;
    }
    else if(S=='c'){
      cs=true;
    }
  }

  if(as==true && bs==true && cs==true){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

return 0;  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
int dp[100005];
int solve(){
          int n,k;
          cin>>n>>k;
          int a[n],i;
          AIN
          dp[0]=0;
          int j;
          for(i=1;i<=k;i++){
                    dp[i]=0;
                    if(i<a[0]){
                              dp[i]=0;
                              continue;
                    }
                    if(i==a[0]){
                              dp[i]=1;
                              continue;
                    }
                    for(j=0;j<n;j++){
                              if(a[j]>i){
                                        break;
                              }
                              if(a[j]==i){
                                        dp[i]=1;
                                        break;
                              }
                              if(dp[i-a[j]]==0){
                                        dp[i]=1;
                              }
                    }
          }
          if(dp[k])
                    cout<<"First\n";
          else
                    cout<<"Second\n";
  return 0;
}
int main(){
fast
          int t=1;
          // cin>>t; 
          T(t){
            solve();
          }
          return 0;
}

Measured memory_bytes: 3956
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define REP(i, k) for (decltype(k) i = 0; i < k; i++)
#define LOOP(k) REP (ngtkana_is_a_genius, k)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    u32 n, t; std::cin >> n >> t;
    vec<u32> a(n);

    u32 k = 2, q = (n + k - 1) / k;
    vec<u32> b(q);
    for (u32 i=0; i<n; i++) b.at(i/k) += a.at(i);

    while (t--) {
        u32 c; std::cin >> c;

        if (c==0) {
            u32 i, x; std::cin >> i >> x, i--;
            a.at(i) += x;
            b.at(i/k) += x;
        }

        if (c==1) {
            u32 l, r; std::cin >> l >> r, l--;
            u32 ans = 0;
            for (; l<r && l%k; ans += a.at(l++));
            for (; l<r && r%k; ans += a.at(--r));
            for (; l<r; ans += b.at((r-=k)/k));
            std::cout << ans << '\n';
        }
    }
}



Measured memory_bytes: 3408
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string A, B, U;
  	cin >> A >> B;
  	int num_a, num_b;
  	cin >> num_a >> num_b;
  	cin >> U;
  	
  if(U == A){
  num_a--;
  }
  if(U == B){
  num_b--;
  }
  
  cout << num_a << " " << num_b <<endl;
  
}

Measured memory_bytes: 256
from sys import stdin
import math


def main():
    A, B, H, M = [int(x) for x in stdin.readline().rstrip().split()]

    ang_hour = (60 * H + M) * math.pi / 360
    ang_minute = (M / 30) * math.pi
    ang_btw = math.fabs(ang_hour - ang_minute)
    ang = min(ang_btw, 2 * math.pi - ang_btw)

    c = A ** 2 + B ** 2 - (2 * A * B * math.cos(ang))
    print(c ** 0.5)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9516
#include<iostream>

int main()
{
    int a,b;

    std::cin >> a >> b;

    if (a<b){
        std::cout << "a < b" << std::endl;
    }else if(a>b){
        std::cout << "a > b" << std::endl;
    }else{
        std::cout << "a == b" << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 3092
inps = input().split()
if len(inps) < 5:
    print("Illegal input.")
else:
    w = int(inps[0])
    h = int(inps[1])
    x = int(inps[2])
    y = int(inps[3])
    r = int(inps[4])
    if x - r < 0 or x + r > w:
        print("No")
    elif y - r < 0 or y + r > h:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 7692
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stdio.h>

using namespace std;
using ll = long long;
using ld = long double;
template <class T> using vec = std::vector<T>;
template <class T> using vvec = std::vector<std::vector<T>>;

#define REP(i, s, e) for (ll i = s; i < e; ++i)

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

    int N; cin >> N;
    vec<string> ss(N);
    REP(i, 0, N)
    {
        string s; cin >> s;
        sort(s.begin(), s.end());
        ss[i] = s;
    }

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

    ll c = 0;
    ll r = 0;
    REP(i, 0, N - 1)
    {
        if (ss[i] == ss[i + 1]) ++c;
        else
        {
            r += c * (c + 1) / 2;
            c = 0;
        }
    }

    r += c * (c + 1) / 2;

    cout << r << endl;

    return 0;
}


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

signed main(){
    int n,k; cin >> n >> k;
    vector<bool> vis(n+1, false);
    vector<int> tel(n+1), store;
    for(int i=1; i<=n; i++) cin >> tel[i];
    int s = 1, cycle = 1, flag = 0;
    // k++;
    while(vis[s] == false){
        store.push_back(s);
        vis[s] = true;
        s = tel[s];
        k--;
        if(k == 0){
            flag = 1;
            break;
        }
    }
    // for(int x: store) cout << x << " ";
    if(flag){
        cout << s << endl;
        exit(0);
    }
    // cout << s << endl;
    int i = store.size() - 1;
    while(store[i] != s){
        i--;
        cycle++;
    }
    // cout << cycle << endl;
    k %= cycle;
    i += k;
    // cout << endl;
    cout << store[i] << endl;
}

Measured memory_bytes: 6968
from sys import stdin

q, h, s, d = map(int, stdin.readline().rstrip().split())
n = int(stdin.readline().rstrip())
q *= 4
h *= 2
t = min(q, h, s)
if 2 * t > d:
    print((n // 2) * d + (n % 2) * t)
else:
    print(n * t)

Measured memory_bytes: 3060
let last_i = ref 0

let parent i = int_of_float (floor (float_of_int i) /. 2.)

let left i = 2*i

let right i = 2*i + 1

let extract (t : int array) =
  let rec max_heapify i =
    let l = left i in
    let r = right i in
    let m = if l <= !last_i && t.(l) > t.(i) then l else i in
    let m = if r <= !last_i && t.(r) > t.(m) then r else m in
    if i = m then ()
    else begin
      let tmp = t.(i) in
      t.(i) <- t.(m);
      t.(m) <- tmp;
      max_heapify m
    end in
  let ret = t.(1) in
  t.(1) <- t.(!last_i);
  decr last_i;
  max_heapify 1;
  ret

let insert x (t : int array) =
  let rec doit i =
    let p = parent i in
    if i <= 1 || t.(p) >= t.(i) then ()
    else begin
      let tmp = t.(i) in
      t.(i) <- t.(p);
      t.(p) <- tmp;
      doit p
    end in
  incr last_i;
  t.(!last_i) <- x;
  doit !last_i

let () =
  let t = Array.make 2000001 0 in
  while true do
    let op = Scanf.scanf "%s " (fun i -> i) in
    if op = "end" then exit 0
    else if op = "extract" then extract t |> Printf.printf "%d\n"
    else insert (Scanf.scanf "%d " (fun i -> i)) t
  done

Measured memory_bytes: 20380
// AOJ 0283: Study Session
// 2018.1.29 bal4u

#include <stdio.h>
#include <stdlib.h>

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int N;
int s[1000002], t[1000002];
int leader[102], lsz;
int group[102],  gsz;
int id[102];

int bsch(int x)
{
	int m, l = 0, r = N;

    while (l < r) {
        m = (l+r) >> 1;
        if (t[m] < x) l = m + 1; else r = m;
    }
	return l;
}

int check(int v)
{
	int i, s;

	if (!lsz) return 0;
	s = id[0] - bsch(group[0]-v);
    for (i = 1; i < lsz; i++) {
		if (group[i-1]+1 >= group[i]-v) s += id[i] - id[i-1];
		else                            s += id[i] - bsch(group[i]-v);
	}
	return s;
}

int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int Q, i, a, lo, hi, m, f, max;
	char buf[20], *p;
	
	N = in(), Q = in();
    for (i = 0; i < N; i++) s[i] = t[i] = in();
	qsort(t, N, sizeof(int), cmp);
	max = t[N-1]+1;

	lsz = 0, f = 1;
    while (Q--) {
		fgets(p=buf, 20, stdin);
		while (*p > ' ') p++;
		a = atoi(p+1);
		if (*buf == 'A') leader[lsz++] = a-1, f = 1;
		else if (*buf == 'R') {
			f = 1, a--;
            for (i = 0; leader[i] != a; i++);
			while (i < lsz) leader[i] = leader[i+1], i++;
			lsz--;
        } else if (*buf == 'C') {
			if (f) {
				gsz = 0;
				for (i = 0; i < lsz; i++) group[gsz++] = s[leader[i]];
				qsort(group, gsz, sizeof(int), cmp);
				for (i = 0; i < lsz; i++) id[i] = bsch(group[i]+1);
			}
			f = 0;

			lo = -1, hi = max;
            while (hi - lo > 1) {
                m = (lo+hi) >> 1;
                if (check(m) >= N-a) hi = m; else lo = m;
            }
            if (hi == max) printf("NA\n");
            else printf("%d\n", hi);
        }
    }
    return 0;
}


Measured memory_bytes: 13244
#include <bits/stdc++.h>
#define boost_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int
#define v vector
#define vi vector< int >
#define vpi vector< pair< int,int > >
#define forl(a) for(int i = 0;i < a;i ++)
using namespace std;
ll modF=1e7;

void solve(){
	int n;
	cin>>n;
	v<ll> a(n+1);
	forl(n+1){
		a[i]=2;
	}
	a[1]=1;
	for(int i=2;i<=n;i++){
		for(int j=2*i;j<=n;j+=i){
			a[j]++;
		}
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		ans+=i*a[i];
	}
	cout<<ans<<"\n";
}

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

Measured memory_bytes: 81336
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    int s=0,n=N;
    while(n){
        s+=n%10;
        n/=10;
    }
    if(N%s==0)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3584
(let ((line (read-line nil nil)))
  (sort line #'char<)
  (if (and (char= (char line 0) (char line 1))
		   (char= (char line 2) (char line 3))
		   (not (char= (char line 1) (char line 2))))
	(format t "Yes")
	(format t "No")))

Measured memory_bytes: 10848
n,m=map(int,input().split())
p=[-1]*n
for i in range(m):
    s,c=map(int,input().split())
    if p[s-1]==-1:
        p[s-1]=c
    else:
        if c!=p[s-1]:
            print(-1)
            break
else:
    if n==1 and (p[0]==0 or p[0]==-1):
        print(0)
    elif p[0]==0:
        print(-1)
    else:
        s=""
        for i in range(n):
            if p[i]==-1:
                if i==0:
                    s+="1"
                else:
                    s+="0"
            else:
                s+=str(p[i])
        print(s)

Measured memory_bytes: 3064
import collections


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


def gcd(a, b):
    if a > b:
        a, b = (b, a)
    while b:
        a, b = b, a % b
    return a


def main():
    a, b = map(int, input().split())
    gcd_num = gcd(a, b)
    c = collections.Counter(prime_factorize(gcd_num))
    # print(prime_factorize(gcd_num))
    # cには１が含まれていないので、その分カウントを増やす
    print(len(c) + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
N,A,B,C,D=list(map(int,input().split()))

if N%A==0: p=N/A

else: p=N//A+1

if N%C==0: q=N/C

else: q=N//C+1

if B*p<D*q: print(int(B*p))
else: print(int(D*q))


Measured memory_bytes: 5600
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
using namespace std;
int main(){
    int N;
    cin >> N;
    int A[200020];
    int B[200020];
    for(int i = 1;i <= N;i++){
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B + 1, B + N + 1);
    for(int i = 1;i <= N;i++){
        if(B[N] == B[N - 1])cout << B[N];
        else if(A[i] == B[N])cout << B[N - 1];
        else cout << B[N];
        cout << endl;
    }
    
    
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

struct UnionFind {
  vector<ll> par, siz;
  UnionFind(ll n):par(n),siz(n,1) {
    for (ll i = 0; i < n; ++i) par[i] = i; //すべて根として初期化
  }
  ll root(ll x) {
    if (par[x] == x) return x;
    else return par[x] = root(par[x]);
  }
  void merge(ll x, ll y) {
    ll rx = root(x);
    ll ry = root(y);
    if (rx == ry) return;
    if (siz[rx] < siz[y]) swap(rx, ry);
    par[rx] = ry;
    siz[ry] += siz[rx];
  }
  bool same(ll x, ll y) { return root(x) == root(y);}
  ll size(ll x) { return siz[root(x)]; }
};

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n;
  cin >> n;
  vector<P> a(n);
  rep(i,n) cin >> a[i].first >> a[i].second;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  int ans = 100;
  rep(i,n) for (int j = i + 1; j < n; ++j) {
    ll p = a[i].first - a[j].first, q = a[i].second - a[j].second;
    UnionFind uf(n);
    rep(k,n) rep(l,n) {
      if (k == l) continue;
      if (a[k].first-p == a[l].first && a[k].second-q == a[l].second) uf.merge(k,l); //コスト0
    }
    int cost = 0;
    rep(k,n) {
      if (uf.root(k) == k) cost++; //unionfind内の木の数がコストになる
    }
    chmin(ans, cost);
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
  int n, t, a;
  cin >> n >> t >> a;
  float h[n];
  float k[n];
  int num = 0;
  for(int i = 0; i < n; i++) {
    cin >> h[i];
    k[i] = abs(a -(t - 0.006 * h[i]));
    if(k[num] >= k[i]) {
      num = i;
    }
  }
  
  
  cout << num + 1<< endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


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

		int n = sc.nextInt();

		// ボトムアップ型、メモリ節約
		int cache_2 = 1;
		int cache_1 = 1;
		int ret = 1;
		for (int i = 2; i <= n; i++) {
			ret = cache_1 + cache_2;
			cache_2 = cache_1;
			cache_1 = ret;
		}
		
		System.out.println(ret);
		
         sc.close();
	}
}

Measured memory_bytes: 17356
N, K = map(int, input().split())

a = list(map(int, input().split()))

white = [0] * (N + 1)
black = [0] * (N + 1)
for i, d in enumerate(a):
  if d < 0:
    white[i + 1] += d
  else:
    black[i + 1] += d
  white[i + 1] += white[i]
  black[i + 1] += black[i]

score = 0
for i in range(N - K + 1):
  score = max(black[N] + white[i + K] - white[i], black[N] - black[i + K] + black[i], score)

print(score)

Measured memory_bytes: 23392
from itertools import accumulate
 
N = int(input())
S = list(input())
 
A = [0]*(N+1) #N+1まで入れること忘れず
 
#リーダーの方向を向く，W->1の累積和，[0]start
for i in range(1, N+1):
    j = 0
    if S[i-1] == "W":
        j = 1
    A[i]=A[i-1] +j
#A =list(accumulate(A))
#print(A)
 
#iより左にいて西を向いている人の最小値
ans=N
for i in range(1, N+1):
    val = N-i +A[i] -A[N]
    ans = min(ans, A[i-1] +val)
 
print(ans)

Measured memory_bytes: 66032
n = int(input())
def count(i):
    count = 0
    while(i%2 == 0):
        i = i/2
        count +=1
    return count

max = 0
number = 1
for j in range(1,n+1):
    if (count(j) > max):
        max = count(j)
        number = j
print(number)

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

typedef pair <int, int> ii;

int n;
char c[200005];
int numr, ans;

int main() {
	scanf("%d", &n);
	scanf("%s", c);
	for (int i = 0; i < n; i++) {
		if (c[i] == 'R') numr++;
		else break;
	}
	for (int i = n - 1; i >= numr; i--) {
		if (c[i] == 'R') {
			ans++, numr++;
			while (c[numr] == 'R') numr++;
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 4012