akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};

template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}

extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

int main()
{
	int n;
	cin>>n;
	vector<int> cnt(100001);
	int ans=0;
	REP(i,n)
	{
		int a=read<int>();
		if(a>100000)
		{
			ans++;
			continue;
		} 
		cnt[a]++;
	}
	REP(i,100001)
		if(cnt[i]>=i)
		{
			ans+=cnt[i]-i;
		}
		else
			ans+=cnt[i];
	print(ans);
}


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

class _Class
{
	void _()
	{
		var _N = _Ns();

		var a = new List<int>();
		a.Add(_N[0]);
		a.Add(_N[1]);
		a.Add(_N[2]);

		a.Sort();

		if (a[0] == a[1] + a[2])
		{
			Console.WriteLine("Yes");
			return;
		}
		if (a[0] +a[1] == a[2])
		{
			Console.WriteLine("Yes");
			return;
		}
		Console.WriteLine("No");
	}

	static void Main(string[] args)
  {
    new _Class()._();
  }

  #region

  string _S()
  {
    return Console.ReadLine();
  }

  string[] _Ss()
  {
    return Console.ReadLine().Split();
  }

  int[] _N(int n)
  {
    var x = new int[n];
    for (var i = 0; i < n; i++)
    {
      x[i] = int.Parse(Console.ReadLine());
    }
    return x;
  }

  int[] _Ns()
  {
    var ss = Console.ReadLine().Split();

    var x = new int[ss.Length];
    for (var i = 0; i < ss.Length; i++)
      x[i] = int.Parse(ss[i]);

    return x;
  }
  #endregion
}


Measured memory_bytes: 2776
# C - Count Order
import itertools

n = int(input())
p = 1
q = 1
a_list = list(itertools.permutations(range(1,n+1)))
for i in range(2):
    if i == 0:
        p = a_list.index(tuple(map(int,input().split())))
    else:
        q = a_list.index(tuple(map(int,input().split())))
print(abs(p - q))

Measured memory_bytes: 8052
#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 put(a) cout<<a<<"\n"
#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 SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> 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;}


int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    string res = "";
    int dx = tx - sx;
    int dy = ty - sy;
    REP(i,dx){
        res.push_back('R');
    }
    REP(i,dy){
        res.push_back('U');
    }
    REP(i,dx){
        res.push_back('L');
    }
    REP(i,dy){
        res.push_back('D');
    }
    res.push_back('D');
    REP(i,dx+1){
        res.push_back('R');
    }
    REP(i,dy+1){
        res.push_back('U');
    }
    res.push_back('L');
    res.push_back('U');
    REP(i,dx+1){
        res.push_back('L');
    }
    REP(i,dy+1){
        res.push_back('D');
    }
    res.push_back('R');
    put(res);
    return 0;
}


Measured memory_bytes: 256
/*
======================
[     ___T_          ]
[    | 6=6 | =>HI :-)] 
[    |__o__|         ]
[ >===]__o[===<      ]
[     [o__]          ]
[      .".           ]
[      |_|           ]
[                    ]
======================
 */

#include<bits/stdc++.h>
using namespace std;
using lli = int64_t;
int main(){
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int T = 1;
	 for(int t = 1; t <= T; t++){
		 int a,b;
		 cin >> a >> b;
		 if(a > b){
			 for(int i = 0; i < a; i++){
				 cout << b;
			 }
		 }else{
			 for(int i = 0; i < b; i++){
				 cout << a;
			 }
		 }
	 }
}



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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if (k <= a) cout << k << endl;
  else if (k <= a + b) cout << a << endl;
  else cout << a - (k - (a + b)) << endl;
  return 0;
}

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

typedef long long int int64;
int64 max2(int64 a, int64 b) { return a > b ? a : b; }

int64 max3(int64 a, int64 b, int64 c) { return ((a > b ? a : b) > c ? (a > b ? a : b) : c); }

int main()
{
    int64 a,b,c,d;

    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);

    printf("%lld",max2((a*c),max3((a*d),(b*c),(b*d))));
}


Measured memory_bytes: 1732
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}

ll solve(ll N){
  ll ret = 0;
  ll till = (ll)sqrt(N);
  for(ll a = 1 ; a <= till ; a++ ){
    if(N % a == 0){
      if((N/a - 1) <= a){
        continue;
      }
      ret = ret + (N/a - 1);
    }
  }
  return ret;
}

ll N;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N;
  ll ret = solve(N);
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 888
#include<stdio.h>

