akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        bool[] a = new bool[10000];
        for (int i = 0; i < 10000; i++)
        {
            a[i] = IsPrime((long)i);
        }
        while (true)
        {
          sd: { }
            long n = long.Parse(Console.ReadLine());
            if (n == 0) { break; }
            if (n % 2 == 0) { n--; }
            for (long i = n; i >= 5; i -= 2)
            {
                if (a[i] && a[i - 2]) { Console.WriteLine(i - 2 + " " + i); goto sd; }
            }

        }

    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Measured memory_bytes: 9284
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

constexpr lli inf = 10000 * 10000;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli n, m;
	cin >> n >> m;

	cout << (n - 1) * (n) / 2 + m * (m - 1) / 2 << endl;


	return 0;
}


Measured memory_bytes: 256
from math import log
N=int(input())

L=[1]
for i in range(1,N):
    if 6**i<=N:
        L.append(6**i)
    else:
        break
for i in range(1,N):
    if 9**i<=N:
        L.append(9**i)
    else:
        break

dp=[100000]*(N+1)
dp[0]=0
dp[1]=1
for i in range(2,N+1):
    sub=100000
    for l in L:
        if i-l>=0:
            sub=min(dp[i-l]+1,sub)
    dp[i]=sub

print(dp[N])

Measured memory_bytes: 3828
#include <cstdlib>
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#define ALL(x) x.begin(),x.end()
#define RS(T) sort(T.rbegin(),T.rend())
#define BS(T, x) binary_search (T.begin(), T.end(), x)
#define U unsigned
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b,c,d;
    cin >> a>>b>>c>>d;
    cout << min(a,b)+min(c,d);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
 using namespace std;
 int main(){
 int A,B,C,D;
 cin>>A>>B>>C>>D;
 int X=(A+D-1)/D;
 int Y=(C+B-1)/B;
 cout<<(X>=Y?"Yes":"No")<<"\n";
 return 0;
 }

Measured memory_bytes: 3632
def fa(): #final answer
    global ans
    print(ans)
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

N = getN()
space = {}

for i in range(N):
    k = getN()
    if k in space:
        space[k] = space[k] ^ 1
    else:
        space[k] = 1


print(sum(space.values()))


Measured memory_bytes: 15072
#include <iostream>
#include <queue>
using namespace std;
typedef long long ll;
ll n, a[100100], b[100100], c[100100], L[100100], S[100100], res;
const ll INF = -1000000000000000000;
priority_queue<ll, vector<ll>, greater<ll>> lar;
priority_queue<ll> sma;
int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
        lar.push(a[i]);
        L[0] += a[i];
    }
    for (ll i = 0; i < n; i++) cin >> b[i];
    for (ll i = 0; i < n; i++) {
        cin >> c[i];
        sma.push(c[i]);
        S[0] += c[i];
    }
    for (ll i = 0; i < n; i++) {
        lar.push(b[i]);
        ll t = lar.top(); lar.pop();
        L[i + 1] = L[i] + b[i] - t;
        sma.push(b[n - i - 1]);
        ll u = sma.top(); sma.pop();
        S[i + 1] = S[i] + b[n - i - 1] - u;
    }
    res = INF;
    for (ll i = 0; i <= n; i++) {
        res = max(res, L[i] - S[n - i]);
    }
    cout << res << endl;
}


Measured memory_bytes: 5876
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define DEBUG
#ifdef DEBUG
    #define IFD(...) __VA_ARGS__
    #define IFN(...)
    #define L cout<<__LINE__<<"\n";
    #define PRINT(...) __VA_ARGS__ cout<<__LINE__<" : "<<#__VA_ARGS__<<"\n"
    #define PRT(x) cout<<__LINE__<<" : "<<#x<<" = "<<x<<"\n"
#else // DEBUG
    #define IFD(...)
    #define IFN(...) __VA_ARGS__
    #define L
    #define PRINT(...) __VA_ARGS__
    #define PRT(x)
#endif // DEBUG

#define it iterator
#define rit reverse_iterator
#define mp make_pair
#define mems(a,b) memset(a,b,sizeof(a))
#define mem0(a) mems(a,0)
#define mem1(a) mems(a,1)
#define mem255(a) mems(a,255)
#define halt exit(0)
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
#define fort0(i,a,b) for(ll i=a,i##_TO=b;i<i##_TO;i++)
#define for0(i,n) fort0(i,0,n)
#define fort1(i,a,b) for(ll i=a,i##_TO=b;i<=i##_TO;i++)
#define for1(i,n) fort1(i,1,n)
#define ford(i,a,b) for(ll i=a,i##_TO=b;i>=i##_TO;i--)

using namespace __gnu_pbds;
using namespace std;

#define int ll

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

const int N=55555;

