akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

using lint = long long;

struct frac {
    lint n,d;
    frac() { n = 0, d = 1; }
    frac(lint _n, lint _d) {
        n = _n, d = _d;
        lint g = __gcd(n,d); n /= g, d /= g;
        if (d < 0) n *= -1, d *= -1;
    }
    frac(lint _n) : frac(_n,1) {}

    friend frac abs(frac F) { return frac(abs(F.n),F.d); }

    friend bool operator<(const frac& l, const frac& r) { return l.n*r.d < r.n*l.d; }
    friend bool operator==(const frac& l, const frac& r) { return l.n == r.n && l.d == r.d; }
    friend bool operator!=(const frac& l, const frac& r) { return !(l == r); }

    friend frac operator+(const frac& l, const frac& r) { return frac(l.n*r.d+r.n*l.d,l.d*r.d); }
    friend frac operator-(const frac& l, const frac& r) { return frac(l.n*r.d-r.n*l.d,l.d*r.d); }
    friend frac operator*(const frac& l, const frac& r) { return frac(l.n*r.n,l.d*r.d); }
    friend frac operator*(const frac& l, int r) { return l*frac(r,1); }
    friend frac operator*(int r, const frac& l) { return l*r; }
    friend frac operator/(const frac& l, const frac& r) { return l*frac(r.d,r.n); }
    friend frac operator/(const frac& l, const int& r) { return l/frac(r,1); }
    friend frac operator/(const int& l, const frac& r) { return frac(l,1)/r; }

    friend frac& operator+=(frac& l, const frac& r) { return l = l+r; }
    friend frac& operator-=(frac& l, const frac& r) { return l = l-r; }
    template<class T> friend frac& operator*=(frac& l, const T& r) { return l = l*r; }
    template<class T> friend frac& operator/=(frac& l, const T& r) { return l = l/r; }

    friend ostream& operator<<(ostream& strm, const frac& a) {
        strm << a.n;
        if (a.d != 1) strm << "/" << a.d;
        return strm;
    }
};

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cout << setprecision(14) << fixed;
	int n;
	cin >> n;
	//frac total;
	double total = 0.0;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		//frac x(1, a);
		double k = 1.0/a;
		total = total + k;
	}
	cout << (double)1.0/total << '\n'; 
}



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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF * 300 * 300;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


void Main()
{
	int h,w; cin >> h >> w;
	//dp[80][80][12800]
	vector<vector<vector<bool>>> dp(81);
	VVI map(81);
	REP(i,81){
		dp[i].resize(81);
		map[i].resize(81);
		REP(j,81){
			dp[i][j].resize((80+80)*81+1,false);
		}
	}

	VVI mapa(h);
	REP(i,h){
		mapa[i].resize(w);
		REP(j,w){
			cin >> mapa[i][j];
		}
	}
	VVI mapb(h);
	REP(i,h){
		mapb[i].resize(w);
		REP(j,w){
			cin >> mapb[i][j];
		}
	}

	

	REP(i,h){
		REP(j,w){
			int a=mapa[i][j];
			int b=mapb[i][j];
			int t = abs(a-b);
			map[i][j] = t;
			if(i+j == 0){
				dp[0][0][t] = true;
			}
		}
	}
	REP(i,h){
		REP(j,w){
			int sa = map[i][j];
			REP(k,SIZE(dp[i][j])){
				int t = abs(k-sa);

				if((i-1 >= 0) && (dp[i-1][j][t])){
					//dump(i)
					//dump(j)
					//dump(k)
					dp[i][j][k] = true;
				}
				if((i-1 >= 0 ) && (dp[i-1][j][k+sa])){
					//dump(i)
					//dump(j)
					//dump(k)
					dp[i][j][k] = true;
				}
				if((j-1 >= 0) && (dp[i][j-1][t])){
					//dump(i)
					//dump(j)
					//dump(k)
					dp[i][j][k] = true;
				}
				if((j-1 >= 0 ) && (dp[i][j-1][k+sa])){
					//dump(i)
					//dump(j)
					//dump(k)
					dp[i][j][k] = true;
				}

			}
		}
	}
	REP(k,SIZE(dp[h-1][w-1])){
		if(dp[h-1][w-1][k] == true){
			cout << k << endl;
			return ;
		}
	}

	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 13120
#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 chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<pii> v(n);
	vector<int> a(n);
	rep(i, n) {
		int x, y;
		cin >> x >> y;
		v[i] = {x, y};
		a[i] = i;
	}
	auto d = [&](pii a, pii b) {
		return sqrt(pow(a.first - b.first, 2) + pow(a.second - b.second, 2));
	};
	int p = 0;
	double ans = 0;
	do {
		p++;
		rep(i, n - 1) {
			ans += d(v[a[i]], v[a[i + 1]]);
		}
	} while (next_permutation(all(a)));
	printf("%.10f\n", ans / p);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll r,g;
    cin>>r>>g;
    
    cout << g*2-r << endl;
    
    return 0;
}



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

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int[] a = new int[3];
        for (int i=0; i<3; i++) {
            a[i] = reader.nextInt();
        }
        Arrays.sort(a);

        System.out.println(a[0]*a[1]/2);
    }
    
    public static void solver() {
        // write logic
    }
    
    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



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

