akhauriyash/Code-Regression huggingface dataset:
def examA():
    N = I()
    A = LI()
    ans = 1
    flag = None
    for i in range(N-1):
        cur = A[i+1] - A[i]
        if not flag:
            if cur<0:
                flag = "d"
            elif cur>0:
                flag = "u"
        else:
            if cur<0 and flag=="u":
                flag = None
                ans += 1
            elif cur>0 and flag=="d":
                flag = None
                ans += 1
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examA()

"""

"""

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

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


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


int main(){
  int a,b,c;
  cin>>a>>b>>c;
  set<int> s;
  s.insert(a);
  s.insert(b);
  s.insert(c);
  cout<<s.size()<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Long = {
    val N, D = sc.nextInt
    val A = Array.fill[(Long, Long)](N)((sc.nextLong, sc.nextLong))
    var now: Long = 1
    var people: Long = 0
    var ans: Long = 0
    var prevTime: Long = 0
    for (i <- 0 until N) {
      val time = math.abs(now - A(i)._2)
      if (time > A(i)._1 - prevTime) {
        return -1
      } else if (now - 1 + A(i)._2 - 1 <= A(i)._1 - prevTime) {
        ans += (now - 1) * people
        people = 0
      } else {
        ans += (A(i)._1 - prevTime) * people
      }
      people += 1
      if (people > D) {
        return -1
      }
      now = A(i)._2
      prevTime = A(i)._1
    }
    ans + people * (now - 1)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)

    println(solve(sc))
  }
}

Measured memory_bytes: 201976
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
bool cmp(string a,string b){
    return a < b; //按字典序从小到大排列 
} 

int main(){
	int n;
	scanf("%d",&n);
    string s[n];
    int a[n];a[0]=1;
    for(int i=0;i<n;i++)
    cin>>s[i];
    sort(s,s+n);
    for(int i=1;i<n;i++)
    {
    	if(s[i]==s[i-1])
    		a[i]=a[i-1]+1;
    	else
    		a[i]=1;
    }
  //  for(int i=0;i<n;i++){
  //      cout << s[i]<<" ";
  //      cout << a[i]<<" ";
   // }
    int max=0;
    for(int i=0;i<n;i++)
    {
    	if(a[max]<a[i])
    		max=i;
	}
//	printf("%d",a[max]);
	for(int i=0;i<n;i++)
		{
			if(a[i]==a[max])
			cout<<s[i]<<endl;
		}
}

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

int main(){
    string s;
    cin >> s;
    vector<int>a(26,0);
    for(int i = 0;i<s.size();i++){
        int b = s[i] - 'a';
        a[b] += 1;
    }
    bool frag = true;
    for(int i = 0;i<26;i++){
        if(a[i] % 2 == 1){
            frag = false;
        }
    }
    if(frag == true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (N, X) = readLine()!!.split(" ").map{it.toInt()}
    val x = readLine()!!.split(" ").map{Math.abs(it.toLong() - X)}

    println(x.fold(0L, ::gcd))
}

/**
 * Calculate the greatest common divisor of `x` and `y` with Euclidean algorithm
 */
private tailrec fun gcd(x: Long, y: Long): Long = if (y == 0L) x else gcd(y, x % y)


Measured memory_bytes: 50388
#include <iostream>
#include <cstdlib>
#include<string>
#include<stdlib.h>
using namespace std;

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


int main()
{
    double r,g;
    
    cin>>r>>g;
    cout<<g+(g-r)<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.first << ", " << p.second << ")";
}
 
template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
	out << "{";
	for(auto it = a.begin(); it != a.end(); it = next(it))
		out << (it != a.begin() ? ", " : "") << *it;
	return out << "}";
}
 
void dump() { cerr << "\n"; }
template<class T, class... Ts> void dump(T a, Ts... x) {
	cerr << a << ", ";
	dump(x...);
}

#ifdef DEBUG
#  define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__)
#else
#  define debug(...) false
#endif
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
template<class T> int size(T && a) { return a.size(); }
 
