akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
LL ans,l[500010],r[500010],f[500010];
int n,a[500010];
int main(){
	cin>>n;
	FOR(i,0,n) getint(a[i]);
	l[n]=0;
	r[n]=0;
	FORD(i,n-1,0){
		r[i]=a[i+1]+r[i+1];
		l[i]=(a[i+1]+l[i+1]+1)/2;
		if (l[i]>r[i]) return puts("-1"),0;
		
	}
	if (1-a[0]<l[0] || 1-a[0]>r[0]) return puts("-1"),0;
	f[0]=1-a[0];
	FOR(i,0,n-1){
		f[i+1]=min(f[i]*2-a[i+1],r[i+1]);
	}
	ans=0;
	FOR(i,0,n) ans+=f[i]+a[i];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 6332
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
const long double PI=(acos(-1));
using namespace std;
typedef long long ll;
int main(){
  long double a,b,x;
  cin>>a>>b>>x;
  long double ans;
  if(a*a*b/2>=x){
    ans=PI/2-atan(2*x/(a*b*b));
  }else{
    ans=atan(2*(a*a*b-x)/(a*a*a));
  }
  cout<<fixed<<setprecision(10)<<ans*180.0/PI<<endl;
}

Measured memory_bytes: 256
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	k := scanInt(sc)

	minNegIdx := -1
	xs := make([]int, n)
	for i := 0; i < n; i++ {
		xs[i] = scanInt(sc)
		if xs[i] < 0 {
			minNegIdx = i
		}
	}

	leftmost := int(math.Max(0, float64(minNegIdx-k+1)))
	rightmost := int(math.Min(float64(n-k), float64(minNegIdx+1)))

	minTime := math.MaxInt32
	for i := leftmost; i <= rightmost; i++ {
		var time int
		end := i + k - 1

		if end <= minNegIdx {
			time = abs(xs[i])
		} else if minNegIdx < i {
			time = xs[end]
		} else {
			if abs(xs[i]) < xs[end] {
				if xs[end] == 0 {
					time = abs(xs[i])
				} else {
					time = abs(xs[i])*2 + xs[end]
				}
			} else {
				time = abs(xs[i]) + xs[end]*2
			}
		}

		if time < minTime {
			minTime = time
		}
	}

	fmt.Println(minTime)
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}


Measured memory_bytes: 2944
def solve():
    N = int(input())
    As = [int(i) for i in input().split()]
    As.sort()
    maxA = As.pop()
    minA = As.pop(0)
    upper0A = [i for i in As if i >= 0]
    lower0A = [i for i in As if i < 0]
    # print('maxA:', maxA)
    # print('minA:', minA)
    # print('upper0A:', upper0A)
    # print('lower0A:', lower0A)
    result_load = []
    for uA in upper0A:
        result_load.append([minA, uA])
        minA = minA - uA
    for lA in lower0A:
        result_load.append([maxA, lA])
        maxA = maxA - lA
    result_load.append([maxA, minA])
    resultA = maxA - minA

    # export
    print(resultA)
    for x, y in result_load:
        print(x, y)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 23324
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
static const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  cin>>s>>sb; n=s.size(),m=sb.size(); int a[n+1]={},b[m+1]={};
  rep(i,n)a[i+1]=s[i]-'A'+1+a[i];
  rep(i,m)b[i+1]=sb[i]-'A'+1+b[i];
  cin>>q; int x1,y1;
  rep(i,q){
    cin>>x>>y>>x1>>y1;
    pri1(((a[y]-a[x-1])%3==(b[y1]-b[x1-1])%3)?"YES":"NO");
  }
}

Measured memory_bytes: 1744
import java.util.Scanner;

public class Main {

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

		while(true) {
			int chukan = sc.nextInt();
			int kimatsu = sc.nextInt();
			int saishi = sc.nextInt();

			if(chukan == -1 && kimatsu == -1 && saishi == -1) {
				break;
			}

			if (chukan == -1 || kimatsu == -1) {
				System.out.println("F");
			} else if(chukan + kimatsu >= 80) {
				System.out.println("A");
			} else if(chukan + kimatsu >= 65) {
				System.out.println("B");
			} else if(chukan + kimatsu >= 50) {
				System.out.println("C");
			} else if(chukan + kimatsu >= 30 && saishi >= 50) {
				System.out.println("C");
			} else if(chukan + kimatsu >= 30) {
				System.out.println("D");
			} else {
				System.out.println("F");
			}
		}
	}
}



