akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

	if (a == b)
	{
		cout << "a == b" << endl;
	}
	else if (a < b)
	{
		cout << "a < b" << endl;
	}
	else
	{
		cout << "a > b" << endl;
	}
}



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


signed main() {
    int K, N;
    cin >> K >> N;

    int A[200010];
    rep (i, N) cin >> A[i];

    int d[200010];
    rep (i, N-1) {
        d[i] = A[i+1] - A[i];
    }
    d[N-1] = (K - A[N-1]) + A[0];

    int max = 0;
    rep (i, N) {
        if (d[i] > max) max = d[i];
    }

    cout << K - max << endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  int n; cin >> n;
  vector<LL> sum(n);
  LL ans = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    sum[i] = a + b;
    ans -= b;
  }

  sort(sum.rbegin(), sum.rend());
  for (int i = 0; i < n; i ++) {
    if (i % 2 == 0) {
      ans += sum[i];
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#include<stdio.h>
int w,h;
char array[21][21];
int search(int x,int y)
{
		if(x<0||y<0||x>=w||y>=h)
			return 0;
		if(array[x][y]=='#')
			return 0;
		else{
				array[x][y]='#';
				return 1+search(x-1,y)+search(x+1,y)+search(x,y-1)+search(x,y+1);
		}
}
			
int main()
{
		int i,j;
		while(scanf("%d%d",&h,&w)&&w!=0&&h!=0){
				for(i=0;i<w;i++)
					scanf("%s",array[i]);
				for(i=0;i<w;i++)
					for(j=0;j<h;j++){
								if(array[i][j]=='@')
									printf("%d\n",search(i,j));
								}
						}
				}




Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  for(int i=1; i<=n; i++) {
    for(int j = i; j<=n; j+=i) {
      a[j]++;
    }
  }
  ll ans = 0;
  rep(i, n+1) {
    ans += (ll)i*a[i];
  }
  cout << ans << endl;
  return 0;
}

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

const int N=450,M=100100;
bitset<N>f[N],g[N],d;
int n,m,a[M],b[M],ans;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;++i)f[i][i]=1;
	for(int i=1;i<=m;++i)cin>>a[i]>>b[i];
	for(int i=m;i;--i){
		d|=f[a[i]]&f[b[i]];
		f[a[i]]=f[b[i]]=f[a[i]]|f[b[i]];
	}
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)g[i][j]=f[j][i];
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j)if(!d[i]&&!d[j])ans+=(g[i]&g[j]).none();
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1152
import fractions as math
n=int(input())
a=list(map(int,input().split()))
s=[0 for i in range(n)]
e=[0 for i in range(n)]
l=[0 for i in range(n)]
s[0]=a[0]
e[-1]=a[-1]
for i in range(1,n):
    s[i]=math.gcd(s[i-1],a[i])
    e[n-1-i]=math.gcd(e[n-i],a[n-1-i])
for i in range(1,n-1):
    l[i]=math.gcd(s[i-1],e[i+1])
l[0]=e[1]
l[-1]=s[n-2]
print(max(l))

Measured memory_bytes: 16124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LINE_BUF_SIZE 256

int main(){

    int i,j,k;
    char line[256];
    int A,B,count;

    count = 0;

    fgets(line,sizeof(line),stdin);
    sscanf(line,"%d %d",&A,&B);

    int s,t,u,v;

    for(i=A;i<=B;i++){

        s = i / 10000;      /*1万の位*/
        t = i % 10;         /*1の位*/
        u = i / 1000 % 10;  /*千の位*/
        v = i / 10 % 10;     /*十の位*/

        if(s == t && u == v)count += 1;

    }

    printf("%d",count);

    return 0;

}

Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	s := make([]int, n)
	for i := 0; i < n; i++ {
		s[i] = nextInt()
	}

	var dp [101][10101]bool
	dp[0][0] = true

	for i := 0; i < n; i++ {
		for j := 0; j < 10001; j++ {
			if dp[i][j] {

				dp[i+1][j] = true
				dp[i+1][j+s[i]] = true
			}
		}
	}

	ans := 0
	for j := 0; j < 10001; j++ {
		if j%10 != 0 && dp[n][j] {
			ans = max(ans, j)
		}
	}

	fmt.Println(ans)
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
int main()
{
	 long long int a,b;
	cin>>a>>b;
	if(a==1 or b==1)
	cout<<1;
	else{
		if(a%2!=0 and b%2!=0)
			cout<<((a*b)/2)+1;
			
		else
			cout<<(a*b)/2;
	}
}
	

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int result = (int) (Math.pow(a,1) + Math.pow(a,2) + Math.pow(a,3));
    
    System.out.println(result);
  }
}

Measured memory_bytes: 35772
import math
A=[list(map(int,input().split())) for n in range(3)]
N=int(input())
D=[int(input()) for i in range(N)]
F=[]
ans="No"
for d in D:
    for aa in A:
        for a in aa:
            if d==a:
               F.append([A.index(aa)+2,aa.index(d)+2])
            else:
                continue

for f1 in F:
    for f2 in F:
        for f3 in F:
            if f1==f2 or f2==f3 or f3==f1:
                continue
            elif math.atan2((f2[1]-f1[1]),(f2[0]-f1[0]))==math.atan2((f3[1]-f1[1]),(f3[0]-f1[0])):
                ans="Yes"
                break
            else:
                continue

