akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;
typedef long long ll;

void call(int n) {
    int i = 1;
    for (; i <= n; i++) {
        int x = i;
        if (x % 3 == 0) cout << ' ' << i;
        else {
            while (x) {
                if (x % 10 == 3) {
                    cout << ' ' << i;
                    break;
                }
                x /= 10;
            }
        }
    }
    cout << endl;
}

int main() {
    int n; cin >> n;
    call(n);
}


Measured memory_bytes: 3092
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
#define mp make_pair

void print(auto &a)
{
    for (auto s: a) cout<<s<<' ';
    cout<<endl;
}

void get(vector<auto> &a)
{
    for (int i = 0; i<a.size(); i++) cin>>a[i];
}

const int p =  1e9 + 7;


int mul(int a, int b) {
    return (1LL * a%p * b%p) % p;
}

int add(int a, int b) {
    ll s = (a+b);
    s = s%p;
    if (s<0) s+=p; 
    return s;
}

int po(int a, int deg)
{
    if (deg==0) return 1;
    if (deg%2==1) return mul(a, po(a, deg-1));
    int t = po(a, deg/2);
    return mul(t, t);
}

int inv(int n)
{
    return po(n, p-2);
}



vector<int> Z(string s)
{
int n = s.length();
vector<int> z(n);
int L = 0, R = 0;
for (int i = 1; i < n; i++) {
  if (i > R) {
    L = R = i;
    while (R < n && s[R-L] == s[R]) R++;
    z[i] = R-L; R--;
  } else {
    int k = i-L;
    if (z[k] < R-i+1) z[i] = z[k];
    else {
      L = i;
      while (R < n && s[R-L] == s[R]) R++;
      z[i] = R-L; R--;
    }
  }
}
return z;
}





int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int> a(26);
    for (int i = 0; i<s.length(); i++) a[s[i]-'a']++;
    ll answer = 1;
    for (int i = 0; i<26; i++) answer = mul(answer, a[i]+1);
    answer = add(answer, -1);
    cout<<answer;
}

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

using namespace std;

int x[99999], y[99999];
long r[99999];
int main()
{
	int h, w, d;
	cin >> h >> w >> d;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			int a;
			scanf("%d", &a);
			x[a] = i, y[a] = j;
		}
	}
	for (int i = d + 1; i <= h * w; i++)
		r[i] = r[i - d] + abs(x[i] - x[i - d]) + abs(y[i] - y[i - d]);
	int q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int l, R;
		scanf("%d%d", &l, &R);
		cout << r[R] - r[l] << '\n';
	}
	cout << flush;
	return 0;
}


Measured memory_bytes: 2560
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
 
class Main{
    public static void main(String[] args) throws IOException{
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final String[] rt = br.readLine().split(" ");
        //final String[] bCard = br.readLine().split(" ");
        //final String[] sCard = new String[bCard.length];
        //System.arraycopy(bCard, 0, sCard, 0, sCard.length);
        
        int j = gcd(Integer.parseInt(rt[0]), Integer.parseInt(rt[1]));
        System.out.println(j);
    }

    public static int gcd(int x, int y) {
        if (x < y){
            int n = y;
            y = x;
            x = n;
        }
        while (y > 0){
            int r = x % y;
            x = y;
            y = r;
        }
        return x;
    }
};


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

//  cout << std::to_string(std::numeric_limits<uint64_t>::max()).size() << endl;
  int64_t x, y;
  cin >> x >> y;

  int cnt = 0;
  while (y / x > 0) {
    cnt++;
    x *= 2;
  }

  cout << cnt << endl;
  
  return 0;
}

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

int main() {
  int n, x, y;
  cin >> n >> x >> y;
  
  vector<int> len_num(n, 0);
  for ( int i = 1; i < n; i++ ) {
    for ( int j = i+1; j <= n; j++ ) {
      int len = min(j-i, min(abs(x-i)+abs(j-y)+1, abs(y-i)+abs(j-x)+1));
      len_num[len]++;
    }
  }

  for ( int i = 1; i < n; i++ ) {
    cout << len_num[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3576
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n;
	int tmp, count;
	char m[2000];
	char chars[9][5] = {
	    {'.', ',', '!', '?', ' '},
	    {'a', 'b', 'c'},
	    {'d', 'e', 'f'},
	    {'g', 'h', 'i'},
	    {'j', 'k', 'l'},
	    {'m', 'n', 'o'},
	    {'p', 'q', 'r', 's'},
	    {'t', 'u', 'v'},
	    {'w', 'x', 'y', 'z'}};
	int sizes[] = {5, 3, 3, 3, 3, 3, 4, 3, 4};
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", m);
		for (char *ptr = m; *ptr != '\0'; ptr++) {
			count = 0;
			tmp = (*ptr - '0');
			if (!tmp)
				continue;
			while (*++ptr != '0')
				count++;
			printf("%c", chars[tmp - 1][count % sizes[tmp - 1]]);
		}
		printf("\n");
	}
	return 0;
}



Measured memory_bytes: 1976
#include <stdio.h>
#include <math.h>
#define MAX 500001

int A[MAX];
int n;

void maxHeapify(int i){

	int temp,largest;
	int l = 2 * i;
	int r = 2 * i + 1;

	//????????????????????????????????§???????????§????????????????????¶
	if(l <= n && A[l] > A[i]) largest = l;
	else largest = i;

	if(r <= n && A[r] > A[largest]) largest = r ;

	if(largest != i){
		temp = A[i];
		A[i] = A[largest];
		A[largest] = temp;
		maxHeapify(largest);
	}
}

void buildMaxHeap(){
	int j;
	for( j = (int)n/2; j >= 1; j--) maxHeapify(j);
}

int main(){
	
	int i;

	scanf("%d",&n);

	for(i = 1; i <= n; i++) scanf("%d",&A[i]);
	buildMaxHeap();
	for(i = 1; i <= n; i++) printf(" %d",A[i]);
	printf("\n");

	return 0;
}

Measured memory_bytes: 2552
#include<stdio.h>
int main(){
  int H,W=1;
  int i,j;
  scanf("%d%d",&H,&W);
  while(H!=0||W!=0){
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
	if(j==0||j==W-1||i==0||i==H-1)printf("#");
        else printf(".");}
      printf("\n");}
    printf("\n");
   scanf("%d%d",&H,&W);}
  return 0;
}

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

