akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, m;
    int a[101][101]={0};
    int b[101]={0};
    int c[101]={0};
    scanf("%d %d", &n, &m);
    
    for (int j=0; j<n; j++) {
        for (int i=0; i<m; i++) {
            scanf("%d", &a[j][i]);
        }
    }
    for (int i=0; i<m; i++) {
        scanf("%d", &b[i]);
    }
    
    //ベクトル演算
    for (int j=0; j<n; j++) {
        for (int i=0; i<m; i++) {
            c[j] += a[j][i]*b[i];
        }
    }
    for (int j=0; j<n; j++) {
        printf("%d\n", c[j]);
    }
    return 0;
}


Measured memory_bytes: 2104
#include<stdio.h> 
int main() 
  { 
     int arr[5],i,a; 
     for(i=0;i<5;i++)
       { 
          scanf("%d",&arr[i]);
       }
  for(i=0;i<5;i++)
    { 
       if(arr[i]==0)
         { 
           a=i+1;
         }
    } 
  printf("%d",a);
  return 0;
  }


Measured memory_bytes: 1700
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int r = n-1;
    while(s[r] == 'B'){
        r--;
        if(r < 0)break;
    }
    ll ans = 0;
    for(int i = r; i >= 0; i--){
        if(s[i] == 'B'){
            ans += r - i;
            r--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define endl '\n'
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define in insert
#define pi 3.14159265358979323846
#define rep(i,a,b) for(int i = a ; i < b ; i++)
#define repr(i,a,b) for(int i = b ; i > a ; i--)
  
long long fact(long long a, long long b){
    int r= max(a, b);
    int v= min(a, b);
    int l=1;
    // if(v==0)
    for(int i=r+1; i<=a+b; i++){
        l*=i;
    }
    for(int i=v; i>=2; i--){
        l/=i;
    }
    return l;
}

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

int powr(int a) { 
    int var=1;
    for(int i=0; i<a; i++){
        var*=2;
    }
    return var;
}

void func(int a, bool i){
    cout << a;
    if(a==100){
        i=1;
    }
    else if(a==0){
        return;
    }
    if(!i)
        func(a+1, i);
    else
        func(a-1, i);
}

signed main(){   
    fast;
    int h, w;
    cin >> h >> w;
    string a[h];
    rep(i,0,h){
        // rep(j,0,w)
            cin >> a[i];
    }
    int dp[h+1][w+1];
    dp[0][0]=1;
    for(int i=0;i<h; i++){
        for(int j=0; j<w; j++){
            if(i==0 && j==0){
                continue;
            }
            if(a[i][j]=='#'){
                dp[i][j]=0;
                continue;
            }
            if(i==0){
                dp[i][j] = dp[i][j-1];
                continue;
            }
            if(j==0){
                dp[i][j] = dp[i-1][j];
                continue;
            }
            if(a[i][j]=='#')
                dp[i][j]=0;
            else{
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
            }
            // cout << dp[i][j] << " ";
        }
        // cout << endl;
    }
    cout << dp[h-1][w-1]%mod;
}

Measured memory_bytes: 12484
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int a[100005];
int main()
{
    int n,x;
    long long ans=0;
    scanf("%d%d",&n,&x);
    for (int i=1 ;i<=n; i++)
        scanf("%d",&a[i]);

    if (a[1]>x)
    {
        ans+=a[1]-x;
        a[1]=x;
    }
    for (int i=2; i<=n; i++)
    {
        int k = a[i] + a[i-1] - x;
        if (k>0)
        {
            ans += k;
            a[i] -= k;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 640
N = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
    for j in range(i + 1, N):
        k = j - i + j
        if k < N:
            if {S[i], S[j], S[k]} == {"R", "G", "B"}:
                ans -= 1
print(ans)

Measured memory_bytes: 73784
n=int(input())
w=[input() for i in range(n)]
def C(w):
    for i in range(1, n):
        if not(list(w[i])[0]==list(w[i-1])[-1]):
            return False
        if any(w[i]==w[j] for j in range(i)):
            return False
    return True
if C(w):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
N, M = gets.split(" ").map{|d|d.to_i}
A = (0...N).map{gets.strip}
B = (0...M).map{gets.strip}

# p N,M,A,B




(N - M + 1).times{|row|
	(N - M + 1).times{|column|
		matched = true
		M.times{|y|
			M.times{|x|

# p "y=#{y} x=#{x}"
# p "A=#{A[row + y][column + x]} B=#{B[y][x]}"

				if A[row + y][column + x] != B[y][x]
					matched = false
				end
			}
		}
		if matched
			puts "Yes"
			exit
		end
	}
}

puts "No"


Measured memory_bytes: 3836
package main;

import (
	"strconv"
	"bufio"
	"os"
	"fmt"
)

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

func main() {
	sc := NewScanner()
	S := sc.NextLine()
	k := 0
	count := 0
	for i := 0; i < len(S); i++ {
		if S[i] == 'S' {
			count++
		} else if S[i] == 'T' {
			if count > 0 {
				count--
				k++
			}
		} else {
			count = 0
		}

	}
	fmt.Println(len(S) - k * 2)
}


Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

    ll s = 0, t = 0;
    int k = 0;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        a[i] -= b;
        s += a[i];
        if (a[i] < 0) t += a[i], k++;
    }

    if (s < 0) {
        cout << -1 << endl;
        exit(0);
    }

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    for (int i = 0; i < n; i++) {
        if (t >= 0) break;
        t += a[i];
        k++;
    }

    cout << k << endl;

    //同じものはそのままでいい
    //より小さいものは変える必要がある
    //より大きいもののうち差が大きいものから取っていく

    return 0;
}

Measured memory_bytes: 640
def main():
    import itertools
    N,M = map(int,input().split())
    A = list(map(int,input().split()))
    acc = itertools.accumulate(A)
    acc = [e % M for e in acc]
    cnt_dict = {}
    ans = 0
    for e in acc:
        if e == 0:
            ans += 1
        if e in cnt_dict:
            cnt_dict[e] += 1
        else:
            cnt_dict[e] = 0
        ans += cnt_dict[e]
    print(ans)

main()

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

int main(){
  string s;
  cin >> s;
  vector<int> a(26);
  for (int i=0;i<s.size();i++){
    for(int j=0;j<26;j++){
      if((int)s[i] == 97+j){
        a[j]++;
      }
    }
  }
  for(int i=0;i<26;i++){
    if(a[i]==0){
      cout << (char)(97+i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  
}

Measured memory_bytes: 512
n,k = map(int,input().split())
def Base_10_to_n(x, y):
    if (int(x/y)):
        return Base_10_to_n(int(x/y), y)+str(x%y)
    return str(x%y)
ans = Base_10_to_n(n, k)
print(len(ans))

Measured memory_bytes: 3060
n, m = map(int, input().split())

if n >= 2 and m >= 2:
    print((n - 2) * (m - 2))
elif n == 1 and m > 1:
    print(m - 2)
elif m == 1 and n > 1:
    print(n - 2)
else:
    print(1)

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

int main(void) {
    int A,B,C;cin>>A>>B>>C;
    int cnt = 0;
    while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
        if (A == B && B == C) {
            cout << -1 << endl;
            return 0;
        }
        cnt++;
        int a = (B + C) / 2;
        int b = (A + C) / 2;
        int c = (A + B) / 2;
        A = a;
        B = b;
        C = c;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

#define loop(i,n) for(ll i = 0; i < n; i++)
#define loopr(i,x,y) for(ll i = x; i < y; i++)
#define push_back pb ;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<string> VS;
typedef vector<P> VP;
typedef vector<V> VV;
typedef map<ll,ll> MP;
typedef set<ll> SET;
typedef multiset<ll> MSET;

int main() {
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n;
    
    cin>>n;
    
    ll arr[n];
    
    ll sum = 0;
    
    loop (i, n) {
    	cin>>arr[i];
    	
    	sum += arr[i];
	}
	
	MP mp;
	
	loop (i, n) {
		if (mp.find(arr[i]) == mp.end()) {
			mp[arr[i]] = 1;
		} else {
			mp[arr[i]]++;
		}
	}
	
	ll q;
	
	cin>>q;
	
	ll b, c;
	
	loop (i, q) {
		cin>>b>>c;
		
		if (mp.find(b) == mp.end()) {
			cout<<sum<<endl;
		} else {
			ll count = mp[b];
			
			mp[b] = 0;
			
			mp[c] += count;
			
			sum -= (b * count);
			sum += (c * count);
			
			cout<<sum<<endl;
		}
	}
}

Measured memory_bytes: 9520
n = int(input())
a = list(map(int, input().split()))
Alice = 0
Bob = 0
ans = 0
while len(a) != 0:
    Alice += max(a)
    a.remove(max(a))
    if a:
        Bob += max(a)
        a.remove(max(a))
ans = Alice - Bob
print(ans)


Measured memory_bytes: 38524
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  int A, B, C;
  cin >> A >> B >> C;

  if (A + B >= C - 1)
    cout << (B + C) << endl;
  else {
    cout << (B + (B + A + 1)) << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		String s = stdIn.next();
		int ans = 700;
		for(int i = 0; i < 3; i++) {
			if(s.charAt(i) == 'o') {
				ans += 100;
			}
		}
		System.out.print(ans);
	}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 100000;

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;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    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;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }


int main(){
    int H,W; cin >> H >> W;
    char S[20][20];
    int d[H*W][H*W];
    int N=W*H;
    vector<pair<int,int> > e;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> S[i][j];
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            d[i][j] = INF;
        }
        d[i][i] = 0;
    }
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(S[i][j]=='.'){
                for(int k=0;k<4;k++){
                    int tx = j+dx[k];
                    int ty = i+dy[k];
                    if(ty<0 || ty>=H || tx<0 || tx>=W){
                        continue;
                    }
                    if(S[ty][tx]=='.'){
                        d[j+i*W][tx+ty*W] = 1;
                    }
                }
            }
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            for(int k=0;k<N;k++){
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
    int ma=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(d[i][j]>MAX*20*20) continue;
            cerr << d[i][j] << " ";
            if(ma<d[i][j]){
                ma = d[i][j];
            }
        }
        cerr << "\n\n";
    }
    cout << ma << endl;
    return 0;
}


Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{
	int K, N;
	int A[200001];
	scanf("%d %d", &K, &N);
	for(int i = 0; i < N; i++){
		scanf("%d", &A[i]);
	}
	
	sort(A, A+N);
	A[N] = K+A[0];
	
	int Dist[200001];
	for(int i = 0; i < N; i++){
		Dist[i] = A[i+1] - A[i];
	}
	
	ll sum = 0;
	for(int i = 0; i < N; i++){
		sum += Dist[i];
	}
	
	sort(Dist, Dist+N);
	
	printf("%lld\n", sum-Dist[N-1]);
	
	return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

#define long long long

using namespace std;

int main() {
    int n;
    cin >> n;
    long ans=0, best=1e17;
    for (int i=0; i<n; i++) {
        long a, b;
        cin >> a >> b;
        if (a > b) best = min(best, b);
        ans += a;
    }
    cout << max(ans - best, 0ll) << '\n';
    return 0;
}

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


int main() {
	int n, w;
	cin >> n >> w;
	int price[110][2];
	for(int i=1; i<=n; i++){
		cin >> price[i][0] >> price[i][1];
	}
	long long dp[110][100100] = {0};
	for(int i=1; i<=n; i++){
		for(int j=0; j<=w; j++){
			if(j-price[i][0]>=0) dp[i][j-price[i][0]] = max(dp[i][j-price[i][0]], dp[i-1][j]+price[i][1]);
			dp[i][j] = max(dp[i][j], dp[i-1][j]);
		}
	}
	long long ans = 0;
	for(int i=0; i<=w; i++){
		ans = max(ans, dp[n][i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 86272
from sys import stdin
n,k = map(int,stdin.readline().rstrip().split())
point = 0
#n=p*b+r
for b in range(1,n+1):
    p = n//b
    r = n%b
    point += p*max(0,b-k)
    point += max(0,r-k+1)
if k == 0:
    point -= n
print(point)

Measured memory_bytes: 3060
import java.util.*

fun main(args: Array<String>) {
    val s = Scanner(System.`in`)
    val n = s.nextInt()
    val m = s.nextLong()

    val ab = Array(n) { s.nextLong() to s.nextLong() }

    val ret = ab
        .sortedBy { p -> p.first }
        .fold(0L to m) { acc, p ->
            val buy = Math.max(Math.min(acc.second, p.second), 0)
            acc.first + p.first * buy to acc.second - buy
        }
        .first

    println(ret)
}

Measured memory_bytes: 121772
#include<iostream>
#include<string>

int main(){
	std::string str;
	std::cin>>str;

	if (str[2] == str[3] && str[4] == str[5]) {
		std::cout << "Yes" << std::endl;
		exit(0);
	}

	std::cout<<"No"<<std::endl;
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
ans = 0
point = 0
count = 0
for i in range(1, n + 1):
    point = i
    while (not (point >= k)):
        point *= 2
        count += 1
    ans += (1 / n) * (1 / 2)**count
    point = 0
    count = 0
print("{:.9f}".format(ans))

Measured memory_bytes: 3060
// AOJ 1366 Min-Max Distance Game
// 2018.2.8 bal4u

#include <stdio.h>

#define INF 0x30303030

int x[100002], n;

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
//	while (c <= ' ') c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int check(int t)
{
	int i, j, f = 1;
	for (j = 0, i = 0; i < n; i++) if (x[i]-x[j] > t) f++, j = i;
	return f;
}

int main()
{
	int m, alice, i, j, ans;
	int lo, hi, mi;

	n = in(), m = (n+1) >> 1;
	alice = (getchar_unlocked() == 'A');
	i = 3; if (alice) i += 2;
	while (i--) getchar_unlocked();
	for (i = 0; i < n; i++) x[i] = in();

	ans = INF;
	if ((n & 1) == alice) {
		for (i = 0, j = m; j < n; i++, j++) if (x[j]-x[i] < ans) ans = x[j]-x[i];
	} else {
		lo = 0, hi = x[n-1];
		while (hi-lo > 1) {
			mi = (lo+hi) >> 1;
			if (check(mi) > m) lo = mi; else hi = mi;
		}
		ans = hi;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2172
a,b,c,d=map(int,input().split())
dcou=b//d-(a-1)//d
ccou=b//c-(a-1)//c
from math import gcd
dc=d*c//gcd(d,c)
dccou=b//dc-(a-1)//dc
ans=b-a-dcou-ccou+dccou+1
print(int(ans))

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	N=S.size();
	FOR(i,N) if(S[i]!=S[N-1-i]) return _P("No\n");
	FOR(i,(N-1)/2) if(S[i]!=S[(N-1)/2-1-i]) return _P("No\n");
	reverse(ALL(S));
	FOR(i,(N-1)/2) if(S[i]!=S[(N-1)/2-1-i]) return _P("No\n");
	cout<<"Yes"<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
  val (h, w) = readLine()!!.split(" ").map { it.toInt() }
  val s = Array(h) { readLine()!!.split(" ") }
  for (i in 0 until h) {
    for (j in 0 until w) {
      if (s[i][j] in "snuke") {
        println("${('A' + j).toChar()}${i + 1}")
        return
      }
    }
  }
}


Measured memory_bytes: 38032
let a, b, c, x = Scanf.scanf " %d %d %d %d" @@ fun a b c d -> a, b, c, d
let ans = ref 0
let _ =
  for i = 0 to a do
    for j = 0 to b do
      for k = 0 to c do if 500 * i + 100 * j + 50 * k = x then incr ans done done done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORALL(i, m) for( auto i = m.begin(); i != m.end() ; ++i )
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define TM_T template <class T>
using namespace std;
typedef long long ll;
TM_T T inp(){T it;cin >> it;return it;}

ll N,K;
vector<ll> li;
vector<ll> dp;
vector<ll> dp2;

int input(){
  cin >> N >> K;
  REP(i,N) li.push_back( inp<ll>() );
}

int main()
{
  input();
  
  REP(i,K+1) dp.push_back(0);
  REP(i,K+1) dp2.push_back(0);
  dp[0] = 1;
  
  REP(i,N){
    REP(j,K+1) dp2[j] = 0;
    REP(j,K+1){
      dp2[j] = dp[j];
      if (j>0) dp2[j] += dp2[j-1];
      if (j-li[i]>0) dp2[j] += -dp[j-li[i]-1] + (1000000007l*9l);
    }
    REP(j,K+1) dp[j] = dp2[j]%(1000000007l);
  }
  
  cout << dp[K] << endl;
  
}

Measured memory_bytes: 2552
import copy
import math
N = int(input())
lis = []
for i in range(N):
    li = []
    A = int(input())
    for j in range(A):
        li.append(list(map(int, input().split())))

    lis.append(copy.deepcopy(li))
#print(lis)
mtrue = 0
def mjyun(a):
    flag = 0
    #print(a)
    for i in range(len(a)):
        if flag == 1:
            break
        b = a[i]
        #print(b)
        for j in range(len(lis[b])):
            #print(lis[b][j], a)
            if (lis[b][j][1]  == 1 and lis[b][j][0] - 1 not in a) or (lis[b][j][1] == 0 and lis[b][j][0] -1 in a):
                flag = 1
                break

    if flag == 0:
        return len(a)
    else:
        return 0
for i in range(2 ** N):
    #print("a", i)
    count = 0
    a = []
    for j in range(N):
        if i & (1 << j) != 0:
            a.append(int(math.log2(i & (1 << j))))

    num = mjyun(a)
    #print(num)
    if mtrue < num:
        mtrue = num
print(mtrue)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o<<endl;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>F,R;void setF(int n,int mod){F=R=V<ll>(++n);F[0]=1;FOR(i,1,n)F[i]=F[i-1]*i%mod;R[n-1]=modInv(F[n-1],mod);FORR(i,n-1,1)R[i-1]=R[i]*i%mod;}
//ll comb(int a,int b,int m){return a<b||b<0?0:F[a]*R[b]%m*R[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7; //998244353;
const int N = 8;
int n, x[N], y[N];
double d[N][N];
V<int> v;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> x[i] >> y[i];
    v.pb(i);
  }
  FOR(i, 0, n)FOR(j, i+1, n) d[i][j]=d[j][i]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  double ans = 0.0;
  do{
    FOR(i, 1, n) ans += d[v[i-1]][v[i]];
  }while(next_permutation(all(v)));
  FOR(i, 0, n) ans /= i+1;
  printf("%.12f\n", ans);
}

Measured memory_bytes: 256
import sys
sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

def main():
    c=[[]for _ in range(3)]
    for i in range(3):
        c[i]=LI()
    a=[0,0,0]
    b=[0,0,0]
    for i in range(3):
        b[i]=c[0][i]
        
    for i in range(1,3):
        a[i]=c[i][0]-b[0]
        
    flag=1
    
    for i in range(3):
        for j in range(3):
            if c[i][j]!=a[i]+b[j]:
                flag=0
                
    if flag==1:
        print("Yes")
    else:
        print("No")
        
    
            
    


main()

Measured memory_bytes: 38384
import java.util.Scanner;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    
    int n=sc.nextInt();
    String s=sc.next();
    if (n<3200)
      System.out.println("red");
    else
      System.out.println(s);
  }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int h=0;
    int l;
    int ans=0;
    for(int i=0;i<s.size();i++){
        h=0;
        l=0;
        for(int j=i;j<s.size();j++){
            if(s.at(j)=='A'||s.at(j)=='C'||s.at(j)=='G'||s.at(j)=='T'){
                l++;
            }
            else{
                h++;
            }
            if(h!=0)break;
        }
        ans=max(ans,l);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
using namespace std;
double p[10], q[10];
int main() {
	rep(i, 1, 6) scanf("%lf", &p[i]), p[i] /= 100;
	rep(i, 1, 6) scanf("%lf", &q[i]), q[i] /= 100;
	double ans = 1.0;
	rep(i, 1, 6) {
		double A = q[i] / (p[i] + q[i]), ret = 0;
		rep(j, 1, 6) ret += max(A * p[j], (1.0 - A) * q[j]);
		ans = min(ans, ret);
	}
	printf("%.12lf", ans);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Y cout << "Yes\n"
#define N cout << "No\n"
#define REP(i, a, b) for (int i = a; i <= b; i++)
#define R(i, n) for (int i = 0; i < n; i++)
#define RE(i, a, b) for (int i = a; i >= b; i--)


long long mo = 1000000007 ;
int p(long long a , long long b , ll mod)
{
     int ans = 1 ;
    while(b)
    {
        if(b%2)
        {
            ans = ( (ans%mod)*(a%mod) ) %mod ;
        }
        a = ((a%mod)*(a%mod))%mod ;
        b /= 2 ;
    }
    return ans ;
}

int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int n , a[101] ;
     cin >> n ;
     R(i,n)
     {
          cin >> a[i] ;
     }
     sort(a,a+n) ;
     ll ans = 0 ;
     for(int i = 0 ; i < n-2 ; i++)
     {
          for(int j = i+1 ; j < n-1 ; j++)
          {
               if(a[i] == a[j])
               {
                    continue ;
               }
               for(int k = j+1 ; k < n ; k++)
               {
                    if(a[j] == a[k])
                    {
                         continue ;
                    }
                    if( (a[i]+a[j]) > a[k] )
                    {
                         ans++ ;
                    }
                    else
                    {
                         break ;
                    }
               }
          }
     }
     cout << ans << endl ;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
const int INF=INT_MAX;
const long long LLINF=LONG_MAX;
typedef long long ll;
const ll mod=998244353;
const int MX=2e5+7;
ll qpow(ll a ,ll b,int MOD=mod)
{
    ll ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=ans*a%MOD;
        }
        a=a*a%MOD;
        b>>=1;
    }
    return ans;
}
ll dp[MX];
struct node
{
    ll a,b;
    void get()
    {
        cin>>a>>b;
    }
}p[MX];
bool cmp(node x,node y)
{
    return x.a<y.a;
}
int main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        p[i].get();
    }
    sort(p+1,p+m+1,cmp);
    for(int i=0;i<=30000;i++)
    {
        dp[i]=1e18;
    }
    dp[0]=0;
  //  cout<<"ss"<<dp[1]<<endl;
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=30000;j++)
        {
            if(j>=p[i].a)
                dp[j]=min(dp[j-p[i].a]+p[i].b,dp[j]);
            else dp[j]=min(p[i].b,dp[j]);
        }
    }
    ll mi=1e18;
    for(int i=n;i<=30000;i++)
    {

        mi=min(dp[i],mi);
    }
    cout<<mi<<endl;
}


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

int main()
{
	int N;
	cin >> N;
	vector<int> P( N );
	for( int i = 0; i < N; i++ ) {
		cin >> P[i];
	}

	int ans = 0;
	int mi = N + 1;
	for( int i = 0; i < N; i++ ) {
		mi = min( mi, P[i] );
		if( P[i] <= mi ) ans++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3940
#include <bits/stdc++.h>
#define ll long long

using namespace std;

// inputc
int n,k;

vector<int> x;

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

    cin >> n >> k;

    int num;

    for(int i = 0;i < n;i++){
        cin >> num;
        x.push_back(num);
    }

    ll ans = 999999999999999;

    for(int i = 0;i <= n - k;i++){
        // cout << i << " " << n-k+i << "\n";

        ll left = abs(x[i])+abs(x[k+i-1]-x[i]);
        ll right = abs(x[k+i-1])+abs(x[k+i-1]-x[i]);

        // cout << "left : "  << x[i]<< "\n";
        // cout << "right : " << x[k+i] << "\n";


        // cout << left <<" " <<right << "\n";
        
        ans = min(ans,left);
        ans = min(ans,right);

    }

    cout << ans << "\n";
    
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
#define rep0(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i <= (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<string, int, int> TU;
typedef tuple<int, int, int> TI;

int main()
{
    int N;
    cin >> N;
    vector<int> input(N);
    rep0(i,N){
        cin >> input[i];
    }
    int before=0;
    ll res = 0;
    rep0(i,N){
        res+=max(input[i]-before,0);
        before = input[i];
    }
    cout << res << endl;

}


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

int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    m1 += h1 * 60;
    m2 += h2 * 60;

    int res = m2 - m1 - k;

    cout << res << endl;
}


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

int main(){
    string s;
    cin>>s;
    if(s=="ABC")cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
}

Measured memory_bytes: 3624
N,M=map(int,input().split())
AB=[]
for _ in range(M):
    AB.append(tuple(map(int,input().split())))
    
request_max=0
request_num=0

AB.sort(key=lambda x:x[1])
for (a,b) in AB:
    if a>=request_max:
        request_num +=1
        request_max = b
print(request_num)

Measured memory_bytes: 18212
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
typedef vector<int> vi;
typedef long long ll;

ll GCD(ll a,ll b){
    if(a>b){
        return GCD(b,a);
    }
    else{
    ll r=b%a;
    while(r!=0){
        b=a;
        a=r;
        r=b%a;
    }
    return a;
    }
}

int main(){
    ll N,x[100020],d[100020];
    cin>>N;
    rep(i,0,N+1)cin>>x[i];
    sort(x,x+(N+1));
    rep(i,0,N)d[i]=x[i+1]-x[i];
    if(N==1){
        cout<<d[0]<<endl;
        return 0;
    }
    ll gcd=GCD(d[0],d[1]);
    rep(i,2,N){
        gcd=GCD(gcd,d[i]);
    }
    
    cout<<gcd<<endl;
}






Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <tuple>
using namespace std;
using ll = long long;
using tpl = tuple<ll, ll, ll, ll>;
vector<ll> solve() {
    ll X, Y, Z, K; cin >> X >> Y >> Z >> K;
    vector<ll> A(X), B(Y), C(Z), ret; ret.reserve(K);
    for (ll& i : A) cin >> i; sort(A.begin(), A.end(), greater<ll>());
    for (ll& i : B) cin >> i; sort(B.begin(), B.end(), greater<ll>());
    for (ll& i : C) cin >> i; sort(C.begin(), C.end(), greater<ll>());
    auto cmp = [](const tpl& t1, const tpl& t2) { return get<0>(t1) < get<0>(t2); };
    priority_queue<tpl, vector<tpl>, decltype(cmp)> Q(cmp);
    Q.push(make_tuple(A[0] + B[0] + C[0], 0, 0, 0));
    vector<tpl> pushed = {Q.top()};
    for (ll l = 0; l < K; l++) {
        tpl tmp = Q.top(); Q.pop();
        ret.push_back(get<0>(tmp));
        ll i = get<1>(tmp), j = get<2>(tmp), k = get<3>(tmp);
        vector<tpl> push_list = {
            make_tuple((i + 1 < X ? A[i+1] + B[j] + C[k] : 0), i + 1, j, k),
            make_tuple((j + 1 < Y ? A[i] + B[j+1] + C[k] : 0), i, j + 1, k),
            make_tuple((k + 1 < Z ? A[i] + B[j] + C[k+1] : 0), i, j, k + 1)
        };
        for (const tpl& t : push_list) {
            if (find(pushed.begin(), pushed.end(), t) == pushed.end()) {
                Q.push(t);
                pushed.push_back(t);
            }
        }
    }
    return ret;
}
int main() {
    for (ll i : solve()) cout << i << endl;
}

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

#define ll long long
using namespace std;
const int N = 3e5 + 5;

int32_t main() {
   int a, b, c;
   cin >> a >> b >> c;
   swap(a,b);
   swap(a, c);
   cout << a <<' ' << b <<' ' << c;

    return 0;
}

Measured memory_bytes: 256
/* ex4_2
   masaaki52	*/

#include <stdio.h>
#include <math.h>

int main(void){
  double hlen,mlen,hour,minute,rad,len;
  scanf("%lf %lf %lf %lf",&hlen,&mlen,&hour,&minute);//それぞれの変数に値を入力
  rad = M_PI * (hour/6 - minute * 11/360);//長針と短針の成す角を計算
  len = sqrt(pow(hlen,2) + pow(mlen,2) -2*hlen*mlen*cos(rad));//余弦定理で端点同士の距離を計算
  printf("%.10f\n",len);//結果を出力
  return 0;
}


Measured memory_bytes: 2556
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	static class Node {
		int id;
		int group;
		Set<Integer> conns;

		Node(int id) {
			this.id = id;
			this.group = -1;
			this.conns = new HashSet<>();
		}
	}

	int N, M;
	Node[] nodes;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		M = Integer.parseInt(tokens[1]);
		nodes = new Node[N];
		for (int i = 0; i < N; ++i) {
			nodes[i] = new Node(i);
		}
		for (int i = 0; i < M; ++i) {
			tokens = in.readLine().split(" ");
			int A = Integer.parseInt(tokens[0]) - 1;
			int B = Integer.parseInt(tokens[1]) - 1;
			nodes[A].conns.add(B);
			nodes[B].conns.add(A);
		}
	}

	void mark(int current, int group, int parent) {
		if (nodes[current].group >= 0) {
			return;
		}
		nodes[current].group = group;
		for (Integer next : nodes[current].conns) {
			if (!next.equals(parent)) {
				mark(next, group, current);
			}
		}
	}

	void calc() {
		int group = 0;
		for (int i = 0; i < N; ++i) {
			if (nodes[i].group < 0) {
				mark(i, group, -1);
				++group;
			}
		}
		System.out.println((group - 1));
	}

	void showResult() {
	}
}


Measured memory_bytes: 78892
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        long S = scan.nextLong();
        long x = 1000000000;
        long y = 1;
        long m = S/x;
        if (S % x != 0) {
            m += 1;
        }
        long l = m * x - S;
        System.out.println("0 0 " + x + " " + y + " " + l + " " + m);
    }
}


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

