akhauriyash/Code-Regression huggingface dataset:
#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>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

int n,k;
map<int,int>mp;
ll solve(){
   ll ans=0;
   rep(i,k){
       int d;
       cin>>d;
       rep(j,d){
            int ai;
            cin>>ai;
            mp[ai]++;
       }
   }
   for(int i=1;i<=n;i++){
       if(mp.count(i)==0)ans++;
   }

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

    cin>>n>>k;
    cout<<solve()<<endl;
    return 0;
}

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

a, b = map(int, input().split())
max = gcd(a, b)
pf=[]

#print(max)
tmp=max
i=2
while tmp % 2 == 0:
    pf.append(2)
    tmp //= 2
f = 3
while f * f <= tmp:
    if tmp % f == 0:
        pf.append(f)
        tmp //= f
    else:
        f += 2
if tmp != 1:
    pf.append(tmp)


#print(pf)
spf = set(pf)
#print(spf)
print(len(spf)+1)

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


int main(void){
    ll l,r;
    cin >> l>>r;
    ll ans =pow(10,18)*5;
    // cout << ans<<endl;
    if(2019 <= r-l+1){
        cout << 0 << endl;
    }else{
        for(ll i=l;i<=r;i++){
            for(ll j=i+1;j<=r;j++){
                ll tmp = (i*j)%2019;
                if(tmp<ans){
                    ans = tmp;
                    // cout << i<<"*"<<j<<"="<<ans << endl;
                    if(ans == 0){
                        break;
                    }
                }
            }
            if(ans==0){
                break;
            }
        }
        cout << ans << endl;
    }
    
}


