akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n:usize,
        csf: [(i32,i32,i32); n-1],
    }
    for i in 0..n {
        let mut ans=0;
        for &(c,s,f) in &csf[i..n-1] {
            let mut start = s;
            loop {
                if ans<=start {ans=start;break;}
                start+=f;
            }
            ans+=c;
        }
        println!("{}", ans);    
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;

map<ll, ll> res;
const int mod = 1000000007;

void prime_factor(ll n){
  for (ll i = 2; i * i <= n; i++){
    while (n % i == 0){
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
}

int main(){
  ll n;
  cin >> n;
  for (ll i = 2; i <= n; i++) prime_factor(i);
  ll ans = 1;
  for (auto tmp : res) {
    ll num = tmp.second + 1;
    ans = (ans * num) % mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int H = scanner.nextInt();
        int[] T = new int[H + 1];
        for (int i = 1; i < H + 1; i++) {
            T[i] = scanner.nextInt();
        }
        for (int i = 1; i < H + 1; i++) {
            StringBuilder sb = new StringBuilder();
            sb.append("node " + String.valueOf(i) + ": key = " + String.valueOf(T[i]) + ", ");
            if (i / 2 > 0) {
                sb.append("parent key = " + String.valueOf(T[i / 2]) + ", ");
            }
            if (i * 2 < H + 1) {
                sb.append("left key = " + String.valueOf(T[i * 2]) + ", ");
            }
            if (i * 2 + 1 < H + 1) {
                sb.append("right key = " + String.valueOf(T[i * 2 + 1]) + ", ");
            }
            System.out.println(sb.toString());
        }
    }
}

Measured memory_bytes: 27584
'use strict'

// 1≤N≤10e5
// 1≤Hi≤10e9

function main(input) {
  input = input
    .trim()
    .split(/\n|\s/)
    .map(v => Number(v))
  const N = input[0]
  const H = input.slice(1)

  const diff = [0]
  for (let i = 1; i < N; i++) {
    diff[i] = H[i] - H[i - 1] <= 0 ? 1 + diff[i - 1] : 0
  }

  console.log(Math.max(...diff))
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 30004
#include<iostream>
#include<cstring>
#include<string>
using namespace std;

int main()
{
	string str;
	char ch;
	int m;
	int h;
	int len;
	int i,j,k;
	
	while(1){
		cin >> str;
		if(str=="-")
			break;
		
		i=0;
		len=0;
		while(str[i]!='\0'){
			len++;
			i++;
		}
		
		cin >> m;
		for(i=0;i<m;i++){
			cin >> h;
			for(j=0;j<h;j++){
				ch=str[0];
				for(k=0;k<len-1;k++){
					str[k]=str[k+1];
				}
				str[k]=ch;
				k++;
				str[k]='\0';
			}
		}
		
		cout << str << endl;
		
	}
	return 0;
}

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

int main(){
  int n, k, s;
  long long ans = 0;
  cin >> n >> k;
  
  for(int i = k+1; i <= n; i++){
    if(k){
      if(n%i-k>=0) s = n%i-k+1;
      else s = 0;
    }else s = n%i;
    ans += n/i*(i-k) + s;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
d = [chr(i) for i in range(97, 97+26)]

ans = ""
for i in range(1, 99):
  if N <= 26 ** i:
    N -= 1
    for j in range(i):
      ans += d[N % 26]
      N //= 26
    break
  else:
    N -= 26 ** i
print(ans[::-1])

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

using namespace std;

template<class INT>
INT mod_pow(INT n, INT k, INT p){
    if (k == 0)
        return 1;
    if (k % 2 == 0){
        INT res = mod_pow(n, k / 2, p);
        return res * res % p;
    }
    return mod_pow(n, k - 1, p) * n % p;
}

template<class INT>
vector<INT> fact(INT n, INT p=INT(1e9 + 7)){
    vector<INT> f(n + 1);
    f[0] = 1;
    for (INT i = 0; i < n; i++)
        f[i + 1] = (i + 1) * f[i] % p;
    return f;
}

template<class INT>
vector<INT> invfact(INT n, const vector<INT> &f, INT p=INT(1e9 + 7)){
    vector<INT> inv(n + 1);
    inv[n] = mod_pow<INT>(f[n], p - 2, p);
    for (INT i = n; i > 0; i--)
        inv[i - 1] = inv[i] * i % p;
    return inv;
}

template<class INT>
INT comb(INT a, INT b, const vector<INT> &f, const vector<INT> &invf, INT p=(INT)(1e9 + 7)){
    if (a < b)
        return 0;
    if (a < 0 or b < 0)
        return 0;
    return f[a] * invf[b] % p * invf[a - b] % p;
}

template<class INT>
std::map<INT, int> factorize(INT n){
    std::map<INT, int> res;
    for (int i = 2; i * i <= n; i++){
        while (n % i == 0){
            res[i]++;
            n /= i;
        }
    }

    if (n > 1)
        res[n]++;

    return res;
}

int main(){
    int n;
    cin >> n;
    vector<int64_t> A(n);
    copy_n(istream_iterator<int>(cin), n, A.begin());
    const int64_t p = 1e9 + 7;

    int64_t gcd = A[0];
    for (const auto &a: A)
        gcd = __gcd(gcd, a);
    for (auto &a: A)
        a /= gcd;

    map<int64_t, int64_t> F;
    for (const auto &a: A){
        auto res = factorize(a);
        for (const auto &r: res)
            F[r.first] = max(F[r.first], (int64_t)r.second);
    }

    int64_t lcm = 1;
    for (const auto &f: F){
        lcm *= mod_pow(f.first, f.second, p);
        lcm %= p;
    }

    lcm *= mod_pow(A[0], p - 2, p);
    lcm %= p;
    int64_t ans = 0;
    for (int i = 0; i < n; i++){
        ans += lcm % p * A[0] % p * mod_pow(A[i], p - 2, p) % p;
        ans %= p;
    }

    cout << ans % p << endl;
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		if(a <b) {
			System.out.println( "a < b");
		}else if(a >b) {
			System.out.println("a > b" );
		}else if(a  == b) {
			System.out.println("a == b");
		}
  }

}


Measured memory_bytes: 26220
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}


void solve(void){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,0,n) {
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[n-1] - a[0]<<endl;

}


   

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,A[100000];
int partition(int p,int r){
  int x=A[r];
  int i=p-1;
  for(int j=p;j<r;j++)
    if(A[j]<=x)swap(A[++i],A[j]);
  swap(A[i+1],A[r]);
  return i+1;
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
  int idx=partition(0,n-1);
  for(int i=0;i<n;i++){
    if(i)cout<<" ";
    if(i==idx)cout<<"["<<A[i]<<"]";
    else cout<<A[i];
  }
  cout<<endl;
  return 0;
}

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

int main(void)
{
	int n, a, q, k;
	cin >> n;
	vector<int> A;
	rep(i, n)
	{
	    cin >> a;
		A.push_back(a);
	}

    cin >> q;
    rep(i, q)
    {
        cin >> k;
        cout << lower_bound(A.begin(), A.end(), k) - A.begin()  << endl;
    }
}


Measured memory_bytes: 3536
#include <iostream>


using namespace std;


int main()
{
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    
    
    int ans;
    if( N < K ) ans = X * N;
    else ans = X*K + (N-K)*Y;
    cout << ans << endl;
    
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

public class Program
{
    private int N;
    private List<int>[] Edge;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        Edge = new List<int>[N];
        for (int i = 0; i < N; i++)
        {
            Edge[i] = new List<int>();
        }

        for (int i = 0; i < N - 1; i++)
        {
            int x = sc.NextInt() - 1;
            int y = sc.NextInt() - 1;
            Edge[x].Add(y);
            Edge[y].Add(x);
        }
        
        Console.WriteLine(Win(0,-1) > 0?"Alice":"Bob");
    }

    private int Win(int pos, int parent)
    {
        int result = 0;
        foreach (int i in Edge[pos])
        {
            if (i == parent) continue;
            result ^= 1+Win(i, pos);
        }

        return result;
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

Measured memory_bytes: 37516
from _collections import deque


h,w=map(int,input().split())
cx,cy=map(int,input().split())
dx,dy=map(int,input().split())
s=[[] for _ in range(h+2)]
for i in range(h):
    x=list(input())
    x.insert(0,"#")
    x.append("#")
    s[i+1]=x
s[0]=s[-1]=["#"]*(w+2)




dep=[[10**10]*(w+2) for _ in range(h+2)]
dep[cx][cy]=0
data=deque([[cx,cy,0]])
while len(data)>0:
  xy=data.popleft()
  x,y=xy[0],xy[1]
  if xy[2]==dep[x][y]:
    if s[x-1][y]=="." and dep[x-1][y]>dep[x][y]:
        dep[x-1][y]=dep[x][y]
        data.appendleft([x-1,y,dep[x][y]])
    if s[x+1][y] == "." and dep[x+1][y] > dep[x][y]:
        dep[x+1][y] = dep[x][y]
        data.appendleft([x + 1,y,dep[x][y]])
    if s[x][y-1] == "." and dep[x][y-1] > dep[x][y]:
        dep[x][y-1] = dep[x][y]
        data.appendleft([x,y-1,dep[x][y]])
    if s[x][y+1] == "." and dep[x][y+1] > dep[x][y]:
        dep[x][y+1] = dep[x][y]
        data.appendleft([x,y+1,dep[x][y]])

    for i in range(5):
        for j in range(5):
            if 0<=x-2+i<=h+1 and 0<=y-2+j<=w+1 and s[x-2+i][y-2+j]=="." and dep[x-2+i][y-2+j]>dep[x][y]+1:
                dep[x-2+i][y-2+j]=dep[x][y]+1
                data.append([x-2+i,y-2+j,dep[x][y]+1])

print(dep[dx][dy] if dep[dx][dy]<10**10 else -1)






Measured memory_bytes: 142728
a,b=map(int,input().split())
pic=[]

for i in range(a):
  pic.append(input())

for i in range(b+2):
  print("#",end="")
print()
for i in range(a):
  print("#",end="")
  print(pic[i],end="")
  print("#")
  
for i in range(b+2):
  print("#",end="")

Measured memory_bytes: 3064
N = int(input())
a = list(map(lambda x: int(x), input().split(' ')))

avg = sum(a)/N
min = 1000
answer = 101

for i in range(0, N):
	if abs(a[i] - avg) < min:
		min = abs(a[i] - avg)
		answer = i

print(answer)

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

using namespace std;

int main()
{
	int n;
	while (cin >> n, n)
	{
		vector<int> a(n);
		long long sum = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> a[i];
			sum += a[i];
		}
		sum /= n;
		int ans = 0;
		for (int i = 0; i < n; ++i)
		{
			if (a[i] <= sum)
				ans++;
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)

using namespace std;

void getKoyakusu(int big, int small, vector<int>& retvec);

int main(void) {

	int a;
	int b;
	int c;

	cin >> a;
	cin >> b;
	cin >> c;

	cout << c << " " << a << " " << b;

}






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

    typedef long long int ll;
    #define pb         push_back
    #define mp         make_pair
    #define F          first
    #define S          second
    #define fl(i,a,b)  for(ll i=a;i<b;i++)
    #define pll        pair<ll,ll>
    #define pii        pair<int,int>
    #define all(v)     v.begin(),v.end()
    #define M 1000000007
    #define tr(v, it) for(auto it = v.begin(); it != v.end(); it++)
    using namespace std;

    vector<int> topo;
    void dfs(int s, vector<int> graph[], bool visited[])
    {
        visited[s]=true;
       for(int i=0;i<graph[s].size();i++)
       {
           int u =graph[s][i];
           if(!visited[u])
            dfs(u,graph,visited);
       }
       topo.pb(s);
       return;
    }

    void dist(vector<int> graph[], int level[])
    {
        for(int i=topo.size()-1; i>=0; i--)
        {
            int u = topo[i];
            for(int j=0; j<graph[u].size(); j++)
            {
                int v = graph[u][j];
                level[v]=max(level[v],level[u]+1);
            }
        }
        return;
    }
    int main()
    {

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

         int V,E;
         cin>>V>>E;
         vector<int> graph[V+1];
         for(int i=0; i<E; i++)
         {
             int x,y;
             cin>>x>>y;
             graph[x].pb(y);
         }
         bool visited[V+1];
         memset(visited,false,sizeof(visited));

         for(int i=1; i<V+1; i++)
         {
             if(!visited[i])
                dfs(i,graph,visited);
         }
         int level[V+1]={0};
         dist(graph,level);
         int result=0;
         for(int i=0; i<V+1; i++)
         {
             if(level[i]>result)
                result=level[i];
         }
         cout<<result;

       return 0;
    }


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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

vector<LL> InputVec(LL size) {
	vector<LL> vec((size_t)size);
	REP(i, size) {
		cin >> vec[(size_t)i];
	}
	return vec;
}

vector<LL> tbl;

int main()
{
	LL N;
	cin >> N;
	vector<LL> hs = InputVec(N);
	tbl.resize(N, 1000000000);
	tbl[0] = 0;

	REP(i, N) {
		if (i - 1 >= 0) {
			LL cost = tbl[i - 1] + abs(hs[i - 1] - hs[i]);
			tbl[i] = min(tbl[i], cost);
		}

		if (i - 2 >= 0) {
			LL cost = tbl[i - 2] + abs(hs[i - 2] - hs[i]);
			tbl[i] = min(tbl[i], cost);
		}
	}

	cout << tbl[N - 1] << endl;

	return 0;
}


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

#define rep(i, first, to) for(ll i = first; i < to; ++i)

using namespace std;
typedef long long ll;

void solve() {
	string s[3];
	rep(i, 0, 3) {
		cin >> s[i];
	}
	cout << s[0][0] << s[1][0] << s[2][0] << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second

signed main(){
  int n,k;
  cin>>n>>k;
  int s=0;
  for(int i=1;i<=n;i+=2){
    s++;
  }
  if(s>=k)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
 
        if (b <= a) {
            System.out.println("delicious");
        } else if (b <= a + x) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }
    }
}

Measured memory_bytes: 22228
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define S 200005
#define M 1000000007
#define nl cout<<"\n";
#define er  cout<<"\n***********\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test lli t;  cin>>t; while(t--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (lli)(x.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define Y cout<<"YES\n";
#define N cout<<"NO\n";
#define print(x)                 cout<<#x<<": "<<x<<endl;
#define print2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl;
#define print3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define print4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define print5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl;
#define print6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl;


void solve()
{
    
    lli n,x,t;
    cin>>n>>x>>t;
    lli sum=0,ct=0;

    while(sum<n)
    {
        sum=sum+x;
        ct++;
    }

    cout<<ct*t;



    
}


int main()
{
    fast
    #ifndef ONLINE_JUDGE
     freopen("inputa.txt", "r", stdin);
     freopen("outputa.txt", "w", stdout);
    #endif    
     
     // test
     {
          solve();
          nl
     }
}
//a+b=a?b+2?(a&b)
//__builtin_popcnt(number)
//cout<<fixed<<setprecision(8)<<output<<"\n";

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

signed main(){
	int N;
	cin >> N;
	N %= 10;
	string s;
	if(N == 2 || N == 4 || N == 5 || N == 7 || N == 9)
		s = "hon";
	else if(N == 3)
		s = "bon";
	else
		s = "pon";
	cout << s << endl;


	return 0;	
}

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

countA = 0
countB = 0

card_list.sort()
card_list.reverse()


for i, x in enumerate(card_list):
    if i % 2 == 0:
        countA += x
    else :
        countB += x
        
print(countA - countB)

Measured memory_bytes: 3060
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final BigInteger MOD = BigInteger.valueOf((long) 1e9 + 7);

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();
        int d = in.nextInt();

        int[][] x = new int[n][d];
        for (int i=0; i < n; i++) {
            for (int j=0; j < d; j++) {
                x[i][j] = in.nextInt();
            }
        }

        int ans = 0;
        for (int i=0; i < n-1; i++) {
            for (int j=i+1; j < n; j++) {
                if (isSquared(distanceSquared(x[i], x[j])))
                        ans++;
            }
        }

        out.println(ans);

    }

    private static int distanceSquared(int[] vec1, int[] vec2) {
        int ret = 0;
        for (int i=0; i < vec1.length; i++) {
            ret += Math.pow(Math.abs(vec1[i] - vec2[i]), 2);
        }
        // System.out.println(ret);
        return ret;
    }

    private static boolean isSquared(int test) {
        return (double )test == Math.pow((int)Math.sqrt(test), 2);
    }

}


Measured memory_bytes: 22868
#include <iostream>
#include <math.h>
int main(){
	int a,b;
	std::cin>>a>>b;
	int n=10;
	while(b/n != 0){
		n*=10;	
	}
	n=a*n+b;
	int k=sqrt(n);
	if(n == k*k)std::cout<<"Yes"<<std::endl;
	else std::cout<<"No"<<std::endl;
	return 0;
}


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

using namespace std;

int a,b,c,d;
priority_queue<int,vector<int>,greater<int> > x,y;

int main(){
  cin >> a >> b>> c>>d;
  x.push(a);
  x.push(b);
  y.push(c);
  y.push(d);
  cout << x.top()+y.top() << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
int main(){
	ll n,k;
	cin>>n>>k;
	vector<ll> a;
	map<ll,ll> m;
	for(int i=0;i<n;i++){
		ll tmp;
		cin>>tmp;
		a.pb(tmp);
		m[tmp]++;
	}
	sort(a.begin(),a.end());
	vector<ll> cts;
	for(int i=0;i<a.size();i++){
		if( m[a[i]]>0){
			cts.pb(m[a[i]]);
			m[a[i]] = 0;
		}
	}
	sort(cts.begin(),cts.end());
	ll ans = 0;
	for(int i=cts.size();i>k;i--){
		ans += cts[cts.size()-i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 17392
#include <iostream>

using namespace std;

int main(void){
  int N; cin >> N;
  long ans = 0;
  for(int i = 1; i <= N; i++){
    //3かつ5で割り切れない
    if((i % 3) && (i % 5)){
      ans += i;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define pb(x) push_back(x)
#define int long long

signed main(void) {
  string S;
  cin >> S;
  SORT(S);
  if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]){
  	cout << "Yes" << endl;
  } else {
  	cout << "No" << endl;
  }

  return 0;
}


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

int main(){
  string s="abcdefghijklmnopqrstuvwxyz";
  char x;
  cin>>x;
  for(int i=0;i<26;i++){
    if(x==s[i]){
      cout<<"a"<<endl;
      return 0;
    }
  }
  cout<<"A"<<endl;
}

Measured memory_bytes: 3624
N = int(input())
S = list(input())

e_cnt = S.count('E')
w_cnt = 0
ans = float('inf')
for i in range(N):
    if S[i] == 'E':
        e_cnt -= 1
        w = w_cnt
    else:
        w_cnt += 1
        w = w_cnt - 1
    
    ans = min(ans, e_cnt+w)

print(ans)

Measured memory_bytes: 11556
import java.util.*;

public class Main {

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

        int baseLength = S.length();
        int zeroWord = baseLength - S.replaceAll("0", "").length();
        int oneWord = baseLength - S.replaceAll("1", "").length();

        if (zeroWord > oneWord) {
            System.out.println(oneWord*2);
        }
        else {
            System.out.println(zeroWord*2);
        }
    }
}

Measured memory_bytes: 32976
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check();


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    int a,b;
    cin>>a>>b;
    int n=max(a,b);
    int m=min(a,b);
    f1(i,n) {
        cout<<m;
    }
    en
    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

// https://beta.atcoder.jp/contests/abc054/tasks/abc054_b

int main() {
    int N, M; cin >> N >> M;
    string A[N];
    string B[M];

    REP(i, N) {
        cin >> A[i];
    }
    REP(i, M) {
        cin >> B[i];
    }

    REP(i, N-M+1) {
        REP(j, N+M+1) {

            bool match = true;
            REP(k, M) {
                REP(l, M) {
                    if (B[k][l] != A[k+i][l+j]) {
                        match = false;
                    }
                }
            }

            if (match) {
                cout << "Yes" << "\n";
                return 0;
            }
        }
    }

    cout << "No" << "\n";
    return 0;
}


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val s = new Main()
    s.solve()
    s.out.flush()
  }
}

class Main {
  import java.io._
  import java.util.StringTokenizer

  import scala.collection.mutable
  import scala.util.Sorting
  import math.{abs, max, min}
  import mutable.{ArrayBuffer, ListBuffer}
  import scala.reflect.ClassTag

  val MOD = 1000000007
  val out = new PrintWriter(System.out)

  def solve(): Unit = {
    import java.util
    val N = ni()
    val A = na(N, -1)
    val R = Array.ofDim[Int](N)
    REP(N) { i =>
      R(A(i)) = i
    }

    val lts = new util.TreeSet[Integer]()
    var ans = 0L
    REP(N) { i =>
      val p = R(i)
      val l = lts.lower(p)
      val ll = if (l != null) l.intValue() + 1 else 0
      val r = lts.higher(p)
      val rr = if (r != null) r.intValue() else N
      lts.add(p)
      ans += (p - ll + 1).toLong * (rr - p) * (i + 1)
    }

    out.println(ans)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = next().toInt
    def nextLong(): Long = next().toLong
    def nextChar(): Char = next().charAt(0)
  }
  val sc = new InputReader(System.in)
  def ni(): Int = sc.nextInt()
  def nl(): Long = sc.nextLong()
  def nc(): Char = sc.nextChar()
  def ns(): String = sc.next()
  def ns(n: Int): Array[Char] = ns().toCharArray
  def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
  def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
    val A1, A2 = Array.ofDim[Int](n)
    REP(n) { i =>
      A1(i) = ni() + offset
      A2(i) = ni() + offset
    }
    (A1, A2)
  }
  def nm(n: Int, m: Int): Array[Array[Int]] = {
    val A = Array.ofDim[Int](n, m)
    REP(n) { i =>
      REP(m) { j =>
        A(i)(j) = ni()
      }
    }
    A
  }
  def nal(n: Int): Array[Long] = map(n)(_ => nl())
  def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }

  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }


  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }

  def cumSum(as: Array[Int]) = {
    val cum = Array.ofDim[Int](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) + as(i)
    }
    cum
  }
}

Measured memory_bytes: 69148
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
char ma[60][60];
int main(void)
{
    int n,m;
    scanf("%d %d",&n,&m);
    memset(ma,0,sizeof(ma));
    for(int i = 1;i <= n;i++)
        scanf("%s",ma[i]+1);
    bool flag = true;
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j < m;j++)
        {
            if(ma[i][j] == '#'&&ma[i-1][j]!='#'&&ma[i+1][j]!='#'&&ma[i][j+1]!='#'&&ma[i][j-1]!='#')
                flag = false;
        }
    }
    if(flag)
        printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