bool c[N+1];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    c[2]=false;
    for(int i=2;i<=N;i++)
        if(!c[i])
        {
            if(i%5==2)
                cout<<i<<" ",n--;
            if(!n)
                exit(0);
            for(int j=i*i;j<=N;j+=i)
                c[j]=true;
        }
}


Measured memory_bytes: 256
import sys
import math


S = sys.stdin.readline().rstrip()

count1 = 0
count2 = 0
#01010101
for i in range(len(S)):
    if i % 2 ==0:
        if S[i] == '1':
            count1 += 1
    if i % 2 == 1:
        if S[i] == '0':
            count1 += 1

for i in range(len(S)):
    if i % 2 == 1:
        if S[i] == '1':
            count2 += 1
    if i % 2 == 0:
        if S[i] == '0':
            count2 += 1

if count1 < count2:
    ans = count1
else:
    ans = count2

print(ans)


Measured memory_bytes: 3188
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define MP make_pair
#define PB push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

template <class T>  
inline bool RD(T &ret) {  
        char c; int sgn;  
        if (c = getchar(), c == EOF) return 0;  
        while (c != '-' && (c<'0' || c>'9')) c = getchar();  
        sgn = (c == '-') ? -1 : 1 , ret = (c == '-') ? 0 : (c - '0');  
        while (c = getchar(), c >= '0'&&c <= '9') ret = ret * 10 + (c - '0');  
        ret *= sgn;  
        return 1;  
}  
template <class T>  
inline void PT(T x) {  
        if (x < 0) putchar('-') ,x = -x;  
        if (x > 9) PT(x / 10);  
        putchar(x % 10 + '0');  
}

const int INF = 0x3f3f3f3f;
typedef long long LL;
typedef pair<int, int> pii;
typedef long double LD;


const int N = 444;
LL f[N][N];
const LL MOD = 1e9 + 7;
LL A[N], B[N];
LL dp[N][N];
LL qp[N][N];
LL qpow(LL val, LL K) {
	LL ans = 1;
	while(K) {
		if(K & 1) ans = ans * val % MOD;
		K >>= 1;
		val = val * val % MOD;
	}
	return ans;
}
int main()  {
	int n, c;
	cin >> n >> c;
	for(int num = 1; num <= 400; num ++)
		for(int k = 0; k <= 400; k ++) qp[num][k] = qpow(num, k);
	for(int i = 1; i <= n; i ++) cin >> A[i];
	for(int i = 1; i <= n; i ++) cin >> B[i];
	for(int i = 1; i <= n; i ++) {
		LL sum;
		for(int k = 0; k <= c; k ++) {
			sum = 0;
			for(int base = A[i]; base <= B[i]; base ++) {
				sum += qp[base][k];
			}	
			f[i][k] = sum % MOD;
		}
	}
	dp[0][0] = 1;
	for(int i = 1; i <= n; i ++)
		for(int ci = 0; ci <= c; ci ++) {
			for(int k = 0; k <= ci; k ++) 
				dp[i][ci] = (dp[i][ci] + dp[i - 1][ci - k] * f[i][k]) % MOD;
		}
	printf("%d\n", (int) dp[n][c]);
}


Measured memory_bytes: 4480
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var N, K int
	fmt.Scan(&N, &K)
	bufio.NewScanner(os.Stdin).Scan()

	N -= K
	count := 1
	if N > 0 {
		count += N / (K - 1)
		N -= (count - 1) * (K - 1)
	}
	if N > 0 {
		count++
	}

	fmt.Println(count)
}


Measured memory_bytes: 768
#include<iostream>
#include<string>
#include <stdio.h>
#include <math.h>
#include <cctype>
#include<queue>
#include<stack>
#include<cstdio>
#include <algorithm>
#include <cstdio>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		int ans=0;
		int d[999999+100]={};
		for(int i=2;i*i<=n;i++){
			if(d[i]==0){
				for(int j=2;j*i<=n;j++){
					d[j*i]++;
				}
			}
		}
		d[1]=1;
		for(int i=1;i<=n;i++){
					if(d[i]==0){
						ans++;
					}
							}
			cout<<ans<<endl;

		}
		
		return 0;
}

Measured memory_bytes: 5072
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    string s;cin >> s;
    ll n = s.size();
    bitset<26> bs(0);
    rep(i,n)bs[s[i]-'a'] = 1;
    string ans;
    if(bs.count() != 26){
        ans = s;
        rep(i,26)if(bs[i] == 0){ans += 'a'+i;break;}
    }
    else{
        ans = s;
        for(int i = 25; 0 <= i; i--){
            bool ok = false;
            ans.pop_back();
            ll t = s[i] - 'a';
            bs[t] = 0;
            for(int j = t+1; j < 26; j++){
                if(bs[j] == 0){ans += 'a' + j; ok = true;break;}
            }
            if(ok)break;
        }
        if(ans == "")ans = "-1";
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] W = new int[N];
		for (int i = 0; i < N; i++) {
			W[i] = scan.nextInt();
		}
		int min = 10000;
		for (int i = 0; i < N; i++) {
			int S1 = 0;
			int S2 = 0;
			for (int j = 0; j < N; j++) {
				if (i <j) {
					S1 += W[j];
				} else {
					S2 += W[j];
				}
			}
			if (Math.abs(S1 - S2) < min) {
				min = Math.abs(S1 - S2);
			}
		}
		System.out.println(min);
	}

}


