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

#[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, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}



use std::cmp;
use std::iter::Iterator;

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

    let mut ls: Vec<_> = (1..n+1).map(|i| l + i as i64 - 1).map(|v| (v.abs(), v)).collect();
    ls.sort();
    
    let ans = &(ls[1..n]).into_iter().map(|&(v1, v2)| v2).sum::<i64>();
    println!("{}", ans);


    
}



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

int main(){
  int N, X;
  int bound = 1;
  int pos = 0;
  cin >> N >> X;
  vector<int> vec(N);
  
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  for(int i = 0; i < N; i++){
    pos += vec.at(i);
    if(pos > X){
      break;
    }

    bound++;
  }
  cout << bound << endl;
  return 0;
}


Measured memory_bytes: 256
import math

a, b, x = map(int, input().split())

t = a*a*b

if x == t:
    theta = 90
elif x <= t*0.5:
    tan = 2*x/(a*b*b)
    theta = math.degrees(math.atan(tan))
else:
    tan = a*a*a/(2*(a*a*b - x))
    theta = math.degrees(math.atan(tan))

print(90 - theta)

Measured memory_bytes: 3060
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long,long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long,long>>;

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    ll c_R = 0;
    ll c_B = 0;
    ll c_G = 0;
    REP(i,N) {
        if(S.at(i) == 'R') c_R++;
        if(S.at(i) == 'G') c_G++;
        if(S.at(i) == 'B') c_B++;
    }

    //cout << c_R << " " << c_G << " " << c_B << endl;

    ll no_count = 0;
    for(int i = 0; i < N-2; i++) {
        for(int k = i+2; k < N; k++) {
            if(k%2 == i%2) {
                int j = (k+i)/2;
                //cout << i << " " << j << " " << k << endl;
                if(S.at(i) != S.at(j) && S.at(i) != S.at(k) && S.at(j) != S.at(k)) {
                    //cout << S.at(i) << " " << S.at(j) << " " << S.at(k) << endl;
                    no_count++;
                }
            } 
        }
    }
    cout << c_R*c_G*c_B - no_count << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl;
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2

double dist[1010];
int vis[1010];
int main() {
	ll xs, ys, xt, yt, N;
	cin >> xs >> ys >> xt >> yt >> N;

	vector<vector<ll>>v;
	vector<vector<double>>e(1010,vector<double>(1010,0));
	v.pb({xs,ys,0});
	rep(i, 0, N) {
		ll x, y, r;
		cin >> x >> y >> r;
		v.pb({ x,y,r });
	}
	v.pb({xt,yt,0});

	rep(i, 0, N+2) {
		rep(j, 0, N+2) {
			if (i == j)continue;
			ll x1 = v[i][0];
			ll y1 = v[i][1];
			double R1 = v[i][2];
			ll x2 = v[j][0];
			ll y2 = v[j][1];
			double R2 = v[j][2];
			ll tmp = (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2);
			double dist = sqrt(tmp);
			double cost = (dist - R1 - R2 > 0) ? dist - R1 - R2 : 0;
			e[i][j] = cost;
		}
	}

	rep(i, 0, 1010)dist[i] = (double)inf;
	min_priority_queue<pair<double,ll>>q;
	dist[0] = 0.0;
	q.push({0.0,0});
	while (q.size()) {
		auto p = q.top();
		q.pop();
		ll now = p.second;
		double d = p.first;
		if (vis[now])continue;
		vis[now] = 1;
		rep(j, 0, N + 2) {
			if (now == j)continue;
			double cc = d + e[now][j];
			if (cc < dist[j]) {
				dist[j] = cc;
				q.push({cc,j});
			}
		}
	}

	printf("%.25f",dist[N+1]);
	puts("")

	return 0;
}


Measured memory_bytes: 14576
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main () {
    char *s1 = malloc(sizeof(char)*12), *s2 = malloc(sizeof(char)*12), *s3 = malloc(sizeof(char)*12);
    scanf("%s %s %s", s1, s2, s3);
    printf("%c%c%c\n", toupper(s1[0]), toupper(s2[0]), toupper(s3[0]));
    return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline

H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
dp = [10**18]*(H+1)
dp[0] = 0

for i in range(H):
    for A, B in AB:
        j = min(H, i+A)
        dp[j] = min(dp[j], dp[i]+B)

print(dp[H])

Measured memory_bytes: 74064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  int one = C*2*max(X,Y);
  int too = A*X+B*Y;
  int thr = X < Y ? B : A;
  int hoo = 2 * C * min(X, Y) + thr * abs(X-Y);
  cout << min(one,min(too,hoo)) << endl;
}


Measured memory_bytes: 3588
s = input()
ll = [i for i in range(97,123,1)]
for j in s:
    s_num = ord(j)
    if s_num in ll:
        ll.remove(s_num)
    else:
        pass