int main(void){

int r,D,x_2000,x_new,i;
scanf("%d %d %d",&r,&D,&x_2000);
for(i=0;i<10;i++){
  x_new = r*x_2000-D;
  printf("%d\n",x_new);
  x_2000 = x_new;
 }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll sumx = a[0];
    rep(i, n-1){
        sumx ^= a[i+1];
    }

    rep(i, n){
        ll tmp = sumx ^ a[i];
        cout << tmp <<" ";
    }

    return 0;
}

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

int Q, N;
string s, t;

int fw[100005][2];
void update(int x, int v, int n) { //v is value, x is position
    for (;x <=N; x+=x&(-x)) fw[x][n] += v; 
}
int sum(int x, int n) {
    int res = 0;
    for(; x; x-=x&(-x)) res += fw[x][n];
    return res;
}
int rs(int x, int y, int n) {
	return sum(y, n) - sum(x-1, n);
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> s >> t;
	N = max(s.length(), t.length());
	N++;
	for (int i = 0; i < (int) s.length(); i++) {
		update(i+1, s[i]-'A'+1, 0);
	}
	for (int i = 0; i < (int) t.length(); i++) {
		update(i+1, t[i]-'A'+1, 1);
	}
	cin >> Q;
	for (int q = 0; q < Q; q++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		if (rs(a, b, 0) % 3 == rs(c, d, 1) % 3) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
}


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

long long a, b, c;

int main(){
  cin >> a >> b >> c;

  long long t = c - a - b;
  if(t > 0 && t * t > 4 * a * b) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;

}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
MOD = 10**9+7

def fa(n):
    arr = []
    temp = n
    m = int(n**0.5//1)
    for i in range(2, m+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

l = []
for i in range(n):
	deg = fa(a[i])
	if i == 0:
		l = deg
	else:
		for j in range(len(deg)):
			for k in range(len(l)):
				if deg[j][0] == l[k][0]:
					l[k][1] = max(l[k][1], deg[j][1])
					break
			else:
				l.append(deg[j])
lcm = 1
for fac in l:
	factors = pow(fac[0], fac[1], MOD)
	lcm = (lcm*factors)%MOD
ans = 0
for i in range(n):
	ans += pow(a[i], MOD-2, MOD)
print((ans*lcm)%MOD)

Measured memory_bytes: 47196
import os

def main():
    sosu = int(input())
    if sosu == 2:
        print(2)
    else:
        while(checksosu(sosu)):
            sosu += 1
        print(sosu)

def checksosu(num):
    for i in range(3,num,2):
        if num % i == 0:
            return True
    return False
    
if __name__ == "__main__":
    main()



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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int a, b; cin >> a >> b; cout << max(a - 2 * b,0) << endl;
}

Measured memory_bytes: 256
N = int(input())
X = sorted(map(int, input().split()))

mina, maxa = X[0], X[N-1]

ans = (maxa ** 2) * len(X)
for i in range(mina, maxa+1):
  sum = 0
  for j in range(len(X)):
    sum += (X[j] - i) ** 2
  ans = min(ans, sum)
  
print(ans)

Measured memory_bytes: 3060
function Main(input) {
  'use strict';

  const temp = input.split("\n");
  const n = temp.shift();
  const an = temp.shift().split(" ");
  const bn = temp.shift().split(" ");

  let rest = 0;
  let ans = 0;

  for(let i = 0; i < n; i++){
    const monsters = parseInt(an[i]);
    const strength = parseInt(bn[i]) + rest;
    if(monsters <= strength){
      ans += monsters;
      rest = Math.min(strength - monsters, parseInt(bn[i]));
    }else{
      ans += strength;
      rest = 0;
    }
  }
  ans += Math.min(rest,parseInt(an[n]))
  console.log(ans)
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 31192
import java.util.*;

public class Main {
	
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		System.out.println(k * pow(k - 1, n - 1));
	}
	
	static long pow(long p, int x) {
		if (x == 0) {
			return 1;
		} else {
			return p * pow(p, x - 1);
		}
	}
}


Measured memory_bytes: 21844
#ifndef DEBUG
#pragma GCC optimize("O3,unroll-loops")
#pragma loop_opt(on)
#endif
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#define FAST ;
#else
#define FAST ios::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define All(v) v.begin(),v.end()
#define Ft first
#define Sd second
using ll = long long;
using pii = pair<int, int>;
constexpr ll MOD = 1e9+7;

signed main() {
    FAST;

    constexpr int MAX = 1e4+10;
    constexpr int SQRT = sqrt(MAX)+5;
    array<int,MAX> sum{};
    auto f = [](int x, int y, int z) { return x*x+y*y+z*z+x*y+y*z+z*x; };
    Fr(i,1,SQRT) Fr(j,1,SQRT) Fr(k,1,SQRT) if (f(i,j,k) < MAX)
        sum[f(i,j,k)]++;
    int n;
    cin >> n;
    Fr(i, 0, n) cout << sum[i+1] << endl;

}


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

int main() {
	string A, B, C;
	cin >> A >> B >> C;
	string ans;
	ans += (char)(A[0] + ('A' - 'a'));
	ans += (char)(B[0] + ('A' - 'a'));
	ans += (char)(C[0] + ('A' - 'a'));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define repA(i, a, n) for(ll i = a; i < (n); ++i)
#define repD(i, a, n) for(ll i = a; i > (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (long long) (x).size()
#define fill(a) memset(a, 0, sizeof(a))
#define fst first
#define snd second
// #define mp make_pair
#define pb push_back
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
const long double PI = 3.141592653589793238462643383;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long int> vll;
typedef vector<double> vd;
typedef vector<pii> vii;
long long Ceil(long long a, long long b){
    if(a%b==0) return a/b;
    else return (a/b)+1;
}
ll p=1000000007;
float E = 0.00000000000001;
ll power(ll x, ll y){
    if(y==0){
        return 1;
    }
    if(y%2==0){
        ll q=power(x,y/2);
        q=q%p;
        return (q*q)%p;
    }
    ll q=power(x,y/2);
    q=q%p;
    return ((x%p)*((q*q)%p))%p; 
}
bool isPowerOfTwo (long long x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}  

long long int gcd(long long int a, long long int b){ 
    if (a == 0) 
        return b;  
    return gcd(b % a, a); 
}
long long int mod(long long int a, long long int b) {
    long long int ret = a%b; return ret>=0? ret: ret+b; 
}
int main(){
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);   
    freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin>>t;
    while(t--){ 
        int n;cin>>n;
        vector <int> vec(n);
        for(auto &x:vec)
            cin>>x;
        int mx = vec.front();
        long long ans = 0;
        for(int i = 1; i < n ; i++){
            ans += max(0, mx-vec[i]);
            mx = max(vec[i], mx);
        }
        cout<<ans<<endl;

    }
    return 0;
}


Measured memory_bytes: 3956
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ARRAY_MAX		100000									// 最大配列数

// 内部変数
static FILE *szpFpI;											// 入力
static int si1Array[D_ARRAY_MAX];								// 配列
static int siACnt;												// 配列数
static long long slMin, slMax;									// 最小・最大

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 配列数 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &siACnt);

	// 配列 - 取得
	for (i = 0; i < siACnt; i++) {
		fscanf(szpFpI, "%d", &si1Array[i]);
	}
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);

	// 最終
	if (si1Array[siACnt - 1] != 2) {
		return -1;
	}

	// 最終前～１回目
	slMin = 2;
	slMax = 3;
	for (i = siACnt - 2; i >= 0; i--) {

		// 最小
		long long llMin = (slMin + si1Array[i] - 1) / si1Array[i] * si1Array[i];
		if (llMin > slMax) {
			return -1;
		}

		// 最大
		long long llMax = slMax / si1Array[i] * si1Array[i] + si1Array[i] - 1;
		if (llMax < slMin) {
			return -1;
		}

		// 更新
		slMin = llMin;
		slMax = llMax;
	}

	return 0;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// １行出力
	if (liRet == 0) {
		sprintf(lc1Buf, "%lld %lld\n", slMin, slMax);
	}
	else {
		sprintf(lc1Buf, "-1\n");
	}
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 512
use std::io;