using namespace std;

int main() {
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  if(a[0] == 5 and a[1] == 5 and a[2] == 7) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
char digit[1000];
int main() {
while(1){
scanf("%s",digit);
if(digit[0] == '0' )
  break;
int len = strlen(digit);
int sum = 0;
int ro = len * 48;
for(int i=0;i<len;i++){
    sum += digit[i];
}
printf ("%d\n",(sum-ro));
}
    return 0;
}



Measured memory_bytes: 2068
#include <iostream>

int main(int argc, char const *argv[]) {
    int a,b,c;
    std::cin >> a >> b >> c;
    if (a+c==2*b) {
        std::cout << "YES" << '\n';
    }else{
        std::cout << "NO" << '\n';
    }
    return 0;
}


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

#define ll long long int
#define pi 3.141592653589793238
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
ll dx[4]={0,0,1,-1};
ll dy[4]={-1,1,0,0};


void solve()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++)
        cin>>a[i];
    vector<ll> suf(n,0);
    suf[n-1]=a[n-1];
    for(int i=n-2;i>0;i--)
    {
        suf[i]=suf[i+1]+a[i];
        suf[i]%=mod;
    }
    ll ans=0;
    for(ll i=0;i<n-1;i++)
    {
        ans+=(a[i]*suf[i+1]);
        ans%=mod;
    }
    cout<<ans;
    return;
}

int main()
{
	FAST;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
        solve();
	return 0;
}

Measured memory_bytes: 6364
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
int idx;
string s;

map<int,int> a[256];
int as[256];


int num(){
  int ret = 0;
  for(; idx < (int)s.size() && '0' <= s[idx] && s[idx] <= '9'; idx++){
    ret *= 10;
    ret += s[idx]-'0';
  }
  return ret;
}

int expr(){
  if('0' <= s[idx] && s[idx] <= '9')
    return num();

  int name = s[idx];
  idx+=2;

  int n = expr();
  idx++;
  if(n < 0) return -1;

  if(a[name].find(n) == a[name].end())
    return -1;

  return a[name][n];
}

bool decl(){
  int name = s[idx];
  idx += 2;
  as[name] = num();
  idx++;

  return true;
}

bool assi(){
  int name = s[idx];
  idx += 2;

  int n = expr();
  idx+=2;
  int m = expr();

  if(n < 0 || m < 0) return false;
  if(as[name] <= n) return false;
  
  a[name][n] = m;
  return true;
}

bool prog(){
  bool f = false;
  for(int i = 0; i < (int)s.size(); i++)
    if(s[i] == '=')
      f = true;

  if(!f) return decl();
  return assi(); 
}

void init(){
  for(int i = 0; i < 256; i++){
    a[i].clear();
    as[i] = -1;
  }

}

int main(void){
  int l = 0;
  int errl = 0;

  init();

  while(cin >> s){
    if(s=="."){
      if(!l){
	return 0;
      }

      cout << errl << endl;
      errl = 0;
      l = 0;
      init();

    }else{
      idx = 0;
      l++;
      if(!errl && !prog()){
	errl = l;
      }
    }
  }
}

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

int main()
{
    int n; cin>>n;
    int a[n];
    set<int> s;
    bool res=true;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(s.find(a[i])!=s.end()){
            res=false;
        }
        else{
        s.insert(a[i]);
        }
    }
    if(res==true){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
    
    return 0;
}

Measured memory_bytes: 10368
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

immutable mod = 10^^9 + 7;

