akhauriyash/Code-Regression huggingface dataset:
n = int(input())
p = list(map(int,input().split()))
a = [30000*i+1 for i in range(n)]
b = [30000*(n-i) for i in range(n)]
for i in range(n):
    b[p[i]-1]+=i
for i in a:
    print(i,end =' ')
print()
for i in b:
    print(i,end=' ')
print()

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

class frac{
public:
    int zero, one;

    frac(int zero = 0, int one = 0):zero(zero), one(one){}

    bool operator <(const frac &f)const{
        return 1ll * one * f.zero < 1ll * zero * f.one;
    }

    frac operator +(const frac &f)const{
        return frac(zero + f.zero, one + f.one);
    }
};

const int N = 200010;
typedef std::pair <frac, int> pfi;
typedef long long ll;

int fa[N], last[N], suf[N], v[N], p[N];
frac f[N];

int find(int u){
    if (fa[u] == u) return u;
    fa[u] = find(fa[u]);
    f[u] = f[fa[u]];
    last[u] = last[fa[u]];
    return fa[u];
}

void unite(int u, int v){
    int _u = find(u), _v = find(v);
    if (_u == _v) return;
    fa[_u] = _v;
    f[_v] = f[_v] + f[_u];
    suf[last[_v]] = _u;
    last[_v] = last[_u];
}

int main(){
    int n;
    scanf("%d", &n);
    for (int i = 2; i <= n; ++ i){
        scanf("%d", &p[i]);
    }
    std::set <pfi> set;
    for (int i = 1; i <= n; ++ i){
        scanf("%d", &v[i]);
        f[i] = frac(v[i] == 0, v[i] == 1);
        fa[i] = last[i] = i;
        if (i > 1){
            set.insert({f[i], i});
        }
    }
    while (set.size()){
        int u = set.begin() -> second;
        set.erase(set.begin());
        int v = p[u];
        if (find(v) > 1){
            set.erase({f[find(v)], find(v)});
        }
        unite(u, v);
        if (find(v) > 1){
            set.insert({f[find(v)], find(v)});
        }
    }
    ll ans = 0;
    int one = 0, x = 1;
    while (x){
        ans += v[x] ? 0 : one;
        one += v[x] == 1;
        x = suf[x];
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 18304
#include<bits/stdc++.h>
using namespace std;
int main(){long long n,i,j,k,p=0,r=0,g=0,b=0,t;
string s;cin>>n>>s;
for(i=0;i<n;i++){
    if(s[i]=='R')
    r++;
    if(s[i]=='G')
    g++;
    if(s[i]=='B')
    b++;
}t=r*g*b;
for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
        k=2*j-i;
        if(k>0&&k>j&&k<n){
            if(s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i])
            p++;
        }
    }
}cout<<t-p;
    return 0;
  
}

Measured memory_bytes: 3628
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
c = Counter(S)
bool = True
if (c['N']==0) ^ (c['S']==0):
    bool = False
if (c['E']==0) ^ (c['W']==0):
    bool = False

print('Yes' if bool else 'No')


Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>
#define VMAX 10000


int main(){
   unsigned short *A, *B;
   int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

   A = malloc(sizeof(short)*n+1);
   B = malloc(sizeof(short)*n+1);



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

  for(i = 0; i < VMAX+1; i++){
    C[i] = 0;
  }

  for(i = 0 ;i < n;i++){
    C[A[i]]++;
  }

  for(i = 1; i < VMAX+1; i++){
    C[i] = C[i] + C[i-1];
  }

  for(i = n-1; i >= 0; i--){
    B[C[A[i]]-1] = A[i];
    C[A[i]]--;
  }


  
  for(i = 0; i < n ; i++){
 
    if(i == n-1){
      printf("%d\n",B[i]);
      break;
    }
    printf("%d ",B[i]);
  }

  return 0;
}



Measured memory_bytes: 9592
import java.util.Scanner;
import java.util.stream.IntStream;
 
public class Main{
    static IntStream REPS(int v){return IntStream.range(0,v);}
    static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
    static IntStream INS(int n) {return REPS(n).map(i->getInt());}
    static Scanner s=new Scanner(System.in);
    static int getInt(){return Integer.parseInt(s.next());}
    public static void main(String[]$){
        int n=getInt(),cn=n;
        int rn=0;
        while(cn!=0) {
            rn*=10;
            rn+=cn%10;
            cn/=10;
        }
        System.out.println(rn==n?"Yes":"No");
    }
}

Measured memory_bytes: 23636
#include<iostream>
#include<algorithm>
#include <vector>
#include <cstdio>
using namespace std;

static const int NIL = -1;
int nodePointer;

class Node{
public:

	int valSubScript;
	int parent, left, right;
};

class Point {
public:

	Point(){}
	Point(int X, int Y, int ID): x(X), y(Y), id(ID){}

	void Print() {
//		cout << id << endl;
		printf("%d\n", id);
	}

	//?????????????????¨STL?????????struct?????\???????????????
	bool operator <(const Point &p) {
		return id < p.id;
	}

	int GetX() const { return x; }
	int GetY() const { return y; }

private:

	int id;
	int x, y;
};

 bool LessX(const Point &p1, const Point &p2) {
	return p1.GetX() < p2.GetX();
}

 bool LessY(const Point &p1, const Point &p2) {
	return p1.GetY() < p2.GetY();
}

int makeKDTree(int left, int right, int depth, Point point[], Node kDNode[]) {

	if (left >= right) return NIL;

	int mid = (left + right) / 2;

	int curNP = nodePointer;
	nodePointer++;

	if (depth % 2 == 0) sort(point + left, point + right, LessX);
	else                         sort(point + left, point + right, LessY);

	kDNode[curNP].valSubScript = mid;
	kDNode[curNP].left = makeKDTree(left, mid, depth + 1, point, kDNode);
	kDNode[curNP].right = makeKDTree(mid + 1, right, depth + 1, point, kDNode);

	return curNP;
}

void FindVerticalPoint(int subScript, int minX, int maxX, int minY, int maxY, 
	int depth, vector<Point> &ans, Point point[], Node kDNode[]) {

	int x = point[kDNode[subScript].valSubScript].GetX();
	int y = point[kDNode[subScript].valSubScript].GetY();

	if (minX <= x && x <= maxX && minY <= y && y <= maxY)
		ans.push_back(point[kDNode[subScript].valSubScript]);

	if (depth % 2 == 0) {
		if (kDNode[subScript].left != NIL)
			if (minX <= x) FindVerticalPoint(kDNode[subScript].left, minX, maxX, minY, maxY, depth + 1, ans, point, kDNode);
		if (kDNode[subScript].right != NIL)
			if (x <= maxX) FindVerticalPoint(kDNode[subScript].right, minX, maxX, minY, maxY, depth + 1, ans, point, kDNode);
	} else {
		if (kDNode[subScript].left != NIL)
			if (minY <= y) FindVerticalPoint(kDNode[subScript].left, minX, maxX, minY, maxY, depth + 1, ans, point, kDNode);
		if (kDNode[subScript].right != NIL)
			if (y <= maxY) FindVerticalPoint(kDNode[subScript].right, minX, maxX, minY, maxY, depth + 1, ans, point, kDNode);
	}
}

int main() {
	int verNum;
	Point point[500000];
	Node kDNode[500000];

//	cin >> verNum;
	scanf("%d", &verNum);
	for (int i = 0; i < verNum; i++) {
		int x, y;
//		cin >> x >> y;
		scanf("%d %d", &x, &y);
		point[i] = Point(x, y, i);
		kDNode[i].left = kDNode[i].right = 
			kDNode[i].parent = NIL;
	}

	nodePointer = 0;
	int root = makeKDTree(0, verNum, 0, point, kDNode);

	int query;
	int minX, minY, maxX, maxY;
	//cin >> query;
	scanf("%d", &query);
	vector<Point> ans;
	for (int i = 0; i < query; i++) {
//		Point ans[500000];
		ans.clear();
//		cin >> minX >> maxX >> minY >> maxY;
		scanf("%d %d %d %d", &minX, &maxX, &minY, &maxY);
		FindVerticalPoint(root, minX, maxX, minY, maxY, 0, ans, point, kDNode);
		sort(ans.begin(), ans.end());
		for (int j = 0; j < ans.size(); j++) {
			ans[j].Print();
		}
//		cout << endl;
		printf("\n");
	}
}

Measured memory_bytes: 16384
#include <iostream>
#include <vector>

using namespace std;

const long long inf = 1000000000000000000;

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

	int n;
	cin >> n;

	vector<long long> a;
	a.resize(n);

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

	vector<long long> dp;
	dp.resize(n);

	vector<long long> sum;
	sum.resize(n);

	for(int i = 0; i < n; ++i) {
		sum[i] = (i >= 2 ? sum[i - 2] : 0) + a[i];
	}
	
	dp[1] = max(a[0], a[1]);

	for(int i = 2; i < n; ++i) {
		if(!(i & 1)) {
			dp[i] = max(dp[i - 1], dp[i - 2] + a[i]);
		} else {
			dp[i] = max(sum[i - 1], dp[i - 2] + a[i]);
		}
	}

	cout << dp[n - 1] << '\n';

	return 0;
}


Measured memory_bytes: 7948
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	V := make([]float64, N)
	for i := range V {
		fmt.Scan(&V[i])
	}
	sort.Float64s(V)

	score := V[0]
	for i := range V {
		score = (score + V[i]) / 2
	}
	fmt.Println(score)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int r; cin >> r;
  cout << 3 * r * r << endl;
}


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

int main(){
    int n, a, b;
    std::cin>>n>>a>>b;

    std::cout<<std::min(a * n, b)<<std::endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int q = Integer.parseInt(br.readLine());
      String[] s = new String[q+q];
      Arrays.fill(s, "");
      List<String> list  = Arrays.asList(s);
      int head = q;
      int tail = q;

      String[] query;
      int op;
      for ( int i=0; i<q; i++ ){
        query = br.readLine().split(" ");
        op  = Integer.parseInt(query[0]);

        switch( op ) {
          case 0 :
            if ( Integer.parseInt(query[1]) == 0 )
              list.set(head--,query[2]);
            else
              list.set(++tail,query[2]);
            break;
          case 1 :
            System.out.println( list.get(head+1 + Integer.parseInt(query[1])) );
            break;
          case 2 :
            if ( Integer.parseInt(query[1]) == 0 )
              head++; // list.set(head++,"");
            else
              tail--; // list.set(tail--,"");
            break;
          default:
        }
      }
    }
  }
}