print(ans)

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

using namespace std;

const int mod = 1e9 + 7;

long long add(long long a, long long b) {
    long long res = a + b;
    if (res >= mod) res -= mod;
    return res;
}

long long sub(long long a, long long b) {
    long long res = a - b + mod;
    if (res >= mod) res -= mod;
    return res;
}

long long mul(long long a, long long b) {
    return (((a % mod) * (b % mod)) % mod);
}

long long gcd(long long x, long long y){
    if(y == 0){
        return x;
    }
    if(x > y){
         return gcd(y, x % y);
    }
    else{
         return gcd(x, y % x);
    }
}

void dfs(vector<vector<int>> &v, vector<int> &visited, int node, int &ans){
    if(visited[node]){
        return;
    }
    visited[node] = 1;
    ans++;
    for(auto i : v[node]){
        dfs(v, visited, i, ans);
    }
}

/*bool good(vector<int> &v, int d, int mid){
    vector<int> p(v.size());
    p[0] = v[0] - mid;
    for(int i = 1;i < v.size();i++){
        p[i] = p[i - 1] + (v[i] - mid);
    }
    vector<int> m(v.size());
    m[0] = p[0];
    int mi = m[0];
    for(int i = 1;i < v.size();i++){
        mi = min(mi, p[i]);
        m[i] = mi;
    }
    for(int r = 0;r < v.size();r++){
        if(r - d > 0){
            if(m[r - d - 1] <= p[r]){
                L = r - d;
                R = r;
                return true;
            }
        }
    }
    return false;
}*/

int main(){
    int n, k;
    cin >> n >> k;
    vector<long long> h(n);
    for(int i = 0;i < n;i++){
        cin >> h[i];
    }
    vector<long long> dp(n + 1);
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(h[0] - h[1]);
    for(int i = 3;i <= n;i++){
        dp[i] = 1e18;
        for(int j = 1;j <= k;j++){
            if(i - j - 1 < 0)break;
            dp[i] = min(dp[i], dp[i - j] + abs(h[i - 1] - h[i - j - 1]));
        }
    }
    cout << dp[n] << endl;
 }
/*
5 2
-1 -2 -3 4 5
2 3
4

-3 -2 -1 4 5
2 3
5 + (-3) = 2
4 + -2 = 2
ans = 4

-3 -2 -1 4 5
3 2
5 + -3 = 2
4 + -1 = 3
ans = 5
*/


Measured memory_bytes: 4840
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

const int N = 100005;

int n, a, b;
int arr[N];

bool ok(int mid) {
  int have = mid;
  for (int i = 0; i < n; i++) {
    long long tmp = arr[i];
    tmp -= 1ll * mid * b;
    if (tmp <= 0) {
      continue;
    }
    int need = (tmp + a - b - 1) / (a - b);
    if (need > have) return 0;
    have -= need;
  }
  return 1;
}

