akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

    class Program
    {
        static void Main(string[] args)
        {
        string[]input=System.Console.ReadLine().Split(' ');
        int N_PeopleNum = int.Parse(input[0]);
        int A_Q1 = int.Parse(input[1]);
        int B_Q2 = int.Parse(input[2]);
        System.Console.WriteLine(Math.Min(A_Q1,B_Q2)+" "+Math.Max(A_Q1+B_Q2-N_PeopleNum,0));
    }
    }


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K;
  cin >>N >>K;
  vector<int> A,B;
  for(int i=0; i<N; i++){
    int x;
    cin >>x;
    if(N==1){
      cout <<abs(x) <<endl;
      return 0;
    }
    if(x==0){
      K--, N--, i--;
      continue;
    }
    if(x>0) B.push_back(x);
    else if(x<0){
      x*=(-1);
      A.push_back(x);
    }
  }
  sort(A.begin(), A.end());
  int ans=1e9, x=K-B.size(), y=A.size();
  for(int i=max(0,x); i<=min(K,y); i++){//負のとる個数
    int temp=0;
    if(i==0) temp=B[K-1];
    else if(i==K) temp=A[K-1];
    else temp=min(A[i-1]*2+B[K-i-1],A[i-1]+B[K-i-1]*2);
//    cout<<"i:"<<i<<" K:"<<K<<" temp:"<<temp<<endl;
    ans=min(ans,temp);
  }
  cout <<ans <<endl;
}

