akhauriyash/Code-Regression huggingface dataset:
# include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)n;i++)
typedef long long ll;

ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            // If divisors are equal, 
            // count only one 
            if (n / i == i) 
                cnt++; 
  
            else // Otherwise count both 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 

int main(){
  ll N;
  cin >> N;
  ll tmp[N+10];
  rep(i,N) tmp[i]=2;
  tmp[1]=1;
  ll res=0;
  for(ll i=2;i<=N/2;i++){
    for(ll j=i+i;j<=N;j=j+i){
      tmp[j]++;
    }
  }
  rep(i,N){
    res += i*tmp[i];
  }
  cout <<res;
  return 0;
}


Measured memory_bytes: 81764
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

int main(void){
	int n=nextint();
	long a=0;
	for(int i=0; i<n-1; i++){
		int u=nextint();
		int v=nextint();
		if(u>v){ int t=u; u=v; v=t; }
		a += (long)u*(n-v+1);
	}
	long b = (long)n*(n+1)*(n+1)/2 - (long)n*(n+1)*(n*2+1)/6;
	printf("%ld\n", b-a);
}


Measured memory_bytes: 1588
/*
 * 2522.cc: Register Phase
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  string s;
  cin >> s;

  int n = s.size();
  bool ok = false;

  if (n >= 6) {
    bool num = false, uc = false, lc = false;
    for (int i = 0; i < n; i++) {
      if (s[i] >= '0' && s[i] <= '9') num = true;
      else if (s[i] >= 'A' && s[i] <= 'Z') uc = true;
      else if (s[i] >= 'a' && s[i] <= 'z') lc = true;
    }
    ok = num && uc && lc;
  }

  cout << (ok ? "VALID" : "INVALID") << endl;
  return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define MOD 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define M 1e6+9
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
#define int long long
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}

// ll n,k,a,b,c,d,x,y,z,m,l;
ll ans;
vecl arr(N);
ll dp[509][509];
ll pre[N];



void test_case() {

    
   string s;
   cin>>s;

   for(int i=0; i<s.size(); i++) {
       cout<<"x";
   }








}


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
    // cin >> t;
    while(t--)
    {   
        test_case();
    }
}


Measured memory_bytes: 3852
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
int  n,q;
int calc(int v,int w){
	if(v==w)return w;
	if(v>w) return calc(w,v);
	return calc(v,(w-1)/n);
}



int main(){
	cin >> n >> q;
	if(n==1){
		for(int i=0;i<q;i++){
			int v,w;
			cin >> v >> w;
			cout << min(v,w) << endl;
		}
	}else{
		for(int i=0;i<q;i++){
			int v,w;
			cin >> v >> w;
			v--;
			w--;
			cout << calc(v,w)+1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1280
from sys import stdin
from itertools import repeat
def main():
    n = int(stdin.readline())
    a = [0] + map(int, stdin.readline().split(), repeat(10, n))
    m = 2 * (n - 1)
    dat = map(int, stdin.read().split(), repeat(10, m))
    j = 0
    xt = [None] * m
    la = [None] * (n + 1)
    deg = [0] * (n + 1)
    if n == 2:
        print "YES" if a[1] == a[2] else "NO"
        return
    for i in xrange(n - 1):
        x, y = dat[j], dat[j+1]
        xt[j+1] = la[x]
        xt[j] = la[y]
        deg[x] += 1
        deg[y] += 1
        la[x] = j + 1
        la[y] = j
        j += 2
    st = []
    pu = st.append
    po = st.pop
    for i in xrange(1, n + 1):
        if deg[i] != 1:
            r = i
            break
    pu(r)
    col = [0] * (n + 1)
    sd = [0] * (n + 1)
    while st:
        x = po()
        if col[x] == 0:
            col[x] = 1
            pu(x)
            y = la[x]
            while y is not None:
                z = dat[y]
                if not col[z]:
                    pu(z)
                y = xt[y]
        elif deg[x] > 1:
            col[x] = 2
            y = la[x]
            ss = 0
            ms = 0
            while y is not None:
                if col[dat[y]] == 2:
                    z = sd[dat[y]]
                    ss += z
                    if ms < z:
                        ms = z
                y = xt[y]
            p = ss - a[x]
            if p < 0 or ss < p * 2:
                print "NO"
                return
            sd[x] = ss - p * 2
            if p > ss - ms:
                print "NO"
                return
        else:
            col[x] = 2
            sd[x] = a[x]
    print "YES" if sd[r] == 0 else "NO"
main()


Measured memory_bytes: 24372
#include <iostream>
using namespace std;
#define MAX 100005
#define NIL -1


struct Node{int p,l,r;};

Node T[MAX];
int n,D[MAX];

void print(int u)
{
    int i,c;
    cout<<"node "<<u<<": ";
    cout<<"parent = "<<T[u].p<<", ";
    cout<<"depth = "<<D[u]<<", ";

    if(T[u].p==NIL)cout<<"root, ";
    else if(T[u].l==NIL)cout<<"leaf, ";
    else cout<<"internal node, ";

    cout<<"[";

    for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r)
    {
        if(i)cout<<", ";
        cout<<c;
    }

    cout<<"]"<<endl;
}

//再帰的に深さを求める
void rec(int u,int p)
{
    D[u]=p;
    if(T[u].r!=NIL)rec(T[u].r,p);//右兄弟にも同じ深さp
    if(T[u].l!=NIL)rec(T[u].l,p+1);//最左の子には深さp+1
}


int main()
{
    int i,j,d,v,c,l,r;
    //全体node数n
    cin>>n;
    for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;

    for(i=0;i<n;i++)
    {
        //vは入力1行に１つのnodeID
        //dは入力1行に１つの次数(子のnode数)
        cin>>v>>d;
        //vの子のindexに相当j=0-->(d-1)
        for(j = 0; j < d ; j++)
        {
            //毎回node vの子c1,c2,...が入ってくる
            cin>>c;
            //(子index)j==0 <--> 子 第1nodeのとき
            if(j==0)T[v].l=c;
            //(深さ)j>=1 <-->　2つ目以降の子node
            //c1以降は右兄弟を次々代入
            else T[l].r=c;
            //うえのelseで使うlへの代入
            //毎回行われ、lはNULL->c1->c2->...と変遷
            l=c;
            //子nodeたちの親は全てv
            T[c].p=v;
        }
    }
    for(i = 0; i < n; i++)
    {
        //全nodeからroot nodeを探索
        if(T[i].p==NIL)r=i;
    }

    //root nodeは見つけたので
    //root nodeの深さ0から全nodeに深さを求める
    rec(r,0);

    for( i = 0; i < n; i++)print(i);

    return 0;
}


Measured memory_bytes: 7672
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, K;
pair<ll, ll> xy[60];
ll x[60];
ll y[60];
const ll inf = ((1ULL << 63) - 1);
ll calc(const ll y1, const ll y2) {
  ll ret = inf;
  assert(y1 < y2);
  vector<ll> p;
  for(int i = 0; i < N; ++i) {
    if (xy[i].second <= y2 && xy[i].second >= y1) p.push_back(xy[i].first);
  }
  sort(p.begin(), p.end());
  if (p.size() < K) return inf;
  for(int i = 0; i + K - 1 < p.size(); ++i) {
    ret = min(ret, (y2 - y1) * (p[i + K - 1] - p[i]));
    
  }

  return ret;
}

int main() {
  cin >> N >> K;
  for (ll i = 0; i < N; ++i) {
    ll a, b;
    cin >> a >> b;
    xy[i] = {a, b};
    x[i] = a;
    y[i] = b;
  }

  sort(xy, xy + N);
  sort(x, x + N);
  sort(y, y + N);
  ll ret = inf;
  for (ll iy1 = 0; iy1 < N; ++iy1) {
    for (ll iy2 = iy1 + 1; iy2 < N; ++iy2) {
      ret = min(ret, calc(y[iy1], y[iy2]));
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] list = new int[n];
		for (int i = 0; i < list.length; i++) {
			list[i] = sc.nextInt();
		}
		
		int cnt = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < list.length; i++) {
			if (min >= list[i]) {
				min = list[i];
				cnt++;
			}
		}
		
		System.out.println(cnt);

	}
}

Measured memory_bytes: 84824
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c,sum = 0;
  cin>>a>>b>>c;
  sum = a+b+c;
  if(sum>=22)
  {
    cout<<"bust";
  }
  else
    cout<<"win";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <map>
const int MOD = 1e9+7;
using namespace std;


int main(){
	int h, a;
	cin >> h >> a;
	cout << (h+a-1)/a << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define INF 1LL << 60
#define LLINF 1e12
#define PI 3.14159265359
#define ALL(a) (a).begin(), (a).end()
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
int ny, nx;
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll m, ll n)
{
    if ((0 == m) || (0 == n))
        return 0;
    return ((m / gcd(m, n)) * n);
}

ll llpow(ll x, ll y)
{
    ll ans = 1;
    REP(i, y)
    ans *= x;
    return ans;
}

ll llmin(ll x, ll y) { return x < y ? x : y; }
ll llmax(ll x, ll y) { return x > y ? x : y; }

unsigned GetDigit(unsigned num) { return to_string(num).length(); }

template <typename Container>
bool exist_in(const Container &c, const typename Container::value_type &v)
{
    return (c.end() != std::find(c.begin(), c.end(), v));
}

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

ll nCr(int n, int r)
{
    if (n == r or n == 0)
        return 1;
    if (n < r)
        return 0;
    if (r == 1)
        return n;
    return nCr(n - 1, r - 1) + nCr(n - 1, r);
}

vector<ll> decom;

void decompositPrime(ll n)
{
    ll a = 2;
    while (n >= a * a)
    {
        if (n % a == 0)
        {
            decom.push_back(a);
            n /= a;
        }
        else
        {
            a++;
        }
    }
    decom.push_back(n);
}

//std::cout << std::defaultfloat << std::setprecision(10);
////////////////////////////////////////

int main()
{

    int N; cin >> N;
    vector<int> A(N), B(N);
    REP(i,N) cin >> A[i] >> B[i];

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    int ans=0;

    if(N%2==1){
        ans = B[N/2] - A[N/2] + 1;
    }else{
        ans = B[N/2-1] + B[N/2] - (A[N/2-1] + A[N/2]) + 1;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4752
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		boolean[] a = new boolean[N + 1];
		Arrays.fill(a, true);
		for (int i = 1; i <= M; i++) {
			a[sc.nextInt()] = false;
		}

		int[] ans = new int[N + 1];
		ans[0] = 1;
		ans[1] = 1;

		for (int i = 2; i <= N; i++) {
			ans[i] = 0;
			if (a[i - 2]) {
				ans[i] += ans[i - 2];
				ans[i] %= 1000000007;
			}
			if (a[i - 1]) {
				ans[i] += ans[i - 1];
				ans[i] %= 1000000007;
			}

		}

		out.println(ans[N]);

		sc.close();

	}

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

}


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

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::min;

fn main() {
    input!{
        n: usize,
        k: usize,
        v: [i64; n]
    }
    let mut tab: Vec<usize> = vec![0; n];
    for i in 1..n {
        let mut m = usize::max_value();
        for j in 1..min(k, i) + 1 {
            m = min(m, tab[i - j] + (v[i] - v[i - j]).abs() as usize);
        }
        tab[i] = m;
    }
    println!("{}", tab[n - 1]);
}


Measured memory_bytes: 6396
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vvl DP = VVL(10, 10, 0);
  FOR(i, 1, N + 1) {
    string S = to_string(i);
    // cout << S[0] << "," << S[S.size() - 1] << endl;
    DP[S[0] - '0'][S[S.size() - 1] - '0']++;
  }
  ll ans = 0;
  FOR(i1, 1, 10) FOR(i2, 1, 10) { ans += DP[i1][i2] * DP[i2][i1]; }
  cout << ans << endl;
  return 0;
}


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

int main(void)
{
    long a, c=0, x1=0, x2=0, x11=0, x22=0;
    cin >> a;
    if(a < 5)
    {
        cout << "0" << endl;
        return 0;
    }
    if(a >= 500)
    {
        x1 = a/500;
        x11 = x1*1000;
        c += x11;
        a -= (x1*500);
    }
    if(a >= 5)
    {
        x2 = a/5;
        x22 = x2*5;
        c += x22;
    }
    cout << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	long a[50], b[50], c[50], d[50];
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	for (int i = 0; i < m; i++)
		cin >> c[i] >> d[i];
	long ans[50];
	for (int i = 0; i < n; i++)ans[i] = 999999999;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			ans[i] = min((abs(a[i] - c[j]) + abs(b[i] - d[j])),ans[i]);
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (ans[i] == abs(a[i] - c[j]) + abs(b[i] - d[j])) {
				ans[i] = j + 1;
				break;
			}
		}
	}
	for (int i = 0; i < n; i++)
		cout << ans[i] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
#include<stdio.h>
using namespace std;

int main() {
	char N[5];
	cin >> N;
	int A = 0;
	for (int i = 0; i < 2; i++) {
		if (N[i] == N[i + 1]) {
			if (N[i + 1] == N[i + 2]) {
				A++;
			}
		}
	}
	if (A >= 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  long n,ii;
  vector<long> vec;
  cin >> n;
  vec.resize(n);

  for(ii=0;ii<n;ii++){
	cin >> vec[ii];
  }
  map<long,long> map1,map2;

  for(ii=0;ii<n;ii+=2){
	if(map1.find(vec[ii]) == map1.end()){
	  map1[vec[ii]] = 1;
	}
	else{
	  map1[vec[ii]] += 1;
	}

	if(map2.find(vec[ii+1]) == map2.end()){
	  map2[vec[ii+1]] = 1;
	}
	else{
	  map2[vec[ii+1]] += 1;
	}
  }
//  for(auto pair : map1){
//	cout << "key" <<  pair.first << "val" << pair.second << endl;
//  }
//
//  for(auto pair : map2){
//	cout << "key" <<  pair.first << "val" << pair.second << endl;
//  }
//  cout << "count:" << map1.count(vec[0]) << endl;
  if(map1[vec[0]] == n/2 && map2[vec[1]] == n/2){
	if(vec[0] != vec[1]){
	  cout << "0" << endl;
	}
	else{
	  cout << n/2 << endl;
	}
  }
  else{
	pair<long,long> max1_1,max1_2;
	pair<long,long> max2_1,max2_2;

	max1_1.second = 0;
	max1_2.second = 0;
	max2_1.second = 0;
	max2_2.second = 0;
  
	for(auto pair : map1){
	  if(pair.second > max1_1.second){
		max1_2.first = max1_1.first;
		max1_2.second = max1_1.second;
		max1_1.first = pair.first;
		max1_1.second = pair.second;
	  }
	  else if(pair.second > max1_2.second){
		max1_2.first = pair.first;
		max1_2.second = pair.second;
	  }
	}

	for(auto pair : map2){
	  if(pair.second >= max2_1.second){
		max2_2.first = max2_1.first;
		max2_2.second = max2_1.second;
		max2_1.first = pair.first;
		max2_1.second = pair.second;
	  }
	  else if(pair.second > max2_2.second){
		max2_2.first = pair.first;
		max2_2.second = pair.second;
	  }
	}

	if(max1_1.first != max2_1.first){
	  cout << (n/2 - max1_1.second) + (n/2 - max2_1.second) << endl;
	}
	
	else{
	  long m1221,m1122,m1222;

	  m1221 = max1_2.second + max2_1.second;
	  m1122 = max1_1.second + max2_2.second;
	  m1222 = max1_2.second + max2_2.second;
	  if(m1221 >= m1122 && m1221 >= m1222){
		cout << (n/2 - max1_2.second) + (n/2 - max2_1.second) << endl;
	  }
	  
	  else if(m1122 >= m1221 && m1122 >= m1222){
		cout << (n/2 - max1_1.second) + (n/2 - max2_2.second) << endl;
	  }
	  else{
		cout << (n/2 - max1_2.second) + (n/2 - max2_2.second) << endl;
	  }
	}
  }


  
  return 0;
}


Measured memory_bytes: 7296
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
vector<vector<ll>> g(200005);
vector<ll> cnt(200005,0);
vector<bool> done(200005,0);
void dfs(ll v){
    done[v] = 1;
    for (ll u:g[v]){
        if (done[u]) continue;
        cnt[u] += cnt[v];
        dfs(u);
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,c = 0;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
        c += a[i];
    }
    vector<ll> use;
    rep(i,1,(ll)sqrt(c)+1){
        if (c%i == 0){
            use.push_back(i);
            use.push_back(c/i);
        }
    }
    RSORT(use);
    rep(i,use.size()){
        ll cnt = 0,p = 0;
        vector<ll> plus,minus;
        rep(j,n){
            ll l = a[j]%use[i];
            if (l <= use[i]-l){
                cnt += l;
                p -= l;
                plus.push_back(use[i]-2*l);
            }
            else{
                cnt += use[i]-l;
                p += use[i]-l;
                minus.push_back(use[i]-2*(use[i]-l));
            }
        }
        if (p > 0){
            p /= use[i];
            SORT(minus);
            rep(j,p){
                cnt += minus[j];
            }
        }
        if (p < 0){
            p = abs(p)/use[i];
            SORT(plus);
            rep(j,p){
                cnt += plus[j];
            }
        }
        if (cnt/2 <= k){
            PRINT(use[i]);
            return 0;
        }
    }
}




Measured memory_bytes: 6528
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
const int N = (int)(1e6) + 5;
int tr[N][2];
int h[N];
int SZ = 0;
int main(void)
{
    int n;
    ll l;
    cin>>n>>l;
    memset(tr,-1,sizeof(tr));
    while (n --)
    {
        string str;
        cin>>str;
        int cnt = 0;
        for (auto it : str)
        {
            int to = it - '0';
            if (tr[cnt][to] == -1)
                tr[cnt][to] = ++SZ,h[SZ] = h[cnt] + 1;
            cnt = tr[cnt][to];
        }
    }
    vector < ll > ss;
    for (int i = 0;i <= SZ;++i)
    {
        int xx = min(tr[i][0],tr[i][1]);
        int yy = max(tr[i][0],tr[i][1]);
        if (xx == -1 && yy > -1)
            ss.pb(l - h[i]);
    }
    ll ans = 0;
    for (auto it : ss)
    {
        int cnt = 0;
        while (!(it % (1ll << (cnt + 1))))
            ++cnt;
        ans ^= 1ll << cnt;
    }
    puts(ans ? "Alice" : "Bob");
    return 0;
}


Measured memory_bytes: 11512
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

const int MOD=1000003;
int N,M;
vector<vector<int> > L;
int ans=0;
map<pair<int,int> ,int> memo;


long long calc(int start,int end){
//	cout<<"do "<<start<<" "<<end<<endl;
	if((end-start)%2==0) return 0;
	if(start>end) return 1;
	if(memo.count(make_pair(start,end))) return memo[make_pair(start,end)];
	long long res=1;

	int now=start;
	if(L[now].size()==0){
		while(now<=end && L[now].size()==0) now+=2;
		return calc(now,end);
	}
	else{
		res=0;
		for(int k=0;k<L[now].size();k++){
			long long ans1=calc(now+1,L[now][k]-1),ans2=1;
			if(L[now][k]+1<end) ans2=calc(L[now][k]+1,end);
			res+=(ans1*ans2)%MOD;
			res%=MOD;
		}
	}
	res+=calc(now+2,end);
	res%=MOD;
	memo[make_pair(start,end)]=res;
//	cout<<"res "<<start<<" "<<end<<" :"<<res<<endl;
	return res%MOD;
}

int main()
{
	while(cin>>N>>M && N!=0){
		memo.clear();
		L.clear();
		L.resize(N,vector<int>());

		for(int i=0;i<M;i++){
			int in,out;cin>>in>>out;
			in--;out--;
			if(in<out)
				L[in].push_back(out);
			else
				L[out].push_back(in);
		}
		for(int i=0;i<N;i++){
			sort(L[i].begin(),L[i].end());
			L[i].erase(unique(L[i].begin(),L[i].end()),L[i].end());
		}
		cout<<(calc(0,N-1)+calc(1,N-2))%MOD<<endl;
	}
}

Measured memory_bytes: 8140
using System;


class Program {
    static void Main (string[] args) {
        

        string[] a1 = Console.ReadLine ().Split (' ');
        int a = int.Parse(a1[0]);
        int b = int.Parse(a1[1]);
        int rtn = 0;

        if(b == 1){
            rtn = 0;
        }else{
            rtn = a- b;
        }

        Console.WriteLine(rtn);
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
const int N = 1e6 + 5;
const int inf = 2e9;
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vi;

vi up(vi& a){
    int n = a.size(); vi b = a;
    for (int i = n >> 1; i != 0; i >>= 1) for (int j = 0; j < n; j++) if (j&i) {
        priority_queue <int> mq;
        mq.push(b[j].first);
        mq.push(b[j-i].first);
        mq.push(b[j].second);
        mq.push(b[j-i].second);
        b[j].first = mq.top(); mq.pop();
        b[j].second = mq.top(); mq.pop();
    }
    return b;
}

vi a;

int n, ans[N];

int main(){
    cin >> n;
    a.resize(1 << n);
    for (int i = 0; i < (1 << n); i++){
        int x;
        cin >> x;
        a[i].first = x;
        a[i].second = -inf;
    }
    a = up(a);
    for (int i = 0; i < (1 << n); i++){
        ans[i] = max(ans[i-1], a[i].first + a[i].second);
    }
    for (int i = 1; i < (1 << n); i++) cout << ans[i] << "\n";
}


Measured memory_bytes: 6140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int Maxn = 1000005;
 
int t;
int n, a, b;
int seq[Maxn], slen;
 
int main()
{
    scanf("%d %d %d", &n, &a, &b);
    if (a + b - 1 > n || ll(a) * b < n) printf("-1\n");
    else {
      slen = 0;
      int cur = 1;
      int lft = n - a;
      for (int i = 1; i <= a; i++) {
        int tk = min(lft, b - 1); lft -= tk;
        tk++;
        cur += tk;
        for (int j = cur - 1; j >= cur - tk; j--)
          seq[slen++] = j;
      }
      for (int i = 0; i < slen; i++)
        printf("%d%c", seq[i], i + 1 < slen? ' ': '\n');
    }
}

Measured memory_bytes: 3328
n, x = input().split()
n = int(n)
x = int(x)
m = []
i_min = 0
result = 0
#リストに値を読み込み
for i in range(n):
  m.append(int(input()))
#一個ずつ作る
for i in range(len(m)):
  x = x - m[i]
  result = result + 1
#最小量の粉量を確定
for i in range(len(m)):
  if m[i_min] > m[i]:
    i_min = i
#i_minを作れるだけ作る
for i in range(x):
  if x >= m[i_min]:
    x = x - m[i_min]
    result = result + 1
  else:
    break
#結果の表示
print(result)

Measured memory_bytes: 3064
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        int[] siblings = Enumerable.Repeat(-1, n).ToArray();
        int[] parents = Enumerable.Repeat(-1, n).ToArray();
        List<int>[] childs = Enumerable.Repeat(0, n).Select(_ => new List<int>()).ToArray();
        for (int i = 0; i < n; i++)
        {
            var data = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var id = data[0];
            var l = data[1];
            var r = data[2];
            for (int _ = 0; _ < 2; _++)
            {
                if (l != -1)
                {
                    siblings[l] = r;
                    parents[l] = id;
                    childs[id].Add(l);
                }
                { var tmp = l; l = r; r = tmp; }
            }
        }

        int[] depths = new int[n];
        int[] heights = new int[n];
        Action<int> dfs = null;
        dfs = node =>
        {
            foreach (var item in childs[node])
            {
                depths[item] = depths[node] + 1;
                dfs(item);
                heights[node] = Max(heights[node], heights[item] + 1);
            }
        };
        dfs(Array.IndexOf(parents, -1));
        for (int i = 0; i < n; i++)
        {
            var degree = childs[i].Count;
            Console.WriteLine($"node {i}: parent = {parents[i]}, sibling = {siblings[i]}, degree = {degree}, depth = {depths[i]}, height = {heights[i]}, {(parents[i] == -1 ? "root" : degree == 0 ? "leaf" : "internal node")}");
        }
    }
}


Measured memory_bytes: 18540
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxV = 90010;
const int maxN = 2e5+10;
const int MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
const int inf = 1e9+10;
#define X first;
#define Y second;

ll c[maxN];

int main() {
	int x,y;
	scanf("%d %d",&x,&y);
	if(x<=9 && y<=9)
	{
		printf("%d\n",x*y);
	}
	else
	{
		puts("-1");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int x, y;
  cin >> x >> y;
  rep(i, x+1){
    if(2*i+4*(x-i)==y){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <cstdlib>

using namespace std;

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

const long long INF = 1LL << 60;

long long h[100010];
long long dp[100010];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> h[i];
	for (int i = 0; i < n + 1; i++) dp[i] = INF;
	dp[0] = 0;

	for (int i = 1; i < n; i++) {
		chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
		if (i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));

	}
	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i, n) cin >> p[i];
	int ans = 0;
	int tmp[3];
	int diff;
	for (int i = 1; i <= n-2; ++i) {
		tmp[0] = p[i - 1];
		tmp[1] = p[i];
		tmp[2] = p[i + 1];
		diff = p[i];
		sort(tmp, tmp + 3);
		if (diff > tmp[0] && diff < tmp[2]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
int main(){
 int in;
 int h=0,m=0,s=0;
 scanf("%d",&in);
 
 while(in>=3600){
 in -= 3600;
 h += 1;
 }

 while(in>=60){
 in -= 60;
 m += 1;
 }

 s = in;
 
 printf("%d:%d:%d\n",h,m,s);
}

Measured memory_bytes: 1020
use proconio::{input, marker::Usize1};

fn main() {
    input! {
        n: usize,
        k: usize,
        pp: [Usize1; n],
        cc: [i64; n],
    }
    let mut ans = None;
    
    for i in 0..n {
        let mut index = i;
        let mut cycle_sum = 0;
        let mut cycle_count = 0;
        loop {
            index = pp[index];
            cycle_sum += cc[index];
            cycle_count += 1;
            if index == i {
                break;
            }
        }

        let mut sum = 0;
        let mut count = 0;
        for _ in 0..std::cmp::min(k, cycle_count) {
            index = pp[index];
            sum += cc[index];
            count += 1;

            let sum = if cycle_sum > 0 {
                let n = (k - count) / cycle_count;
                cycle_sum * n as i64 + sum
            } else {
                sum
            };
            if let Some(ans) = ans.as_mut() {
                *ans = std::cmp::max(*ans, sum);
            } else {
                ans = Some(sum);
            }
        }
    }

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


Measured memory_bytes: 2340
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int func(long long int k){
  string s = to_string(k);
  int tmp = 0;
  for(int i=0; i<s.size(); i++){
    tmp += s[i]-'0';
  }
  return tmp;
}

int main(){

  long long int k; cin >> k;

  long long int n = 1;
  long long int d = 1;
  cout << 1 << endl;
  for(long long int i=1; i<k; i++){
    if( func(n+d)*(n+d*10) < func(n+d*10)*(n+d) ) d *= 10;
    n += d;
    cout << n << endl;
  }

  return 0;
}



//


Measured memory_bytes: 256
x = input()
s_q = []
arc = []
for i, v in enumerate(x):
    if v == 'S':
        s_q.append(v)
    else:
        if len(s_q) > 0:
            s_q.pop()
        else:
            arc.append(v)
print(len(s_q)+len(arc))



Measured memory_bytes: 5096
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 998244353

A, B, C, D = MAP()

dp = [[0]*(D+1) for _ in range(C+1)]
dp[A][B] = 1

for i in range(A, C+1):
    for j in range(B, D+1):
        if j > B:
            dp[i][j] += dp[i][j-1] * i
        if i > A:
            dp[i][j] += dp[i-1][j] * j
        if A < i and B < j:
            dp[i][j] -= (i-1) * (j-1) * dp[i-1][j-1]
        dp[i][j] %= mod

print(dp[C][D])


Measured memory_bytes: 144476
def sortcounts(c: dict):
    a = [(v, k) for k, v in c.items()]
    return sorted(a, reverse=True)


def solve(a):
    m = len(a)//2

    o = [a[i] for i in range(len(a)) if i%2==0]
    e = [a[i] for i in range(len(a)) if i%2==1]

    # print(o)
    # print(e)

    import collections
    co = sortcounts(collections.Counter(o))
    ce = sortcounts(collections.Counter(e))

    # print(co)
    # print(ce)

    no, vo = co[0]
    ne, ve = ce[0]

    if vo != ve:
        ans = (m-no) + (m-ne)
    else:
        anse = (m-no) + m-(0 if len(co)<2 else co[1][0])
        anso = (m-ne) + m-(0 if len(ce)<2 else ce[1][0])
        ans = min(anse, anso)

    return ans


def main():
    _=input()
    a = list(map(int, input().split()))
    print(solve(a))


if __name__ == '__main__':
    main()






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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    int res = 0;
    cin >> n;
    vector<int> a;
    rep (i, n) {
        int x;
        cin >> x;
        a.push_back(--x);
    }
    rep (i, n) if (i == a[a[i]]) res++;
    cout << res / 2 << endl;
    
    return 0;
}



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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            int D = int.Parse(input[0]);
            int X = int.Parse(input[1]);
            
            int ans = 0;
            
            for(int i = 0 ; i < N ; i++)
            {
                int A = int.Parse(Console.ReadLine());
                for(int j = 0 ; j < D ; j += A)
                {
                    ans++;
                }
            }
            
            Console.WriteLine(ans+X);
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long ll;


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


int main() {
    string s;
    cin >> s;
    string zero="", one="";
    for (int i = 0; i < (int)s.size(); i++) {
        if (i % 2 == 0) {
            zero += "0";
            one += "1";
        }
        else {
            zero += "1";
            one += "0";
        }
    }
    int zerone = 0;
    int onezero = 0;
    for (int i = 0; i < (int)s.size(); i++) {
        if (s[i] != zero[i]) zerone++;
        if (s[i] != one[i]) onezero++;
    }
    cout << min(zerone, onezero) << endl;
}


Measured memory_bytes: 3912
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(){
	int N;
	cin >> N;
	bool flag = false;
	while(N > 0){
		 if(N % 10 == 7){
			 flag = true;
			 break;
		 }
		 N /= 10;
	}
	if(flag){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
}

Measured memory_bytes: 3612
import itertools
import bisect
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_acc = [0] + list(itertools.accumulate(a))
b_acc = [0] + list(itertools.accumulate(b))
ans = 0

for i in range(n+1):
    if k - a_acc[i] >= 0:
        ans = max(ans, i + bisect.bisect(b_acc, k - a_acc[i])-1)
print(ans)


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n, m, x;

li c[22];
li a[22][22];

int main() {
    cin >> n >> m >> x;
    rin{
        cin >> c[i];
        rep(j, m) {
            cin >> a[i][j];
        }
    }

    li res = INF;
    rep(i, bit(n)) {
        bitset<22> bs(i);
        vector<li> tmp(m, 0);
        li tc = 0;
        rep(j, n) {
            if (bs[j]) {
                rep(k, m) {
                    tmp[k] += a[j][k];
                }
                tc += c[j];
            }
        }
        bool ok = true;
        rep(j, m) {
            if (tmp[j] < x) {
                ok = false;
                break;
            }
        }
        if (ok) {
            res = min(res, tc);
        }
    }

    cout << (res == INF ? -1 : res) << endl;



    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define eall(a) a.begin()+1, a.end()
#define show(ans)  cout << ans << endl;


int main(){long D; string s;
cin >> D;
if(D == 25){
    s = "Christmas";
}
else if(D == 24){
    s = "Christmas Eve";
}
else if(D == 23){
    s = "Christmas Eve Eve";
}
else if(D == 22){
    s = "Christmas Eve Eve Eve";
}
cout << s << endl;
return 0;
}

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


int main(){
    int a,b;
    cin>>a>>b;
    cout << fixed << setprecision(5);
	cout << a / b << " " << a%b << " " << (double)a / b << endl;
    
     return 0;
}



Measured memory_bytes: 3280
/*
  -------------
  Prateek Celly
  DA-IICT
  -------------
*/
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define MOD 1000000007

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n,a,b;
  cin>>n;
  ll sum=0;
  pair<ll,ll> p[n];
  for(ll i=0;i<n;i++){
    cin>>p[i].ss>>p[i].ff;
  }
  sort(p,p+n);
  for(ll i=0;i<n;i++){
    sum+=p[i].ss;
    if(sum>p[i].ff) {cout<<"No"; return 0;}
  }
  cout<<"Yes";
  return 0;
}


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

void main_()
{
    ll N;
    cin >> N;
    vector<ll> Ts;
    Ts.reserve(N);
    copy_n(istream_iterator<ll>(cin), N, back_inserter(Ts));

    auto ans = accumulate(begin(Ts), end(Ts), 1L, [](auto acc, auto n) { return acc / __gcd(acc, n) * n; });
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
short=0
ans=0
li=[]
if sum(a)<sum(b):
  print(-1)
  exit()
for i in range(n):
    if a[i]>b[i]:
        li.append(a[i]-b[i])
    elif a[i]<b[i]:
        short+=b[i]-a[i]
        ans+=1
li.sort(reverse=True)
i=0
while short>0:
    short-=li[i]
    i+=1
print(ans+i)
    
    

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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

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

    string s; cin >> s >> s;
    cout << "A" << s[0] << "C" << endl;
}


Measured memory_bytes: 256