akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;

typedef long long ll;
const int MAXN=200005*4;
const int MOD=924844033;
const int G=5;

int n;
int siz[MAXN],cnt[MAXN];
ll a[MAXN],b[MAXN];
vector<int> E[MAXN];
ll fac[MAXN],finv[MAXN];

ll ksm(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1) res=res*x%MOD;
        x=x*x%MOD;
        y>>=1;
    }
    return res;
}

void Init(){
    fac[0]=1;
    for(int i=1;i<MAXN;i++) fac[i]=fac[i-1]*i%MOD;
    finv[1]=1;
    for(int i=2;i<MAXN;i++) finv[i]=1ll*(MOD-MOD/i)*finv[MOD%i]%MOD;
    finv[0]=1;
    for(int i=1;i<MAXN;i++) finv[i]=finv[i]*finv[i-1]%MOD;
}

void dfs(int u,int fa=0){
    siz[u]=1;
    for(int i=0;i<(int)E[u].size();i++){
        int v=E[u][i];
        if(v==fa) continue;
        dfs(v,u);
        siz[u]+=siz[v];
    }
    cnt[siz[u]]--;
    cnt[n-siz[u]]--;
}

void ntt(ll A[],int n,int mode){
    for(int i=1,j=0;i<n;i++){
        for(int s=n;j^=s>>=1,~j&s;);
        if(i<j) swap(A[i],A[j]);
    }
    for(int i=1;i<n;i<<=1){
        ll w1=ksm(G,(MOD-1)/(i<<1)),w=1;
        if(mode==-1) w1=ksm(w1,MOD-2);
        for(int j=0;j<i;j++,w=(1ll*w*w1)%MOD)
            for(int l=j,r=l+i;l<n;l+=(i<<1),r=l+i){
                int temp=1ll*A[r]*w%MOD;
                A[r]=(A[l]-temp+MOD)%MOD;
                A[l]=(A[l]+temp)%MOD;
            }
    }
    if(mode==-1){
        ll inv=ksm(n,MOD-2);
        for(int i=0;i<n;i++)
            A[i]=1ll*inv*A[i]%MOD;
    }
}

int main(){

    Init();
    scanf("%d",&n);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        E[u].push_back(v);
        E[v].push_back(u);
    }
    dfs(1);
    cnt[n]=n;
    for(int i=1;i<=n;i++){
        a[i]=cnt[i]*fac[i]%MOD;
        b[i]=finv[n-i];
        //printf("%lld %lld\n",a[i],b[i]);
    }
    ll len=1;
    for(;len<=n*2;len<<=1);
    ntt(a,len,1),ntt(b,len,1);
    for(int i=0;i<=len;i++)
        a[i]=a[i]*b[i]%MOD;
    ntt(a,len,-1);
    for(int i=1;i<=n;i++){
        ll ans=a[n+i]*finv[i]%MOD;
        ans=(ans+MOD)%MOD;
        printf("%lld\n",ans);
    }

    fclose(stdin);
    fclose(stdout);
}


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

