akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
int h,w,n;
vector<string> s;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
bool is(int x,int y){
	return 0<=x&&x<h&&0<=y&&y<w;
}
bool allclear(vector<string> s){
	bool update=true;
	while(update){
		update=false;
		vector<string> ns(h,string(w,'.'));
		rep(j,w){
			int cnt=h-1;
			for(int i=h-1;i>=0;i--){
				if(s[i][j]!='.') ns[cnt--][j]=s[i][j];
			}
		}
		s=ns;
		bool e[30][30]={};
		rep(i,h) rep(j,w) rep(d,4){
			char c=s[i][j];
			if(c=='.') break;
			int x=i,y=j,cnt=0;
			while(is(x,y)&&s[x][y]==c) x+=dx[d],y+=dy[d],cnt++;
			if(cnt>=n){
				x=i;y=j;
				rep(k,cnt) e[x][y]=true,x+=dx[d],y+=dy[d];
			}
		}
		rep(i,h) rep(j,w) if(e[i][j]){
			update=true;
			s[i][j]='.';
		}
	}
	rep(i,h) rep(j,w) if(s[i][j]!='.') return false;
	return true;
}
int main(){
	cin>>h>>w>>n;
	rep(i,h){
		string hoge;
		cin>>hoge;
		s.pb(hoge);
	}
	vector<string> sc=s;
	bool can=false;
	rep(i,h) rep(j,w-1){
		s=sc;
		swap(s[i][j],s[i][j+1]);
		if(allclear(s)) can=true;
	}
	if(can) puts("YES");
	else puts("NO");
}

Measured memory_bytes: 1204
/*
問題の名称：Princess'sMarriage
問題のURL:http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=3534922#3
所要時間：30分
学んだこと：pairの宣言、ソートなど
*/
#include <iostream>
#include <utility>
#include <algorithm>
using namespace std;
int main()
{
	int N,M;

	//DとPのペアDPの宣言
	pair<int,int> DP[10000];
	while ((cin >> N >> M) && (N > 0))
	{
		for (int i = 0; i < N; ++i)
		{
			cin >> DP[i].first >> DP[i].second;

			//Pの大きさでソートしたいのでPをfirstに
			swap(DP[i].first,DP[i].second);
		}

		//降順にソート
		sort(DP,DP+N);
		reverse(DP,DP+N);

		int ans = 0;

		for (int i = 0; i < N; ++i) //Pの大きいところから護衛を雇う
		{
			if (M >= DP[i].second) //お金が十分にあるときは護衛を次の宿場まで雇える
			{
				M -= DP[i].second;
			}
			else if (M > 0) //中途半端な時は所持金の限り雇う 残りは期待値を加算
			{
				ans += DP[i].first * (DP[i].second - M); 
				M = 0;
			}
			else //お金がないときはそのまま期待値を加算
			{
				ans += DP[i].first * DP[i].second;
			}
		}

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


Measured memory_bytes: 3120
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;

public class Main {
  public static void main(String[] args)throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] a = new int[n];
    boolean flg = true;
    for(int i=0; i<n; i++) {
      a[i] = Integer.parseInt(str[i]);
    }
    Arrays.sort(a);
    for(int i=0; i<n-1; i++) {
      if(a[i] == a[i+1])
        flg = false;
    }
    System.out.println(flg==true?"YES":"NO");
  }
}

Measured memory_bytes: 48604
#include <stdio.h>

int main()
{
  int a[100],i,d,min=1000000000,max=0;
  scanf("%d",&d);
  for(int i=1;i<=d;i++){
  scanf("%d",&a[i]);
  }
      for(i = 1;i <= d;i++){
      if(a[i]>max){
          max=a[i];
      }
  }
  for(i=1;i<=d;i++){
      if(a[i]<min){
          min=a[i];
      }
  }
  printf("%d",max-min);
    return 0;
}


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

const int INF = 1000000000;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  int ans = INF;
  for (int p = 1; p <= 100; p++) {
    int sum = 0;
    for (auto xi : x) {
      sum += (xi - p) * (xi - p);
    }
    ans = min(ans, sum);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3648
def main():
    n,m = (int(x) for x in input().split())
    h = [int(x) for x in input().split()]
    r = [[h[i]] for i in range(n)]
    for i in range(m):
        a,b = (int(x)-1 for x in input().split())
        r[a].append(h[b])
        r[b].append(h[a])

    cnt = 0
    for i in range(n):
        if max(r[i]) == h[i] and r[i].count(h[i]) == 1:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 26032
#include <iostream>
 
using namespace std;
 
int main(){
  
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
  int H,N;
  cin>>H >> N;
  int damage  = 0;
  int x = 0;
  for(int i=0;i<N;i++){
  	cin >> x;
    damage += x;
  }
  
  if(damage >= H){
  	cout << "Yes"<<endl;
  }else{
  	cout<< "No"<<endl;
  }
  
  return 0;
}	


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
struct node{
	string t;
	int s;
	int d;
}a[105];
int cmp(node a,node b){
	if(a.t==b.t) return a.s>b.s;
	return a.t<b.t;
}
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].t;
		cin>>a[i].s;
		a[i].d=i;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++) cout<<a[i].d<<endl;
	return 0;
}

