akhauriyash/Code-Regression huggingface dataset:
//  ____            _                  _                       _       _
// |  _ \ _   _ ___| |_    ___ _ __   | |_ ___ _ __ ___  _ __ | | __ _| |_ ___
// | |_) | | | / __| __|  / __| '_ \  | __/ _ \ '_ ` _ \| '_ \| |/ _` | __/ _ \
// |  _ <| |_| \__ \ |_  | (__| |_) | | ||  __/ | | | | | |_) | | (_| | ||  __/
// |_| \_\\__,_|___/\__|  \___| .__/___\__\___|_| |_| |_| .__/|_|\__,_|\__\___|
//                            |_| |_____|               |_|

//https://github.com/manta1130/Competitive_Programming_Template_Rust

#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector_row<T>(n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v = Vec::with_capacity(n);
        for _ in 0..n {
            let buf = match input_line_str().parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    pub trait ToCharVec {
        fn to_charvec(&self) -> Vec<char>;
    }

    impl ToCharVec for String {
        fn to_charvec(&self) -> Vec<char> {
            self.to_string().chars().collect::<Vec<_>>()
        }
    }
}

use input::*;

fn main() {
    let (a, b, c): (isize, isize, isize);
    input!(a, b, c);
    if a <= c && c <= b {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
N = int(input())
A = []
c = 0

for i in range(2,int(N**0.5)+1):
    if N % i == 0:
        A.append(i)
        A.append(N//i)

for i in range(2,int((N-1)**0.5)+1):
    if (N - 1) % i == 0:
        A.append(i)

        A.append((N-1)//i)
A = list(set(A))
if N == 2:
    print(1)
else:
    for i in A:
        start = N
        while(True):
            if start % i != 0:
                break
            start = start//i
        if start % i == 1:
            c += 1
    print(c+2)

Measured memory_bytes: 41052
fn main() {
    println!("{}", solve(input()));
}

fn input() -> u32 {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.pop();
    let r: u32 = buf.parse().unwrap();
    r
}

fn solve(r: u32) -> f64 {
    let pi: f64 = std::f64::consts::PI;
    r as f64 * pi * 2 as f64
}


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

int main()
{
  int n;
  cin >> n;
  int b[n-1];
  for(int i = 0; i < n-1; ++i) cin >> b[i];
  
  int ans = b[0] + b[n-2];
  for(int i = 1; i < n-1; ++i){
    ans += min(b[i-1], b[i]);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3588
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.next().toLong()
    val l = sc.next().toLong()
    println(problem131b(n, l))
}

fun problem131b(n: Long, l: Long): Long {
    val apples = (1..n).map { l + it - 1 }

    val sum = Math.abs(apples.sum())
    var tmp = Long.MAX_VALUE
    apples.forEachIndexed { i, ai ->
        val sum2 = apples.filter { it != ai }.sum()
        if (Math.abs(sum - Math.abs(tmp)) > Math.abs(sum - Math.abs(sum2))) {
            tmp = sum2
        }
    }
    return tmp
}

Measured memory_bytes: 31388
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
        int n = sc.nextInt();
      	int k = sc.nextInt();
      	int count=0;
      
      	while(n != 0){
        	n /= k;
          	count++;
        }
      
      	System.out.println(count);      	        
	}
}

Measured memory_bytes: 35656
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<int, II> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int x, dp[100010];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> x;
    dp[0] = true;
    FOR(i,1,x) {
        FOR(j,0,5) {
            if (i >= 100 + j) {
                dp[i] |= dp[i - 100 - j];
            }
        }
    }
    if (dp[x]) cout << 1;
    else cout << 0;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
#define F first
#define S second
int main()
{
    Hello
    int n, k, cntr = 0, ans = 0;
    cin >> n >> k;
    int arr[n + 5];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    for(int i = 0; i < n; i++)
    {
        cntr++;
        if(cntr == k || i == n - 1)
        {
            cntr = 1;
            ans++;
        }
    }
    cout << ans;
    return 0;
}


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

template<typename T> 
void getmat(std::vector<std::vector<T>> &mat,unsigned n,unsigned m)
{
	for (int i = 0; i < n; i++) {
		std::vector<T> v;
		for (int i = 0; i < m; i++) {
			T n;
			std::cin >> n;
			v.push_back(n);
		}
		mat.push_back(v);
	}
}
template<typename T> 
void printmat(std::vector<std::vector<T>> mat)
{
	for (auto&& v : mat) {
		bool b{false};
		for (auto&& n : v) {
			if (b) std::cout << " ";
			b = true;
			std::cout << n ;
		}
		std::cout << std::endl;
	}
}

int main(int argc, char const* argv[])
{
	int n, m, l;
	std::vector<std::vector<unsigned long>> a, b, c;
	std::cout << std::fixed;
	std::cin >> n >> m >> l;
	getmat(a, n, m);
	getmat(b, m, l);
	c.resize(n);
	for (int i = 0; i < n; i++) {
		c[i].resize(l);
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				c[i][j] += a[i][k] * b[k][j];
			}
		}
	}
	printmat(c);

	return 0;
}

Measured memory_bytes: 3256
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll k, a, b;
    cin >> k >> a >> b;
    for (ll i = a; i <= b; i++)
        if (i % k == 0)
            return cout << "OK", 0;
    cout << "NG";
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 100000001
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
#define dbg(x) cout <<#x<<":"<<x<<endl;
ll max1(ll a, ll b, ll c=-inf, ll d=-inf) {ll mx1=(a>b)?a:b, mx2=(c>d)?c:d; return ((mx1>mx2)?mx1:mx2);}
#define int ll


signed main() {
	fast;
	
	ll n;
	cin>>n;
	ll ga,gb,sa,sb,ba,bb;
	cin>>ga>>sa>>ba;
	cin>>gb>>sb>>bb;

	ll g=0, s=0, b=0;
	

	ll ans=n;
	ll n1,n2;

	if(ga>=gb) n1=0;
	else n1=n;

	if(sa>=sb) n2=0;
	else n2=n;

	if(n1!=0&&n2!=0){
		swap(ga,ba);
		swap(gb,bb);
		if(ga>=gb) n1=0;
		else n1=n;
		if(sa>=sb) n2=0;
		else n2=n;
	}

	for(int i=0;i<=n1;i++){
		for(int j=0;i+j<=n&&j<=n2;j++){
			ll cur=0;
			ll g=0, s=0, b=0;
			ll g1=i;
			ll s1=j;
			ll b1=n-i-j;

			g+=(g1/min(ga,gb)); cur+=g1%min(ga,gb);
			s+=(s1/min(sa,sb)); cur+=s1%min(sa,sb);
			b+=(b1/min(ba,bb)); cur+=b1%min(ba,bb);

			cur+=g*gb+s*sb+b*bb;
			g=0; b=0; s=0;

			ans=max(ans,cur);
		}
	}

	n=ans;
	swap(ga,gb);
	swap(sa,sb);
	swap(ba,bb);

	if(ga>=gb) n1=0;
	else n1=n;

	if(sa>=sb) n2=0;
	else n2=n;

	if(n1!=0&&n2!=0){
		swap(ga,ba);
		swap(gb,bb);
		if(ga>=gb) n1=0;
		else n1=n;
		if(sa>=sb) n2=0;
		else n2=n;
	}
  
  	assert(n1*n2<=10000000000);

	for(int i=0;i<=n1;i++){
		for(int j=0;i+j<=n&&j<=n2;j++){
			ll cur=0;
			ll g=0, s=0, b=0;
			ll g1=i;
			ll s1=j;
			ll b1=n-i-j;

			g+=(g1/min(ga,gb)); cur+=g1%min(ga,gb);
			s+=(s1/min(sa,sb)); cur+=s1%min(sa,sb);
			b+=(b1/min(ba,bb)); cur+=b1%min(ba,bb);

			cur+=g*gb+s*sb+b*bb;
			g=0; b=0; s=0;

			ans=max(ans,cur);
		}
	}


	cout<<ans;

} 

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
    public static void main(String[] args) throws IOException{


        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String word = br.readLine();
        word = word + word;
        String key = br.readLine();
        boolean result = false;

        int i=0;
        while(i < word.length()/2){
        	int index = word.indexOf(key.charAt(0), i);

        	if(index + key.length() > word.length() || index == -1)break;

        	String tmp = word.substring(index, index + key.length());
        	if(key.equals(tmp)){
        		result = true;
        		break;
        	}else{
        		i = index + 1;
        	}
        }

        if(result){
        	System.out.println("Yes");
        }else{
        	System.out.println("No");
        }
    }
}

