akhauriyash/Code-Regression huggingface dataset:
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
inner=0
for i in range(n-1):
  for j in range(i+1,n):
    if a[i]>a[j]:
      inner+=1
outer=0
for i in range(n):
  for j in range(n):
    if a[i]>a[j]:
      outer+=1
ans=inner*k+outer*k*(k-1)//2
print(ans%mod)

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

#define fi first
#define se second

const int K = 500500;

using namespace std;

int main()
{
        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
        ios_base::sync_with_stdio(0);

        string s;
        cin >> s;
        long long res = 0;
        vector < int > a((int)s.size() + 1, 0);
        for(int i = 0; i < s.size(); i++){
                int j = i;
                if(i && s[i - 1] == '<'){
                        continue;
                }
                while(j < s.size() && s[j] == '<'){
                        a[j + 1] = max(a[j + 1], a[j] + 1);
                        j += 1;
                }
        }
        for(int i = s.size() - 1; i >= 0; i--){
                int j = i;
                if(i < s.size() && s[i + 1] == '>'){
                        continue;
                }
                while(j >= 0 && s[j] == '>'){
                        a[j] = max(a[j], a[j + 1] + 1);
                        j -= 1;
                }
        }
        for(int x: a){
                res += x;
        }
        cout << res << "\n";
}


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