void main() {
    int n, m;
    scan(n, m);

    auto adj = new bool[][](n, n);

    foreach (i ; 0 .. m) {
        int ai, bi;
        scan(ai, bi);
        ai--; bi--;
        adj[ai][bi] = adj[bi][ai] = 1;
    }

    int ans;

    void dfs(bool[] visited, int node) {
        visited[node] = 1;

        foreach (i ; 0 .. n) {
            if (adj[node][i] && !visited[i]) {
                dfs(visited, i);
            }
        }
    }

    foreach (i ; 0 .. n) {
        foreach (j ; i + 1 .. n) {
            if (adj[i][j]) {
                adj[i][j] = adj[j][i] = 0;

                auto visited = new bool[](n);

                dfs(visited, 0);

                ans += !all(visited);
                adj[i][j] = adj[j][i] = 1;
            }
        }
    }

    writeln(ans);
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr first
#define se second
#define r_0 return 0;
#define ll long long
#define pb push_back
#define TIME ios_base::sync_with_stdio(0)
using namespace std;
vector<ll>V,L,Q;
vector<string>P;
map<int,int>M;
set<char>S;
set<char>:: iterator it;
ll n,m,a,b,c,d,e,f,cnt,x,y,z,t;
string   s,p,ans,temp;
ll   arr[10001];
bool xy=0;
char bd;
int main()
{
    TIME;
    cin>>n;
    for (int i =0; i <n; i ++ )
        cin>>a,V.pb(a),L.pb(a);
    sort(V.begin(),V.end());
    for (int i =0; i <n; i ++ )
        if (L[i]!=V[i])
        cnt++;
    if (cnt<3)
        cout<<"YES";
    else
        cout<<"NO";

}


Measured memory_bytes: 256
n, a, b = map(int, input().split())
s = input()
tuuka = 0
kaigai = 0
for i in s:
    if i == 'a':
        if tuuka < a+b:
            print('Yes')
            tuuka += 1
        else:
            print('No')
    elif i == 'b':
        if tuuka < a+b and kaigai < b:
            print('Yes')
            tuuka += 1
            kaigai += 1
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 4016
#include <iostream>
#include <bitset>
#include <algorithm>

using namespace std;

int a[1000], b[1000];
int c[1000];

int dp[1001][1<<12];

typedef pair<int, int> P;
P p[1000];

const int INF = 1e+8;

int main(){
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> a[i] >> b[i];
        p[i] = P(a[i], i);
        for(int j = 0; j < b[i]; j++){
            int d;
            cin >> d;
            d--;
            int m = (1<<d);
            c[i] = c[i]|m;
        }
    }
    for(int i = 0; i < (1<<N); i++){
        dp[0][i] = INF;
    }
    dp[0][0] = 0;

    sort(p, p+N);

    for(int i = 0; i < M; i++){
        for(int j = 0; j < (1<<N); j++){
            dp[i+1][j] = dp[i][j];
        }
        int idx = i;
        for(int j = 0; j < (1<<N); j++){
            dp[i+1][j|c[idx]] = min(dp[i][j|c[idx]], dp[i+1][j|c[idx]]);
            dp[i+1][j|c[idx]] = min(dp[i+1][j|c[idx]], dp[i][j]+a[idx]);
        }
        
    }
    if(dp[M][(1<<N)-1] == INF){
        cout << -1 << endl;
        return 0;
    }
    cout << dp[M][(1<<N)-1] << endl;
}

Measured memory_bytes: 16256
import copy
import sys
sys.setrecursionlimit(100000)
input = sys.stdin.readline

N,U,V = map(int, input().split())
d = [set() for _ in range(N+1)]
dps = [0 for _ in range(N+1)]
dpss = [0 for _ in range(N+1)]
vs = set()
r = {}

def it(v, p, depth, ps):
    for u in d[v]:
        if u == p:
            continue
        dps[u] = depth
        if u == V:
            r["p"] = copy.deepcopy(ps)
            continue
        ps.add(u)
        it(u, v, depth+1,ps)
        ps.remove(u)
        vs.add(u)

def it2(v, p, depth):
    for u in d[v]:
        if u == p:
            continue
        if u not in vs:
            continue
        if dps[v] >= depth-1 and u not in r["p"]:
            continue
        dpss[u] = depth
        it2(u, v, depth+1)



for _ in range(N-1):
    a, b = [int(x) for x in input().split()]
    d[a].add(b)
    d[b].add(a)

