akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	ll n,k;
	cin >> n >> k;
	vector<ll> A(n),F(n);
	for(int i = 0;i<n;i++)cin >> A[i];
	for(int i = 0;i<n;i++)cin >> F[i];

	sort(A.begin(),A.end());
	sort(F.rbegin(),F.rend());

	ll sum = 0;
	for(int i = 0;i<n;i++)sum += A[i];
	if(sum <= k)
	{cout << 0 << endl; return 0;}

	ll l = 0,r = 1e18;
	while(1)
	{
		ll m = (r+l)/2;
		ll now = 0;
		for(int i = 0;i<n;i++)if(F[i]*A[i]>m)now += A[i] - m/F[i];

		if(now<=k)r = m;
		else l = m;
		if(r-l<2)break;
	}
	cout << r << endl;
	
}


Measured memory_bytes: 6400
n , m = map(int,input().split())
ans = [1 for i in range(n)]
for i in range(m):
    a , b = map(int,input().split())
    if a != 1:
        ans[a-1] *= -1
    if b != 1:
        ans[b-1] *= -1
        
for i in ans:
    if i == -1:
        print("NO")
        exit()
print("YES")

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

int N, M;
vector<int> achk, bchk;

int main() {
    scanf("%d %d", &N, &M);

    achk = bchk = vector<int>(N, 0);

    for(int i = 0; i < M; i++) {
        int u, v; scanf("%d %d", &u, &v);
        u--; v--;
        if(u > v) swap(u, v);
        if(u == 0) achk[v] = 1;
        if(v == N - 1) bchk[u] = 1;
    }

    for(int i = 0; i < N; i++) {
        if(achk[i] && bchk[i]) {
            printf("POSSIBLE");
            return 0;
        }
    }
    printf("IMPOSSIBLE");
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define loope(i,a,b) for(ll i=a;i<=b;i++)
#define test() ull t;cin>>t;while(t--)
#define pll pair<ll,ll>
#define puu pair<ull,ull>
#define f first
#define s second
#define pb push_back
#define mkp make_pair
#define ins insert
#define Vint vector<int>
#define Vll vector<ll>
#define Vull vector<ull>
#define nl cout<<endl
#define sp cout<<" "
#define MOD 1000000007
#define all(x) x.begin(),x.end()

int main() 
{
	 // #ifndef ONLINE_JUDGE
  //       freopen("input.txt", "r", stdin);
  //       freopen("output.txt", "w", stdout);
  //   #endif
  //   fastio();
    ll n;
    cin>>n;
    vector<ll> v(n);
    ll cnt = 1;
    loop(i,0,n)
    	cin>>v[i];
    ll mn = v[0];
    loop(i,1,n)
    {
    	if(v[i]<=mn)
    		cnt++;
    	mn = min(mn,v[i]);
    }
    cout<<cnt;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define loops(i, s, n) for (int i = s; i < n; i++)
#define loop(i, n) for (int i = 0; i < n; i++)
#define eps 1e-9
#define loopitr(mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define even_set 0xAAAAAAAA ... 1010101010
#define odd_set 0x55555555 ... 01010101
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vall(v) v.begin(), v.end()
#define mkp make_pair
#define ret return
#define cont continue
#define ff first
#define max3(a, b, c) max(a, max(b, c))
#define ss second
#define cnt_bits __builtin_popcount
const int mod = 1000000007;

int main()
{

    fastio;

    int n;
    cin >> n;
    int arr[n][3];
    loop(j, n)
    {
        cin >> arr[j][0] >> arr[j][1] >> arr[j][2];
    }

    ll dp[n][3];
    dp[0][0] = arr[0][0];
    dp[0][1] = arr[0][1];
    dp[0][2] = arr[0][2];

    for(int i =1;i<n;i++){
        dp[i][0] = arr[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = arr[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = arr[i][2] + max(dp[i-1][0], dp[i-1][1]);
    }

    cout<<max3(dp[n-1][0], dp[n-1][1], dp[n-1][2])<<endl;

}

Measured memory_bytes: 3840
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT cin.tie(0); ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    ll N;
    cin >> N;

    if (N % 2 == 0) {
        cout << N / 2 << endl;
    } else {
        cout << N / 2 + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

pair<ll, ll> get_answer(int n, vector<int> & a) {
ll left = 2, right = 2;

for (int i = n - 1; i >= 0; --i) {
 int size = a[i];
 ll nearestLeft = left + (size - left % size) % size;
 ll nearestRight = right - right % size;

 if (nearestLeft > nearestRight) {
  left = -1;
  right = -1;
  break;
 }

 left = nearestLeft;
 right = nearestRight + size - 1;
}

return make_pair(left, right);
}

int main() {

int n;
cin >> n;

vector<int> a(n, 0);
for (int i = 0; i < n; ++i) cin >> a[i];

pair<ll, ll> answer = get_answer(n, a);
cout << answer.first;
if (answer.first != -1) cout << " " << answer.second;
cout << endl;

return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long LL;
typedef pair<LL, LL> pLL;

int main(void)
{
	LL N,AC=0,WA=0,TLE=0,RE=0;
	cin >> N;
	string str;
	for (int i = 0; i < N; i++)
	{
		cin >> str;
		if (str == "AC")
			AC++;
		else if (str == "WA")
			WA++;
		else if (str == "TLE")
			TLE++;
		else if (str == "RE")
			RE++;
	}
	cout << "AC x " << AC << endl;
	cout << "WA x " << WA << endl;
	cout << "TLE x " << TLE << endl;
	cout << "RE x " << RE << endl;

	return 0;

}

Measured memory_bytes: 3644
def calc(pp,x,y):
    p = 0
    for i in range(1,1000):
        if i*(100+x)/100 == pp:
            p = i
            break
    return p*(100+y)/100

while True:
    max = 0
    X = 0
    Y = 0
    x,y,s = map(int,raw_input().split())
    if x == 0 and y == 0 and s == 0:
        break
    for i in range(1,s):
        for j in range(i,s):
            if i + j != s:
                continue
            if max < calc(i,x,y)+calc(j,x,y):
                max = calc(i,x,y)+calc(j,x,y)
    print max

Measured memory_bytes: 4300
#include<stdio.h>
int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  char s[12];
  for(int i=0;i<12;i++){
    scanf("%s",&s[i]);
  }
  //printf("%s",s);
  if(s[a]=='-'){
    for(int i=0;i<12;i++){
      if(i==a){
        i++;
      }
      if(s[i]=='-'){
        puts("No");
        return 0;
      }
    }
  }else{
    puts("No");
    return 0;
  }
  puts("Yes");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#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()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INTINF = 1<<29;
const ll LLINF = 1LL<<61;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const int DX[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const int DY[8]={ 1, 0,-1, 0, 1,-1, 1,-1};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b){
      cout << c << endl;
  }else if (a==c){
      cout << b << endl;
  }else{
      cout << a << endl;
  }
}

Measured memory_bytes: 256
from collections import deque
import itertools

h,w=map(int, input().split())
d=[list(input()) for i in range(h)]
inf=10**7

def bfs():
    for i, j in itertools.product([i for i in range(h)], [j for j in range(w)]):
        if d[i][j]=='.':
            d[i][j]=inf
    que=deque([[0,0]])
    d[0][0]=0

    while que:
        y,x=que.popleft()
        for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
            ny,nx=y+i,x+j
            if nx>=0 and nx<w and ny>=0 and ny<h:
                dist=d[ny][nx]
                if dist!='#':
                    if dist>d[y][x]+1:
                        d[ny][nx]=d[y][x]+1
                        que.append([ny,nx])

bfs()
ans=h*w-d[h-1][w-1]-1
for i, j in itertools.product([i for i in range(h)], [j for j in range(w)]):
    if d[i][j]=='#': 
        ans-=1
if ans>=0:
    print(ans)
else:
    print('-1')

Measured memory_bytes: 3316
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){

 ll int a,b;
 cin >> a >> b;

 if ( a>=b){
	 rep(i,a){
		 cout << b;
	 }
	 
 }	 else{
		 rep(i,b){
		 cout << a;

		 }
		 }








	return 0;

}



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

long long f[1000][1000];

int main(){
	long long h,w;
	char s[1000][1000];
	cin >> h >> w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> s[i][j];
			if(s[i][j]=='.'){
				if(i==0){
					if (f[i][j-1]==0&&j!=0){
						f[i][j]=0;
					}
					else
						f[i][j]=1;
				}
				else if(j==0){
					if (f[i-1][j]==0&&i!=0){
						f[i][j]=0;
					}
					else
						f[i][j]=1;
				}
				else{
					f[i][j]=(f[i-1][j]+f[i][j-1])%1000000007;
				}
			}
		}
	}
//	for(int i=0;i<h;i++){
//		for(int j=0;j<w;j++){
//			cout << f[i][j] << " ";
//		}
//		cout << endl;
//	}
	cout << f[h-1][w-1];
}

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

int main(){
    int N;
    cin >> N;
    std::vector<int> a(N);
    rep(i, N) cin >> a[i];

    double m = accumulate(a.begin(), a.end(), 0.0) / a.size();
    int m_int = m;
    if(m > double(m_int) + 0.5) ++m_int;
    int ans = 0;
    rep(i, N){
        double d = a[i] - m_int;
        ans += d*d;
    }
    cout << ans << endl;
    return 0;
}


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

int main () {
      long long n;
      cin >> n;
      long long a[n+10];
      long long sum1=0;
      for (long long i=0; i<n; i++) {
            cin >> a[i];
            sum1+= a[i];
      }
      for (long long i=0; i<n; i++){
            for (long long j=i+1; j<n; j++) {
                  if (a[j]<a[i]) {
                        a[j] = a[i];
                  }
                  else {
                        break;
                  }
            }
      }
      long long sum2=0;
      for (long long i=0; i<n; i++) {
            sum2 += a[i];
      }
      cout << sum2-sum1 << endl;
      return 0;
}


Measured memory_bytes: 5160
#include<iostream>
#include<memory.h>
using namespace std;

int main(){
    int a[26][100];
    int b[26];
    memset(b,0,sizeof(b));
    memset(a,0,sizeof(a));
    int n;
    string s;
    int ans=-1;;
    cin>>n;
    cin>>s;
    for(int i=0;i<n;i++){
        int c=s.at(i)-'a';
        int d=b[c];
        a[c][d]=i;
        b[c]++;
    }
    for(int i=1;i<n;i++){
        int num=0;
        for(int j=0;j<26;j++){
            for(int k=0;k<b[j];k++){
                if(a[j][k]<i&&a[j][k+1]>=i){
                    num++;
                    break;
                }
            }
        }
        ans=max(num,ans);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
/*Author- Soumak Poddar*/

#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define sll signed long long int
#define ull unsigned long long int
#define um unordered_map
#define us unordered_set
#define mm multimap
#define mp make_pair
#define pb push_back
#define M 1000000007

bool comp(pair<int,int> a,pair<int,int> b)
{
   return a.second<b.second;
}

template<typename T>
T gcd(T a,T b)
{
   if(a==0)
      return b;
   return gcd(b%a,a);
}
template<typename T>
T lcm(T a,T b)
{
   ll g=gcd<T>(a,b);
   return (a*b)/g;
}
template<typename T>
bool isprime(T n)
{
   if(n<=1)
      return false;
   for (int i = 2; i < n; i++)
      if (n % i == 0)
         return false;
   return true;
}

void solve();
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);

   #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("error.txt", "w", stderr);
      freopen("output.txt", "w", stdout);
   #endif
   
   int t=1;
   // cin>>t;
   while(t--)
   {
      solve();
      cout<<"\n";
   }
   cerr<<"Time Taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
   return 0;
}
void solve()
{
   int n,d;
   cin>>n>>d;
   int c=0;
   while(n--)
   {
      int x,y;
      cin>>x>>y;
      double dist=sqrt(pow(x,2)+pow(y,2));
      if(dist<=d)
         c++;
   }
   cout<<c;
}

Measured memory_bytes: 3824
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long
#define ull unsigned long long
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

ull s(ull arg)
{
    ull ret = 0;
    while(arg > 0)
    {
        ret += arg % 10;
        arg /= 10;
    }

    return ret;
}

int main(){
    std::ios::sync_with_stdio(false);
    ull k;
    cin >> k;

    ull base = 1;
    ull diff = 1;
    while(k > 0)
    {
        if(((double)base / s(base)) <= ((double)(base + diff) / s(base + diff)))
        {
            cout << base << endl;
            base += diff;
            k--;
        } 
        else
        {
            base -= diff;
            diff *= 10;
            base += diff;
        }
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int& vi : v)
    cin >> vi;
  sort(v.begin(), v.end());
  double sum = v[0];
  for (int i = 1; i < v.size(); ++i)
    sum = (sum + v[i]) / 2;
  cout << std::fixed;
  cout << std::setprecision(6) << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
//#define len length()
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect 

void solve() {
    int n, m;
    cin >> n >> m;
    if (n == 1 || m == 1) cout << 1;
    else cout << ((m + 1) / 2) * ((n + 1) / 2) + (m / 2) * (n / 2);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int a1,a2,a3,s=0;
    cin>>a1>>a2>>a3;
    s=a1+a2+a3;
    if(s<22){
        cout<<"win";
    }
    else{
        cout<<"bust";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
  ll n,mi=10000000000,ma=-10000000000,r;
  cin >> n;
  for(int i=0;i<n;i++){
    cin>>r;
    ma=max(ma,r-mi);
    mi=min(mi,r);
  }
  cout << ma << endl;
  return 0;
}


Measured memory_bytes: 3088
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

#[fastout]
fn main() {
   input! {
      n:usize,k:usize,c:usize,
      s:Chars
   }

   let mut s1 = vec![];
   let mut s2 = vec![];
   let mut interval = c + 1;
   let mut count = 0;

   for (i, x) in s.iter().enumerate() {
      if *x == 'o' && interval > c && count < k {
         interval = 0;
         s1.push(i + 1);
         count += 1;
      }
      interval += 1;
   }

   count = 0;
   interval = c + 1;

   for (i, x) in s.iter().enumerate().rev() {
      if *x == 'o' && interval > c && count < k {
         interval = 0;
         s2.push(i + 1);
         count += 1;
      }
      interval += 1;
   }

   s2.reverse();
   //dbg!(&s1, &s2);
   for i in 0..k {
      if s1[i] == s2[i] {
         println!("{}", s1[i]);
      }
   }
}


Measured memory_bytes: 6196
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    int n, i, j, ecount = 0;
    cin >> n;
    string s;
    int a[n];
    cin >> s;
    for (i = 1; i < n; ++i){
        if(s[i] == 'E'){
            ecount += 1;
        }
    }
    for (i = 0; i < n; ++i){
        if(1 <= i && s[i] == 'E'){
            ecount -= 1;
        }
        a[i] = ecount;
        if(s[i] == 'W'){
            ecount += 1;
        }
    }
    sort(a, a + n);
    cout << a[0] << endl;
    return 0;
}

Measured memory_bytes: 1796
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
while True:
	min_a = A.min()
	new_A = np.where(A%min_a==0,min_a,A%min_a)
	A = new_A
	if (np.all(A == A[0])):
		break
print(A.min())


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

using namespace std;

int main()
{
    int a, b, c, x;
    cin >> a >> b >> c;
    
    x = c - b;
    if(x > a)
		cout << "dangerous" << endl;
    else if(b >= c)
		cout << "delicious" << endl;
    else 
		cout << "safe" << endl;
    
	return 0;
}

Measured memory_bytes: 256
N = int(input())

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

cnt = 0

for v in a:
    if v < 0:
        cnt += 1
a = [abs(x) for x in a]

if cnt % 2 == 0:
    print(sum(a))
else:
    print(sum(a)-(min(a)*2))

Measured memory_bytes: 20032
<?php

fscanf(STDIN, "%d%d", $x, $y);

for ($i = 0; $i <= $x; ++$i) {
    $j = $x - $i;
    if (2 * $i + 4 * $j === $y) {
        echo 'Yes';
        exit;
    }
}

echo 'No';


Measured memory_bytes: 16120
import java.util.Scanner;
public class Main {

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

		String c= sc.next();
		
		if(c.equals("a")||c.equals("i")||c.equals("u")||c.equals("e")||c.equals("o"))
		{
			System.out.println("vowel");
		}else 
		{
			System.out.println("consonant");
		}
	}

}


Measured memory_bytes: 23124
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);
		 
		 String msg = "No";
		 
		 String str = scan.nextLine();
		 if (str.charAt(0) == str.charAt(1)) {
			 if (str.charAt(2) == str.charAt(3) && str.charAt(0) != str.charAt(2)) {
				 msg = "Yes";
			 }
		 }
		 else if (str.charAt(0) == str.charAt(2)) {
			 if (str.charAt(1) == str.charAt(3) && str.charAt(0) != str.charAt(1)) {
				 msg = "Yes";
			 }
		 }
		 else if (str.charAt(0) == str.charAt(3)) {
			 if (str.charAt(1) == str.charAt(2) && str.charAt(0) != str.charAt(1)) {
				 msg = "Yes";
			 }
		 }
		 
		 System.out.println(msg);
		 
		 scan.close();

	}

}