Measured memory_bytes: 26256
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, M, L = map(int, input().split())
dist = [[INF] * N for _ in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    if c > L:
        continue
    a -= 1
    b -= 1
    dist[a][b] = c
    dist[b][a] = c
Q = int(input())

for k in range(N):
    for i in range(N):
        for j in range(N):
            if dist[i][j] > dist[i][k] + dist[k][j]:
                dist[i][j] = dist[i][k] + dist[k][j]
fuel = [[INF] * N for _ in range(N)]
for i in range(N):
    for j in range(N):
        fuel[i][j] = 1 if dist[i][j] <= L else INF
for k in range(N):
    for i in range(N):
        for j in range(N):
            if fuel[i][j] > fuel[i][k] + fuel[k][j]:
                fuel[i][j] = fuel[i][k] + fuel[k][j]
for i in range(Q):
    s,t = map(int, input().split())
    if fuel[s - 1][t - 1] != INF:
        print(fuel[s - 1][t - 1] - 1)
    else:
        print(-1)

Measured memory_bytes: 79720
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

fn main() {
    input! {
        n: u64,
    }

    let p = vec![3_u64, 5, 7, 11, 13];
    let mut num = vec![];

    let l = p.len();

    for i in 0..l - 2 {
        for j in i + 1..l - 1 {
            for k in j + 1..l {
                num.push(p[i] * p[j] * p[k]);
            }
        }
    }

    for i in 0..l - 1 {
        for j in i + 1..l {
            num.push(p[i].pow(3) * p[j]);
            num.push(p[j].pow(3) * p[i]);
        }
    }

    num.sort();

    let mut cnt = 0;

    for e in num {
        if e <= n {
            cnt += 1;
        }
    }

    println!("{}", cnt);
}


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

using namespace std;

typedef long long ll;

const int Mod = 1e9 + 7;

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

void sub_self(int& x, int y)
{
    if((x -= y) < 0)    x += Mod;
}

int add(int x, int y)
{
    return add_self(x, y), x;
}

int sub(int x, int y)
{
    return sub_self(x, y), x;
}

int mul(int x, int y)
{
    return (ll) x * y % Mod;
}

int fp(int x, ll y)
{
    int Res = 1;
    for(; y > 0; y >>= 1, x = mul(x, x))
        if(y & 1)
            Res = mul(Res, x);
    return Res;
}

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

    vector <int> Dp(k + 1);

    for(int x = k; x > 0; x--)
    {
        Dp[x] = fp(k / x, n);

        for(int y = x + x; y <= k; y += x)  sub_self(Dp[x], Dp[y]);
    }

    int Ans = 0;

    for(int x = 1; x <= k; x++) add_self(Ans, mul(x, Dp[x]));

    cout << Ans << endl;
}


Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	string s;
	cin >> s;
	int n = s.size();
	if (s[n-1] == 's') cout << s + "es" << endl;
	else cout << s + "s" << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    c*=2;
    int ans=a*x+b*y;
    ans=min(ans,c*max(x,y));
    if(y-x>0)ans=min(ans,c*x+b*(y-x));
    if(x-y>0)ans=min(ans,c*y+a*(x-y));
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  char s[20];
  char t[20];
  int flag=1;
  scanf("%s%s",s,t);
  for(int i=0;s[i];i++){
    if(s[i]!=t[i]) {
      flag=0;
      break;
    }
  }
  if(flag) printf("Yes");
  else printf("No");
  return 0;
}

Measured memory_bytes: 3816
#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a < b) 
        printf("a < b\n");
    else if (a > b)
        printf("a > b\n");
    else
        printf("a == b\n");
    return 0;
}


Measured memory_bytes: 2076
import sys, math
import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
#from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
from decimal import Decimal
#from fractions import Fraction
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = int(1e9)+7

n=int(data())
print("Yes" if n%9==0 else "No")


Measured memory_bytes: 75164
a, b, c, d = map(int, input().split())
a = int(a)
b = int(b)
c = int(c)
d = int(d)

if ((abs(a - c) <= d) or (abs(a - b) <= d and abs(b - c) <= d)):
	print("Yes")