Measured memory_bytes: 124220
#include  "bits/stdc++.h"
//#include  <iostream>
 using namespace std;
 
#define IOS         ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define mem(a,v)    memset((a), (v), sizeof (a))
#define FOR(i,a,n)  for(int i = (a); i<(n); ++i) 
#define FORE(i,a,n) for(int i = (a); i<=(n); ++i)
#define mp(a , b)   make_pair(a , b)
#define pb(a)       push_back(a)

#define anal         '\n'

#define M 1000000007 
typedef long long ll;


int main(){
     
    IOS;
    
 //   freopen("input.in", "r", stdin);
  //  freopen("output.in", "w", stdout);
    
   float n;
    cin>>n;
  
   printf("%0.3f",2*3.14*n);


 

  return  0 ;
   	    
}


Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
using vs = vector<string> ;
#define all(v) v.begin(),v.end()

int main(){
  ll N,M;cin>>N>>M;
  priority_queue<pair<ll,ll>> works;
  vector<pair<ll,ll>> v;
  rep(i,N){
    ll a,b;cin>>a>>b;
    v.push_back(make_pair(b,a));
  }
  sort(all(v),[&](auto const& a,auto const& b){return a.second<b.second;});
  int ans=0,tmp=0;
  for(int i=0;i<=M;++i){
    while(tmp<N && v[tmp].second<=i){
      pair<ll,ll> p = make_pair(v[tmp].first,v[tmp].second);
      works.push(p);
      tmp++;
    }
    if(!works.empty()){
    pair<ll,ll> w = works.top();
    ans += w.first;
    works.pop();
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4848
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define MAX(a, b) ((a > b)?a:b)

typedef struct point{
  int x;
  int y;
  int h;
}point;

int cmp(const void *x, const void *y) {
  return ((point *)y)->h - ((point *)x)->h;
}

int main() {
  int n, ansh, k;
  scanf("%d", &n);
  point a[n];
  for (int i=0; i<n; i++) {
    scanf("%d%d%d", &(a[i].x), &(a[i].y), &(a[i].h));
  }
  qsort(a, n, sizeof(point), cmp);
  for (int i=0; i<=100; i++) {
    for (int j=0; j<=100; j++) {
      ansh = a[0].h + abs(a[0].x-i) + abs(a[0].y-j);
      for (k=1; k<n; k++) {
        if (MAX(ansh-abs(a[k].x-i)-abs(a[k].y-j), 0) == a[k].h) continue;
        else break;
      }
      if (k==n) {
        printf("%d %d %d\n", i, j, ansh);
        return 0;
      }
    }
  }
  return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<pair<P,int>>pai;
	set<string>ss;
	rep(i, n) {
		string s;
		int p;
		cin >> s >> p;
		P pp = make_pair(s, -p);
		pai.emplace_back(make_pair(pp, i));
	}
	sort(pai.begin(), pai.end());
	rep(i, n) {
		cout << pai[i].second +1<< endl;
	}
	return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    ll A[15] = {};
    cin >> N;
    rep(i,0,N) cin >> A[i];
    ll ans = 0;
    ll dd[3] = {-1,0,1};
    rep(bit,0,pow(3,N)){
        ll v[10] = {};
        ll idx = 0;
        ll n = bit;
        while(n > 0){
            v[idx] = n % 3;
            n /= 3;
            idx++;
        }
        bool ok = false;
        rep(i,0,N){
            if((A[i] + dd[v[i]]) % 2 == 0){
                ok = true;
            } 
        }
        if(ok) ans++;

    }
    print(ans);

}

Measured memory_bytes: 256
N = int(input())
mod = 1000000007
def powmod(x,y):
  res = 1
  for i in range(y):
    res = res*x%mod
  return res
ans = powmod(10,N)-powmod(9,N)-powmod(9,N)+powmod(8,N)
ans = ans%mod
ans = (ans + mod)%mod
print(ans)

Measured memory_bytes: 9128
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
#include <set>

#define F first
#define S second
#define PB push_back
using namespace std;

const int maxn = 1e4;
bool dp[2][maxn][2 * maxn];
vector <int> v, u[2];

int main (){
    string s;
    int x, y;
    cin >> s >> x >> y;
    int cnt = 0;
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'T'){
            v.PB(cnt);
            cnt = 0;
        }
        else {
            cnt ++;
            if (i == s.size() - 1)
                v.PB(cnt);
        }
    }
    int n = v.size();
    u[1].PB(0);
    u[0].PB(0);
    for (int i = 0; i < n; i++)
        u[i % 2].push_back(v[i]);
    dp[0][0][10 * 1000] = 1;
    dp[1][0][10 * 1000] = 1;
    for (int i = 0; i < u[0].size() - 1; i++){
        for (int j = 0; j < 2 * maxn; j++){
            if (dp[0][i][j]){
                dp[0][i + 1][j + u[0][i + 1]] = 1;
                if (i == 0)
                    continue;
                dp[0][i + 1][j - u[0][i + 1]] = 1;
            }
        }
    }
    for (int i = 0; i < u[1].size() - 1; i++){
        for (int j = 0; j < 2 * maxn; j++){
            if (dp[1][i][j]){
                dp[1][i + 1][j + u[1][i + 1]] = 1;
                dp[1][i + 1][j - u[1][i + 1]] = 1;
            }
        }
    }
    int p = u[0].size() - 1;
    int q = u[1].size() - 1;
    if (dp[0][p][x + 1000 * 10] && dp[1][q][y + 1000 * 10])
        cout << "Yes" << endl;
    else  
        cout << "No" << endl;  
}       


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

int main() {
	string s;
	cin >> s;
	string t = "CODEFESTIVAL2016";

	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		ans += s[i] != t[i];
	}
	cout << ans << endl;
}

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

