akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <time.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)

vector<ll> v;
void solve()
{
    int n;
    cin >> n;
    v.assign(n, 0);
    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    
    ll res = inf;
    for(ll i = -100; i <= 100; i++)
    {
        ll temp = 0;
        for(int k = 0; k < n; k++)
        {
            temp += (i - v[k]) * (i - v[k]);
        }
        res = min(res, temp);
    }
    cout << res << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    solve();
    return 0;
}

Measured memory_bytes: 256
package main

import (
    "fmt"
)

func sumSlice(x []int) int {
    var sum int
    for _, i := range x {
        sum += i
    }
    return sum
}

func main() {
    var n int
    fmt.Scanf("%d", &n)
    var w []int = make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &w[i])
    }

    var abs int = 9999999
    for t := 0; t < n - 1; t++ {
        diff := sumSlice(w[:t+1]) - sumSlice(w[t+1:])

        if diff < 0 {
            diff *= -1
        }
        if abs > diff {
            abs = diff
        }
    }
    fmt.Printf("%d\n", abs)
}

Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

void split(string s, vector<string>&v){
    string tmp = "";
    for(int i = 0; i < s.size(); i++){
        if(s[i] == '"'){
            v.push_back(tmp);
            tmp = "";
        }
        else tmp += s[i];
    }
    if(tmp.size())v.push_back(tmp);
}

int main(){

    for(string s1;cin>>s1;){
        if(s1==".")break;
        string s2;
        cin >> s2;
        int cnt = 0;
        vector<string>v1, v2;
        split(s1, v1);
        split(s2, v2);
        if(v1.size() == v2.size()){
            for(int i = 0; i < v1.size(); i++){
                if(v1[i] != v2[i]){
                    if(i%2)cnt++;
                    else cnt = 2;
                }
            }
        }
        else{
            cnt = 2;
        }
        if(cnt == 0)cout << "IDENTICAL" << endl;
        if(cnt == 1)cout << "CLOSE" << endl;
        if(cnt > 1)cout << "DIFFERENT" << endl;
        
    }

    return 0;
}


Measured memory_bytes: 3188
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int arr[4];
int main()
{
    int n; cin >> n;
    string s;
    
    for(int i = 0; i < n; i++)
    {
       cin >> s;
       if(s[0]=='A')
          arr[0]++;
       else if(s[0]=='W')
          arr[1]++;
       else if(s[0]=='T')
          arr[2]++;
       else if(s[0]=='R')
          arr[3]++;
    }

    cout << "AC x " << arr[0] << endl;
    cout << "WA x " << arr[1] << endl;
    cout << "TLE x " << arr[2] << endl;
    cout << "RE x " << arr[3] << endl;
}


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

int main()
{
    int n;
    cin >> n;
    long long ans = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 3 == 0 || i % 5 == 0)
            continue;
        ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
def extract(a, i):
  return (a>>(i+1) << i) | (a&((1<<i)-1))

def space(a, i):
  return ((a>>i) << (i+1)) | (a&((1<<i)-1))

def compose(n, a, b):
  if n==1:
    return [a, b]
  for i in range(n):
    if (a>>i&1) ^ (b>>i&1):
      x = i
      a_bool = (a>>i & 1) << i
      b_bool = a_bool ^ (1 << i)
      a_dash = extract(a, i)
      b_dash = extract(b, i)
      c = a_dash ^ 1
      break
  Q = compose(n-1, a_dash, c)
  R = compose(n-1, c, b_dash)
  n_Q = [space(i, x)|a_bool for i in Q]
  n_R = [space(i, x)|b_bool for i in R]
  return n_Q + n_R
  
n, a, b = map(int, input().split())
cnt = 0
c = a^b
for i in range(n):
  cnt += c>>i & 1
if cnt&1:
  print("YES")
  print(*compose(n, a, b))
else:
  print("NO")

Measured memory_bytes: 15228
MOD = 10**9+7
n, m = map(int, input().split())
dp = [0] * (n+1)
dp[0] = 1

# skip用 list
A = [0] * (n+1) 
for _ in range(m):
  broken = int(input())
  A[broken] = 1

# dp
for i in range(1, n+1):
  if A[i] == 1:
    dp[i] = 0
  else:
    dp[i] = (dp[i-1] + dp[i-2]) % MOD
    
print(dp[n])

Measured memory_bytes: 7668
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const int MOD = 1e9 + 7;