else:
	print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll Q;
    cin >> Q;
    while (Q--) {
        ll A, B;
        cin >> A >> B;

        if (A == B) {
            cout << 2*A-2 << "\n";
            continue;
        }
        if (A > B) swap(A, B);

        ll ok = 0, ng = 1e10;
        while (abs(ok-ng) > 1) {
            ll mid = (ok+ng)/2;
            // cout << mid << "\n";
            auto judge = [&](ll x) -> bool {
                ll k = (x+1) / 2;
                if (k*(x+1-k) > A*B-1) return false;
                else return true;
            };
            if (judge(mid)) ok = mid;
            else ng = mid;
        }

        cout << ok-1 << "\n";
    }
}

Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ( A + B > C + D ) {
	cout << "Left" << endl;
  }
  else if ( A + B == C + D ) {
    cout << "Balanced" << endl;
  }
  else if ( A + B < C + D ) {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long 
struct vl{
	int x,y;
	bool operator<(const vl& t)const{
		if(x==t.x)return y<t.y;
		return x<t.x;
	}
};
const int INF = 1e18;
const int mod = 1e9+7;
const int MAXN = 1e6+69;
int q=1,m,n,x,y,z,k,l;
vector<int> a[MAXN];
int dist[MAXN][4];
string s;
int stat,fin;
void Bfs(){
	queue<vl>q;
	for(int i=1;i<=n;i++)for(int j=0;j<=3;j++)dist[i][j] = INF;
	dist[stat][0] = 0;
	q.push({stat,0});
	while(!q.empty()){
		vl tmp = q.front();
		q.pop();
		int u = tmp.x;
		int mode = tmp.y;
		// cout<<u<<' '<<mode<<' '<<dist[u][mode]<<endl;
		int newmode = (mode+1)%3;
		for(int v:a[u]){
			if(dist[v][newmode] <= dist[u][mode] + 1)continue;
			dist[v][newmode] = dist[u][mode] + 1;
			q.push({v,newmode});
		}
	}
	if(dist[fin][0]==INF){
		cout<<-1;
	}
	else {
		int ans = dist[fin][0]/3;
		cout<<ans;
	}
}
signed main(){																																												ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	// cin>>q;
	while(q--){
		cin>>n;
		cin>>m;
		for(int i=1;i<=m;i++){
			int x,y;
			cin>>x>>y;
			a[x].push_back(y);
			// a[y].push_back(x);
		}
		cin>>stat>>fin;
		Bfs();
	}
}

Measured memory_bytes: 33304
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int a[1010],b[1010];
  int count=0;
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
    count+=b[i]-a[i]+1;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t n;
  cin >> n;
  int64_t y=1000;
  int64_t s=0; 
  vector<int>a(n);
  for (int i=0;i<n;i++) {
    cin >> a[i]; 
  }
  if(a[0]<a[1]){
    s=y/a[0];
    y-=a[0]*s;
  }
  for (int i=1;i<n-1;i++) {
    if(a[i-1]<a[i]){
      y+=a[i]*s;
      s=0;
    }
    if(a[i]<a[i+1]){
      s=y/a[i];
      y-=a[i]*s;
    }
  }  
  y+=s*a[n-1];
  cout << y << endl;
}  

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,k;
  cin>>n>>k;
  n++;
  vll d(n);
  d[1]=1;
  for(int i=2;i<n;i++){
    d[i]+=d[i-1]+i;
  }
  ll ans=1;
  for(int i=k;i<n;i++){
    ans+=d[n-1]-d[n-i-1]-d[i-1]+1;
    ans%=MOD;
  }
  COUT(ans);
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int64_t rs64() {
	int64_t n;
	scanf("%" SCNd64, &n);
	return n;
}

#define MOD 1000000007
template<int mod>
struct ModInt{
	int x;
	ModInt():x(0){}
	ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}
	ModInt &operator^=(long long p){
		ModInt res = 1;
		for (; p; p >>= 1) {
			if (p & 1) res *= *this;
			*this *= *this;
		}
		return *this = res;
	}
	ModInt operator-()const{return ModInt(-x);}
	ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
	ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
	ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
	ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	ModInt operator^(long long p)const{return ModInt(*this)^=p;}
	bool operator==(const ModInt &p)const{return x==p.x;}
	bool operator!=(const ModInt &p)const{return x!=p.x;}
	explicit operator int() const { return x; }						   // added by QCFium
	ModInt operator=(const int p) {x = p; return ModInt(*this);} // added by QCFium
	ModInt inverse()const{
		int a=x,b=mod,u=1,v=0,t;
		while(b>0){
			t=a/b;
			a-=t*b;
			std::swap(a,b);
			u-=t*v;
			std::swap(u,v);
		}
		return ModInt(u);
	}
	friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
		return os<<p.x;
	}
	friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
		long long x;
		is>>x;
		a=ModInt<mod>(x);
		return (is);
	}
};
typedef ModInt<MOD> mint;

struct MComb {
	std::vector<mint> fact;
	std::vector<mint> inversed;
	MComb(int n) { // O(n+log(mod))
		fact = std::vector<mint>(n+1,1);
		for (int i = 1; i <= n; i++) fact[i] = fact[i-1]*mint(i);
		inversed = std::vector<mint>(n+1);
		inversed[n] = fact[n] ^ (MOD-2);
		for (int i = n - 1; i >= 0; i--) inversed[i]=inversed[i+1]*mint(i+1);
	}
	mint ncr(int n, int r) {
		return (fact[n] * inversed[r] * inversed[n-r]);
	}
	mint npr(int n, int r) {
		return (fact[n] * inversed[n-r]);
	}
	mint nhr(int n, int r) {
		assert(n+r-1 < (int)fact.size());
		return ncr(n+r-1, r);
	}
};