Measured memory_bytes: 23764
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	tmp, _ := reader.ReadString('\n')
	tmp = strings.Trim(tmp, "\n")

	amount, _ := strconv.ParseInt(tmp, 10, 64)

	var thou int64
	var five int64
	thou = amount / 500

	less := amount % 500

	five = less / 5

	ans := thou*1000 + five*5

	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
long long a[100000];

long long gcd(long long m, long long n){
  if(n == 0){
    return m;
  }
  if(n > m){
    return gcd(n, m);
  }
  return gcd(n, m % n);
}

int main(){
  int N;
  long long M;
  cin >> N >> M;
  for(int i = 0; i < N; i++){
    cin >> a[i];
  }

  int two_power_num = 0;
  while(a[0] % 2 == 0){
    a[0] /= 2;
    two_power_num ++;
  }
  for(int i = 1; i < N; i++){
    int cur_two_power_num = 0;
    while(a[i] % 2 == 0){
      a[i] /= 2;
      cur_two_power_num ++;
    }
    if(two_power_num != cur_two_power_num){
      cout << 0 << endl;
      return 0;
    }
  }

  long long base = 1;
  for(int i = 0; i < two_power_num - 1; i++){
    base *= 2;
  }

  long long lcm = a[0];
  for(int i = 1; i < N; i++){
    lcm = lcm * a[i] / gcd(lcm, a[i]);
    if(lcm > M){
      cout << 0 << endl;
      return 0;
    }
  }
  
  long long candidates = M / (base * lcm);
  if(candidates % 2 == 0){
    cout << candidates / 2 << endl;
  } else {
    cout << candidates / 2 + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] p = new int[n];
		for(int i=0; i<n;i++)
		{
		    p[i] = sc.nextInt();
		}
		int count = 0;
		for(int i=1; i<n-1;i++)
		{
		    if(p[i-1]<p[i] && p[i]<p[i+1])
		        count++;
		    else if(p[i-1]>p[i] && p[i]>p[i+1])
		        count++;
		}
      	System.out.println(count);
	}
}

Measured memory_bytes: 23764
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty())return out;
    constexpr bool is_vector_v = is_vector<T>::value;
    if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
    else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
    return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first<<"\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main(){
    int n;
    cin >> n;
    vector<int> b(n-1);
    REP(i,n-1){
        cin >> b[i];
    }
    vector<int> a(n);
    a[0] = b[0];
    a.back() = b.back();
    FOR(i,1,n-1){
        a[i]=min(b[i-1],b[i]);
    }
    ll res = 0;
    REP(i,n){
        res+=a[i];
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] strs = line.Split(' ');
            long N = long.Parse(strs[0]);
            long K = long.Parse(strs[1]);
            long town = 0;
            line = Console.ReadLine();
            strs = line.Split(' ');

            long[] teleporter = new long[N]; 
            for(int i = 0; i < N; i++)
            {
                teleporter[i] = long.Parse(strs[i])-1;
            }
            long[] town_何番目に来たか = new long[N];
            for (int i = 0; i < N; i++) town_何番目に来たか[i] = -1;
            long count = 0;
            while(count < K)
            {
                if (town_何番目に来たか[town] != -1) break;
                town_何番目に来たか[town] = count;
                town = teleporter[town];
                count++;
            }
            if (count == K)
            {
                Console.WriteLine(town+1);
            }
            else
            {
                //ループにかかる回数
                var loop = count - town_何番目に来たか[town];
                var nokori = K - town_何番目に来たか[town];
                var 目的の番目 = nokori % loop;
                for(int i = 0; i < N; i++)
                {
                    if (town_何番目に来たか[i] == 目的の番目 + town_何番目に来たか[town])
                    {
                        Console.WriteLine(i+1);
                    }
                }
            }


        }
    }
}


Measured memory_bytes: 44660
#include <iostream>