Measured memory_bytes: 256
/*
 *  Created on: 2 / 8 / 2020
 *  Author:     Eslam Waheed
 */

#define _CRT_SECURE_NO_WARNINGS
//#define __USE_MINGW_ANSI_STDIO

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

#define Eslam__Waheed ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

#define ll   long long
#define ull  unsigned ll
#define dd   double
#define ld   long dd
#define ss   string

#define pb      push_back
#define all(c)  c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define stp(n)  cout << fixed << setprecision(n);
#define iq(v)   v.resize(unique(v.begin(),v.end())-v.begin())
#define sz(s)   (ll)(s.size())
#define endl    '\n'

#define loop(i,m,n)  for(ll i=m;i<n;i++)
#define test(t)      while(t--)

//ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }

//const ld PI = acos(-1);
//const ll mod = 1e9 + 7;
//const ld EPS = 1e-8;
/*
 you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )
*/
int main()
{
	//stp(0)
	Eslam__Waheed;
	ll x; cin >> x;
	ss s; cin >> s;
	ll r = count(all(s), 'R'), a = 0;
	loop(i, 0, r)
	{
		if (s[i] == 'R')a++;
	}
	if (a > 0)
		cout << r - a;
	else
		cout << r;
}

Measured memory_bytes: 3704
/* 
 * Project: AtCoder Beginners Contest 139 C - Lower
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/08/26
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
#include <cstdint>
#include <vector>
using namespace std;

uint32_t n;
vector<uint64_t> h;

void solve() {


    uint32_t max_cnt = 0;
    for (auto i=h.begin();i<h.end();i++) {
        uint32_t cnt = 0;
        auto iter = i;
        while (*iter >= *next(iter) && iter < h.end()-1) {
            cnt++;
            iter++;
        }
        max_cnt = max(max_cnt, cnt);
        if (iter == h.end()-1) {
            break;
        }
    }

    printf("%d\n", max_cnt);
}

int main() {

    scanf("%d", &n);
    h.resize(n);
    for (int i=0;i<n;i++) {
        scanf("%lld", &h[i]);
    }

    solve();
}

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

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

  int n;
  cin >> n;
  int f[110][10];
  int p[110][11];
  rep(i, n) {
    rep(j, 10) cin >> f[i][j];
  }
  rep(i, n) {
    rep(j, 11) cin >> p[i][j];
  }

  ll ans = -(1<<30);
  FOR(mask, 1, 1<<10) {
    ll res = 0;
    rep(i, n) {
      ll cnt = 0;
      rep(j, 10) {
        if ((mask & (1 << j)) && (f[i][j] == 1)) {
          cnt++;
        }
      }
      //cerr << p[i][cnt] << endl;
      res += p[i][cnt];
    }
    ans = max(ans, res);
  }
  cout << ans << endl;
}

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

int n, m, a;

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

	for (int i = 0; i < m; i++) {
		cin >> a;
		n -= a;
	}

	if (n < 0)
		cout << -1 << endl;
	else
		cout << n << endl;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int l,r;
  cin >> n;
  int ans = n;

  REP(i,n){
      cin >> l >> r;
      ans -= l;
      ans += r;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int count1(int a)
{
    int ans=0;
    while(a)
    {
        ans+=a%10;
        a=a/10;
    }
    return ans;
}
int main()
{
    int  n;
    cin>>n;
   int mi=100000;
   for(int i=1;i<n;i++)
   {
     mi=min(mi,count1(i)+count1(n-i));

   }
    cout<<mi<<endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ff first
#define ss second
#define ll long long
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define repr(i, a, n) for (ll i = (n); i >= (a); --i)
using namespace std;
const int INF(1 << 30);
const ll LLINF(1LL << 55LL);
const int pi = 3.1415926536;
const int MOD = 1000000007;
const int MAX = 510000;

void Main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int L = a + b, R = c + d;
  if (L > R) {
    puts("Left");
  } else if (L < R) {
    puts("Right");
  } else {
    puts("Balanced");
  }
}

int main() {
  std::cin.tie(nullptr);                  // 標準入出力高速化
  std::ios_base::sync_with_stdio(false);  // CとC++の入出力出力を非同期
  std::cout << std::fixed << std::setprecision(15);  // 小数を10進数表示
  Main();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1,n,a,b,m1,d1,m2,d2;
    //cin>>t;
    while(t--){
        cin>>n;
        ll lb=1,ub=5e4,flag=0,mid=0;
        while(lb<=ub){
            mid=(lb+ub)/2;
            ll temp=mid*1.08;
            if(temp==n){
                flag=1;
                break;
            }
            else if(temp>n){
                ub=mid-1;
            }
            else
                lb=mid+1;
        }
        if(flag)
            cout<<mid;
        else
            cout<<":(";
   }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> adj[200'001];
bool seen[200'001];
int d[200'001];
int main() {
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    queue<int> q;
    q.push(1);
    memset(seen, false, sizeof seen);
    memset(d, -1, sizeof d);
    seen[1] = true;
    d[1] = 0;
    while(!q.empty()) {
        int u = q.front();
        q.pop();
        for(int v : adj[u]) {
            if(!seen[v]) {
                seen[v] = true;
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }
    cout << (d[n] == 2 ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}


Measured memory_bytes: 13424
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String n = input.next();
        int ans = 0;
        for (int i = 0; i < n.length(); i++){
            if (n.charAt(i) == '2'){
                ans += 1;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
from sys import stdin
A,B = list(map(int,stdin.readline().strip().split()))
ans=10**4+1
for x in range(10**4,0,-1):
    if int(x*0.08)==A and int(x*0.1)==B:
        if ans>x:ans=x
if ans==10**4+1:ans=-1
print(ans)

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

using ll = long long;
// #define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))

const int MAX = 200000000;
/***** MAIN *****/
signed main() {
  int H, N;
  cin >> H >> N;
  int power[N], mp[N];
  REP(i,N) {
    cin >> power[i] >> mp[i];
  }
  int lowest_mp[H+1];
  REP(i,H+1) {
    if(i == 0) lowest_mp[i] = 0;
    else lowest_mp[i] = MAX;
  }
  REP(h,H+1) {
    REP(waza, N) {
      int new_d = h + power[waza];
      new_d = min(new_d, H);
      lowest_mp[new_d] = min(lowest_mp[new_d], lowest_mp[h]+mp[waza]);
    }
  }
  cout << lowest_mp[H];
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
using namespace std;
using ll=long long;
#define MOD  1000000007

int main(int argc, char const *argv[]) {
  int n,l;
  std::cin >> n >> l;
  string s[n];
  for(int i=0; i<n; i++) std::cin >> s[i];
  sort(s,s+n);
  for(int i=0; i<n; i++) std::cout << s[i] ;
  std::cout  << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100100100100100100;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;


string  L;
ll N;
ll dp[200010][2];

int main(){
    cin >> L;
    N = L.size();
    dp[0][0] = 1;
    rep(i,N){
        if(L[i] == '1'){
            dp[i+1][1] += dp[i][1] * 3 + dp[i][0];
            dp[i+1][0] += dp[i][0] * 2;
        }else{
            dp[i+1][1] += dp[i][1] * 3;
            dp[i+1][0] += dp[i][0];
        }
        dp[i+1][0] %= MOD;
        dp[i+1][1] %= MOD;
    }
    cout << (dp[N][1] + dp[N][0]) % MOD << endl;
}


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

int debug = 1;

int main(){
    int n,k;
    cin >> n >>k;
    vector<int> flag(n+1,1);
    flag[0]=0;

    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int who;
            cin >> who;
            flag[who]=0;
        }
    }
    
    int ans=0;
    rep(i,n+1){
        ans += flag[i];
    }

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

Measured memory_bytes: 3628
#include<stdio.h>

int sol(int,int);

int A[2000],m[2000],n;
int main(){
  int q,judge,i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
  }

  for(i=0;i<q;i++){  
    judge=sol(0,m[i]);
    if(judge==1) printf("yes\n");
    if(judge==0) printf("no\n");
  }

  return 0;
}

