akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A = [int(input()) for i in range(N)]
A = sorted(A)
h = N // 2
if N % 2 == 0:
    ans = sum(A[h:])*2 - sum(A[:h])*2 - A[h] + A[h-1]
else:
    ans1 = sum(A[h+1:])*2 - sum(A[:h+1])*2 + (A[h-1] + A[h])
    ans2 = sum(A[h:])*2 - sum(A[:h])*2 - (A[h] + A[h+1])
    ans = max(ans1, ans2)
print(ans)

Measured memory_bytes: 14156
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')

n = list(input())
n1 = int(n[-1])

if n1 == 2 or n1 == 4 or n1 == 5 or n1 == 7 or n1 == 9:
    print('hon')
elif n1 == 0 or n1 == 1 or n1 == 6 or n1 == 8:
    print('pon')
else:
    print('bon')


Measured memory_bytes: 68488
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
using namespace std;
using ll = long long;
int main(){
  int k;
  cin >> k;
  queue<ll> que;
  for(int i = 0; i < 9; i++){
    que.push(i + 1);
  }
  for(int i = 0; i < k - 1; i++){
    ll tmp = que.front();
    que.pop();
    ll in = (ll)tmp * 10 + tmp % 10;
    if(tmp % 10 != 0){
      que.push(in - 1);
    }
    que.push(in);
    if(tmp % 10 != 9){
      que.push(in + 1);
    }
    
    
  }
  cout << que.front() << endl;
  return 0;
}

Measured memory_bytes: 1792
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>
#include <limits>

#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--)

using namespace std;
//エイリアス
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

//定数
const int intmax = numeric_limits<int>::max();
const ll llmax = numeric_limits<ll>::max();
const ll mod = 1e9 + 7;
const double pi = M_PI;

int main()
{
  int n, m;
  cin >> n >> m;
  vector<vector<int>> graph(n, vector<int>());
  rep(i, m) {
    int a, b; 
    cin >> a >> b;
    graph[a - 1].push_back(b - 1);
    graph[b - 1].push_back(a - 1);
  }

  v parents(n, -1);

  auto bfs = [&](){
    queue<int> q;
    vector<bool> flag(n, false);
    q.push(0);
    flag[0] = true;
    while(!q.empty()) {
      int cur = q.front();
      q.pop();
      for(int i = 0; i < graph[cur].size(); i++) {
        int next = graph[cur][i];
        if(flag[next]) continue;
        q.push(next);
        flag[next] = true;
        parents[next] = cur;
      }
    }
  };
  bfs();
  cout << "Yes" << endl;
  rep(i, n - 1) cout << parents[i + 1] + 1 << endl;
}


Measured memory_bytes: 10148
array_size = gets(chomp:true).to_i
  array = gets.split.map(&:to_i)

  elm_cnt = Array.new(array.max + 1){0}
  ans_arr = []

  # 出現回数計算
  array.each do | arr_elm |
    elm_cnt[ arr_elm ] += 1
  end

  # 累積和計算
  elm_cnt.each_with_index do | elem, idx |
    elm_cnt[idx] += elm_cnt[idx - 1] if idx > 0
  end

  # 出力
  array.reverse_each do | arr_elm |
    ans_arr[ elm_cnt[ arr_elm ] - 1 ] = arr_elm
    elm_cnt[ arr_elm ] -= 1
  end

  puts ans_arr.join(" ")



Measured memory_bytes: 153084
n = gets.strip.to_i
a = gets.strip.split.map(&:to_i)
b = gets.strip.split.map(&:to_i)

# 累積和の配列を作成
a_r = []
b_r = []
a_r[0] = 0
b_r[0] = 0
(2..n+1).each do |i|
  a_r[i-1] = a_r[i-2] + a[i-2]
  b_r[i-1] = b_r[i-2] + b[i-2]
end

# 組み合わせを全て見ていく
max = 0
(1..n).each do |i|
  candy = ( a_r[i] - a_r[0] ) + ( b_r[n] - b_r[i-1] )
  max = candy if max < candy
end
puts max

Measured memory_bytes: 1788
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


const int N=300005;
ll dp[N];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,d,a;
    cin>>n>>d>>a;
    vector<pair<ll,ll>>v;
    for(int i=0;i<n;i++){
        ll b,c;
        cin>>b>>c;
        v.push_back({b,c});
    }
    sort(v.begin(),v.end());
    ll res=0;
    int j=0;
    for(int i=0;i<n;i++){
        while(j<n&&v[j].first-v[i].first<=2*d)j++;
        ll ans=max((v[i].second-dp[i]*a+a-1)/a,0ll);
        res+=ans;
        dp[i]+=ans;
        dp[j]-=ans;
        dp[i+1]+=dp[i];
    }
    cout<<res<<endl;
    return 0;
    }


Measured memory_bytes: 6256
#include <stdio.h>

int main(void)
{
	int i, n;
	double buy, avr = 0.0;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%lf", &buy);
		
		avr += buy / n * 1.0;
	}
	
	printf("%.0lf\n", avr);
	
	return (0);
}

Measured memory_bytes: 656
import java.util.*;
public class Main {