Measured memory_bytes: 1020
// Apna Time Aayega...
#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define inf 100000000000000000
int addMod(int x, int y)
{
    x += y;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

int mulMod(int x, int y)
{
    return (x * 1ll * y) % MOD;
}

int binpow(int x, int y)
{
    int z = 1;
    while(y)
    {
        if(y & 1) z = mulMod(z, x);
        x = mulMod(x, x);
        y >>= 1;
    }
    return z;
}

int inv(int x)
{
    return binpow(x, MOD - 2);
}

int divide(int x, int y)
{
    return mulMod(x, inv(y));
}

ll gcd(int a, int b) 
{   if (a == 0) return b; 
    if (b == 0) return a;  
    if (a == b) return a; 
    if (a > b)  return gcd(a-b, b); 
    return gcd(a, b-a); 
} 

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

ll h(ll* A, int N){
    ll pro = 1;
    for(int i=0; i<N; ++i) pro = mulMod(A[i], pro);
    return pro;
}

ll f(ll* A, int N){
    int alpha = A[0];
    for(int i=1; i<N; ++i){
        alpha = gcd(alpha, A[i])%MOD;
    }
    return alpha;
}

void generateNormal(string ans, int N, int charUsed){
    if(N==0) {cout<<ans<<endl; return;}
    for(int i=0; i<charUsed+1; ++i){
        char currentChar = 'a' + i;
        generateNormal(ans+currentChar, N-1, i+1);
    }
    return;
}
int N, X;
int A[100005];
vector <int> adj[100005];
int dfs(int u, int p){
    int sum = A[u];
    for(auto &i:adj[u]){
        if(i!=p){
            sum += dfs(i, u);
        }
    }
    return max(sum, -X);
}

void cl()
{
    for(int i=1;i<=N;i++)
        adj[i].clear();
}

unsigned long long int counting(int a, int b){
    unsigned long long int count = 1;
    while(a>0 || b>0){
        if(a&1 && b&1){
            count = mulMod(2, count);
        }
        a = a>>1;
        b = b>>1;
    }
    return count;
}

vector <int> graph[100005];

void insert(int a, int b){
    graph[a].push_back(b);
    graph[b].push_back(a);
    return;
}

int countArray[100000] = {0};
void customizedBFS(int start){
    deque<pair<int , int>> alpha;
    alpha.push_back(make_pair(start, 0));
    int visited[100000] = {0};
    while(alpha.size()){
        pair<int, int> beta = alpha.front();
        alpha.pop_front();
        if(visited[beta.first]!=1)
            visited[beta.first]=1;
        else
            continue;
        if(beta.first>start) countArray[beta.second]++;
        for(auto &i:graph[beta.first]){
            // if(i>beta.first)
            alpha.push_back(make_pair(i, beta.second+1));
        }
    }
    return;
}

void solve(int N, int X, int Y){
    for(int i=1; i<N; ++i) insert(i, i+1);
    insert(X, Y);
    for(int i=1; i<N; ++i){
        customizedBFS(i);
    }
    for(int i=1; i<N; ++i){
        cout<<countArray[i]<<endl;
    }
}

int main(){
    FIO
    int N, X, Y;
    cin>>N>>X>>Y;
    solve(N, X, Y);
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define int long long
using namespace std;

 signed main() {
  int N,k;
  cin>>N;
  std::vector<int> v(N+1,0);
  for(int i=2;i<N+1;i++){
    k=i;
    for(int j=2;k>1;j++){
      if(k%j==0){
        v[j]++;
        k/=j;
        j=1;
      }
    }
  }
  int ans=1;
  for(int i=1;i<N+1;i++){
    ans*=(v[i]+1);
    ans%=1000000007;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

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

    int N, M;
    cin >> N >> M;

    int range_l=0, range_r=(int)10e5+1;
    REP(i,M){
        int l, r;
        cin >> l >> r;
        if (range_l < l) range_l = l;
        if (range_r > r) range_r = r;
    }

    int ans;
    if (range_r - range_l + 1 < 0) ans = 0;
    else ans = range_r - range_l + 1;

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


Measured memory_bytes: 256
#include<stdio.h>
//using namespace std;
int main()
{
  long w,h,x,y;
  scanf ("%ld%ld%ld%ld", &w, &h, &x, &y);
  if (2*x==w && 2*y==h)
  {
    printf("%.9lf 1", ((double)w/2)*h);
  }
  else 
    {
      printf("%.9lf 0", ((double)w/2)*h);
    }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
 
int main()
{
    int n, x, i, j, k, ans;
    while(1) {
        scanf("%d%d", &n, &x);
        ans=0;
        if(n==0 && x==0) break;
        for(i=1; i<n-1; i++) {
            for(j=i+1; j<n; j++) {
                k=x-i-j;
                if(j<k && k<=n) ans++;
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<limits.h>
#include<utility>
#include<cstdlib>
#include<bitset>
#define LP(i,n) for(int i=0;i<n;i++)
#define LPIN(n,a) for(int i=0;i<n;i++)cin >> a[i]
using namespace std;

int main(){
int ans = 0;
int n,d;
cin >> n >> d;
int a[11][11];
for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
cin >> a[i][j];
    }
}
double temp =0;
for(int i=0;i<n;i++){
    for(int j=0;j<i;j++){
        temp =0;
        for(int k=0;k<d;k++){
        temp += abs(a[i][k] - a[j][k]) * abs(a[i][k] - a[j][k]);
        }
        temp = sqrt(temp);
        if(ceil(temp) == floor(temp))ans++;
    }
}
cout << ans;
}

Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let N = Number(xs[0].split(' ')[0]);
   let M = Number(xs[0].split(' ')[1]);
   let A = xs[1].trim().split(' ').map(v=>parseInt(v,10));
   let ans = 0;
  
   for(let i=0; i<M; i++){
     ans += A[i] 
   }
   if(N<ans){
     console.log(-1); 
   }else{
     console.log(N-ans);
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 30644
package main

import (
	"fmt"
)

func main() {
	var a,b int
	fmt.Scan(&a,&b)

	if a % 3 == 0 || b % 3 == 0 || (a+b)%3 == 0 {
		fmt.Println("Possible")
	} else {
		fmt.Println("Impossible")
	}
}


Measured memory_bytes: 512
import java.io.*;
import java.util.StringTokenizer;
public class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int A = Integer.parseInt(st.nextToken());
		int B = Integer.parseInt(st.nextToken());
		int C = Integer.parseInt(st.nextToken());
		int K = Integer.parseInt(st.nextToken());
		if (A >= K) {
			System.out.println(K);
		} else {
			K -= A;
			if (B >= K) {
				System.out.println(A);
			} else {
				K -= B;
				if (C >= K) {
					System.out.println(A - K);
				} else {
					System.out.println(A - C);
				}				
			}		
		}
	}
}

Measured memory_bytes: 32548
//ABC 174 --> Put in review package later
/*Author: Aayush Khazanchi                                   Date: 02/08/20
 * 
 * 
 * */
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {  //Ball out dawg
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N = I.nextInt();
		long D = I.nextLong();
		int ans = 0;
		for (int i = 0; i < N; i++) {
			long x = I.nextLong();
			long y = I.nextLong();
			if (x*x+y*y<=D*D) ans++;
		}
		O.pln(ans);
	}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static long abs(long x, long y) {return Math.abs(x-y);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(max(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 45912
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main() {

    string S, T;
    cin >> S >> T;

    cout << T + S << endl;

    return 0;

}

Measured memory_bytes: 256
#include<iostream>

int main() {
	int d;
	std::cin >> d;

	if (d == 25) {
		std::cout <<"Christmas"<< std::endl;
	}
	if (d == 24) {
		std::cout << "Christmas Eve" << std::endl;
	}
	if (d == 23) {
		std::cout << "Christmas Eve Eve" << std::endl;
	}
	if (d == 22) {
		std::cout << "Christmas Eve Eve Eve" << std::endl;
	}


	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cincout ios::sync_with_stdio(false)
#define mp make_pair
#define fi first
#define se second
#define pb push_back

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef map<int, int> mii;

int n;
int c[55];
int v[55];
ll cnt = 0;

int main(){
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> v[i];
	}
	for(int i=1;i<=n;i++){
		cin >> c[i];
		if(v[i]-c[i]>0) cnt+=(v[i]-c[i]);
	}
	cout << cnt <<endl;
}

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

int main(){
    long long N, M, K, k;
    cin >> N >> M >> K;
    vector<long long> A(N+1,0), B(M+1,0);
    long long buf, ans = 0, time = 0;
    for(int i = 1; i <= N; ++i){
        cin >> buf;
        A[i] = A[i-1] + buf;
    }
    for(int i = 1; i <= M; ++i){
        cin >> buf;
        B[i] = B[i-1] + buf;
    }
    long long buf2 = M;
    for(int i = 0; i <= N; ++i){
        if(A[i] > K)continue;
        time = A[i];
        for(int j = buf2; j >= 0; --j){
            if(j==0){
                buf2 = 0;
                break;
            }
            else if(time + B[j] > K)--buf2;
            else break;
        }
        ans = max(ans, i + buf2);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

long long a,b,n;

void process()
{
    long long l=1,r=b-1,kq=0,mid;
    while (l<=r)
    {
        mid=(l+r)/2;
        if (mid<=n)
        {
            l=mid+1;
            kq=mid;
        }
        else r=mid-1;
    }
    cout<<(a*kq)/b-a*(kq/b);
}

int main()
{
    cin>>a>>b>>n;
    process();
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(void) {
    int n; cin >> n;
    string s[n];
    rep(i, n) cin >> s[i];
    map<string,int> mp;
    rep(i, n) {
        mp[s[i]]++;
    }
    int max = 0;
    rep(i, n) {
        if(max < mp[s[i]])
            max = mp[s[i]];
    }
    vector<string> ans;
    for(auto i = mp.begin(); i!=mp.end(); i++) {
        if(i->second == max) ans.push_back(i->first);
    }
    sort(ans.begin(), ans.end());
    rep(i, ans.size()) {
        cout << ans[i] << endl;
    }
}



Measured memory_bytes: 28404
import itertools

def main():
    N = int(input())
    n_x_y = {}
    for n in range(N):
        A = int(input())
        x_y = {}
        for _ in range(A):
            x, y = map(int, input().split())
            x_y[x-1] = y
        n_x_y[n] = x_y

    ans = 0
    for flags in itertools.product([1, 0], repeat=N):
        sat = True
        for n, flag in enumerate(flags):
            if flag == 0:
                continue
            for x, y in n_x_y[n].items():
                if (y == 1 and flags[x] == 0) or (y == 0 and flags[x] == 1):
                    sat = False
                    break
            if sat is False:
                break
        if sat is True and sum(flags) > ans:
            ans = sum(flags)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 74068
# -*- coding: utf-8 -*-
n,a,b = map(int,input().split()) 

if (b - a) % 2 == 0:
    ans = int((b - a) // 2)
else:
    #ans = min((n-b) + (n-1-(a+n-b)) // 2, (a-1) + (b-a-1) // 2)
    ans = min(n-b, a-1) + 1 + (b - a - 1) // 2

print(ans)


Measured memory_bytes: 2940
#include <stdio.h>
#include <inttypes.h>

#define S_INTERNAL(X) # X
#define S(X) S_INTERNAL(X)

#define MAX 200000

int N, M;
char S[MAX + 1];
char T[MAX + 1];

int calc_gcd(int a, int b) {
	while (b > 0) {
		int r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main(void) {
	int gcd;
	int64_t lcm;
	int64_t i, delta;

	if (scanf("%d%d", &N, &M) != 2) return 1;
	if (scanf("%" S(MAX) "s", S) != 1) return 1;
	if (scanf("%" S(MAX) "s", T) != 1) return 1;
/*
	if (S[0] != T[0]) {
		puts("-1");
		return 0;
	}
*/
	gcd = calc_gcd(N, M);
	lcm = N / gcd * (int64_t)M;

	delta = lcm / gcd;
	for (i = 0; i < lcm; i += delta) {
		if (S[i / (lcm / N)] != T[i / (lcm / M)]) {
			puts("-1");
			return 0;
		}
	}

	printf("%"PRId64"\n", lcm);
	return 0;
}

/*
#...#...#...
#.#.#.

N=15, M=9
gcd=3
lcm=45
#..#..#..#..#..#..#..#..#..#..#..#..#..#..#..
#....#....#....#....#....#....#....#....#....

#.....#.....#.....#.....#.....#.....#.....#.....#.....#.....#.....#.....#.....#.....#.....
#.........#.........#.........#.........#.........#.........#.........#.........#.........

*/


Measured memory_bytes: 384
nums = []

while True:
    num = [int(e) for e in input().split()]
    if num[0]==0 and num[1]==0:
        break
    nums.append(num)

for i in range(len(nums)):
    for j in range(len(nums[i])):
        for k in range(j):
            if nums[i][k] > nums[i][j]:
                a = nums[i][k]
                nums[i][k] = nums[i][j]
                nums[i][j] = a

for i in range(len(nums)):
    print(" ".join(map(str, nums[i])))


Measured memory_bytes: 6036
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
#define PI 3.141592653589793
#define MOD 1000000007
//#define MOD 998244353
#define ALL(obj) (obj).begin(),(obj).end()
const ll INF = 1LL << 60;
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;

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

int main() { 
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max(max(a*d,a*c),max(b*d,b*c)) << endl;
    return 0;
}



Measured memory_bytes: 3636
A,B,C,X,Y = map(int,input().split())

plan1 = (A*X) + (B*Y)
plan2 = (C*2) * max(X,Y)
plan3 = (C*2) * X + B*(Y-X)
plan4 = (C*2) * Y + A*(X-Y)

if X <= Y:
  print(min(plan1,plan2,plan3))
else:
  print(min(plan1,plan2,plan4))


Measured memory_bytes: 3060
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int main()
{
	int h, w, i, j;
	while (true)
	{
		cin >> h >> w;
		if (h == 0 && w == 0) break;
		for (i = 0; i < h; i++ )
		{
			for (j = 0; j < w; j++)
			{
				if (i % 2 == j % 2) cout << '#';
				else cout << '.';
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
import sys
input = sys.stdin.readline
from collections import *

MAX = 3*10**5+100
MOD = 998244353
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
    
for i in range(2, MAX):
    fact[i] = fact[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD

def C(n, r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fact[n]*(finv[r]*finv[n-r]%MOD)%MOD

N, A, B, K = map(int, input().split())
ans = 0

for i in range(N+1):
    if (K-i*A)%B!=0:
        continue
    
    j = (K-i*A)//B
    ans += C(N, i)*C(N, j)
    ans %= MOD

print(ans)

Measured memory_bytes: 48376
import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    -- スペース区切り整数の入力
    [n, m] <- map strToInteger . words <$> getLine
    -- 出力
    putStrLn . show $ solve n m

solve :: Integer -> Integer -> Integer
solve n m = if n * 2 > m
    then m `div` 2
    else n + ((m - 2 * n) `div` 4)


Measured memory_bytes: 508
N=int(input())
A=list(map(int, input().split()))

a_max = max(A)
B=[0]*(a_max + 1)

for ai in A:
    for multi in range(ai, a_max+1, ai):
        B[multi] += 1

ans = 0
for ai in A:
    if B[ai] == 1:
        ans += 1

print(ans)










Measured memory_bytes: 32260
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, result;
  
  cin >> A >> B;
  
  for(int i = 0; i < 2; i++){
    if(A >= B){
      result = result + A;
      A = A - 1;
    }
    else{
      result = result + B;
      B = B -1;
    }
  }
 
  cout << result << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MAX 1000000007
int main(){
    int N;
    cin>>N;
    int a[N];
    int flag=-1;
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    if(N%2==1){
        int x[N/2+1]={};
        for(int i=0;i<N;i++){
            if(a[i]!=0){
                if(a[i]%2!=0 or x[a[i]/2]+1>2){
                    cout<<"0"<<endl;
                    flag++;
                    break;
                }
                x[a[i]/2]++;
            }else{
                x[0]++;
                if(x[0]>1){
                    cout<<"0"<<endl;
                    flag++;
                    break;
                }
            }
        }
        if(flag<0){
            int ans=1;
            for(int s=0;s<N/2;s++){
                ans=(2*ans)%MAX;
            }
            cout<<ans;
        }
    }else{
        int x[N/2]={};
        for(int i=0;i<N;i++){
                if(a[i]%2==0 or x[a[i]/2]+1>2){
                    cout<<"0"<<endl;
                    flag++;
                    break;
                }
                x[a[i]/2]++;
        }
        if(flag<0){
            int ans=1;
            for(int s=0;s<N/2;s++){
                ans=(2*ans)%MAX;
            }
            cout<<ans;
        }
    }
    return 0;
}


Measured memory_bytes: 768
input = gets.split(" ")

a = input[0].to_i # 高橋くんのHP
b = input[1].to_i # 高橋くんのattack
c = input[2].to_i # 青木くんH
d = input[3].to_i # 青木くんA

while a > 0 do
    c = c - b
    if c <= 0
        puts "Yes"
        break
    end
    a = a - d
    
    if a <= 0 then
        puts "No"
        break
    end
end

Measured memory_bytes: 14312
#include<cstdio>
#include<iostream>
using namespace std;
const int N=7;
int main()
{
	int a,b,c;
	while(cin>>a>>b>>c)
	{
		if(a>b) swap(a,b);
		if(a>c) swap(a,c);
		if(b>c) swap(b,c);
		cout<<a+b<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

namespace AtCoder.abc092 {

    export class Program {

        constructor(private readonly args: string) {
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const [a, b, c, d]: number[] = this.args.split('\n').map(Number);

            console.log(Math.min(a, b) + Math.min(c, d));
        }
    }
}

const args = fs.readFileSync('/dev/stdin', 'utf8').trim();
const prg = new AtCoder.abc092.Program(args);
prg.main();


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

int main(void){
  int A, B, C;
  cin >> A >> B >> C;
  bool ans = false;
  if(A <= C && C <= B)
    ans = true;
  if(ans) cout << "Yes" << "\n";
  else cout << "No" << "\n";
  return 0;
}


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

int ans;

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i, n) cin >> p.at(i);
  
  for(int i = 1; i < n-1; i++){
    if(p.at(i) > p.at(i-1) && p.at(i) < p.at(i+1)) ans++;
    else if(p.at(i) < p.at(i-1) && p.at(i) > p.at(i+1)) ans++;
  }
    
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <queue>
#define LL long long
#define inf 0x3f3f3f3f
#define lson rt<<1
#define rson rt<<1|1
#define PII pair<int,int>
#define test freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
using namespace std;
const int maxn=3e5+5;
int a[maxn],pre[maxn];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    map<int,int>cnt;
    for(int i=1;i<=n;++i) scanf("%d",a+i);
    for(int i=1;i<=n;++i) 
    {
        pre[i]=(pre[i-1]+a[i]-1)%k;
        //cout<<pre[i]<<' ';
    }
    LL ans=0;
    for(int i=0;i<k&&i<=n;++i)
    {
        ans+=cnt[pre[i]];
        cnt[pre[i]]++;
    }
    for(int i=k;i<=n;++i)
    {
        cnt[pre[i-k]]--;
        ans+=cnt[pre[i]];
        cnt[pre[i]]++;
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  char p[4000];
  string S;
  cin>>S;
  long long ans=0;
  long long  rn=0;
  long long  gn=0;
  long long  bn=0;
  for(int i=0;i<N;i++){
    p[i]=S.at(i);
    if(S.at(i)=='R') rn++;
    if(S.at(i)=='G') gn++;
    if(S.at(i)=='B') bn++;
  }
  ans=rn*gn*bn;
  long long  minus=0;
  for(int i=0;i<N;i++){
    for(int j=1;j<=((N-i-1)/2);j++){
      //N-iだとエラー　
      if (p[i]!=p[i+j] && p[i+j]!=p[i+j+j] && p[i+j+j]!=p[i]){
        //cout<<i<<" "<<j<<endl;
        minus++;
      }
    }
  }
  //cout<<rn<<" "<<gn<<" "<<ans<<" "<<minus<<endl;
  cout<<ans-minus<<endl;
  return 0;
}

 

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

int main() {

	//ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

	int n, a, b, ap, bp, i;

	while(cin >> n, n) {

		ap = 0; bp = 0;
		for(i = 0; i < n; i++) {
		cin >> a >> b;
			if(a < b) {
				bp += a;
				bp += b;
			} else if(b < a) {
				ap += a;
				ap += b;
			} else {
				ap += a;
				bp += b;
			}
		}

		cout << ap << " " << bp << endl;

	}

	return 0;

}

Measured memory_bytes: 1160
import java.util.*;

public class Main {
    private static final Scanner scn = new Scanner(System.in);
    
    public static void main(String[] args) {
        int n, m, p;
        while((n = scn.nextInt()) > 0) {
            m = scn.nextInt();
            p = scn.nextInt();
            System.out.println(gamble(n, m, p));
        }
    }
    
    private static int gamble(int n, int m, int p) {
        int num = 0, sum = 0;
        for(int i = 1; i <= n; i++) {
            int tmp = scn.nextInt();
            if(i == m) {
                num = tmp;
            }
            sum += tmp;
        }
        return num > 0 ? (100 - p) * sum / num : 0;
    }
}

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

typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    if (n == 1) {
        cout << 1 << "\n";
        return 0;
    }
    vector<int>v(n);
    for (int i = 0; i< n; i++){
        cin >> v.at(i);
    }
    vector<int>dp;
    dp.push_back(v.at(0));
    int ans = 1;
    for (int i = 1; i < n; i++){
        if (dp.at(i-1) > v.at(i)){
            ans++;
        }
        dp.push_back(min(dp.at(i-1),v.at(i)));
    }
    cout << ans << "\n";
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int sum = 0;
    int n;
    cin >> n;
    vector<int> b(n - 1);
    for(int i = 0; i < n - 1; i++)
    {
        cin >> b[i];
    }
    for(int i = 0; i < n - 2; i++)
    {
        sum += min(b[i], b[i + 1]);
    }
    cout << sum + b[0] + b[n - 2];

    return 0;
}


Measured memory_bytes: 256
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

n,m = map(int,input().split())
a = list(map(int,input().split()))
b = [i // 2 for i in a]

def f(n):
    res = 0
    while n % 2 == 0:
        res += 1
        n //= 2
    return res

if not all(f(b[0]) == f(b[i]) for i in range(n)):
    print(0)
    exit(0)

cnt = f(b[0])
g = b[0] >> cnt
for i in b:
    g = lcm(g, i >> cnt)

gg = g << cnt
print((m + gg) // (2 * gg))


Measured memory_bytes: 89580
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define MOD2 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
typedef pair<int, int> pr;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);
vector<pr> v;
int dp[2001][2001];

int rec(int l,int r){
    if(l>r) return 0;
    int & ans =dp[l][r];
    int num=l+(v.size()-r-1);
    if(ans!=-1)return ans;
    ans=0;
    ans=max(ans,rec(l+1,r)+v[num].F*abs(l-v[num].S));
    ans=max(ans,rec(l,r-1)+v[num].F*abs(r-v[num].S));
    return ans;
}

void solve() {
   int n;cin>>n;
   for(int i=0;i<n;i++){
       int x;cin>>x;
       v.EB(x,i);
   }
   sort(ALL(v),greater<pr>());
   memset(dp,-1, sizeof(dp));
   cout<<rec(0,n-1);


}
int32_t main() {
    IOS;
    int test = 1;
//    cin >> test;
    for(int i=1;i<=test;i++){
//        cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 35120
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
using namespace std;

int main(){
  int n,i,j;
  while(cin >> n) {
    if(n==1){
      cout << 0 <<endl;
      continue;
    }
    int k = 0, a[n];
    a[0] = 2;
  
    for (i = 3; i <= n; i = i + 2) {
      for (j = 0; j <= k; j++) {
        if(i % a[j] == 0 ) break;
        if(i <= a[j] * a[j]) {
          k++;
          a[k] =i;
          break;
        }
        
      }
      if(j == k + 1) {
        k++;
        a[k] = i;
      }
    }
    cout << k+1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1688
import math

a, b, h, m = map(float, input().split())
deg = abs(30.0 * h - m * 5.5)

if deg > 180.0 :
    deg = 360.0 - deg

ans = a * a + b * b - 2.0 * a * b * math.cos(deg * 4.0 * math.atan(1.0) / 180.0)
print(math.sqrt(ans))

Measured memory_bytes: 9388
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
ll const mod = 998244353;
const ll MAX = 300000;
using vi = vector<int>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }


//////////////////////////////////////


int main() {
    int h,n;
    cin>>h>>n;
    vi a(n),b(n);
    rep(i,n){
        cin>>a[i]>>b[i];
    }
    vvi dp(n+1,vi(h+1,INF));
    dp[0][0]=0;
    rep(i,n){
        rep(j,h+1){
            chmin(dp[i+1][j],dp[i][j]);
            chmin(dp[i+1][min(h,(int)j+a[i])],dp[i+1][j]+b[i]);
        }
    }
    cout<<dp[n][h]<<endl;
    return 0;
}

Measured memory_bytes: 39424
from math import ceil
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))

A.sort()

if N % 2 == 1:
    num = (N - 1) // 2
    if A[0] != 0:
        print(0)
        exit()
    for i in range(1, N):
        if A[i] == ceil(i / 2) * 2:
            continue
        else:
            print(0)
            exit()
else:
    num = N // 2
    for i in range(N - 1):
        if A[i] == (i // 2) * 2 + 1:
            continue
        else:
            print(0)
            exit()

print((2**num) % (10**9 + 7))


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

using namespace std;

template <int p>
struct Modint
{
	int value;

	Modint() : value(0) {}
	Modint(long x) : value(x >= 0 ? x % p : (p + x % p) % p) {}

	inline Modint &operator+=(const Modint &b)
	{
		if ((this->value += b.value) >= p) this->value -= p;
		return (*this);
	}
	inline Modint &operator-=(const Modint &b)
	{
		if ((this->value += p - b.value) >= p) this->value -= p;
		return (*this);
	}
	inline Modint &operator*=(const Modint &b)
	{
		this->value = (int)((1LL * this->value * b.value) % p);
		return (*this);
	}
	inline Modint &operator/=(const Modint &b)
	{
		(*this) *= b.inverse();
		return (*this);
	}

	Modint operator+(const Modint &b) const { return Modint(*this) += b; }
	Modint operator-(const Modint &b) const { return Modint(*this) -= b; }
	Modint operator*(const Modint &b) const { return Modint(*this) *= b; }
	Modint operator/(const Modint &b) const { return Modint(*this) /= b; }

	inline Modint &operator++(int) { return (*this) += 1; }
	inline Modint &operator--(int) { return (*this) -= 1; }

	inline bool operator==(const Modint &b) const { return this->value == b.value; }
	inline bool operator!=(const Modint &b) const { return this->value != b.value; }
	inline bool operator<(const Modint &b) const { return this->value < b.value; }
	inline bool operator<=(const Modint &b) const { return this->value <= b.value; }
	inline bool operator>(const Modint &b) const { return this->value > b.value; }
	inline bool operator>=(const Modint &b) const { return this->value >= b.value; }

	//requires that "this->value and p are co-prime"
	// a_i * v + a_(i+1) * p = r_i
	// r_i = r_(i+1) * q_(i+1) * r_(i+2)
	// q == 1 (i > 1)
	// reference: https://atcoder.jp/contests/agc026/submissions/2845729 (line:93)
	inline Modint inverse() const
	{
		assert(this->value != 0);
		int r0 = p, r1 = this->value, a0 = 0, a1 = 1;
		while (r1)
		{
			int q = r0 / r1;
			r0 -= q * r1;
			swap(r0, r1);
			a0 -= q * a1;
			swap(a0, a1);
		}
		return Modint(a0);
	}

	friend istream &operator>>(istream &is, Modint<p> &a)
	{
		long t;
		is >> t;
		a = Modint<p>(t);
		return is;
	}
	friend ostream &operator<<(ostream &os, const Modint<p> &a)
	{
		return os << a.value;
	}
};

const int mod = 1e9+7;

using Int = Modint<mod>;

void solve()
{
    int n, k;
    cin >> n >> k;
    int m = 0;
    for (int i = 1; i * i <= n; i++)
    {
        m += 2;
        if (i * (i+1) > n) m--;
    }
    vector<Int> dp(m+2, 1), ws(m+2);
    for (int i = 1; i <= (m+1)/2; i++)
    {
        ws[m-i+1] = n/i - n/(i+1);
        ws[i] = 1;
    }

    for(int i = 1; i <= m; i++)
    {
        dp[i] = ws[i];
    }
    while(--k)
    {
        vector<Int> nx(m+2);
        int idx = m+1;
        for (int i = 1; i <= m; i++)
        {
            nx[0] += dp[i];
            nx[idx--] -= dp[i];
        }
        for (int i = 0; i < m+1; i++)
        {
            nx[i+1] += nx[i];
            nx[i] *= ws[i];
        }
        swap(dp, nx);
    }
    cout << accumulate(dp.begin()+1, dp.end()-1, Int(0)) << endl;
}

int main()
{
    solve();
    cerr << "\"努力不足ですね！\"" << endl;
    return 0;
}

Measured memory_bytes: 1040
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

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 long long INF = 1000000000000000;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll h, w, n, m; string s;
char maze[60][60];
int dis[60][60];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main() {
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int res = 1;
	int k = h[0];
	for (int i = 1; i < n; i++) {
		chmax(k, h[i-1]);
		if (h[i] >= k) {
			res++;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[6],b[6];
int main(){
	int ma=0;
	for(int i=1;i<=5;i++){
		cin>>a[i];
		if(a[i]%10==0)b[i]=0;
		else b[i]=10-a[i]%10;
		ma=max(ma,b[i]);
	}
	int ans=0;
	int k=0x3f3f3f3f;
	for(int i=1;i<=5;i++){
		if(ma==b[i]){
			if(k==0x3f3f3f3f){
				k=a[i];
				a[i]=a[i+1];
				continue;
			}
			
		}
		if(k!=0x3f3f3f3f){
			a[i]=a[i+1];
		}
	}
	for(int i=1;i<=4;i++){
		if(a[i]%10==0)ans+=a[i];
		else ans=ans+a[i]+10-a[i]%10;
	
	}
	cout<<ans+k;	
	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);
		
		int r = sc.nextInt();
		int c = sc.nextInt();
		int[][] a = new int[r+1][c+1];
		for(int i=0; i<r; i++) {
			for(int j=0; j<c; j++) {
				a[i][j] = sc.nextInt();
			}
		}
		for(int i=0; i<r; i++) {
			for(int j=0; j<c; j++) {
				a[i][c] += a[i][j];
			}
		}
		for(int j=0; j<=c; j++) {
			for(int i=0; i<r; i++) {
				a[r][j] += a[i][j];
			}
		}

		for(int i=0; i<= r; i++) {
			for(int j=0; j<=c; j++) {
				if(j==0)	System.out.printf("%d", a[i][j]);
				else		System.out.printf(" %d",a[i][j]);
			}
			System.out.printf("\n");
		}
	}
}


Measured memory_bytes: 62540
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <queue>

using namespace std;

#define pb push_back
#define pbk pop_back
#define fs first
#define sc second
#define sz(s) ((int) (s).size())
#define all(x) (x).begin(), (x).end()
#define mt make_tuple
#define mp make_pair
#define next hunext
#define prev huprev

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;

const int inf = 1e9;
const double pi = 4 * atan(1.0);
const double eps = 1e-9;
const int N = int(1e5) + 100;

ll a[N];
vi ord;

int main() {
#ifdef LOCAL42
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    ll l;
    cin >> n >> l;
    for (int i = 0; i < n; ++i) {
        scanf("%lld", a + i);
    }
    for (int i = 0; i + 1 < n; ++i) {
        if (a[i] + a[i + 1] >= l) {
            puts("Possible");
            ord.pb(i);
            for (int j = i - 1; j >= 0; --j) {
                ord.pb(j);
            }
            for (int j = i + 1; j + 1 < n; ++j) {
                ord.pb(j);
            }
            reverse(all(ord));
            for (int x : ord) {
                printf("%d\n", x + 1);
            }
            return 0;
        }
    }
    puts("Impossible");
    return 0;
}


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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n-1); 0=<i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);

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

    VL A_i(N-1); //2-N

    REP(i,N-1)
    {
        cin >> A_i.at(i);
    }

    ll count = 0;
    ll match = 1;
    ll nokori = N;

    V_SORT_U(A_i);

    REP(i,N-1)
    {
        if(A_i.at(i) == match)
        {
            count ++;
            if(i == N-2)
            {
                cout << count << endl;
                nokori --;
                break;
            }

        }
        else
        {
            cout << count << endl;
            match = A_i.at(i);
            if(match > (A_i.at(i-1)+1) )
            {
                //2以上大きかったら間を埋める
                REP(j, (match-A_i.at(i-1)-1) )
                {
                    cout << 0 << endl;
                    nokori --;
                }
            }

            nokori --;
            count = 1;
            if(i == N-2)
            {
                cout << count << endl;
                nokori --;
                break;
            }
        }
    }

    REP(i,nokori)
    {
         cout << 0 << endl;
    }

    return 0;
}

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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = new char[]{'a', 'e', 'i', 'o', 'u'};
            var c = Convert.ToChar(Console.ReadLine());

            if(l.Contains(c)){
                Console.WriteLine("vowel");
            }else{
                Console.WriteLine("consonant");
            }
        }
    }
}


Measured memory_bytes: 11220
// https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_b
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long A, B, V, W, T;
  string ans;
  cin >> A >> V >> B >> W >> T;

  if (V == W) {
    ans = "NO";
  } else {
    if (abs(A - B) > T * (V - W))
      ans = "NO";
    else
      ans = "YES";
  }

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


Measured memory_bytes: 3624
#include<stdio.h>

int main(void)
{
  int moun[10] = {0};
  int i, j ,k;

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

  for(i=0;i<10;i++){
    j=9;
    while(i<j){
      if(moun[i]<moun[j]){
	k = moun[j];
	moun[j] = moun[i];
	moun[i] = k;
      }
      j--;
    }
  }

  for(i=0; i<3; i++){
  printf("%d\n", moun[i]);
  }

  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> Pi;
typedef queue<Pi> QPi;
typedef pair<ll, ll> Pll;
typedef queue<Pll> QPll;
typedef vector<vi> Graph;
const int mod = 1000000007;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int n,m,a,sum=0;
  cin >> n >> m;
  REP(i,m) {
    cin >> a;
    sum+=a;
  }
  if(sum>n) {
    cout << "-1" << endl;
  } else {
    cout << n-sum << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll=int;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

  1 2 3 4 5 //(now, start)
1 . # # # . (1, 1) (5, 5)
2 # . . . . (1, 1) (5, 5)
3 . # # . . (3, 1) (5, 5)
4 . # # # . (4, 1) (5, 5)

  1 2 3 4 5 //(now, start)
1 . # # . . (1,1) (4,4) (5,5)
2 # # # . . (4,4) (5,5)
3 . . . . # (4,4)
4 # # # # . (4,5)


*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll H, W;
  cin >> H >> W;
  
  set<pair<ll, ll>> pos;
  multiset<ll> score;
  rep(i, H){
//    cout<<"i:"<<i<<endl;
    ll A, B;
    cin >> A >> B;
    //初期入れ
    if (i == 0){
      for(ll j=1; j<=W; j++){
        if (j >= A && j <= B)
          continue;
        pos.insert({j,j});
        score.insert(0);
      }
    }
    else {
      if (score.empty()){
        cout << -1 << endl;
        continue;
      }
      auto itr1 = pos.lower_bound({A, 0});
      auto itr2 = pos.lower_bound({B, 200010});
      if (B == W || (itr2 != pos.end() && (*itr2).first == B+1)){
        while (itr1 != itr2){
          score.erase(score.find((*itr1).first - (*itr1).second));
          pos.erase(itr1++);
        }
      }
      else{
        //B+1が存在するなら全部消す。
        //しないなら、B+1に最も近い1個だけ残して消す。
        while (itr1 != itr2){
          auto judge = itr2;
          judge--;
          if (itr1 == judge){
            ll v1 = (*itr1).first;
            ll v2 = (*itr1).second;
            score.erase(score.find(v1 - v2));
            score.insert(B+1 - v2);
            pos.erase(itr1++);
            pos.insert({B+1, v2});
          }
          else{
            score.erase(score.find((*itr1).first - (*itr1).second));
            pos.erase(itr1++);
          }
        }
      }
    }
    if (score.empty())
      cout << -1 << endl;
    else
      cout << *score.begin() + i + 1 << endl;
  }
}


Measured memory_bytes: 22244
//-------All power is within you,you can do Anything and Everything.---------//
 
    #include <bits/stdc++.h>
    // #pragma GCC optimize("Ofast")
    using namespace std;
    //library
  
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ M $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    #define F first
    #define S second
    #define pb push_back
    #define mkp make_pair
    #define int long long
    #define ld long double
    //scankar
    #define sz(x) (int)(x).size()
    #define all(x) x.begin(),x.end() 
    #define rall(x) x.rbegin(),x.rend()
    #define fo(i,a,b) for(int i=a;i<b;i++)
    #define rfo(i,b,a) for(int i=b;i>=a;i--)
    #define mem( a, val ) memset(a, val, sizeof( a ) )
    #define deci( x ) cout<<fixed<<setprecision( x );
    #define bitcount( x ) __builtin_popcountll( x )
    #define endl "\n" 
    
    #define XOX 
    
    typedef vector<int> vi;
    typedef pair<int,int> pi; 
    typedef map<int,int> mii;
    typedef map<int,bool> mib;
    typedef map<char,int> mci;
    typedef map<string,int> msi;
    
    const int INF = 1e18L + 5;
    const int MAX = 2e6 + 7;
    const int MOD =  1000000007;
    const long double PI  =3.141592653589793238463;
    //direction
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ D $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
    
    #define deb(x) cout<<#x<<" "<<x<<endl;
    //debugger

//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ V $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//  
    
    int i,j,k,t,n,q,l,r,mid;

//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ F $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//

    void solve()
    {
        string s="";
        cin>>s;
        n=s.size();
        if(s[n-1]=='s')
            s+='e';

        s+='s';
        cout<<s<<endl;

    }
    
//*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$*//
//                          THE GAME STARTS HERE                             //
 
    int32_t main() 
    {
    
        // int start,stop=clock();
        // cout<<"time:"<<(stop-start)/double(CLOCKS_PER_SEC)*1000<<endl;
        ios_base::sync_with_stdio(0);
        cin.tie(NULL);
        cout.tie(NULL);
        
        // sc(t);while(t--)
        // cin>>t;while(t--)
            solve();
    
        return 0;
    }

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

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, k, x, sum, ctr;
    multiset<int> price;
    multiset<int> :: iterator itr;

    cin >> n >> k;

    for(int i = 0 ; i < n ; i++){
        cin >> x;
        price.insert(x);
    }

    sum = 0; ctr = 0;
    for(itr = price.begin() ; ctr < k ; itr++){
        // cout << *itr << " ";
        sum += *itr;
        ctr++;
    }

    cout << sum;

	return 0;
}

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

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  vector<int> a(5);
  for (int i = 0; i < 5; i++)
    cin >> a[i];
  int res = numeric_limits<int>::max();
  sort(begin(a), end(a));
  do {
    int cur = 0;
    for (int i = 0; i < 5; i++) {
      if (cur % 10)
        cur += 10 - cur % 10;
      cur += a[i];
    }
    res = min(res, cur);
  } while (next_permutation(begin(a), end(a))); 
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 256
require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
}).on('line', function(line) {
  var x = +line;
  var happiness = Math.floor(x / 500) * 1000;
  happiness += Math.floor((x % 500) / 5) * 5;
  console.log(happiness);
});

Measured memory_bytes: 7500