akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,f,n) for(int i=(f); (i) < (n); i++)
#define repe(i,f,n) for(int i=(f); (i) <= (n); i++)
#define PI 3.14159265359
#define MOD (ll)1000000007
using namespace std;
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;}


typedef long long ll;
ll INF = 1e+18;

int
main()
{
  int N, K; cin >> N >> K;
  vector<int> arr(N);
  rep(i, 0, N) cin >> arr[i];
  sort(arr.begin(), arr.end());
  int sum = 0;
  rep(i, 0, K){
    sum += arr[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 100
#define MAX_M 100
#define INF   10000

vector<int> G[MAX_N];

int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

 
  // input
  int N, M;
  cin >> N >> M;
  
  for(int i = 0; i < M; i++) {

    int a, b;
    cin >> a >> b;
    
    G[a].push_back(b);
    G[b].push_back(a);
    
  }
  
  // ---------------------
  // 

  int array[N-1];
  
  for (int i = 0; i < N-1; i++) {
    array[i] = i + 2;
  }

  int num_path = 0;
  
  do{

    bool flag = false;

    for (int j = 0; j < G[1].size(); j++) {
      if (G[1][j] == array[0]) flag = true;
    }
    if (!flag) continue;
    
    for (int i = 0; i < N-2; i++) {
      int node = array[i];

      flag = false;
      for (int j = 0; j < G[node].size(); j++) {
	if (G[node][j] == array[i+1]) flag = true;
      }
      if (!flag) break;
    }

    if (flag) num_path++;
    
  }while(next_permutation(array, array + N - 1));


  cout << num_path << endl;

  return 0;
  
}


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

int main(){
  int x[10000];
    for(int i=0; i<10000; i++) {
      cin >> x[i];
      if(x[i] == 0) break;
    }

  for(int i=0; i<10000; i++){
    if(x[i] == 0){
      return 0;
    }
    cout << "Case " << i+1 << ": " << x[i] << endl;
  }
}



Measured memory_bytes: 3028
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

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

using namespace std;

int dp[15][100005];
int n;
vector<int> po;

int rec(int i, int j){
	int res;
	if (dp[i][j]>0) return dp[i][j];
	if (i==po.size() ){
		res = 0;
	}else if (i>=po.size()-1){
		res = j;
	}else if (po[i]>j){
		res = rec(i+1, j);
	}else{
		res = min(rec(i,j-po[i]) + 1, rec(i+1,j));
		//printf("rec(%d,%d) = %d\n", i, j, res);
	}
	dp[i][j] = res;
	return res;
}

int main(){
	int n, ans, a;

	REP(i,15){
		REP(k,100005) dp[i][k] = -1;
	}

	cin >> n;
	ans = 10000007;

	po.push_back(1);
	for (int i=1; i<8; i++)	po.push_back(pow(6,i));
	for (int i=1; i<7; i++) po.push_back(pow(9,i));
	sort(po.begin(), po.end(), greater<int>() );

	cout << rec(0,n) << endl;

	return 0;
}



Measured memory_bytes: 6912
#include<iostream>

using namespace std;

int main() {
	int a,b;
	cin >> a >> b;
	int ans = 0;
	int sockets = 1;
	while(sockets < b){
        sockets--;
        sockets += a;
        ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3628
import java.io.IOException;
import java.util.Scanner;

/**
 * Created on 2017/09/29 8:06.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);
        final int MAX_COST = 1000000001;

        while (sc.hasNextInt()) {
            int N = sc.nextInt();
            int t[][] = new int[N][N];
            int backup[][] = new int[N][N];

            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    t[i][j] = sc.nextInt();
                    backup[i][j] = t[i][j];
                }
            }

            for (int k = 0; k < N; k++) {
                for (int i = 0; i < N; i++) {
                    for (int j = 0; j < N; j++) {
                        if (i == j) {
                            continue;
                        }
                        t[i][j] = Math.min(t[i][j], t[i][k] + t[k][j]);
                    }
                }
            }

            boolean exists = true;
            for (int i = 0; exists && i < N; i++) {
                for (int j = 0; j < N; j++) {
                    if (t[i][j] != backup[i][j]) {
                        exists = false;
                        break;
                    }
                }
            }
            if (!exists) {
                System.out.println(-1);
                continue;
            }

            for (int k = 0; k < N; k++) {
                for (int i = 0; i < N; i++) {
                    for (int j = 0; j < N; j++) {
                        if (i == j || j == k || i == k) {
                            continue;
                        }
                        if (t[i][j] == backup[i][k] + backup[k][j]) {
                            t[i][j] = MAX_COST;
                        }
                    }
                }
            }

            long ans = 0;
            for (int i = 0; i < N; i++) {
                for (int j = i + 1; j < N; j++) {
                    if (t[i][j] == MAX_COST) {
                        continue;
                    }
                    ans += t[i][j];
                }
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 62716
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for(int i = 0; i < n; i++){
            array[i] = sc.nextInt();
        }
        System.out.print(array[n - 1]);
        for(int i = n - 2; i >= 0; i--){
            System.out.print(String.format(" %d", array[i]));
        }
        System.out.println();
    }
}



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

template <typename T>
void print(const T &v);

int main()
{
    int S, W;
    cin >> S >> W;
    if (S <= W)
    {
        cout << "unsafe" << endl;
    }
    else
    {
        cout << "safe" << endl;
    }
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm> 
#include<climits>
#include<stack>
#include<queue>
#include<set>
#include<cctype>
#include<bitset> 
#include<type_traits>
#include<numeric>
#include<array>
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<int,int> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

const int mod = 1000000007;
const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

// a^b mod M
ll myPow(ll a,ll b,ll M) {
    ll ret = 1;
    ll tmp = a;
    while(b>0) {
        if((b&1)==1) ret = (ret * tmp) % M;
        tmp = (tmp * tmp) % M;
        b = b>>1;
    }
    return ret;
}

 // nCk mod M
ll nCk(ll n,ll k,ll M) {
    ll ret = 1;
    ll mi = min(k, n-k);
    for(ll i=1;i<=mi;i++) {
        ret = (ret * myPow(i,M-2,M)) % M;
    }
    for(ll i=n-mi+1;i<=n;i++) {
        ret = (ret * i) % M;
    }
    return (ll)ret;
}

int main(){
    int R,G,B,N;cin >> R >> G >> B >> N;

    int ans=0;
    rep(r,0,N/R+1) rep(g,0,N/G+1) {
        if((N-r*R-g*G)%B==0) {
            int b = (N-r*R-g*G)/B;
            if(b>=0) ans++;
        }
    }

    pl(ans)

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define rep1(i,n) for(int i=1; i<(int)n; i++)
#define repa(i,a,n) for(int i=(a); i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
#define COUT(x) cout<<(x)<<endl
#define YES(x) cout<<(x?"YES":"NO")<<endl
#define Yes(x) cout<<(x?"Yes":"No")<<endl
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using psi = pair<string, int>;
const int dx[4] = {1, 0,-1, 0};
const int dy[4] = {0, 1, 0,-1};
const int mod = 1e9+7;
int gcd(int a, int b){if(a%b == 0){return(b);}else{return(gcd(b, a%b));}}
int lcm(int a, int b){return a / gcd(a, b)*b;}
//cout << fixed << setprecision(15);
int N, M, K, H, W, L, R, X, Y;
//string S, T;

signed main(){
  cin >> N;
  vi D(N);
  int sum = 0;
  int Asum =0;
  rep(i,N){
    cin >> D[i];
    sum += D[i];
    if(i%2 == 1) Asum += D[i];
  }
  vi Y(N);
  Y[0] = sum-2*Asum;
  rep1(i,N) Y[i]=2*D[i-1]-Y[i-1];
  
  rep(i,N){
    cout << Y[i];
    if(i != N-1) cout << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 4820
#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)


class Student{
public:
  int num;
  double weight;
  double height;
  Student(int n, double w, double h){
    num =n;
    weight = w;
    height = h;
  }
};

int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(6);

  int INF = 1000000;

  vector<Student> data;
  int n;
  double w,h;
  char d;
  while(cin >> n >> d >> w >> d >> h){
    Student d(n,w,h);
    data.push_back(d);
  }

  for(vector<Student>::iterator it=data.begin(); it!=data.end(); ++it){
    double bmi = it->weight / pow(it->height,2);
    if( bmi >= 25 )
      cout << it->num << endl;
  }

  return 0;
}

Measured memory_bytes: 1240
// Name: Traveling Alone: One-way Ticket of Youth
// Level: 2
// Category: グラフ,Graph,最短経路,Warshall-Floyd
// Note:

/**
 * 最小金額と最短時間のそれぞれについて、Warshall-Floydで前処理しておけばよい。
 * オーダーは O(M^3 + K)。
 */
#include <iostream>
#include <vector>

using namespace std;

bool solve() {
    int N, M;
    if(!(cin >> N >> M)) return false;
    if(!N && !M) return false;

    vector<vector<int>> cost(M, vector<int>(M, -1));
    vector<vector<int>> dist(M, vector<int>(M, -1));
    for(int i = 0; i < N; ++i) {
        int a, b, c, t;
        cin >> a >> b >> c >> t;
        --a; --b;
        cost[a][b] = cost[b][a] = c;
        dist[a][b] = dist[b][a] = t;
    }
    for(int k = 0; k < M; ++k) {
        for(int i = 0; i < M; ++i) {
            for(int j = 0; j < M; ++j) {
                if(cost[i][k] != -1 && cost[k][j] != -1 && (cost[i][j] == -1 || cost[i][k]+cost[k][j] < cost[i][j])) {
                    cost[i][j] = cost[i][k] + cost[k][j];
                }
                if(dist[i][k] != -1 && dist[k][j] != -1 && (dist[i][j] == -1 || dist[i][k]+dist[k][j] < dist[i][j])) {
                    dist[i][j] = dist[i][k] + dist[k][j];
                }
            }
        }
    }
    int K;
    cin >> K;
    while(K--) {
        int a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        if(c == 0) {
            cout << cost[a][b] << endl;
        } else {
            cout << dist[a][b] << endl;
        }
    }
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1312
n=int(input())
ans=0
anss=[]
ok=False
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        ans+=1
    else:
        anss.append(ans)
        ans=0
anss.append(ans)       
ok=False
for i in anss:
    if i>=3:
        ok=True
if ok:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9212
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a==1){
    a+=13;
  }
  if(b==1){
    b+=13;
  }
  if(a>b){
    cout<<"Alice"<<endl;
  }
  else if(a<b){
    cout<<"Bob"<<endl;
  }
  else{
    cout<<"Draw"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, A: "List[int]"):
    print(max(A) - min(A))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)


if __name__ == '__main__':
    main()


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

using namespace std;

int dirx[] = {1, -1, 0, 0};
int diry[] = {0, 0, 1, -1};

int main() {
	int h, w;
	cin >> h >> w;

	vector<vector<char>> mat(h + 2, vector<char>(w + 2));

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

	int ans = 0;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (mat[i][j] == '.') {
				vector<vector<bool>> visited(h + 2, vector<bool>(w + 2));
				vector<vector<int>> res(h + 2, vector<int>(w + 2));

				queue<pair<int, int>> q;
				q.push(make_pair(i, j));
				visited[i][j] = 1;
				res[i][j] = 0;
				while (!q.empty()) {
					pair<int, int> p = q.front(); q.pop();
					int px = p.first;
					int py = p.second;

					for (int i = 0; i < 4; i++) {
						int tx = px + dirx[i];
						int ty = py + diry[i];

						if (tx >= 0 && ty >= 0 && tx < h && ty < w && mat[tx][ty] == '.' && !visited[tx][ty]) {
							q.push(make_pair(tx, ty));
							visited[tx][ty] = 1;
							res[tx][ty] = res[px][py] + 1;
						}
					}
				}
				
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < w; j++) {
						ans = max(ans, res[i][j]);
					}
				}
			}
		}
	}

	cout << ans << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

