akhauriyash/Code-Regression huggingface dataset:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	#a = int(input())
	n, a, b = tin()
	#s = input()
	if n == 1 and a != b:
		return 0
		
	if n == 1:
		return 1
		
	if a > b:
		return 0
	
	max_v = b * (n-1) + a
	min_v = b + a *(n-1)
	return max_v - min_v + 1


	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 9244
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   ll n;
   cin>>n;
   
   ll arr[n];
   for(ll i=0;i<n;i++)
        cin>>arr[i];
   
   ll ans = 0;
   for(ll i=61;i>-1;i--)
   {
       ll cnt = 0;
       ll temp = (1ll<<i);
       //temp%=mod;
       for(ll j=0;j<n;j++)
       {
           if(arr[j]&temp)
                cnt++;
       }
       temp%=mod;
      // cout<<"cnt = "<<cnt<<" at "<<i<<"\n";
       ll cnt1 = (n-cnt);
       ll add = temp*((cnt*cnt1)%mod);
       add%=mod;
       ans+=add;
       ans%=mod;
   }
   
   cout<<ans;
   return 0;
}  
   

Measured memory_bytes: 2560
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x,y =1;
        while(true){
            x = sc.nextInt();
            y = sc.nextInt();
            if(x>y){
                int temp = x;
                x=y;
                y=temp;
                System.out.println(x+" "+y);
            }
            else if(x==0 && y==0){
                break;
            }
            else{
                System.out.println(x+" "+y);
            }
        }
    }
}


Measured memory_bytes: 35340
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <iomanip>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string s = to_string(n);

    bool done = false;
    for (char c : s) {
        if (c == '7') {
            cout << "Yes" << endl;
            done = true;
            break;
        }
    }
    if (!done) {
        cout << "No" << endl;
    }


}


Measured memory_bytes: 3692
#define _USE_MATH_DEFINES 
#include <cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<vector>
#include<cctype>
#define rep(i,start,n) for(int i=start;i<n;i++)
#define And &&
#define Or ||
#define Lb cout<<endl
using namespace std;

int main(void) {
	string str; cin >> str;
	int q; cin >> q;
	string meirei, x;
	int a, b;
	rep(i, 0, q) {
		cin >> meirei;
		cin >> a >> b;
		if (meirei == "replace") {
			cin >> x;
			rep(j, 0, x.length()) {
				str[a + j] = x[j];
			}
		}
		else if (meirei == "reverse") {
			rep(j, 0, (b - a + 1) / 2) {
				char temp;
				temp = str[a + j];
				str[a + j] = str[b - j];
				str[b - j] = temp;
			}
		}
		else {
			rep(j, 0, (b - a + 1)) {
				cout << str[a + j];
			}
			cout << endl;
		}
	}
}

Measured memory_bytes: 1212
from fractions import gcd

N = int(input())
A = list(map(int, input().split()))



# L[0] = 0
# L[i] (i=1, ..., N)にはA_1, ..., A_iの最大公約数が格納されている

L = []
L.append(0)

for i in range(N):
    L.append(gcd(L[i], A[i]))

#  for i in range(N+1):
    #  print(L[i])


# R[N+1] = 0
# R[i] (i=N, N-1, ..., 1)にはA_i, ..., A_Nの最大公約数が格納されている

R = [0] * (N+2)
# R = [0, 0, 0, ... , 0] (0がN+2個)

for i in range(N, 0, -1):
    R[i] = gcd(A[i-1], R[i+1])

#  for i in range(N+1, -1, -1):
    #  print(R[i])



# M[i] (i=0, ..., N-1)にはA_(i+1)を除いた整数の最大公約数が格納されている

M = []
for i in range(N):
    M.append(gcd(L[i], R[i+2]))

print(max(M))


Measured memory_bytes: 16140
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) {

		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int k = sc.nextInt();
		int q = sc.nextInt();

		int a[] = new int[n];
		for (int i = 0; i < q; i++) {
			a[sc.nextInt() - 1]++;
		}
		List<String> str = new ArrayList<>();
		for (int x : a) {
			str.add(k + x - q <= 0 ? "No" : "Yes");
		}
		System.out.println(String.join(System.getProperty("line.separator"), str));
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
            return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
            }
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
            }
        }

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
        }

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 29228
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int a,b,s=0;
int main()
{
    cin>>a>>b;
    for(int i=a;i<=b;i++)
    s++;
    if(a<=0&&b>=0)
    cout<<"Zero";
    else if(s%2==0||(a>0&&b>0))
    cout<<"Positive";
    else
    cout<<"Negative";
    cout<<endl;
    return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int w, h, x, y, r;
  scanf("%d%d%d%d%d", &w, &h, &x, &y, &r);

  if (x < 0 || y < 0 || w < (x + r) || h < (y + r)) {
    printf("No\n");
  } else {
    printf("Yes\n");
  }
  return 0;
}



Measured memory_bytes: 2112
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

