akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

vector<vector<int>> calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'A'] = i;
	}
	return res;
}


int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	auto cn = calcNext(s);
	vector<ll> m1(n + 1, 0);
	vector<ll> c1(n + 1, 0);
	m1[0] = 0;
	REP(i, n) {
		m1[i + 1] = m1[i] + (s[i] == 'M');
		c1[i + 1] = c1[i] + (s[i] == 'C');
	}
	int q;
	cin >> q;
	vector<int> k(q);
	REP(i, q) {
		cin >> k[i];
	}
	vector<ll> res(q, 0);

	REP(i, q) {
		ll temp = 0;
		int pre = 0;
		Rep(j, n) {
			if (s[j] == 'D') {
				if (pre > j) {
					//temp -= (m1[j] - m1[pre - k[i]]) * (c1[min(pre, n)] - c1[pre - k[i]]);
				} else {
					temp = 0;
				}
				int t1 = max(pre - 1, j);
				pre = j + k[i];
				while (t1 < n) {
					t1 = cn[t1 + 1]['C' - 'A'];
					if (t1 < j + k[i] && t1 < n) {
						temp += m1[t1] - m1[j];
					} else {
						break;
					}
				}
				res[i] += temp;
			} else if (s[j] == 'M') {
				temp -= c1[min(pre, n)] - c1[j];
			}
		} 
	}
	REP(i, q) {
		put(res[i]);
	}

	return 0;
}


Measured memory_bytes: 151684
import copy, itertools
from scipy.sparse.csgraph import floyd_warshall

N, M, R = map(int, input().split())
r = [x-1 for x in list(map(int, input().split()))]

way_cost = [[float('inf')]*N for _ in range(N)]

for idx in range(N):
    way_cost[idx][idx] = 0

for _ in range(M):
    a, b, c = map(int, input().split())
    way_cost[a-1][b-1] = c
    way_cost[b-1][a-1] = c

# ワーシャルフロイド法で全ての街同士の最短距離を求める
shortest_path_cost = floyd_warshall(csgraph=way_cost, directed=False)

# 巡回ルートを総当りで調べ、最小コストを出力する
route_list = list(itertools.permutations(r))

ans = float('inf')
for route in route_list:
    cost = 0
    for idx in range(R-1):
        cost += shortest_path_cost[route[idx]][route[idx+1]]
    ans = min(ans,cost)

print(int(ans))

Measured memory_bytes: 24652
use std::io;
use std::str::FromStr;
use std::fmt;
use std::iter;

fn read_line() -> String {
    let mut ret = String::new();
    io::stdin().read_line(&mut ret).expect("read_line failed");
    ret.trim().to_string()
}

fn read_one<F>() -> F where F: FromStr {
    // FromStr has type Error in its struct.
    // https://doc.rust-lang.org/std/str/trait.FromStr.html
    // String#parse return Result<F, F::Err>,
    // and unwrap is only available in Result<T, Result>
    match read_line().parse::<F>() {
        Ok(v)  => v,
        Err(_) => panic!("failed to parse.")
    }
}