Measured memory_bytes: 23252
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(), v.end()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const ll inf = 10000000000000000;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };


string s;
int ans;
bool f = true;
map <char, bool> mp;

int main() {

	cin >> s;

	rep(i, s.size()) {
		mp[s[i]] = true;
	}

	rep(i, 26) {
		char c = 'a' + i;
		if (mp[c])continue;
		else {
			f = false;
			cout << c << endl;
			break;
		}
	}

	if (f)cout << "None" << endl;

	return 0;
} 

Measured memory_bytes: 512
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
 
 
def main():
    N, x = map(int, input().split())
    a_list = list(map(int, input().split()))
 
    ans = INF
    m = [INF] * N
    for rotate in range(N):
        total_time = rotate * x
        for i in range(N):
            t = a_list[i - rotate]
            if t < m[i]:
                m[i] = t
            total_time += m[i]
        ans = min(ans, total_time)
    print(ans)
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 3572
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

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

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    // bool state = false;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            // state = true;
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

void solve(){
    ll N;
    cin >> N;

    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }

    // sort(all(a));
    ll nume = 0, numo = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] % 2 == 0) {
            nume++;
        }else{
            numo++;
        }
    }

    if (numo > 0) {
        cout << "first" << endl;
    }else{
        cout << "second" << endl;
    }


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,m,r;
    cin>>n>>m>>r;
    vi rarr;
    ll d[n+3][n+3];
    for(int i=0;i<r;i++){
        int k;
        cin>>k;
        rarr.pb(k);
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j){
                d[i][j]=0;
            }
            else{
                d[i][j]=inf;
            }

        }
    }
    for(int i=0;i<m;i++){
        int a,b,c;
        cin>>a>>b>>c;
        if(d[a][b]>c){
            d[a][b]=c;
            d[b][a]=c;
        }
    }

    for(int k=1;k<=n;k++){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                if(d[i][j]>d[i][k]+d[k][j]){
                    d[i][j]=d[i][k]+d[k][j];
                }
            }
        }
    }
    ll ans=inf;
    sort(rarr.begin(), rarr.end());
    do {
        ll count=0;
        for(int i=0;i<r-1;i++){
            count+=d[rarr[i]][rarr[i+1]];
        }
        if(count<ans)
            ans=count;

    }while(next_permutation(rarr.begin(),rarr.end()));

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