#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)

int main(void)
{
	int K, S;
	cin >> K >> S;
	int ans = 0;
	Rep(X, K + 1){
		Rep(Y, K + 1){
			int Z = S - X - Y;
			if(0 <= Z && Z <= K){
				ans++;
			}
		}
	}
	PrintLn(ans);
}


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

int main(){
    ull N, ans = 1;
    cin >> N;
    std::vector<ull> A(N);
    
    for(ull i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] == 0){
            ans = 0;
            break;
        }
    }
    
    if(ans != 0){
        for(ull i = 0; i < N; i++){
            if(A[i] > 1000000000000000000 / ans){
                ans = -1;
                break;
            }
            ans *= A[i];
        }
    }

    cout << (ll)ans << endl;
}


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

int main(){
  ll A,V,B,W,T;
  cin>>A>>V>>B>>W>>T;
  if(abs(A-B) <= abs(V*T) - abs(W*T)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var ny = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            for(int i = 0; i <= ny[0]; i++) {
                for(int j = 0; j <= ny[0] - i; j++) {
                    var otoshidama = i * 10000 + j * 5000 + (ny[0] - i - j) * 1000;
                    if(otoshidama == ny[1]) {
                        Console.WriteLine($"{i} {j} {ny[0] - i - j}");
                        Console.Out.Flush();
                        return;
                    }
                }
            }

            Console.WriteLine("-1 -1 -1");

            Console.Out.Flush();
        }
    }
}


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

int main() {
    vector<int> vnum1, vnum2;
    vector<char> vop;
    int num1, num2, i, N = -1;
    char op;

    do {
        cin >> num1 >> op >> num2;
        vnum1.push_back(num1);
        vop.push_back(op);
        vnum2.push_back(num2);
        ++N;
    } while(vop[N] != '?');

    for(i=0; i<N; ++i) {
        switch(vop[i]) {
            case '+':
                cout << vnum1[i] + vnum2[i] << endl;
                break;
            case '-':
                cout << vnum1[i] - vnum2[i] << endl;
                break;
            case '*':
                cout << vnum1[i] * vnum2[i] << endl;
                break;
            case '/':
                cout << vnum1[i] / vnum2[i] << endl;
                break;
            default:
                break;
        }
    }

    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(RALL(x))
#define SUM(x) accumulate(ALL(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}

int main () {
  ll a, b;
  cin >> a >> b;
  ll g = gcd(a,b);
  auto f = factorize(g);
  int ans = f.size() + 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}

ll mod=1000000007;
vecll per(200010);
ll pw(ll a,ll p){
    if(p==0)return 1;
    if(p%2==0){
        ll d=pw(a,p/2);
        return d*d%mod;
    }
    return a*pw(a,p-1)%mod;
}
void f(){
    per[0]=1;
    rep2(i,1,200009){
        per[i]=per[i-1]*i%mod;
    }
    return;
}

ll divide(ll a,ll b){
    return a*(ll)pw(b,mod-2)%mod;
}
ll comb(ll a,ll b){
    return divide(per[a],per[b]*per[a-b]%mod);
}
int main(){
    int n=in(),a=in(),b=in(),c=in();
    f();
    ll cnt=0;
    rep2(k,n,2*n-1){
        cnt+=divide(comb(k-1,n-1)*((pw(a,n)*pw(b,k-n)%mod+pw(b,n)*pw(a,k-n)%mod)%mod)%mod*k%mod,pw(a+b,k)%mod);
        cnt%=mod;
    }
  if(c>0)cnt=divide(cnt*100%mod,a+b);
    cout<<cnt<<endl;
}


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

#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define si(x) scanf("%d", &x)
#define sll(x) scanf("%lld", &x)
#define loop(i, x, y, z) for(int i=(x); i<(y); i+=(z))
#define loopr(i, x, y, z) for(int i=(x); i>=(y); i-=(z))
#define deb(x) cerr << "[ " << #x << " : ";debug(x);cerr << " ]\n";

template<class T> void read(T&);
template<class H, class... T> void read(H&, T&...);
template<class A> void read(vector<A>&);
template<class T> void write(T);
template<class H, class... T> void write(H, T...);
template<class A> void write(vector<A>);
template<class A, class B> void debug(map<A, B>);
template<class A, class B> void debug(unordered_map<A, B>);
template<class A> void debug(vector<A>);

//------------------------------ Templates Definition -------------------------------- //

template<class A, class B>
void debug(map<A, B> m) {
	for(auto v: m) {
		cerr << "[ " << v.first << " : " << v.second << " ] ";
	}
}

template<class A, class B>
void debug(unordered_map<A, B> m) {
	for(auto v: m) {
		cerr << "[ " << v.first << " : " << v.second << " ] ";
	}
}

template<class A>
void debug(vector<A> m) {
	for(auto v: m) {
		cerr << v << ' ';
	}
}

template<typename T>
void debug(T t) {
	cerr << t;
}

template<class T>
void read(T& x) {
	cin >> x;
}

template<class H, class... T>
void read(H& h, T&... t) {
	read(h);
	read(t...);
}

template<class A>
void read(vector<A>& v) {
	for(auto &x: v) read(x);
}

template<class T>
void write(T x) {
	cout << x << '\n';
}

template<class H, class... T>
void write(H h, T... t) {
	write(h);
	write(t...);
}

template<class A>
void write(vector<A> v) {
	for(auto x: v) {
		cout << x << '\n';
	}
	cout << '\n';
}

// --------------------- End Of Templates -------------------------------------- //

void testcase()
{
	int D, T, S;
	si(D); si(T); si(S);
	if(S*1LL*T >= D) {
		printf("Yes");
	} else {
		printf("No");
	}
}

int main()
{
	int t = 1;
	//si(t);
	while(t--) {
		testcase();
		puts("");
	}
}


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

int MCXItoI(char *MCXI,int len);
int ctoi(char c);		//char to integer
void ItoMCXI(int integer,char ans[]);
char itoc(int i);


int main(void) {
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		char MCXI1[8],MCXI2[8];
		scanf("%s %s",MCXI1,MCXI2);
		int num1,num2;
		int len1,len2;
		len1 = strlen(MCXI1);
		len2 = strlen(MCXI2);
		num1 = MCXItoI(MCXI1,len1);
		num2 = MCXItoI(MCXI2,len2);
		char ans[8];
		ItoMCXI(num1+num2,ans);
		printf("%s\n",ans);
	}

	return 0;
}

