akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
#include<map>
#include<queue>
#include<cstdio>
#include<string>
#include<algorithm>

typedef pair<string,int> P;

int main(){
  string goal="111111111222444666555333333333";
  int n;
  char a;
  string cube;
  cin>>n;
  while(n--){
    cube="";
    for(int i=0;i<30;i++){
      cin>>a;
      cube+=a;
    }
    queue<P> que;
    map<string,int> used;
    que.push(P(cube,0));
    while(!que.empty()){
      P p=que.front();que.pop();
      string now=p.first;
      int co=p.second;
      if(now==goal){
	cout<<co<<endl;
	break;
      }
      if(used[now]==1)continue;
      used[now]=1;          
      string next;
      next=now;
      swap(next[0],next[27]);
      swap(next[1],next[28]);
      swap(next[2],next[29]);
      swap(next[14],next[15]);
      swap(next[18],next[20]);
      que.push(P(next,co+1));
      
      next=now;
      swap(next[6],next[21]);
      swap(next[7],next[22]);
      swap(next[8],next[23]);
      swap(next[17],next[12]);
      swap(next[9],next[11]);
      que.push(P(next,co+1));

      next=now;
      swap(next[0],next[23]);
      swap(next[3],next[26]);
      swap(next[6],next[29]);
      swap(next[9],next[20]);
      swap(next[15],next[17]);
      que.push(P(next,co+1));
      
      next=now;
      swap(next[2],next[21]);
      swap(next[5],next[24]);
      swap(next[8],next[27]);
      swap(next[11],next[18]);
      swap(next[12],next[14]);
      que.push(P(next,co+1));

    }
  }
}

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      std::string ss; scan(ss);
      std::string ts = "CODEFESTIVAL2016";
      long res = 0;
      for(long i = 0; i < (long)ss.size(); ++i) {
         if( ss[i] != ts[i] ) res += 1;
      }
      printf("%ld\n", res);
   }
};

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



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

int main()
{
	int l, r, d, ans;

	cin >> l >> r >> d;

	ans = 0;
	for (int i = l;i <= r;++i) {
		if (i % d == 0)
			++ans;
	}

	cout << ans << endl;
}

Measured memory_bytes: 3632
S = input()

def is_kaibun(s):
    l = len(s)
    # print('former', s[:int(l/2)])
    # print('latter', s[:-(int(l/2))-1:-1])
    if s[:int(l/2)] == s[:-(int(l/2))-1:-1]:
        return True
    else:
        return False

if is_kaibun(S):
    if is_kaibun(S[:int((len(S)-1)/2)]):
        if is_kaibun(S[int((len(S)+3)/2)-1:]):
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 8792
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

struct UnionFindWeighted {
    par: Vec<usize>,
    rank: Vec<usize>,
    weight: Vec<i64>,
}
impl UnionFindWeighted {
    fn new(n: usize) -> UnionFindWeighted {
        let mut par = Vec::with_capacity(n);
        let mut rank = Vec::with_capacity(n);
        let mut weight = Vec::with_capacity(n);
        for i in 0..n {
            par.push(i);
            rank.push(0);
            weight.push(0);
        }
        UnionFindWeighted {
            par: par,
            rank: rank,
            weight: weight,
        }
    }
    fn root(&mut self, x: usize) -> usize {
        if self.par[x] == x {
            x
        } else {
            let par = self.par[x];
            let ppar = self.root(par);
            self.weight[x] += self.weight[par] as i64;
            self.par[x] = ppar;
            ppar
        }
    }
    fn same(&mut self, x: usize, y: usize) -> bool {
        return self.root(x) == self.root(y);
    }
    fn unite(&mut self, x: usize, y: usize, w: i64) {
        let px = self.root(x);
        let py = self.root(y);
        if px == py {
            return;
        }
        if self.rank[px] < self.rank[py] {
            self.par[px] = py;
            self.weight[px] = w - self.weight[x] + self.weight[y];
        } else {
            self.par[py] = px;
            self.weight[py] = -w - self.weight[y] + self.weight[x];
            if self.rank[px] == self.rank[py] {
                self.rank[px] += 1;
            }
        }
    }
    fn diff(&mut self, x: usize, y: usize) -> i64 {
        return self.weight[x] - self.weight[y];
    }
}
fn main() {
    let (n, m) = get!(usize, usize);
    let mut ufw = UnionFindWeighted::new(n);
    for _ in 0..m {
        let mut tmp = get!(usize, usize, i64);
        tmp.0 -= 1;
        tmp.1 -= 1;
        if ufw.same(tmp.0, tmp.1) {
            //eprintln!("tmp.0: {}, tmp.1: {}", tmp.0, tmp.1);
            //eprintln!(
            //    "weight[tmp.0]: {}, weight[tmp.1]: {}",
            //    ufw.weight[tmp.0], ufw.weight[tmp.1]
            //);
            if ufw.diff(tmp.0, tmp.1) != tmp.2 {
                println!("No");
                return;
            }
        }
        ufw.unite(tmp.0, tmp.1, tmp.2);
    }
    println!("Yes");
}