    public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            int a = sc.nextInt();
            int ct =0;
            for (int i =0;i<10;i++){
                for (int j =0;j<10;j++){
                    for (int k =0;k<10;k++){
                        for (int l=0;l<10;l++){
                            if (i+j+k+l==a){
                                ct++;
                            }
                        }

                    }
                }
            }
            System.out.println(ct);
        }

    }
}

Measured memory_bytes: 18856
#include <iostream>
#include <vector>
using namespace std;
int main(){
    long long S;
    cin >> S;
    long long MAX = 1e9;
    long long X1 = 0, Y1 = 0, X2 = MAX, Y2 = 1, X3, Y3;
    X3 =  ((- S) % MAX + MAX) % MAX;
    Y3 = (S + X3) / MAX;
    printf("%lld %lld %lld %lld %lld %lld\n", X1, Y1, X2, Y2, X3, Y3);
}

Measured memory_bytes: 3764
//abc057_d.cpp
//Mon Apr  8 21:30:59 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n,a,b;
	cin >> n >> a >> b;

	double v[n];
	unordered_map <ll,ll> mp;
	for (int i=0;i<n;i++){
		cin >> v[i];
		auto itr = mp.find(v[i]);
		if(itr != mp.end()) {
			mp[v[i]]++;
		}else {
			mp[v[i]] = 1;
		}
	}

	sort(v,v+n);
	reverse(v,v+n);

	double sum = 0.0;
	double ave = 0.0;
	double count = 1.0;
	ll samenum = 0;
	ll patterns = 0;
	for (int i=0;i<a;i++){
		sum += v[i];
		if (i==0 || v[i-1] != v[i]){
			samenum = 1;
		}else {
			samenum++;
		}
	}
	ave = sum/a;

	ll left = mp[v[a-1]];
	ll right = samenum;
	ll temp = 1;
	ll righttemp = 1;
	for (int x=left;x>left-right;x--){
		temp = temp*x/righttemp;
		righttemp++;
	}
	patterns = temp;

	for(int i=a;i<b;i++){
		if (v[0]==v[a-1] && v[a-1]==v[i]){
			samenum++;
				ll left = mp[v[a-1]];
				ll right = samenum;
				ll temp = 1;
				ll righttemp = 1;
				for (int x=left;x>left-right;x--){
					temp = temp*x/righttemp;
					righttemp++;
				}
				patterns += temp;
		}else{
			break;
		}
	}

//		printf("%.6f\t%.1f\t%.1f\n",sum/count,v[i],count);
//		count++;
//	}

	printf("%.6f\n",ave);
	cout << patterns << endl;
}

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

int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  while(true){
  	C -= B;
    if(C <= 0){
      cout << "Yes" << endl;
      break;
    }
    A -= D;
    if(A <= 0){
      cout << "No" << endl;
      break;
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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; }
const ll MOD = 1e9+7;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
    }

    ll idx = 1;
    REP(i,N){
        ll a = A[i];
        if(a == idx)
            idx++;
    }

    ll ans = N - idx + 1;

    if(ans == N){
        cout << -1 << endl;
    }
    else{
        cout << ans << endl;
    }
    return 0;
}


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

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int>a(n);
  for(auto &e:a) cin >> e;
  sort(a.begin(), a.end());
  
  int cnt = 0;
  int num = 1;
  for(int i = 1; i < n; ++i)
  {
    if(a[i] == a[i - 1])
    {
      num++;
    }
    else
    {
      if(a[i - 1] > num)
        cnt += num;
      else
        cnt += num - a[i - 1];
      num = 1;
    }
  }
  if(a[n - 1] > num)
    cnt += num;
  else
    cnt += num - a[n - 1];
  
  cout << cnt << endl;
  
  return 0;
}

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

int main() {
	int arr[5];
	for(int i=0;i<5;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<5;i++)
	{
		if(arr[i]==0)
			cout<<i+1<<endl;
	}
}

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

int lis(const vector<int>& xs)
{
    set<int> s;
    for (const int x : xs)
    {
        s.insert(x);
        const auto it = s.upper_bound(x);
        if (it != s.end())
            s.erase(it);
    }
    return int(s.size());
}

int main()
{
    cout << setprecision(15) << fixed;

    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    if (x1 > x2)
    {
        swap(x1, x2);
        swap(y1, y2);
    }

    const bool flipped = y1 > y2;
    if (flipped)
        y1 = -y1, y2 = -y2;

    const double path_length = 100.0*((x2-x1) + (y2-y1));
    const double extra = 2*(20*atan(1) - 10);
    const double savings = 20 - 20*atan(1);

    int N;
    cin >> N;

    struct Point { int x, y; };
    vector<Point> points;
    for (int i = 0; i < N; i++)
    {
        int X, Y;
        cin >> X >> Y;

        if (flipped) Y = -Y;

        if (x1 <= X && X <= x2 && y1 <= Y && Y <= y2)
            points.push_back({X, Y});
    }

    if (x1 == x2 || y1 == y2)
    {
        assert(points.size() <= 1);
        cout << + path_length + (points.size() == 1) * extra << endl;
        exit(0);
    }

    const auto compare = [](const Point a, const Point b)
    {
        assert(a.x != b.x);
        return a.x < b.x;
    };
    sort(begin(points), end(points), compare);

    vector<int> ys;
    for (const Point p : points)
        ys.push_back(p.y);
    const int fountains_reached = lis(ys);

    double total = path_length - fountains_reached*savings;
    if (fountains_reached == min(x2-x1+1, y2-y1+1))
    {
        total += savings;
        total += extra;
    }
    cout << total << endl;
}


