akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Word
import qualified Data.ByteString as BSW
import qualified Data.ByteString.Char8 as BS
import Data.Array.Unboxed
import Data.Array.ST
--import qualified Data.Vector.Unboxed as U
--import qualified Data.Vector.Unboxed.Mutable as UM

-- Input: s t
-- Output: arr
--   arr ! (i,j) == length of lcs of (drop i s, drop j t)
lcsTable2 :: BS.ByteString -> BS.ByteString -> UArray (Int,Int) Word16
lcsTable2 s t = runSTUArray $ do
  let !m = BS.length s
      !n = BS.length t
      !n' = n+1
  arr <- newArray ((0,0),(m,n)) 0
  forM_ [m-1,m-2..0] $ \ !i -> do
    let !x = BSW.index s i
        loopY !j !v
          -- v = readArray arr (i,j+1)
          | j < 0 = return ()
          | otherwise = do
              let !y = BSW.index t j
              if x == y
                then do l2 <- readArray arr (i+1,j+1)
                        let !l = l2 + 1
                        writeArray arr (i,j) l
                        loopY (j-1) l
                else do l0 <- readArray arr (i+1,j)
                        let !l = max l0 v
                        writeArray arr (i,j) l
                        loopY' (j-1) l l0
        loopY' !j !v !w
          -- v = readArray arr (i,j+1)
          -- w = readArray arr (i+1,j+1)
          | j < 0 = return ()
          | otherwise = do
              let !y = BSW.index t j
              if x == y
                then do let !l = w + 1
                        writeArray arr (i,j) l
                        loopY (j-1) l
                else do l0 <- readArray arr (i+1,j)
                        let !l = max l0 v
                        writeArray arr (i,j) l
                        loopY' (j-1) l l0
    loopY' (n-1) 0 0
  return arr

main = do
  s <- BS.getLine
  t <- BS.getLine
  -- BS.length s <= 3000, BS.length t <= 3000, BS.all isAsciiLower s, BS.all isAsciiLower t
  let !table = lcsTable2 s t
      !m = BS.length s
      !n = BS.length t
      !n' = n+1
  let recon !i !j | i >= m || j >= n = Nothing
                  | x == y = let !i' = i+1 ; !j' = j+1
                             in Just (x, (i', j'))
                  | table ! (i+1,j) >= table ! (i,j+1) = recon (i+1) j
                  | otherwise = recon i (j+1)
        where x = BSW.index s i
              y = BSW.index t j
      (result, _) = BSW.unfoldrN (fromIntegral $ table ! (0,0)) (\(!i,!j) -> recon i j) (0,0)
  BS.putStrLn result


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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,L;
    int A[100000];
    cin>>N>>L;
    rep(i,N)cin>>A[i];

    for(int i=0;i+1<N;i++){
        if(A[i]+A[i+1]>=L){
            puts("Possible");
            for(int j=1;j<=i;j++)printf("%lld\n",j);
            for(int j=N-1;j>i+1;j--)printf("%lld\n",j);
            printf("%lld\n",i+1);
            return 0;
        }
    }
    puts("Impossible");
    return 0;
}


Measured memory_bytes: 1536
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

n = ni()
ss = []
for _ in range(n):
    ss.append(lc())

alpha = [[0 for _ in range(n)] for _ in range(26)]


for i, s in enumerate(ss):
    c_set = set(list(s))
    for c in c_set:
        alpha[ord(c) - ord("a")][i] = s.count(c)

ans = ""
for i, a in enumerate(alpha):
    ans = ans + chr(ord("a")+i)*min(a)
    
print(ans)

Measured memory_bytes: 3064
<?php
$n = intval(fgets(STDIN));
$array = array_map("intval", explode(" ", trim(fgets(STDIN))));

$min = 10**18;
for($i = 0; $i < 2; $i++){
    $sum = 0;
    $move = 0;
    for($j = 0; $j < $n; $j++){
        $sum+=$array[$j];
        if(($i+$j) % 2 == 0){
            if($sum <= 0){
                $move += 1-$sum;
                $sum += 1-$sum;
            }
        }else{
            if($sum >= 0){
                $move += 1 + $sum;
                $sum -= 1 + $sum;
            }
        }
    }
    $min = min($min, $move);
}
echo $min;


Measured memory_bytes: 16884
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <numeric>

using namespace std;
#define ALL(x)			(x).begin(),(x).end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (ll)(n) ; ++(i))
#define INF				(int)2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;
typedef vector<ll>		VLL;
typedef vector<VLL>		VVLL;
typedef vector<VVLL>	VVVLL;

/*-----------------------------------------------------------------------------
　処理
 -----------------------------------------------------------------------------*/