Measured memory_bytes: 24320
from collections import  defaultdict
from collections import deque
import math
N = int(input())

AB = [list(map(int,input().split())) for _ in range(N-1)]


d = defaultdict(list)

for a,b in AB:
    d[a-1].append(b-1)
    d[b-1].append(a-1)


def get_distance(start):
    visited = set([start,])
    distance = [999999999999999999 for _ in range(N)]
    distance[start ] =0
    to_visit = deque([ (1,a) for a in d[start]])

    while to_visit:
        dist,now = to_visit.popleft()
        visited.add(now)
        distance[now]=dist
        for a in d[now]:
            if a not in visited:
                to_visit.append((dist+1,a))

    return distance



a =(get_distance(0))
b= (get_distance(N-1))

distance_ = a[N-1]

def get_close(a,i):
    l = list(sorted([(a[x],x) for x in d[i]]))
    return l[0][1]

tmp = N-1
for i in range((distance_+1)//2-1):
   tmp = get_close(a,tmp)

middle_a = get_close(a,tmp)
middle_b = tmp



x = get_distance(0)
max_ = math.ceil(x[N-1]/2)





d[middle_a].remove(middle_b)
d[middle_b].remove(middle_a)


a_new = (get_distance(0))
b_new = (get_distance(N-1))
"""
print(a)
print(b)
print(middle_a)
print(middle_b)
print(a_new,b_new)
"""
if sum( q<99999999999999999 for q in a_new ) >sum( q<99999999999999999 for q in b_new ):
    print("Fennec")
else:
    print("Snuke")





Measured memory_bytes: 71684
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	int n,i,j,d,m[11][11];
	while(cin >> n) {
		if (n==0) break;
		memset(m,0,sizeof(m));
		for (i=0;i<n;i++) for (j=0;j<n;j++) {
			cin >> d;
			m[i][j]=d; m[i][n]+=d; m[n][j]+=d; m[n][n]+=d;
		}
		for (i=0;i<=n;i++) {
			for (j=0;j<=n;j++) printf("%5d",m[i][j]);
			printf("\n");
		}
	}
	return 0;
	}

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