Measured memory_bytes: 12016
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<stack>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	int N;
	cin >> N;
	cout << pow(N,3) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> l(n);
  rep(i,n) cin >> l[i];
  
  sort(l.begin(),l.end(),greater<int>());
  
  int ans = 0;
  rep(i,k) ans += l[i];
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#define MAXN 12
using namespace std;

typedef long long int lli;

int N, M, X, C[MAXN], A[MAXN][MAXN], U[MAXN], ans = -1;
void dfs(int idx, int money){
    if(idx == N){
        bool pos = true;
        for(int j = 0; j < M; ++j){
            if(U[j] < X){
                pos = false;
                break;
            }
        }
        if(pos){
            if(ans == -1 || ans > money)
                ans = money;
        }
        return;
    }
    dfs(idx + 1, money);
    
    for(int j = 0; j < M; ++j)
        U[j] += A[idx][j];
    dfs(idx + 1, money + C[idx]);
    for(int j = 0; j < M; ++j)
        U[j] -= A[idx][j];
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> M >> X;
    for(int j = 0; j < N; ++j){
        cin >> C[j];
        for(int i = 0; i < M; ++i)
            cin >> A[j][i];
    }
    dfs(0, 0);
    cout << ans;
    return 0;
}

Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    String alphabet = "abcdefghijklmnopqrstuvwxyz";
    String name = "";
    while(n > 0){
      n--;
      long remain = n % 26l;
      name = alphabet.charAt((int)remain) + name;
      n = n / 26l;
    }
    System.out.println(name);
  }
}

Measured memory_bytes: 39200
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;
	cin >> n;
	ll sum=0;
	rep(i,1,n+1){
		if(i%3==0||i%5==0){
			continue;
		}
		sum+=1ll*i;
	}
	cout<<sum<<endl;
	return 0;
}



Measured memory_bytes: 3652
while True:
    m,f,r = [int(x) for x in input().split()]
    if (m,f,r)==(-1,-1,-1): break
    s_mf = m + f
    if   m < 0 or f < 0: mark = 'F'
    elif s_mf <  30:     mark = 'F'
    elif s_mf >= 80:     mark = 'A'
    elif s_mf >= 65:     mark = 'B'
    elif s_mf >= 50:     mark = 'C'
    elif r    >= 50:     mark = 'C'
    else:                mark = 'D'
    print(mark)

Measured memory_bytes: 7692
a = int(input())
b = []
c = ""
x = 0
for i in range(a):
    c = input().split()
    if c[0] == c[1]:
        x = x + 1
    else:
        x = 0
    if x >= 3:
        print("Yes")
        exit()
if x <= 3:
    print("No")

Measured memory_bytes: 9104
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

struct magic {
	int A, B;
	double C;
	bool operator < (const magic& b) const {
		return C > b.C;
	}
};
magic M[100010];
int dp[100010];
int main()
{
	int H, N;
	cin >> H >> N;
	for (int i = 0; i < N; i++) {
		cin >> M[i].A >> M[i].B;
	}
	dp[0] = 0;
	for (int i = 1; i <= H; i++) {
		dp[i] = mod;
	}
	ll ans = 0;
	for (int i = 1; i <= H; i++) {
		for (int j = 0; j < N; j++) {
			if (i - M[j].A < 0) {
				dp[i] = min(dp[i], M[j].B);
			}
			else {
				//cout << i <<" "<< j << endl;
				dp[i] = min(dp[i], dp[i - M[j].A] + M[j].B);
			}
		}
		//cout << dp[i] << endl;
	}
	cout << dp[H] << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

    int N; scanf("%d",&N);
    switch (N%10)
    {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        printf("hon\n");
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        printf("pon\n");
        break;
    case 3:
        printf("bon\n");
        break;
    }
    return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
 
 
vector<int> x(10), y(10);
 
double distance(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx*dx+dy*dy, 0.5);
}
 