int main()
{
	int X, A, B;
	cin >> X >> A >> B;
	cout << (X - A) % B << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		String s = sc.next();
		String[] h = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};

		for (int i = 0; i < 26; i++) {
			if (!s.contains(h[i])) {
				System.out.println(h[i]);
				sc.close();
				return;
			}
		}
		
		System.out.println("None");

		sc.close();
	}
}


Measured memory_bytes: 25428
def gcd(a, b):
    if a % b == 0: return b
    else: return gcd(b, a % b)

N = int(raw_input())
A = map(int, raw_input().split())

val = A[0]
for i in xrange(1, N, 1):
    val = gcd(val, A[i])

print val

Measured memory_bytes: 11320
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
//#pragma clang optimize off
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

using ll = long long;
using ull = unsigned long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}


double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int n, h;
	scanf("%d", &n);
	vector<tuple<int, int, int>> a(n);
	for (auto& [x, y, hh] : a)scanf("%d%d%d", &x, &y, &hh);
	bool flag;
	tuple<int, int, int> fst;
	for (auto& p : a)if (get<2>(p))fst = p;
	rep(x, 101) {
		rep(y, 101) {
			flag = true;
			auto [p, q, r] = fst;
			h = r + abs(x - p) + abs(y - q);
			for (const auto& [p, q, r] : a) {
				if (r != max(h - abs(x - p) - abs(y - q), 0))flag = false;
			}
			if (flag) {
				printf("%d %d %d\n", x, y, h);
			}
		}
	}

	Please AC;
}


Measured memory_bytes: 3800
#include<cstdio>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;

int main(void) {
	int N;
	scanf("%d", &N);
	vector<int> p(N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &p[i]);
	}
	vector<int> copy(p);
	sort(copy.begin(), copy.end());
	int diffCnt = 0;
	for (int i = 0; i < N; i++) {
		if (copy[i] != p[i]) {
			diffCnt++;
		}
	}
	printf(diffCnt <= 2 ? "YES" : "NO");
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[][] happiness = new int[n][3];
        int[][] dp = new int[3][n];
        int[] cal = new int[n];
        for (int i = 0; i < n; i++) {
            cal[i] = -1;
            for (int i1 = 0; i1 < 3; i1++) {
                happiness[i][i1] = scanner.nextInt();
            }
        }
        System.out.println(maxHappiness(happiness, dp, cal, n));
    }

    public static int maxHappiness(int[][] happiness, int[][] dp, int[] cal,int n) {

        dp[0][0] = happiness[0][0];
        dp[1][0] = happiness[0][1];
        dp[2][0] = happiness[0][2];

        for (int i = 1; i < n; i++) {
            dp[0][i] = Math.max(dp[1][i - 1], dp[2][i - 1]) + happiness[i][0];
            dp[1][i] = Math.max(dp[0][i - 1], dp[2][i - 1]) + happiness[i][1];
            dp[2][i] = Math.max(dp[1][i - 1], dp[0][i - 1]) + happiness[i][2];
        }


        return Math.max(Math.max(dp[0][n-1], dp[1][n-1]), dp[2][n-1]);
    }
}