int main() {
	int n = ri();
	int a[n];
	for (auto &i : a) i = ri();
	std::sort(a, a + n, std::greater<>());
	mint res = 0;
	for (int i = 0; i < n; i++) {
		res += mint(i + 2) * (mint(2) ^ i) * a[i] * (mint(2) ^ (n - 1 - i));
	}
	std::cout << res * (mint(2) ^ n) / 2 << std::endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.*;
     
    class Main {
      public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++)
          a[i] = sc.nextInt();
        
        Arrays.sort(a);
        int t=0,ans=0,f=0;
        while(f == 0) {
          if(Arrays.binarySearch(a, x-t) < 0) {
           ans = x - t;
            f = 1;
          } else if(Arrays.binarySearch(a, x+t) < 0) {
            ans = x + t;
            f = 1;
          }
          t++;
        }
        System.out.println(ans);
      }
    }

Measured memory_bytes: 35620
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a,b,n,x;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
 	cin>>a>>b>>n;
 	if(b-1<=n) x=b-1;
 	else x=n;
 	cout<<a*x/b-a*(x/b);
	return 0;
}

Measured memory_bytes: 3648
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <iostream>
#include <string>
#include <vector>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int col[4010][3];

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

	int n;
	string s;
	cin >> n >> s;

	if(n <= 3)
	{
		cout << 0;
		return 0;
	}
	
	for(int i = 0; i< n; ++i)
	{
		if(i)
		{
			col[i][0] = col[i-1][0];
			col[i][1] = col[i-1][1];
			col[i][2] = col[i-1][2];
		}
		if(s[i] == 'R')
			col[i][0]++;
		else if(s[i] == 'G')
		{
			col[i][1]++;
		}
		else
		{
			col[i][2]++;
		}
	}

	ll sum = 0;
	for(int i = 0; i< n; ++i)
	{
		for(int j = i+1; j< n; ++j)
		{
			if(s[i] != s[j])
			{
				if('R' != s[i] && 'R' != s[j])
				{
					sum+= col[n-1][0] - col[j][0];
					if(j + (j-i) < n && s[j + (j-i)] == 'R')
						sum--;
				}
				if('G' != s[i] && 'G' != s[j])
				{
					sum+= col[n-1][1] - col[j][1];
					if(j + (j-i) < n && s[j + (j-i)] == 'G')
						sum--;
				} 
				if('B' != s[i] && 'B' != s[j])
				{
					sum+= col[n-1][2] - col[j][2];
					if(j + (j-i) < n && s[j + (j-i)] == 'B')
						sum--;
				} 
			}
		}
	}
	cout << sum;

    return 0;
}

Measured memory_bytes: 3696
/*.....Bismillahir Rahmanir Rahim...... 
knapsack problem atcoder problem 
d & e educational dp contest.........*/ 
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld long double
#define   pb push_back
#define  sz(x)  (int)x.size()
#define  ff first
#define  ss second
#define  pii  pair<int,int>
using namespace std;

int dp[101][1000006];

inline void  solve(){ 
	int  capasity ,n ; 
	cin >> n >> capasity ; 
	int w[1+n],cost[1+n]; 
	for (int i=1;i<=n;i++)  cin>>w[i]>>cost[i]; 
	for (int i=1;i<=n;i++) { 
		for (int j=0; j<=capasity ;j++) { 
			// main coding part ... ... ... 
			if (j<w[i]) dp[i][j] = dp[i-1][j];
			else 
				dp[i][j] = max(dp[i-1][j], cost[i] + dp[i-1][j-w[i]]) ; 
		} 
	} 
	cout << dp[n][capasity];
} 


signed main()
{
	solve();
    return 0;
}


Measured memory_bytes: 289024
import sys

def solve():
    a, b, c = map(int, input().split())

    if (a & 1) or (b & 1) or (c & 1):
        print(0)
        return

    if a == b and b == c:
        print(-1)
        return

    cnt = 0

    while True:
        if (a & 1) or (b & 1) or (c & 1):
            print(cnt)
            return

        a, b, c = (b + c) >> 1, (a + c) >> 1, (a + b) >> 1
        cnt += 1

if __name__ == '__main__':
    solve()

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for (ll i=(a);i<(b);i++)
#define RFOR(i,a,b) for (ll i=(b)-1;i>=(a);i--)
#define REP(i,n) for (ll i=0;i<(n);i++)
#define RREP(i,n) for (ll i=(n)-1;i>=0;i--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
	EACH(x,vec) is >> x;
	return is;
}
template<typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
	REP(i,vec.size()) {
		if (i) os << " ";
		os << vec[i];
	}
	return os;
}
template<typename T>
ostream& operator<<(ostream& os, vector< vector<T> >& vec) {
	REP(i,vec.size()) {
		if (i) os << endl;
		os << vec[i];
	}
	return os;
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int a, b, c, d, e, f;
	while ( cin >> a >> b >> c >> d >> e >> f ) {
		ll delta = a * e - b * d;
		ll x = c * e - b * f;
		ll y = a * f - c * d;
		ld X = (ld)x/delta;
		ld Y = (ld)y/delta;
		if (-0.0005 < X && X < 0.0005) {
			X = 0;
		}
		if (-0.0005 < Y && Y < 0.0005) {
			Y = 0;
		}
		cout << fixed << setprecision(3) << X << " " << Y << endl;
	}
}

