akhauriyash/Code-Regression huggingface dataset:
local n = io.read("*n", "*l")
local rowmap = {}
for i = 1, n do
  rowmap[i] = io.read()
end

local colmap = {}
for i = 1, n do
  local tmps = ""
  for j = 1, n do
    tmps = tmps .. rowmap[j]:sub(i, i)
  end
  colmap[i] = {}
  tmps = tmps .. tmps
  for j = 1, n do
    colmap[i][j] = tmps:sub(n + 2 - j, n + 2 - j + n - 1)
  end
end

local function check(r)
  for k = 1, n do
    local row_tgt = k + n - r
    if n < row_tgt then row_tgt = row_tgt - n end
    local col_ofst = 1 + r
    if rowmap[row_tgt] ~= colmap[k][col_ofst] then return 0 end
  end
  return n
end
local ret = 0
for i = 0, n - 1 do
  ret = ret + check(i)
end
print(ret)


Measured memory_bytes: 34680
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<functional>
#include<set>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 9223372036854775807
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0;
string s;
bool flag;
#pragma endregion
#define MAX 111111


int main(void) {
  ll x, y;
  cin >> x >> y;
  if (x >= 0) {
	if (y >= 0) {
	  if (y >= x) {
		ans = y - x;
	  }
	  else {
		ans = x - y + 2;
		if (y == 0) ans--;
	  }
	}
	else {
	  ans = llabs(x + y) + 1;
	}
  }
  else {
	if (y >= 0) {
	  ans = llabs(x + y) + 1;
	  if (y == 0) ans--;
	}
	else {
	  if (x <= y) {
		ans = llabs(x - y);
	  }
	  else {
		ans = llabs(x - y) + 2;
	  }
	}
  }
  cout <<ans<<endl;

  return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
def main():
  def s(l,r):
    k=l*n+r
    if d[k]:return d[k]
    if r-l<2:return 0
    d[k]=t=min(s(l,i)+s(i,r)for i in range(l+1,r))+a[r-1]-a[l-1]
    return t
  n,*a=map(int,open(0).read().split())
  d=[None]*(n*n+1)
  for i in range(n-1):a[i+1]+=a[i]
  a+=[0]
  print(s(0,n))
main()

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

int main(){
  int N,x=0,n;
  cin >> N;
  n=N;
  while(N!=0){
    x += N%10;
    N /= 10;
  }
  if(n%x==0) cout << "Yes" << endl;
  else cout << "No" << endl;
} 


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

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	long MODULO = 1_000_000_000 + 7;

	void run() {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] t = new int[n];
		int[] p = new int[n];
		int[] x = new int[s];
		for (int i = 0; i < s; ++i) {
			x[i] = sc.nextInt();
		}
		for (int i = 0; i < n; ++i) {
			t[i] = sc.nextInt();
			p[i] = sc.nextInt();
			--p[i];
		}
		int[] w = new int[n];
		for (int i = 0; i < n; ++i) {
			w[i] = t[i] - x[p[i]];
		}
		Arrays.sort(w);
		long ans = 0;
		for (long v : w) {
			ans -= v;
		}
		long[][] f = new long[n + 1][m + 1];
		for (int i = 0; i < f.length; ++i) {
			for (int j = 0; j < f[i].length; ++j) {
				f[i][j] = Integer.MAX_VALUE / 16;
			}
		}
		for (int i = 1; i < f.length; ++i) {
			f[i][1] = w[i - 1] * i;
		}

		for (int j = 2; j <= m; ++j) {
			// j is fixed.
			// Attention: h[i][k]:=f[k][j-1]+w[i-1]*(i-k) is of Monge.
			// min(h[i][]) can be enumerated in O(n*log(n))
			// f[i][j]=min(h[i][])
			long[] v = calc(f, w, j);
			for (int i = 1; i <= n; ++i) {
				// for (int k = 1; k <= i - 1; ++k) {
				// f[i][j] = Math.min(f[i][j], h(f, w, i, j, k));
				// }
				f[i][j] = v[i];
			}
		}

		long min = Integer.MAX_VALUE / 16;
		for (int j = 1; j <= m; ++j) {
			min = Math.min(min, f[n][j]);
		}
		ans += min;
		System.out.println(ans);
	}

	long[] calc(long[][] f, int[] w, int j) {
		int n = f.length - 1;
		int m = f[0].length - 1;
		long[] ret = new long[n + 1];
		Arrays.fill(ret, Integer.MAX_VALUE / 16);
		rec(ret, 1, n, 2, n + 1, f, w, j);
		return ret;
	}

	// [low,high]
	// [left,right)
	long rec(long[] ret, int low, int high, int left, int right, long[][] f, int[] w, int j) {
		int mid = (left + right) / 2;// the value of the variable i
		long v = Long.MAX_VALUE / 16;
		int arg = -1;
		for (int k = Math.max(0, low); k <= Math.min(mid - 1, high); ++k) {
			v = Math.min(v, h(f, w, mid, j, k));
			if (v == h(f, w, mid, j, k))
				arg = k;
		}
		if (right - left > 1) {
			rec(ret, low, arg, left, mid, f, w, j);
			rec(ret, arg, high, mid, right, f, w, j);
		}
		ret[mid] = v;
		return v;
	}

	long h(long[][] f, int[] w, int i, int j, int k) {
		return f[k][j - 1] + w[i - 1] * (i - k);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 78532
N = int(input())
S = str(input())
S = S.split()
S_list = list(S)
for i in range(len(S_list)):
    S_list[i] = int(S_list[i])

S_list.sort()
S_list.reverse()
total = 0

for i in range(len(S_list)):
    if i > 0:
        total = total + S_list[i]

if S_list[0] < total:
    print('Yes')
else:
    print('No')

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

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

Measured memory_bytes: 256
#include<stdio.h>

double a[11];

int main()
{
	while( scanf( "%lf", &a[1] ) != EOF ){
		double ans = a[1];
	
		for( int i = 2; i <= 10; i++ ){
			if( i % 2 == 0 ){
			 	a[i] = a[i-1] * 2.0;
			}
			else{
			 	a[i] = a[i-1] / 3.0;
			}
			
			ans += a[i];
		}
		
		printf( "%.8f\n", ans );
	}

 	return 0;
}

Measured memory_bytes: 1080
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)