Measured memory_bytes: 256
N,K = map(int, input().split())
P = list(map(int, input().split()))
L = []
S = [0]
for i in range(N):
    if P[i] % 2 == 0:
        L.append((P[i]+1)*(P[i]//2)*(1/P[i]))
    else:
        L.append(((P[i]+1)*(P[i]//2)+(P[i]//2+1))*(1/P[i]))
    S.append(L[-1]+S[-1])
n = 0
for i in range(N-K+1):
    n = max(n,S[i+K]-S[i])
print(n)

Measured memory_bytes: 89608
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int f[100001];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int sol = 0;
    for (int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        f[x]++;
    }
    for (int i = 1; i < 100000; ++i)
        sol = max(sol, f[i - 1] + f[i] + f[i + 1]);
    cout << sol;
}


Measured memory_bytes: 640
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef std::int_fast64_t i64;
typedef std::uint_fast64_t u64;
typedef std::int_fast32_t i32;
typedef std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(std::vector<T>& vector, const typename std::vector<T>::size_type size) {
    vector.reserve(size);
    std::copy_n(std::istream_iterator<T>(std::cin), size, std::back_inserter(vector));
  }

  template <typename T, std::size_t N>
  void read(std::array<T, N>& array) {
    std::copy_n(std::istream_iterator<T>(std::cin), N, array.begin());
  }
}

#endif

// main.cpp

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

  const bool has_N = std::any_of(S.begin(), S.end(), [](const char& c) { return c == 'N'; });
  const bool has_W = std::any_of(S.begin(), S.end(), [](const char& c) { return c == 'W'; });
  const bool has_S = std::any_of(S.begin(), S.end(), [](const char& c) { return c == 'S'; });
  const bool has_E = std::any_of(S.begin(), S.end(), [](const char& c) { return c == 'E'; });

  if (has_N && !has_S) goto FAILED;
  if (has_S && !has_N) goto FAILED;
  if (has_W && !has_E) goto FAILED;
  if (has_E && !has_W) goto FAILED;

  std::cout << "Yes" << std::endl;
  return 0;

FAILED:
  std::cout << "No" << std::endl;
  return 0;
}

Measured memory_bytes: 256
inf = 10**9+7
mod = 10**9+7
n, m = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
sub = []
for i in range(m-1):
    sub.append(x[i+1]-x[i])
sub.sort()
for i in range(n-1):
    if sub:
        sub.pop()
if sub:
    print(sum(sub))
else:
    print(0)

Measured memory_bytes: 56872
#include <bits/stdc++.h>
using namespace std; 
#define ff first
#define ss second
#define MP make_pair
#define PB push_back
#define ll long long
#define int long long
#define f(i,x,n) for(int i=x;i<n;i++)
#define ld long double
#define mod 1000000007
int x,y,d;
void gcd(int a,int b){
	if(b==0){
		d=a;
		x=1;
		y=0;
		return ;
	}
	gcd(b,a%b);
	int X,Y;
	X=y;
	Y=x-(a/b)*y;
	x=X;  y=Y;
}
int a,b,c,m; 
int exp(int a,int b){
	m=b+1;
	int res=1;
	while(b!=0){
		if(b&1){
			res*=a;
			res%=m;
		}
		b/=2;
		a*=a; a%=m;
	}
	return res;
}
void prime(){
	int n; cin>>n;
	if(n<2){
		cout<<"composite\n";
		return ;
	}else if(n==2){
		cout<<"prime\n";
		return ;
	}else if(n%2==0){
		cout<<"composite\n";
		return ;
	}else {
		for(int i=3;i*i<=n;i+=2){
			if(n%i==0){
				cout<<"composite\n";
				return ;
			}
		}
		cout<<"prime\n";
	}
}
void toutient(int n) {
    vector<int> phi(n + 1);
    phi[0] = 0;
    phi[1] = 1;
    for (int i = 2; i <= n; i++)
        phi[i] = i - 1;

    for (int i = 2; i <= n; i++)
        for (int j = 2 * i; j <= n; j += i)
              phi[j] -= phi[i];
	cout<<phi[n];
}
int pr[11000];
int dig(int a){
	int s=0;
	while(a!=0){
		s+=(a%10);
		a/=10;
	}
	return s;
}
int ans[11000];
void seive(){
	pr[0]=pr[1]=1;
	for(int i=2;i<11000;++i){
		if(pr[i]==0){
			for(int j=2*i;j<11000;j+=i){
				pr[j]=1;
			}
		}
	}
	for(int i=0;i<11000;++i)
		ans[i]=-1;
	for(int i=0;i<11000;++i){
		if(pr[i]==0){
			ans[i]=1;
			if(i<100){
				ans[i*i]=1;
			}
		}
		else if(ans[i]==-1) ans[i]=LLONG_MAX;
	}
	vector<int> v;
	for(int i=0;i<11000;++i)
	if(ans[i]==1)
	v.push_back(i);
	for(int i=0;i<11000;++i){
		if(ans[i]!=LLONG_MAX){
			for(auto it : v){
				ans[i+it]=min(ans[i+it],ans[i]+1);
			}
		}
	}
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//seive();
	int x,n; cin>>n;
	x=0;
	int p=n/500;
	x+=1000*p;
	n-=500*p;
	p=n/5;
	x+=5*p;
	cout<<x;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

  int a, b, c, n;
  int count = 0;

  scanf("%d %d %d", &a, &b, &c);

  if(c % a == 0){
    count++;
  }

  n = b - a; //Calc the number of times.

  while(n){
    a += 1;

    if(c % a == 0){
      count++;
    }

    n--;
  }

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

  return 0;
}



Measured memory_bytes: 2104
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    h, w = list(map(int, input().strip().split()))
    if h == 1 or w == 1:
        print(1)
    else:
        print((h * w + 1) // 2)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;cin>>n;
  int x=n%10;
  if(x==2||(x==4)||(x==5)||(x==7)||(x==9))cout<<"hon";
  else if(x==3)
    cout<<"bon";
  else cout<<"pon";
}

Measured memory_bytes: 3624
n,k,c=map(int,input().split())
s=list(input())
for i in range(len(s)):
	if s[i]=="o":
		s[i]=True
	else:
		s[i]=False
i=0
work1=[]
while len(work1)<k:
	if s[i]:
		work1.append(i)
		i+=c+1
	else:
		i+=1
i=n-1
work2=[]
while len(work2)<k:
	if s[i]:
		work2.append(i)
		i-=c+1
	else:
		i-=1
work2.sort()
for i in range(k):
	if work1[i]==work2[i]:
		print(work1[i]+1)

Measured memory_bytes: 22056
package main

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

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

func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

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

func main() {
	sc.Split(bufio.ScanWords)

	s := scanText()

	ans := 0
	n := len(s)

	for i := 0; i < n/2; i++ {
		if s[i] != s[n-1-i] {
			ans++
		}
	}

	fmt.Println(ans)
}


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

int n;

int main(){
  cin >> n;
  int mi = 2e9, ma = 0;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    mi = min(mi, a);
    ma = max(ma, a);
  }
  cout << ma - mi << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=2e5+9;
ll n,d[N],c[N];
ll solve(ll sum){
  if(sum<=9)return 0;
  return sum/10+solve(sum%10+sum/10);
}
int main(){
  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  cin>>n;
  ll sum=0,sumn=0;
 // bool flag=1;
  for(int i=1;i<=n;i++){
    cin>>d[i]>>c[i];
    sum+=1ll*d[i]*c[i],sumn+=c[i];
  }
  ll ans=sumn-1+solve(sum);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3328
import java.io.*;
public class Main
{
  public static void main(String args[])throws IOException
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readLine());
    if(n==0)
      System.out.println("1");
    else
      System.out.println("0");
  }
}


Measured memory_bytes: 25364
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
import bisect
A_sum=[0]
B_sum=[0]
for i in range(N):
    A_sum.append(A_sum[i]+A[i])
for i in range(M):
    B_sum.append(B_sum[i]+B[i])

ans=0
for i in range(N+1):
    if A_sum[i]>K:
        continue
    b_read=bisect.bisect_right(B_sum,K-A_sum[i])-1
    ans=max(ans,i+b_read)
print(ans)


Measured memory_bytes: 47360
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        long n = sc.NextLong();

        long answer = 0;

        long before = 0;
        for (int i = 0; i < n; i++)
        {
            long current = sc.NextLong();

            if (before == 0)
            {
                answer += current / 2;
                before = current % 2;
            }
            else
            {
                answer += (current + before) / 2;
                if (current > 0)
                {
                    before = (current - 1) % 2;
                }
                else
                {
                    before = 0;
                }
            }
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 34840
#include<stdio.h>
int main()
{
    int a,b,c,d,x,y;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a<b) x=a;
    else x=b;
    if(c<d) y=c;
    else y=d;
    printf("%d\n",x+y);
    return 0;

}

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

using namespace std;
#define Debug(x) cout << #x << "=" << (x) << endl;
const int maxn = 2e5+10;


int a[maxn];
int main()
{
    int n, k, num;
    scanf("%d%d", &n, &k);
    memset(a, 0, sizeof(a));
    for(int i = 1; i <= n; i++)
    {
        scanf("%d", &num);
        a[num]++;
    }
    vector<int> vec;
    for(int i = 1; i <= n; i++)
    {
        if(a[i]>0)vec.push_back(a[i]);
    }
    sort(vec.begin(), vec.end());
    if(k>=vec.size())
    {
        printf("0\n");
    }
    else
    {
        int ans = 0;
        for(int i = 0; i < (vec.size()-k); i++)
            ans += vec[i];
        printf("%d\n", ans);
    }



    return 0;
}


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

/*int main() {
  int N,flag[101];cin>>N;
    for(int i=0;i<N;i++){int d;
    cin>>d;flag[d] = 1;}
      int ans = 0;
  for(int i=0;i<N;i++){
    ans = ans + flag[i];}
  cout << ans << endl;
}*/
int d,N,flag[101];
int main(){
cin >> N;
for(int i = 0; i < N; ++i){
cin >> d;
flag[d] = 1;
}
int ans = 0;
for(int i = 0; i < 101; ++i){
ans += flag[i];
}
cout << ans << endl;
}

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

using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<ll> suff(n);
  suff.back() = a.back();
  for(int i = n-2; i >= 0; i--) {
    suff[i] = suff[i+1] + a[i];
  }
  long long ans = 0;
  for(int i = 0; i < (n-1); i++) {
    long long x = a[i];
    long long y = suff[i+1];
    x %= mod;
    y %= mod;
    x *= y;
    x %= mod;
    ans += x;
    ans %= mod;
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 6376
import java.util.Scanner;
class Main{
	   public static void main(String[] args){
	  Scanner scan =  new Scanner(System.in);
	   int a = scan.nextInt();
	   int b = scan.nextInt();
       int d [][]=new int[2][a];
       int e [][]=new int[2][b];
       for(int i =0;i<a;i++){
    	   d[0][i]=scan.nextInt();
    	   d[1][i]=scan.nextInt();
	   }
	  for(int i=0;i<b;i++){
		  e[0][i]=scan.nextInt();
		  e[1][i]=scan.nextInt();
	  }
	  for(int i =0;i<a;i++){
		  int c = 0;
		  int f [] = new int[b];
		  for(int n=0;n<b;n++){
		  f[n]=Math.abs(d[0][i]-e[0][n])+Math.abs(d[1][i]-e[1][n]);
		  if(f[c]>f[n]){
			  c=n;
	      }
		  }
		  System.out.println(c+1);
		  
	  }
	   }
	}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a, b;
  int k;
  cin >> a >> b >> k;
  bool A = true;
  for(int i = 0; i < k; i++){
    if(A){
      if(a%2 == 1) a--;
      a /= 2;
      b += a;
      A = false;
    }
    else{
      if(b%2 == 1) b--;
      b /= 2;
      a += b;
      A = true;
    }
  }
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main {
    def main(args: Array[String]){
        val sc = new Scanner(System.in)
        val n = sc.nextInt
        val tlist = List.fill(n)(sc.nextLong)

        val ans = tlist.reduceLeft { (a, b) => lcm(a, b) }
        println(ans)
    }

    def gcd(a:Long, b:Long) :Long = {
        if (b == 0) a else gcd(b, a%b)
    }

    def lcm(a:Long, b:Long) :Long = {
        val c = gcd(a, b)
        if (c > 0) a / gcd(a, b) * b else 0
    }
}


Measured memory_bytes: 25544
void main()
{
    long a, b, c;
    rdVals(a, b, c);

    if (a + b >= c)
    {
        "No".writeln;
        return;
    }
    long x = a * b;
    long y = c - a - b;

    writeln(4 * x < y * y ? "Yes" : "No");
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int mat1[101][101];

    int mat2[101][101];

    double mat3[101][101];

    int na,mb,lc;

    int f,g,h;

    scanf("%d %d %d", &na, &mb, &lc);
    for(f=0; f<na; f++)
    {
        for(g=0; g<mb; g++){
            scanf("%d", &mat1[f][g]);
        }
    }
    for(f=0; f<mb; f++)
    {

        for(g=0; g<lc; g++){
            scanf("%d", &mat2[f][g]);
        }
    }
    for(f=0; f<na; f++)
    {
        for(g=0; g<lc; g++)
        {
            for(h=0; h<mb; h++)
            {
                mat3[f][g] += mat1[f][h] * mat2[h][g];
            }
        }
    }
    for(f=0; f<na; f++)
    {
        for(g=0; g<lc; g++)
        {
            if(g != lc-1) printf("%.0lf ", mat3[f][g]);
            else printf("%.0lf", mat3[f][g]);
        }
        printf("\n");
    }
    return 0;

}


Measured memory_bytes: 2088
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, nextInt())
	}
	return
}

