akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int prime[1000000+10];
void makep(int n){prime[0]=prime[1]=1;for(int i=2;i*i<=n;i++)if(!prime[i])for(int j=i*i;j<=n;j+=i)prime[j]=1;}
void yakusuu_zeta(int n,ll*dp){
	//g(x)=Σ[k|x]f(k)のとき、fからgを作る
	rep(p,2,n+1)if(!prime[p])rep(k,1,n/p+1)dp[k*p]+=dp[k];
}

int n;
int a[200010];
ll aa[1000010];
int main(){
	scanf("%d",&n);
	rep(i,0,n)scanf("%d",a+i);
	rep(i,0,n)aa[a[i]]++;
	makep(1000005);
	yakusuu_zeta(1000000,aa);

	int ans=0;
	rep(i,0,n)if(aa[a[i]]==1)ans++;
	printf("%d",ans);
}

Measured memory_bytes: 14184
import time
start = time.time()
H,W=[int(s) for s in input().split()]
inls=[[int(s) for s in input().split()] for _ in range(H)]
for i in range(H):
  x=[int(s) for s in input().split()]
  for j in range(W):
    inls[i][j]=abs(inls[i][j]-x[j])
dp=[[set() for _ in range(W)] for _ in range(H)]
dp[0][0].add(inls[0][0])
for i in range(H):
  for j in range(W):
    x=80*(H+W-i-j)
    for e in dp[i-1][j]:
      if e+inls[i][j]<x:
        dp[i][j].add(e+inls[i][j])
      dp[i][j].add(abs(e-inls[i][j]))
    for e in dp[i][j-1]:
      if e+inls[i][j]<x:
        dp[i][j].add(e+inls[i][j])
      dp[i][j].add(abs(e-inls[i][j]))
  if time.time() - start>1.7:
    dp[H-1][W-1].add(0)
    break
print(min(dp[H-1][W-1]))


Measured memory_bytes: 622316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long double a, b, c;
  cin >> a >> b >> c;
  
  long double eps = 1.0E-15;
  
  if ( sqrt(a) + sqrt(b) + eps < sqrt(c)) {
    cout << "Yes" << endl; 
  }
  else {
    cout << "No" << endl; 
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
#define all(i) i.begin(),i.end()
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N;
  cin>>N;
  if(400<=N&&N<=599) cout<<8<<endl;
  else if(600<=N&&N<=799) cout<<7<<endl;
  else if(800<=N&&N<=999) cout<<6<<endl;
  else if(1000<=N&&N<=1199) cout<<5<<endl;
  else if(N<=1399) cout<<4<<endl;
  else if(N<=1599) cout<<3<<endl;
  else if(N<=1799) cout<<2<<endl;
  else cout<<1<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    //cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int data_num; cin >> data_num;
    int ans[data_num];
    REP(rep,data_num){
        string T,S;
        cin >> T; cin >> S;
        vector<vector<int> > dp(T.size()+1, vector<int>(S.size()+1, 0));
        REP(i,T.size()){
            REP(j,S.size()){
                if(T[i] == S[j]) {dp[i+1][j+1] = dp[i][j] + 1;}
                else {dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);}
            }
        }
        ans[rep] = dp[T.size()][S.size()];
    }

    REP(i,data_num){
        cout << ans[i] << endl;
    }
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	int N;
	cin>>N;
	vint H(N);rep(i,N)cin>>H[i];
	H[0]--;
	for(int i=1;i<N;i++){
		if(H[i-1]>H[i]){
			cout<<"No"<<endl;
			return 0;
		}
		if(H[i-1]<H[i])H[i]--;
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author rn-sshawish
 */
public class Main {
    
    static int n;
    static int m;
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
         n = 2;
         m = input.nextInt();
        Pair [][] pairses = new Pair[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                pairses[i][j] = new  Pair(i, j, input.nextInt(), 0);
            }
        }
        bfs(pairses[0][0], pairses);
        System.out.println(pairses[1][m-1].sum + pairses[1][m-1].value);
    }
    
    public static void bfs (Pair pair, Pair [][] pairses){
        Queue<Pair> pairs = new LinkedList<>();
         pairs.add(pair);
         
         while (!pairs.isEmpty()) {
             
             Pair p = pairs.poll();

             if (check(p.x + 1, p.y) && (p.value + p.sum > pairses[p.x + 1][p.y].sum || p.value + p.sum ==  pairses[p.x + 1][p.y].sum && !pairses[p.x + 1][p.y].add) ) {
                 pairses[p.x + 1][p.y].sum = p.value + p.sum;
                 pairs.add(pairses[p.x + 1][p.y]);
                 pairses[p.x + 1][p.y].add = true;
                 
             }
              
              if (check(p.x, p.y + 1) &&(p.value + p.sum > pairses[p.x][p.y+1].sum || p.value + p.sum ==  pairses[p.x ][p.y +1].sum && !pairses[p.x ][p.y+1 ].add)) {
                 pairses[p.x][p.y+1].sum = p.value + p.sum ;
                 pairs.add(pairses[p.x][p.y + 1]);
                 pairses[p.x][p.y + 1].add = true;
             }
        }
    
       
    }
    
    
    public static boolean check (int x, int y){
        
        return x > -1 && x < n && y > -1 && y < m;  
    }
}


