akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
    
int dep[1000];
int deg[1000];
int dad[1000]; 
int lef[1000];
int rig[1000]; 
int hei[1000];
int sib[1000];
int in[1000];

int depth(int now,int prev){
  if(deg[now] == 0){
    dep[now] = dep[prev]+1; 
    return 0;
  }
    dep[now] = dep[prev]+1;
    //cout << "now = " << now << ", prev = " << prev << endl;
    //cout << dep[now] << endl;
    if(lef[now] != -1){//cout << "In1" << endl;
    depth(lef[now],now);
    }
    if(rig[now] != -1){//cout << "In2" << endl;
      depth(rig[now],now);
    }

  
}

int heich(int now,int above){
  if(dad[now] == -1)return 0;

  if(hei[now]+1 > hei[above]){  
    hei[above]=hei[now]+1;
    heich(above,dad[above]);
  }

}

int main(){
  int n,id,L,R;
 

  scanf("%d\n",&n);

  for(int i=0;i<1000;i++){
    dad[i]=-1;
    lef[i]=-1;
    rig[i]=-1;
    dep[i]=0;
    hei[i]=0;
    sib[i]=-1;
    deg[i]=0;
  }

  for(int i=0;i<n;i++){ 
    scanf("%d %d %d\n",&id,&L,&R);
    dad[L]=dad[R]=id;
    lef[id] = L;
    rig[id] = R;
    if(!(L==-1 || R==-1)){ 

      sib[L]=R;
      sib[R]=L;
    }
    if(L+R == -2){
      deg[id]=0;
    }
    else if(L == -1 || R == -1){
      deg[id]=1;
    }
    else deg[id] = 2;


    if(L == -1){
      dep[R]=dep[id]+1;
    }
    else if(R == -1){
      dep[L]=dep[id]+1;
    }else{
      dep[L]=dep[id]+1;
      dep[R]=dep[id]+1;
    }
    if(deg[L] != 0){
      if(lef[L] == -1){

	depth(rig[L],L);
      }
      else if(rig[L] == -1){
	depth(lef[L],L);
      }
      else{
	depth(rig[L],L);
	depth(lef[L],L);
      }
    }
    if(deg[R] != 0){ 
      if(lef[R] == -1){
	depth(rig[R],R);
      }
      else if(rig[R] == -1){
	depth(lef[R],R);
      }
      else{
	depth(rig[R],R);
	depth(lef[R],R);
      }
    }

    /*
    if(L+R != -2){ // hukasa    
      if(deg[L] != 0){
	if(lef[L] == -1){
	  depth(rig[L],L);
	}
	else if(rig[L] == -1){
	depth(lef[L],L);
	}
	else{
	  depth(rig[L],L);
	  depth(lef[L],L);
	}

      }
      if(deg[R] != 0){
	depth(rig[R],R);
      }
    }
    else if(L == -1){
      dep[R]=dep[id]+1;
      if(deg[R] != 0){
	depth(rig[L],L);
      }
    }
    else{
      dep[L]=dep[id]+1;
      if(deg[L] != 0){
	depth(lef[L],L);
      }
    }
    */

  }

  for(int i=0;i<n;i++){ //
    if(lef[i] == -1 && rig[i] == -1){
      heich(i,dad[i]);
    }
  } //

  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,dad[i],sib[i],deg[i],dep[i],hei[i]);
    if(dad[i] == -1){
      printf("root\n");
    }
    else if(hei[i] == 0){
      printf("leaf\n");
    }
    else printf("internal node\n");

  }


  return 0;
}

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

