akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  string s;
  cin >> s;
  bool ans = true;
  if(s[0]!='A'){
    ans = false;
  }
  ll count_C = 0;
  for (ll i = 2; i <= sz(s) - 2;i++){
    if(s[i]=='C'){
      count_C++;
    }
  }
  if(count_C!=1){
    ans = false;
  }
  ll count = 0;
  rep(i, sz(s)){
    if(s[i]>='A'&&s[i]<='Z'){
      count++;
    }
  }
  if(count!=2){
    ans = false;
  }
  if(ans){
    print("AC");
  }
  else{
    print("WA");
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a, b, c, cnt = 0, num = 0;
	scanf("%d%d%d", &a, &b, &c);
	for (; a <= b; a++)
	{
		num = c % a;
		if (num == 0)
		{
			cnt++;
		}
	}
	printf("%d\n", cnt);
	
	return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

long long  fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
long long int dp[100040] = {};
int main() {
	long long int n;
	long long int k;
	long long int ans = 300000000;
	cin >> n >> k;
	for (int i = 0; i <= n; i++) {
		long long int a = pow(2, i);
		ans = min(ans, 1 * a + k * (n - i));
	}
	cout << ans;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main(){
	int n; cin >> n;
	int a = 0, b = 0;
	while (n--){
		string str, STR; cin >> str >> STR;
		if (str < STR) b += 3;
		else if (str > STR) a += 3;
		else ++a, ++b;
	}
	cout << a << ' ' << b << '\n';
}

Measured memory_bytes: 1208
using System;
using System.Linq;
using System.Collections.Generic;
public class Hello{
    public static void Main(){
        var n = long.Parse(Console.ReadLine());
        var min = long.MaxValue;
        var list = Console.ReadLine().Split(' ').Select(long.Parse).ToList();
        for(var i = list.Min();i <= list.Max();i++){
            var temp = 0L;
            for(var j = 0;j < n;j++){
                temp += (long)Math.Pow(list[j] - i,2);
            }
            min = Math.Min(temp,min);
        }
        Console.WriteLine(min);
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

int main()
{
    ll N, M;
    cin >> N >> M;
    ll a[N];
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
        a[i] /= 2;
    }
    ll L = a[0];
    for (ll i = 1; i < N; i++) {
        L = lcm(L, a[i]);
    }
    for (ll i = 0; i < N; i++) {
        if ((L / a[i]) % 2 == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    ll ans = (M / L + 1) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>

int main(){
    std::vector<bool> vec(10, true);
    vec.at(1) = false;
    vec.at(9) = false;
    vec.at(7) = false;
    vec.at(4) = false;
    
    int a, b, c, d;
    std::cin >> a >> b >> c >> d;
    vec.at(a) = true;
    vec.at(b) = true;
    vec.at(c) = true;
    vec.at(d) = true;

    std::string ans = "NO";
    if(std::end(vec) == std::find(std::begin(vec), std::end(vec), false)){
        ans = "YES";
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 888
/**
 * 整数ユーティリティー
 */
export class IntUtil {
  /**
   * aをbで割った時の商と余りを求める。
   * @param a 割られる数
   * @param b 割る数
   * @return [商, 余り]
   */
  static extraQ(a: number, b: number): [number, number] {
    const r = a % b;
    return [(a - r) / b, r];
  }

  /**
   * 最大公約数を求める。
   * @param x 数値1
   * @param y 数値2
   * @return [最大公約数r, a, b] (ただしa, bは ax + by = r となる整数)
   */
  static gcd(x: number, y: number): [number, number, number] {
    let r0 = x;
    let r1 = y;
    let a0 = 1;
    let a1 = 0;
    let b0 = 0;
    let b1 = 1;
    while(r1 > 0) {
      const [q, r] = IntUtil.extraQ(r0, r1);
      const a = a0 - q * a1;
      const b = b0 - q * b1;
      r0 = r1;
      r1 = r;
      a0 = a1;
      a1 = a;
      b0 = b1;
      b1 = b;
    }
    return [r0, a0, b0];
  }

  /**
   * 最小公倍数を求める。
   * @param x 数値1
   * @param y 数値2
   * @return 最小公倍数
   */
  static lcm(x: number, y: number): number {
    let gcd = IntUtil.gcd(x, y);
    return x * y / gcd;
  }

  /**
   * pを法とした時のxの逆数を返す
   * @param x 数値
   * @param p xと互いに素である数値
   * @return x^{-1} (mod p)
   */
  static inverseMod(x: number, p: number): number {
    const [r, a, _] = IntUtil.gcd(x, p);
    if (r != 1) {
      throw new Error(`NOT COPRIME: IntUtil.inverseMod(${x}, ${p})`);
    }

    return a >= 0 ? (a % p) : (p + (a % p));
  }
}

export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [k]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    let result = 0;
    for (let i = 1; i <= k; i++) {
      for (let j = 1; j <= k; j++) {
        const tmpGcd = IntUtil.gcd(i, j)[0];
        for (let s = 1; s <= k; s++) {
          result += IntUtil.gcd(tmpGcd, s)[0];
        }
      }
    }
    return `${result}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 35848
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int sumMoney = 0;
    int sumProduct = 0;
    int counter =0;
    while(sc.hasNext()) {
      String str = sc.next();
      String[] strArr = str.split(",");
      sumMoney += Integer.parseInt(strArr[0])*Integer.parseInt(strArr[1]);
      sumProduct += Integer.parseInt(strArr[1]);
      counter++;
    }
    System.out.println(sumMoney);
    System.out.println(Math.round((float)sumProduct/counter));
  }
}

Measured memory_bytes: 11000
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
map<long long,int> ap;
long long x,sum,tot;
int n,i,j;
int main()
{
    cin>>n;ap[0]=1;
    for(i=1;i<=n;i++)
    {
        cin>>x;
        sum+=x;
        tot+=1LL*ap[sum];
        ap[sum]++;
    }
    cout<<tot<<'\n';
    return 0;
}


Measured memory_bytes: 12800
n1, n2 = [int(i) for i in input().split()]

t1 = 100
s1 = 0
t4 = 0
for i1 in range(n1):

    t4 = n2 + i1
    
    s1 += t4
    if abs(t1) >= abs(t4):
        t1 = t4
print(s1 - t1)

Measured memory_bytes: 3060
import           Data.Maybe (fromJust)
import           Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as BSC8
import           Data.List (sort)


readInts :: IO [Int]
readInts = map ( fst . fromJust . BSC8.readInt ) . BSC8.words <$> BSC8.getLine

main :: IO ()
main = do
  (_:k:_) <- readInts
  ps <- readInts
  print $ sum . take k . sort $ ps


Measured memory_bytes: 4448
#!/usr/bin/perl
use strict;
use warnings;

my $k = <>;
chomp $k;

my $s = 0;
for (my $x = 1; $x <= $k; $x += 2) {
    for (my $y = 2; $y <= $k; $y += 2) {
        $s++;
    }
}

print "$s\n";


Measured memory_bytes: 640
#include<stdio.h>

int main(void){
    int A, B, C, K,score = 0;;
    scanf("%d %d %d %d",&A, &B, &C, &K);
    if(A >= K){
        score = K;
    }
    else{
        score = A;
        K = K-A;
        if(B < K){
            score = score - (K-B);
        }
    }
    printf("%d\n",score);
    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <deque>
#include <limits>
#include <numeric>
#include <boost/math/common_factor_rt.hpp>


#define INF 100000000
#define MOD 1000000007

#define ll long long

using namespace std;


int main() {
	int N, T;
	int c[105] = {};
	int t[105] = {};
	int ans = 10000;
	
	cin >> N >> T;

	for (int i = 0; i < N; i++)
	{
		cin >> c[i] >> t[i];
	}

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

		if (t[i] <= T) {
			ans = min(ans, c[i]);
		}

		
	}
	
	if (ans == 10000) {
		cout << "TLE" << endl;
		return 0;
	}
	else {
		cout << ans << endl;
		return 0;
	}


	
	
}



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

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    vector<vector<int>> choco(H,vector<int>(W,0));
    for (int i=0;i<H;i++){
        for (int j=0;j<W;j++){
            char c;
            cin >> c;
            choco[i][j] = c- '0';
        }
    }
    int INF = H*W*2;
    int ans = INF;
    for (int mask =0;mask< (1<< (H-1) ); mask++){
        int horizontal_block_count = 0;
        vector<int> horizontal_section(H,0);
        for (int i=0;i<H;i++){
            horizontal_section[i] = horizontal_block_count;
            if (mask & (1<<i)) horizontal_block_count++; //1
        }
        horizontal_block_count++;
        vector<int> count(horizontal_block_count,0);
        int count_cut = horizontal_block_count -1;
        for (int j=0;j<W;j++){
            for (int i=0;i<H;i++){
                count[horizontal_section[i]]+=choco[i][j];
            }
            if (*max_element(count.begin(),count.end()) > K){
                count_cut++;
                for (int k=0;k<horizontal_block_count;k++) count[k] = 0;
                for (int k=0;k<H;k++) count[horizontal_section[k]] +=choco[k][j];//超えた時点でリセットを書けているので今の分を足しなおす
            }
            if (*max_element(count.begin(),count.end()) > K){
                //この時点でK超えてたらこの横の切り方では無理
                count_cut =INF;
                break;
            }
        }
        ans = min(count_cut,ans);
    }
    printf("%d\n",ans);

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]

signed main(){
    int n; cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];
    ll ans=0;
    int j=0;
    vector<int> num(21,0);
    rep(i,n){
        if(i==0){
            rep(k,21){
                if(a[i]&(1ull<<k)) num[k]++;
            }
        }else{
            rep(k,21){
                if(a[i-1]&(1ull<<k)) num[k]--;
            }
        }
        bool br=0;
        while(j+1<n){
            j++;
            rep(k,21){
                if(a[j]&(1ull<<k)) num[k]++;
                if(num[k]>1) br=1;
            }
            if(br){
                rep(k,21){
                    if(a[j]&(1ull<<k)) num[k]--;
                }
                j--;
                break;
            }
        }
        //cout << i <<" "<<j<<endl;
        ans+=j-i+1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

import numpy as np

n = int(input())
a = np.array([list(map(int, input().split())) for _ in range(n)])

g = csr_matrix(a)
dist = floyd_warshall(g)

if (dist == a).all():
    sm = a.sum()
    sm //= 2

    INF = 10 ** 18 + 1
    for i in range(n):
        a[i, i] = INF

    for u in range(n):
        for v in range(u + 1, n):
            mn = np.min(a[u] + a[v])
            if mn == a[u, v]:
                sm -= a[u, v]

    print(sm)

else:
    print(-1)


Measured memory_bytes: 20292
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
using namespace std;
int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll sum4=0;
    ll sum2=0;
    ll sumodd=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(0==a[i]%4){
            sum4++;
        }else if(0==a[i]%2){
            sum2++;
        }else{
            sumodd++;
        }
    }
    
    string ans;
    if(0==sum2){
        if(sum4+1>=sumodd){
            ans="Yes";
        }else{
            ans="No";
        }
    }else{
        if(sum4>=sumodd){
            ans="Yes";
        }else{
            ans="No";
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int []a = new int[N];
        for (int i=0; i<N; i++) {
            a[i] = sc.nextInt();
        }
        int ans = 0;

        for (int i=0; i<N; /*nop*/) {
            if (a[i] % 2 != 0) {
                i++;
                continue;
            }
            a[i] /= 2;
            ans++;
        }

        System.out.println("" + ans);
    }
}


Measured memory_bytes: 34480
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int  A[10];
 
    for(int i=0;i<5;i++){
        cin >> A[i];
        if(A[i]==0){
            cout << i+1;
            break;
        }
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 3596
import sys
import numpy as np

a, b = np.array(sys.stdin.read().split(), dtype=np.int64)[1:].reshape(2, -1)
np.cumsum(a, out=a)
b = np.cumsum(b[::-1])[::-1]

def main():
    print(np.amax(a + b))

if __name__ ==  '__main__':
    main()

Measured memory_bytes: 12484
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <limits>
#include <iomanip>
#include <bitset>

#define INF 1000000000
#define Inf 1000000000000000000
#define mp make_pair
#define pb push_back
#define EPS 1e-9

using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

ll q, h, s, d, n, qq, hh, ss, dd;

int main() {

    //freopen("in","r",stdin);
    
    cin >> q >> h >> s >> d >> n;
    qq = q * n * 4;
    hh = h * n * 2;
    ss = s * n;

    dd = d * (n / 2);
    
    if (n & 1)
        dd += min(q * 4, min(h * 2, s));
    
    cout << min(qq, min(hh, min(ss, dd))) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <math.h>
#include <cmath>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
using ull =unsigned long long;
const ll INF =1001001001;

//10億7。　　　100000007

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}


int main(){
cout<<fixed<<setprecision(10);
//cin.tie(0); ios::sync_with_stdio(false);


  int R;
  cin>>R;
  cout<<R*2*6.28318530717958623200/2<<endl;
  
  
}



Measured memory_bytes: 3788
#include<iostream>
#include<vector>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
#define mkp make_pair
#define pin pair<int,int>
pin solve(V<pin>& ab, int ex) {
	if (!ex) { return mkp(0, 0); }
	V<V<pin>> qab(2);
	int sz = ab.size();
	qab[0].reserve(sz);
	qab[1].reserve(sz);
	for (pin& x : ab) {
		qab[x.second & 1].push_back(mkp(x.first / 2, x.second / 2));
		if (x.first & 1) { qab[(x.second + 1) & 1].push_back(mkp(x.first / 2, (x.second + 1) / 2)); }
	}
	int c = 0;
	for (pin& x : qab[0]) {
		int qc = (2 * x.first + x.second) % 3;
		c ^= (qc + 1);
	}
	if (!c) {
		pin ans = solve(qab[1], ex - 1);
		ans.first *= 2; ans.second *= 2; ans.second++;
		return ans;
	}
	pin ans = solve(qab[0], ex - 1);
	c = 0;
	int d = 0;
	for (pin& x : qab[1]) {
		int w = ans.second - x.second - 1;
		if ((w & x.first) == w) { c ^= 1; }
      	w++;
      	if ((w & x.first) == w) { d ^= 1; }
	}
  	ans.first *= 2; ans.second *= 2;
	ans.first+=(c|d); ans.second -= c;
	return ans;
}
signed main() {
	cin.tie(0); ios::sync_with_stdio(false);
	long long inf = 1e17;
	int n; cin >> n;
	V<pin> ab(n);
	rep(i, n) {
		long long a, b; cin >> a >> b;
		ab[i] = { a + inf,b + inf };
	}
	pin ret = solve(ab, 59);
	cout << ret.first - inf << " " << ret.second - inf << "\n";
}

Measured memory_bytes: 7552
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}

void bfs(const vector<vector<int> > &G, int v, vector<int> &dist){
    for (int i = 0; i < (int) dist.size(); i++) dist[i] = -1;
    queue<int> que;
    dist[v] = 0;
    que.push(v);
    while (!que.empty()) {
        v = que.front();
        que.pop();
        for (int next_v : G[v]) {
            if (dist[next_v] != -1) continue;
            dist[next_v] = dist[v] + 1;
            que.push(next_v);
        }
    }
}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int N, X, Y;
    cin >> N >> X >> Y;

    Graph G(N);
    REP(i,N-1) {
        G[i].PB(i+1);
        G[i+1].PB(i);
    }
    G[X-1].PB(Y-1);
    G[Y-1].PB(X-1);

    VVI dist(N,VI(N));

    map<int,int> mp;

    REP(i,N) {
        bfs(G,i,dist[i]);
    }
    
    REP(i,N-1) FOR(j,i+1,N) mp[dist[i][j]]++;

    FOR(i,1,N) {
        print(mp[i]);
    }


    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_d && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_d && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_d && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 31872
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < int(Y);++(X))
#define rrep(X,Y) for (int (X) = int(Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < int(Y);++(X))
#define peat(X,Y) for (;(X) < int(Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define int ll

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef int Cost;
struct Edge{int to,cap,rev;Cost cost;};
typedef vector<Edge> Edges;
typedef vector<vector<Edge> > Graph;

void add_edge(Graph &g,int from,int to,int cap,Cost cost=0){
  g[from].pb((Edge){to,cap,g[to].size(),cost});
  g[to].pb((Edge){from,0,g[from].size()-1,-cost});
}
Cost INF=1e7;

//min-cost,dij

typedef pair<Cost,int> Que;

double min_cost_flow(Graph &g,int s,int t,int f){
  int V=g.size();
  vector<Cost> dist(V);
  vector<int> used(V),prevv(V),preve(V);
  double res=0;
  int v,i;
  while(f>0){
    fill(all(dist),INF);
    dist[s]=0;
    bool upd=1;
    while(upd){
      upd=0;
      rep(v,V){
        if(dist[v]==INF)continue;
        rep(i,g[v].size()){
          Edge &e=g[v][i];
          if(e.cap>0 && dist[e.to]>dist[v]+e.cost){
            dist[e.to]=dist[v]+e.cost;
            prevv[e.to]=v;
            preve[e.to]=i;
            upd=1;
          }
        }
      }
    }
    if(dist[t]==INF)
      return -1;
    int d=f;
    for(v=t;v!=s;v=prevv[v]){
      d=min(d,g[prevv[v]][preve[v]].cap);
    }
    f-=d;
    res+=d*dist[t];
    for(v=t;v!=s;v=prevv[v]){
      Edge &e=g[prevv[v]][preve[v]];
      e.cap-=d;
      g[v][e.rev].cap+=d;
    }
  }
  return res;
}


signed main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int i,j,k,n;
  cin>>n;
  vector<vector<int> > w(n,vector<int>(n)),e(n,vector<int>(n));
  rep(i,n)rep(j,n)
    cin>>w[i][j];
  rep(i,n)rep(j,n)
    cin>>e[i][j];
  string str,strs[n];
  Graph g(n*2+2);
  rep(i,n){
    cin>>str;
    strs[i]=str;
    int sum=0;
    rep(j,n){
      if(str[j]=='o'){
        w[i][j]=-e[i][j];
        sum+=e[i][j];
      }
    }
    rep(j,n)
      add_edge(g,i+2,j+n+2,1,sum+w[i][j]);
    add_edge(g,0,i+2,1,0);
    add_edge(g,i+n+2,1,1,0);
  }
  cout<<min_cost_flow(g,0,1,n)<<endl;
  vector<pii> er,wr;
  rep(i,n){
    int fr=-1;
    rep(j,g[i+n+2].size()){
      if(g[i+n+2][j].cap){
        fr=g[i+n+2][j].to-2;
        break;
      }
    }
    rep(j,n){
      if(j==i){
        if(strs[fr][j]=='.')
          wr.pb(pii(fr,j));
      }else{
        if(strs[fr][j]=='o')
          er.pb(pii(fr,j));
      }
    }
  }
  cout<<er.size()+wr.size()<<endl;
  rep(i,er.size())
    cout<<er[i].X+1<<" "<<er[i].Y+1<<" erase"<<endl;
  rep(i,wr.size())
    cout<<wr[i].X+1<<" "<<wr[i].Y+1<<" write"<<endl;
  return 0;
}

Measured memory_bytes: 2444
x, y = map(int, input().split())

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
  
mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1]

if (x+y)%3 != 0 :
  print(0)
else:
  n = (x + y) // 3
  if x >= n and y >= n:
    a = x - n
    b = y - n
    
    for i in range(2, n + 1):
      g1.append( ( g1[-1] * i ) % mod )
      inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
      g2.append( (g2[-1] * inverse[-1]) % mod )
    
    answer = cmb(a+b,a,mod)
    print(answer)
  else:
    print(0)

Measured memory_bytes: 82440
#include <iostream>
#include <algorithm>

using namespace std;
struct q{
    int x, y;
}v[300003];
bool cmp(q i1, q i2) {
  if (i1.x < i2.x)
    return true;
  if (i1.x > i2.x)
    return false;
  if (i1.y < i2.y)
    return true;
  return false;
}
int main()
{
    int z, t, a, b, c;
    cin>>z>>t>>a>>b>>c;
    for(int i=0;i<a+b+c;i++){
        cin>>v[i].x;
        if(i<a){
            v[i].y=1;
        }
        else if(i<a+b){
            v[i].y=2;
        }
        else{
            v[i].y=3;
        }
    }
    sort(v, v+a+b+c, cmp);
    long long sum=0;
    int cnt=z+t, ans=a+b+c;
    while(cnt!=0){
        if(v[ans].y==1 && z!=0){
            sum+=v[ans].x;
            z--;
            cnt--;
        }
        if(v[ans].y==2 && t!=0){
            sum+=v[ans].x;
            t--;
            cnt--;
        }
        if(v[ans].y==3){
            sum+=v[ans].x;
            cnt--;
        }
        ans--;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef unsigned long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
// #define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 2e5+5;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
// #define trace6(a, n,i;b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// Constants //
 
/*** Template Ends ***/

void solve()
{
  ll n,k,i;
  cin>>n>>k;
  ld sum=k;
  std::vector<ll> v(n);
  for(i=0;i<n;i++)
    cin>>v[i];
  for(i=0;i<k;i++)
    sum+=v[i];
  ld ans = sum/2;
  for(i=k;i<n;i++)
  {
    sum-=v[i-k];
    sum+=v[i];
    ans = max(ans,sum/2);
  }
  cout.precision(12);
  cout<<fixed<<ans;
}
int main()
{ 
  // ios;
  // fxreopen("inputt.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int W, H;
char map[20][20];
int count;

void visit2(int, int);

void visit() {
  int i, j;
  count = 0;

  for(i = 0; i < H; i++) {
    for(j = 0; j < W; j++) {
      if(map[i][j] == '@') {
	count++;
	map[i][j] = '#';
	visit2(j, i);
	return;
      }
    }
  }
}

void visit2(int x, int y) {
  int dir[4][2] = {{1, 0},
		   {0, 1},
		   {-1,0},
		   {0,-1}};
  int dx, dy;
  int i;
  for(i = 0; i < 4; i++) {
    dx = x + dir[i][0];
    dy = y + dir[i][1];
    if(dx >= 0 && dx < W && dy >= 0 && dy < H) {
      if(map[dy][dx] == '.') {
	count++;
	map[dy][dx] = '#';
	visit2(dx, dy);
      }
    }
  }
}

int main() {
  int i, j;
  int a;
  while(1) {
    scanf("%d %d", &W, &H);
    if(W == 0 && H == 0) break;
    for(i = 0; i < 20; i++) {
      for(j = 0; j < 20; j++) {
	map[i][j] = '#';
      }
    }

    for(i = 0; i < H; i++) {
      getchar();
      for(j = 0; j < W; j++) {
	scanf("%c", &map[i][j]);
      }
    }
    visit();
    printf("%d\n", count);
  }
  return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		if(N==1){
			Console.WriteLine(A[0]);
			return;
		}
		
		HashSet<long> H=new HashSet<long>();
		H.Add(0);
		H.Add(enc(0,A[0]));
		
		for(int i=1;i<N;i++){
			HashSet<long> nxt=new HashSet<long>();
			foreach(var s in H){
				long r=decR(s);
				long c=decC(s);
				nxt.Add(s);
				long nr,nc;
				nr=r+A[i];
				nc=c;
				if(nr>nc){long tmp=nr;nr=nc;nc=tmp;}
				nxt.Add(enc(nr,nc));
				nr=r;
				nc=c+A[i];
				if(nr>nc){long tmp=nr;nr=nc;nc=tmp;}
				nxt.Add(enc(nr,nc));
			}
			H=nxt;
		}
		
		long min=(long)1e9;
		long tot=A.Sum();
		foreach(var s in H){
			long r=decR(s);
			long c=decC(s);
			long rem=tot-r-c;
			long max=new long[]{r,c,rem}.Max();
			min=Math.Min(min,max);
		}
		
		Console.WriteLine(min);
		
	}
	
	long enc(long r,long c){return (r<<12)+c;}
	long decR(long s){return s>>12;}
	long decC(long s){return s&0xFFF;}
	
	int N;
	long[] A;
	public Sol(){
		N=ri();
		A=new long[N];
		
		for(int i=0;i<N;i++)A[i]=rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

Measured memory_bytes: 172644
n = input()
src = map(int, raw_input().split())
even = []
odd = []
for i in range(n):
    if i%2 == 0:
        even.append(src[i])
    else:
        odd.append(src[i])
even.reverse()
even.extend(odd)
if n%2 == 0:
    even.reverse()
print ' '.join(map(str, even))


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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)

ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
    ios_base::sync_with_stdio(false);
    ll k;
    string s;
    cin >> k >> s;
    if(s.size()<=k){
        cout << s << endl;
    }else{
        for(int i=0;i<k;i++){
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}


Measured memory_bytes: 3552
var gets = (function(){
  function f(s){return new g(s);}
  function g(s){this._s=s.trim().split("\n");this._y=0;}
  g.prototype.a = function(f){
    var s = this._s, y = this._y, r;
    if(typeof s[y] === "string")s[y]=s[y].split(" ").reverse();
    r = s[y].pop();
    if(!s[y].length)this._y++;
    return f?r:+r;
  }
  g.prototype.l = function(f){
    var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);
  }
  g.prototype.m = function(n,f){
    var r=this._s.slice(this._y,this._y+n).map(a=>a.split(" "));
    this._y += n;
    return f?r:r.map(a=>+a);
  }
  g.prototype.r = function(n,f){
    var r = this._s.slice(this._y,this._y+n);
    this._y += n;
    return f?r:r.map(a=>+a);
  }
  return f;
})();
var o=gets(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var Y = "Yes", N = "No";
  var n = o.a();
  var a = o.l();
  var b = [0,0,0];
  for(var i = 0; i < n; i++){
    var t = a[i] % 4;
    if(t === 0)b[2]++;
    else if(t === 2)b[1]++;
    else b[0]++;
  }
  if(n === b[1])return Y;
  if(b[1])b[0]++;
  if(b[2] && b[0] <= b[2]+1)return Y;
  return N;
}

Measured memory_bytes: 17740
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define rt return 0
#define endln "\n"
#define all(v) v.begin(), v.end()
#define for1(i, a, b) for (long long int i = a; i < b; i++)
#define for2(i, a, b) for (long long int i = a; i > b; i--)
//  cout << fixed << setprecision(0) << pi <<" "<<npi<<endl;typedef long long int i;
typedef long long int lli;
typedef pair<lli, lli> pll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s, t;
    cin >> s >> t;
    lli n1 = s.length();
    lli n2 = t.length();
    lli ans = n2;
    for1(i, 0, n1)
    {
        lli f = 0;
        if (i + n2 > n1)
        {
            break;
        }
        for1(j, i, i + n2)
        {
            if (s[j] != t[j - i])
            {
                f += 1;
            }
        }
        ans = min(f, ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){
	ll x = 0,f = 1;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;
}

const int N = 300005;
int X,Y,n,ans;
int Mx[N*4],lazy[N*4];
struct node{
	int x,y;
	friend bool operator <(node a,node b){
		return a.x < b.x;
	}
}a[N],stkl[N],stkr[N];

inline void update(int k){
	if(lazy[k] != 0){
		int l = k<<1,r = k<<1|1;
		lazy[l] += lazy[k]; lazy[r] += lazy[k];
		Mx[l] += lazy[k]; Mx[r] += lazy[k];
		lazy[k] = 0;
	}
}

void change(int num,int l,int r,int x,int y,int val){
	if(x <= l && r <= y){
		Mx[num] += val;
		lazy[num] += val;
		return;
	}
	int mid = (l+r)>>1;
	update(num);
	if(x <= mid) change(num<<1,l,mid,x,y,val);
	if(y > mid) change(num<<1|1,mid+1,r,x,y,val);
	Mx[num] = max(Mx[num<<1],Mx[num<<1|1]);
}

void solve(){
	sort(a+1,a+n+1);
	int topl = 0,topr = 0;
	for(int i = 1;i < n;++i){
		int cur = i-1;
		if(a[i].y <= Y/2){
			while(topl && stkl[topl].y < a[i].y){
				change(1,1,n,stkl[topl].x,cur,stkl[topl].y - a[i].y);
				cur = stkl[topl--].x-1;
			}
			if(cur != i-1) stkl[++topl] = (node){cur+1,a[i].y};
		}else{
			while(topr && stkr[topr].y > a[i].y){
				change(1,1,n,stkr[topr].x,cur,a[i].y - stkr[topr].y);
				cur = stkr[topr--].x-1;
			}
			if(cur != i-1) stkr[++topr] = (node){cur+1,a[i].y};
		}
		stkl[++topl] = (node){i,0};
		stkr[++topr] = (node){i,Y};
		change(1,1,n,i,i,Y-a[i].x);
		ans = max(ans,Mx[1] + a[i+1].x);
	}
}

signed main(){
	X = read(); Y = read(); n = read();
	for(int i = 1;i <= n;++i) a[i].x = read(),a[i].y = read();
	a[++n] = (node){0,0}; a[++n] = (node){X,Y};
	solve();

	memset(Mx,0,sizeof Mx);
	memset(lazy,0,sizeof lazy);
	swap(X,Y);
	for(int i = 1;i <= n;++i) swap(a[i].x,a[i].y);
	solve();
	printf("%d\n", ans*2);
	return 0;
}

Measured memory_bytes: 15616
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i > 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t int64;

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

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; }

using namespace std;


class A {
	string s, t;
public:
	A()
	{
		cin >> s >> t;
	}
	void solve()
	{
		int ans{ 0 };
		if (s[0] == t[0]) ++ans;
		if (s[1] == t[1]) ++ans;
		if (s[2] == t[2]) ++ans;

		cout << ans << endl;
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

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

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}


void solve(){
    string n;
    cin>>n;
    bool flag=false;
    REP(i,3) if(n[i]=='7')flag=true;
    cout<<(flag?"Yes":"No")<<en;
}

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

    solve();
    //ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <string.h>
#include <math.h>
#define rep(i,l,n) for(i=l;i<n;i++)
void change(double *x){
	if(-0.0005<*x && *x<=0){
		*x=0;
	}
}

int main(void){
	double a,b,c,d,e,f,x,y;

	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF){
		x=(c*e-b*f)/(a*e-b*d);
		y=(a*f-c*d)/(a*e-b*d);
		//printf("%.10f %.10f\n",x,y);
		change(&x);
		change(&y);
		printf("%.3f %.3f\n",x,y);
	}
	
	return 0;
}

Measured memory_bytes: 652
n, k = map(int, input().split(' '))
pp = list(map(int, input().split(' ')))

pp_ex = list(map(lambda p: (p + 1) / 2, pp))

max_ex = 0
for i in range(k):
    max_ex += pp_ex[i]
bef_ex = max_ex
for i in range(1, n - k + 1):
    ex = bef_ex - pp_ex[i - 1] + pp_ex[i + k - 1]
    bef_ex = ex
    if max_ex < ex:
        max_ex = ex

print(max_ex)


Measured memory_bytes: 25060
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
void setcomb() {
	fac[0] = 1;
	ifac[0] = 1;
	for (ll i = 0; i < 300000; i++) {
		fac[i + 1] = fac[i] * (i + 1) % M; // n!(mod M)
		ifac[i + 1] = ifac[i] * mpow(i + 1, M - 2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
	}
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a) {
	long long b = M, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= M;
	if (u < 0) u += M;
	return u;
}
vector<vector<ll>> mul(vector<vector<ll>> a, vector<vector<ll>> b, int n) {
	int i, j, k, t;
	vector<vector<ll>> c(n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			t = 0;
			for (k = 0; k < n; k++)
				t = (t + a[i][k] * b[k][j] % M) % M;
			c[i].push_back(t);
		}
	}
	return c;
}

template< typename Monoid >
struct SegmentTree {

	int sz;
	vector< Monoid > seg;

	const Monoid M1;

	SegmentTree(int n, const Monoid &M1) : M1(M1) {
		sz = 1;
		while (sz < n) sz <<= 1;
		seg.assign(2 * sz, M1);
	}

	void set(int k, const Monoid &x) {
		seg[k + sz] = x;
	}

	void build() {
		for (int k = sz - 1; k > 0; k--) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	void update(int k, const Monoid &x) {
		k += sz;
		seg[k] = x;
		while (k >>= 1) {
			seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
		}
	}

	Monoid query(int a, int b) {
		Monoid L = M1, R = M1;
		for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
			if (a & 1) L = f(L, seg[a++]);
			if (b & 1) R = f(seg[--b], R);
		}
		return f(L, R);
	}

	Monoid value(const int &k) const {
		return seg[k + sz];
	}

	Monoid f(Monoid a, Monoid b) {
		return a + b;
	}
};

int main() {
	int c[33], i;
	char s[11];
	for (i = 0; i < 26; i++)
		c[i] = 0;
	cin >> s;
	for (i = 0; i < 4; i++)
		c[s[i] - 'A']++;
	for (i = 0; i < 26; i++) {
		if (c[i] != 0 && c[i] != 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 4992
import java.io.*;
import java.lang.*;
import java.util.*;
import java.math.*;

class Main{
	static int imax=Integer.MAX_VALUE;
	static long lmax=Long.MAX_VALUE;
	
	public static void main(String[] args) throws FileNotFoundException{
		
		Scanner sc=new Scanner(System.in);
		int n=readI(sc);
		int[] num=readlnI(sc," ");
		int[] color={0,0,0,0,0,0,0,0};
		int scr=0;
		int fr=0;
		
		for(int i=0;i<n; i++){
			scr=num[i];
			
			if(1<=scr && scr<=399){
				color[0]=1;
			}else if(400<=scr && scr<=799){
				color[1]=1;
			}else if(800<=scr && scr<=1199){
				color[2]=1;
			}else if(1200<=scr && scr<=1599){
				color[3]=1;
			}else if(1600<=scr && scr<=1999){
				color[4]=1;
			}else if(2000<=scr && scr<=2399){
				color[5]=1;
			}else if(2400<=scr && scr<=2799){
				color[6]=1;
			}else if(2800<=scr && scr<=3199){
				color[7]=1;
			}else{
				fr+=1;
			}
		}
		
		int mn=0;
		int mx=0;
		
		for(int i=0;i<color.length; i++){
			if(color[i]==1){
				mn+=1;
			}
		}
		
		if(mn==0){
			System.out.printf("%d %d\n",1, mn+fr);
		}else{
			System.out.printf("%d %d\n",mn, mn+fr);
		}
		
		
	}//main_end
	
	//utility
	static int readI(Scanner sc){
		return Integer.parseInt(sc.nextLine().trim());
	}
	static long readL(Scanner sc){
		return Long.parseLong(sc.nextLine().trim());
	}
	static String readS(Scanner sc){
		return sc.nextLine().trim();
	}
	static int[] readlnI(Scanner sc, String dl){
		return Arrays.stream(sc.nextLine().trim().split(dl)).mapToInt(Integer::parseInt).toArray();
	}
	static long[] readlnL(Scanner sc, String dl){
		return Arrays.stream(sc.nextLine().trim().split(dl)).mapToLong(Long::parseLong).toArray();
	}
	static String[] readlnS(Scanner sc, String dl){
		return sc.nextLine().trim().split(dl);
	}
	@SuppressWarnings("unchecked")
	static <T> void puts(T... args){
		for(int i=0; i<args.length-1; i++){
			System.out.printf("%s ",args[i]);
		}
		System.out.println(args[args.length-1]);
	}
	static void puts(int[] ary){
		for(int i=0; i<ary.length-1; i++){
			System.out.printf("%d ",ary[i]);
		}
		System.out.println(ary[ary.length-1]);
	}
	static void puts(long[] ary){
		for(int i=0; i<ary.length-1; i++){
			System.out.printf("%d ",ary[i]);
		}
		System.out.println(ary[ary.length-1]);
	}
	static void bs(){
		System.out.println("");
	}
	static void tblSort(int[][] tbl){
		Arrays.sort(tbl, new Comparator<int[]>(){
			@Override
			public int compare(int[] a, int[] b){
				if(a[0]==b[0]){
					return b[1]-a[1];
				}else{
					return b[0]-a[0];
				}
			}
		});
	}
}


Measured memory_bytes: 27220