fn main() {
    let mut n=String::new();
    io::stdin().read_line(&mut n).expect("Failed to read line");
    let n: u32=n.trim().parse().expect("Failed to parse");

    if n%2==0{
        println!("{}",n);
    }else{
        println!("{}",2*n);
    }
}


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

int perm[8];
bool used[8];
bool mat[8][8];
int cnt;

void permutation(int n, int d) {
  if (d == n) { ++cnt; return;}

  for (int i = 1; i < n; ++i) {
    if (used[i] || !mat[perm[d-1]][i]) continue;
    perm[d] = i;
    used[i] = true;
    permutation(n, d+1);
    used[i] = false;
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    mat[a][b] = mat[b][a] = true;
  }

  permutation(n, 1);
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b,c;
int main()
{
    cin>>a>>b>>c;
    for(register int i=1;i<=c;i++)
    {
        if(i&1)
        {
            if(a&1) --a;
            b+=a>>1;
            a>>=1;
        }
        else 
        {
            if(b&1) --b;
            a+=b>>1;
            b>>=1;
        }
    }
    cout<<a<<' '<<b<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
long long a,b,k;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>a>>b>>k;
	if(a>=k){
		cout<<a-k<<' '<<b<<endl;
		return 0;
	}
	k-=a;
	a=0;
	if(b>=k){
		cout<<a<<' '<<b-k<<endl;
		return 0;
	}
	cout<<0<<' '<<0<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=1000005;
int n,m,w[maxn],v[maxn],dp[maxn],ans;
signed main(){
	memset(dp,0x3f3f3f3f,sizeof(dp));
	cin>>n>>m;
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	dp[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=1e5;j>=v[i];j--){
			dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
			if(dp[j]<=m)ans=max(ans,j);
		}
	}
	cout<<ans;
}

Measured memory_bytes: 10496
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int[] num = new int[26];
        for (int i = 0; i < H; i++) {
            String s = sc.next();
            for (int j = 0; j < W; j++) {
                num[s.charAt(j)-'a']++;
            }
        }
        //System.out.println(Arrays.toString(num));

        boolean ans = true;
        if (H%2 == 0 && W%2 == 0) {
            int num4 = H*W/4;
            for (int i = 0; i < 26; i++) {
                if (num[i] >= 4) {
                    int a = Math.min(num[i]/4, num4);
                    num[i] -= a*4;
                    num4 -= a;
                }
            }
            int others = 0;
            for (int i = 0; i < 26; i++) {
                others += num[i];
            }
            ans = others == 0;
        } else if (H%2 == 1 && W%2 == 1) {
            int num4 = (H-1)*(W-1)/4;
            for (int i = 0; i < 26; i++) {
                if (num[i] >= 4) {
                    int a = Math.min(num[i]/4, num4);
                    num[i] -= a*4;
                    num4 -= a;
                }
            }
            int num2 = ((H-1)+(W-1))/2;
            for (int i = 0; i < 26; i++) {
                if (num[i] >= 2) {
                    int a = Math.min(num[i]/2, num2);
                    num[i] -= a*2;
                    num2 -= a;
                }
            }
            int others = 0;
            for (int i = 0; i < 26; i++) {
                others += num[i];
            }
            ans = others == 1;
        } else {
            int odd = H%2 == 1 ? H : W;
            int even = H%2 == 1 ? W : H;
            //System.out.println("# odd: " + odd + ", even: " + even);

            int num4 = (odd-1)*even/4;
            for (int i = 0; i < 26; i++) {
                if (num[i] >= 4) {
                    int a = Math.min(num[i]/4, num4);
                    num[i] -= a*4;
                    num4 -= a;
                }
            }
            int num2 = even/2;
            for (int i = 0; i < 26; i++) {
                if (num[i] >= 2) {
                    int a = Math.min(num[i]/2, num2);
                    num[i] -= a*2;
                    num2 -= a;
                }
            }
            int others = 0;
            for (int i = 0; i < 26; i++) {
                others += num[i];
            }
            ans = others == 0;
            //System.out.println("# " + Arrays.toString(num));
        }
        System.out.println(ans ? "Yes" : "No");
    }
}


Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <math.h>
using namespace std;
int main() {
    string S;
    cin >> S;

    if (S == "SUN") cout << 7 << endl;
    else if (S == "MON") cout << 6 << endl;
    else if (S == "TUE") cout << 5 << endl;
    else if (S == "WED") cout << 4 << endl;
    else if (S == "THU") cout << 3 << endl;
    else if (S == "FRI") cout << 2 << endl;
    else if (S == "SAT") cout << 1 << endl;
}

