akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,ans,t;
  int a[1000];
  while(1){
  cin >> n;
  if(n==0) break;
  for(int i=0; i<n; i++){
	cin >> a[i];
  }
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
	t = a[i] - a[j];
	if(t<0) t = t*(-1);
	if(i==0 && j==i+1) ans = t;
	ans = min(ans,t);
    }
  }
  cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
// Author: droftware
#include <bits/stdc++.h>

#define forn(i,a,n) for(int i=a;i<(int)n;i++)
#define DRT()  int t; cin>>t; while(t--)

#define TRACE
#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#else
#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif
using namespace std;

const int N = 1e5+5;

bool dp[N]; int nums[N];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	int n,k;
	cin>>n>>k;
	forn(i,0,n){
		cin>>nums[i];
	}
	dp[0] = false;
	for(int i = 1; i <= k; ++i){
		dp[i] = false;
		for(int j = 0; j < n; ++j){
			if(i - nums[j] >= 0){
				if(!dp[i - nums[j]]){
					dp[i] = true;
					break;
				}
			}
		}
	}
	if(dp[k])
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;
}
	
	



Measured memory_bytes: 384
import java.util.*;
import java.util.stream.*;
import java.util.function.*;


class Store{
    // 円
    long a;
    // 本
    int b;
    public Store(long a, int b) {
        this.a = a;
        this.b = b;
    }
}
public class Main {
    public static void main(String[] args) throws Exception {
        System.out.println(new Main().solve());
    }
    
    // パラメタ渡しもちゃんとクラス作るのも面倒なので手抜き
    // 必要な値はここで全部取ってしまう
    Scanner sc = new Scanner(System.in);
    // 店
    int n = Integer.parseInt(sc.next());
    // 本数
    int m = Integer.parseInt(sc.next());
    
    List<Store> stores = IntStream.range(0, n)
                .mapToObj(i -> new Store(Integer.parseInt(sc.next()), Integer.parseInt(sc.next())) )
                .sorted((s1, s2) -> (int)(s1.a - s2.a))
                .collect(Collectors.toList());
    
    long solve() {
        long result = 0L;
        int count = 0;
        
        for(Store s: stores) {
            if(count + s.b < m) {
                count += s.b;
                result += s.a * s.b;
            } else {
                result += s.a * (m - count);
                break;
            }
        }
        
        return result;
    }
    
}


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