Measured memory_bytes: 3236
n  = int(input())
a = [int(x) for x in input().split()]

def gcd(a,b):
    if a == 0 or b == 0:
        return a+b
    else:
        if a % b == 0:
            return b
        else:
            return gcd(b,a%b)

r = [0 for _ in range(n+1)]
l = [0 for _ in range(n+1)]

for i in range(n):
    l[i+1] = gcd(l[i], a[i])
    r[n-i-1] = gcd(r[n-i], a[n-i-1])

m = [0 for _ in range(n)]

for i in range(n):
    m[i] = gcd(l[i],r[i+1])

print(max(m))

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

typedef long long int ll;

void fileioe(){
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout); 
	freopen("error.txt","w",stderr);
}
#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
#define fioe() fileioe()
#else
#define fioe() 1
#endif

int main()
{
	GO
	//fioe();
	ll a,b;
	cin>>a>>b;
	ll ans=b*10;
	bool flag=0;
	for(ll i=0;i<=9;i++){
		ans+=i;
		ll val=floor(ans*(0.08));
		if(val==a){
			flag=true;
			break;
		}
		ans-=i;
	}	
	if(flag)
		cout<<ans<<endl;
	else
		cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	char s[4],x=0;
	scanf("%s",s);
	if(s[0]=='S'){
		if(s[1]=='A')	x=1;
		else	x=7;
	}
	if(s[0]=='M')	x=6;
	if(s[0]=='T'){
		if(s[1]=='U')	x=5;
		else	x=3;
	}
	if(s[0]=='W')	x=4;
	if(s[0]=='F')	x=2;
	printf("%d\n",x);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  string a,b;
  cin>>a>>b;
  a+=b;
  int d;
  d=stoi(a);
  if(int(sqrt(d))*int(sqrt(d))==d)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3696
// skip until line 65
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <sstream>
#include <list>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

#define BR "\n"
#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a, b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it, cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it, cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
#define MAX(V, T) V=max(V,T)
#define MIN(V, T) V=min(V,T)

#define DumpArray(cont, from, to) for(int __i=from;__i<to;++__i) {cout<<"(" <<__i<<": " << cont[__i]<<")";} cout<<endl;

/*
 * ***_bound(6)
 * 5 6 6 6 6 6 7 7 7
 *   ^lower    ^upper
 * void reverse(c.begin(), c.end())
 *
 * graph
 * seg tree
 * dp
 * brute force
 */
struct Comparator{
    int operator()(int l, int r) const {
        return r<l;
    }
};
struct Vec;
//set<int, Comparator> S;

// solution below
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
int main() {

    cout.precision(10);
    cout<<fixed;
    ll X;
    cin>>X;
    cout << (X/500)*1000+((X-(X/500)*500)/5 )*5<<endl;
}

struct Vec{
    double v[2];
    string to_s(){
        return "("+to_string(v[0])+","+to_string(v[1])+")";
    }
    double& operator[](int t){
        return v[t];
    }
    Vec operator+(Vec t) {
        return {v[0]+t[0],v[1]+t[1]};
    }
    Vec& operator+=(Vec t) {
        v[0]+=t[0];v[1]+=t[1];
        return *this;
    }
    Vec operator-(Vec t) {
        return {v[0]-t[0],v[1]-t[1]};
    }
    Vec& operator-=(Vec t) {
        v[0]-=t[0];v[1]-=t[1];
        return *this;
    }
    Vec operator*(double t) {
        return {v[0]*t,v[1]*t};
    }
    Vec& operator*=(double t) {
        v[0]*=t;v[1]*=t;
        return *this;
    }
    double operator*(Vec t) {
        return v[0]*t[0]+v[1]*t[1];
    }
    Vec operator-(){
        return {-v[0],-v[1]};
    }
    static Vec Z;
};
Vec Vec::Z={0,0};


Measured memory_bytes: 256
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
  cout << a*b;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define sz(x) ((int)x.size())

int pref[405] = {0}, dp[405][405];
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> pref[i], dp[i][i] = 0, pref[i] += pref[i-1];
    for(int i = 2; i <= n; i++)
        for(int j = 1; j+i-1 <= n; j++)
        {
            int l = j, r = j+i-1;
            dp[l][r] = (1LL<<60);
            for(int k = l; k < r; k++)
                dp[l][r] = min(dp[l][r], dp[l][k] + dp[k+1][r] + pref[r]-pref[l-1]);
        }
    cout << dp[1][n] << endl;
}

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

const int INF = 1 << 30;