int sol(int i,int m){
  int res,j;
  if(m==0) return 1;
  if(i>=n) return 0;
 
  res=sol(i+1,m-A[i]) || sol(i+1,m);

  return res;
  
  
}

  
    

  



Measured memory_bytes: 2104
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]

x, y = map(int,input().split())

if x in a and y in a:
  print("Yes")
elif x in b and y in b:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
const ll INF = 1e18L + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  string s; cin >>s;
  auto isEvenStr = [](string t) {
    int mid=t.length()/2;
    for (int i=0; i<mid; i++) {
      if (t[i]!=t[i+mid]) return false;
    }
    return true;
  };
  int j = 1;
  while(1) {
    string t = s.substr(0, s.length()-2*j);
    if (isEvenStr(t)) {
      cout << t.length() << endl; return 0;
    }
    j++;
  }
  return 0;
}

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

int main()
{
    int n;
    cin>>n;
    vector<int>v(n);
    int i,j,k;
    for(i=0;i<n;i++)
    {
      cin>>v[i];
    }
    int m;
    cin>>m;
    vector<int>v2(m);
    for(i=0;i<m;i++)
    {
        cin>>v2[i];
    }
    cout<<includes(v.begin(),v.end(),v2.begin(),v2.end())<<endl;
    return 0;
}



Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  while (B <= A and K > 0) {
    B *= 2;
    --K;
  }
  while (C <= B and K > 0) {
    C *= 2;
    --K;
  }
  if (A < B and B < C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3088
//IncubatorMan
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
#define All(x) (x).begin(),(x).end()
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
        int test=1;
        //read(test);
        //cin>>test;
        while(test--){
            solve();
        }
    return 0;
}