int main()
{
	char wheather[2][3];
	int ans = 0;

	for(int i = 0; i < 2; i++)
		for (int j = 0; j < 3; j++)
			std::cin >> wheather[i][j];

	for (int j = 0; j < 3; j++)
		if (wheather[0][j] == wheather[1][j])
			ans++;
	
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
static const int MAX=100;
static const int INFTY=(1<<21);
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;
int n,M[MAX][MAX];
void stra(){
    int minv;
    int d[MAX],color[MAX];
    for(int i=0;i<n;i++){
        d[i]=INFTY;
        color[i]=WHITE;
    }
    d[0]=0;
    color[0]=GRAY;
    while(1){
        minv=INFTY;
        int u=-1;
        for(int i=0;i<n;i++){
            if(minv>d[i] && color[i]!=BLACK){
                u=i;
                minv=d[i];
            }
        }
        if(u==-1) break;
        color[u]=BLACK;
        for(int v=0;v<n;v++){
            if(color[v]!=BLACK && M[u][v]!=INFTY){
                if(d[v]>d[u]+M[u][v]){
                    d[v]=d[u]+M[u][v];
                    color[v]=GRAY;
                }
            }
        }
    }

    for(int i=0;i<n;i++){
        cout<<i<<" "<<(d[i]==INFTY ?-1:d[i])<<endl;
    }
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            M[i][j]=INFTY;
        }
    }
    
    int k,c,u,v;
    for(int i=0;i<n;i++){
        cin>>u>>k;
        for(int j=0;j<k;j++){
            cin>>v>>c;
            M[u][v]=c;
        }
    }
    stra();
    return 0;
}


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

#define int long long
#define mod 1000000007

using namespace std;

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

    int ans = 0;

    for(int i=105;i<=n;i++)
    {
        int count = 0;

        for(int j=1;j*j<=i;j++)
        {
            if(i%j == 0)
                count++;
        }

        if(count == 4 && i%2 == 1)
            ans++;
    }

    cout << ans;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
 
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int N, K;
	cin >> N >> K;

	double ans = 0;
	const double PI = acos(-1.0);
	ans = N*sin(PI*(N-2*K) / N / 2)*sin(PI/N) / sin(PI*(N-2*K) / N / 2+ PI / N);


	cout << fixed << setprecision(10) << ans << endl;

}


Measured memory_bytes: 3456
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
        ll n, zero, one;
        scanf("%ld", &n);
        V a(n);
        scan(a);
        ll w = 1, ans = 0;
        rep(i, 0, 61){
                zero = one = 0;
                for(ll& x: a){
                        if((x>>i)&1) one++;
                        else zero++;
                }
                ans = (ans + w * zero % MOD * one % MOD) % MOD;
                w = w * 2 % MOD;
        }
        printf("%ld\n", ans);
        return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,nmsl;