typedef long long ll;

int n,nk,f[100005],g[100005][26];
char s[200005];

ll Calc(ll m,int c)
{
    if(m<=n)return g[m][c];
    ll l1=n,l2=nk,k,s1=g[l1][c],s2=g[l2][c];
    while(l1+l2<=m)k=l1,l1+=l2,l2=k,k=s1,s1+=s2,s2=k;
    return s1+Calc(m-l1,c);
}

int main()
{
    scanf("%s",s+1),n=strlen(s+1)>>1,f[0]=-1;
    for(int i=1,j=-1;i<=n;f[i++]=++j)while(j>=0&&s[j+1]!=s[i])j=f[j];
    nk=n-f[n];
    for(int i=1;i<=n;++i)memcpy(g[i],g[i-1],sizeof g[i]),++g[i][s[i]-'a'];
    ll l,r;
    scanf("%lld%lld",&l,&r);
    for(int i=0;i<26;++i)printf("%lld%c",Calc(r,i)-Calc(l-1,i),i==25?'\n':' ');
    return 0;
}

Measured memory_bytes: 10880
N, K = map(int, input().split())
a = list(map(int, input().split()))
dp = [False] * (K + 1)
for i in range(1, K + 1):
    for j in range(N):
        if i - a[j] >= 0:
            dp[i] |= not dp[i - a[j]]