Measured memory_bytes: 3628
n = int(input())
f=[]
p=[]
for _ in range(n):
    f.append(list(map(int,input().split())))
for _ in range(n):
    p.append(list(map(int,input().split())))
ans = -(10**10)
for i in range(1,2**10):
    x=0
    binary=format(i,"010b")
    for j in range(n):
        cnt=0
        for k in range(10):
            if binary[k]=="1" and f[j][k]==1:
                cnt+=1
        x += p[j][cnt]
    ans = max(ans,x)
print(ans)

Measured memory_bytes: 3188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <random>
#include <utility>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <sstream>
#define REP(i,x) for(int i=0; i<(x); i++)
typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
    int a[3];
    cin >> a[0]>>a[1]>>a[2];
    int c=0;
    while (a[0]!=a[1]||a[1]!=a[2]) {
        
        sort(a, a+3);
        
        if (a[0]<=a[2]-2) {
            a[0]+=2;
        }else if (a[1]<=a[2]-2){
            a[1]+=2;
        }else if (a[0]==a[1]){
            a[0]++;
            a[1]++;
        }else if (a[1]==a[2]){
            a[0]+=2;
        }
        c++;
    }
    cout << c <<endl;
    
    return 0;
}

Measured memory_bytes: 256
# include<iostream>
# include<stdio.h>