Measured memory_bytes: 640
#include<cstdio>
const int N=1005,INF=~0u>>2;
int b[N],n,vis[N],lk[N],even[N],odd[N],even_num,odd_num,ans,k,tot,tim,v[N][N];
int abs(int x){return x>0?x:-x;}
bool find(int x){
	for(int i=1;i<=even_num;++i){
		if(v[x][i]&&vis[i]!=tim){
			vis[i]=tim;
			if(!lk[i]||find(lk[i])) return lk[i]=x,1;
		}
	}
	return 0;
}
//bool find(int x){
//	vis[x]=tim;
//	for(int i=1;i<=even_num;++i){
//		if(v[x][i]&&vis[lk[i]]!=tim){
//			if(!lk[i]||find(lk[i])) return lk[i]=x,1;
//		}
//	}
//	return 0;
//}
//bool find(int x){
//	for(int i=head[x];i;i=edge[i].nxt){
//		if(vis[edge[i].to]!=tim){
//			vis[edge[i].to]=tim;
//			if(!lk[edge[i].to]||find(edge[i].to)){
//				lk[edge[i].to]=x;
//				return 1;
//			}
//		}
//	}
//	return 0;
//}
bool check(int x){
	if(x==1) return 0;
	for(int i=2;i*i<=x;++i){
		if(x%i==0) return 0;
	}
	return 1;
}
void solve(int x){
	if(x&1) odd[++odd_num]=x;
	else even[++even_num]=x;
}
int main(){
//	freopen("ex.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&b[i]);b[0]=-1;
	for(int i=1;i<=n;++i){
		if(b[i]!=b[i-1]+1) solve(b[i]);
		if(b[i]+1!=b[i+1]) solve(b[i]+1);
	}
	for(int i=1;i<=odd_num;++i)
		for(int j=1;j<=even_num;++j)
			if(check(abs(even[j]-odd[i]))) v[i][j]=1;
	for(int i=1;i<=odd_num;++i){
		tim++;
		if(find(i)) k++;
	}
	ans=k+((even_num-k)/2+(odd_num-k)/2)*2+((odd_num-k)%2)*3;
	printf("%d",ans);
	return 0;
}

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