int main() {
    int N; cin >> N;
    for (int i = 1; i <= N; ++i) {
        cin >> x[i] >> y[i];
    }

    vector<int> v(N);
    for (int i = 0; i < N; ++i) {
        v[i] = i + 1;
    }

    int cnt=1;
    for (int i = 1; i <= N; ++i) {
        cnt *= i;
    }
    double dis_sum= 0.0;
    do {
        for (int i = 0; i < N - 1; ++i) {
            dis_sum += distance(v[i], v[i+1]);
        }
    } while (next_permutation(v.begin(), v.end()));
 
    cout << setprecision(10) << dis_sum / cnt << endl;
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, int> Pli;

ll X;

int main() {
    cin >> X;

    ll ans = 0;
    ans += (X / 500) * 1000;
    ans += ((X % 500) / 5) * 5;

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
int main()
{
   int N , K;
   scanf("%d %d",&N,&K);
   char S[51]={'\0'};
   scanf("%s",&S);


    S[K-1]=tolower(S[K-1]);


   printf("%s",S);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    lint n;
    cin >> n;
    lint ans = 0;
    for (lint i = 1; i * (i + 1) < n; i++) {
        ans += n % i == 0 ? n / i - 1 : 0;
    }
    cout << ans << endl;
}

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

int main(){
  string s;
  cin >> s;
  int n = s.size();
  reverse(s.begin(), s.end());
  
  vector<int> v(n,0);
  int x = 1;
  
  for(int i = 0; i < n; i++){
    if(i == 0) v[i] = s[i]-'0';
    else v[i] = v[i-1] + ((s[i]-'0')*x);
    v[i] = v[i] % 2019;
    x *= 10;
    x %= 2019;
  }
  
  int ans = 0;
  vector<int> count(2100,0);
  count[0] = 1;

  for(int i = 0; i < n; i++){
    if(count[v[i]] == 0){
      count[v[i]] = 1;
    }else{
      ans += count[v[i]];
      count[v[i]]++;
    }
  }
  
  cout << ans << endl;

  return 0;
}

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

//#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;

#ifndef LOCAL
#define int long long
#endif

mt19937 rnd(time(0));
#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("dead", "r", stdin); freopen("tmp.out", "w", stdout);
#define s second
#define f first
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pii pair<int,int>
#define res resize
#define PI acos(-1)

template<class T>
ll upmax(T &a, T b) { return (b > a) ? a = b, 1 : 0; }

template<class T>
ll upmin(T &a, T b) { return (b < a) ? a = b, 1 : 0; }

const ll INF = 1e9;//9223372036854775807L; //LONG_MAX;
constexpr ll mod = 1e9 + 7, dopmod = 6914882281337;


void solve() {
    ll a, b;
    cin >> a >> b;
    if (a * 500 >= b)cout << "Yes\n";
    else cout << "No\n";
}

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



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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef long long ll;
typedef pair<int, int> pi;

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, k;
    cin>>n>>k;
    string s;
    cin>>s;

    int l = 0, r = 0;
    int ans = 0, maxi = 0;

    while (r<n){
        if (s[r] == '0'){
            if (k > 0){
                while (r<n && s[r] == '0') r++;
                maxi = max(maxi, r-l);
                k--;
            }
            else {
                maxi = max(maxi, r-l);
                k++;
                l++;
                while(l<n && (s[l]!='1' || s[l-1]!='0')) l++;
            }
        }
        else {
            r++;
            maxi = max(maxi, r-l);
        }
    }
    cout<<maxi<<endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const long long INF = 1LL << 61;

int MOD = 1000000007;


int main(){
    std::ios_base::sync_with_stdio(false);

    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;

    bool exist = false;

    if(abs(a-b)>k) exist = true;
    if(abs(a-c)>k) exist = true;
    if(abs(a-d)>k) exist = true;
    if(abs(a-e)>k) exist = true;
    if(abs(b-c)>k) exist = true;
    if(abs(b-d)>k) exist = true;
    if(abs(b-e)>k) exist = true;
    if(abs(c-d)>k) exist = true;
    if(abs(c-e)>k) exist = true;
    if(abs(d-e)>k) exist = true;

    if(exist) cout << ":(" << endl;
    else cout << "Yay!" << endl;

    return 0;
}


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

struct C{
	double r,x,y;
	C(double r,double x,double y) : r(r) , x(x) , y(y) {}
};

bool cmp_x(const C &a,const C &b){ return a.x == b.x ? a.y < b.y : a.x < b.x ; }
bool cmp_y(const C &a,const C &b){ return a.y == b.y ? a.x < b.x : a.y < b.y ; }

double dist(const C &a,const C &b){
	double x = a.x - b.x;
	double y = a.y - b.y;
	return sqrt( x * x + y * y );
}
int main(){
	int n;
	while(cin >> n && n){
		vector<C> a,b;
		for(int i = 0 ; i < n ; i++){
			double r,x,y;
			cin >> r >> x >> y;
			a.push_back(C(r,x,y));
			b.push_back(C(r,x,y));
		}
		double ans = 1e15;
		sort(a.begin(),a.end(),cmp_x);
		sort(b.begin(),b.end(),cmp_y);
		for(int i = 0 ; i < n ; i++){
			for(int j = max(0,i-50) ; j < min(i+50,n) ; j++){
				if(i!=j) ans = min(ans,dist(a[i],a[j])-a[i].r-a[j].r);
			}
			for(int j = max(0,i-50) ; j < min(i+50,n) ; j++){
				if(i!=j) ans = min(ans,dist(b[i],b[j])-b[i].r-b[j].r);
			}
		}
		printf("%.7f%c",ans,10);
	}
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		for(;;){
			String x = sc.next();
			if(x.equals("0"))break;
			String[] strArray = x.split("");
			int add = 0;
			for (int i = 0; i < strArray.length; i++) {
				int num = Integer.parseInt(strArray[i]);
			    add += num;
			}
			System.out.println(add);
		}
	}	
}

Measured memory_bytes: 27076
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr> void dump(Itr begin, Itr end) { for (;begin != end; ++begin) clog << *begin << LF; }

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

  int n; cin >> n;
  cout << 800 * n - (n/15) * 200 << LF;

  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int A,B,C,D;
    long long int sum1,sum2;
    while(~scanf("%d%d%d%d",&A,&B,&C,&D))
    {
        sum1=A*B;
        sum2=C*D;
        if(sum1==sum2)
        {
            printf("%I64d\n",sum1);
        }
        else if(sum1>sum2)
        {
            printf("%I64d\n",sum1);
        }
        else if(sum2>sum1)
        {
             printf("%I64d\n",sum2);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#pragma GCC optimize("O2")
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline int compare(const int*a,const int*b){return *a-*b;}
static inline long IN(void)
{
  long x=0;int f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline void OUT(long x){if(x<0)putchar('-'),x=-x;if(x>=10)OUT(x/10);putchar(x%10+48);}
int main(void)
{
  int N=IN(),x,p=0,m=0,z=0,sign=0,A[200000];
  long K=IN(),count=0,l=-2e18,r=-l,mid;
  while(N--){x=IN();if(x>0)A[m+p++]=x;else if(x<0)A[p+m++]=x;else z++;}
  if(K>1l*m*p&&K<1l*m*p+1l*z*(N-1)/2)return puts("0"),0;
  qsort(A,m+p,sizeof(int),(int(*)(const void*,const void*))compare);
  rep(i,m)A[i]*=-1;
  if(K<=1l*m*p)r=1l;else l=-1l;
  while(l<=r)
  {
    mid=(l+r)/2;count=0;
    if(mid>=0)
    {
      int plus=p-1,minus=m-1;count+=1l*z*(p+m)+1l*z*(z-1)/2+1l*p*m;
      rep(i,plus){while(1l*A[m+i]*A[m+plus]>mid){plus--;}if(i>=plus){break;}count+=1l*plus-i;}
      rep(i,minus){while(1l*A[m-1-i]*A[m-1-minus]>mid){minus--;}if(i>=minus){break;}count+=1l*minus-i;}
    }
    else{mid*=-1l;sign=1;int low=0;rep(i,m){while(1l*A[m+low]*A[i]<mid&&low<p){low++;}count+=1l*p-low;}}
    if(count>=K){if(sign)r=-mid-1l;else r=mid-1l;}else{if(sign)l=-mid+1l;else l=mid+1l;}
  }
  return OUT(l),0;
}

Measured memory_bytes: 2720
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;

int arr[303][303] , N , M , cnt[303] , ans; bool del[303];

int main(){
	cin >> N >> M; ans = N;
	for(int i = 1 ; i <= N ; ++i){
		for(int j = 1 ; j <= M ; ++j) cin >> arr[i][j];
		++cnt[arr[i][1]];
	}
	for(int i = 1 ; i <= M ; ++i){
		int mx = 0;
		for(int j = 1 ; j <= M ; ++j) mx = max(mx , cnt[j]);
		ans = min(ans , mx);
		for(int j = 1 ; j <= M ; ++j)
			if(mx == cnt[j]){del[j] = 1; break;}
		memset(cnt , 0 , sizeof(cnt));
		for(int j = 1 ; j <= N ; ++j)
			for(int k = 1 ; k <= M ; ++k)
				if(!del[arr[j][k]]){++cnt[arr[j][k]]; break;}
	}
	cout << ans; return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
using namespace std;
int main(){

  int n,a[100],b[100],r=0;
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>b[i];
  reverse(b,b+n);
  for(int i=1;i<n;i++){
    a[i]+=a[i-1];
    b[i]+=b[i-1];
  }
  for(int i=0;i<n;i++) r=max(r,a[i]+b[n-i-1]);
  cout<<r<<endl;
  return 0;


}

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

int main(){
  string s;
  cin >> s;
  int ans = 700;
  for(int i=0;i<s.size();i++){
    if(s.at(i) == 'o'){
      ans += 100;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
const int MAXM=200005;
struct edge{int x,y,next;}a[2*MAXM];int len=1,last[MAXN];
bool flag[2*MAXM];
void ins(int x,int y){len++;a[len].x=x;a[len].y=y;a[len].next=last[x];last[x]=len;}
int n,m,D[MAXN],id[MAXN],val[2*MAXM];
bool cmp(int n1,int n2){return D[n1]<D[n2];}
void mark(int k,int u){flag[k]=flag[k^1]=1;val[k]=val[k^1]=u;}
int flag1[MAXN],ok[MAXN];
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;i++)D[i]=read(),id[i]=i;
	for(int i=1;i<=m;i++)
	{
		int u=read(),v=read();
		ins(u,v);ins(v,u);
	}sort(id+1,id+1+n,cmp);int kk=-1;
	for(int i=1;i<=n;i++)if(D[id[i]]==D[id[1]])
	{
		for(int k=last[id[i]];k;k=a[k].next)
		{
			int y=a[k].y;
			if(D[y]==D[id[1]]){kk=k;break;}
		}
	}if(kk==-1)return pr2(-1),0;mark(kk,D[id[1]]);
	ok[a[kk].x]=ok[a[kk].y]=1;flag1[a[kk].y]=1;
	for(int i=1;i<=n;i++)if(!ok[id[i]])
	{
		bool tf=false;int x=id[i];
		for(int k=last[x];k;k=a[k].next)if(D[a[k].y]<=D[x])
		{
			tf=true;ok[x]=1;
			if(D[a[k].y]<D[x])flag1[x]=flag1[a[k].y],mark(k,D[x]-D[a[k].y]);
			else
			{
				if(ok[a[k].y])flag1[x]=flag1[a[k].y]^1,mark(k,D[x]);
				else ok[a[k].y]=1,flag1[x]=1,mark(k,D[x]);
			}break;
		}
		if(!tf)return pr2(-1),0;
	}
	for(int i=1;i<=n;i++)putchar(flag1[i]?'B':'W');puts("");
	for(int i=2;i<len;i+=2)
	{
		if(flag[i])pr2(val[i]);
		else pr2(1000000000);	
	}
	return 0;
}


Measured memory_bytes: 10880
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
using namespace std;

constexpr int MAX = 7368791 + 1;
bool used[MAX];

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	for(int m, n; cin >> m >> n && m;) {
		memset(used, false, sizeof(used));
		int ans = m;
		for(int i = 0; i < n; ++i) {
			used[ans] = true;
			for(int j = ans; j < MAX; j += ans) {
				used[j] = true;
			}
			while(used[ans]) ++ans;
		}
		cout << ans << endl;
	}
	return EXIT_SUCCESS;
}

Measured memory_bytes: 10280
#include <iostream>
#include <cstdio>
#define N 200005
using namespace std;

int n, k, c, a[N], b[N], x, y;
string s;
int main() {
	int i;
	cin >> n >> k >> c >> s;
	s = '.' + s;
	a[0] = -1e9;
	for(i=1; i<=n && x<k; i++) {
		if(s[i]=='o' && i-a[x]>c) a[++x] = i;
	}
	b[k+1] = 1e9; y = k+1;
	for(i=n; i && y>1; i--) {
		if(s[i]=='o' && b[y]-i>c) b[--y] = i;
	}
	for(i=1; i<=k; i++) {
		if(a[i]==b[i]) printf("%d\n", a[i]);
	}
	return 0;
}

Measured memory_bytes: 3392
N,K = map(int,input().split())
S = input()

LR = []
num = 1
now = S[0]

for i in range(1,N):
    if S[i] == now:
        num += 1
    else:
        now = S[i]
        LR.append(num)
        num = 1

LR.append(num)

length = len(LR)
print(N-length+min(2*K,length-1))


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

int main()
{
    int N;
    cin >> N;
    vector<int> H(N, 0);

    for(auto&& h: H){
        cin >> h;
    }

    int count = 1;

    for (int i = 1; i < N; ++i){

        bool flag = true;

        for (int j = 0; j <= i - 1; ++j){

            if( H[j] > H[i]){
                flag = false;
            }

        }

        if( flag == true){
            ++count;
        }

    }

    cout << count << endl;

    return 0;
}

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

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

	ll num = n / k;
	ll ans = pow(num, 3);
	if (k % 2 == 0) {
		ll num2 = n / (k / 2);
		if (num2 % 2 == 0) {
			num2--;
		}
		num2 = (num2 + 1) / 2;
		ans += pow(num2, 3);

	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
using System;

namespace TestSpace
{
    class Test
    {
        static void Main(string[] args)
        {
            string[] arrRead;
            int i, j, k, l, N, z;
            N = int.Parse(Console.ReadLine());
            int[] intRead = new int[3];

            for (i = 0; i < N; i++)
            {
                arrRead = Console.ReadLine().Split(' ');

                for (j = 0; j < 3; j++)
                {
                    intRead[j] = int.Parse(arrRead[j]);
                }

                for (k = 0; k < 2; k++)
                {
                    for (l = 2; k < l; l--)
                    {
                        if (intRead[l] < intRead[l - 1])
                        {
                            z = intRead[l];
                            intRead[l] = intRead[l - 1];
                            intRead[l - 1] = z;
                        }                        
                    }
                }

                if (Math.Pow(intRead[0], 2) + Math.Pow(intRead[1], 2) == Math.Pow(intRead[2], 2))
                {
                    Console.WriteLine("YES");
                }
                else 
                {
                    Console.WriteLine("NO");

                }      
            }
        }
    }
}



Measured memory_bytes: 13840
#include "iostream"
#include "map"
using namespace std;
 
long long n,sum=0;
int cnt=0;
string s;
map<int, long long> m;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
 
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		if(s[0]=='M'){
			m[1]++;
		}
		else if(s[0]=='A'){
			m[2]++;
		}
		else if(s[0]=='R'){
			m[3]++;
		}
		else if(s[0]=='C'){
			m[4]++;
		}
		else if(s[0]=='H'){
			m[5]++;
		}
	}

	for(int i=1;i<=m.size();i++){
		for(int j=i+1;j<=m.size();j++){
			for(int k=j+1;k<=m.size();k++){
				// cout<<i<<j<<k<<endl;
				// cout<<m[i]<<m[j]<<m[k]<<endl;
				sum+=(m[i]*m[j]*m[k]);
				// cout<<sum<<endl;
			}
		}
	}

	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define rrep(i,m,n) for(int i = m; i >= n; i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    ll h[100010];
    cin >> N >> K;
    rep(i,0,N){
        cin >> h[i];
    }
    ll dp[100010] = {};
    dp[0] = 0;
    rep(i,1,N){
        dp[i] = INF;
    }
    rep(i,1,N){
        ll v = max(0LL, i - K);
        // print(v);
        rep(j, v, i){
            // print2(v,i-1);
            dp[i] = min(dp[i], dp[j] + abs(h[j] - h[i]));
        }
        // print(dp[i]);
        // ll v = min(0LL, i - K);
        // // dp[i+1] = -1;
        // rrep(v,i-1,0){
        //     if(v == i-1){
        //         dp[i+1] = dp[i-v] + abs(h[i-v] + h[i+1]);
        //     }
        //     dp[i+1] = min(dp[i+1], dp[i-v] + abs(h[i-v] + h[i+1]));
        // }
    }
    print(dp[N-1]);

}


Measured memory_bytes: 1792
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]

result = "APPROVED"
for i in 1..N do
  s = lines[1][i-1]
  if s % 2 == 0 then
    if s % 3 != 0 and s % 5 != 0 then
      result = "DENIED"
    end
  end
end
    
print result

Measured memory_bytes: 1788
#include <iostream>

using namespace std ;

long long arr[100000];
int main ()
{
	long long n ;
	cin >>n;
	
	for (int i=0 ; i < n ;i++)
		cin >> arr[i];
	
	int max = 1 ;
	int size = 1 ;
	for (int i=1 ; i < n ;i++)
	{
		
		if (arr[i] <= arr[i-1])
		{
			size++;
		}
		else
		{
			size=1 ;
		}
		
		if (size > max)
			max = size;
	}
	
	cout << max-1 ;
}

Measured memory_bytes: 1152
#include <stdio.h>

int main (){
	
	char w[100];
	scanf ("%[^\n]", &w);
	int counter = 0;
	
	 for(int i= 0; w[i] != '\0'; i++){
    if(w[i] == ' '){
		if(w[i - 1] == w[i + 1]){
			counter++;
		}
    }
  }
  if(counter == 2){
  	printf("YES\n");
  }
  else{
  	printf("NO\n");
  }
	
	return 0;
}


Measured memory_bytes: 1596
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<map>
#include<bitset>
#include<utility>
//#include<unordered_map>
#ifdef LOCAL
#include"file.h"
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
const double eps = 1e-12;
const double Pi = 3.1415926535897932;
const int dir[4][2] = { -1,0,1,0,0,-1,0,1 };
//const int dir[8][2] = { -2,-1,-2,1,2,-1,2,1,-1,2,-1,-2,1,2,1,-2 };






const int maxn = 10000 + 5;
const int MOD = 1e9 + 7;


int f[maxn][100 + 5];

char s[maxn];
int n, D;
int main() {
#ifdef LOCAL
	fileopen();
#endif
	scanf("%s", s + 1);
	scanf("%d", &D);
	n = strlen(s + 1);

	

	f[n+1][0] = 1;
	for (int i = n+1; i >= 2; i--) {
		for (int j = 0; j < D; j++)if(f[i][j]) {
			for (int k = 0; k <= 9; k++) {
				f[i - 1][(j + k) % D] += f[i][j];
				f[i - 1][(j + k) % D] %= MOD;
			}
		}
	}

	int ans = MOD - 1;
	int t = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < s[i] - '0'; j++) {
			ans += f[i + 1][(t - j % D + D) % D];
			ans %= MOD;
		}
		t = (t - (s[i] - '0')%D + D) % D;
	}
	//ans = (ans - 1 + MOD) % MOD;

	t = 0;
	for (int i = 1; i <= n; i++)
		t = (t + s[i] - '0') % D;
	if (!t)ans = (ans + 1) % MOD;

	printf("%d\n", ans);



#ifdef LOCAL
	fileclose();
#endif
	return 0;
}


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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    str S; cin >> S;
    F0R(i, 3) {
        if (S[i] == '7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a;i<=b;++i)
#define read(n)  scanf("%d",&n)
#define ll long long
#define N 100005
ll n;
ll num[N];
ll back[N];
ll ans=1;
int flag=1;
void dfs(ll pre,ll deep)
{
	if(flag==0) return ;
	if(deep>n) return ;
	if((pre*2-num[deep]<0||pre>back[deep])){
		flag=0;
		return ;
	}
	ans+=min(back[deep+1]+num[deep],pre*2);
	dfs(min(back[deep+1]+num[deep],pre*2)-num[deep],deep+1);
}
int main()
{
	cin>>n;
	f(i,0,n)  read(num[i]);
	if(n>0&&num[0]) flag=0;
	if(num[0]>1) flag=0;
	for(int i=n;i>=0;--i) back[i]=back[i+1]+num[i];
	dfs(1,1);
	if(!flag) 
	{
		cout<<-1;
		return 0;
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 5216
#include<iostream>

#include<queue>
#include<algorithm>
using namespace std;

int main()
{
  int n, q, t;
  string name;
  queue<pair<string, int> > Q;
  
  cin >> n >> q;

  for (int i = 1; i <= n; i++){
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;
  int elaps = 0, a;

  while (!Q.empty()) {
    u = Q.front(); Q.pop();
    a = min(u.second, q);
    u.second -= a;
    elaps += a;
    if (u.second > 0) {
      Q.push(u);
    }
    else {
      cout << u.first << " "<< elaps << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 6388
// Problem Code: abc176_d

#include <bits/stdc++.h>

using namespace std;

int wizard_in_maze(int H, int W, pair<int, int>& C, pair<int, int>& D, vector<string>& S) {
	int type, moves;
	type = moves = 0;
	set<int> seen;
	queue<pair<int, int>> q;
	vector<vector<int>> T(H, vector<int>(W));
	vector<vector<bool>> visited(H, vector<bool>(W));
	
	// traverse directions easily
	vector<int> xdir = {-1, 0, 1, 0};
	vector<int> ydir = {0, -1, 0, 1};
	
	// helper function
	auto valid = [&](int i, int j) {
		return (i >= 0 && i < H && j >= 0 && j < W);	
	};
	
	function<void(int, int)> flood_fill = [&](int x, int y) {
		if (!valid(x, y) || S[x][y] != '.' || T[x][y])
			return;
		T[x][y] = type;
		for (int k = 0; k < xdir.size(); k++)
			flood_fill(x + xdir[k], y + ydir[k]);
	};
	
	function<void(int, int)> dfs = [&](int x, int y) {
		if (!valid(x, y) || S[x][y] != '.' || visited[x][y])
			return;
		
		visited[x][y] = true;
		
		// Move B
		for (int a = -2; a <= 2; a++)
			for (int b = -2; b <= 2; b++) {
				int new_x = x + a, new_y = y + b;
				if (valid(new_x, new_y) && S[new_x][new_y] == '.' && !seen.count(T[new_x][new_y])) {
					seen.insert(T[new_x][new_y]);
					q.push({new_x, new_y});
				}
			}
		
		// Move A
		for (int k = 0; k < xdir.size(); k++)
			dfs(x + xdir[k], y + ydir[k]);
	};
	
	for (int i = 0; i < H; i++)
		for (int j = 0; j < W; j++)
			if (S[i][j] == '.' && !T[i][j]) {
				type++;
				flood_fill(i, j);
			}
	
	// initialization
	q.push(C);
	seen.insert(T[C.first][C.second]);
	
	// BFS
	while (!q.empty()) {
		int size = q.size();
		while (size--) {
			int x, y;
			tie(x, y) = q.front();
			q.pop();
			if (T[x][y] == T[D.first][D.second])
				return moves;
			dfs(x, y);
		}
		moves++;
	}
	
	return -1;
}

int main() {
	int H, W;
	pair<int, int> C, D;
	cin >> H >> W >> C.first >> C.second >> D.first >> D.second;
	C.first--, C.second--, D.first--, D.second--;
	vector<string> S(H);
	for (int i = 0; i < H; i++)
		cin >> S[i];
	cout << wizard_in_maze(H, W, C, D, S);
	return 0;
}

Measured memory_bytes: 17348
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <class... T> void printl(T&&...){ }
template <class... T> void printc(T&&...){ }
template <class... T> void prints(T&&...){ }
template <class... T> void printd(T&&...){ }
#endif

int main(){
    int n; cin >> n;
    vector<int> as(3 * n);
    for(int i=0;i<3 * n;i++){
        cin >> as[i];
    }
    sort(as.rbegin(), as.rend());
    ll ans = 0;
    for(int i=0;i<2 * n;i++){
        if(i % 2){
            ans += as[i];
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
//#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
 

signed main(void){
    int K,X;
    cin >> K >> X;
    if(500*K>=X){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int main(){
    string s;
    cin>>s;
    if(s[2]==s[3]&&s[4]==s[5]){
        cout<<"Yes"<<endl;
    }else{
       cout<<"No"<<endl; 
    }
    
}

Measured memory_bytes: 256
def return_d(A,abcds):
    sum_d=0
    for abcd in abcds:
        a,b,c,d=abcd
        if A[b]-A[a]==c:
            sum_d+=d
    return sum_d

n,m,q=[int(i) for i in input().split()]
abcds=[[int(i) for i in input().split()] for j in range(q)]


As=[]
for i_1 in range(1,m+1):
    for i_2 in range(i_1, m + 1):
        for i_3 in range(i_2, m + 1):
            for i_4 in range(i_3, m + 1):
                for i_5 in range(i_4, m + 1):
                    for i_6 in range(i_5, m + 1):
                        for i_7 in range(i_6, m + 1):
                            for i_8 in range(i_7, m + 1):
                                for i_9 in range(i_8, m + 1):
                                    for i_10 in range(i_9, m + 1):
                                        As.append([0,i_1,i_2,i_3,i_4,i_5,i_6,i_7,i_8,i_9,i_10])


ans=0
for A in As:
    ans=max(ans,return_d(A,abcds))

print(ans)

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

using namespace std;

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

    int n, m, frq[31] = {}, ans = 0;
    cin >> n >> m;

    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        while (k--) {
            int tmp;
            cin >> tmp;
            frq[tmp]++;
        }
    }

    for (int i = 1; i <= m; i++)
        if (frq[i] == n)
            ans++;
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,a,b;
    scanf("%d",&n);
    


       a=n/10;
       b=n%10;
       if(a==9||b==9)
            printf("Yes\n");
       else printf("No\n");
    

    return 0;
}

Measured memory_bytes: 128