akhauriyash/Code-Regression huggingface dataset:
using System;

namespace B___Great_Ocean_View
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split(' ');
            var h = new int[n];
            var count = 1;
            for (var i = 0; i < n; i++)
            {
                h[i] = int.Parse(input[i]);
            }
            var max = h[0];
            for (var i = 1; i < n; i++)
            {
               
                if (max<=h[i])
                {
                    max = h[i];
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 11092
s=[]
h,w,k=map(int,input().split())
for i in range(h):
    c=list(input())
    s.append(c)

ans=0
for hi in range(1<<h):
    for wj in range(1<<w):
        cnt=0
        for i in range(h):
            for j in range(w):
                if hi>>i&1:
                    continue
                if wj>>j&1:
                    continue
                if s[i][j]=='#':
                    cnt+=1
        if cnt == k:
            ans+=1
print(ans)

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

#define all(v) v.begin(), v.end()
typedef long long ll;

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

    ll x = n;
    if(b <= n) x = b - 1 ? b - 1 : 1;
    ll res = floor(a * x / b) - a * floor(x / b);
    cout << res << endl;
}


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

int main(){
    int n; cin >> n;
    string s;
    int C0=0,C1=0,C2=0,C3=0;
    rep(i,n){
        cin >> s;
        if(s=="AC") C0++;
        if(s=="WA") C1++;
        if(s=="TLE") C2++;
        if(s=="RE") C3++;
    }
    cout << "AC x " << C0 << endl;
    cout << "WA x " << C1 << endl;
    cout << "TLE x " << C2 << endl;
    cout << "RE x " << C3 << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
using namespace std;

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

bool check(map<int,int>& m){
	for(auto i : m){
		if(i.second % 2) return false;
	}
	return true;
}

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

	map<int,int> ma;
	rep(i,m){
		int a, b;
		cin >> a >> b;
		ma[a]++;
		ma[b]++;
	}

	cout << (check(ma) ? "YES" : "NO") << endl;
}


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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    int N, M; cin >> N >> M;
    cout << ((N == M) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string w[110];
  for(int i=0; i<n; i++){
    cin >> w[i];
  }
  set<string> s;
  s.insert(w[0]);
  for(int i=1; i<n; i++){
    if(s.count(w[i])){
      cout << "No" << endl;
      return 0;
    }
    if(w[i][0] != w[i-1][w[i-1].size()-1]){
      cout << "No" << endl;
      return 0;
    }
    s.insert(w[i]);
  }
  cout << "Yes" << endl;   
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;

int main()
{
  int x;
  cin >> x;
  cout << x*x*x << endl;
  return 0;
}

Measured memory_bytes: 3072
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, W = [int(x) for x in stdin.readline().rstrip().split()]
wv = [list(map(int, stdin.readline().rstrip().split())) for _ in range(N)]

max_weight = W+1
max_cost = sum([v for w, v in wv])

# cost時の最小の重さ
# dp[cost] = weight
# 計算量は最大でもN=100*vi=10^3の10^5
dp = [INF for _ in range(max_cost+10)]
dp[0] = 0

for w, v in wv:
    # 前からやると重複を許してしまうことになるので後ろから
    # max_cost~v
    for i in reversed(range(v, max_cost+1)):
        dp[i] = min(dp[i], dp[i-v]+w)

# max_cost~0
for i in reversed(range(max_cost+1)):
    if dp[i] <= W:
        print(i)
        break

Measured memory_bytes: 70636
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    long int N;
    cin >> N;
 
    long int arr[N+1];
    long int solved[N+1];
 
    for(long int n=1; n<=N; n++)
    {
        cin >> arr[n];
 
        solved[arr[n]] = n;
    }
 
    for(long int n=1; n<=N; n++)
    {
        cout << solved[n] << " ";
    }
 
    return 0;
}

Measured memory_bytes: 5188
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return [LIST() for _ in range(n)]
def NSTR(n): return [input() for _ in range(n)]


import time


INF = float("inf")
MOD = 10**9 + 7


def bit_sum(n):
    wa = 0
    while n > 0:
        wa += n & 1
        n >>= 1
    return wa

def bit(n, k):
    return (n >> k) & 1

def main():
    start = time.time()
    N = INT()
    X = input()
    origX = X
    wa = X.count("1")
    x = 0
    px = 0
    nx = 0
    start = time.time()
    for c in X:
        x <<= 1
        px <<= 1
        nx <<= 1
        if c == "1":
            x |= 1
            px |= 1
            nx |= 1
        px %= (wa+1)
        if wa != 1:
            nx %= (wa-1)
        else:
            nx %= wa
    if wa == 1:
        nx = None
    # print(time.time()-start)
    # start = time.time()
    X = x
    table = [None]*(N+1)
    table[0] = 0
    table[1] = 1
    for i in range(1, N+1):
        table[i] = table[i % bit_sum(i)] + 1
    # print(time.time()-start)
    # start = time.time()

    for i, c in enumerate(origX):
        count = 0
        if c == "1":
            if wa == 1:
                print(0)
                continue
            x = (nx-pow(2, N-i-1, wa-1)) % (wa-1)
            print(table[x]+1)
        else:
            x = (px+pow(2, N-i-1, wa+1)) % (wa+1)
            print(table[x]+1)
    # print(time.time()-start)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 84004
#include<bits/stdc++.h>
using namespace std;
const int M=1e6;
int a[M];
int main(){
	int n;
	string s;
	cin>>n>>s;
	s+=s;
	for(int i1=0;i1<2;i1++){
		for(int i2=0;i2<2;i2++){
			a[0]=i1;a[1]=i2;
			for(int i=2;i<=n+1;i++){
				if(s[i-1]=='o'&&a[i-1]==0) a[i]=1-a[i-2];
				if(s[i-1]=='o'&&a[i-1]==1) a[i]=a[i-2];
				if(s[i-1]=='x'&&a[i-1]==0) a[i]=a[i-2];
				if(s[i-1]=='x'&&a[i-1]==1) a[i]=1-a[i-2];
			}
			if(a[n]==a[0]&&a[n+1]==a[1]){
				for(int i=0;i<n;i++){
					cout<<(a[i]?'S':'W');
				}
				return 0;
			}
		}
	}
	cout<<-1<<endl;
	return 0;
} 

Measured memory_bytes: 1052
#include<bits/stdc++.h>
// __builtin_ctz : no of trailing zeros
#define int long long
#define ll long long
#define pp pair<int,int>
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int max(int x, int y)
{
    return x>y ? x : y;
}
int min(int x, int y)
{
    return x<y ? x : y;
}
void _(int&a , int b)
{
    a=(a%mod+b%mod)%mod;
    a=(a+mod)%mod;
}
ll cl(ll a,ll b)
{
    return (a/b)+(!(!(a%b)));
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin >> n;map<ll,ll> m;ll ans=0;
    for (int i = 0; i < n; ++i)
    {
    	ll d;cin >> d;m[d]++;ans+=d;
    }
    ll q;cin >> q;
    while(q--)
    {
    	ll b,c;cin >> b >> c;
    	ans-=b*m[b];ans+=c*m[b];
    	m[c]+=m[b];m[b]=0;
    	cout <<ans << "\n";
    }
    }

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

int main(){
    string s;
    cin >> s;
    int n = s.length();
    for(int i = 0; i < n; i++){
        for(int j = i; j < n; j++){
            string a = s.substr(0, i);
            string b = s.substr(j);
            string t = a+b;
            if(t == "keyence"){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M = mapint()
S = list(input())
T = list(input())
from math import gcd

leng = N*M//gcd(N, M)
step = (leng//N)*(leng//M)//gcd((leng//N), (leng//M))

for i in range(1, leng+1, step):
    if (i-1)%(leng//N)==0 and(i-1)%(leng//M)==0:
        if S[(i-1)//(leng//N)]!=T[(i-1)//(leng//M)]:
            print(-1)
            break
else:
    print(leng)

Measured memory_bytes: 71132
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  lint h,w,n;cin>>h>>w>>n;
  map<P,int> p;
  rep(i,n){
      int x,y;cin>>y>>x;
      p[{x,y}]+=1;
  }
  vector<lint> res(10,0);
  for(auto const& val:p){
      int dx=val.first.first-2;int ux=val.first.first;
      int dy=val.first.second-2;int uy=val.first.second;
      dx=max(1,dx);dy=max(dy,1);
      for(int i=dx;i<=ux;++i){
          for(int j=dy;j<=uy;++j){
              int sm=0;
              for(int xx=0;xx<3;++xx){
                  for(int yy=0;yy<3;++yy){
                      if(i+xx>w||j+yy>h){
                          sm=0;break;
                      }
                      if(p.find({i+xx,j+yy})!=p.end())++sm;
                  }
              }
              if(sm!=0)res[sm]++;
              //if(sm<9)printf("x=%d y=%d sm=%d\n",i,j,sm);
          }
      }
  }
  lint bufsm=0;
  rep1(i,9){
      bufsm+=res[i]/i;
  }
  lint zero=(h-2)*(w-2)-bufsm;
  cout<<zero<<"\n";
  rep1(i,9){
      cout<<res[i]/i<<"\n";
  }
  return 0;
}

Measured memory_bytes: 9896
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int gcd( int n, int m ) {
	if ( m == 0 ) {
		return n;
	}
	return gcd( m, n % m );
}

string Affine(string str, int a, int b) {
	string res = "";
	for ( int i = 0; i < str.size(); i++ ) {
		if ( str[ i ] >= 'a' && str[ i ] <= 'z' ) {
			char y = str[ i ] - 'a';
			res += ( char ) ( ( a * y + b ) % 26 ) + 'a';
		}
		else {
			res += str[ i ];
		}
	}
	return res;
}

int main() {
	int n;
	scanf( "%d\n", &n );
	while ( n-- ) {
		string str;
		getline( cin, str );
		for ( int i = 0; i < 100; i++ ) {
			if ( gcd( i, 26 ) != 1 ) {
				continue;
			}
			for ( int j = 0; j < 26; j++ ) {
				string s = Affine( str, i, j );
				if ( s.find( "that" ) != string::npos || s.find( "this" ) != string::npos ) {
					printf( "%s\n", s.c_str() );
					goto fin;
				}
			}
		}
	fin:;
	}
	return 0;
}

Measured memory_bytes: 1236
package main

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

// fmt.Scan is high cost
func main() {
	var sc = bufio.NewScanner(os.Stdin)
	buf := make([]byte, 1024)
	sc.Buffer(buf, 222222)
	var s string
	sc.Scan()
	s = sc.Text()
	a, z := -1, -1
	for i := 0; i < len(s); i++ {
		if a == -1 && s[i] == 'A' {
			a = i
		}
		if s[i] == 'Z' {
			z = i
		}
	}
	fmt.Println(z - a + 1)
}


Measured memory_bytes: 1280
n=int(input())
arr=list(map(int,input().split()))
d=dict()
count=0 
for i in arr:
    d[i]=d.get(i,0)+1 
for k,v in d.items():
    if not d[k]==k:
        if d[k]<k:
            count+=d[k]
        else:
            count+=d[k]-k 
print(count)

Measured memory_bytes: 17780
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
deque<ll> ans;
unordered_map<ll,ll> out;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>x;
    if(n==2||x==1||x==2*n-1){
        if(x!=2){
            Cout("No");
            return 0;
        }
        rep(i,2*n){
            ans.push_back(i+1);
        }
    }
    else if(x-2>=1){
        ans.push_back(x);
        ans.push_back(x+1);
        ans.push_back(x-2);
        ans.push_front(x-1);
        rrep(i,1,2*n){
            if(i==x-2)i=x+1;
            else{
                cnt++;
                if(cnt%2==1)ans.push_front(i);
                else ans.push_back(i);
            }
        }
    }
    else if(x+2<=2*n-1){
        ans.push_back(x);
        ans.push_back(x+1);
        ans.push_front(x-1);
        ans.push_front(x+2);
        rrep(i,1,2*n){
            if(i==x-1)i=x+2;
            else{
                cnt++;
                if(cnt%2==0)ans.push_front(i);
                else ans.push_back(i);
            }
        }
    }
    else{
        Cout("No");
        return 0;
    }

    Cout("Yes");
    rep(i,2*n-1)Cout(ans[i]);
    return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;

signed main() {
	int N, M;
	cin >> N >> M;
	vector<int>a(N), b(N), c(M), d(M);
	rep(i, N)cin >> a[i] >> b[i];
	rep(i, M)cin >> c[i] >> d[i];
	vector<P>mn(N);
	P p = make_pair(INF, INF);
	rep(i, N)mn[i] = p;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++) {
			int len = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			mn[i] = min(mn[i], make_pair(len, j + 1));
		}
	}
	rep(i, N)cout << mn[i].second << endl;
}

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

int main() {
	int n;
	cin >> n;
	vector <int> a(n);
	map <int, int> mp;
	int macs = -1;
	rep (i, n) {
		cin >> a[i];
		mp[a[i]]++;
		macs = max(macs, a[i]);
	}

	cout << macs << " ";
	auto itr = mp.upper_bound(macs / 2);
	auto va = mp.upper_bound(macs / 2);
	itr--;
	if (abs(itr->first - macs / 2.0) <= abs(va->first - macs / 2.0)) {
		cout << itr->first << endl;
	} else {
		cout << va->first << endl;
	}

	return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  s+=t;
  reverse(s.begin(),s.end());
  int k=1;
  int n=0;
  for(int i=0;i<s.size();i++){
    n+=(s[i]-'0')*k;
    k*=10;
  }
  for(int i=1;i<=5000;i++){
    if(i*i==n){
      cout<<"Yes"<<endl;
      return(0);
    }
  }
  cout<<"No"<<endl;
  return(0);
}


Measured memory_bytes: 256
N = int(input())
T,A = map(int, input().split())
temp_list = list(map(int, input().split()))
near_place = 100000
H = []
min_index = 0
for i in range(N):
    a = T - temp_list[i]*0.006
    H.append(abs(A - a))
print(H.index(min(H)) + 1)

 

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

int main(void)
{
    long long num;
    cin >> num;

    string s;
    while (num)
    {
        char c = 96 + ((num % 26 != 0) ? (num % 26) : 26);
        s += c;
        num /= 26;
        if (c == 'z')
            num--;
    }

    reverse(s.begin(), s.end());
    cout << s << endl;
}


Measured memory_bytes: 3120
n = int(input())
a = list(map(int, input().split()))

abs_min = float('inf')
ans = 0
neg_cnt = 0
zero_cnt = 0
for ai in a:
	if abs(ai)<abs_min:
		abs_min = abs(ai)
	if ai<0:
		neg_cnt += 1
	if ai==0:
		zero_cnt += 1
	ans += abs(ai)

if zero_cnt>0:
	print(ans)
elif neg_cnt%2 == 0:
	print(ans)
else:
	print(ans-abs_min*2)

Measured memory_bytes: 14412
#include <stdio.h>
int main(void)
{
    int i,n,tmp;  
    scanf("%d",&n);
    int a[n];
    for(i=0; i<n; i++){
      
        scanf("%d",&a[i]);
    }
    for(i=0; i<n/2; i++){
        tmp =a[i];
        a[i] =a[n-1-i];
        a[n-1-i] =tmp;
    }
    for(i = 0; i < n; i++){
        if(i)printf(" ");
        printf("%d",a[i]);
        
    }
    printf("\n");
    return 0;

    
}



Measured memory_bytes: 2140
#B - Bingo
import sys
a11,a12,a13=list(map(int,input().split()))
a21,a22,a23=list(map(int,input().split()))
a31,a32,a33=list(map(int,input().split()))
n = int(input())
card = []
card.append(a11)
card.append(a12)
card.append(a13)
card.append(a21)
card.append(a22)
card.append(a23)
card.append(a31)
card.append(a32)
card.append(a33)
x = 'x'
inputs = [input() for i in range(n)]
for j in inputs:
    if(int(j) in card):
        index = card.index(int(j))
        card[index] = 'x'
if(card[0] == x and card[1] == x and card[2] == x):
    print('Yes')
    sys.exit()
if(card[3] == x and card[4] == x and card[5] == x):
    print('Yes')
    sys.exit()
if(card[6] == x and card[7] == x and card[8] == x):
    print('Yes')
    sys.exit()
if(card[0] == x and card[3] == x and card[6] == x):
    print('Yes')
    sys.exit()
if(card[1] == x and card[4] == x and card[7] == x):
    print('Yes')
    sys.exit()
if(card[2] == x and card[5] == x and card[8] == x):
    print('Yes')
    sys.exit()
if(card[0] == x and card[4] == x and card[8] == x):
    print('Yes')
    sys.exit()
if(card[2] == x and card[4] == x and card[6] == x):
    print('Yes')
    sys.exit()
print('No')

Measured memory_bytes: 3192
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
	char s_[50],t[50];
	scanf("%s",s_);
	scanf("%s",t);
	int pos=-1,ls=strlen(s_),lt=strlen(t);
	for(int i=0;i+lt<=ls;i++){
		for(int j=0;j<=lt;j++){
			if(j==lt){
				pos=i;
				break;
			}
			if(s_[i+j]!='?'&&s_[i+j]!=t[j]){
				//printf("%d %d\n",i,j);
				break;
			}
		}
	}
	if(pos==-1) printf("UNRESTORABLE\n");
	else{
		for(int i=0;i<ls;i++){
			if(i>=pos&&i<(pos+lt)){
				printf("%c",t[i-pos]);
			}
			else if(s_[i]=='?')
				printf("a");
			else
				printf("%c",s_[i]);
		}
		printf("\n");
	}
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X, A;
    cin >> X >> A;
    if (X < A) {
        cout << "0"
             << "\n";
    } else {
        cout << "10"
             << "\n";
    }

    return 0;
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int N, T;
  cin >> N >> T;

  int minv = INF;
  rep(i, N) {
    int c, t;
    cin >> c >> t;
    if (t <= T) chmin(minv, c);
  }

  if (minv == INF) cout << "TLE" << "\n";
  else cout << minv << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int MAX = 1000000010;
const ll MOD = 1000000007;
const double PI = acos(-1);

int main() {
    ll N, M; cin >> N >> M;
    ll ans = min(N, M / 2);
    if (N < M * 2) {
        ans += (M - ans * 2) / 4;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	string S;
	int offset = 0;

	cin >> S;
	sort(S.begin(), S.end());

	rep(i, S.length()) {
		if (S[i] == 'a' + offset) offset++;
		if ('a' + offset - 1 == 'z') {
			cout << "None" << endl;
			return 0;
		}
	}

	printf("%c\n", 'a' + offset);

	return 0;
}


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

int main(){
  ll n, k;
  cin >> n >> k;
  vector<ll> h(n);
  rep(i,n) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());
  if(k >= n) {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 0;
  rep(i,n-k) {
    ans += h[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
<?php
$N = trim(fgets(STDIN));
$a = explode(" ", trim(fgets(STDIN)));

$max = max($a);
$min = min($a);

$mid = floor(($max + $min) / 2);

while (true) {
    $val = sum($mid);
    $r = sum($mid + 1);
    $l = sum($mid - 1);

    if (min($val, $r, $l) == $val) {
        $ans = $val;
        break;
    } elseif ($val < $r) {
        $max = $mid;
        $mid = ceil(($min + $mid) / 2);
    } else {
        $min = $mid;
        $mid = floor(($max + $mid) /2);
    }
}

echo $ans;

function sum($n)
{
    global $a;
    $sum = 0;
    foreach ($a as $v) {
        $sum += ($v - $n) * ($v - $n);
    }
    return $sum;
}

Measured memory_bytes: 2936
#include<bits/stdc++.h>
using namespace std;
 
#define ff              first
#define ss              second
#define ll             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
 


 
long long d[1000010];
int main()
{
 

   
    int n,k;
    cin >> n >> k;
    int a[n];
    for(int i =0 ;i<n;i++){
    	cin >> a[i];
    }
    sort(a,a+n);
    int sum = 0;
    for(int i =0;i<k;i++)sum+=a[i];

    cout << sum << endl;
    




    
}

  

	
    
    	


  


Measured memory_bytes: 3620
/**
*     ________   ________   ___        ________          ________   ___        ________       ___    ___  _______    ________
*    |\   ____\ |\   __  \ |\  \      |\   __  \        |\   __  \ |\  \      |\   __  \     |\  \  /  /||\  ___ \  |\   __  \
*    \ \  \___|_\ \  \|\  \\ \  \     \ \  \|\  \       \ \  \|\  \\ \  \     \ \  \|\  \    \ \  \/  / /\ \   __/| \ \  \|\  \
*     \ \_____  \\ \  \\\  \\ \  \     \ \  \\\  \       \ \   ____\\ \  \     \ \   __  \    \ \    / /  \ \  \_|/__\ \   _  _\
*      \|____|\  \\ \  \\\  \\ \  \____ \ \  \\\  \       \ \  \___| \ \  \____ \ \  \ \  \    \/  /  /    \ \  \_|\ \\ \  \\  \|
*        ____\_\  \\ \_______\\ \_______\\ \_______\       \ \__\     \ \_______\\ \__\ \__\ __/  / /       \ \_______\\ \__\\ _\
*       |\_________\\|_______| \|_______| \|_______|        \|__|      \|_______| \|__|\|__||\___/ /         \|_______| \|__|\|__|
*       \|_________|                                                                        \|___|/
*/

#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
typedef vector<vector<ll>> mat;

const int N = 1e5 + 5;
int n , a[N] , out;
vector<int> se;

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

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

    for(int i = n - 1 ; i >= 0 ; i--)
    {
        auto x = upper_bound(se.begin() , se.end() , a[i]);
        if(x == se.end()) se.push_back(a[i]);
        else *x = a[i];
    }
    cout << se.size();

    return 0;
}


Measured memory_bytes: 1276
#include <bits/stdc++.h>
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second
using namespace std;
 
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
ll h[100004];
ll v[100004];
ll dp[100003];
 int32_t main()
{
    Need_for_speed(activated);
//    satisfy
//    {}
    ll hh,n;cin>>hh>>n;
    fore(i,0,n)cin>>h[i]>>v[i];
    fore(i,0,hh+1)
    {
        ll r=100000000000;ll ans=0;
        for(ll j=0;j<n;j++)
        {
            if(r>((i-h[j])>0?(dp[i-h[j]]+v[j]):(v[j])))
            {
                ans=((i-h[j])>0?(dp[i-h[j]]+v[j]):(v[j]));
                r=ans;
            }
            dp[i]=ans;
        }
       
    }
    cout<<dp[hh]<<endl;
    return 0;
}












Measured memory_bytes: 384
import java.util.*;
import java.util.function.BiFunction;
import java.io.*;


public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int N = sc.nextInt();
        char[] S = sc.next().toCharArray();
        int q = sc.nextInt();
        StringBuilder result = new StringBuilder();
        SegmentTree<Long> t = new SegmentTree<>(N, (x, y)->x|y, 0L);
        for(int i=0;i<N;i++){
            t.update(i, (x, y)->y, 1L<<(S[i]-'a'));
        }
        for(int i=0;i<q;i++){
            if(sc.nextInt()==1){
                int iq = sc.nextInt();
                char cq = sc.next().charAt(0);
                t.update(iq-1, (x, y)->y, 1L<<(cq-'a'));
            }
            else{
                int l = sc.nextInt();
                int r = sc.nextInt();
                long bit = t.query(l-1, r);
                result.append(Long.bitCount(bit)+"\n");
            }
        }

        out.println(result);
        out.flush();
    }

}

@SuppressWarnings("unchecked")
class SegmentTree<T> {
    private BiFunction<T, T, T> f;
    private int n;
    private T d1;
    private T[] dat;
    private  SegmentTree(T[] dat, int n_, BiFunction<T, T, T> f, T d1){
        this.f = f;
        this.d1 = d1;
        init(n_);
        build(dat);
    }

    public SegmentTree(T[] dat, BiFunction<T, T, T> f, T d1){
        this(dat, dat.length, f, d1);
    }

    public SegmentTree(int n_, BiFunction<T, T, T> f, T d1){
        this((T[]) new Object[0], n_, f, d1);
    }

    private void init(int n_){
        n = 1;
        while(n<n_) this.n *= 2;
        this.dat = (T[]) new Object[2 * this.n - 1];
    }

    private void build(T[] v){
        for(int i=0;i<n;i++) dat[i+n-1] = i < v.length ? v[i]: d1;
        for(int i=n-2;i>=0;i--) dat[i] = f.apply(dat[i*2+1], dat[i*2+2]);
    }

    public <E> void update(int k,BiFunction<T,E,T> g, E a){
        k += n-1;
        dat[k] = g.apply(dat[k], a);
        while(k>0){
            k = (k-1)/2;
            dat[k] = f.apply(dat[k*2+1], dat[k*2+2]);
        }
    }

    private T query(int a, int b, int k,int l, int r){
        if(r<=a || b<=l) return d1;
        if(a<=l&&r<=b) return dat[k];
        T vl = query(a, b, k*2+1, l, (l+r)/2);
        T vr = query(a, b, k*2+2, (l+r)/2, r);
        return f.apply(vl, vr);
    }

    public T query(int a, int b){
        return query(a, b, 0, 0, n);
    }
}

Measured memory_bytes: 153844
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> vec(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    vec.at(a - 1)++;
    vec.at(b - 1)++;
  }
  for (int i = 0; i < N; i++) {
    cout << vec.at(i) << endl;
  }
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
#define INF 1e7
#define LINF 1e15
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
// 'a' = 97 'z' = 122 => 'a' = 0 'z' = 25

int main() {
    string s; cin >> s;
    if(s[2] == s[3] && s[4] == s[5]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}




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

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

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

    ll ans = -10e17;
    if ((a <= 0 && b >= 0) || (c <= 0 && d >= 0)) ans = 0;
    chmax(ans, a * c);
    chmax(ans, a * d);
    chmax(ans, b * c);
    chmax(ans, b * d);

    cout << ans << endl;
}

Measured memory_bytes: 3628
# encoding: utf-8
n = int(input())
a = list(map(int, input().split()))

anss = [0] * 2
for init in range(2):
    ans = 0
    state = init
    sum_tmp = 0
    for i, ai in enumerate(a):
        ans_tmp = 0
        # 0
        if i == 0:
            if state == 1 and ai <= 0: ans_tmp += (-ai + 1)
            elif state == 0 and ai >= 0: ans_tmp += (ai + 1)
            sum_tmp = ai + ans_tmp if state == 1 else ai - ans_tmp
            ans += ans_tmp
            continue
        # > 1
        state = 1 - state
        ans_tmp = 0
        if state == 1:
            sum_tmp += ai
            if sum_tmp <= 0: ans_tmp += (-sum_tmp + 1) # 1
            sum_tmp += ans_tmp
        else:
            sum_tmp += ai
            if sum_tmp >= 0: ans_tmp += (sum_tmp + 1) # -1
            sum_tmp -= ans_tmp
        ans += ans_tmp
    anss[init] = ans

print(min(anss))

Measured memory_bytes: 14468
#include <bits/stdc++.h>
using namespace std;
int main(){
   int n,l;
   string s[110];
   cin >> n >> l;
   for (int i = 0;i < n; i++){
        cin >> s[i];
}
    sort(s,s+n);
    for (int i = 0;i < n;i++){
        cout << s[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int,input().split()))

    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)


main()

Measured memory_bytes: 21516
#include <bits/stdc++.h>
using namespace std ;
const int N = 2e5 + 10 ;
vector<int> v[N] ;
int a[N] , b[N] , c[N] , d[N] ;
int n , m ;
int h[N * 2] , ne[N * 2] , e[N * 2] , w[N * 2] , vis[N] ;
int idx , use[N] ;
int get(int x)
{
  return lower_bound(d + 1 , d + n + 1 , x) - d ;
}
void add(int a , int b , int c)
{
  e[idx] = b , ne[idx] = h[a] , w[idx] = c ,  h[a] = idx ++ ;
}
int dfs(int u)
{
  vis[u] = 1 ;
  int x = c[u] ;
  for(int i = h[u] ; ~i ; i = ne[i])
   {
     int v = e[i] ;
     if(!vis[v] && dfs(v))
      x ^= 1 , use[w[i]] = 1 ;
   }
  return x ;
}
int main()
{
  for(int i = 0 ;i < N ;i ++) h[i] = -1 ;
  ios::sync_with_stdio(false) ;
  cin.tie(0) , cout.tie(0) ;
  cin >> n >> m ;
  for(int i = 1; i <= n ; i ++) cin >> a[i] >> b[i] , d[i] = a[i] ;
  sort(d + 1 , d + n + 1) ;
  for(int i = 1; i <= n ;i ++)
   c[get(a[i])] = b[i] ;
  for(int i = n + 1; i >= 1 ;i --) c[i] ^= c[i - 1] ;
  for(int i = 1; i <= m ;i ++)
   {
     int l , r ;
     cin >> l >> r ;
     l = get(l) , r = upper_bound(d + 1 , d + n + 1 , r) - d - 1 ;
     if(l <= r)
     add(l , r + 1 , i) , add(r + 1 , l , i) ;
   }
   for(int i = 1; i <= n + 1 ;i ++)
    if(!vis[i] && dfs(i))
     {
       cout << -1 << endl ;
       return 0 ;
     }
     int ans =  0 ;
     for(int i = 1; i <= m ;i ++)
      if(use[i]) ans ++ ;
    cout << ans << endl ;
    for(int i = 1;i <= m ;i ++)
     if(use[i])
      cout << i << " " ;
  //  puts("") ;

}


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

int main() {
  int h, w;
  cin >> h >> w;
  
  vector<vector<char>> board(h, vector<char> (w));
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++)
      cin >> board.at(i).at(j);
  }
  
  vector<bool> row(h, false);
  vector<bool> col(w, false);
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (board.at(i).at(j) == '#') {
        row.at(i) = true;
        col.at(j) = true;
      }
    }
  }
  
  for (int i = 0; i < h; i++) {
    if (row.at(i)) {
      for (int j = 0; j < w; j++) {
        if (col.at(j))
          cout << board.at(i).at(j);
      }
      cout << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
unittest
{
	assert( [ "4 3", "1 2", "2 3", "2 4", "2 10", "1 100", "3 1" ].parse.expand.solve == "100 110 111 110" );
	assert( [ "6 2", "1 2", "1 3", "2 4", "3 6", "2 5", "1 10", "1 10" ].parse.expand.solve == "20 20 20 20 20 20" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nq = input.front.split.to!( long[] );
	auto abs = new long[ 2 ][ nq[ 0 ] - 1 ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
		ab[] -= 1;
	}
	auto pxs = new long[ 2 ][ nq[ 1 ] ];
	foreach( ref px; pxs )
	{
		input.popFront;
		px = input.front.split.to!( long[] );
		px[ 0 ]--;
	}
	return tuple( nq[ 0 ], abs, pxs );
}

auto solve( long n, long[ 2 ][] abs, long[ 2 ][] pxs )
{
	auto ws = new long[ n ];
	foreach( px; pxs )
	{
		ws[ px[ 0 ] ] += px[ 1 ];
	}
	
	auto anss = bfsEx( n, abs, ws, 0 );
	return anss.to!( string[] ).join( " " );
}

// グラフの始点指定最短経路探索（幅優先探索）
auto bfsEx( bool undirected = false )( long n, long[ 2 ][] es, long[] ws, long s )
{
	import std.container.dlist;
	
	auto ds = new long[ n ];
	ds[] = long.max;
	ds[ s ] = ws[ s ];
	
	auto nss = new long[][ n ];
	foreach( e; es )
	{
		nss[ e[ 0 ] ] ~= e[ 1 ];
		static if( undirected ) nss[ e[ 1 ] ] ~= e[ 0 ];
	}
	
	auto queue = make!DList( s );
	while( !queue.empty )
	{
		auto f = queue.front;
		queue.removeFront();
		
		foreach( t; nss[ f ] )
		{
			if( ds[ t ] < long.max ) continue;
			ds[ t ] = ds[ f ] + ws[ t ];
			queue.insertBack( t );
		}
	}
	return ds;
}


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

using namespace std;

bool judge(char a, char b) {
  if(a == '(') return b == ')';
  if(a == ')') return b == '(';
  if(a == 'i') return b == 'i';
  if(a == 'w') return b == 'w';
  assert(false);
}

int main() {
  
  string str, rev;
  cin >> str;
  rev = str; reverse(rev.begin(), rev.end());
  int const N = str.size();
  int half;
  if(N % 2 == 0) half = N/2;
  else half = N/2+1;
  
  int cnt = 0;
  for(int i=0; i<half; i++) {
    cnt += !judge(str[i], rev[i]);
  }
  
  cout << cnt << endl;
  
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>

using namespace std;

int main(){
    int N, d[100], S;
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> d[i];
    }
    for (int i = 0; i < N-1; i++){
        for (int j = i+1; j < N; j++){
            S += d[i] * d[j];
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string.h>


using namespace std;

int main(){
  char A='A';
  int N;
  cin>>N;
  char S[N+10];
  cin>>S;
  int count;
  int maxcount=0;
  for(int i=0;i<N;i++){
    count=0;
    for(char c='a';c<='z';c++){
      bool aru1=false;
      bool aru2=false;
      for(int j=0;j<i;j++) if(c==S[j]) aru1=true;
      for(int j=i;j<N;j++) if(c==S[j]) aru2=true;
      if(aru1&&aru2) count++;
    }
    maxcount=max(maxcount,count);



  }

  cout<<maxcount;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define re register
#define debug printf("Now is Line : %d\n",__LINE__)
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
//#define int long long
#define D double
#define inf 123456789
#define mod 1000000007
il int read() {
    re int x = 0, f = 1; re char c = getchar();
    while(c < '0' || c > '9') { if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
    return x * f;
}
#define rep(i , a , b) for(int i = (a) , i##Limit = (b) ; i <= i##Limit ; ++ i)
#define drep(i , b , a) for(int i = (a) , i##Limit = (b) ; i >= i##Limit ; -- i)
#define Next(i, u) for(re int i = head[u]; i; i = e[i].next)
#define mem(k, p) memset(k, p, sizeof(k))
#define lb(x) (x)&(-(x))
#define ls k * 2
#define rs k * 2 + 1
#define maxn 200005
il int Mul(int a, int b) { return 1ll * a * b % mod; }
il int Inc(int a, int b) { return (a += b) >= mod ? a - mod : a; }
il int Dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
il int qpow(int a, int b) { int r = 1; while(b) { if(b & 1) r = Mul(r, a); a = Mul(a, a), b >>= 1; } return r; }
int n, m;
D p[maxn], ans, sum[maxn];
int main() {
	n = read(), m = read();
	rep(i, 1, n) p[i] = (1 + read()) / 2.0, sum[i ] = sum[i - 1] + p[i];
	rep(i, m, n) ans = max(ans, sum[i] - sum[i - m]);
	printf("%.10lf", ans);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc150_a() {
	ll K, X;
	string ans;
	cin >> K >> X;

	if (500 * K >= X) {
		ans = "Yes";
	}
	else {
		ans = "No";
	}

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

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

	solve_abc150_a();

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    ll n;
    cin>>n;
    ll a[n+5];
    map< ll, ll > m;
    ll i;
    FOR0(i, n)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    map<ll, ll>::iterator it = m.begin();
    ll ans = 0;
    while(it != m.end())
    {
        ans += (it->ss)*(it->ss-1)/2;
        it++;
    }
    FOR0(i, n)
    {
        ll cur = m[a[i]];
        ans -= cur*(cur-1)/2;
        ans += (cur-1)*(cur-2)/2;
        cout<<ans<<endl;
        ans -= (cur-1)*(cur-2)/2;
        ans += cur*(cur-1)/2;
    }
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 11136
#include<iostream>
#include<strings.h>
using namespace std;
int main(){
  	int n;
  	string s, t, r;
  	cin>>n>>s>>t;
  	r = "";
  	for(int i=0; i<n; i++){
       r = r + s[i]+t[i];
    }
  	cout<<r<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
	int n;
	int a[100];
	cin >> n;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	int av = sum / n;
	int av2 = av + 1;
	int ans1 = 0,ans2 = 0;
	for (int i = 0; i < n; i++) {
		ans1 += (av - a[i]) * (av - a[i]);
		ans2 += (av2 - a[i]) * (av2 - a[i]);
	}
	cout << min(ans1,ans2) << endl;
}

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

using namespace std ;

const int MAX = 2e5 + 10 ;

int arr[MAX] ;
int n ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	vector< pair<int , int> >vp ;
	for(int i = 0 ; i < n ; ++i)
	{
		int a , b ;
		cin>>a>>b ;
		vp.emplace_back(b , a) ;
	}
	sort(vp.begin() , vp.end()) ;
	int cnt = 0 ;
	for(auto &i : vp)
	{
		int a = i.second , b = i.first ;
		if(cnt > b)
			return cout<<"No\n" , 0 ;
		cnt += a ;
		if(cnt > b)
			return cout<<"No\n" , 0 ;
	}
	return cout<<"Yes\n" , 0 ;
}		

Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define MAX (ll)(5e5 + 7)
#define INF (ll)(1e18 + 7)
#define MOD (ll)(1e9 + 7)

using namespace std;
using ll = long long;
using cd = complex<double>;

void f_io () {
	ios_base :: sync_with_stdio (false);
	cin.tie (nullptr);
}

int main () {
	string st;
	cin >> st;
	cout << st;
	if (st.back () == 's') {
		cout << "es\n";
	}
	else {
		cout << "s\n";
	}
}


Measured memory_bytes: 3628
# coding: utf-8
# Your code here!
MOD=10**9+7

def matmul(A, B, mod): # A,B: 行列
    res = [[0] * len(B[0]) for _ in range(len(A))]
    for i, resi in enumerate(res):
        for k, aik in enumerate(A[i]):
            for j,bkj in enumerate(B[k]):
                resi[j] += aik*bkj
                resi[j] %= mod
    return res

def matpow(A, p, M): #A^p mod M
    if p % 2 == 1:
        return matmul(A, matpow(A, p - 1, M), M)
    elif p > 0:
        b = matpow(A, p // 2, M)
        return matmul(b, b, M)
    else:
        return [[1 if i == j else 0 for j in range(len(A))] for i in range(len(A))]


n,k = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(n)]

ans = matpow(A,k,MOD)
print(sum(sum(r) % MOD for r in ans) % MOD)

Measured memory_bytes: 43484
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b, c; readV(a, b, c);

  auto v = new bool[](b);
  foreach (i; 1..b+1) {
    auto m = a*i%b;
    if (m == c) {
      writeln("YES");
      return;
    } else if (v[m]) {
      writeln("NO");
      return;
    }
    v[m] = true;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int M,D,S=0;
  scanf("%d %d",&M,&D);
  for(int i=1;i<=M;i++){
    for(int j=22;j<=D;j++){
      int d1=j%10;
      int d2=(j/10)%10;
      if(d1>=2 && d2>=2 && i==d1*d2){
        S++;
      }
    }
  }
  printf("%d\n",S);
  return 0;
}

Measured memory_bytes: 1704
from fractions import Fraction
N = int(input())
A = list(map(int, input().split()))

avg = Fraction(sum(A), N)

min_val = float('inf')
for a in A:
    val = abs(a - avg)
    min_val = min(min_val, val)

for i, a in enumerate(A):
    val = abs(a - avg)
    if val == min_val:
        print(i)
        exit(0)

Measured memory_bytes: 64056
main = interact $ unlines . map fst . filter (\(_,(w,h)) -> w / h^2 >= 25.0) . map read' . lines
 where read' xs = (\[s,w,h] -> (s, (read w, read h))) (splitOn ',' xs)

splitOn c xs
 | null xs = []
 | head xs == c = splitOn c (tail xs)
 | otherwise = (takeWhile (/= c)) xs : splitOn c (dropWhile (/= c) xs)

Measured memory_bytes: 3988