akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <sstream>
#include <algorithm>

using namespace std;

template<typename T>
void dabaa(vector<T> vec){
    for(int i = 0;i < vec.size();i++){
        cout << vec[i] << ",";
    }
    cout << "\n";
}
template<typename T>
void dabaa(vector<vector<T>> vec){
    for(int i = 0;i < vec.size();i++){
        dabaa<T>(vec[i]);
    }
}

vector<string> split(const string str,const vector<int> pos){
    vector<string> vec;
    vec.push_back(str.substr(0,pos.front()));
    for (int it = 0;it < pos.size() - 1; it++){
        vec.push_back(str.substr(pos[it],pos[it + 1] - pos[it]));

    }
    // vec.push_back(str.substr(pos[pos.size() - 1],str.size() - pos[pos.size() - 1]) );
    vec.push_back(str.substr(pos.back(),str.size() - pos.back()));

    return vec;
}

int main(){
    string str;
    cin >> str;
    // str = "9999999999";

    
    // cout << str.length() << "\n";
    int n = str.length();
    
    long int sum = 0;
    vector<vector<string>> vec_candi;

    
    for (int bit = 1; bit < (1 << (n )); bit++){
        vector<int> S;
        vector<string> str_item;
        
        int sum1 = 0;
        int pre = 0;
        for(int i = 0; i < n ;i++){
            
            if((bit >> i) & 1){
                S.push_back(i);
                // string s =  str.substr(pre,i - pre + 1);
                // sum1 += stoll(s);
                // pre = i + 1;
                // cout << i << ",";
                
                // cout << str[i] << "\n";
                // sum += str[i] - '0';
            }

        }
        // dabaa<int>(S);
        
                
        str_item = split(str,S);
        // dabaa<string>(str_item);
        
        for(int i = 0;i < str_item.size();i++){
            if(str_item[i] == ""){
                str_item.erase(str_item.begin() + i);
            }
        }

        // dabaa<string>(str_item);
        vec_candi.push_back(str_item);
        
    }
    // cout << "重複削除前\n";

    // dabaa<string>(vec_candi);


    sort(vec_candi.begin(),vec_candi.end());
    vec_candi.erase(unique(vec_candi.begin(),vec_candi.end()),vec_candi.end());
    
    // cout << "重複削除後\n";
    // dabaa<string>(vec_candi);

    for(int i = 0;i < vec_candi.size();i++){
        for(int j = 0;j < vec_candi[i].size();j++){
            sum += stoll(vec_candi[i][j]);
        }
    }
    
    cout  << sum <<"\n";
    
}


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

using namespace std;


long long int DP[3001][3001][2];

long long int maximizexminusy(long long int *arr,int n,int i,int j,int turn){

    if(i>j)
    return 0; 

     if(DP[i][j][turn]!=-1)
  return DP[i][j][turn];


   else{


    if(turn==0)
     return DP[i][j][turn]=max(arr[i]+maximizexminusy(arr,n,i+1,j,1),arr[j]+maximizexminusy(arr,n,i,j-1,1));
    
    else
     return DP[i][j][turn]=min(maximizexminusy(arr,n,i+1,j,0),maximizexminusy(arr,n,i,j-1,0));


   }

  //return DP[i][j][turn];



}


int main(){



  int n;

  cin>>n;

  long long int arr[n];
  long long int sum=0;

  for(int i=0;i<n;i++){
  	cin>>arr[i];
  	sum+=arr[i];
  }

 memset(DP,-1,sizeof DP);
  
  long long int x=maximizexminusy(arr,n,0,n-1,0);
  //cout<<x;
  
  long long int y=sum-x;

   cout<<(x-y)<<endl;
   

	return 0;
}

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