int main() {
  int N;
  int L[11];
  cin >> N;
  int i;
  for(i=0;i<N;i++) cin >> L[i];
  int Lmax=L[0];
  int Lsum=0;
  for(i=1;i<N;i++){
    if (L[i]>Lmax) Lmax = L[i];
  }
  for(i=0;i<N;i++){
    Lsum += L[i];
  }
  Lsum -= Lmax;
  if (Lsum>Lmax) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
from fractions import gcd
from math import factorial, ceil, sqrt, atan2, log
from itertools import *
import string
import copy
import random
import bisect
from decimal import *
def id_generator(size=20, chars=string.digits):
    return ''.join(random.choice(chars) for _ in range(size))
 
def mp():
    return map(int,str(raw_input()).split())

x=input()
a=input()
b=input()
print (x-a)%b

Measured memory_bytes: 6032
n = int(input())
s = input()
num_r=s.count('R')
if num_r==n or num_r==0:
    print('0')
    exit()

red=[]
for i in range(n):
    if s[i]=='R':
        red.append(i)
ans = num_r
for j in red:
    if j+1 <=num_r:
        ans-=1
print(ans)


Measured memory_bytes: 16644
// https://atcoder.jp/contests/abc097/tasks/abc097_a
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define REP(i, n) FOR(i, 0, n)
#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()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - b) <= d && abs(b - c) <= d || abs(c - a) <= d) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

Measured memory_bytes: 256
from collections import Counter

n, m = map(int, input().split())
a = Counter(list(map(int, input().split())))
bc = [map(int, input().split()) for i in range(m)]
b = {}
ans = 0

for i, j in bc:
    if j in b:
        ref = b[j]
        b[j] = ref + i
    else:
        b[j] = i

d = Counter(a) + Counter(b)
keys = sorted(d)[::-1]

for key in keys:
    qty = d[key]
    if qty < n:
        ans += qty*key
        n -= qty
    else:
        ans += n*key
        break

print(ans)

Measured memory_bytes: 97052
#include <stdio.h>
#include <stdlib.h>

int int_sort(const void*a, const void*b) {
  return (*(int*)a - *(int*)b);
}

int main(void) {
  int P, Q, R;
  scanf("%d%d%d", &P, &Q, &R);

  int X[3];
  X[0] = P + Q;
  X[1] = P + R;
  X[2] = Q + R;
  qsort(X, 3, sizeof(int), int_sort);
  printf("%d\n", X[0]);
  return 0;
}


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

int main(){
  int n; cin>>n;
  vector<int> num(n);
  int count=1;
  for(int i=0;i<n;i++){
    cin>>num[i];
    if(count==num[i]){
      count++;
    }
  }
  count--;
  if(count==0){
    cout<<-1<<endl;
  }else{
    cout<<n-count<<endl;
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define N 112345
vpii g[N];
int x[N];

void dfs(int a, int b, int p){
	x[a] = b;
	for(pii &i : g[a]){
		if(i.first==p) continue;
		if(i.second%2) dfs(i.first, 1-b, a);
		else dfs(i.first, b, a);
	}
}

int main(){
	int n; scanf("%d", &n);
	REP(i, n-1){
		int a, b, c; scanf("%d%d%d", &a, &b, &c);
		g[a].EB(b, c);
		g[b].EB(a, c);
	}
	dfs(1, 0, 0);
	REP(i, n) printf("%d\n", x[i+1]);
}


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

int main(){
	int n;
	cin >> n;
	REP(i,26){
		REP(j,15){
			if(i * 4 + j * 7 == n){
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

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

class Proc{
	public:
		string nam;
		int tim;
		Proc(){
			nam="";
			tim=0;
		}
};

Proc Q[100001];

class Queue{
	private:
		int fp;
		int rp;
	public:
		Queue(){
			fp=0;
			rp=0;
		}
		int next(int p) const{
			return (p+1)%100001;
		}
		bool isFull() const{
			return (next(rp)==fp);
		}
		bool isEmpty() const{
			return (rp==fp);
		}
		void push(Proc d);
		Proc front();
		void pop();
};

void Queue::push(Proc d){
	if(isFull()){
		return;
	}
	Q[rp]=d;
	rp=next(rp);
}

Proc Queue::front(){
	if(isEmpty()){
		Proc er;
		er.tim=-1;
		return er;
	}
	return Q[fp];
}

void Queue::pop(){
	if(isEmpty()){
		return;
	}
	fp=next(fp);
}


int main(){
	Queue que;
	int n,q;
	cin>>n>>q;
	for(int i=0;i<n;i++){
		Proc p;
		cin>>p.nam>>p.tim;
		que.push(p);
	}
	int total_tim=0;
	while(!que.isEmpty()){
		Proc p=que.front();
		que.pop();
		if(p.tim<=q){
			total_tim+=p.tim;
			cout<<p.nam<<' '<<total_tim<<endl;
		}else{
			total_tim+=q;
			p.tim-=q;
			que.push(p);
		}
	}
	return 0;
}

Measured memory_bytes: 6972
#include <bits/stdc++.h>
using namespace std;
void BubbleSort(vector<int> &A, int N){
    int bf;
    bool flag = true;
    int Count = 0;

    while ( flag ){
        flag = false;
        for ( int i = N - 1; i >= 1; i-- ){
            if ( A.at(i) < A.at(i-1) ){
                bf        = A.at(i);
                A.at(i)   = A.at(i-1);
                A.at(i-1) = bf;
                flag = true;
                Count++;
            }
        }
    }
    for ( int i = 0; i < N - 1; i++ ){
        cout << A.at(i) << " ";
    }
    cout << A.at(N-1) << endl;
    cout << Count << endl;
}
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for ( int i = 0; i < N; i++ ) cin >> A.at(i);
    
    BubbleSort( A, N );

    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y first
#define st string
#define ull unsigned long long
#define size(s) s.size()
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
/*inline void write(long long x) {
  static long long sta[35];
  long long top = 0;
  do {
    sta[top++] = x % 10, x /= 10;
  } while (x);
  while (top) putchar(sta[--top] + 48);
  puts("");
}
bool prime(int n)
{
	if(n==0||n==1)
	  return false;
	for(int i=2;i*i<=n;i++)
	  if(n%i==0)
	    return false;
	return true;
}
const ll power(int n,int k)
{
	ll t=1;
	rep(i,k)
	  t*=n;
	return t;
}
const string turn2(int n)
{
	string s="";
	while(n!=0)
	{
		s+=(char)(n%2+'0');
		n/=2;
	}
	reverse(s.begin(),s.end());
	return s;
}
const string turn16(int n)
{
	string s="";
	while(n!=0)
	{
		if(n%16>9)
		  s+=(char)('A'+n%16-10);
		else
		  s+=(char)('0'+n%16);
		n/=16;
	}
	reverse(s.begin(),s.end());
	return s;
}*/
int main()
{
	long long n,m;
	cin>>n>>m;
	if(n*500>=m)
	{
		cout<<"Yes\n";
		return 0;
	}
	else {
		cout<<"No\n";
		return 0;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <map>
#define fr first
#define sc second
using namespace std;

int main(){
  typedef pair<int,int> P;
  int n,a,b,ap,bp,prev;
  P rank[101],tmp[101];
  memset(rank,0,sizeof(rank));
  cin >> n;
  for(int i=0;i<n*(n-1)/2;i++){
    cin >> a >> b >> ap >> bp;
    if(ap == bp){ rank[a].fr++; rank[b].fr++;}
    else if(ap > bp) rank[a].fr += 3;
    else rank[b].fr += 3;
  }
  copy(rank+1,rank+n+1,tmp);
  sort(rank+1,rank+n+1,greater<P>());
  prev = rank[1].fr; int r_p = 1;
  for(int i=1;i<=n;i++){
    if(prev == rank[i].fr) rank[i].sc = r_p;
    else{ rank[i].sc = i;  r_p = i; }
    prev = rank[i].fr;
  }
  for(int i=0;i<n;i++){
    for(int j=1;j<=n;j++){
      if(tmp[i].fr == rank[j].fr){ cout << rank[j].sc << endl; break;}
    }
  }
}

Measured memory_bytes: 1164
import sys

x, n = map(int, input().split())
if n == 0:
  print(x)
  sys.exit()

p = list(map(int, input().split()))

smallest = int(2 ** 63 - 1)
ans = x
for i in range(-1000, 1000):
  if i in p:
    continue

  tmp = abs(x - i)
  if tmp < smallest:
    smallest = tmp
    ans = i

print(ans)


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

using namespace std;

int n=0,k=0;	
double arr[200000];
int p[200000];

int main()
{
	cin >> n >> k;	
	for (int i=0; i<n; i++)
		cin >> p[i];
	for (int i=0; i<n; i++)
	{
		arr[i] = p[i]*(p[i]+1)/2;
		arr[i]/=p[i];
	}
	double Max = 0;
	for (int i=0; i<k; i++)
	{
		Max+=arr[i];
	}
	double sum = Max;
	for (int i=k; i<n; i++)
	{
		sum-=arr[i-k];
		sum+=arr[i];
		Max = max(Max, sum);
	}
	cout << fixed << setprecision(7) << Max;
	return 0;
}	


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define r(i,a,n) for(i=0;i<n;)
using namespace std;
int main(){
	string s;
	int i,j,k,l,sum=0,a,b,c;
	cin>>s;
	r(i,0,s.size()){
		a=b=c=0;
		for(;s[i]=='J';a++)i++;
		for(;s[i]=='O';b++)i++;
		for(;s[i]=='I';c++)i++;
		if(b<=a&&b<=c)sum=max(b,sum);
	}
	cout<<sum<<endl;
}

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

int main() {
    long long ara[10005],mn=1000000000000,mx=-10000000000000,sum=0;
    long long  num,a;
    cin >> num;
    for(int i=0; i<num; i++) {
        scanf("%lld",&ara[i]);
        mx=max(mx,ara[i]);
        mn=min(mn,ara[i]);
        sum+=ara[i];
    }
    cout << mn << " " << mx << " " << sum << endl;

    return 0;

}



Measured memory_bytes: 3340
n=int(input())
k=int(input())
xs=list(map(int,input().split(' ')))
#A (0,i)
#B (K,i)
sum=0
for i in range(n):
  deltak=abs(xs[i]-k)
  if xs[i]<deltak:
    sum+=2*xs[i]
  else:
    sum+=deltak*2
print(sum)

Measured memory_bytes: 9112
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()

	ans := 0
	for m := 0; m*m <= n; m++ {
		if n%(m+1) != 0 {
			continue
		}
		if m > 0 && n/m == n%m {
			ans += m
		}
		k := n/(m+1) - 1
		if k > 0 && n/k == n%k {
			ans += k
		}
	}

	puts(ans)
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  rep(i, n) {
    cout << s[i] << t[i];
  }
  cout << endl;
}


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

using namespace std;

int main()
{

    string str;
    getline(cin,str);

    int digit,len,i,koita=0;

    len=str.size();

    for(i=0;i<len;i++)
    {
       digit= str[i]- '0';

       if(digit==1)
            koita++;

    }

    printf("%d\n",koita);

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <utility>
#include <vector>
#include <map>
using namespace std;
typedef long long int ll;
typedef double db;
const int INF = 1e9 + 5;

void solve()
{
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if (((c + b - 1) / b) <= ((a + d - 1) / d))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main()
{
//	int t;
//	cin >> t;
//	while (t-- > 0)
	solve();
}


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

using namespace std;
using ll = long long;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

#define LOCAL
#ifdef LOCAL
#define show(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

struct AccSum{
    vector<ll> Ac;
    ll L;
    AccSum(vector<ll> &A){
        L = A.size();
        Ac.resize(L+1);
        FOR(i, 0, L){
            Ac[i+1] = Ac[i] + A[i];
        }
    }

    // sum of [a, b]
    ll sum(ll a, ll b){
        if(a<0) return -1;
        if(b>L-1) return -1;
        return Ac[b+1] - Ac[a];
    }
};

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

    // input
    ll N, K;
    cin >> N >> K;

    show(N);
    show(K);

    string s;
    cin >> s;
    ll L = s.size();

    // count 
    vector<ll> C;

    if(s[0]=='0'){
        C.push_back(0);
    }

    char current = s[0];
    ll count = 1;
    FOR(i, 1, L){
        char c = s[i];
        if(c==current){
            count++;
        }else{
            C.push_back(count);
            count = 1;
        }
        current = c;
    }
    C.push_back(count);

    if(s.back()=='0'){
        C.push_back(0);
    }

    ll black_num = C.size()/2;
    if(black_num <= K){
        // 全部1にできる
        ll sum = 0;
        for(ll c : C){
            sum += c;
        }
        p(sum);
        return 0;
    }

    // 累積和
    auto Ac = AccSum(C);
    ll max_sum = 0;

    for(int i=0; i<C.size()-2*K+1; i+=2){
        ll sum = Ac.sum(i, i+2*K);
        max_sum = max(max_sum, sum);
    }

    p(max_sum);
    
    return 0;
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N, K; cin >> N >> K;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        int h; cin >> h;
        if (h >= K) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
	LL a, b, k;
	cin >> a >> b >> k;

	if (a >= k) {
		a -= k;
		k = 0;
	}
	else {
		k -= a;
		a = 0;
	}

	if (b >= k) {
		b -= k;
	}
	else {
		b = 0;
	}

	cout << a << ' ' << b << endl;
	return 0;
}


Measured memory_bytes: 3628
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

void solve()
  {

	int d,t,s;
	cin>>d>>t>>s;
	if(d<=s*t)cout<<"Yes";
	else cout<<"No";

  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}


Measured memory_bytes: 3644
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.LongStream;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int a = 5000100;
		long[] arr = new long[5000];
		for(int i = 0; i < 5000; i++) {
			arr[i] = i;
		}
		Arrays.parallelPrefix(arr, Long::sum);
		long Tmin = 0;
		long Tmax = 5000;
		long T = 0;
		while(Tmax - Tmin > 1) {
			T = Tmin + (Tmax - Tmin) / 2;
			if(arr[(int) T] > n) {
				Tmax= T;
			} else {
				Tmin = T;
			}
		}
		long x = arr[(int) Tmax] - n;
		LongStream.rangeClosed(1, Tmax).filter(l -> l != x).forEach(System.out::println);
	}
}

Measured memory_bytes: 30548
N, K = map(int, input().split())
P = list(map(int, input().split()))
max_p = max(P)
dp = [0] * (max_p + 1)
dp[1] = 1
for i in range(2, max_p + 1):
    dp[i] = dp[i - 1] + 0.5
S = 0
for j in range(K):
    S += dp[P[j]]
ans = S
for i in range(1, N - K + 1):
    S = S - dp[P[i - 1]] + dp[P[i + K - 1]]
    ans = max(ans, S)
print(ans)

Measured memory_bytes: 24804
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
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 long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
	
	
	int i,x,y,z;
	cin>>x>>y>>z;
	cout<<(x-z)/(y+z)<<endl;
	
	
	
	
	
	
	
	
//////////////////////////////////////////////////////
return 0;}











Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <utility>
#include <cmath>
#include <cstdio>

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;
LL MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<LL> A(N, 0);
    vector<vector<LL>> dp(N+1, vector<LL>(N+1, 0));
    for(int i=0; i<N; i++) cin >> A[i];

    LL dir = 1;
    if(N%2==0) dir = -1;
    for(int d=0; d<=N; d++, dir *= -1) {
        if(d==0) {
            for(int i=0; i<N; i++) {
                dp[i][i+1] = dir * A[i]; 

            }
            continue;
        }
        for(int i=0; i+d<=N; i++) {
            int j = i+d;
            if(dir == 1) {
                dp[i][j] = max(dp[i][j-1] + A[j-1] , dp[i+1][j] + A[i]);
            }
            if(dir == -1) {
                dp[i][j] = min(dp[i][j-1] - A[j-1] , dp[i+1][j] - A[i]);
            }
            //cout << i << " " << j << " " << dp[i][j]<< endl;
        }

    }
    cout << -dp[0][N] << endl;

    return 0;
}

Measured memory_bytes: 70784
n = gets.to_i
s = gets.split('')

cnt = 0
(n-1).times do |i|
  j = i + 1
  k = i + 2
  while k < n
    cnt += 1 if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k])
    j += 1
    k += 2
  end
end

puts s.count('R') * s.count('G') * s.count('B') - cnt

Measured memory_bytes: 14328
#include <iostream>
#include <algorithm>
//#include <fstream>

using namespace std;

string dec2bin (int n )
{
	string res = "";
	int count = 0;

	while (n > 0 || count < 8){
		res += n % 2 + '0';
		n /= 2;
		++count;
	} // end while
	
	reverse (res.begin(), res.end() );

	return res;
}

string dec2bin_dec (double n )
{
	string res = "";
	double d = 0.5;
	int count = 0;

	while (n > 0.0 || count < 4){
		
		if (n >= d ){
			n -= d;
			res += '1';
		}else{
			res += '0';
		} // end if
		d /= 2.;
		++count;
	} // end while

	return res;
}
int main()
{
//	cut here before submit 
//	freopen ("testcase.binarydigit", "r", stdin );
	double n;

	while (cin >> n && n >= 0.0 ) {
		int    integer = (int)n;
		double decimal = n - (double)integer;
		string resi = dec2bin (integer);
		string resd = dec2bin_dec (decimal );
		
		if (resi.length() > 8 || resd.length() > 4){
			cout << "NA" << endl;
		}else{
			cout << resi << '.' << resd << endl;
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
n = int(input())
a_list = sorted(map(int, input().split()))

max_num = max(a_list)

is_ans = [False]*(max_num+1)
memo = [0]*(max_num+1)
for i in a_list:
    is_ans[i] = True
    memo[i] += 1

for i in range(1, max_num+1):
    if is_ans[i]:
        for j in range(2*i, max_num+1, i):
                is_ans[j] = False

    if memo[i] > 1:
        is_ans[i] = False

ans = is_ans.count(True)
print(ans)


Measured memory_bytes: 35024
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(3);
  cin>>a.at(0)>>a.at(1)>>a.at(2);
  sort(a.begin(),a.end());
  int ans=1;
  for(int i=0;i<2;i++){
    if(a.at(i)!=a.at(i+1)){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <cstdlib>
using namespace std;


int sim(string x){
	if (x.size() == 1) return 0;
	stringstream ss;
	string res;
	ss << (int)(x[0]+x[1]-'0'*2) << x.substr(2);
	ss >> res;
	return 1+sim(res);
}

main(){
	int n,i,j;
	cin >> n;
	while(n--){
		string s;
		cin >> s;
		cout << (sim(s)%2 ? "Fabre wins." : "Audrey wins.") << endl;
	}
	return 0;
}

Measured memory_bytes: 6000
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef unsigned  uint;
typedef unsigned long long int ull;
typedef pair<ll,ll> P;
typedef pair<P,long double> Pi;
typedef pair <long double,int> Pd;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=1000000007;
const uint mod=998244353;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
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; }
vector<vector<int>> graph,ch;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
graph.resize(n);
ch.resize(n);
for(int i=0;i<n+m-1;i++){
    int a,b;
    cin>>a>>b;
    --a;--b;
    graph[a].push_back(b);
    ch[b].push_back(a);
}
int par=0;
for(int i=0;i<n;i++){
    if(ch[i].size()==0){
        par=i;
        break;
    }
}
vector<P> ans(n,P(0,0));
queue<P> q;
q.push(P(par,0));
vector<int> used_times(n,0);
while(!q.empty()){
    P p=q.front();
    q.pop();
    for(int v:graph[p.fi]){
        if(ch[v].size()!=1){
            used_times[v]++;
             if(used_times[v]!=ch[v].size())continue;
        }
        ans[v]=P(p.fi+1,p.se);
         q.push(P(v,p.se+1));
        }
    }
for(int i=0;i<n;i++){
    cout<<ans[i].fi<<endl;
}
}


Measured memory_bytes: 13696
#include <bits/stdc++.h>
#include <stdio.h>
#include <cmath>

using namespace std;

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

//階乗
int factorial(int k){
    int result=1;
    for (int i=1;i<=k;++i){
        result*=i;
    }
    return result;
}


int main() {
    int n,T;
    cin>>n>>T;

    int mincost=inf;

    rep2(i,1,n){
        int c,t;
        cin>>c>>t;

        if(t<=T){
            mincost=min(mincost,c);
        }
    }

    if(mincost==inf){
        cout<<"TLE"<<endl;
        return 0;
    }

    cout<<mincost<<endl;

}






Measured memory_bytes: 256
import java.util.*;

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

		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if (a * c <= b){
			System.out.println(c);
		}else{
			System.out.println(b / a);
		}
	}
}


Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <stack>
#include <string>
#include <cstring>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <climits>

using namespace std;

const long long p = 1e9 + 7;
int n, m, T, a, b;

long long quick_mod(long long a, long long b)
{
    long long ans = 1;
    a %= p;
    while (b)
    {
        if (b & 1)
        {
            ans = ans * a % p;
            b--;
        }
        b >>= 1;
        a = a * a % p;
    }
    return ans;
}

long long C(long long n, long long m)
{
    if (m > n)
        return 0;
    long long ans = 1;
    for (int i = 1; i <= m; i++)
    {
        long long a = (n + i - m) % p;
        long long b = i % p;
        ans = ans * (a * quick_mod(b, p - 2) % p) % p;
    }
    return ans;
}

long long Lucas(long long n, long long m)
{
    if (m == 0)
        return 1;
    return C(n % p, m % p) * Lucas(n / p, m / p) % p;
}

int main()
{
#ifdef ONLINE_JUDGE
#else
    //freopen("r.txt", "r", stdin);
#endif
    ios::sync_with_stdio(false);

    cin >> n >> a >> b;

    long long ans = quick_mod(2, n) - 1 - Lucas(n, a) - Lucas(n, b);

    while (ans < 0)
        ans += p;

    cout << ans;
}

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

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll 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;
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int N, K; cin >> N >> K;
    if ((N-1)*(N-2)/2 - K < 0) cout << -1 << endl;
    else
    {
        cout << N-1 + (N-1)*(N-2)/2 - K << endl;
        REP(i, N-1)
        {
            cout << 1 << " " << i+2 << endl;
        }
        vector<pair<int, int> > E;
        REP(i, N-1)
        {
            REP(j, N-2)
            {
                if (i > j)
                {
                    E.pb(make_pair(i+2, j+2));
                }
            }
        }
        REP(i, (N-1)*(N-2)/2-K)
        {
            cout << E.at(i).first << " " << E.at(i).second << endl;
        }
    }
    return 0;
}



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

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
 
int main()
{
    int N,A,B,f=0,s=0,t=0,P;
    cin>>N>>A>>B;

    for(int i=1;i<=N;i++){
        cin>>P;
        if(P>=(B+1)){
            t++;
        }else if(P>=(A+1)&&P<=B){
            s++;
        }else{
            f++;
        }
    }

    cout<<min(f,min(s,t))<<endl;
 
    return 0;
}

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

int main()
{	
	int n, d;
	cin >> n >> d;
	int cnt = 0;
	for(int i = 0; i < n; i++){
		double x, y;
		cin >> x >> y;
		if((double)sqrt(x*x + y*y) <= (double)d){
			cnt++;
		}
	}
	cout << cnt;
	return 0;
}



Measured memory_bytes: 3800
# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
N=int(input())

if N>=30:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 72820
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
const int N=5005;
int dp[N][N];
int Pow(int x,int k)
{
	int s=1;
	while(k)
	{
		if(k&1)
			s=(s*x)%mod;
		x=(x*x)%mod;
		k>>=1;
	}
	return s;
}
main()
{
	memset(dp,0,sizeof(dp));
	int n,m;
	string s;
	dp[0][0]=1;
	for(int i=0;i<=5000;i++)
	{
		for(int j=0;j<=5000;j++)
		{
			if(dp[i][j]==0) 
				continue;
			dp[i+1][j+1]=(dp[i+1][j+1]+(2*dp[i][j])%mod)%mod;
			(dp[i+1][max(0LL,j-1)]+=dp[i][j]%mod)%=mod;	
		}
	}
	cin>>n>>s;
	cout<<(dp[n][s.size()]*Pow(Pow(2,s.size()),mod-2))%mod<<endl;
	return 0;
}


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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

const int MAX_N = 8;

int ans = 0;
int n;

vvi graph(MAX_N);

void dfs(set<int> s, int u) {
  if (s.size() == n) {
    ans++;
    return;
  }

  for (int v: graph[u]) {
    if (Find(s, v)) continue;
    set<int> tmp = s;
    tmp.insert(v);
    dfs(tmp, v);
  }
};

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

  cin >> n;
  int M;
  cin >> M;
  int a, b;
  rep(i, 0, M) {
    cin >> a >> b;
    a--; b--;
    graph[a].pb(b);
    graph[b].pb(a);
  }
  set<int> s;
  s.insert(0);
  dfs(s, 0);

  cout << ans << endl;

  return 0;
};


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  int even,odd;
  cin >> even >> odd;
  cout << even*(even-1)/2 + odd*(odd-1)/2 << endl;
}

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

int main() {
  string k;
  cin >> k;
  bool n9flag = true;
  int sento = k.at(0) - '0'; //数値変換
  int size = k.size() - 1;
  for (int i = 1; i < k.size(); i ++) {
  	// 全部９でないか確認
    int j = k.at(i) - '0';
    if (j != 9) {
    	n9flag = false;
      	break;
    }
  }
  if (n9flag) {
    int result = sento + size * 9;
  	cout << result << endl;
  } else {
  	int result = sento + size * 9 - 1;
  	cout << result << endl;
  }
}


Measured memory_bytes: 256
from sys import stdin
from itertools import repeat
def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split(), repeat(10, n))
    b = map(int, stdin.readline().split(), repeat(10, n))
    if sum(a) < sum(b):
        print -1
        return
    ans = s = 0
    p = []
    for i in xrange(n):
        if a[i] < b[i]:
            s += b[i] - a[i]
            ans += 1
        elif a[i] > b[i]:
            p.append(a[i] - b[i])
    p.sort(reverse=True)
    for x in p:
        if s <= 0:
            break
        s -= x
        ans += 1
    print ans