bool pairCompare(const pair<int, int>& firstElof, const pair<int, int>& secondElof) {
    return firstElof.first > secondElof.first;
}

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

    vector<string> S(H);
    for(int i=0;i<H;i++) {
        cin >> S.at(i);
    }
    vector<vector<int>> U(H, vector<int>(W));
    vector<vector<int>> D(H, vector<int>(W));
    vector<vector<int>> L(H, vector<int>(W));
    vector<vector<int>> R(H, vector<int>(W));

    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            if(S.at(i).at(j)=='#') {
                L.at(i).at(j) = 0;
            }
            else {
                if(j==0) L.at(i).at(j) = 1;
                else L.at(i).at(j) = L.at(i).at(j-1) + 1;
            }
        }
    }
    for(int i=0;i<H;i++) {
        for(int j=W-1;j>=0;j--) {
            if(S.at(i).at(j)=='#') {
                R.at(i).at(j) = 0;
            }
            else {
                if(j==W-1) R.at(i).at(j) = 1;
                else R.at(i).at(j) = R.at(i).at(j+1) + 1;
            }
        }
    }
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            if(S.at(i).at(j)=='#') {
                U.at(i).at(j) = 0;
            }
            else {
                if(i==0) U.at(i).at(j) = 1;
                else U.at(i).at(j) = U.at(i-1).at(j) + 1;
            }
        }
    }
    for(int i=H-1;i>=0;i--) {
        for(int j=0;j<W;j++) {
            if(S.at(i).at(j)=='#') {
                D.at(i).at(j) = 0;
            }
            else {
                if(i==H-1) D.at(i).at(j) = 1;
                else D.at(i).at(j) = D.at(i+1).at(j) + 1;
            }
        }
    }

    int ans = 0;
    for(int i=0;i<H;i++) {
        for(int j=0;j<W;j++) {
            ans = max(ans, U.at(i).at(j)+D.at(i).at(j)+L.at(i).at(j)+R.at(i).at(j)-3);
        }
    }

    cout << ans << endl;

    return (0);
}


Measured memory_bytes: 67200
fun main(args: Array<String>) {
    val (max, left, right) = readLine()!!.split(" ").map(String::toInt)
    var total = 0
    for (num in 1..max) {
        val subtotal = num.toString().sumBy { it.toString().toInt() }
        if (subtotal in left..right) total += num
    }
    print(total)
}

Measured memory_bytes: 40668
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;

const int MOD = 1000000007 ; //  , 1000000009 , 1000000023 ,998244353
const ll INF = ll(1e18);
const ld PI = 4*atan((ld)1);

ll power(ll x,ll n) {
  ll result=1;
  while(n>0){
    if(n&1)result = (result * x)%MOD;
    x=(x*x)%MOD;
    n >>= 1;
  }
  return result%MOD;
}

int main() {
  #ifdef AVI  
    freopen("input.txt" , "r" , stdin);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  ll n,d;
  cin >> n >> d;
  vector<vector<ll>>ar(n,vector<ll>(d));
  for(ll i=0 ; i<n ; i++){
    for(ll j=0 ; j<d ; j++){
      cin >> ar[i][j];
    }
  }
  ll c=0;
  for(ll i=0 ; i<n ; i++){
    for(ll j=i+1 ; j<n ; j++){
      ld res = 0;
      for(ll k=0 ; k<d ; k++){
        res += (ar[j][k] - ar[i][k])*(ar[j][k] - ar[i][k]);
      }
      ld x = sqrt(res)*1.0000;
      if(floor(x)==ceil(x))c++;
    }
  }
  cout << c;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
//#include<bits/stdc++.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<set>
#define  si(a)       scanf("%d",&a)
#define  sl(a)       scanf("%lld",&a)
#define  sii(a,b)    scanf("%d%d",&a,&b)
#define  sll(a,b)    scanf("%lld%lld",&a,&b)
#define  queues      priority_queue
#define mod 998244353
#define mem(a)  memset(a,0,sizeof(a));
#define def(a) ((a)&(-a))
#define fi  first
#define se  second
#define mp  make_pair
#define  pb push_back
typedef long long ll;
//priority_queue<int,vector<int >,greater<int > >q;
const ll INF=0x3f3f3f3f;
//const double E=exp(1);
//const double PI=acos(-1);
using namespace std;
int main()
{

    int x,y,z,k;
    cin>>x>>y>>z>>k; vector<ll>a(x),b(y),c(z),v;
    for(int i=0;i<x;i++)
        cin>>a[i];
    for(int i=0;i<y;i++)
        cin>>b[i];
    for(int j=0;j<z;j++)
        cin>>c[j];
    sort(a.begin(),a.end(),greater<ll>());
    sort(b.begin(),b.end(),greater<ll>());
    sort(c.begin(),c.end(),greater<ll>());
    for(int i=0;i<x;i++)
        for(int j=0;j<y;j++)
        for(int ii=0;ii<z;ii++)
    {
        if((i+1)*(j+1)*(ii+1)<=k)
            v.pb(a[i]+b[j]+c[ii]);
    }
    sort(v.begin(),v.end(),greater<ll>());
    for(int i=0;i<k;i++)
        cout<<v[i]<<endl;
}

/******************************************
**        **             ********       **
**       ** **           **             **
**      **   **          **             **
**     **     **         **             **
**    ***********        **             **
**   **         **       ********       **
******************************************/


Measured memory_bytes: 1404
module Main where

import Control.Applicative
import Control.Monad
import Data.List

ds :: [Int]
ds = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

main :: IO ()
main = do
    [a, b] <- fmap read . words <$> getLine
    let cs = do
        s <- [1 .. a]
        t <- if s == a then [1 .. b] else [1 .. ds !! (s - 1)]
        guard (s == t)
        return (s, t)
    print $ length cs

Measured memory_bytes: 508
use proconio::input;

const MOD: i64 = 1_000_000_007;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut sum = a.iter().fold(0, |a, x| (a + x) % MOD);
    let mut ans = 0;

    for i in 0..n {
        sum -= a[i];
        if sum < 0 {
            sum += MOD;
        }
        ans += a[i] * sum;
        ans %= MOD;
    }

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


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}