using P = pair<ll, ll>;

vector<P> factorize(ll val) {
    vector<P> res;
    ll tmp = val;
    for (ll i = 2; i * i <= val; ++i) {
        ll cnt = 0;
        while (tmp % i == 0) {
            tmp /= i;
            ++cnt;
        }
        if (cnt) {
            res.emplace_back(i, cnt);
        }
    }
    if (tmp > 1) {
        res.emplace_back(tmp, 1);
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<P> factors = factorize(N);
    ll ans = 0;
    for (auto& f : factors) {
        ll cnt = f.second;
        ll e = 1;
        while (cnt - e >= 0) {
            ++ans;
            cnt -= e;
            ++e;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  ll n;
  cin >>n;
  vector<pair<ll,ll>>fac;
  ll ans=0;
  for(ll i=2;i*i<=n;i++){
    if(n%i!=0)continue;
    int ex=0;
    while(n%i==0){
      ex++;
      n/=i;
    }
    fac.push_back({i,ex});
  }
  if(n!=1)fac.push_back({n,1});
  for(auto f:fac){
    int tmp=0;
    int e=1;
    while(f.second>=e){
      f.second-=e;
      e++;
      tmp++;
    }
    ans+=tmp;
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 3612
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<complex>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS (long double) 1e-8
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};

int main(void) {
	map<char, int> m;
	m['a'] = 0;
	m['b'] = 0;
	m['c'] = 0;
	m['d'] = 0;
	m['e'] = 0;
	m['f'] = 0;
	m['g'] = 0;
	m['h'] = 1;
	m['i'] = 1;
	m['j'] = 1;
	m['k'] = 1;
	m['l'] = 1;
	m['m'] = 1;
	m['n'] = 1;
	m['o'] = 1;
	m['p'] = 1;
	m['q'] = 0;
	m['r'] = 0;
	m['s'] = 0;
	m['t'] = 0;
	m['u'] = 1;
	m['v'] = 0;
	m['w'] = 0;
	m['x'] = 0;
	m['y'] = 1;
	m['z'] = 0;
	while(1) {
		string s;
		cin>>s;
		if(s == "#") break;
		int res = 0;
		FOR(i, 1, s.size()) {
			if(m[s[i]] != m[s[i - 1]]) ++ res;
		}
		cout<<res<<endl;
	}
}

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

using namespace std;
#define int long long
int MOD = 1000000007;


signed main(){
    int N;
    cin >> N;
    int x,y;
    int tmpx=0,tmpy=0,cnt=0;
    for(int i=0;i<N;i++){
        cin >> x >> y;
        tmpx = max(tmpx,x);
        if(tmpx == x) tmpy = y;
    }
    
    for(int i=0;i<tmpy;i++){
        cnt++;
    }
    
    cout << tmpx+cnt << endl;
    
    return 0;
}


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

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        int n;
        cin >> n;
        cout << fixed << setprecision(9);
        cout << acos(-1) * 2 * n;
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> B(N - 1);
  for(int i = 0;i < N - 1;i++){
    cin >> B[i];
  }

  vector<int> C(N);
  C[N - 1] = B[N - 2];
  C[0] = B[0];
  for(int i = N - 2;i > 0;i--){
    if(B[i] > B[i - 1]){
      C[i] = B[i - 1];
    }else if(B[i] <= B[i - 1]){
      C[i] = B[i];
    }
  }
  int total = 0;
  for(int i = 0;i < N;i++){
    total += C[i];
  }
  cout << total;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int num,i;
	int a,b,c;
	int right;
	scanf("%d",&num);
	for(i=0;i<num;i++) {
		scanf("%d %d %d",&a,&b,&c);
		right=0;
		if(a*a+b*b==c*c)right=1;
		if(b*b+c*c==a*a)right=1;
		if(c*c+a*a==b*b)right=1;
		printf("%s\n",right?"YES":"NO");
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
amax = max(a)
amax_id = int(a.index(amax))
a.pop(amax_id)
amax2 = max(a)
for i in range(n):
  if i == amax_id:
    print(amax2)
  else:
    print(amax)

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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    int base = 26;
    vi ans;
    while(n){
        n--;
        ans.push_back('a' + (n%base));
        n /= base;
        //n--;
    }
    reverse(all(ans));
    string s(all(ans));
    cout << s << "\n";

    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a>b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a<b) a = b; }
template<typename T>
struct VoronoiMST {
	int n;
	using E = pair<int, T>;
	using P = pair<T, int>;
	vector<vector<E> > G;
	VoronoiMST(vector<T> &x) {
		n = x.size();
		G.assign(n << 1, vector<E>());
		for (int i = 0; i<n; i++) G[i].emplace_back(n + i, x[i]);
	}
	void add_edge(int u, int v, T c) {
		G[u + n].emplace_back(v + n, c);
		G[v + n].emplace_back(u + n, c);
	}
	vector<vector<E> > build() {
		priority_queue<P, vector<P>, greater<P> > pq;
		const T INF = numeric_limits<T>::max();
		vector<T> dist(n << 1, INF);
		vector<int> from(n << 1, -1);
		for (int i = 0; i<n; i++) {
			dist[i] = 0; from[i] = i;
			pq.emplace(dist[i], i);
		}
		while (!pq.empty()) {
			T d;
			int v;
			tie(d, v) = pq.top(); pq.pop();
			if (dist[v]<d) continue;
			for (E e : G[v]) {
				int u = e.first;
				T c = e.second;
				if (dist[u] <= dist[v] + c) continue;
				dist[u] = dist[v] + c;
				from[u] = from[v];
				pq.emplace(dist[u], u);
			}
		}
		vector<vector<E> > H(n);
		for (int v = 0; v<(n << 1); v++) {
			for (E e : G[v]) {
				int u = e.first;
				T c = e.second;
				if (from[v] == from[u]) continue;
				int x = from[v], y = from[u];
				T z = dist[v] + dist[u] + c;
				H[x].emplace_back(y, z);
				H[y].emplace_back(x, z);
			}
		}
		return H;
	}
};



template<typename T>
struct Kruskal {

	struct edge {
		int from, to;
		T cost;
		int used;
		edge() {}
		edge(int from, int to, T cost) :
			from(from), to(to), cost(cost), used(0) {}
		bool operator<(const edge& e) const {
			return cost<e.cost;
		}
	};

	int n;
	vector<int> p, r;
	vector<edge> edges;

	Kruskal() {}
	Kruskal(int n) :n(n) {}

	void init(int n) {
		r.assign(n, 1);
		p.resize(n);
		iota(p.begin(), p.end(), 0);
	}

	int find(int x) {
		return (x == p[x] ? x : p[x] = find(p[x]));
	}

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

	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y) return;
		if (r[x]<r[y]) swap(x, y);
		r[x] += r[y];
		p[y] = x;
	}

	void add_edge(int u, int v, T c) {
		edges.emplace_back(u, v, c);
	}

	T build() {
		sort(edges.begin(), edges.end());
		init(n);
		T res = 0;
		for (auto &e : edges) {
			if (!same(e.from, e.to)) {
				res += e.cost;
				unite(e.from, e.to);
				e.used = 1;
			}
		}
		return res;
	}
};
signed KEYENCE2019_E() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	int n, d;
	cin >> n >> d;
	vector<long long> a(n);
	for (int i = 0; i<n; i++) cin >> a[i];
	VoronoiMST<long long> vo(a);
	for (int i = 1; i<n; i++) {
		vo.add_edge(i - 1, i, d);
	}
	auto G = vo.build();
	Kruskal<long long> ks(n);
	for (int v = 0; v<n; v++) {
		for (auto e : G[v]) {
			int u = e.first;
			long long c = e.second;
			/*if (v<u)*/ ks.add_edge(v, u, c);
		}
	}
	cout << ks.build() << endl;
	return 0;
}