int MCXItoI(char *MCXI,int len){
	char work;
	int temp = 1;
	int M = 0;
	int C = 0;
	int X = 0;
	int I = 0;
	int i = 0;

	while(i<len){
		work = *(MCXI + i++);
		if('0'<work && work<='9'){
			temp = ctoi(work);
		}
		else{
			switch (work){
			case 'm': M = temp;
					  temp = 1;
					  break;
			case 'c': C = temp;
					  temp = 1;
					  break;
			case 'x': X = temp;
					  temp = 1;
					  break;
			case 'i': I = temp;
					  temp = 1;
					  break;
			}
		}
	}
	int result;
	result = M*1000 + C*100 + X*10 + I;
	return result;
}

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

void ItoMCXI(int integer,char ans[]){
	int M = 0;
	int C = 0;
	int X = 0;
	int I = 0;

	M = integer / 1000;
	C = (integer-1000*M) /100;
	X = (integer-1000*M-100*C) / 10;
	I = (integer-1000*M-100*C-10*X);

	int i =0;

	if(M != 0){
		if(M != 1){ans[i++] = itoc(M);}
		ans[i++] ='m';
	}
	if(C != 0){
		if(C!=1){ans[i++] = itoc(C);}
		ans[i++] ='c';
	}
	if(X != 0){
		if(X!=1){ans[i++] = itoc(X);}
		ans[i++] ='x';
	}
	if(I != 0){
		if(I!=1){ans[i++] = itoc(I);}
		ans[i++] ='i';
	}
	ans[i] = '\0';
}

char itoc(int i){
	char c;
	c = i + '0';
	return c;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll n; cin>>n;
  string s, t;
  cin>>s>>t;
  rep(i, n) cout<<s.at(i)<<t.at(i);
}

Measured memory_bytes: 256
/* Filename: ABC044B.java
 * Author: Mushiyo
 */

import java.util.Scanner;
import java.util.Arrays;

public class Main{

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int[] countChar = new int[26];

		while (input.hasNext()) {
			String w = input.next();
			Arrays.fill(countChar, 0);
			
			for(int i = 0; i < w.length(); ++i){
				++countChar[w.charAt(i) - 'a'];
			}
			
			boolean isBeautiful = true;
			for(int i = 0; i < countChar.length; ++i){
				if(countChar[i] % 2 == 1){
					isBeautiful = false;
				}
			}
			
			if(isBeautiful){
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}

}


Measured memory_bytes: 8660
from statistics import mean, median,variance,stdev
import sys
import math

x = input().split()
#y = input().split()
a = []
#for i in range(len(x)):
#   a.append(int(x[i]))

q = int(x[0])
w = int(x[2])
if x[1] == '-':print(q-w)
else: print(q+w)

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

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const ll INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

//#define int long long
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

int n, t, s;
int dp[2][3005];
int a[3005], b[3005];

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> t >> s;
    rep(i, n) cin >> a[i] >> b[i];
    int cur = 1, pre = 0;
    rep(i, n) {
        rep(j, t + 1) dp[cur][j] = 0;
        rep(j, t + 1) {
            dp[cur][j] = dp[pre][j];
            if (j - b[i] >= 0) {
                if (j <= s) dp[cur][j] = max(dp[cur][j], dp[pre][j - b[i]] + a[i]);
                else if (j - b[i] >= s) dp[cur][j] = max(dp[cur][j], dp[pre][j - b[i]] + a[i]);
            }
        }
        swap(cur, pre);
    }
    int ans = 0;
    rep(j, t + 1) ans = max(ans, dp[pre][j]);
    cout << ans << endl;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