func min(num1, num2 int) int {
	if num1 < num2 {
		return num1
	}
	return num2
}

func max(num1, num2 int) int {
	if num1 < num2 {
		return num2
	}
	return num1
}

func main() {
	sc.Scan()
	S := sc.Text()
	if S == "Sunny" {
		fmt.Print("Cloudy")
	}
	 if S == "Cloudy"{
		fmt.Print("Rainy")
	}
	 if S == "Rainy"{
		fmt.Print("Sunny")
	}
}


Measured memory_bytes: 640
n=int(input())
s=[int(input()) for i in range(n)]
#print(n,s)
t=[[float('-inf') for i in range(10000+1)] for i in range(n+1)]

t[0][0]=0
for j in range(1,n+1):
    t[j]=t[j-1]
    tmp=[]
    for i in range(10000+1):
        if t[j-1][i]>=0:
            tmp.append(t[j-1][i])
    for i in tmp:
        t[j][i+s[j-1]]=i+s[j-1]

for i in range(len(t[n])):
    if t[n][i]%10==0:
        t[n][i]=0

print(max(t[n]))



Measured memory_bytes: 35316
#include<stdio.h>

int main(){
    int K, X;
    int min,max;
    scanf("%d %d",&K, &X);
    if(X-K+1 < -1000000) min = -1000000;
    else min = X-K+1;
    if(X+K-1 > 1000000) max = 1000000;
    else max  = X+K-1;
    
    for(int i = min;i <= max ; i++)
    printf("%d ",i);
    printf("\n");
    return 0;
}



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