struct INIT{
    INIT(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(0);
        cout << fixed << setprecision(13);
    }
}INIT;

LL T1, T2, A1, A2, B1, B2;

int main(){
    cin >> T1 >> T2;
    cin >> A1 >> A2;
    cin >> B1 >> B2;
    if(T1 * A1 + T2 * A2 == T1 * B1 + T2 * B2){
        cout << "infinity" << endl;
        return 0;
    }
    LL SA1 = (T1 * A1 - T1 * B1), SA2 = (T1 * A1 + T2 * A2 - T1 * B1 - T2 * B2);
    if((SA1 > 0 && SA2 > 0) || (SA1 < 0 && SA2 < 0)){
        cout << 0 << endl;
        return 0;
    }
    if(SA1 > 0){
        SA2 += SA1;
        if(SA1 % (SA1 - SA2) == 0){
            cout << SA1 / (SA1 - SA2) * 2LL << endl;
        }else{
            cout << SA1 / (SA1 - SA2) * 2LL + 1 << endl;
        }
    }else{
        SA2 *= -1;
        SA1 *= -1;
        SA2 += SA1;
        if(SA1 % (SA1 - SA2) == 0){
            cout << SA1 / (SA1 - SA2) * 2LL << endl;
        }else{
            cout << SA1 / (SA1 - SA2) * 2LL + 1 << endl;
        }
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int K, N;
	cin >> K >> N;
	vector<int> A(N + 1);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	A[N] = A[0] + K;
	auto ans = K;
	for (auto i = 0; i < N; ++i)
	{
		ans = min(ans, K - (A[i + 1] - A[i]));
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(" ", $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function printIn($str = "")
    {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;

$a = $sc->nextInt();
$b = $sc->nextInt();

echo ceil(($a + $b) / 2);

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false); 
    for (int i = 0; i < 5; i++)
    {
        int x;
        cin>>x;
        if(x==0)
            cout<<i+1;
    }
    return 0;
}

Measured memory_bytes: 3488
#[allow(unused_macros)]
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)*}
        };
    }

#[allow(unused_macros)]
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)*}
        };
    }

#[allow(unused_macros)]
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, bytes) => {
            read_value!($next, String).into_bytes()
        };
     
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
     
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }

fn main() {
    input! {
            n: i32,
            train: i32,
            taxi: i32
        }

    let train_fee_for_all = n * train;

    println!("{}", if train_fee_for_all < taxi { train_fee_for_all } else { taxi });
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int MOD = 1000000007;
const int INF = 1e15;
using Graph = vector<vector<int>>;

signed main() {
  int N, K;
  cin >> N >> K;

  vector<int> V(N);
  for( int i = 0; i < N; i++ ) cin >> V.at(i);


  int ans = 0;
  for( int l = 0; l <= min(N, K); l++){
    for( int r = 0; l+r <= min(N, K); r++ ){
      priority_queue<int, vector<int>, greater<int>> pq;
      int total = 0;
      for( int i = 1; i <= l; i++ ){ //左の宝石を詰める
        pq.push(V.at(i-1));
        total += V.at(i-1);
      }
      for( int i = 1; i <= r; i++ ){ //右の宝石を詰める
        pq.push(V.at(N-i));
        total += V.at(N-i);
      }
      for( int i = 0; i < max(0LL, K-(l+r)); i++ ){
        if( pq.empty() ) break;
        if( pq.top() < 0 ){
          total -= pq.top();
          pq.pop();
        }
      }
      ans = max(ans, total);
    }
  }
  cout << ans << endl;
}


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

class Program
{
    static void Main()
    {

        int N = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();

        // (m mod a1) の項は、m = k * a1 - 1 のときに最大となる。
        // (m mod a2) の項は、m = k * a2 - 1 のときに最大となる。

        //つまり、m + 1 がa1の倍数だとかa2の倍数だとかになると、それらが最大化される。
        //つまり、m + 1 が、a1, a2, a3, ... an の最小公倍数になれば良い。(別に「最小」である必要は無いが)
        //ていうか全部の項を最大化可能ということがわかったので、公倍数は計算する必要すらない。
        //各項を最大化してしまえば良い。

        Console.WriteLine(a.Select(num => num - 1).Sum());



    }
    
}



static class MathUtil
{
    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}



Measured memory_bytes: 13268
use proconio::{fastout, input};
use std::cmp::max;
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        ar: isize,
        al: isize,
        br: isize,
        bl: isize
    }
    let mut res = ar * br;
    res = max(res, ar * bl);
    res = max(res, al * br);
    res = max(res, al * bl);
    println!("{}", res);
}


Measured memory_bytes: 2200
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
#define ll long long
#define ld long double
using namespace std;

int main() {
	int N;
	cin >> N;
	bool flag=1;
	int k=N;
	while(k>1){
	    if(k%2==1) flag=0;
	    k /= 2;
	}
	if(flag){
	    cout << "No" << endl;
	    return 0;
	}
	cout << "Yes" << endl;
	vector<vector<int>> ans(1+N*2);
	int p=1;
	while(p<N+3){
	    int q=(p==3 ? N+1 : p+1);
	    ans[p].push_back(q);
	    ans[q].push_back(p);
	    p=q;
	}
	for(int i=4; i+1<=N; i+=2){
	    ans[i].push_back(i+1);
	    ans[i+1].push_back(i);
	    ans[i].push_back(1);
	    ans[1].push_back(i);
	    ans[1].push_back(N+i+1);
	    ans[N+i+1].push_back(1);
	    ans[N+i].push_back(N+i+1);
	    ans[N+i+1].push_back(N+i);
	}
	if(N%2==0){
	    int s=N^(N-2);
	    ans[N].push_back(s);
	    ans[s].push_back(N);
	    ans[2*N-1].push_back(2*N);
	    ans[2*N].push_back(2*N-1);
	}
	for(int i=1; i<=N*2; ++i){
	    for(int j=0; j<ans[i].size(); ++j){
	        if(i<ans[i][j]){
	            cout << i << ' ' << ans[i][j] << endl;
	        }
	    }
	}
	return 0;
}


Measured memory_bytes: 13688
N, A, B = map(int, input().split())
V = list(map(int, input().split()))
V = sorted(V, reverse=True)

ma = sum(V[:A]) / A
num = 0

MOD = 10 ** 9 + 7
M = 60
fact = [0] * M
fact[0] = 1
for i in range(1, M):
    fact[i] = fact[i - 1] * i


def comb(n, k):
    return fact[n] // fact[n - k] // fact[k]


num = 0
pos = 0
for i in range(N):
    if V[i] == V[A - 1]:
        num += 1
        if i < A:
            pos += 1
ans = 0
if pos == A:
    for i in range(A, B + 1):
        ans += comb(num, i)
else:
    ans += comb(num, pos)