using LL = long long;
using PII = pair<int, int>;

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

	LL n, a, b;
	cin >> n >> a >> b;
	if(a % 2 == b % 2) {
		cout << (b - a) / 2 << "\n";
	}
	else {
		LL x = a + (b - a - 1) / 2;
		LL y = n - b + (b - a + 1) / 2;
		cout << min(x, y) << "\n";
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

//Lost in Space
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		double RATIO = 1e-4;
		while(t--!=0){
			double qr = sc.nextDouble(), rp = sc.nextDouble(), pq = sc.nextDouble();
			double r1 = qr/rp, r2 = rp/pq, r3 = pq/qr;
			int n = sc.nextInt();
			double[] x = new double[n+1], y = new double[n+1], z = new double[n+1];
			for(int i=1;i<=n;i++){
				x[i] = sc.nextDouble()*9.461; y[i] = sc.nextDouble()*9.461; z[i] = sc.nextDouble()*9.461;
			}
			for(int p=1;p<=n;p++)for(int q=1;q<=n;q++)for(int r=1;r<=n;r++){
				if(p==q||q==r||r==p)continue;
				double QR = Math.sqrt(Math.pow(x[q]-x[r], 2)+Math.pow(y[q]-y[r], 2)+Math.pow(z[q]-z[r], 2));
				double RP = Math.sqrt(Math.pow(x[p]-x[r], 2)+Math.pow(y[p]-y[r], 2)+Math.pow(z[p]-z[r], 2));
				double PQ = Math.sqrt(Math.pow(x[q]-x[p], 2)+Math.pow(y[q]-y[p], 2)+Math.pow(z[q]-z[p], 2));
				double R1 = QR/RP, R2 = RP/PQ, R3 = PQ/QR;
				double d1 = Math.abs(r1-R1), d2 = Math.abs(r2-R2), d3 = Math.abs(r3-R3);
				if(d1<RATIO && d2<RATIO && d3<RATIO){
					System.out.println(p+" "+q+" "+r);break;
				}
			}
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 13000
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
  int N;
  cin >> N;
  multiset<int> ms;
  rep(i, N)
  {
    int a;
    cin >> a;
    ms.insert(a);
  }
  int ans = 0;
  while (!ms.empty())
  {
    auto it = --ms.end();
    int a = *it;
    ms.erase(it);
    int b = 1;
    while (b <= a)
      b *= 2;
    auto jt = ms.find(b - a);
    if (jt != ms.end())
    {
      ans++;
      ms.erase(jt);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9600
#include <cstdio>
const int MAXN = 2e5+1;
const int mo = 1e9+7;
typedef long long LL;
int fac[MAXN], inv[MAXN];
int pow(int x, int y)
{
	int res = 1;
	while (y)
	{
		if(y&1) res = LL(res) * x % mo;
		x = LL(x) * x % mo;
		y >>= 1;
	}
	return res;
}
void init(int lmt)
{
	fac[0] = inv[0] = 1;
	for(int i=1; i<=lmt; ++i)
		fac[i] = LL(fac[i-1])*i%mo, inv[i] = pow(fac[i], mo-2);
}
int calc(int x, int y)
{
	return LL(fac[x+y]) * inv[x] % mo * inv[y] % mo;
}
int main()
{
	int H, W, A, B, i, ans = 0;
	scanf("%d%d%d%d", &H, &W, &A, &B);
	init(H+W);
	for(i=B+1; i<=W; ++i)
		ans = (ans + LL(calc(i-1, H-A-1)) * calc(W-i, A-1)) % mo;
	printf("%d\n", ans);
}


Measured memory_bytes: 1792
/*  ex9_1
    suuxxu  */

#include <stdio.h>
#include <stdlib.h>
#define SIZE 10

typedef struct { // 文字列を格納するスタック
    int size; // 最大データ数
    int count; // 現在のデータ数
    char data[SIZE]; // データ配列
    char *top; // topへのポインタ
} stack;

void initialize_stack(stack *stk); // スタックの初期化
void print_stack(stack *stk); // スタックの中身を古い順に出力
void push(stack *stk, char chr); // スタックのpush操作
char pop(stack *stk); // スタックのpop操作

stack stk;

int main(void){
    int i;
    char input[10], tmp;

    initialize_stack(&stk); // スタックを初期化
    
    scanf("%s", input); // 入力をinputに格納

    for(i = 0; i < strlen(input); i++){
        if(input[i] == 'B'){ // バックスペースなら
            tmp = pop(&stk); // popで1番新しい要素を削除
        }else{
            push(&stk, input[i]); // それ以外の文字ならpushで要素を追加
        }
    }

    print_stack(&stk); // 結果を出力

    return 0;
}

void initialize_stack(stack *stk){ // スタックの初期化
    stk->count = 0; // 現在のデータ数を0に
    stk->size = SIZE; // 最大データ数をSIZEに
    stk->top = &(stk->data[SIZE]); // topを配列の最終要素の1つ手前に
}

void push(stack *stk, char chr){ // スタックのpush操作
    if(stk->count >= stk->size){
        printf("Error: stack overflow. (x=%c)\n", chr); // 容量がオーバーフローする
        exit(1);
    }else{
        stk->top--; // topを1つ手前に移動
        *(stk->top) = chr; // topにデータを格納
        stk->count++; // データ数を1つ増やす
    }
}

char pop(stack *stk){ // スタックのpop操作
    char chr;
    if(stk->count > 0){
        chr = *(stk->top); // topの位置のデータを取り出す
        stk->top++; // topを1つ後ろに移動
        stk->count--; // データ数を1つ減らす
        return chr;
    }
}

void print_stack(stack *stk){ // スタックの中身を古い順に出力
    int i, len;
    char output[10];

    len = stk->count; // 出力の長さを記録

    for(i = 1; i <= len; i++){
        output[len - i] = pop(stk); // スタックからpopしたデータを後ろからoutputに記録
    }

    for(i = 0; i < len; i++){
        printf("%c", output[i]); // outputを出力
    }

    printf("\n");
}

Measured memory_bytes: 1604
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using static System.Math;
using System.Linq;
using static System.Array;

namespace ConsoleApp2
{
    class Program
    {
    

        static void Main(string[] args)
        {

            //var NK = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
            //var N = NK[0];
            //var K = NK[1];

            var N = long.Parse(Console.ReadLine());

            var Dic = PrimeFactorization(N);

            var res = 0L;
            foreach (var item in Dic)
            {
                var value = item.Value;
                res += Find(value);
            }


            Console.WriteLine(res);
        }

        static long Find(long value)
        {
            var l = 0;
            var r = 100;
            var mid = (l+r)/2;
            while (l+1 < r)
            {
                mid = (l + r) / 2;
                if (mid*(mid+1)/2 <= value)
                {
                    l = mid;
                }
                else
                {
                    r = mid;
                }
            }
            return l;
        }

        public static Dictionary<long, long> PrimeFactorization(long n)
        {
            var result = new Dictionary<long, long>();

            for (long i = 2; i * i <= n; i++)
            {
                if (n % i != 0) continue;
                long exponents = 0;

                // 割り続ける
                while (n % i == 0)
                {
                    exponents++;
                    n /= i;
                }

                result[i] = exponents;
            }

            // 素数が残っている場合
            if (n != 1) result[n] = 1;
            return result;
        }
    }

}


Measured memory_bytes: 27764
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()
tmp = s.replace('ABC', '1')
ans = 0
for t in tmp:
    if(t == '1'):
        ans += 1
print(ans)


Measured memory_bytes: 74584
#include <bits/stdc++.h>
using namespace std;
int n, m, j, i, k, a, s;
int main(){
	scanf("%d%d%d", &k, &n, &m);
	for(i=n; i<=m; i++){
		if(i%k==0){
			s++;
		}
	}
	if(s==0){
		printf("NG");
	}
	else{
		printf("OK");
	}
	return 0;
}

Measured memory_bytes: 3748
#include <stdio.h>
#include <math.h>

long modpow(long a, long n, long mod){
  long size;
  for (long i = 1; ; i++) {
    if (pow(2,i) > n) {
      size = i;
      break;
    }
  }
  long bit[size];
  bit[0] = n;
  for (long i = 1; i < size; i++) {
    bit[i] = bit[i-1]/2;
    bit[i-1] %= 2;
  }
  long powa[size];
  powa[0] = a;
  for (long i = 1; i < size; i++) {
    powa[i] = powa[i-1]*powa[i-1];
    powa[i] %= mod;
  }
  long answer = 1;
  for (long i = 0; i < size; i++) {
    if (bit[i] == 1) {
      answer *= bit[i]*powa[i];
      answer %= mod;
    }
  }
  return answer;
}

int main(void){

  long n,k;
  scanf("%ld %ld", &n, &k);
  long mod = pow(10,9)+7;
  long answer = 0;
  long count[k+1];
  for (long i = k; i >= 1; i--) {
    count[i] = modpow(k/i,n,mod);
    for (long j = 2; i*j <= k; j++) {
      count[i] -= count[i*j];
      count[i] %= mod;
    }
  }
  long sum;
  for (long i = 1; i <= k; i++) {
    sum = i*count[i];
    sum %= mod;
    answer += sum;
    answer %= mod;
  }
  printf("%ld\n", answer);

  return 0;
}

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

int main()
{
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int x3 = x2 + y1 - y2;
	int y3 = y2 + x2 - x1;
	int x4 = x3 + y2 - y3;
	int y4 = y3 + x3 - x2;

	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0LL)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;}
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


bool isOk(ll key,ll value){
  return key >= value;
}

ll binary_search(vector<ll> a,ll key){
  ll ok = a.size()-1;
  ll ng = 0;

  while(abs(ok - ng) > 1){
    ll mid = (ok + ng) / 2;
    if(isOk(key,a[mid]))ok = mid;
    else ng = mid;
  }
  return ok;
}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n,m;cin>>n>>m;
  vector<int> a(m);rep(i,m)cin>>a[i];
  sort(all(a));
  if(m == 1){
    print(0);return 0;
  }

  vector<int> dif(m-1);
  ll ans = 0;
  rep(i,m-1){
    dif[i] = abs(a[i+1] - a[i]);
    ans += dif[i];
  }
  sort(all(dif));
  reverse(all(dif));

  rep(i,n-1){
    if(m-1 < i)break;
    ans -= dif[i];
  }
  print(ans);
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;

ll ans[100][100001];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,W;	cin>>n>>W;
	ll i,j,w[n],v[n];
	for(i=0;i<n;i++){
		cin>>w[i]>>v[i];
	}

	ans[0][w[0]]=v[0];
	for(i=1;i<n;i++){
		for(j=0;j<=W;j++){
			ans[i][j]=ans[i-1][j];
		}
		for(j=0;j<=W-w[i];j++){
			ans[i][j+w[i]]=max(ans[i][j+w[i]],ans[i-1][j]+v[i]);
		}
	}
	ll maxi=0;
	for(i=1;i<=W;i++){
		maxi=max(maxi,ans[n-1][i]);
	}
	cout<<maxi;
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if( A + B > C + D ){
    cout << "Left" << endl;
  }
  else if( A + B == C + D ){
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 3580
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


x = 7
ans = 1
k = inp()
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
while True:
    if x % k == 0:
        print(ans)
        exit()
    else:
        x += 7 * pow(10, ans, k) % k
        ans += 1


Measured memory_bytes: 68556
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int x[N],y[N],h[N];
  REP(i,N)cin>>x[i]>>y[i]>>h[i];
  int ans[3]={-1,-1,-1};
  REP(cx,101){
    REP(cy,101){
      bool f= true;
      int H;
      REP(i,N){
        if(h[i]==0)continue;
        H=h[i]+(int)abs(x[i]-cx)+(int)abs(y[i]-cy);
        break;
      }
      REP(i,N){
        int ht=max(H-(int)abs(x[i]-cx)-(int)abs(y[i]-cy),0);
        if(ht!=h[i])f=false;
      }
      if(f){
        ans[0]=cx;
        ans[1]=cy;
        ans[2]=H;
        break;
      }
    }
    if(ans[0]>=0)break;
  }
  cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<endl;
  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func sort(x, y int)(int, int) {
	if x > y {
		return y, x
	}
	return x, y
}
func main() {

	var a, b int
	fmt.Scan(&a, &b)
	for a != 0 || b != 0 {
		a, b = sort(a, b)
		fmt.Println(a, b)
		fmt.Scan(&a, &b)
	}
}


Measured memory_bytes: 1296
#include <bits/stdc++.h>
using namespace std;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)

map<int,int> mp;
int main(){
	int a, b, k;
	scanf("%d%d%d", &a, &b, &k);
	repi(i,a,a+k){
		if(i < 1 || i > b)continue;
		printf("%d\n", i);
		mp[i] = 1;
	}
	repi(i,b-k+1,b+1){
		if(i < 1 || i < a)continue;
		if(mp[i] == 0)printf("%d\n", i);
	}
	return 0;
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0) {
        c -= b;
        a -= d;
//        cout << "a = " << a << ", c =" << c << endl;
    }

    cout << (c <= 0 ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3572
#include <iostream>
#include <map>

using namespace std;

void solve()
{
	int N, Q;
	while(cin >> N >> Q, N || Q)
	{
		map<int, int> Map;
		for(int i = 0; i < N; ++i)
		{
			int M;
			cin >> M;
			for(int j = 0; j < M; ++j)
			{
				int date;
				cin >> date;
				++Map[date];
			}
		}
		int day = 0;
		int max_present = 0;
		map<int, int>::iterator it = Map.begin();
		while(it != Map.end())
		{
			if(max_present < it->second)
			{
				day = it->first;
				max_present = it->second;
			}
			++it;
		}
		if(max_present >= Q)
		{
			cout << day << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1196
if __name__ == '__main__':
    O=input()
    E=input()
    O=list(O)
    E=list(E)
    password=[]
    n=min(O.__len__(),E.__len__())
    for i in range(n):
        password.append(O.pop(0))
        password.append(E.pop(0))
    password+=O
    password+=E
    print("".join(password))



Measured memory_bytes: 38492
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int s = gi();
    int w = gi();
    printf(w >= s ? "unsafe\n" : "safe\n");

    return 0;
}


Measured memory_bytes: 3848
inf=10**8

n,m=map(int,input().split())

A=[]
C=[]
dp=[inf]*(1<<n)
dp[0]=0

for _ in range(m):
  a,_=map(int,input().split())
  c=list(map(int,input().split()))
  A.append(a)
  tmp=0
  for i in c:
    tmp+=1<<(i-1)
  C.append(tmp)

for i in range(1<<n):
  for index,j in enumerate(C):
    dp[i|j]=min(dp[i|j],dp[i]+A[index])
ans=dp[-1]
if ans==inf:ans=-1
print(ans)

Measured memory_bytes: 45800
parseInt(x) = parse(Int,x)

parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    mod = 10^9 + 7
    N, M = readline() |> split |> parseMap
    S = readline() |> split |> parseMap
    T = readline() |> split |> parseMap
    DP = [[1 for j in 1:N+1] for i in 1:M+1]
    C=0
    for i in 1:M
        for j in 1:N
            if T[i]==S[j]
                C=300^2
                C=300^2
                C=30-10
                DP[i+1][j+1] = (DP[i+1][j]+DP[i][j+1])%mod
            else
                C=300^2
                C=300^2
                C=30-10
                DP[i+1][j+1] = (mod + DP[i+1][j]+DP[i][j+1]-DP[i][j])%mod
            end
        end
    end
    println(DP[M+1][N+1])
end

main()


Measured memory_bytes: 146184
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;


int main(){
    int n,d=0,max=0;
    cin>>n;
    
    vector<string> a(n);
    rep(i,n) cin>>a[i];
        
    
    int m;
    cin>>m;
    
    vector<string> b(m);
    rep(i,m) cin>>b[i];
    
    rep(i,n) {
        rep(j,n) if(a[i]==a[j]) d++;
        rep(j,m) if(a[i]==b[j]) d--;
        if(d>max) max=d;
        d=0;
    }
    
    cout<<max<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
string S;
  cin >> N;
  cin >> S;
  int number = 0;
  for(int a = 0;a < S.length();a++){
    if(S[a]=='A')number = 0;
    if(S[a]=='B')number = 1;
    if(S[a]=='C')number = 2;
    if(S[a]=='D')number = 3;
    if(S[a]=='E')number = 4;
    if(S[a]=='F')number = 5;
    if(S[a]=='G')number = 6;
    if(S[a]=='H')number = 7;
    if(S[a]=='I')number = 8;
    if(S[a]=='J')number = 9;
    if(S[a]=='K')number = 10;
    if(S[a]=='L')number = 11;
    if(S[a]=='M')number = 12;
    if(S[a]=='N')number = 13;
    if(S[a]=='O')number = 14;
    if(S[a]=='P')number = 15;
    if(S[a]=='Q')number = 16;
    if(S[a]=='R')number = 17;
    if(S[a]=='S')number = 18;
    if(S[a]=='T')number = 19;
    if(S[a]=='U')number = 20;
    if(S[a]=='V')number = 21;
    if(S[a]=='W')number = 22;
    if(S[a]=='X')number = 23;
    if(S[a]=='Y')number = 24;
    if(S[a]=='Z')number = 25;
    number = (number  + N) % 26;
    
    if(number == 0)S[a] = 'A';
    if(number == 1)S[a] = 'B';
    if(number == 2)S[a] = 'C';
    if(number == 3)S[a] = 'D';
    if(number == 4)S[a] = 'E';
    if(number == 5)S[a] = 'F';
    if(number == 6)S[a] = 'G';
    if(number == 7)S[a] = 'H';
    if(number == 8)S[a] = 'I';
    if(number == 9)S[a] = 'J';
    if(number == 10)S[a] = 'K';
    if(number == 11)S[a] = 'L';
    if(number == 12)S[a] = 'M';
    if(number == 13)S[a] = 'N';
    if(number == 14)S[a] = 'O';
    if(number == 15)S[a] = 'P';
    if(number == 16)S[a] = 'Q';
    if(number == 17)S[a] = 'R';
    if(number == 18)S[a] = 'S';
    if(number == 19)S[a] = 'T';
    if(number == 20)S[a] = 'U';
    if(number == 21)S[a] = 'V';
    if(number == 22)S[a] = 'W';
    if(number == 23)S[a] = 'X';
    if(number == 24)S[a] = 'Y';
    if(number == 25)S[a] = 'Z';
    
    
    
  }
  
  cout<<S<<endl;
 
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

#define bit(b, i) (((b) >> (i)) & 1)

int n, a[1 << 18];
vector<pair<int, int>> dp[1 << 18];

int t[1 << 18];

void f(int a, int b) {
	dp[a][2] = dp[b][0];
	dp[a][3] = dp[b][1];
	sort(RALL(dp[a]));
	unique(ALL(dp[a]));
}

int main() {
	cin >> n;
	inc(i, 1 << n) { cin >> a[i]; }
	
	inc(i, 1 << n) {
		dp[i].EB(a[i], i);
		inc(k, 3) { dp[i].EB(-1, -1); }
	}
	
	inc(i, 1 << n) {
	inc(j, n) {
		if(bit(i, j) == 0) { f(i | (1 << j), i); }
	}
	}
	
	int ma = 0;
	incID(i, 1, 1 << n) {
		setmax(ma, dp[i][0].FI + dp[i][1].FI);
		cout << ma << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 22528
from collections import deque
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


H, W = map(int, input().split())
grid = [[0]*W for _ in range(H)]

cnt = 0
for i in range(H):
    l = input()
    for j in range(W):
        grid[i][j] = l[j]
        if l[j] == '.':
            cnt += 1


# 動的計画法 dp[i][j]->grid[i][j]に行くための最短距離
dp = [[float('inf')]*W for _ in range(H)]


def check_in(x, y):
    return 0 <= x < W and 0 <= y < H


def bfs():
    dx = [1, -1, 0, 0]
    dy = [0, 0, 1, -1]
    Q = deque([[0, 0]])
    dp[0][0] = 0

    while Q:
        s = Q.popleft()
        if s[0] == H-1 and s[1] == W-1:
            return
        else:
            s_x = s[1]
            s_y = s[0]
            for x, y in zip(dx, dy):
                n_x = s_x+x
                n_y = s_y+y

                if check_in(n_x, n_y):
                    if grid[n_y][n_x] != "#" and dp[n_y][n_x] == float('inf'):
                        Q.append([n_y, n_x])
                        dp[n_y][n_x] = dp[s_y][s_x]+1


def solve():
    bfs()
    min_dist = dp[H-1][W-1]
    if min_dist == float('inf'):
        return -1
    else:
        return cnt - min_dist-1


print(solve())


Measured memory_bytes: 3316
n=int(input())
l = list(map(int,input().split()))
if len(l) < 3:
  print(0)
  exit()
r = 0
for i in range(len(l) - 2):
  for j in range(i + 1, len(l) - 1):
    for k in range(j + 1, len(l)):
      if l[i] == l[j]:
        continue
      if l[j] == l[k]:
        continue
      if l[i] == l[k]:
        continue
      if l[i] + l[j] <= l[k]:
        continue
      if l[i] + l[k] <= l[j]:
        continue
      if l[k] + l[j] <= l[i]:
        continue
      r += 1
print(r)

Measured memory_bytes: 9196
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 205000;

int n;
pair <int, int> v[MAXN];
int ans[MAXN];

int main() { 

  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i].first);
    v[i].second = i;
  }
  sort(v, v + n);

  for (int i = 0; i < n; i++) {
    if (i < n / 2) {
      ans[v[i].second] = v[n / 2].first;
    } else {
      ans[v[i].second] = v[(n / 2) - 1].first;
    }
  }

  for (int i = 0; i < n; i++) {
    printf("%d\n", ans[i]);
  }

  return 0;
}


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

int primemax(int m);
int primemin(int m);

int main() {
	int n;
	while (scanf("%d",&n) != EOF) {
		cout << primemax(n - 1) << " " << primemin(n + 1) << endl;
	}
}

int primemax(int n)
{
	int t;
	for (n;; n--)
	{
		for (t = 2; t <= n; t++)
		{
			if (t == n)
			{
				return n;
			}
			else if (n%t == 0)
			{
				break;
			}
		}
	}
}
int primemin(int n)
{
	int t;
	for (n;; n++)
	{
		for (t = 2; t <= n; t++)
		{
			if (t == n)
			{
				return t;
			}
			else if (n%t == 0)
			{
				break;
			}
		}
	}
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	int r;
	while(r=a%b){
		a=b;
		b=r;
	}
	return b;
}
int main(){
	int n;cin>>n;
	int a[n];
	rep(i,n) cin>>a[i];
	int g=gcd(a[0],a[1]);
	for(int i=2;i<n;i++) g=gcd(g,a[i]);

	cout<<g<<"\n";
}

Measured memory_bytes: 640
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
l.sort()
if n%2==0:
    s=l[:n//2]
    b=l[n//2:]
    ans=0
    for i in range(n-1):
        if i%2==0:
            ans+=b[i//2]-s[i//2]
        else:
            ans+=b[(i+1)//2]-s[i//2]
    print(ans)
else:
    s=l[:n//2]
    b=l[n//2+1:]+[l[n//2]]
    ans1=0
    for i in range(n-1):
        if i%2==0:
            ans1+=b[i//2]-s[i//2]
        else:
            ans1+=b[(i+1)//2]-s[i//2]
    t=[l[(n//2)]]+l[:n//2]
    c=l[n//2+1:]
    ans2=0
    for i in range(n-1):
        if i%2==0:
            ans2+=c[i//2]-t[i//2]
        else:
            ans2+=c[i//2]-t[(i+1)//2]
    print(max(ans1,ans2))

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

int main(){
	char ch;
	int count[26] = { 0 };
	while (cin >> ch){
		int num = -1;

		if (ch >= 'a'&&ch <= 'z'){
			num = ch - 'a';
			count[num]++;
		}
		if (ch >= 'A'&&ch <= 'Z'){
			num = ch - 'A';
			count[num]++;
		}
	}
	for (int i = 0; i < 26; i++){
		cout << (char)('a' + i) << " : " << count[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 1140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 998244353

ll ch[100010];

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
	ll n;
	cin>>n;
	for(ll i=0;i<n;i++){
		ll now;
		cin>>now;
		ch[now]++;
		if(i==0&&now!=0){
			cout << 0;
			return 0;
		}
	}
	if(ch[0]!=1){
		cout << 0;
		return 0;
	}
	ll cnt=ch[0];
	ll ans=1;
	for(ll i=1;;i++){
		if(ch[i]==0){
			cout << 0;
			return 0;
		}
		ans*=modpow(ch[i-1], ch[i], 998244353); 
		ans%=inf;
		cnt+=ch[i];
		if(cnt==n){
			break;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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


void solve(long long N, std::string S){
    vector<int> ruisekiB;
    ruisekiB.push_back(0);
    for(int i = 0;i < N;i++){
        ruisekiB.push_back((S[i] == 'B' ? 1 : 0) + ruisekiB.back());
    }
    vector<int> ruisekiR;
    ruisekiR.push_back(0);
    for(int i = 0;i < N;i++){
        ruisekiR.push_back((S[i] == 'R' ? 1 : 0) + ruisekiR.back());
    }

    vector<int> ruisekiG;
    ruisekiG.push_back(0);
    for(int i = 0;i < N;i++){
        ruisekiG.push_back((S[i] == 'G' ? 1 : 0) + ruisekiG.back());
    }
    ll ans = 0;

    for(int i = 0;i < N - 2;i++){
        for(int j = i + 1;j < N - 1;j++){
            if(S[i] != S[j]){
                if(!(S[i] == 'R' || S[j] == 'R')){
                    ans += ruisekiR.back() - ruisekiR[j + 1];
                    int d = j - i;
                    if(j + d < N){
                        if(S[j + d] == 'R'){
                            ans--;
                        }
                    }
                }
                if(!(S[i] == 'G' || S[j] == 'G')){
                    ans += ruisekiG.back() - ruisekiG[j + 1];
                    int d = j - i;
                    if(j + d < N){
                        if(S[j + d] == 'G'){
                            ans--;
                        }
                    }
                }
                if(!(S[i] == 'B' || S[j] == 'B')){
                    ans += ruisekiB.back() - ruisekiB[j + 1];
                    int d = j - i;
                    if(j + d < N){
                        if(S[j + d] == 'B'){
                            ans--;
                        }
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
const long long P = 1000000007;

int main() {
  long long a,b,c,d;
  cin >> a >> b >> c >> d;
  long long ans = a*c;
  ans = max(ans,max(a*c,a*d));
  ans = max(ans,max(b*c,b*d));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

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



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

  int cnt4=0, cnt2=0, cnt1=0;
  rep(i, n) {
    int a;
    cin >> a;

    if(a % 4 == 0) cnt4++;
    else if(a % 2 == 0) cnt2++;
    else cnt1++;
  }

  if(cnt4 >= cnt1) cout << "Yes" << endl;
  else if(cnt4 + 1 < cnt1) cout << "No" << endl;
  else if(cnt2 > 0) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}

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

int main() {
   ll i,j,k;
    ll a,b,ans=0;
    cin >> a>>b;
    if(a>=1 && a<=9 && b>=1 && b<=9)
    {
      ans=a*b;
    }else
    {
      ans=-1;
    }
  cout <<ans  << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
}
 
int32_t main()
{
    c_p_c();
    int n;
    cin>>n;
    vi arr(n,0);
    int dp[403][403]={0};
  memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    auto sum=[&](int l,int r)
    {  int s=0;
        for(int i=l;i<=r;i++)
        s+=arr[i];
        return s;
    };
    for(int l=n-1;l>=0;l--)
    {
        for(int r=l;r<n;r++)
        {
            
          if(l==r)
          dp[l][r]=0;
          else
          {  dp[l][r]=1e17+5;
              int s=sum(l,r);
              for(int i=l;i<=r-1;i++)
              {
                  dp[l][r]=min(dp[l][r],dp[l][i]+dp[i+1][r]+s);
              }
          }
        }
    }
    
    cout<<dp[0][n-1];
    return 0;
}

Measured memory_bytes: 1536
N = int(input())
alpha =['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
x = 1
Z = 'A'
while N > 0:
    if N % 26 == 0:
        Z += 'z'
        N = (N - 1)  //26
    else:
        Z += alpha[((N - 1)  % 26)]
        N = N // 26
#    print(Z) 
#Z += alpha[N - 1]
#print('Z = ', Z)
for i in range(len(Z) - 1, 0 , -1):
    print(Z[i], end = '')


Measured memory_bytes: 9120
//
//  main.cpp
//  ProgrammingContestChallengeBook2
//
//  Created by Hisaki Kobayashi on 2020/04/04.
//  Copyright © 2020 Hisaki Kobayashi. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <string>
#include <bits/stdc++.h>
#include <stdlib.h>
//#include "mylibrary.hpp"

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

using namespace std;
int main(){
    int N; cin >> N;

    int hyaku=(N/100)%10,zyu=(N/10)%10,iti=N%10;

//    cout << hyaku << " " << zyu << " " << iti << endl;
    if(hyaku==7 || zyu == 7 || iti == 7)
        cout << "Yes" << endl;
    else{
        cout << "No" << endl;
    }


    
    
//    long N; cin >> N;
//
//    vector<int> A(7,0);
//
//    int div=1;
//    long sum=0;
//    for(int i=1;i<=N;i++){
//        if(i%3!=0 && i%5!=0){
//            sum+=i;
//        }
//    }
//    cout << sum << endl;
//
    
//    int a, b, c,K;
//      cin >> K;
//
//    a=100;
//    b=50;
//    c=7;
//
//     cout << "abcの最大公約数:" << gcd(gcd(a, b),c) << endl;
//
    
    
    return 0;
 
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	int n,k;
	string s;
	cin>>n>>k;
	cin>>s;
	if(s[k-1]=='A')s[k-1]='a';
	else if(s[k-1]=='B')s[k-1]='b';
	else if(s[k-1]=='C')s[k-1]='c';
	cout<<s<<endl;
	return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define mem(x,val) memset(x,val,sizeof(x))
#define forr(i,a,b) for(ll i=a;i<b;i++)
#define f(i,n) forr(i,0,n)
#define sz(x) ll((x).size())
#define all(x) ((x).begin(),(x).end())
#define asc(x) ((int)(x))
#define precision(x) cout<<fixed<<setprecision((x));

const ll mod=1e9 + 7;

/*******************************************************************************************/

void solve()
{
    ll n,x,y;
    cin>>n>>x>>y;
    x--,y--;

    ll d[n][n];

    f(a,n)
    {
        for(ll b=a+1;b<n;b++)
        {
            d[a][b]=b-a;
            d[a][b] = min(d[a][b],abs(x-a)+1+abs(b-y));
        }
    }

    ll ans[n];
    mem(ans,0);

    f(i,n)
    {
        for(ll j=i+1;j<n;j++) ans[d[i][j]-1]++;
    }
    f(i,n-1) cout<<ans[i]<<"\n";

    return;
}

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

    ll t=1;
    //cin>>t;
    clock_t launch=clock();

    while(t--)
    {
        solve();
    }

    clog<<((long double)(clock()-launch)/CLOCKS_PER_SEC)<<"\n";
}


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

using namespace std; using ll=long long; const ll LNF=1e18; const int INF = 1e9+1; const ll M = 1e9+7;
typedef pair<int,int> P;

int main() {
  ll a,b,c,k; cin>>a>>b>>c>>k;
  ll an = min(a, k); k -= min(a, k);
  k -= min(b, k);
  an -= min(c, k);
  cout << an <<endl;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // a - (N - a) - 1
  int K, T; cin >> K >>T;
  int M = 0;
  REP(i, T){
    int tmp; cin >> tmp;
    chmax(M, tmp );
  }
  cout << max(0, 2*M-K-1) << endl;
}

Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#include<list>
#define ll long long int
#define MOD 1000000007LL
using namespace std;
int main() {
    int c[4][4]={};
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>c[i][j];
        }
    }
    bool f=true;
    int a=c[0][0]-c[1][0];
    int b=c[1][0]-c[2][0];
    int e=c[0][0]-c[0][1];
    int g=c[0][1]-c[0][2];
    for(int i=1;i<3;i++){
        if((c[i][0]-c[i][1]!=e)||(c[i][1]-c[i][2]!=g)){
            f=false;
        }
    }
    for(int i=1;i<3;i++){
        if((c[0][i]-c[1][i]!=a)||(c[1][i]-c[2][i]!=b)){
            f=false;
        }
    }
    if(f){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
import std.stdio;

void main(){
	int n, m;
	string[10] ans;
	while (scanf("%d", &n), n) {
		ans = "";
		foreach (i; 0..n) {
			scanf("%d", &m);
			ans[m] ~= '*';
		}
		foreach (i; 0..10) {
			if (!ans[i].length) ans[i] = "-";
			writeln(ans[i]);
		}
	}
}

Measured memory_bytes: 1008
#include <stdio.h>
int Y (int* ,int);
int count;
int main ()
{
  int i,n,hi[100];
  scanf ("%d",&n);
  for (i=0;i<n;i++){
    scanf ("%d",&hi[i]);
  }
  count=Y(hi,n);

  for (i=0;i<n;i++){
    printf ("%d",hi[i]);
    if (i!=n-1)
      printf (" ");
  }
  printf ("\n");
  printf ("%d\n",count);

  return 0;
}
int Y (int* A,int N){
  int i,j,minj,p,count=0;
  for (i=0;i<=N-1;i++){
    minj=i;
    for (j=i;j<=N-1;j++){
      if (A[j]<A[minj]){
	minj=j;
      }
    }
    /*交換*/
    if(i!=minj){
      p=A[i];
      A[i]=A[minj];
      A[minj]=p;
      count++;
    }
  }
  return count;
}



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

bool chk[100005]={};

int main(){
    int n,curr,step;
    int val[]={1,6,36,216,1296,7776,46656,9,81,729,6561,59049};
    scanf("%d",&n);
    queue<tuple<int,int> > q;

    for(int i=11;i>=0;i--)
        q.push(make_tuple(n-val[i],1) );

    while(!q.empty()){
       // printf("chk\n");
        tie(curr,step)=q.front();
        q.pop();
        if(curr>n||curr<0||chk[curr]) continue;
        chk[curr]=true;
        if(!curr){
            printf("%d",step);
            break;
        }

        for(int i=11;i>=0;i--)
            q.push(make_tuple(curr-val[i],step+1) );
    }


}


Measured memory_bytes: 2304
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y
def primes(n):
    P=[2]
    for L in range(3, n):
        isP = True
        for L2 in P: isP = isP and L%L2
        if isP: P.append(L)
    return P

A,B=LI()
gd = gcd(A,B)
if gd == 1:
    print(1)
    exit()

# print("gcd: {}".format(gd))
cands = []
prs = []

for i in range(2, math.ceil(math.sqrt(gd))+1):
    if gd%i == 0:
        cands.append(i)
        cands.append(gd//i)

cands.sort()
cands.append(gd)

for i in range(0, len(cands)):
    ok = True
    for prime in prs:
        if cands[i]%prime == 0:
            ok = False
            break
    if ok:
        prs.append(cands[i])

# print(prs)
print(len(prs)+ 1)


Measured memory_bytes: 40172