akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int main()
{
  int H,W;
  vector <string> A;
  vector <vector<int>> d;

  cin >> H >> W;
  for( int i=0;i<H;i++ )
    {
      string tmp;
      cin >> tmp;
      A.push_back(tmp);
    }

  
  for( int i=0;i<H;i++ )
    d.push_back(vector<int>(W, -1));

  queue<pair<int, int>> q;
  for( int i=0;i<H;i++ )
    for( int j=0;j<W;j++ )
      if( A[i][j] == '#' )
	{
	  q.push(make_pair(i,j));
	  d[i][j] = 0;
	}
	

  while(!q.empty())
    {
      auto x = q.front();
      q.pop();
      int i = x.first;
      int j = x.second;
      int c = d[i][j];
      if( i+1>=0 && i+1<H && j>=0 && j<W && d[i+1][j]==-1 )
	{
	  q.push(make_pair(i+1,j));
	  d[i+1][j] = c+1;
	}
      if( i>=0 && i<H && j+1>=0 && j+1<W && d[i][j+1]==-1 )
	{
	  q.push(make_pair(i,j+1));
	  d[i][j+1] = c+1;
	}
      if( i-1>=0 && i-1<H && j>=0 && j<W && d[i-1][j]==-1 )
	{
	  q.push(make_pair(i-1,j));
	  d[i-1][j] = c+1;	  
	}
      if( i>=0 && i<H && j-1>=0 && j-1<W && d[i][j-1]==-1 )
	{
	  q.push(make_pair(i,j-1));
	  d[i][j-1] = c+1;	  
	}
    }
  
  int ans = 0;
  for( int i=0;i<H;i++ )
    for( int j=0;j<W;j++ )
	ans = max(ans, d[i][j]);

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


Measured memory_bytes: 13456
#include<stdio.h>

int main(void){

int H,M,S,h,m,s,T;
scanf("%d",&T);
s=T%60;
m=(T-s)%3600/60;
h=(T-m-s)/3600;
printf("%d:%d:%d\n",h,m,s);


return 0;
}


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

int main(void){
  ios::sync_with_stdio(false);
  ll a, b, c, k;
  cin >> a >> b >> c >> k;
  ll zero = 0;
  ll ans = 0;
  ans += min(k, a);
  ans -= max(zero, k-a-b);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; For(i, n){ Cin(T, x); map[x] ++; }
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"

using namespace std;
using ll = long long;

int main(void){
    Cin(int, n);
    Cinm(int, n, a);
    int ans = 0;
    for(auto &e : a){
        ans += ((e.second >= e.first) ? e.second - e.first : e.second);
    }
    Cout(ans);
}


Measured memory_bytes: 4260
//There was and will always be only one Chester
//RIP legend
#include<bits/stdc++.h>
#define Nilesh ios_base::sync_with_stdio(false)
using namespace std;
int main()
{
    Nilesh;
    long long a,b;
    cin>>a>>b;
    if(a<b)
        cout<<0;
    else
        cout<<a-b;
}


Measured memory_bytes: 256
n=int(input())
h = list(map(int, input().split()))
move=0
maxmove=0
minheight=h[0]

for i in range(1,n):
  if minheight>=h[i]:
    move+=1
    minheight=h[i]
  else:
    maxmove=max(move,maxmove)
    move=0
    minheight=h[i]
print(max(maxmove,move))
    

Measured memory_bytes: 14224
import math

N = int(input())

group_seq_index = math.ceil(math.log(25*N/26+1)/math.log(26))
char_li = [chr(i) for i in range(97,97+26)]
li = []
a = ''

N -= int((1 - 26 ** (group_seq_index + 1)) / -25)

for i in range(group_seq_index):
  li.append(N % 26)
  N = N // 26

for index in reversed(li):
  a += char_li[index]
  
print(a)

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

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            new Program().Solve();
        }

        void Solve()
        {
            var input = GetInputIntegers();
            Console.WriteLine(input[0] * input[1] % 2 == 0 ? "Even" : "Odd");
        }

        int[] GetInputIntegers()
        {
            return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        }
    }
}


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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,M; cin >> N >> M;
  vector<int> A(N);

  int sum = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    sum += A[i];
  }

  vector<int> ans;

  sort(A.rbegin(), A.rend());

  int num = 0;
  for(int i = 0; i < N; i++){
    if(A[i] * 4 * M >= sum){
      ans.push_back(A[i]);
      num++;
      if(num == M) break;
    }
  }

  if(ans.size() == M){
    cout << "Yes" << endl;
  } else { 
    cout << "No" << endl;
  }

  
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>

using namespace std;