L, R, D = getNM()
cnt = 0
for i in range(L, R + 1):
    if i % D == 0:
        cnt += 1
print(cnt)

Measured memory_bytes: 77852
// AOJ 3055 Don't Burn Kotatsu Turtle
// 2019.4.7 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//// 高速入力
#if 1
#define gc() getchar_unlocked()
#define pc(x) putchar_unlocked(x)
#else
#define gc() getchar()
#define pc(x) putchar(x)
#endif
int in()    // 非負整数の入力
{
	int n = 0, c = gc();
	//	while (isspace(c)) c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

void ins(char *s)  // 文字列の入力　スペース以下の文字で入力終了
{
	do *s = gc();
	while (*s++ > ' ');
	*(s - 1) = 0;
}


//// 優先度付きキュー（ダイクストラ法用）
#define MAX 500000
typedef struct { long long t; short r, c; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int r, int c, long long t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].t = t, que[i].r = r, que[i].c = c;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		i = min;
	}
}


//// 本問題関連
#define MAXV 1005
char vis[MAXV][MAXV];
char map[MAXV][MAXV]; int H, W;
char bomb[MAXV][MAXV];
int A, B;
int mv[8][2] = { {-1,0},{0,1},{1,0},{0,-1},{-1,-1},{-1,1},{1,1},{1,-1} };
int tt[8][2];

long long dijkstra(int sr, int sc, int gr, int gc)
{
	int i, k, r, c, f, g, rr, cc;
	long long t;

	enq(sr, sc, 0);
	while (qsize) {
		r = que[0].r, c = que[0].c, t = que[0].t, deq();
		if (r == gr && c == gc) return t;
		if (vis[r][c]) continue;
		vis[r][c] = 1;

		f = bomb[r][c], k = (2-f) << 2;
		for (i = 0; i < k; i++) {
			rr = r + mv[i][0], cc = c + mv[i][1];
			if (rr < 1 || rr > H || cc < 1 || cc > W) continue;
			g = (map[rr][cc] == '#');
			if (f && g) continue;
			if ((i < 4 || g) && !vis[rr][cc]) enq(rr, cc, t + tt[i][g]);
		}
	}
	return -1LL;
}


int main()
{
	int i, r, c, sr, sc, tr, tc;
	long long ans;

	H = in(), W = in(), A = in(), B = in();
	for (r = 1; r <= H; r++) {
		ins(map[r]+1);
		for (c = 1; c <= W; c++) {
			if (map[r][c] == '*') {
				bomb[r][c] = 1;
				for (i = 0; i < 8; i++)
					bomb[r + mv[i][0]][c + mv[i][1]] = 1;
			}
			else if (map[r][c] == 's') sr = r, sc = c;
			else if (map[r][c] == 'g') tr = r, tc = c;
		}
	}
	for (i = 0; i < 4; i++) tt[i][0] = A, tt[i][1] = A + B;
	A <<= 1;
	for (; i < 8; i++) tt[i][0] = A, tt[i][1] = A + B;

	ans = dijkstra(sr, sc, tr, tc);
	if (ans >= 0) printf("%lld\n", ans);
	else puts("INF");
	return 0;
}



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

vector<ll>adj[100005];
bool visited[100005];
ll dp[100005];

void dfs(ll s)
{
    ll len=1;
    visited[s]=true;
    for(auto x : adj[s])
    {
        if(visited[x]==false)
            dfs(x);

        dp[s]=max(dp[s],len+dp[x]);
    }
}


int main()
{
    ll n,m,x,y;
    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
        //adj[y].push_back(x);
    }

    ll mx_len=0;

    for(int i=1; i<=n; i++)
    {
        if(visited[i]==false)
            dfs(i);
        
        mx_len=max(mx_len,dp[i]);
    }

    cout<<mx_len<<endl;

    return 0;
}



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

using namespace std;

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

    int n;
    cin >> n;

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

    int dp[n];
    dp[0] = 0, dp[1] = abs(ar[1] - ar[0]);

    for(int i = 2; i < n; i++)
    {
        dp[i] = min(abs(ar[i] - ar[i-2]) + dp[i-2], abs(ar[i]- ar[i-1]) + dp[i-1]);
    }

    cout << dp[n-1];
}


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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= m; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout << i << endl
using namespace std;
int main(){
  int h,w;
  vector<pair<int,int>> bx;
  REP(i,6){
      cin >> h >> w;
      if(h < w) bx.pb(make_pair(h,w));
      else bx.pb(make_pair(w,h));
    }
    sort(bx.begin(),bx.end());
    
    REP(i,3){
        if(bx[2*i + 1].first != bx[2* i].first || bx[2* i + 1].second != bx[2*i].second){
            cout << "no" << endl;
            return 0;
          }
      }
    if(bx[0].first == bx[2].first){
        if(bx[0].second < bx[2].second){
            if(bx[4].first != bx[0].second || bx[4].second != bx[2].second){
                cout << "no" << endl;
                return 0;
              }
          }else{
            if(bx[4].second != bx[0].second || bx[4].first != bx[2].second){
                cout << "no" << endl;
                return 0;
              }
            }
      }else if(bx[0].first == bx[2].second){
        if(bx[0].second < bx[2].second){
            if(bx[4].first != bx[0].second || bx[4].second != bx[2].first){
                cout << "no" << endl;
                return 0;
              }
          }else{
            if(bx[4].second != bx[0].second || bx[4].first != bx[2].first){
                cout << "no" << endl;
                return 0;
              }
            }
        }else{
            cout << "no" << endl;
            return 0;
          }   
      cout << "yes" << endl;
      return 0;
}



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