ll n;
double v[50000];
double rv[50000];

int main(){
	cin >> n;
	vector<P> vp(n);
	rep(i,n)cin >> vp[i].first;
	rep(i,n)cin >> vp[i].second;
	ll sum = 0;
	rep(i,n){
		ll t = vp[i].first * 2;
		ll vv = vp[i].second;
		for(ll i = sum+1;i <= sum+t;i++)v[i] = vv;
		for(ll i = sum;i < sum+t;i++)rv[i] = vv;
		sum += t;
	}
	for(ll i = 1;i <= sum;i++){
		v[i] = min(v[i-1]+0.5,v[i]);
	}
	for(ll i = sum-1;i >= 0;i--){
		rv[i] = min(rv[i+1]+0.5,rv[i]);
	}
	// for(ll i = sum;i >= 0;i--){
	// 	cout << (double)i*0.5 <<" "<< rv[i] << endl;
	// }
	double ans = 0;
	rep(i,sum){
		// cout << (double)i*0.5 <<" "<< min(rv[i],v[i]) << endl;
		double vv = min(rv[i],v[i]);
		double vv2 = min(rv[i+1],v[i+1]);
		ans += (min(vv,vv2)*0.5 + fabs(vv-vv2)*0.25);
	}
	printf("%.10lf\n",ans);
}

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;

#define INF INT_MAX
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define all(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define sz(a) int((a).size())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define clr(a) memset(a,0,sizeof(a))
#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);

template<class T> inline T gcd(T a,T b) //NOTES:__gcd(0,0) gives exception
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

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

/*bool sortby(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
    return (a.second < b.second);
}*/

const int MAX_N = 123456;

int arr[MAX_N];

int main() {
    int K;
    scanf("%d",&K);
    for(int i=0;i<K;i++) scanf("%d",arr+i);
    ll l=0,r=LLONG_MAX,ans,L,R;

    while(l<r){
        ll m=(r-l)/2+l;
        ans=m;
        for(int i=0;i<K;i++){
            ans=(ans/arr[i])*arr[i];
        }
        //printf("%lld ",l);
        if(ans<2) l=m+1; else r=m;
    }
    L=l;

    l=0;r=LLONG_MAX;
    while(l<r){
        ll m=(r-l)/2+l;
        ans=m;
        for(int i=0;i<K;i++){
            ans=(ans/arr[i])*arr[i];
        }
        //printf("%lld ",l);
        if(ans<=2) l=m+1; else r=m;
    }
    R=l-1;
    if(L>R){
        printf("-1\n");
        return 0;
    }
    printf("%lld %lld\n",L,R);
	return 0;
}


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



int main(void) {
	int Q, H, S, D, N;
	cin >> Q >> H >> S >> D >> N;

	if (Q*2 < H) H = Q*2;
	if (H*2 < S) S = H*2;
	if (S*2 < D) D = S*2;

	long long cost = (long long)D*(N/2);
	if (N%2==1) cost += S;

	cout << cost << endl;

	return 0;
}


Measured memory_bytes: 256
n,k = map(int,input().split())
arr = [0 for i in range(1,10**5+2)]
s = 0
for i in range(n):
    a,b = map(int, input().split())
    arr[a] += b
for i in range(1,10**5+1):
    s += arr[i]
    if k <= s:
        print(i)
        break


Measured memory_bytes: 45168
using System;
using System.Linq;

public class ABC152_B
{
    public static void Main()
    {
        int[] i = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int min = Math.Min(i[0], i[1]), max = Math.Max(i[0], i[1]);
        string result = "";
        for (int n = 0; n < max; n++) result += min;
        Console.WriteLine(result);
    }
}

Measured memory_bytes: 11348
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        String str1 = in.next();
        String str2 = in.next();
        String str3 = in.next();
        int a, b, c;
        a = Integer.parseInt(str1);
        b = Integer.parseInt(str2);
        c = Integer.parseInt(str3);
        if(a < b && b < c) {
        System.out.println("Yes");
        }else{
        System.out.println("No");
        }
    }
    
}

Measured memory_bytes: 26292
#include <stdio.h>

int main() {
  int a=0, b=0, c=0;
  scanf("%d %d %d", &a, &b, &c);
  if (a >= b && a >= c) printf("%d\n", a*10 + b + c);
  else if (b >= a && b >= c) printf("%d\n", b*10 + a + c);
  else if (c >= a && c >= b) printf("%d\n", c*10 + a + b);
  return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	final static double[] LV500 = { 35.5, 37.5, 40, 43, 50, 55, 70 };
	final static double[] LV1000 = { 71, 77, 83, 89, 105, 116, 148 };
	final static String[] lv = { "AAA", "AA", "A", "B", "C", "D", "E" };

	public static void main(String[] arg) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			double _500 = in.nextDouble();
			double _1000 = in.nextDouble();
			String s = "NA";
			for (int i = 0; i < 7; i++) {
				if (LV500[i] > _500 && LV1000[i] > _1000) {
					s = lv[i];
					break;
				}
			}
			System.out.println(s);
		}
	}
}