int main() {
    int n,m;
    cin>>n>>m;
    vector<int> a[n+1];
    int p[m],y[m];
    for (int i=0;i<m;i++) {
        cin>>p[i]>>y[i];
        a[p[i]].push_back(y[i]);
    }
    for (int i=1;i<=n;i++)
        sort(a[i].begin(),a[i].end());
    for (int i=0;i<m;i++)
        printf("%06d%06d\n",p[i],lower_bound(a[p[i]].begin(),a[p[i]].end(),y[i])-a[p[i]].begin()+1);
    return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>

#define ull unsigned long long
#define ul unsigned long
#define ll long long
#define size_t long long
// std::sort(&a[0], &a[4], [](auto& x, auto& y){return x[0] < y[0];});
//accumulate(&arr2[n], &arr2[m-1], 0);
using namespace std;

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

  ull n,k;
  std::cin >> n >> k;

  ull arr[n];
  for (int i = 0; i < n; i++) {
    std::cin >> arr[i];
  }
  bool flag = false;
  ull sum = accumulate(&arr[0], &arr[n], 0ull);
  ull digits = 0ull;

  for (int64_t i = 50; i >= 0 ; i--) {
    uint64_t pivot = 1ull << i;
    ull temp = 0;
    // std::cout << pivot << '\n';
    // std::cout <<((k & pivot) > 0) << " " <<  flag << '\n';
    if(((k & pivot) > 0) || (flag == true)){
      for(ull j = 0; j < n; j++){
        temp += pivot ^ arr[j];
      }
      if(temp > sum){
        digits += pivot;
      }else{
        flag = true;
      }
    }
    // std::cout << "" << '\n';
  }

  ull temp = 0;
  for(size_t j = 0; j < n; j++){
    temp += digits ^ arr[j];
  }
  std::cout << temp << '\n';

  return 0;
}