#define ll long long

int mod;
vector<int> adj[100005];
ll int dp1[100005];
ll int dp2[100005];
vector<ll int> pre[100005];
vector<ll int> suf[100005];

void dfs1(int node, int pn)
{
  dp1[node] = 1;
  for(int i=0;i<adj[node].size();i++)
    if(adj[node][i] != pn)
    {
      dfs1(adj[node][i], node);
      dp1[node] = (dp1[node] * (1 + dp1[adj[node][i]])) % mod;
    }
  return;
}


void dfs2(int node, int pn, int up)
{
  dp2[node] = (1 + up) % mod;
  ll int prev=1, front=1;

  pre[node].resize(adj[node].size());
  suf[node].resize(adj[node].size());

	for(int i=0;i<adj[node].size();i++)
  {
    if(adj[node][i] != pn)
    {
      pre[node][i] = (prev * (1+dp1[adj[node][i]])) % mod;
      prev = pre[node][i];
    }
    pre[node][i] = prev;
  }

  for(int i=adj[node].size()-1;i>=0;i--)
  {
    if(adj[node][i] != pn)
    {
      suf[node][i] = (front * (1+dp1[adj[node][i]])) % mod;
      front = suf[node][i];
    }
    suf[node][i] = front;
  }

  for(int i=0;i<adj[node].size();i++)
    if(adj[node][i] != pn)
    {
      ll int mul = dp2[node];
      if(i != 0)
        mul = (mul * pre[node][i-1]) % mod;
      if(i != adj[node].size()-1)
        mul = (mul * suf[node][i+1]) % mod;

      dfs2(adj[node][i], node, mul);
    }
  return;
}