lli a[300005];
int main()
{
    int n;
    cin >> n;
    map<lli, lli> m;
    rep(i, n)
    {
        cin >> a[i];
        m[a[i]]++;
    }
    vector<lli> v;
    vector<lli> v2;

    for (auto s : m) {
        if (s.second > 1) {
            v.push_back(s.first);
        }
        if (s.second > 3) {
            v2.push_back(s.first);
        }
    }
    if (v.size() < 2 and v2.size() == 0) {
        cout << 0 << endl;
        return 0;
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    sort(v2.begin(), v2.end());
    reverse(v2.begin(), v2.end());
    if (v2.size() > 0) {
        lli ans = max(v[0] * v[1], v2[0] * v2[0]);
        cout << ans << endl;
    } else {
        lli ans = v[0] * v[1];
        cout << ans << endl;
    }
}


Measured memory_bytes: 7296
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	int cnt = 0;
	while(n--){
		int a;
		cin>>a;
		if(a>=k){
			cnt++;
		}
	}
	cout << cnt;
}


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

int N;
vector<int> v;

int solve() {
	for(int i = 0; i < 10000; i++) {
		bool flg = true;
		for(int j = 0; j < v.size(); j++) {
			flg &= v[j] == j+1;
		}
		if(flg)
			return i;

		int pb = v.size();
		int k = 0;
		for(int j = 0; j < v.size(); j++) {
			v[j]--;
			v[k] = v[j];
			if(v[j]) k++;
		}
		v.erase(v.begin() + k, v.end());
		v.push_back(pb);
	}
	return -1;
}

int main() {
	while(cin >> N, N) {
		v.clear();
		v.resize(N);
		for(int i = 0; i < v.size(); i++) {
			cin >> v[i];
		}
		cout << solve() << endl;
	}
}

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

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

#define pb push_back
#define mp make_pair

int main(){
    int k, x;
    while(~scanf("%d %d", &k, &x)){
        int lft = max(-1000000, x - k + 1);
        int rgt = min(1000000, x + k - 1);
        for(int i=lft; i<=rgt; i++){
            printf("%d%c", i, i==rgt?'\n':' ');
        }
    }
    return 0;
}


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

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

	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll>a(n+1),b(m+1);
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]+=a[i-1];
	}
	for(int i=1;i<=m;i++){
		cin>>b[i];
		b[i]+=b[i-1];
	}
	ll ans=0;
	for(int len1=0;len1<=n;len1++){
		ll time1=a[len1];
		ll len2=upper_bound(b.begin(),b.end(),k-time1)-b.begin();
		len2--;
		ll time2=b[len2];
		if(time1+time2<=k){
			ans=max(ans,len1+len2);
		}
	}
	cout<<ans<<'\n';

	return 0;
}

Measured memory_bytes: 6328
import java.util.Arrays;
import java.util.Scanner;

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

		int[] arr = new int[3];
		arr[0] = reader.nextInt();
		arr[1] = reader.nextInt();
		arr[2] = reader.nextInt();
		int K = reader.nextInt();
		int ans = 0;
		Arrays.sort(arr);
		for (int i = 0; i< K; i++) {
			arr[2] *= 2;
		}
		for (int i = 0; i < 3; i++) {
			ans += arr[i];
		}



		System.out.print(ans);
		reader.close();
	}
}





Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
using namespace std;

long long  MOD = 1000000007;