void replaceAll (std::string& str, const std::string& from, const std::string& to) {
    std::string::size_type pos = 0;
    while(pos = str.find(from, pos), pos != std::string::npos) {
        str.replace(pos, from.length(), to);
        pos += to.length();
    }
}

int main(){
	string s;
	while (getline(cin, s)) {
		replaceAll(s, "apple", "<-- p -->");
		replaceAll(s, "peach", "apple");
		replaceAll(s, "<-- p -->", "peach");
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

ull A[300][300];
ull B[300][300];


ull solve() {
  int N;
  cin>>N;
  REP(i, N) REP(j,N) {
    ull a;
    cin>>a;
    A[i][j]=a;
    B[i][j]=1;
  }

  REP(i,N) {
    REP(j,N) {
      REP(k,N) {
        if (i==j || j==k || k==i ) continue;

        const ull direct = A[i][j];
        const ull ukai = A[i][k] + A[k][j];

        //DUMP(direct);
        //DUMP(ukai);

        // 迂回したほうが早い→最短経路ではない
        if(direct > ukai) return 0;

        // 迂回＝直接の場合、その道は存在しない
        if(direct == ukai) B[i][j]=B[j][i]=0;
      }
    }
  }

  ull ans=0;
  FOR(i,0,N) {
    FOR(j,i+1,N){
      DUMP(A[i][j]);
      DUMP(B[i][j]);
      ans += A[i][j]*B[i][j];
    }
  }
  return ans;
}

int main() {
  auto ans = solve();
  if(ans) cout << ans << endl;
  else cout << -1 << endl;

  return 0;
}


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

int main(){
    ll N,i;
    ll result=0;
    cin>>N;
    vector<ll> A(N);
    for(i=0;i<N;i++)cin>>A[i];
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    for(i=0;i<N;i++){
        if(i%2==0){
            result+=A[i];
        }else{
            result-=A[i];
        }
    }
    cout<<result<<endl;
}

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

int n;
struct P {double x, y;};
vector<P> p;

double dist(P a, P b) {
    double dx = a.x - b.x;
    double dy = a.y - b.y;
    return sqrt(dx*dx + dy*dy);
}

double f (double x, double y) {
    double res = 0;
    rep(i, n) {
        res = max(res, dist((P){x,y}, p[i]));
    }
    return res;
}

double g(double x) {
    double l = 0, r = 1000;
    rep(i, 80) {
        double c1 = (l*2+r)/3;
        double c2 = (l+r*2)/3;
        if (f(x, c1) > f(x, c2)) l = c1; else r = c2;
    }
    return f(x, l);
}

int main(){
    cin >> n;
    p = vector<P>(n);
    rep(i, n) cin >> p[i].x >> p[i].y;

    double l = 0, r = 1000;
    rep(i, 80) {
        double c1 = (l*2+r)/3;
        double c2 = (l+r*2)/3;
        if (g(c1) > g(c2)) l = c1; else r = c2;
    }

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


Measured memory_bytes: 256
using System;

namespace ITP1_8_Ccs
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] list = new int[26];
            string s = "abcdefghijklmnopqrstuvwxyz";
            while (true)
            {
                string str = Console.ReadLine();
                if (str == null)
                {
                    break;
                }
                for (int i = 0; i < str.Length; i++)
                {
                    for (int j = 0; j < 26; j++)
                    {
                        if (str[i].ToString().ToLower() == s[j].ToString())
                        {
                            list[j]++;
                            break;
                        }
                    }
                }
            }
            for(int j = 0; j < 26; j++)
            {
                Console.WriteLine(s[j] + " : " + list[j]);
            }
        }
    }
}

Measured memory_bytes: 9236
public class Main {
  public static void main(String[] args) {
    int N = new java.util.Scanner(System.in).nextInt();
    if (N == 1000 || N == 2000 || N == 3000 || N == 4000 || N == 5000 || N == 6000 || N == 7000 || N == 8000 || N == 9000 || N == 10000) {
      int A = 0; 
      System.out.println(A);
    } else {
      int A = 1000 - (N % 1000);
      System.out.println(A);
    }
  }
}