Measured memory_bytes: 256
num_list = list(map(int, input().split()))
k = int(input())

max = 0
index = -1
for i in num_list:
    if max < i:
        max = i
        index = num_list.index(i)

change = max*(2**k)
num_list[index] = change
ans = 0
for j in num_list:
    ans += j

print(ans)

Measured memory_bytes: 9084
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{

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

		int[] numbers = {0,0,0,0,0};
		for (int i= 0; i < 5; i++) {
			numbers[i] = sc.nextInt();
			if (numbers[i]==0) {
				System.out.println(i+1);
			}
		}
	}
	
	private static class FastScanner {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;

		public FastScanner(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
			tokenizer = null;
		}

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

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

	}
}

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

int main() {
  int n;
  ll m;
  cin >> n >> m;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());
  vector<ll> s(n+1);
  rep(i,n) s[i+1] = s[i]+a[i];

  auto calc = [&](int x) {
    ll tot = 0, num = 0;
    rep(i,n) {
      int j = lower_bound(a.begin(), a.end(), x-a[i]) - a.begin();
      num += n-j;
      tot += s[n]-s[j];
      tot += a[i]*ll(n-j);
    }
    return make_pair(tot,num);
  };

  int l = 0, r = 200005;
  while (l+1<r) {
    int c = (l+r)>>1;
    if (calc(c).second >= m) l = c; else r = c;
  }
  auto p = calc(l);
  ll ans = p.first;
  ans -= (p.second-m)*l;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>