Measured memory_bytes: 20520
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  string s,t;
  cin >> t >> s;
  int n = s.size();
  int m = t.size();
  int ans = 1000;
  for(int i=0;i+n-1<m;i++){
    int cnt = 0;
    rep(j,n){
      if(s.at(j) != t.at(i+j)) cnt++;
    }
    ans = min(cnt, ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include<stdio.h>
#define MAX 10000
 
int main(void){
  int S[MAX],T[MAX],n,q,count=0,i,j;
   
  scanf("%d",&n);
 
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
 
  scanf("%d",&q);
 
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
  }
 
  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(S[j] == T[i]){
    count++;
    break;
      }
    }
  }
  printf("%d\n",count);
  return 0;  
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 7, MAXS = 3000 ;
int n, m, s;
unsigned int dp[MAXN * MAXN + 2][MAXS + 10], UB = 100000;

int main()
{

    while(cin >> n >> m >> s && n)
    {
        memset(dp, 0, sizeof(dp));
        dp[0][0] = 1;

        for(int i_m = 1; i_m <= m; i_m++)
            for(int i_n = n * n + 1; i_n > 0; i_n--)
                for(int i_s = s; i_s > 0; i_s--)
                        if(i_s - i_m >= 0) 
                            dp[i_n][i_s] = 
                                (dp[i_n][i_s] + dp[i_n - 1][i_s - i_m]) % UB;
        
        //rep(i,n*n){rep(j,s) cout << dp[i][j] << ","; cout << endl;}

        cout << dp[n * n][s] << endl;
    }
    return 0;
}

Measured memory_bytes: 1764
def main():
    S = input()
    T = input()
    from collections import defaultdict
    tran = defaultdict(set)
    rtran = defaultdict(set)
    for s, t in zip(S, T):
        tran[s].add(t)
        rtran[t].add(s)
    if all(len(v) <= 1 for v in tran.values()) and \
            all(len(v) <= 1 for v in rtran.values()):
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 41840
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

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

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}