void insertionSort(vector<int>& A, int N){
 for(int k = 0; k < N; k++){
   if (k == (N-1)) cout<<A[k]<<endl;
   else cout<<A[k]<<" ";
 }
 for(int i = 1; i < N; i++){
  int v = A[i];
  int j = i - 1;
  while(j>= 0 && A[j]>v){
   A[j+1] = A[j];
   j--;
}
  A[j+1] = v;

  for(int k = 0; k < N; k++){
   if (k == (N-1)) cout<<A[k]<<endl;
   else cout<<A[k]<<" ";
}
}
}

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

 insertionSort(A,N);
}


Measured memory_bytes: 3088
#include<iostream>
#include<cstdio>
#define MN 1000000
#define mod 998244353
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int p[MN+5],inv[MN+5],n,m,ans;
inline int C(int n,int m){return m<=n?1LL*p[n]*inv[m]%mod*inv[n-m]%mod:0;}
int main()
{
	inv[0]=inv[1]=p[0]=p[1]=1;
	for(int i=2;i<=MN;++i) inv[i]=1LL*(mod-mod/i)*inv[mod%i]%mod,p[i]=1LL*p[i-1]*i%mod;
	for(int i=2;i<=MN;++i) inv[i]=1LL*inv[i-1]*inv[i]%mod;
	n=read();m=read();
	for(int i=0;i<=m;++i) if((i&1)==(m&1))
	{
		int u=(m+i)/2,d=(m-i)/2;
		if(!i) ans=(ans+C(m-1,u))%mod;
		else ans=(ans+C(m,u))%mod;
		if(i<n)
		{
			int up=-d+(n-i)-1;
			if(up>=0) ans=(ans-(!i?C(m-1,u):C(m,u))+mod)%mod;
			else if(!i) ans=(ans-C(m-1,(m-2*up)/2)+mod)%mod;
			else ans=(ans-C(m,(m+i-2*up)/2)+mod)%mod;
		}	
	}
	printf("%d",ans);
	return 0;
}

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

typedef long long ll;


int main(void){
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i = 0 ; i < N ; i++){
        cin >> A.at(i);
        if(A.at(i) == 0){
            cout << 0 << endl;
            return 0;
        }
        
    }
    
    ll sum = 1;
    for(int i = 0 ; i < N ; i++){
        if(A.at(i) <= 1000000000000000000 / sum){
            sum *= A.at(i);
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    
    cout << sum << endl;
    return 0;
}

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

void print(const vector<int>& A) {
    for(int i = 0; i < A.size(); i++) {
      if (i > 0) {
        cout << " ";
      }
      cout << A[i];
    }
    cout << endl;
}

void insertionSort(vector<int>& A)
{
  for(int i = 1; i < A.size(); i++){
    int v = A[i];
    int j = i - 1;
    while(j >= 0 && A[j] > v){
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    print(A);
  }
}

int main(){
  vector<int> A;
  A.reserve(100);

  int N, a;
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  print(A);
  insertionSort(A);
}


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

#define MAX 200000

int main() {
  
  int ballCount;
  scanf("%d", &ballCount);
  
  int *ballno;
  ballno = new int[ballCount];
  for (int i=0, *p = ballno ; i<ballCount ; i++) {
    scanf("%d", p++);
  }
  
  int dicCount = ballCount+1;
  int *dic = new int[dicCount];
  int dicBytes = dicCount<<2;
  
  memset(dic, 0, dicBytes);
  for (int i=0 ; i<ballCount ; i++) {
    dic[ballno[i]]++;
  }

  unsigned long int sum = 0;
  for (int i=0, *p = dic; i<dicCount ; i++, p++) {
    if (*p > 1) {
      sum += ((unsigned long int)*p) * (*p - 1);
    }
  }
  sum >>= 1;
  
  for (int k=0 ; k<ballCount ; k++) {
    int m = dic[ballno[k]];
    m = ((m-1) * -2) >> 1;
    printf("%lld\r\n", sum + m);
  }
  
  delete[] ballno, dic;
}

Measured memory_bytes: 4352
#include<stdio.h>
#include<string.h>
int n=0,d,t[20][30],m[30],i,j,r[2];
char c[20][20];
int main()
{
	for(;scanf("%d",&n),n;)
	{
		memset(m,0,sizeof(m));
		memset(t,-1,sizeof(t));
		for(i=0;i<n;i++)
		{
			scanf("%s%d",c[i],&d);
			for(j=0;j<d;m[t[i][j]]++,j++)
				scanf("%d",&t[i][j]);
		}
		for(i=0,r[1]=999;i<n;i++)
		{
			for(j=d=0;t[i][j]!=-1;j++)
				d+=n-m[t[i][j]]+1;
			if(d<r[1]||(d==r[1]&&strcmp(c[i],c[r[0]])<0))
				r[0]=i,r[1]=d;
		}
		printf("%d %s\n",r[1],c[r[0]]);
	}
	return 0;
}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;

#define FOR(var,start,end) for(int var=start; var<end; var++)
#define REP(var,cnt) FOR(var,0,cnt)

 int main(void) {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ma = max({a,b,c});
	int res = ma * pow(2, k) + a + b + c - ma;
	cout << res << endl;

	return 0;
 }


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		
		String lastWeek = scan.next();
		
		if(lastWeek.equals("ABC")) {
			System.out.println("ARC");
		}else {
			System.out.println("ABC");
		}
		
	}
}