Measured memory_bytes: 1024
x, y, a, b, c = gets.split.map(&:to_i)
p = gets.split.map(&:to_i)
q = gets.split.map(&:to_i)
r = gets.split.map(&:to_i)

puts (p.sort[-x, x] + q.sort[-y, y] + r).sort[-(x + y), x + y].reduce(0) {|i, j| i + j}


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


int main(){
	int N;
	cin >> N;
	int ans = 0;
	rep(i,N){
		int tmp;
		cin >> tmp;
		ans += tmp;
	}
	cout << ans - N << endl;

}














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

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

using namespace std;

const char B4[4][5]={
	"abcc",
	"abdd",
	"eegh",
	"ffgh"
};

const char B5[5][6]={
	"ahhgg",
	"ai..f",
	"bi..f",
	"b.jje",
	"ccdde"
};

const char B7[7][8]={
	"a.hh.gg",
	"aii..k.",
	"..m..kf",
	"b.m...f",
	"bl.nn..",
	".l..jje",
	"cc.dd.e"
};

int main(){
	int n; scanf("%d",&n);

	if(n==2) return puts("-1"),0;

	char B[1000][1001]={};
	rep(i,n) rep(j,n) B[i][j]='.';

	if(n%3==0){
		rep(k,n/3){
			B[3*k+0][3*k+0]='a';
			B[3*k+1][3*k+0]='a';
			B[3*k+2][3*k+1]='b';
			B[3*k+2][3*k+2]='b';
		}
	}
	else{
		int dp[1001];
		rep(i,n+1) dp[i]=-1;
		dp[0]=0;
		rep(i,n-4+1) if(dp[i]!=-1) dp[i+4]=4;
		rep(i,n-5+1) if(dp[i]!=-1) dp[i+5]=5;
		rep(i,n-7+1) if(dp[i]!=-1) dp[i+7]=7;

		vector<int> P;
		{
			int now=n;
			while(now>0) P.emplace_back(dp[now]), now-=dp[now];
		}

		int pos=0;
		for(int a:P){
			rep(i,a) rep(j,a) {
				if     (a==4) B[pos+i][pos+j]=B4[i][j];
				else if(a==5) B[pos+i][pos+j]=B5[i][j];
				else if(a==7) B[pos+i][pos+j]=B7[i][j];
			}
			pos+=a;
		}
	}

	rep(i,n) puts(B[i]);

	return 0;
}