typedef struct
{
  int h, r;
} Doll;

int solve(int prev, vector<int>& used, const vector<Doll>& doll, vector<int>& dp)
{
  if (dp[prev] != -1)
    return dp[prev];

  int ret = 0;
  for (int i = 0; i < doll.size(); ++i) {
    if (!used[i] && doll[prev].h > doll[i].h && doll[prev].r > doll[i].r) {
      used[i] = 1;
      ret = max(ret, solve(i, used, doll, dp)+1);
      used[i] = 0;
    }
  }
  return dp[prev] = ret;
}

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    vector<Doll> doll;
    for (int i = 0; i < n; ++i) {
      int h, r;
      cin >> h >> r;
      doll.push_back((Doll){h, r});
    }

    int m;
    cin >> m;
    for (int i = 0; i < m; ++i) {
      int h, r;
      cin >> h >> r;
      doll.push_back((Doll){h, r});
    }

    doll.push_back((Doll){INF, INF});
    vector<int> used(n+m+1, 0);
    vector<int> dp(n+m+1, -1);
    cout << solve(n+m, used, doll, dp) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#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;
  cin >> n;

  string tmp;
  map<string, int> m;
  rep(i, n) {
    cin >> tmp;
    m[tmp]++;
  }

  int maxV = 0;
  for (const auto &tmpPair :m) {
    maxV = max(maxV, tmpPair.second);
  }

  for (const auto &tmpPair :m) {
    if (tmpPair.second == maxV) {
      std::cout << tmpPair.first << endl;
    }
  }
  return 0;
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; ll P; string S; cin >> N >> P >> S;
    ll ans=0;
    if (P==2||P==5){
        for (int i=0;i<N;++i){
            if ((S[i]-'0')%P==0) ans+=i+1;
        }
    } else {
        ll po=1,now=0;
        vector<ll> cnt(P,0);
        cnt[0]=1;
        for (int i=N-1;i>=0;--i){
            (now+=(ll)(S[i]-'0')*po%P)%=P;
            (po*=10)%=P;
            ans+=cnt[now]; ++cnt[now];
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 720
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<pair<pair<double, double>, double>> v;
	v.emplace_back(make_pair(make_pair(0, 0), 0));
	for(int i = 1; i <= n; i++){
		double dist = 100.0 / pow(3, i);
		vector<pair<pair<double, double>, double>> next;
		for(auto &&pp:v){
			pair<double, double> &p = pp.first;
			double angle = pp.second;
			next.emplace_back(make_pair(p, angle));
			next.emplace_back(make_pair(make_pair(p.first += dist * cos(angle), p.second += dist * sin(angle)), angle + M_PI / 3));
			next.emplace_back(make_pair(make_pair(p.first += dist * cos(angle + M_PI / 3), p.second += dist * sin(angle + M_PI / 3)), angle - M_PI / 3));
			next.emplace_back(make_pair(make_pair(p.first += dist * cos(angle - M_PI / 3), p.second += dist * sin(angle - M_PI / 3)), angle));
		}
		v = next;
	}
	v.emplace_back(make_pair(make_pair(100, 0), 0));
	for(auto &&pp:v){
		pair<double, double> &p = pp.first;
		cout << fixed << setprecision(10) << p.first << ' ' << p.second << endl;
	}
	return 0;
}

Measured memory_bytes: 3616
#include "cstring"
#include "math.h"
#include "iostream"

using namespace std;

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

	cin >> a >> b;
	c = a + b;
	d = a - b;
	e = a * b;
	if (c > d) {
		if (c > e) {
			cout << c;
		}
		else {
			cout << e;
		}
	}
	else {
		{
			if (d > e) {
				cout << d;
			}
			else {
				cout << e;
			}
		}
	}
	
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s; cin >> s;
  FOR(i,0,s.length()-1) {
    if(s[i] == 'A' && s[i+1] == 'C') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
ll n,m,a[200002],b[200002],s[200002],L,tmp,tmp2;
int main(void){
    cin>>n>>m;
    m++;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    L=1;
    for(int i=1;i<=n+1;i++){
        b[i]=L;
        if(s[L]!=0){tmp=i;break;}
        s[L]=i;
        L=a[L];
    }
    if(m<=tmp){cout<<b[m]<<endl;return 0;}
    else{
        //cout<<m<<" "<<s[L]<<" "<<tmp<<" "<<s[L]<<endl;
        tmp2=(m-s[L]+1)%(tmp-s[L]);
        if(tmp2==0)tmp2=tmp-s[L];
    }
    //cout<<tmp2<<endl;
    for(int i=1;i<=tmp2;i++){
        s[L]++;
    }
    cout<<b[s[L]-1]<<endl;
}


Measured memory_bytes: 8324
#include <bits/stdc++.h>
using namespace std;
#define N 300100
const int mod=1e9+7;

int a[8][2],f[N][8];
char s[N];

int main()
{
	a[0][0]=1; a[0][1]=2;
	a[1][0]=3; a[1][1]=4;
	a[2][0]=5; a[2][1]=6;
	a[3][0]=a[3][1]=1;
	a[4][0]=1; a[4][1]=2;
	a[5][0]=7; a[5][1]=2;
	a[6][0]=a[6][1]=6;
	a[7][0]=a[7][1]=5;
	scanf("%s",s);
	int n=strlen(s);
	f[n][2]=f[n][6]=1;
	for (int i=n-1;i>=0;i--)
		for (int j=0;j<8;j++)
		{
			if (s[i]!='1') (f[i][j]+=f[i+1][a[j][0]])%=mod;
			if (s[i]!='0') (f[i][j]+=f[i+1][a[j][1]])%=mod;
		}
	printf("%d\n",f[0][0]);
	return 0;
}

Measured memory_bytes: 9856
n,k=map(int,input().split())
wd=[]
for i in range(n):
    wd.append(list(map(int,input().split())))
    
ok=wd[0][0]+k*wd[0][1]+2
ng=0

while ok-ng>1:
    m=(ok+ng)//2
    z=0
    for i in range(n):
        if wd[i][0]<=m:
            z+=(m-wd[i][0])//wd[i][1]+1
    if z>=k:
        ok=m
    else:
        ng=m
print(ok)

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

class Program
{
    static void Main(string[] args)
    {
        //変数・リスト宣言・初期化
        int n = int.Parse(Console.ReadLine());//N
        string input = Console.ReadLine();//色の入力をstringとして取り込む
        char save = ' ';
        int count = 0;

        foreach (char m in input)//色の切り取り、読み込み
        {
            if (save != m) count++;
            save = m;
        }

        Console.Write(count);//出力
    }
}


Measured memory_bytes: 13116
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
long long power(long long a,long long now) {
	long long ans = 1;
	while (now != 0) {
		if (now % 2 == 1) {
			ans *= a;
			ans %= MAX_MOD;
		}
		now /= 2;
		a *= a;
		a %= MAX_MOD;
	}
	return ans;
}
long long inv(long long a) {
	return power(a, MAX_MOD - 2);
}
long long permutation(long long a, long long b) {
	long long ans = 1;
	for (long long i = 0; i < b; ++i) {
		ans *= (a - i);
		ans %= MAX_MOD;
	}
	return ans;
}
long long combination(long long a, long long b) {
	long long ans = 1;
	for (long long i = 0; i < b; ++i) {
		ans *= (a - i);
		ans %= MAX_MOD;
		ans *= inv(i + 1);
		ans %= MAX_MOD;
	}
	return ans;
}
int main() {
	long long n, k;
	cin >> n >> k;
	if (k >= n) cout << 1 << endl;
	else cout << 0 << endl;
}



Measured memory_bytes: 3096
from sys import exit

N = int(input())
A = [int(input()) for i in range(N)]
A.sort()

if sum(A)%10!=0:
    print(sum(A))
    exit()

for i in range(N):
    if A[i]%10!=0:
        print(sum(A)-A[i])
        exit()
print(0)


Measured memory_bytes: 3060
X = int(input())

def is_prime(n):
    if n==1:return False
    for i in range(2,n+1):
        if i*i > n:
            return True
        if n%i==0:
            return False
    return True

for i in range(X,110000):
    if is_prime(i):
        print(i)
        break

Measured memory_bytes: 38384
using System.Collections.Generic;
using System.Linq;
using System;

class Program
{
    static int N;
    static List<int>[] E;

    static void Main()
    {
        D();
    }

    static void D()
    {
        N = int.Parse(Console.ReadLine());
        
        E = new List<int>[N];
        for (int i = 0; i < N; i++) E[i] = new List<int>();
        for (long i = 0; i < N - 1; i++)
        {
            var XY = Console.ReadLine().Split(' ').Select(x => int.Parse(x) - 1);
            E[XY.ElementAt(0)].Add(XY.ElementAt(1));
            E[XY.ElementAt(1)].Add(XY.ElementAt(0));
        }

        Console.WriteLine(Grundy(0, 0) == 0 ? "Bob" : "Alice");
    }

    static int Grundy(int root, int prev)
    {
        int ans = 0;
        
        foreach (var n in E[root])
        {
            if (n != prev) ans ^= Grundy(n, root) + 1;
        }

        return ans;
    }
}

Measured memory_bytes: 37232
#include <iostream>

using namespace std;

int main() {
    int A, B, T, ans;
    cin >> A >> B >> T;

    double C = (double)T + 0.5;

    ans = C / A;

    if (ans == 0) {
        cout << 0 << endl;
    } else {
        cout << B * ans << endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

a = int(input())
b = int(input())
c = int(input())
x = int(input())

answer = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500 * i + 100 * j + 50 * k:
                answer += 1

print(answer)


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

using namespace std;

typedef long long ll;

int main(){
    ll n,h;
    scanf("%lld%lld",&n,&h);
    vector< ll > m;
    vector< ll > t;
    for(int i=0;i<n;i++){
        ll a,b;
        scanf("%lld%lld",&a,&b);
        m.push_back(a);
        t.push_back(b);

    }
    sort(m.begin(),m.end());
    sort(t.begin(),t.end());
    reverse(m.begin(),m.end());
    reverse(t.begin(),t.end());
    ll ans=0,sum=0,k=0;
    for(int i=0;i<n;i++){
        if(t[i]>=m[0]){
            k++;
            sum+=t[i];
        }
    }
    if(sum<=h){
        double g=h-sum;
        ans+=ceil(double(g*1.0/m[0]));
        h-=(ans*m[0]);
    }
    for(int i=0;i<n;i++){
        if(h<=0)break;
        ans++;
        h-=t[i];
    }
    cout<<ans;
}


Measured memory_bytes: 2036
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

lint gcd(lint a, lint b) {
    lint r;
    while (b != 0) {
        r = a % b;
        a = b; 
        b = r;
    }
    return a;
}

lint lcm(lint a, lint b) {
    return (a / gcd(a, b)) * b;
}

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    int l = s.length();
    bool check = true;
    int ans = 0;
    for (int i=l-2; i>=0; i-=2){
        check = true;
        for (int j=0; j<i/2; ++j){
            if(s[j] != s[j + (i / 2)]){
                check = false;
            }
        }
        if(check){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math

SO=[0 for i in range(101)]

N=int(input())
for i in range(2,N+1):
    NUM=i
    for j in range(2,100):
        while NUM%j==0:
            SO[j]+=1
            NUM=NUM/j
A74=0
A24=0
A14=0
A04=0
A02=0
for j in range(len(SO)):
    if SO[j]>=74:
        A74+=1
    if SO[j]>=24:
        A24+=1
    if SO[j]>=14:
        A14+=1
    if SO[j]>=4:
        A04+=1
    if SO[j]>=2:
        A02+=1
#print(SO)
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

#74
ans=A74
#3*5*5
if A04>=2:
    ans+=(A02-2)*combinations_count(A04,2)
#3*25
ans+=(A02-1)*A24
#5*15
ans+=(A04-1)*A14


print(ans)

        

Measured memory_bytes: 3064
n = gets.to_i
x = gets.split(" ").map(&:to_f)
y = gets.split(" ").map(&:to_f)

for i in 0..n-1
  x[i] = (x[i] - y[i]).abs
end

puts x.reduce(:+)
puts (x.map {|q| q*q}.reduce(:+))**0.5
puts (x.map {|q| q*q*q}.reduce(:+))**(1.0/3)
puts x.max



Measured memory_bytes: 8944
use proconio::input;

// use std::cmp::*;
// use std::collections::*;
// use proconio::marker::Chars;

fn main() {
    input! {
        // s: String
        // n: isize
        a:i64,
        c:char,
        b:i64,
    }
    let ans = if c=='+'{
        a+b
    }else{
        a-b
    };
    println!("{}",ans);
}


Measured memory_bytes: 2108
// きさま！ 見ているなッ！

#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;



int main()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (c - a - b < 0)
	{
		cout << "No" << endl; return 0;
	}
	bool flag = 4 * a*b < (c - a - b)*(c - a - b);

	cout << (flag ? "Yes" : "No") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

const int CMax = 100002;

int A, B, C, D;

string S;

int main() {
    cin >> S;
    A = (int)(S[0] - '0');
    B = (int)(S[1] - '0');
    C = (int)(S[2] - '0');
    D = (int)(S[3] - '0');

    if (A + B + C + D == 7) {
        printf("%d+%d+%d+%d=7\n", A, B, C, D);
    } else if (A - B + C + D == 7) {
        printf("%d-%d+%d+%d=7\n", A, B, C, D);
    } else if (A + B - C + D == 7) {
        printf("%d+%d-%d+%d=7\n", A, B, C, D);
    } else if (A + B + C - D == 7) {
        printf("%d+%d+%d-%d=7\n", A, B, C, D);
    } else if (A - B - C + D == 7) {
        printf("%d-%d-%d+%d=7\n", A, B, C, D);
    } else if (A - B + C - D == 7) {
        printf("%d-%d+%d-%d=7\n", A, B, C, D);
    } else if (A + B - C - D == 7) {
        printf("%d+%d-%d-%d=7\n", A, B, C, D);
    } else if (A - B - C - D == 7) {
        printf("%d-%d-%d-%d=7\n", A, B, C, D);
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int ch[30];
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		ch[s[i] - 'a']++;
	}
	string ans = "Yes";
	for (int i = 0; i < 26; i++)if (ch[i] % 2)ans = "No";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256