main()


Measured memory_bytes: 14520
#include <iostream>
#include <algorithm>
#include <vector>
//#include <numeric>

using namespace std;

typedef pair<int, int> Pii;

#define MP make_pair
#define F first
#define S second

int main() {
  
  int n, m, a;
  while(cin >> n >> m >> a, (n|m|a)) {
    vector<pair<int, Pii> > vec(m);
    for(int i=0; i<m; i++) {
      int h, p, q; cin >> h >> p >> q;
      vec[i] = MP(h, Pii(p, q));
    }
    
    sort(vec.begin(), vec.end());
    vector<int> ans(n+1);
    //iota(ans.begin(), ans.end(), 0);
    for(int i=0; i<n+1; i++)
      ans[i] = i;
    
    for(int i=0; i<m; i++)
      swap(ans[vec[i].S.F], ans[vec[i].S.S]);
    
    cout << ans[a] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
int sum1[2010][2010],sum2[2010][2010],sum3[2010][2010],a[2010][2010];
int gsum(int sum[2010][2010],int x1,int y1,int x2,int y2)
{
	return sum[x2][y2]-sum[x1-1][y2]-sum[x2][y1-1]+sum[x1-1][y1-1];
}
int main()
{
	int n,m,q;scanf("%d%d%d\n",&n,&m,&q);
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++)
	{
		if (getchar()=='1') a[i][j]=1;
		if (j==m) scanf("\n");
	}
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++)
	{
		sum1[i][j]=sum1[i-1][j]+sum1[i][j-1]-sum1[i-1][j-1]+a[i][j];
		sum2[i][j]=sum2[i-1][j]+sum2[i][j-1]-sum2[i-1][j-1]+(a[i][j]&a[i+1][j]);
		sum3[i][j]=sum3[i-1][j]+sum3[i][j-1]-sum3[i-1][j-1]+(a[i][j]&a[i][j+1]);
	}
	while (q--)
	{
		int x1,y1,x2,y2;scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		printf("%d\n",gsum(sum1,x1,y1,x2,y2)-gsum(sum2,x1,y1,x2-1,y2)-gsum(sum3,x1,y1,x2,y2-1));
	}
}