int main() {
    int N,M;
    cin >> N >> M;
    vector<string>A(N), B(M);
    for (int i = 0; i < N; i++)cin >> A[i];
    for (int i = 0; i < M; i++)cin >> B[i];

    for (int i = 0; i <= N-M; i++) {
        for (int j = 0; j <= N - M; j++) {
            bool ok = true;
            for (int k = 0; k < M; k++) {
                for (int l = 0; l < M; l++) {
                    if (A[i+k][j+l] != B[k][l])ok = false;
                }
            }
            if (ok==true) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
bc = [1] * n
bt = [0] * n
bt[0] = 1

for _ in range(m):
    x, y = map(int, input().split())
    x, y = x - 1, y - 1
    bc[x] -= 1
    bc[y] += 1
    bt[y] |= bt[x]
    if bc[x] == 0:
        bt[x] = 0

print(sum(bt))



Measured memory_bytes: 4596
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  vll BIT(n + 1, 0);
  auto badd = [&](ll i) {
    while(i <= n){
      BIT[i] += 1;
      i += i & -i;
    }
  };
  auto bsum = [&](ll i) {
    ll ret = 0;
    while (i > 0) {
      ret += BIT[i];
      i -= i & -i;
    }
    return ret;
  };

  vll st(n);
  vll bin(n);
  rep(i, n) {
    cin >> bin[i];
    st[i] = bin[i];
  }
  Sort(st);
  unordered_map<ll, ll> revst;
  rep(i, n) revst[st[i]] = i + 1;
  ll ans = 0;
  rep(i, n) {
    ll tmp = revst[bin[i]];
    ans += i - bsum(tmp);
    badd(tmp);
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 15748
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<functional>
#include<algorithm>
using namespace std;

struct edge { int to, cost; };
typedef pair<int, int> P;
vector<edge>G[200005];
int d[200005];

void dijk(int s) {
	priority_queue<P,vector<P>, greater<P>>Q;
	fill(d, d + 200000, 1e9);
	d[s] = 0;
	Q.push(P(0, s));

	while (Q.size()) {
	
		P p = Q.top();
		Q.pop();
		int v = p.second;
		if (d[v] < p.first)continue;
		for (int i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				Q.push(P(d[e.to], e.to));
			}
		}
	}
}
signed main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		G[a - 1].push_back({ b - 1,1 });
		G[b - 1].push_back({ a - 1,1 });
	}
	dijk(0);
	if (d[n-1] > 2)puts("IMPOSSIBLE");
	else puts("POSSIBLE");
}

Measured memory_bytes: 15080
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#define REP(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a, b) for(i = (a); i < (b); i++)
#define ill long long
#define fcout cout << fixed << setprecision(10)
using namespace std;

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  vector<vector<char>> v(h, vector<char>(w));
  REP(i, 0, h) {
    REP(j, 0, w) {
      cin >> v[i][j];
    }
  }
  int cnt = 0;
  for(int bit = 0; bit < (1<<(h+w)); bit++) {
    vector<int> s;
    for(int i = 0; i < w+h; i++) {
      if(bit & (1<<i)) {
        s.push_back(i);
      }
    }
    //for(int i : s) cout << i << " ";
    //cout << "\n";
    vector<vector<char>> vv = v;
    for(int i : s) {
      if(i < h) {
        REP(j, 0, w) {
          vv[i][j] = '0';
        }
      } else {
        REP(j, 0, h) {
          vv[j][i-h] = '0';
        }
      }
    }
    /*REP(i, 0, h) {
      REP(j, 0, w) {
        cout << vv[i][j];
      }
      cout << "\n";
    }
    cout << "\n";*/
    int f = 0;
    REP(i, 0, h) {
      REP(j, 0, w) {
        if(vv[i][j] == '#') {
          f++;
        }
      }
    }
    //cout << bit << " " << f << "\n";
    if(f == n) cnt++;
  }
  cout << cnt << "\n";
}

Measured memory_bytes: 3632
#atcoder template
def main():
    import sys
    imput = sys.stdin.readline
    #文字列入力の時は上記はerrorとなる。
    #ここにコード
    #input
    n = int(input())
    a = list(map(int, input().split()))

    #output
    answer = 0
    for i in range(1, n):
        if a[i] < a[i-1]:
            answer += a[i-1]-a[i]
            a[i] = a[i-1]

    print(answer)

    #N = 1のときなどcorner caseを確認！
if __name__ == "__main__":
    main()

Measured memory_bytes: 32068
#!/usr/bin/python3
# -*- coding: utf-8 -*-



N = int(input())
Dn = list(map(int, input().split()))
ret = 0
for d1 in range(N):
  for d2 in range(d1+1,N):
    ret += Dn[d1] * Dn[d2]
print(ret)

Measured memory_bytes: 38512
N=int(input())
S=list(input())

numbers=[]
number=[0,0]


for s in S:
    if s=='W':
        number[0]+=1
        suuji=number[1]-number[0]
        numbers.append(suuji)
    else:
        number[1]+=1
        suuji=number[1]-number[0]
        numbers.append(suuji)
place=numbers.index(max(numbers))


if place==0:
    answer=S[1:].count('E')
    print(answer)
elif place==N-1:
    answer=S[:-1].count('W')
    print(answer)
else:
    first=S[:place]
    last=S[place+1:]
    answer=first.count('W')+last.count('E')
    print(answer)
    

Measured memory_bytes: 25616
/*----------------by syr----------------*/
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<limits>
#include<list>
#include<map>
#include<math.h>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<sstream>
#include<string>
#include<time.h>
#include<utility>
#include<vector>

using namespace std;

const int INF=1e9+7;

struct st{int p,b,c;};

bool operator < (const st &a,const st &b){return a.c>b.c;}