int main()
{
    int a,b,r;
    cin>>a>>b;
    r=a-b*2;
    if(r>=0){
        cout<<r;
    }
    else{
        cout<<"0";
    }
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n = INT()
    p = LIST()
    ans = 0

    mi = p[0]
    for x in p:
        if x <= mi:
            ans += 1
            mi = x
    print(ans)


if __name__=='__main__':
    main()


Measured memory_bytes: 27208
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else { return false; } }
const long long INF = 1LL << 60;
long long dp[110][110000];

int main() {
  int N; 
  long long W;
  cin >> N >> W;
  long long weight[110];
  int value[110];
  for (int i = 0; i < N; i++) {
    cin >> weight[i] >> value[i];
  }

  for (int i = 0; i < 110; i++) {
    if (i == 0) {
      for (int j = 0; j < 110000; j++) {
        dp[i][j] = INF;
      }
    } else {
      dp[i][0] = 0;
    }
  }
  dp[0][0] = 0;

  int maxn = -1;
  for (int i = 1 ; i <= N; i++) {
    for (int j = 0; j < 110000; j++) {
      if (value[i - 1] <= j && dp[i - 1][j - value[i - 1]] != INF) {
        long long x = weight[i - 1] + dp[i - 1][j - value[i - 1]];
        if (x <= W) { 
          maxn = max(maxn, j);
          dp[i][j] = x;
        } else {
          dp[i][j] = INF;
        }
        chmin(dp[i][j], dp[i - 1][j]);
      } else {
        dp[i][j] = dp[i - 1][j];
      }
    }
  }

  cout << maxn << endl;
  return 0;
}


Measured memory_bytes: 94464
import java.util.*;
 
class Main {
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
    	ArrayList<Integer> digitList = new ArrayList<>(); 
    	
    	int a, b;
    	int digit;
    	String strDigit;
    	int cnt = 0;
    	while(sc.hasNext()) {
    		a = sc.nextInt();
    		b = sc.nextInt();
    		digit = a + b;
    		strDigit = String.valueOf(digit);
    		digitList.add(strDigit.length());
    		cnt++;
    	}
    	for(int i = 0; i < cnt; i++) {
    		System.out.println(digitList.get(i));
    	}
	}
}

Measured memory_bytes: 26356
#!/usr/bin/env python3
from collections import Counter
import itertools
import copy
from itertools import product


def count_black(array):
    flatten = itertools.chain.from_iterable(array)
    c = Counter(flatten)
    return c['#']


def red_row(array, i):
    length = len(array[0])
    array[i] = ['r'] * length
    return array


def red_col(array, j):
    for row in array:
        row[j] = 'r'
    return array


H, W, K = map(int, input().split())
C = []

for _ in range(H):
    row = list(input())
    C.append(row)

total = 0

row_select_patterns = product([True, False], repeat=H)
col_select_patterns = list(product([True, False], repeat=W))

for row_select_pattern in row_select_patterns:
    for col_select_pattern in col_select_patterns:
        c = copy.deepcopy(C)

        for i, i_flag in enumerate(row_select_pattern):
            for j, j_flag in enumerate(col_select_pattern):
                if i_flag:
                    c = red_row(c, i)

                if j_flag:
                    c = red_col(c, j)

        if count_black(c) == K:
            total += 1

print(total)


Measured memory_bytes: 9648
#include <iostream>
#include <vector>
#include <algorithm>

constexpr int MAX_N = 1001;

int n, m;
int p[MAX_N];
std::vector<int> sums;

int main() {
	while (1) {
		std::cin >> n >> m;
		if (n + m == 0)
			break;
		sums.clear();
		for (int i = 0; i < n; ++i)
			std::cin >> p[i];
		++n;
		p[n - 1] = 0;
		for (int i = 0; i < n; ++i) {
			for (int j = i; j < n; ++j)
				sums.push_back(p[i] + p[j]);
		}
		std::sort(sums.begin(), sums.end());
		sums.erase(std::unique(sums.begin(), sums.end()), sums.end());
		int res = 0;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				auto it = std::upper_bound(sums.begin(), sums.end(), m - p[i] - p[j]);
				if (it != sums.begin()) {
					--it;
					res = std::max(res, (*it) + p[i] + p[j]);
				}
			}
		}
		std::cout << res << std::endl;
	}
	return 0;
}

Measured memory_bytes: 4940
#include <stdio.h>
int clc(int n){
	int rev_n=0;
	while(n!=0){
		rev_n*=10;
		rev_n+=n%10;
		n/=10;
	}
	return rev_n;
}
int main()
{
	int n, rev_n;
	scanf("%d", &n);
	rev_n=clc(n);
	if(n==rev_n)printf("Yes\n");
	else printf("No");
	return 0;
}

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