class Pair{
    int x;
    int y;
    int value;
    int sum;
    
    boolean add;

    public Pair(int x, int y, int value, int sum) {
        this.x = x;
        this.y = y;
        this.value = value;
        this.sum = sum;
    }

}



Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, begin, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if (B / A > C)
    {
        cout << C << endl;
    }
    else
    {
        cout << B / A << endl;
    }
}

Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <map>
#include <stdio.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = (a); i < (int)(b); i++)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vint;
typedef vector<string> vstr;
typedef pair<ll, ll> pint;
unsigned long long inf = (1LL << 62);
ll MOD = (ll)pow(10.0, 9.0) + 7;
pint dx[4] = { {0, 1}, {0, -1}, {1, 0}, {-1, 0} };
char da[4] = { 'R', 'L', 'D', 'U' };
char dad[4] = { 'L', 'R', 'U', 'D' };
ll min(ll a, ll b)
{

	return (a < b) ? a : b;
}
ll max(ll a, ll b) { return (a > b) ? a : b; }

ll N;






int main() {
	ll R, G, B, N;

	cin >> R >> G >> B >> N;

	ll cnt = 0;
	for (int i = 0; i <= (N / R); i++) {
		for (int j = 0; j <= (N / G); j++) {

			if (N - R * i - G * j >= 0 && (N - R * i - G * j) % B == 0)
				cnt += 1;
		}
	}



	cout << cnt << endl;
	return 0;

}

Measured memory_bytes: 256
n = int(input())

def solve(num):
    cnt = 0
    for i in range(1,num+1):
        if num % i == 0:
            cnt += 1
    return cnt

ans = 0
for i in range(1,n+1):
    if i % 2 == 0:
        continue
    if solve(i) == 8:
        ans += 1

print(ans)



Measured memory_bytes: 9076
n=int(input())
a=[int(i) for i in input().split()]
poss=1
a[0]-=1
for i in range(1,n):
    if(a[i]<a[i-1]):
        poss=0
        break
    if(a[i]-1>=a[i-1]):
        a[i]-=1
if(poss):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 14252
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n; cin >> n;
	vi v(n); rep(i, n) cin >> v[i];
	vi u = v;
	sort(all(u));
	rep(i, n) v[i] = lower_bound(all(u), v[i]) - u.begin();
	int cnt = 0;
	for(int i = 0; i < n; i += 2) cnt += v[i] % 2 != i % 2;
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 1024
def gcd(a,b):
    while b:
        a,b = b ,a % b

    return a

N,X = map(int,input().split())
cities = [int(x) - X for x in input().split()]

#print(cities)

if N == 1:
    print(abs(cities[0]))
else:
    ans = gcd(cities[0],cities[1])

    for i in range(1,len(cities) - 1):
        ans = gcd(ans, cities[i+1])
        #print(ans)

    print(abs(ans))

Measured memory_bytes: 14224
import java.io.*;
import java.util.*;

class Main {
    private static int[] heights;
    private static int n, ans = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        heights = new int[n + 3];
        dp = new int[n + 3];
        for (int i = 1; i <= n; i++) {
            heights[i] = sc.nextInt();
        }
        Arrays.fill(dp, -1);
        System.out.println(findJumpCost(1));
        sc.close();
    }

    private static int[] dp;

    private static int findJumpCost(int ind) {
        if (ind == n)
            return 0;

        if (dp[ind] != -1) {
            return dp[ind];
        }
        int min = Integer.MAX_VALUE;
        for (int i = ind + 1; i <= Math.min(n, ind + 2); i++) {
            min = Math.min(min, Math.abs(heights[i] - heights[ind]) + findJumpCost(i));
            // System.out.println(min);
        }
        return dp[ind] = min;
    }
}

Measured memory_bytes: 71328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    for (int i = 1; i <= 3500; i++) {
        for (int j = 1; j <= i; j++) {
            int64_t a = 4 * i * j - n * (i + j);
            if (a <= 0) continue;
            int64_t b = n * i * j;
            int64_t k = b / a;
            int64_t r = b % a;
            if (r == 0) {
                cout << i << ' ' << j << ' ' << k << endl;
                return 0;
            }
        }
    }
}

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