print(ma)
print(ans)


Measured memory_bytes: 3064
t1, t2 = map(int, input().split())
a1, a2 = map(int, input().split())
b1, b2 = map(int, input().split())

delta1 = (a1 - b1) * t1
delta2 = (a2 - b2) * t2

if delta1 + delta2 == 0:
    print('infinity')
    exit()

if delta1 * delta2 >= 0:
    print(0)
    exit()

if abs(delta1) > abs(delta2):
    print(0)
    exit()

steps = abs(delta1 + delta2)

ans = 2 * (min(abs(delta1), abs(delta2)) // steps) + 1

if min(abs(delta1), abs(delta2)) % steps == 0:
    ans -= 1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second


void solve() 
{
    int n;string s;cin>>n>>s;int ans=0;
    auto pos=s.find("ABC");
    while(pos!=string::npos){
        ans++;
        pos=s.find("ABC",pos+3);
    }
    cout<<ans<<endl;
}

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


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

using namespace std;

int main(){
  int d; cin >> d;
  if(d==25){
    cout << "Christmas" << endl;
  }
  else if(d==24){
    cout << "Christmas Eve" << endl;
  }
  else if(d==23){
    cout << "Christmas Eve Eve" << endl;
  }
  else if(d==22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
}

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

# import time
# start = time.time()

import math
from functools import reduce



def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
for a in range(1,N+1):
    for b in range(1,N+1):
        for c in range(1,N+1):
            ans+=gcd(a,b,c)
print(ans)



Measured memory_bytes: 69900
S = input()
if S == 'SSS':
  print(0)
elif S == 'SSR':
  print(1)
elif S == 'SRS':
  print(1)
elif S == 'SRR':
  print(2)
elif S == 'RSS':
  print(1)
elif S == 'RSR':
  print(1)
elif S == 'RRS':
  print(2)
else:
  print(3)

Measured memory_bytes: 9048
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

signed main(){
  int N,M;
  string s[101];
  map<string,int>mp;

  cin>>N;
  for(int t=0;t<N;t++){
    cin>>s[t];
    mp[s[t]]++;
  }
  cin>>M;
  for(int i=0;i<M;i++){
    string temp;
    cin>>temp;
    mp[temp]--;
  }

  int max=0;
  for(int t=0;t<N;t++){
    if(max<mp[s[t]])max=mp[s[t]];
  }

  cout<<max<<"\n";
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  long ans=0;
  cin >> N;
  long x=10;
  if(N%2==0&&N>=10){
    while(x<=N){
      ans+=N/x;
      x*=5;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
from bisect import bisect_left as bl
from bisect import bisect_right as br
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort()
ans = 0
for i in range(n): ans += bl(a,b[i])*(n-br(c,b[i]))
print(ans)

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

int main(){
    for(int x,y,i = 0 ;; i++){
        cin >> x >> y;
        
        if(x == 0 && y == 0) break;
        
        if(x > y){
            cout << y << " " << x << endl;
        }
        else{
            cout << x << " " << y << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 2996
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define int long long
#define vll vector<long long>
#define pii pair<long long ,long long >
#define vvi vector< vector<long long > >
#define vpii vector<pair<int,int>>
#define pll  pair<long long ,long long >
#define pb  push_back
#define ff  first
#define sec second
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend())
#define m_p make_pair
#define all(x) (x.begin(),x.end())
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD = 1e9 + 7 ;
int size = 10000000;


void solve() {

  int n; cin >> n;
  int flag = 0;
  while (n > 0) {

    if (n % 10 == 7) { flag = 1; break;}
    n /= 10;
  }

  if ( flag ) cout << "Yes" << endl;
  else cout << "No" << endl;





}


int32_t main() {
  fast;
  /*  #ifndef ONLINE_JUDGE
      freopen("input.txt","r",stdin);
      freopen("output.txt","w",stdout);
    #endif */

  int T = 1; //cin>>T;
  while (T--) {
    solve();
  }

  return 0;
}



Measured memory_bytes: 3584
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

a,b,k = get_nums_l()

tak = max(0, a-k)

aok = b if k<=a else max(0, b - (k-a))

print(tak, aok)

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(condition) if(condition){cout << "POSSIBLE" << endl;}else{cout << "IMPOSSIBLE" << endl;}
#define Possible(condition) if(condition){cout << "Possible" << endl;}else{cout << "Impossible" << endl;}
#define possible(condition) if(condition){cout << "possible" << endl;}else{cout << "impossible" << endl;}
#define Size(n) (n).size()

typedef long long ll;


using namespace std;

const int INF = 1e9,MOD = 1e9 + 7,ohara = 1e6;
const ll LINF = 1e18;


long long int n,cnt=0,ans=0,a,b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

      
      cin>>n;
      rrep(i,1,n+1){
        rrep(j,1,n+1){
          if(i%2!=0)continue;
          if(j%2==0)continue;
          ans++;
        }
      }
      Cout(ans);
     

       
return 0;
}


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

using namespace std;

long long dp[305][32];
int n,c,len[8],seq[8];
int cnt = 0;
//int fuckywh[305];

int main()
{
	scanf("%d%d",&n,&c);
	for(int i = 1;i <= n; ++ i) scanf("%d",&len[i]);
	sort(len + 1,len + 1 + n);
	for(int i = 1;i < n; ++ i) seq[i] = i;
	long long as = 0;
	do
	{
		memset(dp,0,sizeof(dp));
		int all = (1 << n - 1) - 1;
		dp[min(len[n] * n,c * n)][0] = 1;
		for(int i = 0;i <= c * n; ++ i)
			for(int j = c * n;j >= i; -- j)
				for(int k = 0;k <= all; ++ k)
				{
					if(!dp[j][k]) continue;
					if(i % n && !(k & 1 << i % n - 1))
					{
						dp[min(c * n,max(j,i + len[seq[i % n]] * n))][k | 1 << i % n - 1] += dp[j][k];
					}
				}
		as += dp[c * n][all];
		cnt ++;
	}while(next_permutation(seq + 1,seq + n));
	printf("%.11Lf\n",(long double)as * 1.0 / cnt / pow(c,n - 1));
	return 0;
}

Measured memory_bytes: 512
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#include<bits/stdc++.h>
#define fr first
#define sc second
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<ll,ll>
#define pdd pair<ld, ld>
#define pq priority_queue
#define umap unordered_map
#define uset unordered_set
#define pii pair<int, int>
#define forn(i,n) for(int i =1;i<= (n);++i)
#define fast cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);cout.sync_with_stdio(0);
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordset;
typedef string str;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
const int inf = 1e9+7;
const int nmax = 500005;
const ll linf = LLONG_MAX;
const ll mod = 1000000007;

ll n , k , a[100005] , C[100005] , rez;

ll inverse(ll t){
    ll r = 1 , p = t;
    for(ll i = 0 ; (1<<i) <= mod-2 ; i++){
        if((1<<i)&(mod-2)){
            r *= p;
            r %= mod;
        }
        p *= p;
        p %= mod;
    }
    return r;
}

int main(){
    fast;
    cin >> n >> k;
    forn(i,n){
        cin >> a[i];
    }
    sort(a+1,a+n+1);
    forn(i,n){
        if(i < k -1 )C[i] = 0;
        if(i == k - 1)C[i] = 1;
        //    =  (i+1) / (i-k+1)
        if(i >= k){
            C[i] = C[i-1];
            C[i] *= i;
            C[i] %= mod;
            C[i] *= inverse(i-k+1);
            C[i] %= mod;
        }
    }
    forn(i,n){
        rez -= a[i] * C[n-i];
        //cout << i << ' ' << C[n-i] << ' ' << C[i-1] << '\n';
        rez += a[i] * C[i-1];
        rez = (rez +mod)%mod;
    }
    cout << rez << '\n';
}


Measured memory_bytes: 1792
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

//二項係数 nCk mod pを求める
const LL MAX = 510000, p = 998244353; LL fac[MAX], finv[MAX], inv[MAX];
/* 前処理 */void COM_init() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; FOR(i, 2, MAX) { fac[i] = fac[i - 1] * i % p; inv[i] = p - inv[p%i] * (p / i) % p; finv[i] = finv[i - 1] * inv[i] % p; } }
/* 主処理 */LL COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % p) % p; }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL D, N;
	cin >> D >> N;

	LL ans = pow(100, D) * N;
	if (N == 100) {
		if(D==0)ans = 101;
		else if (D == 1)ans = 10100;
		else ans = 1010000;
	}
	O(ans);

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a, b, i = 0, aa = 0, ca;
	double ba = 0;
	while(scanf("%d,%d", &a, &b) != EOF){
		i++;
		aa += a * b;
		ba += b;
	}
	ba /= i;
	ba += 0.5;
	ca = ba;
	printf("%d\n%d\n", aa, ca);
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <cmath>
using namespace std;
 
int main(int argc, char** argv) {
    int a, b; // 0 ??? a, b ??? 1000000
    while(cin >> a >> b) {
        cout << (int)floor(log10((double)a+b))+1 << endl;
    }
    return 0;
}

Measured memory_bytes: 1204
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let x:i64 = read();
    let mut v = vec![x];
    for _ in 0..n {
        v.push(read());
    }
    let mut ans = v[1] - v[0];
    for i in 1..=n {
        ans = gcd(ans, (v[i]-v[i-1]).abs());
    }
    println!("{}", ans);
}

fn gcd(a:i64, b:i64) ->i64 {
    if b == 0 {
        return a
    }
    return gcd(b, a%b)
}

Measured memory_bytes: 2900
N = int(input())
L = list(map(int, input().split()))
num = 0
if N < 3:
   num=0
else:
   for i in range(N-2):
       for j in range(i+1, N-1):
          for k in range(j+1, N):
             if not(L[i]==L[j] or L[j]==L[k] or L[k]==L[i]):
                if (L[i]-L[j] < L[k]) and (L[j]-L[i]<L[k])and(L[k]<L[j]+L[i]):
                   num=num+1
print(num)

Measured memory_bytes: 9228
#134ABCD - Preparing Boxes
#部分的WA
import math
N = int(input())
a = list(map(int,input().split()))
ball = [0]*N
for i in range(N,0,-1):
    #print(ball)
    stock = 0
    for j in range(i,N+1,i):
        stock += ball[j-1]
        #print(stock)
    if stock %2 == 1:
        if a[i-1] ==1:
            ball[i-1] += 0
        elif a[i-1] == 0:
            ball[i-1] += 1
    elif stock %2 == 0:
        if a[i-1] ==1:
            ball[i-1] += 1
        elif a[i-1] == 0:
            ball[i-1] += 0
#print(ball)
#ans = [str(k) for k in ball]
#print(' '.join(ans))#int型ではjoinは使えない
ans1 = []
count = 0
for k in range(N):
    if ball[k] == 1:
        ans1.append(k+1)
        count += 1
ans2 = [str(l) for l in ans1]
print(count)
print(' '.join(ans2))

Measured memory_bytes: 22712
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> T;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using vvec = vector<vector<int>>;
using vec = vector<int>;

vvec G;
vec cost;


void dfs(int pre,int now){
    for(auto &next : G[now]){
        if(pre==next) continue;
        cost[next]+=cost[now];
        dfs(now,next);
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n,q;
    cin>>n>>q;
    G.resize(n);
    cost.resize(n,0);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb((b));
        G[b].pb(a);
    }
    rep(i,q){
        int p,x;
        cin>>p>>x;
        p--;
        cost[p]+=x;
    }
    dfs(-1,0);
    rep(i,n){
        cout<<cost[i]<<endl;
    }
}

Measured memory_bytes: 177408
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[]) {
  /* code */
  string num;
  int a = 0;
  cin >> num;
  for (int i = 0; i < 3; i++) {
    if (num[i] == num[i + 1]) {
      a++;
    }
    }
    if (a == 0) {
      cout << "Good" << endl;
    } else {
      cout << "Bad" << endl;
    }
  return 0;
}

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

using namespace std;

int main()
{
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int x3,y3,x4,y4;
    x3=x2 + y1 - y2;
    y3 = y2 + x2 - x1;
    x4 = x1 + y1 - y2;
    y4 = y1 + x2 - x1;
  
   cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define un unsigned
#define lo long
#define in int
#define sh short
#define fo for
using namespace std;
in n;
un lo lo a[200100],b[200100],ha,hb,tt[200100];
un lo lo ra[200100],rb[200100];
un lo lo Base=1900210023LL,Modu=3200320091LL;
template<typename T,typename V,int &N>
struct Hasher{
	void Hashing(V arr[],T &res,T bas,T mod){
		for(int i=0;i<N;i++)
			res=((res*bas)%mod+(T)(arr[i]))%mod;
		return;
	} 
	void DeleteHash(V val,T &res,T HighestValue,T mod){
		res=(res+mod-((T)(val)*HighestValue)%mod)%mod;
	}
	void AddHash(V val,T &res,T bas,T mod){
		res=((res*bas)%mod+(T)(val))%mod;
	}
};
in main(){
	#ifdef FILIN
		#ifndef LOCAL
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	fo(in i=0;i<n;i++) cin>>a[i];
	fo(in i=0;i<n;i++) ra[i]=a[i];
	fo(in i=0;i<n;i++) tt[i]=(a[i]^a[(i+1)%n]);
	fo(in i=0;i<n;i++) a[i]=tt[i];
	fo(in i=0;i<n;i++) cin>>b[i];
	fo(in i=0;i<n;i++) rb[i]=b[i];
	fo(in i=0;i<n;i++) tt[i]=(b[i]^b[(i+1)%n]);
	fo(in i=0;i<n;i++) b[i]=tt[i];
	Hasher<un lo lo,un lo lo,n> haxi;
	haxi.Hashing(a,ha,Base,Modu);
	haxi.Hashing(b,hb,Base,Modu);
	long long hv=1LL;
	fo(in i=1;i<n;i++) hv=(hv*Base)%Modu;
	fo(in i=0;i<n;i++){
		if(ha==hb)
			cout<<i<<' '<<(ra[i]^rb[0])<<endl;
		haxi.DeleteHash(a[i],ha,hv,Modu);
		haxi.AddHash(a[i],ha,Base,Modu);
	} 
	return 0;
}


Measured memory_bytes: 11264
N, K = map(int, input().split())
P = list(map(lambda x:int(x)-1, input().split()))
C = list(map(int, input().split()))

ans = -float('inf')

for start in range(N):
    loop_len = 1
    pos = P[start]
    score = C[pos]
    scores = [score]
    while pos != start:
        loop_len += 1
        pos = P[pos]
        score += C[pos]
        scores.append(score)
    loops = (K-1)//loop_len
    if score > 0:
        cand = max(0, score * loops) + max(scores[:(K-loop_len * loops)])
    else:
        cand = max(scores[:min(K, loop_len)])
    ans = max(ans, cand)
print(ans)

Measured memory_bytes: 79888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return (rand()<<16|rand())%x;
}
const int N=305;
int n,k,mod,f[N][N],c[N][N],g[N][N];
int main(){
	n=read(); k=read(); mod=read();
	for(int i=0;i<=k+1;i++)f[0][i]=1;
	for(int i=0;i<=n;i++){
  		c[i][0]=1;
		for(int j=1;j<=i;j++)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	}
	for(int i=k;i>=0;i--){
		g[i][0]=1;
		for(int j=1;j<=n;j++)for(int k=1;k<=j;k++)g[i][j]=(g[i][j]+(ll)g[i][j-k]*c[j-1][k-1]%mod*f[i+1][k]%mod)%mod;
		for(int j=1;j<=n+1;j++)f[i][j]=(f[i+1][j]+g[i][j-1])%mod;
	}
	cout<<(f[0][n+1]-f[1][n+1]+mod)%mod<<endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (1e+18) + 7;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

ll mod_pow(ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%mod;
		a = a * a%mod; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 500;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}

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

void solve() {
	int n; cin >> n;
	bool b = true;
	rep(i, n) {
		int a; cin >> a;
		if (a % 2 == 0) {
			if (a % 3 && a % 5)b = false;
		}
	}
	if (b) {
		cout << "APPROVED" << endl;
	}
	else {
		cout << "DENIED" << endl;
	}
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init_f(); init();
	//int t; cin >> t; rep(i, t)solve();
	//while(cin>>n,n)solve();
	solve();
	stop
		return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	set<int>S;
	for(int i=0;i<2;i++){
		int n;cin>>n;
		while(n--){
			int a,b;
			cin>>a>>b;
			S.insert(a*100+b);
		}
	}
	set<int>::iterator it=S.begin();
	for(int i=0;i<S.size();it++,i++)cout<<*it/100<<":"<<(*it%100<10?"0":"")<<*it%100<<" \n"[i+1==S.size()];
	return 0;
}


Measured memory_bytes: 1204
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define rep(i,n) for(int i=0;i<(n);i++)

int cmpint(const void *a,const void *b){
  return *(int *)b-*(int *)a;
}

int main(){
  int n,a;
  scanf("%d%d",&n,&a);
  printf("%d\n",n*n-a);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main(){
	pair<string,pair<int,int>> s[123];
	int n,p[123];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i].first>>p[i];
		s[i].second.first=(p[i]-(2*p[i]));
		s[i].second.second=(i+1);
	}
	sort(s,s+n);
	for(int i=0;i<n;i++){
		cout<<s[i].second.second<<endl;
	}
}


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

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

  int n, k;
  cin >> n >> k;
  vector<int64_t> x(n);
  int zero = n;
  int prev = -1;
  for (int i = 0; i < n; ++i) {
    cin >> x[i];
    if (prev < 0 && 0 <= x[i]) {
      zero = i;
    }
    prev = x[i];
  }
  int l = max(0, zero - k - 1), r = l + k - 1;
  int64_t ans = INT64_MAX;
  for (int i = 0; i < 2 * k && r < n; ++i) {
    assert(r - l == k - 1);
    if (x[l] * x[r] < 0 || l == 0 || x[l - 1] * x[l] < 0 || r == n - 1 ||
        x[r] * x[r + 1] < 0) {
      if (x[l] * x[r] < 0) {
        if (abs(x[l]) < abs(x[r])) {
          ans = min(ans, 2 * abs(x[l]) + abs(x[r]));
        } else {
          ans = min(ans, abs(x[l]) + 2 * abs(x[r]));
        }
      } else {
        ans = min(ans, max(abs(x[l]), abs(x[r])));
      }
    }
    ++l, ++r;
  }
  cout << ans << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int x,a,b;
    cin>>x>>a>>b;
    if(b-a <= 0)cout<<"delicious"<<endl;
    else if(b-a <= x)cout<<"safe"<<endl;
    else cout<<"dangerous"<<endl;
}