using namespace std;
int main(void){
	int i, j, n, no;
	char mark;
	int card[4][14];
		cin >> n;
	for (i = 0; i < n; i++){
		cin >> mark >> no;
		switch (mark){
		case 'S':
				card[0][no] = 99;
				break;
		case 'H':
				card[1][no] = 99;
				break;
		case 'C':
				card[2][no] = 99;
				break;
		case 'D':
				card[3][no] = 99;
				break;
		}
	}
	for (i = 0; i < 4; i++){
		for (j = 1; j <= 13; j++){
			if (card[i][j] != 99){
				switch (i){
				case 0:printf("S %d\n", j); break;
				case 1:printf("H %d\n", j); break;
				case 2:printf("C %d\n", j); break;
				case 3:printf("D %d\n", j); break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000000+7;
const long long INF=-mod;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
//ショートカット
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,k,n) for(int i=k;i<n;i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
//入力
#define vin(v,N) for(long long i=0;i<N;i++) cin>>v.at(i)
#define lin(n) long long n;cin>>n
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m,long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m,long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x,long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//nCr
long long C(long long n, long long r);
//nCr (mod)
long long modC(long long n, long long r) {
    vector<long long> f(n+1),inv(n+1),invf(n+1);
    f[0]=f[1]=1;
    invf[0]=invf[1]=1;
    inv[1]=1;
    for (long long i=2;i<n+1;i++) {
        f[i]=(i*f[i-1])%mod;
        inv[i]=mod-((mod/i)*inv[mod%i])%mod;
        invf[i]=(inv[i]*invf[i-1])%mod;
    }
    long long cmb=f[n]*(invf[r]*invf[n-r]%mod)%mod;
    if (n>=r) return cmb;
    else return 0;
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(10);
  
  lin(N);lin(K);
  lin(A);
  ll M=A;
  rep(i,N-1){
    lin(a);
    A=gcd(A,a);
    M=max(M,a);
  }
  
  if(K%A==0 && M>=K)
    cout<<"POSSIBLE";
  else
    cout<<"IMPOSSIBLE";
  //cout<<endl<<M<<" "<<A;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

ans = 0
for b in range(1, N+1): #bを全探索
    amari = max(b-K, 0)
    count = N // b
    # print ('b=', b)
    # print (count * amari + max(N%b - K + 1, 0))
    ans += count * amari + max(N%b - K + 1, 0)

if K == 0:
    ans -= N
print (ans)





#以下単純な全探索O(N^2)となり間に合わない
# count = 0
# for a in range(1,N+1):
#     for b in range(1,N+1):
#         if a%b >= K:
#             count += 1

# print (count)


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int r,n;
  while(1){
    cin>>r>>n;
    if(r==0)break;
    int height[50]={};
    int p=25;
    rep(i,n){
      int x,y,h;
      cin>>x>>y>>h;
      for(j=x+p;j<y+p;j++)height[j]=max(height[j],h);
    }

    double ok=0.0;
    double ng=21.0;
    rep(i,100){
      double t=(ok+ng)/2;//太陽の中心は(p,t-r)
      bool c=true;
      for(j=0;j<50;j++){//x座標がjのとき
	int h=min(height[j-1],height[j]);
	if(fabs(p-j)>=r)continue;
	double a=t-r+sqrt(r*r-(p-j)*(p-j));
	//	cout<<j<<" "<<a<<endl;
	if(a >= h)c=false;
      }
      if(c)ok=t;
      else ng=t;
      // cout<<shosu(6)<<ok<<" "<<ng<<endl;
    }
    cout<<shosu(6)<<ok<<endl;
  }
}



Measured memory_bytes: 3188
#include <iostream> // cout, endl, cin
#include <iomanip>
#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 <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;
const int BG = 1000000007;

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

    if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0)
    {
        cout << "Possible" << endl;
    }
    else
    {
        cout << "Impossible" << endl;
    }
}


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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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


struct UnionFind{
    vector<int> par;
    UnionFind(int32 n){
        par = vector<int>(n, -1);
    }

    int root(int x){
        if(par[x] < 0)return x;
        return par[x] = root(par[x]);
    }

    bool unite(int x, int y){
        x = root(x);
        y = root(y);
        if(x == y)return false;
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }

    int32 deg(int x){
        return -par[root(x)];
    }
};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n,m;
  cin >> n >> m;
  UnionFind uf(n);
  REP(i,m){
    int32 a,b;
    cin >> a >> b;
    a--;b--;
    uf.unite(a,b);
  }
  int32 ans = 0;
  REP(i,n)chmax(ans, uf.deg(i));
  ANS(ans);
  return 0;
}

Measured memory_bytes: 4612
/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
unsigned long long MOD = 1e9 + 7;
ll INF = 1e18;
long long modMult(long long a, long long b, long long m)
{
    long long res = 0;
    long long exp = a % m;
    while (b)
    {
        if (b & 1)
        {
            res += exp;
            if (res > m)
                res -= m;
        }
        exp <<= 1;
        if (exp > m)
            exp -= m;
        b >>= 1;
    }
    return res;
}
long long powMod(long long a, long long b, long long m)
{
    long long res = 1;
    long long exp = a % m;
    while (b)
    {
        if (b & 1)
            res = modMult(res, exp, m);
        exp = modMult(exp, exp, m);
        b >>= 1;
    }
    return res;
}
//powMod(a,b,MOD)
//O(log(b))?
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> vec(n);
    vector<ll> reg(100,0);
    rep(i, n) {
        cin >> vec[i];
    }
    rep(i, n)
    {
        ll g=pow(2,61);
        for(ll j=61;j>=0;j--)
        {
            if(g<=vec[i]){
                reg[j]++;
                vec[i]-=g;
            }
            g/=2;
        }
    }
    ll res=0;
    ll g=1;
    rep(i, 62)
    {
        ll k=g;
        ll f=reg[i]*(n-reg[i]);
        f%=MOD;
        ll p=k*f%MOD;
        res += p;
        res %= MOD;
        g*=2;
        g%=MOD;
    }
    cout << res%MOD << endl;
}


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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<long long> vll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    ll n;
    cin >> n;
    vll x,y;
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        x.push_back(a);
        y.push_back(b);
    }
    double d=0;
    rep(i,n){
        rep(j,n){
            d+= pow(pow(x[i]-x[j] ,2)+pow(y[i]-y[j] ,2) ,0.5);
        }
    }
    cout << setprecision(10);
    cc(d/n);
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
#include<string.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}