	int h, w;
	cin >> h >> w;

	vector<string> v(h);
	vector<int> h_ng(h, 0);
	vector<int> w_ng(w, 0);
	rep (i, 0, h)
		cin >> v[i];

	rep (i, 0, h) {
		bool judge = false;
		rep (j, 0, w) {
			if (v[i][j] == '#') {
				judge = true;
				break;
			}
		}
		if (!judge)
			h_ng[i] = 1;
	}

	rep (i, 0, w) {
		bool judge = false;
		rep (j, 0, h) {
			if (v[j][i] == '#') {
				judge = true;
				break;
			}
		}
		if (!judge)
			w_ng[i] = 1;
	}

	rep (i, 0, h) {
		if (h_ng[i])
			continue;
		rep (j, 0, w) {
			if (w_ng[j])
				continue;

			cout << v[i][j];
		}
		cout << "\n";
	}

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long d,t,s;
    cin>>d>>t>>s;
    if((t*s)>=d)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector <string> S(N);
  for( int i = 0; i < N; i++){
    cin >> S.at(i);
  }
  int ans = 1;
  sort(S.begin(), S.end());
    for(int i=0; i<(N-1); i++){
      if(S.at(i) != S.at(i+1)){
        ans ++;
      }
    }
  cout << ans << endl;
}


Measured memory_bytes: 9604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/
typedef pair<char, ll> pci;
vector<pci> a, b, c;

int main()
{
	char let; ll n;
	while (cin >> let&&let != '$')
	{
		cin >> n;
		a.emplace_back(let, n);
	}
	while (cin >> let&&let != '$')
	{
		cin >> n;
		b.emplace_back(let, n);
	}
	while (cin >> let&&let != '$')
	{
		cin >> n;
		c.emplace_back(let, n);
	}
	int sza = a.size(), szb = b.size(), szc = c.size();
	vector<pci> res;
	
	REP(i, sza - szb + 1)
	{
		if (a[i].first == b[0].first&&a[i].second >= b[0].second)
		{
			bool f = true;
			int j;
			for (j = 1; j < szb; j++)
			{
				if (j == szb - 1)
				{
					if (b[j].first != a[i + j].first || b[j].second > a[i + j].second) f = false;
				}
				else
				{
					if (b[j].first != a[i + j].first || b[j].second != a[i + j].second) f = false;
				}
			}
			if (f)
			{
				if (szb <= 1)
				{
					REP(k, i) res.emplace_back(a[k]);
					REP(k, c.size()) res.emplace_back(c[k]);
					if (a[i].second > b[0].second) res.emplace_back(a[i].first, a[i].second - b[0].second);
					FOR(k, i + b.size(), a.size()) res.emplace_back(a[k]);
					break;
				}
				else
				{
					REP(k, i) res.emplace_back(a[k]);
					if (a[i].second > b[0].second) res.emplace_back(a[i].first, a[i].second - b[0].second);
					REP(k, szc) res.emplace_back(c[k]);
					if (a[i + szb - 1].second > b.back().second) res.emplace_back(b.back().first, a[i + b.size() - 1].second - b.back().second);
					FOR(k, i + szb, sza) res.emplace_back(a[k]);
					break;
				}
			}
		}
	}
	vector<pci> ans;
	if (res.size() == 0) ans = a;
	else
	{
		ans.emplace_back(res[0]);
		FOR(i, 1, res.size())
		{
			if (res[i].first == ans.back().first) ans.back().second += res[i].second;
			else ans.emplace_back(res[i]);
		}
	}
	REP(i, ans.size()) cout << ans[i].first << " " << ans[i].second << " ";
	cout << "$\n";
	return 0;
}