fn read_many<F>() -> Vec<F> where F: FromStr {
    read_line().split(' ').map(
        |s| match s.parse::<F>() {
            Ok(v)  => v,
            Err(_) => panic!("failed to parse.")
        }
    ).collect()
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
fn main() {
    let n = read_one::<u32>();
    let a = read_many::<u32>();

    let ret = a.iter().all(|k| k % 2 == 1 || (k % 3 == 0 || k % 5 == 0));
    println!("{}", if ret { "APPROVED"} else { "DENIED" });
}


Measured memory_bytes: 4352
n,m = map(int,input().split())

s = []
c = []
for i in range(m):
    ss,cc = map(int,input().split())
    s.append(ss)
    c.append(cc)

if n == 1:
    c = list(set(c))
    if len(c) > 1:
        print(-1)
    elif len(c) == 1:
        print(c[0])
    else:
        print(0)
elif n == 2:
    if m == 0:
        print(10)
    else:
        for i in range(10,100):
            flag = True
            for j in range(m):
                if s[j] == 2:
                    if i%10 != c[j]:
                        flag = False
                else:
                    if i//10 != c[j]:
                        flag = False
            if flag:
                print(i)
                exit()
        print(-1)
else:
    if m == 0:
        print(100)
    else:
        for i in range(100,1000):
            flag = True
            for j in range(m):
                if s[j] == 3:
                    if i%10 != c[j]:
                        flag = False
                elif s[j] == 2:
                    if (i%100)//10 != c[j]:
                        flag = False
                else:
                    if i//100 != c[j]:
                        flag = False
            if flag:
                print(i)
                exit()
        print(-1)    

Measured memory_bytes: 39152
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define pi 3.1415926
#define sec setprecision　
const long long mod = 998244353;
const int  MAX = 510000;

using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll a, ll b) {
	ll p = sqrt(b);
	ll k = b % p, h = b / p, s = 1;
	rip(i, p)s = (s * a) % mod; ll j = 1;
	if (h != 0)rip(i, h)j = j * s % mod;
	if (k != 0)rip(i, k)j = j * a % mod;
	return(j);
}
ll fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
ll com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return (fac[n] * (finv[k] * finv[n - k] % mod) % mod);
}
int ketasuu(int h) {
	if (h == 0)return (1);
	else {
		int k=0;
		rip(i, 30) {
			if ((pow(10, i) <= h) && (h < pow(10, i+1))) {
				k = i;break;
			}
		}
		k++;
		return(k);
	}
}
int main() {
	int n;
	cin >> n;
	int dp[10][10];
	rip(i, 10) {
		rip(j, 10)dp[i][j] = 0;
	}
	for(int i = 1; i <= n;i++) {
		int k = i / (pow(10, (ketasuu(i) - 1)));
		dp[k][i % 10]++;
	}
	int count = 0;
	rip(i, 10) {
		rip(j, 10)count += dp[i][j] * dp[j][i];
	}
	cout << count << endl;
}

Measured memory_bytes: 512
/*
  Motto - try hard to become an expert
*/
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <iomanip>
 
//define
#define rep(i,n)    for(int i=0;i<n;i++)
#define repu(i,k,n) for(int i=k;i<=n;i++)
#define repd(i,k,n) for(int i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define INF (int)INT_MAX
#define all(v)  v.begin(), v.end()
#define endl "\n"
 
//typedef
typedef long long int ll;
typedef long double ld;
typedef std::pair<int, int> pii;
typedef std::vector<int> vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, int > > vpp;
 
const int N = 3*1e5 +5 ;
const long long MOD = 998244353;
const long long inf = 1e18;
 
using namespace std;
 
ll MAXN=100001;
ll spf[100001]; 
 
ll modpow(ll x,ll n){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n>>=1;
    }
    return res;
}
 