int main() {
  int n,m;
  cin >> n;
  vector<int> t(n);
  REP(i,n){
    cin >> t[i];
  }
 
  cin >> m;
  vector<int> p(m);
  vector<int> x(m);
  REP(i,m){
    cin >> p[i] >> x[i];
    p[i] -= 1;
  }
  
  
  vector<int> tt(n);
  REP(i,n){
    tt[i] = t[i];
  }
  REP(i,m){
    t[(p[i])] = x[i];
    int ans = 0;
      REP(j,n){
        ans += t[j];
      }
    cout << ans << endl;
    t[p[i]] = tt[p[i]];
  }
  
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(void){
	int i,j,n,m,x,y,xr,yl,w = 1;
	int a[100],b[100];
	
	scanf("%d %d %d %d", &n, &m, &x, &y);
	for(i = 0; i < n; i++)
		scanf("%d", &a[i]);
	for(i = 0; i < m; i++)
		scanf("%d", &b[i]);
	
	xr = a[0];
	yl = b[0];
	for(i = 0; i < n; i++){
		if(xr < a[i])
			xr = a[i];
	}
	for(i = 0; i < m; i++){
		if(yl > b[i])
			yl = b[i];
	}
	
	for(i = x+1; i <= y; i++){
		for(j = xr+1; j <= yl; j++){
			if(i == j){
				w = 0;
			}
		}
	}
	
	if(w == 1)
		printf("War\n");
	else
		printf("No War\n");
		
	return 0;
}

Measured memory_bytes: 128
card_dict = {}

card_dict['a'] = input()
card_dict['b'] = input()
card_dict['c'] = input()

turn = 'a'

while True:
    if not card_dict[turn]:
        print(turn.upper())
        break
    next_turn = card_dict[turn][0]
    card_dict[turn] = card_dict[turn][1:]
    turn = next_turn

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

int main() {
  int N;
  cin >> N;

  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    A.at(i)--;
  }

  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (A.at(i) == i) {
      if(i != N - 1) swap(A.at(i), A.at(i + 1));
      cnt++;
    }
  }

  cout << cnt << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

struct point { int x, y; };

int main()
{
	point p[4];

	cin >> p[0].x >> p[0].y >> p[1].x >> p[1].y;

	p[2].x = p[1].x + (p[0].y - p[1].y);
	p[2].y = p[1].y + (p[1].x - p[0].x);

	p[3].x = p[2].x + (p[0].x - p[1].x);
	p[3].y = p[2].y + (p[0].y - p[1].y);

	printf("%d %d %d %d\n", p[2].x, p[2].y, p[3].x, p[3].y);

	return 0;
}


Measured memory_bytes: 384
from collections import Counter

N = int(input())
A = list(map(int,input().split()))

counter = Counter(A)
combinations = {k: int(v * (v - 1) / 2) for k, v in counter.items()}
# print(combinations)
total = sum(combinations.values())
# print(total)
for a in A:
  print(total - (counter[a] - 1))


Measured memory_bytes: 32156
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REPS(i,n) for(int i=1;i<=(int)(n);i++)
using namespace std;
using ll = long long;
using ld = long double;