int n,m;
vector<int> g[100005];
map<int,int> d[100005];
map<int,vector<int> > ve[100005];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		u--;v--;
		ve[u][w].push_back(v);
		ve[v][w].push_back(u);
		g[u].push_back(w);
		g[v].push_back(w);
	}
	priority_queue<st> pq;
	pq.push((st){0,0,0});
	d[0][0]=0;
	while(!pq.empty()){
		st p=pq.top();
		pq.pop();
		if(d[p.p][p.b]!=p.c) continue;
		if(d[p.p].find(0)==d[p.p].end()||d[p.p][0]>p.c){
			d[p.p][0]=p.c;
			pq.push((st){p.p,0,p.c});
		}
		if(p.b==0){
			for(int i=0;i<g[p.p].size();i++){
				int v=g[p.p][i];
				if(d[p.p].find(v)==d[p.p].end()||d[p.p][v]>p.c+1){
					d[p.p][v]=p.c+1;
					pq.push((st){p.p,v,p.c+1});
				}
			}
			continue;
		}
		for(int i=0;i<ve[p.p][p.b].size();i++){
			int v=ve[p.p][p.b][i];
			if(d[v].find(p.b)==d[v].end()||d[v][p.b]>p.c){
				d[v][p.b]=p.c;
				pq.push((st){v,p.b,p.c});
			}
		}
	}
	int ans=INF;
	for(map<int,int>::iterator it=d[n-1].begin();it!=d[n-1].end();it++) ans=min(ans,(it->second));
	if(ans==INF) puts("-1");
	else printf("%d\n",ans);
	return 0;
}


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

int main() {
    int n;
    int k;
    int numShow = 1;
    int minNumber = 9999999;
    cin >> n >> k;

    for (int i = 0; i < n; i++) {
        // 操作Aの処理
        for (int a = i; a < n; a++) {
            numShow *= 2;
            //cout << "a";
            // if (numShow > minNumber) {
            //     break;
            // }
        }

        // 操作Bの処理
        for (int b = n - i; b < n; b++) {
            numShow += k;
            //cout << "b";
            // if (numShow > minNumber) {
            //     break;
            // }
        }

        //cout << numShow << endl;
        if (numShow < minNumber) {
            minNumber = numShow;
        }

        numShow = 1;
    }
    
    cout << minNumber << endl;
}

Measured memory_bytes: 3556
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int ans = 0;
		int[] l = new int[2 * n];

		for (int i = 0; i < l.length; i++) {
			l[i] = scan.nextInt();
		}

		Arrays.sort(l);

		for (int i = 0; i < l.length; i += 2) {
			ans += l[i];
		}

		System.out.println(ans);

		scan.close();
	}
}


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


int main(){
    int N,R;
    cin >> N >> R;
    if(N>=10){
        cout << R << endl;
    }else{
        cout << R+100*(10-N) << endl;
    }
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  ll a, b, k; cin >> a >> b >> k;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  // ll ans = 0;
  // bool ok = false;
  if(b-a>=k*2) {
    rep(i,k) cout << a+i << endl;
    rep(i,k) cout << b-k+1+i << endl;
  } else //if (b-a>=c-1){
    for(int i=a;i<=b;i++){
      cout<<i<<endl;
    }
  //} else {
    
    
  // cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}









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

typedef pair<int, int> P;

int main() {
    int N, M;
    cin >> N >> M;
    priority_queue<P> que;
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        que.push(P(a, 1));
    }
    for (int i = 0; i < M; i++) {
        int b, c;
        cin >> b >> c;
        que.push(P(c, b));
    }

    long long res = 0;
    while (N > 0) {
        P p = que.top(); que.pop();
        int t = min(p.second, N);
        res += (long long)p.first * t;
        N -= t;
        p.second -= t;
        if (p.second > 0) {
            que.push(p);
        }
    }

    cout << res << endl;
    return 0;
}

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

long long K;

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

int main(){
	cin >> K;
	long long ans = 0;
	for(long long a = 1; a <= K; a++) {
		for(long long b = 1; b <= K; b++) {
			for(long long c = 1; c <= K; c++) {
				ans += gcd(a, gcd(b, c));
			}
		}
	}
	cout << ans << endl;

}

Measured memory_bytes: 3640
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
typedef long long LL;

using namespace std;

int main()
{
	int m,n;
	cin >> m >> n;
	int x,y;
	int flag = 0;
	for(int i = 0;i < 100;i++)
	{
		for(int j = 0;j < 100;j++)
		{
			if(2*i+4*j == n && i+j == m)
			{
				cout << "Yes";
				return 0;
			}
			if(2*i+4*j > n && i + j > m)
			{
				break;
			}
		}
		if(2*i > n && i > m)
		{
			break;
		}
	}
	if(!flag)
		cout << "No";
	
	return 0;
}

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

using namespace std;

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

    long double a;
    long double b;
    cin>>a>>b;

    cout<<int64_t(floor(a*b))<<"\n";


    return 0;
}


Measured memory_bytes: 3744
package main

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

func main() {
	N, K := ReadInt(), ReadInt()
	v1 := N % K
	v2 := K - v1
	fmt.Println(Min(v1, v2))
}