int main(){
long long a,b,c,d,e,s,sum;
cin>>a>>b>>c;
if(b-a+1>2*c){
  for(int i=0;i<c;i++){
    cout<<a+i<<endl;
  }
    for(int i=0;i<c;i++){
    cout<<b-c+1+i<<endl;
  }
}
  else{
  for(long long i=0;i<b-a+1;i++){
   cout<<a+i<<endl;
  }
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int k, n;
  cin >> k >> n;
  vector<ll> a(n + 1);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  a[n] = a[0] + k;
  vector<ll> dist(n);
  for (int i = 0; i < n; ++i) {
    dist[i] = a[i + 1] - a[i];
  }
  vector<ll> sum(n);
  for (int i = 0; i < n - 1; ++i) {
    sum[0] += dist[i];
  }
  for (int i = 1; i < n; ++i) {
    sum[i] = sum[i - 1] - dist[i - 1] + dist[(i + n - 2) % n];
  }
  ll ans = 1e18;
  for (int i = 0; i < n; ++i) {
    ans = min(ans, sum[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <string.h>

void rotate(grid)
	char grid[][9];
{
	char tmp[8][9] = {};
	int i, j;

	for (i = 0; i < 8; i++)
		for (j = 0; j < 8; j++)
			tmp[j][7 - i] = grid[i][j];

	memcpy(grid, tmp, sizeof(tmp));
}

int main(argc, argv)
	int argc;
	char *argv[];
{
	char grid[8][9];
	int i, j;

	for (i = 0; i < 8; i++)
		scanf("%s", grid[i]);

	for (i = 90; i <= 270; i += 90){
		printf("%d\n", i);
		rotate(grid);
		for (j = 0; j < 8; j++)
			printf("%s\n", grid[j]);
	}

	return (0);
}

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

using namespace std;

int n, m, k;
bool ok;
int main( ) {
	scanf("%d %d %d", &n, &m, &k);
	for (int i = 0; i <= n; i ++) {
// i * m + (n - i) * j = k;
		int tmp = k - i * m;
		if (tmp < 0) continue;
		if (tmp == 0) {
			ok = true;
			break;
		}
		if (n - 2 * i == 0) continue;
		if (tmp % ((n - 2 * i))) continue;
		int q = tmp / (n - 2 * i);
		if (q < 0 || q > m) continue;
		ok = true;
		break;
	}
	if (ok) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

int main(){
        double r;
        cin >> r;
        cout <<fixed << setprecision(6)<<pow(r,2.0) * M_PI  <<" "<< 2.0 * r
*M_PI << endl;
        return 0;
}


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

int main()
{
  int N;
  unsigned long long A[100000];

  std::cin >> N;

  //printf("N:%d", N);
  for ( int i = 0; i < N; i++ ) {
    std::cin >> A[i];
    //printf("%llu\n", A[i]);
    if ( A[i] == 0 ) {
      std::cout << 0 << std::endl;
      return 0;
    }
    //printf("%d:%lf", i, A[i]);
  }

  unsigned long long B = A[0];
  for ( int i = 1; i < N; i++ ) {
    if ( A[i]  > (unsigned long long)1e18 / B ) {
      std::cout << -1 << std::endl;
      return 0;
    }
    B *= A[i];
  }

  std::cout << (unsigned long long)B << std::endl;

  return 0;

}


Measured memory_bytes: 4332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
char anst[30], anss[30];

int main(){
    for(int i = 0; i < 30; i++) anss[i] = anst[i] = 'A';
    string s,t;
    cin >> s >> t;
    for(int i = 0; i < s.length(); i++){
        if(anss[int(s[i]-'a')] != 'A'){
            if(anss[int(s[i]-'a')] != t[i]){
                cout << "No\n";
                return 0;
            }
        }
         if(anst[int(t[i]-'a')] != 'A'){
            if(anst[int(t[i]-'a')] != s[i]){
                cout << "No\n";
                return 0;
            }
        }
        anss[int(s[i]-'a')] = t[i];
        anst[int(t[i]-'a')] = s[i];
    }

    cout << "Yes\n";
}

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

int main() {
  int n;
  cin >> n;
  
  map<string, int> mp;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    ++mp[s];
  }
  
  int mx = 0;
  for (auto&& p : mp) {
    mx = max(mx, p.second);
  }
  
  for (auto&& p : mp) {
    if (p.second == mx) {
      cout << p.first << endl;
    }
  }
}

Measured memory_bytes: 25216
import java.util.*;

public class Main {
  public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          int num1 = sc.nextInt();
          int num2 = sc.nextInt();
          int sum = 0;
          for(int i = 0; i < 2; i++){
            if(num1 < num2){
              sum += num2;
              num2--;
            } else {
              sum += num1;
              num1--;
            }
          }
          System.out.println(sum);
      }
    }

Measured memory_bytes: 21332
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	map<char, int> mp;
	rep(i,h*w){
		char a;
		cin >> a;
		++mp[a];
	}
	int two = 0, four = 0;
	for(auto p : mp){
		four += p.second / 4;
		p.second %= 4;
		two += p.second / 2;
	}
	int n_four = (h/2) * (w/2);
	int n_two = (h*w - n_four * 4) / 2;
	bool ok = true;
	if(four < n_four) ok = false;
	two += (four - n_four) * 2;
	if(two < n_two) ok = false;
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int n,k,r,s,p,ans=0,i;
string t;
int main(){
cin>>n>>k>>r>>s>>p>>t;
for(i=0;i<n;i++){
    if(i>=k&&t[i]==t[i-k])t[i]=0;
    if(t[i]=='s')ans+=r;
    if(t[i]=='p')ans+=s;
    if(t[i]=='r')ans+=p;
}
cout<<ans;
}


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

if n % 2 == 0:
    for i in reversed(range(1,n,2)):
        print(a[i],end=" ")
    for i in range(0,n-1,2):
        print(a[i],end=" ")
elif n % 2 == 1:
    for i in reversed(range(0,n,2)):
        print(a[i],end=" ")
    for i in range(1,n,2):
        print(a[i],end=" ")

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

int main() {
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 10000; i++) {
    if (int(i * 0.08) == a && int(i * 0.1) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
import copy

N, M = map(int, input().split())
X = list(map(int, input().split()))

if N > M:
    ans = 0
else:
    ans = 0
    X.sort()
    diff = []
    for i in range(len(X) - 1):
        diff.append(X[i + 1] - X[i])
    diff_orig = copy.copy(diff)
    diff.sort()
    index = []
    for i in range(N - 1):
        index.append(diff_orig.index(diff.pop()))
    index.append(-1)
    index.sort()
    i = len(index) - 1
    index.append(len(X) - 1)
    while i >= 0:
        ans += X[index[i + 1]] - X[index[i] + 1]
        i -= 1
print(ans)

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int nums[] = new int[3];
		nums[0] = sc.nextInt();
		nums[1] = sc.nextInt();
		nums[2] = sc.nextInt();
		Arrays.sort(nums);
		if(nums[0] + nums[1] == nums[2]) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
// abc165_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#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()
{
  ll x,yokin=100,ans=0;
  cin>>x;
  while(true) {
    if (yokin>=x) {
      break;
    }
    ans++;
    yokin=yokin*1.01;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main() {
cout<<fixed<<setprecision(10);

string s;
  cin >>s;
  if (s[0]=='7' || s[1]=='7' ||s[2]=='7') cout <<"Yes";
  else cout <<"No";
	
}


Measured memory_bytes: 3592
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#define SREP(s,i,m) for(unsigned int i = s; i < m; ++i)
#define REP(i,m) SREP(0,i,m)
using namespace std;
#ifdef _MSC_VER
using LONG = __int64;
#else
using LONG = long long int;
#endif

string S;
LONG result;

void calc(string s, LONG lhs) {
  for (int i = 0; i < s.size(); i++) {
    string first = s.substr(0, i);
    string last = s.substr(i);
    stringstream fss(first), lss(last);
    LONG fnum, lnum;
    lss >> lnum; fss >> fnum;
    if (i != 0) {
      calc(last, lhs + fnum);
    } else {
      result += lhs + lnum;
    }
  }
}

int main(void) {
  cin >> S;
  result = 0;
  calc(S, 0);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    while True:
        n = int(input().strip())

        if n == 0:
            break

        phrases = []
        for _ in range(n):
            word = input().strip()
            phrases.append(word)

        PHRASE_LEN = [5,7,5,7,7]
        found_flag = False

        for i in range(n):
            acc_len = 0
            phrase_idx = 0
            for j in range(i, n):
                acc_len += len(phrases[j])

                if acc_len == PHRASE_LEN[phrase_idx]:
                    if phrase_idx == (len(PHRASE_LEN)-1):
                        found_flag = True
                        break

                    acc_len = 0
                    phrase_idx += 1
                elif acc_len > PHRASE_LEN[phrase_idx]:
                    break

            if found_flag:
                print(i+1)
                break

if __name__ == "__main__":
    main()



Measured memory_bytes: 5608
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    S = read_func().strip()
    T = read_func().strip()

    for i in range(len(T)):
        is_match = True
        for j in range(len(S)):
            if S[j] != T[(i + j) % len(T)]:
                is_match = False
                break
        if is_match == True:
            break;
    if is_match == True:
        print "Yes"
    else:
        print "No"

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
x,y,u,v=map(int,input().split())

p=u-x
q=v-y

S="U"*q+"R"*p+"D"*q
S+="L"*(p+1)+"U"*(q+1)+"R"*(p+1)+"D"+"R"+"D"*(q+1)+"L"*(p+1)+"U"
print(S)


Measured memory_bytes: 38256
<?php
  list($n)=explode(" ",trim(fgets(STDIN)));
  $a=explode(" ",trim(fgets(STDIN)));

  $gcd=$a[0];

  for($i=1;$i<$n;$i++){
    $gcd=gmp_gcd($gcd,$a[$i]);
  }
  echo $gcd;

Measured memory_bytes: 24080
{-# LANGUAGE BangPatterns #-}
import           Control.Exception           (assert)
import           Control.Monad
import           Control.Monad.Primitive
import qualified Control.Monad.ST            as ST
import qualified Data.Array.IO               as IO
import qualified Data.Array.ST               as ST
import qualified Data.Array.Unboxed          as A
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import qualified Data.Map.Strict             as Map
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Set                    as Set
import qualified Data.Vector                 as VB
import qualified Data.Vector.Mutable         as VBM
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

inf :: Int
inf = 10^18

-- quickSortVec from https://gist.github.com/kazu-yamamoto/3051375
quickSortList :: (Ord a, VM.Unbox a) => [a] -> [a]
quickSortList xs = ST.runST $ do
    arr <- V.thaw $ V.fromList xs
    let beg = 0
        end = VM.length arr - 1
    quickSortVec beg end arr
    V.toList <$> V.freeze arr

quickSortVec l u arr
  | l >= u    = return ()
  | otherwise = do
      VM.unsafeSwap arr l ((u+l)`div`2)
      t <- VM.unsafeRead arr l
      let i = l
          j = u + 1
      nj <- loopVec t u i j arr
      VM.unsafeSwap arr l nj
      quickSortVec l (nj-1) arr
      quickSortVec (nj+1) u arr

loopVec !t !u !i !j arr = do
  ni <- doWhile i (+1)         (< t)
  nj <- doWhile j (subtract 1) (> t)
  if ni > nj
    then return nj
    else do VM.unsafeSwap arr ni nj
            loopVec t u ni nj arr
              where
                {-# INLINE doWhile #-}
                doWhile k op p
                  | nk > u    = return nk
                  | otherwise = do
                      x <- VM.unsafeRead arr nk
                      if p x then
                        doWhile nk op p
                        else
                        return nk
                        where
                          nk = op k

main = do
  n <- getInt
  as <- getIntList

  let as' = quickSortList as

  let solve [] res = res
      solve (a:as) res = let res' = res * (fromIntegral a)
                         in if res' > (10^18)
                            then -1
                            else solve as res'

  print $ solve as' (1::Integer)


Measured memory_bytes: 10680
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

int main() {
    lint N, Q;
    cin >> N >> Q;

    vector<lint> A(N);
    for(auto& elem : A)  cin >> elem;
    vector<lint> X(Q);
    for(auto& elem : X)  cin >> elem;

    sort(A.begin(), A.end());
    vector<lint> right(N+1);
    right[0] = 0, right[1] = A[0];
    for(lint i=2; i<=N; i++) right[i] = right[i-2] + A[i-1];

    vector<lint> left(N+1);
    left[N] = 0;
    for(lint i=N-1; i>=0; i--) left[i] = left[i+1] + A[i];

    for(auto x : X) {
        lint ok = N;
        lint ng = 0;
        while(ok - ng > 1) {
            lint mid = (ok + ng) / 2;
            if(A[mid] < x) {
                ng = mid;
            } else {
                lint tID = N-mid-1;
                auto r = lower_bound(A.begin(), A.end(), A[mid]);
                auto l = lower_bound(A.begin(), A.end(), x+x-A[mid]);
                lint aID = r-l;
                (aID >= tID ? ok : ng) = mid;
            }
        }
        cout << left[ok] + right[max(0LL,ok+ok-N)] << endl;
    }
}

Measured memory_bytes: 4864
import sys
sys.setrecursionlimit(100000000)
#input = sys.stdin.readline

def solve():
  n,k = (int(i) for i in input().split())
  a = list(int(i) for i in input().split())
  mod = 10**9+7
  firstt = [0]*n
  for i in range(n-1):
    for j in range(i+1,n):
     if a[i] > a[j]:
      firstt[i] += 1
      
  secondt = [0]*n
  a2 =  a + a
  for i in range(n):
   for j in range(i+1,2*n):
    if a2[i] > a2[j]:
      secondt[i] += 1
  
  query = []
  for i in range(n):
    query.append(secondt[i]-2*firstt[i])

  ans = 0
  for i in range(n):
    tmp = 0
    tmp += (query[i]*(k*(k-1)))
    tmp += (firstt[i]*(k*(k+1)))
    tmp //= 2
    ans += tmp
  print(ans%mod)
solve()


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

int main()
{
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int k;
    int a[5];
    cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]>>k;
    bool yay=0;
    for(int i=0;i<4;i++)
    {
        for(int j=i+1;j<5;j++)
        {
            if(abs(a[j]-a[i])>k)
            {
                yay=1;
                break;
            }
        }
    }
    if(yay==0)
        cout<<"Yay!\n";
    else
        cout<<":(\n";

    return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

int main() {
  int n, bmi;
  double w, h;
  char c1, c2;
  VI num;

  while(cin >> n >> c1 >> w >> c2 >> h) {
    bmi = w / (h*h);
    if(bmi >= 25) num.PB(n);
  }
  if(num.empty()) cout << "該当なし" << endl;
  else {
    VI::iterator it = num.begin();
    while(it != num.end()) {
      cout << *it << endl;
      it++;
    }
  }
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n,k; cin >> n >> k;
  	VI h(n); VIin(h);
  	SORT(h);
  	int ans = INF;
  	VI a(k,0);
  	rep(i,n-k+1){
    	int res = 0;
      	rep(j,k) a[j] = h[i+j];
      	ans = min(ans,a[k-1] - a[0]);
    }
  	ANS;
  
    return 0;
}


Measured memory_bytes: 1792
A = list(input())
B = list(input())
C = list(input())

t = 'a'

while True:
    if t == 'a':
        if len(A) > 0:
            t = A[0]
            del A[0]
        else:
            r = 'A'
            break
    elif t == 'b':
        if len(B) > 0:
            t = B[0]
            del B[0]
        else:
            r = 'B'
            break
    else:
        if len(C) > 0:
            t = C[0]
            del C[0]
        else:
            r = 'C'
            break

print(r)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);


int main()
{
    int n,a,b;
    cin >> n >> a >> b;
    if(a+b < n) cout << min(a,b) << ' ' << 0 << endl;
    else cout << min(a,b) << ' ' <<  (a+b)-n << endl; 
    return 0;
}

Measured memory_bytes: 256
def dfs(v, k):
    if ans[v][1] == 0:
        ans[v][1] = k
    else:
        return k - 1
    for i in d[v]:
        k = dfs(i, k + 1)
    k += 1
    if ans[v][2] == 0:
        ans[v][2] = k
    return k


G = int(input())
vlst = [list(map(int, input().split())) for _ in range(G)]
d = [[] for _ in range(G)]
for i in range(G):
    for j in range(vlst[i][1]):
        d[i].append(vlst[i][2 + j] - 1)
ans = [[_, 0, 0] for _ in range(G)]
k = 1
for i in range(G):
    k = dfs(i, k) + 1
for i in ans:
    print(i[0] + 1, i[1], i[2])


Measured memory_bytes: 5724
#include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    typedef pair<int,int> pii;
    #define mp make_pair
    #define pb push_back
    #define f first
    #define s second
     
     
    //var 
    LL x, k, d;
     
    int main(){
    	ios_base::sync_with_stdio(0); 
    	cin.tie(0);
     
    	cin >> x >> k >> d;
    	if(x < 0) x = -x;
     
    	if((x/d) > k){
    		cout << x - (k*d) << endl;
    		return 0;
    	}
     
    	if(k % 2 == ((x/d) % 2)){
    		cout << (x%d) << endl;
    		return 0;
    	}
     
    	cout << (d - (x%d)) << endl;
     
    	cout.flush();
    	return 0;
    }

Measured memory_bytes: 3632
import sys
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if v <= w:
    print('NO')
    sys.exit()

V = v - w
R = abs(a-b)
if V*t >= R:
    print('YES')
else:
    print('NO')

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

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

ll N, A, B, diff;
vector<ll> h;
bool check(ll x)
{
  ll need = 0;
  for (ll i = 0; i < N; ++i) {
    ll temp = h.at(i) - B * x;
    if (temp <= 0) {
      break;
    }
    need += (temp + diff - 1) / diff;
  }
  if (need <= x) {
    return true;
  }
  else {
    return false;
  }
}

int main()
{
  cin >> N >> A >> B;
  diff = A - B;
  h = vector<ll>(N);
  for (ll i = 0; i < N; ++i) {
    cin >> h.at(i);
  }
  sort(h.begin(), h.end());
  reverse(h.begin(), h.end());
  ll l = 0, r = pow(10, 9) + 1;
  while (l + 1 != r) {
    ll m = (l + r) / 2;
    if (check(m)) {
      r = m;
    }
    else {
      l = m;
    }
  }
  cout << r << "\n";
}


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

//yokuwakaranaidesune;;

int main(){
    ll n; cin >> n;
    vector<char> c(n); rep(i,n) cin >> c[i];

    ll r = 0, ans = 0; 
    for(auto x : c) if(x == 'R') r++;
    rep(i,r) if(c[i] == 'W') ans++;

    put(ans);
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, m; cin >> n >> m;
    map<ll, ll> cnt;
    rep(i, m){
        ll s, g;
        cin >> s >> g;
        s--; g--;
        cnt[s]++, cnt[g]++;
    }
    bool ans = true;
    for(auto &num: cnt) if(num.second%2 != 0) ans = false;
    ans ? YES() : NO();
}

Measured memory_bytes: 9060
package main

import "fmt"

func main() {
	var h [300][2]int
	var i int
	i = 0
	for true {
		fmt.Scanf("%d%d\n", &h[i][0], &h[i][1])
		if h[i][0] == 0 {
			if h[i][1] == 0 {
				break
			}
		}
		i++

	}
	for j := 0; j < i; j++ {

		for n := 0; n < h[j][0]; n++ {
			if n == 0 || n == h[j][0]-1 {
				for k := 0; k < h[j][1]; k++ {
					fmt.Printf("#")
				}
			} else {
				for k := 0; k < h[j][1]; k++ {
					if k == 0 || k == h[j][1]-1 {
						fmt.Printf("#")
					} else {
						fmt.Printf(".")
					}
				}
			}
			fmt.Println("")
		}
		fmt.Println("")
	}

}




Measured memory_bytes: 1160
# D
import numpy as np
a, b, x = map(int, input().split())
h = (x/(a*a)-0.5*b)/0.5
if h > 0.0:
    print("%.11f"%(np.arctan((b-h)/a)*180/np.pi))
else:
    h = x/(0.5*b*a)
    print("%.11f"%(np.arctan(b/h)*180/np.pi))

Measured memory_bytes: 12508
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int taroP = 0;
        int hanakoP = 0;
        int num = sc.nextInt();
        while (num > 0) {
            String taroStr = sc.next();
            String hanakoStr = sc.next();
            int result = taroStr.compareTo(hanakoStr);
            if (result > 0) {
                taroP = taroP + 3;
            } else if (result < 0){
                hanakoP = hanakoP + 3;
            }else {
                taroP++;
                hanakoP++;
            }
            num--;
        }
        System.out.println(taroP + " " + hanakoP);
    }
}



Measured memory_bytes: 30108
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int shurui,max=0;
int N=Integer.parseInt(sc.next());
String S=sc.next();
    for(int I=0;I<N;I++){
    String SS=S.substring(0,I+1);
    String SSS=S.substring(I+1,N);
    shurui=0;
    for(char j='a';j<='z';j++){
        String k=String.valueOf(j);
    if(SSS.contains(k)&&SS.contains(k))shurui++;
    }
    max=Math.max(shurui, max);
    }
System.out.println(max);
}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 2005

int length;
string input_str,rev_str;
ll dp[NUM][NUM];
int next_loc[NUM][26],rev_next[NUM][26];
ll ruisekiwa[NUM][26],num_alpha[NUM][NUM];

int main(){

	cin >> input_str;

	length = input_str.size();

	rev_str = input_str;

	reverse(rev_str.begin(),rev_str.end());

	for(int i = 0; i < 26; i++){
		next_loc[length][i] = BIG_NUM;
	}

	for(int i = length-1; i >= 0; i--){
		for(int k = 0; k < 26; k++){
			if(input_str[i] == 'a'+k){

				next_loc[i][k] = i;
			}else{

				next_loc[i][k] = next_loc[i+1][k];
			}
		}
	}


	for(int i = 0; i < 26; i++){
		rev_next[length][i] = BIG_NUM;
	}

	for(int i = length-1; i >= 0; i--){
		for(int k = 0; k < 26; k++){
			if(rev_str[i] == 'a'+k){

				rev_next[i][k] = i;
			}else{

				rev_next[i][k] = rev_next[i+1][k];
			}
		}
	}

	for(int i = 0; i <= length; i++){
		for(int k = 0; k <= length; k++){
			dp[i][k] = 0;
		}
	}


	dp[0][0] = 1;
	int next_i,next_rev_i;

	for(int i = 0; i < length; i++){
		for(int rev_i = 0; rev_i < length; rev_i++){
			for(int k = 0; k < 26; k++){

				next_i = next_loc[i][k];
				next_rev_i = rev_next[rev_i][k];

				if(next_i == BIG_NUM || next_rev_i == BIG_NUM || next_i+1+next_rev_i+1 > length)continue;

				dp[next_i+1][next_rev_i+1] += dp[i][rev_i];
				dp[next_i+1][next_rev_i+1] %= MOD;
			}
		}
	}

	ll ans = 0,add;

	for(int i = 0; i <= length; i++){
		for(int rev_i = 0; rev_i+i <= length; rev_i++){
			add = 1;
			for(int k = 0; k < 26; k++){
				if(next_loc[i][k]+1 <= length-(rev_i)){
					add++;
				}
			}
			ans += (dp[i][rev_i]*add)%MOD;
			ans %= MOD;
		}
	}

	printf("%lld\n",ans-1);

	return 0;
}



Measured memory_bytes: 35032
#!/usr/bin/env python3

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = sorted(list(set([int(input()) for _ in range(N)])))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = (ans * T[i + 2]) // (gcd(ans, T[i + 2]))
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 5128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	string s;

	ll ans=0;
	cin>>n>>s;
	vvl dp(n,vl(n));
	rep(i,n){
		range(j,i+1,n){
			if(i==0)dp[i][j]=(s[i]==s[j]?1:0);
			else{
				if(s[i]==s[j])dp[i][j]=min(ll(j-i),dp[i-1][j-1]+1);
				chmax(ans,dp[i][j]);
			}
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 195840
#include<stdio.h>
#include<string.h>
 
int main(void)
{
    int a;
  	int b;
  	int temp=0;
  	int i=0;
    // 整数の入力
    scanf("%d %d\n",&a,&b);
  	if(a>b){
      temp=b;
      for(i=0;i<a-1;i++)
       	temp=10*temp+b;
    }
	else if(b>a){
      temp=a;
      for(i=0;i<b-1;i++)
       	temp=10*temp+a;
    }
    else if(a==b){
      temp=a;
      for(i=0;i<a-1;i++)
       	temp=10*temp+a;
    }
    printf("%d\n",temp);
    return 0;
}

Measured memory_bytes: 128
from bisect import bisect_right

if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a = sorted(a)
    b = sorted(b)
    c = sorted(c)

    ans = 0

    # まずあるbを選んだ時のcの組み合わせの数のリストを作る。
    clist = [0] * n
    clist[n-1] = n - bisect_right(c, b[n-1])
    for i in range(n-2, -1, -1):
        clist[i] = n - bisect_right(c, b[i]) + clist[i+1]

    for aa in a:
        b_pos = bisect_right(b, aa)
        if b_pos != n:
            ans += clist[b_pos]

    print(ans)


Measured memory_bytes: 24052
#include <stdio.h>
int max(int a,int b) {return a>b?a:b;}
int run(int *u, int l, int k) {
	int s[100001] = {u[0]}, m = u[0], i;
	for(i = 1; i < l; i++) {
		s[i] = s[i - 1] + u[i];
		if(!(i % 2) && i >= k*2) {
			m = max(m, s[i] - (i - k*2 - 1 >= 0 ? s[i - k*2 - 1] : 0));
		} else if(i == l - 1)
			m = max(m, s[i] - (i - k*2 >= 0 ? s[i - k*2] : 0));
	}
	return m;
}
int main() {
	int n, k, s[100000], u[100001], l = 0, m, c = 1, i;
	char t;
	scanf("%d %d ", &n, &k);
	for(i = 0; i < n; i++) {
		scanf("%c", &t);
		s[i] = t - '0';
		if(!i) {
			m = s[i];
			if(!m)
				u[l++] = 0;
		} else if(s[i] == m)
			c++;
		else {
			u[l++] = c;
			m = !m;
			c = 1;
		}
	}
	u[l++] = c;
	
	printf("%d", run(u, l, k));
	return 0;
}

Measured memory_bytes: 896
import math
N, M = list(map(int, input().split()))
if N==M==1:
    print(0)
elif M < 2:
    print(int(math.factorial(N)/math.factorial(2)/math.factorial(N-2)))
elif N==0:
    print(int(math.factorial(M)/math.factorial(2)/math.factorial(M-2)))
else:
    print(int(math.factorial(N)/math.factorial(2)/math.factorial(N-2) +  math.factorial(M)/math.factorial(2)/math.factorial(M-2)))

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a[5];
    for(int i=0;i<5;i++)
    {
        cin>>a[i];
        if(!a[i])
        {
            cout<<i+1<<'\n';
            break;
        }
    }
    
    return 0;
}



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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;

int main()
{
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> p, q;
    rep(i, a)
    {
        ll input;
        cin >> input;
        p.push_back(input);
    }
    rep(i, b)
    {
        ll input;
        cin >> input;
        q.push_back(input);
    }
    sort(p.begin(), p.end());
    sort(q.begin(), q.end());

    priority_queue<int> que;
    for (int i = 0; i < x; i++) {
        que.push(p.at(a - 1 - i));
    }
    for (int i = 0; i < y; i++) {
        que.push(q.at(b - 1 - i));
    }

    rep(i, c)
    {
        ll input;
        cin >> input;
        que.push(input);
    }

    ll sum = 0;
    rep(i, x + y)
    {
        sum += que.top();
        que.pop();
    }

    cout << sum << endl;
}


Measured memory_bytes: 3956
#include <stdio.h>

int main(void)
{
	int a, b, i;
	int count = 1;

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

	if (b == a) 
	{
		printf("1\n");
		return 0;
	}
	else if (b == 1) 
	{
		printf("0\n");
		return 0;
	}

	i = a;
	while (i < b)
	{
		i += (a - 1);
		count++;
	}

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

	return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h> 
using namespace std; 
#define M 1e9+7
#define ll long long
#define lli long long int
#define I 10e5

int main() 
{ 
   ios_base::sync_with_stdio(false);cin.tie(NULL); 
   
   #ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin);
   freopen("output.txt", "w", stdout); 
   #endif
   int t;
   ll n, k;
   cin>>n>>k;
   vector<ll> v(n);
   for(auto &i:v)
      cin>>i;
   vector<ll> dp(n, M);
   dp[0] = 0;
   for(ll i=0;i<n;i++)
   {
      for(ll j=1;j<=k;j++)
      {
         if(i+j<n)
            dp[i+j] = min(dp[i+j], dp[i]+abs(v[i]-v[i+j]));
      }
   }
   cout<<dp[n-1]<<endl;
   cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl; 
   return 0; 
}

Measured memory_bytes: 4744
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
 int a, b, c, d;
  cin >> a >> b;
  
  c=max(a+b, a-b);
  co(max(c, a*b));
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int n, m, c[15][15] = { 0 };
	std::cin >> n >> m;
	
	for (int i = 0; i < 10; ++i)
	{
		for (int j = 0; j < 10; ++j)
		{
			std::cin >> c[i][j];
		}
	}
	
	for (int k = 0; k < 10; ++k)
	{
		for (int i = 0; i < 10; ++i)
		{
			for (int j = 0; j < 10; ++j)
			{
				if (i != j && c[i][k] + c[k][j] < c[i][j])
				{
					c[i][j] = c[i][k] + c[k][j];
				}
			}
		}
	}
	
	int ans = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			int x;
			std::cin >> x;
			if (x != -1)
			{
				ans += c[x][1];
			}
		}
	}
	
	std::cout << ans;
}

Measured memory_bytes: 256
[<EntryPoint>]
let main _ =
    let days = ["SAT"; "FRI"; "THU"; "WED"; "TUE"; "MON"; "SUN"]
    let input = System.Console.ReadLine()
    List.findIndex ((=) input) days
    |> (+) 1
    |> printfn "%i"
    0

Measured memory_bytes: 14044
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100005;
#define endl '\n'
#define ld long double
#define int ll
#define all(x) (x).begin(),(x).end()

int32_t main()
{ 
   IOS
 
   int x;
  cin >> x;
  if(x>=30) cout << "Yes" << endl;
  else cout << "No" << endl;


  


  
    


  
  
  


    


  
  

 
}

Measured memory_bytes: 3584
def slove():
    import sys
    input = sys.stdin.readline
    s = str(input().rstrip('\n'))
    t = []
    lt = ""
    cnt = 0
    for i in range(len(s)):
        t.append(s[i])
        if lt != "".join(t):
            cnt += 1
            lt = "".join(t)
            t = []
    print(cnt)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 41308
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::cmp;

fn f(i: i64, N: usize, A: Vec<i64>) -> i64 {
    let mut B = A.iter().map(|a| a % i).collect::<Vec<_>>();
    B.sort();
    let mut k = N - 1;
    let mut q = 0;
    for j in 0..N {
        while B[j] > 0 && B[j] < i {
            if j == k {
                return 10000000000;
            }
            let d = cmp::min(i - B[k], B[j]);
            B[k] += d;
            B[j] -= d;
            if B[k] == i {
                k -= 1;
            }
            q += d;
        }
    }
    q
}

fn main() {
    let (N, K) = get!(usize, i64);
    let A = get!(Vec<i64>);

    let s = A.iter().sum::<i64>();
    let mut i = 1;
    let mut ans = 0;
    while i * i <= s {
        if f(i, N, A.clone()) <= K {
            ans = cmp::max(i, ans);
        }
        if f(s / i, N, A.clone()) <= K {
            ans = cmp::max(s / i, ans);
        }
        i += 1;
    }

    println!("{}", ans);
}

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

namespace codeTester.contest190804
{
    class ProblemC
    {
        static int n = 0;
        static List<long> hList = new List<long>();
        static string answer = "";

        public static void Main(string[] args)
        {
            Input();
            Logic();
            Output();
        }

        static void Input()
        {
            n = int.Parse(Console.ReadLine());
            hList = ReadSpaceSeparatedValues();
        }

        public static List<long> ReadSpaceSeparatedValues()
        {
            List<long> values = new List<long>();
            string[] inputs = Console.ReadLine().Split(' ');
            foreach (string input in inputs)
            {
                values.Add(long.Parse(input));
            }

            return values;
        }

        static void Logic()
        {
            long lastHeight = 0;
            for(int i = 0; i < n - 1; i++)
            {
                // 今の数字を可能なら１減らしておく。
                if (lastHeight < hList[i])
                {
                    hList[i]--;
                }

                // 次の数字が今の数字より小さかったらアウト
                if (hList[i + 1] < hList[i])
                {
                    answer = "No";
                    return;
                }
                lastHeight = hList[i];
            }
            answer = "Yes";
        }

        static void Output()
        {
            Console.WriteLine(answer);
        }

        static void DebugPrint(string msg)
        {
            // 提出時に消す
            // Console.WriteLine(msg);
        }
    }
}


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

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

typedef pair<int,int> P;
const int hmax=1001,wmax=1001;
const int INF=1000100100;
char mp[hmax][wmax];
int d[hmax][wmax];
int h,w,n,ans=0;
int sy,sx;
int dy[4]={-1,0,1,0},dx[4]={0,1,0,-1};
int gy[10],gx[10];


int bfs(){
    cin >> h >> w >> n;
    rep(i,h)rep(j,w) d[i][j]=INF;
    rep(i,h)rep(j,w){
        cin >> mp[i][j];
        if(mp[i][j]=='S'){
            sy=i,sx=j;
        }
        if(mp[i][j]!='S'&&mp[i][j]!='X'&&mp[i][j]!='.'){
            gy[mp[i][j]-'1']=i,gx[mp[i][j]-'1']=j;
        }
    }
    rep(k,n){
        rep(i,h)rep(j,w) d[i][j]=INF;
        d[sy][sx]=0;
        queue<P> q;
        q.push(P(sy,sx));
        while(q.size()){
            P p=q.front();
            q.pop();
            if(p.first==gy[k]&&p.second==gx[k]) break;
            rep(i,4){
                int y=p.first+dy[i],x=p.second+dx[i];
                if(0<=y&&y<h&&0<=x&&x<w&&d[y][x]==INF&&mp[y][x]!='X'){
                    q.push(P(y,x));
                    d[y][x]=d[p.first][p.second]+1;
                }
            }
        }
        ans+=d[gy[k]][gx[k]];
        sy=gy[k],sx=gx[k];
    }
    return ans;
}

int main(){
    cout << bfs() << endl;
    return 0;
}














Measured memory_bytes: 8048
#include <cstdio>
#define buf 10000
using namespace std;
int B[10];
void BubbleSort(void);

int main(void){
  int i,n,m,A[20001];
  char str[buf];

  for( ; ; ){
    for(i=0;i<5;i++){
      fgets(str,sizeof(str),stdin);
      sscanf(str,"%d %d",&n,&m);
      if(n==0 && m==0) return 0;
      B[i]=n+m; A[n+m]=i;
    }
    BubbleSort();
    printf("%c %d\n",'A'+A[B[0]],B[0]);
  }
  return 0;
}

void BubbleSort(void){
  int i,j,tmp;
  for(i=0;i<4;i++){
    for(j=4;j>i;j--){ 
      if(B[j] > B[j-1]){
        tmp = B[j-1];
        B[j-1] = B[j];
        B[j] = tmp;
      }
    }
  }
}

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

using namespace std;

#define int int64_t

signed main() {
    int n;
    cin >> n;
    vector<pair<int, int>> arr(n);
    for (int i = 0; i < n; ++i) {
        int x, l;
        cin >> x >> l;
        arr[i].first = x + l;
        arr[i].second = x - l;
    }
    sort(arr.begin(), arr.end());
    int ans = 0, l = -1e9;
    for (int i = 0; i < n; ++i) {
        if (arr[i].second >= l) {
            ++ans;
            l = arr[i].first;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

ll a,b,N,K,cunt;                                                 
int main(){
    cin>>N>>K;

    if(K){
        for(b=K+1;b<=N;b++)
            cunt+=(N/b)*max(0ll,b-K)+max(0ll,N%b+1-K);
    }
    else
        cunt=N*N;
    cout<<cunt<<"\n";
    return 0;
}

Measured memory_bytes: 256