Measured memory_bytes: 64896
fun main(args: Array<String>) {
    val S = next()
    val ans = when (S) {
        "SUN" -> 7
        "MON" -> 6
        "TUE" -> 5
        "WED" -> 4
        "THU" -> 3
        "FRI" -> 2
        "SAT" -> 1
        else -> 0
    }
    println("${ans}")
}
fun next() = readLine()!!
fun nextLong() = next().toLong()

Measured memory_bytes: 31740
#include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
const int M=100010;
const int MOD=1000000007;
const int INF=1000000007;
using ll=long long;

int main() {
	int N,C,s,t,c,ans=0;
	int dp[M][33]={};	//dp[time][channel];
	int record[M]={};
	cin>>N>>C;
	rep(i,0,N){
		cin>>s>>t>>c;
		dp[s][c]++;
		dp[t][c]--;
	}
	rep(i,1,100000){
		rep(j,1,31){
			if(dp[i][j]==1){
				if(dp[i+1][j]==0)dp[i+1][j]=1;
				if(dp[i+1][j]==-1)dp[i+1][j]=2;
			}
			if(dp[i][j]!=0)record[i]+=1;
			if(i==99999&&dp[100000][j]!=0)record[100000]=+1;
		}
	}
	rep(i,0,100001)ans=max(ans,record[i]);
	cout<<ans;
}