int main() {
  scanf("%d %d %d", &n, &a, &b);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  int l = 1, r = 2e9, ans;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (ok(mid)) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        ArrayList<Integer>[] dic = new ArrayList[26];
        for(int i=0;i<26;i++) dic[i]=new ArrayList<>();
        for(int i=0;i<s.length();i++){
            char cur = s.charAt(i);
            dic[cur-'a'].add(i);
        }
        int ans = 100;
        for(int i=0;i<26;i++){
            if(dic[i].size()==0) continue;
            int temp = dic[i].get(0);
            for(int j=0;j<dic[i].size()-1;j++){
                temp = Math.max(temp,dic[i].get(j+1)-dic[i].get(j)-1);
            }
            temp = Math.max(temp,s.length()-1-dic[i].get(dic[i].size()-1));
            ans = Math.min(ans,temp);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21332
#include <iostream>
#include <iomanip>
#include <cmath>

// Vector 2D
template<class T>
struct Vec2D
{
    T x,y;
    explicit Vec2D(T x_=T(), T y_=T()):x(x_),y(y_){}
    Vec2D(const std::pair<T,T>& p):x(p.first),y(p.second){}
    Vec2D& operator+=(const Vec2D& v){ return *this = *this+v; }
    Vec2D& operator-=(const Vec2D& v){ return *this = *this-v; }
    friend Vec2D operator+(const Vec2D& l, const Vec2D& r){ return Vec2D(l.x+r.x,l.y+r.y); }
    friend Vec2D operator-(const Vec2D& l, const Vec2D& r){ return Vec2D(l.x-r.x,l.y-r.y); }
    friend T norm(const Vec2D& v){ return std::hypot(v.x,v.y); }
    friend T norm2(const Vec2D& v){ return v.x*v.x+v.y*v.y; }
    friend T dot(const Vec2D& l, const Vec2D& r){ return l.x*r.x+l.y*r.y; }
    friend T cross(const Vec2D& l, const Vec2D& r){ return l.x*r.y-l.y*r.x; }
    friend int dir(const Vec2D& l, const Vec2D& r)
    {
        // assert(norm2(l)!=0);
        const auto c = cross(l,r);
        if(c>0) return 1;
        if(c<0) return -1;
        if(dot(l,r)<0) return -2;
        if(norm2(l)<norm2(r)) return 2;
        return 0;
    }
};

// Triangle 2D
template<class T=double>
class Triangle2D
{
    Vec2D<T> a,b,c;
public:
    explicit Triangle2D(T ax=T(), T ay=T(), T bx=T(), T by=T(), T cx=T(), T cy=T()):a(ax,ay),b(bx,by),c(cx,cy){}
    Triangle2D(const Vec2D<T>& a_, const Vec2D<T>& b_, const Vec2D<T>& c_):a(a_),b(b_),c(c_){}
    T area() const
    {
        return std::abs(a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y))/2;
    }
    T dist_a() const { return norm(b-c); }
    T dist_b() const { return norm(c-a); }
    T dist_c() const { return norm(a-b); }
    Vec2D<T> circumcenter() const
    {
        const Vec2D<T> vb(2*(b.x-a.x),2*(c.x-a.x)),
                       vc(2*(b.y-a.y),2*(c.y-a.y)),
                       vd(norm2(a)-norm2(b),norm2(a)-norm2(c));
        return Vec2D<T>(cross(vc,vd)/cross(vb,vc),
                        cross(vd,vb)/cross(vb,vc));
    }
    T R() const { return dist_a()*dist_b()*dist_c()/(4*area()); }
    bool inside(const Vec2D<T>& p, bool line=true) const
    {
        const auto c1 = cross(b-a,p-a);
        const auto c2 = cross(c-b,p-b);
        const auto c3 = cross(a-c,p-c);
        if(line) return (c1>=0&&c2>=0&&c3>=0)||(c1<=0&&c2<=0&&c3<=0);
        else     return (c1> 0&&c2> 0&&c3> 0)||(c1< 0&&c2< 0&&c3< 0);
    }
};

int main()
{
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(3);
    typedef double F;
    for( F x1,y1,x2,y2,x3,y3,px,py;
         std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> px >> py; )
    {
        const Triangle2D<F> tri(x1,y1,x2,y2,x3,y3);
        std::cout << (tri.inside(Vec2D<F>(px,py))?"YES":"NO") << std::endl;
    }
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define l first
#define r second

using namespace std;

const int maxn = 2e5 + 1;

int t[maxn];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, c, k;
    cin >> n >> c >> k;
    for (int i = 0; i < n; i++)
        cin >> t[i];
    sort(t, t + n);
    int ci = -1, ans = 0;
    for (int i = 0; i < n; i++) {
        if (i - ci == c || i == n - 1 || t[i + 1] > t[ci + 1] + k) {
            ++ans; ci = i;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1024
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys
from itertools import combinations

def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    n, m, x = _ia()
    c = []
    a = []
    for i in range(n):
        t = list(_ia())
        c.append(t[0])
        a.append(t[1:])
    books = [i for i in range(n)]
    r = -1
    for i in range(1,n+1):
        for b in combinations(books, i):
            cost = sum(c[k] for k in b)
            if r>0 and cost>=r:
                continue
            tmp = [0] * m
            for bi in b:
                for j,aij in enumerate(a[bi]):
                    tmp[j] += aij

            if min(tmp)>=x:
                r = cost
    return r

if __name__ == "__main__":
    print(main())


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

#define sync ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
#define debug(x) cerr << #x << ": " << x << endl
#define debugP(p) cerr << #p << ": {" << p.first << ", " << p.second << '}' << endl
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9, MOD = INF + 7;
 
/////////////////////////////////////////////////////////////////////
 
const int N = 1e5 + 5;

int main() {
 
	sync;

	int n, m, sumX = 0, sumY = 0; cin >> n >> m;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		sumX = (sumX + 1LL * (2 * i - n + 1) * x % MOD) % MOD;
	}
	for (int i = 0; i < m; i++) {
		int y; cin >> y;
		sumY = (sumY + 1LL * (2 * i - m + 1) * y % MOD) % MOD;
	}
	cout << 1LL * sumX * sumY % MOD << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define INF 1e9+7
#define pf2 pop_front
#define pb2 pop_back
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define sz size
#define eps 1e-7
#define fod find_by_order
#define fastio ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ofk order_of_key
#define val(x) cout << "Value dari "<< #x << " adalah " << x  << "\n"
#define tr tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
using namespace __gnu_pbds;
using namespace std;

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

void readf(string x){
	freopen((x+".in").c_str(),"r",stdin);
	freopen((x+".out").c_str(),"w",stdout);
}

void pr(string x){
	freopen((x+".in").c_str(),"w",stdout);
}


int read()
{
	bool min = 0;
	int  result = 0;
	char ch;
	ch = getchar();
	while(1)
	{
		if(ch == '-') break;
		if(ch >='0' && ch <= '9') break;
		ch = getchar();
	}
	if(ch == '-') min = 1;else result = ch-'0';
	while(1)
	{
		ch =getchar();
		if(ch< '0' || ch>'9') break;
		result = result * 10 + (ch-'0');
	}
	if(min) return -result;
	return result;
}
//Reynaldo's Template

int main(){
	int N;
	cin >> N;
	int x[N+5];
	int cnt4 = 0,cnt2 = 0;
	for(int i=1;i<=N;i++) cin >> x[i];
	for(int i=1;i<=N;i++){
		if(x[i] % 4 == 0) x[i] = 4,cnt4++;
		else if(x[i] % 2 ==0 ) x[i] = 2,cnt2++;
		else {
			x[i] = 1;
		}
	}
	int gg = cnt4 * 2 + 1;
	//co
	N = N - gg;
	if(N <= 0){
		cout << "Yes\n";
		return 0;
	}
	if(cnt2 >= N+1){
		cout <<"Yes\n";
	}
	else cout << "No\n";
}



Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int N;
  scanf("%d", &N);

  int c = 0;

  long p;

  int i;

  for(i = 0; i < N; i++){
    scanf("%ld" , &p);
    if(p % 2 == 1){
      c++;
    }
  }

  if(c == 0) printf("second\n");
  else printf("first\n");

  return 0;
}


Measured memory_bytes: 128
A, B = map(int, input().split())
ans = 0
for i in range(A, B + 1):
    s = str(i)
    if len(s) % 2 == 0:
        if s[0:len(s) / 2] == s[::-1][0:len(s) / 2]:
            ans += 1
    else:
        if s[0:((len(s) - 1) // 2)] == s[::-1][0:((len(s) - 1) // 2)]:
            ans += 1
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h> 
using namespace std;
int main()
{
int a,b,c,ans=0;
cin>>a>>b>>c;
int d[10001];
for(int i=1;i<=a;++i){
cin>>d[i];
if(d[i]<b||d[i]>=c)
{
ans++; 
}
}
cout<<ans<<endl;
return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  LL n,d;
  cin >> n >> d;
  cout << (n+d*2)/(d*2+1) << endl;
  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]

use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let _: usize = read();
    let S: String = read();
    let mut e_count = 0;
    for c in S.chars() {
        if c == 'E' {
            e_count += 1;
        }
    }
    let mut ans = std::usize::MAX;
    let mut now_may_change_count = e_count;
    let mut before_char = 'X';
    for c in S.chars() {
        if c == 'E' {
            now_may_change_count -= 1;
        }
        if before_char == 'W' {
            now_may_change_count += 1;
        }
        before_char = c;
        ans = std::cmp::min(ans, now_may_change_count);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
	int ans=0;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		int pk=0;
		if (i%2==0) continue;
		for (int j=1;j*j<=i;j++){
			if (i%j==0) pk+=2;
			if (j*j==i) pk--;
		}
		if (pk==8) ans++;
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

a,b = li()

if b%a == 0:
    print(a+b)
else:
    print(b-a)

Measured memory_bytes: 3064
package main

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

const (
	PERCENT_8  float64 = 0.08
	PERCENT_10         = 0.1
)

func main() {
	sc := newInputScanner(true)
	A := float64(sc.nextInt())
	B := float64(sc.nextInt())
	minOne, maxOne := findRange(PERCENT_8, A)
	minTwo, maxTwo := findRange(PERCENT_10, B)
	var answer int
	if maxTwo < minOne || maxOne < minTwo {
		answer = -1
	} else {
		if minOne > minTwo {
			answer = minOne
		} else {
			answer = minTwo
		}
	}
	fmt.Println(answer)
}

func findRange(taxRate float64, tax float64) (int, int) {
	min := int(math.Ceil(tax / taxRate))
	max := int(math.Ceil((tax+1.0)/taxRate)) - 1
	return min, max
}

type inputScanner struct {
	*bufio.Scanner
}

func newInputScanner(enabledScanWords bool) *inputScanner {
	scanner := bufio.NewScanner(os.Stdin)
	if enabledScanWords {
		scanner.Split(bufio.ScanWords)
	}
	return &inputScanner{
		Scanner: scanner,
	}
}

func (inputSc *inputScanner) nextInt() int {
	inputSc.Scan()
	i, e := strconv.Atoi(inputSc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextUInt64() uint64 {
	inputSc.Scan()
	i, e := strconv.ParseUint(inputSc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func (inputSc *inputScanner) nextStr() string {
	inputSc.Scan()
	return inputSc.Text()
}


Measured memory_bytes: 640
{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
{-# LANGUAGE BangPatterns      #-}
{-# LANGUAGE CPP               #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections     #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    !n <- readLn :: IO Int
    xs <- U.unfoldrN n (B.readInt.B.dropWhile isSpace) <$> B.getLine
    print $ solve $ U.toList xs

solve :: [Int] -> Int
solve xs = sum.map step.group $ sort xs
  where
    step ys@(y:_)
      | y == l = 0
      | y < l = l - y
      | otherwise = l
      where
        !l = length ys

Measured memory_bytes: 16764
import math

order = []
for i in range(5):
    order.append(int(input()))

mod = 10
idx = 0
for i, ord in enumerate(order):
    tmp = ord % 10
    if tmp < mod and tmp > 0:
        mod = tmp
        idx = i

for i in range(5):
    if i != idx:
        order[i] = math.ceil(order[i] / 10.) * 10

print(sum(order))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	char rem[500];
	char ram[500];
	scanf("%s%s",rem,ram);
	int yes=0;
	int l=strlen(rem);
	for (int i=0;i<l&&yes==0;i++){
		int val=1;
		for (int j=0;j<l;j++){
			if (rem[j]!=ram[(i+j)%l]){
				val=0;
				break;
			}
		}
		if (val==1){
			yes=1;
		}
	}
	if (yes)printf ("Yes\n");
	else printf ("No\n");
}

Measured memory_bytes: 256
#include<stdio.h>

#define MAX 44

int fib(int);

int data[MAX];

int main(void){
	int n;
	int i;

	scanf("%d",&n);

	for(i=0;i<=MAX;i++) data[i]=-1;

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

	return 0;
}

int fib(int n){
	if(data[n]>=0) return data[n];
	else{
		if(n==0 || n==1) return 1;
		else{
			data[n]=fib(n-1)+fib(n-2);
			return data[n];
		}
	}
}

Measured memory_bytes: 596
import bisect

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

def solv():
    N, M = map(int, input().split())
    divisors = make_divisors(M)
    l_i, r_i = bisect.bisect_left(divisors, N), bisect.bisect_right(divisors, N)
    print(M//divisors[min(l_i, r_i)])

if __name__ == '__main__':
    solv()


Measured memory_bytes: 39152
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <string>
using namespace std;
#define N (int)1e5
#define INF (int)1e9
#define mod (int)1e9 + 7
#define LL long long
LL n, c, k, ans, i2;
LL cre[N], dp[N], r[N];
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> cre[i];
	sort(cre, cre + n);
	r[0] = cre[0];
	for (int i = 1; i < n; i++)
	{
		r[i] = r[i - 1] + cre[i];
	}
	for (int i = 0; i < n; i++)
	{
		dp[i]++;
		if (cre[i + 1] <= r[i] * 2)
		{
			dp[i + 1] += dp[i];
		}
	}
	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <locale>
using namespace std;
int main(){

	
	char X,Y;

	cin>> X>> Y;
	if(int(X) > int(Y)){
		
		cout<<">";
	}else if(int(X) < int(Y)){
		cout<<"<";
	}else{
		cout<<"=";
	}
	
	return 0;
}

Measured memory_bytes: 256
import numpy as np

h,w = list(map(int,input().split()))

def tra(a):
    b = []
    for ax in a:
        if ax == '#':
            b.append(1)
        else:
            b.append(0)
    b = np.array(b)
    return b

aa = []
for i in range(h):
    a = input()
    aa.append(tra(a))

aa_ori = np.vstack(aa)

while True:
    ind = np.sum(aa_ori,axis=0) > 0
    if np.sum(ind) == len(ind):
        break
    aa_ori = aa_ori[:,ind]

    ind = np.sum(aa_ori,axis=1) > 0
    if np.sum(ind) == len(ind):
        break
    aa_ori = aa_ori[ind,:]

for a in aa_ori:
    s = ''
    for b in a:
        if b == 1:
            s += '#'
        else:
            s += '.'
    print(s)




Measured memory_bytes: 21860
import sys
import math
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
n,k=get_ints()
a=get_array()
ans1=[a[0]]
for i in range(1,n):
    ans1.append(a[i]+ans1[-1])
ans=[ans1[k-1]]
x=0
for j in range(k,n):
    ans.append(ans1[j]-ans1[x])
    x=x+1
for i in range(len(ans)-1):
    if ans[i+1]>ans[i]:
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 121212
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 0) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  std::string S;
  std::cin >> S;
  ll N = S.size();

  for (ll i = 1; i <= N; i++) {
    if ((N-i) % 2 != 0) continue;

    std::string s = S.substr(0, (N-i)/2);
    std::string t = S.substr((N-i)/2, (N-i)/2);
    if (s == t) {
      print(N - i);
      break;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll x, y;

int main() {
	cin >> x >> y;
	if (x%y == 0)cout << -1 << endl;
	else cout << x*y - x << endl;
}

Measured memory_bytes: 764
#include <cstdio>
#include <algorithm>
#include <cstring>
#define N 100005
#define fi(a, b, c) for(int a = (b); a < (c); a++)
#define FI(a, b, c) for(int a = (b); a <= (c); a++)
using namespace std;

int n, a[N], dp[N][2];

int main(){
	scanf("%d", &n);
	
	int lp = 0, ispower = 1;
	
	FI(i, 1, n){
		scanf("%d", &a[i]);
		
		int p = 31 - __builtin_clz(a[i]);
		int isp = __builtin_popcount(a[i]) == 1;
		
		dp[i][0] = dp[i][1] = 1e9;
		
		if(isp){
			dp[i][0] = min(dp[i][0], dp[i - 1][0] + p + !isp - min(p, lp));
			if(!ispower) dp[i][0] = min(dp[i][0], dp[i - 1][1] + p + !isp - min(p, lp + 1));
		}else{
			dp[i][0] = min(dp[i][0], dp[i - 1][0] + p + !isp - min(p + 1, lp));
			if(!ispower) dp[i][0] = min(dp[i][0], dp[i - 1][1] + p + !isp - min(p + 1, lp + 1));
			
			dp[i][1] = min(dp[i][1], dp[i - 1][0] + p + !isp - min(p, lp));
			if(!ispower) dp[i][1] = min(dp[i][1], dp[i - 1][1] + p + !isp - min(p, lp + 1));
		}
		
		lp = p;
		ispower = isp;
	}
	
	printf("%d\n", min(dp[n][0], dp[n][1]));
}

Measured memory_bytes: 1408
gets
t=gets.split.map &:to_i
v=gets.split.map &:to_i

a=[]
s=0
t.zip(v){|x, y| (2*x).times{ a<<s; s=[s+0.5, y].min }}

b=[]
s=0
t.reverse.zip(v.reverse){|x, y| (2*x).times { b<<s=[s+0.5, y].min }}

p a.zip(b.reverse).each_cons(2).map{|x, y| (x.min+y.min)*0.5}.inject(0.25, :+)/2

Measured memory_bytes: 6848
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int n;
int a[1010];
bool f[1100000];
int main()
{
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for (int i=0;i<n;i++)
	{
		int s=0;
		for (int j=0;j<6 && j+i<n;j++)
		{
			s=s*10+a[i+j];
			f[s]=true;
		}
	}
	int i=0;
	while (true)
	{
		if (!f[i])
		{
			printf("%d\n",i);
			return 0;
		}
		i++;
	}
    return 0;
}


Measured memory_bytes: 4116
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
ll f(ll h, ll w){
    ll mini = INF;
    rep(i,1,h){
        ll h1 = h - i;
        ll h2 = (i + 1) / 2;
        ll h3 = i / 2;
        ll w1 = (w + 1) / 2;
        ll w2 = w / 2;
        mini = min(mini, max({h1 * w, h2 * w, h3 * w}) - min({h1 * w, h2 * w, h3 * w}));
        mini = min(mini, max({h1 * w, i * w1, i * w2}) - min({h1 * w, i * w1, i * w2}));
    }
    return mini;
}
main(){
    int H,W;
    cin >> H >> W;
    cout << (min(f(H,W), f(W,H) )) << endl;
}

Measured memory_bytes: 384
X=0
hoge=1
N=int(input())
NUM_list = list(int(input()) for i in range(N))
NUM_list.sort()
for i in range(N-1):
   if NUM_list[i]==NUM_list[i+1]:
      hoge+=1
   else:
      X += hoge%2
      hoge=1
X+=hoge%2

print(X)

Measured memory_bytes: 7436
#print('RRRLLRL'.index('LR'))
#print('RRRLLRLR'.index('LR'))
#=>4
#str.index(検索文字列,開始位置,終了位置)

#indexは見つからないとエラー
#findは見つからないと-1を出力

#s='RRLRLR'
#bubun=s[0:3]
#print(bubun)
#=>RRL


def stateRL(s):
	state=[0]*len(s)
	r=s.count('R')
	l=s.count('L')
	state[r-1]=1+(r-1)//2+l//2
	state[r]=1+r//2+(l-1)//2
	return state

s=input()
n=len(s)

state=[]

kireme=-1
nkireme=s.find('LR',0)

while nkireme!=-1:
	bubun=s[kireme+1:nkireme+1:]
	state+=stateRL(bubun)
	kireme=nkireme
	nkireme=s.find('LR',kireme+1)

bubun=s[kireme+1::]
state+=stateRL(bubun)
	
for i in range(n):
	print(state[i],end=' ')

Measured memory_bytes: 4908
#include <iostream>
#include <iomanip>
#include <ios>
#include <string>
using namespace std;
int main(void){
  string s;
  cin >> s;
  
  int checkc = -1;
  int checkf = -1;
  
  int n = s.length();
  
  for(int i=0;i<n;i++){
    if(s[i] == 'C') checkc = i;
    if(s[i] == 'F') checkf = i;
  }
  
  if(checkc != -1 && checkf != -1 && checkc < checkf){
    cout << "Yes" << endl;
  }
  else
    cout << "No" << endl;
  
  return 0;
}


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

int calc_point(int D, vector<int> c, vector<vector<int>> s, vector<int> t)
{
    int point = 0;
    vector<int> last(26);
    for (int i = 0; i < D; i++)
    {
        last.at(t.at(i) - 1) = i + 1;
        for (int j = 0; j < 26; j++)
        {
            point -= c.at(j) * (i + 1 - last.at(j));
        }

        point += s.at(i).at(t.at(i) - 1);
    }

    return point;
}

int main()
{
    clock_t start = clock();

    int D;
    cin >> D;

    vector<int> c(26);
    vector<vector<int>> s(D, vector<int>(26));

    for (int i = 0; i < 26; i++)
    {
        cin >> c.at(i);
    }

    for (int i = 0; i < D; i++)
    {
        for (int j = 0; j < 26; j++)
        {
            cin >> s.at(i).at(j);
        }
    }

    vector<int> t(D);
    for (int i = 0; i < D; i++)
    {
        t.at(i) = rand() % 26 + 1;
    }

    int point = calc_point(D, c, s, t);

    int old = 0;
    int new_point = 0;

    clock_t end;

    double time;

    int d;
    int q;
    while (true)
    {
        d = rand() % D + 1;
        q = rand() % 26 + 1;
        old = t.at(d - 1);
        t.at(d - 1) = q;

        new_point = calc_point(D, c, s, t);
        if (point < new_point)
        {
            point = new_point;
        }
        else
        {
            t.at(d - 1) = old;
        }

        end = clock();
        time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;

        if (time > 1980)
        {
            break;
        }
    }

    for (int i = 0; i < D; i++)
    {
        cout << t.at(i) << endl;
    }

    return 0;
}


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

int main(){
  int X;
  int x[3];
  cin >> X;
  x[0] = X/100; X -= (X/100)*100;
  x[1] = X/10 ; X -= (X/10)*10;
  x[2] = X;
  if (x[0] == x[2]){
    cout <<"Yes" <<endl;
  }else{
    cout <<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a, b, c, x, min, max;
    cin >> a >> b >> c; 
    if(b < a){
        x = a;
        a = b;
        b = x;
    }
    if(c < b){
        x = b;
        b = c;
        c = x;
    }
    if(b < a){
        x = a;
        a = b; 
        b = x;
    }
    cout << a << " " << b << " " << c;
    cout << endl;
}



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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;

vector<vector<i64>> dp;
vector<i64> a;
i64 n;

i64 dfs(i64 l, i64 r) {
    if (dp[l][r] != -1) return dp[l][r];
    if (l + 1 == r) return 0;

    i64 res = INF;
    for (i64 i = l + 1; i < r; i++) {
        res = min(res, dfs(l, i) + dfs(i, r) + a[r] - a[l]);
    }
    return dp[l][r] = res;
}

void solve() {
    cin >> n;
    a.resize(n + 1);
    for (i64 i = 1; i <= n; i++) cin >> a[i];
    partial_sum(all(a), begin(a));
    dp.resize(n + 1, vector<i64>(n + 1, -1));
    cout << dfs(0, n) << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 4504
SD = input()
T = input()

ans = ''

for i in range(0, len(SD) - len(T)+1):
    flg = True
    for j in range(len(T)):
        if SD[i+j] == '?' or SD[i+j] == T[j]:
            continue
        else:
            flg = False
    if flg == True:
        ans = SD[0:i] + T + SD[i+len(T):]
            
if ans:
    ans = ans.replace('?', 'a')
else:
    ans = 'UNRESTORABLE'
    
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cctype>

using namespace std;

int main(){
	string a, b, c;
	cin >> a >> b >> c;

	string ans;
	ans[0] = a[0];
	ans[1] = b[0];
	ans[2] = c[0];
	
	int i=0;
	char tmp;
	while(ans[i]){
		tmp = ans[i];
		putchar(toupper(tmp));
		i++;
	}
	
	return 0;
}



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

using ll = int_fast64_t;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define repr(i,n) for(int i{n};i-->0;)

signed main(){

  ll n,k;
  cin>>n>>k;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];

  vector bitcnt(60,0);
  rep(i,n)rep(j,60)if(a[i]>>j&1)bitcnt[j]++;

  ll x = 0;
  repr(j,60)if(bitcnt[j]*2<=n and (x|(1LL<<j))<=k)x|=1LL<<j;

  ll ans = 0;
  rep(i,n)ans+=x^a[i];
  cout<<(ans)<<endl;

}

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


int main() {
    ll N;
    cin >> N;
    N--;
    cout << N * (N+1) / 2LL << endl;
    return 0;
}


Measured memory_bytes: 256
"use strict";

const main = arg => {
    const N = arg.split("\n")[0].split(" ").map(n=>parseInt(n)).sort((a,b)=>a-b);
    const K = arg.split("\n")[1];
    const target = Math.max(...N) * Math.pow(2, K);
    N.pop();
    N.push(target);
    
    console.log(N.reduce((m,n)=>m+n));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

a=[list(map(int,input().split())) for i in range(3)]
n=int(input())
b=[int(input()) for i in range(n)]

for i in range(n):
    for j in range(3):
        for k in range(3):
            if a[j][k]==b[i]:
                a[j][k]=1000

# print(a)
for i in range(3):
    if a[i][0]==1000 and a[i][1]==1000 and a[i][2]==1000:
        print("Yes")
        quit()

for i in range(3):
    if a[0][i]==1000 and a[1][i]==1000 and a[2][i]==1000:
        print("Yes")
        quit()

if a[0][0]==1000 and a[1][1]==1000 and a[2][2]==1000:
    print("Yes")
    quit()

if a[0][2]==1000 and a[1][1]==1000 and a[2][0]==1000:
    print("Yes")
    quit()

print("No")

Measured memory_bytes: 66028
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      String A = sc.next();
      if(A.contains("a")&&A.contains("c")&&A.contains("b")){
      System.out.println("Yes");
      }
      else {
      System.out.println("No");
      }
   }
 }

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

int main()
{
	int a,b,c,xa,xb;
	cin>>a>>b>>c;
	xa=abs(a-b);
	xb=abs(a-c);
	cout<<((xa>xb)?"B":"A")<<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64=int_fast64_t;
using pii=pair<int,int>;
template <class T> using minheap=priority_queue<T,vector<T>,greater<T>>;
#define fir first
#define sec second
#define mkp make_pair
#define all(v) begin(v),end(v)
#define mod 1000000007LL

int n,m,k;
i64 _fac[1<<19],_ifac[1<<19],_inv[1<<19];

i64 comb(int x,int y) {
    if(x<y || y<0) return 0;
    return _fac[x]*_ifac[y]%mod*_ifac[x-y]%mod;
}

i64 calc(int x,int y) {
    return (comb(y*2+x,y)+mod-comb(y*2+x,y-1))%mod;
}

signed main() {
    _fac[0]=_ifac[0]=1;
    for(int i=1; i<1<<19; ++i) {
        _fac[i]=_fac[i-1]*i%mod;
    }
    _inv[1]=1;
    for(int i=2; i<1<<19; ++i) {
        _inv[i]=mod-mod/i*_inv[mod%i]%mod;
    }
    for(int i=1; i<1<<19; ++i) {
        _ifac[i]=_ifac[i-1]*_inv[i]%mod;
    }
    cin>>n>>m>>k;
    i64 ans=0;
    for(int i=0; i<=k; ++i) {
        (ans+=comb(k*2+n+m,i*2+n)*calc(n,i)%mod*calc(m,k-i)%mod)%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 15392
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define For(i, a, b) for (int i = int(a); i < int(b); i++)
#define Dor(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define Foz(i, a) For(i, 0, a)
#define Doz(i, a) Dor(i, 0, a)
#define Trav(e, v) for (auto& e : v)
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vii = vector<ii>;
template <typename T> bool ckmin (T& a, T b) { return (b < a) ? a = b, 1 : 0; }
template <typename T> bool ckmax (T& a, T b) { return (b > a) ? a = b, 1 : 0; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (string& e) { return "\"" + e + "\""; }
string to_string (char e) { return "\'" + string(1, e) + "\'"; }
string to_string (bool e) { return e ? "true" : "false"; }
template <typename T> string to_string (T e) {
	string s = "[ ";
	for (auto& x : e) s += to_string(x) + " ";
	return s + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e) {
	return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
 	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	ll n;
	cin >> n;
	auto f = [&] (ll x, ll y) {
		return abs(x - 1) + abs(y - 1);
	};
	ll ans = f(1, n);
	for (ll i = 2; i * i <= n; i++) if (n % i == 0) {
		ckmin(ans, f(i, n / i));
	}
	cout << ans << '\n';

}



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

int main() {
    int l,r,d; cin >> l >> r >> d;
    int ans=0;
    for (int i=l; i <= r; i++) {
        if (i%d == 0) ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

vector<pair<ll, int>> prime_factor(ll num) {
  vector<pair<ll, int>> ret;
  for (ll i=2; i*i<=num; ++i) {
    int count = 0;
    while (num%i == 0) {
      num /= i;
      ++count;
    }
    if (count != 0) ret.push_back(make_pair(i, count));
  }
  if (num != 1) ret.push_back(make_pair(num, 1));
  return ret;
}

int main() {
  ll a, b; cin >> a >> b;
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  int ans = prime_factor(b).size() + 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
k,s=map(int,input().split())
dp=[0]*(3*k+4)
dp[0]=1
dp[k+1]=-3
dp[2*k+2]=3
dp[-1]=-1
from itertools import accumulate
dp=list(accumulate(list(accumulate(list(accumulate(dp))))))
print(dp[s])

Measured memory_bytes: 9312
main :: IO ()
main = do
  k <- read <$> getLine :: IO Int
  (a:b:_) <- map read . words <$> getLine :: IO [Int]
  putStrLn $ if (b-a+1) >= k
             then "OK"
             else if all (/=0) (map (`mod` k) [a..b])
                  then "NG"
                  else "OK"


Measured memory_bytes: 3768
import java.util.*;
 
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int x = 0;
		int max = 0;
		for(int i=0; i<n; i++){
			if(s.charAt(i) == 'I'){
				x++;
			}else if(s.charAt(i) == 'D'){
				x--;
			}
			if(x > max){max = x;}
		}
		System.out.println(max);
		return;
	}
}

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


ull gcd(ull a,ull b){
	if(!b) return a;
	return gcd(b,a%b);
}


int main(){
	ull n,cnt = 0,memo = 0,i = 0;
	cin  >> n;
	
	cnt += n / 11;
	cnt *= 2;
	n %= 11;
	
	if(n > 6){
		cnt += 2;
	}
	else if(n > 0){
		cnt++;
	}
	
	
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    long long a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if (v - w <= 0){
        cout << "NO" << endl;
    }
    else if( abs(b - a) <= t * (v-w))
    {
        cout << "YES" << endl;        
    }else{
        cout << "NO" << endl;
    }
 
    return 0;
}


Measured memory_bytes: 3640
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String S = sc.next();

        String val = S.substring(0,4);
        int yyyy = Integer.parseInt(val);

        String val2 = S.substring(5, 7);
        int mm = Integer.parseInt(val2);

        if ((yyyy == 2019 && mm < 5) || yyyy <= 2018) {
            System.out.println("Heisei");
        } else {
            System.out.println("TBD");
        }
    }
}

Measured memory_bytes: 23892
#include <stdio.h>
int main(){
    int n, cnt=0;
    scanf("%d",&n);
    char s[100002]={0};
    scanf("%s",s);
    for(int i=0; i<n; i++){
        if( s[i]!=s[i+1] ){ cnt++; }
    }
    printf("%d\n",cnt);
    return 0;
}

Measured memory_bytes: 1788
import java.io.*;
import java.util.*;

class Main{
	public static void main(String[] args){
		solve();
	}
	public static void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[200001];
		for(int i=0;i<n;i++){
			a[sc.nextInt()]++;
		}
		Arrays.sort(a);
		int count = 0;
		for(int i=200000;i>200000-k;i--){
			count += a[i];
		}
		System.out.println(n-count);
	}
}



Measured memory_bytes: 85500
#include<iostream>
    #include<algorithm>
    #include<vector>
    #include<queue>
    #include<stack>
    #include<map>
    #include<string>
    #include<cstring>
    #define ll long long
    #define all(x) (x).begin(),(x).end()
    #define rep(i,n) for(int i = 0;i < (n);++i)
    #define reps(i,n) for(int i = 1;i <= (n);++i)
    using namespace std;
    int main(){
    	cin.tie(0);
    	ios::sync_with_stdio(false);
    	int n;
    	cin >> n;
    	string s;
    	int cnt = 0;
    	reps(i,n){
    		s = to_string(i);
    		if(s.size() % 2 == 1) ++cnt;
    	}
    	cout << cnt << '\n';
    	return 0;
    }

Measured memory_bytes: 256