Measured memory_bytes: 2176
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n, Q; cin >> n >> Q;
  vector<ll> A(n); cin >> A;
  sort(all(A));
  vector<ll> S1(n+1, 0), S2(n+1, 0);
  rep(i, n) S1[i+1] = S1[i] + A[i];
  rep(i, n) S2[i+1] = A[i];
  rep(i, 2, n+1) S2[i] += S2[i-2];
  ll sum = 0;
  auto check = [&](ll mid, ll X, ll xub) {
    ll fst = mid, snd = mid;
    if (n-1-fst < xub) return true;
    ll right = n-fst-xub;
    ll left = xub;
    if (right == 0) return true;
    if (left + right <= snd) return true;
    if (snd < right) return false;
    ll L = snd - (right-1) - 1;
    // cout << left << " " << right << " " << L << endl;
    if (L < 0) return false;
    if (L >= left) return true;
    return abs(X-A[xub+right-1]) < abs(X-A[xub-L-1]);
  };
  // cout << check(2, 4, 1) << endl;
  // return;
  rep(i, Q) {
    ll X; cin >> X;
    ll lb = 0, ub = n;
    ll xub = upper_bound(all(A), X) - A.begin();
    rep(t, 30) {
      // 高橋くんが何ターン行うか
      ll mid = (lb + ub) / 2;
      if (check(mid, X, xub)) {
        ub = mid;
      }
      else {
        lb = mid;
      }
    }
    ll T = ub;
    // cout << T << endl;
    ll ans = (S1[n] - S1[n-T]) + S2[max(0, n-2*T)];
    cout << ans << endl;
  }
}


Measured memory_bytes: 4096
def num2alpha(num):
    return chr(num+65).lower()


N = int(input()) - 1
ans = ""
while(True):
    surplus = N % 26
    N -= surplus
    num = surplus
    ans = num2alpha(num) + ans
    if N == 0:
        break
    else:
        N //= 26
        N -= 1
print(ans)

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

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	string s, t;
	cin >> s >> t;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] != t[i])
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}

Measured memory_bytes: 3624
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A < B:
    print("YES" if A + T * V >= B + T * W else "NO")
else:
    print("YES" if A - T * V <= B - T * W else "NO")


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

int s[110],n;
int main() {
	ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
cin>>n;
for(int i=1;i<=n;++i){
	cin>>s[i];
	s[i]+=s[i-1];
}
int ans=110;
for(int i=1;i<n;++i)ans=min(ans,abs(s[n]-2*s[i]));
cout<<ans<<endl;
return 0;
}


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

int main(){
    string s; cin >> s;
    int red=0; int blue=0;
    for(int i=0; i<s.length(); i++){
        if(s.at(i)=='0') red++;
        if(s.at(i)=='1') blue++;
    }
    int sum = 2 * min(red, blue);

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3756
import java.math.BigInteger;
import java.util.Scanner;

public class Main 
{

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		BigInteger a = new BigInteger(sc.next());
		BigInteger b = new BigInteger(sc.next());
		
		System.out.println(a.multiply(b));
	}

}



Measured memory_bytes: 235404
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include<unordered_map>