int main(){
    cin>>a>>b>>c;
    if(b>=a){
        cout<<1<<endl;
        exit(0);}
    if(c>=b){
        cout<<-1<<endl;
        return 0;}
    if((a-b)%(b-c)>=1)nmsl=1;
    cout<<((a-b)/(b-c)+nmsl)*2+1<<endl;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <set>
typedef long long ll;
using namespace std;
int main() {
    ll n; cin >> n;
    vector<ll> a;
    vector<ll> b;
    vector<pair<ll, ll>> sum;
    for (int i = 0; i < n; i++) {
        ll _a, _b; cin >> _a >> _b;
        a.push_back(_a);
        b.push_back(_b);
        sum.push_back(make_pair(_a + _b, i));
    }
    sort(sum.begin(), sum.end());
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ll index = sum[n-i].second;
        if (i%2 != 0) {
            ans += a[index];
        }
        else if (i%2 == 0) {
            ans -= b[index];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3676
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<functional>
typedef long long ll;
using namespace std;
typedef pair<int,int> p;

map<int,int> miria;
int main(){
  int s;
  cin >> s;
  miria[s]++;
  int c=1;
  while(1){
    c++;
    if(s%2==0){
      s /= 2;
      miria[s]++;
    }else{
      s = 3*s+1;
      miria[s]++;
    }
    if(miria[s]==2){
      break;
    }
  }
  cout << c << endl;
}


Measured memory_bytes: 256
function main(input){
  const args=input.split(" ");
  const N=parseInt(args[0],10);
  const L=parseInt(args[1],10);

  var arr=[];
  
  for(i=0; i<N; i++){
    arr.push(L+i)
  }
  
  if(arr.indexOf(0)>=0){
    console.log((arr[0]+arr[N-1])*N/2);
  }else if(arr[N-1]<0){
    console.log((arr[0]+arr[N-1])*N/2-arr[N-1]);
  }else{
    console.log((arr[0]+arr[N-1])*N/2-arr[0]);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 7372
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t,class ...A> inline void read(t &x,A &...a){
	read(x);read(a...);
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

#define int long long

int n,tot,sum;

signed main(){
	read(n);
	for(int i=1,x,y;i<=n;i++){
		read(x,y);
		tot+=y;sum+=x*y;
	}
	write(tot-1+(sum-1)/9);
}

Measured memory_bytes: 3616
n=int(input())
a = list(map(int, input().split())) #
ans=1
for i in range(n):
    if a[i]==0:
        print(0)
        exit()
for i in range(n):
    if a[i]*ans>10**18:
        print(-1)
        exit()
    else:
        ans=ans*a[i]
print(ans)

Measured memory_bytes: 84752
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

/*
- x
  - a
- y
  - b
- z
  - c
a = (x + y) / 2
=> y = 2a - x
b = (y + z) / 2
=> z = 2b - y => z = 2b - 2a + x
c = (z + x) / 2
=> x = 2c - z => x = 2c - 2b + 2a - x
=> x = a - b + c
*/
fn main() {
    let N: usize = read();
    let mut A: Vec<usize> = (0..N).map(|_| read()).collect();
    let mut ans: Vec<usize> = vec![];
    let mut firstVal: i32 = 0;
    for (i, &v) in A.iter().enumerate() {
        if i % 2 == 0 {
            firstVal += v as i32;
        } else {
            firstVal -= v as i32;
        }
    }
    A.pop();
    ans.push(firstVal as usize);
    let mut now = firstVal as usize;
    for dam in A {
        let next = (dam - (now as usize / 2)) * 2;
        now = next;
        ans.push(next);
    }
    println!(
        "{}",
        ans.into_iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(" ")
    )
}


Measured memory_bytes: 8572
#include <stdio.h>
int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  int n=100*a+10*b+c;
  
  if(n%4==0){
    printf("YES\n");
  }
  else{
    printf("NO\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>

int main()
{
    int n, i, j, digits, check;
    scanf("%d", &n);
    for (i = 3;i <= n;i++){
        if (i % 3 == 0 || i % 10 == 3){
            printf(" %d", i);
        }
        else{
            digits = floorf(log10(i)+1);
            for (j = 1; j <= digits; j++){
               check = (int)floor(i / pow(10,j)) % 10;
               if (check == 3){
                   printf(" %d", i);
                   break;
               }
            }
        }
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 664
//Heaplax
#include<bits/stdc++.h>
#define N 200005
#define LL long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
const int mod=1000000007;
int n,a,b,c,d;
int ans,fac[N],ifac[N],inv[N];
int mi(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=1ll*res*a%mod;
		a=1ll*a*a%mod;
		b>>=1;
	}
	return res;
}
int C(int n,int m)
{
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int main()
{
	inv[0]=inv[1]=ifac[0]=fac[0]=1;
	for(int i=1;i<N;++i)
	{
		if(i>1)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[i]=1ll*fac[i-1]*i%mod;
		ifac[i]=1ll*ifac[i-1]*inv[i]%mod;
	}
	re(n),re(a),re(b),re(c);
	d=a+b;
	c=1ll*c*mi(100,mod-2)%mod;
	a=1ll*a*mi(d,mod-2)%mod;
	b=1ll*b*mi(d,mod-2)%mod;
	for(int i=n;i<=n+n-1;++i)
	{
		// LOG(i);
		int p=(1ll*mi(a,n)*mi(b,i-n)+1ll*mi(b,n)*mi(a,i-n))%mod*C(i-1,n-1)%mod;
		// LOG(C(i-1,n-1));
		// cerr<<p<<endl;
		ans=(ans+p*(i+1ll*c*i%mod*mi((1-c+mod)%mod,mod-2)%mod))%mod;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 2560
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import math 
def main():
    A, B = map(int, readline().split())
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(math.sqrt(x))+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    g = gcd(A, B)
    print(len(factorize(gcd(A, B)))+1) 
if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<stdio.h>

int main(void){
	int a[30];
	int i,j,check=0;
	
	for(i=0;i<28;i++){
		scanf("%d",&a[i]);
	}
	for(i=1;i<=30;i++){
		for(j=0;j<28;j++){
			if(a[j]==i){
				check = 1;
			}
		}
		if(check==0)
		printf("%d\n",i);
		check=0;
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=2e5+50,oo=1e9;

int ans,dep[N],prt[N],n,pX,pY,eu[N],win[N],ev[N];

vector<int> g[N],g2[N];

void dfs(int v,int p){
	prt[v]=p;
	for(int d:g[v])if(d!=p){
		dep[d]=dep[v]+1;
		dfs(d,v); 
	}
}

void chk(int u,int v){
	bool ok=false;
	ok|=prt[u]==v||prt[v]==u;
	ok|=prt[u]==prt[v]||prt[prt[u]]==v||prt[prt[v]]==u;
	Pr("Chk %d,%d,ok=%d\n",u,v,(int)ok); 
	if(!ok)win[u]=win[v]=true;
	else g2[u].pb(v),g2[v].pb(u);
}

int q[N],h,t,dis[N];
void bfs(){
	mem(dis,-1); 
	q[t++]=pX;
	dis[pX]=0;
	while(h!=t){
		int v=q[h++];
		for(int d:g2[v])if(dis[d]==-1){
			dis[d]=dis[v]+1;
			Pr("d=%d,dep[d]=%d\n",d,dep[d]);
			if(dep[d]>dis[d])q[t++]=d;
		}
	}
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	//freopen("my.out","w",stdout);
#endif
	read(n),read(pX),read(pY); 
	rep(i,1,n-1)read(eu[i]),read(ev[i]); 
	rep(i,1,n-1){
		int u,v;
		read(u),read(v);
		g[u].pb(v);
		g[v].pb(u);
	}
	dfs(pY,0);
	rep(i,1,n-1){
		chk(eu[i],ev[i]); 
	}
	bfs();
	rep(i,1,n)if(dis[i]!=-1&&dep[i]>dis[i]){
		if(win[i])ans=oo;
		else cmax(ans,2*(dep[i]));
	}
	printf("%d\n",ans==oo?-1:ans); 
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

using namespace std;


int main(){

  long long int n,m,l,a[100010],b[100010],c[100010],dist[400][400],distf[400][400];
  
  cin >> n>> m >> l;
  
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i] >> c[i];
    
  }
  
  for(int i=0;i<400;i++){
    for(int j=0;j<400;j++){
      if(i==j){
      dist[i][j] = 0;
      }
      else{
        dist[i][j] = 1e15;
      }
    }
  }
  
  
  for(int i=0;i<m;i++){
    
      dist[a[i]][b[i]] = c[i];
    dist[b[i]][a[i]] = c[i];
    
  }
  
 
  for (int k = 0; k <= n; k++){       
    for (int i = 0; i <= n; i++) {    
      for (int j = 0; j <= n; j++) {  
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

 for(int i=0;i<400;i++){
    for(int j=0;j<400;j++){
      if(i==j){
      distf[i][j] = 0;
      }
      else{
        distf[i][j] = 1e15;
      }
    }
  }
  
  
  for(int i=0;i<=n;i++){
    for(int j=0;j<=n;j++){  
      if(dist[i][j] <= l) distf[i][j] = 1;
  }
  }
 
  for (int k = 0; k <= n; k++){       
    for (int i = 0; i <= n; i++) {    
      for (int j = 0; j <= n; j++) {  
        distf[i][j] = min(distf[i][j], distf[i][k] + distf[k][j]);
      }
    }
  }

  int Q;
  cin >> Q;
  
	for(int i=0;i<Q;i++){
		int q1,q2; 
        cin >> q1 >> q2;
		if(distf[q1][q2] > 1e14) cout << -1 << endl;
		else cout << distf[q1][q2]-1 << endl;
	}
  
}


Measured memory_bytes: 5248
import numpy as np
h = list(map(int, input().split()))
ln = []
lost_point = [0]*h[0]
point = [h[1]-h[2]]*h[0]
for i in range(h[2]):
    n = int(input())
    ln.append(n)
for j in range(h[2]):
    lost_point[ln[j]-1]+= 1 
result = np.array(point) + np.array(lost_point)
for k in range(h[0]):
    if result[k] > 0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 20136
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

int main(){
    char c;
    cin >> c;

    char ans = c + 1;

    cout << ans << 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.Scanner;

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

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            double a = in.nextInt();
            double b = in.nextInt();
            double x = in.nextInt();
            double ans = 0;

            double h = x / (a * a);
            double atan;
            if (h * 2 >= b) {
                atan = Math.atan2(Math.abs(b - h) * 2.0, a);
            } else {
                double z = x * 2.0 / b / a;
                atan = Math.atan2(b, z);
            }
            ans = Math.toDegrees(atan);

            out.printf("%.10f\n", ans);
        }

    }
}



Measured memory_bytes: 24020
import math  # noqa
import bisect  # noqa
import queue  # noqa


# if __name__ == '__main__':
#     a, b, x = map(int, input().split())

#     L = b - a + 1
#     res = L // x
#     if L % x != 0:
#         if a % x == 0 or b % x == 0:
#             res += 1
#         else:
#             c = b - b % x
#             if a <= c:
#                 L = c - a + 1
#                 res = L // x
#                 if L % x != 0:
#                     if a % x == 0 or c % x == 0:
#                         res += 1
#     print(res)


def f(n, x):
    if n == -1:
        return 0
    else:
        return n // x + 1


if __name__ == '__main__':
    a, b, x = map(int, input().split())

    print(f(b, x) - f(a - 1, x))


Measured memory_bytes: 38380
import numpy as np
from fractions import gcd
from functools import reduce

n = int(input())

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

left = [a[0]] * n
for i in range(1, n):
    left[i] = gcd(left[i - 1], a[i])

right = [a[-1]] * n
for i in range(0, n - 1)[::-1]:
    right[i] = gcd(right[i + 1], a[i])
left.insert(0, right[1])
right.append(left[-2])

print(max(gcd(left[i], right[i + 1]) for i in range(n)))


Measured memory_bytes: 24240
#include <iostream>
#define MAX 301

using namespace std;

int dp[MAX];

void Make_dp(void){

  dp[0] = 1;

  for( int i = 1 ; i <= 17 ; i++ ){
    for( int j = 0 ; j < MAX - i*i ; j++ ){
      dp[i*i + j] += dp[j];
    }
  }

}

int main(void){

  Make_dp();

  int n;
  while( cin >> n , n )
    cout << dp[n] << endl;

  return 0;
}

Measured memory_bytes: 1160
from collections import deque

n = int(input())
g = []
d = [10**10] * n
d[0] = 0

for i in range(n):
    temp = list(map(int, input().split()))
    k = temp[1]
    temp = temp[2:]
    adj = []
    for j in range(k):
        v, c = temp[j*2], temp[j*2+1]
        adj.append([v, c])
    g.append(adj)

# for i in range(n):
#     print(g[i])

q = deque()
q.append((0, g[0]))
done = set()

while q:
    node = q.popleft()
    prev = node[0]
    adj = node[1]
    # print('\nadj:', adj)

    for next in adj:
        v = next[0]
        w = next[1]
        # print('v:', v)
        # print('prev:', prev)

        # d[v] = min(d[v], d[prev] + w)
        if d[prev] + w < d[v]:
            d[v] = d[prev] + w
            # Need to add to Q regardless of it's in done or not,
            # because the shortest path was udpated.
            q.append((v, g[v]))
        if v not in done:
            done.add(v)
            q.append((v, g[v]))

# print('d:', d)

for i in range(len(d)):
    print(i, d[i])


Measured memory_bytes: 6496
(defun main ()
    (setq a (read))
    (setq b (read))
    (if (= a 1) (setq a 20)  NIL)
    (if (= b 1) (setq b 20)  NIL)
    (cond ((= a b) (princ "Draw"))
    ((> a b) (princ "Alice"))
    ((< a b) (princ "Bob"))))
    (main)

Measured memory_bytes: 3432
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
dp = [[h * w] * w for _ in range(h)]
dp[0][0] = 0 if s[0][0] == "." else 1

for x0 in range(w):
    for y0 in range(h):
        for i, j in [(0, 1), (1, 0)]:
            x = x0 + i
            y = y0 + j
            if x < w and y < h:
                n = 1 if s[y0][x0] == "." and s[y][x] == "#" else 0
                dp[y][x] = min(dp[y0][x0] + n, dp[y][x])

print(dp[-1][-1])


Measured memory_bytes: 9240
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::cout << std::setprecision(20) << std::fixed;

  string N; cin >> N;
  
  int sum = 0;
  for (int i = 0; i < N.length(); i++) {
    sum += N[i] - '0';
    sum %= 9;
  }

  cout << (sum ? "No" : "Yes") << "\n";
  return 0;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#define st first
#define nd second

using namespace std;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

// const int N = ;
int n, m;

int main() {
	ios_base::sync_with_stdio(false);	
	cin >> n >> m;
	cout << (3 * n + m) / 2;
}	


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

int main(){
  int N, L;
  cin >> N >> L;
  vector<string> s(N);
  for(int i = 0; i < N; i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  for(int i = 0; i < N; i++){
    cout << s[i];
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(123456789)
#define LINF (long long int)(123456789012345678)
#define MAX_V 1000

struct position{int x, y;};
bool cmp(position a, position b){
	return (a.x  < b.x);
}

int main(void){
	/*
	*ここから初期化なので読まなくて良い
	*/
	int H,W,N;
	cin>>H>>W>>N;
	int x,y;
	vector<position> p;
	rep(i,N){
		cin>>x>>y;
		position hoge = {x,y};
		p.push_back(hoge);
	}
	sort(p.begin(),p.end(),cmp);
	position now = {1,1};
	int pi = 0;
	/*
	*ここまで初期化なので読まなくて良い
	*/

	/*
	* now.x = 現在のx座標　now.y = 現在のy座標　これを動かしてシミュレーション
	* 高橋君は必ず右に進む
	* 青木君は上に進めるときは進んでおく()
	* 例えばnow.xが10, now.yが7だとする。
	* ここまで進んだということはx座標が9以下の障害物にぶつかれていないということをふまえると、
	* もしx,y = 11,3に障害物があったとして、この障害物に進むような手順があったことを証明できる。
	* つまり、yに関しては進めるだけ進んで、戻りたい時に戻れる。
	*/
	while(true){
		int memo = pi;//pという障害物をx座標昇順ソートした配列がある。 p[pi]と言った形で障害物を参照。初期値はpi=0。

		if(now.x == H){//すでに右端に到達してるなら現在のX座標が答え。
			cout<<now.x<<endl;
			return 0;
		}

		/*
		*now.xの一つ右 かつ now.y以下 の座標に障害物があれば、そこにぶつかるように調整できる。
		*/
		while(memo < N && now.x + 1 >= p[memo].x){//pはxについて昇順ソートされていることに注意。
			if((now.x+1==p[memo].x && now.y>=p[memo].y)){//もしぶつかれるならnow.xが答え。
				cout<<now.x<<endl;
				return 0;
			}else{//ぶつかれないなら次の障害物を確認.
				memo++;
			}
		}
		now.x++;//ぶつからなかったので右に移動。
		bool can = true;//上に移動できますか？
		while(pi < N && now.x >= p[pi].x){
			if(now.x==p[pi].x && now.y+1==p[pi].y){//上に移動できなかった場合
				can = false;
				pi++;//障害物を次に進める(そのxは通り越したので、もう見る必要はない)
			}else{
				pi++;//障害物を次に進める(そのxは通り越したので、もう見る必要はない)
			}
		}
		if(can){
			now.y++;
		}
	}
	return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	vector<string> vec;
	int len = s.size();
	int ans = 1;
	vec.push_back(string(1, s[0]));
	int i = 1;
	while (i < len - 1) {
		int j = i + 1;
		string tmp(1, s[i]);
		while (tmp == vec[ans - 1]) {
			tmp += s[j++];
		}
		vec.push_back(tmp);
		ans++;
		i = j;
	}
	if (i == len - 1) {
		if (vec[ans - 1] == string(1, s[i])) {
			vec[ans - 1] += s[i];
		} else {
			vec.push_back(string(1, s[i]));
			ans++;
		}
	}
/*	for (auto str: vec) {
		cout << str << endl;
	}*/
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 10996
#include<bits/stdc++.h>
using namespace std;
const int maxn=1000005;
const int mod=998244353,inf=1000000007;
string str;
int num[maxn],f1[maxn],f2[maxn];
signed main(){
	cin>>str;
	reverse(str.begin(),str.end());
	int len=str.length();
	for(int i=1;i<=len;++i)
		num[i]=str[i-1]-'0';
	f1[1]=num[1],f2[1]=10-num[1];
	for(int i=2;i<=len;++i)
	{
		f1[i]=min(f1[i-1]+num[i],f2[i-1]+num[i]+1);
		f2[i]=min(f2[i-1]+9-num[i],f1[i-1]+10-num[i]);
	}
	cout<<min(f1[len],f2[len]+1)<<endl;
	return 0;
}

Measured memory_bytes: 13060
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
 
int main() {
	char c;
	cin >> c;

	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
	{
		cout << "vowel" << endl;
	}
	else
	{
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 3604
n = int(input())
a = list(map(int, input().split()))
total = 0
minus = 0
smallest = abs(a[0])
for i in range(n):
    smallest = min(smallest, abs(a[i]))
    if a[i] < 0:
        minus = (minus + 1) % 2
        total -= a[i]
    else:
        total += a[i]
if minus == 1:
    print(total - 2 * smallest)
else:
    print(total)

Measured memory_bytes: 14412
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
ll num[100005], sum[100005];
int main () {
  int n;
  scanf("%d", &n);
  FOR(i, 0, n) {
    scanf("%lld", &num[i]);
  }
  if (n == 0) {
    if (num[0] != 1) printf("-1\n");
    else printf("1\n");
    return 0;
  }
  if (num[0] > 0 || num[n] == 0) {
    printf("-1\n"); return 0;
  }
  sum[n + 1] = 0;
  FORD(i, n, 0) {
    sum[i] = sum[i + 1] + num[i];
  }
  ll d = 1, cnt = 1;
  FOR(i, 0, n - 1) {
    d -= num[i];
    if (d < 1) {
      printf("-1\n"); return 0;
    }
    d = min(d * 2, sum[i + 1]);
    cnt += d;
  }
  if (d != num[n]) printf("-1\n");
  else printf("%lld\n", cnt);
  return 0;
}

Measured memory_bytes: 5316
import numpy as np


def numOfDigit(n):
    return int(np.log10(n) + 1)


N = int(input())
M = numOfDigit(N)

for i in range(int(np.sqrt(N)) + 1):
    if N % (i + 1) != 0:
        continue
    N1 = N / (i + 1)
    N2 = i + 1
    M = min(M, numOfDigit(max(N1, N2)))

print(M)


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

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

  ll n;
  cin>>n;
  ll ans;
  if(n%1000==0){
    ans=0;
  }
  else{
    ans=1000-n%1000;
  }

  cout<<ans;


}






Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <cmath>
#include <math.h>

using namespace std;
const long long INF = (long long) (1e18)+1;

int main() {
  string s, t;
  long long a;
  double b;
  cin >> a >> b;
  long long ib = b * 100 + 0.5;
  long long ans = a * ib / 100;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3720