int main() {
	KEYENCE2019_E();
	return 0;
}

Measured memory_bytes: 79984
N = int(input())
b = [int(i) for i in input().split()]

ans = []
while b:
    for i in range(len(b)):
        if b[len(b)-1-i] == len(b)-i:
            ans.append(b.pop(len(b)-1-i))
            break
    else:
        print(-1)
        exit()

print(*ans[::-1], sep='\n')


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

long ans;
long M, N, K;
long X, Y;
long ac, wa, tle, re;
vector<long> A, B, C;
vector<long> P;
vector<vector<long>> S;

int main(void) {

    cin >> N;

    for (long i = 0; i < N; i++) {
        string s; cin >> s;
        if (s == "AC") ac++;
        if (s == "WA") wa++;
        if (s == "TLE") tle++;
        if (s == "RE") re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;

    return 0;

}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] array = new int[3];
		array[0] = sc.nextInt();
		array[1] = sc.nextInt();
		array[2] = sc.nextInt();
		sc.close();
		Arrays.sort(array);
		long sum = array[0] + array[1];
		System.out.println(sum);
	}
}

Measured memory_bytes: 22996
import java.util.Scanner;

class Main{
  public static void main(String args[]){
    String s;
    Scanner sc = new Scanner(System.in);
    
    s = sc.next();
    if(s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define endl '\n'
#define pb push_back
#define mp make_pair
#define cont continue  
#define MOD 998244353
#define rep(i, n) for(int i = 0 ; i < (n) ; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 10000000000000001;
const double pi = 3.141592653589793;

int T;

int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  
  string s1, s2;
  cin >> s1;
  cin >> s2;
  bool flag = true;
  for(int i = 0 ; i < s1.size() ; i++) {
    if(s1[i] != s2[i]) flag = false;
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3624
r, c = map(int, input().split())
hyou = []
tate_sum = [0] * (c + 1)
for i in range(r):
    line = list(map(int, input().split()))
    line.append(sum(line))
    tate_sum = [tate_sum[j] + line[j] for j in range(len(line))]
    hyou.append(" ".join(map(str, line)))
    
hyou.append(" ".join(map(str, tate_sum)))
print("\n".join(hyou))

Measured memory_bytes: 7704
// Problem : A - Five Variables
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define cs(ans) setprecision(10)<<fixed<<ans

 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359;
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
   	vi v(5);
   	F0R(x,5)
   	{
   		cin>>v[x];
   		if(v[x]==0)
   		{
   			cout<<x+1<<endl;
   			return 0;
   		}
   	} 
	
	return 0;
	//CHECK CORNER CASES
}
// read the question correctly (ll vs int)
// template by bqi343




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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

const int MAX_N = 112345;
int a[MAX_N], b[MAX_N], c[MAX_N];
ll dp[MAX_N][3];

int main2() {
  CLR(dp, 0);
  int N = nextInt();
  REP(i, N) {
    a[i] = nextInt();
    b[i] = nextInt();
    c[i] = nextInt();
  }
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  for (int i = 1; i < N; i++) {
    chmax(dp[i][0], dp[i-1][1] + a[i]);
    chmax(dp[i][0], dp[i-1][2] + a[i]);
    chmax(dp[i][1], dp[i-1][0] + b[i]);
    chmax(dp[i][1], dp[i-1][2] + b[i]);
    chmax(dp[i][2], dp[i-1][0] + c[i]);
    chmax(dp[i][2], dp[i-1][1] + c[i]);
  }
  ll ans = max(max(dp[N-1][0], dp[N-1][1]), dp[N-1][2]);
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main()
{
	long a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0) {
		cout << (a + b) / 2 << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}


Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<list>
#include<deque>
#include<cmath>
#include<unordered_map>
#include<numeric>
using namespace std;

using ll = int64_t;

/// <summary>
/// 単純なcoutの時に使う
/// </summary>
#define co(a) cout<<a<<endl


/// <summary>
/// [beg, end)の範囲を，添え字indexでループするfor文に置換します
/// </summary>
#define rep(i,a) for(ll i=0; i<a; ++i)

/// <summary>
/// 迷路等で使う方向のベクトル
/// </summary>
const vector<ll> dx = { 0, 1, 0, -1 }, dy = { 1, 0, -1, 0 };

/// <summary>
/// デバッグ時に使う
/// </summary>
#define DEBUG(x)     std::cout << #x << " : " << x << "\n"


///////////////////////////////////////////////////////////////////////////

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

	string S;
	cin >> S;

	int ans = 0;
	rep(i, S.size()) {
		if (S[i] == '1') {
			ans++;
		}
	}
	co(ans);
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
//#define int long long

signed main(){
    int a, b;
    cin >> a >> b;
    cout << a + b/2 << endl;
}

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


int main(){
  while(1){
  int n;
  string str,tmp;
  cin>>n;
  if(n==0) break;
  cin>>str;
  for(int i=0;i<n;i++){
    int cnt=0;
    char cntp=str[0];
str+='a';
  for(int j=0;j<(int)str.size();j++){
    if(cntp==str[j])cnt++;
    else{
            string tmpc;
      while(cnt/10>0) tmpc+=(cnt/10+'0'),cnt-=((cnt/10)*10);
	tmpc+=(cnt%10+'0');
	tmp+=tmpc+str[j-1],cnt=1;
	cntp=str[j];
    }
  }
  str=tmp;  

  tmp.clear();
  }
  cout<<str<<endl;
  }
  return 0;
}

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

int n, k;
vector<int> a;

bool check(int y) {
  long long cnt = 0;
  for (auto& x : a) {
    cnt += (x + y - 1) / y - 1;
  }
  return (cnt <= k);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int lo = 1, hi = (int) 1e9, ans;
  for (int i = 0; i < 50; i++) {
    int mid = lo + (hi - lo) / 2;
    if (check(mid)) {
      ans = mid;
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3896
! 2019.10.19
!
      program answer
      implicit none
      integer :: N
      character(len=1),allocatable,dimension(:) :: S
      integer :: ans
      integer :: i
!
      read(*,*) N
      allocate(S(N))
      read(*,'(100000A)') (S(i),i=1,N)
!
      ans = N
!
      do i=1,N-1
        if(S(i) == S(i+1)) then
          ans = ans - 1
        end if
      end do
!
      write(*,*) ans
      end program answer


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define repr(i,n) for(int i=0, i##_len=(n); i<i##_len; --i)
#define REP(i,m,n) for(int i=int(m), i##_len=(n); i<i##_len; ++i)
#define VV(T) vector<vector<T>>
#define co(P) cout << P << endl
#define ci(P) cin >> P
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;;
typedef long long ll;
typedef double d;

int main(){
  int N,M;
  ci(N);
  if(N<10){
    if(N==2||N==4||N==5||N==7||N==9){
    co("hon");
    }
    if(N==0||N==1||N==6||N==8){
    co("pon");
    }
    if(N==3){
    co("bon");
    }
  }
  else{
    M = N-(N/10)*10;
    if(M==2||M==4||M==5||M==7||M==9){
    co("hon");
    }
    if(M==0||M==1||M==6||M==8){
    co("pon");
    }
    if(M==3){
    co("bon");
    }
  }
}

Measured memory_bytes: 3620
#include<iostream>
using namespace std;
int main(){
  int N,M,C;
  cin >> N >> M >> C;
  int B[M];
  for(int i = 0; i < M; ++i){
    cin >> B[i];
  }
  int ans = 0;  
  for (int i = 0; i < N; i++){
  	int t1 = 0;
    for (int j = 0; j < M; j++){
      int t2 = 0;
      cin >> t2;
      t1 += t2 * B[j];
    }
    if (t1 + C > 0){
      ans++;
    }
  } 
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
const int MOD=998244353;
struct mint{int x;mint(int x=0):x(x){}};
inline mint operator+  (mint a,mint b){return a.x+b.x<MOD?a.x+b.x:a.x+b.x-MOD;}
inline mint operator-  (mint a){return MOD-a.x;}
inline mint operator-  (mint a,mint b){return a+-b;}
inline mint operator*  (mint a,mint b){return 1LL*a.x*b.x%MOD;}
inline mint operator<< (mint x,int y){mint r=1;for(;y;y>>=1,x=x*x)if(y&1)r=r*x;return r;}
inline mint operator~  (mint x){return x<<MOD-2;}
inline mint operator/  (mint a,mint b){return a*~b;}
inline mint&operator+= (mint&a,mint b){return a=a+b;}
inline mint&operator-= (mint&a,mint b){return a=a-b;}
inline mint&operator*= (mint&a,mint b){return a=a*b;}
inline mint&operator<<=(mint&x,int y){return x=x<<y;}
inline mint&operator/= (mint&a,mint b){return a=a/b;}
#define MN 200
int x[MN+5],y[MN+5];
int main()
{
	int n=read(),i,j,k,cnt;
	for(i=1;i<=n;++i)x[i]=read(),y[i]=read();
	mint ans=(mint(2)<<n)-n*(n+1)/2-1;
	for(i=1;i<=n;++i)for(j=1;j<=n;++j)if(i!=j)
	{
		for(cnt=2,k=1;k<=n;++k)if(k!=i&&k!=j)
			if((x[k]-x[i])*(y[j]-y[i])==(y[k]-y[i])*(x[j]-x[i]))++cnt;
		ans-=((mint(2)<<cnt)-cnt*(cnt+1)/2-1)/cnt/(cnt-1);
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	
	string S, T;
	cin >> S >> T;
	vector<int> exchange(26); const ll N = S.size();
	iota(ALL(exchange), 0);
	map<char, char> exmap;
	//FOR(i, 26) exmap[i + 'a'] = i + 'a';
	FOR(i, N) {
		//auto s = S[i] - 'a', t = T[i] - 'a';
		auto s = S[i] , t = T[i] ;
		if (exmap.find(s) == exmap.end()) {
			exmap[s] = t;
		}
		else {
			if (exmap[s] != t)
			{
				cout << "No" << endl;
				exit(0);
			}
		}
	}
	//////////////////////////////////////////////////////////////////////////////

//  
//////////////////////////////////////////////////////////////////////////////

	exmap.clear();
	FOR(i, N) {
		auto s = S[i], t = T[i];
		if (exmap.find(t) == exmap.end()) {
			exmap[t] = s;
		}
		else {
			if (exmap[t] != s)
			{
				cout << "No" << endl;
				exit(0);
			}
		}
	}

	cout << "Yes" << endl;
	exit(0);

	return 0;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifndef ONLINE_JUDGE
#define debug(a) cout<<#a<<" --> "<<(a)<<"\n";
#define debug2(a) cout<<#a<<" --> "<<(a)<<" ";
#define HERE cout<<"here - "<<__LINE__<<"\n";
#else
#define debug(a)
#define debug2(a)
#define HERE
#endif
const ll mod = 1e9+7;
const int N = 1e7+1;
typedef pair<int,int> pii;
ll divisors[N+2];
void Divisors()
{
    int n= N;
    int i;
    int j;
    for(i = 1; i*i <= n; i++)
    {
        for(j = i*i; j <= n; j += i)
        {
            divisors[j]++;
            if(i!=j/i)
                divisors[j]++;
        }
    }
}
void TEST_CASES(int cas)
{
    Divisors();
    ll n;
    scanf("%lld",&n);
    ll ans= 0;
    for(ll i=1;i<=n;i++)
    {
        ans+= i*divisors[i];
    }
    printf("%lld\n",ans);


}


/*


*/

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1,cas=0;
    //scanf("%d",&t);
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



//os.order_of_key(v): returns how many elements strictly less than v
//os.find_by_order()

template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p)
{
    os<<"{"<<p.first<<", "<<p.second<<"} ";
    return os;
}
template <class T>
ostream &operator <<(ostream &os, vector<T>&v)
{
    os<<"[ ";
    for(int i=0; i<v.size(); i++)
    {
        os<<v[i]<<" " ;
    }
    os<<" ]";
    return os;
}

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


Measured memory_bytes: 81904
n,a,b = map(int,input().split())
mod = 10**9+7
def combination(N,K):
    bunsi = 1
    bunbo = 1
    for i in range(K):
        bunsi = bunsi*(N-i)%mod
        bunbo = bunbo*(i+1)%mod
    return bunsi*pow(bunbo,mod-2,mod)%mod
all_num = pow(2,n,mod)-1
ans = all_num-combination(n,a)-combination(n,b)
print(ans%mod)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
signed main()
{
	int N, Q;
	string S;
	cin >> N >> Q >> S;
	vector<int>l(Q), r(Q);
	rep(i, Q)cin >> l[i] >> r[i];
	vector<int>v(N + 1, 0);
	for(int i=2;i<=N;i++)
	{
		v[i] = v[i - 1] + (S[i - 2] == 'A' && S[i - 1] == 'C');
	}
	rep(i, Q)cout << v[r[i]] - v[l[i]] << endl;
}

Measured memory_bytes: 3456
#include <algorithm>
#include <vector>
#include<stdio.h>
#include <iostream>
#include<map>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
const int MAX_NODES = 6000;
const int INF = 2147483647;
ll mapa[5005][5005];
int nodes = MAX_NODES, src, dest;
int dist[MAX_NODES], cola[MAX_NODES], work[MAX_NODES];
struct E{
  int to, rev;
  ll flow, cap;
};
vector<E> gR[MAX_NODES];

void addEdge(int a, int b, ll c_to,ll c_rev){
  E e1 = {b, gR[b].size(), 0, c_to};
  E e2 = {a, gR[a].size(), 0, c_rev};
  gR[a].push_back(e1);
  gR[b].push_back(e2);
}
bool dinicBfs() {
  fill (dist,dist+nodes,-1);
  dist[src]=0;
  int fin=-1;
  cola[++fin]=src;
  int ini=0;
  while (ini<=fin){
    int u=cola[ini++];
    for (int i=0; i<(int)gR[u].size(); i++){
        E &e=gR[u][i];
        int v=e.to;
        if (dist[v]<0 && e.flow<e.cap){
            dist[v]=dist[u]+1;
            cola[++fin]=v;
        }
    }
  }
  return (dist[dest] >= 0);
}
ll dinicDfs(int u, ll f){
  if (u == dest) return f;
  for (int &i = work[u]; i < (int) gR[u].size(); i++) {
    E &e = gR[u][i];
    if (e.cap <= e.flow) continue;
    int v = e.to;
    if (dist[v] == dist[u] + 1) {
      ll df = dinicDfs(v, min(f, e.cap - e.flow));
      if (df > 0) {
        e.flow += df;
        gR[v][e.rev].flow -= df;
        return df;
      }
    }
  }
  return 0;
}

ll maxFlow(int _src, int _dest) {
  src = _src;
  dest = _dest;
  ll res = 0;
  while (dinicBfs()) {
    fill(work, work + nodes, 0);
    ll delta = dinicDfs(src, INF);
    res += delta;
  }
  return res;
}

int main() {

    int n,m,x,y;
    ll c;
    scanf("%d%d",&n,&m);
    nodes=n;
    for (int i=0; i<m; i++){
        scanf("%d%d%lld",&x,&y,&c);
        if (x!=y){
            mapa[x][y]+=c;
        }
    }
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++){
            if (mapa[i][j]>0) {
                addEdge(i,j,mapa[i][j],mapa[j][i]);
                mapa[i][j]=0; mapa[j][i]=0;
            }
        }

    }
    printf("%lld\n",maxFlow(0,n-1));
}

Measured memory_bytes: 3716
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
/* contest template */
int x,y;

int main()
{
    cin>>x>>y;
    if(x%y==0){
        cout<<-1<<endl;
    }
    else cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <utility>
#include <complex>
#include <stack>
#include <climits>
#include <set>
#include <numeric>

using namespace std;

int t[5];

bool straight()
{
	if(t[0] == 1 && t[1] == 10 && t[2] == 11 && t[3] == 12 && t[4] == 13) return true;
	for (int i = 0; i < 4; i++){
		if(t[i+1]-t[i] != 1) return false;
	}
	return true;
}

int main()
{
	while(~scanf("%d,%d,%d,%d,%d",t,t+1,t+2,t+3,t+4)){
		sort(t,t+5);
		if(t[0] == t[3] || t[1] == t[4])
			puts("four card");
		else if( (t[0] == t[1] && t[2] == t[4]) || (t[0] == t[2] && t[3] == t[4]))
			puts("full house");
		else if(straight())
			puts("straight");
		else if(t[0] == t[2] || t[1] == t[3] || t[2] == t[4])
			puts("three card");
		else if( (t[0] == t[1] && (t[2] == t[3] || t[3] == t[4])) || (t[1] == t[2] && t[3] == t[4]) )
			puts("two pair");
		else if( t[0] == t[1] || t[1] == t[2] || t[2] == t[3] || t[3] == t[4])
			puts("one pair");
		else 
			puts("null");
	}
	return 0;
}

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

int n; vector <ll> v;
ll memo[100001];

ll solve(int i){
  if(i == n-1) return 0;

  if(memo[i]!=-1) return memo[i];
  memo[i] = solve(i+1)+fabs(v[i]-v[i+1]);
  if(i != n-2) memo[i] = min(memo[i], solve(i+2)+abs(v[i]-v[i+2]));
  return memo[i];
}

int main(){
  scanf("%d", &n); v.resize(n);
  for(int i=0;i<n;i++) scanf("%lld", &v[i]);
  memset(memo, -1, sizeof memo);
  printf("%lld\n", solve(0));
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
typedef long long ll;
#define fr first
#define sc second

using namespace std;
const int MN = 3e2+7;

int a[MN], cnt[5];
double dp[MN][MN][MN];

signed main(){
    int n;
    cin >> n;
    cout << setprecision(16);
    for(int k = 0; k < MN; k++){
        if(k > n)break;
        for(int j = 0; j < MN; j++){
            if(j > n)break;
            for(int i = 0; i < MN; i++){
                if(i > n)break;
                if(k+j+i > n)break;
                double z = i+j+k;
                if(z == 0){
                    //cout << "0, 0, 0 : 0\n";
                    dp[k][j][i] = 0;
                    continue;
                }
                //printf("%d, %d, %d : ", k, j, i);
                dp[k][j][i] = n/z;
                if(i)dp[k][j][i] += dp[k][j][i-1] * (i/z);
                if(j)dp[k][j][i] += dp[k][j-1][i+1] * (j/z);
                if(k)dp[k][j][i] += dp[k-1][j+1][i] * (k/z);
                //cout << dp[k][j][i] << endl;
            }
            //cout << "-\n";
        }
        //cout << "***********\n";
    }
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cnt[a[i]]++;
    }
    cout << dp[cnt[3]][cnt[2]][cnt[1]];
}


Measured memory_bytes: 221440
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.StringTokenizer

fun main(args: Array<String>) {
    val sc = FastScanner(System.`in`)

    val r = sc.nextInt()
    val g = sc.nextInt()
    println(2 * g - r)


}


class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}




Measured memory_bytes: 29344
s=input()
a,b=[],[]
for i in range(len(s)):
    if i%2==0:
        a.append("0")
        b.append("1")
    else:
        a.append("1")
        b.append("0")
a_cnt=0
for i in range(len(s)):
    if s[i] != a[i]:
        a_cnt += 1
b_cnt=0
for i in range(len(s)):
    if s[i] != b[i]:
        b_cnt+=1
print(min(a_cnt, b_cnt))

Measured memory_bytes: 4852