Measured memory_bytes: 6396
#include <iostream>

using namespace std;

int chebyshev(int n);
int isPrime(int n);

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

	while(cin >> p, p)
	{
		cout << chebyshev(p) << endl;
	}

	return 0;
}

int chebyshev(int n)
{
	int counter = 0;

	for(int i = n + 1; i <= 2 * n; i++)
	{
		if(isPrime(i))
		{
			counter++;
		}
	}

	return counter;
}

int isPrime(int n)
{
	if(n <= 1)
	{
		return 0;
	}
	else if(n == 2)
	{
		return 1;
	}
	else if(n % 2 == 0)
	{
		return 0;
	}
	else
	{
		for(int i = 3; i * i <= n; i += 2)
		{
			if(n % i == 0)
			{
				return 0;
			}
		}
	}

	return 1;	
}

Measured memory_bytes: 1160
X, Y = map(int, input().split())
ans = 0
k = [3, 2, 1]
if X <= 3:
    ans += k[X-1]
if Y <= 3:
    ans += k[Y-1]
if X == 1 and Y == 1:
    ans += 4
print(ans * 100000)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;

int main(void) {
    int a, b;
    cin >> a >> b;
    if (a <= 5) {
        cout << 0 << endl;
    } else if (6 <= a && a <= 12) {
        cout << b / 2 << endl;
    } else {
        cout << b << endl;
    }
}

Measured memory_bytes: 256
//Author - Sanket Mundra
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define IIITA ios::sync_with_stdio(0)
#define sanket cin.tie(0)
#define mundra cout.tie(0)
ll M = 1000000007;

int main()
{
	IIITA; sanket; mundra;
	ll t,i,j,n,m,l,k,r,sum,ans,mx,mn,x,y,z; cin>>t;
	if(t%2==0)
	{
		ans=0,i=5;
		while(t/(2*i)>0)
		{
			ans+=(t/(2*i));
			i*=5;
		}
		cout<<ans<<endl;
	}
	else cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();

    UnionFind uf = new UnionFind(N);

    for (int i = 0; i < M; i++) {
      int left = scanner.nextInt() - 1;
      int right = scanner.nextInt() - 1;
      int dist = scanner.nextInt();

      int[] lr = uf.find(left);
      int[] rr = uf.find(right);

      if (lr[0] == rr[0]) {
        if (rr[1] - lr[1] != dist) {
          System.out.println("No");
          return;
        }
      } else {
        uf.union(left, right, dist);
      }
    }

    System.out.println("Yes");
  }

  static class UnionFind {
    private final int[] table;
    private final int[] delta;
    private final int[] ranks;

    public UnionFind(int size) {
      this.table = new int[size];
      this.delta = new int[size];
      this.ranks = new int[size];
      for (int i = 0; i < size; i++) {
        table[i] = i;
      }
    }

    public int[] find(int x) {
      if (table[x] != x) {
        int[] res = find(table[x]);
        table[x] = res[0];
        delta[x] += res[1];
      }
      return new int[] {table[x], delta[x]};
    }

    public void union(int x, int y, int dist) {
      int[] xRoot = find(x);
      int[] yRoot = find(y);
      if (xRoot[0] == yRoot[0]) return;

      if (ranks[xRoot[0]] < ranks[yRoot[0]]) {
        int[] tmp = xRoot;
        xRoot = yRoot;
        yRoot = tmp;
        dist = -dist;
      }

      table[yRoot[0]] = xRoot[0];
      delta[yRoot[0]] = xRoot[1] + dist - yRoot[1];
      if (ranks[xRoot[0]] == ranks[yRoot[0]]) ranks[xRoot[0]]++;
    }
  }
}