if len(ll) != 0:
    print(chr(ll[0]))
else:
    print("None")


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

int main()
{
    int x,y;
    while (1)
        {
            cin >> x >> y;
            if (x == 0 and y == 0)
                break;
            else 
                if (x > y)
                    cout << y << " " << x << endl;
                else cout << x << " " << y << endl;
        } 
    return 0;
}

Measured memory_bytes: 1160
N, C = map(int, input().split())
d = [list(map(int , input().split())) for _ in range(C)]
c = [list(map(int , input().split())) for _ in range(N)]
#print(d)
#print(c)

from collections import defaultdict
cd = [defaultdict(int), defaultdict(int), defaultdict(int)]
for i in range(N):
    for j in range(N):
        k = (i+1+j+1) % 3
        cd[k][c[i][j]] += 1

ans = 10 ** 10
import itertools
for p in itertools.permutations(list(range(C)), 3):
    iwa = 0
    for ci in cd[0].items():
        iwa += d[ci[0]-1][p[0]] * ci[1]
    for ci in cd[1].items():
        iwa += d[ci[0]-1][p[1]] * ci[1]
    for ci in cd[2].items():
        iwa += d[ci[0]-1][p[2]] * ci[1]
    ans = min(ans, iwa)
#print(cd)
print(ans)

Measured memory_bytes: 5876
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    string s;
    cin >> s;
    int ret = 0;
    int odd = s.size() % 2;
    for (int i = 1; i < s.size() / 2 + odd; ++i) {
        if (s.substr(0, i) == s.substr(i, i))
            chmax(ret, i);
    }
    cout << ret * 2 << "\n";
    return 0;
}

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

int a[105];

int main()
{
  int n ;
  cin >> n ;
  int cnt1 = 0,cnt2 = 0,cnt3 = 0,cnt4 = 0 ,cnt5 = 0,cnt6 = 0,cnt7 = 0,cnt8 = 0,cnt9 = 0 ;
  int ans = 0 ;
  int mn = 10000000007 ;
  for(int i = 0 ; i < n ; i++)
  {
    cin >> a[i] ;
    if(a[i] >= 1 && a[i] <= 399)
    {
      cnt1++ ;
    }
    else if(a[i] >= 400 && a[i] <= 799)
    {
      cnt2++ ;
    }
    else if(a[i] >= 800 && a[i] <= 1199)
    {
      cnt3++ ;
    }
    else if(a[i] >= 1200 && a[i] <= 1599)
    {
      cnt4++ ;
    }
    else if(a[i] >= 1600 && a[i] <= 1999)
    {
      cnt5++ ;
    }else if(a[i] >= 2000 && a[i] <= 2399)
    {
      cnt6++ ;
    }
    else if(a[i] >= 2400 && a[i] <= 2799)
    {
      cnt7++ ;
    }
    else if(a[i] >= 2800 && a[i] <= 3199)
    {
      cnt8++ ;
    }
    else if(a[i] >= 3200)
    {
      cnt9++ ;
    }
  }
  int tmp = 0;

  if(cnt1 != 0)
  {
   tmp++ ;
  }
   if(cnt2 != 0)
  {
   tmp++ ;
  }
   if(cnt3 != 0)
  {
   tmp++ ;
  }
   if(cnt4 != 0)
  {
   tmp++ ;
  }
   if(cnt5 != 0)
  {
   tmp++ ;
  }
   if(cnt6 != 0)
  {
   tmp++ ;
  }
   if(cnt7 != 0)
  {
   tmp++ ;
  }
   if(cnt8 != 0)
  {
   tmp++ ;
  }
  if(tmp == 0)
  {
    cout << 1 <<" " << tmp+cnt9 << endl;
    return 0 ;
  }
  cout << tmp <<" " << tmp+cnt9 << endl;

  return 0 ;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int a,b;
    char op;
    while(1){
        scanf("%d",&a);
        getchar();
        scanf("%c%d",&op,&b);
        if(op=='+')
            printf("%d\n",a+b);
        else if(op=='-')
            printf("%d\n",a-b);
        else if(op=='*')
            printf("%d\n",a*b);
        else if(op=='/')
            printf("%d\n",a/b);
        else
            break;
    }
    return 0;
}

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

