akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (m); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

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

template<class T> inline auto __lcm(T& a, T& b) 
{ return a * b / __gcd(a, b); }


int main() {
    int N, D;  cin >> N >> D;
    int cnt = 1;
    int sum = 0;
    rep(i, N) {
        sum += 2 * D + 1;
        if (sum < N) ++cnt;
        else {
            print(cnt);
            break;
        }
    }

    return 0;
}



Measured memory_bytes: 256
#include <iostream>


struct Answer {
    int yen_10000;
    int yen_5000;
    int yen_1000;
    
    bool is_valid() { 
        return yen_10000 != -1;
    }
    
    void print() {
        std::printf(
            "%d %d %d\n",
            yen_10000, yen_5000, yen_1000
        );
    }
};

struct Cond {
    bool use_10000 = true;
    bool use_5000  = true;
    bool use_1000  = true;
};


// n枚でy円作る組み合わせを返す
Answer solve(const int n, const int y, Cond cond) {
    //
    if(n == 0 && y == 0) {
        return {0, 0, 0};
    }
    if(y == 0) {
        return {-1, -1, -1};
    }
    if(y == n) {
        return {0, 0, n};
    }
    
    //
    if(cond.use_10000) {
        for(int num = y / 10; num >= 0; --num) {
            auto ans = solve(
                n - num,
                y - num*10,
                {false, cond.use_5000, cond.use_1000}
            );
            if(ans.is_valid()) {
                ans.yen_10000 += num;
                return ans;
            }
        }
    }
    if(cond.use_5000) {
        for(int num = y / 5; num >= 0; --num) {
            auto ans = solve(
                n - num,
                y - num*5,
                {cond.use_10000, false, cond.use_1000}
            );
            if(ans.is_valid()) {
                ans.yen_5000 += num;
                return ans;
            }
        }
    }
    
    return {-1, -1, -1};
}

int main(void) {
    int N, Y;
    std::cin >> N >> Y;

    solve(N, Y/1000, {}).print();
}


Measured memory_bytes: 256
import collections
n = int(input())
s = []
for i in range(n):
    s.append(input())

c = collections.Counter(s)

ans = []
most = c.most_common()
max_size = most[0][1]
for i in range(len(most)):
    if max_size != most[i][1]:
        break
    else:
        ans.append(most[i][0])

print('\n'.join(sorted(ans)))

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

int mod = pow(10, 9) + 7;
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> oks(N + 1, 1);
    int a;
    for(int i = 0; i < M; i++) {
        cin >> a;
        oks.at(a) = 0;
    }

    vector<ll> dp(N + 1);
    dp.at(0) = 1;
    for(int now = 0; now < N; now++) {
        for(int next = now + 1; next <= min(N, now + 2); next++) {
            if(oks.at(next)) {
                dp[next] += dp[now];
                dp[next] %= mod;
            }
        }
    }

    cout << dp[N] << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  int min = 1 + (N * K);
  int M = 2;
  
  for(int i=0; i < N;i++){
    int P = M + (N - i - 1) * K;
    if (P < min)
      min = P;
    M *= 2;
  }
  
  cout << min << endl;    
}  

Measured memory_bytes: 256
using System;

namespace ABC110_A_Maximize_the_Formula
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] inStrArr = Console.ReadLine().Split(' ');
			int[] inIntArr = new int[3];

			for (int index = 0; index < 3; index++)
			{
				inIntArr[index] = int.Parse(inStrArr[index]);
			}

			for (int index = 0; index < 3; index++) {
				for (int j = 1; j < 3; j++) {
					if (inIntArr[index] < inIntArr[j])
					{
						int value = inIntArr[j];
						inIntArr[j] = inIntArr[index];
						inIntArr[index] = value;
					}
				}
			}

			inStrArr[0] = inIntArr[0].ToString() + inIntArr[1].ToString();
			
			Console.WriteLine(int.Parse(inStrArr[0]) + inIntArr[2]);
		}
	}
}

Measured memory_bytes: 11092
mo = 10**9 + 7
def fac(x):
    ans = 1
    for i in range(1,x+1):
        ans *= i
        ans %= mo
    return ans

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)

def modinv(a, m):
    g, x, y = egcd(a, m)
    return x % m

def f():
    x,y = [int(s) for s in input().split()]
    if x > (y*2):
        return 0
    if y > (x*2):
        return 0
    if (2*x-y)%3:
        return 0
    if (2*y-x)%3:
        return 0
    a = (2*x-y)//3
    b = (2*y-x)//3
    if a==0 or b==0:
        return 1
    ar = modinv(fac(a),mo)
    br = modinv(fac(b),mo)
    ans = (((fac(a+b) * ar)%mo)*br)%mo
    return ans


print(f())


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