vs.add(U)
it(U, -1, 1, set([U]))
it2(V, -1, 1)
print(max(dpss)-1)


Measured memory_bytes: 118688
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;


public class Main{
	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static int mod = (int) (1e9+7);
	static long cf = 998244353;
    static final long MAX = (long) 1e15;
    public static List<Integer>[] edges;
    public static int[][] parent;
    public static int col = 32;
    public static int[] Bit;
    public static long[] dp;
    
	public static void main(String[] args) {
	
	
	FastReader sc = new FastReader();
	
	int n = sc.nextInt();
	int m = sc.nextInt();
	char[][] tab = new char[n][m];
	for(int i=0;i<n;++i) 
		tab[i] = sc.next().toCharArray();
	int ans = 0;
	for(int i=0;i<n;++i) {
		for(int j=0;j<m;++j) {
			if(tab[i][j] != '#')
			ans = Math.max(ans, bfs(i,j,n,m,tab));
		}
	}
	out.print(ans);
	
	out.close();
	}

	static int[] dx = {0,-1,0,1};
	static int[] dy = {-1,0,1,0};
	
	private static int bfs(int i, int j, int n, int m, char[][] tab)  {
		boolean[][] vis = new boolean[n][m];
		Queue<Node> q = new LinkedList<>();
		int ans = 0;
		q.add(new Node(i,j,0));
		vis[i][j] = true;
		while(q.size() > 0) {
			Node node = q.poll();
			for(int k=0;k<4;++k) {
				int x = node.x+dx[k];
				int y = node.y+dy[k];
				if(x<0 || y<0 || x>=n || y>=m || tab[x][y] == '#' || vis[x][y]) continue;
				vis[x][y] = true;
				q.add(new Node(x,y,node.d+1));
				
			}
			//out.println(node.x+" "+node.y+" , "+node.d);
			ans = Math.max(ans,node.d);
		}
		return ans;
	}
	static class Node{
		int x;
		int y;
		int d;
		Node(int x,int y,int d){
			this.x =x;
			this.y = y;
			this.d = d;
		}
	}
	
}

Measured memory_bytes: 27440
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1000000007;
const ll INF = 9223372036854775807;
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  random_device rd;
  mt19937 mt(rd());
  uniform_int_distribution<ll> a(1,26);
  vector<ll> day(26);
  vector<pair<ll,ll>> c(26);
  ll d;
  cin >> d;
  rep(i,26) {
    ll t;
    cin >> t;
    c[i] = pair(t,i);
  }
  Sort(c);
  ll p = 0;
  rep(i,26) {
    if (c[i].first < 75) {
      p = i;
      break;
    }
  }
  ll cnt = 0;
  while (1) {
    rep(i,p) {
      cout << c[i].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
    rep(i,(26-p)/2) {
      cout << c[i+p].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
    rep(i,p) {
      cout << c[i].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
    rep(i,((26-p)+1)/2) {
      cout << c[i+p+(26-p)/2].second +1 << '\n';
      ++cnt;
      if (cnt >= 365) {
        return 0;
      }
    }
  }  
}

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

using namespace std;

int main()
{
    int N;
    cin >>N;
    int A[N]; 
    int t; 
    for(int i=0;i<N;i++)
    {
       cin>>t;
       A[t-1] = i+1;
    }
    for(int i=0;i<N;i++)
    {
        cout <<A[i]<<" " ; 
    }
    cout <<endl; 
    return 0; 
}


Measured memory_bytes: 1152
h,w=map(int, input().split())
c=[list(map(int, input().split())) for _ in range(10)]
a=[list(map(int, input().split())) for _ in range(h)]

def warshall_floyd(adj_m):
    # _dist[i][j] : i から j への最短距離
    _dist=adj_m
    for _k in range(10):
        for _i in range(10):
            for _j in range(10):
                _dist[_i][_j] = min(_dist[_i][_j], _dist[_i][_k]+_dist[_k][_j])
    return _dist

dist=warshall_floyd(c)

ans=0
for i in range(h):
    for j in range(w):
        if a[i][j]!=-1:
            ans+=dist[a[i][j]][1]
print(ans)


Measured memory_bytes: 9560
using System;

namespace ConsoleApplication1
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var value = int.Parse(Console.ReadLine());
            switch (value%10)
            {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9:
                    Console.WriteLine("hon");
                    break;
                case 0:
                case 1:
                case 6:
                case 8:
                    Console.WriteLine("pon");
                    break;
                case 3:
                    Console.WriteLine("bon");
                    break;
            }
        }
    }
}