int main(void) {
    ll W, H, x, y;
    cin >> W >> H >> x >> y;

    cout << fixed << setprecision(10) << (ld) W*H/2 << " ";
    if (x == (ld)W/2 && y == (ld)H/2) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc157/tasks/abc157_d

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#if DEBUG
  #define DUMP(a) REP(_i, a.size()) cout << a[_i] << (_i + 1 == a.size() ? "\n" : " ")
  #define DUMP2D(b) REP(_j, b.size()) DUMP(b[_j]); cout << endl
#else
  #define DUMP(a)
  #define DUMP2D(b)
#endif

//------------------------------------------------------------------------------
class UnionFindTree {
public:
  int n;
  vector<int> par;
  vector<int> rnk;
  vector<int> siz;

  void init(int _n) {
    n = _n;
    par = vector<int>(n);
    rnk = vector<int>(n, 0);
    siz = vector<int>(n, 1);
    REP(i, n) par[i] = i;
  }

  int find(int x) {
    if (par[x] == x) {
      return x;
    } else {
      return par[x] = find(par[x]);
    }
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rnk[x] < rnk[y]) {
      par[x] = y;
      siz[y] += siz[x];
    } else {
      par[y] = x;
      siz[x] += siz[y];
      if (rnk[x] == rnk[y]) rnk[x]++;
    }
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  int size(int x) {
    return siz[find(x)];
  }
};

//------------------------------------------------------------------------------
const int N_MAX = 1e5;
const int M_MAX = 1e5;
const int K_MAX = 1e5;

int N, M, K;
vector<int> A;
vector<int> B;
vector<int> C;
vector<int> D;

UnionFindTree uf;
vector<int> ec;

int main() {
  cin >> N >> M >> K;
  A = vector<int>(M);
  B = vector<int>(M);
  REP(i, M) cin >> A[i] >> B[i];
  C = vector<int>(K);
  D = vector<int>(K);
  REP(i, K) cin >> C[i] >> D[i];

  uf.init(N);
  ec = vector<int>(N, 1);

  REP(i, M) {
    int a = A[i] - 1;
    int b = B[i] - 1;
    ec[a]++;
    ec[b]++;
    uf.unite(a, b);
  }

  REP(i, K) {
    int c = C[i] - 1;
    int d = D[i] - 1;
    if (uf.same(c, d)) {
      ec[c]++;
      ec[d]++;
    }
  }

  REP(i, N) {
    cout << (uf.size(i) - ec[i]);
    if (i == N - 1) cout << endl;
    else cout << " ";
  }
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define ll long long
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 1000000007
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
//#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   

const int N = 1e7+5;
ll divn[N];

void init() {
    for(ll i = 1; i<=N; ++i) {
        for(ll j = 1; j*i<=N; j++) {
            divn[i*j]++;
        }
    }
}

int32_t main() 
{ 
    init();
    fastio
    ll n;
    cin>>n;

    ll ans = 0;
    for(ll i = 1; i<=n; ++i) {
        ll num = divn[i];
        ans += num *i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 81776
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const ll MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);

const int MAX=200010;


int main() {
    ios_base::sync_with_stdio(false); 

    int h,w,d;
    cin >> h >> w >> d;
    map<int,P> mp;
    vector<vector<ll>> p(d,vector<ll>((h*w)/d+10));
    rep(i,h) {
        rep(j,w) {
            int a;
            cin >> a;
            mp[a-1]={i,j};
        }
    }
    repr(i,d,h*w) {
        p[i%d][i/d]=abs(mp[i].first-mp[i-d].first)+abs(mp[i].second-mp[i-d].second);
    }
    rep(i,d) {
        rep(j,(h*w)/d+10-1) {
            p[i][j+1]+=p[i][j];
        }
    }
    int q;
    cin >> q;
    rep(i,q) {
        int l,r;
        cin >> l >> r;
        --l; --r;
        cout << p[r%d][r/d]-p[l%d][l/d] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 19288
#include <stdio.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)
#define INF (long long int)(9223372036854775807)
#define IINF (int)(2147483647)

int main(void) {
  int a,b,c,d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  puts((c + b - 1) / b <= (a + d - 1) / d ? "Yes" : "No");
}

Measured memory_bytes: 1644
k, x = input().split(' ')
k, x = int(k), int(x)   
arr = []
         
for i in range(k): 
  arr.append(x-i)
  arr.append(x+i)
arr = list(set(arr))
arr.sort()
text = ""
for i in range(len(arr) - 1):
  text += str(arr[i]) + " "
print(text + str(arr[len(arr) - 1]))

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

int main( void ) {
	int i, j;
	int n;

	while ( scanf( "%d", &n ), n ) {
		int matrix[ 11 ][ 11 ], sumR[ 11 ], sumC[ 11 ];

		memset( sumR, 0, sizeof sumR );
		memset( sumC, 0, sizeof sumC );

		for ( i = 0; i < n; i++ )
			for ( j = 0; j < n; j++ ) {
				scanf( "%d", matrix[ i ] + j );
				sumR[ i ] += matrix[ i ][ j ];
				sumC[ j ] += matrix[ i ][ j ];
			}
		for ( i = 0; i < n + 1; i++ )
			sumC[ n ] += sumR[ i ];

		for ( i = 0; i < n; i++ ) {
			for ( j = 0; j < n; j++ )
				printf( "%5d", matrix[ i ][ j ] );
			printf( "%5d\n", sumR[ i ] );
		}
		for ( j = 0; j < n + 1; j++ )
			printf( "%5d", sumC[ j ] );
		putchar( '\n' );
	}

	return 0;
}

Measured memory_bytes: 612
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/3 22:02:32
File Name     :main.cpp
************************************************ */
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include<random>
#include<ctime>
#include<stack>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 1e9
#define bug puts("--------------")
const ll N = 2e5 + 10;
const ll mod = 1e9;
const ll Max_n = 1e6 + 10;
using namespace std;
vector<ll> q,p;
bool ok(ll x,ll n,ll k){
    ll ans = 0;
    sort(q.begin(),q.end(),greater<ll>());
    sort(p.begin(),p.end());
    int s1 = q.size(),s2 = p.size();
    for(int i = 0;i < s1;++i){
        int l = i,r = s1-1;
        while(l < r){
            int mid = l + r +1 >>1;
            if(q[i]*q[mid] <= x) l = mid;
            else r = mid - 1;
        }
        if(l > i) ans += l -i ;
    }
    for(int i = 0;i < s2;++i){
        int l = i,r = s2 - 1;
        while(l < r){
            int mid = l + r + 1 >> 1;
            if(p[i]*p[mid] <= x) l = mid;
            else r = mid - 1;
        }
        if(l > i) ans += l - i ;
    }
    if(ans >= k) return 1;
    reverse(q.begin(),q.end());
    reverse(p.begin(),p.end());
    for(int i = 0;i < s1;++i){
        int l = -1,r = s2-1;
        while(l < r){
            int mid = l + r + 1>>1;
            if(q[i] * p[mid] <=  x) l = mid;
            else r = mid - 1;
        }
        if(l != -1) ans += l + 1;
    }
    return ans >= k;

    
}
int main(){
    ll n,k;
    scanf("%lld%lld",&n,&k);
    for(int i = 1;i <= n;++i){
        ll a;
        scanf("%lld",&a);
        if(a<0) q.push_back(a);
        else  p.push_back(a);
    }
    ll l = - mod * mod ,r = mod *mod;
    while(l < r){
        ll mid = l + r >>1;
        if(ok(mid,n,k)) r = mid;
        else l = mid + 1;
    }
    cout << r;
}

Measured memory_bytes: 2548
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

char FULL;
vector<int> G[9];

int dfs(int node, char visited)
{
	int cnt = 0;

	visited |= (1 << (node - 1));
	if (visited == FULL) cnt++;

	rep(i, (int)G[node].size()) {
		int next = G[node][i];

		if ((visited & (1 << (next - 1))) == 0) {
			cnt += dfs(next, visited);
		}
	}

	return cnt;
}

int main()
{
	int N, M, a, b;

	cin >> N >> M;
	rep(i, M) {
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	FULL = (char)((int)(1 << N) - 1);
	cout << dfs(1, 0) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> ivv;
typedef vector<string> sv;

int main()
{
	int n,ans = 1,_max = 0;
	
	cin >> n;
	
	REP(i,n+1)
	{
		int tmp = i,sum = 0;
		while(tmp > 0 && tmp % 2 != 1)
		{
			sum++;
			tmp /= 2;
		}
		
		if(_max < sum)
		{
			_max = sum;
			ans = i;
		}
		
	}
	
	cout << ans << endl;
		
	
	return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <string>
using namespace std;
int main()
{
	int k;
	k=0;
	string s;
	string t;
	cin>>s;
	cin>>t;
	for(int i=0; i<s.size(); i++)
	{
		if(s[i]!=t[i])
		{
			k=k+1;
		}
	}
	cout<<k;
}

Measured memory_bytes: 3848
let print_array l =
  Array.iter (fun x -> Printf.printf " %d" x) l;print_newline ();;

let rec max_heapify h a j =
  let l = j*2 and
      r = j*2+1 and
      largest = ref j
  in
  if l <= h then
    begin
      if a.(l-1) > a.(j-1) then largest := l;
      if r <= h && a.(r-1) > a.(!largest-1) then largest := r;
      if !largest != j then
        begin
          let temp = a.(!largest-1) in
          a.(!largest-1) <- a.(j-1);
          a.(j-1) <- temp;
          max_heapify h a !largest
        end
    end
;;

let () =
  let h = read_int () and
      a = read_line () |> Str.split (Str.regexp " ")
          |> List.map int_of_string |> Array.of_list
  in
  for i = 1 to h/2 do
    let j = h/2 - i+1 in
    max_heapify h a j;
  done;
  print_array a;;

Measured memory_bytes: 61764
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int a, b;
  cin >> a >> b;
  bool ok = false;
  if(a%3 == 0) ok = true;
  if(b%3 == 0) ok = true;
  if((a+b) %3 == 0) ok = true;

  if(ok) cout << "Possible" << endl;
  else cout << "Impossible" << endl;
  return 0;
}


Measured memory_bytes: 3604
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int m = sc.nextInt();
		for(int z=0;z<m;z++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int n = sc.nextInt();
			int max = 0;
			for(int i=0;i<n;i++){
				int t = sc.nextInt();
				double r = sc.nextDouble();
				int c = sc.nextInt();
				int temp;
				int sum;
				if(t==1){
					temp = a;
					for(int j=0;j<b;j++){
						temp = (int)(temp*(1+r))-c;
					}
				}else{
					temp = a;
					sum = 0;
					for(int j=0;j<b;j++){
						sum += temp*r;
						temp -= c;
					}
					temp += sum;
				}
				max = Math.max(max, temp);
			}
			System.out.println(max);
		}
	}	
}

Measured memory_bytes: 42068
n, m = map(int, input().split())

s = [tuple(map(int, input().split())) for _ in range(n)]
c = [tuple(map(int, input().split())) for _ in range(m)]

for a, b in s:
    d = float('inf')
    for i in range(m):
        x, y = c[i]
        if abs(a - x) + abs(b - y) < d:
            d = abs(a - x) + abs(b - y)
            ans = i + 1
    print(ans)

Measured memory_bytes: 9136
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
	int N,D;
	string X;
	cin>>N>>X>>D;
	vector<bool>v(N);
	for(int i=0;i<N&&D;i++){
		if(X[i]=='0'){
			v[i]=true;
			X[i]='1';
			D--;
		}
	}
	for(int i=N-1;i>=0&&D;i--){
		if(!v[i]){
			X[i]='0';
			D--;
		}
	}
	cout<<X<<endl;
}

Measured memory_bytes: 3212
n = gets.to_i
a = gets.split.map(&:to_i)

full_length = a.inject(:+)
half_length = full_length / 2

left = 0
half_index = 0
a.each_with_index do |length, i|
  left += length
  if left >= half_length
    half_index = i
    break
  end
end

right = full_length - left

answers = []
answers << (right - left).abs
answers << (right + a[half_index] - (left - a[half_index])).abs

puts answers.min


Measured memory_bytes: 16132
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<ctime>
#include<iostream>
#include<stack>
typedef long long LL;
using namespace std;
const int Maxn = 1e6;
const int Inf = 1e9 + 7;
int a[4] , vis[4];
int main()
{
	while( ~scanf(" %d %d %d",&a[1] , &a[2] , &a[3]) ){
		int Min = Inf;
		int sum = 0;
		memset( vis , 0 , sizeof(vis) );
		for( int i = 1 ; i <= 3 ; i++ ){
			vis[i] = 1;
			sum = 0;
			for( int j = 1 ; j <= 3 ; j++ ){
				if( vis[j] == 0 ){
					sum += abs(a[i] - a[j]);
					vis[j] = 1;
					for( int k = 1 ; k <= 3 ; k++ ){
						if( vis[k] == 0 ){
							sum += abs( a[k] - a[j] );
							Min = min( Min , sum );
							sum -= abs( a[k] - a[j] );
						}
					}
					sum -= abs(a[i] - a[j]);
					vis[j] = 0;
				}
			}
			vis[i] = 0;
		}
		cout << Min << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define fr first
#define sc second
#define r_0 return 0
#define ld long double
#define TIME ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

    const ll N = 1e3 + 7;
    const ll mod = 1e9 + 7;
    const ll inf = 1e9;

int n , k;
int x , l;
int used[N];
vector < int > res[N];

void solve(){
    cin >> n >> k;
    for(int i = 1; i <= k; ++ i){
        cin >> x;
        for(int j = 1; j <= x; ++ j){
            cin >> l;
            used[l] ++;
        }
    }
    int ans = 0;
    for(int i = 1; i<= n; ++ i)
        ans += !used[i];
    cout << ans;

}

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

/**



**/


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

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

//C++14 (GCC 5.4.1)
int main() {
    int N,M;
    cin >>N>>M;
    bool is=false;

    if(M<=0){
        M=1;
        is=true;
    }

    vector<int> A(M);
    if(is){
        A[0]=-1;
    }else{
        rep(i,M) cin >> A.at(i);
    }
    A.push_back(INT_MAX);

    
    //-----------------------------------
    int acnt=0;
    vector<ll> HOW(N+1);
    HOW.at(0)=1;
    if(A.at(acnt)==1){
        HOW.at(1)=0;
        acnt++;
    }else{
        HOW.at(1)=1;
    }
    repd(i,2,N+1){//2toN
        if(A.at(acnt)==i){
            HOW.at(i)=0;
            while(acnt<M&&A.at(acnt)<=i)acnt++;
            if(acnt>=M)acnt=0;
        }else{
            HOW.at(i)=(HOW.at(i-1)+HOW.at(i-2))%mod;
        }
    }


    cout << HOW[N] <<endl;
    return (0);
}

Measured memory_bytes: 1400
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	if (a + b < c + d){
		printf("Right\n");
	}
	else if (a + b > c + d){
		printf("Left\n");
	}
	else{
		printf("Balanced\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include <cstdio>
using namespace std;
int N; char S[105];
int main() {
  scanf("%d\n%s\n", &N, S+1);
  int left = 0, right = 0;
  for(int i = 1; i <= N; ++i) {
    if(S[i] == '(') ++right;
    else if(right > 0) --right;
    else ++left;
  }
  for(int i = 0; i < left; ++i) printf("%c", '(');
  printf("%s", S+1);
  for(int i = 0; i < right; ++i) printf("%c", ')');
  printf("\n");
}

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

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

const string YES = "YES";
const string NO = "NO";

void solve(std::vector<long long> N){
    set<ll> st(ALL(N));
    if(st.count(1)&&st.count(9)&&st.count(7)&&st.count(4))
        cout << YES << endl;
    else
        cout << NO << endl;
}

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


Measured memory_bytes: 256
N,L = map(int,input().split())

if L >= 1:
    print((N-1)*(2*L+N)//2)
elif L < 1 and N > -L:
    print(N*(2*L+N-1)//2)
else:
    print(N*(2*L+N-1)//2-N-L+1)

Measured memory_bytes: 2940
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in1(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in1(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
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; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int N, M;
    in2(N, M);

    int X, Y;
    in2(X, Y);

    vi x(N);
    inN(x, N);

    vi y(M);
    inN(y, M);

    sort(all(x));
    sort(all(y));

    repse(z, X + 1, Y)
    {
        if (x.back() < z && y.front() >= z)
        {
            outl("No War");
            return 0;
        }
    }
    
    outl("War");

    return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll n, m;
ll fact[100100];

ll solve() {
    if (abs(n - m) > 1) return 0;
    fact[0] = 1;
    for (ll i = 1; i <= 100000; i++) fact[i] = (fact[i-1] * i) % mod;

    if (n == m) return (fact[n] * fact[m] * 2) % mod;
    return fact[n] * fact[m] % mod;
}

void input() {
    cin >> n >> m;
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 1024
def f(n, f1, f2, f3):
    ret = 0

    def dfs(n, f1, f2, f3):
        if N < n:
            return 0

        nonlocal ret
        ret += 1 if f1 and f2 and f3 else 0

        dfs(n * 10 + 7, True, f2, f3)
        dfs(n * 10 + 5, f1, True, f3)
        dfs(n * 10 + 3, f1, f2, True)

        return ret

    return dfs(n, f1, f2, f3)


N = int(input())

print(f(0, False, False, False))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define vint vector<signed>
#define pint pair<signed,signed>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define isEven(t) t%2==0
signed main(){
  int n;
  cin>>n;
  int ans=n;
  for(int i=0;i<=n;++i){
    int res=0,tmp=i;
    while(tmp>0)res+=tmp%9,tmp/=9;
    tmp=n-i;
    while(tmp>0)res+=tmp%6,tmp/=6;
    ans=min(res,ans);
  }
  cout<<ans;
  
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
const int N=255555;
typedef long long LL;
struct data{
	LL len,a[26];
	inline void operator+=(const data&rhs){
		len+=rhs.len;
		for(int i=0;i<26;++i)a[i]+=rhs.a[i];
	}
	inline data operator-(const data&rhs)const{
		data c;
		c.len=0;
		for(int i=0;i<26;++i)c.a[i]=a[i]-rhs.a[i];
		return c;
	}
}d[500],ans;
char s[N];
int fail[N],n;
LL L,R;
void getfail(){
    for(int i=2,j=0;i<=n;++i){
        while(j&&s[j+1]!=s[i])j=fail[j];
        if(s[j+1]==s[i])++j;
        fail[i]=j;
    }
}
data solve(LL R){
	data ret;
	for(int i=ret.len=0;i<26;++i)ret.a[i]=0;
	if(n%(n-fail[n])==0){
		LL k=R/n;
		for(int i=1;i<=n;++i)ret.a[s[i]-'a']+=k;
		for(int i=1;i<=R%n;++i)++ret.a[s[i]-'a'];
	}else{
		memset(d,0,sizeof d);
		int tot=2;
		d[2].len=n;
		for(int i=1;i<=n;++i)++d[2].a[s[i]-'a'];
		d[1].len=n-fail[n];
		for(int i=1;i<=n-fail[n];++i)++d[1].a[s[i]-'a'];
		while(d[tot].len<=R){
			++tot;
			d[tot]=d[tot-1],d[tot]+=d[tot-2];
		}
		for(int i=tot;i;--i)
		if(R>=d[i].len)R-=d[i].len,ret+=d[i];
		for(int i=1;i<=R;++i)++ret.a[s[i]-'a'];
	}
	return ret;
}
int main(){
	scanf("%s%lld%lld",s+1,&L,&R);
	n=strlen(s+1)>>1;
	getfail();
	ans=solve(R);
	ans=ans-solve(L-1);
	for(int i=0;i<26;++i)
	printf("%lld ",ans.a[i]);
	return 0;
}

Measured memory_bytes: 896
// I am Varun Das from Jadavpur University
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define dbg(x) cerr << #x << " = " << x << endl
#define INF LLONG_MAX
#define loop(i,a,b) for(int i=a;i<b;++i)
#define rep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout<<fixed<<setprecision(10);
long double dp[10000];
int n;
cin>>n;
dp[0]=1;
loop(i,0,n){
    long double p;
    cin>>p;
    rep(j,i+1,0){
        dp[j] = (j==0 ? 0 : dp[j-1]*p) + dp[j]*(1-p);
    }
}
long double ans=0;
loop(i,(n+1)/2,n+1){
    ans+=dp[i];
}
cout<<ans;
	return 0;
}

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

int main() {
   int n;
   std::cin >> n;
   std::vector<int> a(n);
   for (size_t i = 0; i < n; i++) {
      std::cin >> a.at(i);
   }
   int max = a.at(0);
   int min = a.at(0);
   for (size_t i = 1; i < n; i++) {
      if (a.at(i) > max) {
         max = a.at(i);
      }else if (a.at(i) < min) {
         min = a.at(i);
      }
   }
   std::cout << max - min << '\n';
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll ChebyshevDistance(ll x1, ll y1, ll x2, ll y2) {
    ll result1, result2;
    result1 = x1-y1 - (x2-y2);
    result2 = x1+y1 - (x2+y2);
    if (result1 > result2) {
        return result1;
    } else {
        return result2;
    }
}
int main() {
    int n;
    cin >> n;
    ll x[n], y[n];
    for (int i=0; i<n; i++) {
        cin >> x[i] >> y[i];
    }
    ll result, maxf = -10000000000, minf = 10000000000;
    for (int i=0; i<n; i++) {
        if (x[i]-y[i] > maxf) maxf = x[i]-y[i];
        if (x[i]-y[i] < minf) minf = x[i]-y[i];
    }
    result = maxf - minf;
    ll tmp;
    maxf = -10000000000;
    minf = 10000000000;
    for (int i=0; i<n; i++) {
        if (x[i]+y[i] > maxf) maxf = x[i]+y[i];
        if (x[i]+y[i] < minf) minf = x[i]+y[i];
    }
    tmp = maxf - minf;
    if (tmp > result) result = tmp;
    cout << result << endl;
}

Measured memory_bytes: 6752
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

void cal_score(vector<int> &c, vector<vector<int>> &s, int &score, vector<int8_t> v, vector<int8_t> &mai) {
	int n = v.size() - 1;
	score += s[n][v.back()];
	REP(i, 26)mai[i]++;
	mai[v.back()] = 0;
	REP(i, 26)score -= c[i] * mai[i];
}

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

	ll d;cin >> d;
	vector<int> c(26);REP(i, 26)cin >> c[i];
	vector<vector<int>> s(d, vector<int>(26));
	REP(i, d)REP(j, 26)cin >> s[i][j];

	vector<pair<int, pair<vector<int8_t>, vector<int8_t>>>> lis;
	REP(i, 26){
		vector<int8_t> v(1, i);
		vector<int8_t> mai(26, 0);
		int score = 0;
		cal_score(c, s, score, v, mai);
		lis.EB(score, MP(v, mai));
	}

	REP(i, d-1){
		sort(ALL(lis), greater<pair<int, pair<vector<int8_t>, vector<int8_t>>>>());
		lis.resize(min((int)lis.size(), 300));
		vector<pair<int, pair<vector<int8_t>, vector<int8_t>>>> now;

		for(auto seica: lis){
			REP(i, 26){
				vector<int8_t> v = seica.SE.FI;v.PB(i);
				vector<int8_t> mai = seica.SE.SE;
				int score = seica.FI;
				cal_score(c, s, score, v, mai);
				now.EB(score, MP(v, mai));
			}
		}

		lis = now;
	}

	sort(ALL(lis), greater<pair<int, pair<vector<int8_t>, vector<int8_t>>>>());
	REP(i, d){
		cout << (lis[0].SE.FI[i]+1) << endl;
	}


	return 0;
}


Measured memory_bytes: 11480
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {

    input!{
        N:usize,
        _T:usize,
        A:[isize;N]
    }

    let mut R = vec![A[N-1];N];
    let mut C = HashMap::new();
    for i in (0..N-1).rev(){
        R[i] = max(R[i+1],A[i]);
        let c = R[i]-A[i];
        let d = C.entry(c).or_insert(0);
        *d += 1;
    }
    let k = C.keys().max().unwrap();
    println!("{}",C[k]);

}


Measured memory_bytes: 7980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  cin >> str;
  for(int i=0 ; i<3 ; i++){
    if(str[i]=='1')
      str[i]='9';
    else
      str[i]='1';
  }
  cout << str << endl;
}

Measured memory_bytes: 256
import fractions
def LCM(a, b):
    return(a // fractions.gcd(a, b) * b)

n = int(input())
a = list(map(int, input().split()))
lc = 1;

for i in range(n):
    lc = LCM(lc, a[i])

res = 0;
for i in range(n):
    res = res + (lc // a[i])

print(res % 1000000007)



Measured memory_bytes: 6112
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=1000000007;

signed main(){
	stin(s);
	ll a=0;
	ll b=0;
	FOR(i,0,s.sz-1){
		if(s[i]=='1'){
			a++;
		}else{
			b++;
		}
	}
	sal(2*min(a,b));
}


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

int k;
int s;



int main(){
  cin >> k;
cin >> s;

int count = 0;
  for(int i=0; i<=k; i++){
    for(int j=0; j<=k; j++){
      if( 0<=((s - i) - j) && ((s - i) - j) <= k ) count++;
    }
   }
   cout << count << endl;
   return 0;
}


Measured memory_bytes: 256