Measured memory_bytes: 35528
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (l[i] == l[j] || l[j] == l[k] || l[k] == l[i]) continue;
        int maxi = max({l[i], l[j], l[k]});
        int x = l[i] + l[j] + l[k] - maxi;
        if (x > maxi) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
A, B, C, X = int(input()), int(input()), int(input()), int(input())
ans = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500 + b*100 + c*50 == X:
                ans += 1
print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

using namespace std;

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

int main(void) {
  string s, t;
  cin >> s >> t;
  bool ans = true;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) != t.at(i)) ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3624
// atcoder/abc068/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    cout << "ABC" << n << endl;
  }

  return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

//min(n+x,(m-2*x)/2)
//2*n+2*x=m-2*x
//4*x=m-2*n
//x=(m-2*n)/4

i64 n,m;
i64 f(i64 x){
    return min(n+x,(m-2*x)/2);
}

void solve(){
    cin >> n >> m;
    i64 x=(m-2*n)/4;
    if(x<0) x=0;
    cout << f(x) << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
    from sys import stdin
    from collections import defaultdict  # , deque
    from collections import Counter
    # import math
    # import random
    input = stdin.readline


    n = int(input())

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

    up = defaultdict(int)
    down = defaultdict(int)
    for i in range(n):
        up[i+aa[i]] += 1
        down[i-aa[i]] += 1
    
    count_up = Counter(up)
    count_down = Counter(down)

    ans = 0

    for key, value in count_up.items():
        ans += count_down[key]*value
    print(ans)

    







Measured memory_bytes: 70500
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,R,S,P;
  cin>>N>>K>>R>>S>>P;
  string T;
  cin>>T;
  string Z=T;
  long long ans=0;
  for(int i=0; i<T.size(); i++){
    if(T[i]=='r') {
      Z[i]='p';
      ans+=P;
    }
    if(T[i]=='s'){
      Z[i]='r';
      ans+=R;
    }
    if(T[i]=='p'){
      Z[i]='s';
      ans+=S;
    }
  }
  for(int i=K; i<Z.size(); i++){
    if(Z[i-K]==Z[i]){
      if(Z[i]=='r'){
        ans-=R;
        if(i<Z.size()-K){
          if(Z[i+K]=='r') Z[i]='s';
        }
        continue;
      }
      if(Z[i]=='s'){
        ans-=S;
        if(i<Z.size()-K){
          if(Z[i+K]=='s') Z[i]='p';
        }
        continue;
      }
      if(Z[i]=='p'){
        ans-=P;
        if(i<Z.size()-K){
          if(Z[i+K]=='p') Z[i]='r';
        }
        continue;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	string s;
	cin >> s;
	s[5] = ' '; s[13] = ' ';
	cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }



void solve()
{
    ll k, a, b;
    cin >> k >> a >> b;
    if(b-a <= 2) cout << k+1;
    else{
        ll kk = max(0ll, k-(a-1));
        kk /= 2;
        cout << kk*(b-a)+a + (k-(a-1))%2;
    }
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
/************************************************
*Author        :  Jack
*Created Time  :  2019.11.07.21:08
*Mail          :  724033213@qq.com
*Problem       :  AT2165
*Extra         :  
************************************************/
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int t[maxn << 1], n;
void read(int & x) {
	x = 0; int f = 1;
	char ch = getchar();
	while(!isdigit(ch)) {
		if(ch == '-') f = -1;
		ch = getchar();
	}
	while(isdigit(ch)) {
		x = x* 10 + ch - '0';
		ch = getchar();
	}
}
bool O(int x, int y) {
	if(x == 1 && y == 1) return 1;
	return 0;
}
bool Z(int x, int y) {
	if(x == 0 && y == 0) return 1;
	return 0;
}
bool check(int dat) {
	int a[maxn << 1] = {0};
	for(int i = 1;i <= n * 2 - 1;i ++) {
		a[i] = t[i] >= dat;
	}
//	cout << dat << " " ;
//	for(int i = 1;i <= n * 2 - 1;i ++) {
//		cout << a[i] << " " ;
//	}
//	cout << endl;
	for(int len = 0;len < n;len ++) {
		if(O(a[n + len], a[n + len + 1]) || O(a[n - len], a[n - len - 1])) return 1;
		if(Z(a[n + len], a[n + len + 1]) || Z(a[n - len], a[n - len - 1])) return 0;
	}
	return a[1];
}
int main() {
//    freopen("AT2165.in","r",stdin);
//    freopen("AT2165.out","w",stdout);
	read(n);
	for(int i = 1;i <= n * 2 - 1;i ++) read(t[i]);   
	int l = 0, r = n * 2 - 1, ans;
	while(l <= r) {
		int mid = l + r >> 1;
		if(check(mid)) {
			ans = mid;
			l = mid + 1;
		} else {
			r = mid - 1;
		}
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define pb push_back

typedef long long ll;

typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
//cout<<"Yes"<<endl;
//cout<<"No"<<endl;

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;}

int main(){
  string s;
  cin>>s;
  string t;
  REP(i,3){
    t+=s[i];
  }
  cout<<t<<endl;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"

using namespace std;

using vi = vector<int>;

using uint = unsigned int;

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

	string S_, T;
	cin >> S_ >> T;

	reverse(S_.begin(), S_.end());
	reverse(T.begin(), T.end());
	vi matched_indices;

	bool matched;

	for (uint i = 0; i < S_.size() - T.size() + 1;) {
		matched = true;

		for (uint j = 0; j < T.size(); ++j) {
			if (S_.at(i + j) == '?') {
				matched = true;
			}
			else if (S_.at(i + j) != T.at(j)) {
				matched = false;
				break;
			}
		}

		if (matched) {
			matched_indices.push_back(i);
			i += T.size();
		}
		else {
			i++;
		}
	}

	if (matched_indices.size() == 0) {
		cout << "UNRESTORABLE" << endl;
	}
	else {
		for (uint i = 0; i < S_.size(); ++i) {
			if (S_.at(i) == '?') {
				S_.at(i) = 'a';
			}
		}

		for (uint j = 0; j < T.size(); ++j) {
			S_.at(matched_indices.front() + j) = T.at(j);
		}

		reverse(S_.begin(), S_.end());
		cout << S_ << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  u64 x;
  cin >> x;
  u64 cnt = x/11*2;
  u64 r = x%11;
  if (r>0) {
    if (r<=6) cnt+=1;
    else cnt+=2;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	int N;
	string S;
	cin>>N;
	cin>>S;
	for (int i=0;i<S.length();i++){
		char ch;
		int x=S[i]-'A'+N;
		if (x<26){
			ch=S[i]+N;
		}else{
			x-=26;
			ch='A'+x;
		}
		S[i]=ch;
	}
	cout<<S<<endl;

	return 0;
}

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

int main(){
  int a,b,c;
  cin >> a  >> b;
  c=a+b;
  if(c%2==0){
    c=c/2;
    cout << c;
  }
  else{
    cout << "IMPOSSIBLE";
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5+100;
int ax[maxn];
long long n,a,b;
typedef long long LL;
int main() {
   scanf("%lld%lld%lld",&n,&a,&b);
   if((b-a)&1){
       long long ans = min(b - 1,n - a);
       LL temp = min(n - b,a - 1)+1;
       ans = min(ans,(b-1-a)/2+temp);
       printf("%lld\n",ans);
   }
   else{
       long long ans = (b-a) / 2;
       printf("%lld\n",ans);
   }
   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long ll;
int main() {
	int a, b;
	char c;
	cin >> a >> c >> b;
	if (c == '+')
		cout << a + b << endl;
	else
		cout << a - b << endl;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

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

  ll cnt = 0;
  rep(i, 3) cnt += s[i] == '1' ? 1 : 0;

  cout << cnt << endl;
  
  return 0;
}


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

long long atk(long long H) {
	if (H == 1) {
		return 1;
	} else {
		return 2 * atk(H/2) + 1;
	}
}
int main() {
	long long H;
	cin >> H;
	cout << atk(H) << endl;
	return 0;
}



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

using namespace std;

int main() {
	int n, a, mini, maxi;
	int64_t sum;
	cin >> n;
	cin >> a;
	mini = maxi = sum = a;
	while (--n) {
		cin >> a;
		mini = min(mini, a);
		maxi = max(maxi, a);
		sum += a;
	}
	cout << mini << ' ' << maxi << ' ' << sum << endl;
}


Measured memory_bytes: 3088
/*
 * main.c
 *
 *  Created on: 2020/07/27
 *      Author: 113896
 */

#include <stdio.h>

int main() {

	int H, W, curr_i, curr_j;
	while (1) {
		scanf("%d%d", &H, &W);
		if (H == 0 && W == 0) break;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				curr_i = i + 1;
				curr_j = j + 1;
				if (curr_i % 2 == 0){
					if (curr_j % 2 == 0) {
						printf("#");
					} else {
						printf(".");
					}
				} else {
					if (curr_j % 2 == 0) {
						printf(".");
					} else {
						printf("#");
					}
				}
			}
			printf("\n");
		}
		printf("\n");
	}


	return 0;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
int H[303];

ll dp[303][303];




void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	if(K==N) return _P("0\n");
	FOR(i,N) cin>>H[i+1];
	
	FOR(x,N+2) FOR(y,N+2) dp[x][y]=1LL<<60;
	dp[0][K]=0;
	ll mi=1LL<<60;
	
	FOR(i,N+1) {
		FOR(x,K+1) if(dp[i][x]<1LL<<60) {
			if(x>=N-i) mi=min(mi,dp[i][x]);
			for(y=i+1;y<=N&&x>=y-i-1;y++) {
				int dif=max(H[y]-H[i],0);
				dp[y][x-(y-i-1)]=min(dp[y][x-(y-i-1)],dp[i][x]+dif);
			}
		}
	}
	
	cout<<mi<<endl;
	
	
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

string ans = "";
ll sum[40] = {};

void rec (int i, int n) {
    if (i == 0) {
        if (n == 0) ans += "0";
        else if (n == 1)
            ans += "1";
        else {
            cout << "no";
        }
        return;
    }

    if (sum[i] - pow (2, i - 1) < n) {
        n -= pow (2, i);
        ans += "10";
        // cout << n << "\n ";
        rec (i - 2, n);
    } else if (sum[i - 2] < n) {
        n -= pow (2, i - 1);
        ans += "11";
        // cout << n << "\n ";
        rec (i - 2, n);
    } else if ((sum[i - 3] <= n && i > 3) || i == 2 && (n == 0 || n == 1)) {
        ans += "00";
        // cout << n << "\n ";
        rec (i - 2, n);
    } else {
        ans += "01";
        n += pow (2, i - 1);
        // cout << n << "\n ";
        rec (i - 2, n);
    }
}
int main() {
    int n;
    cin >> n;
    int cnt = -1;
    bool chk1 = 0, chk2 = 0;
    if (n >= 0) chk1 = 1;
    else
        chk2 = 1;
    rep (i, 0, 40) {
        if (i == 0) sum[i] = 1;
        else if (i == 1)
            sum[i] = -2;
        else if (i % 2 == 0)
            sum[i] = sum[i - 2] + pow (-2, i);
        else
            sum[i] = sum[i - 2] + pow (-2, i);

        if (sum[i] >= n && cnt == -1 && chk1) {
            cnt = i;
        } else if (sum[i] <= n && cnt == -1 && chk2) {
            cnt = i + 1;
        }
    }
    // cout << cnt << "\n";
    rec (cnt, n);
    if (n != 0 && ans[0] == '0') ans = ans.substr (1, cnt);
    cout << ans << "\n";
}


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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

int main()
{
  int N; scanf("%d", &N);
  vector<int> P(N + 5);
  for (int i = 1; i <= N; ++i) { scanf("%d", &P[i]); }
  int ans = 0;
  for (int i = 1; i <= N; ++i) {
    if (P[i] != i) { continue; }
    if (i == N) {
      swap(P[i], P[i - 1]);
      ++ans;
    }
    else {
      swap(P[i], P[i + 1]);
      ++ans;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int x = 1;
        for (int i = 0; i < n; i++) {
            if (x < k)
                x *= 2;
            else
                x += k;
        }
        System.out.println(x);
    }
}


Measured memory_bytes: 21844
a, b, c, d = map(int, input().split())
if c%b == 0:
    e = c//b
else:
    e = c//b+1
if a%d == 0:
    f = a//d
else:
    f = a//d+1
if e <= f:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9180
#include<iostream>
using namespace std;
int min(int a,int b){
  return (a<b)?a:b;
}
int main(){
  int h,w,min_1[10],tmp,d[10][10];
  long long sum=0;
  cin >> h>> w;
  int a;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
     cin >> d[i][j]; 
    }
  }
  for(int k=0;k<10;k++){
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
        d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin >> a;
      if(a!=-1&&a!=1){
        sum += d[a][1];
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

use itertools::Itertools;
use proconio::input;
use proconio::marker::{Chars, Usize1};

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = 92233720368547758;
#[allow(dead_code)]
static INF_I32: i32 = 21474836;
#[allow(dead_code)]
static INF_USIZE: usize = 18446744073709551;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    input! {
       s:Chars,
    }

    let mut ans: usize = 0;
    let a = s[s.len() - 1] as usize - '0' as usize;
    if a == 2 || a == 4 || a == 5 || a == 7 || a == 9 {
        echo!("hon");
    } else if a == 0 || a == 1 || a == 6 || a == 8 {
        echo!("pon");
    } else {
        echo!("bon");
    }
}


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

using namespace std;

int main() {
  int M1, D1, M2, D2;
  cin >> M1 >> D1;
  cin >> M2 >> D2;  
  if (M1 != M2)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int d[2][55][2555];
constexpr int mod = 1e9 + 7;
void add(int &a, int b) {
  a = (a + b) % mod;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (m & 1) {
    puts("0");
    return 0;
  }
  d[0][0][0] = 1;
  int cur = 0;
  for (int _ = 0; _ < n; ++_) {
    int nxt = cur ^ 1;
    memset(d[nxt], 0, sizeof(d[nxt]));
    for (int i = 0; i <= n; ++i) {
      for (int j = 0; j <= m; ++j) {
        if (d[cur][i][j]) {
          if (j + i * 2 <= m) {
            add(d[nxt][i][j + i * 2], ((2LL * i + 1) * d[cur][i][j]) % mod);
          }
          if (i > 0 && j + i * 2 - 1 <= m) {
            add(d[nxt][i - 1][j + i * 2 - 1], 1LL * d[cur][i][j] * i % mod);
          }
          if (i + 1 <= n && j + i * 2 + 1 <= m) {
            add(d[nxt][i + 1][j + i * 2 + 1], 1LL * d[cur][i][j] * (i + 1) % mod);
          }
        }
      }
    }
    cur = nxt;
  }
  printf("%d\n", d[cur][0][m]);
  return 0;
}



Measured memory_bytes: 1280
/*

Author : AllKilled
Date   : 202001197 19:50:00 UTC+8

Website: https://atcoder.jp/contests/abc152
Contest: AtCoder Beginner Contest 152
Problem: Task F.
Result :

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

typedef long long LL;
typedef pair<LL, LL> PLL;

const int inf = 0x3f3f3f3f;
const LL MOD = 1e9+7;
const LL MAXN = 1e6 + 3;

///--------------------------------------------///

LL n, a[MAXN], p[MAXN];

LL qp(LL x, LL y, LL mod) {
    LL res = 1;
    for (; y; y >>= 1) {
        if (y & 1) res = res * x % mod;
        x = x * x % mod;
    }
    return res;
}

void process(LL u) {
    for (LL i = 2; i * i <= u; ++i) {
        if (u % i) continue;
        LL cnt = 0;
        while (u % i == 0) {
            u /= i;
            ++cnt;
        }
        p[i] = max(p[i], cnt);
    }
    if (u > 1) {
        p[u] = max(p[u], 1ll);
    }
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        process(a[i]);
    }
    LL lcm = 1;
    for (int i = 0; i < MAXN; ++i) {
        lcm = lcm * qp(i, p[i], MOD) % MOD;
    }
    LL ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += lcm * qp(a[i], MOD-2, MOD) % MOD;
    }
    ans = (ans % MOD + MOD) % MOD;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;
int a[maxn],b[maxn],c[maxn],x,y,A,B,C; 
int main(){
	cin>>x>>y>>A>>B>>C;
	for(int i=0;i<A;i++)cin>>a[i];
	for(int i=0;i<B;i++)cin>>b[i];
	for(int i=0;i<C;i++)cin>>c[i];
	vector<int>v;
	sort(a,a+A);
	sort(b,b+B);
	sort(c,c+C);
	int i=0,j=0;
	for(int i=A-1;i>=A-x;i--)v.push_back(a[i]);
	for(int i=B-1;i>=B-y;i--)v.push_back(b[i]);
	sort(v.begin(),v.end());
	int id=C-1;
	for(int i=0;i<v.size();i++){
		if(c[id]>v[i]){
			v[i]=c[id];
			id--;
		}
	}
	ll sum=0;
	for(int i=0;i<v.size();i++)sum+=v[i];
	cout<<sum;
	return 0; 
}

Measured memory_bytes: 2552
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll saidai(ll c, ll d, ll b){
	ll res = 0;
	ll i = 0;
	while(b -i*c > 0){
		res = max(res, b - ((b-i*c)%d));
		i++;
	}
	return res;
}

int main(){
  	ll A, B, C, D, E, F;
  	cin >> A >> B >> C >> D >> E >> F;

  	ll Wans = 0, Sans = 0;

  	for(ll i=0;i<=30;i++){
  		for(ll j=0;j<=30;j++){
  			ll W = 100*A*i + 100*B*j;
  			if(F>=W){
  				ll bound = min(F-W, (W*E)/100);
	  			ll S = saidai(C, D, bound);
	  			//cout << S <<endl;
	  			if(S*Wans >= Sans*W){
	  				Sans = S;
	  				Wans = W;
	  			}
  			}
  			
  		}
  	}

    cout << Wans+Sans << " " << Sans  <<endl;
  	return 0;
}

Measured memory_bytes: 256
from math import factorial

n = int(input())
A = sorted(list(map(int, input().split())))


max_num = A[-1]
medium = max_num / 2

diff = []
for a in A:
    diff.append(abs(medium-a))

min_index = diff.index(min(diff))
print(max_num, A[min_index])


Measured memory_bytes: 14180
n = int(input())
wa = [0]*n
sa = [0]*n
for i in range(n):
    x,y = map(int,input().split())
    wa[i] = x+y
    sa[i] = x-y
wanosa = max(wa) - min(wa)
sanosa = max(sa) - min(sa)
ans = max(wanosa,sanosa)
print(ans)

Measured memory_bytes: 73104
#include<bits/stdc++.h>   //取り敢えず書く
using namespace std;      //取り敢えず書く
int main(){               //取り敢えず書く
 /* コード */    int x;
 cin>>x;
 x=x*x*x;
 cout<<x<<endl;//今までやったようにコードを書く
}


Measured memory_bytes: 3096
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;

ll tag1[1610000],tag2[1610000],m1[1610000],m2[1610000];
int a[210000],n,Q,A,B;

int abs(int x){
	return x>0?x:-x;
}

void downtag1(int v){
	if(tag1[v]==0)return;
	tag1[v<<1]+=tag1[v];
	tag1[(v<<1)|1]+=tag1[v];
	m1[v]+=tag1[v];
	tag1[v]=0;
}

void downtag2(int v){
	if(tag2[v]==0)return;
	tag2[v<<1]+=tag2[v];
	tag2[(v<<1)|1]+=tag2[v];
	m2[v]+=tag2[v];
	tag2[v]=0;
}

void build(int v,int l,int r){
	if(l==r){
		m1[v]=abs(B-l)+l;
		m2[v]=abs(B-l)-l;
		return;
	}int mid=(l+r)>>1;
	build(v<<1,l,mid);
	build((v<<1)|1,mid+1,r);
	m1[v]=min(m1[v<<1],m1[(v<<1)|1]);
	m2[v]=min(m2[v<<1],m2[(v<<1)|1]);
}

ll query1(int v,int l,int r,int ql,int qr){
	downtag1(v);
	if(l>=ql&&r<=qr)return m1[v]+tag1[v];
	int mid=(l+r)>>1;
	ll res=1ll<<60;
	if(mid>=ql)res=min(res,query1(v<<1,l,mid,ql,qr));
	if(mid<qr)res=min(res,query1((v<<1)|1,mid+1,r,ql,qr));
	return res;
}

ll query2(int v,int l,int r,int ql,int qr){
	downtag2(v);
	if(l>=ql&&r<=qr)return m2[v]+tag2[v];
	int mid=(l+r)>>1;
	ll res=1ll<<60;
	if(mid>=ql)res=min(res,query2(v<<1,l,mid,ql,qr));
	if(mid<qr)res=min(res,query2((v<<1)|1,mid+1,r,ql,qr));
	return res;
}

void modify1(int v,int l,int r,int pos,ll x){
	downtag1(v);
	if(l==r){
		m1[v]=min(m1[v],x);
		return;
	}int mid=(l+r)>>1;
	if(mid>=pos)modify1(v<<1,l,mid,pos,x);
	else modify1((v<<1)|1,mid+1,r,pos,x);
	m1[v]=min(m1[v<<1]+tag1[v<<1],m1[(v<<1)|1]+tag1[(v<<1)|1]);
}

void modify2(int v,int l,int r,int pos,ll x){
	downtag2(v);
	if(l==r){
		m2[v]=min(m2[v],x);
		return;
	}int mid=(l+r)>>1;
	if(mid>=pos)modify2(v<<1,l,mid,pos,x);
	else modify2((v<<1)|1,mid+1,r,pos,x);
	m2[v]=min(m2[v<<1]+tag2[v<<1],m2[(v<<1)|1]+tag2[(v<<1)|1]);
}

ll sch(int v,int l,int r){
	downtag1(v);downtag2(v);
	if(l==r)return min(m1[v]-l,m2[v]+l);
	int mid=(l+r)>>1;
	return min(sch(v<<1,l,mid),sch((v<<1)|1,mid+1,r));
}

void out(int v,int l,int r){
	downtag1(v);downtag2(v);
	if(l==r){printf("%d:%lld %lld %lld %lld\n",l,m1[v]-l,m2[v]+l,m1[v],m2[v]);return;}
	int mid=(l+r)>>1;
	out(v<<1,l,mid);
	out((v<<1)|1,mid+1,r);
}

int main(){
//	freopen("Many Moves.in","r",stdin);
//	freopen("Many Moves.out","w",stdout);
	scanf("%d %d %d %d",&n,&Q,&A,&B);
	for(int i=1;i<=Q;i++){
		scanf("%d",&a[i]);
	}a[0]=A;
	build(1,1,n);
//	out(1,1,n); 
//	printf("----------\n");
	for(int i=1;i<=Q;i++){
		ll x1=query1(1,1,n,a[i],n)-a[i];
		ll x2=query2(1,1,n,1,a[i])+a[i];
//		printf("%lld %lld\n",x1,x2);
		tag1[1]+=abs(a[i]-a[i-1]);
		tag2[1]+=abs(a[i]-a[i-1]);
		modify1(1,1,n,a[i-1],min(x1,x2)+a[i-1]);
		modify2(1,1,n,a[i-1],min(x1,x2)-a[i-1]);
//		out(1,1,n); 
//		printf("----------\n");
	}printf("%lld\n",sch(1,1,n));
	return 0;
}

Measured memory_bytes: 33024
#include <iostream>
#include <memory>
#include <string>
#include <vector>

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

using lint = long int;
using llint = long long int;
using namespace std;

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

    int s;
    cin >> s;

    int h = s / 3600;
    s %= 3600;

    int m = s / 60;
    s %= 60;

    cout << h << ":" << m << ":" << s << endl;
}




Measured memory_bytes: 3216
// 2018/06/16
// Insertion Sort
#include <stdio.h>

void insertionSort(int*, int);

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

  for(i=0; i < n; i++){ // 入力した内容を表示
    if(i != 0)printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  
  insertionSort(A, n);  // 挿入ソート
  
  return 0; 
}

void insertionSort(int *A, int n){ 
  int i, j, k, v;
  
  // 挿入ソート //
  for(i=1; i < n; i++){
    v = A[i];           // 対象の配列の中身をvに保存する
    j = i-1;            // i番目の手前の配列要素を参照するためのj
    while(j >= 0 && A[j] > v){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    
    // 配列の内容を表示 //
    for(k=0; k < n; k++){
      if(k != 0)printf(" ");
      printf("%d", A[k]);
    }
    printf("\n");
  }
}



Measured memory_bytes: 2084
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
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; }

using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class ADodecagon {
public:
    void solve(istream& in, ostream& out) {
      SPEED;
      int r; in >> r;
      out << 3*r*r << endl;
    }
};

int main() {
	ADodecagon solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
def solve(s, c):
    """rv = min(Sr, Cr//2), where
       Sr = S + a
       Cr = C - 2a  # a>=0, a is number of (2c->S) conversions
       thus
       rv = max(min(S + a, C//2 - a) for a in range(0, C//2))
       if a >=0, optimum is Sr == Cr//2, thus
                            S + a == Cr//2 - a
                            a = (C//2 - S) / 2
    """
    a = (c / 2 - s) / 2
    if a < 0:
        a = 0
    al = int(a)
    ar = int(a) + 1
    return max(min(s + a, c//2 - a) for a in (al, ar))


if __name__ == "__main__":
    import sys
    S, C = map(int, sys.stdin.readline().split())
    print(solve(S, C))


def test_solve():
    assert solve(1, 2) == 1
    assert solve(0, 4) == 1
    assert solve(0, 1) == 0


def test_atcode():
    assert solve(1, 6) == 2
    assert solve(12345, 678901) == 175897

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

bool match(string s, string t) {
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != '?' && s[i] != t[i]) {
      return false;
    }
  }
  return true;
}

int main() {

  string S, T;
  cin >> S >> T;

  string answer = "UNRESTORABLE";

  for (int i = 0; i <=  (int)S.size() -  (int)T.size(); i++) {
    string s = S.substr(i, T.size());
    if (match(s, T)) {
      string answer_ = S;
      for (int j = i; j < i + T.size(); j++) {
        answer_[j] = T[j - i];
      }
      for (int j = 0; j < i; j++) {
        if (answer_[j] == '?') {
          answer_[j] = 'a';
        }
      }
      for (int j = i + T.size(); j < S.size(); j++) {
        if (answer_[j] == '?') {
          answer_[j] = 'a';
        }
      }
      if (answer == "UNRESTORABLE") {
        answer = answer_;
      } else {
        answer = min(answer, answer_);
      }
    }
  }
  
  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll x; cin >> x;
	x = abs(x);
	ll n{0}, i{1};

	while (true)
	{
		n += i;
		if (n >= x) break;
		++i;
	}
	std::cout << i << std::endl;
	// 	std::cout << n << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

char data_array[50][50] = {};
int ans[50][50] = {};

int main()
{
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			cin >> data_array[i][j];
		}
	}

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (data_array[i][j] == '.') 
			{
				int num = 0;
				//左上
				if (i == 0 && j == 0)
				{
					if (data_array[0][1] == '#') num++;
					if (data_array[1][0] == '#') num++;
					if (data_array[1][1] == '#') num++;
				}
				//右上
				else if (i == 0 && j == (w - 1))
				{
					if (data_array[0][w - 2] == '#') num++;
					if (data_array[1][w - 1] == '#') num++;
					if (data_array[1][w - 2] == '#') num++;
				}
				//左下
				else if (i == (h - 1) && j == 0)
				{
					if (data_array[h - 1][1] == '#') num++;
					if (data_array[h - 2][0] == '#') num++;
					if (data_array[h - 2][1] == '#') num++;
				}
				//右下
				else if (i == (h - 1) && j == (w - 1))
				{
					if (data_array[h - 1][w - 2] == '#') num++;
					if (data_array[h - 2][w - 1] == '#') num++;
					if (data_array[h - 2][w - 2] == '#') num++;
				}
				//中上
				else if (i == 0 && 0 < j && j < (w - 1))
				{
					if (data_array[0][j - 1] == '#') num++;
					if (data_array[0][j + 1] == '#') num++;
					if (data_array[1][j - 1] == '#') num++;
					if (data_array[1][j] == '#') num++;
					if (data_array[1][j + 1] == '#') num++;
				}
				//中下
				else if (i == (h - 1) && 0 < j && j < (w - 1))
				{
					if (data_array[h - 1][j - 1] == '#') num++;
					if (data_array[h - 1][j + 1] == '#') num++;
					if (data_array[h - 2][j - 1] == '#') num++;
					if (data_array[h - 2][j] == '#') num++;
					if (data_array[h - 2][j + 1] == '#') num++;
				}
				//中左
				else if (0 < i && i < (h - 1) && j == 0)
				{
					if (data_array[i - 1][0] == '#') num++;
					if (data_array[i - 1][1] == '#') num++;
					if (data_array[i][1] == '#') num++;
					if (data_array[i + 1][0] == '#') num++;
					if (data_array[i + 1][1] == '#') num++;
				}
				//中右
				else if (0 < i && i < (h - 1) && j == w - 1)
				{
					if (data_array[i - 1][w - 1] == '#') num++;
					if (data_array[i - 1][w - 2] == '#') num++;
					if (data_array[i][w - 2] == '#') num++;
					if (data_array[i + 1][w - 1] == '#') num++;
					if (data_array[i + 1][w - 2] == '#') num++;
				}
				//中
				else
				{
					if (data_array[i - 1][j - 1] == '#') num++;
					if (data_array[i - 1][j] == '#') num++;
					if (data_array[i - 1][j + 1] == '#') num++;
					if (data_array[i][j - 1] == '#') num++;
					if (data_array[i][j + 1] == '#') num++;
					if (data_array[i + 1][j - 1] == '#') num++;
					if (data_array[i + 1][j] == '#') num++;
					if (data_array[i + 1][j + 1] == '#') num++;
				}
				ans[i][j] = num;
			}
			else
			{
				ans[i][j] = -1;
			}

		}
	}

	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (ans[i][j] == -1)
			{
				cout << '#';
			}
			else
			{
				cout << ans[i][j];
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
ll no[10000001];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
//	cin>>test;
	while(test--)
	{
		ll ans=0;
		int n;
		cin>>n;
		FOR(i,1,n+1)
		{
			for(int j=i;j<=n;j+=i)
			no[j]++;
//			cout<<no[i]<<' ';
			ans+=no[i]*i;
		}
		cout<<ans;
	}
	return 0;
}

Measured memory_bytes: 81732