ll modFact(ll n, ll p) 
{ 
    if (n >= p) 
        return 0; 
  
    ll result = 1; 
    for (ll i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result;  
} 
 
bool isPrime(int x)
{
    if(x%2==0)
        return 0;
    for(int i=3;i<=sqrt(x);i+=2)
    {
        if(x%i==0)
            return 0;
    }
    return 1;
}
void solve()
{
	string s ;
	cin>>s; 
	if(s=="ABC"){
		cout<<"ARC";
		return ;
	}
	cout<<"ABC";
}
 
int main() {
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int t = 1;
    // cin>>t;
    while(t--)
    {
        solve();
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

Measured memory_bytes: 3800
N = int(input())
S = ["a"] * N
for i in range(N):
    S[i] = input()

count_ac = 0
count_wa = 0
count_tle = 0
count_re = 0

for i in range(N):
    if S[i] == "AC":
        count_ac += 1
    elif S[i] == "WA":
        count_wa += 1
    elif S[i] == "TLE":
        count_tle += 1
    elif S[i] == "RE":
        count_re += 1

print("AC x {}".format(count_ac))
print("WA x {}".format(count_wa))
print("TLE x {}".format(count_tle))
print("RE x {}".format(count_re))

Measured memory_bytes: 16040
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:f64,
    }
    let cnt:f64 = (1..n as i64+1).filter(|x| x % 2 != 0 ).count() as f64;
    let ans = cnt / n;
    println!("{:.10}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<ll> t(n), v(n);
    for(int i = 0; i < n; ++i){
        cin >> t.at(i);
    }
    for(int i = 0; i < n; ++i){
        cin >> v.at(i);
    }

    vector<ll> tstart(n, 0), tend(n, 0);
    for(int i = 0; i < n; ++i){
        if(i == 0){
            tend.at(0) = t.at(i);
        }else{
            tstart.at(i) = tend.at(i - 1);
            tend.at(i) = tstart.at(i) + t.at(i);
        }
    }

    const ll total_time = tend.back();
    vector<ll> speed(total_time + 1);
    for(ll i = total_time; i >= 0; --i){
        speed.at(i) = min(
            i,
            total_time - i
        );
    }

    for(int i = 0; i < n; ++i){
        for(int j = 0; j <= total_time; ++j){
            if(tstart.at(i) <= j && j < tend.at(i)){
                speed.at(j) = min(speed.at(j), v.at(i));
            }else if(j < tstart.at(i)){
                speed.at(j) = min(
                    speed.at(j),
                    v.at(i) + (tstart.at(i) - j)
                );
            }else{
                speed.at(j) = min(
                    speed.at(j),
                    v.at(i) + (j - tend.at(i))
                );
            }
        }
    }

    vector<ll> is_flat(total_time, false);
    for(int i = 0; i < n; ++i){
        for(int j = 0; j < total_time; ++j){
            if(tstart.at(i) <= j && j < tend.at(i) &&
               speed.at(j) == v.at(i)){
                is_flat.at(j) = true;
            }
        }
    }

    double ans = 0;
    for(int i = 1; i <= total_time; ++i){
        // cerr << i << ' ' << speed.at(i - 1) << ' ' << speed.at(i) << ' ' << is_flat.at(i - 1) << endl;
        ans += (double)(speed.at(i - 1) + speed.at(i)) / 2.0;
        if(!is_flat.at(i - 1) && speed.at(i - 1) == speed.at(i)){
            ans += 0.25;
        }
    }
    printf("%.4f\n", ans);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(int argc,char* argv[]) {
	int pasta[3];
	int juice[2];
	int minpasta;
	int minjuice;
	int i;
	scanf("%d",&pasta[0]);
	scanf("%d",&pasta[1]);
	scanf("%d",&pasta[2]);
	scanf("%d",&juice[0]);
	scanf("%d",&juice[1]);
	minpasta=10000;
	for(i=0;i<3;i++) {
		if(pasta[i]<minpasta)minpasta=pasta[i];
	}
	minjuice=(juice[0]<=juice[1])?juice[0]:juice[1];
	printf("%d\n",minpasta+minjuice-50);
	return 0;
}

Measured memory_bytes: 0
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (LL)(1e18)+1;
const int INF_INT = 2147483647-1e6;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

string S;

string ans = "Yes";

void solve(){
	int N = S.length();
	for(int i=0;i<(N-1)/2;i++){
		if(S[i]!=S[N-1-i]){
			ans = "No";
			return;
		}
	}
	int mid = (N-1)/2+1;
	for(int i=0;i<mid/2;i++){
		if(S[i]!=S[mid-2-i]){
			ans = "No";
			return;
		}
	}
	for(int i=0;i<mid/2;i++){
		if(S[mid+i]!=S[N-1-i]){
			ans = "No";
			return;
		}
	}
}
 
int main(){
    cin >> S;
 
    solve();

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
-module('Main').
-export([main/1]).

main(_) ->
    {ok, [X, Y]} = io:fread("", "~d ~d"),
    %% Aを鶴の数、Bを亀の数とする
    Answers = [{A, B} ||
              A <- lists:seq(0, 100),
              B <- lists:seq(0, 100),
              A + B =:= X,
              2 * A + 4 * B =:= Y],
    case length(Answers) > 0 of
        true ->
            io:format("Yes~n");
        false ->
            io:format("No~n")
    end,
    halt().






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

int main(){
  int H,W,N;
  cin>>H>>W;
  cin>>N;
  vector <int> a(N+1,0);
  vector<vector<int>>b(H,vector<int>(W,0));
  vector<int> c(H*W,0);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }

  int temp=0;
  for(int i=0;i<N;i++){
    for (int j=0;j<a[i];j++){
      c[temp]=i+1;
      //cout<<temp<<" "<<c[temp]<<" "<<N<<"*"<<endl;
      temp++;
    }
  }
  
  //cout<<c[0]<<c[1]<<c[2]<<c[3]<<endl;
  temp=0;
  for(int i=0;i<H;i++){
    if(i%2==0){
      for(int j=0;j<W;j++){
        b[i][j]=c[temp];
        //cout<<c[temp]<<"#"<<endl;
        temp++;
      }
    }
    if(i%2!=0){
      for(int j=0;j<W;j++){
        b[i][W-j-1]=c[temp];
        //cout<<c[temp]<<"%"<<endl;
        temp++;
      }
    }
  }
  for(int i=0;i<H;i++){
    for(int j=0;j<W-1;j++){
      cout<<b[i][j]<<" ";
    }
    cout<<b[i][W-1]<<endl;
  }
  //cout<<c[2]<<" "<<c[3]<<endl;
  //cout<<b[0][0]<<" "<<b[0][1]<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define MOD (unsigned long)(1e9+7)

using namespace std;

int main() {
    int n;
    cin >> n;
    unsigned long power = 1;
    REP(i, n) {
        power = power * (i + 1) % MOD;
    }
    cout << power << "\n";
}

Measured memory_bytes: 256
S = list(input())
N = len(S)

ans = 0
cnt = [0] * 2019
a = 1
s = 0

for i in range(N)[::-1]:
    s = int(S[i]) * a + s
    a *= 10
    a = a % 2019
    cnt[s % 2019] += 1
    s = s % 2019

ans += cnt[0]
for i in range(2019):
    ans += cnt[i] * (cnt[i] - 1) // 2
print(ans)


Measured memory_bytes: 77808
import sys
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
from collections import deque 

input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))

INF = 1001001001

# ---------------------------------------

def main():
    n = inp()
    k = inp()
    x = inp()
    y = inp()
    if n > k:
        print(x * k + y * (n - k))
    else:
        print(x * n)

main()


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

int main(){
  int n;
  cin >> n;
  char s[2][n];
  rep(i,n)cin >> s[0][i];
  rep(i,n)cin >> s[1][i];
  int i = 0;
  ll ans;
  bool to;
  if(s[0][0]==s[1][0]){
    ans = 3;
    i++;
    to = 0;
  }else{
    ans = 6;
    i+=2;
    to = 1;
  }
  while(i!=n){
    if(s[0][i]==s[1][i]){
      if(to == 0)ans *= 2;
      ans %= MOD;
      i++;
      to = 0;
    }else{
      if(to==0)ans *= 2;
      else ans *= 3;
      ans %= MOD;
      to = 1;
      i += 2;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;
using LL = long long;

constexpr int N = 1e5 + 5;

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

    vector< int> in(n);
    for (int &e : in) cin >> e;

    sort(begin(in), end(in), greater< int>());
    
    LL res = 0;
    for (int i = 1; i < n; i++) res += in[i / 2];

    cout << res << endl;
}

Measured memory_bytes: 3992
N, A = map(int, input().split())
x = list(map(int, input().split()))

max_of_a = N * A

# dp[i][j][k] := i枚目までからj枚取って、合計をkにする通り数
dp = [[[0] * (max_of_a + 1) for _ in range(N+1)]for _ in range(N+1)]
dp[0][0][0] = 1


for i in range(N+1):
    for j in range(N+1):
        for k in range(max_of_a + 1):
            if i >= 1 and x[i-1] > k:
                dp[i][j][k] = dp[i-1][j][k]
            elif i >= 1 and j >= 1 and x[i-1] <= k:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k - x[i-1]]

ans = 0
for j in range(1, N+1):
    # N枚(カード総数)の中から1枚以上取った時の、j枚取って合計がj*Aの所 の合計
    ans += dp[N][j][j*A]
print(ans)

Measured memory_bytes: 92636
s = gets.chomp
flip = false

pre = ""
post = ""

gets.to_i.times do
  t, f, c = gets.split

  if t == "1"
    flip = !flip
  else
    if (f == "1") ^ flip
      pre <<= c
    else
      post <<= c
    end
  end
end

if flip
  print post.reverse!, s.reverse!, pre, "\n" 
else
  print pre.reverse!, s, post, "\n" 
end


Measured memory_bytes: 2556
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

int main() {
  int n, k; cin >> n >> k;
  vector<int> a(n);

  REP(i, n){
    cin >> a[i];
  }

  cout << (int)ceil(1.0 * (n - k) / (k - 1)) + 1 << endl;

  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

int main() {
  int N;
  std::string s;
  std::cin >> N >> s;
  std::vector<int> p(N);
  
  int sum = 0; // Eの数
  /* E(東)=>1, W(西)=>0 */
  for (int i = 0; i < s.size(); ++i) {
    p[i] = (s[i] == 'E');
    sum += p[i];  
  }

  // リーダーを0番目の人にした時
  int ans = sum-p[0];
  int l = 0;
  int r = sum-p[0]; 

  // 1番目以降を見ていく
  for (int i = 1; i < N; ++i) {
    r -= p[i];
    l += p[i-1];
    ans = std::min(r+(i-l), ans); // (右側で東を向いている人)+(左側で西を向いている人の数)
  }

  std::cout << ans << std::endl;
  
  return 0;
}


Measured memory_bytes: 4836
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        
    def find_root(self, x):
        if self.par[x] == x:
            return x
        self.par[x] = self.find_root(self.par[x])
        return self.par[x]
    
    def union(self, x, y):
        x_root = self.find_root(x)
        y_root = self.find_root(y)
        if x_root != y_root:
            if self.rank[x_root] < self.rank[y_root]:
                x_root, y_root = y_root, x_root
            if self.rank[x_root] == self.rank[y_root]:
                self.rank[x_root] += 1
            self.par[y_root] = x_root
            
    def is_same(self, x, y):
        x_root = self.find_root(x)
        y_root = self.find_root(y)
        return x_root == y_root
    def num(self):
        c=set()
        for i in range(len(u.par)):
            c.add(self.find_root(i))
        return len(c)
    
n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(m)]
xy=[[x-1,y-1] for x,y,z in xyz]
u=UnionFind(n)
for x,y in xy:
    u.union(x,y)
print(u.num())

Measured memory_bytes: 97624
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
const int P=998244353;
inline void upd(R int &x,R int y){(x+=y)>=P?x-=P:0;}
inline int add(R int x,R int y){return x+y>=P?x+y-P:x+y;}
inline int dec(R int x,R int y){return x-y<0?x-y+P:x-y;}
inline int mul(R int x,R int y){return 1ll*x*y-1ll*x*y/P*P;}
int ksm(R int x,R int y){
	R int res=1;
	for(;x;x>>=1,x=mul(x,x))(y&1)?res=mul(res,x):0;
	return res;
}
const int N=1e5+5;
int sz[N],ok[N],n,m,res;
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	fp(i,1,n)sz[i]=1;ok[1]=1;
	for(R int x,y,i=1;i<=m;++i){
		scanf("%d%d",&x,&y);
		ok[y]|=ok[x],++sz[y],--sz[x];
		if(!sz[x])ok[x]=0;
	}
	fp(i,1,n)res+=ok[i];
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int cnt[10];

int main(){
	int n;
  cin>>n;
  rep(i, n){
    int a;
    cin>>a;
    a /= 400;
    cnt[min(a, 8)]++;
  }
  int res = 0;
  rep(i, 8) res += cnt[i]>0;
  int res2 = res+cnt[8];
  cout<<max(res, 1)<<" "<<res2<<endl;
	return 0;
}


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



int main() {
	ll n;
	cin>>n;
	int m=sqrt(n),ans=0;
	for(ll i=m;i>=1;i--){
		if(n%i==0){
			int MAX=max(i,n/i);
			while(MAX){
				ans++;
				MAX=MAX/10;
			}
			cout<< ans;
			return 0;
		}
	}
}

Measured memory_bytes: 256
x = int(input())

def converter(x):
    if x <= 26:
        y = chr(x + 96)
    elif x % 26 == 0:
        y = converter(x // 26 - 1) + chr(122)
    else:
        y = converter(x // 26) + chr(x % 26 + 96)
    return y

name = converter(x)

print(name)

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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  ll a;
  char s[4];
  cin >> a;
  rep(i, 4) cin >> s[i];

  int b = (s[0] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0');
  cout << (a * b) / 100 << endl;

  return 0;
}


Measured memory_bytes: 3540
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(LL i = (a); i < (LL)(n); ++i)
#define REM(i,a,n) for(LL i = ((n) - 1); i >= (a); --i)
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const string INFSTR = "\x7f";
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
// all_of
// partial_sum, adjacent_difference

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#include "Geometry.h"
#include "Matrix.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

struct Edge {
	int from, to;
	LL cost;
};

vector<Edge> G;
LL dist[1000];
int main() {
	int N, M;
	cin >> N >> M;
	REP(i, 0, M) {
		int a, b;
		LL c;
		cin >> a >> b >> c;
		G.push_back(Edge{ a - 1, b - 1, -c });
	}
	Fill(dist, INFLL);
	dist[0] = 0;
	REP(k, 0, N * 2) {
		for (auto e : G) {
			if (dist[e.from] == INFLL) continue;
			if (dist[e.from] + e.cost < dist[e.to]) {
				dist[e.to] = dist[e.from] + e.cost;
				if (k >= N - 1 && e.to == N - 1) {
					cout << "inf" << endl;
					return 0;
				}
			}
		}
	}
	cout << -dist[N - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
// I T N O GG\\;

// M_Erfan_S \\;

#include <bits/stdc++.h>
 
using namespace std;

long long n, c, k, ans = 0, ma = 0, a, j = 0;

int main(){
    
    cin >> n >> c >> k;
    
	int a[n];
    for(int i = 0; i < n; i++){
    	cin >> a[i];
	}
	sort(a,a+n);
	
    for(int i = 0; i < n; i++){
    	if(ma < a[i] || j >= c){
    		ans ++;
    		ma = a[i]+k;
    		j = 1;
		}
		else{
			j++;
		}
	}
	
	cout << ans;
	
    return 0;
    
}



Measured memory_bytes: 640
#include<stdio.h>
int main()
{
  int N;
  int d[100];
  int i;
  int list[100];
  int ans;

  // 入力
  scanf("%d", &N);
  
  for(i = 0; i < N; i++){
    scanf("%d", &d[i]);
    list[i] = 0;
  }
  for(; i < 100; i++){
    list[i] = 0;
  }
  
  ans = 0;
  for(i = 0; i < N; i++){
    if(list[d[i]-1] == 0){
      list[d[i]-1] = 1;
      ans++;
    }
  }
  
  // 出力
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
/*
LANG:C++
PROB:

*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
#include <iostream>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)


using namespace __gnu_pbds;
using namespace std;


typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
typedef unsigned long long ui64;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int mod=1000000007;
  i64 poww(i64 a, i64 b)
  {
    a%=mod;
    i64 res=1;
    while(b)
      {
if(b&1)res=res*a%mod;

      a=a*a%mod;
      b/=2;

      }
      return res;
  }
  i64 inv(i64 a)
  {
    return poww(a,mod-2);
  }


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

    // ifstream fin(".in");
    // ofstream fout(".in");

i64 x;
cin>>x;
for(i64 i=0;i*i*i*i*i<=1e18;i++)
{
  i64 b=(i*i*i*i*i)-x;
  i64 ps=abs(b);
  i64 pw=pow(ps*1.0,0.2);

  if(pw*pw*pw*pw*pw==ps)
  {
    if(b<0)pw*=-1;
    cout<<i<<" "<<pw;
    return 0;
  }
}


    return 0;
  }


Measured memory_bytes: 4116
module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

struct Input
{
	ulong a, b;
}

void parseInput(T)(out Input input, T file)
{
	with (file) with (input)
	{
		auto array = readln().strip().split();
		a = array[0].to!ulong;
		b = array[1].to!ulong;
	}
}

struct Output
{
}

auto main2(Input* input)
{
	return lcm(input.a, input.b);
}

unittest { writeln("begin unittest"); }

unittest // example1
{
	string example =
`2 3`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == 6);
}

unittest // example2
{
	string example =
`123 456`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == 18696);
}

unittest // example3
{
	string example =
        `100000 99999`;
	Input input = void;
	parseExample(input, example);
	auto result = main2(&input);
	writeln(result);
	assert(result == 9999900000);
}

unittest { writeln("end unittest"); }

void parseExample(out Input input, string example)
{
	struct Adapter
	{
		string[] _lines;
		this(string input) { _lines = input.splitLines(); }
		string readln() { auto line = _lines[0]; _lines = _lines[1..$]; return line; }
	}
	parseInput(input, Adapter(example));
}

void main()
{
	Input input = void;
	parseInput(input, stdin);
	auto result = main2(&input);
	writeln(result);
}

T lcm(T)(T i1, T i2)
{
	return i1 / gcm(i1, i2) * i2;
}

T gcm(T)(T i1, T i2)
{
	T large = i1 < i2 ? i2 : i1;
	T small = i1 < i2 ? i1 : i2;

	while (small != 0)
	{
		T q = large % small;

		large = small;
		small = q;
	}

	return large;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {

    string s;
    cin>>s;
    int a=-INF,z=0;
    rep(i,s.size()){
        if(s[i]=='A' && a==-INF) a=i;
        if(s[i]=='Z') z=i;
    }
    cout << z-a+1 << endl;
    
    return 0;
}


Measured memory_bytes: 640
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Measured memory_bytes: 50776
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    for num in inlis:
        if num % 2== 0:
            if num % 3 == 0 or num % 5 == 0:
                pass
            else:
                print("DENIED")
                exit()
    print("APPROVED")

    
if __name__ == "__main__":
    main()


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

int main() {
  int n;
  cin>>n;
  vector<long long>a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  long long ans=0;
  long long ab=1;
  for(int i=0;i<61;i++){
    long long zero=0;
    long long one=0;
    for(int i=0;i<n;i++){
      if(a[i]%2==0) zero++;
      else one++;
      a[i]/=2;
    }
    long long x=zero*one;
    x%=1000000007;
    long long y=ab%1000000007;
    x*=y;
    x%=1000000007;
    ans+=x;
    ans%=1000000007;
    ab*=2;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2560
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main{
    static int n;
    static int memo[][];
    static int[][] val;
    public static void main(String[] args) throws IOException {
        scanner sc = new scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        n = sc.nextInt();

        memo = new int[n][3];
        val = new int[n][3];

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < 3; j++) {
                val[i][j] = sc.nextInt();
            }
        }

        for (int i = 0; i < n; i++)
            Arrays.fill(memo[i],-1);


        out.println(dp(0,0));
        out.flush();
    }

    static int dp(int i,int prev){
        if (i == n)
            return 0;

        if (memo[i][prev] != -1)
            return memo[i][prev];

        int cost = 0;

        for (int j = 0; j < 3; j++) {
            if (i == 0 || prev != j)
                cost = Math.max(cost,dp(i+1,j) + val[i][j]);
        }

        return memo[i][prev] = cost;
    }

}
class scanner{
    StringTokenizer st;
    BufferedReader br;
    public scanner(InputStream s){
        br = new BufferedReader(new InputStreamReader(s));
    }
    public scanner (String s) throws FileNotFoundException { br = new BufferedReader(new FileReader(s));}

    public String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
        return  Long.parseLong(next());
    }

    public String nextLine() throws IOException {
        return br.readLine();
    }

    public boolean ready() throws IOException {
        return br.ready();
    }
}

Measured memory_bytes: 58156
#include <iostream>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int n;
  int l[10];
  cin >> n;
  int m = 0;
  int s = 0;
  for (int i = 0; i < n; ++i) {
    cin >> l[i];
    m = max(m, l[i]);
    s += l[i];
  }
  s -= m;
  if (m < s) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3132
/*

参考にした提出
https://agc023.contest.atcoder.jp/submissions/2435072

*/


#include<cstddef>
#include<cstdint>
#include<cstdio>

using uint64 = std::uint_fast64_t;

constexpr uint64 M = 1000000007;

template<std::size_t N>
struct Fact {
	uint64 val[N], v2[N];
	constexpr Fact() :val(), v2() {
		val[0] = 1;
		for (std::size_t i = 1; i < N; ++i) val[i] = val[i - 1] * i % M;
		for (std::size_t i = 1; i < N; ++i) v2[i] = val[i - 1] * val[i] % M;
		for (std::size_t i = 1; i < N; ++i) val[i] = val[i] * i % M;
	}
};

template<std::size_t N, uint64 F>
struct IFact {
	uint64 val[N];
	constexpr IFact() : val() {
		val[N - 1] = F;
		for (std::size_t i = N - 1; i; --i) val[i - 1] = val[i] * i % M;
	}
};

int main() {
constexpr auto fact = Fact<1000000>();
constexpr auto ifact = IFact<1000000, 498215386>();
	unsigned int n;
	uint64 ans=0;
	scanf("%u", &n);
	const std::size_t N = n;
	for (std::size_t i = (N + 1) >> 1; i < N - 1; ++i) {
		ans += fact.v2[i] * ifact.val[(i << 1) - N] % M;
	}
	ans %= M;
	long long unsigned int o = fact.val[N - 1] < ans ? fact.val[N - 1] + M - ans : fact.val[N - 1] - ans;
	printf("%llu\n", o);
	return 0;
}


Measured memory_bytes: 23552
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
//template< typename T >
//T mod_pow(T x, T n, const T &p) {
//  T ret = 1;
//  while(n > 0) {
//    if(n & 1) (ret *= x) %= p;
//    (x *= x) %= p;
//    n >>= 1;
//  }
//  return ret;
//}
/////////////////// 
//

#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string s;
  cin >> s;
  if(s[0]=='7' || s[1]=='7' || s[2] =='7')
    pri("Yes");
  else 
    pri("No");
  return 0;
}







Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<math.h>
using namespace std;

int main() {
	long long W, a, b;
	cin >> W >> a >> b;
	int tmp = abs(a - b) - W;
	if (tmp < 0) {
		cout << "0" << endl;
	}
	else cout << tmp << endl;

	return 0;
}

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

int main() {
    int N, M, a, b;
    cin >> N;
    if (N >= 64) {
        cout << 64 << endl;
        return 0;
    }
    if (N >= 32) {
        cout << 32 << endl;
        return 0;
    }
    if (N >= 16) {
        cout << 16 << endl;
        return 0;
    }
    if (N >= 8) {
        cout << 8 << endl;
        return 0;
    }
    if (N >= 4) {
        cout << 4 << endl;
        return 0;
    }
    if (N >= 2) {
        cout << 2 << endl;
        return 0;
    }
    cout << 1 << endl;
    return 0;
}


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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

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

    int d[n];
    rep(0, n) cin >> d[i];

    int sum = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            sum += d[i] * d[j];
        }
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
using namespace std;

typedef long long ll;

int main(){
        ll N;
        vector<ll> A(N), InputBallIndex, NumBall(N, 0);
        cin >> N;
        for(int i=0; i<N; i++){
                cin >> A[i];
        }

        for(int i=N-1; i>=0; i--){
                if(NumBall[i]%2 != A[i]){
                        for(int k=1; k*k<=i+1; k++){
                                if((i+1)%k==0){
                                        if(k != (i+1)/k){
                                                NumBall[k-1]++;}
                                        NumBall[(i+1)/k-1]++;
                                }
                        }
                InputBallIndex.push_back(i+1);
                }
        }
        cout << InputBallIndex.size() << endl;
        sort(InputBallIndex.begin(), InputBallIndex.end());
        for(int i=0; i<InputBallIndex.size(); i++){
                cout << InputBallIndex[i] << endl;
        }




}

Measured memory_bytes: 100596
#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 pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int dp[200001];
int nx[200001][26];
const int INF=1000100010;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    rep(i,26) nx[n][i]=n+1;
    rep(i,n+1) dp[i]=INF;
    dp[n]=1;dp[n+1]=0;
    for(int i=n-1;i>=0;--i){
        int mn=INF;
        rep(j,26){
            if(s[i]-'a'==j) nx[i][j]=i+1;
            else nx[i][j]=nx[i+1][j];
            mn=min(mn,dp[nx[i][j]]+1);
        }
        dp[i]=mn;
    }
    string ans;
    int cur=0;
    while(1){
        rep(i,26)if(dp[nx[cur][i]]+1==dp[cur]){
            ans+='a'+i;
            cur=nx[cur][i];
            break;
        }
        if(cur>=n+1)break;
    }
    cout<<ans<<endl;
    //rep(i,26) sort(nx[i].begin(),nx[i].end());
    return 0;
}

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

int main() {
    int N; cin >> N;
    long long sum = 0;
    for(int i=1; i<=N; ++i) {
        if(i % 3 != 0 && i % 5 != 0) sum += i;
    }
    cout << sum << '\n';
}

Measured memory_bytes: 3612
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long ll;

int d[12] = {9, 9*9, 9*9*9, 9*9*9*9, 9*9*9*9*9, 6, 6*6, 6*6*6, 6*6*6*6, 6*6*6*6*6, 6*6*6*6*6*6, 6*6*6*6*6*6};

int checkData[100001];

int check(int N) {
  if (checkData[N] > 0) return checkData[N];
  int ans = N;
  for (int i = 0; i < 12; i++) {
    if (d[i] <= N) ans = min(ans, 1 + check(N-d[i]));
  }
  return checkData[N] = ans;
}

int main(){
  int N;
  scanf("%d", &N);
  for (int i = 0; i <=N; i++) checkData[i] = -1;
  printf("%d\n", check(N));
}

Measured memory_bytes: 896