int main() {
    int N;
    cin >> N;
    vector<int> heights(N);
    for (int i = 0; i < N; i++) cin >> heights[i];

    vector<int> dp(N, 0);
    dp[0] = 0;
    dp[1] = abs(heights[1] - heights[0]);

    for (int i = 2; i < N; i++) {
        int prevA = abs(heights[i] - heights[i - 1]);
        int prevB = abs(heights[i] - heights[i - 2]);

        dp[i] = min(prevA + dp[i - 1], prevB + dp[i - 2]);
    }

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


Measured memory_bytes: 1024
import java.io.*;
import java.util.ArrayList;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        long N = Long.parseLong(str);
        ArrayList<Long> num = new ArrayList<>();
        for (int i=1;i<Math.sqrt(N);i++){
            if ((N-i)%i==0 && (N-i)/i>i){
                num.add((long)(N-i)/i);
            }
        }
        long ans = 0;
        for (long n:num){
            ans += n;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23508
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

long long ans=0;
int tot=0,h[100005];
int n,m,x,y,S,T,k[100005],siz[100005];
int s[100005],top;
bool odd;
struct Edge{
    int x,next;
}e[200005];

inline void add_edge(int x,int y){
    e[++tot].x=y;
    e[tot].next=h[x],h[x]=tot;
}

void dfs1(int x,int fa){
    for(int i=h[x];i;i=e[i].next){
        if(e[i].x==fa)continue;
        if(siz[e[i].x]){
            if(siz[x]==siz[e[i].x])odd=true;
            S=x,T=e[i].x;
        }else{
            siz[e[i].x]=-siz[x];
            dfs1(e[i].x,x);
        }
    }
}

void dfs2(int x,int fa){
    for(int i=h[x];i;i=e[i].next){
        if(e[i].x==fa||(x==S&&e[i].x==T)||(x==T&&e[i].x==S))continue;
        dfs2(e[i].x,x);
        siz[x]+=siz[e[i].x];
        k[x]+=k[e[i].x];
    }
}

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        scanf("%d%d",&x,&y);
        add_edge(x,y);
        add_edge(y,x);
    }
    siz[1]=1,dfs1(1,0);
    int sum=0;
    for(int i=1;i<=n;i++)sum+=siz[i];
    if(m==n-1){
        if(sum)return printf("-1"),0;
    }else{
        if(odd){
            if(sum&1)return printf("-1"),0;
            ans+=abs(sum>>1);
            siz[S]-=sum>>1,siz[T]-=sum>>1;
        }else{
            if(sum)return printf("-1"),0;
            else k[S]=1,k[T]=-1;
        }
    }
    dfs2(1,0);
    for(int i=1;i<=n;i++){
        if(k[i])s[++top]=k[i]*siz[i];
        else ans+=abs(siz[i]);
    }
    s[++top]=0;
    sort(s+1,s+top+1);
    int mid=s[top+1>>1];
    for(int i=1;i<=top;i++)ans+=abs(s[i]-mid);
    printf("%lld",ans);
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
vector<string> a;
string s;
int k;
int main() {
	cin >> s >> k;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 1; j <= k && i + j <= s.size(); j++) {
			a.push_back(s.substr(i, j));
		}
	}
	sort(a.begin(), a.end());
	a.resize(unique(a.begin(), a.end()) - a.begin());
	cout << a[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 1660
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
a=set(a)
A=[0]*(n+1)
A[0]=1
for i in range(1,n+1):
  if i in a:
    A[i]==0
  else:
    A[i]=A[i-1]+A[i-2]
print(A[n]%(10**9+7))

Measured memory_bytes: 460020
import sys

# import bisect
# from collections import Counter, deque, defaultdict
# import copy
# from heapq import heappush, heappop, heapify
from fractions import gcd

# import itertools

# from operator import attrgetter, itemgetter
# import math

# import numpy as np

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, k = list(map(int, readline().split()))

    ans = 0
    if k % 2 == 0:
        odd = (n + (k // 2)) // k
        even = n // k
        ans = (odd ** 3 + even ** 3)
    else:
        cnt = n // k
        ans = cnt ** 3

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 63980
n=int(input())
s=str(input())
r=0
g=0
b=0
for x in range (n):
    if s[x]=='R':
        r+=1
    elif s[x]=='G':
        g+=1
    else:
        b+=1
rgb=r*g*b

for i in range (n):
    for j in range (i,n):
        k=j*2-i
        if k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                rgb=rgb-1
print(rgb)

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

int main()
{
    int D, N;
    cin >> D >> N;
    if (N == 100)
    {
        cout << (long)(pow(100, D) * 101) << endl;
    }
    else
    {
        cout << (long)(pow(100, D) * N) << endl;
    }
}


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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count=1;
  for(int i=0; i<n-1; i++){
    if(s[i] != s[i+1]){
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>

using namespace std;

bool isPal(string s)
{
    int l = 0, r = s.size()-1;

    while (r > l)
    {
        if (s[l++] != s[r--]) return false;
    }

    return true;
}

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

    if (isPal(S) && isPal(S.substr(0, (S.size()-1)/2)) && isPal(S.substr((S.size()+3)/2-1, (S.size()-1)/2)))
    {
        cout << "Yes";
    }
    else cout << "No";
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){

  int i,j,sum,flag=1,sei,count=0;

  scanf("%d",&sum);

  j=sum;
  
  while(j>0 ){
    scanf("%d",&sei);
    	if(flag==0)flag=1;
    for(i=2;i*i<=sei;i++)
      {
	if(sei%i == 0)
	  {
	    flag=0;
	    break;
	  }
      }
    if(flag==1)count++;
    j--;
  }
  printf("%d\n",count);

  return 0;
}

Measured memory_bytes: 596
def resolve():
    n = int(input())
    r = n % 10
    unit = ''
    if r == 3:
        unit = 'bon'
    elif r == 0 or r == 1 or r == 6 or r == 8:
        unit = 'pon'
    else:
        unit = 'hon'
    print(unit)

resolve()

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

using ll = long long;
#define rep(i, a, b) for(auto i = (a); i < (b); ++i)
#define sz(x) (int)(x).size()

const int MOD = 1000000007;
const int MAXD = 10000;
const int MAXK = 100;
ll dp[MAXD + 5][MAXK][2]; // # digits, modulo, isbelow

void add(auto& a, auto b){a = (a + b) % MOD;}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  string s;
  cin >> s;
  int k;
  cin >> k;
  int n = sz(s);
  dp[0][0][0] = 1;
  rep(i, 0, n) {
    rep(j, 0, k) {
      rep(c, '0', '9' + 1) {
	rep(below, 0, 2) {
	  if (!below and c > s[i]) continue;
	  int j2 = (j + (c - '0')) % k;
	  bool below2 = below || c < s[i];
	  add(dp[i + 1][j2][below2], dp[i][j][below]);
	}
      }
    }
  }
  dp[n][0][1] = (dp[n][0][1] - 1 + MOD) % MOD; // exclude 0...00 since it's not a valid answer
  cout << (dp[n][0][1] + dp[n][0][0]) % MOD << '\n';
}


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

using namespace std;

int lunlun_buffer[10];
int lunlun_count = 0;
int lunlun_order;

void focus(int focus_index);
bool increase_buffer(int index, int limit);

int main(void)
{
    vector<string> lunlun_numbers;

    cin >> lunlun_order;

    for(int i = 0; i < 10; i++){
        lunlun_buffer[i] = 0;
    }

    for(int i = 0; i < 10; i++){
        focus(i);
        if(lunlun_order <= lunlun_count){
            break;
        }
    }

    int index = 9;
    while(lunlun_buffer[index] == 0){
        index -= 1;
    }
    for(int i = index; i >= 0; i--){
        cout << lunlun_buffer[i];
    }

    cout << endl;

    return 0;
}

void focus(int focus_index)
{
    for(int i = 1; i <= 9; i++){
        lunlun_buffer[focus_index] = i;

        for(int j = focus_index - 1; j >= 0; j--){
            lunlun_buffer[j] = max(lunlun_buffer[j + 1] - 1, 0);
        }
        lunlun_count += 1;
        if(lunlun_order <= lunlun_count){
            return;
        }

        while(increase_buffer(0, focus_index)){
            lunlun_count += 1;
            if(lunlun_order <= lunlun_count){
                return;
            }
        }

    }
}

bool increase_buffer(int index, int limit)
{
    if(index >= limit){
        return false;
    }

    if(lunlun_buffer[index] > lunlun_buffer[index + 1] || lunlun_buffer[index] == 9){
        bool continues = increase_buffer(index + 1, limit);
        if(continues){
            lunlun_buffer[index] = max(max(0, lunlun_buffer[index] - 1), lunlun_buffer[index + 1] - 1);
            for(int i = index - 1; i >= 0; i--){
                lunlun_buffer[i] = max(max(0, lunlun_buffer[i] - 2), lunlun_buffer[i + 1] - 1);
            }
        }

        return continues;
    }else{
        lunlun_buffer[index] += 1;
    }

    return true;

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramC
    {
        static void Main()
        {
            int n = NextInt;
            var h = LongList;
            var array = Enumerable.Repeat(0, n).ToArray();

            for (int i = 1; i < n; i++)
            {
                if (h[i - 1] >= h[i])
                {
                    array[i] = array[i - 1] + 1;
                }
            }

            System.Console.WriteLine(array.Max());
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


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

typedef long long int LL;
const int MOD = 2019;
string str;

LL solve() {
	int t = 0;
	vector<LL> dp[2];
	for (int i = 0; i < 2; i++)
		dp[i] = vector<LL>(MOD, 0);
	LL ans = 0;
	for (int i = 0; i < str.size(); i++) {
		int d = str[i] - '0';
		for (int j = 0; j < MOD; j++)
			dp[(i + 1) & 1][j] = 0;
		for (int j = 0; j < MOD; j++)
			if (dp[i & 1][j])
				dp[(i + 1) & 1][(j * 10 + d) % MOD] += dp[i & 1][j];
		dp[(i + 1) & 1][d] += 1;
		ans += dp[(i + 1) & 1][0];
	}
	return ans;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	while (cin >> str) {
		cout << solve() << endl;
	}
}

Measured memory_bytes: 3744
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  al:string = 'abcdefghijklmnopqrstuvwxyz';
  tf,tfl,tfr:Boolean;
begin
  try
    { TODO -oUser -cConsole メイン : ここにコードを記述してください }
    Readln(n);
    max:=0;
    min:=1000000000;
    for i := 0 to n - 1 do begin
      Read(a);
      if a > max then
        max:=a;
      if a < min then
        min:=a;
    end;

    Readln;
    Writeln(max-min);
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main (){
 string s,a[3];
 for(int i =0 ; i<3;i++){
    cin>>a[i];
    a[i][0]=(char )((int )(a[i][0]-32));
    s+=a[i][0];
 }
cout<<s<<endl;
return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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 = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    int N; cin >> N;
    vector<vector<int>> A(N, vector<int>(26, 0));
    for (int i = 0; i < N; i++) {
        string S; cin >> S;
        for (auto c : S) A[i][c - 'a']++;
    }

    vector<int> B(26, MAX);
    for (int i = 0; i < 26; i++) for (int j = 0; j < N; j++) chmin(B[i], A[j][i]);

    for (int i = 0; i < 26; i++) {
        for (int j = 0; j < B[i]; j++) {
            cout << (char)(i + 'a');
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3616
comb :: Int -> [Int] -> [[Int]]
comb 0 _ = [[]]
comb _ [] = []
comb n (x:xs) = map (x:) (comb (n-1) xs) ++ (comb n xs)

solv' :: [Int] -> [[Int]]
solv' (n:l:_) = filter (\y -> (sum y) == l) $ comb 3 [1..n]

main = getContents >>= mapM_ (print . length . solv') . takeWhile (/= [0,0]) . map (map read . words) . lines

Measured memory_bytes: 5484
N=int(input())
H=list(map(int,input().split()))
c=0
C=[0]

for i in range(N-1) :

    if H[i] >= H[i+1] :

        c+=1

    if i==N-2 or H[i] < H[i+1]:

        C.append(c)

        c = 0

print(max(C))
    


Measured memory_bytes: 15020
import itertools
n = int(input())
m=0;a=0;r=0;c=0;h=0
for i in range(n):
    s = input()
    if s[0]=='M':
        m+=1
    elif s[0]=='A':
        a+=1
    elif s[0]=='R':
        r+=1
    elif s[0]=='C':
        c+=1
    elif s[0]=='H':
        h+=1
l = itertools.combinations([m,a,r,c,h],3)
ans = 0
for i in l:
    k = 1
    for i2 in i:
        k*=i2
    ans+=k
print(ans)

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

n = int(input())
h = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]


sellogn = []
seln = 0
selfunc = max
selone = 0
selb = []


def __init__(a, func=max, one=-10 ** 18):
    global sellogn, seln, selfunc, selone, selb
    sellogn = (len(a) - 1).bit_length()
    seln = 1 << sellogn
    selfunc = func
    selone = one

    selb = [selone] * (2 * seln - 1)
    for i, j in enumerate(a):
        selb[i + seln - 1] = j
    for i in reversed(range(seln - 1)):
        selb[i] = selfunc(selb[i * 2 + 1], selb[i * 2 + 2])


def get_item(i):
    global sellogn, seln, selfunc, selone, selb
    return selb[i + seln - 1]


def update(index, x):
    global sellogn, seln, selfunc, selone, selb
    i = index + seln - 1
    selb[i] = x
    while i != 0:
        i = (i - 1) // 2
        selb[i] = selfunc(selb[i * 2 + 1], selb[i * 2 + 2])


def update_func(index, x):
    global sellogn, seln, selfunc, selone, selb
    i = index + seln - 1
    selb[i] = selfunc(selb[i], x)
    while i != 0:
        i = (i - 1) // 2
        selb[i] = selfunc(selb[i * 2 + 1], selb[i * 2 + 2])


def get_segment(l, r):
    global sellogn, seln, selfunc, selone, selb
    l += seln
    r += seln
    s = selone
    t = selone
    while l < r:
        if l & 1:
            s = selfunc(s, selb[l - 1])
            l += 1
        if r & 1:
            r -= 1
            t = selfunc(selb[r - 1], t)
        l >>= 1
        r >>= 1
    return selfunc(s, t)


__init__([0]*(n+1))

for i in range(n):
    j = get_segment(0, h[i] + 1)
    update_func(h[i], j + a[i])
print(get_segment(0, n+1))


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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int a, b;
    cin >> a >> b;
    int k = 1, cnt = 0;
    while(k < b) {
        ++cnt;
        k += a-1;
    }
    cout << cnt << "\n";
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
 
#n = int(input())
n,t = [int(i) for i in readline().split()]
a = [10**9+1]+[int(i) for i in readline().split()]


"""
gain = 0
m = 0
maxid = []
minid = []
memo = {}
for i in range(n-1,-1,-1):
    ai = a[i]
    if ai > m:
        m = ai
        maxid = [i]
        memo.append([minid[:],maxid[:]])
    elif ai == m:
        maxid.append[i]

    m = max(ai,m)
    if gain < m-ai:
        gain = m-ai
        minid = [i]
        memo = []
    elif gain == m-ai:
        minid.append(i)
    
    print(minid,maxid,memo)
"""    

gain = 0
m = 0
for ai in reversed(a):
    m = max(ai,m)
    if gain < m-ai: gain = m-ai

m = 0
mi = ma = 0

ans = 0
for ai in reversed(a):
    if m < ai:
        ans += max(mi,ma)
        mi = ma = 0
    elif m == ai:
        ma += 1

    m = max(m,ai)
    
    if m-ai == gain:
        mi += 1


print(ans)    






Measured memory_bytes: 14260
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#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 int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(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 ul = unsigned long;
 
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) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }
 
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
 
inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int n,m; cin>>n>>m;
  vi s(m), c(m);
  rep(i,m){
    cin>>s[i]>>c[i];
    s[i]--;
  }
  
  string S="";
  rep(i,n){
    S+="0";
  }
  
  vi a(n,-1);
  
  rep(i,m){
    if(a[s[i]]!=-1&&a[s[i]]!=c[i] || n!=1&&s[i]==0&&c[i]==0){
      cout<<-1<<endl;
      return 0;
    }
    a[s[i]]=c[i];
    S[s[i]]=('0'+c[i]);
  }
  if(n!=1 && S[0]=='0') S[0]='1';
  
  cout<<S<<endl;
}

Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

a,p = inpl()
print((a*3+p)//2)


Measured memory_bytes: 4852
from collections import Counter


def factorize(n):
    a = 2
    fct = []
    while a * a <= n:
        while n % a == 0:
            n //= a
            fct.append(a)
        a += 1
    if n > 1:
        fct.append(n)
    return fct


n = int(input())
c = Counter(factorize(n))
ans = 0
for v in c.values():
    t = 1
    while v >= t:
        v -= t
        t += 1
        ans += 1
print(ans)


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


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

    int H,W;
    cin >> H >> W;
    vector<vector<char>> a(H+2,vector<char>(W+2,'#'));
    for(int i=1;i<H+1;i++){
        for(int j=1;j<W+1;j++){
            cin >> a.at(i).at(j);
        }
    }
    rep(i,H+2){
        rep(j,W+2){
            cout << a.at(i).at(j);
        }
        cout << endl;
    }


}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        char[] s = sc.next().toCharArray();
        boolean flg = true;
        for (int i = 0 ; i < a + b + 1 ; i++) {
            if (i == a) {
                if (s[i] != '-') flg = false;
            } else {
                if (s[i] == '-') flg = false;
            }
        }
        System.out.println(flg ? "Yes" : "No");
    }

}

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


    int main() {
      int A,B,C;cin >> A >> B >> C;
      if (A == B){
        cout << C << endl;
      }else{
        if (B == C){
          cout << A << endl;
        }else{
          cout << B << endl;
        }
      }
    
    }

Measured memory_bytes: 256
#include<algorithm>
#include<iomanip>
#include<iostream>
#include<map>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cmath>
using namespace std;
#define FOR(i,a,b) for(int i=(a); i<int(b); ++i)
#define RFOR(i,a,b) for(int i=(b)-1; i>=int(a); --i)
#define rep(i,n) FOR(i,0,n)
#define rep1(i,n) FOR(i,1,int(n)+1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
#define al(d) d.begin(),d.end()
using namespace std;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(int n){
	vector<T> vec;
	rep(i,n){
		T input;
		cin >> input;
		vec.emplace_back(input);
	}
	return vec;
}
using AdjList = vector<vector<int>>;
using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

// Recieve edge(=(int,int)) as an adj list.
AdjList getadj(int N, int M){
	// Initialize all lists of the graph as a empty vector.
	vector<int> init;
	vector<vector<int>> graph(N,init);

	rep(i,M){
		int a, b;
		cin >> a >> b;
		graph[a-1].emplace_back(b-1);
		graph[b-1].emplace_back(a-1);
	}
// rep(i,N)
// 	putv(graph[i]);
	return graph;
}

long long Manhattan_dist(long long x1, long long y1, long long x2, long long y2){return abs(x1-x2) + abs(y1-y2);}

void out(bool ans){
	if(ans == true) cout << "yes" << endl;
	else cout << "no" << endl;
}
void Out(bool ans){
	if(ans == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}
void OUT(bool ans){
	if(ans == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}
unsigned long long gcd(const unsigned long long a, const unsigned long long b){
	return (b==0) ? a : gcd(b,a%b);
}

bool compare(string S, string T);
int main(){
	string S,T;
	cin >> S >> T;
	int lenS = S.length();
	int lenT = T.length();
	bool success = false;
	for(int i=lenS-lenT; i>=0; --i){
		if(compare(S.substr(i),T)){
			rep(j,i)
				if(S[j] == '?')
					S[j] = 'a';
			for(int j=i;j<i+lenT;++j)
				S[j] = T[j-i];
			for(int j=i+lenT; j<lenS; ++j)
				if(S[j] == '?') S[j] = 'a';
			success = true;
			break;
		}
	}
	if(success) cout << S << endl;
	else cout << "UNRESTORABLE" << endl;
}

bool compare(string S, string T){
	int lenS = S.length();
	int lenT = T.length();
	rep(pos,lenT)
		if(S[pos]!='?' && S[pos]!=T[pos])
			return false;
	return true; 
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
    int N;
    cin >> N;
    int price[N];
    int max = 0;
    int sum = 0;

    for(int i = 0; i < N; i++){
        cin >> price[i];
        sum += price[i];
        if(max <= price[i])
            max = price[i];
    }
    sum -= (max / 2);
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, int b, int _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  cout << min(b, n * a) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int K = scanner.nextInt();
    int[] h = new int[N];
    for (int i = 0; i < N; i++) h[i] = scanner.nextInt();

    int[] dp = new int[N];
    for (int i = 1; i < N; i++) {
      dp[i] = Integer.MAX_VALUE;
      for (int j = 1; j <= K && j <= i; j++) {
        dp[i] = Math.min(dp[i], dp[i - j] + Math.abs(h[i] - h[i - j]));
      }
    }
    System.out.println(dp[N - 1]);
  }
}


Measured memory_bytes: 52728
n = int(input())
a = list(map(int, input().split()))

m = max(a)
half = m / 2
sa = float("inf")
ans = 0
for i in a:
    if i != m:
        if abs(half - i) < sa:
            ans = i
            sa = abs(half - i)

print(m, ans)

Measured memory_bytes: 14428
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#define SIZE(array) (sizeof(array)/sizeof(array[0]))

using namespace std;

int main(){
    int n;
    cin >> n;
    string s[n];
    int sum = n;
    for (int i=0; i<n; i++){
        cin >> s[i];
    }
    sort(s, s + SIZE(s));
    for (int i=0; i<n-1; i++){
        if (s[i]==s[i+1]){
            sum -= 1;
        }
    }
    cout << sum << endl;
}

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

int main(){
  int n;
  cin >> n;
  set<string> st;
  rep(i,n){
    string s;
    cin >> s;
    st.insert(s);
  }
 cout <<st.size()<<endl;
  return 0;
}


Measured memory_bytes: 19232
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define semicolon ;
#define ryan bear
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<pl>p(n);
    for(pl&t:p)
        cin>>t.fi>>t.se,t.fi-=t.se,t.se=t.fi+t.se+t.se;
    sort(all(p),[](pl&x,pl&y){return x.se<y.se;});
    ll m=-INF;
    int c=0;
    for(pl&t:p)
        if(t.fi>=m)
            c++,m=t.se;
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.M_Solutions_2020
{
    class C
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int[] nk = ReadInts();
            int n = nk[0];
            int k = nk[1];
            int[] array = ReadInts();

            int left = 0;
            int right = k;
            for (; right < n; right++)
            {
                WriteLine(array[left] < array[right] ? "Yes" : "No");
                left++;
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 45656
//https://atcoder.jp/contests/arc068/tasks/arc068_d

#include<bits/stdc++.h>
const int N = 2005;
const int mod = 1e9 + 7;
using namespace std;

int n, k, dp[N][N], sum[N][N];

void add(int&a, int b){
    a += b; if (a >= mod) a -= mod;
}

int po(int n, int k){
    int ans = 1;
    while (k){
        if (k&1) ans = 1LL * ans * n % mod;
        n = 1LL * n * n % mod;
        k >>= 1;
    }
    return ans;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> k; k = n - k;
    dp[0][0] = sum[0][0] = 1;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= i; j++) dp[i][j] = sum[i-1][j], add(dp[i][j], dp[i-1][j-1]);
        for (int j = i; j >= 0; j--) sum[i][j] = dp[i][j], add(sum[i][j], sum[i][j+1]);
    }
    if (k) cout << 1LL * sum[n-1][k] * po(2, k-1) % mod;
    else cout << sum[n-1][0];
}


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int cnt[100009];

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int N;
    cin >> N;
    VI V(N);
    REP(i, N) cin >> V[i];
    REP(i, N) {
        cnt[V[i]]++;
    }
    map<int, set<int> > M;
    REP(i, 100009) {
        M[cnt[i]].insert(i);
    }
    auto last = prev(M.end());
    while (last->first != 1) {
        auto &v = last->second;
        // debug(last->first, v);
        // auto last2 = prev(last);
        if (SZ(v) > 1) {
            auto ll = prev(v.end());
            auto ll2 = prev(ll);
            int l = *ll;
            int l2 = *ll2;
            M[last->first-1].insert(l);
            M[last->first-1].insert(l2);
            v.erase(ll);
            v.erase(ll2);
            // debug(v);
            if (SZ(v) == 0) {
                M.erase(last);
            }
        } else {
            auto last2 = prev(last);
            auto ll = prev(v.end());
            int l = *ll;
            v.erase(prev(v.end()));
            if (SZ(v) == 0) {
                M.erase(last);
            }
            M[last->first - 1].insert(l);
            auto &v2 = last2->second;
            int l2 = *(prev(v2.end()));
            v2.erase(prev(v2.end()));
            if (SZ(v2) == 0) {
                M.erase(last2);
            }
            if (last2->first != 1) {
                M[last2->first - 1].insert(l2);
            } 
        }
        last = prev(M.end());
        // debug(last->second);
        // cout << last->first << endl;
    }
    cout << SZ(M[1]) << endl;
}

Measured memory_bytes: 5760
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    A=list(pin())
    A.sort()
    a=0
    if A[0]%2!=A[1]%2:
        A[1]+=1
        A[2]+=1
        a+=1
    a+=(A[2]*2-A[0]-A[1])//2
    print(a)
    
#%%submit!
resolve()

Measured memory_bytes: 38384
//
// Created on 2020/08/28.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    int n;
    cin>>n;
    vector<vector<pair<int,int>>>edge(n,vector<pair<int,int>>());
    vector<pair<int,int>>x_edge(n);
    vector<pair<int,int>>y_edge(n);
    vector<int>color(n);
    for (int i = 0; i < n; ++i) {
        int x,y;
        cin>>x>>y;
        x_edge[i] = {x,i};
        y_edge[i] = {y,i};
    }
    sort(all(x_edge));
    sort(all(y_edge));

    for (int i = 1; i < n; ++i) {
        int d = abs(x_edge[i].first - x_edge[i - 1].first);
        edge[x_edge[i].second].push_back({d,x_edge[i-1].second});
        edge[x_edge[i-1].second].push_back({d,x_edge[i].second});
    }
    for (int i = 1; i < n; ++i) {
        int d = abs(y_edge[i].first - y_edge[i - 1].first);
        edge[y_edge[i].second].push_back({d,y_edge[i-1].second});
        edge[y_edge[i - 1].second].push_back({d,y_edge[i].second});
    }

    priority_queue<pair<int,int>,vector<pair<int,int> >,greater< pair<int,int> >>p_q;
    p_q.push({0,0});
    ll ans = 0;
    int sum_c = 0;
    while(!p_q.empty()){
        if(sum_c >= 2 * n)break;
        int d = p_q.top().first;
        int u = p_q.top().second;
        p_q.pop();
        if(color[u] == 2) continue;
        color[u] = 2;
        ans += d;
        sum_c += 2;
        for (int i = 0; i < edge[u].size(); ++i) {
            int next_d = edge[u][i].first;
            int next_u = edge[u][i].second;
            if(color[next_u] == 2) continue;
            p_q.push({next_d, next_u});
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol a; cin >> a;
    float f; cin >> f;
    lol f100 = f*100+0.5;
    //int k; cin >> k;
    /*
    vector<int> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    result = a*f100;
    result = result/100;

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3700
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<class T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<class T,class Size=typename vector<T>::size_type>inline auto vector_2d(Size h,Size w,T v){return vector<vector<T>>(h,vector<T>(w,v));}
template<class RandomAccessIterator,class Pair=typename iterator_traits<RandomAccessIterator>::value_type>inline void sort_pairs_by_second(RandomAccessIterator first,RandomAccessIterator last){sort(first,last,[](const Pair&p1,const Pair&p2){return p1.second<p2.second||(p1.second==p2.second&&p1.first<p2.first);});}

int main()
{
    ll d=in(),t=in(),s=in();
    cout<<(d<=t*s?"Yes":"No")<<endl;
}


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

using namespace std;

int main()
{
    int A[3][3];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> A[i][j];
        }
    }
    int N;
    cin >> N;
    int b[N];
    for (int i = 0; i < N; i++)
    {
        cin >> b[i];
    }
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            for (int k = 0; k < 3; k++)
            {
                if (A[j][k] == b[i])
                {
                    A[j][k] = -1;
                }
            }
        }
    }
    bool ans_r;
    for (int i = 0; i < 3; i++)
    {
        ans_r = true;
        for (int j = 0; j < 3; j++)
        {
            if (A[i][j] == -1)
                continue;
            ans_r = false;
        }
        if (ans_r)
        {
            break;
        }
    }
    bool ans_c;
    for (int i = 0; i < 3; i++)
    {
        ans_c = true;
        for (int j = 0; j < 3; j++)
        {
            if (A[j][i] == -1)
                continue;
            ans_c = false;
        }
        if (ans_c)
        {
            break;
        }
    }
    bool ans_x1 = false;
    if (A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1)
    {
        ans_x1 = true;
    }
    bool ans_x2 = false;
    if (A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1)
    {
        ans_x2 = true;
    }
    if (ans_r || ans_c || ans_x1 || ans_x2)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

int main() {
    int N, K;
    cin >> N >> K;
    vector<ll> x(N), y(N);
    vector<ll> xAry(N), yAry(N); //長方形の四隅の候補

    rep(i, N) {
        cin >> x[i] >> y[i];
        xAry[i] = x[i];
        yAry[i] = y[i];
    }

    sort(xAry.begin(), xAry.end());
    sort(yAry.begin(), yAry.end());

    ll ans = 1e20;
    // 長方形の候補を全部試す
    rep(xi, N) {
        for (int xj = xi + 1; xj < N; xj++) {
            rep(yi, N) {
                for (int yj = yi + 1; yj < N; yj++) {
                    ll lx = xAry[xi], rx = xAry[xj];
                    ll ly = yAry[yi], ry = yAry[yj];

                    //長方形に含まれる座標をカウントする
                    int cnt = 0;
                    rep(i, N) if (lx <= x[i] && x[i] <= rx && ly <= y[i] && y[i] <= ry) cnt++;

                    if (cnt >= K) ans = min(ans, (rx - lx) * (ry - ly));
                }
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>

int main(){
	int n, m, p;
	while(std::cin >> n >> m >> p, n){
		int mn, s = 0;

		for(int i=1;i<=n;i++){
			int j;
			std::cin >> j;
			if(i == m)mn = j;
			s += j;
		}
		if(mn == 0)std::cout << 0 << std::endl;
		else std::cout << s*(100-p)/mn << std::endl;
	}
}

Measured memory_bytes: 1160
#
a = input().split()

wa = int(a[0])+int(a[1])
minus = int(a[0])-int(a[1])
seki = int(a[0])*int(a[1])

if wa == minus and wa > seki and minus > seki:
    print(str(wa))
elif wa > minus and wa > seki:
    print(str(wa))
elif minus > wa and minus > seki:
    print(str(minus))
else:
    print(str(seki))


Measured memory_bytes: 3064
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

TMPMAX = -float('inf')
for j in range(2):
    cands = [0] * D

    types = []
    last = [-1] * 26
    S = 0
    for d in range(D):
        # search type
        M = -float('inf')
        for tt in range(26):
            _last = last[:]
            tmp = s[d][tt]

            _last[tt] = d
            for i in range(26):
                tmp -= c[i] * (d - _last[i])

            if tmp > M:
                M = tmp
                M_tt = tt

        S += s[d][M_tt]

        last[M_tt] = d
        for i in range(26):
            S -= c[i] * (d - last[i])
        types.append(M_tt)


    last = [-1] * 26
    S = 0

    if j == 0:
        r = list(range(D))
    else:
        r = list(reversed(range(D)))
    for d in r:
        seq = []
        for tt in range(26):
            _last = last[:]
            tmp = s[d][tt]

            _last[tt] = d
            for i in range(26):
                tmp -= c[i] * (d - _last[i])

            seq.append([tmp, tt])

        seq.sort(reverse=True)

        tmpmax = -float('inf')
        for i in range(15):
            tt = seq[i][1]
            _last = last[:]
            _types = types[:]
            _types[d] = tt
            _S = S

            for dd in range(d, D):
                _S += s[dd][_types[dd]]
                _last[_types[dd]] = dd
                for i in range(26):
                    _S -= c[i] * (dd - _last[i])

            if _S > tmpmax:
                cand = tt
                tmpmax  = _S

        cands[d] = cand + 1
        S += s[d][cand]
        last[cand] = d
        for i in range(26):
            S -= c[i] * (d - last[i])

    if S > TMPMAX:
        TMPMAX = S
        ans = cands

for _ans in ans:
    print(_ans)


Measured memory_bytes: 71464
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    // int n, p;
    // cin >> n >> p;
    string s;
    cin >> s;

    int n = s.length();
    int p = 2019;
    if (10 % p == 0) {
        ll ans = 0;
        rep(r, n) {
            if ((s[r] - '0') % p == 0) {
                ans += r + 1;
            }
        }
        cout << ans << endl;
        return 0;
    }

    vector<int> d(n + 1);
    int ten = 1;
    for (int i = n - 1; i >= 0; --i) {
        int a = (s[i] - '0') * ten % p;
        d[i] += (d[i+1] + a) % p;
        ten *= 10;
        ten %= p;
    }

    vector<int> cnt(p);
    ll ans = 0;
    // iを左端の桁としたときに、右側に選べる物が何個あるかをカウントしながら追加している
    for (int i = n; i >= 0; --i) {
        ans += cnt[d[i]];
        cnt[d[i]]++;
    }
    cout << ans << endl;

    return 0;
}

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


int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> p;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    p.push_back(make_pair(b, a));
  }
  sort(p.begin(), p.end());
  int q = 1;
  int A = 0;
  int B = 0;
  for (int i = 0; i < N; i++) {
    int a, b;
    tie(b, a) = p.at(i);
    A += a;
    if (A > b) {
      q-- ;
      break;
    }
  }
  if (q == 1) {
    cout << "Yes" <<endl;
  }
  else {
    cout << "No" <<endl;
  }
}

Measured memory_bytes: 2420