Measured memory_bytes: 27344
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mem(arr,v) memset(arr,v,sizeof(arr))
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
ll arr[2000005],arr2[2000005];
int main()
{
     ll t,mx=INT_MIN,cnt=1;;
     cin>>t;
     for(int i=0;i<t;i++)
     {
         cin>>arr[i];
         arr2[i]=arr[i];
         if(arr[i]>mx)
         {
             cnt=1;
             mx=arr[i];
         }
         else if(arr[i]==mx)
         {
             cnt++;
         }
     }
     sort(arr2,arr2+t);
     if(cnt>1)
     {
         for(int i=0;i<t;i++)
         {
             cout<<mx<<endl;
         }
     }
     else
     {
         //cout<<"deb"<<endl;
         for(int i=0;i<t;i++)
         {
             if(arr[i]==mx)
                cout<<arr2[t-2]<<endl;
             else
             cout<<mx<<endl;
         }
     }
}


Measured memory_bytes: 7296
#include <iostream>
using namespace std;
int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    if(A==B)
    {
        cout<<C;
    }
    else
    {
        if(A==C)
        {
            cout<<B;
        }
        else
        {
            cout<<A;
        }
    }
}

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

int main(){
int r;
cin >> r;
cout << fixed << setprecision(10) << 2*M_PI*r << endl;
}


Measured memory_bytes: 3784
N, M = map(int, input().split())
paths = set()

for i in range(M) :
    _f, _t = map(int, input().split())
    paths.add((_f - 1, _t - 1))
    paths.add((_t - 1, _f - 1))

zeromask = "".join(['0' for x in range(N)])
fullmask = "".join(['1' for x in range(N)])
cnt = 0

def do_mask(m, idx) :
    return m[:idx] + '1' + m[idx + 1:]

def dfs(m, idx) :
    global cnt
    new_mask = do_mask(m, idx)
    
    if new_mask == fullmask :
        cnt += 1
    else :
        for i in range(N) :
            if i != idx and m[idx] != '1' and (idx, i) in paths:
                dfs(new_mask, i)
            
dfs(zeromask, 0)
print(cnt)

Measured memory_bytes: 3064
s = input()
t = input()
ans=1000
for i in range(len(s) - len(t)+1):
    c = 0
    f = 0
    for j in range(i, i + len(t)):
        if s[j] != t[f]:
            c += 1
        f += 1
    ans = min(ans, c)
print(ans)

Measured memory_bytes: 9128
#include<iostream>
#include<string>
#include <sstream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main() {
    double a,b,c,d,e;

    cin >> a >> b>> c >> d >> e; 

    double hour,minute,diff;
    hour= c-a;
    minute = d-b;
    diff = hour*60+minute-e;
    cout << diff << endl;
    
}

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

int main()
{
    
    int i = 0,m[10];
    
    while(i<10){
        cin >> m[i];
        i++;
    }
    
    int max,index,j;
   
    for(j = 0;j < 3 ; j++){
        max = m[0];
        index = 0;
        for(i = 0; i < 10 ;i++){
            if(max < m[i])
            {
                max = m[i];
                index = i;
            }
        }
        cout << m[index] << endl;
        m[index] = 0;
    }
}

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