int main(){
    //入力
    int r,g,b;
    cin >> r >> g >> b;
    //出力
    if((100*r+10*g+b)%4==0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		long N = sc.nextLong();

		sc.close();
		N--;
		out.println((1 + N) * N / 2);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 24020
#include<stdio.h>
int main(){
  char S[3];
  int i;
  int aa=0;
  int bb=0;
  int cc=0;

 scanf("%s",&S[0]);
 for(i=0;i<3;i++){
 if(S[i]=='a')
   aa=1;
   if(S[i]=='b')
   bb=1;
   if(S[i]=='c')
   cc=1;
 }
  if(aa==1&&bb==1&&cc==1)
    printf("Yes");
  else
    printf("No");
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;

int main(){
	string c[3];
	cin>>c[0]>>c[1]>>c[2];
	cout<<c[0][0]<<c[1][1]<<c[2][2];
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

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

	x := (b / c) + (b / d) - (b / lcm(c, d))
	y := ((a - 1) / c) + ((a - 1) / d) - ((a - 1) / lcm(c, d))

	fmt.Println(b - a + 1 - (x - y))
}

func gcd(a, b int) int {
	for {
		if a%b == 0 {
			return b
		}
		tmp := b
		b = a % b
		a = tmp
	}
	return b
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}


Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main() {
    ll N,Q;
    cin >> N >> Q;
    vector<vector<ll>> v(N);
    
    vector<ll>p(N, 0), ans(N, 0);
    FOR(i, N-1) { ;
        ll tmpa, tmpb;
        cin >> tmpa >> tmpb;
        tmpa--;
        tmpb--;
        v[tmpa].push_back(tmpb);
        v[tmpb].push_back(tmpa);
        ;
    }
    FOR(i, Q) { ;
        ll tmpp, tmpx;
        cin >> tmpp >> tmpx;
        tmpp--;
        p[tmpp] += tmpx;
    }
    function<void(ll, ll, ll)> f = [&](ll now, ll par, ll point) {
        point += p[now];
        ans[now] = point;
        for(auto vv:v[now]){
            //point += p[now];
            if(vv!=par){
                f(vv, now, point);
            }
        }
        ;
    };
    f(0, -1, 0);
    FOR(i, N-1) { ;
        cout<<ans[i]<<" ";
    }
    cout << ans[N - 1] << endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define fin(x) cout << x << endl;

using namespace std;
using ll = long long;

int main(void) {
  string s;
  cin >> s;
  vector<char> vec;
  if (s.size() % 2 != 0) {
    cout << "No" << endl;
    return 0;
  }
  rep(i, s.size()) {
    vec.push_back(s[i]);
  }
  for (int i = 0; i < s.size() / 2; i += 2) {
    if (vec[i] == 'h' && vec[i+1] == 'i') {
      continue;
    } else {
      fin("No");
      return 0;
    }
  }
  fin("Yes");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<list>
#include<math.h>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl

#define INF 1000000007;

int main(){
  int A,B,ans;
  char op;

  cin >>A>>op>>B;
  if(op=='+') ans=A+B;
  else ans=A-B;

  print(ans);
  
  return 0;
}


Measured memory_bytes: 256
# input
l = [int(x) for x in list(input())]

N = len(l)
ans = 0

for i in range(N):
    for k in range(N - i - 1):
        ans += (2 ** i) * (2 ** (N - i - k - 2)) * (10 ** k) * l[i]
    ans += (2 ** i) * (10 ** (N - i - 1)) * l[i]

print(ans)


    

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

int main() {
int s;
  cin >>s;
  for (int i=1; i>=0;){
    if (s==1||s==2||s==4){
      i=i+3;
      cout << i << endl;
      break;
    }if (s%2==0){
      s=s/2;
    }else {
      s=s*3+1;
    }
    i++;
}
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int k = sc.nextInt();
        HashSet<String> set = new HashSet<>();
        for(int i = 0; i <= s.length(); i++) {
            for(int j = i + 1; j <= i + k && j <= s.length(); j++) {
                String sub = s.substring(i, j);
                set.add(sub);
            }
        }
        String[] subStrings = new String[set.size()];
        set.toArray(subStrings);
        Arrays.sort(subStrings);
        System.out.println(subStrings[k-1]);
    }
}


Measured memory_bytes: 24256
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
for i in range(h+2):
    ans = ""
    for j in range(w+2):
        if i == 0 or i == h+1 or j == 0 or j == w+1:
            ans += "#"
        else:
            ans += a[i-1][j-1]
    print(ans)

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

using namespace std;

typedef long long int ll;

vector<vector<ll> > gr;

int solve(int x, int y) {
    if(x < 0 || y < 0)
        return 0;
    if(gr[x][y] == -1)
        return 0;
    if(gr[x][y] != -2)
        return gr[x][y];
    gr[x][y] = (solve(x-1, y) + solve(x, y-1))%1000000007;
    return gr[x][y];
}

int main() {
    int h, w;
    char ch;
    cin >> h >> w;
    gr.resize(h, vector<ll>(w));
    for(int i = 0; i < h; i++) {
        for(int j = 0; j < w; j++) {
            cin >> ch;
            if(ch == '.')
                gr[i][j] = -2;
            else gr[i][j] = -1;
        }
    }
    gr[0][0] = 1;
    cout << solve(h-1, w-1) << "\n";
}

Measured memory_bytes: 8192
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  string S;
  int N;
  cin >> S >> N;
  vector<string> A(N);
  for (int i = 0; i < N; ++i)
    cin >> A[i];
  for (int i = 0; i < N; ++i)
    A[i] += A[i];
  int ans = 0;
  for (int i = 0; i < N; ++i)
    if (A[i].find(S) != A[i].npos)
      ++ans;
  cout << ans << endl;
}


Measured memory_bytes: 3180
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
* * WRITER:kakitamasziru/OxOmisosiru * *
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
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; }
const long long INF = 1001001001001001;
const long long MOD = 1000000007;
typedef pair<long long,long long> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

long long A,B;
bool ok(long long key,long long index){
    string S = to_string(index);
    long long nagasa = S.size();
    if(index*A+nagasa*B > key) return true;
    else if(index*A+nagasa*B <= key) return false;
}
long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N,X;cin >> N >> X;
    vector<int> retu(N);
    for(int i = 0;i<N;i++)cin >> retu.at(i);
    int za = 0;
    int times = 1;
    for(int i = 1;i<N+1;i++){
        za += retu.at(i-1);
        if(za <= X) times++;
        else break;
    }
    

    cout << times << endl;
    

    // PLEASE GIVE ME THE "ACCEPTED" !
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll N,K;
  cin >> N >> K;
  vl A(N);
  vl F(N);
  REP(i,N) cin >> A[i];
  REP(i,N) cin >> F[i];
  sort(A.begin(),A.end());
  sort(F.begin(),F.end());
  reverse(F.begin(),F.end());
  ll ok = 1e15;
  ll ng = -1;
  while(abs(ok-ng)>1){
    ll m = (ok+ng)/2;
    ll cost = 0;
    REP(i,N){
      ll norma = m/F[i];
      cost += max(0ll,A[i]-norma);
    }
    if(cost<=K) ok=m;
    else ng=m;
  }
  cout << ok << endl;
  return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define ll long long int
#define pb(x) push_back(x)
#define TEST(t) int inox,t;cin>>t; for(inox=1;inox<=t;inox++)
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;


int main(){
	ll n; cin>>n;
	double e=n;
	double k= (log2(e));
	double h=ceil(k);
	if(h==k)h++;
	ll j=pow(2,h);
	cout<<j-1;
	return 0;
}

Measured memory_bytes: 384
#define LOCAL
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb push_back
#define eb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos((ld)-1.0))
#define MAXN (300006)
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph push
#define btinpct(x) __builtin_popcountll((x))
#define MSB(bm) ((bm==0)?-1:(63-__builtin_clzll((bm))))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
string to_string(char c) {string s(1,c);return s;}string to_string(bool b){return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void degug_out() { cerr << endl; }template <typename Head, typename... Tail>void degug_out(Head H, Tail... T) {cerr << " " << to_string(H);degug_out(T...);}inline ll gcd(ll a,ll b){if(a>b)swap(a,b);if(a==0)return b;return gcd(b%a,a);}
#ifdef LOCAL
// #define degug(...) cerr << "[" << #__VA_ARGS__ << "]:", degug_out(__VA_ARGS__)
#else
// #define degug(...) 663
#define cerr if(0)cout
#endif
#warning "// FOR has been inclusive now!!!!"
ll A,B;
int main()
{
	ll n; cin >> n;
	ll A[n];
	FOR(i,0,n-1) cin>>A[i];
	ll co=0, ans=0;
	DEC(i,n-1,0){
		if(A[i]>=A[i+1]) ++co;
		else {
			co=0;
		}
		ans=max(ans, co);
	}
	cout<<ans<<'\n';
}


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

ll KnapSack(ll n,ll W,ll wo[],ll vo[])
{
    ll keep[n+1][W+1],V[n+1][W+1];
    for(ll i=0;i<=W;i++){
        V[0][i]=0;
    }
    for(ll i=0;i<n;i++){
        V[i][0]=0;
    }
    for(ll i=1;i<=n;i++){
        for(ll w=1;w<=W;w++){
            if((wo[i]<=w) && (vo[i]+V[i-1][w-wo[i]]>V[i-1][w]) ){
                V[i][w]=vo[i]+V[i-1][w-wo[i]];
                keep[i][w]=1;
            }
            else{
                V[i][w]=V[i-1][w];
                keep[i][w]=0;
            }
        }
    }
    ll K=W;
    /*
    for(ll i=n;i>=1;i--){
        if(keep[i][K]==1){
            cout<<i<<" ";
            K=K-wo[i];
        }
    }
    */
    return V[n][W];

}
int main(){
    ll n,W;
    cin>>n>>W;
    ll wo[n+1],vo[n+1];
    wo[0]=vo[0]=0;
    for(ll i=1;i<=n;i++){
        cin>>wo[i]>>vo[i];
    }
    ll y=KnapSack(n,W,wo,vo);
    cout<<y;
    return 0;
}


Measured memory_bytes: 158080
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
int main()
{
    int H, N;
    cin >> H >> N;
    int input, m = 0;
    REP(i, N)
    {
        cin >> input;
        m += input;
    }

    if (m >= H)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

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

#include <boost/multiprecision/cpp_int.hpp>
using bint = boost::multiprecision::cpp_int;

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  bint n;
  cin >> n;
  if (n % 9 == 0) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }
  return 0;
}


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

int N, A, B, used[100], rings[100]; vector<int> G[100];
 
int rec(int pos)
{
    used[pos] = true; int ret = 1;
     
    for(int i = 0; i < rings[pos]; i++)
    {
        if(!used[G[pos][i]])
        {
            ret = max(ret, rec(G[pos][i]) + 1);
        }
    }
     
    used[pos] = false;
     
    return ret;
}
 
int main()
{
    int N, A, B;
     
    while(true)
    {
        scanf("%d", &N);
         
        if(N == 0) { break; }
 
        for(int i = 0; i < 100; i++)
        {
            used[i] = false;
            rings[i] = 0;
            G[i].clear();
        }
     
        for(int i = 0; i < N; i++)
        {
            scanf("%d", &A); A--;
            scanf("%d", &B); B--;
         
            G[A].push_back(B);
            G[B].push_back(A);
        }
         
        for(int i = 0; i < 100; i++)
        {
            rings[i] = G[i].size();
        }
         
        int nodes = 0;
         
        for(int i = 0; i < 100; i++)
        {
            if(rings[i])
            {
                nodes++;
            }
        }
     
        int ret = 0;
     
        for(int i = 0; i < 100; i++)
        {
            ret = max(ret, rec(i));
                 
            if(ret == nodes) { break; }
        }
         
        printf("%d\n", ret);
    }
     
    return 0;
}

Measured memory_bytes: 3180
#include "bits/stdc++.h"

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;

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

	int ans = 0;
	for (int i = n; i > 0; i--) {
		string s = to_string(i);
		int si = s.size();
		if (si % 2 == 1) {
			ans++;
		}
	}
	c(ans);
	return 0; 
}


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

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

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin >> s >> t;
    int ns=s.size();
    int nt=t.size();
    int ans=INT_MAX;

    for(int i = 0; i <= ns-nt; i++) {
        int cnt=0;
        for(int j = 0; j < nt; j++) {
            if(s[i+j]!=t[j]) cnt++;
        }
        ans=min(ans,cnt);
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3596
def main():
  import sys
  import math
  input = sys.stdin.readline
  a,b=map(int,input().split())
  if b>=10:
    for i in range(b*10,b*10+10):
      if a==math.floor(i*0.08):
        print(i)
        exit()
    print(-1)
  else:
    for i in range(b*10,b*10+10):
      if a==math.floor(i*0.08):
        print(i)
        exit()
    print(-1)
if __name__=='__main__':
  main()

Measured memory_bytes: 3060
n = gets.to_i
heights = gets.split.map(&:to_i)
ans = 0
h_left = 0
tmp = 0
heights.each do |h|
  if h_left >= h
    tmp += 1
  else
    tmp = 0
  end

  ans = tmp if ans < tmp
  h_left = h
end
puts ans

Measured memory_bytes: 8580
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <random>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
#include <random>
using namespace std;
using LL = long long;


template<typename T>
class BIT {
private:
	vector<T>arr;
	int siz;
public:
	BIT(int n) :siz(1) {
		while (siz < n)siz *= 2;
		arr.resize(siz + 1);
	}
	//[0,x)までの和を取得する
	T query(int x) const {
		T s = 0;
		while (x > 0) {
			s += arr[x];
			x -= (x & -x);
		}
		return s;
	}
	//xに値kを加算する
	void add(int x, const T& k) {
		++x;
		while (x <= siz) {
			arr[x] += k;
			x += (x & -x);
		}
	}
};

const LL MOD = 998244353;

int main() {
	int N, K;
	cin >> N >> K;
	vector<pair<int, int>>kukan;
	BIT<LL> tree(N + 100);
	for (int i = 0; i < K; i++) {
		int a, b;
		cin >> a >> b;
		kukan.push_back({ a,b });
	}
	tree.add(0, 1);
	LL last = 0;
	for (int i = 1; i < N; i++) {
		LL now = 0;
		for (auto p : kukan) {
			int lo = i - p.second;
			int hi = i - p.first + 1;
			lo = max(0, lo);
			hi = max(0, hi);
			now += tree.query(hi) - tree.query(lo);
		}
		now %= MOD;
		tree.add(i, now);
		last = now;
	}
	cout << last << endl;
	return 0;
}

Measured memory_bytes: 5380
import re
for i in range(int(input())):
 s=input().replace(" ","")
 print(re.sub(r'0.','',''.join([i+j for(i,j)in zip(str(10000+sum([eval(i[0]+'0'*'ixcm'.find(i[1]))for i in['1'+i for i in''.join(re.split(r'\d\w',s))]+re.findall(r'\d\w',s)])),list('1mcxi'))]).replace('1','')))

Measured memory_bytes: 6584
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
BC = [list(map(int, input().split())) for i in range(M)]
BC = sorted(BC, key=lambda x: -x[1])
i = 0
for B, C in BC:
    for _ in range(B):
        if i < N and A[i] < C:
            A[i] = C
            i += 1
        else:
            print(sum(A))
            exit()
print(sum(A))


Measured memory_bytes: 36936
object Main extends App {

  import scala.annotation.tailrec
  import scala.math.max

  val n = scala.io.StdIn.readLine.toInt
  val a = scala.io.StdIn.readLine.split(" ").map(_.toInt)

  @tailrec
  def gcd(x: Int, y: Int): Int = {
    if (y == 0) {
      x
    } else
      gcd(y, x % y)
  }

  var rr = new Array[Int](n)
  var ll = new Array[Int](n)
  rr(0) = a(0)
  ll(n - 1) = a.last

  (1 until n).foreach { i =>
    rr(i) = gcd(rr(i - 1), a(i))

    ll(n - 1 - i) = gcd(ll(n - i), a(n - 1 - i))
  }

  var ans = List(rr(n - 2), ll(1)).max

  (1 until n - 1).foreach { i =>
    ans = max(ans, gcd(rr(i - 1), ll(i + 1)))
  }

  println(ans)
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<fixed;
	cout<<setprecision(10);
double a,b,h,m;
cin>>a>>b>>h>>m;

double deg_h =((h*360)/12)*(M_PI/180.0)+((m*30)/60)*(M_PI/180.0);
double deg_m =((m*360)/60)*(M_PI/180.0);
double hx=a*sin(deg_h);
double hy=a*cos(deg_h);
double mx=b*sin(deg_m);
double my=b*cos(deg_m);

double dist=sqrt((hx-mx)*(hx-mx)+(hy-my)*(hy-my));
cout<<dist;

 return 0;
}


Measured memory_bytes: 4168
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

#define ll long long
#define ull unsigned long long
#define all(a) (a).begin(), (a).end()

int main() {
	int h, w;
	while (cin >> h >> w && h > 0) {
		string a, b;
		for (int i = 0; i < w; ++i) {
			a += (i % 2 == 0) ? '#' : '.';
			b += (i % 2 == 1) ? '#' : '.';
		}
		for (int i = 0; i < h; ++i)
			if (i % 2 == 0)
				cout << a << endl;
			else
				cout << b << endl;
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3148
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    string s;
    cin >> s;
    if(s.find('a') != string::npos && s.find('b') != string::npos &&s.find('c') != string::npos) cout <<"Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

#define ll long long

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

  vector<int> v(n);
  for(int i=0; i<n; ++i) cin >> v.at(i);

  if(n<3){
    cout << 0 << endl;
    return 0;
  }

  int sum=0;
  for(int i=0; i<n; ++i)
    for(int j=i+1; j<n; ++j)
      for(int k=j+1; k<n; ++k)
      {
        if(v[i]==v[j] || v[j]==v[k] || v[k]==v[i]){continue;}
          if(v[i]+v[j] > v[k] && v[j]+v[k] > v[i] && v[k]+v[i] > v[j]) ++sum;
      }
  cout << sum << endl;
}

Measured memory_bytes: 3580
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
    int n,a,b;
    cin>>n>>a>>b;
    if(!((b-a)%2))cout<<"Alice"<<endl;
    else cout<<"Borys"<<endl;
    return 0;
    }


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
template <typename T>
T gcd(T m, T n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main(){
  ll N,K;
  string S;
  cin>>S>>K;
  reverse(S.begin(),S.end());
  vector<vector<ll>> dp(S.size(),vector<ll>(8,0));//溢れない,0,1,2,3,
  dp[0][0]=1;
  int c=S[0]-'0';
  dp[0][1]=c;
  dp[0][1+4]=9-c;  
  for(ll i=1;i<S.size();++i){
    c = S[i]-'0';
    FOR(j,2){
      FOR(k,4){
        if(j==0){
          if(c!=0){
            dp[i][k]+=dp[i-1][k];
            dp[i][k]+=dp[i-1][4+k];
          }else{
            dp[i][k]+=dp[i-1][k];
            dp[i][4+k]+=dp[i-1][4+k];
          }
        }else{
          
        }
        if(k!=0){
          if(j==0){
            dp[i][k]+=dp[i-1][k-1]*(c);
            if(c!=0){
              dp[i][k]+=dp[i-1][4+k-1]*(c-1);
            }
          }else{
            dp[i][4+k]+=dp[i-1][k-1]*(9-c);
            if(c!=0){
              dp[i][4+k]+=dp[i-1][4+k-1]*(9-c+1);
            }else{
              dp[i][4+k]+=dp[i-1][4+k-1]*(9);
            }
          }
        }
      }
    }
  }
  cout<<dp[S.size()-1][K]<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const ll mod=1e9 +7;
#define vi vector<int>
#define pb emplace_back
ll poww(ll n,ll x)
{
    ll res=1;
    
    while(x>0)
    {
        if(x&1)
          res*=n;
        
        x=x>>1;
        n*=n;
    }
    return res;
}

ll parent[2000005];
ll size1[2000005];
int find(int node)
{
	if(parent[node]<0)
	  return node;
	 
	return parent[node]= find(parent[node]);
}

void union1(ll a,ll b)
{
	a=find(a);
	b=find(b);
	
	
	if(a!=b)
	{
		 if(size1[a]>size1[b])
	      swap(a,b);
	    
	    size1[a]+= size1[b];
		parent[b]=a;
	}
	   
}


int main() 
{
	   ios::sync_with_stdio(0);
	   cin.tie(0);
	   cout.tie(0);
       
       ll n,m,x,y;
       cin>>n>>m;
       for(int i=0;i<n;i++)
       {
       	  parent[i]=-1;
       	  size1[i]=1;
       }
       
       while(m--)
       {
       	cin>>x>>y;
       x--,y--;
       	union1(x,y);
       }
       
       map<ll,ll> mp1;
       for(int i=1;i<=n;i++)
       {
       	//cout<<parent[i]<<' ';
       	mp1[parent[i]]++;
       }
      // cout<<endl;
       
       ll mx=0;
       for(int i=0;i<n;i++)
           mx=max(size1[i],mx);
       cout<<mx;
//        
       
}

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

int main() {
  int n, t;
  scanf("%d", &n);
  set<int> a;
  for(int i = 0; i < n; i++) {
    scanf("%d", &t);
    a.insert(t);
  }
  printf("%d\n", a.size() - (a.size() + 1) % 2);
}

Measured memory_bytes: 4992
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>

using namespace std;

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

    if(N >= 100){
        N = N - ((N / 100) * 100);
    }
    if(N >= 10){
        N = N - ((N / 10) * 10);
    }

    if(N == 2 || N == 4 || N == 5 || N == 7 || N == 9){
        cout << "hon" << endl;
    }
    if(N == 0 || N == 1 || N == 6 || N == 8){
        cout << "pon" << endl;
    }
    if(N == 3){
        cout << "bon" << endl;
    }

    return 0;
}

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

pair<string, pair<int, int> > a[110];

int main() {

    ios::sync_with_stdio(false) ;
    cin.tie(0) ;
    cout.tie(0) ;

    int n ;
    cin >> n ;

    for(int i = 0, t; i < n; i++){

        string s ;
        cin >> s >> t ;
        a[i] = {s,{-t, i+1}} ;

    }
    sort(a, a+n) ;
    for(int i = 0; i < n; i++){

        cout << a[i].second.second << '\n' ;

    }

}


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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define MOD 1000000007



int main() {
    int N; cin >> N;
    vi H(N);
    rep(i,N) cin >> H[i];
    vi move(N-1,0);
    rep(i,N-1){
        if(H[i] >= H[i+1]) move[i] = 1;
    }
    int ans = 0;
    int tmp = 0;
    rep(i,N-1){
        if(move[i] == 1) tmp++;
        if(move[i] == 0 || i == N-2){
            ans = max(ans,tmp);
            tmp = 0;
        }
    }
    cout << ans << endl;

}





Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
using namespace std;
ll binpow(ll x,ll y)/* (x^y)%p in O(log y) */{ll res=1;while (y > 0){if(y&1)res=(res*x);y = y>>1;x=(x*x);}return res;}
ll binpowmod(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpowmod(n,p-2,p);}
ull gcd(ull x,ull y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
bool comp(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
bool comp_pairs_by_s(pair<ll,ll> &x ,pair<ll,ll> &y)
{
    return x.second<y.second;
}
bool isPowerOfTwo (ll x)  
{  
    /* First x in the below expression is for the case when x is 0 */
    return x && (!(x&(x-1)));  
}

class cmp      //comparator for priority_queue 
{               //declaration: priority_queue<int,vector<int>,cmp>
public:         
    bool operator()(pair<int,int> A,pair<int,int> B)
    {
        if(abs(A.first-A.second)==abs(B.first-B.second))
            return A.first>B.first;
        return abs(A.first-A.second)<abs(B.first-B.second);
    }
};
// int prime[100005]={0};
// void sieve(void)
// {
//  int i,j;
//  for(i=0;i<100005;i++)
//         prime[i]=1;
//  prime[0]=0,prime[1]=0;
//  for(i=2;i<=sqrt(100005);i++){
//      if(prime[i]){
//          for(j=i*i;j<100005;j+=i){
//              prime[j]=0;
//          }
//      }
//  }
    
// }
void swap(int &x,int &y){
    int temp=x;
    x=y;
    y=temp;
}
vector<int> scnt[26];
void solve()
{   
    string s,t;
    int c;
    cin>>s>>t;
    for(int i=0;i<26;i++){
        char ch='a'+i;
        for(int j=0;j<s.length();j++){
            if(s[j]==ch)
                scnt[i].push_back(j);
        }
    }
    for(char c: t){
        if(scnt[c-'a'].size()==0){
            cout<<-1;
            return;
        }
    }
    ll ss=0;
    for(int i=0;i<t.length();){
        c=t[i]-'a';
        int prev_index=INT_MIN;
        auto it=upper_bound(scnt[c].begin(),scnt[c].end(),prev_index);
        ss++;
        while(it!=scnt[c].end()){
            i++;
            if(i==t.length()){
                cout<<(ss-1)*s.length()+*it+1;
                return;
            }
            c=t[i]-'a';
            prev_index=*it;
            it=upper_bound(scnt[c].begin(),scnt[c].end(),prev_index);
        }
    }
    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}


Measured memory_bytes: 1228
S=input()
a=["dream","dreamer","erase","eraser","dreamerase","dreameraser"]

numlist=[0,0,0,0,0,0]
for i in range(len(a)):
    numlist[i]=S.count(a[i])
numlist[0]-=numlist[1]
numlist[2]-=numlist[3]
numlist[4]-=numlist[5]
numlist[1]-=(numlist[4]+numlist[5])   #誤ってdreamerで数えた分を
numlist[0]+=(numlist[4]+numlist[5])   #dreamに計上しなおす
total=numlist[0]*5+numlist[1]*7+numlist[2]*5+numlist[3]*6
if total==len(S):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    long n, m, p, a;
    cin >> n >> m >> p;
    long rui[2*m+1], sum = 0;
    fill(rui, rui+2*m+1, 0);
    for (long i=0; i<n-1; i++) {
        p %= m;
        cin >> a;
        if (a < p) a += m;
        sum += a - p;
        rui[p+1] += -1;
        rui[a]   += a - p;
        rui[a+1] += p - a + 1;
        p = a;
    }
    for (int i=1; i<=2*m; i++)
        rui[i] += rui[i-1];
    for (int i=1; i<=2*m; i++)
        rui[i] += rui[i-1];
    long dif = 0;
    for (int i=1; i<=m; i++)
        dif = min(dif, rui[i] + rui[i+m]);
    cout << dif + sum << '\n';
    return 0;
}

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

string s;
double ans,x;

int main()
{
	int n;
	cin>>n;
	for (int i=1; i<=n; ++i)
	{
		cin>>x>>s;
		if (s=="JPY") ans+=x;
		else ans+=x*380000;
	}
	printf("%.5lf",ans);
}

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

int main() {
  char c;
  cin >> c;
  string v = "aeiou";
  bool flg = false;
  
  for (int i = 0; i < v.size(); i++) {
    if (v.at(i) == c) {
      flg = true;
      break;
    }
  }
  cout << (flg ? "vowel":"consonant") << endl;
}


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

char c[MAXN];

int cnt[200];

void solve(){
	scanf("%s", &c[0]);
	ll ans = 1ll;
	for(int i = 0; c[i]; i++) {
		ans += i - cnt[c[i]];
		cnt[c[i]]++;
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 384
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    m1, d1 = rli()
    m2, d2 = rli()
    if m1 != m2:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
ll gcd(ll x, ll y) {
    if (y == 0) return x;
    return gcd(y, x % y);
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
/* main */
int main(){
    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << '\n';
}


Measured memory_bytes: 256
####以下カンニング####
n, m = map( int, input().split() )
connect = {}

for _ in range( m ):
    a, b = map( int, input().split() )
    try:
        connect[ a ].append( b )
    except KeyError:
        connect[ a ] = [ b ]
    try:
        connect[ b ].append( a )
    except KeyError:
        connect[ b ] = [ a ]

queue = [ 1 ]
guide = [ -1 ] * ( n+1 )
visited = [ False ] * ( n+1 )

while queue:
    x = queue.pop(0)
    for y in connect[ x ]:
        if visited[ y ] == False:
            queue.append( y )
            guide[ y ] = x
            visited[ y ] = True

print( "Yes" )
for x in range( 2, n+1 ):
    print( guide[x] )

Measured memory_bytes: 40592