Measured memory_bytes: 256
def main():

    L, R = [int(i) for i in input().split()]

    if (L//2019) < (R//2019):
        ans = 0
    else:
        ans = 10 ** 10
        for l in range(L, R+1):
            for r in range(l+1, R+1):
                ans = min(ans, (l*r)%2019)

    print(ans)


if __name__ == "__main__":
    main()

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

int main() {
  int N, n, f=0;
  cin >> N;
  n = N;
    
  for (int i=1; i<=9; i++){
    f += n%10;
    n /= 10;
  }
  if (N%f==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
int main(){
    long long l,r,a,b,m=2019;
    cin >> l >> r;
    if(r/2019>l/2019 || l%2019==0){
        cout << 0 << endl;
    }
    else{
        a=l%2019;
        b=r%2019;
        for(int i=a; i<b; i++){
            for(int j=i+1; j<b+1; j++){
                if(m>(i*j)%2019){
                    m=(i*j)%2019;
                }
            }
        }
        cout << m << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  char a,b;
  cin>>a>>b;
  if(a == b) {
    cout << "H" << endl;
  } else {
    cout << "D" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define vstroku() to_string()
#define vchislo() to_ulong()
#define gcd(x,y) __builtin_gcd(x,y)
#define numberof1(x) __builtin_popcount(x)
#define povsemelementam(i,mnozh) for(auto i: mnozh)
#define podotrezok(i,j) substr(i-1,j) // like prefix sum, (i,j)=s[j]-s[i-1]
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back 
#define pii pair <int, int>
#define F first
#define S second
#define mipletsplay ios_base::sync_with_stdio(0); cin.tie(0); 


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 3e5;
const ll INF = 1e9;
const ll kek=998244353;

int main() {
mipletsplay;

int n,a,b;
cin>>n>>a>>b;
int k=min(a*n,b);
cout<<k;}

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

typedef long long ll;
typedef pair<int,int> p_int;
typedef pair<ll,ll> p_ll;
typedef tuple<ll,ll,ll> t3_ll;
int dx[] = {-1,0,1,0},dy[] = {0,1,0,-1};
int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
const ll inf = 1000000007;

int main() {
	ll n;
	cin >> n;
	ll a[3][n];
	ll dp[n][3];
	for (int i = 0;i < n;i++) {
		cin >> a[0][i] >> a[1][i] >> a[2][i];
	}
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 3;j++) {
			dp[i][j] = -1;
		}
	}
	dp[0][0] = a[0][0];
	dp[0][1] = a[1][0];
	dp[0][2] = a[2][0];
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 3;k++) {
				if (j != k) {
					dp[i+1][k] = max(dp[i+1][k],dp[i][j]+a[k][i+1]);
				}
			}
		}
	}
	cout << max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}) << endl;
}

Measured memory_bytes: 4992