func Min(xs ...int) int {
	min := xs[0]
	for _, x := range xs[1:] {
		if min > x {
			min = x
		}
	}
	return min
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1844
s = input()
n = len(s)
l = []
i = 0
while i < n:
    j = 1
    while i + j < n and s[i] == s[i + j]:
        j += 1
    l.append((s[i], j, i))
    i += j

ans = [0] * n
i = 0
if l[0][0] == 'L':
    ans[0] = l[0][1]
    i += 1

while i + 1 < len(l):
    cr, R, pr = l[i]
    cl, L, pl = l[i + 1]
    ans[pl - 1] = (R + 1) // 2 + L // 2
    ans[pl] = (L + 1) // 2 + R // 2
    i += 2

if l[-1][0] == 'R':
    ans[-1] = l[-1][1]
print(*ans)


Measured memory_bytes: 21112
#include <stdio.h>
int line[200000];
int main(void)
{
	int n, temp = 0;
	if (~scanf("%d", &n))
	{
		for (int i = 0; i < n; i++)
		{
			scanf("%d", &line[i]);
		}
		for (int i = 0; i < n; i++)
		{
			if (line[i] == temp + 1)
			{
				temp++;
			}
		}
		if (temp) printf("%d", n - temp);
		else printf("-1");
	}
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007

#define rep(i, n) for(ll (i) = 0;(i) < (ll)(n);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1;(i) >= 0LL;(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ld W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << fixed << setprecision(9);
    cout << W * H / 2 << ' ' << (W / 2.0 == x && H / 2.0 == y) << 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++)
typedef long long ll;
int main(){
    int n,ma,mb,A[40],B[40],C[40],dp[41][401][401],INF=1e9;
    cin>>n>>ma>>mb;
    rep(i,n) cin>>A[i]>>B[i]>>C[i];
    rep(i,41)rep(j,401)rep(k,401) dp[i][j][k]=INF;
    dp[0][0][0]=0;
    rep(i,n)rep(j,401)rep(k,401){
      dp[i+1][j][k]=dp[i][j][k];
      if(j>=A[i]&&k>=B[i]&&dp[i][j-A[i]][k-B[i]]!=INF) dp[i+1][j][k]=min(dp[i][j-A[i]][k-B[i]]+C[i],dp[i+1][j][k]);
    }
    dp[n][0][0]=INF;
    int m=INF,z=0;
    rep(j,401)rep(k,401) if(j*mb==k*ma&&dp[n][j][k]!=INF) z=1,m=min(m,dp[n][j][k]);
    if(z) cout<<m;
    else cout<<-1;
}

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

int main(){
    long long int H, W;
    cin >> H >> W;
    long long int sum = 0;
    if(W == 1 || H == 1) sum = 1;
    else if(W % 2 != 0){
        if(H % 2 != 0){
            sum = (W / 2 + 1) * (H / 2 + 1) + (W / 2) * (H / 2);
        }
        else{
            sum = (W / 2 + 1) * (H / 2) + (W / 2) * (H / 2);
        }    
    }
    else{
        sum = (W / 2) * H;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;
const int MAX_N = 3000 + 1;
int dp[MAX_N][MAX_N];

int main() {

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

  string s, t;
  cin >> s;
  cin >> t;
  
  dp[0][0] = 0;
  
  for (int i = 0; i < s.size(); i++) {
    for (int j = 0; j < t.size(); j++) {
      if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j] + 1;
      else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]);
    }
  }

  string lcs = "";
  int i = s.size();
  int j = t.size();
  while(i > 0 && j > 0) {
    if(dp[i][j] == dp[i-1][j]) i--;
    else if (dp[i][j] == dp[i][j-1]) j--;
    else {
      lcs = s[i-1] + lcs;
      i--; j--;
    }
  }

  cout << lcs << endl;
  return 0;
}



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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  string S;
  cin >> S;
  stack<char> st;
  REP(i,S.length()) {
    if(st.empty()) {
      st.push(S[i]);
    }else{
      if(st.top() == 'S' && S[i] == 'T') {
        st.pop();
      }else{
        st.push(S[i]);
      }
    }
  }
  cout << st.size() << endl;
  return 0;
}



Measured memory_bytes: 644
import java.util.Scanner;

public class Main {