Measured memory_bytes: 151048
#include <bits/stdc++.h>
using namespace std;
int x = 0, y = 0;
bool vi[200] = {0};

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (!vi[s[i]] && (s[i] == 'E' || s[i] == 'W')) x++;
        if (!vi[s[i]] && (s[i] == 'N' || s[i] == 'S')) y++;
        vi[s[i]] = 1;
    }
    if (x % 2 == 0 && y % 2 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
import sys


def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    return [w[0], w[1]]


def mod_inv(a, m):
    x = extgcd(a, m)[0]
    return (m + x % m) % m


def main():
    X, Y = map(int, input().split())
    C = 10**9 + 7

    if (X + Y) % 3 != 0:
        print(0)
        sys.exit()

    cnt = [0, 0]
    cnt[0] = (2 * X - Y) // 3
    cnt[1] = (-X + 2 * Y) // 3

    if cnt[0] < 0 or cnt[1] < 0:
        print(0)
        sys.exit()

    ans = 1
    for i in range(1, sum(cnt) + 1):
        ans *= i
        ans %= C
    for i in range(1, cnt[0] + 1):
        ans *= mod_inv(i, C)
        ans %= C
    for i in range(1, cnt[1] + 1):
        ans *= mod_inv(i, C)
        ans %= C

    print(ans)


main()


Measured memory_bytes: 41692
#include<bits/stdc++.h>
#define reg register
#define ll long long
#define inf 0x3f3f3f3f
#define iinf 0x3f3f3f3f3f3f3f3fll//sfngfduishguid
using namespace std;
map<ll,ll>f;
ll n;
inline ll dp(ll x)
{
	return f[x]?f[x]:f[x]=((dp(x>>1)+dp((x-1)>>1)+dp((x-2)>>1)))%1000000007;
}
int main()
{
    scanf("%lld",&n);
    f[0]=1;
    f[1]=2;
    printf("%lld",dp(n));
    return 0;
}

Measured memory_bytes: 256
//____________________________________________________________________
  //________________________________NAMAN_______________________________
 //________________________________TALAYCHA______________________________
//__________________________________________________________________________

#include <bits/stdc++.h>
#define ll              long long
#define int             long long
#define pmin            priority_queue < ll, vector<ll>, greater<ll> >
#define pmax            priority_queue <ll>
#define endl            '\n'
#define mii             map<ll , ll >
#define pii             pair< ll, ll >
#define vi              vector<ll>
#define all(a)          (a).begin(), (a).end()
#define DEBUG           cerr<<"/n>>>I'm Here<<</n"<<endl;
#define rep(i, a, b )   for (ll i = a; i < b; i++)
#define rrep(i, a, b)   for (ll i = a; i >= b; i--)
#define bs              binary_search
#define present(c, x)   ((c).find(x) != (c).end())
#define cpresent(c, x)  (find(all(c), x) != (c).end())
#define p1(i)           cout<<i<<endl;
#define p2(i,j)         cout<<i<<" "<<j<<endl;
#define line            cout<<endl;
#define prt(s,b,n)      rep(i,(b),(n)) { cout<<(s)[i]<<" ";} line
#define lower(u)        transform(u.begin(), u.end(), u.begin(), ::tolower);  //convert string u to lowercase;
#define upper(u)        transform(u.begin(), u.end(), u.begin(), ::toupper);
#define tr(container, it) \
for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define hell 1e6+3
#define mod 998244353

  using namespace std;

//_________________________________________________________________________________________________________
//__________________________________________START____________________________________________________________

//................EVERY COIN HAS TWO SIDES...............................................................................................................

void solve()
{
  ll n,k; 
  //ll m=0 , mx=0 , mn=0 , k=0 , ans=0 , flag=0 , res=0 ;
  cin>>n;
  //for(ll i=0;i<n;i++)
  //string s;  cin>>s;
 vi a(n);
  vi b(n);
   vi c(n); rep(i,0,n){ cin>>a[i]>>b[i]>>c[i];}

  ll d1[n+1];
  rep(i,0,n+1) d1[i]=INT_MIN;
  d1[0]=0;
  d1[1]=a[0];
  
    ll d2[n+1];
  rep(i,0,n+1) d2[i]=INT_MIN;
  d2[0]=0;
  d2[1]=b[0];

    ll d3[n+1];
  rep(i,0,n+1) d3[i]=INT_MIN;
  d3[0]=0;
  d3[1]=c[0];

  rep(i,2,n+1)
  {  
    d1[i]=max(d2[i-1]+a[i-1],d3[i-1]+a[i-1]);
    d2[i]=max(d1[i-1]+b[i-1],d3[i-1]+b[i-1]);
    d3[i]=max(d2[i-1]+c[i-1],d1[i-1]+c[i-1]);
  }
 // prt(d1,1,n+1)
 // prt(d2,1,n+1)
 // prt(d3,1,n+1)
  cout<<max(d1[n],max(d2[n],d3[n]))<<endl;
  return;
}

//__________________________________________________________________________________________________________
//__________________________________________END______________________________________________________________

signed main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  #ifndef ONLINE_JUDGE 
  freopen("input.txt" , "r", stdin);
  freopen("out12.txt" , "w", stdout);
  #endif  
//sieve();
  ll TESTS = 1;
  //cin>>TESTS;
  while (TESTS--) 
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 7876
def popcount(n):
    return bin(n).count("1")


N = int(input())

A = [0] * N
x = [[0] * N for i in range(N)]
y = [[0] * N for j in range(N)]

for i in range(N):
    A[i] = int(input())
    for j in range(A[i]):
        x[i][j], y[i][j] = map(int, input().split())

# 各々が正直かそうでないかの2^N通りの全パターンについて、矛盾が起きないかどうかを調べる
# iビット目の 0/1 によって、正直かどうかを表す（1 → 正直、 0 → 不親切）
ans = 0
for bits in range(1 << N):
    is_ok = True
    for i in range(N):
        if not (bits & 1 << i):  # 不親切な人の証言は無視する
            continue
        for j in range(A[i]):
            target_is_honest_by_pattern = (bits >> (x[i][j] - 1)) & 1
            target_is_honest_by_testimony = y[i][j]
            if target_is_honest_by_pattern ^ target_is_honest_by_testimony:
                is_ok = False
    if is_ok:
        ans = max(ans, popcount(bits))

print(ans)


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	if(s.substr(s.length()-1,1)=="s"){
		cout<<s<<"es"<<endl;
	}else{
		cout<<s<<"s"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3664
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main() {
    cin.tie(0);

    int a;cin>>a;
    int p;cin>>p;

    cout<<(a*3+p)/2<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100001];
char s[10000001];
signed main()
{
	cin>>s+1;
	int n=strlen(s+1);
	for(int i=1;i<=n;i++)
	{
		if(i%2==1&&s[i]!='h')
		{
			printf("No");
			return 0;
		}
		if(i%2==0&&s[i]!='i')
		{
			printf("No");
			return 0;
		}
	}
	if(n%2!=0)
		{
			printf("No");
			return 0;
		}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<iomanip>

using namespace std;

int main() {
    int k, x;
    cin >> k >> x;
    if(k*500>=x) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main() {
  string s;
  int left, right, len;
  cin >> s;

  len = 0;
  for (int i = 0; s[i] != '\0'; i++)
    len++;
  
  for (int i = 0; i < len; i++) {
    if (s[i] == 'A') {
      left = i;
      break;
    }
  }

  for (int i = len - 1; i >= 0; i--) {
    if (s[i] == 'Z') {
      right = i;
      break;
    }
  }
  
  cout << right - left + 1 << endl;
  
  return 0;
}


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

int main() {
  long long int N,i,sum;
  cin >> N;
  sum = 0;
  for (i = 1;i <= N;i++) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum += i;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 3608
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
ll modpow(ll a, ll b)
{
    if (b == 0)
        return 1;
    else if (b % 2 == 0)
    {
        ll d = modpow(a, b / 2) % MOD;
        return (d * d) % MOD;
    }
    else
    {
        return (a * modpow(a, b - 1)) % MOD;
    }
}

const int MAX_N = 1e6;

ll fact[MAX_N], finv[MAX_N];
ll comb(int n, int r)
{
    if (n < r || r < 0)
        return 0;
    return fact[n] * finv[n - r] % MOD * finv[r] % MOD;
}

void calc(int n)
{
    fact[0] = finv[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        fact[i] = (fact[i - 1] * i) % MOD;
        finv[i] = modpow(fact[i], MOD - 2);
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    calc(MAX_N);
    ll h, w,a,b;
    cin>>h>>w>>a>>b;
    ll sum=0;
    rep3(i,b+1,w+1){
        ll temp = 1;
        ll x1 = i-1;
        ll y1 = h - a-1;
        //cout<<comb(1,1)<<endl;
        if(x1!=0&&y1!=0){
            temp *= comb(x1 + y1, x1);
        }
        ll x2 = (w - i);
        ll y2 = a-1;
        if(x2!=0&&y2!=0){
            temp *= comb(x2 + y2, x2);
        }
        if(temp>=MOD)temp%=MOD;
        sum+=temp;
        if(sum>=MOD)sum-=MOD;
      //  cout<<x1<<" "<<y1<<" "<<x2<<" "<<y2<<" "<<temp<<endl;
       // sum%=MOD;
    }
    cout << sum << endl;
}


Measured memory_bytes: 15872
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] nums = br.readLine().split(" ");
        String reverse = "";
        for (int i = n - 1; i >= 0; i--) {
            reverse += nums[i] + ((i == 0) ? "" : " ");
        }
        System.out.println(reverse);
    }
}

Measured memory_bytes: 24412
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

ll gcd(ll x,ll y){
  return y? gcd(y,x%y):x;
}

ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return g*(x/g)*(y/g);
}

int main()
{
  int n;
  cin>>n;
  vector<ll> t(n);
  REP(i,n) cin>>t[i];

  ll ans=t[0];
  REP(i,n-1){
    ans=lcm(ans,t[i+1]);
  }
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 256
num = (int)(input())
mons = list(map(int, input().split(" ")))
while(sum(mons) != len(mons) * min(mons)):
  wari = min([e for e in mons if e != 0])
  for i in range(len(mons)):
    if mons[i] != wari:
      mons[i] %= wari
  mons = [e for e in mons if e != 0]
print(max(mons))

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

#define BR "\n"
#define SP " "

int main() {

  ll MAX = 1e8;
  vector<bool> prime(MAX + 1, true);
  prime[0] = 0;
  prime[1] = 0;
  for (ll i = 2; i < sqrt(MAX) + 1; i++) {
    if ( !prime[i] ) continue;
    for (ll j = 2; j <= MAX / i; j++) {
      if (i * j > MAX) break;
      prime[i * j] = false;
    }
  }

  ll N, ans = 0;
  cin >> N;

  for (int i = 0; i < N; i++) {
    ll x;
    cin >> x;
    if (prime[x]) ans++; 
  }

  cout << ans << BR;
  return 0;
}


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

using namespace std;


string n,m;


int main (){
	cin  >> n;
	sort(n.begin(),n.end());
	for (int i = 0; i < n.size(); i++){
		if (n[i] == n[i + 1] && i != n.size() - 1){
			cout << "no";
			return 0;
		}
	}
	cout << "yes";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
// #define f first
// #define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

int main() {
  ll N;
  cin >> N;
  double pitwo = 6.28318530717958623200;
  cout << N * pitwo << endl;

  return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int a,b;
    cin>>a>>b;
    cout<<100<<" "<<100<<endl;
    for(int i=0;i<49;i++){
        for(int j=0;j<100;j++){
            if(a>1&&i%2==0&&j%2==0){
                --a;
                cout<<'.';
            }
            else{
                cout<<'#';
            }
        }
        cout<<endl;
    }
    for(int i=0;i<100;i++){
        cout<<'#';
    }
    cout<<endl;
    for(int i=0;i<100;i++){
        cout<<'.';
    }
    cout<<endl;
    for(int i=0;i<49;i++){
        for(int j=0;j<100;j++){
            if(b>1&&i%2==0&&j%2==0){
                --b;
                cout<<'#';
            }
            else{
                cout<<'.';
            }
        }
        cout<<endl;
    }
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc109/tasks/abc109_a

#include <iostream>
using namespace std;

int main()
{
  /* Magic word */
  cin.tie(0);
  ios::sync_with_stdio(false);
  /* ---------- */

  int a, b;
  string r;

  cin >> a >> b;

  r = (a * b) % 2 ? "Yes" : "No";

  cout << r << '\n';

  return 0;
}


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

int main()
{
    ll S;
    cin >> S;

    cout << "0 " << "0 " << "1000000000 " << "1 " << (((int)1e9) - S%((int)1e9))%((int)1e9) << ' ' << (S-1)/((int)1e9)+1 << endl;

    return 0;
}

Measured memory_bytes: 256
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [x, a, b] = input.split(" ").map(Number);

  const ans = Math.abs(x - a) < Math.abs(x - b) ? 'A' : 'B';
  console.log(ans);
}

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1000000007;
const long long INF = 1LL << 60;
using Graph = vector<vector<ll>>;

int main()
{
    string s;
    cin >> s;
    ll cnt = 0;
    rep(i, s.length())
    {
        if (s[i] == 'p')
            cnt++;
    }
    cout << s.length() / 2 - cnt << endl;
}

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

template<int MOD>
class mod_int {
	unsigned x;
public:
	mod_int() : x(0) { }
	mod_int(int sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	mod_int(long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	mod_int &operator+=(mod_int that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	mod_int &operator-=(mod_int that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	mod_int &operator*=(mod_int that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	mod_int &operator/=(mod_int that) { return *this *= that.inverse(); }

	mod_int operator+(mod_int that) const { return mod_int(*this) += that; }
	mod_int operator-(mod_int that) const { return mod_int(*this) -= that; }
	mod_int operator*(mod_int that) const { return mod_int(*this) *= that; }
	mod_int operator/(mod_int that) const { return mod_int(*this) /= that; }

	bool operator==(const mod_int& that) const { return x == that.x; }

	mod_int inverse() const {
		long long a = x, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		return mod_int(u);
	}
};

template<int MOD>
istream& operator >> (istream& is, mod_int<MOD>& val) {
	long long x;
	is >> x; val = x;
	return is;
}

template<int MOD>
ostream& operator << (ostream& os, const mod_int<MOD>& val) {
	os << val.get();
	return os;
}

const int mod = 1e9 + 7;
using mint = mod_int<mod>;

int main()
{
	int H, W, K;
	cin >> H >> W >> K; --K;
	vector<mint> v(W);
	v[0] = v[1] = 1;
	for (int i = 2; i < W; i++) {
		v[i] = v[i - 2] + v[i - 1];
	}
	vector<vector<mint>> dp(H + 1, vector<mint>(W));
	dp[0][0] = 1;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			dp[i + 1][j] += dp[i][j] * (v[j] * v[W - (j + 1)]);
			if (j + 1 < W) {
				dp[i + 1][j + 1] += dp[i][j] * (v[j] * v[W - (j + 2)]);
			}
			if (j - 1 >= 0) {
				dp[i + 1][j - 1] += dp[i][j] * (v[j - 1] * v[W - (j + 1)]);
			}
		}
	}
	cout << dp[H][K] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n,m;cin>>n>>m;
	int x[m],y[m];
	rep(i,m) cin>>x[i]>>y[i];

	int l[n],red[n];
	rep(i,n){
		l[i]=1;
		red[i]=0;
		if(i==0) red[i]=1;
	}

	rep(i,m){
		if(red[x[i]-1]) red[y[i]-1]=1;
		l[x[i]-1]--;
		l[y[i]-1]++;
		if(l[x[i]-1]==0) red[x[i]-1]=0;
	}

	ll ans=0;
	rep(i,n) ans+=(ll)red[i];

	cout<<ans<<"\n";
}

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

int main(){

  string str;
  int t = 0;
  getline(cin,str);

  for(int i=0;i<str.size();i++){

    if("peach" == str.substr(i,5)){
      i += 4;
      cout << "apple";
    }

    else if("apple" == str.substr(i,5)){
      i += 4;
      cout << "peach";
    }

    else cout << str[i];

  }
  cout << endl;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e6+5;
map<pll,ll> M;
void simplify(pll& p){
    ll gcd=__gcd(p.first,p.second);
    p.first/=gcd;p.second/=gcd;
    if((p.first<0&&p.second<0)||(p.first>0&&p.second<0)) {p.first=-p.first;p.second=-p.second;}
}
const ll mod=1e9+7;
inline ll power(ll a,ll b){
    ll ans=1;for(;b;b>>=1,a=a*a%mod) if(b&1) ans=ans*a%mod;return ans;
}
pll opesite(const pll& p){
    pll ans=make_pair(-p.second,p.first);
    simplify(ans);
    return ans;
}
int main() {
    int n,zero=0;cin>>n;for(int i=1;i<=n;i++) {
        ll l,r;cin>>l>>r;if(!(l|r)) {zero++;continue;}
        pll x={l,r};simplify(x);M[x]++;
    }ll ans=1;
    for(auto x=M.begin();x!=M.end();x++) {
        if(M.find(opesite((*x).first))!=M.end()){
            ans=ans*((power(2,x->second)+power(2,M[opesite(x->first)])-1)%mod)%mod;
            x->second=0;M[opesite(x->first)]=0;
        }
        else {
            (ans*=power(2,x->second))%=mod;
        }
    }
    cout<<((ans+zero-1)%mod+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 15884
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    string s;
    cin >> s;
    int ans = 0;
    rep(i,s.size()-1){
        if(s[i]!=s[i+1]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long int
#define fast  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            int t; cin>>t; while(t--)
const int mod = 1000000007;
bool comp(pair<ll,ll>& a, pair<ll,ll>& b)
{
    if(a.second == b.second)
    return a.first > b.first;
    else
    return b.second < a.second;
}
int main()
{
    fast
    ll n;
    cin>>n;
    vector<ll> v(n+1);
    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
    }
    sort(v.rbegin(),v.rend());
    ll sum = 0;
    ll cnt = 0;
    for(ll i=0;i<n-1;i++)
    {

            sum += v[cnt];
            if(i%2==0)
            {
                cnt++;
            }



    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4704
N = int(input())
f = lambda x,y,z:x*x+y*y+z*z+x*y+y*z+z*x
ans = [0]*(10001)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            if f(x,y,z)>10000:
                break
            ans[f(x,y,z)]+=1
for i in range(1, N+1):
    print(ans[i])


Measured memory_bytes: 68688
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  string s;
  cin >> s;
  REP(i, SZ(s)) {
	s[i] = 'x';
  }
  cout << s << endl;
  return 0;
}


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


int main(){
  int N;
  cin >> N;
  vector<vector<int>> A(1000000,vector<int>(3));
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      cin >> A.at(i).at(j);
    }
  }
  vector<vector<long long>> dp(1000000,vector<long long>(3));
  for(int i=0;i<N;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(j==k){
          continue;
        }
        dp.at(i+1).at(k)=max(dp.at(i+1).at(k),dp.at(i).at(j)+A.at(i).at(k));
      }
    }
  }
  cout << max({dp.at(N).at(0),dp.at(N).at(1),dp.at(N).at(2)}) << endl;
}   

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

const int maxn = 200010;
int n, V, a[maxn], L[maxn][20], R[maxn][20];
int d[20], fl[1 << 18], fr[1 << 18], ans[maxn];

int main() {
    scanf("%d %d", &n, &V);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    int m = (int)log2(V) + 1;
    for (int i = 0; i <= m; i++) {
        d[i] = V >> i;
    }
    for (int i = 0; i <= m; i++) {
        L[0][i] = L[1][i] = 1;
        R[n][i] = R[n + 1][i] = n;
        for (int j = 2; j <= n; j++) {
            L[j][i] = a[j] - a[j - 1] <= d[i] ? L[j - 1][i] : j;
        }
        for (int j = n - 1; j; j--) {
            R[j][i] = a[j + 1] - a[j] <= d[i] ? R[j + 1][i] : j;
        }
    }
    for (int i = 0; i < 1 << m; i++) {
        fr[i] = n + 1;
        for (int j = 0; j < m; j++) if (i >> j & 1) {
            fl[i] = max(fl[i], R[fl[i ^ (1 << j)] + 1][j + 1]);
            fr[i] = min(fr[i], L[fr[i ^ (1 << j)] - 1][j + 1]);
        }
    }
    for (int i = 0; i <= n + 1; i++) {
        ans[i] = n + 2;
    }
    for (int i = 0; i < 1 << m; i++) {
        ans[fl[i]] = min(ans[fl[i]], fr[i ^ ((1 << m) - 1)]);
    }
    for (int i = n; ~i; i--) {
        ans[i] = min(ans[i], ans[i + 1]);
    }
    for (int i = 1; i <= n; i++) {
        if (ans[L[i][0] - 1] <= R[i][0] + 1) printf("Possible\n");
        else printf("Impossible\n");
    }
    return 0;
}

Measured memory_bytes: 38624
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();

    let a: usize = iter.next().unwrap().parse().unwrap();
    let b: usize = iter.next().unwrap().parse().unwrap();

    println!("{}", (a + b) / 2);
}



Measured memory_bytes: 5036
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    if '9' in S:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


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

int main() {
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int ans;
  if(a>=k) ans=k;
  else if(k<=a+b) ans=a;
  else ans=2*a+b-k;
  cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main(){
  int n,m,k,a,i,j,ans = 0;cin >> n >> m;
  int v[m] = {};
  for(i=0;i<n;i++){
    cin >> k;
    for(j=0;j<k;j++){
      cin >> a;v[a-1]++;
    }
  }
  for(i=0;i<m;i++){
    if(v[i]==n) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    io.Source.stdin.getLines foreach (n => println(pi(n.toInt)))
  }
  val primes: IndexedSeq[Int] = prime_sieve(50000)
  def prime_sieve(x: Int): IndexedSeq[Int] = {
    val n = x - x % 6 + 6
    val correction = if (x % 6 > 1) 1 else 2
    val sieve = Array.fill(n/3)(true)
    for (i <- 1 to (Math.sqrt(n) / 3).toInt if sieve(i)) {
      val k = (3 * i + 1) | 1
      for (j <- (k * k) / 3 until sieve.length by 2*k) sieve(j) = false
      for (j <- (k*(k-2*(i&1)+4))/3 until sieve.length by 2*k) sieve(j) = false
    }
    2 +: 3 +: (for (i <- 1 until n / 3 - correction if sieve(i)) yield (3*i+1)|1)
  }
  def bisect(n: Int): Int = {
    def loop(left: Int, right: Int): Int = {
      val mid = (left + right) / 2
      if (primes(mid) <= n && n < primes(mid+1)) mid+1
      else if (n < primes(mid)) loop(left, mid)
      else loop(mid+1, right)
    }
    if (n < primes.head) 0
    else if (n >= primes.last) primes.length
    else loop(0, primes.length)
  }
  def pi: Memoized[Int, Int] = Memoized {x =>
    if (x <= primes.last) bisect(x)
    else {
      val a = pi(Math.sqrt(Math.sqrt(x)).toInt)
      val b = pi(Math.sqrt(x).toInt)
      val c = pi(Math.cbrt(x).toInt)

      var result = phi(x, a) + ((b + a - 2) * (b - a + 1)) / 2
      for (i <- a + 1 to b) {
        val w = x / primes(i - 1)
        val b_i = pi(Math.sqrt(w).toInt)
        result -= pi(w)
        if (i <= c)
          for (j <- i to b_i)
            result = result - pi(w / primes(j - 1)) + j - 1
      }
      result
    }
  }
  def phi: Memoized[(Int,Int), Int] = Memoized {
    case (x, a) =>
      if (a == 1) (x + 1) / 2
      else phi(x, a - 1) - phi(x / primes(a - 1), a - 1)
  }
  case class Memoized[Arg, Ret](f: Arg => Ret) extends (Arg => Ret) {
    val cache = collection.mutable.Map[Arg, Ret]()
    def apply(arg: Arg) = cache.getOrElseUpdate(arg, f(arg))
  }
}

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

typedef long long ll;

ll mod(ll x){
	if(x>=0){
		return x;
	}else{
		return -x;
	}
}


int main(){
	ll k,n,i;
	cin>>n>>k;
	ll a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	ll mdist=INT_MAX;
	k--;
	for(i=k;i<n;i++){
		ll dist= a[i]-a[i-k],l;
		if(a[i-k]>=0){
			l=a[i-k];
		}else if(a[i-k]<0){
			l = min(mod(a[i]),mod(a[i-k]));
		}
	//	printf(": %ld %ld %ld\n",mdist,l,dist);
		mdist = min(mdist,dist+l);
	}
	cout<<mdist;
}




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

#define int             long long
#define	ll				long long

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

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

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

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}

int a[10000009];

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

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 81792
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let n=nin()
  out(n*800-floor(n/15)*200)
}
main()

Measured memory_bytes: 7372
x = int(input())


ans = 0
if 400 <= x <= 599:
    ans = 8
elif 600 <= x <= 799:
    ans = 7
elif 800 <= x <= 999:
    ans = 6
elif 1000 <= x <= 1199:
    ans = 5
elif 1200 <= x <= 1399:
    ans = 4
elif 1400 <= x <= 1599:
    ans = 3
elif 1600 <= x <= 1799:
    ans = 2
else:
    ans = 1
print(ans)


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

int is_prime( int x )
{
  int p, i ;
  p = 1 ;

  if( x == 1 ){
    p = 0 ;
  }

  int r = sqrt(x) ;

  for( i = 2 ; i <= r ; i++ ){
    if( x % i == 0 ){
      p = 0 ;
      break ;
    }
  }
  
  return p ;
}

int main()
{
  int n, cnt ;
  int i ;

  cnt = 0 ;
  scanf("%d",&n) ;
  int p[n] ;

  for( i = 0 ; i < n ; i++ ){
    scanf("%d", &p[i]) ;
    if( is_prime( p[i] ) == 1 ){
      cnt += 1 ;
    }
  }

  printf("%d\n", cnt) ;

  return 0 ;
}


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



int main(void){

  char N_str[20];
  scanf("%s", N_str);
  int a[20] ={0};
  int i;

  for(i=0;i<19 ;i++){
    char tmp[2] = { N_str[i], '\0'};
    a[i] = atoi( tmp );
  }

  /* for(i=0;i<19 ; i++){ */
  /*   printf("%d; ", a[i] ); */
  /*     } */

  int len = strlen(N_str);

  int cp = 0;			/* 9999に変化p */
  int max =0;
  for(cp =0; cp<len; cp++){
    int sum = 0;

    for(i=0; i<len; i++){
      if(i<cp){
	sum += a[i];
      }else if(i == cp && i == len -1){
	sum += a[i];
      }else if(i == cp){
	sum += a[i] -1;
      }else {
	sum += 9;
      }
    }
   max = (sum > max)?sum:max;
  }

  printf("%d", max);
}


Measured memory_bytes: 128
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 5 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 

    int H , W;
    int h , w;

    cin>>H >> W;

    cin>>h>>w;

    cout<<(H * W) - ((h * W) + ( w * H )) + (h * w)<<endl;



    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("ain","r",stdin);
    freopen("aout","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

Measured memory_bytes: 384