int main() {
    ios::sync_with_stdio(false);
    int k, s, ans = 0;
    cin >> k >> s;
    for (int x = 0; x <= k; x++) {
        for (int y = 0; y <= k; y++) {
            int z = s - (x+y);
            if (0 <= z && z <= k) {
                //printf("%d %d %d\n", x, y, z);
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    long k = sc.nextLong();
    String answer ="1";
    long one= 0;
    for(int i =0;i<s.length();i++){
      if(!s.substring(i,i+1).equals("1")){
        answer = s.substring(i,i+1);
        break;
      }else{
        one=one+1;
      }
    }
    if(k<=one){
       System.out.println("1");
    }else{
       System.out.println(answer);
    }
    
  }

  

  
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
int main() {
    double R;
    cin >> R;
    double pi = acos(-1);
    cout << 2.0 * pi * R << endl;
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n); 0<=i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper);
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);

int main(void){
    ll K,A,B;
    cin >> K;
  	cin >> A >> B;
    
	for(ll i=A; i<B+1; i++)
    {
     	 if(i%K==0)
         {
           cout << "OK" << endl;
           return 0;
         }
    }
	cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3624
/* "It's okay if you hate me. I hate me too." */

#include <bits/stdc++.h>

using namespace std;

const int maxN = (int)2E5+5;

bool a[maxN], b[maxN];
int n, m;

int main() {
	scanf("%d %d", &n, &m);
	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	for (int i = 0; i < m; ++i) {
		int u, v;
		scanf("%d %d", &u, &v);
		if (u == 1) a[v] = true;
		else if (v == n) b[u] = true;
	}
	for (int u = 2; u < n; ++u)
		if (a[u] && b[u]) {
			puts("POSSIBLE");
			return 0;
		}
	puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 640
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, a, b = map(int, readline().split())
    ans = max(b * (n - 2) - a * (n - 2) + 1, 0)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200000 + 5;
int n;
ll a[N];

int main() {
	scanf("%d", &n);
	ll sum = 0;
	for(int i=0; i<n; ++i) {
		scanf("%lld", a+i);
		a[i] -= i+1;
		sum += a[i];
	}
	sort(a, a+n);
	ll tmp = 0, res = 1e18;
	for(int i=0; i<n; ++i) {
		tmp += a[i];
		res = min(res, -tmp+(i+1LL)*a[i] + (sum-tmp) - (n-i-1LL)*a[i]);
	}
	printf("%lld\n", res);
	return 0;
}



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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
signed main(){
    gearup;
    int n,m; cin >> n >> m;
    vl a(m);
    rep(i,m)cin>>a[i];
    ll sum = accumulate(all(a),0LL);
    if(n-sum >= 0)out(n-sum);
    else out(-1);
}


Measured memory_bytes: 3696
#include "bits/stdc++.h"
using namespace std;
int main()
{
  string a,b; cin>>a>>b;
  bool ba = (b.length() == a.length()+1) ;
  bool bb = ((b.substr(0,b.length()-1).compare(a)==0));
  (ba && bb)? cout<<"Yes" : cout<<"No" ;
  return 0;
}

Measured memory_bytes: 3604
import numpy as np

N = int(input())
a = np.array(input().split(), np.int64)

h = {}
for i in range(len(a)):
    if a[i] - 1 not in h:
        h[a[i] - 1] = 0
    h[a[i] - 1] += 1
    if a[i] not in h:
        h[a[i]] = 0
    h[a[i]] += 1
    if a[i] + 1 not in h:
        h[a[i] + 1] = 0
    h[a[i] + 1] += 1
print(max(h.values()))

# -1, 0, 1, ..., 100001
# 3 1 4 1 5 9 2
#  0 ..
#  1 ...
#  2 ....
#  3 ...
#  4 ...
#  5 ..
#  6 .
#  7
#  8 .
#  9 .
# 10 .

# print(a)


Measured memory_bytes: 25076
#include<bits/stdc++.h>
using namespace std;
int main(){

    string s; cin >> s;
    if( s[0] == s[1] && s[1] == s[2] ){
        cout << "Yes\n";
    }else{
        if( s[1] == s[2] && s[2] == s[3] ){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }

}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn main(){
    let (w, h): (usize, usize) = readln();
    let mut pq: Vec<(usize, bool)> = Vec::with_capacity(w + h);
    for _ in 0..w{
        let p = readln();
        pq.push((p, true));
    }
    for _ in 0..h{
        let q = readln();
        pq.push((q, false));
    }

    pq.sort();

    let mut res = 0;
    let mut p = 0;
    let mut q = 0;
    for &(c, is_p) in &pq{
        if p == w && q == h {
            break;
        }

        if is_p && p < w{
            res += c * (h + 1 - q);
            p += 1;
        }else if q < h{
            res += c * (w + 1 - p);
            q += 1;
        }
    }

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



#[allow(dead_code)]
fn get_line() -> String{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_string()
}

#[allow(dead_code)]
fn readln<T: Read>() -> T{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

trait Read{
    fn read(s: &str) -> Self;
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl<T: Read> Read for Vec<T>{
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B){
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C){
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

Measured memory_bytes: 9724
///In the name of ALLAH

#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;
 
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define endl '\n'
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()
#define mx_int_prime 999999937
 
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007
 
#define mem(a,b) memset(a, b, sizeof(a) )
#define gcd(a,b) __gcd(a,b)
#define sqr(a) ((a) * (a))
 
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int mx = 1e5+123;
int dp[mx], n, h[mx];

int solve ( int i )
{
  if ( i == n ) return 0;
  if ( dp[i] != -1 ) return dp[i];

  int ret2 = inf;
  int ret1 = abs ( h[i] - h[i+1] ) + solve ( i+1 );
  if ( i+2 <= n ) ret2 = abs ( h[i] - h[i+2] ) + solve ( i+2 );

  return dp[i] = min ( ret1, ret2 );
}

int main()
{
  optimize();

  cin >> n;
  for ( int i = 1; i <= n; i++ ) cin >> h[i];

  memset ( dp, -1, sizeof (dp) );
  cout << solve ( 1 ) << endl;


  return 0;
}

Measured memory_bytes: 9076
n = int(input())
s2=list(input())
k = 0
w = []
r = ''
for i in range(len(s2)):
    r += s2[i]
w.append(r)
for i in range(1,n):
    s=list(input())
    if s[0]!=s2[len(s2)-1]:
        k = 1
    r = ''
    for j in range(len(s)):
        r += s[j]
    #print(w,r,w.count(r))
    if w.count(r) != 0:
        k = 1
    w.append(r)
    s2 = s
if k == 1:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
import itertools

N,M,R = map(int,input().split())
Visit = list(map(int,input().split()))
lVisit = len(Visit)

Data = []
INF = 10**10
for _ in range(N):
    Data.append([INF]*N)
for i in range(N):
    Data[i][i] = 0
for _ in range(M):
    a,b,c = map(int,input().split())
    Data[a-1][b-1] = c
    Data[b-1][a-1] = c

for k in range(N):
    for i in range(N):
        for j in range(N):
            Data[i][j] = min(Data[i][j], Data[i][k]+Data[k][j])

ans = 10**10
for course in list(itertools.permutations(Visit)):
    sum1 = 0
    for i in range(lVisit-1):
        to = course[i+1]
        fm = course[i]
        sum1 += Data[fm-1][to-1]
    ans = min(ans,sum1)
print(ans)


Measured memory_bytes: 52952
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, n) for(auto i = (n).begin(); i != (n).end(); i++)
#define in_arr(type, a, n) copy_n(istream_iterator<type>(cin), n, (a).begin());
#define ll long long int

int main(){
    string s;
    cin >> s;
    cout << s.substr(0, s.size() - 8) << endl;
    return 0;
}


Measured memory_bytes: 256
var s:String;a,b:Longint;x,y:Boolean;
begin
readln(s);
a:=ord(s[1])-48;
a:=a*10+ord(s[2])-48;
b:=ord(s[3])-48;
b:=b*10+ord(s[4])-48;
x:=(0<a)and(a<13);
y:=(0<b)and(b<13);
if x and y then writeln('AMBIGUOUS')
else if x then writeln('MMYY')
else if y then writeln('YYMM')
else writeln('NA');
end.

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    J=[tuple(map(int,input().split())) for _ in range(n)]
    J.sort(lambda x:x[1])
    now=0
    for a,b in J:
        now+=a
        if(now>b):
            print("No")
            return
    print("Yes")
resolve()

Measured memory_bytes: 77148
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c,d,e,f,sugar=0,mass=0;
  cin>>a>>b>>c>>d>>e>>f;
  lvector S,W;
  for(ll a_=0;100*a*a_<=f;++a_) {
    for(ll b_=0;100*b*b_<=f;++b_) {
      if(100*a*a_+100*b*b_<=f) W.emplace_back(100*a*a_+100*b*b_);
    }
  }
  for(ll c_=0;c*c_<=3000;++c_) {
    for(ll d_=0;d*d_<=3000;++d_) {
      if(c*c_+d*d_<=3000) S.emplace_back(c*c_+d*d_);
    }
  }
  double max_c=-1.0,c_tmp;
  for(ll w:W) {
    if(w==0) continue;
    for(ll s:S) {
      if(!(s+w<=f&&e*w>=s*100)) continue;
      c_tmp=100.0*s/(w+s);
      if(max_c<c_tmp) {
        max_c=c_tmp;
        sugar=s;
        mass=s+w;
      }
    }
  }
  printf("%lld %lld\n",mass,sugar);
  return 0;
}

Measured memory_bytes: 35172
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
const int N=2003;
int dp[N][N];
int ans;
void cmax(int &x,int y){x=max(x,y);}
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif
	int n;
	cin>>n;
	pair<int,int> a[n+1];
	for(int i=1;i<=n;i++)
		cin>>a[i].first,a[i].second=i;
	sort(a+1,a+n+1);reverse(a+1,a+n+1);


	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<i;j++)
		{
			int l=j;
			int r=i-1-j;
			cmax(dp[l+1][r],dp[l][r]+abs(l+1-a[i].second)*a[i].first);
          	r=j;l=i-1-j;
			cmax(dp[l][r+1],dp[l][r]+abs(n-r-a[i].second)*a[i].first);

		}
	}
	for(int i=0;i<=n;i++)cmax(ans,dp[i][n-i]);
	cout<<ans<<"\n";
}



Measured memory_bytes: 26256
//#define _GLIBCXX_DEBUG
//#define _CRTDBG_MAP_ALLOC
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

const ll LINF = 9187201950435737471;
const ll nLINF = -9187201950435737472;
const int INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const int MAXN = 3e5 + 15;
const ll MOD = 1e15 + 7;
const double EPS = 1e-9;
const int BLOCK = 500;
const double PI = acos(-1);
//auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
auto seed = 194113341;
mt19937 rnd(seed);

bool is_equal(double a, double b) {
    return abs(a - b) <= EPS;
}


#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) ((_v) * (_v))
#define vi vector <int>
#define vii vector <pair <int, int> >
#define eb emplace_back
#define pb push_back
#define mod(x, m) ((x) % m + (x < 0 ? m: 0))


inline void IO() {
#if buyolitsez
    freopen("input.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
}

template <typename T>
istream& operator >> (istream& in, vector<T>& a) {
    for (auto& i : a)
        in >> i;
    return in;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T>& a) {
    for (auto& i : a) {
        out << i << " ";
    }
    return out;
}

template <typename T, typename D>
istream& operator >> (istream& in, pair<T, D>& a) {
    in >> a.first >> a.second;
    return in;
}

template <typename T, typename D>
ostream& operator << (ostream& out, const pair<T, D>& a) {
    out << a.first << " " << a.second;
    return out;
}

inline void solve() {
    int n, m;
    cin >> n >> m;
    while (m--) {
        int x;
        cin >> x;
        n -= x;
    }
    cout << max(-1, n);
}

signed main() {
    IO();
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	string str;
	while(cin>>str){
		int len=str.length();
		int f=0;
		for(int i=0;i<len;i++){
			if(str[i]==str[i+1]&&i+1<len){
				f=1;
				cout<<i+1<<" "<<i+2<<endl;
				break;
			}
			if(str[i]==str[i+2]&&i+2<len){
				f=1;
				cout<<i+1<<" "<<i+3<<endl;
				break;
			}
		}
		if(!f)
			cout<<-1<<" "<<-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

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

int main() {
    int N; cin >> N;
    vector<pair<int, int>> res;
    reppe(i, 1, N) {
        reppe(j, i + 1, N) {
            if (N % 2 == 0) {
                if (j == (N + 1 - i)) continue;
                res.push_back(make_pair(i, j));
            } else {
                if (j == (N - i)) continue;
                res.push_back(make_pair(i, j));
            }
        }
    }
    cout << res.size() << endl;
    repp(i, 0, res.size()) {
        cout << res[i].first << " " << res[i].second << endl;
    }
}


Measured memory_bytes: 384
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<vector>
#include<cctype>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define qread(x) x=read()
#define mes(x,y) memset(x,y,sizeof(x))
#define mpy(x,y) memcpy(x,y,sizeof(x))
#define Maxn 10
#define INF 2147483647
inline int read(){
	int f=1,x=0;char ch;
	while(!(ch>='0'&&ch<='9')){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
int len,c;
char s[Maxn+1];
int main(){
	//freopen("b.in","r",stdin);
	//freopen("b.out","w",stdout);
	scanf("%s",s+1);len=strlen(s+1);
	c=0;
	for(int i=2;i<=len;i++){
		if(s[i]=='C')c++;
		if(s[i]!='A'&&s[i]!='C'&&s[i]>='A'&&s[i]<'Z'){
			printf("WA\n");
			return 0;
		}
	}
	if(s[2]=='C')c--;
	if(s[len]=='C')c--;
	if(s[1]=='A'&&c==1)printf("AC\n");
	else printf("WA\n");
}

Measured memory_bytes: 256
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	int n, x, ans = 0;
	cin >> n >> x;
	for(int i = 0, a; i < n; i++)
		cin >> a, ans = __gcd(ans, abs(x-a));
	cout << ans;

	return 0;
}


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

int main() {
  int h, a;
  cin >> h >> a;
  int div = h / a;
  int mod = h % a;
  if(mod == 0) {
    cout << div << endl;
  } else {
    cout << div + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define P pair<int,int>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define asort(x) sort(x.begin(),x.end())
 
int main() {
    ll a;
    long double b;
    cin>>a>>b;
    cout << (ll)((long double)a * b) << endl;
    return 0;
}

Measured memory_bytes: 3732
//noob
#include<bits/stdc++.h>
using namespace std;
#define fori(x) for(int i=0;i<x;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long int 
#define ld long double
#define ull unsigned long long int
#define pi acos(-1)
#define test() int T,t=1;cin>>T;
#define all(x) (x).begin(),(x).end()
#define sz(x) (int(x.size()))
typedef vector<int> vi;
typedef pair<int,int> PI;
const int N = (int)1e6 + 7;

void solve()
{
	ll a,b,c,d;cin>>a>>b>>c>>d;
	cout<<max(a*c,max(a*d,max(b*c,b*d)))<<endl;
}
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	//freopen("input.txt","r",stdin);
	
solve();
	return 0;
}

Measured memory_bytes: 3616
import std.stdio, std.string, std.conv, std.range, std.algorithm;

void main() {
    auto S = readln.split.to!(int[]);
    auto N = S[0], M = S[1];
    auto A = new bool[][N];
    auto B = new bool[][M];
    foreach (i; 0..N) {
        A[i] = readln.chomp.map!(a => a == '#').array;
    }
    foreach (i; 0..M) {
        B[i] = readln.chomp.map!(a => a == '#').array;
    }
    foreach (i; 0..N-M+1) {
        foreach (j; 0..N-M+1) {
            bool flag = true;
            foreach(x; 0..M) {
                foreach (y; 0..M) {
                    if (A[x+i][y+j] != B[x][y]) {
                        flag = false;
                        break;
                    }
                }
                if (!flag) break;
            }
            if (flag) {
                writeln("Yes");
                return;
            }
        }
    }
    writeln("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <iostream>
#include <stdlib.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main(void){
    int N;
    long int Q, K;
    cin >> N >> K >> Q;
    int A[Q];
    long int point[N];
    REP(i,N) point[i] = 0;
    REP(i,Q){
        cin >> A[i];
        point[A[i]-1] += 1;
    };
    REP(i,N){
        if(K-Q+point[i]>0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    return 0;
}

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

int main() {
  int createCount = 0, minAmount = 0;
  int minCount, amount;
  cin >> minCount >> amount;

  int targetAmount = 0;
  for (int i = 0; i < minCount; i++) {
      cin >> targetAmount;
      if (minAmount == 0 || targetAmount < minAmount) {
          minAmount = targetAmount;
      }
      createCount++;
      amount -= targetAmount;
  }

  if (amount > 0) {
      minCount = minCount + (amount / minAmount);
  }
  

  cout << minCount << endl;
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pii pair<int,int>
#define pll pair<long,long>
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)
#define adj(N) vector<vector<int>> ADJ(N+1)


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

	READV(H);
	READV(W);
	char A[H][W];
	ll B[H][W];
	FORI(i,0,H)
	{
		FORI(j,0,W)
		{
			cin>>A[i][j];	
			B[i][j]=0;		
		}
	}
	FORI(i,0,H)
	{
		ll a=0;
		FORI(j,0,W)
		{
			if(A[i][j]=='#')
			{
				a=0;
				B[i][j]+=0;
			}
			else
			{
				B[i][j]+=a;
				a++;
			}
		}
		a=0;
		FORD(j,W-1,-1)
		{
			if(A[i][j]=='#')
			{
				a=0;
				B[i][j]+=0;
			}
			else
			{
				B[i][j]+=a;
				a++;
			}
		}
	}
	FORI(j,0,W)
	{
		ll a=0;
		FORI(i,0,H)
		{
			if(A[i][j]=='#')
			{
				a=0;
				B[i][j]+=0;
			}
			else
			{
				B[i][j]+=a;
				a++;
			}
		}
		a=0;
		FORD(i,H-1,-1)
		{
			if(A[i][j]=='#')
			{
				a=0;
				B[i][j]+=0;
			}
			else
			{
				B[i][j]+=a;
				a++;
			}
		}
	}
	ll ans=0;
	FORI(i,0,H)
	{
		FORI(j,0,W)
		{
			ans=max(ans,B[i][j]);
		}
	}
	cout<<ans+1<<endl;

	return 0;
}

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

const long long INF=1000000000000000000ll;

void slidemin(int n,int m,long long *A,long long *B)
{
  deque<int> Q;
  for(int i=0;i<n;i++){
    B[i]=(Q.empty()?INF:A[Q.front()]);
    while(!Q.empty()&&A[Q.back()]>=A[i]){
      Q.pop_back();
    }
    Q.push_back(i);
    if(i>=m&&Q.front()==i-m){
      Q.pop_front();
    }
  }
}

int main()
{
  int n,m,k;
  scanf("%d%d%d",&n,&m,&k);
  static long long a[100000];
  for(int i=0;i<n;i++){
    scanf("%d",a+i);
  }
  static long long X[2][100000];
  bool b=0;
  for(int j=0;j<n;j++){
    X[b][j]=-a[j];
  }
  for(int i=2;i<=k;i++){
    slidemin(n,m,X[b],X[!b]);
    for(int j=0;j<n;j++){
      X[!b][j]-=i*a[j];
      //printf("%d %d %lld\n",i,j,X[!b][j]);
    }
    b=!b;
  }
  long long ans=-INF;
  for(int i=0;i<n;i++){
    ans=max(ans,-X[b][i]);
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  int ret = 0;
  for(int i = 0; i < 4; i++){
    if(s[i] == '+') ret++;
    else ret--;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;

int main(){
    int k,x;
    cin >> k>> x;
    for(int i=max(-1000000,x-k+1); i<=min(x+k-1,1000000);i++)
    cout << i << " ";
    cout << endl;
}

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

int main()
{
    int n, r;
    cin >> n >> r;
    if (n >= 10) cout << r << endl;
    else cout << r + 100 * (10 - n) << endl;
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
#define println(X) cout<<X<<endl;
#define DBG(X) cout<<#X<<" : "<<X<<endl;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

const int MAX_PRIME = 1000000;

vector<int> is_prime(MAX_PRIME,1);
vector<int> primes;

void calcPrime(){
	is_prime[0]=is_prime[1]=0;
	for(int i=2; i<MAX_PRIME; i++){
		if(is_prime[i]==1){
			for(int j=i*2; j<MAX_PRIME; j+=i){
				is_prime[j]=0;
			}
			primes.push_back(i);
		}
	}
}
void primeFact(int n, map<int, int>& mp){
	int k = n;
	for(auto& i: primes){
		if(i * i > n) continue;
		while(k > 1 && k % i == 0){
			k /= i;
			mp[i]++;
		}
	}
	if(k > 1) mp[k]++;
}


int main(){
	calcPrime();
	int n;
	cin>>n;
	if(n == 1) {
		cout<<1<<endl;
		return 0;
	}
	map<int, int> mp;
	for(int i = 2; i <= n; i++){
		primeFact(i, mp);
	}
	ll ans = 1LL;
	for(auto& p : mp){
		(ans *= (ll)(p.se+1))%=MOD;
		//cout<<" "<<p.fi<<" "<<p.se<<" "<<ans<<endl;
	}
	cout<<ans<<endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int round = 1;
            string kekka = "";
            int a = int.Parse(input[0].ToString());
            int b = int.Parse(input[1].ToString());
            int c = int.Parse(input[2].ToString());
            int d = int.Parse(input[3].ToString());
            while(true)
            {
                if(round % 2 == 1)
                {
                    c = c - b;
                    if(c <= 0)
                    {
                        break;
                    }
                }
                else
                {
                    a = a - d;
                    if(a <= 0)
                    {
                        break;
                    }
                }
                round++;
            }
            if(a <= 0)
            {
                kekka = "No";
            }
            else
            {
                kekka = "Yes";
            }
            Console.WriteLine(kekka);
            Console.Read();
        }
    }
}


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

int main(){

    int n;
    cin >> n;
    vector<long long int> num(5,0);
    string s;
    for(int i=0; i<n; i++){
        cin >> s;
        if(s.at(0)=='M') num.at(0)++;
        if(s.at(0)=='A') num.at(1)++;
        if(s.at(0)=='R') num.at(2)++;
        if(s.at(0)=='C') num.at(3)++;
        if(s.at(0)=='H') num.at(4)++;
    }

    long long int ans=0;
    for(int i=0; i<3; i++){
        for(int j=i+1; j<4; j++){
            for(int k=j+1; k<5; k++){
                ans+=num.at(i)*num.at(j)*num.at(k);
                //cout << num.at(i) << ' ' << num.at(j) << ' ' << num.at(k) << endl;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define N 2005
#define inf 1000000000
using namespace std;
int i,j,k,l,s,n,m,v[N],a[N],q[N],id[N],ans;
inline bool cmp(int x,int y) {
	return a[x]<a[y];
}
inline void work(int l,int r) {
	if (l>r) return ;
	int s=0;
	for (int i=l;i<=r;i++) q[++s]=i;
	sort(q+1,q+1+s,cmp);
	for (int i=1;i<=s-k+1;i++) v[q[i]]=1;
}
int main() {
	scanf("%d%d%d",&n,&k,&m);
	for (i=1;i<=n;i++) scanf("%d",&a[i]),id[i]=i;
	sort(id+1,id+1+n,cmp);
	ans=inf;
	for (i=1;i<=n;i++) {
		int L=0;
		for (j=1;j<=n;j++) v[j]=0;
		for (j=1;j<=n;j++) 
			if (a[j]<a[i]) work(L+1,j-1),L=j;
		work(L+1,n);
		s=0;
		for (j=1;j<=n;j++) {
			if (v[id[j]]) s++;
			if (s==m) break;
		}
		if (j<=n) ans=min(ans,a[id[j]]-a[i]);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define rep(i,b) for(ll i=0;i<b;i++)
using namespace std;

int main() {
    ll r;
    cin>>r;
    cout<<r*r*3<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n,p;
    scanf("%d",&n);
    
    p=n%10;
    
    if(p==2||p==4||p==5||p==7||p==9)
    {
        
        printf("hon");
    }
    else if(p==0||p==1||p==6||p==8)
    {
        
        printf("pon");
    }
    else if(p==3)
    {
        
        printf("bon");
    }
    return 0;
}

Measured memory_bytes: 1684
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N, P[202020];
vector<int> graph[202020];
int rev[202020];
bool oncyc[202020];
int grundy[202020];

int cgrundy(vector<int> &vec)
{
	sort(vec.begin(), vec.end());

	if (vec.size() == 0) return 0;
	if (vec[0] != 0) return 0;

	for (int i = 0; i < vec.size() - 1; ++i) {
		if (vec[i] + 1 < vec[i + 1]) return vec[i] + 1;
	}
	return vec.back() + 1;
}

int decide(int p)
{
	if (grundy[p] != -1) return grundy[p];
	vector<int> ch;
	for (int q : graph[p]) {
		ch.push_back(decide(q));
	}
	return grundy[p] = cgrundy(ch);
}

bool solve(int p, int v)
{
	for (int i = 0; i < N; ++i) grundy[i] = -1;
	grundy[p] = v;

	for (int i = 0; i < N; ++i) decide(i);

	vector<int> ch;
	for (int q : graph[p]) {
		ch.push_back(decide(q));
	}

	//printf("%d %d\n", v, cgrundy(ch));
	return v == cgrundy(ch);
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) {
		scanf("%d", P + i);
		--P[i];
		graph[P[i]].push_back(i);
		oncyc[i] = false;
	}

	int r = 0;
	for (int i = 0; i < 2 * N; ++i) r = P[r];

	vector<int> cyc;
	int r2 = r;
	do {
		cyc.push_back(r2);
		r2 = P[r2];
	} while (r2 != r);

	for (int p : cyc) oncyc[p] = true;

	for (int i = 0; i < N; ++i) grundy[i] = -1;
	vector<int> ori;
	for (int q : graph[r]) {
		if (!oncyc[q]) {
			ori.push_back(decide(q));
		}
	}

	int low = cgrundy(ori);
	//printf("%d %d\n", r, low);
	bool ret = false;
	ret |= solve(r, low);
	//printf("%d\n", low);
	ori.push_back(low);
	low = cgrundy(ori);
	//printf("%d\n", low);

	ret |= solve(r, low);
	puts(ret ? "POSSIBLE" : "IMPOSSIBLE");

	return 0;
}


Measured memory_bytes: 24692
N=int(input())
a=[0,0,0]
for i in range(N):
    a[0],a[1],a[2] = map(int, input().split())
    a.sort()
    if a[0]**2+a[1]**2 == a[2]**2:
        print("YES")
    else:
        print("NO")


Measured memory_bytes: 5604
//package Round613;

import java.util.Scanner;

/**
 * @author sguar <shugangcao@gmail.com>
 * welcome to kuaishou
 * Created on 2020-01-12
 */
public class Main {
    boolean []ac;
    int [] wa;
    public void run() {
        Scanner cin = new Scanner(System.in);
        int n, m;
        n =  cin.nextInt();
        m = cin.nextInt();
        cin.nextLine();
        ac = new boolean[n + 1];
        wa = new int[n + 1];
        int numberOfAc = 0;
        int numberOfWa = 0;
        for (int i = 0; i < m; i++) {
            int problem = cin.nextInt();
            String answer = cin.nextLine();
            if (answer.charAt(1) == 'A') {
                if (!ac[problem]) {
                    numberOfAc++;
                    ac[problem] = true;
                }
            } else {
                if (!ac[problem]) {
                    wa[problem]++;
                }
            }
        }
        for (int i = 1; i <= n; i++) {
            if (ac[i]) numberOfWa += wa[i];
        }
        System.out.println(numberOfAc + " " + numberOfWa);
    }
    public static void main(String[] args) {
       new Main().run();
    }
}


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

//#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")

#define int long long
typedef pair <int, int> pii;

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	char a;
	cin >> a;
	cout << (char)(a + 1);
}


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

#define repo(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;

int main(){

    int N, M;
    cin >> N >> M;

    vector<int> A(N);
    int sum_vote = 0;
    repo(i,N){
        cin >> A[i];
        sum_vote += A[i];
    }
    
    int count = 0;
    repo(i,N){
        if(A[i] >= sum_vote*(1.0/(4.0*M))){
            count++;
        }
    }
    if(count >= M){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}



Measured memory_bytes: 256
from itertools import product

S = input()
op = list(product(["+","-"],repeat=3))

for i in range(len(op)) :
    calc = S[0]+op[i][0]+S[1]+op[i][1]+S[2]+op[i][2]+S[3]
    if eval(calc) == 7 :
        print(calc+"=7")
        break


Measured memory_bytes: 3060