int main(){
    int N;
    string S,T;
    cin >> N >> S >> T;
    string ST;
    int count = 0;
    for(int i=0;i<N*2;i++){
        ST[i] = S[count];
        i++;
        ST[i] = T[count];
        count++;
    }
    rep(i,2*N){
        cout << ST[i];
    }
    cout <<  endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N;
  int A, B;
  cin >> N;
  if(N == 1){
    cout << "Hello World" << endl;
  }else if(N == 2){
    cin >> A;
    cin >> B;
    cout << A + B << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
#define dame { printf("No\n"); return 0;}
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)



vector<pair<llong,llong>> factoring(llong n){
    vector<pair<llong,llong>> ans;
    if( n== 1){
        ans.push_back( make_pair(1,1));
        return ans;
    }
    llong i=1;
    while(1){
        i+=1;
        if( i * i > n) break;
        pair<llong,llong> tmp;
        tmp.first=i;
        tmp.second=0;
        while(1){
            if(n%i != 0) break;
            n/=i;
            tmp.second+=1;
        }
        if(tmp.second!=0) ans.push_back(tmp);
    }
    if(n!=1) ans.push_back( make_pair(llong(n),llong(1)));
    return ans;

}

signed main(){
    int n;
    cin >> n;
    if(n == 1){
        cout << 0 << endl;
        return 0;
    }
/*
    vector<pair<llong,llong>> fac = factoring(n);


    int res = -1;
    int kosu = 1;
    int wa = 1;

    itrfor(itr,fac){
        kosu *= itr->se + 1;
        int tmp = 1;
        int su = 0;
        int aa = itr->fi;
        REP(j,itr->se + 1){
            su += tmp;
            tmp *= aa;
        }
        wa *= su;
    }
    
    if(n %2 == 1){
    cout << wa - kosu  << endl;
    }
    else{
    cout << wa - kosu -1 << endl;        
    }

*/
    int ans = 0;
    FOR(i,1,n){
        if( (i-1) * (i-1) >n ) break;
        if( n % i ==0){
            int m = n / i -1;
            if(i < m) ans += m;
        }

    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>


int main(void){
    double hi;
    int n;
    int popul[6];
    
    for (int i=0; i<6; i++) popul[i]=0;
    scanf("%d", &n);
    for (int i=0; i<n; i++){
        scanf("%lf", &hi);
        popul[(int)(hi-160)/5]++;
    }
    for (int i=0; i<6; i++){
        printf("%d:", i+1);
        for (int j=0; j<popul[i]; j++){
            printf("*");
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1068
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
typedef long long ll;

int main()
{
	int n,m;
	scanf("%d%d", &n,&m);
	int h[n+1];
	int a[m+1],b[m+1];
	int i = 1;
	int log[n+1];
	while (i <= n)
	{
		scanf("%d",&h[i]);
		log[i] = i;
		i++;
	}
	i = 1;
	while (i <= m)
	{
		scanf("%d",&a[i]);
		scanf("%d",&b[i]);
		i++;
	}
	i = 1;
	int j = 1;
	while (i <= m)
	{
		if (h[a[i]] <= h[b[i]])
			log[a[i]] = -1;
		if (h[b[i]] <= h[a[i]])
			log[b[i]] = -1;
		i++;
	}
	i = 1;
	int cnt = 0;
	while (i <= n)
	{
		if (i == log[i])
			cnt++;
		i++;
	}
	printf("%d\n", cnt);
	return (0);
}


Measured memory_bytes: 3712
N, K = map(int, input().split())
H = list(map(int, input().split()))
H = [H[0]]*K+H
def solve(H):
    dp = [0]*(N+K)
    for i in range(K,N+K):
        dp[i]= 10**10
        for j in range(1,K+1):
            dp[i] = min(dp[i],dp[i-j]+abs(H[i]-H[i-j]))
    ans = dp[-1]
    return ans
print(solve(H))

Measured memory_bytes: 52576
import math as m

Z = 10 ** 9 + 7


def calc(N, K):
    M = N - K + 1
    M_fact = m.factorial(M)
    K1_fact = m.factorial(K - 1)
    result = ''
    for i in range(1, K + 1):
        if (M - i < 0):
            val = 0
        else:
            val = M_fact // m.factorial(i) // m.factorial(M - i) * \
                K1_fact // m.factorial(i - 1) // m.factorial(K - i)
        result += "{}\n".format(
            val if val < Z else val % Z
        )
    print(result)


s = input().split(' ')
N = int(s[0])
K = int(s[1])

calc(N, K)


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

using namespace std;

namespace {

    typedef double real;
    typedef long long ll;

    template<class T> ostream& operator<<(ostream& os, const vector<T>& vs) {
        if (vs.empty()) return os << "[]";
        os << "[" << vs[0];
        for (int i = 1; i < vs.size(); i++) os << " " << vs[i];
        return os << "]";
    }
    template<class T> istream& operator>>(istream& is, vector<T>& vs) {
        for (auto it = vs.begin(); it != vs.end(); it++) is >> *it;
        return is;
    }

    void solve() {
        ll a, b;
        cin >> a >> b;
        if (a * b <= 0) {
            cout << "Zero" << endl;
        } else {
            if (a > 0) {
                cout << "Positive" << endl;
            } else {
                if ( (b - a + 1) % 2 == 1 ) {
                    cout << "Negative" << endl;
                } else {
                    cout << "Positive" << endl;
                }
            }
        }
    }
}

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



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


int main()
{
	int n, a[102], maxa = -1;
	fill(a, a + 101, 0);
	while ((scanf("%d", &n))!=EOF){
		a[n]++;
	}
	for (int i = 1; i <= 100; i++){
		maxa = max(maxa, a[i]);
	}
	for (int i = 1; i <= 100; i++){
		if (a[i] == maxa){
			cout << i << endl;
		}
	}
	return 0;
}

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

int main() {
  vector<int> pn;
  int N, K;
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    int temp;
    cin >> temp;
    pn.push_back(temp);
  }
  sort(pn.begin(), pn.end());
  int output = 0;
  for(int i = 0; i < K; i++) {
    output += pn[i];
  }
  cout << output << endl;
  return 0;
}


Measured memory_bytes: 3196
import java.util.*;
 
public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
   		int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();

    while(true){
      C -= B;
      if(C <= 0){
        System.out.println("Yes");
        break;
      }     
      A -= D;
      if(A <= 0){
        System.out.println("No");
        break;
      }
    }
  }
}

Measured memory_bytes: 35724
N, X = map(int, input().split())
s_list = list(map(int, input().split()))

s_list.sort(reverse=True)

mod = 10 ** 9 + 7

dp = [[0] * (X + 1) for _ in range(N + 1)]
dp[0][X] = 1

for i in range(N):
    for x in range(X + 1):
        if dp[i][x] == 0:
            continue
        s = s_list[i]
        dp[i + 1][x % s] += dp[i][x]
        dp[i + 1][x % s] %= mod
        dp[i + 1][x] += dp[i][x] * (N - i - 1)
        dp[i + 1][x] %= mod

ans = 0
for x in range(1, X + 1):
    ans += dp[N][x] * x
    ans %= mod
print(ans)


Measured memory_bytes: 192152
n, k = map(int, input().split())
okashi = []
for _ in range(2 * k):
    okashi.append(list(map(int, input().split())))

flag = [0] * n
for i in range(int(len(okashi) / 2)):
    i = 2 * i + 1
    for j in okashi[i]:
        flag[j-1] = 1
count = 0
for i in flag:
    if i == 0:
        count += 1

print(count)

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

int main(){
  ll n, m;
  cin >> n >> m;
  
  if(2*n >= m){
    cout << m / 2 << endl;
  }else{
    long long ans = n + (m - 2*n) / 4; 
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <functional>
/*
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
*/
using namespace std;
#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vpii        vector<pii>
#define mi          map<int,int>
#define vii         vector<vector<int>>
#define mpii        map<pii,int>
#define piii        pair<int,pair<int,int> >
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define PI          3.141592653589
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define rf(s)       for(auto &c : s)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++) //use Iterator
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define ef else if

/*template<class T>
T big(T a, T b) { return a>b ? a : b; }
int gcd(int a, int b) {  if (a == 0)  return b; return gcd(b % a, a); } 
int lcm(int a, int b) { return (a*b)/gcd(a,b); } 
bool mod(double a,double b) {return a/b - floor(a/b);}
int occurs(vi v,int n)  {  auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}
int logb(int base, int x) {return (log(x) / log(base));}
int pow(int n, int m){
    int ans=1;
    fo(i,0,m){
        ans*=n;
    }return ans;
}
int factors(int ans){
    int count=0;
    for (int i=1; i<=sqrt(ans); i++) { 
        if (ans%i == 0) 
        {if (ans/i == i) count++;
            else count+=2;} 
    }
    return count;     
}
bool isSubSequence(string str1, string str2, int m, int n)  // str1<str2
{ 
  
    if (m == 0) return true; 
    if (n == 0) return false; 
  
  	if (str1[m-1] == str2[n-1]) 
        return isSubSequence(str1, str2, m-1, n-1); 
  
    return isSubSequence(str1, str2, m, n-1); 
} */

signed main()
{
tezz;
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
	cin>>a[i];	
}
int max=0,c=0;
for(int i=0;i<n;i++)
{
	if(max<=a[i])
	{
		max=a[i];
		c++;
	}
}
cout<<c<<endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
    while (true) {
        int n;
        cin >> n;
        if(n==0) break;
        bool flags[2*n+1];
        repi(i,2,2*n+1) flags[i]=true;
        repi(i,2,2*n+1){
            if(flags[i]){
                for(int j=i*2;j<2*n+1;j+=i){
                    flags[j]=false;
                }
            }
        }
        int ans=0;
        repi(i,n+1,2*n+1) if(flags[i]) ans++;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3304
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair
#define endl '\n'
#define _ << ' '
#define min3(a, b, c) min(a, min(b, c))
#define min4(a, b, c, d) min(min(a, d), min(b, c))

using namespace std;
const ll mod = (ll)1e9+7;
const ll INF = (ll)1e9+1;

ll n, ans=0;
int dist[301][301];
int v[301][301];

void R(int i, int j)
{
    bool ok=1;
    for(int k=1; k<=n; k++)
    {
        if(i==k||j==k) continue;
        if(dist[i][k]+dist[k][j]==dist[i][j])
        {
            if(!v[i][k]) R(i, k);
            if(!v[k][j]) R(k, j);
            ok=0;
        }
    }
    if(ok) ans += dist[i][j];
    v[i][j]=1; v[j][i]=1;
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    //freopen("B.txt", "r", stdin);
    #endif
    cin >> n;
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            cin >> dist[i][j];
        }
    }
    for(int k=1; k<=n; k++)
    {
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=n; j++)
            {
                if(dist[i][k]+dist[k][j]<dist[i][j])
                {
                    cout << -1;
                    return 0;
                }
            }
        }
    }
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=n; j++)
        {
            if(!v[i][j])
            {
                R(i, j);
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define mod 1000000007
#define pub(a) push_back(a)
#define mp(a,b) make_pair(a,b)


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    ll h[n+1];
    for(ll i =1;i<=n;i++){
        cin>>h[i];
    }
    ll dp[n+1];
    dp[0]= dp[1] =0;
    dp[2] = abs(h[2]-h[1]);
    for(ll i = 3;i<=n;i++){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout<<dp[n];

    return 0;
}

Measured memory_bytes: 5212
///ComentaryAC
#include <iostream>
using namespace std;

int main() {
    int n;
    int d[110];
    cin >> n;
    for (int i=0;i<n;++i) cin >> d[i];
    int num[110]={0};
    for (int i=0;i<n;++i){
        num[d[i]]++;
    }
    int res = 0;
    for (int i = 1; i<=100; ++i){
        if (num[i]) {
            ++res;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

ll bit[200010];
int max_n = 200000;
int pm = 0;
void add(int x) {

	while (max_n >= x)
	{
		bit[x]++;
		x += x & -x;
	}
}
void sub(int x) {
	while (max_n >= x)
	{
		bit[x]--;
		x += x & -x;
	}
}
int search(int x) {

	int k = 0;
	int p = 1;
	while (p * 2 <= max_n)
	{
		p *= 2;
	}
	for (int i = p; i > 0; i /= 2)
	{
		if (i + k < max_n && bit[i + k] < x) {
			x -= bit[i + k];
			k += i;
		}
	}
	return k + 1;
}
void solv() {
	while (true)
	{
		string s;
		cin >> s;
		if (s == "0") break;
		int sum = 0;
		for (size_t i = 0; i < s.size(); i++)
		{
			sum += s[i] - '0';
		}
		printf("%d\n", sum);
	}


}
int main() {
	//	COMinit();
	solv();
	return 0;
}



Measured memory_bytes: 3284
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;

int main() {
  ll n, k;
   cin >> n >> k;
   vector<ll> v(n);
   for (int i = 0; i < n; i++) cin >> v[i];
 
   ll ans = 0;
   for (int i = 0; i < n; i++) {
     ll migi = 0, zentai = 0;
     for (int j = i; j < n; j++)
       if (v[i] > v[j]) migi++;
     for (int j = 0; j < n; j++)
       if (v[i] > v[j]) zentai++;
 
     ans += migi * k % MOD;
     ans %= MOD;
     ans += (k - 1) * k / 2 % MOD * zentai % MOD;
     ans %= MOD;
   }
   cout << ans << endl;
}

Measured memory_bytes: 3616
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])
    
def main():
    h,w,k=inpm()
    s=[]
    for _ in range(h):
        s.append(list(input()))
    ans=[[0 for _ in range(w)] for _ in range(h)]
    p=1
    key = 0
    key2=0
    key3=0
    for i in range(h):
        for j in range(w):
            if s[i][j]=='#':
                if key == 0:
                    key = 1
                else:
                    p+=1
            ans[i][j]=p
            if j==w-1:
                if key == 0:
                    if i!=0:
                        key3=1
                        for k in range(w):
                            ans[i][k]=ans[i-1][k]
                    else:
                        key2=1
                else:
                    if key2==1:
                        key2=0
                        for k in range(i):
                            for l in range(w):
                                ans[k][l]=ans[i][l]
                key=0
        if key3==0 and key2==0:
            p+=1
        key3=0
    for i in range(h):
        print(*ans[i])




if __name__ == "__main__":
    main()

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> piipii;

#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define eb emplace_back

int dp[300005];
vector<pii> g[300005];
vector<pii> edge[1000005];
int p[100005];
int idx[100005];
int root(int a){
    return p[a] == a?a:(p[a]=root(p[a]));
}
void merge(int a, int b){
    a = root(a), b = root(b);
    if(a != b) p[a] = b;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);   
    int n, m;
    cin >> n >> m;
    for(int i=1;i<=n;i++) p[i] = i;
    for(int i=1;i<=m;i++){
        int a, b, c;
        cin >> a >> b >> c;
        edge[c].eb(mp(a, b));
    }
    int cnt = n+1;
    for(int i=1;i<=1000000;i++){
        vector<int> v;
        for(int j=0;j<sz(edge[i]);j++){
            int a = edge[i][j].fi, b = edge[i][j].se;
            merge(a, b);
            v.eb(a), v.eb(b);
        }
        sort(all(v));
        v.erase(unique(all(v)), v.end());
        for(int i=0;i<sz(v);i++){
            int u = v[i];
            if(root(u) == u) idx[u] = cnt++;
        }
        for(int i=0;i<sz(v);i++){
            int u = v[i];
            g[u].eb(mp(idx[root(u)], 1));
            g[idx[root(u)]].eb(mp(u, 0));
        }
        for(int i=0;i<sz(v);i++) p[v[i]] = v[i];
    }
    deque<pii> dq;
    memset(dp, -1, sizeof(dp));
    dp[1] = 0;
    dq.push_front(mp(dp[1], 1));
    while(!dq.empty()){
        int u = dq.front().se;
        int val = dq.front().fi;
        dq.pop_front();
        if(val != dp[u]) continue;
        for(int i=0;i<sz(g[u]);i++){
            int v = g[u][i].fi, w = g[u][i].se;
            if(dp[v] == -1 || dp[v] > dp[u] + w){
                dp[v] = dp[u] + w;
                if(w == 0) dq.push_front(mp(dp[v], v));
                else dq.push_back(mp(dp[v], v));
            }
        }
    }
    printf("%d\n", dp[n]);
}

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

#define sz(x) (int)(x.size())
#define FOR(i,L,R) for(int i = L; i <= R; i++)
#define int long long

const int N = 2e5 + 2, inf = 1e18;

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

    int d, t, s;
    cin >> d >> t >> s;
    int dist = t * s;
    cout << (dist >= d ? "Yes" : "No") << '\n';
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		while (true) {
			String ins = scan.next();
			int n = scan.nextInt();

			for (int rep = 0; rep < n; rep++) {
				String op = scan.next();
				int a = scan.nextInt();
				int b = scan.nextInt();
				if (op.equals("print")) {
					System.out.println(ins.substring(a, b + 1));
				} else if (op.equals("replace")) {
					String r = scan.next();
					String ans = "";
					if (a > 0)
						ans = ans.concat(ins.substring(0, a));
					ans = ans.concat(r);
					if (b + 1 < ins.length())
						ans = ans.concat(ins.substring(b + 1, ins.length()));
					ins = ans.substring(0, ans.length());
				} else if (op.equals("reverse")) {
					String ans = "";
					if (a > 0)
						ans = ans.concat(ins.substring(0, a));
					for (int i = b; i >= a; i--)
						ans = ans.concat(ins.substring(i, i + 1));
					if (b + 1 < ins.length())
						ans = ans.concat(ins.substring(b + 1, ins.length()));
					ins = ans.substring(0, ans.length());

				}
			}
			break;
		}
		scan.close();
		System.exit(0);
	}

}

Measured memory_bytes: 40616
def main():
    N = int(input())
    A = list(map(int, input().split()))

    cnt = 1
    ans = 0
    for i in range(N):
        if cnt == A[i]:
            cnt += 1
            ans += 1
    
    if ans == 0:
        print(-1)
    else:
        print(N-ans)




if __name__ == "__main__":
    main()

Measured memory_bytes: 77516
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

int main(int argc, char const *argv[]){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a == b && b == c)	printf("1\n");
	else if(a == b || a == c || b == c)	printf("2\n");
	else printf("3\n");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;
int main() {
    int i,j,n,b,c,x,y;
    int flag=0;
    int count10000=0;
    int count5000=0;
    int count1000=0;
    int sum=0;
    int souwa=0;
    int max=0;
    int temp;
    cin>>n>>y;
    for(i=0; i<=n; ++i){
        for(j=0; j<=n; ++j){
            temp=y-10000*i-5000*j;
            if(temp<0){break;}
            if((10000*i+5000*j+temp==y)&&(i+j+temp/1000==n)){cout<<i<<" "<<j<<" "<<temp/1000;flag=1;break;}
        }
        if(flag==1)break;
    }
    if(flag==0){cout<<-1<<" "<<-1<<" "<<-1;}

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

// type graph [][]int

func main() {
	var N int
	fmt.Scan(&N)

	graph1 := make([][]int, N+1)

	for i := 2; i <= N; i++ {
		ai := 0
		fmt.Scan(&ai)
		graph1[ai] = append(graph1[ai], i)

	}
	// fmt.Println(graph1)
	for i := 1; i <= N; i++ {
		fmt.Println(len(graph1[i]))
	}
}


Measured memory_bytes: 14896
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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 int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
ll N;
ll A[2020];
ll dp[2020][2020];
pair<ll, ll> AA[2020];

int main()
{
    cin >> N;
    rep(i, 0, N)
    {
        cin >> A[i];
        AA[i] = make_pair(A[i], i);
    }

    sort(AA, AA + N);
    reverse(AA, AA + N);

    ll ans = 0;
    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N - i; j++)
        {
            auto next = AA[i + j - 1];
            if (i == 0 && j == 0)
            {
                dp[i][j] = 0;
            }
            else if (j == 0)
            {
                dp[i][j] = dp[i - 1][j] + next.first * abs(next.second - (i - 1));
            }
            else if (i == 0)
            {
                dp[i][j] = dp[i][j - 1] + next.first * abs((N - 1) - next.second - (j - 1));
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j] + next.first * abs(next.second - (i - 1)), dp[i][j - 1] + next.first * abs((N - 1) - next.second - (j - 1)));
            }
            chmax(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}


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

int main() {
    int N, S = 0;
    cin >> N;
    int a[N];
    for (int i = 0; i < N; i++){
        cin >> a[i]; S += a[i];
    }
    S = (S >= 0) ? (int)(S/(float)N+0.5) : (int)(S/(float)N-0.5);
    int ans = 0;
    int buf;
    for (int i = 0; i < N; i++) {
        buf = a[i] - S;
        ans += buf * buf;
    }
    cout << ans << endl;
}


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

const int Max = 402, inf = 1e17;
int arr[Max], memo[Max][Max], prefix[Max];

int solve(int l, int r) {
    if(l > r) return inf;
    if(l == r) return 0;
    if(l+1 == r) return arr[l] + arr[r];
    if(memo[l][r] != -1) return memo[l][r];
    int res = inf;
    for(int split = l; split < r; ++split) {
        res = min(res, solve(l, split) + solve(split+1, r));
    }
    return memo[l][r] = res + prefix[r] - (l-1 >= 0 ? prefix[l-1] : 0);
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> arr[i];
        for(int j = 0; j < n; ++j) {
            memo[i][j] = -1;
        }
    }
    prefix[0] = arr[0];
    for(int i = 1; i < n; ++i) {
        prefix[i] = prefix[i-1] + arr[i];
    }
    cout << solve(0,n-1) << '\n';
    return 0;
}


























Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
	int n, w; cin>>n>>w;
	int wt[n+1], value[n+1]; 
	for(int i=0;i<n;i++){
		cin>>wt[i]>>value[i]; 
	}
	int dp[w+1];
	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++){
		for(int j=w;j>=wt[i-1];j--){
			dp[j] = max(dp[j], dp[j-wt[i-1]] + value[i-1]);
		}
	} 
	cout << dp[w] << endl;
}

Measured memory_bytes: 4348
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
  long long a,b,c;
  cin>>a>>b>>c;
  long long s,t,u;
  s=a+b;
  t=a+c;
  u=b+c;
  if(s<t&&s<u){
    cout<<s<<endl;
  }
  else{
    if(t<s&&t<u){
		cout<<t<<endl;
    }
    else{
      cout<<u<<endl;
    }
  }
  
}
  


Measured memory_bytes: 256