	static char[] s;
	static int idx;
	static int[] PQR = {0,0,0};
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			String str = cin.next();
			if(str.equals(".")){
				break;
			}
			s = (str+"     ").toCharArray();
			idx=0;
			int count=0;
			for(int i = 0;i <3;i++){
				for(int j = 0;j<3;j++){
					for(int k = 0;k<3;k++){
						idx=0;
						PQR[0]=i;
						PQR[1]=j;
						PQR[2]=k;
						if(formula()==2){
							count++;
						}
					}
				}
			}
			System.out.println(count);
		}
	}
	static int formula(){
		int res = 0;
		if(s[idx]=='0'){
			res = 0;
			idx++;
		}
		else if(s[idx]=='1'){
			res = 1;
			idx++;
		}
		else if(s[idx]=='2'){
			res = 2;
			idx++;
		}
		else if(s[idx]=='P'){
			res = PQR[0];
			idx++;
		}
		else if(s[idx]=='Q'){
			res = PQR[1];
			idx++;
		}
		else if(s[idx]=='R'){
			res = PQR[2];
			idx++;
		}
		else if(s[idx]=='-'){
			idx++;
			res = minus(formula());
		}
		else if(s[idx]=='('){
			idx++;
			res = formula();
			if(s[idx]=='*'){
				idx++;
				res = and(res, formula());
			}
			else if(s[idx]=='+'){
				idx++;
				res = or(res, formula());
			}
			idx++;
		}
		return res;
	}
	static int minus(int a){
		if(a == 0){
			return 2;
		}
		else if(a==2){
			return 0;
		}
		else{
			return 1;
		}
	}
	static int and(int a, int b){
		if(a+b==4){
			return 2;
		}
		else if(a==0||b==0){
			return 0;
		}
		else{
			return 1;
		}
	}
	static int or(int a,int b){
		if(a+b==0){
			return 0;
		}
		else if(a==2||b==2){
			return 2;
		}
		else{
			return 1;
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (((a + d - 1) / d) < ((b + c - 1) / b)) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin >> n;
	for(int i=1;i<=n;i++){
		long double ld=i*1.08;
		int id=(int)ld;
		if(id==n){
			cout << i << "\n";
			return 0;
		}
	}
	cout << ":(" << "\n";
	return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

struct Spl{auto r="".splitter;auto rd(){r=readln.splitter;}auto bd(T)(ref T t){t=r.front.to!T;r.popFront;}}
auto _s = Spl();
auto getV(T...)(ref T t){foreach(ref u;t)_s.bd(u);}
auto getA(T)(size_t n,ref T t){t=new T(n);foreach(ref u;t)_s.bd(u);}
auto readV(T...)(ref T t){_s.rd; getV(t);}

void main()
{
  int p, q, r; readV(p, q, r);
  writeln(min(p+q, q+r, r+p));
}


Measured memory_bytes: 256
program ABC170D
    implicit none
    integer(8)::N,i,j,flg,ans=0,amax
    integer(8),allocatable::A(:),B(:)
    read*,N
    allocate(A(N))
    read*,A
    amax=maxval(A)
    allocate(B(amax))
    B=0
    call heapsort(N,A)

    do i=1,N
        if(i>=2.and.A(i)==A(i-1))B(A(i))=1
        do j=2,amax/A(i)
            B(A(i)*j)=1
        end do
    end do

    do i=1,N
        if(B(A(i))==0)ans=ans+1
    end do

    print'(i0)',ans
end program ABC170D

subroutine heapsort(n,array)
    implicit none
    integer(8),intent(in) :: n
    integer(8),intent(inout) :: array(1:n)
   
    integer(8) ::i,k,j,l
    integer(8) :: t
   
    if(n.eq.1)return
  
    l=n/2+1
    k=n
    do while(k.ne.1)
       if(l.gt.1)then
          l=l-1
          t=array(L)
       else
          t=array(k)
          array(k)=array(1)
          k=k-1
          if(k.eq.1) then
             array(1)=t
             exit
          endif
       endif
       i=l
       j=l+l
       do while(j.le.k)
          if(j.lt.k)then
             if(array(j).lt.array(j+1))j=j+1
          endif
          if (t.lt.array(j))then
             array(i)=array(j)
             i=j
             j=j+j
          else
             j=k+1
          endif
       enddo
       array(i)=t
    enddo
  
    return
end subroutine heapsort

Measured memory_bytes: 12412
// C - Forbidden List
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

bool exist(int x, vi &P){
		for(auto p:P) if(x == p) return true;
		return false;
}

int main(){
	int x, n; cin>>x>>n;
	vi P(n); rep(i, n) cin>>P[i];
	int ans = x, d = 1e9;
	rep(c, 101+1){ // candidate:[0,101]
		if(!exist(c, P)){
			if(d > abs(x-c)){
				d = abs(x-c);
				ans = c;
			}
		}
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>

using namespace std;

typedef long long int ll;
typedef vector<ll> V;
typedef vector<V> VV;

int main() {
  // Happy hacking!
  ll a, b, t;
  cin >> a >> b >> t;

  cout << b * (t / a) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define fi first
#define se second
using namespace std;
using pii = pair<int,int>;
using vi = vector<int>;
using ll = long long;
int n;
int a[105];

bool perfect(int p)
{
    int df;
    if (p == 0) {
        df = a[2] - a[1];
    } else if (p == 1){
        df = a[2] - a[0];
    } else {
        df = a[1] - a[0];
    }

    for (int i=1; i<n+1; ++i) {
        int tmp = a[i] - a[i-1];
        if (i == p) continue;
        if (i-1 == 0) continue;

        if (i-1 == p) {
            tmp = a[i] - a[i-2];
        }

        if (tmp != df) {
            return false;
        }
    }
    return true;
}

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


    while (cin >> n, n != 0) {
        rep(i, n+1) {
            cin >> a[i];
        }

        rep(pos, n+1) {
            if (perfect(pos)) {
                outl(a[pos]);
                break;
            }
        }
    }
}




Measured memory_bytes: 3168
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#include <string.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
 
const double TL = 1.5 * CLOCKS_PER_SEC;
mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count());
#define clr(x, y) memset(x, y, sizeof(x))
#define forn(i, n) for (int i = 0; i < n; i++)
#define LL long long
const double pi = acos(-1.0);

int l, r, d;
int main() {
#ifdef LOCAL
  auto start_clock = clock();
  freopen("in", "r", stdin);
#endif
  scanf("%d%d%d", &l, &r, &d);
  int ans = 0;
  for (int i = l; i <= r; i++) {
    if (i % d == 0) {
      ans += 1;
    }
  }
  printf("%d\n", ans);

  

#ifdef LOCAL
 auto end_clock = clock();
 cout << "Time:" << (end_clock - start_clock) / CLOCKS_PER_SEC << endl;
#endif
  return 0;
}

Measured memory_bytes: 3840