int main()
{
  int n, x, y;
  cin>>n>>mod;

  for(int i=0;i<n-1;i++)
  {
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }


  dfs1(1, -1);
  dfs2(1, -1, 0);

  for(int i=1;i<=n;i++)
    cout<<(dp2[i] * dp1[i]) % mod<<endl;

  return 0;
}


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


int main() {
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    if(r<=x && x <=w-r && r<=y && y<=h-r) {
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
    return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

ll n;
vector<bool> is_prime((ll)1e7 + 1, true);

VL isprime(ll N) {
    VL res;
    for(int p = 2; p <= N; p++) {
        if(!is_prime[p]) continue;
        for(int k = p * 2; k <= N; k += p) is_prime[k] = false;
        res.push_back(p);
    }
    return res;
}

int main() {
    VL pri = isprime((ll)1e7);
    sort(All(pri));
    while(cin >> n) {
        if(n == 0) break;
        auto itr = lower_bound(All(pri), n);
        if(*itr != n) itr--;
        while(true) {
            ll t = *(itr--);
            if(is_prime[t - 8] && is_prime[t - 6] && is_prime[t - 2]) {
                cout << t << "\n";
                break;
            }
        }
    }
}



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

int main(){
    int n, k, c; cin >> n >> k >> c;
    string s; cin >>  s;
    vector<int> front(n,-1), back(n,-2);

    int count = 1;
    for(int i = 0; i < n; ){
        if(s[i] == 'x'){ i++; continue; }
        front[i] = count;
        count++;
        i += c+1;
    }
    count = k;
    for(int i = n-1; i >= 0; ){
        if(s[i] == 'x'){ i--; continue; }
        back[i] = count;
        count--;
        i -= c+1;
    }
    rep(i,n) if(front[i] == back[i]) cout << i+1 << endl;
    return 0;
}

Measured memory_bytes: 5168
#include<iostream>

using namespace std;

int s[4];

int main() {
    char c;
    for (int i = 0; i < 4; ++i) {
        cin >> c;
        s[i] = c - '0';
    }

    for (int bit = 0; bit < 1 << 3; ++bit) {
        int calc = s[0];
        for (int i = 0; i < 3; ++i) {
            calc += s[i + 1] * (((bit >> i) & 1) == 1 ? 1 : -1);
        }
        if (calc == 7) {
            cout << s[0];
            for (int i = 0; i < 3; ++i) {
                cout << (((bit >> i) & 1) == 1 ? '+' : '-') << s[i + 1];
            }
            cout << "=7" << endl;
            return 0;
        }
    }
}

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

#define INF 1e+10
#define MAX_V 100000

struct edge {
    long long to;
    long long cost;
};

// <最短距離, 頂点の番号>
using P = pair<long long, long long>;

long long V;
vector<edge> G[MAX_V];
long long d[MAX_V];

void dijkstra(long long s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        long long v = p.second;
        if (d[v] < p.first) continue;

        for (long long i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin >> V;
    long long E;
    cin >> E;
    long long r;
    cin >> r;
    for (long long i=0; i<E; ++i) {
        long long a, b, c;
        cin >> a >> b >> c;
        edge e = {b, c};
        G[a].push_back(e);
    }
    dijkstra(r);
    for (long long i=0; i<V; ++i) {
        if(d[i] < INF){
            cout << d[i] << endl;
        }else{
            cout << "INF" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 19468
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;
/* ---------------------------------------------------------------------------------------------------- */

int r,D,x;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> r >> D >> x;
  REP(i,10) {
    x = r*x-D;
    cout << x << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
 
int main() {
    int N;
    cin >> N;

    int V[N], C[N], a[N];   //a[i] = V[i] - C[i]
    
    for(int i = 0; i < N; i++) {
        cin >> V[i];
    }

    for(int i = 0; i < N; i++) {
        cin >> C[i];
        a[i] = V[i] - C[i];
    }

    int maxSum = 0;

    for(int i = 0; i < N; i++) {
        if(a[i] > 0) {
            maxSum += a[i];
        }
    }

    cout << maxSum;
    
    cout << endl;
    return 0;
}

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

void print(char* str){
	int i, a,b;
	scanf("%d%d", &a, &b);
	for(i = a; b >= i; i++){
		printf("%c", str[i]);
	}
	printf("\n");
}
void reverse(char* str){
	char buf[1000];
	int a,b,i, c = 0;
	scanf("%d%d", &a, &b);
	for(i = a; b >= i; i++){
		buf[c] = str[i];
		c++;
	}
	c = 0;
	for(i = a; b >= i; i++){
		str[i] = buf[(b-a)-c];
		c++;
	}
}
void replace(char* str){
	char buf[1000];
	int a,b,i, c = 0;
	scanf("%d%d%s", &a, &b, buf);
	for(i = a; b >= i; i++){
		str[i] = buf[c];
		c++;
	}
}
int main(void) {
	char str[1000];
	int n, i;
	
	scanf("%s%d", str, &n);
	for(i = 0; n > i; i++){
		char me[8];
		scanf("%s", me);
		if(!strcmp(me, "print"))
			print(str);
		else if(!strcmp(me, "reverse"))
			reverse(str);
		else if(!strcmp(me, "replace"))
			replace(str);
	}
	
	return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
#define console
using namespace std;
#ifndef console
ifstream fin("data.in");
ofstream fout("data.out");
#else
#define fin cin
#define fout cout
#endif
#define usain_bolt() (ios_base::sync_with_stdio(false), \
fin.tie(NULL), fout.tie(NULL))
typedef long long ll;
int main()
{
    usain_bolt();
    int k, a, b;
    fin >> k >> a >> b;
    int l = (b / k) * k;
    if (a <= l)
      fout << "OK";
    else fout << "NG";
#ifndef console
    fin.close(), fout.close();
#endif
    return 0;
}


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

// Function to find pair with given difference in the array
// This method handles duplicates in the array

int main()
{
	int n;
	cin>>n;
	int arr[n];
	for(int i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    int a=arr[(n/2)-1];
    int b=arr[(n)/2];
    cout<<b-a<<endl;
	return 0;
}


Measured memory_bytes: 640
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
aN = LIST()

# dp[この子までの範囲で][飴を配る総数] = 場合の数
dp = [[0] * (K+1) for i in range(N+1)]
# 0番目まで(誰もいない)の範囲で0個配る場合の数は1通り
dp[0][0] = 1

for i in range(N):
    sm = [0] * (K+2)
    # 今回送るi行について累積和を取る
    for j in range(1, K+2):
        sm[j] = sm[j-1] + dp[i][j-1]
        sm[j] %= MOD
    for j in range(K+1):
        # iが送る予定の長さに応じた区間和を取る
        dp[i+1][j] = sm[j+1] - sm[max(j-aN[i], 0)]
        dp[i+1][j] %= MOD
        # for k in range(aN[i]+1):
        #     dp[i+1][j+k] += dp[i][j]
print(dp[N][K])


Measured memory_bytes: 135768