int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	rep(i, n) {
		if (s[i] == '1') cnt++;
	}
	map<int, int> mp;
	mp[0] = 0;
	rep(i, cnt + 10) {
		int ai = i + 1;
		int cnti = 0;
		rep(iiii, 20) {
			if (ai & (1 << iiii)) cnti++;
		}
		mp[ai] = mp[ai % cnti] + 1;
	}
	int cnt1 = cnt + 1;
	int cnt2 = cnt - 1;
	int amari1 = 0;
	int amari2 = 0;
	int amari = 1;
	rep(i, n) {
		int ai = amari * (s[n-1-i] - '0');
		amari1 = (amari1 + ai) % cnt1;
      amari=amari*2%cnt1;
	}
  amari=1;
  if(cnt2!=0){
  rep(i,n){
    int ai=amari*(s[n-1-i]-'0');
    amari2=(amari2+ai)%cnt2;
    amari=amari*2%cnt2;
  }
  }
	rep(i, n) {
		if (s[i] == '0') {
			int amari1i = amari1;
			amari1i += modpow(2, (n - 1 - i), cnt1);
			amari1i %= cnt1;
			cout << mp[amari1i] + 1 << endl;
		}
		else {
          if(cnt2==0){
            cout<<0<<endl;
            continue;
          }
			int amari2i = amari2;
			amari2i -= modpow(2, (n - 1 - i), cnt2);
			amari2i = (amari2i + cnt2) % cnt2;
			cout << mp[amari2i] + 1<<endl;
		}
	}
}


Measured memory_bytes: 8324
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
long long int a[333],b[333],c[333],d[333];

int n,res=-(1<<30);
int f[100][14];
int p[100][15];
int main(){
    cin>>n;
    rep(i,0,n)rep(j,0,10)cin>>f[i][j];
    rep(i,0,n)rep(j,0,11)cin>>p[i][j];
    
    rep(bit,1,(1<<10)){
        int cc=0;
        rep(i,0,n){
          int c=0;
          rep(j,0,10)if((bit>>j & 1)&& f[i][j])c++;
          cc+=p[i][c];
        }
        if(res<cc)res=cc;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, B;
  cin >> N >> A >> B;
  if (N * A > B) {
    cout << B << endl;
  }
  else if (N * A == B) {
    cout << B << endl;
  }
  else {
    cout << N * A << endl;
  }
}

Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

int n;
double ans;
pair<double, double> p[9];

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> p[i].first >> p[i].second;
    sort(p, p + n);
    do {
        for (int i = 1; i < n; ++i)
            ans += sqrt((p[i].first - p[i - 1].first) * (p[i].first - p[i - 1].first) +
                (p[i].second - p[i - 1].second) * (p[i].second - p[i - 1].second));
    } while (next_permutation(p, p + n));
    function<int(int)> f = [&](int x) {
        if (x == 1) return 1;
        return x * f(x - 1);
    };
    printf("%.9lf\n", ans / f(n));
}

Measured memory_bytes: 256
#include <iostream>

#include <algorithm>
#include <cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;
typedef long long LL;

int main() {


	int a, b = 0, c = 0;
	//----------------------
	int n, X, Z;
	int ans = 0;

	string s1;
	string s2;
	string s3;

    cin >> s1;
	cin >> s2;
	cin >> s3;

	cout << s1.at(0)<<s2.at(1)<<s3.at(2) << endl;

	

	//cout << ans << endl;

	//------------------------
	//cin >> Z;

	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if (a % 2 == 0 || b % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	// A
	int n, k;
	cin >> n >> k;
	if ( (n + 1) / 2 >= k) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;	
}

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

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

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

    ll A,B; cin >> A >> B;
    ll C = A+B;
    if(C%2 == 0) cout << C/2 << endl;
    else cout << "IMPOSSIBLE" << endl;

    return 0;

}