Measured memory_bytes: 13568
#include<bits/stdc++.h>
#define fios ios_base::sync_with_stdio(false); cin.tie(0);
#define sf(x) scanf("%d",&x)
#define sfl(x) scanf("%lld",&x)
#define pf(x) printf("%d\n",x)
#define pfl(x) printf("%lld\n",x)
#define ll long long
#define nl "\n"
using namespace std;


int main()
{
    int a1,a2,a3;

    cin>>a1>>a2>>a3;

    if(a1+a2+a3>=22)
        cout<<"bust\n";
    else
        cout<<"win\n";

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int  main(){
  long N;
  cin>>N;
  vector<long>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  sort(A.begin(),A.end());
  bool ans=true;
  for(int i=0;i<N-1;i++){
    if(A[i]==A[i+1]){
      ans=false;
      break;
    }
  }
  if(ans==true)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}
  

Measured memory_bytes: 1792
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){
   int x;
   cin >> x;
   int hun = x/100;
   int res = x%100;

   int cnt = 0;
   if(res >= 5){
      while( res >=5 ){
         res = res - 5;
         cnt++;
      } 
   }
   if(res > 0) cnt++;

   if(cnt <= hun) cout << 1 << endl;
   else cout << 0 << endl;


   return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;

typedef struct Tree {
	int p=-1, l=-1, r=-1;
} Tree;

Tree tree[25];
int n;

int root() {
	for (int i = 0; i < n; i++) {
		if (tree[i].p == -1)
			return i;
	}
	return -1;
}


void prtw(int r) {
	if (r == -1)
		return;
	printf(" %d", r);
	prtw(tree[r].l);
	prtw(tree[r].r);

}
void intw(int r) {
	if (r == -1)
		return;
	intw(tree[r].l);
	printf(" %d", r);
	intw(tree[r].r);
}
void potw(int r) {
	if (r == -1)
		return;
	potw(tree[r].l);
	potw(tree[r].r);
	printf(" %d", r);
}

int main(){
	scanf("%d", &n);
	int id, l, r;
	for (int i = 0; i < n; i++) {
		scanf("%d%d%d", &id, &l, &r);
		tree[id].l = l;
		tree[id].r = r;
		if (l != -1)
			tree[l].p = id;
		if (r != -1)
			tree[r].p = id;
	}
	int rt = root();
	printf("Preorder\n");
	prtw(rt);
	printf("\nInorder\n");
	intw(rt);
	printf("\nPostorder\n");
	potw(rt);
	printf("\n");

	return 0;
}

Measured memory_bytes: 2724
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int solve(int n) {
  int ans = n * (n-1) / 2;
  return ans;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  cout << solve(a) + solve(b) << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}
char readc() {
	char c=getchar();
	while (c!='-'&&c!='+') c=getchar();
	return c;
}

const int N=100000+10;

int n;
ll dp[N][3];

int main() {
	n=read();
	dp[1][0]=read(),dp[1][1]=dp[1][2]=-1e18;
	for (int i=2;i<=n;++i) {
		char op=readc(); int w=read();
		if (op=='+') {
			dp[i][0]=max({dp[i-1][0],dp[i-1][1],dp[i-1][2]})+w;
			dp[i][1]=max(dp[i-1][1],dp[i-1][2])-w;
			dp[i][2]=dp[i-1][2]+w;
		} else {
			dp[i][0]=max({dp[i-1][0],dp[i-1][1],dp[i-1][2]})-w;
			dp[i][1]=max(max(dp[i-1][1],dp[i-1][2])+w,dp[i-1][0]-w);
			dp[i][2]=max(dp[i-1][1],dp[i-1][2])+w;
		}
	}
	printf("%lld\n",max({dp[n][0],dp[n][1],dp[n][2]}));
	return 0;
}

Measured memory_bytes: 6108