if dp[K]:
    print('First')
else:
    print('Second')

Measured memory_bytes: 41964
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<tuple<ll, ll, ll>> ds(n);
  REP(i,0,n) {
    ll a, b;
    cin >> a >> b;
    ds[i] = make_tuple(a + b, a, b);
  }
  sort(ds.rbegin(), ds.rend());
  ll ans = 0;
  REP(i,0,n) {
    if(i % 2 == 0) {
      ans += get<1>(ds[i]);
    } else {
      ans -= get<2>(ds[i]);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int, input().split()))
if x not in p:
    print(x)
    exit()

x1 = x - 1
x2 = x + 1
while True:
    if x1 not in p:
        print(x1)
        exit()
    elif x2 not in p:
        print(x2)
        exit()
    x1 -= 1
    x2 += 1

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

int my_adds(int x,int y,int z){
  return x+y+z;
}

int main(){
  string n;
  int s1,s2,s3;
  cin >> n;
  s1=n.at(0);
  s2=n.at(1);
  s3=n.at(2);
  int answer = my_adds(s1,s2,s3);
  cout << answer-144 << endl;
}

Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
	  int N = int.Parse(Console.ReadLine());
      int result = 0;
      int endA = 0;
      int beginB = 0;
      int beginBendA = 0;
      for(int i = 0; i < N; i++)
      {
          string str = Console.ReadLine();
          if(str[str.Length-1] == 'A')
          {
            if(str[0] == 'B') beginBendA++;
            else endA++;
          }
          else if(str[0] == 'B') beginB++;
        
          for(int j = 0; j < str.Length - 1; j++)
          {
             if(str[j] == 'A' && str[j+1] == 'B') result++;
          }
      }
      
      if(beginBendA > 0)
      {
        if(beginB > 0 || endA > 0) result += beginBendA;
        else result += (beginBendA-1);
      }
      
      result += Math.Min(beginB, endA);
      
      Console.WriteLine("{0}", result);
	}
}