Measured memory_bytes: 27004
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Measured memory_bytes: 7708
#include<cstdio>
int main(){
    char s[16];
    scanf("%s",s);
    int lose=0;
    for(int i=0;s[i]!='\0';i++){
        if(s[i]=='x')lose++;
    }
    if(lose>=8)printf("NO\n");
    else printf("YES\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define For(i,l,r) for (register int i=l; i<=r; i++)
using namespace std;
typedef unsigned long long LL;
typedef signed long long ll;
template <typename T>
inline void read(T &x) {
	char c = getchar(); int w = 1; x = 0;
	while (!isdigit(c))
		(c == '-') && (w = -w), c = getchar();
	while (isdigit(c))
		x = (x << 1) + (x << 3) + (c ^ '0'), c = getchar();
	x *= w;
}
const int dx[8] = {-1, 1, 0, 0, -1, 1, -1, 1},
		  dy[8] = {0, 0, -1, 1, -1, -1, 1, 1};
int a, b;
int main() {
	cin >> a >> b;
	For(i,b-a+1,b+a-1)
		cout << i << ' ';
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 256
/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
*/

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#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()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

int dp[350][610];

void otp(vector<int> A) {
	REP (i,A.size()) {
		cout << A[i] << " ";
	}
	cout << endl;
}

signed main() {
	int n,k; cin >> n >> k;
	int ans = k;
	REP (i,n-1) {
		ans *= (k-1);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)
#define INF 1 << 28

inline void chmax(int &a, int b) { a = max(a,b); }
inline void chmin(int &a, int b) { a = min(a,b); }

int main()
{
  int N;
  while(cin >> N,N) {
    vector<vector<bool> >mas(5001,vector<bool>(5001,false));
    int X[3005], Y[3005];
    Rep(i,N) {
      cin >> X[i] >> Y[i];
      mas[Y[i]][X[i]] = true;
    }
    int maxv = 0;
    Rep(i,N) {
      Rep(j,N) {
	if(i == j)continue;
	int x = X[j] - X[i];
	int y = Y[j] - Y[i];
	for(int k = -1; k <= 1; k += 2) {
	  int ny1 = Y[i] + x * k, ny2 = Y[j] + x * k;
	  int nx1 = X[i] - y * k, nx2 = X[j] - y * k;
	  if(nx1 < 0 || nx2 < 0 || ny1 < 0 || ny2 < 0 || nx1 > 5000 || nx2 > 5000 || ny1 > 5000 || ny2 > 5000)continue;
	  if(mas[ny1][nx1] && mas[ny2][nx2]) {
	    chmax(maxv,x * x + y * y);
	  }
	}
      }
    }
    cout << maxv << endl;
  }
  return 0;
}
	  
  

Measured memory_bytes: 6260
// 6/13
// リアルタイム参加
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;

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

    cout << S.substr(0, 3) << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

//#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}

void solve() {
    int n, m; 
    cin >> n >> m;
    int two = -1;
    ll cur = 1;
    bool ok = 1;
    loop(i, n) {
        int x; cin >> x;
        x >>= 1;
        int ctwo = 0, xx = x;
        while (!(xx & 1)) {
            xx >>= 1; ++ctwo;
        }
        if (two != -1 && ctwo != two)
            ok = 0;
        two = ctwo;
        cur = cur * x / gcd(cur, x);
        if (cur > m)
            ok = 0;
    }
    if (!ok) {
        cout << 0; return;
    }
    int l = 0, r = m + 1;
    while (r - l > 1) {
        int mid = l + r >> 1;
        if (cur * mid <= m)
            l = mid;
        else
            r = mid;
    }
    cout << r / 2;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  Int n;
  cin>>n;
  string s;
  cin>>s;

  Int R=0;
  Int W=count(s.begin(),s.end(),'W');

  auto calc=[&](Int x,Int y){return max(x,y);};

  Int ans=calc(0-R,(n-0)-W);
  for(Int i=0;i<n;i++){
    R+=s[i]=='R';
    W-=s[i]=='W';
    chmin(ans,calc((i+1)-R,(n-(i+1))-W));
  }

  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 3736
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

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


signed main(void) {
    int x,y;
    cin >> x >> y;
    int ans = 0;
    int g = gcd(x,y);
    x /= g;
    y /= g;
    ans += x-1;
    ans += y-1;
    ans++;
    ans *= g;
    ans++;
    cout << ans << endl;
}



Measured memory_bytes: 3100
#include <cmath>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>

using namespace std;

string decode(string inp,int n){
    string in=inp;
    for(int i=0;i<in.length();i++){
        if(isalpha(in[i])){
            in[i]=in[i]+n;
            if(in[i]>'z') in[i]='a'+(in[i]-'z'-1);
        }
    }
    return in;
}
bool check(string inp){
    stringstream words(inp);
    string word;
    while(getline(words, word, ' ')){
        if(word=="the"||word=="this"||word=="that"||word=="the."||word=="this."||word=="that.")
            return true;
    }
    return false;
}

int main(){
    string input;
    while(getline(cin,input)){
        for(int i=0;i<=26;i++){
            if(check(input)){
                break;
            }
            input=decode(input,1);
        }
        cout << input << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define LL long long
#define LD long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()

using namespace std;

const int N = 2e5 + 100;	
const int MOD = 1e9 + 7;
	
int n;
int c;
vector <int> f;
int sum[N];
int dp[N];

int main() {
	scanf ("%d", &n);
	int last = -1;
	f.pb(last);
	rep(i, 1, n) {
		scanf ("%d", &c);
		if (c != last) f.pb(c);
		last = c;
	}
	dp[0] = 1;
	rep(i, 1, ss(f) - 1) {
		sum[f[i]] = (sum[f[i]] + dp[i - 1]) % MOD;
		dp[i] = sum[f[i]] % MOD;
	}
	printf ("%d\n", dp[ss(f) - 1]);
	
    return 0;
}


Measured memory_bytes: 2676
n = int(input())
A = list(map(int, input().split()))

N = 10 ** 6 + 1

# 一度しか現れないものを抽出する
cnt = [0] * (N + 1)
for a in A:
    cnt[a] += 1

once = []
for a in A:
    if cnt[a] == 1:
        once.append(a)

# 倍数を排除
bl = [True] * (N + 1)
A = list(set(A))
for elem in A:
    for m in range(elem * 2, N + 1, elem):
        bl[m] = False

res = 0
for elem in once:
    if bl[elem]:
        res += 1
print(res)


Measured memory_bytes: 143740
#include <bits/stdc++.h>
/*#include <ctime>
#include <list>
#include <numeric>
#include <bitset>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <string>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <utility>
#include <fstream>
#include <sstream>
#include <cmath>
#include <stack>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
#include <array>
#include <iomanip>
#include <limits>*/

using namespace std;


/// Bismilahir Rahmanir Rahim


typedef unsigned int ui;
typedef long long int lli;
typedef unsigned long long int ulli;
typedef short int si;
typedef unsigned short int usi;
typedef pair <int, int> pii;


#define CASE false
#define File false
#define TEST false
#define BUFFER true
#define TIME false
#define DEBUG true
#define SET_GEN false
#define _ << " " <<
#define __ << "\n"
#define ff first
#define ss second
#define RANGE(a, b) (rand() % (b-a+1) + a)


const double pi = acos(-1.);
const double eps = 1e-7;
const int high = 2e9;
const int inf = 2147483647;
const int _inf = -2147483648;
const lli INF = 1e18;
const int mod = 1e9+7;
const int maxn = 1e4;


void delay(int sec); // DEBUG


void solution(void)
{
    int n;

    cin >> n;

    vector <double> dp(n+1);
    dp[0] = 1;

    for(int i = 1; i <= n; ++i) {
        double p;
        cin >> p;
        for(int j = i; j >= 0; --j) {
            dp[j] = (j == 0? 0: dp[j-1]*p) + dp[j]*(1-p);
        }
    }

    double ans = 0;

    for(int i = (n+1)>>1; i <= n; ++i)
        ans += dp[i];

    cout << fixed << setprecision(10) << ans __;




    return ;
}

int main(int argc, char *arv[])
{
    #if File
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    #if BUFFER
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #endif

    #if SET_GEN
    srand((unsigned int) time(0));
    #endif

    #if prep
    prep_calc();
    #endif

    int t = 1;

    #if CASE
    int cnt = 1;
    #endif

    #if TEST
    cin >> t;
    #endif

    #if TIME
    clock_t start_time, end_time;
    double time_elapsed;
    #endif


    while(t--) {

        #if TIME
        start_time = clock();
        #endif

        #if CASE
        cout << "Case " << cnt++ << ": ";
        #endif

        solution();

        #if TIME
        end_time = clock();

        time_elapsed = (double) (end_time - start_time) / CLOCKS_PER_SEC;

        cout << "\nRuntime: " << fixed << setprecision(7) << time_elapsed << "\n";
        #endif
    }


    return 0;
}

void delay(int sec)
{
    int mili_sec = 1000 * sec;

    clock_t start_time = clock();

    while (clock() < start_time + mili_sec);

    return ;
}
/*

*/


Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(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);
  string S, T; cin >> S >> T;
  int N = S.size();
  int ans = 0;
  REP(i, N){
    if(S[i] != T[i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3884
#define _GLIBCXX_DEBUG //エラーを出すためのおまじない
#include <bits/stdc++.h>
//#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
#include <math.h>
using namespace std;
#define coYES cout << "YES" << endl
#define coNO cout << "NO" << endl
#define coYes cout << "Yes" << endl
#define coNo cout << "No" << endl
#define coyes cout << "yes" << endl
#define cono cout << "no" << endl
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int x;
  cin >> x;
  if (x >= 30) {
    coYes;
  }
  else {
    coNo;
  }
}

  


Measured memory_bytes: 3680
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void doIt(){
		Scanner sc = new Scanner(System.in);
		Player[] group = new Player[8];
		Player[] top_two = new Player[6];
		Player[] sub = new Player[6];
		
		for(int i=0; i<3; i++){
			for(int j=0; j<8; j++){
				group[j] = new Player();
				group[j].number = sc.nextInt();
				group[j].time = sc.nextDouble();
			}
			//??????????????????
			Arrays.sort(group);
			
			//????????¨??????????¨????
			top_two[0+i*2] = group[0]; top_two[1+i*2] = group[1];
			
			//????????¨???????????°?????????
			sub[0+i*2] = group[2]; sub[1+i*2] = group[3];
		}
		//??????????????¨???????????????
		for(int i=0; i<6; i++){
			System.out.println(top_two[i].number + " " + top_two[i].time);
		}
		//????????¨???????????°???????????????????????¨??????
		Arrays.sort(sub);
		for(int i=0; i<2; i++){
			System.out.println(sub[i].number + " " + sub[i].time);
		}
		
	}
	
	public static void main(String[] args){
		new Main().doIt();
	}

	class Player implements Comparable<Player>{
		int number=0;
		double time=0;
		
		@Override
		public int compareTo(Player p) {
			int r=-1;
			if(this.time>p.time) r=1;
			else if(this.time==p.time) r=0;
			return r;
		}
	}
}

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

int main() {
    vector<ll> A(3);
    for (ll i = 0; i < 3; i++) {
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    cout << A[0] * A[1] / 2 << endl;
}

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

int main(){
    int A, B, ans;
    ans = -1;
    cin >> A >> B;
    for(int i =1; i < 1010; i++){
        if(floor(i * 0.08) == A && floor(i * 0.1) == B){
            ans = i;
            break;
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <map>
#include <math.h>
#include <vector>
using namespace std;
map<int, int> ct;
map<int, int> ct2;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 998244353LL
#define EPS 0.00001
#define f first
#define s second
#define pb push_back
#define mp make_pair

#define FOR(i, a, b) for (int i=(a); i<=(signed)(b); i++)
#define AFOR(i, a) for (int i=0; i<(signed)(a); i++)
#define RFOR(i, a, b) for (int i=(a); i >= b; i--)

#define MN 100005
int n, m, l;
int a, b, c;
string s[MN];
string str;
string ans;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

/*
int N;
cin >> N;
vi vect(N);
FOR(i,N) cin >> vec.at(i);*/
//sort(vec.begin(),vec.end());
//vvi data(N,vi(4));


/*	int bfs(int x, int y,vvi &A,vvi flag) {
		queue<pii> que;
		que.push(pii(x, y));
		while (que.size()) {
			pii p = que.front(); que.pop();
			AFOR(i, 4) {
				int nx = p.first + dx[i]; int ny = p.second + dy[i];
				if (0 <= nx && nx < N && 0 <= ny && ny < N) {
					if (A.at(p.first).at(p.second) + flag.at(p.first).at(p.second) < A.at(nx).at(ny)) {
						A.at(nx).at(ny) = A.at(p.first).at(p.second) + flag.at(p.first).at(p.second);
						que.push(pii(nx, ny));
					}
				}
			}
		}
		return 0;
	}
	*/
	/*int gcd(int p, int q){
		while(q != 0){
		int r = p % q;
		p = q;
		q = r;
		}
	return p;
	}*/

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	long long X;
	cin >> X;
	long long sum = 0;
	
	while (X > 499) {
		X -= 500;
		sum += 1000;
	}
	while (X > 4) {
		X -= 5;
		sum += 5;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1024
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys
import itertools as itr

S = []

dp = [] #末尾3つのパターンで記憶

def init():
  dct = {}
  for i in ['A','C','G','T']:
    for j in ['A','C','G','T']:
      for k in ['A','C','G','T']:
        s = i+j+k
        if s not in ['AGC','ACG','GAC']:
          dct[s] = 1
  return dct


def chk(s):
  if ('AGC' in s) or ('ACG' in s) or ('GAC' in s):
    return False
  elif ('AGAC' in s) or ('AGCC' in s) or ('AGGC' in s) or ('AGTC' in s):
    return False
  elif ('AAGC' in s) or ('ACGC' in s) or ('AGGC' in s) or ('ATGC' in s):
    return False
  else:
    return True


n = int(input())-3

dp = init()
for i in range(n):
  dct = {}
  for s in dp:
    for c in ['A','C','G','T']:
      if chk(s+c):
        if s[1:]+c not in dct:
          dct[s[1:]+c] = dp[s] % (10**9+7)
        else:
          dct[s[1:]+c] += dp[s] % (10**9+7)
  dp = dct

print(sum(dp.values())%(10**9+7))


Measured memory_bytes: 40560
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
     
#define mp make_pair
#define sz(x) (int)((x).size())
#define all(x) (x).begin(),(x).end()
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define eb emplace_back
 
typedef pair< int, int > pii;
typedef pair< long long, long long > pll;
typedef long long ll;
typedef unsigned long long ull;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< ll > vll;
typedef vector< vll > vvll;
typedef vector< pii > vpii;
typedef vector< vpii > vvpii;
typedef vector< pll > vpll;
typedef long double ld;
typedef vector< ld > vld;
typedef unsigned int uint;
 
const ll MOD2 = 1e9 + 7;
const int MOD = 1e9 + 7;
 
const ull infull = numeric_limits<unsigned long long>::max();
 
void fix(int &x, ll MOD) {
    x = (x % MOD);
    if(x < 0) x += MOD;
    return;
}
 
ll lgput(ll a, ll b, ll MOD) {
    ll ret = 1;
    a %= MOD;
    while(b) {
        if(b&1) ret = ret*a % MOD;
        a = a*a % MOD;
        b >>= 1;
    }
 
    return ret;
}
 
ll inv(ll a, ll MOD) {
    return lgput(a, MOD-2, MOD);
}
 
template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    const bool operator<(const M& o) const {return v < o.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
 
using Mint = ModInt<(int)1e9 + 7>;

int main() { 
    #ifdef BLAT
        freopen("stdin", "r", stdin);
        freopen("stderr", "w", stderr);
    #endif
 
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    srand(time(NULL));

    string s, t;
    cin >> s >> t;

    t.pop_back();

    cout << (s == t ? "Yes\n" : "No\n");
    return 0; 
}

Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
	int N,a;
	scanf("%d",&N);
	for(int i=1;i<=9;i++)
	{
		if(N%i==0)
			a=N/i;
		else
			continue;
		/*if(a>=10)
		{
			printf("No\n");
			break;
		}
		else
		{
			printf("Yes\n");
			break;
		}*/
		if(a<10)
		{
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;

}

Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]

X,Y,A,B,C = map(int,input().split(' '))
l_p = list(map(int, input().split()))
l_q = list(map(int, input().split()))
l_r = list(map(int, input().split()))
l_p = sorted(l_p, reverse=True)
l_q = sorted(l_q, reverse=True)
l_r = sorted(l_r, reverse=True)
x = 0
y = 0
z = 0
Z = len(l_r)

def getMax(x,y,z):
    k_x = 0 if x==X else l_p[x]
    k_y = 0 if y==Y else l_q[y]
    k_z = 0 if z==Z else l_r[z]
    MAX = max(k_x,k_y,k_z)
    if MAX==k_x:
        x += 1
    elif MAX==k_y:
        y += 1
    else:
        z += 1
    return x,y,z,MAX
ans = 0
while True:
    x,y,z,m = getMax(x,y,z)
    ans += m
    if x+y+z==X+Y:
        break
print(ans)

Measured memory_bytes: 23328
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = 998244353;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

bool d2 = true;
vec group(100010, 0);
mat G(100010, vec(0));
void dfs(ll v, ll c){
    group[v] = c;
    for(ll to : G[v]){
        if(group[to] == c){
            d2 = false;
            return;
        }else if(group[to] == 0){
            dfs(to, -c);
        }
    }
    return;
}

int main() {
    cin>>N>>M;
    rep(i,M){
        cin>>A>>B;
        --A; --B;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    dfs(0, 1);
    if(!d2){
        cout<<N * (N - 1) / 2 - M<<endl;
    }else{
        ll a, b;
        a = b = 0;
        rep(i,N) (group[i] > 0 ? ++a : ++b);
        cout<<a * b - M<<endl;
    }
}

Measured memory_bytes: 7936
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int ban[100001];
int main(){
	string S;
	cin>>S;
	REP(i,S.size()){
	    if(S[i]=='B'){
	       ban[i]=0;
	    }else{
	       ban[i]=1;
	    }
	}
	int ans=0;
	int temp=ban[0];
	REP(i,S.size()){
	    if(i==0)continue;
	    if(ban[i]!=ban[i-1]){
	       ans++;
	    }
	}
        cout<<ans<<endl;
	return(0);
}

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

using namespace std;

using ll = long long;

int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int K;
    cin >> K;
    cout << a[K -1] << endl;
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}


int main(){
    int n;
    cin >> n;
    vector<int> odd, even;
    for(int i = 1; i <= n; i++){
        int a; cin >> a;
        if(i%2 == 1) odd.push_back(a);
        else even.push_back(a);
    }

    vector<int> ans;
    if(n%2 == 1){
        for(int i = odd.size()-1; i >= 0; i--) ans.push_back(odd[i]);
        for(int i = 0; i < even.size(); i++) ans.push_back(even[i]);
    }
    else{
        for(int i = even.size()-1; i >= 0; i--) ans.push_back(even[i]);
        for(int i = 0; i < odd.size(); i++) ans.push_back(odd[i]);
    }

    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 5072
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back

typedef pair<ll,ll> pl;

int main() {
  int N,C;
  cin >> N >> C;

  ll imos[30][101010];
  rep(i,N) {
    ll s,t,c;
    cin >> s >> t >> c;
    s--, c--;
    ++imos[c][s], --imos[c][t];
  }

  for (int c = 0; c < C; ++c) {
    for (int i = 1; i < 101010; ++i) {
      imos[c][i] += imos[c][i-1];
    }
  }

  for (int c = 0; c < C; ++c) {
    for (int i = 0; i < 101010; ++i) {
      if (imos[c][i]) imos[c][i] = 1;
    }
  }

  int ans = 0;
  for (int i = 0; i < 101010; ++i) {
    int cnt = 0;
    for (int c = 0; c < C; ++c) cnt += imos[c][i];
    ans = max(ans, cnt);
  }

  cout << ans << endl;
}


Measured memory_bytes: 23936
N,*A = `dd`.split.map &:to_i
g1 = [nil, A[0]]
g2 = [nil, A[-1]]
(1...N).each{ |i|
  g1 << g1[-1].gcd(A[i])
  g2 << g2[-1].gcd(A[-i-1])
}

g1 << nil
g2 << nil
g2.reverse!
#p g1, g2
p (1..N).map{ |i|
  (g1[i-1] || g2[i+1]).gcd(g2[i+1] || g1[i-1])
}.max

Measured memory_bytes: 11908
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve() {
    int m, d; cin >> m >> d;
    int ans = 0;
    Rep(i, 4, m) Rep(j, 22, d) {
        if(j/10 >= 2 && j%10 >= 2 && i == (j/10)*(j%10)) ans++;
    }
    cout << ans << endl;
}

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

    solve();
    return 0;
}
 


Measured memory_bytes: 256
n,m,c = map(int,input().split())
L = list(map(int,input().split()))
cnt = 0
for i in range(n):
    wa = 0
    li = list(map(int,input().split()))
    for j in range(m):
        wa +=L[j]*li[j]
    if wa + c >0:
        cnt +=1
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define sz(a)       (ll)(a.size())
#define cr(P)       cout<<P<<"\n";return;
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,x,n)   for(ll i=x;i<n;i++)
#define frr(i,x,n)  for(ll i=n-1;i>=x;i--)
using namespace std;


const ll N   =  500005;
const ll mod = 1e9 + 7;

ll f(vector<ll> a,vector<ll> b,vector<ll> c){
	ll ans =0,x;
	for(auto i : a){
		for(auto j : b){
			if(j> i){
				//cout << i << " "<<j <<" "<< 2 * j - i<<"\n";
				x = c.size() - (upper_bound(c.begin(), c.end(),j) -c.begin());
			if(x>0 and binary_search(c.begin(), c.end(),2*j-i)){
				ans +=x-1;
			}
			else ans+=x;
			}
		}
	}
	return ans;
}

void solve(){
vector<ll>v[3];

  ll x=0,y=0,c=0,ans=0;
  ll n,m,k;
  cin>>n;
 	string s;
 	cin>>s;
 	for (ll i = 0; i < n; ++i){
 			
 		if(s[i]=='R')
 			v[0].pb(i+1);
 		else if(s[i]=='G')
 			v[1].pb(i+1);
 		else v[2].pb(i+1);
 	}

 	ans+=f(v[1],v[2],v[0]) + f(v[1],v[0],v[2]) + f(v[0],v[2],v[1])+ f(v[0],v[1],v[2])
 	 + f(v[2],v[1],v[0]) + f(v[2],v[0],v[1]) ;
 	c(ans);
}

signed main(){
     
  ios_base::sync_with_stdio(false);   
  cin.tie(NULL);
  //int T;cin >> T;while (T--)
  solve();
  return 0;
}


Measured memory_bytes: 3792