Measured memory_bytes: 97064
#include <bits/stdc++.h>
using namespace std;
int a[200005];
map<int, int> dp;
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    long long ans = 0;
    for(int i=n;i>=1;i--){
        ans += dp[i+a[i]];
        dp[i-a[i]]++;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 21560
s = input()
al = set(list(s))
ans = 100
for c in al:
    L = list(s.split(c))
    tmp = 0
    for st in L:
        tmp = max(tmp,len(st))
    tmp = max(tmp,len(L[0]))
    tmp = max(tmp,len(L[-1]))
    ans = min(tmp,ans)
print(ans)



Measured memory_bytes: 3060
#define DEBUG 0

/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-4-21 10:41:20
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

const int MAX_SIZE = 1000010;
bool isprime[MAX_SIZE];
vector<int> prime_num;

void init()
{
  fill(isprime, isprime + MAX_SIZE, true);
  isprime[0] = isprime[1] = false;
  for (auto i = 2; i < MAX_SIZE; i++)
  {
    if (isprime[i])
    {
      prime_num.push_back(i);
      for (auto j = 2; i * j < MAX_SIZE; j++)
      {
        isprime[i * j] = false;
      }
    }
  }
}

vector<long long> make_factors(long long x)
{ // 2 \leq x \leq MAX_SIZE^2
  vector<long long> ans;
  auto it = prime_num.begin();
  while (it != prime_num.end())
  {
    if (x == 1)
    {
      break;
    }
    while (x % *it == 0)
    {
      ans.push_back(*it);
      x /= *it;
    }
    it++;
  }
  if (x != 1)
  {
    ans.push_back(x);
  }
  return ans;
}

ll N;
ll a[100010];
set<ll> S;
vector<ll> ans;

void make_primes()
{
  for (auto it = prime_num.begin(); it != prime_num.end(); it++)
  {
    if (*it <= N)
    {
      S.insert(*it);
#if DEBUG == 1
      cerr << "S.insert(" << *it << ")" << endl;
#endif
    }
    else
    {
      break;
    }
  }
  auto W = make_factors(abs(a[N]));
  for (auto x : W)
  {
#if DEBUG == 1
    cerr << "W inclues " << x << endl;
#endif
    S.insert(x);
  }
}

void flush()
{
  sort(ans.begin(), ans.end());
  for (auto x : ans)
  {
    cout << x << endl;
  }
}

void check_prime(ll p)
{
  vector<ll> A(min(p, N + 1), 0);
  A[0] = a[0];
  for (auto i = 1; i <= N; i++)
  {
    ll t = i % (p - 1);
    if (t == 0)
    {
      t = p - 1;
    }
    A[t] += a[i];
  }
  bool ok = true;
  for (auto x : A)
  {
    if (x % p != 0)
    {
      ok = false;
      break;
    }
  }
  if (ok)
  {
    ans.push_back(p);
  }
}

int main()
{
  init();
  cin >> N;
  for (auto i = 0; i <= N; i++)
  {
    cin >> a[i];
  }
  reverse(a, a + N + 1);
  make_primes();
  for (auto x : S)
  {
    check_prime(x);
  }
  flush();
}

Measured memory_bytes: 1916
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;
typedef pair<int, string> PSI;

int n, m;
string s;
int table[10][100];

int dp[10][100];

int main(){
	cin >> n >> m;
	REP(i, n){
		cin >> s;
		REP(j, m){
			if (s[j] == 'W')table[0][i]++;
			if (s[j] == 'B')table[1][i]++;
			if (s[j] == 'R')table[2][i]++;
		}
	}
	REP(i, 10)REP(j, 100)dp[i][j] = INF;
	dp[0][0] = table[1][0] + table[2][0];
	FOR(i, 1, n){
		if (i <= n - 3)dp[0][i] = dp[0][i - 1] + table[1][i] + table[2][i];
		if (i <= n - 2){
			dp[1][i] = min(dp[0][i - 1], dp[1][i - 1]) + table[0][i] + table[2][i];
		}
		if (2 <= i){
			dp[2][i] = min(dp[1][i - 1], dp[2][i - 1]) + table[0][i] + table[1][i];
		}
	}
	cout << dp[2][n - 1] << endl;
}

Measured memory_bytes: 1208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var nt = Console.ReadLine().Split().Select(int.Parse).ToArray();
			int n = nt[0];
			int t = nt[1];
			int[] tt = Console.ReadLine().Split().Select(int.Parse).ToArray();

			long ans = 0;
			for (int i = 1; i < n; i++) {
				ans += Math.Min(t, tt[i] - tt[i - 1]);
			}

			ans += t;
			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 26720
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    div = sorted(divisor(sum(A)), reverse=True)
    ans = 0
    for d in div:
        mod = [0] * N
        for i in range(N):
            mod[i] = A[i] % d
        sort_mod = sorted(mod)
        cnt = float('inf')
        rsum = d * N - sum(sort_mod)
        lsum = 0
        for j in range(N):
            lsum += sort_mod[j]
            rsum -= d - sort_mod[j]
            tmp = max(lsum, rsum)
            cnt = min(cnt, tmp)
        if cnt <= K:
            print(d)
            exit()

    


if __name__ == "__main__":
    main()

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

namespace B_ABC129
{
    class MainClass
    {

        static int[] n;
        static int[] s;

        public static void Main(string[] args)
        {
            n = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);

            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            
            var slst = s.ToList();
            long sum = slst.Sum();

            long ans1 = sum;
            long ans2 = 0;
            long tmp = 0;
            var anslst = new List<long>();

            for(int i=0;i<n[0];i++){
                ans1 = ans1 -slst[i];
                ans2 += slst[i];
                tmp = Math.Abs(ans1-ans2);
                anslst.Add(tmp);
            }
            anslst.Sort();
            Console.WriteLine(anslst.First());




        }
    }
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    int i;
    for(i=0;i<N;i++) cin >> A[i];
    for(i=0;i<N;i++){
        if(A[i]%2 == 0){
            if(A[i]%3 != 0 && A[i]%5 != 0){
                cout <<"DENIED" << endl;
                return 0;
            }
        }
    }
    cout << "APPROVED" << endl;
    return 0;
}

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