#define rep(i, s, n) for(int i = s; i < n; ++i)
#define rrep(i, n) for(int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    vector<int> ans(n);
    int even_cnt = 0, odd_cnt = 0;
    rep(i, 0, n){
        if(s[i] == 'R'){
            if(i % 2 == 0){
                even_cnt++;
            }else{
                odd_cnt++;
            }
        }else{
            if(i % 2 == 0){
                ans[i] += even_cnt;
                even_cnt = 0;
                ans[i - 1] += odd_cnt;
                odd_cnt = 0;
            }else{
                ans[i] += odd_cnt;
                odd_cnt = 0;
                ans[i - 1] += even_cnt;
                even_cnt = 0;
            }
        }
    }
    rrep(i, n){
        if(s[i] == 'L'){
            if(i % 2 == 0){
                even_cnt++;
            }else{
                odd_cnt++;
            }
        }else{
            if(i % 2 == 0){
                ans[i] += even_cnt;
                even_cnt = 0;
                ans[i + 1] += odd_cnt;
                odd_cnt = 0;
            }else{
                ans[i] += odd_cnt;
                odd_cnt = 0;
                ans[i + 1] += even_cnt;
                even_cnt = 0;
            }
        }
    }
    cout << ans[0];
    rep(i, 1, n){
        cout << ' ' << ans[i];
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int gcd(int a, int b) {
  if(a < b) gcd(b, a);
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> bns(n);
	vector<int> ans(n);
	vector<int> res(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	ans[0] = a[0];
	for(int i=1; i<n; i++){
		ans[i] = gcd(ans[i-1], a[i]);
	}
	bns[n-1] = a[n-1];
	for(int i=n-2; i>=0; i--){
		bns[i] = gcd(bns[i+1], a[i]);
	}
	for(int i=0; i<n-2; i++){
		res[i] = gcd(ans[i], bns[i+2]);
	}
	res[n-2] = ans[n-2];
	res[n-1] = bns[1];
	cout << *max_element(res.begin(), res.end()) << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
long int n,a,b,z,z1;
int main()
{
    
    cin>>n>>a>>b;
	z=n-a;z1=z/b;
    if(z%b==0)
    {
    cout<<"0";
    }
    else 
    {
	cout<<n-a-b*z1;
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
using namespace std;

int main(void) {
  string s;
  int k;
  cin>>s>>k;
  int n=s.size();
  vector<string> vec;
  for (int i=0;i<min(5,n);++i) { //何個カットするか
    for (int j=0;j+i<n;++j) { //何番目から始めるか
      vec.push_back(s.substr(j,i+1));
    }
  }  
  sort(vec.begin(),vec.end());
  vec.erase(unique(vec.begin(),vec.end()),vec.end());
  cout<<vec[k-1]<<endl;
  return 0;
}


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

int main()
{
   int n,l;
   cin >> n >> l;
   vector<string> s(n);
   rep(i,n)
   cin >> s[i];
   sort(ALL(s));
   rep(i,n)cout<<s[i];cout<<endl;
   return 0;
}

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

int STACK[1000];
int POINT = 0;

void push(int i){
    STACK[POINT] = i;
    POINT++;
}

int pop(void){
    POINT--;
    return STACK[POINT];
}

int main(void){
    char read[10];
    int l=0;
    int r=0;
    while(scanf("%s ", read)== 1){
        if(read[0] == '+') push(pop()+pop());
        else if(read[0] == '-'){
            r = pop();
            l = pop();
            push(l-r);
        }
        else if(read[0] == '*') push(pop()*pop());
        else if(read[0] == '/'){
            r = pop();
            l = pop();
            push(l/r);
        }
        else{
            push(atoi(read));
        }
    }
    printf("%d\n", pop());
    return 0;
}

Measured memory_bytes: 1828
let n, h = Scanf.scanf " %d %d" @@ fun a b -> a, ref b
let m, ans = ref 0, ref 0
let f _ = Printf.printf "%d\n" !ans; exit 0
let bs = Array.init n @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> m := max !m a; b
let _ = Array.(sort (fun x y -> y - x) bs; iter (fun b -> if b > !m then (incr ans; h := !h - b; if !h <= 0 then f ())) bs); ans := !ans + (!h + !m - 1) / !m; f ()

Measured memory_bytes: 4736
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

use std::collections::binary_heap::BinaryHeap;

fn main() {
    input! {
        n: usize,
        m: usize,
        a: [u64;n]
    }
    let mut h = BinaryHeap::<u64>::new();
    h.extend(a.iter());
    let mut c = 0;
    while c < m {
        let mut x = h.peek_mut().unwrap();
        *x /= 2;
        c+=1;
    }
    println!("{}", h.iter().sum::<u64>());
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 8444
<?php

$abk = explode(' ', trim(fgets(STDIN)));
$a = $abk[0];
$b = $abk[1];
$k = $abk[2];

$count = 0;
$d = [];
for($i=$a; $i>=1; $i--){
  $j = $i;
  if ($a%$j==0 && $b%$j==0){
    $count++;
  }
  if ($count == $k) break;
}

echo $j;
  
?>

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
int n,k,m;
bool a[15];
char s[10];
int main() {
    scanf("%d %d",&n,&k);
    for (int i=0;i<k;i++) {
        scanf("%d",&m);
        a[m]=true;
    }
    int x=n;
    while (true) {
        int ok=true;
        int y=x;
        while (x) {
            if (a[x%10]) ok=false;
            x/=10;
        }
        x=y;
        if (ok) {
            printf("%d\n",x);
            return 0;
        }
        x++;
    } 
    /*for (int i=0;i<strlen(s);i++) {
        if (!a[s[i]-'0']) printf("%d",s[i]-'0');
        else {
            int x=s[i]-'0';
            while (a[x]) {
                x++;
                if (x==10) {
                    printf("10");
                    break;
                }
            }
            if (x!=10) printf("%d",x);
        } 
    }*/
    printf("\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll x;
  rep(i, 5) {
    cin >> x;
    if (x == 0) cout << i+1 << endl;
  }

  return 0;
}


Measured memory_bytes: 3624
import std.stdio, std.algorithm;
void main() {
	double i;
	while ("%f\n".readf(&i)) {
		double[] a = [i];
		foreach (j; 2..11) {
			if (j % 2 == 0)
				a ~= a[$-1] * 2.0;
			else
				a ~= a[$-1] / 3.0;
		}
		"%.8f".writefln(a.reduce!"a+b");
	}
}

Measured memory_bytes: 2424
#include <iostream>
using namespace std;
int main(){
  int A,B,C;  cin >> A >> B >> C;
  int X;  cin >> X;
  int count = 0;
  for(int i = 0;i <= A;i++){
    for(int j = 0;j <= B;j++){
      for(int k = 0;k <= C;k++)
          if(500 * i + 100 * j + 50 * k == X)count++;
    }
  }

  cout << count << endl;

}

Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[1]:


def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return False
    if par[x] > par[y]:
        x,y = y,x
    par[x] += par[y]
    par[y] = x
    return True

def size(x):
    return -par[find(x)]


# In[3]:


N,M = map(int, input().split())
par = [-1]*N
for _ in range(M):
    A,B = map(int, input().split())
    A -= 1; B -= 1
    unite(A,B)
ans = 0
for i in range(N):
    ans = max(ans, size(i))
print(ans)


# In[ ]:






Measured memory_bytes: 14628
// Goods things are coming, just keep believing 
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll unsigned long long
#define hii cout << "hii" << endl
#define okay cout << "okay" << endl
// #define hey cout << "hey" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
// #define mpp make_pair
#define endl '\n'
#define ff first 
#define int long long
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 #define ld long double
#define INF 1000000000;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
 
 
const int N = 2e5 + 5;
const int LG = 20;
const int mod = 1e9 + 7;

int arr[N];

int n, m;
int diff[N];
int pref[N];

void solve()
{
	int n;
	cin >> n;
	int ten = 5;
	int cnt = 0;
	if(n & 1)
	{
		cout << 0 << endl;
		return;
	}
	int idx = 1;
	while(ten <= n)
	{
		cnt += (n / ten) / 2;
		ten *= 5;
		idx++;
	}
	cout << cnt << endl;
	// cout << 124999999999999995;
}
 
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int t = 1;
	// cin >> t;
	while(t--)
	{
		solve();
	}
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a) {if(a){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}}
void YESNO(int a) {if(a){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}}
void AorB(int a,string b,string c) {if(a){cout<<b<<endl;}else{cout<<c<<endl;}}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int n,ans=0;
    cin>>n;
    Vi a(2*n);
    REP(i,0,2*n) cin>>a[i];
    SORT(a);
    REP(i,0,n) ans += a[2*i];
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
FAST_IO = 1
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

s = rr()
print(s[:3])

Measured memory_bytes: 64528
// 22
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fors(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fors(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define forrs(_, x, n, s) for (int _ = x; _ > n; _ -= s)
#define forrn(_, x, n) forrs(_, x, n, 1)
#define rrep(_, n) forrn(_, n - 1, -1)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  li n, W;
  cin >> n >> W;
  vector<int> w(n), v(n);
  rep(i, n) { cin >> w[i] >> v[i]; }
  vector<vector<li>> mem(n, vector<li>(W, -1));
  function<li(int, int)> knapsack = [&](int i, int k) -> li {
    assert(k <= W);
    if (i == n - 1)
      if (k + w[i] <= W)
        return v[i];
      else
        return 0;
    if (mem[i][k] != -1) return mem[i][k];
    mem[i][k] = 0;
    if (k + w[i] <= W) mem[i][k] = v[i] + knapsack(i + 1, k + w[i]);
    if (k <= W) mem[i][k] = max(mem[i][k], knapsack(i + 1, k));
    return mem[i][k];
  };
  cout << knapsack(0, 0) << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0);
  return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

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

using namespace std;

#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";
#define FIO ios_base::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(10);cout.tie(nullptr);cin.tie(nullptr);

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

template < class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); }
template < class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); }
template < class T> inline T ison(T n, T pos) { return (bool)(n & ((T)1 << pos)); }
template < class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); }return a; }

