akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    string s; cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc")
    {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String str = reader.readLine();
		int X = Integer.parseInt(str);
		int amari = X % 100;
		int kosuu = X / 100;
		if (amari > 5 * kosuu) {
			System.out.println("0");
			return;
		}
		System.out.println("1");
		
	}
}


Measured memory_bytes: 21204
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
#include<boost/operators.hpp>
#include<boost/dynamic_bitset.hpp>

namespace adaptor = boost::adaptors;

void Main()
{
	int N, D;
	std::cin >> N >> D;
	int ret = 0;
	for (int i = 0; i < N; ++ret)
	{
		i += 2 * D + 1;
	}
	std::cout << ret << std::endl;
}

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

Measured memory_bytes: 256
n = int(input())
hlst = list(map(int, input().split()))
INF = 10 ** 20
dp = [INF] * n
dp[0] = 0
for i in range(n):
  if i + 1 <= n - 1:
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(hlst[i] - hlst[i + 1]))
  if i + 2 <= n - 1:
    dp[i + 2] = min(dp[i + 2], dp[i] + abs(hlst[i] - hlst[i + 2]))
print(dp[n - 1])

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

int main() {
  string s;
  cin >> s;
  int64_t s_size = s.size();
  int64_t sum = 0;
  
  for(int tmp = 0; tmp < (1 << s_size - 1); tmp++) {
    bitset<20> b(tmp);
    
    int64_t sum_a = s.at(0) - '0';
    for (int i = 0; i < s_size - 1; i++){
      if(b.test(i)) { 
        sum_a *= 10;
        sum_a += s.at(i + 1) - '0';
      }
      else {
        sum += sum_a;
        sum_a = s.at(i + 1) - '0';
      }
    }
    sum += sum_a;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;



int main(){
    int x,a,b;
    cin >> x >> a >> b;
    if(abs(x-a)>abs(x-b)){
        puts("B");
        return 0;
    }else{
        puts("A");
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000
//bool cmp(P a,P b){ return a.second < b.second;}
	ll N,M,K,ans=0;
	ll A;
	ll B;
	ll C[200010];
    string S;



int main(){
	std::ios_base::sync_with_stdio(false);
    cin>>N>>A>>B;
	REP(i,N){
		for(int j=i+1;j<N;j++){
			ll a=abs(j-i),b=abs(A-i-1)+1+abs(B-j-1),c=abs(B-i-1)+1+abs(A-j-1);
			C[min({a,b,c})-1]++;
		}
	}
	REP(i,N-1)cout<<C[i]<<endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a[n][3] = {};
    for(int i=0; i<n; i++){
        cin >> a[i][0] >> a[i][1] >> a[i][2];
    }
    int dp[n][3] = {};
    dp[0][0] = a[0][0];
    dp[0][1] = a[0][1];
    dp[0][2] = a[0][2];
    for(int i=0; i<n-1; i++){
        for(int j=0; j<3; j++){
            int k = (j+1)%3;
            int l = (j+2)%3;
            dp[i+1][k] = max(dp[i][j]+a[i+1][k], dp[i+1][k]);
            dp[i+1][l] = max(dp[i][j]+a[i+1][l], dp[i+1][l]);
        }
    }
    int ans = max(max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int C = sc.nextInt();
    	
    	int r = 0;
    	if( C > A+B+1 ) {
    		r = A+B+1;
    	}
    	else {
    		r = C;
    	}
    	System.out.println( r + B );
    	sc.close();
    }
}


Measured memory_bytes: 23252
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
const char dir[4] = { 'u','l','d','r' };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

vector<tuple<int, int, int>>ans;
int n, m;
int l;

int main() {
	cin >> l;
	while (1 << n <= l)n++;
	for (int i = 1; i < n; i++) {
		ans.emplace_back(make_tuple(i, i + 1, 1 << (i - 1)));
		ans.emplace_back(make_tuple(i, i + 1, 0));
	}
	int now = (1 << (n - 1)) - 1;
	for (int i = n - 1; i >= 1; i--) {
		if (now == l - 1)break;
		int num = 1 << (i - 1);
		if (now + num <= l - 1) {
			ans.emplace_back(make_tuple(i, n, now + 1));
			now += num;
		}
	}
	m = ans.size();
	cout << n << " " << m << endl;
	for (auto a : ans) {
		cout << get<0>(a) << " " << get<1>(a) << " " << get<2>(a) << endl;
	}
}

Measured memory_bytes: 256
#include <iostream> 
using namespace std;
const int maxn = 100005;
int GCD(int a, int b){ return b ? GCD(b, a % b) : a; }
int A[maxn],l[maxn], r[maxn];
int main(){
	int N; cin >> N;
	for(int i = 0; i < N; ++i) cin >> A[i];
	for(int i = 0; i < N; ++i) {
		l[i+1] = GCD(l[i], A[i]);
	}
	for(int i = N-1; i >= 0; --i){
		r[i] = GCD(r[i+1], A[i]);
	}
 
	int max = 0;
	for(int i = 0; i < N; ++i){
		int ll = l[i], rr = r[i+1];
		int g = GCD(ll, rr);
		if(max < g) max = g;
	}
	cout << max << endl;
	return 0;
}

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

bool Judge(int m, int index, vector<int> &A)
{
	if(m == 0){
		return true;
	}
	if(index == A.size()){
		return false;
	}
	int l = m - A[index];
	index++;
	return Judge(m, index, A) || Judge(l, index, A);
}

int main()
{
	int n, q; //n:??´??°???????????? q:???????????° 
	cin >> n;
	vector<int> A, M;
	for(int i = 0; i < n; i++){
		int a;
		cin >> a;
		A.push_back(a);
	}
	cin >> q;
	for(int i = 0; i < q; i++){
		int m;
		cin >> m;
		M.push_back(m);
	}
	for(int i = 0; i < q; i++){
		if(Judge(M[i], 0, A)){
			cout << "yes" << endl;
		}else{
			cout << "no"  << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3156
/*******************************
 * written by Koki Riho
 * Rih0z https://github.com/Rih0z
 *******************************/

#include<iostream>
#include<map>
#include<vector>
#include<string>
#include<numeric>
#include<algorithm>

#define DEBUG false

#define FOR(i , a, b) for(size_t i = a ; i < b ; i++ )
#define REP(i,b) FOR(i , 0 , b)
#define RFOR(i,a,b) for(size_t i = a-1 ; i >= b ; i--)
#define RREP(i,a) RFOR(i,a,0)



typedef long long ll;
using namespace std;

int scanInt(void);
string scanString(void);

void scanLlArr(ll *a , int n);
void scanCharArr(char *string);

void printInt(int p);
void printLlArr(ll *a);
void printCharArr(char *string);


void perSum(ll *a , ll *sum ,int n);

/*************Global variable  **************/
int N ;
bool ok = true ;
char str[26];
std::map<char,int> M ;
/*******************************/

int main(){
  if (DEBUG){
    std::printf("******debug mode********\n");
  }
  cin >> N ;
  string S[N];
  REP(i,N){
    cin >> S[i];
  }
  int j , k ;
  REP(i,N){
    for(j = 0 ; j < i ; j++){
     if(S[i] == S[j]){
       ok = false ;
     }
    }
  }
  REP(i ,N-1){
    if(S[i][S[i].length()-1] != S[i+1][0])
      ok = false;
  }
  if(ok){
  cout << "Yes" << endl;
  }else {
  cout << "No" << endl;
  }
  if (DEBUG){
    std::printf("******debug********\n");

    std::printf("******debug********\n");
  }
  return 0 ;
}

//各地点までの部分和を計算する
void perSum(ll *a , ll *sum ,int n){
  int i ;
  sum[0] = a[0];
  for(i = 1 ; i < n ; i++){
    sum[i] = a[i] + sum[i-1];
  }

}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func getMaxInt(numbers []int) int {
	var max int
	max = numbers[0]
	for _, v := range numbers {
		if max < v {
			max = v
		}
	}
	return max
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	max := getMaxInt(a)
	median := int(max / 2)
	diff := max
	diff_index := 0
	for i := 0; i < n; i++ {
		if a[i] == max {
			continue
		}
		if int(math.Abs(float64(median - a[i]))) < diff {
			diff_index = i
			diff = int(math.Abs(float64(median - a[i])))
		}
	}
	fmt.Println(max, a[diff_index])
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793


int main(){
    int n;
    cin >> n;
    VI a(n);
    vector<VI> x(n,VI(n));
    vector<VI> y(n,VI(n));
    rep(i,n){
        cin >> a.at(i);
        rep(j,a.at(i)){
            cin >> x.at(i).at(j) >> y.at(i).at(j);
        }
    }
    int mx=0;
    for(int bit=0;bit< (1<<n);bit++){
        set<int> good;
        bool chk=true;
        rep(k,n){
            if(bit & (1<<k)){
                good.insert(k+1);
            }
        }
        rep(i,n){
            if(good.count(i+1)){
             rep(j,a.at(i)){
                if(y.at(i).at(j)==1){
                    if(good.count(x.at(i).at(j)));
                    else{ 
                    chk=false;
                    break;
                    }
                }
                else if(y.at(i).at(j)==0){
                    if(good.count(x.at(i).at(j))){
                        chk=false;
                        break;
                    }
                }
             }
            }
            if(chk);
            else break;
        }
        if(chk){
            int m=good.size();
            mx=max(mx,m);
        }
    }
    cout << mx << endl;
}

    

Measured memory_bytes: 3644
H = int(input())
W = int(input())
N = int(input())
a = 0
if H > W:
    a = N / H
    if H * int(a) >= N:
        print(int(a))
    else:
        print(int(a) + 1)
else:
    a = N / W
    if W * int(a) >= N:
        print(int(a))
    else:
        print(int(a) + 1)

Measured memory_bytes: 3060
S = input()
N = len(S)
K = int(input())
top_k = []
for i in range(N):
    for j in range(i + 1, min([i + K, N]) + 1):
            st = S[i:j]
            top_k.append(st)
            if len(top_k) > K:
                top_k = list(set(top_k))
                top_k.sort()
                top_k = top_k[:K]
top_k.sort()
print(top_k[-1])

Measured memory_bytes: 3188
/*** akshaykumar99 ***/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
 
#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long INF = INT_MAX;
const long long LINF = LLONG_MAX;
const long long N = 2e5+1;
 
typedef long long ll;
typedef long double ld;

vector<ll> v[N];
ll ans, ff;
vector<ll> vv;
bool vis[N];

void dfs(ll s)
{
    vv.pu(s);
    vis[s] =1 ;
    for(auto u : v[s])
    {
        if(!vis[u])
        {
            dfs(u);
        }
        else
        {
            ff = u;
        }
    }
}
void test_case()
{
    ll n,k,i,j;
    cin>>n>>k;
    f(i,1,n+1)
    {
        ll x;
        cin>>x;
        v[i].pu(x);
    }
    dfs(1);
    ll nn = vv.size(), st;
    for(ll i = 0; i < nn; i++)
    {
        if(vv[i] == ff)
        {
            st = i;
            break;
        }
        if(k==0)
        {
            cout<<vv[i]<<'\n';
            return;
        }
        k--;
    }
    vector<ll> res;
    for(ll i = st; i < nn; i++)
    {
        res.pu(vv[i]);
    }
    ll mm = res.size();
    cout<<res[k % mm]<<'\n';
}

int32_t main()
{
    IOS(); 
   
    int tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

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

int GCD(int a, int b){
	if(b == 0) return a;
	else return GCD(b, a%b);
}

int LCM(int a, int b){
	return a / GCD(a, b) * b;
}

int main()
{
	int a,b;
	while(cin >> a >> b){
		
		cout << GCD(a,b) << " " << LCM(a,b) << endl;
	}
}

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

int main(void) {
  double a,b,c,S,l,L,h;
  scanf("%lf %lf %lf",&a,&b,&c);
  S = a * b * sin(c * M_PI / 180.000) / 2;
  L = (a * a) + (b * b) - 2 * a * b * cos(c * M_PI / 180.000);
  h = b * sin(c * M_PI / 180.000);
  printf("%lf\n%lf\n%lf\n",S,sqrt(L) + a + b,h);
}


Measured memory_bytes: 2076
from sys import stdin
import sys
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    N = ri()
    D = ria()

    s = sum(D)
    s *= s
    d = sum(map(lambda x: x * x, D))
    print((s - d) //2)


if __name__ == "__main__":
    main()


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

int main()
{
    int H, N;
    cin >> H >> N;
    int Ai, Bi;
    vector<int> dp(H+1, numeric_limits<int>::max());
    dp[0] = 0;
    for(int i=0;i<N;i++){
        cin >> Ai >> Bi;
        for(int j=0;j<H;j++){
            if(dp[j] == numeric_limits<int>::max()) continue;
            int k = min(j + Ai, H);
            dp[k] = min(dp[k], dp[j] + Bi);
        }
    }
    cout<<dp[H]<<endl;

    return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    ll a[n+2], d[n], total = 0LL;
    a[0] = 0LL;
    rep(n) cin >> a[i+1];
    a[n+1] = 0LL;
    rep(n+1){
        d[i] = abs(a[i+1] - a[i]);
        total += d[i];
    }
    a[0] = 0LL;
    reppp(i, 1, n+1){
        cout << total - d[i-1] - d[i] + abs(a[i+1] - a[i-1]) << endl;
    }
}


Measured memory_bytes: 2816
#include <climits>
#include <iostream>
#include <vector>

long long manhattan(std::pair<long long, long long> a, std::pair<long long, long long> b)
{
    return std::abs(a.first - b.first) + std::abs(a.second - b.second);
}

int main()
{
    int n, m;
    std::cin >> n >> m;

    std::vector<std::pair<long long, long long>> student_pos(n);
    for (int i = 0; i < n; i++) {
        long long a, b;
        std::cin >> a >> b;

        student_pos[i] = std::make_pair(a, b);
    }

    std::vector<std::pair<long long, long long>> checkpoint_pos(m);
    for (int i = 0; i < m; i++) {
        long long a, b;
        std::cin >> a >> b;

        checkpoint_pos[i] = std::make_pair(a, b);
    }

    for (int i = 0; i < n; i++) {
        long long min = LONG_LONG_MAX;
        long long min_idx = 1;

        for (int j = 0; j < m; j++) {
            if (min > manhattan(student_pos[i], checkpoint_pos[j])) {
                min = manhattan(student_pos[i], checkpoint_pos[j]);
                min_idx = j + 1;
            }
        }
        std::cout << min_idx << std::endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
using namespace std;

typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vint;
typedef vector<uint> vuint;
typedef vector<ull> vull;
typedef vector<ll> vll;

#define init(type,var) type var;cin>>var;
#define vinit(vtype,var,n) vtype var((uint)n);loop(i,0,n)cin>>var[i];
#define range(container) container.begin(),container.end()
#define loop(i,first,end) for(ull i=(first);i<(end);i++)
#define outl(out) cout<<(out)<<endl;

const ull INF = (ull)(-1LL);

int main(void){
	init(ll, n);
	vinit(vll, a, n);
	loop(i, 0, n)a[i]--;
	vinit(vll, b, n);
	vinit(vll, c, n - 1);

	ll f = b[a[0]];

	loop(i, 1, n){
		f += b[a[i]];
		if (a[i] - a[i - 1] == 1)f += c[a[i - 1]];
	}

	outl(f);

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
using namespace std;
int main(){
    int a,b,count,s;
 
    while(scanf("%d %d",&a,&b)!=EOF){
        count=0;
        s=a+b;
        while(s!=0){
            s/=10;
            count++;
        }
        printf("%d\n",count);
    }
 
    return 0;
}


Measured memory_bytes: 3116
import math


def binarySearch(l, r):
    while r - l > eps:
        mid = (l+r)/2
        if f(mid):
            r = mid
        else:
            l = mid
    return r


def f(mid):
    if h1 >= b / 2:
        c = b - h1 - (a / 2 * math.tan(mid)) <= 0
    else:
        c = 2 * h2 - (b * math.tan(math.pi / 2 - mid)) >= 0
    return c


a, b, x = map(int, input().split())
eps = 10 ** -12
r = 90 * 10 ** 6
h1 = x / a ** 2
h2 = x / (a * b)
e = binarySearch(0, 90 * math.pi / 180)
print(e / math.pi * 180)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <climits>

#define X first
#define Y second
#define vsort(v) sort((v).begin(), (v).end())
#define vrev(v) reverse((v).begin(), (v).end())


//INT_MAX
//INT_MIN
//LLONG_MAX
//LLONG_MIN
//DBL_MIN
//DBL_MAX
//LDBL_MIN
//LDBL_MAX

using namespace std;
using ll = long long;

int main(int argc, const char * argv[]) {
    int a, b;
    cin >> a >> b;
    if (a * b % 2 == 0) {
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;


int cnt[100005];

int main() {
	int n; cin >> n;
	int t = 0, sum = 0;
	while (sum < n) {
		t++;
		sum += t;
	}
	if (sum != n) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	cout << t + 1 << endl;
	
	vector<vector<int>> ans(t + 1, vector<int>(t));
	for (int i = 1; i <= t; i++) ans[0][i - 1] = i, cnt[i]++;
	for (int i = 1; i < t + 1; i++) {
		for (int j = 0; j < i; j++) {
			for (int b : ans[j]) {
				if (cnt[b] >= 2) continue;
				cnt[b]++;
				ans[i][j] = b;
				break;
			}
		}
		int idx = i;
		for (int j = ans[i][i - 1] + 1; j <= n; j++) {
			if (idx >= t) break;
			if (cnt[j] >= 1) continue;
			
			cnt[j]++;
			ans[i][idx] = j;
			idx++;
		}
	}
	for (int i = 0; i < t + 1; i++) {
		cout << ans[i].size() << " ";
		for (int j = 0; j < t; j++) cout << ans[i][j] << (j < t - 1 ? " " : "\n");
	}
	return 0;
}

Measured memory_bytes: 2560
n = gets.chomp.to_i
temochi = {S:(1..13).to_a, H:(1..13).to_a, C:(1..13).to_a,D:(1..13).to_a}
n.times do
    card_case, number = gets.chomp.split
    case card_case
    when "S"
        temochi[:S] -= [(number.to_i)]
    when "H"
        temochi[:H] -= [(number.to_i)]
    when "C"
        temochi[:C] -= [(number.to_i)]
    when "D"
        temochi[:D] -= [(number.to_i)]
    end
end
#s_length = 13 - temochi[:S].length.to_i
#puts "S #{temochi[:S].first(13{} - temochi[:S].length)}"
temochi[:S].each do |i|
    puts "S #{i}"
end
temochi[:H].each do |i|
    puts "H #{i}"
end
temochi[:C].each do |i|
    puts "C #{i}"
end
temochi[:D].each do |i|
    puts "D #{i}"
end

Measured memory_bytes: 6116
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


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

    for (;;) {
        int R0, W0, C, R;
        cin >> R0 >> W0 >> C >> R;
        if (R0 == 0) break;

        int ans = max((C * W0 - R0 + R - 1) / R, 0);
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 3128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n, m;
vector<llint> G[20];
llint in[1<<15], out[1<<15];
llint adj[1<<15], pop[1<<15];
llint dp[1<<15], dp2[1<<15];
llint beki[305];

void calc(llint dp[], llint S, llint T)
{
	llint N = 1<<n;
	dp[1<<S] = 1;
	for(int i = 0; i < N; i++){
		if((i & (1<<S)) == 0 || (i&(1<<T))) continue;
		llint sum = beki[in[i]];
		for(int j = (i-1)&i; j > 0; j = (j-1)&i){
			if((j & (1<<S)) == 0) continue;
			sum += mod - dp[j]*beki[in[i-j]]%mod, sum %= mod;
		}
		dp[i] = sum;
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	llint u, v;
	for(int i = 0; i < m; i++){
		cin >> u >> v;
		u--, v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	beki[0] = 1;
	for(int i = 1; i < 305; i++) beki[i] = beki[i-1] * 2 % mod;
	
	llint N = 1<<n;
	for(int i = 0; i < N; i++){
		adj[i] = i;
		for(int j = 0; j < n; j++){
			if((i & (1<<j)) == 0) continue;
			for(int k = 0; k < G[j].size(); k++){
				llint u = G[j][k];
				if((i & (1<<u)) == 0) out[i]++, adj[i] |= 1<<u;
				else in[i]++;
			}
		}
		in[i] /= 2;
	}
	for(int i = 1; i < N; i++) pop[i] = pop[i&(i-1)]+1;
	
	calc(dp, 0, 1);
	calc(dp2, 1, 0);
	
	llint ans = 0;
	for(int i = 0; i < N; i++){
		if((i & (1<<0)) == 0 || (i & (1<<1))) continue;
		llint c = (N-1) - adj[i];
		for(int j = c; j > 0; j = (j-1)&c){
			if((j & (1<<1)) == 0) continue;
			llint cnt = m - (out[i] + out[j] + in[i] + in[j]);
			llint tmp = dp[i] * dp2[j] % mod * beki[cnt] % mod;
			ans += tmp, ans %= mod;
		}
	}
	ans = beki[m] - ans + mod, ans %= mod;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1792
N = int(input())
k = [0]*5
ans = 0
for i in range(N):
  S = input()
  if S[0] == "M":
    k[0] += 1
  elif S[0] == "A":
    k[1] += 1
  elif S[0] == "R":
    k[2] += 1
  elif S[0] == "C":
    k[3] += 1
  elif S[0] == "H":
    k[4] += 1
  else:
    continue
ans += k[0]*k[1]*k[2]
ans += k[0]*k[1]*k[3]
ans += k[0]*k[1]*k[4]
ans += k[0]*k[2]*k[3]
ans += k[0]*k[2]*k[4]
ans += k[0]*k[3]*k[4]
ans += k[1]*k[2]*k[3]
ans += k[1]*k[2]*k[4]
ans += k[1]*k[3]*k[4]
ans += k[2]*k[3]*k[4]
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

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

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

	int n;
	cin >> n;

	const int S = n / 2;

	vector<int> t(n, 0);
	REP(i, 1, n) cin >> t[i];

	enum { A, B, NUM };
	constexpr int INF = (1 << 29);
	vector<vector<int>> dp(S + 2, vector<int>(NUM, INF));
	dp[0][A] = dp[0][B] = 0;

	rep(i, n) {
		vector<vector<int>> next(S + 2, vector<int>(NUM, INF));

		rep(j, min(S, i) + 1) {
			next[j + 1][A] = min(dp[j][A], dp[j][B] + t[i]);
			next[j][B] = min(dp[j][A] + t[i], dp[j][B]);
		}

		dp = move(next);
	}

	cout << min(dp[S][A], dp[S][B]) << endl;

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1592
def gcd(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x, y = y, x % y
    return y


def gcd3(ll):
    ans = ll[0]
    for i in range(1, len(ll)):
        ans = gcd(ans, ll[i])
    return ans


D = {}
def prime_div(n, A):
    if len(D) == 0:
        for a in range(2, A + 1, 2):
            D[a] = 2
        for a in range(3, A + 1):
            if a in D:
                continue
            now = a
            while now <= A:
                if now not in D:
                    D[now] = a
                now += a * 2
    result = []
    while n > 1:
        result.append(D[n])
        n = n // D[n]
    return result
    

def checkPairwise(ll):
    dic = {}
    for n in ll:
        primes = list(set(prime_div(n, 1000000)))
        # print(n, primes)
        for p in primes:
            if p not in dic:
                dic[p] = 1
            else:
                return False
    return True


def main():
    N = int(input())
    A = [int(n) for n in input().split(" ")]
    a1 = checkPairwise(A)
    if a1:
        print("pairwise coprime")
    else:
        a2 = gcd3(A)
        if a2 == 1:
            print("setwise coprime")
        else:
            print("not coprime")


if __name__ == "__main__":
    main()

Measured memory_bytes: 147804
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

#define INF SHRT_MAX


short** input( short* n ) {

  short i, j;
  short** g;

  scanf( "%hd", n );
  g = (short**)malloc( sizeof( short* ) * *n );
  for( i=0; i<*n; i++ ) {
    g[i] = (short*)malloc( sizeof( short ) * *n );
  }

  for( i=0; i<*n; i++ ) {
    for( j=0; j<*n; j++ ) {

      scanf( "%hd", &g[i][j] );
      if( g[i][j] < 0 ) {
	g[i][j] = INF;
      }

    }
  }

  return g;
}



int mstForCost( short** g, short n ) {

  int   cost, i, add;
  short di[n], min, minDist;
  char  co[n];

  for( i=0; i<n; i++ ) {
    di[i] = INF;
    co[i] = 0;
  }

  add = 0;
  co[0] = 1;
  cost = 0;
  while( 1 ) {

    for( i=0; i<n; i++ ) {
      if( g[add][i] < di[i] && co[i] == 0) {
	di[i] = g[add][i];
      }
    }
    
    
    minDist = INF;
    for( i=0; i<n; i++ ) {
      if( di[i] < minDist  && co[i] == 0 ) {
	minDist = di[i];
	min = i;
      }
    }
    if( minDist == INF ) {
      return cost;
    }

    add = min;
    co[ min ] = 1;
    cost += minDist;

  }

  return 0;

}


main() {

  short i, j, n;
  short** g;


  g = input( &n );

  printf( "%d\n", mstForCost( g, n ) );

  return 0;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout<<"### "<<x<<endl;
#define For(a,b,c) for(int a=b;a<=c;++a)
#define Dor(a,b,c) for(int a=b;a>=c;--a)
inline int read(){
    int x=0;char c=getchar();
    while(c<'0'||c>'9')c=getchar();
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return x;
}
long long n;
int main(){
	cin>>n;
	cout<<n*(n-1)/2<<endl;
	
	
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int N;
int c=0;

int main(){
  if(scanf("%d", &N)==1);
  int p[N];
  for(int i=0; i<N; i++){
    if(scanf("%d", &p[i])==1);
  }
  
  for(int i=1; i<N-1; i++){
    if((p[i-1]<p[i]&&p[i]<p[i+1]) || (p[i-1]>p[i]&&p[i]>p[i+1]))c++;
  }
  
  printf("%d", c);
  
  return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>
#include <stack>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int N, K;
  cin >> N >> K;
  vector<int> as(N);
  rep (i, N) cin >> as[i];

  int ans;// = (N) / (K-1);
  if (N==K) ans = 1;
  else ans = 1+ (N-K) / (K-1) + (((N-K)%(K-1)>0) ? 1 : 0);
  cout << ans << endl;

  return 0;
}








Measured memory_bytes: 1016
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

VVL adj;
LL vals[200001];
bool vis[200001];

void dfs(LL node){
    vis[node] = true;
    for(auto num : adj[node]){
        if(!vis[num]){
            vals[num] += vals[node];
            dfs(num);
        }
    }
}

int main()
{
    fast();



    LL t,n,i,j,k,x,y,c,m;
    cin >> n >> k;
    MEM(vals, 0);
    MEM(vis, false);
    adj.resize(n);
    REP(i, n - 1){
        cin >> x >> y;
        --x;
        --y;
        adj[x].PB(y);
        adj[y].PB(x);
    }
    REP(i, k){
        cin >> x >> y;
        --x;
        vals[x] += y;
    }

    dfs(0);
    REP(i, n){
        cout << vals[i] << " ";
    }

}

Measured memory_bytes: 21376
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int k; cin >> k;
  queue<ll> a;
  for(int i = 1; i < 10; i++)  a.push(i);
  if(k < 10){
    cout << k << endl;
    return 0;
  }
  int now = 9;
  while(true){
    int n = a.front(); a.pop();
    for(int i = -1; i <= 1; i++){
      int p = n%10 + i;
      if(p < 0 || p > 9) continue;
      now++;
      ll temp = (ll)n*10 + p;
      if(now == k){
        cout << temp << endl;
        return 0;
      }
      a.push(temp);
    }
  }
  return 0;
}


Measured memory_bytes: 768
from sys import stdin

x = []
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))

k = int(stdin.readline().rstrip())

flag = 0
for i in range(1,5):
    for j in range(0,i):
        if abs(x[i] - x[j]) > k:
            flag = 1

if flag == 0:
    print("Yay!")
else:
    print(":(")

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

const long long mod=1000000007;

int main(int argc, char const *argv[])
{
	int n,k;
	cin>>n>>k;
	int cnt[100000]={},now=1,pos=0;
	while (now<=n)
	{
		int inv=n/now;
		if (n<=inv)
		{
			cnt[pos]=1;
			++now;			
		}
		else
		{
			cnt[pos]+=n/inv-now+1;
			now=n/inv+1;
		}
		++pos;
	}
	long long sum[k+5][pos+5]={},dp[k+5][pos+5]={};
	dp[0][0]=1LL;
	for (int i = 0; i < k; ++i)
	{
		for (int j = 0; j <= pos; ++j)
		{
			sum[i][j+1]=(sum[i][j]+dp[i][j])%mod;
		}
		for (int j = 0; j < pos; ++j)
		{
			dp[i+1][j]=sum[i][pos-j]*cnt[j]%mod;
		}
	}
	long long ans=0LL;
	for (int i = 0; i <= pos; ++i)
	{
		ans+=dp[k][i];
		ans%=mod;
	}
	cout<<ans<<endl;
}
	

Measured memory_bytes: 104448
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
struct S{
	int idx,a,b;
	bool operator<(S s){return b<s.b;}
};
S a[100005];
int to[100005];
bool used[100005];
int flag[100005];
vector<P>x;
signed main(){
	cin>>N;
	rep(i,N){
		cin>>a[i].a;a[i].idx=i;
	}
	rep(i,N){
		cin>>a[i].b;
	}
	sort(a,a+N);
	rep(i,N){
		x.pb({a[i].a,i});
	}
	sort(all(x));
	rep(i,N){
		if(x[i].first>a[i].b){
			cout<<"No"<<endl;return 0;
		}
		to[x[i].second]=i;
	}
	rep(i,N){
		if(i<N-1&&a[i].b>=x[i+1].first){
			cout<<"Yes"<<endl;return 0;
		}
	}
	rep(i,N){
		if(!used[i]){
			used[i]=true;
			int j=to[i],cnt=1;
			while(j!=i){
				used[j]=true;
				cnt++;j=to[j];
			}
			if(cnt!=N){
				cout<<"Yes"<<endl;return 0;
			}
		}
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 5104
#include<stdio.h>
#include<algorithm>
using namespace std;
long long b[110];
long long c[110];
int n;
int chk(long long L,long long R){
	if(L<1||L>1000000000000000000LL||R<1||R>1000000000000000001LL)return 0;
	if(L>=R)return 0;
	for(int i=0;i<n;i++){
		long long val=R/(1LL<<(i+1))*(1LL<<i)+max(0LL,R%(1LL<<(i+1))-(1LL<<i));
		val-=L/(1LL<<(i+1))*(1LL<<i)+max(0LL,L%(1LL<<(i+1))-(1LL<<i));
		if(val!=b[i])return 0;
	}
	return 1;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++)scanf("%lld",b+i);
		n=0;
		for(int i=0;i<a;i++)if(b[i])n=i+1;
		bool dame=false;
		for(int i=0;i<n;i++)if(b[i]>1000000000000000000LL)dame=true;
		if(n>60||dame){
			printf("None\n");continue;
		}
		
		for(int i=0;i<n;i++)c[i]=b[i];
		pair<long long,long long>L=make_pair(-1,-1);
		pair<long long,long long>R=make_pair(-1,-1);
		long long tl=1;
		long long tr=(1LL<<(n-1))+c[n-1];
		for(int i=0;i<n-1;i++){
			c[i]-=c[n-1]/(1LL<<(i+1))*(1LL<<i)+max(0LL,c[n-1]%(1LL<<(i+1))-(1LL<<i));
		}
		for(int i=n-2;i>=0;i--){
			if(c[i]<(1LL<<i)){
				tl=(1LL<<(i+1))-c[i];
				break;
			}
			for(int j=0;j<i;j++){
				c[j]-=(1LL<<i)/2;
			}
		}
		//printf("%lld %lld\n",tl,tr);
		if(chk(tl,tr))L=make_pair(tl,tr);
		for(int i=0;i<n;i++)c[i]=b[i];
		long long sz=c[n-1];
		tl=1LL<<(n-1);
		tr=(1LL<<n)-sz;
		for(int i=n-2;i>=0;i--){
			if(c[i]&&c[i]<sz){
				tl+=(1LL<<i)+c[i]-sz;
				break;
			}
			if(c[i]==0){
				tr=tl+(1LL<<i)-sz;
			}else{
				tl+=(1LL<<i);
			}
		}
		
		if(chk(tl,tl+sz))R=make_pair(tl,tl+sz);
		//printf("%lld %lld, %lld %lld\n",L.first,L.second,R.first,R.second);
		if(L.first==-1LL&&R.first==-1LL){
			printf("None\n");
		}else if(L.first!=-1LL&&R.first!=-1LL&&(L.first!=R.first||L.second!=R.second)){
			printf("Many\n");
		}else if(L.first!=-1LL){
			printf("%lld %lld\n",L.first,L.second-1);
		}else{
			printf("%lld %lld\n",R.first,R.second-1);
		}
	}
}

Measured memory_bytes: 1040
import sys

lines = [l for l in sys.stdin]
length = int(lines[0])
words = lines[1:]
counter = {w: 0 for w in words}

for w in words:
  counter[w] += 1
  
max_count = max(counter.values())

ret = [w for w, v in counter.items() if v == max_count]
ret.sort()
for w in ret:
  print(w)


Measured memory_bytes: 37012
#include<stdio.h>
int main(){
int n,a[111111],l,i,j;
scanf("%d%d",&n,&l);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n-1;i++){
if(a[i]+a[i+1]>=l){
printf("Possible\n");
for(j=1;j<=i;j++)
printf("%d\n",j);
for(j=n-1;j>i+1;j--)
printf("%d\n",j);
printf("%d\n",i+1);
return 0;
}
}
printf("Impossible\n");
return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;


int main() {
	int n, m;
	cin >> n >> m;
	vector<int> v(n + 1, 1);
	vector<int> h(n + 1, 0);
	for (int i = 0; i < n; i++) {
		cin >> h[i + 1];
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		if (h[a] <= h[b]) v[a] = 0;
		if (h[b] <= h[a]) v[b] = 0;
	}
	int res = 0;
	for (int i = 1; i <= n; i++) {
		res += v[i];
	}
	cout << res << endl;
}


Measured memory_bytes: 3968
def solve():
    e = 10 ** 18
    n = int(input())
    arr = [int(i) for i in input().split()]
    ans, flag = [1,1]
    if 0 in arr:
      	return 0
    for i in arr:
        ans = ans * i
        if ans > e:
            return -1
    return ans
print(solve())

Measured memory_bytes: 84828
import java.util.*;
public class Main {
	public static void main(String arg[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String res = "";
		for(int i = 0; i < s.length(); i++) {
			if(res.length() > 0 && s.charAt(i) == 'B') {
				res = res.substring(0, res.length()-1);
			}
			else if(s.charAt(i) != 'B') {
				res += s.charAt(i);
			}
		}
		
		System.out.println(res);	
	}
}

Measured memory_bytes: 21716
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
//#include<array>
#include<algorithm>
#include<queue>
#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
//#include<bitset>
//#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//配列,座標
/*array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
array<int, 4>dir_x2 = { 0,0,1,-1 };
array<int, 4>dir_y2 = { 1,-1,0,0 };
char alp[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };*/

//Union Find
class UnionFind {
public:
	vector<int>data;
	UnionFind(int size) :data(size, -1) {};
	bool unionset(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x]) {
				swap(x, y);
			}
			data[x] += data[y];
			data[y] = x;
		}
		return x != y;
	}
	bool findset(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

//最大公約数,最小公倍数
/*LLI gcd(LLI x, LLI y) {
	LLI  r;
	if (x < y) {
		swap(x, y);
	}
	r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}
LLI lcm(LLI x, LLI y) {
	return x / gcd(x, y) * y;
}*/

//組み合わせ
/*long nCr(int n, int r) {
	long ans = 1;
	for (int i = n; i > n - r; i--) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; i++) {
		ans = ans / i;
	}
	return ans;
}
long nHr(int n, int r) {
	n = n + r - 1;
	return nCr(n, r);
}*/

//素数判定
/*bool IsPrime(int num)
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}*/

//桁数
/*LLI GetDigit(LLI num) {
	LLI digit = 0;
	while (num != 0) {
		num /= 10;
		digit++;
	}
	return digit;
}*/

//サンプル
/*const int n_max = 8;
array<array<bool, n_max>, n_max>graph;
int dfs(int v,int N,array<bool,n_max>visited) {
	int ret = 0;
	bool all_visited = true;
	for (int i = 0; i < N;i++) {
		if (visited[i] == false) {
			all_visited = false;
		}
	}
	if (all_visited) {
		return 1;
	}
	for (int i = 0; i < N;i++) {
		if (graph[v][i] == false) {
			continue;
		}
		if (visited[i] == true) {
			continue;
		}
		visited[i] = true;
		ret += dfs(i,N,visited);
		visited[i] = false;
	}
	return ret;
}*/

//サンプル
/*vector<vector<int>>sub;
int dfs(int id) {
	if (sub[id].size() == 0) {
		return 1;
	}
	int minP = (int)1e9;
	int maxP = 0;
	for (int i : sub[id]) {
		int P = dfs(i);
		minP = min(minP, P);
		maxP = max(maxP, P);
	}
	return minP + maxP + 1;
}*/

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl
//cout << "Yes" << endl;
//cout << "No" << endl;



int main(void) {
	long double a;
	cin >> a;
	cout << (2 * a) * 3.14159265359 << endl;
}

Measured memory_bytes: 3260
n = int(input())
if n == 0:
    print(0)
    exit()
out = ""
i = 0
while n != 0:
    if n % -2 != 0:
        out = str(- (n % -2)) + out
        n += n % -2
        # print("n:{} div:{}=(-2)^{}".format(n, (-2) ** i, i))
    else:
        out = str(n % 2) + out
    n = int(n / (-2))
    i += 1
print(out)
"""
tmp = 1
digit = 0
while tmp < n:
    tmp *= 4
    digit += 1
number = [0 for i in range(digit)]
print(number)
tmp = n
for i in range(digit):
    if 0 < tmp % 4 < 4:
        number[i] = tmp % 4
        tmp = int(tmp / 4)
"""


Measured memory_bytes: 3064
#include <bits/stdc++.h>
//#pragma GCC target("avx,avx2,sse4.2")
#define re register
#define rep(q, a, b) for (re int q = a, q##_end_ = b; q <= q##_end_; ++q)
#define dep(q, a, b) for (re int q = a, q##_end_ = b; q >= q##_end_; --q)
#define mem(a, b) memset(a, b, sizeof a)
#define debug(a) cerr << #a << ' ' << a << "___" << endl
using namespace std;
//char buf[10000000], *p1 = buf, *p2 = buf;
#define Getchar() getchar()//p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 10000000, stdin), p1 == p2) ? EOF : *p1++
template<typename T>
void in(T &r) {
    static char c;
    r = 0;
    while (c = Getchar(), c < 48)
        ;
    do
        r = (r << 1) + (r << 3) + (c ^ 48);
    while (c = Getchar(), c > 47);
}
const int mn=100005;
long long n,val[mn],ans[mn];
bool mark[mn];
int get(int v){
	if(v==0)v=n;
	if(v>n)v-=n;
	return v;
}
int main(){
	in(n);
	rep(q,1,n)in(val[q]);
	int now=1;
	while(1){
		if(mark[now])break;
		mark[now]=1;
		int lt=now;
		now+=2;
		while(now>n)now-=n;
		ans[now]=ans[lt]+(val[get(lt+1)]-val[lt])*2;
	}
	long long x=(val[1]*2-ans[2])>>1;
	rep(q,1,n)ans[q]+=x,printf("%lld ",ans[q]);
	return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>
#define N 100000

typedef struct stu{
    int num;
    int p_num;
}Student;

typedef Student key;

void marge(key data[], key work[], int start, int mid, int end){
    int i = start;
    int j = mid + 1;
    int k = start;
    while(i <= mid && j <= end){
        if(data[i].p_num <= data[j].p_num){
            work[k++] = data[i++];
        }else{
            work[k++] = data[j++];
        }
    }
    
    if(i <= mid){
        while(i <= mid){
            work[k++] = data[i++];
        }
    }else{
        while(j <= end){
            work[k++] = data[j++];
        }
    }
    
    for(k = start; k <= end; k++){
        data[k] = work[k];
    }
}

void margesort(key data[], key work[], int start, int end){
    int mid;
    if(start < end){
        mid = start + (end - start)/2;
        margesort(data, work, start, mid);
        margesort(data, work, mid + 1, end);

        marge(data, work, start, mid, end);
    }
}

int main(void){
    int n;
    Student a[N+10];
    Student work[N+10];
    int i;
    
    scanf("%d", &n);
    
    for(i = 1; i <= n; i++){
        a[i].num = i;
        scanf("%d", &a[i].p_num);
    }
    
    margesort(a, work, 1, n);
    
    for(i = 1; i <= n; i++){
        printf("%d ", a[i].num);
    }
    
    return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
char s[100001];
main() {
	int n=read(),b=read()-1;
	scanf("%s",s);
	s[b]+='a'-'A';
	printf("%s",s);
}


Measured memory_bytes: 256
N,P = map(int, input().split())
A = [int(a) for a in input().split()]

even = 0
odd = 0
for a in A:
    if a%2 == 0:
        even += 1
    else:
        odd += 1

if odd == 0:
    if P == 0:
        ans = pow(2, N)
    else:
        ans = 0
else:
    ans = pow(2, N-1)

print(ans)

Measured memory_bytes: 3064