int main() {
  int n, k, x, y, a = 0;
  cin >> n >> k >> x >> y;
  for(int i = 0; i < n; i++){
    if(i < k){
      a = a + x;
    }
    else{
      a = a + y;
    }
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> sum(n + 1, 0);
  REP(i, n) {
    ll a;
    cin >> a;
    a--;
    sum[i + 1] = sum[i] + a;
  }
  map<ll, vector<ll>> mp;
  REP(i, n + 1) { mp[sum[i] % k].push_back(i); }
  ll ans = 0;
  FOREACH(x, mp) {
    vector<ll> v = x.second;
    ll m = SZ(v);
    REP(i, m) {
      auto it = upper_bound(v.begin() + i + 1, v.end(), v[i] + k - 1);
      ans += max(0LL, (it - v.begin()) - i - 1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

struct Fol{
    ll h,a,flag;
};

bool comp(Fol x,Fol y){
    return x.h<y.h;
}

ll nodenum;
vector<ll> node;

ll init_num=-1;
ll func(ll x,ll y){
    return max(x,y);
}

//セグ木
void init(vector<ll> v){
    nodenum=1;
    while(v.size()>nodenum)nodenum*=2;
    node.resize(2*nodenum-1,init_num);
    rep(i,nodenum-1,nodenum*2-2){
        if(i-(nodenum-1)<v.size()){
            node[i]=node[i-(nodenum-1)];
        }else{
            node[i]=init_num;
        }
    }
    for(ll i=nodenum-2;i>=0;i--){
        node[i]=func(node[2*i+1],node[2*i+2]);
    }
}

void update(ll x,ll y){ //v[x]をyに変更する
    node[x+nodenum-1]=y;
    ll next=x+nodenum-1;
    while(next>0){
        next=(next-1)/2;
        node[next]=func(node[2*next+1],node[2*next+2]);
    }
}

ll find(ll i,ll j,ll x,ll y,ll z){     //v[[i,j)]でのfuncの結果を出力する //node[x]に着目しているnode[x]が担当する範囲は[y,z); //最初はx=-1で
    if(x==-1) return find(i,j,0,0,nodenum);
    if(j<=y || z<=i)return init_num;
    if(i<=y && z<=j)return node[x];
    return func(find(i,j,2*x+1,y,(y+z)/2),find(i,j,2*x+2,(y+z)/2,z));
}

int main(){fastio
    ll n;cin>>n;
    Fol fol[n+1];
    rep(i,1,n){
        fol[i].flag=i;
        cin>>fol[i].h;
    }
    rep(i,1,n){
        cin>>fol[i].a;
    }
    sort(fol+1,fol+n+1,comp);
    /*
    rep(i,0,n){
        cout<<fol[i].a<<' '<<fol[i].h<<' '<<fol[i].flag<<endl;
    }*/
    
    vector<ll> v;
    rep(i,0,n){
        v.pb(-1);
    }
    init(v);
    ll dp[n+1];
    rep(i,1,n){
        if(find(1,fol[i].flag,-1,0,0)==-1){
            dp[i]=fol[i].a;
            update(fol[i].flag,dp[i]);
        }else{
            dp[i]=find(1,fol[i].flag,-1,0,0)+fol[i].a;
            update(fol[i].flag,dp[i]);
        }
    }
    ll ans=-1;
    rep(i,1,n){
        ans=max(ans,dp[i]);
    }
    /*
    rep(i,0,node.size()-1){
        cout<<node[i]<<' ';
    }*/
    
    cout<<ans<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 12272
ls = []
for i in range(3):
    ls.append(list(map(int,input().split())))
ans = 'Yes'
if ls[1][1]-ls[1][0] != ls[0][1]-ls[0][0]:
    ans = 'No'
if ls[2][1]-ls[2][0] != ls[0][1]-ls[0][0]:
    ans = 'No'   
if ls[1][2]-ls[1][0] != ls[0][2]-ls[0][0]:
    ans = 'No'
if ls[2][2]-ls[2][0] != ls[0][2]-ls[0][0]:
    ans = 'No'
print(ans)

Measured memory_bytes: 9232
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define mod 1000000007
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

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

    int ans = 0;
    int len = s.size();
    rep(i, 1, len - 1) {
        if (s[i - 1] == s[i]) {
            if (s[i] == s[i + 1]) {
                if (s[i] == '0') s[i] = '1';
                else s[i] = '0';
                ans++;
            } else  {
                if (s[i] == '0') s[i] = '1';
                else s[i] = '0';
                ans++;
            }
        }

        if (i == len - 2) {
            if (s[i] == s[i + 1]) ans++;
        }
    }

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


Measured memory_bytes: 512
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)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 debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n >> y;
  rep(i, n + 1) {
    rep(j, n + 1) {
      k = n - i - j;
      if (k < 0) continue;
      if (10000 * i + 5000 * j + 1000 * k == y) {
        cout << i << " " << j << " " << k << "\n";
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << "\n";
  return 0;
}

Measured memory_bytes: 3656
function Main(input) {
    const lines = input.split("\n");

    const [A, B, M] = lines.shift().split(' ').map(Number);
    const aList = lines.shift().split(' ').map(Number);
    const bList = lines.shift().split(' ').map(Number);

    const minA = aList.reduce((acc, current) => Math.min(acc, current), Infinity);
    const minB = bList.reduce((acc, current) => Math.min(acc, current), Infinity);

    let minCost = minA + minB;

    for (let i = 0; i < M; i++) {
        const [x, y, c] = lines[i].split(' ').map(Number);
        minCost = Math.min(minCost, aList[x-1] + bList[y-1] - c);
    }

    console.log(minCost);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 52928
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node{
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }

  z->parent = y;
  if(y == NIL){
    root = z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n, i, x;
  string com;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    cin >> com;
    if(com == "insert"){
      scanf("%d", &x);
      insert(x);
    }else if(com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
}

Measured memory_bytes: 24688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, n) for(int i = 1; i <= (int)(n); i++)
const long long INF = 1LL << 60;
const double PI=3.14159265358979323846;

int LinearSearch(int A[], int n, int key){
    int i=0;
    A[n] = key;
    while(A[i] != key)i++;
    return i != n;
    
}

int main() 
{
    int n,q,sum=0;

    cin >> n;
  	int S[n+10];
    rep(i,n){
        cin >> S[i];
    }
    cin >> q;
  	int T[q+10];
    rep(i,q){
        cin >> T[i];
    }

    for(int i=0;i<q;i++){
        if(LinearSearch(S,n,T[i]))sum++;
    }

    cout << sum << endl;

}


Measured memory_bytes: 3112
import java.util.Scanner;
class Main {
  public static void main(String Args[]) {
    String s;
    int c = 0;
    
    Scanner sc = new Scanner(System.in);
    s = sc.next();
    for (int i = 0;i < 3;i++) {
      if (s.charAt(i) == 'o')
        c++;
    }
    
    System.out.println(c * 100 + 700);
    return;
  }
}

Measured memory_bytes: 23764
package main

import (
	"fmt"
)

func main() {

	var n [][]int
	var h, w int

	for {
		fmt.Scan(&h)
		fmt.Scan(&w)

		if h == 0 && w == 0 {
			break
		}

		n = append(n, []int{h, w})

	}

	for i := 0; i < len(n); i++ {

		for j := 0; j < n[i][0]; j++ {

			for k := 0; k < n[i][1]; k++ {
				if (k+1+j+1)%2 == 0 {
					fmt.Print("#")
				} else {
					fmt.Print(".")
				}

			}
			fmt.Print("\n")
		}

		fmt.Print("\n")
	}

}

//a, _ := strconv.ParseFloat(tmp[0], 64)



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

int N, M;
const int MAX_N = 1e5;
vector<int> L(MAX_N), R(MAX_N);
void solve()
{
	int maxL , minR;
	maxL = L[0], minR = R[0];
	for(int i = 1; i < M; i++){
		if(maxL < L[i])
		maxL = L[i];
		if(R[i] < minR)
		minR = R[i];
	}
  	int res;
  	if(maxL <= minR)
      	res = minR - maxL + 1;
  	else
      	res = 0;
	cout << res << endl;
}
int main()
{
	cin >> N >> M;
	for(int i = 0; i < M; i++){
		cin >> L[i] >> R[i];
	}
	solve();
	return 0;
}


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

int m, n;
int a[105];
int main(){
    cin >> n >> m;
    int sum = 0;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        sum += a[i];
    }
    int cnt = 0;
    for(int i = 1;i <= n;i++){
        if(a[i] * 4 * m >= sum){
            cnt++;
        }
    }
    if(cnt >= m){
        puts("Yes");
    }else{
        puts("No");
    }
    return 0;
}


Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 xxx.cpp

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
    string S,T; cin>>S>>T;
    int A,B; cin>>A>>B;
    string U; cin>>U;

    map<string,int> m;
    m[S] = A;
    m[T] = B;

    m[U]--;

    cout << m[S] << " " << m[T] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

int main()
{
    ciosup;
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans;
    ans = (1. * w * h) / 2.;
    cout << ans << " ";
    if (x * 2 == w && y * 2 == h)
    {
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 
#define digits(n) (int)(log10(n) + 1)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;

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

/********** TEMPLATE ENDS HERE ***********/

const int DIM = 1e5 + 7;
int v[DIM];

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

    int sum = 0;
    for(int i = 1; i <= n; i++) 
	{
        cin >> v[i];
        sum += abs(v[i] - v[i - 1]);
    }
	
    v[n + 1] = 0;
    sum += abs(v[n + 1] - v[n]);
 
    for(int i = 1; i < n + 1; i++) 
	{
        cout << sum - abs(v[i] - v[i - 1]) - abs(v[i + 1] - v[i]) + abs(v[i + 1] - v[i - 1]) << "\n";
    }
}

Measured memory_bytes: 1664
PROGRAM ATCODER

implicit none
integer :: tb,x
real(8) :: ta


read(*,*) tb,x    !ここが入力欄

! ここに計算式
ta = real(tb)/real(x)

! ここに出力結果
if(ta < 1.0d0) then
	write(*,'("0",f0.5)') ta
else
	write(*,'(f0.5)') ta
end if

END PROGRAM ATCODER

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <string.h>
#include <ctype.h>
#include <algorithm>

using namespace std;

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b == c+d)
    cout << "Balanced" << endl;
  else if(a+b > c+d)
    cout << "Left" << endl;
  else
    cout << "Right" << endl;
}

Measured memory_bytes: 3636
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ct_list = [n,a,b,c,d,e]
for i in range(5):
  if ct_list[i] < ct_list[i+1]:
    ct_list[i+1] = ct_list[i]

if ct_list[5] >= ct_list[4]:
  if n%ct_list[4] == 0:
    print(4+n//ct_list[4])
  else:
    print(5+n//ct_list[4])
else:
  if n%ct_list[5] == 0:
    print(4+n//ct_list[5])
  else:
    print(5+n//ct_list[5])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//useful 
#define rep(i,n) for(int i = 0; i < (n); i++)
int long long gcd(int long long a, int long long b){
    return b?gcd(b,a%b):a;
} //最大公約数
int long long lcm(int long long a, int long long b){
    return a/gcd(a,b)*b;
} //最小公倍数
int long long GetDigit(int long long num){
    int long long digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
} //桁数
int long long GetDigitN(int long long num, int long long N){
    int long long digit=0;
    while(num!=0){
        num /= N;
        digit++;
    }
    return digit;
} //十進数でnumの際のN進数における桁数
int long long GetDigitSum(int long long n){
    if(n < 10){
       return n;
    }
    return GetDigitSum(n/10) + n%10;
} //十進数の桁和
unsigned int long long unsignedGetDigitSum(unsigned int long long n){
    if(n < 10){
       return n;
    }
    return unsignedGetDigitSum(n/10) + n%10;
} //十進数の桁和unsigned
int long long divisorcount(int long long n){
	int long long ans = 1;
	vector<int> x(n + 1);
	int long long num = n; // 素因数分解する変数num 
	for (int long long i = 2; i <= n; i++) {
		while (num%i == 0) { // 素数で割り切れなくなるまで割っていく
			x.at(i)++; //割った個数を配列に足す
			num /= i;
		}
	}
	for (int i = 2; i <= n; i++){
		ans *= x.at(i) + 1; //それぞれを+1して掛けていく
	}
    return ans;
} //約数カウント

int main(){
    double D, T, S;
    cin >> D >> T >> S;
    if(D / S <= T){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <utility>
using namespace std;
#define fol(i,n) for (int i=0;i<n;i++)

int main(){
    int a,b;
    cin >>a>>b;
    if (a==1) a+=13;
    if (b==1) b+=13;
    if (a==b) cout << "Draw"<<endl;
    else if (a>b) cout << "Alice"<<endl;
    else cout << "Bob"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
using ll = int64_t;
using v = vector<int>;

int main() {
  int A, B, C, D;
  string s;
  cin >> A >> B >> C >> D;
  while (true) {
    C-=B;
    if (C<=0) {
      s = "Yes";
      break;
    }
    A -=D;
    if (A<=0) {
      s = "No";
      break;
    }
  }
  
  cout << s << endl;

}

Measured memory_bytes: 3628
#include <iostream>
#include<iomanip>
#include <string>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<math.h>
#include<stack>
#include<set>
#include<map>
#define INF long long int(1e18+1)
#define rep(i,n,m) for(int i=n;i<m;i++)

using namespace std;


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

	long long int ans = 0;
	long long int x = 1;
	while (h) {
		h /= 2;
		ans += x;
		x *= 2;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3616
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def solve(a, s):
    b = []
    for i in range(len(s)):
        if s[i] == a:
            b.append(i)
    if len(b) == 0:
        return len(s) - 1
    ans = 0
    for i in range(len(b)-1):
        ans = max(ans, (b[i+1] - b[i] - 1))
    ans = max(ans, b[0])
    ans = max(ans, len(s) - b[-1] - 1)
    return ans

def main():
    s = input()
    ans = len(s)
    for i in range(26):
        ans = min(ans, solve(chr(ord('a') + i), s))
    print(ans)
main()

Measured memory_bytes: 9268
// https://atcoder.jp/contests/abc140/tasks/abc140_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, sum = 0;
    cin >> N;
    vector<int> B(N - 1);
    REP(i, N - 1) { cin >> B[i]; }
    REP(i, N - 1) {
        if (i == 0) {
            sum += B[0];
        } else {
            sum += min(B[i - 1], B[i]);
        }
    }
    sum += B[N - 2];
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3624
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

class BinaryIndexedTree
{
private:
    int n;
    vector<int> data;
public:
    BinaryIndexedTree(int n){ // コンストラクタ
        this->n = n;
        data.assign(n+1, 0);
    }
    void add(int k, int x){ // k番目の要素にxを加算する
        ++ k;
        while(k <= n){
            data[k] += x;
            k += k & -k;
        }
    }
    int sum(int k){ // 区間[0,k]の総和を返す
        ++ k;
        int ret = 0;
        while(k > 0){
            ret += data[k];
            k -= k & -k;
        }
        return ret;
    }
    int sum(int a, int b){ // 区間[a,b]の総和を返す
        return sum(b) - sum(a-1);
    }
};

long long solve(const string& s)
{
    int n = s.size();
    vector<deque<int> > index(128);
    for(int i=0; i<n; ++i)
        index[s[i]].push_back(i);

    BinaryIndexedTree bit(n);
    for(int i=0; i<n; ++i)
        bit.add(i, 1);

    long long ans = 0;
    bool isSingle = false;
    for(int i=0; i<n; ++i){
        char c = s[i];
        if(index[c].size() == 0)
            continue;

        if(index[c].size() == 1){
            if(isSingle)
                return -1;
            isSingle = true;
        }
        else{
            int j = index[c].back();
            ans += bit.sum(0, i - 1) + bit.sum(j + 1, n - 1);
            bit.add(i, -1);
            bit.add(j, -1);
            index[c].pop_front();
        }
        index[c].pop_back();
    }
    return ans;
}

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

    cout << solve(s) << endl;

    return 0;
}


Measured memory_bytes: 2180
#include<iostream>
#include<algorithm>
int main(){
	int a[10];
	for(int i=0; i<=9; ++i)std::cin>>a[i];
	std::sort(a,a+10);
	std::cout<<a[9]<<std::endl<<a[8]<<std::endl<<a[7]<<std::endl;
	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }

typedef complex<double> base;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

const double PI = 4*atan(1);
const int N=2e5+5;
const int MOD=201604307997;
 
int FFT_N=0;
vector<base> omega;
 
void init_fft(int n)
{
    FFT_N = n;
    omega.resize(n);
    double angle = 2*PI/n;
    for(int i=0;i<n;i++)
    {
        omega[i]=base(cos(i*angle), sin(i*angle));
    }
}
 
void fft(vector<base> &a)
{
    int n=a.size();
    if(n==1)
        return;
    int half=n>>1;
    vector<base> even(half), odd(half);
    for(int i=0, j=0; i<n; i+=2, j++)
    {
        even[j]=a[i];
        odd[j]=a[i+1];
    }
    fft(even);
    fft(odd);
    int denominator=FFT_N/n;
    for(int i=0;i<half;i++)
    {
        base cur=odd[i] * omega[i*denominator];
        a[i]=even[i] + cur;
        a[i+half]=even[i] - cur;
    }
}
 
void multiply(vector<int> &a, vector<int> &b, vector<int> &res)
{
    vector<base> fa(a.begin(), a.end());
    vector<base> fb(b.begin(), b.end());
    int n=1;
    while(n<2*max(a.size(), b.size()))
        n<<=1;
    fa.resize(n);
    fb.resize(n);
    init_fft(n);
    fft(fa);
    fft(fb);
    for(int i=0;i<n;i++)
        fa[i] = conj(fa[i] *  fb[i]);
    fft(fa);
    res.resize(n);
    for(int i=0;i<n;i++)
    {
        res[i]=(long long)(fa[i].real()/n + 0.5);
        res[i]%=MOD;
    }
}

int32_t main() 
{
    IOS
    int n,m;
    cin>>n>>m;
    int arr[n];
    int freq[100002]={};
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        freq[arr[i]]++;
    }
    vector<int>ans;
    vector<int>a;
    for(int i=0;i<100002;i++)
        a.push_back(freq[i]);
    multiply(a,a,ans);
    int sum=0;
    for(int i=ans.size()-1;i>=0;i--)
    {
        int mini=min(m,ans[i]);
        sum+=i*mini;
        m-=mini;
    }
    cout<<sum;
}   


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

int a[210];
int n;
int main(){
  int res = 0;
  cin >> n;
  for(int i = 0 ; i < n ; ++i )  cin >> a[i] ;
  while(true){
    int flag = 0;
    for(int j = 0; j < n; ++j){
      if(a[j] % 2 != 0) flag = 1;
    }
    if(flag == 1) break; 
    for(int i = 0;i < n; ++i){
      a[i] /= 2;
    }
    ++res;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

using ll = long long;
using P = pair<int, int>;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int n;
vector<ll> a;
vector<vector<ll>> memo(3001, vector<ll>(3001, -1));

ll solve(int p1, int p2, int t) {
    if (p2 < p1) return 0;
    if (memo[p1][p2] != -1) return memo[p1][p2];
    if (t % 2) {
        ll res = 0;
        chmax(res, a[p1] + solve(p1 + 1, p2, t + 1));
        chmax(res, a[p2] + solve(p1, p2 - 1, t + 1));
        return memo[p1][p2] = res;
    }
    else {
        ll res = 1000000000000000;
        chmin(res, solve(p1 + 1, p2, t + 1));
        chmin(res, solve(p1, p2 - 1, t + 1));
        return memo[p1][p2] = res;
    }
}

int main() {
    cin >> n;
    a.resize(n);
    cin >> a;
    
    ll s = 0;
    rep(i, n) s += a[i];
    cout << 2 * solve(0, n - 1, 1) - s << endl;
}

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

int main(){
  int64_t a , b , n ; 
  cin >> a >> b >> n ; 
  int64_t x = n;
  
  if(n >= b-1) x = b-1 ; 
  int64_t ans = a*x/b - a*(x/b) ; 
  
  cout << ans << endl ; 
  return 0 ; 
  
}

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

int main() {
    string S;
    cin >> S;
    vector<int> count(26, 0);
    vector<char> a(26);
    char b = 'a';
    for (int i = 0; i < 26; i++) {
        a.at(i) = b;
        b++;
    }
    for (int i = 0; i < S.size(); i++) {
        for (int j = 0; j < 26; j++) {
            if (S.at(i) == a.at(j)) count.at(j)++;
        }
    }
    for (int i = 0; i < 26; i++) {
        if (count.at(i) == 0) {
            cout << a.at(i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}


Measured memory_bytes: 512
package main

import (
	"fmt"
	"sort"
	"strings"
)

func sortString(w string) string {
	s := strings.Split(w, "")
	sort.Strings(s)
	return strings.Join(s, "")
}

func reverseStr(s string) string {

	runes := []rune(s)

	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}

	return string(runes)
}

func main() {
	// Code for B - Two Anagrams
	var s, t string
	fmt.Scanf("%s\n%s", &s, &t)

	s = sortString(s)
	t = reverseStr(sortString(t))
	if s < t {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1848
n = int(input())
pairs_ab = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x:x[1], reverse=True) # red
pairs_cd = sorted([list(map(int, input().split())) for _ in range(n)], key=lambda x:x[0]) # blue

cnt = 0
for pair_b in pairs_cd:
  for pair_a in pairs_ab:
    if pair_b[1] > pair_a[1] and pair_b[0] > pair_a[0]:
      cnt += 1
      pair_a[0] = pair_a[1] = float('inf')
      break

print(cnt)

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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    string s;
    cin >> s;
    
    ll n = s.size() - 1;
    ll ans = 0;
    
    for(int bit = 0; bit < (1<<n); bit++){
        ll sm = 0;
        ll a = s[0] - '0';
        rep(i,n){
            if(bit & (1 << i)){
                sm+=a;
                a = 0;
            }
            a = a * 10 + s[i + 1] - '0';
        }
        sm += a;
        ans += sm;
    }
    cout << ans << endl;
}






Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <utility>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <cctype>

typedef long long int ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素


using namespace std;

int main() {
   
   string S,T;
   cin >> S >> T;

   int cnt=0;
   REP(i,S.length()){
      if(S[i]!=T[i]){
         cnt+=1;
      }
   }
   cout << cnt << endl;

}

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

int main()
{
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> ans(n, k - q);
    rep(i, q)
    {
        int x;
        cin >> x;
        ans[x - 1]++;
    }
    rep(i, n)
    {
        if (ans[i] > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}

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

int main() {
    int n,k;
    cin>>n>>k;
    map<int,int> m;
    for (int i=0;i<n;i++) {
        int a;cin>>a;
        m[a]++;
    }
    vector<int> a;
    for (auto p:m)
        a.push_back(p.second);
    sort(a.begin(),a.end());
    int ans=0;
    for (int i=0;i<(int)a.size()-k;i++)
        ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 10748
#include<stdio.h>

void dividing(int pm, int pe, int pj);

int main(void)
{
  int n;
  int pm, pe, pj;
  while (1) {
    int i = 0;
    scanf("%d", &n);
  if (n == 0) {
    break;
  } else {
  while (i < n) {
    scanf("%d %d %d", &pm, &pe, &pj);
    dividing(pm, pe, pj);
    i++;
  }
  }
  }
  return 0;
}

void dividing(int pm, int pe, int pj)
{
  if (pm == 100 || pe == 100 || pj == 100) {
    printf("A\n");
  }
  else if (pm + pe >= 90 * 2){
    printf("A\n");
  }
  else if (pm + pe + pj >= 80 * 3){
    printf("A\n");
  }
  else if (pm + pe + pj >= 70 * 3){
    printf("B\n");
  }
  else if((pm + pe + pj >= 50 * 3) && (pm >= 80 || pe >= 80)){
    printf("B\n");
  } else {
    printf("C\n");
  }
}

Measured memory_bytes: 1012
PO = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for _ in range(n):
    b, f, r, v = map(int, input().split())
    PO[b - 1][f - 1][r - 1] += v
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(' ' + str(PO[i][j][k]), end='')
        print()
    if i < 3:
        print('####################')


Measured memory_bytes: 5628
// inputに入力データ全体が入る
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var aa = parseInt(line[0]);
    var bb = parseInt(line[1]);
    var cc = parseInt(line[2]);
    
    var temp = [aa,bb,cc];
    
    var ans = 0;
    
    if(aa === bb && bb === cc){
        if(aa%2===1||bb%2===1||cc%2===1){
        } else {
            ans = -1;
        }
    } else {
        while(1){
//            console.log("ans:"+ans+" a:"+aa+" b:"+bb+" c:"+cc);
          if(aa%2===1||bb%2===1||cc%2===1){
                break;
            } else {
                temp[0] = aa;
                temp[1] = bb;
                temp[2] = cc;

                aa = (temp[1]+temp[2])/2;
                bb = (temp[0]+temp[2])/2;
                cc = (temp[1]+temp[0])/2;

                ans++;
            }
        }
    }
    
    console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
string s;
int n;
int calc(vector<int> v){
    v.push_back(n-1);
    int ret = 0;
    int l = 0;
    for(auto r:v){
        r++;
        int keta = 1;
        for(int i = r-1;i>=l;i--){
            ret += keta*(s[i] - '0');
            keta *= 10;
        }
        l = r;
    }
    return ret;
}
int dfs(int d,vector<int> &v){
    if(d ==n-1)return calc(v);
    int ret = 0;
    ret += dfs(d+1,v);
    v.push_back(d);
    ret += dfs(d+1,v);
    v.pop_back();
    return ret;
}
signed main(){
    cin >> s;
    n = s.size();
    vector<int> v;
    cout << dfs(0,v) << endl;
    return 0;
}

Measured memory_bytes: 256
N, D = map(int, input().split())
X = []
for _ in range(N):
    X.append(list(map(int, input().split())))

ans_sum = 0
for i in range(N):
    for j in range(N):
        temp = 0
        for d in range(D):
            temp += (abs(X[i][d] - X[j][d]))**2
        ans = temp**(1/2)
        if ans.is_integer():
            ans_sum += 1

print((ans_sum - N)//2)

Measured memory_bytes: 38576
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 100000000
#define inf 1e18 
 
using namespace std;

signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    int x;
    cin>>x;
    if(x>=400&&x<600) cout<<"8";
    else if(x>=600&&x<800) cout<<"7";
    else if(x>=800&&x<1000) cout<<"6";
    else if(x>=1000&&x<1200) cout<<"5";
    else if(x>=1200&&x<1400) cout<<"4";
    else if(x>=1400&&x<1600) cout<<"3";
    else if(x>=1600&&x<1800) cout<<"2";
    else cout<<"1";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  int N;
  cin >> N;
  string S = "";
  if(N == 0) {
    cout << 0 << endl;
    return 0;
  }

  while(N != 0) {
    int d, r;
    if(N > 0 || N % -2 == 0) {
      d = N / -2;
      r = N % -2;
    } else {
      d = N / -2 + 1;
      r = N % -2 + 2;
    }
    S.push_back((r + '0'));
    N = d;
  }
  reverse(ALL(S));
  cout << S << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;


int main(int argc, char *argv[])
{
	int n;
	string s;

	//input
	cin >> n;
	cin >> s;


	//calc
	int ans = 0;
	for (int i = 0; i < n - 2; i++){
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C'){
			ans++;
		}
	}


	//ans
	cout << ans << endl;

	return 0;
}


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

using namespace std;

int main() {
    long long a, b, v, w, t, d, da, db;
    cin >> a >> v >> b >> w >> t;

    d = abs(a - b);
    da = v*t;
    db = w*t;
    if(da >= db + d || d == 0) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }

    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
int main()
{
  string a;
  cin>>a;
  int n=a.size();
  int x=(n-3)/2;
  int y=(n+1)/2;
  string b,c;
  string aa,bb,cc;
  for(int i=0;i<n;i++)
  {
	   aa.push_back(a[i]);
  }
  for(int i=0;i<=x;i++)
  {
	  b.push_back(a[i]);
	  
	  bb.push_back(a[i]);
	  
  }
  for(int i=y;i<n;i++)
  {
	  c.push_back(a[i]);
	  
	  cc.push_back(a[i]);
  }
  
  reverse(a.begin(),a.end());
  reverse(b.begin(),b.end());
  reverse(c.begin(),c.end());
  int count=0;
  if(a==aa)
  count++;
  if(b==bb)
  count++;
  if(c==cc)
  count++;
  if(count==3)
  cout<<"Yes";
  else
  cout<<"No";
  
  
 
  
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
using ll=long long;
const int MOD=1000000007;


int main() {
  int H,W;
  cin >> H >> W;
  int h,w;
  cin >> h >> w;
  cout << (H-h)*(W-w) << endl;
}



Measured memory_bytes: 3532
#include<stdio.h>

int main(){
        char mojiretsu[3];
        scanf("%s",mojiretsu);
        int x,i;
        if(mojiretsu[0] != mojiretsu[1] && mojiretsu[1] != mojiretsu[2] && mojiretsu[2] != mojiretsu[0]){                                                                                     
                for(i=0;i<3;i++){
                        if(mojiretsu[i] == 'a'){
                                x++;
                                continue;
                        }else if(mojiretsu[i] == 'b'){
                                x++;
                                continue;
                        }else if(mojiretsu[i] == 'c'){
                                x++;
                                continue;
                        }else   break;
                }
        }
        if(x == 3)      printf("Yes");
        else            printf("No");
        return(0);
}

Measured memory_bytes: 128
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> ipair;
typedef tuple<int, int, int> ituple;

// const int INF = INT_MAX;
const ll INF = LLONG_MAX;
// const int MOD = ((int)1e9 + 7);
// const ld EPS = (1e-10);
#define PI acosl(-1)
#define MAX_N (400 + 2)
int n;
ll a[MAX_N];
ll dp[MAX_N][MAX_N];
ll sum[MAX_N];

ll rec(int l, int r){
  if (l == r){
    dp[l][r] = 0;
  }

  if (dp[l][r] != -1){
    return dp[l][r];
  }

  ll result = INF;
  for (int k = l; k < r; k++){
    ll tmp = rec(l, k) + rec(k+1, r);
    result = min(result, tmp);
  }

  result += sum[r+1] - sum[l];
  dp[l][r] = result;

  // printf("dp[%d][%d] = %lld\n", l, r, dp[l][r]);

  return result;
}

void exec(){
  cin >> n;
  for (int i = 0; i < n; i++){
    scanf("%lld", &a[i]);
    sum[i+1] = sum[i] + a[i];
  }

  for (int i = 0; i < MAX_N; i++){
    for (int j = 0; j < MAX_N; j++){
      dp[i][j] = -1;
    }

  }

  cout << rec(0, n-1) << endl;
}

void solve(){
  int t = 1;
  // scanf("%d", &t);
  for (int i = 0; i < t; i++){
    exec();
  }
}

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


Measured memory_bytes: 1536
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n;
  cin >> n;
  vector<int> a;
  int neg_cnt = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    if (tmp < 0) {
      neg_cnt++;
      tmp = -tmp;
    }
    a.push_back(tmp);
  }

  long long ans = 0;
  sort(a.begin(), a.end());
  for (int t: a) { ans += t; }
  if (neg_cnt % 2) ans -= a[0] * 2;
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
using namespace std;

static int C[33] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int K;
	cin >> K;
	printf("%d\n", C[K-1]);
	return 0;
}

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

#define repr(i,a,b) for (int i=a; i<b; i++)
#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; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
bool dp[100100];

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 

int main () {
    int N;
    cin >> N;
    
    int ans= 0;
    int min = 1000000;

    rep(i,N){
        int P;
        cin >>P;
        if(P <= min ){
            ans +=1;
            min = P;
        }
    }
    cout << ans << endl;
}




Measured memory_bytes: 256