Measured memory_bytes: 3228
#include<stdio.h>
char a[110];
bool t;
int main()
{
	int n,i;
	scanf("%d%s",&n,a);
	if(n%2==1)printf("No\n");
	else
	{
		for(i=0;i<n/2;i++)
	    {
		    if(a[i]==a[i+n/2])t=1;
		    else
			{
				t=0;
				break;
			} 
	    }
	    if(t==1)printf("Yes\n");
	    else printf("No\n");
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#define 	pi 				3.14159265358979
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(ll i = a ; i < b ; i++)
#define     repn(i, a, b)   for(ll i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define     inf             2e18
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define 	ff 				first
#define 	ss				second
#define 	pb				push_back
#define 	mp				make_pair
#define 	bb 				begin()
#define     rb              rbegin()
#define 	ee 				end()
#define     ub              upper_bound
#define     lb              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define     sorta(v)         sort(all(a))
#define     sortd(v)        sort(all(a), greater<ll >())
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define     pll             pair<ll, ll>
#define     vll             vector<ll>
#define     vpll            vector<pll>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define     sqr(a)          ((a)*(a))
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	print3(a) 		for(auto i : a)cout<<i<<nl;
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

// ostringstream str1;
// str1 << n;
// string tmp = str1.str();
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
 
bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

bool compare_float(double x, double y){
    return fabs(x - y) < DBL_EPSILON;
}

double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }
 
// vll pwx(11);
// void cal(ll x){ pwx[0] = 1; rep(i, 1, 11)pwx[i] = x*pwx[i-1]; }
 
/* ################################################################ */

#define space 500005


void solve(){

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

    vector<ll> a(n), pre(n, 1);
    ll tmp = 1;

    rep(i, 0, n){
        cin >> a[i];
    }


    for(ll i = k ; i < n ; i++){
        if(a[i] > a[i-k]){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }
}

 
int main(){
    // boost;
    // cal(1);
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

Measured memory_bytes: 6388
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int X, t;
	cin >> X >> t;

	int n = X - t;
	if (n < 0) n = 0;

	cout << n << endl;
}

Measured memory_bytes: 3568
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
using ll = long long;
int main()
{
    ll l;
    cin >> l;
    cout << fixed << setprecision(30) << l * l * l / 27.0 << "\n";

    return 0;
}

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

int main(){
  int N, K;
  int d=0;
  cin >> N;
  cin >> K;
  
  vector<int> x(N);
  for(int i=0;i<N;i++){
    cin >> x.at(i);
    d+=2*min(x.at(i),K-x.at(i));
  }  
  cout << d << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
#include <sstream>
#include <cctype>
using namespace std;
 
#define PQ priority_queue
#define P pair<int,int>
#define CLA(array) memset(array,0,sizeof array)
#define CLINF(array) memset(array,0x3f,sizeof array)
#define CLF(array) memset(array,-1,sizeof array)
#define DB(a) cout << "DEBUG " << a << endl;
#define lowbit(x) (x)&(-x)
#define fi first
#define se second
typedef long long LL;
typedef unsigned long long ULL;
const int MAXN = 100000 + 10;
const int INF = 0x3f3f3f3f;
 
std::vector<P> v;
int a[MAXN];
 
 
int main(){
    //ios_base::sync_with_stdio(false);
	int n; scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d", &a[i]);
	}
	sort(a, a+n);
	int i, x = 0, y = 0;
	for(i = n-1; i >= 1; i--){
		if(a[i] == a[i-1]){
			x = a[i];
			i -= 2;
			break;
		}
	}
	for(; i >= 1; i--){
		if(a[i] == a[i-1]){
			y = a[i];
			break;
		}
	}
	LL sum = (LL)x*(LL)y;
	printf("%lld\n", sum);
 
    return 0;
}

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

const ll mod = 1000000007;

ll dp[100005][2];
vector<int> g[100005];
void f(int v, int p)
{
    dp[v][0] = 1;
    dp[v][1] = 1;
    for (auto to : g[v])
    {
        if (to == p) continue;
        f(to, v);
        dp[v][0] *= (dp[to][0] + dp[to][1]);
        dp[v][1] *= dp[to][0];
        dp[v][0] %= mod;
        dp[v][1] %= mod;
    }
}

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n-1; i++)
    {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    f(1, -1);
    cout << (dp[1][0] + dp[1][1]) % mod;

    return 0;
}


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

using namespace std;

typedef long long ll;
const int MAX=1e9+7;

int main()
{
    char s[3];
    int ans=7;
    cin>>s;
    for(int i=0;i<3;i++)
        {
            if(s[i]=='o')
                ans++;
        }
        cout<<ans*100<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        FastReader in = new FastReader();
        FastWriter out = new FastWriter();
        int n = in.nextInt();
        String s = in.nextLine();
        if (n % 2 != 0){
            out.pl("No");
        }else if (!(s.substring(0, n/2).equals(s.substring(n/2, n)))){
            out.pl("No");
        }else{
            out.pl("Yes");
        }
        /*
        if (n % 2 != 0){
            out.pl("No");
        }else{
            HashSet<Character> h = new HashSet<Character>();
            for (int i = 0; i < n; i++){
                h.add(s.charAt(i));
            }
            if (n / 2 == h.size()){
                out.pl("Yes");
            }else{
                out.pl("No");
            }
        }
        */
        out.close();
    } 
}
class FastReader{ 
    BufferedReader br; 
    StringTokenizer st; 
    public FastReader() { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    String next(){ 
        while (st == null || !st.hasMoreElements()) { 
            try{ 
                st = new StringTokenizer(br.readLine()); 
            }catch (IOException  e){ 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    int nextInt(){ 
        return Integer.parseInt(next()); 
    } 
    long nextLong(){ 
        return Long.parseLong(next()); 
    } 
    double nextDouble(){ 
      return Double.parseDouble(next()); 
    } 
    String nextLine(){ 
        String str = ""; 
        try{ 
            str = br.readLine(); 
        } 
        catch (IOException e){ 
            e.printStackTrace(); 
        } 
        return str; 
    } 
}
class FastWriter{
    PrintWriter out;
    FastWriter(){
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	out.flush();
    }
    void pl(Object o){
        out.write(o.toString());
	    out.write("\n");
        out.flush();
    }
    void pl(){
        out.write("\n");
    }
    void p(Object o){
        out.write(o.toString());
    }
    void close(){
        out.flush();
        out.close();
    }  
}


Measured memory_bytes: 32960
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())

def eratosthenes(lim):
  is_p=[2]*lim

  is_p[0]=0
  is_p[1]=1

  for i in range(2,lim):
    if 1==1:
#    if is_p[i]==2:
#      cnt=2
      for j in range(i*2,lim,i):
#        cnt+=1
#        is_p[j] = cnt
        is_p[j] += 1

  return is_p

lim=n+1
is_p=eratosthenes(lim)

#print(is_p)

ans=0
for i in range(1,n+1):
  ans+=i*is_p[i]
print(ans)

Measured memory_bytes: 146172
//use itertools::Itertools;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        k: usize,
        p: [usize;n]
    }

    let mut p = p;
    p.sort();

    let mut ans = 0;

    for i in 0..k {
        ans += p[i];
    }

    println!("{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


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

int main() {
  	long long int ans=0,count=0;
   	string s;
    cin >> s;
  for (long long int i=0;i<s.size();i++){
  	if (s[i]=='B'){
      ans+=s.size()-i-1;
      count++;}
  }
  ans-=(count-1)*count/2;
    cout <<ans <<endl;
   
}

Measured memory_bytes: 640
n = int(raw_input())
a = []
for i in range(n):
    a.append(int(raw_input()))

cnt = 0
num = 1
G = [1]
while 1:
    if num*3+1 > n:
        break
    G.insert(0, num*3+1)
    num = num*3 + 1
m = len(G)

def insertionSort(A, n, g, cnt):
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
    return cnt

for i in range(m):
    cnt = insertionSort(a, n, G[i], cnt)

print m
for i in range(m):
    if i == m-1:
        print G[i]
    else:
        print G[i],
        
print cnt

for i in range(n):
    print a[i]

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

int main() {
	long long S;
	cin >> S;
	const long long L = pow(10, 9);
	long long x, y;
	if (S < L * L) {
		y = S / L + 1;
		x = L * y - S;
	}
	else {
		y = L;
		x = 0;
	}
	cout << "0 0 " << L << " 1 " << x << " " << y << endl;
}

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

int main(){

    int N;
    cin >> N;
    vector<int> H(N);
    rep(i,N) cin >> H[i];

    int countmax = 0;
    int counttemp = 0;
    rep(j,N-1){
        if(H[j] >= H[j+1]){
            counttemp++;
            if (countmax < counttemp) countmax = counttemp;
        }else{
            counttemp = 0;
        }
    }

    cout << countmax << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
 
#define ull unsigned long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
using namespace std;
 
const int INF = 1e9 + 7;
 
int main(void)
{
	FAST
	
	int x, y;
	cin >> x >> y;
	bool ok = 0;
	for(int i = 0; i <= x; i++)
	{
		if(i*2 + (x-i)*4 == y) ok = 1;
	}

	cout << (ok?"Yes":"No") << '\n';

	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector< vector<long long> > ab;
  ab = vector< vector<long long> > (n, vector<long long>(2, 0));
  ab.resize(n);
  int i;
  for (i = 0; i < n; i++) {
    cin >> ab[i][0] >> ab[i][1];
  }
  sort(ab.begin(), ab.end());
  long long result = 0;
  for (i = 0; i < n; i++) {
    if (m < ab[i][1]) {
      result += ab[i][0] * m;
      break;
    } else {
      result += ab[i][0] * ab[i][1];
      m -= ab[i][1];
    }
  }

  cout << result << endl;
  return 0;
}


Measured memory_bytes: 5760
n=int(input())
a=list(map(int,input().split()))
a.sort()
A=(2**(n//2))%(10**9+7)
for i in range(n):
  if i%2==n%2 and i+1!=a[i] or i%2==(n+1)%2 and i!=a[i]:A=0
print(A)

Measured memory_bytes: 13880
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
using ll = long long;
using P = pair<int, int>;
 
int main() {
  int x;
  cin >> x;
  ll ans = 0;
  for(int i = 1; i <= 32; i++){
    for(int j = 2; j <= 10; j++){
      ll s = pow(i,j);
      if(s <= x) ans = max(ans,s);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3940
def main
  base, div, target_m = ARGF.gets.split.map(&:to_i)

  mods = []
  1.upto(100) do |n|
    cur = base * n

    m = cur % div
    if m == target_m
      puts "YES"
      return
    end

    if mods.index(m)
      puts "NO"
      return
    end
  end

  puts "NO"
end

if __FILE__ == $0
  main
end


Measured memory_bytes: 1788
import std.stdio, std.string, std.array, std.conv;

void main() {
    long n = readln.chomp.to!long;
    int[] a = new int[32];
    int[] b = new int[32];
    int[] c = new int[32];
    int[] d = new int[32];
    long m = n << 1;
    long l = n >> 1;
    foreach_reverse (i; 0 .. 32) {
        a[i] = n & 1;
        b[i] = !a[i];
        n /= 2;
        c[i] = m & 1;
        m /= 2;
        d[i] = l & 1;
        l /= 2;
    }
    a.to!(string[]).join.writeln;
    b.to!(string[]).join.writeln;
    c.to!(string[]).join.writeln;
    d.to!(string[]).join.writeln;
}


Measured memory_bytes: 2500