int main() 
{
  int N , A;
  cin >> N ;
  int i=0 , j=0;
  
  for (i; i<N; i++)
  {
    cin >> A ;
    if (A%2==0)
    {
      if (A%3!=0 && A%5!=0)
        j++;
    }
  }
    if (j==0)
      cout << "APPROVED" << endl;
    else
      cout << "DENIED" << endl ;
        
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define LL long long
#define endl '\n'
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    // 入力
    string s, p;
    cin >> s >> p;

    // 文字列sを循環する形にする
    s += s;
    // 文字列pが連結させたsの中にあるか調べる
    for (int i = 0; i < s.size(); i++) {
        if (s.substr(i, p.size()) == p) {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 3248
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Point
{
	double x, y;

	Point()
	{
		x = y = 0;

		return;
	}

	Point( int x, int y ) : x( x ), y( y )
	{
		return;
	}

	Point operator - ( Point a )
	{
		return Point( x - a.x, y - a.y );
	}
};

double cross( const Point &a, const Point &b )
{
	return a.x * b.y - a.y * b.x;
}

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

	Point a, b, c, p;

	while ( cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> p.x >> p.y )
	{
		vector< Point > vecs;

		vecs.PB( a - p );
		vecs.PB( b - p );
		vecs.PB( c - p );
		vecs.PB( a - p );

		int sum = 0;

		REP( i, 0, 3 )
		{
			sum += cross( vecs[i], vecs[ i + 1 ] ) < 0 ? -1 : 1;
		}

		if ( abs( sum ) == 3 )
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1224
#include<algorithm>
#include<cassert>
#include<climits>
#include<cmath>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = int(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = int(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = int(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = int(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = int(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << endl

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-8;

const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

template<typename T>
bool chmax(T &a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T &a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

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

    int a;
    string s;
    cin >> a >> s;
    if(a >= 3200){
        cout << s << endl;
    }else{
        cout << "red" << endl;
    }

    return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include <sstream>
#include <iterator>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <cmath>
#include <numeric>

#define YESNO(x) x ? printf("YES") : printf("NO")
#define YesNo(x) x ? printf("Yes") : printf("No")
#define scani(x) scanf("%d", &x)
#define scanll(x) scanf("%lld", &x)
#define printi(x) printf("%d", x)
#define printll(x) printf("%lld", x)

using namespace std;

long long GCD(long long x, long long y) {
	return y ? GCD(y, x % y) : x;
}

long long LCM(long long x, long long y) {
	return x * y / GCD(x, y);
}

double sqdist(int x1, int y1, int x2, int y2) {
	return pow(x1 - x2, 2) + pow(y1 - y2, 2);
}

double dist(int x1, int y1, int x2, int y2) {
	return sqrt(sqdist(x1, y1, x2, y2));
}

int A() {
	int ans = 0;
	int a, b, c;

	scani(a);
	scani(b);
	scani(c);

	printi(c);
	printf(" ");
	printi(a);
	printf(" ");
	printi(b);



	return 0;
}


int B() {
	int ans = 0;
	int n, m;

	scani(n);
	scani(m);

	vector<int> a(n, 1);
	for (auto& x : a) {
		scani(x);
	}

	int select = 0;
	int sum = accumulate(a.begin(), a.end(), 0);
	sort(a.begin(), a.end(), greater<>());
	for (int i = 0; i < m; i++) {
		if (sum / 4 / m <= a[i]) {
			select++;
		}
	}

	YesNo(select == m);

	return 0;
}

int Main() {
	long long n, k;

	scanll(n);
	scanll(k);

	long long now = n;
	long long old = pow(10, 18) + 1;
	long long ans = now;
	if (n >= k) {
		ans = n % k;
		now = ans;
	}
	while (now < old) {
		old = now;
		now = abs(now - k);
		ans = min(ans, now);
	}

	printll(ans);

	return 0;
}

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


Measured memory_bytes: 256
let () = Scanf.scanf "%d %d %d" @@ fun n m c ->
  let bs = Array.to_list @@ Array.init m @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let ass = Array.to_list @@ Array.init n @@ fun _ ->
    Array.to_list @@ Array.init m @@ fun _ -> Scanf.scanf " %d" Fun.id in
  let ans = List.length @@
    List.filter (( < ) 0) @@
    List.map (List.fold_left2 (fun acc b a -> acc + b * a) c bs) ass in
  Printf.printf "%d\n" ans

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

bool solve() {
  int n;
  scanf("%d", &n);
  map<int, int> m;
  for (int i = 0, x; i < n; ++i) {
    scanf("%d", &x);
    m[x]++;
  }
  if (m.size() == 1) {
    return m.begin()->first == 0;
  }
  vector<pair<int, int>> v(m.begin(), m.end());
  if (v.size() == 3)
    return (v[0].second == v[1].second) && (v[1].second == v[2].second) && ((v[0].first ^ v[1].first ^ v[2].first) == 0);
  if (v.size() == 2)
    return v[0].first == 0 && v[0].second * 2 == v[1].second;
  return false;
}

int main() {
  puts(solve() ? "Yes" : "No");
  return 0;
}



Measured memory_bytes: 4480
#include <stdio.h>

int main (void) {
  int N, H[100000], i, j;
  int a = 0;

  scanf ("%d", &N);

  for (i = 0; i < N; i++) {
    scanf ("%d", &H[i]);
  }

  for (i = 0; i < N-1; i++) {
    j = 0;
    while (H[i+j] >= H[i+j+1] && i+j != N-1) {
      j++;
    }
    if (a < j) {
      a = j;
    }
    if (a >= N - i - 1) {
     break;
    }
  }

  printf ("%d", a);
}

Measured memory_bytes: 512
// AOJ 2031: Hyper Rock-Scissors-Paper
// 2017.11.04 bal4u@uu

#include <stdio.h>
#include <string.h>

#define HASHSIZ 101
typedef struct { char *s; int id; } HASH;
HASH hash[HASHSIZ+2], *hashend = hash + HASHSIZ;			// Hash table

int lookup(char *s)
{
	int w = strlen(s);
	int i = (101 * *s + 103 * *(s+w-1) + 107 * w) % HASHSIZ;
	HASH *tp = hash + i;

	while (tp->s != NULL) {
		if (!strcmp(tp->s, s)) return tp->id;
		if (++tp == hashend) tp = hash;
	}
	return -1;
}

void insert(char *s, int id)
{
	int w = strlen(s);
	int i = (101 * *s + 103 * *(s+w-1) + 107 * w) % HASHSIZ;
	HASH *tp = hash + i;

	while (tp->s != NULL) {
		if (!strcmp(tp->s, s)) return;
		if (++tp == hashend) tp = hash;
	}
	tp->s = s, tp->id = id;
}

char *hand[15] = {
	"Rock","Fire","Scissors","Snake","Human","Tree","Wolf","Sponge",
	"Paper","Air","Water","Dragon","Devil","Lightning","Gun" };

int f[15][3];		// [0]:members, [1]:win, [2]:defeated

int main()
{
	int n, i, j, ans;
	char buf[12];

	for (i = 0; i < 15; i++) insert(hand[i], i);

	while (scanf("%d", &n) && n > 0) {
		memset(f, 0, sizeof(f));
		for (i = 0; i < n; i++) {
			scanf("%s", buf);
			f[lookup(buf)][0] = 1;
		}

		for (i = 0; i < 15; i++) if (f[i][0]) {
			for (j = 1; j <= 7; j++) {
				if (f[(i+j) % 15][0]) { f[i][1] = 1;  break; }
			}
			for (j = 8; j < 15; j++) {
				if (f[(i+j) % 15][0]) f[i][2] = 1;
			}
		}

		ans = -1;
		for (i = 0; i < 15; i++) if (f[i][1] && !f[i][2]) ans = i;
		if (ans >= 0) puts(hand[ans]);
		else puts("Draw");
	}
	return 0;
}

Measured memory_bytes: 1752
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <tuple>
#include <set>
#include <map>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <cmath>
#include <tuple>
using namespace std;
typedef long long ll;

int gcd(int a, int b) {
    if (a == 0 || b == 0) return max(a, b);
    // 分子の設定
    int numerator = max(a, b);
    // 分母の設定
    int denominator = min(a, b);
    // あまりの計算
    int rest = numerator % denominator;

    // 余りが０であれば最大公約数を返し、それ以外であれば再びgcdを呼ぶ
    if (rest == 0) return denominator;
    else return gcd(denominator, rest);
}

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

    ll left[n + 2], right[n + 2], number[n];
    for (ll i = 0; i < n; i++) cin >> number[i];

    left[0] = 0;
    right[0] = 0;
    left[n + 1] = 0;
    right[n + 1] = 0;
    for (ll i = 0; i < n; i++) left[i + 1] = gcd(left[i], number[i]);
    for (ll i = n; i >= 1; i--) right[i] = gcd(right[i + 1], number[i - 1]);

    ll res = 0;
    for (ll i = 1; i < n + 1; i++) res = (res < gcd(left[i - 1], right[i + 1])) ? gcd(left[i - 1], right[i + 1]) : res;

    cout << res << endl;

    // for (ll i = 0; i < n + 2; i++) {
    //     cout << "left[" << i << "] = " << left[i] << ", right[" << i << "] = " << right[i] << " ";
    // }
    // cout << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define ROOP(i, N) for(int i=0; i++; i<N)
#define RVROOP(i, N) for(int i=N; i--; i>=0)
#define ALL(v) v.begin(), v.end()
const int INF = 1e9;
const int MAX = 510000;
const int MOD = 1000000007;
using namespace std;
typedef long long ll;

/*DP使ったほうがよくない？？WOWWOW*/

int main(){
  ll N,K,ans; cin>>N>>K;
  ans=min(N%K,K-N%K);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define fast()                        \
ios_base::sync_with_stdio(false); \
cin.tie(NULL);
#define endl "\n"
#define mod 1000000007
#define PI 3.14159265358979323846
#define ff first
#define pb push_back
#define ss second
#define un unordered
#define for0(i, n) for (i = 0; i < n; i++)
#define for1(j, n) for (j = 1; j <= n; j++)
#define ll long long int
#define all(v) v.begin(), v.end()
#define t6 2000010
#define t5 200005
using namespace std;
ll recur(ll arr[],ll i,ll n,ll flag,ll count,pair<ll,ll> **dp){
	if(count==n/2){
		return 0;
	}
	else if(i==n && count!=n/2){
		return -1e17;
	}
	ll ans=0;
	if(dp[count][flag].first==i){
		return dp[count][flag].second;
	}
	if(flag==1){
		ans=recur(arr,i+1,n,1-flag,count,dp);
	}	
	else{
		if((n-i+1)/2==n/2-count){
			ans=(arr[i]+recur(arr,i+1,n,1-flag,count+1,dp));
		}
		else{
			ans=max(arr[i]+recur(arr,i+1,n,1-flag,count+1,dp),recur(arr,i+1,n,flag,count,dp));
		}
	}
	dp[count][flag]={i,ans};
	return ans;
}
void solve(){

	ll n;
	cin>>n;
	ll arr[n+1];
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	ll pre[n+1]={0};
	pre[1]=arr[1];
	for(int i=2;i<=n;i++){
		pre[i]=pre[i-2]+arr[i];
	}
	ll dp[n+1]={0};
	dp[1]=0;
	for(int i=2;i<=n;i++){
		if(i%2==1){
			dp[i]=max(dp[i-1],dp[i-2]+arr[i]);
		}	
		else{
			dp[i]=max(dp[i-2]+arr[i],pre[i-1]);

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



}

int main()
{
	fast()
	ll t = 1;
	//cin >> t;
	for (ll i = 0; i < t; i++)
	{   //cout<<"Case #"<<i+1<<": ";
		solve();
	}   
	
	return 0;
}

Measured memory_bytes: 8324
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N,i;
  cin>>N>>i;
  cout<<N-i+1<<endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		Map<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
			addCntMap(map, a[i]);
		}
		br.close();

		long sum = 0;
		Integer[] arr = map.keySet().toArray(new Integer[0]);
		for (Integer o : arr) {
			long v = map.get(o);
			sum += v * (v - 1) / 2;
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < n; i++) {
			long v = map.get(a[i]);
			pw.println(sum - v * (v - 1) / 2 + (v - 2) * (v - 1) / 2);
		}
		pw.flush();
	}

	static void addCntMap(Map<Integer, Integer> map, Integer key) {
		if (map.containsKey(key)) {
			map.put(key, map.get(key) + 1);
		} else {
			map.put(key, 1);
		}
	}
}


Measured memory_bytes: 67756
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10**9 + 7

def main(n, x, mod):
    w = 0
    for i in range(1, n):
        w += (x[i] - x[i-1]) * i * (n-i)
        w %= mod
    return w

print(main(n, x, mod) * main(m, y, mod) % mod)

Measured memory_bytes: 97832
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		if(a+b >= 10){
			System.out.println("error");
		} else {
			System.out.println(a+b);
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21076
M=10**9+7
n,k,*a=map(int,open(y:=0).read().split())
a.sort()
x=s=1
r=k
while r>1:
 if(t:=a[y]*a[y+1])>a[-x]*a[~x]:s=s*t%M;y+=2;r-=2
 else:s=s*a[-x]%M;x+=1;r-=1
if r:s*=a[-x]
if a[-1]<0<k%2:
 s=1
 for i in a[-k:]:s=s*i%M
print(s%M)

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

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);
  int n;
  cin >> n;
  const int SZ = 100001;
  vector<int> cnt(SZ * 2, 0);
  for (int i = 0; i < n; i += 2) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    cnt[x]++;
    cnt[y + SZ]++;
  }
  int c[4] = { 0, 0, 0, 0 };
  int v[4] = { -1, -1, -1, -1 };
  for (int i = 0; i < SZ; i++) {
    if (c[0] < cnt[i]) {
      c[1] = c[0];
      v[1] = v[0];
      c[0] = cnt[i];
      v[0] = i + 1;
    } else if (c[1] < cnt[i]) {
      c[1] = cnt[i];
      v[1] = i + 1;
    }
  }
  for (int i = SZ; i < SZ * 2; i++) {
    if (c[2] < cnt[i]) {
      c[3] = c[2];
      v[3] = v[2];
      c[2] = cnt[i];
      v[2] = i - SZ + 1;
    } else if (c[3] < cnt[i]) {
      c[3] = cnt[i];
      v[3] = i - SZ + 1;
    }
  }
  dumpv(c, 4);
  dumpv(v, 4);
  if (v[0] != v[2]) {
    cout << n - c[0] - c[2] << endl;
  } else {
    // if (v[1] == -1 && v[3] == -1) {
    //   cout << n - c[0] << endl;
    // } else {
      int a1 = n - c[0] - c[3];
      int a2 = n - c[1] - c[2];
      cout << min(a1, a2) << endl;
    // }
  }
  return 0;
}

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

int main() {

	int n, m; cin >> n >> m;
	vector<vector<int>> jobs(m);
	for (ll i = 0; i < n; i++) {
		int a, b; cin >> a >> b;
		if (m < a) continue;
		jobs[m - a].push_back(b);
	}
	int ans = 0;
	priority_queue<ll> pq;
	for (ll i = m - 1; i >= 0 ; i--) {		
		for (int b : jobs[i]) {
			pq.push(b);
		}
		if (!pq.empty()) {
			ans += pq.top();
			pq.pop();
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 8316
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int main(void) {
    int a,b;
    cin>>a>>b;

    cout<<max(a+b,max(a-b,a*b))<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1001001001;
const int MOD = 1000000007;
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 (b<a) {a=b; return 1;} return 0;}

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...)
#define print(...)
#endif

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> b;
    rep(i, n) {
        // にぶたん
        // その数字より小さい最大の数字の値をその数字で書き換える
        if (b.empty()) {b.push_back(a[i]); continue;}
        auto it = lower_bound(all(b), a[i]);
        // いままでの最大値が出た場合
        if (it==b.end()) b.back()=a[i];
        // いままでの最小値が出た場合
        else if (it==b.begin() && *it>=a[i]) b.insert(b.begin(), a[i]);
        else *(it-1) = a[i];
        debug(i, b);
    }
    cout << sz(b) << endl;
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i,m,n) for(int i = m - 1; i >= n; i--)
#define ALL(v) v.begin(), v.end()
#define itn int
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
#define println(x) cout << x << endl
#define print(x) cout << x << " "
template<typename T, typename U>
inline bool CMAX(T &m, U x) { if (m < x) { m = x; return true; } return false; }
template<typename T, typename U>
inline bool CMIN(T &m, U x) { if (m > x) { m = x; return true; } return false; }

typedef long long lint;
typedef long double ldouble;
const int INF = 1e9;
const lint LINF = 1e18;
const int MOD = 1e9+7;
int main(){
    int n,k;
    cin >> n >> k;
    double mx = 0;
    vector<double> a(n);
    vector<double> s(n + 1);
    REP(i,n){
        int p;
        cin >> p;
        lint sum = (p * (2 + (p - 1))) / 2;
        a[i] = sum / double(p);
    }
    s[0] = 0;
    REP(i,n){
        s[i + 1] = s[i] + a[i];
    }
    REP(i,n + 1 - k){
        CMAX(mx, s[i + k] - s[i]);
    }
    cout << std::fixed << std::setprecision(10) << mx << endl;
    return 0;
}

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

class C
{
	static void Main() => Console.WriteLine(PrimesF(int.Parse(Console.ReadLine()), 100003)[0]);

	static int[] PrimesF(int m, int M)
	{
		var b = PrimeFlags(M);
		return Enumerable.Range(m, M - m + 1).Where(i => b[i]).ToArray();
	}
	static bool[] PrimeFlags(int M)
	{
		var rM = (int)Math.Sqrt(M);
		var b = new bool[M + 1]; b[2] = true;
		for (int i = 3; i <= M; i += 2) b[i] = true;
		for (int p = 3; p <= rM; p++) if (b[p]) for (var i = p * p; i <= M; i += 2 * p) b[i] = false;
		return b;
	}
}


Measured memory_bytes: 13288
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n,k; cin >>n>>k;
    vector<ll> h(n); REP(i,n) cin >> h[i];

    vector<ll> dp(100100, INFLL);
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
        for (int s = 1; s <= k; s++) {
            if (i - s >= 0) {
                dp[i] = min(dp[i], dp[i-s]+abs(h[i-s]-h[i]));
            } 
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}



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

int main() {

	int N;
	cin >> N;

	double tmp = 0.0;
	for (int i = 0; i < N; i++)
	{
		double a;
		cin >> a;
		tmp += 1.0 / a;
	}

	printf("%.12f\n",1.0/tmp);


	return 0;
}

Measured memory_bytes: 256
H,W = list(map(int,input().split()))
a = [[c for c in input()] for _ in range(H)]

tmp = a.copy()
for i,row in enumerate(tmp[::-1],1):
    for c in row:
        if c == "#":
            break
    else:
        a.pop(H-i)
tmp = len(a)
for i in range(W-1,-1,-1):
    for j in range(tmp):
        if a[j][i] == "#":
            break
    else:
        for j in range(tmp):
            a[j].pop(i)

for row in a:
    print("".join(row))

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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  
  int cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < m; ++i) {
    int a;
    cin >> a;
    if (a < x) cnt1++;
    else cnt2++;
  }
  
  cout << min(cnt1, cnt2) << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn = 3e5 + 10;
const int Mod = 1e9 + 7;

void Chkadd(int &x, const int &y) { if ((x += y) >= Mod) x -= Mod; }

char s[maxn];
int F[7], G[7];

int main()
{
	int n = fread(s, 1, maxn, stdin);
	while (s[n - 1] != '0' && s[n - 1] != '1' && s[n - 1] != '?') -- n;
	int *f = F, *g = G;
	f[0] = 1;
	for (int i = 0; i < n; ++ i)
	{
		swap(f, g);
		fill(f, f + 7, 0);
		if (s[i] != '1')
		{
			Chkadd(f[1], g[0]);
			Chkadd(f[2], g[1]);
			Chkadd(f[1], g[2]);
			Chkadd(f[4], g[3]);
			Chkadd(f[6], g[4]);
			Chkadd(f[5], g[5]);
			Chkadd(f[4], g[6]);
		}
		if (s[i] != '0')
		{
			Chkadd(f[3], g[0]);
			Chkadd(f[0], g[1]);
			Chkadd(f[1], g[2]);
			Chkadd(f[5], g[3]);
			Chkadd(f[3], g[4]);
			Chkadd(f[5], g[5]);
			Chkadd(f[4], g[6]);
		}
	}
	Chkadd(f[5], f[3]);
	printf("%d\n", f[5]);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
  int K, X;
  cin >> K >> X;
  int left = X - K + 1, right = X + K - 1;
  for(int i = left; i <= right; i++) cout << i << ' ';
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
listA = list(input())
listB = list(input())
listC = list(input())


counter=0
index=0
while index < n:
    if listA[index] == listB[index] and listB[index] == listC[index]:
        pass
    elif listA[index] != listB[index] and listB[index] != listC[index] and listC[index]!=listA[index]:
        counter+=2
    else:
        counter+=1
    index+=1
print(counter)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
  int w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << 1.0 * w * h / 2 << " " << flush;
  if (1.0 * w / 2 == x && 1.0 * h / 2 == y)
    cout << 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,i;
    cin>>n;
    vector<ll> arr;
    if(n==1)
        cout<<0<<endl;
    else if(n==2)
        cout<<1<<endl;
    else{
        ll term=(n-2);
        ll temp=((term)*(n+1))/2;
        temp+=1;
        cout<<temp<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
def palindrome(str):
    return str == str[::-1]
str = input()
N = len(str)
former = int((N-1)/2)
letter = int((N+3)/2 - 1)
if palindrome(str) and palindrome(str[0:former]) and palindrome(str[letter:N]):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<iostream>
using namespace std;
int mp[2][31][31]={};
int sai[6][4]={{3,5,4,2},{1,4,6,3},{1,2,6,5},{5,6,2,1},{3,6,4,1},{2,4,5,3}};

void die(int t,int f,int x,int y){
  int c,mx=3;  
  int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
  for(int i=0;i<4;i++){
    if(sai[t-1][i]==f){
      for(int j=0;j<4;j++){
	if(mp[1][y][x]>mp[1][y+dy[j]][x+dx[j]]&&sai[t-1][(j+i)%4]>mx){
	  mx=sai[t-1][(j+i)%4];
	  c=j;
	}
      }
      if(c==2)f=7-t;
      else if(c==0)f=t;
      break;
    }
  }
  if(mx==3)mp[0][y][x]=t,mp[1][y][x]++;
  else die(7-mx,f,x+dx[c],y+dy[c]);
}

int main(){
  while(1){
    int n;cin>>n;if(n==0)break;
    int t,f,a[7]={};
    for(int i=0;i<n;i++){
      cin>>t>>f;
      die(t,f,15,15);
    }
    for(int i=0;i<31;i++)
      for(int j=0;j<31;j++){
	a[mp[0][i][j]]++;
	mp[0][i][j]=mp[1][i][j]=0;
      }
    for(int i=1;i<6;i++)cout<<a[i]<<" ";cout<<a[6]<<endl;
  }
  return 0;
}

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

int main(){
    int n;
    std::cin >> n;
    std::string hanako, taro;
    int hanako_p = 0;
    int taro_p = 0;
    while(n--){
        std::cin >> taro >> hanako;
        if(hanako > taro){
            hanako_p += 3;
        }else if(hanako < taro){
            taro_p += 3;
        }else if(hanako == taro){
            hanako_p++;
            taro_p++;
        }
    }
    std::cout << taro_p << " " << hanako_p << std::endl;
}


Measured memory_bytes: 3128
/*
 *  stay hungry, stay foolish, stay home.
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define ml cout<<"\n"
#define tc(w) ll w;cin>>w;while(w--)

#define pii pair<ll,ll>
#define vi  vector<ll>
#define vii vector<pii>
#define mi  map<ll,ll>
#define all(a)  (a).begin(),(a).end()

#define pb push_back
#define in insert
#define ff first
#define ss second
#define mod 1000000007

#define yes cout<<"Yes"<<endl;
#define no cout<<"No"<<endl;
#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

vi v[2000000];
ll visited[2000000];
ll ans[2000000];
mi m;
void dfs(ll root=1,ll pre=-1,ll lev=1){
	if(visited[root]<=lev)
		return;
	visited[root]=lev;
	ans[root]=pre;
	for(auto x:v[root]){
		//if(!visited[x]){
		dfs(x,root,lev+1);
		//}
	}
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
     	cin.tie(NULL);
    	cout.tie(NULL);
    	ll n,k;
    	cin>>n>>k;
    	rep(i,0,k){
    		ll a,b;
    		cin>>a>>b;
    		v[a].pb(b);
    		v[b].pb(a);
    	}
    	rep(i,0,n+1){
    		visited[i]=-1;
    	}
    	 memset(ans,0,sizeof(ans));

    	//dfs();
    	queue<ll> q;
    	q.push(1);
    	while(!q.empty()){
    		ll p = q.front();
    		q.pop();
    		for(auto x:v[p]){
    			if(visited[x]==-1){
    				visited[x]=p;
    				q.push(x);
    			}
    		}
    	}
    	yes;
    	rep(i,2,n+1){
    		cout<<visited[i]<<endl;
    	}

   
	return 0;
}


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

int main(void) {
   double a,b,x;
   cin>>a>>b>>x;

   bool flag = (x<=a*a*b/2);
   double angle;
   if (flag) {
      angle = atan(b/(x/a/b*2))*180./M_PI;
   } else {
      x = a*a*b - x;
      angle = atan(x/a/a*2/a)*180./M_PI;
   }
   printf("%.10lf\n",angle);
   // cout<<angle<<endl;

   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX 100000
#define NIL -1

struct Node {
  int p, l, r;
};
struct Node T[MAX];
int n;

void preParse(int);
void inParse(int);
void postPerse(int);

int main(){
  int i, v, l, r, root;

  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = NIL;

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l!=NIL) T[l].p = v;
    if(r!=NIL) T[r].p = v;
  }

  for(i=0;i<n;i++) if(T[i].p==NIL) root = i;

  printf("Preorder\n");
  preParse(root);
  printf("\n");
  printf("Inorder\n");
  inParse(root);
  printf("\n");
  printf("Postorder\n");
  postPerse(root);
  printf("\n");



  return 0;
}

void preParse(int u){
  if(u==NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u){
  if(u==NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}

void postPerse(int u){
  if(u==NIL) return;
  postPerse(T[u].l);
  postPerse(T[u].r);
  printf(" %d",u);
}



Measured memory_bytes: 2108
#include<iostream>
#include<string>
using namespace std;
int main(){
  int x=0,y=0;
  bool direction[4]={false,false,false,false};
  string s;
  cin >> s;
  int i=0;
  while(i<s.length()){
    switch(s[i]){
      case 'N':direction[0]=true;break;
      case 'S':direction[1]=true;break;
      case 'W':direction[2]=true;break;
      case 'E':direction[3]=true;break;
    }
    i++;
  }
  if(!(direction[0]!=direction[1])&&!(direction[2]!=direction[3])){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


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

def get_par(x):
  if x == par_list[x]:
    return x
  else:
    par_list[x] = get_par(par_list[x])
    return par_list[x]
def merge(x,y):
  par_x = get_par(x)
  par_y = get_par(y)
  if par_x != par_y:
    par_list[par_y] = par_x
def is_same(x,y):
  return get_par(x) == get_par(y)

ablist=[]
for i in range(M):
  a,b=map(int,input().split())
  ablist.append((a,b))
#print(ablist)

answer=0
for i in range(M):
  par_list = list(range(N+1))
  for j in range(M):
    if i==j:
      continue
    a,b=ablist[j]
    merge(a,b)

  comp_set=set()
  for i in range(1,N+1):
    comp_set.add(get_par(i))
  
  if len(comp_set)>1:
    answer+=1
  
print(answer)


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n,q;
int date[111];

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>n>>q;
		if(n==0)break;
		memset(date,0,sizeof(date));
		rep(i,n){
			int m;
			cin>>m;
			rep(j,m){
				int d;
				cin>>d;
				date[d]++;
			}
		}
		int maxx=0,maxi=0;
		rep(i,111){
			if(date[i]>maxx&&date[i]>=q){
				maxx=date[i];maxi=i;
			}
		}
		cout<<maxi<<endl;
	}
	return 0;
}

Measured memory_bytes: 3128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<queue>
#include<set>
#include<cstdio>
#include<climits>
#include<cstring>

using namespace std;

int main(){

    int A,B,C;
    cin >> A >> B >> C;
    int X,Y;
    cin >> X >> Y;

    int R = max(X,Y);

    int ans = INT_MAX;

    for(int i = 0;i <= R;i++){
    	ans = min(ans,(2*C*i + A*max(X-i,0) + B*max(Y-i,0)));
    }

    cout << ans << endl;

	return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <complex>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1000000007;

int main(){
    int n; cin >> n;
    int c[n];
    rep(i,n){
        cin >> c[i];
        c[i]--;
    }
    if(n<=2){
        cout << 1 << endl;
        return 0;
    }
    vector<int> a(n);
    int k=1;
    a[0]=c[0];
    rep(i,n-1){
        if(c[i]!=c[i+1]){
            a[k]=c[i+1];
            k++;
        }
    }
    ll dp[n];
    vector<ll> plus(n,0);
    rep(i,k){
        if(i==0){
            dp[i]=1;
            plus[a[i]]=1;
            continue;
        }
        dp[i] = (dp[i-1]+plus[a[i]]) % MOD;
        dp[i] %= MOD;
        plus[a[i]]+=dp[i-1];
        plus[a[i]] %= MOD;
        //rep(i,n) cout << plus[i] << " "; cout << endl;
    }
    cout << dp[k-1] << endl;
    return 0;
}


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

int main() {
	string c;
  	cin >> c;
  	if(c == "a" || c == "i" ||  c == "u" || c == "e" || c == "o") {
    cout << "vowel" << endl;
    }
  	else {
    cout << "consonant" << endl;}
}


Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<time.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<fstream> 
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 #include<memory>
 
 using namespace std;
 
 char mp[50+5][50+5];
 char mp2[50+5][50+5];
 
 int n,m;
 
 bool check(int i,int j)
 {
   return ((i>=0&&i<n)&&(j>=0&&j<m));     
 }
 
 int main()
 {
   while(cin>>n>>m)
   {
     for(int i=0;i<n;i++)
     {
       for(int j=0;j<m;j++)
       {
         cin>>mp[i][j];        
       }        
     }  
     for(int i=0;i<n;i++)
     {
       for(int j=0;j<m;j++)
       {
         if(mp[i][j]=='.')
         {
           int cnt=0;
           for(int dx=-1;dx<=1;dx++)
           {
             for(int dy=-1;dy<=1;dy++)
             {
               if(dx==0&&dy==0) continue;
               if(check(i+dx,j+dy)&&mp[i+dx][j+dy]=='#') cnt++;         
             }        
           }                 
           mp2[i][j]=(cnt+'0');
         }      
         else mp2[i][j]='#';  
       }        
     }
     for(int i=0;i<n;i++)
     {
       for(int j=0;j<m;j++)
       {
         cout<<mp2[i][j];        
       }        
       cout<<endl;
     }
   } 
   return 0;
 }
 

        


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
int main() {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1 + a2 + a3 >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  long n, k;
  scanf("%ld%ld", &n, &k);
  long ans = 0;
  for (int i=k+1; i<n+1; i++) {
    long p = n/i, q = n%i;
    ans += (i-k)*p;
    if (k == 0) ans--;
    ans += (q>=k) ? q+1-k : 0;
  }
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 128
from collections import Counter
n,k=map(int,input().split())
a=list(map(int,input().split()))
t=list(set(a))
c=sorted(Counter(a).most_common(),key=lambda x:x[1])
num=len(t)-k
if num<0:
    print(0)
    exit()
else:
    ans=0
    for i in range(num):
        ans+=c[i][1]
    print(ans)

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

int main(){
  int a,b,c; cin >>a>>b>>c;
  if((a==b && b!=c)||(a==c && b!=a)||(b==c && b!=a))
  {cout << "Yes";}
  else{cout << "No";}

return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int main()
{
	int n;
	scanf("%d", &n);
	int ans = n / 2;
	if (n % 2 == 0)
		ans--;
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 128
N = int(input())
S = input()

total = S.count('R') * S.count('G') * S.count('B')
    
cnt = 0

for i in range(N):
    for j in range(i+1,N):
        k = 2 * j - i
        if k >= N:
            break
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            cnt += 1
            
print(total-cnt)

Measured memory_bytes: 9132
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    map<string,int> a;
    vector<string> ans;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        a[s]++;
    }
    int m=0;
    for(auto p : a) m=max(m,p.second);
    for(auto p:a)
        if(p.second==m) cout<<p.first<<endl;
}

Measured memory_bytes: 19108
def sub():
    N, K = [int(e) for e in input().split(" ")]

    pOne = (N-K+1) / N
    if pOne < 0:
        pOne = 0.0

    M = min(K-1, N)
    k = 2
    count = 1
    tmpM = M + 0
    buf = []
    for i in range(M):
        tmpM = M-i
        while True:
            v = tmpM*k
            if v >= K:
                buf.append(count)
                break
            k = 2*k
            count = count + 1
    twos = [0.5]
    for _ in range(count-1):
        t = twos[-1] * 0.5
        twos.append(t)
    
    pp = [twos[b-1] / N for b in buf]
    pTwo = sum(pp)
    print(pOne + pTwo)
    


sub()


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = Integer.parseInt(scan.next());
        scan.close();

        int sum = 0;
        for (int a = 1; a <= k; a++) {
            for (int b = 1; b <= k; b++) {
                for (int c = 1; c <= k; c++) {
                    int min = Math.min(a, Math.min(b, c));
                    int gcd = 1;
                    for (int i = 1; i <= min; i++) {
                        if (a % i == 0 && b % i == 0 && c % i == 0) {
                            gcd = i;
                        }
                    }
                    sum += gcd;
                }
            }
        }

        System.out.println(sum);
    }

}


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

long long n,x;

long long dfs(long long n, long long x)
{
	if(n==0) {
		if(x > 0) return 1ll;  //如果x>0，左边都是B了 
			else return 0;  //之前吃光了 
	}
	if(x <= pow(2,n+1)-2) return dfs(n-1,x-1);   //汉堡包对称的，不到中间的话，递归n-1规模的子问题，最右边的B去掉，所以x-1 
		else return pow(2,n) + dfs(n-1,x - pow(2,n+1) + 1); //如果超过对称部分，则在n-1规模子问题中寻找剩下部分能吃多少p 
} 


int main()
{
	cin >> n >> x;
	cout << dfs(n,x);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 

int  A(int x){
    if(x>=0)return x;
    else return -x;
}

int ans[1010][1010];

int main(void){
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n),seq;
    for(ll i=0;i<n;i++)cin>>a[i];
    for(ll i=0;i<n;i++){
        ll sum = 0;
        for(ll j=i;j<n;j++){
            sum+=a[j];
            seq.push_back(sum);
        }
    }
    for(ll i=40;i>=0;i--){
        vector<ll>seq1,seq2;
        for(ll j=0;j<seq.size();j++){
            if(seq[j]&(1LL<<i))seq1.push_back(seq[j]);
            else seq2.push_back(seq[j]);
        }
        if(seq1.size()<k)continue;
        else{
            if(seq1.size()==k){
                seq = seq1;
                break;
            }
            else seq = seq1;
        }
    }
    ll ans = (1LL<<40)-1LL;
    for(ll i=0;i<seq.size();i++)ans&=seq[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 13532