using namespace std;

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
#define rep(i,n) for(int i = 0;i<n;i++)

int main(){

    int N;cin >> N;
    long long s;
    vector<long long> a(110000, 0);
    long long sum = 0;
    rep(i,N){
        cin >> s;
        a[s]++;
        sum+=s;
    }
    int Q;cin >> Q;
    long long b,c;
    vector<long long> r(Q);
    rep(i,Q){
        cin >> b >> c;
        sum += a[b]*c-a[b]*b;
        a[c] += a[b];
        a[b] = 0;
        r[i] = sum;
    }
    rep(i,Q)cout << r[i] << endl;
    
    

}



Measured memory_bytes: 4820
public class Hello{
    public static void Main(){
        // Your code here!
        
        int a = int.Parse(System.Console.ReadLine());
        int b = int.Parse(System.Console.ReadLine());
        int c = int.Parse(System.Console.ReadLine());
        
        int x = a - c + 1;
        int y = a - b + 1;
        int z = x * y;
        
        System.Console.WriteLine(z);
        
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    ll n ; cin >> n;
    string s; cin >> s;
    ll l = 0, r = n-1, cnt = 0;
    while(r-l>=1){
        while(s.at(l)=='R'){
            l++;
            if(l>=n) goto aa;
        }
        s.at(l) = 'R';
        while(s.at(r) == 'W'){
            r--;
        	if(r<0) goto aa;
        }
        s.at(r) = 'W';
        if(r-l<1) break;
      	cnt++;
        //cout << s << endl;
      	//cout << l << " " << r << endl;
    }
    aa:
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3704
#include<iostream>
#include <algorithm>
#include<functional>
using namespace std;
int main(){
    int n;
    int l[200]={0};
    int ans;
    cin>>n;
    for(int i=0;i<2*n;i++){
        cin>>l[i];
    }
    sort(l,l+200,greater<int>());

    for(int i=0;i<2*n;i+=2) {
        if (l[i] < l[i + 1])ans += l[i];
        else ans += l[i+1];
    }
    cout<<ans<<endl;
    return 0;
}

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

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 15;

#ifndef LOCAL_H
    const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

/************************************************************************************************************************************************/

void solve(){
    int H, N;
    cin >> H >> N;
    for(int i = 0;i < N;i++){
        int dummy;
        cin >> dummy;
        H -= dummy;
    }
    if(H <= 0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll p = 1e9+7;

ll llmodpow(ll a,ll e){
  if(e==0){
    return 1LL;
  }
  if(e%2==0){
    ll ret=llmodpow(a,e/2);
    ret%=p;
    return (ret*ret)%p;
  }else{
    ll ret=a*llmodpow(a,e-1);
    ret%=p;
    return ret;
  }
}

int main(){
  ll n;
  cin>>n;
  ll ans;
  ans=llmodpow(10LL,n)-2*llmodpow(9LL,n)+llmodpow(8LL,n);
  ans%=p;
  ans=(ans+p)%p;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(void){
    int mpe[11],npe[11],allpe[11],all,i,j,k;
    char cla[11][200];
    for(i=0;i<9;i++){
    scanf("%s %d %d",&cla[i],&mpe[i],&npe[i]);
    allpe[i]=mpe[i]+npe[i];
    }
    for(j=0;j<9;j++){
        all=mpe[j]*200+npe[j]*300;
        printf("%s %d %d\n",cla[j],allpe[j],all);
    }
return 0;
}

Measured memory_bytes: 596
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  unsigned long long int x,y;
  cin>>x>>y;
  //for(int i=0;i<
  if(x%y==0)cout<<-1<<endl;
  else cout<<x*(y+1)<<endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm.*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
// #define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define debug() cout << "Hi" << endl	// write debug(); in main()
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
/*		0. Go to main function first.
		1. Take all the inputs................................................
		2. Check Once whether the graph given is directed or undirected.......
		3. Tree can also be undirected.
		4. Whenever you do multiplication and division in the same line, beware.
*/
void solve(){
	string s;
	cin >> s;
	if(s[2]==s[3] && s[4]==s[5])cout << "Yes\n";
	else cout << "No\n";
	}
/*	memset() can be used to set all values as 0 or -1 for integer data types.*/

int main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(12); std::cout << std::fixed;
	int t;
	// cin >> t;
	t = 1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
def sum_digits(num: int) -> int:
    sum = 0
    while num > 0:
        num, mod = divmod(num, 10)
        sum += mod
    return sum


n, a, b = list(map(int, input().split(' ')))
total = 0
for i in range(1, n + 1):
    sum = sum_digits(i)
    if a <= sum <= b:
        total += i

print(total)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n,k;
  cin >> n >> k;
  vector<int> q(n,0);
  rep(i,k){
    int d;
    cin >> d;
    rep(j,d){
      int y;
      cin >> y;
      y--;
      q[y]++;
    }
  }
  int ans=0;
  rep(i,n){
    if(q[i]==0)ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
#include<stdio.h>
#include<math.h>

typedef struct{
  double x;
  double y;
}Point;

//        u 
//       / \
//  a---s   t---b

void koch(int n, Point a, Point b){
  Point s,t,u;
  double th = M_PI / 3.0; //60degree
  
  if(n == 0) return;

  s.x = a.x + ((b.x - a.x) / 3.0 * 1.0);
  s.y = a.y + ((b.y - a.y) / 3.0 * 1.0);
  t.x = a.x + ((b.x - a.x) / 3.0 * 2.0);
  t.y = a.y + ((b.y - a.y) / 3.0 * 2.0);
  u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
  u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
  // (cos60 -sin60)(x) 回転行列
  // (sin60  cos60)(y)

  koch(n - 1, a, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(n - 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(n - 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(n - 1, t, b);
  
}

int main(){
  int n;
  Point a,b;
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  scanf("%d",&n);

  printf("%.8f %.8f\n", a.x, a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n", b.x, b.y);
  
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

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

  int res = 1;
  for (int i = 0; i < n; ++i) {
    if (res * 2 <= res + k) res *= 2;
    else res += k;
  }

  cout << res << 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;
const ll MOD = 1e9+7;

int main(){
    int n; cin >> n;
    vector<ll> a(n); rep(i,n) cin >> a[i];
    
    int right = 0;
    ll ans = 0;
    ll a_xor_sum = 0, a_sum = 0;
    for(int left = 0; left < n; ++left){
        while(right < n && (a_sum+a[right]) == (a_xor_sum^a[right])){
            a_sum += a[right];
            a_xor_sum ^= a[right];
            right++;
        }
        ans += right - left;
        if(left == right) ++right;
        else{
            a_sum -= a[left];
            a_xor_sum ^= a[left];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define N 100005
int n,A[N],now,ans;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++) scanf("%d",&A[i]);
	now=1,ans=1;
	for(int i=n-1; i; --i) {
		if(A[i]>=A[i+1])now++;
		else now=1;
		ans=max(ans,now);
	}
	printf("%d",ans-1);
	return 0;
}

Measured memory_bytes: 640
from copy import deepcopy
s1 = list(input())
s2 = deepcopy(s1)
length = len(s1)

ans1 = 0
ans2 = 0

# 1文字目'0'
for a in range(length):
    if a % 2 == 0:
        if s1[a] == '1':
            s1[a] = '0'
            ans1 += 1
    else:
        if s1[a] == '0':
            s1[a] = '1'
            ans1 += 1

# 1文字目'1'
for a in range(length):
    if a % 2 == 0:
        if s2[a] == '0':
            s2[a] = '1'
            ans2 += 1
    else:
        if s2[a] == '1':
            s2[a] = '0'
            ans2 += 1

print(min(ans1, ans2))


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

using namespace std;

int main()
{
    long long int N,K;
    cin>>N>>K;
    vector< pair<int,int> > ab(N);
    for (int i=0; i<N; ++i) {
        cin>>ab[i].first>>ab[i].second;
    }
    
    sort(ab.begin(),ab.end(),[](pair<int, int> a,pair<int, int> b){return a.first < b.first;});
    for (int i=0; i<N; ++i) {
        K-=ab[i].second;
        if(K<=0)
        {
            cout<<ab[i].first<<endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9+7;
pair<ll,ll>s4[4]={{-1,0},{1,0},{0,-1},{0,1}};
pair<ll,ll>s8[8]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,1},{1,0},{1,-1}};

void solve() {
	ll n,k;
	cin >> n >> k;
	ll a[n];
	for(int i=0;i<n;i++) {
		cin >> a[i];
	}
	sort(a,a+n);
	//for(int i=0;i<n;i++) {
	//	cout << a[i] << " ";
	//}
	ll count=0;
	ll sum=0;
	for(int i=n-1-k;i>=0;i--) {
		sum+=a[i];
	}
	cout << sum << endl;
}

signed main() {
	boost;
	solve();
}

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

int n, m;

int main(){
    cin >> n >> m;
    vector<vector<bool>> light(m, vector<bool>(n, false));
    int k;
    int s;
    for (int i = 0; i < m; i++){
        cin >> k;
        for (int j = 0; j < k; j++){
            cin >> s;
            s--;
            light[i][s] = true;
        }
    }
    vector<int> p(m);
    for (int i = 0; i < m; i++) cin >> p[i];
    
    int ans = 0;
    for (int x = 0; x < pow(2, n); x++){
        bool qw = true;
        for (int i = 0; i < m; i++){
            int stack = 0;
            for (int j = 0; j < n; j++){
                if ((x & (int)pow(2, j)) > 0 && light[i][j]) stack++;
            }
            if (stack % 2 != p[i]){
                qw = false;
                break;
            }
        }
        if (qw) ans++;
    }
    cout << ans << endl;
}







Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)

// Z algorithm (length of longest common prefix for s[0:N] & s[i:N] for each i)
// Complexity: O(N)
// <http://snuke.hatenablog.com/entry/2014/12/03/214243>
vector<int> z_algorithm(const string &s) {
    vector<int> ans(s.size());
    ans[0] = s.size();
    int i = 1, j = 0;
    while (i < (int)s.size()) {
        while (i + j < (int)s.size() && s[j] == s[i + j]) ++j;
        ans[i] = j;
        if (!j) {
            ++i;
            continue;
        }
        int k = 1;
        while (i + k < (int)s.size() && k + ans[k] < j) ans[i + k] = ans[k], ++k;
        i += k;
        j -= k;
    }
    return ans;
}

vector<lint> C2(string S) {
    vector<lint> ret(26);
    for (auto c : S) ret[c - 'a']++;
    for (auto &d : ret) d /= 2;
    return ret;
}

string Next(string S) {
    vector<int> z = z_algorithm(S);
    int r = S.length();
    FOR(i, S.length() / 2 + 1, S.length()) if (z[i] + i == S.length()) r = min(r, i);
    return  S.substr(0, r) + S.substr(0, r);
}

map<lint, vector<lint>> mp;

string S, T;
vector<lint> solve(lint L) {
    vector<lint> ret(26);
    while (L > T.length())
    {
        auto itr = prev(mp.upper_bound(L));
        REP(d, 26) ret[d] += itr->second[d];
        L -= itr->first;
    }
    REP(i, L) ret[T[i] - 'a']++;
    return ret;
}

int main()
{
    lint L, R;
    cin >> S >> L >> R;
    T = Next(S);
    vector<lint> v1 = C2(S), v2 = C2(T);
    lint l1 = S.length() / 2, l2 = T.length() / 2;
    mp[l1] = v1;
    mp[l2] = v2;

    while (l2 < 2e18) {
        swap(l1, l2);
        l2 += l1;
        swap(v1, v2);
        REP(i, 26) v2[i] += v1[i];
        mp[l2] = v2;
    }

    vector<lint> ret1 = solve(L - 1), ret2 = solve(R);
    REP(d, 26) printf("%lld ", ret2[d] - ret1[d]);
    puts("");
}


Measured memory_bytes: 1984
// new day,new strength,new thougts
#include<bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define F first
#define S second
#define sz(c) int((c).size())
#define REP(i,n)  for(int i=0;i<int(n);i++)
#define REPD(i,n) for(int i=int(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=int(a);i<=int(b);i++)
#define FORD(i,a,b) for(int i=int(a);i>=int(b);i--)
#define all(s) (s).begin(),(s).end()
#define bit(num,i) ((num>>i)&1)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;

const ll inf=4e18;
const ll maxn=2e5+10;
const ll mod=1e9+7;
const ll Big=1e15;

priority_queue<pll,vector<pll>,greater<pll> >pq;

vector<pll>va[maxn],vb[maxn];
ll disa[maxn],disb[maxn];
bool vis[maxn];

void digikstra(ll s,vector<pll> *v,ll *dis){
    fill(dis,dis+maxn,inf);
    memset(vis,0,sizeof vis);
    dis[s]=0;
    pq.push(MP(0,s));
    while(sz(pq)){
	ll x=pq.top().S;
	pq.pop();
	if(vis[x])continue;
	vis[x]=1;
	for(pll p:v[x]){
	    ll w=p.S+dis[x];
	    if(w<dis[p.F]){
		dis[p.F]=w;
		pq.push(MP(dis[p.F],p.F));
	    }
	}
    }
}

set<pll>st;

int main(){
    ll n,m,s,t;cin>>n>>m>>s>>t;
    REP(i,m){
	ll a,b,x,y;cin>>a>>b>>x>>y;
	va[a].PB(MP(b,x));
	vb[a].PB(MP(b,y));
	va[b].PB(MP(a,x));
	vb[b].PB(MP(a,y));
    }
    digikstra(s,va,disa);
    digikstra(t,vb,disb);

    FOR(i,1,n){
	st.insert(MP(disa[i]+disb[i],i));
    }
    FOR(i,1,n){
	cout<<Big-(st.begin()->F)<<endl;
	st.erase(MP(disa[i]+disb[i],i));
    }
}


Measured memory_bytes: 32512
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <bitset>
#include <numeric>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
clock_t __my_start_clock = clock();
#else
#define eprintf(...)
#endif

#define TIMESTAMP(x) eprintf("["#x"] Time : %.3lf s.\n", (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)
#define TIMESTAMPf(x,...) eprintf("[" x "] Time : %.3lf s.\n", __VA_ARGS__, (clock() - __my_start_clock)*1.0/CLOCKS_PER_SEC)

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << " = "; for (auto xxxx: a) cerr << xxxx << " "; cerr << endl


using namespace std;

#ifdef LOCAL
static struct __timestamper {
  string what;
  __timestamper(const char* what) : what(what){};
  __timestamper(const string& what) : what(what){};
  ~__timestamper(){
    TIMESTAMPf("%s", what.data());
	}
} __TIMESTAMPER("end");
#else 
struct __timestamper {};
#endif

typedef long long ll;
typedef long double ld;

using perm = vector<int>;

perm one(int n) {
  perm p = perm(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
  }
  return p;
}

perm operator*(const perm& a, const perm& b) {
  perm res(a.size());
  for (int i = 0; i < (int)a.size(); i++) {
    res[i] = b[a[i]];
  }
  return res;
}

perm operator^(perm a, int k) {
  perm res = one(a.size());
  while (k) {
    if (k & 1) res = res * a;
    a = a * a;
    k /= 2;
  }
  return res;
}

perm operator~(const perm& a) {
  perm res(a.size());
  for (int i = 0; i < (int)a.size(); i++) {
    assert(0 <= a[i] && a[i] < (int)a.size());
    res[a[i]] = i;
  }
  return res;
}

int main() {
#ifdef LOCAL
  freopen("d.in", "r", stdin);
  freopen("d.out", "w", stdout);
#endif

  int n, k;
  while (scanf("%d%d", &n, &k) == 2) {
    perm p(n), q(n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &p[i]);
      --p[i];
    }
    for (int i = 0; i < n; i++) {
      scanf("%d", &q[i]);
      --q[i];
    }

    perm lm, rm;

    int deg = (k - 12) / 6;
    if (deg > 0) {
      perm ip = ~p;
      perm iq = ~q;
      lm = (iq * p * q * ip);
      rm = (p * iq * ip * q);
      lm = lm ^ deg;
      rm = rm ^ deg;
      k -= deg * 6;
    } else {
      lm = rm = one(n);
    }

    for (int i = 2; i < k; i++) {
      perm t = (~p) * q;
      p = q;
      q = t;
    }

    perm ans;
    if (k == 1) {
      ans = p;
    } else {
      ans = q;
    }

    ans = lm * ans * rm;

    for (int i : ans) {
      printf("%d ", i + 1);
    }
    printf("\n");
  }

  return 0;
}


Measured memory_bytes: 3816
#include "bits/stdc++.h"
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define LL long long

int n,c[200000],ind[200000];
LL cnt[200001];
LL mod = 1000000007;
int main(){
  cin>>n;
  REP(i,n){cin>>c[i];c[i]--;}
  REP(i,200000)ind[i]=-1;
  cnt[0]=1;
  REP(i,n){
    //cerr<<ind[c[i]]<<" "<<cnt[i]<<endl;
    if(ind[c[i]] == -1 || c[i-1]==c[i])cnt[i+1]=cnt[i];
    else cnt[i+1]=(cnt[i]+cnt[ind[c[i]]])%mod;
    ind[c[i]]=i+1;
  }
  cout<<cnt[n]<<endl;
  return 0;
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

int main() {
  ll n;
  cin >> n;

  string s = to_string(n);
  for (ll i = 0; i < s.size(); ++i) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 3668
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            String[] S = new String[N];
            for (int i = 0; i < N; i++) {
                char[] chars = sc.next().toCharArray();
                Arrays.sort(chars);
                S[i] = new String(chars);
            }

            Map<String, Integer> count = new HashMap<>();
            for (String s : S) {
                Integer c = count.get(s);
                if (c == null) {
                    count.put(s, 1);
                } else {
                    count.put(s, c + 1);
                }
            }

            long ans = 0;
            for (Integer value : count.values()) {
                if (value >= 2) {
                    long v = value.longValue();
                    ans += v * (v - 1) / 2;
                }
            }

            System.out.println(ans);
        }
    }

}


Measured memory_bytes: 56240
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    
    ll n,m;
    cin>>n>>m;
    vector <ll> p;
    vector <string > s;
    map <ll,bool> m1;
    for(ll i=0;i<m;i++){
        ll a;
        string x;
        cin>>a>>x;
        p.pb(a);
        s.pb(x);
        if(x=="AC") m1[a]=true;
    }
    ll cor=m1.size(),pen=0;
    mi count,viz;
	for(ll i=0;i<m;i++){
        if(s[i]=="WA" && viz[p[i]]==0){
        count[p[i]]++;
        }
        else if(s[i]=="AC" && viz[p[i]]==0){
            pen+=count[p[i]];
            viz[p[i]]=1;
        }
    }
    cout<<cor<<" "<<pen;
	return 0;
}

Measured memory_bytes: 25320
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

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

#define P pair<int,int>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
map< LL,LL > prime_factor(int64_t n) {
  map< LL, LL > ret;
  for(LL i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main(){
    LCIN(N);LCIN(p);
    map<LL,LL> mp = prime_factor(p);
    LL ans = 1;
    for(pair<LL,LL> a : mp){
        while(a.second >= N){
            a.second-=N;
            ans *= a.first;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
//author-micheal corleone
//the godfather
#include <bits/stdc++.h>
#include <set> 
#include<algorithm>
#include <set> 
#include<algorithm>
#define ll long long int
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define out(n) printf("%lld\n",n)
#define inf 100000000000000
#define endl "\n"
#define precise(x) fixed << setprecision(x) 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
const int MOD =1000000007;
#define f(i,a,n) for(int i=a;i<n;i++)
#define pb push_back
 
using namespace std;

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[1] < v2[1]; 
}
 ll mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}
 //ll power(ll x, ll y) 
//{ 
  //  ll temp; 
    //if( y == 0) 
     //   return 1; 
    //temp = power(x, y/2); 
    //temp=temp%MOD;
    //if (y%2 == 0) 
     //   return (temp%MOD)*(temp%MOD); 
    //else
      //  return (x%MOD)*(temp%MOD)*(temp%MOD); 
//} 
 
 
ll ncr(ll n,ll r){if(n==1 || r==0)return 1;if(r>n/2)r=n-r;
	ll ans=1;for(ll i=1;i<=r;i++){ans=((ans * n )/i);n--;}return ans;
}
ll ncrsum(ll n,ll r, ll mod){
    if(n==1 || r==0)return 1;
  //  ll ans=1,sum=1;for(ll i=1;i<=r;i++){ans=((((ans * n)%MOD )*modinv(i,MOD))%mod);n--;sum+=ans;sum%=mod;}return sum;
}
 //diamond[2000005],ans[1000006];
 const int maxn=5e5+1000;
 
 
int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
     ll t;
    // cin>>t;
   
     t=1;	
     for(ll testcase=0;testcase<t;testcase++)
    {
        ll i1,i2,k,j,j1,a1,i31,i3,j2,i5,i4,i6,i7,i,m,n;
        ll x,y,z;
        ll total=0,cnt=0;
        ll flag=0;
        y=0;
        ll res,res1,ans,res2,q,sum;
        ans=0,cnt=0;
        res1=0,res=0,sum=0;
        ll s1,s2,s3;
        s2=0;
        ll flag1=0;
        s1=0;
        ll k1,k2,k3;
        k1=1,k2=0;
        k3=0;
        ll required,days,h,w;
        //cin>>n;
        
        //for(it=mp.begin();it!=mp.end(),it++)
        //{
        //	for(int i=0;i<it->second.size();i++) cout<<it->second[i]<<" ";
		//}
		double d,time,s,result;
		cin>>d>>time>>s;
		result=d/s;
	//	cout<<result<<endl;
		if(result<=time)
		{
			cout<<"Yes"<<endl;
		}
		else cout<<"No"<<endl;
		
	
	
    }
}
	

Measured memory_bytes: 3704
import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    string n;
    scan(n);

    if (n[0 .. 3].to!int % 111 == 0 || n[1 .. 4].to!int % 111 == 0) {
        writeln("Yes");
    }
    else {
        writeln("No");
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}



struct Queue(T) {
    private {
        int N, head, tail;
        T[] data;
    }

    this(int n) {
        N = n + 1;
        data = new T[](N);
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return (tail + 1) % N == head;
    }

    T front() {
        return data[head];
    }

    void push(T x) {
        assert(!full);
        data[tail++] = x;
        tail %= N;
    }

    void pop() {
        assert(!empty);
        head = (head + 1) % N;
    }

    void clear() {
        head = tail = 0;
    }
}

Measured memory_bytes: 256