int main()
{
  int a,c;
  string b;
  cin>>a>>b>>c;
  if(b=="+"){
    cout<<a+c<<endl;
  }
  else if (b=="-") {
    cout<<a-c<<endl;
  }
  else if(b=="*"){
    cout<<a*c<<endl;
  }
  else if(b=="/"){
    cout<<a/c<<endl;
  }
}


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

int main(){
  long long K, A, B;
  cin >> K >> A >> B;
  long long ans;
  if(A+1>=B) ans=1+K;
  else if(K<A) ans=1+K;
  else{
    long long Sw=(K-A+1)/2;
    ans=Sw*(B-A)+A;
    if((K-A+1-Sw*2)%2==1) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N;
  cin >> N;
  vi P(N);
  vi pos(N);
  rep(i,N) {
    cin >> P[i];
    pos[P[i]-1] = i;
  }
  int cnt = 1;
  int ans = 0;
  rep(i,N) {
    if(pos[i] < pos[i+1]) {
      cnt++;
    } else {
      ans = max(ans,cnt);
      cnt = 1;
    }
  }
  cout << N - ans << endl;
  return 0;
}

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

using namespace std;

#define ALL(x) x.begin(), x.end()

typedef long long int lld;
typedef pair<int, int> pii;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.precision(15);
	cout << fixed;

	string s, t;
	cin >> s >> t;

	int cnt = 0;
	for (int i = 0; i < 3; i++)
		if (s[i] == t[i])
			cnt++;

	cout << cnt << '\n';



	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#define ll long long
#define sc scanf
#define pr printf
using namespace std;
int a[1000005];
int main()
{
	int k, n;
	sc("%d%d", &k, &n);
	int ans = 0;
	for (int i = 0; i < n; i++)
		sc("%d", &a[i]);
	for (int i = 0; i < n - 1; i++)
	{
		ans = max(ans, a[i + 1] - a[i]);
	}
	ans = max(ans, a[0] + k - a[n - 1]);
	pr("%d", k - ans);
}

Measured memory_bytes: 1024
a, b, c, d = map(int, input().split())

if(a>=0 and b>=0 and c>=0 and d>=0) or (a>=0 and b>=0 and c<0 and d>=0) or (a<0 and b>=0 and c>=0 and d>=0):
    print(b*d)
elif(a<0 and b>=0 and c<0 and d<0) or (a<0 and b<0 and c<0 and d>=0) or (a<0 and b<0 and c<0 and d<0):
    print(a*c)
elif(a>=0 and b>=0 and c<0 and d<0):
    print(a*d)
elif(a<0 and b<0 and c>=0 and d>=0):
    print(b*c)
else:
    print(max(a*c,b*d))

Measured memory_bytes: 9188
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
const ll INF = 1e18 + 10 ;
int main(){
    fastio
    ll n ;
    cin >> n ; 
    vector<vector<ll> > g(n + 1) ; 
    vector<ll> deg(n + 1) ; 
    ll k = 0 ; 
    vector<pair<ll,ll> > v(n) ; 
    for(ll i = 0; i < n - 1; i++){
        ll a , b ;
        cin >> a >> b ; 
        v[i].first = a ;
        v[i].second = b ; 
        g[a].push_back(b) ;
        g[b].push_back(a) ; 
        deg[a]++ ; 
        deg[b]++ ; 
        k = max({k, deg[a], deg[b]}) ; 
    }
    map<pair<ll,ll>, ll> mp ; 
    vector<set<ll> > colors(n + 1) ; 
    for(ll i = 1; i <= n; i++){
        ll color = 1 ;
        for(ll &c : g[i]){
            if ( mp.find({i, c}) == mp.end() ){
                while( colors[i].find(color) != colors[i].end() ) color++ ; 
                mp[{i, c}] = color ; 
                mp[{c, i}] = color ; 
                colors[i].insert(color) ; 
                colors[c].insert(color) ; 
            }
        }
    }
    cout << k << endl;
    for(ll i = 0; i < n - 1; i++){
        cout << mp[{v[i].first, v[i].second}] << endl;
    }
    return 0; 
}

Measured memory_bytes: 35456
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Debug.Trace
import Data.List (unfoldr)
import Control.Monad
import qualified Data.Vector.Unboxed as UV

main = do
    n <- UV.head . UV.unfoldr BS.readInt <$> BS.getLine
    print $ length $ filter (\x -> odd $ length $ show x) [1..n]


Measured memory_bytes: 892
#include <iostream>
#include <string>

using namespace std;

int main(){
  string s;
  int a = 0;
  
  cin >> s;
  
  for(int i = 0;i < s.length();i++){
    if(s.substr(i,1)=="o") a++;
  }
  
  if(a + 15 - s.length() >= 8){
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
# C
import numpy as np

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

N,X = list(map(int,input().split()))
x = np.array(list(map(int,input().split())))
X_l = np.array([X] * N)
diff = np.unique(abs(x - X_l))

a = diff[0]
for i in range(1, len(diff)):
    b = diff[i]
    a = gcd(a, b)
    
print(a)

Measured memory_bytes: 23060
#include <stdio.h>

int main(void){
  int n = 0;
  int a = 0;
  long long aa, b, bb, c, d, cc, i;
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    {
      scanf("%d", &a);
      aa += a;
      c = a;
      if(i == 0)
	{
	  b = a;
	  c = a;
	}
      else if(b < c)
	{
	  d = b;
	  b = c;
	  c = d;
	  if(cc < c)
	    {
	      c = cc;
	    }
	}
      else if(cc < c)
	{
	  c = cc;
	}
      bb = b;
      cc = c;
    }
      printf("%lld %lld %lld\n", cc, bb, aa);
  return 0;
}

Measured memory_bytes: 600
#include <iostream>

using namespace std;

int main () {
	int n;
	cin>>n;
	int answer = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		cin>>x;
		while (x % 2 == 0) {
			answer++;
			x /= 2;
		}
	}
	cout << answer;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <array>
#include <cmath>

using namespace std;

using ll = long long int;

// GCDを計算します
template <typename NumType>
NumType calcGCD(NumType a, NumType b) {
    if (a < b) {
        NumType tmp = a;
        a = b;
        b = tmp;
    }

    NumType r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

// 約数を数えます
template <typename NumType>
NumType cntDivisor(const NumType & num) {
    NumType cnt = 0;
    for(NumType i = 1; i * i <= num; ++i) {
        if(num % i == 0) {
            cnt++;
            if(i * i != num) cnt++;
        }
    }

    return cnt;
}

// [beg, end)の範囲を，添え字indexでループするfor文に置換します
#define FOR_RANGE(index, beg, end)     for (ll index = beg; index < N; ++index)

#define DEBUG(x)     std::cout << #x << " : " << x << "\n"

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

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

int main() {
    int N, R;

    cin >> N >> R;

    if (N >= 10) {
        cout << R;
    } else {
        cout << R + (100 * (10 - N));
    }

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
vector<int> v(10004);
int main() {
    int i = 1; 
    for(;;) {
        cin >> v[i];
        if (v[i] == 0) {
            break;
        }
        i++;
    }
    for(int j = 1; j < i; j++)
        cout << "Case " << j << ": " << v[j] << endl; 
}


Measured memory_bytes: 3048
#include <iostream>
#include <cmath>

using namespace std;

int main(){
  long long A,B,C,K;
  cin >> A >> B >> C >> K;

  if(abs(A - B) > (long long)pow(10,18)){
    cout << "Unfair" <<endl;
    return 0;
  }

  if(K % 2 == 0){
    cout << (A - B) << endl;
  }
  else{
    cout << (B - A) << endl;
  }
  return 0;
}


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

int main()
{
    int N;
    cin >> N;
    int ans = 0;
    while (N > 1)
    {
        N -= 2;
        ans += 1;
    }

    if (N == 1)
    {
        cout << ans + 1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  int a[n];
  rep(i,n){
    cin>>a[i];
  }
  sort(a,a+n);
  rep(i,n-1){
    if(a[i]==a[i+1]){cout<<"NO"<<endl;return 0;}
  }
  cout<<"YES"<<endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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 (a>b) { a=b; return 1; } return 0; }

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<<min(a,b)+min(c,d)<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    long long n,i,high,low,sum=0;
    scanf("%lld",&n);
    long long a[n];
    for(i=0;i<n;i++){
       scanf("%lld",&a[i]);
    }
    high=a[0];
    low=a[0];
    for(i=0;i<n;i++){
       if(high<a[i])
         high=a[i];
       if(low>a[i])
         low=a[i];
       sum=a[i]+sum;
    }
    printf("%lld %lld %lld\n",low,high,sum);
    return 0;
}


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


int main(){
    int n; cin >> n;
    vector<int> v(n);
    vector<int> c(n);
    rep(i,n) cin >> v[i];
    rep(i,n) cin >> c[i];
    int ans = 0;
    rep(i,n){
        if(v[i]-c[i] > 0) ans += v[i]-c[i];

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


Measured memory_bytes: 888
# include <bits/stdc++.h>
# define ll long long 
using namespace std;
const ll N = 2e5 + 10, mod = 1e9 + 7;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
}

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

int main(int argc, char* argv[])
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);

	printf("%d %d %d", c, a, b);
	return 0;
}





Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define INF 1200000000



int main(){
    int a,b;
  cin>>a>>b;
  if(a==b)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;  
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
using ll = long long;

int main() {
  int N,K,i,j,MOD=998244353;
  cin>>N>>K;
  vector<int> L(K),R(K);
  for (i=0;i<K;i++) {
    cin>>L[i]>>R[i];
  }
  vector<ll> dp(N+1, 0), dps(N+1,0);
  dp[0]=0;dp[1]=1;
  dps[0]=0;dps[1]=1;
  for (i=2;i<=N;i++) {
    for (j=0;j<K;j++) {
      int r = i-L[j];
      int l = max(i-R[j],1);
      if (0<r) {
        dp[i] += (dps[r] - dps[l-1] + MOD) % MOD;
        dp[i] %= MOD;
      }
    }
    dps[i] = (dps[i-1] + dp[i]) % MOD;
  }
  cout<<dp[N]<<endl;
  return 0;
}


Measured memory_bytes: 6048
#include <bits/stdc++.h>
using namespace std;
long long x[10000010], y[10000010];
#define int long long
signed main()
{

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

   int a, b, n, cnt = 0, ans = 0;
   string s;

   cin >> n;
   for (int i = 0; i < n; i++)
   {
      cin >> x[i];
   }

   for (int i = 0; i < n; i++)
   {
      for (int j = ans; j < n; j++)
      {
         cnt=cnt+(x[i]*x[j]);
      }
      cnt=cnt-(x[i]*x[i]);
      ans++;
   }

   cout << cnt << '\n';
}


Measured memory_bytes: 2304
import static java.lang.System.*;
import java.util.*;

public class Main {
	public static final int MOD = 1000000007;

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

        int n = sc.nextInt();
        char[] str = sc.next().toCharArray();
		
		int[] count = new int[26];
		Arrays.fill(count, 0);
		for(char c: str) count[c-'a']++;
		
		long ans = 1;
		for(int c: count)
			if(c!=0) {
				ans *= (c+1);
				ans %= MOD;
			}
		
        out.println(ans-1);
    }
}


Measured memory_bytes: 25520
#include<stdio.h>

int main(void)
{
   int n, i, x=0, a[100];

   scanf("%d",&n);
   for(i=0;i<n;i++)
      scanf("%d",&a[i]);

   for(i=0;i<n;i++)
      if((a[i]%2==0)&&(a[i]%3!=0)&&(a[i]%5!=0))
         x=1;

   if(x==0)
      printf("APPROVED\n");
   else
      printf("DENIED\n");
   return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<complex>
using namespace std;
int n;
int solve(){
	int ret,best=114514;
	for(int i=1;i<10;i++){
		for(int j=0;j<10;j++){
			int t=(1001*i)+(110*j);
			if(abs(t-n)<best)ret=t,best=abs(t-n);
		}
	}
	for(int i=1;i<10;i++){
		for(int j=0;j<10;j++){
			int t=(101*i)+(10*j);
			if(abs(t-n)<best)ret=t,best=abs(t-n);
		}
	}
	for(int i=1;i<10;i++){
		int t=11*i;
		if(abs(t-n)<best)ret=t,best=abs(t-n);
	}
	return ret;
}
int main(){
	cin>>n;
	if(n<10){
		cout<<n<<endl;
		return 0;
	}
	cout<<solve()<<endl;
	return 0;
}

Measured memory_bytes: 3092
N = int(input())
H = list(map(int, input().split()))
for i in range(N - 1, 0, -1):
	if H[i] < H[i - 1] - 1:
		print('No')
		break
	elif H[i] == H[i - 1] - 1:
		H[i - 1] -= 1
else:
	print('Yes')


Measured memory_bytes: 20656
#include<bits/stdc++.h>
using namespace std;
bool a[100001];
int main()
{
	int n,x,y;
	int cnt=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x>>y;
		for(int i=x;i<=y;i++)
		{
			a[i]=true;
		}
	}
	for(int i=1;i<=100001;i++)
	{
		if(a[i])cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 384
n,y = map(int, input().split())

for i10000 in range(n+1):
  for i5000 in range(n+1):
    i1000 = (y - (i10000*10000 + i5000*5000)) // 1000
    if i1000 >= 0 and i1000 + i5000 + i10000 == n:
      print(i10000, i5000, i1000)
      exit()

print('-1 -1 -1')

Measured memory_bytes: 9176
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int32_t main(){
	string s;
	cin >> s;
	
	if(s == "ABC")
		cout << "ARC";
	else
		cout << "ABC";

	return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  ll cnt=0;
  bool flg=false;
  ll min=INF;
  vll a(n);
  rep(i,n){
    cin>>a[i];
    if(a[i]<0) cnt++;
    if(a[i]==0) flg=true;
    chmin(min,abs(a[i]));
  }
  
  ll ans=0;
  rep(i,n){
    ans+=abs(a[i]);
  }
  if(flg||cnt%2==0){
    
  }else{
    ans-=min*2;
  }
  cout<<ans<<endl;
  
}

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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

const int dx[] = { -1, 0, 1, 0 };
const int dy[] = { 0, 1, 0, -1 };

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	string s;
	cin >> s;

	string ans = "";
	for (int i = 0; i < s.size(); i++) {
		if ((i + 1) & 1) {
			ans += s[i];
		}
	}

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


Measured memory_bytes: 592
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
map<int, int> mp;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

// ^= -> ビットごとの排他的論理和を計算する
int a[27], b[27];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	int re = 0;
	int bl = 0;
	rep(i, n) {
		if (s.at(i) == 'R') {
			re++;
		}
		else {
			bl++;
		}
	}
	if (re > bl) {
		cout << "Yes" << endl;

	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

#include <fstream>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  /*
  ifstream in("input.txt");
  cin.rdbuf(in.rdbuf());
  //*/
  int ans = 0;
  vector<int> cosin(5);
  for (int i = 0; i < 5; i++) {
    cin >> cosin[i];
  }
  int Min = 999999;
  do {
    ans = 0;
    for (int i = 0; i < 4; i++) {
      ans += cosin[i];
      if (ans % 10 != 0) {
        ans += (10 - ans % 10);
      }
    }
    ans += cosin[4];
    Min = min(Min, ans);
  } while (next_permutation(cosin.begin(), cosin.end()));
  cout << Min << endl;
}


Measured memory_bytes: 3596
import sys
import itertools
# import numpy as np
import time

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

class UnionFind(object):
    def __init__(self, n = 1):
        self.link = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.link[x] == x:
            return x

        # re-connect union find to make the height of tree lower
        # you can use while, but recursion makes it easier to reconnect
        self.link[x] = self.find(self.link[x])
        return self.link[x]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return

        if self.size[x] < self.size[y]:
            x, y = y, x
        self.link[y] = x
        self.size[x] += self.size[y]
    
    def get_size(self, x):
        x = self.find(x)
        return self.size[x]

# from union_find import *

# n, m = map(int, readline().split())

# u = UnionFind(n)

# a = [0 for _ in range(m)]
# b = [0 for _ in range(m)]

# for i in range(m):
#     a[i], b[i] = map(lambda x: int(x) - 1, readline().split())

# ans = [None for _ in range(m)]

# ans[-1] = n * (n - 1) // 2

# for i in range(m - 1, 0, -1):
#     x = a[i]
#     y = b[i]
#     if u.is_same(x, y):
#         ans[i - 1] = ans[i]
#     else:
#         ans[i - 1] = ans[i] - (u.get_size(x) * u.get_size(y))
#     u.unite(x, y)

# for a in ans:
#     print(a)

N, M = map(int, input().split())
A, B = [None] * M, [None] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())

uf = UnionFind(N)
ans = [None] * M
ans[M - 1] = N * (N - 1) // 2
for i in range(M - 1, 0, -1):
    x, y = A[i] - 1, B[i] - 1
    if uf.is_same(x, y):
        ans[i - 1] = ans[i]
    else:
        ans[i - 1] = ans[i] - (uf.get_size(x) * uf.get_size(y))
    uf.unite(x, y)

for a in ans:
    print(a)

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

readInt = fst . fromJust . BS.readInt

getInt = readInt <$> BS.getLine

divide :: Int -> Int -> Int -> Int -> Int
divide (-1) b c x = 0
divide a b c x = count + divide (a -1) b c x
  where
    remain = x - 500 * a
    count =
      if remain <= 100 * b + 50 * c
        then divideBc b c remain
        else 0

divideBc :: Int -> Int -> Int -> Int
divideBc (-1) c x = 0
divideBc b c x = count + divideBc (b -1) c x
  where
    remain = x - 100 * b
    count =
      if remain >= 0 then do
        let divided = remain `div` 50
        if divided <= c
          then 1
          else 0
      else 0

main = do
  a <- getInt
  b <- getInt
  c <- getInt
  x <- getInt
  print $ divide a b c x


Measured memory_bytes: 380
N=int(input())
A=[int(a) for a in input().split()]

#e,e->e
#o,o->e
#e,o->o : oddの個数の保存

#oddを消すことを考える
#oddが偶数個なら簡単に消せる
#oddが奇数個なら, どんなに頑張っても消えなくね


if(sum(A)%2==0):
	print("YES")
else:
	print("NO")

Measured memory_bytes: 14108
#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 pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    string s;
    while(getline(cin,s),s!="."){
        stack<int> st;
        bool ans=true;
        int n=s.size();
        --n;
        int c1=0,c2=0;
        rep(i,n){
            if(s[i]=='('){
                ++c1;
                st.push(0);
            }
            else if(s[i]=='['){
                ++c2;
                st.push(1);
            }
            else if(s[i]==')'){
                --c1;
                if(c1<0||st.top()==1) ans=false;
                st.pop();
            }
            else if(s[i]==']'){
                --c2;
                if(c2<0||st.top()==0) ans=false;
                st.pop();
            }
            if(!ans) break;
        }
        if(ans&&c1==0&&c2==0) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long
#define lli long long int

using namespace std;
using P = pair<int,int>;

int main(){

  int N;
  cin >> N;
  int ans = 0;

  for (int i = 1; i <= N; i++) {
    if(i < 10){ //9
      ans++;
    }else if(i > 99 && i < 1000){ // 100 - 999
      ans++;
    }else if(i > 9999 && i < 100000){ // 10000 - 99999
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
    while(1){
        int a, b, c;
        cin >> a;
        string op;
        cin >> op;
        cin >> b;
        if(op == "+"){
            c = a + b;
        }else if(op == "-"){
            c = a - b;
        }else if(op == "*"){
            c = a * b;
        }else if(op == "/"){
            c = a / b;
        }else if(op == "?"){
            break;
        }
        cout << c << endl;
    }
}


Measured memory_bytes: 3144
import java.util.*;

public class Main{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    String s=sc.nextLine();
    if(s.charAt(s.length()-1)=='s')
    s+="es";
    else
    s+='s';
    System.out.println(s);
  }
}


Measured memory_bytes: 38516
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;



int main(void){
	int A,B,C,D,sum=0;
	scanf("%d%d%d%d",&A,&B,&C,&D);
	if(A>B){
		sum+=B;
	}else{
		sum+=A;
	}
	if(C>D){
		sum+=D;
	}else{
		sum+=C;
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int m,n;
	int result;
	int now,sum;
	int i,j;
	scanf("%d%d",&m,&n);
	result=0;
	for(i=0;i<m;i++) {
		sum=0;
		for(j=0;j<n;j++) {
			scanf("%d",&now);
			if(now)sum++;
		}
		if(result<sum)result=sum;
	}
	printf("%d\n",result);
	return 0;
}

Measured memory_bytes: 0
import java.util.*;

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

        System.out.println(c-a-b > 0 && 4*a*b < (c-a-b)*(c-a-b) ? "Yes" : "No");
    }
}


Measured memory_bytes: 23124
//E.cpp
#include<bits/stdc++.h>

#include <unordered_map>
using namespace std;

int main(){
	int n;
	int w;
	cin >> n >> w;
	vector< vector<int> > warr(n, vector<int>(2, 0));

	int sumv = 0;
	for(int i = 0; i < n; i++){
		cin >> warr[i][0] >> warr[i][1];
		sumv += warr[i][1];
	}

 	vector< vector<long long int> > dp(n, vector<long long int> (sumv+1, -1));

 	int a, b;

 	dp[0][warr[0][1]] = warr[0][0];
 	dp[0][0] = 0;


 	int ans = 0;
 	int maxv = 0;
 	for(int s = 0; s <= sumv; s++)
 		if(0 <= dp[0][s] && dp[0][s] <= w && s > ans ){
 				ans = s;
 		}
 	for(int i = 1; i < n; i++){
 		dp[i][0] = 0;
 		for(int s = 1; s <= sumv; s++){
 			dp[i][s] = dp[i-1][s];
 			if(s - warr[i][1] >= 0 && dp[i-1][s - warr[i][1]] >= 0 ){
 				if(dp[i][s] < 0)
 					dp[i][s] =  dp[i-1][s - warr[i][1]] + warr[i][0];
 				else
 					dp[i][s] = min(dp[i][s], dp[i-1][s - warr[i][1]] + warr[i][0]);
 			}
 			if(0 <= dp[i][s] && dp[i][s] <= w && s > ans ){
 				//cout << ans << " " << s << endl;
 				ans = s;
 			}
 		}
 	}


 	// for(int i = 0; i < n; i++){
 	// 	for(int s = 0; s <= sumv; s++){
 	// 		cout << dp[i][s] << " "; 
 	// 	}
 	// 	cout << endl;
 	// }

 	cout << ans << endl;;





	return 0;

	
		
}

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

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

  string S;
  cin >> S;

  char tmp;
  int count = 1;

  rep(i, S.size()) {
    if (i == 0) {
      tmp = S[i];
      continue;
    }
    if (tmp != S[i]) {
      count++;
    }
    tmp = S[i];
  }

  cout << count << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long K,N;
  cin >> K >> N; 

  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long min_ans,rootA,rootB,rootmin;
  min_ans = 1000000;

  for (int i = 0; i < N; i++) {
      if(i==0){
          rootA = A[N-1] - A[0];
          rootB = K - (A[i+1] - A[i]);
          rootmin = min(rootA,rootB);
          min_ans = min(min_ans,rootmin);  
      }else if(i==(N-1)){
          rootA = K - (A[i] - A[i-1]);
          rootB = A[N-1] - A[0];
          rootmin = min(rootA,rootB);
          min_ans = min(min_ans,rootmin);  
      }else{
        rootA = K - (A[i] - A[i-1]);
        rootB = K - (A[i+1] - A[i]);
        rootmin = min(rootA,rootB);
          min_ans = min(min_ans,rootmin);  
      }
  }
  cout << min_ans <<endl;
  return 0;

  }


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
int main(){
	long double b;
	long long a;
	cin>>a>>b;
	cout<<a*b<<endl;
	return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h> // Replace needed headers for speed up

// -------------8<------- start of library -------8<------------------------
template<typename T>
struct RangeMinimumQuery {
    const T INF;
    int n;
    std::vector<T> val;

    RangeMinimumQuery(int size, T inf = std::numeric_limits<T>::max()) : INF(inf) {
        for (n = 1; n < size; ) n <<= 1;
        val.assign(2 * n + 1, INF);
    }

    // 最小値を返す
    inline T op(T v1, T v2) const { return v1 <= v2 ? v1 : v2; }

    void update(int idx, T v) {
        idx += n - 1;
        val[idx] = v;
        while (0 < idx) {
            idx = (idx - 1) >> 1;
            val[idx] = std::min(val[2 * idx + 1], val[2 * idx + 2]);
        }
    }
    T find(int l, int r) {
        T res = INF;
        l += n - 1; r += n - 1;
        while (l < r) {
            if ((l & 1) == 0) res = std::min(res, val[l]);
            if ((r & 1) == 0) res = std::min(res, val[r - 1]);
            l >>= 1;
            r = (r - 1) >> 1;
        }
        return res;
    }
};

// -------------8<------- end of library ---------8-------------------------
int main() {
    int n, q;
    std::cin >> n >> q;

    RangeMinimumQuery<int> rmq(n);
    for (int i = 0, com, x, y; i < q; ++i) {
        std::cin >> com >> x >> y;
        if (com == 0) rmq.update(x, y);
        else std::cout << rmq.find(x, y + 1) << '\n';
    }

    return 0;
}



Measured memory_bytes: 3776
N, Y = map(int, input().split())
answer = -1,-1,-1

# x:m10, y:m5, z:m1 とする
for x in range(N+1):
    for y in range(N-x+1):
        z = N-x-y
        if 0 <= z <= 2000 and 10000*x + 5000*y + 1000*z == Y:
            answer = x, y, z
            break
    else:
        continue
    break
print(*answer)

Measured memory_bytes: 9048
// Problem : D - Replacing
// Contest : AtCoder - AtCoder Beginner Contest 171
// URL : https://atcoder.jp/contests/abc171/tasks/abc171_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N;
	cin>>N;
	vi v(N);
	map<int,int> m;
	ll sum=0;
	F0R(x,N)
		cin>>v[x],m[v[x]]++,sum+=v[x];
	int Q;
	cin>>Q;
	F0R(x,Q)
	{
		ll a,b;
		cin>>a>>b;
		sum-=a*m[a];
		sum+=b*m[a];
		m[b]+=m[a];
		m[a]=0;
		cout<<sum<<endl;
	}
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

const int ISPRIME_SIZE=11111111;
bool isprime[ISPRIME_SIZE];
struct isprime_exec{
    isprime_exec(){
        for(int i=0;i<ISPRIME_SIZE;i++)isprime[i]=true;
        isprime[0]=isprime[1]=false;
        for(int i=2;i<ISPRIME_SIZE;i++){
            if(!isprime[i])continue;
            for(int j=i+i;j<ISPRIME_SIZE;j+=i)isprime[j]=false;
        }
    }
}isprimeexec;

int a[111111];

signed main(){
    for(int i=1;i<111111;i++){
        if(isprime[i]&&isprime[(i+1)/2])a[i]++;
        a[i]+=a[i-1];
    }

    int Q;cin>>Q;
    while(Q--){
        int l,r;cin>>l>>r;
        cout<<a[r]-a[l-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 12288