using namespace std;
#define pi 3.14159265

int main()
{
	long long ans = 0, i = 0, j = 0, k = 0, l = 0;
	long long N, x, a[100] = { 0 };
	cin >> N >> x;
	for (i; i < N; i++)cin >> a[i];

	sort(a, a + N);
	for (i = 0; i < N; i++) {
		x -= a[i];
		if (x >= 0) {
			if (a[i + 1])
				ans++;
			else if (x == 0)
				ans++;
		}
		else
			break;
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=998244353;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int deg[100010];
vector<int>v[100010];
vector<int>vec[100010];
bool used[100010];
set<P>st;
void dfs1(int x){
    used[x]=1;
    for(int i:v[x]){
        if(!used[i]){
            st.insert({x,i});
            vec[i].pb(x);
            vec[x].pb(i);
            dfs1(i);
        }
    }
}
void dfs2(int x,int y=-1){
    used[x]=true;
    for(int i:vec[x]){
        if(!used[i]){
            dfs2(i,x);
        }
    }
    if(y!=-1){
        if(deg[x]==1){
            cout<<x+1<<" "<<y+1<<endl;
            deg[x]=0;
        }
        else{
            cout<<y+1<<" "<<x+1<<endl;
            deg[y]=1-deg[y];
        }
    }
}
void solve(){
    int n,m;
    cin>>n>>m;
    if(m%2){
        puts("-1");
        return;
    }
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    dfs1(0);
    rep(i,n){
        for(int j:v[i]){
            if(st.find(P{i,j})!=st.end()||st.find(P{j,i})!=st.end())continue;
            if(i<j){
                cout<<i+1<<" "<<j+1<<endl;
                deg[i]=1-deg[i];
            }
        }
    }
    fill(used,used+n,0);
    int root=-1;
    rep(i,n){
        if(vec[i].size()>=2)root=i;
    }
    dfs2(root);
}

signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}

Measured memory_bytes: 28800
#include<iostream>
#include<string>

using namespace std;

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    if (n % 2 == 1){
        cout << "No" << endl;
        return 0;
    }
    
    for (int i = 0; i < n; i++){
        if (i % 2 == 0){
            if (s[i] != 'h'){
                cout << "No" << endl;
                return 0;
            }
        }else{
            if (s[i] != 'i'){
                cout << "No" << endl;
                return 0;
            }       
        }
    }
    cout << "Yes" << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int n;
  cin>>n;
  int ans=0;
  FOR(i,1,n){
    if(i%2==0) continue;

    int cnt=0;
    FOR(j,1,i){
      if(i%j==0) cnt++;
    }
    if(cnt==8) ans++;

  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
cin >> N;
vector<int64_t> vec(N);
for (int i = 0;i < N;i++) {
  cin >> vec.at(i);
}
set<int> count;

for (int i = 0;i < N;i++) {
count.insert(vec.at(i));
}
cout << count.size() << endl;

return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, m = map(int, readline().split())
    mat = [list(map(int, readline().split())) for _ in range(n)]

    from itertools import product
    from operator import itemgetter

    ans = 0

    for bit in product([-1, 1], repeat=3):
        cake_value = [[0] * 2 for _ in range(n)]
        for i, row in enumerate(mat):
            cake_value[i][0] = i
            cake_value[i][1] = row[0] * bit[0] + row[1] * bit[1] + row[2] * bit[2]
        cake_value.sort(key=itemgetter(1), reverse=True)
        x_sum, y_sum, z_sum = [0] * 3
        for i, _ in cake_value[:m]:
            cake = mat[i]
            x_sum += mat[i][0]
            y_sum += mat[i][1]
            z_sum += mat[i][2]
        total = abs(x_sum) + abs(y_sum) + abs(z_sum)
        ans = max(ans, total)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
Apparently, the tree supports the same operations as the set 
(at least I haven't any problems with them before), but also there are two new features — 
find_by_order() — The first returns an iterator to the k-th largest element (counting from zero)
order_of_key() — the number of items in a set that are strictly smaller than our item. 
https://codeforces.com/blog/entry/11080
using namespace __gnu_pbds; */
using namespace std;
#define test() int t;cin>>t;for(int test=1;test<=t;test++)
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ld long double
#define endl '\n'
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    int res = 1;
    while(b > 0){
        if(b&1) res = m(m(res)*m(a));
        a = m(m(a)*m(a));
        b >>= 1;
    }
    return res;
}
signed main(){
    fast();
    int l, r, d, ans = 0;
    cin >> l >> r >> d;
    for(int i=l; i<=r; i++){
        if(i%d == 0){
            ans++;
        }
    }
    cout << ans << endl;
    cerr << "\nTime elapsed : " << 1000 * clock() / CLOCKS_PER_SEC << " ms\n";
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int X,Y,A,B,C,p[100100],q[100100],r[100100],que[300100];

int chmax(const void *a,const void *b){
	return *(int *)b-*(int *)a;
	
}
int main(){
	 int i;
	scanf("%d%d%d%d%d",&X,&Y,&A,&B,&C);
	//X--;Y--;
	for(i=0;i<A;i++)scanf("%d",p+i);
	for(i=0;i<B;i++)scanf("%d",q+i);
	for(i=0;i<C;i++)scanf("%d",r+i);
	
	qsort(p,A , sizeof(int), chmax);
	qsort(q,B , sizeof(int), chmax);
	
	for(i=0;i<X;i++)que[i]=p[i];
	for(i=X;i<X+Y;i++)que[i]=q[i-X];
	for(i=X+Y;i<X+Y+C;i++)que[i]=r[i-X-Y];
	
	qsort(que,X+Y+C,sizeof(int),chmax);
	
	long long ret=0;
	
	for(i=0;i<X+Y;i++)ret += que[i];
	printf("%lld\n",ret);
 return 0;
 }

Measured memory_bytes: 3956
N = int(input())
a = list(map(int,input().split()))
tourist = 0
human = [0 for i in range(8)]
for i in range(N):
    if a[i] >= 3200:
        tourist += 1
        continue
    else: human[a[i]//400] += 1
color = sum([1 for i in human if i > 0])
print(str(max(1,color))+' '+str(color+tourist))


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

int main() {
  int H, W;
  cin >> H >> W;
  char field[H+1][W+1];
  for (int i=1; i<=H; i++) {
    for (int j=1; j<=W; j++) {
      cin >> field[i][j];
    }
  }

  for (int i=1; i<=2*H; i++) {
    for (int j=1; j<=W; j++) {
      cout << field[(i+1)/2][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  string s;
  cin >> s;
  ll count = 0;
  rep(i, 3){
    if(s[i]=='R'){
      count++;
    }
  }
  if(count==2&&s=="RSR"){
    print(1);
  }
  else{
    print(count);
  }
}


Measured memory_bytes: 3620
from itertools import permutations

D = [int(input()) for _ in range(5)]
ans = 650

for d in list(permutations(D)):
  sum = 0
  for i in range(5):
    sum += d[i]
    if (i < 4):
      if d[i] % 10 > 0:
        sum += 10 - (d[i] % 10)
      else:
        sum += 0
  if sum < ans:    
    ans = sum

print(ans)

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

int main(){
  int n, m;
  cin >> n >> m;
  if(n == m) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int> dp(n+1, 0);
    int idx = n;
    while(idx > 0){
        bool find = false;
        for(int t = max(0, idx-m); t < idx; t++){
            if(s[t] == '0'){
                dp[t] = idx - t;
                idx = t;
                find = true;
                break;
            }
        }
        if(!find){
            cout << -1 << endl;
            return 0;
        }
    }
    idx = 0;
    while(idx < n){
        cout << dp[idx] << ' ';
        idx += dp[idx];
    }
    cout << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>
#define MAX 100
#define INF 9999999
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];
void dijkstra(){
  int min,u;
  int d[MAX],color[MAX];
  int i,j;
  for(i=0;i<n;i++){
    d[i]=INF;
    color[i]=WHITE;
  }
  d[0]=0;
  color[0]=GRAY;
  while(1){
    min=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(min>d[i]&&color[i]!=BLACK){
        u=i;
        min=d[i];
      }
    }
    if(u==-1)break;
    color[u]=BLACK;
    for(j=0;j<n;j++){
      if(color[j]!=BLACK&&M[u][j]!=INF){
        if(d[j]>d[u]+M[u][j]){
          d[j]=d[u]+M[u][j];
          color[j]=GRAY;
        }
      }
    }
  }
  for(i=0;i<n;i++){
    printf("%d ",i);
    printf("%d\n",(d[i]==INF?-1:d[i]));
  }
}

int main(){
  int i,k,c,u,v,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      M[i][j]=INF;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d%d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d%d",&v,&c);
      M[u][v]=c;
    }
  }
  dijkstra();
  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

#define DEBUG(x) cerr << #x << " = " << x << endl

typedef long double D;

struct Node {
  D p;
  D h;
};

const D EPS = 1e-10;

int sig(D a, D b) {
  if(a < b - EPS) return -1;
  if(a > b + EPS) return +1;
  return 0;
}

bool check(D th, D speed, D start, D end, const vector<Node> &objs) {
  D vx = speed * cos(th);
  D vy = speed * sin(th);
  bool ok = true;
  for(int i = 0; i < (int)objs.size(); ++i) {
    if(sig(start, objs[i].p) <= 0 && sig(objs[i].p, end) <= 0) {
      D x = objs[i].p - start;
      D y = -(x*x/(2*vx*vx)) + vy*x/vx;
      if(sig(y, objs[i].h) < 0) {
        ok = false;
      }
    }
  }
  return ok;
}

D speed(D th, D len) {
  return sqrt(len / (sin(2*th)));
}

void test(D th, D len, D pos) {
  D sp = speed(th, len);
  D vx = sp * cos(th);
  D vy = sp * sin(th);
  D y = -(pos*pos/(2*vx*vx)) + (vy/vx)*pos;
  DEBUG(y);
}

int main() {
  D distance;
  int N, B;
  cin >> distance >> N >> B;
  vector<Node> objs(N);
  for(int i = 0; i < N; ++i) {
    cin >> objs[i].p >> objs[i].h;
  }
  B++;
  D ans = 1e20;
  for(int b = 1; b <= B; ++b) {
    for(int i = 0; i < b; ++i) {
      D start = distance / b * i;
      D end = distance / b * (i + 1);
      D len = abs(end - start);
      D estm;
      // DEBUG(start);
      // DEBUG(end);
      // DEBUG(len);
      // DEBUG(speed(M_PI/4, len));
      // D vx = speed(M_PI/4, len)*cos(M_PI/4);
      // D vy = speed(M_PI/4, len)*sin(M_PI/4);
      // DEBUG(-(len*len/(2*vx*vx))+(vy/vx)*len);
        // DEBUG("false");
      D lb = M_PI/4, ub = M_PI/2;
      for(int t = 0; t < 300; ++t) {
        D mid = (lb + ub) / 2;
        if(check(mid, speed(mid, len), start, end, objs)) {
          ub = mid;
        }
        else {
          lb = mid;
        }
      }
      estm = ub;
      D estm_sp = speed(estm, len);
      bool ok = true;
      for(int j = 0; j < b; ++j) {
        D start2 = distance / b * j;
        D end2 = distance / b * (j + 1);
        if(check(estm, estm_sp, start2, end2, objs) == false) {
          ok = false;
        }
      }
      if(ok) {
        ans = min(ans, estm_sp);
      }
    }
  }
  cout.setf(ios::fixed); cout.precision(10);
  cout << ans << endl;
}

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

int main() {
	// your code goes here
	string s;
	cin>>s;
	if(s[s.length()-1]=='s'||s[s.length()-1]=='S')
	cout<<s<<"es\n";
	else
	cout<<s<<"s\n";
	return 0;
	
}


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

int getDigit(int n){
    int digit = 0;
    while(n > 0){
        n = n / 10;
        digit++;
    }
    return digit;
}

int main(){
    int n; cin >> n;
    int ans = 0;
    for(int i = 1; i < n + 1; i++){
        if(getDigit(i) % 2 != 0) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++) 
using namespace std;

int main(){
    ll x;
    cin >> x;
    ll d = (x/500)*1000;
    x = x % 500;
    d += (x / 5)*5;
    cout << d << endl;  

    return 0;
}

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

int main(){
  int time;
  int x=0,y=0;
  for(int i=0;i<4;i++){
    cin >> time;
    y += time;
  }
  while(y>=60){
    y -= 60;
    x++;
  }
  cout << x << endl << y << endl;
}

Measured memory_bytes: 1160
#import sys
#sys.setrecursionlimit(10**9)
#from functools import reduce
#from operator import mul

#def two(a,ans):
#    if a%2==0:
#        return two(a//2,ans+1)
#    else:
#        return ans

N=int(input())
A=list(map(int,input().split()))

#ans1=0
#ans2=0
#p=reduce(mul,A)
p2=1
for a in A:
    p2*=a
#ans1=two(p,ans1)
ans3=0
while p2%2==0:
    p2//=2
    ans3+=1
#for i in range(N):
#    ans2=two(A[i],ans2)
print(ans3)

Measured memory_bytes: 50908
n,k=map(int,input().split())
mod=10**9+7
ans=0
for i in range(k,n+1):
  ans+=(n*(n+1)//2)-((n-i)*(n-i+1)//2)-(i*(i-1)//2)+1
  ans%=mod
ans+=1
ans%=mod
print(ans)

Measured memory_bytes: 63588
import java.util.Scanner;

class Main{
	public static void main(String[] args){
    	Scanner s=new Scanner(System.in);
        int a=s.nextInt(),b=s.nextInt();
        if((a+b)%2==0){
        	System.out.println(Math.abs((a+b)/2));
        }else{
        	System.out.println("IMPOSSIBLE");
        }
    }
}

Measured memory_bytes: 21844
import sys
readline = sys.stdin.readline

N = int(readline())
Ns = 1<<N
S = [None]+list(map(int, readline().strip()))
P = list(map(int, readline().split()))

res = [None]*Ns
res[0] = P
res[1] = P[1:] + [P[0]]
Ans = [None]*Ns

for i in range(Ns):
    ri = res[i]
    leng = len(ri)
    
    for level in range(leng.bit_length()-1):
        cnt = []
        for j in range(len(ri)//2):
            a = ri[2*j]
            b = ri[2*j+1]
            if S[abs(a-b)] == 1:
                cnt.append(max(a, b))
            else:
                cnt.append(min(a, b))
        ri = cnt[:]
        lri = len(ri)
        if 1 < Ns//lri < Ns-i:
            res[i + Ns//lri] = ri[1:] + [ri[0]]
    Ans[i] = ri[0]
print('\n'.join(map(str, Ans)))         


Measured memory_bytes: 95644
#include <stdio.h>
int main(){
 
  int n,i=0,lo[52]={},cnt=0;
  long long r=1;
  char sa[53],sb[53];
  scanf("%d%s%s",&n,sa,sb);
  for(i=0;i<n;i++){
    if(sa[i]==sb[i]) lo[cnt]=1;
    else {
      lo[cnt]=2;
      i++;
    }
    cnt++;
  }
  if(lo[0]==2) r*=6;
  else r*=3;
  for(i=1;i<cnt;i++){
    if(lo[i-1]==1) r*=2;
    else if(lo[i]==2) r*=3;
    r%=1000000007;
  }
  printf("%lld\n",r);
 
  return 0;
 
}
 

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

#include <fstream>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
typedef long double ld;
using namespace std;
#define endl "\n"
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
const int N=2e5+5, mxN=(1<<22);
int mod=1e9+7;
       int co[N]={};


int main()
{
        FIO
       int n,k;
       cin>>n>>k;
       for(int i=0;i<n;i++)
       {
           int x;
           cin>>x;
          co[x]--;
        }
        sort(co,co+N);
        int ans=n;
        for(int i=0;i<k;i++)
        ans+=co[i];

       cout<<ans;
    return 0;

}






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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

// DP
int n; 
vector<ll> dp;
ll fibo(int i) {
  dp[0] = 1; dp[1] = 1;
  for(int i = 2; i <= n; ++i) {
    dp[i] = dp[i - 1] + dp[i - 2];
  }
  return dp[n];
}

int main() {
  cin >> n; dp.resize(100);
  cout << fibo(n) << endl;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;

int n;
int grid[301][301];

int sum(int sx, int sy, int ex, int ey)
{
	return grid[ex][ey] - 
	       grid[ex][sy - 1] - 
		   grid[sx - 1][ey] + 
		   grid[sx - 1][sy - 1];
}

int calc(int sx, int sy, int ex, int ey)
{
	return sum(sx, sy, ex, ey) - sum(sx + 1, sy + 1, ex - 1, ey - 1);
}

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			scanf("%d", &grid[i][j]);
			grid[i][j] += grid[i - 1][j];
			grid[i][j] += grid[i][j - 1];
			grid[i][j] -= grid[i - 1][j - 1];
		}
	}
	
	/*for (int i = 1; i <= n; i++){
		for (int j = 1; j <= n; j++){
			printf("%d ", grid[i][j]);
		}
		puts("");
	}*/
	
	int res = -INF;
	for (int i = 1; i <= n; i++){
		for (int j = i + 2; j <= n; j++){
			int p = 1;
			for (int k = 3; k <= n; k++){
				int s = calc(i, p, j, k);
				int t = calc(i, k - 2, j, k);
				if (s < t) p = k - 2;
				//printf("%d %d %d %d %d\n", i, p, j, k, calc(i, p, j, k));
				res = max(res, calc(i, p, j, k));
			}
		}
	}
	
	for (int i = 1; i <= n; i++){
		for (int j = i; j <= min(n, i + 1); j++){
			for (int p = 1; p <= n; p++){
				for (int k = p; k <= n; k++){
					res = max(res, sum(i, p, j, k));
					res = max(res, sum(p, i, k, j));
				}
			}
		}
	}
	
	printf("%d\n", res);
	
	return 0;
}

Measured memory_bytes: 1540