template <class T> inline T bigmod(T p, T e, T m) {
	T ret = 1;
	for (; e > 0; e >>= 1) {
		if (e & 1) ret = (ret * p) % m; p = (p * p) % m;
	} return (T)ret;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " is " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define debug(...)
#endif



void solve()
{
	long long n;
	cin>>n;

    vector<long long> items(n+1);

	for(int i=1;i<=n;i++){

		for(int j=i;j<=n;j=j+i){
            items[j]++;
		}
	}

	long long ans=0;

	for(long long i=1;i<=n;i++){
		ans+=items[i]*i;
	}

	cout<<ans<<nl;
}

int main()
{
	FIO;

	int t = 1;

	while (t--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 81324
#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 N, M;
    cin >> N >> M;
    if (N >= M)
    {
        cout << 0 << endl;
        return 0;
    }
    vector<int> x(M);
    rep(i, 0, M)
    {
        cin >> x.at(i);
    }
    vector<pair<int, int>> p(M - 1);
    sort(all(x));
    rep(i, 0, M - 1)
    {
        int a = x.at(i + 1) - x.at(i);
        int b = i + 1;
        p.at(i) = make_pair(a, b);
    }
    sort(all(p));
    reverse(all(p));
    vector<int> c(N + 1);
    c.at(0) = 0;
    c.at(N) = M;
    rep(i, 1, N)
    {
        c.at(i) = p.at(i - 1).second;
    }
    sort(all(c));
    int ans = 0;
    rep(i, 0, N)
    {
        ans += x.at(c.at(i + 1) - 1) - x.at(c.at(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		final int n = sc.nextInt();

		ArrayList<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			list.add(sc.nextInt());
		}

		Collections.sort(list);
		final int min = list.get(0);
		Collections.reverse(list);
		final int max = list.get(0);

		System.out.println(Math.abs(max - min));

	}

}


Measured memory_bytes: 23124
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int h, w;
		h = sc.nextInt();
		w = sc.nextInt();


		String st[] = new String[h + 1];

		char c[][] = new char[h + 1][w + 1];
boolean tate[]=new boolean[h+1];
boolean yoko[]=new boolean[w+1];
Arrays.fill(tate,false);
Arrays.fill(yoko,false);
		for (int i = 1; i <= h; i++) {
			st[i] = sc.next();
			for (int j = 1; j <= w; j++) {
				c[i][j] = st[i].charAt(j-1);
if(c[i][j]=='#'){
	tate[i]=true;
	yoko[j]=true;
}
			}
		}


		for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){

			if(tate[i]&&yoko[j])
			System.out.print(c[i][j]);
		}
		System.out.println();}
	}}