Measured memory_bytes: 764
'use strict';
process.stdin.on('data', function(chunk) {
    var inputs = chunk.toString().trim();
    var expressions = inputs.split('\n');
 
    for (var i = 0; i < expressions.length; i++) {
        if (expressions[i] === '0 ? 0') {
            break;
        }
        var expression = expressions[i].split(' ');
        var left = parseFloat(expression[0]);
        var right = parseFloat(expression[2]);
        var op = expression[1];
 
        switch (op) {
            case '+':
                console.log(left + right);
                break;
            case '-':
                console.log(left - right);
                break;
            case '*':
                console.log(left * right);
                break;
            case '/':
                console.log(Math.floor(left / right));
                break;
        }
 
    }
 
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15852
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
sc = []
for i in range(m):
    sc.append([int(i) for i in input().split()])

for i in range(0, 1000):
    tmp = str(i)
    if len(tmp) != n:
        continue
    else:
        flag = True
        for j in range(m):
            if tmp[sc[j][0] - 1] != str(sc[j][1]):
                #print(i, j, 'B')
                flag = False
        if flag:
            print(i)
            exit()
print(-1)


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;



int main() {
	string s;
	cin >> s;
	int l = 0, m = 0, n = 0;
	rep(i, s.size()) {
		if (s[i] == 'a') l++;
		else if (s[i] == 'b') m++;
		else n++;
	}
	int a = max(l, max(m, n));
	int b = min(l, min(m, n));
	if (a - b >= 2) cout << "NO" << endl;
	else cout << "YES" << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(void){
    int L,R,d;
    int count=0;
    scanf("%d %d %d",&L,&R,&d);
    for(int i=L; i<=R; i++){
        if(i%d == 0){
            count++;
        }
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 1728
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    long long int ans;
    int i;
    int n;
    int m;
    
    cin >> n;
    cin >> m;
    ans = 1;
    for(i=0; i<n; i++){
        ans=(ans*(i+1))%1000000007;
    };
    for(i=0; i<m; i++){
        ans=(ans*(i+1))%1000000007;
    };
    if(n==m){
        ans=(ans*2)%1000000007;
    };
    if(n-m!=0 && n-m!=1 && n-m!=-1){
        ans = 0;
    };
    
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main
{

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

		int N = sc.nextInt();

		int [] height;
		height = new int[N+1];

		int[]dp;
		dp = new int[N+1];

		//height入力
		for(int i=1;i<=N;i++)
		{
		height[i]=sc.nextInt();
		}

		//dp初期化
		for(int i=1;i<=N;i++)
		{
		dp[i]=0;
		}

		dp[2]=Math.abs(height[2]-height[1]);

		//dp実行
		for(int j=3;j<=N;j++)
		{
			int k;
			int l;
			k = dp[j-1] + Math.abs(height[j]-height[j-1]);
			l = dp[j-2] + Math.abs(height[j]-height[j-2]);
			dp[j] = min(k,l);
		}
		System.out.println(dp[N]);
	}

	//dp更新用の関数定義
	public static int min(int i,int j)
	{
		 return Math.min(i,j);
	}

}

Measured memory_bytes: 61360
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 ;
int dpA[N], dpB[N] , dpC[N] ,a[N] , b[N] , c[N],n;
int main()
{
    cin >> n ;
    for ( int i = 0 ; i < n ; i++) cin >> a[i] >> b[i] >> c[i];
    dpA[0] = a[0] ;
    dpB[0] = b[0] ;
    dpC[0] = c[0] ;
    for ( int i = 1 ; i < n ; i++) {
        dpA[i] = max(dpB[i-1],dpC[i-1])+a[i] ;
        dpB[i] = max(dpA[i-1],dpC[i-1])+b[i] ;
        dpC[i] = max(dpB[i-1],dpA[i-1])+c[i] ;
    }
    cout << max(dpA[n-1],max(dpB[n-1],dpC[n-1]));
}


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


int main()
{
	//freopen("input16.txt","r",stdin);freopen("output16.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	char a;
	cin>>a;
	if (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'){
		cout<<"vowel";
	}
	else {
		cout<<"consonant";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;
#define PI 3.141592

int main(){
    double a,b,x;
    cin>>a>>b>>x;
    double max=a*a*b;
    double dega=0.0;
    double degb=90.0;
    if(max==x){
        cout<<0<<endl;
        return 0;
    }
    int i=30;
    double deg;
    double ddeg;
    double dx;
    while(i>0){
        deg=(dega+degb)/2.0;
        ddeg=deg*PI/180.0;
        double da=a*sin(ddeg);
        double db=b*sin(PI/2.0-ddeg);
        if(da<db){
            dx=a*(a*b-(a*a*tan(ddeg)/2.0));
        }
        else{
            dx=a*(b*b*tan(PI/2.0-ddeg)/2.0);
        }


        if(dx<x){
            degb=deg;
        }else{
            dega=deg;
        }
        i--;
    }

    cout<<setprecision(10)<<deg<<endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define X first
#define Y second
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define All(x) x.begin() , x.end()
#define mem(aa,x) memset(aa,x,sizeof aa)
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
const int maxn=4e5+5;

main(){IOS
	string s;
	int alp[26]={};
	bool test=0; 
	cin>>s;
	rep(i,0,s.length()-1) alp[s[i]-'a']++;
	rep(i,0,25){
		if(alp[i]==0){
			cout<<char(i+'a')<<"\n";
			test=1;
			break;
		}
	}
	if(!test) puts("None");
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define newline printf ("\n")
#define space printf (" ")
#define cinfalse ios::sync_with_stdio(false)
#define fread(a) freopen (a".in", "r", stdin), freopen(a".out", "w", stdout)
#define rint register int
#define For(i, a, b) for (rint i = a; i <= b; i ++)
#define Low(i, a, b) for (rint i = a; i >= b; i --)
#define FFr(i, a, b, c) for (rint i = a; i <= b; i += c)
#define FLw(i, a, b, c) for (rint i = a; i >= b; i -= c)
#define min(a, b) ((a)>(b)?(b):(a))
#define max(a, b) ((a)>(b)?(a):(b))
#define ll long long
#define MAXN 100005
using namespace std;

ll c;
int x[MAXN], xx[MAXN], w[MAXN];
int l, r, s, t, n, m;
int main()
{
	scanf ("%d%d%d", &n, &l, &t);
	for (rint i = 1; i <= n; i ++) scanf ("%d%d", &x[i], &w[i]);
	for (rint i = 1; i <= n; i ++)
	{
		if (w[i] == 2) w[i] -= 3;
		r = x[i]+w[i]*t;	
		if (r > 0) c += r/l, c %= n;
        else if (r<0) c += (r+1)/l-1, c %= n;
		xx[i]=(r%l+l)%l;
	}
	sort (xx+1, xx+n+1);
	c = (c+n)%n;
	for (rint i = c+1; i <= n; i ++) printf ("%d\n", xx[i]);
	for (rint i = 1; i <= c; i ++) printf ("%d\n", xx[i]);
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>

using namespace std;
int main(){

    char s[100000]={'3'};
    cin>>s;
    int a=0,b=0;

    for(int i=0;i<100000;i++){
        if(i%2==0){
            if(s[i]=='1'){
                a++;
            }
        }
        else{
            if(s[i]=='0'){
                a++;
            }
        }
    }

    for(int i=0;i<100000;i++){
        if(i%2==0){
            if(s[i]=='0'){
                b++;
            }
        }
        else{
            if(s[i]=='1'){
                b++;
            }
        }
    }

    if(a<b)cout<<a<<endl;
    else{cout<<b<<endl;}

    return 0;
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld long double
#define mp make_pair
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define ll long long int
#define pl pair<ll, ll>
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
void solve()
{
    ll n, a, b;
    cin>>n>>a>>b;
    ll ans=0;
    ans=(n/(a+b))*a;
    n%=(a+b);
    if(n>a)
    ans+=a;
    else 
    ans+=n;
    cout<<ans;
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, W;
  cin >> n >> W;
  
  vector<ll> w(n), v(n);
  for (int i = 0; i < n; i++) cin >> w.at(i) >> v.at(i);
  
  vector<vector<ll>> dp(n + 1, vector<ll>(W + 1, -1e18));
  dp.at(0).at(0) = 0;
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= W; j++) {
      dp.at(i + 1).at(j) = dp.at(i).at(j);
      if (j >= w.at(i)) dp.at(i + 1).at(j) = max(dp.at(i + 1).at(j), dp.at(i).at(j - w.at(i)) + v.at(i));
    }
  }
  
  ll ans = 0;
  for (int j = 0; j <= W; j++) ans = max(ans, dp.at(n).at(j));
  
  cout << ans << '\n';
}

Measured memory_bytes: 80256
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        Queue<Integer> q = new PriorityQueue<>();
        SortedMap<Integer, Integer> map = new TreeMap<>(Comparator.reverseOrder());
        for (int i = 0; i < n; i++) {
            q.add(Integer.parseInt(sc.next()));
        }
        for (int i = 0; i < m; i++) {
            int b = Integer.parseInt(sc.next());
            int c = Integer.parseInt(sc.next());
            map.merge(c, b, (v1, v2) -> v1 + v2);
        }
        while (map.size() > 0) {
            int val = map.firstKey();
            int cnt = map.get(val);
            if (q.peek() >= val) {
                break;
            } else {
                q.poll();
                q.add(val);
                if (cnt == 1) {
                    map.remove(val);
                } else {
                    map.replace(val, --cnt);
                }
            }
        }
        System.out.println(q.stream().mapToLong(x -> x).sum());
    }
}

Measured memory_bytes: 71704