int main()
{
	int N = 0;
	std::cin >> N;
	std::string ans = "YES";

	std::unordered_map<int, int>S;
	for (int i = 0; i < N; i++)
	{
		int A;
		std::cin >> A;
		S[A]++;
	
	}
	
	for (auto itr = S.begin(); itr != S.end(); ++itr)
	{
		if (itr->second > 1){
			ans = "NO"; break;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 8520
N = int(input())
import numpy as np
A = np.array([int(x) for x in input().split()])
B = np.array([int(x) for x in input().split()])
ans = 0
for k in range(29):
    T = 2**k
    mod = 2*T
    Amod = A.copy()%mod
    Bmod = B.copy()%mod
    Bmod.sort()
    f = lambda x,y:np.searchsorted(Bmod,x-Amod)-np.searchsorted(Bmod,y-Amod)
    Cnt = f(2*T,T) + f(4*T,3*T)
    i = Cnt.sum()&1
    ans |= i << k
print(ans)

Measured memory_bytes: 50200
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <string>
#include <utility>
#include <map> 
#include <queue>
#include <stack>
#include <iomanip>
#include <sstream>
#define MP make_pair
#define PB push_back
#define S size()
#define B begin()
#define E end()
#define ll long long
#define REP(i,a,n) for(ll i=a; i<n; ++i)
#define RED(i,n,a) for(ll i=n; i>=a; --i)
#define m9 1000000007
#define endl "\n"
#define F first
#define SE second
#define ld long double



using namespace std;

ll gcd(ll a, ll b){
    if(a%b==0){
        return b;
    }
    else{
        return gcd(b, a%b);
    }
}
ld area(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3){
    return abs(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))/2;
}
struct cmp{
    bool operator()(const pair<ll,ll> &a, const pair <ll,ll> &b)const{
        ll lena=a.SE-a.F+1, lenb=b.SE-b.F+1;
        if(lena==lenb){
            return a.F<b.F;
        }
        return lena>lenb;
    }
};


int main(){
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  ll n, k;
  cin>>n>>k;
  vector <ll> v(n+1,0);
  REP(i,1,n+1){
      ll x;
      cin>>x;
      v[i]=x;
  }
  ll dp[n+1];
  REP(i,0,n+1){
      dp[i]=1e9;
  }
  dp[1]=0;
  for(ll i=2; i<n+1; ++i){
      if(i<k+1){
          for(ll j=1; j<i; ++j){
              dp[i]=min(dp[i], dp[i-j]+abs(v[i]-v[i-j]));
          }
      }
      else{
          for(ll j=1; j<=k; ++j){
              dp[i]=min(dp[i], dp[i-j]+abs(v[i]-v[i-j]));
          }
      }
  }
  cout<<dp[n];
   
}


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

int main() {
    int n;cin>>n;
    n%=10;
    
    if(n==3)cout<<"bon"<<endl;
    else if(n==0||n==1||n==6||n==8)cout<<"pon"<<endl;
    else cout<<"hon"<<endl;

	return 0;
}

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

using ld = long double;

constexpr ld INF = 1e18;

int main() {
    int W, H, N;
    while(cin >> W >> H >> N, W) {
        vector<ld> x(2*N), y(2*N);
        for(int i=0; i<2*N; ++i) {
            cin >> x[i] >> y[i];
        }
        x.push_back(W); y.push_back(0);
        x.push_back(W); y.push_back(H);

        vector<ld> cand = {0, (ld)H};
        for(int i=0; i<x.size(); ++i) {
            if(x[i] == 0) {
                cand.push_back(y[i]);
            }
            for(int j=i+1; j<x.size(); ++j) {
                ld dx = x[j] - x[i],
                   dy = y[j] - y[i];
                if(dx == 0) {
                    continue;
                }
                ld h = - dy / dx * x[i] + y[i];
                if(h < 0 || h > H) {
                    continue;
                }
                cand.push_back(h);
            }
        }
        sort(cand.begin(), cand.end());
        cand.erase(unique(cand.begin(), cand.end()), cand.end());

        ld res = 0;
        for(int i=0; i+1<cand.size(); ++i) {
            ld h1 = cand[i],
               h2 = cand[i+1];
            ld h = (h1 + h2) / 2;
            vector<ld> ps;
            for(int j=0; j<2*N; ++j) {
                if(x[j] == 0) {
                    if(y[j] <= h) {
                        ps.push_back(-INF);
                    } else {
                        ps.push_back(INF);
                    }
                } else {
                    ld t = h + W / x[j] * (y[j] - h);
                    ps.push_back(t);
                }
            }
            sort(ps.begin(), ps.end());
            ld miny = ps[N-1];
            ld maxy = ps[N];
            if(miny < 0) {
                miny = 0;
            } else if(H < miny) {
                miny = H;
            }
            if(maxy < 0) {
                maxy = 0;
            } else if(H < maxy) {
                maxy = H;
            }
            res += (h2 - h1) * (maxy - miny) / (H*H);
        }
        cout << fixed << setprecision(10) << res << endl;
    }
}


Measured memory_bytes: 3496
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int w = 0 , k = 0 ;
    int score[2][10] = {0} ;
    for ( int i = 0 ; i < 2 ; i++ )
    {
        for ( int j = 0 ; j < 10 ; j++ )
        {
            cin >> score[i][j] ;
        }
        sort( score[i],score[i]+10 ) ;
        reverse( score[i],score[i]+10 ) ;
    }
    w = score[0][0] + score[0][1] + score[0][2] ;
    k = score[1][0] + score[1][1] + score[1][2] ;
    printf("%d %d\n",w ,k ) ;

    return 0 ;
}

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

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

    int n;
    cin >> n;
    ll a[n+1], b[n];
    rep(i,n+1) cin >> a[i];
    ll sum = 0;
    rep(i,n){
        cin >> b[i];
        sum += b[i];
    }
    
    rep(i,n){
        if(b[i] > a[i]){
            b[i] -= a[i];
            a[i] = 0;
        }else{
            a[i] -= b[i];
            b[i] = 0;
        }
        
        if(b[i] > a[i+1]){
            b[i] -= a[i+1];
            a[i+1] = 0;
        }else{
            a[i+1] -= b[i];
            b[i] = 0;
        }
    }
    
    ll now_sum = 0;
    rep(i,n) now_sum += b[i];
    
    cout << sum - now_sum << endl;

    return 0;
}

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