Measured memory_bytes: 23864
#include <bits/stdc++.h>
using namespace std;
 
bool is_open(set<int> called, int number) {
  return called.find(number) != called.end();
}
 
int main() {
  int a[3][3];
  for ( int i = 0; i < 3; i++ ) {
    for ( int j = 0; j < 3; j++ ) {
      cin >> a[i][j];
    }
  }
  int n;
  set<int> called;
  cin >> n;
  while ( n-- > 0 ) {
    int b;
    cin >> b;
    called.insert(b);
  }
 
  string bingo = "No";
  for ( int i = 0; i < 3; i++ ) {
    if ( is_open(called, a[i][0]) && is_open(called, a[i][1]) && is_open(called, a[i][2]) ) { bingo = "Yes"; }
  }
  for ( int j = 0; j < 3; j++ ) {
    if ( is_open(called, a[0][j]) && is_open(called, a[1][j]) && is_open(called, a[2][j]) ) { bingo = "Yes"; }
  }
  if ( is_open(called, a[0][0]) && is_open(called, a[1][1]) && is_open(called, a[2][2]) ) { bingo = "Yes"; }
  if ( is_open(called, a[0][2]) && is_open(called, a[1][1]) && is_open(called, a[2][0]) ) { bingo = "Yes"; }
 
  cout << bingo << endl;
  return 0;
}

Measured memory_bytes: 3628