long long N;
vector<long long> A;
vector<long long> B;
int main(){
	cin >> N;
	for(long long i = 0; i < N; i++){
		long long a,b;
		cin >> a >> b;
		A.push_back(a);
		B.push_back(b);
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());


	if(N%2 == 1){
		long long left = A[N/2];
		long long right = B[N/2];
		//cout << "left: " << left << endl;
		//cout << "right: " << right << endl;
		cout << right - left + 1 << endl;
		return 0;
	}

	long long left1 = A[N/2 - 1];
	long long right1 = B[N/2 - 1];
	long long left2 = A[N/2];
	long long right2 = B[N/2];
	//cout << "left1: " << left1 << endl;
	//cout << "right1: " << right1 << endl;
	//cout << "left2: " << left2 << endl;
	//cout << "right2: " << right2 << endl;
	cout << right1 + right2 - left1 - left2 + 1 << endl;
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define fl(i,a,b) for(int i = a; i < b; i++)
#define fli(i,a,b,k) for(int i = a; i < b; i += k)

using namespace std;

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

int main() {
    int h, w, d, a, con = 300*300+7;
    cin >> h >> w >> d;
    
    
    int dist[con] = {0}, x[con], y[con];
    fl(i,1,h+1) {
        fl(j,1,w+1) {
            cin >> a;
            x[a] = i; y[a] = j;
            dist[a] = 0;
        }
    }    
    // cout << "\n";
    for(int i = d+1; i <= h*w; i++) {
        dist[i] = dist[i-d] + abs(y[i]-y[i-d]) + abs(x[i]-x[i-d]);
        // cout << i << ": " << x[i] << "," << y[i] << ": " << dist[i] << "\n";
    }
    
    int q; cin >> q;
    int l,r;
    while(q--) {
        cin >> l >> r;
        cout << dist[r] - dist[l] << "\n";
    }

    return 0;
}

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

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

int n;
string s;

bool can;

string gen(string str) { //最初の2匹から一意的に決めるためのgenerator

	for (int i = 2; i < n; i++) {
		if (str[i - 1] == 'S' && s[i - 1] == 'o') str += str[i - 2];
		else if (str[i - 1] == 'S' && s[i - 1] == 'x') {
			if (str[i - 2] == 'S') str += 'W';
			else str += 'S';
		}
		else if (str[i - 1] == 'W' && s[i - 1] == 'o') {
			if (str[i - 2] == 'S') str += 'W';
			else str += 'S';
		}
		else if (str[i - 1] == 'W' && s[i - 1] == 'x') {
			str += str[i - 2];
		}
	}

	return str;
}

bool check(string str) {
	str += str.substr(0, 2); //円環状になっているため、はじめともう一個分足す。

	for (int i = 1; i <= n; i++) {
		if (str[i] == 'S') {
			if (s[i % n] == 'o' && str[i - 1] != str[i + 1]) return false;
			if (s[i % n] == 'x' && str[i - 1] == str[i + 1]) return false;
		}
		else if (str[i] == 'W') {
			if (s[i % n] == 'o' && str[i - 1] == str[i + 1]) return false;
			if (s[i % n] == 'x' && str[i - 1] != str[i + 1]) return false;
		}
	}

	return true;
}

int main(void){
	cin>>n>>s;

	string S, tester[4] = { "SS", "SW", "WS", "WW" };
	for (int i = 0; i < 4; i++) {
		S.clear();
		S = gen(tester[i]); //"SS", "SW", "WS", "WW" のそれぞれについてチェック。
		if (check(S)) { //矛盾していないならそこで終了する
			can = true;
			break;
		}
	}

	if (can) cout<< S <<endl;
	else cout<< -1 <<endl;

	return 0;
}

Measured memory_bytes: 896
import math

if __name__ == '__main__':
    s = input().rstrip().split(' ')
    H1, M1, H2, M2, K = int(s[0]),int(s[1]),int(s[2]),int(s[3]),int(s[4])
    if (H1, M1) > (H2, M2):
        H2 += 24

    min1 = H1 * 60 + M1
    min2 = H2 * 60 + M2

    print(min2 - min1 - K)

Measured memory_bytes: 9132
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <iomanip>
#include<cmath>
#include<stdio.h>
#include<map>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
#define please return
constexpr auto AC = 0;
using namespace std;
int main() {
	ll a, b;
	ll ans = 0;
	cin >> a >> b;
	vector<ll> s(b);
	rep(i, b) {
		cin >> s[i];
		ans += s[i];
	}
	if (a <= ans)cout << "Yes" << endl;
	else cout << "No" << endl;
	please AC;
}

Measured memory_bytes: 1024
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC103.A
{
    class Program
    {
        static void Main()
        {
            var sc = new Scanner();
            var n = sc.Nextint();
            var a = sc.Arrayint(n);

            var isContinue = false;
            var continueCount = 0;
            var count = 0;
            for (int i = 1; i < n; i++)
            {
                if (a[i - 1] == a[i])
                {
                    if (isContinue)
                    {
                        if (++continueCount % 2 != 0) count++;
                    }
                    else
                    {
                        isContinue = true;
                        continueCount = 1;
                        count++;
                    }
                }
                else isContinue = false;
            }
            Console.WriteLine(count);
        }
    }
    class Scanner
    {
        string[] s;
        long i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public int Nextint()
        {
            return int.Parse(Next());
        }
        public int[] Arrayint(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Nextint() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }

        public double[] ArrayDouble(long N, double add = 0)
        {
            double[] Array = new double[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }

        public decimal NextDecimal()
        {
            return decimal.Parse(Next());
        }

        public decimal[] ArrayDecimal(long N, decimal add = 0)
        {
            decimal[] Array = new decimal[N];
            for (long i = 0; i < N; i++)
            {
                Array[i] = NextDecimal();
            }
            return Array;
        }
    }
}

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

const lli mod = 1e9+7;
lli n, k;

int main(void){
    cin >> n >> k;
    vector<lli> s(n+2);
    rep(i, n+1) s[i+1] = s[i]+i+1;
    lli ans = 0;
    for(int i = k; i <= n+1; i++){
        lli t, p;
        t = s[i];
        p = s[n+1]-s[n+1-i];
        ans+=p-t+1;
        ans%=mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4728
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <map>
#include <set>

#define pii pair <int, int>
#define pb push_back
#define ll long long
#define ss second
#define ff first
#define N 500010

using namespace std;

int a, b, c;

int main()
{
	cin >> a >> b >> c;
	
	if((b*10+c)%4 == 0)
		cout << "YES";
	else
		cout << "NO";
}

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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
    int n = in();
    int sum = 0;
    int m = 0;
    while (sum < n) {
        ++m;
        sum += m;
    }

    while (sum > n) {
        if (sum - m >= n) {
            sum -= m;
        } else {
            cout << m << endl;
        }
        --m;
    }

    while (m) {
        cout << m << endl;
        --m;
    }


    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
//#include <cstdio>
//#include <algorithm>
//#include <cmath>
//#include <cstring>
//#include <iostream>
using namespace std;
typedef long long ll;
const int maxx=1e5+100;
const int INF=1e9;
const int MOD=1e9+7;
char s[maxx];
int main()
{
    cin>>s;
    for(int i=0; s[i]; i++){
        if(i%2==0){
            cout<<s[i];
        }
    }
    cout<<endl;
    return 0;
}


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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    u64 A, B, K;
    cin >> A >> B >> K;
    if (A >= K) {
        cout << A - K << " " << B << endl;
    } else if (A + B >= K) {
        cout << 0 << " " << A + B - K << endl;
    } else {
        cout << 0 << " " << 0 << endl;
    }
}



Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():

    return

#B
def B():

    return

#C
def C():

    return

#D
def D():
    n,m = LI()
    x = LI()
    d = defaultdict(lambda : 0)
    for i in x:
        d[i] += 1
    f = [[0]*2 for i in range(m)]
    for i,j in d.items():
        k = i%m
        f[k][0] += j-(j&1)
        f[k][1] += j&1
    ans = sum(f[0])>>1
    for i in range(1,(m>>1)+1):
        if i == m-i:
            ans += sum(f[i])>>1
            break
        a,b,c,d = f[i][0],f[i][1],f[m-i][0],f[m-i][1]
        if a+b <= c+d:
            ans += a+b
            if a+b <= d:
                ans += c>>1
            else:
                ans += (c-(a+b-d))>>1
        else:
            ans += c+d
            if c+d <= b:
                ans += a>>1
            else:
                ans += (a-(c+d-b))>>1
    print(ans)
    return

#E
def E():

    return

#F
def F():

    return

#G
def G():

    return

#H
def H():

    return

#I
def I_():

    return

#J
def J():

    return

#Solve
if __name__ == "__main__":
    D()


Measured memory_bytes: 72284
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const ABC = input[0].map(Number);

  ABC.sort();

  return ABC[0] === 5 && ABC[1] === 5 && ABC[2] === 7 ? "YES" : "NO";
};

console.log(main(read()));


Measured memory_bytes: 29644
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int X, Y;

	cin >> X >> Y;

	if (X % Y == 0)cout << -1 << endl;
	else cout << X << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
constexpr ll MOD = 1000000007LL;

int main(void) {
    int N, Q;
    cin >> N >> Q;
    set<pair<ll,int>> D;
    vector<tuple<ll,ll,ll>> K;
    for (int i=0;i<N;i++) {
        ll s, t, x;
        cin >> s >> t >> x;
        K.push_back(make_tuple(x,s,t));
    }
    sort(K.begin(), K.end());
    for (int j=0;j<Q;j++) {
        ll t;
        cin >> t;
        D.insert(make_pair(t,j));
    }

    vector<ll> ans(Q);
    for (int i=0;i<N;i++) {
        ll x, l, r;
        tie(x,l,r) = K[i];
#ifdef DEBUG
        cout << "x: " << x << ", l: " << l << ", r: " << r << endl;
#endif
        auto itr = D.lower_bound(make_pair(l-x,-1));
        while (itr != D.end()) {
            if (itr->first >= r-x) break;
            ans[itr->second] = x;
            itr = D.erase(itr);
        }
    }
    for (auto itr: D) {
        ans[itr.second] = -1;
    }
    for (int i=0;i<Q;i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 21868
#include <cstdio>
#include <vector>
#include <algorithm>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using ll = long long;
using namespace std;
constexpr int mod = 1e9+7;
int main() {
    int w, h; scanf("%d%d", &w, &h);
    vector<int> x(w); repeat (i,w) scanf("%d", &x[i]);
    vector<int> y(h); repeat (i,h) scanf("%d", &y[i]);
    whole(sort, x);
    whole(sort, y);
    ll x_acc = 0;
    repeat (j,w) x_acc += x[j] *(ll) j;
    repeat (i,w) x_acc -= x[i] *(ll) (w-i-1);
    ll y_acc = 0;
    repeat (j,h) y_acc += y[j] *(ll) j;
    repeat (i,h) y_acc -= y[i] *(ll) (h-i-1);
    int result = (x_acc % mod) * (y_acc % mod) % mod;
    printf("%d\n", result);
    return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

static const int MAX_NUM  = 2000000;
static const int MAX_ELEM = 10000;

#if 0
void CountSort(int elem[], int num)
{
    int i;
    int cnt[MAX_ELEM] = {0};
    int elem2[MAX_NUM+1];
    int target;

    for (i = 0; i < num; i++) {
        ++cnt[elem[i]];
    }
    for (i = 1; i <= MAX_ELEM; i++) {
        cnt[i] += cnt[i - 1];
    }

    for (i = num - 1; i >= 0; i--) {
        target = elem[i];
        --cnt[target];
        elem2[cnt[target]] = target;
    }

    printf("%d", elem2[0]);
    for (i = 1; i < num; i++) {
        printf(" %d", elem2[i]);
    }
    printf("\n");

    return;
}
#endif

int main(void)
{
    int i;
    int num;
    int cnt[MAX_ELEM+1] = {0};
    int target;
    int *elem1, *elem2;

    scanf("%d", &num);

    elem1 = (int*)malloc(sizeof(int) * num);
    elem2 = (int*)malloc(sizeof(int) * num);

    for (i = 0; i < num; i++) {
        scanf("%d", &elem1[i]);
        ++cnt[elem1[i]];
    }

    for (i = 1; i <= MAX_ELEM; i++) {
        cnt[i] += cnt[i - 1];
    }

    for (i = num - 1; i >= 0; i--) {
        target = elem1[i];
        --cnt[target];
        elem2[cnt[target]] = target;
    }

    printf("%d", elem2[0]);
    for (i = 1; i < num; i++) {
        printf(" %d", elem2[i]);
    }
    printf("\n");

    free(elem1);
    free(elem2);
//    CountSort(elem, num, maxelem);

    return 0;
}

Measured memory_bytes: 16764
#include<iostream>

using namespace std;

int main(){
int A,B,C,temoti;
cin >> A;
cin >> B;
cin >> C;

temoti = 0;
int i=0,nissu=0;

while(temoti<C){
    i++;
    nissu++;
    if(i==7){
        temoti+=B;
        i=0;
    }
    temoti+=A;
}

cout <<nissu << endl;

return 0;

}


Measured memory_bytes: 3100
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std;

string s;
int len;

int bf[1010];

int _minus(int x, int y)
{
	if (x > y)
		return x - y;
	else if (y > x)
		return y - x;
	else if (x == y)
		return x - y;
}

int main()
{
	cin >> s;
	len = s.size();

	int index = 1;
	for (int i = 0; i < len - 2; i++)
	{
		int g = 100;
		for (int j = i; j <= i + 2; j++)
		{
			bf[index] += (s[j]-'0') * g;
			g /= 10;
		}
		index++;
	}

	int ch = _minus(753, bf[1]);
	for (int i = 1; i <= index; i++)
	{
		ch = min(ch, _minus(753, bf[i]));
	}
	printf("%d", ch);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
vector<pair<int,int> >G[5000];
vector<int>GG[5000];
bool used[5000];
int c[5000],r[5000],n,k;
long d[5000];
main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>c[i]>>r[i];
	}
	for(int i=0;i<k;i++)
	{
		int u,v;cin>>u>>v;
		u--,v--;
		GG[u].push_back(v);
		GG[v].push_back(u);
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)used[j]=0;
		queue<pair<int,int> >P;
		P.push(make_pair(i,0));
		used[i]=1;
		while(!P.empty())
		{
			pair<int,int>p=P.front();
			P.pop();
			int u=p.first,x=p.second;
			if(x>=r[i])continue;
			for(int j=0;j<GG[u].size();j++)
			{
				if(used[GG[u][j]])continue;
				int v=GG[u][j];
				G[i].push_back(make_pair(v,c[i]));
				used[v]=1;
				P.push(make_pair(v,x+1));
			}
		}
	}
	for(int i=0;i<n;i++)d[i]=1e15;
	priority_queue<pair<int,int> >P;
	P.push(make_pair(0,0));
	d[0]=0;
	while(!P.empty())
	{
		pair<int,int>p=P.top();P.pop();
		int u=p.second,x=-p.first;
		if(d[u]<x)continue;
		for(int i=0;i<G[u].size();i++)
		{
			int v=G[u][i].first,c=G[u][i].second;
			if(d[v]>d[u]+c)
			{
				d[v]=d[u]+c;
				P.push(make_pair(-d[v],v));
			}
		}
	}
	cout<<d[n-1]<<endl;
}

Measured memory_bytes: 127400
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll A, B;
    cin >> A >> B;
    if (A % 2 != B % 2) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    cout << (A+B)/2 << endl;
}


Measured memory_bytes: 256
//raja1999
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);
int getgcd(int a,int b)
{
	if(a==0)
		return b;
	else
		return getgcd(b%a,a);
}
int main(){
	std::ios::sync_with_stdio(false);
	int n,k,i,maxx=-100,x;
	int gcd=0;
	cin>>n>>k;
	rep(i,n)
	{
		cin>>x;
		gcd=getgcd(gcd,x);
		maxx=max(maxx,x);
	}
	if(k%gcd==0&&k<=maxx)
		cout<<"POSSIBLE"<<endl;
	else
		cout<<"IMPOSSIBLE"<<endl;

} 


Measured memory_bytes: 256
function Main(input){
 var A = input.split(" ")[0];
 var B = input.split(" ")[1];
 A = parseInt(A,10);
 B = parseInt(B,10);
 var sum = 0;
 var count = 0;
  if(B > 1){
    while(sum < B){
      sum += A;
      count += 1;
        if(sum>=B){
          console.log(count);
          break;
         }else{
          sum -= 1;
        }
    }
  }else if(B == 1){
    console.log(0);
  }
}
  Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <string.h>
#include <stdio.h>

using namespace std;
long long n, k;
int main()
{
    scanf("%lld%lld", &n, &k);
    if(k & 1) {
        long long a = n / k;
        printf("%lld\n", a*a*a);
    } else {
        long long a, b;
        a = n / k;
        b = n / (k/2) - a;
        printf("%lld\n", a*a*a + b*b*b);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=3010;
int n,mod;
long long f[N][N],c[N][N];
inline long long add(long long x,long long y)
{
    return x+y>=mod?x+y-mod:x+y;
}
inline long long sub(long long x,long long y)
{
    return x-y<0?x-y+mod:x-y;
}
inline long long po(long long x,long long y,int p)
{
    long long u=1ll;
    while(y)
    {
        if(y&1) (u*=x)%=p;
        (x*=x)%=p;
        y>>=1;
    }
    return u;
}
int main()
{
    scanf("%d%d",&n,&mod);
    f[0][0]=1ll;
    for(int k=1;k<=n+1;k++)
        for(int i=1;i<=k;i++)
            f[k][i]=add(f[k-1][i-1],i*f[k-1][i]%mod);
    for(int k=0;k<=n;k++)
    {
        for(int i=0;i<=k;i++)
        {
            if(k==0||i==0) c[k][i]=1ll;
            else c[k][i]=add(c[k-1][i-1],c[k-1][i]);
        }
    }
    long long ans=po(2,po(2,n,mod-1),mod);
    for(int k=1;k<=n;k++)
    {
        long long anss=0ll;
        for(int i=0;i<=k;i++)
            anss=add(anss,f[k+1][i+1]*po(po(2,n-k,mod),i,mod)%mod);
        (anss*=c[n][k]*po(2,po(2,n-k,mod-1),mod)%mod)%=mod;
        if(k&1) ans=sub(ans,anss);
        else ans=add(ans,anss);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 96160
N = int(input())
times = [int(i) for i in input().split()]
M = int(input())
p_x_list = [[int(i) for i in input().split()] for _ in range(M)]

for i, p_x in enumerate(p_x_list):
    p = p_x[0]
    x = p_x[1]
    # pは1から始まっているのでindexとして扱うために-1する
    print(sum(times) - times[p-1] + x)


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

int main() {
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    if (a + b <= 2 * c) {
        ans = a * x + b * y;
    }
    else {
        if (x >= y) {
            ans = min(2*c*x, 2*c*y+(x-y)*a);
        }
        else {
            ans = min(2*c*y, 2*c*x+(y-x)*b);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

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

  ll ans = 0;
  repp(i, 1, N) {
    ll a = i % K;
    ll b = (K - a) % K;
    ll c = (K - a) % K;
    if ((b + c) % K != 0) continue;
    ans += (pow((N + (K - b) % K) / K, 2));
  }
  cout << ans << endl;
}

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

int main() {
	int N, X;
	cin >> N >> X;
	int A[N];
	int count=1, sum=0;
	for (int i=0; i<N; i++) cin >> A[i];
	for (int i=0;;i++){
	    sum+=A[i]++;
	    count++;
	    if (sum>X){
	        count--;
	        break;
	    }
	    if (sum==X) break;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
// ax + by = gcd(a, b) となるような (x, y) を求める
// 多くの場合 a と b は互いに素として ax + by = 1 となる (x, y) を求める
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x); // 再帰的に解く
    y -= a / b * x;
    return d;
}

// 負の数にも対応した mod (a = -11 とかでも OK) 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

// 逆元計算 (ここでは a と m が互いに素であることが必要)
ll modinv(ll a, ll m) {
    ll x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main() {
    int N; cin >> N;
    map<int, int> M;
    int ma = -1;
    rep(i,N) {
        int d; cin >> d;
        if (i == 0 && d != 0) { // Added at the end. This is REQUIRED.
            cout << 0 << endl;
            return 0;
        }
        M[d]++;
        if (ma < d) ma = d;
    }
    if (M[0] != 1) { // This is not enough. The first and only first should be 0
        cout << 0 << endl;
        return 0;
    }
    ll res = 1;
    for (int i = 1; i <= ma; i++) {
        if (M[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
        res *= modpow(M[i], M[i+1], 998244353);
        res %= 998244353;
    }
    cout << res << endl;
}


Measured memory_bytes: 8292
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    int max = 0;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n-1);
    
    for(int i = 0; i < n-1; i++) {
        cin >> b.at(i);
    }
   
    a.at(n-1) = b.at(n-2);
    
    for(int i = n-2; i > 0 ; i--) {
        a.at(i) = min(b.at(i-1), b.at(i));
    }
    a.at(0) = b.at(0);

    for(int i = 0; i < n; i++) {
        max += a.at(i);
    }

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
n, p = map(int,input().split())
a = list(map(int,input().split()))
 
o = 0
for i in a:
    if  i % 2:
        o += 1 
e = n-o
if o != 0:
    print((2**e)*int(2**(o-1)))
else:
    if p == 0:
        print(2**n)
    else:
        print(0)

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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    long double a, b;
    cin >> a >> b;
    b *= 100.0;
    b += 0.001;

    llint bllint;
    bllint = b;

    llint c;
    c = a * bllint;
    c /= 100;

    cout << c << endl;
    return 0;
}



Measured memory_bytes: 3704
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = sc.nextLong();
    long A = sc.nextLong();
    long B = sc.nextLong();
    long setCnt = N/(A+B);
    long r = N%(A+B);
    long br = Math.min(r,A);
    System.out.println(br+setCnt*A);
  }
  

  
}

Measured memory_bytes: 25044
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define mkp make_pair
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,a,b)for(int i=a;i<b;i++)
#define repre(i,a,b)for(int i=a;i<=b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> orderedSet;
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> orderedMSet;
//*p.find_by_order(index) return value at index
//p.order_of_key(key) return index
int32_t main()
{
   fastio
   string s;
   cin>>s;
   int c=0;
   unordered_map<char,int>m;
   rep(i,4)
   {
     if(m[s[i]]==0)c++;
     m[s[i]]++;
   }
   if(c!=2)cout<<"No\n";
   else if(c==2)
   {
     int a;
     int b;
     int flag=1;
     for(auto it=m.begin();it!=m.end();it++)
     {
       if(flag)a=it->second,flag=0;
       else b=it->second;
     }
     if(a==b)cout<<"Yes\n";
     else cout<<"No\n";
   }
   return 0;
}


Measured memory_bytes: 256
# https://atcoder.jp/contests/abc104/tasks/abc104_b
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1:
    t = s.replace('A', '')
    t = t.replace('C', '')
    for i in t:
        if ord('a') <= ord(i) <= ord('z'):
            continue
        else:
            print('WA')
            break
    else:
        print('AC')
else:
    print('WA')


Measured memory_bytes: 38256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N;

    scanf("%d", &N);

    int a[N];
    int o = 0, t = 0, f = 0;

    for(int i = 0; i < N; i++){
        scanf("%d", &a[i]);
        if(a[i] % 4 == 0){
            f++;
        }else if(a[i] % 2 == 0){
            t++;
        }else{
            o++;
        }
    }

    if(f + 1 >= t + o){
        printf("Yes\n");
    }else if(o - f <= 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 2008
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF 2000000000
#define INFLL 9000000000000000000
using namespace std;
int main(void)
{
	int n, z, w;

	cin>>n>>z>>w;

	vector<int> a(n+1);

	rep(i, n) cin>>a[i];

	if(n==1){
		cout<<abs(a[0]-w)<<endl;
	}else{
		int ans=(abs(a[n-1]-a[n-2])>abs(a[n-1]-w))?abs(a[n-1]-a[n-2]):abs(a[n-1]-w);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
#include <iostream>

int main() {
  // 入力
  int current_rating;
  int target_rating;
  std::cin >> current_rating >> target_rating;

  // 計算
  int next_performance = target_rating * 2 - current_rating;

  // 出力
  std::cout << next_performance << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int w,n;
  int t=0;
  while(1){
    t++;
    cin>>w;
    if(w==0)break;
    cout<<"Case "<<t<<":"<<endl; 
    cin>>n;
    vector<vi> dp(n+1,vi(w+1,-1));
    dp[0][0]=0;
    rep(i,n){
      int tv,tw;
      char c;
      cin>>tv>>c>>tw;
      rep(j,w+1)if(dp[i][j]>=0){
	dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
	if(j+tw<=w)
	  dp[i+1][j+tw]=max(dp[i+1][j+tw],dp[i][j]+tv);
      } 
    }
    int ans=0;
    rep(i,w+1)if(dp[n][i]>dp[n][ans])ans=i;

    cout<<dp[n][ans]<<endl;
    cout<<ans<<endl;
   
  }
}

Measured memory_bytes: 6836
n = int(input())
s = [input() for i in range(n)]
smap = {}
for i in range(n):
    smap[s[i]] = smap.get(s[i], 0) + 1
maxs = []
maxsmap = max(list(smap.values()))
for si in smap:
    if maxsmap == smap[si]:
        maxs.append(si)
maxs.sort()
for i in range(len(maxs)):
    print(maxs[i])

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

ll solve(long long D, long long N){
    ll res = 1;
    for (int i = 0; i < D; i++)
        res *= 100;
    return res * (N == 100 ? 101 : N);
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long D;
    scanf("%lld",&D);
    long long N;
    scanf("%lld",&N);
    cout << solve(D, N) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AFallingAsleep solver = new AFallingAsleep();
        solver.solve(1, in, out);
        out.close();
    }

    static class AFallingAsleep {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String[] s = new String[n];
            int[] t = new int[n];
            for (int i = 0; i < n; i++) {
                s[i] = in.next();
                t[i] = in.nextInt();
            }

            String x = in.next();
            int answer = 0;
            for (int i = 0; i < n; i++) {
                answer += t[i];
                if (x.equals(s[i]))
                    answer = 0;
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 22740
//gnuplot
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;

float seisankakux(float x0,float x1,float y0,float y1){
  float vx,vy,x3;
  vx = (x1-x0)/3;
  vy = (y1-y0)/3;
  x3 = vx * 0.5 + vy * -1 * sqrt(3)/2 + x0 + vx;
  return x3;
}
float seisankakuy(float x0,float x1,float y0,float y1){
  float vx,vy,y3;
  vx = (x1-x0)/3;
  vy = (y1-y0)/3;
  y3 = vx * sqrt(3)/2 + vy * 0.5 + y0 + vy;
  return y3;
}

void koch(float x0,float x1,float y0,float y1,int n){
  float a,b;
  a = seisankakux(x0,x1,y0,y1);
  b = seisankakuy(x0,x1,y0,y1);
  if(n == 0){
    cout << x1 << " " << y1 << endl;
  }
  else if(n == 1){
    cout << (2 * x0 + x1)/3 << " " << (2 * y0 + y1)/3 << endl;
    cout << a << " " << b << endl;
    cout << (x0 + 2 * x1)/3 << " " << (y0 + 2 * y1)/3 << endl;
    cout << x1 << " " << y1 << endl;
  }
  else{
    koch(x0,(2 * x0 + x1)/3,y0,(2 * y0 + y1)/3,n-1);
    koch((2 * x0 + x1)/3,a,(2 * y0 + y1)/3,b,n-1);
    koch(a,(x0 + 2 * x1)/3,b,(y0 + 2 * y1)/3,n-1);
    koch((x0 + 2 * x1)/3,x1,(y0 + 2 * y1)/3,y1,n-1);
  }
}

int main(){
  int n;
  cin >> n;
  cout << 0 << " " << 0 << endl;
  koch(0,100,0,0,n);
}



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

int main() {
    int a[100]={0};
    int b[100]={0};
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
        b[i]=a[i];
    }
    int cnt=0;
    sort(b,b+n);
    for(int i=0;i<n;i++){
        if(a[i]!=b[i])
            cnt++;
    }
    if(cnt==2||cnt==0){
        cout << "YES" << endl;
    }
    else
        cout << "NO" << endl;
    return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll n,m;
    cin >> n >> m;
    const ll MOD = 1e9 + 7;
    ll ans = 1;
    for(j = 2;j <= sqrt(m);++j){
        if(m%j == 0){
            ll cnt = 0;
            while(m%j == 0){
                ++cnt;
                m /= j;
            }
            int max_number = n - 1 + cnt;
            int ans_number = cnt;
            int MOD = 1e9+7;
            
            vector<ll> inv(max_number+1,1);
            vector<ll> nCk(max_number+1,1);
            for(i = 2;i <= ans_number;++i){
                inv.at(i) = MOD - inv.at(MOD%i)*(MOD/i)%MOD;
            }
            for(i = 1;i <= ans_number;++i){
                nCk.at(i) = nCk.at(i-1)*(max_number-i+1)%MOD;
                nCk.at(i) = nCk.at(i)*inv.at(i)%MOD;
            }
            ans *= nCk.at(cnt);
            ans %= MOD;
        }
        if(m == 1) break;
    }
    if(m != 1){
        ans *= n;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4892
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

da = 0
db = 0
for i in range(n):
    if a[i] <= b[i]:
        da += (b[i] - a[i]) // 2
    else:
        db += a[i] - b[i]
        
if da >= db:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 40560
void main() {
	auto N = ri;
	foreach(k; 1..50001) {
		if(floor(k * 1.08) == N) {
			writeln(k);
			return;
		}
	}
	writeln(":(");
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

#define DEFAULT_STACK_SIZE 12
#define MAX_STR_SIZE 12

struct stack {
  char **arr;
  int i;
  int size;
};

static void
init_stack(struct stack *s) {
  s->arr = (char **) malloc(sizeof(char *) * DEFAULT_STACK_SIZE);
  s->size = s->arr == NULL ? 0 : DEFAULT_STACK_SIZE;
  s->i = 0;
}

static void
expand_stack_if_needed(struct stack *s) {
  char **tmp;

  if (s->i < s->size) return;

  tmp = (char **) realloc(s->arr, sizeof(char *) * s->size * 2);
  if (tmp == NULL) return;
  s->arr = tmp;
  s->size *= 2;
}

static void
push_stack(struct stack *s, char *v) {
  expand_stack_if_needed(s);
  s->arr[s->i] = v;
  s->i++;
}

static char *
pop_stack(struct stack *s) {
  char *v;

  if (s->i == 0) return NULL;

  v = s->arr[s->i - 1];
  s->i--;
  s->arr[s->i] = NULL;

  return v;
}

static void
destroy_stack(struct stack *s) {
  int i;

  for (i = 0; i < s->size; ++i) {
    free(s->arr[i]);
    s->arr[i] = NULL;
  }
  free(s->arr);
  s->arr = NULL;
}

static int
read_expr_and_calc(FILE *f, struct stack *s) {
  char *str;
  int m, n, ret;
  char *a;
  char *b;

  while (1) {
    str = (char *) malloc(sizeof(char) * MAX_STR_SIZE);
    if (str == NULL) break;

    n = fscanf(f, "%s", str);
    if (errno != 0) perror("fscanf");
    if (n == EOF) break;

    if (strcmp(str, "+") == 0) {
      b = pop_stack(s);
      a = pop_stack(s);
      m = atoi(a);
      n = atoi(b);
      free(a);
      free(b);
      a = b = NULL;
      snprintf(str, MAX_STR_SIZE, "%d", m + n);
      push_stack(s, str);
    } else if (strcmp(str, "-") == 0) {
      b = pop_stack(s);
      a = pop_stack(s);
      m = atoi(a);
      n = atoi(b);
      free(a);
      free(b);
      a = b = NULL;
      snprintf(str, MAX_STR_SIZE, "%d", m - n);
      push_stack(s, str);
    } else if (strcmp(str, "*") == 0) {
      b = pop_stack(s);
      a = pop_stack(s);
      m = atoi(a);
      n = atoi(b);
      free(a);
      free(b);
      a = b = NULL;
      snprintf(str, MAX_STR_SIZE, "%d", m * n);
      push_stack(s, str);
    } else if (strcmp(str, "/") == 0) {
      b = pop_stack(s);
      a = pop_stack(s);
      m = atoi(a);
      n = atoi(b);
      free(a);
      free(b);
      a = b = NULL;
      snprintf(str, MAX_STR_SIZE, "%d", m / n);
      push_stack(s, str);
    } else {
      push_stack(s, str);
    }
  }

  str = pop_stack(s);
  ret = atoi(str);
  free(str);
  str = NULL;
  return ret;
}

int
main(int argc, char **argv) {
  struct stack s;
  int n;

  init_stack(&s);
  n = read_expr_and_calc(stdin, &s);
  printf("%d\n", n);
  destroy_stack(&s);
  exit(0);
}


Measured memory_bytes: 2080