int main() {
    long h, w;
    cin >> h >> w;

    if (h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }

    if ((h * w) % 2 == 0) {
        cout << (h * w) / 2 << endl;
        return 0;
    }
    cout << (h * w) / 2 + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args)  {
		Scanner sc = new Scanner((System.in));
		long n = sc.nextLong() ;
		long m = sc.nextLong();
		sc.close();
		long count = 0;
		if((n==1) || (m==1)) {
			if(n > m) {
				count = n - 2;
			}else if(m > n) {
				count = m -2;
			}else {
				count = 1;
			}
		}else if((n==2) || (m==2)) {
			count = 0;
		}else {
			count = (n-2)*(m-2);
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23124
#include <iostream>

int main(){
   std::string input;
   std::cin >> input ;
   char test;
   if (input[0] != input[1]) {
      std::cout << "Yes" << std::endl;
      return 0;
   }
   if (input[1] != input[2]) {
      std::cout << "Yes" << std::endl;
      return 0;
   }
   if (input[0] != input[2]) {
      std::cout << "Yes3" << std::endl;
      return 0;
   }

   std::cout << "No" << std::endl;
   return 0;
}

Measured memory_bytes: 256
s=input()
x,y=map(int,input().split())
t=s.split("T")
x-=len(t[0])
dx,dy=[],[]

for i,tt in enumerate(t[1:]):
  if i%2==1:
    dx.append(len(tt))
  else:
    dy.append(len(tt))

def is_ok(n,l):
  dp=set([0])
  for d in l:
    t=[]
    for v in dp:
      t.append(v+d)
      t.append(v-d)
    dp=set(t)
  return True if n in dp else False

if is_ok(x,dx) and is_ok(y,dy):
  print("Yes")
else:
  print("No")



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

int main(){
  int R_0,W_0,C,R;
  double a;

  while(1){
    cin >> R_0 >> W_0 >> C >> R;
    if(R_0==0 && W_0==0 && C==0 && R==0){
      break;
    }
    a= (double)(C*W_0-R_0)/(double)R;

    if(a <= 0){
      cout << 0 << endl;
      continue;
    }
    if(a - (int)a > 0){
      cout << (int)a+1 << endl;
    }else{
      cout << (int)a << endl;
    }
  }
  return 0;
}




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

int main(){
  long long N;cin>>N;
  long long res;
  
  for(long long i=1;i*i<=N;i++){
    if(N%i==0){
      res=N/i+i-2;
    }
  }
  
  cout<<res;
}


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

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

    bool ans;
    if (n % 2 == 1) {
        ans = false;
    } else {
        ans = true;
        for (int i = 0; i < n / 2; i++) {
            if (s.at(i) != s.at(i + n / 2)) {
                ans = false;
            }
        }
    }
    if (ans == true) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

int main(){
	int N;
	cin >> N;
	vector<ll> X(N);
	for(int i=0; i<N; i++) cin >> X[i];
	ll L;
	cin >> L;

	vector<vector<ll>> skip(N, vector<ll>(20));
	int j=0;
	for(int i=0; i<N-1; i++){
		while(j<N&&X[j]-X[i]<=L) j++;
		skip[i][0] = j-1;
		debug(any{i, 0, j-1});
	}
	skip[N-1][0] = N;
	for(int n=1; n<20; n++){
		for(int i=0; i<N; i++){
			if(skip[i][n-1]<N) skip[i][n] = skip[skip[i][n-1]][n-1];
			else skip[i][n] = N;
			debug(any{i, n, skip[i][n]});
		}
	}

	int Q;
	cin >> Q;
	for(int q=0; q<Q; q++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		if(a>b) swap(a, b);

		int x=a;
		int k=19;
		int ans = 0;
		while(x<b){
			if(k>0&&skip[x][k]>b) k--;
			else {
				x = skip[x][k];
				ans += 1<<k;
			}
		}
		cout << ans << endl;
	}

	return 0;
}


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

int main() {
    string s, t;
    cin >> s >> t;
    ll ans = s.size();
    rep(i,s.size()-t.size()+1) {
        string tmp = s.substr(i,t.size());
        ll cnt = 0;
        rep(j,t.size()) if (tmp[j] != t[j]) cnt++;
        ans = min(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
using namespace std;
inline int read(){
	int ret=0,p=1;
	char ch=getchar();
	while (ch<'0' || ch>'9'){if (ch=='-') p=-1;ch=getchar();}
	while (ch>='0' && ch<='9') ret=ret*10+ch-'0',ch=getchar();
	return ret*p;
}
int a,b,c;
inline void init(){
	a=read();b=read();c=read();
	if (a<b) a^=b^=a^=b;
	if (a<c) a^=c^=a^=c;
	if (b<c) b^=c^=b^=c;
}
inline void work(){
	int ans=a-b;
	if ((b+c)&1) ans+=(b-c+1)/2+1;
	else ans+=(b-c)/2;
	cout << ans << endl;
}
int main(){
	init();
	work();
	return 0;
}

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

#define ll long long int
#define ull unsigned long long int
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


using namespace std;

const int INF = 1e9 + 7;
const int N = 1e5+5;

int main() {

	IO; 

	string s;
	cin >> s;
	
	int mn = INT_MAX;
	
	
	for (int i = 0; i < (int) s.size(); ++i) {
		string c = s.substr(i, 3);
		mn = min(mn, abs(stoi(c) - 753));
	}
	
	cout << mn << endl;
		
}



Measured memory_bytes: 3616
// inputに入力データ全体が入る
function Main(input) {
  var s, t, result;
  s = input.split('\n')[0];
  t = input.split('\n')[1];
  result = 0;  
  for(var i = 0; i < s.length; i++){
    if(s.charAt(i) === t.charAt(i)) result++;
  }
  console.log(result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import sys
s=[list(map(int,e.split(',')))for e in sys.stdin]
for i in range(1,len(s)):
 k,a=len(s[i]),s[i-1]
 for j in range(k):
  t=j-(k>len(a))
  s[i][j]+=max(a[t*(j>0):t+2])
print(*s[-1])


Measured memory_bytes: 5616
N, x = map(int, input().split())
a = sorted(list(map(int, input().split())))
cnt = 0

for i in range(N):
  if x >= a[i]:
    cnt += 1
    x -= a[i]
  else:
    x = 0
    break

if not x == 0:
  cnt -= 1

print(cnt) 

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;

int main() {
    vector<int> a(3);
    for (int i = 0; i < 3; i++) {
        cin >> a[i];
    }
    int k; cin >> k;
    sort(a.begin(), a.end());
    int sum = a[2] * pow(2, k) + a[1] + a[0];
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	char chLetter;	// 入力された1文字
	char chDiffer;	// 'A' - 'a' のコード差

	chDiffer = 'A' - 'a';

	// 入力：文字列を1文字ずつ読み取る
	while ((chLetter = getc(stdin)) != '\n')
	{
		// 大文字か小文字か判定
		if ('a' <= chLetter && chLetter <= 'z')
		{
			chLetter += chDiffer;
		}
		else if('A' <= chLetter && chLetter <= 'Z')
		{
			chLetter -= chDiffer;
		}

		// 出力：大文字/小文字を反転した結果
		printf("%c", chLetter);
	}
	printf("\n");

	return 0;
}


Measured memory_bytes: 2032