Measured memory_bytes: 13268
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

fn main() {
    input! {
        l: i64,
        r: i64,
    }

    let mut minv = std::i64::MAX;
    for i in l..r {
        for j in i + 1..=r {
            let ans = (i * j) % 2019;

            if ans == 0 {
                println!("{}", ans);
                return;
            }

            minv = min(minv, ans);
        }
    }
    println!("{}", minv);
}


Measured memory_bytes: 2160
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    D, N = (int(_) for _ in input().split())
    if N!=100:
        print(100**D * N)
    else:
        print(100**D * N + 1*(100**D))
        
if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vector<string> a;
    vector<vi> dp;
    const vii dr={{1,0},{-1,0},{0,1},{0,-1}};
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

void dfs(lli x,lli y)
{
    queue<ii> pq;
    pq.push({x,y});
    pq.push({-2,-2});
    lli cnt=0;
    bool fl=false;
    while(!pq.empty())
    {
        auto u=pq.front();pq.pop();
        if(u.X==-2)
        {
            if(fl)
                break;
            pq.push(u);
            cnt++;
            fl=true;
            continue;
        }

        if(u.X<0||u.Y<0||u.X>=n||u.Y>=m||a[u.X][u.Y]=='#'||dp[u.X][u.Y]<=cnt)
            continue;
        fl=false;
        dp[u.X][u.Y]=cnt;
        for(auto x:dr)
            pq.push({x.X+u.X,x.Y+u.Y});
    }
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    a.resize(n);
    fo(i,n)
        cin>>a[i];

    lli ans=0;

    fo(i,n)
    fo(j,m)
    {
        dp.clear();
        dp.resize(n,vi(m,INF));
        dfs(i,j);
        for(auto &v:dp)
        for(auto x:v)
            if(x!=INF)
                ans=max(ans,x);
    }

    cout<<ans<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 256
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	H, N = getlist()
	A = getlist()
	if sum(A) >= H:
		print("Yes")
	else:
		print("No")
	


if __name__ == '__main__':
	main()

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

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

const LL mod=1000000007;

LL modpow(LL x, LL y){
	LL r=1;
	while(y){
		if(y&1) r=r*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return r;
}

LL modinv(LL x){
	LL k=mod, u=1, v=0;
	while(k){
		LL t=x/k;
		x-=t*k; swap(x,k);
		u-=t*v; swap(u,v);
	}
	u%=mod;
	if(u<0) u+=mod;
	return u;
}

int main(){
	LL n, a, b;
	cin >> n >> a >> b;
	LL C[200010];
	C[1]=n;
	for(LL i=2; i<200010; i++){
		C[i]=C[i-1]*(n-i+1);
        C[i]%=mod;
        C[i]*=modinv(i);
        C[i]%=mod;
	}
    LL ans=modpow(2,n)-C[a]-C[b]-1;
    if(ans<0){
      while(ans<0) ans+=mod;
    }
    cout << ans << endl;

	return 0;
}

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

int main(){
    int a, b, d, r;
    double f;
    cin >> a >> b;
    d = a / b;
    r = a % b;
    f = (double)a / (double)b; 
    cout << fixed;
    cout << d << " " << r << " " << setprecision(6) << f << endl;
    
    return 0;
}


Measured memory_bytes: 3264
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n = I()
s = S()  # 65 - 90
ans = ""
for i in range(len(s)):
    tmp = ord(s[i]) + n
    if tmp > 90:
        ans += chr(tmp - 91 + 65)
    else:
        ans += chr(tmp)
print(ans)

Measured memory_bytes: 40556
n=+require("fs").readFileSync("/dev/stdin","utf-8")

function kaip(n) {
  n = n+""
  if (n[0] != n[n.length-1]) return false;
  for (var i=1; i<n.length/2; ++i)
    if (n[i] != n[n.length-i-1]) return false;
  return true;
}

(function(){
  if (kaip(n)) {
    console.log(n)
    return;
  }
  for (j=1;;++j) {
    if (kaip(n-j)) {
      console.log(n-j);
      return;
    }
    if (kaip(n+j)) {
      console.log(n+j);
      return;
    }
  }
})(n)

Measured memory_bytes: 7388
import heapq

#dg = 10**7#ノード数より多く取る

n,m, S = map(int,input().split()) #n:頂点数　m:辺の数

edge = [[] for i in range(n)]
#edge[i] : iから出る道の[重み,行先]の配列


Cs=[]
Ds=[]
amax=0
for _ in range(m):
    u, v, a, b = map(int,input().split())
    edge[u-1].append([v-1,a,b])
    edge[v-1].append([u-1,a,b])#有向グラフの場合コメント
    amax=max(a,amax)

for _ in range(n):
    c, d = map(int,input().split())
    Cs.append(c)
    Ds.append(d)

dg=(n-1)*amax

def cut(S): 
    return min(S,dg)

S=cut(S)

def dijkstra(start):

    #dijkstra
    # d : minimum distance from s
    d = [[10**20]*(dg+1) for _ in range(n)]
    d[start][cut(S)] = 0
    edgelist = []

    heapq.heappush(edgelist,[Ds[0], 0, cut(S+Cs[0])])

    for e in edge[start]:
        if S-e[1]>=0:
            heapq.heappush(edgelist,[e[2],e[0],S-e[1]])

    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        t,ce,cs = minedge[0],minedge[1],minedge[2]
        #print(t,ce,cs)
        if  d[ce][cs]== 10**20:
            d[ce][cs] = t
            ns=cut(cs+Cs[ce])
            #print(ce,ns)
            if d[ce][ns]==10**20:
                #d[ce][ns]=t+Ds[ce]
                heapq.heappush(edgelist, [t+Ds[ce],ce,ns])

            for e in edge[ce]:
                if cs>=e[1]:
                    #print(e)
                    ne=e[0]
                    ns=cs-e[1]
                    if d[ne][ns]==10**20:
                        #print(ne)
                        heapq.heappush(edgelist, [t+e[2],ne,ns])
    return d

d=dijkstra(start=0)
for x in d[1:]:
    print(min(x))
#print(d)


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

// 0 から v までの XOR を計算する
long long f(long long v){

  // 答え
  long long res = 0;

  // 0 -> 000
  // 1 -> 001
  // --- 0 xor 1 = 1 ---
  // 2 -> 010
  // 3 -> 011
  // --- 2 xor 3 = 1 ---
  // 4 -> 100

  // v が作れる 2 個組の個数
  long long count = (v + 1) / 2;

  // 奇数なら 1 偶数なら 0
  res = count % 2;

  // v が偶数だと 2 個組から 1 個余るので、
  // 余った 1 個と res で XOR を計算する
  if (v % 2 == 0) {
    res = res ^ v;
  }

  return res;
}

int main() {

  long long A, B;
  cin >> A >> B;

  // (0 から B までの XOR) XOR (0 から A - 1 までの XOR)
  long long answer = f(B) ^ f(A - 1);

  cout << answer << endl;

  return 0;

}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

calc [] = 1
calc (a : as)
  | odd a = 1 * calc as
  | even a = 2 * calc as

main = do
  n <- getInt
  as <- getIntList
  print $ 3 ^ n - calc as


Measured memory_bytes: 3768