akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <string>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int p;

int mpow(int x,int n){
    ll ans = 1;
    while(n != 0){
        if(n & 1) ans = ans*x % p;
        x = x*x % p;
        n = n >> 1;
    }
    return ans;
}

int main(void){
    int n;
    string s;
    int dp;
    ll ans = 0;
    map<ll, ll> count;
    
    cin >> s;
    p = 2019;
    n = s.length();
    vector<int> m(n + 1, 0), sum(n + 1, 0);
    
        rep(i,n){
            int num = s[i] - '0';
            m[i] = (num % p) * mpow(10, n - i - 1);
            m[i] %= p;
        }

        count[0]++;
        for (int i = n; i > 0; i--){
            sum[i - 1] = sum[i] + m[i - 1];
            sum[i - 1] %= p;
            count[sum[i - 1]]++;
        }


        for (auto x : count){
            ans += x.second * (x.second - 1) / 2;
        }

    cout << ans << endl;
}

Measured memory_bytes: 5240
N=int(input())
m=list(map(int,input().split()))
t=[]
for i in range(N):
  t.append(0)
for i in range(N):
  t[m[i]-1]+=1
total=0
for i in range(N):
  total+=(t[i]*(t[i]-1))//2
for i in range(N):
  if t[m[i]-1]<2:
    print(total)
  else:
    print(total-(t[m[i]-1]-1))

Measured memory_bytes: 24748
#include <stdio.h>

int L; char A[12];

void go(int l, char e)
{
	if (l == L){
		puts(A);
		return;
	}

	for (char s = 'a'; s <= e; s++){
		A[l] = s;
		go(l + 1, e + (s == e));
	}
}

int main()
{
	scanf ("%d", &L);
	go(0,'a');

	return 0;
}

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

int main() {
    map<string, int> mp;
    int N; cin >> N;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }

    int M; cin >> M;
    for (int i = 0; i < M; i++) {
        string t;
        cin >> t;
        mp[t]--;
    }

    int ans = 0;
    for (auto& p : mp) {
        ans = max(ans, p.second);
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

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

int main()
{
    ll n, k, q;
    cin >> n >> k >> q;
    k = k - q;
    vector<ll> a(n);
    ll seikai;
    for (int i = 0; i < n; i++)
    {
        a[i] = k;
    }
    for (int i = 0; i < q; i++)
    {
        cin >> seikai;
        a[seikai - 1]++;
    }
    for (int i = 0; i < n; i++)
    {
        if (a[i] > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<endl
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define endl "\n"
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
bool compare(pair<ll,string> p1,pair<ll,string> p2){
return p2.fi>p1.fi;
}
void solve(){
 ll x,p=100,cnt=0;
 cin>>x;
 while(p<x){
    p+=p/100;
    cnt++;
 }
 cout<<cnt<<endl;

}
int main()
{   fast;
    ll t=1;
    //cin>>t;
    fr(zz,1,t+1){
    solve();
    }
}


Measured memory_bytes: 3648
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int[] area = new int[10 * 10];

		String str;

		try {
			while ((str = br.readLine()) != null) {
				String strArray[] = str.split(",");
				int x = Integer.parseInt(strArray[0]);
				int y = Integer.parseInt(strArray[1]);
				int size = Integer.parseInt(strArray[2]);

				int point = y * 10 + x;

				switch (size) {
				case 3:
					if (x < 8)
						area[point + 2]++;
					if (x > 1)
						area[point - 2]++;
					if (y < 8)
						area[point + 20]++;
					if (y > 1)
						area[point - 20]++;
				case 2:
					// 左上
					if (x > 0 && y > 0)
						area[point - 11]++;
					// 右上
					if (x < 9 && y > 0)
						area[point - 9]++;
					// 左下
					if (y < 9 && x > 0)
						area[point + 9]++;
					// 右下
					if (y < 9 && x < 9)
						area[point + 11]++;
				case 1:
					if (x < 9)
						area[point + 1]++;
					if (x > 0)
						area[point - 1]++;
					if (y < 9)
						area[point + 10]++;
					if (y > 0)
						area[point - 10]++;
					area[point]++;
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

		Arrays.sort(area);
		int blank = 0;
		for (int i = 0; i < 100; i++) {
			if (area[i] != 0) {
				blank = i;
				break;
			}
		}

		// System.out.println(Arrays.binarySearch(area, 1));
		System.out.println(blank);
		System.out.println(area[99]);
	}
}

Measured memory_bytes: 16916
#include <iostream>

using namespace std;

int main()
{
    string s,t;
    cin >> s >> t;
    int m,n;
    cin >> m >> n;
    string s1;
    cin >> s1;
    if(s1 == s)
        cout << m-1 << " " << n << endl;
    else cout << m << " " << n-1 << endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
def solve(n, t, a, b):
    dp = np.zeros(t, dtype=int)
    candidates = []
    for w, v in sorted(zip(a, b)):
        candidates.append(dp[-1] + v)
        if w > t:
            continue
        dp[w:] = np.maximum(dp[:-w] + v, dp[w:])
    return np.max(candidates)

n, t = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
print(solve(n, t, a, b))

Measured memory_bytes: 12596
n, m = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
c = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split(' '))
    c[a - 1].append(b - 1)
    c[b - 1].append(a - 1)
r = 0
for i in range(n):
    mh = 0
    for j in c[i]:
        mh = max(mh, h[j])
    r += 1 if h[i] > mh  else 0
print(r)

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T>
T vec_max(V<T> v){return *max_element(ALL(v));}

int main(){
    int K,N;
    cin>>K>>N;
    Vi A(N);
    REP(i,N) cin>>A[i];

    Vi A_diff(N);
    REP(i,N){
        if((i+1)%N != 0){
            A_diff[i] = A[(i+1)] - A[i];
        }else{
            A_diff[i] = A[0] - A[i] + K;
        }
    }

    cout<<K - vec_max(A_diff)<<endl;

    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (int i = 0; i < n; ++i) {
        cin >> l[i];
    }
    int ans = 0;
    for (int i = 0; i < n - 2; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            for (int k = j + 1; k < n; ++k) {
                if (l[i] == l[j] or l[j] == l[k] or l[k] == l[i]) {
                    continue;
                }
                if (abs(l[i] - l[j]) < l[k] and l[k] < l[i] + l[j]) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


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

using namespace std;

const int N=105;
int n,m,dp[N][N];
char c[N][N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>c[i][j];
            if(i==1&&j==1) dp[i][j]=(c[i][j]=='#');
            else
            {
                dp[i][j]=m*n;
                if(i>1) dp[i][j]=min(dp[i][j],dp[i-1][j]+(c[i][j]=='#'&&c[i-1][j]=='.'));
                if(j>1) dp[i][j]=min(dp[i][j],dp[i][j-1]+(c[i][j]=='#'&&c[i][j-1]=='.'));
            }
        }
    }
    cout<<dp[n][m];
}


Measured memory_bytes: 256
#!/usr/bin/ruby
# -*- coding: utf-8 -*-

fh=STDIN
while fh.gets do
  a,b = $_.split.map{|x| x.to_i}
  gcd_ = a.gcd(b)
  lcm_ =  a * b / gcd_
  printf("%d %d\n", gcd_, lcm_)
end

Measured memory_bytes: 8596
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <memory>
#include  <cerrno>
#include  <time.h>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<int,int>
using namespace std;
int a[5];
int minn=1e9;
int main()
{
    for(int i=0;i<3;i++)
    cin>>a[i];
    for(int i=0;i<3;i++)
    {
        int ans=0;
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<3;k++)
            {
                if(i!=j && j!=k && i!=k)
                {
                    minn=min(minn,abs(a[j]-a[i])+abs(a[k]-a[j]));
                }
            }
        }
    }
    cout<<minn<<endl;
    return 0;
}


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

int main(){
    int i, n = 1, w = 1, e = 1, s = 1;
    string str;
    cin >> str;
    for(i=0; i<str.length(); i++){
        if(str[i] == 'N'){
            n = 0;
        }else if(str[i] == 'W'){
            w = 0;
        }else if(str[i] == 'S'){
            s = 0;
        }else{
            e = 0;
        }
    }
    if(n^s || w^e){
        cout << "No";
    }else{
        cout << "Yes";
    }
    return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b = LI()
    ans = ['Odd', 'Even']
    print(ans[(a*b)%2-1])
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()


Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int main() {
    int N;
    cin >> N;
    map<P, bool> ma;
    vector<int> x(N), y(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i];
        ma[P(x[i], y[i])] = true;
    }
    vector<P> gap;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            gap.emplace_back(P(x[j] - x[i], y[j] - y[i]));
        }
    }
    int ans = 100;
    if (N == 1) ans = 1;
    for (int i = 0; i < gap.size(); i++) {
        int cnt = 0;
        for (int j = 0; j < N; j++) {
            if (ma[P(x[j] + gap[i].first, y[j] + gap[i].second)]) {
                cnt++;
            }
        }
        ans = min(ans, N - cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,s=0;
  cin>>n;
  vector<int>v(2*n);
  for(int i=0;i<2*n;i++)
  {
     cin>>v[i];

  }
  sort(v.begin(),v.end());
for(int i=0;i<2*n;i+=2)
 {
    
  s+=v[i];
}
cout<<s<<endl;

}

Measured memory_bytes: 3608
N=gets.to_i
s,t=2.times.map{gets.chomp}

res=""
(N+s.size+t.size).times do |i|
  ss=""
  ss=s[i..-1] if i < s.size
  tt=t
  if ss.size < t.size
    tt=t[0...ss.size]
  else
    ss=s[0...t.size]
  end
  next unless ss == tt
  next if i + t.size < N
  p i+t.size
#   res="z"*(i+t.size)
#   res[-t.size..-1]=t
#   res[0...s.size]=s
#   puts res
  break
end


Measured memory_bytes: 1788
import sys
input = sys.stdin.buffer.readline

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

# dp[i][j] 区間a[i,j)だけ残った時点で互いの点数を一旦0とし、ゲームを最後まで続けた場合のX-Yの値
dp = [[0]*(N+1) for _ in range(N+1)]

# こちらもメモ化再帰ではpypy3でも間に合わない
# j==i+1, i+2, ...とループしてdpテーブルの上三角部分を対角線と平行に埋めていく。jをshift_iと書き換えてループ
for shift_i in range(1, N+1):
    for i in range(N+1):
        if i+shift_i >= N+1:
            continue
        elif ((i+shift_i)-i)%2 == N%2: # 先手番
            dp[i][(i+shift_i)] = max(a[i] + dp[i+1][(i+shift_i)], a[(i+shift_i)-1] + dp[i][(i+shift_i)-1])
        else:
            dp[i][(i+shift_i)] = min(-a[i] + dp[i+1][(i+shift_i)], -a[(i+shift_i)-1] + dp[i][(i+shift_i)-1])

print(dp[0][N])

Measured memory_bytes: 113500
#include <iostream>

using namespace std;

int main()
{
	char input;
	cin >> input;
	
	if(input == 'a' || input == 'e' || input == 'i' || input == 'o' || input == 'u')
	{
		cout << "vowel" << endl;
	}
	else
	{
		cout << "consonant" << endl;
	}
}


Measured memory_bytes: 256
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

signed main()
{
  ll X;
  cin >> X;

  ll u500 = X / 500;
  ll u5 = (X % 500) / 5;

  cout << u500 * 1000 + u5 * 5 << endl;
}


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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n,m,p;
  while(cin>>n>>m>>p,n||m||p) {
    long long s = 0;
    int x[n];
    REP(i,n) {
      cin >> x[i];
      s+=x[i];
    }
    s *= 100;
    s = s *(100-p) / 100;
    if (x[m-1] == 0)
      cout << 0 << endl;
    else
      cout << s / x[m-1] << endl;
  }
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  ll k, x;
  cin >> k >> x;
  REP(i, k-1)
    cout << x-k+i+1 << endl;
  cout << x << endl;
  REP(i, k-1)
    cout << x+i+1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>

using namespace std;

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

    int n, t;
    cin >> n >> t;

    int output =  INT_MAX;
    for(int i=0; i<n; i++){
        int cost, time;
        cin >> cost >> time;
        if(time <= t)
        {
            if(cost < output){
                output = cost;
             }
        }
    }
    if(output == INT_MAX){
        cout << "TLE\n";
    }else{
        cout << output;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m;
vector<int>v[100];
vector<int>st(100,-1),et(100,-1);
int tim;
bool cycle;
void dfs(int u,int p){
	st[u]=tim++;
	for(auto i:v[u]){
		if(p==i)continue;
		if(st[i]==-1){
			dfs(i,u);
			if(cycle)return;
		}
		else if(et[i]==-1){
			cycle=1;
			return;
		}
	}
	et[u]=tim;
}
int main(){
	cin>>n>>m;
	while(m--){
		int l,r;
		cin>>l>>r;
		v[l].emplace_back(r);
	}
	for(int i=0;i<n;i++){
		if(st[i]==-1)dfs(i,-1);
	}
	cout<<cycle<<"\n";
}


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

long long pls(long long x) {
  if (x<0) return 0;
  else return x;
}

int main() {
  
  long long a, b, k;
  cin >> a;
  cin >> b;
  cin >> k;
  
  cout << pls(a-k) << " " << pls(b-pls(k-a)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define f(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define mod 1000000007
#define P pair<int,int>
using namespace std;
int x[200000],y[200000];
signed main(){
	int n;
	cin>>n;
	f(i,n){
		cin>>x[i];
		y[i]=x[i];
	}
	sort(y,y+n);
	f(i,n){
		if(lower_bound(y,y+n,x[i])-y<n/2) cout<<y[n/2]<<endl;
		else cout<<y[n/2-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 5376
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) {
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        int x, y;
        try{
        while (true)
        {
        	String[] list = br.readLine().split(" ");
        	x = Integer.parseInt(list[0]);
        	y = Integer.parseInt(list[1]);
        	if (x == 0 && y == 0)
        	{
        		break;
        	}
        	if (x <= y)
        	{
        		System.out.println(x + " " + y);
        	}
        	else if ( x > y)
        	{
        		System.out.println(y + " " + x);
        	}
        }
        }
        catch(IOException e){
        	e.printStackTrace();
        }
	}

}

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

int main(){
  int n, x;
  cin >> n >> x;
  int m[n];
  int min = 10000;
  for(int i=0; i<n; i++){
    cin >> m[i];
    if(min > m[i])  min = m[i];
    x = x-m[i];
  }
  cout << x/min + n << endl;
}

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

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
#define MOD 1000000007

using namespace std;

using ll = long long;
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

typedef stack<ll> llStack;
typedef queue<ll> llQueue;
typedef vector<ll> llVector;
typedef list<ll> llList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll N;
  cin >> N;
  ll A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  
  map<ll, ll> mp1, mp2;
  for(int i=0;i<N;i++){
    mp1[i+A[i]]++;
    mp2[i-A[i]]++;
  }
  ll ans = 0;
  for(int i=1;i<200000;i++){
    ans += mp1[i]*mp2[i];
  }
  
  cout << ans << endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>P(N);
  for(int i=0;i<N;i++)cin>>P[i];
  int ans=1;
  int Min=P[0];
  for(int i=1;i<N;i++){
    if(P[i]<=Min)ans++;
    Min=min(Min,P[i]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
n = gets.to_i
array = gets.split().map(&:to_i)

array_abs = array.map {|a| a.abs}

case array.select {|a| a < 0}.size % 2
when 0
	p array_abs.inject(0) {|sum, a| sum + a}
when 1
	min = array_abs.min
	array_abs.delete(min)
	p array_abs.inject(0) {|sum, a| sum + a} - min
end

Measured memory_bytes: 10116
def func():
    N = int(input())
    H = [int(i) for i in input().split()]
    
    dp = [0]*N
    for i in range(1, N):
        L = []
        for j in range(max(0, i-2), i):
            L.append(dp[j] + abs(H[i] - H[j]))
        dp[i] = min(L)

    print(dp[-1])
    
if __name__=="__main__":
    func()

Measured memory_bytes: 52208
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

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

	string s;
	cin >> s;
	rep(i, 0, s.size()) {
		if(i - 1 >= 0) {
			if(s[i] == s[i - 1]) {
				cout << i << " " << i + 1<< endl;
				return 0;
			}
		}
		if(i + 2 < s.size()) {
			if(s[i] == s[i + 2]) {
				cout << i + 1 << " " << i + 3 << endl;
				return 0;
			}
		}
	}

	cout << "-1 -1" << endl;

}


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

using namespace std;

typedef long long int lli;

int main () {
    lli n, base;
    cin >> n >> base;
    lli count = 0;
    while(n) {
        count += 1;
        n = n/base;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans;
string s;
int d[1000];
int uu[1000];
int main(){
    cin>>n;
    cin>>s;
    for(int i=0;i<n;i++){
        for(int u=0;u<999;u++)d[u]=0;
        for(int u=0;u<999;u++)uu[u]=0;
        int kari=0;
        for(int u=0;u<i;u++){
            d[s[u]]=1;
        }
        for(int u=i;u<n;u++){
            uu[s[u]]=1;
        }
        for(int u=0;u<150;u++){
            if(d[u]==1&&uu[u]==1)kari++;
        }
        ans=max(ans,kari);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args)throws Exception {


        Scanner sc = new Scanner(System.in);

        String[] arr = sc.nextLine().split(" ");
        sc.close();
        double x1 = Double.parseDouble(arr[0]);
        double x2 = Double.parseDouble(arr[1]);
        double y1 = Double.parseDouble(arr[2]);
        double y2 = Double.parseDouble(arr[3]);

        double x = Math.pow((y1-x1), 2);
        double y = Math.pow((y2-x2), 2);

        double n = Math.sqrt(x+y);

        System.out.println(n);
    }

}

Measured memory_bytes: 26344
#include <stdio.h>
int main(void)
{
	char b;
	scanf("%c", &b);

	if (b == 'A') 
	{
		printf("T");
	}
	else if (b == 'C') 
	{
		printf("G");
	}
	else if (b == 'G')
	{
		printf("C");
	}
	else 
	{
		printf("A");
	}
    return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] step = sc.next().toCharArray();
        boolean b = true;
        for(int i=0; i<step.length; i++){
            if((i%2==0 && step[i]=='L')||(i%2==1 && step[i]=='R')){
                b = false;
                break;
            }
        }
        System.out.println(b ? "Yes" : "No");
    }
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W;
    cin >> H >> W;
    vector<string>A(H);
    for(int i=0; i<H; i++) cin >> A[i];

    string ans = "Possible";
    for(int i=0; i<H; i++)
    {
        for(int j=0; j<W; j++)
        {
            int downright = 0;
            int upleft = 0;
            if(A[i][j] != '#') continue;
            if(i+1!=H && A[i+1][j] == '#') downright++;
            if(j+1!=W && A[i][j+1] == '#') downright++;
            if(i-1!=-1 && A[i-1][j] == '#') upleft++;
            if(j-1!=-1 && A[i][j-1] == '#') upleft++;
            if(!(i==H-1 && j==W-1) && (downright == 0 || downright == 2)) ans = "Impossible";
            if(!(i==0 && j==0) && (upleft == 0 || upleft == 2)) ans = "Impossible";
        }
    }
    cout << ans << endl;

    return 0;
}


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

const ll MOD = 1000000007;

int main(){
	ll n;
	cin >> n;
	ll ans = 1;
	REP(i,n){
		ans *= i;
		ans %= MOD;
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
if (N % 7 == 0) or (N % 7 == 4):
  print('Yes')
  exit()
a = int(N / 7)
for i in range(a+1):
  N_ = N - 7 * i
  if N_ % 4 == 0:
    print('Yes')
    exit()
print('No')

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

int main(){
  int N,x;
  long long int count=0;
  cin >> N >> x;
  int a[N];
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=0;i<N-1;i++){
    if(a[i]>x){
      count+=a[i]-x;
      a[i]=x;
      count+=a[i+1];
      a[i+1]=0;
    }else if((a[i]+a[i+1])>x){
      count+=(a[i]+a[i+1]-x);
      a[i+1]-=(a[i]+a[i+1]-x);
    }
  }
  cout << count << endl;
  return 0;
}


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

int main() {
  vector<char>vec(4) ;
  for(int i=0 ;i<4 ; i++){
    cin >> vec.at(i);
  }
  int a=0,b=0;
  if(vec.at(0)=='0'&&vec.at(1)!='0')
    a++;
  if(vec.at(0)=='1'&&vec.at(1)=='0')
    a++;
    if(vec.at(0)=='1'&&vec.at(1)=='1')
    a++;
   if(vec.at(0)=='1'&&vec.at(1)=='2')
    a++;
  
  if(vec.at(2)=='0'&&vec.at(3)!='0')
    b++;
  if(vec.at(2)=='1'&&vec.at(3)=='0')
    b++;
   if(vec.at(2)=='1'&&vec.at(3)=='1')
    b++;
   if(vec.at(2)=='1'&&vec.at(3)=='2')
    b++;  
    
if(a==1&&b==1)
  cout<<"AMBIGUOUS"<<endl ;
  if(a==0&&b==1)
  cout<<"YYMM"<<endl ;
  if(a==1&&b==0)
  cout<<"MMYY"<<endl ;
  if(a==0&&b==0)
  cout<<"NA"<<endl ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<bits/stdc++.h>
using namespace std;
int max(int x, int y){
    if(x>y) return x;
    else return y;
}
int main(){
    int n;
    cin>>n;
    vector<int> l(n);
    for(int i=0;i<n;i++) cin>>l.at(i);
    int m=0;
    for(int j=0;j<n;j++){
        m=max(m,l.at(j));
    }
    int sum=0;
    for(int k=0;k<n;k++){
        sum+=l.at(k);
    }
    if(2*m-sum<0) cout<<"Yes";
    else cout<<"No";
    
}

Measured memory_bytes: 256
function main(input: string) {
  const inputNumbers: number[] = input.split('\n').map(n => parseInt(n, 10))

  const A: number = inputNumbers[0]
  const B: number = inputNumbers[1]
  const C: number = inputNumbers[2]
  const X: number = inputNumbers[3]

  let count: number = 0

  for (let i = 0; i <= A; i ++) {
    for (let j = 0; j <= B; j++) {
      for (let k = 0; k<= C; k ++) {
        let result: number = 500 * i + 100 * j + 50 * k
        if (result === X) count ++ 
      }
    }
  }

  console.log(count)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))

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

int main(){
  int N,K;
  cin>>N>>K;
  vector<int> h(N);
  for(int i=0;i<N;i++){
    cin>>h.at(i);
  }
  int s=0;
  for(int i=0;i<N;i++){
    if(h.at(i)>=K){
      s++;
    }
  }
  cout<<s<<endl;
}

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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    int a[m];
    int b[m];
    for(int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
    }

    int count=0;
    for(int skip = 0; skip < m; skip++) {
//        cout << "skip : " << skip << "\n";
        vector<vector<int>> g(n);
        for(int i = 0; i < m; i++) {
            if(i!=skip){
                int ta=a[i]-1;
                int tb=b[i]-1;
                g[ta].emplace_back(tb);
                g[tb].emplace_back(ta);
            }
        }

        vector<int> dist(n, -1);
        queue<int> que;

        dist[0] = 0;
        que.push(0);

        while (!que.empty()) {
            int v = que.front();
            que.pop();

            for (int nv : g[v]) {
                if (dist[nv] != -1) continue;
                dist[nv] = dist[v] + 1;
                que.push(nv);
            }
        }

        bool jud=true;
        for(int i = 0; i < n; i++) {
            if(dist[i]==-1) jud=false;
        }
        if(jud==false) count++;
    }
    cout << count << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int n=s.length();
    int m=t.length();
    int dp[n+1][m+1];
    memset(dp, 0, sizeof dp);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
            if(s[i]==t[j])
                dp[i+1][j+1]=dp[i][j]+1;
            else
                dp[i+1][j+1]=max(dp[i+1][j], dp[i][j+1]);
    }
    int len=dp[n][m];
    string ans="";
    for(int i=n-1,j=m-1;i>=0 and j>=0 and len>=0;)
    {
        if(s[i]==t[j]){ans+=s[i];i--,j--;}
        else if(dp[i+1][j]>dp[i][j+1])j--;
        else i--;
    }
  	reverse(ans.begin(),ans.end());
    cout<<ans;




}

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

using namespace std;

#define int long long

const int maxn=300005;

vector<int>cnt(maxn);

int32_t main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        ++cnt[a[i]];
    }
    int t=0;
    for(int i=1;i<=n;i++){
        if(cnt[i]){
            t+=(cnt[i]*(cnt[i]-1))/2;
        }
    }
    vector<int>ans;
    for(int k=1;k<=n;k++){
        int val=t-(cnt[a[k-1]]-1);
        ans.push_back(val);
    }
    for(int i=0;i<(int)ans.size();i++){
        cout<<ans[i]<<endl;
    }
}


Measured memory_bytes: 8176
def jd(m,a,b,c)
  return [true,m[a]] if m[a]==m[b] and m[b]==m[c] and m[a]!="s"
  return [false,0]
end
while gets
  m=$_.chomp.split("")
  l=jd(m,0,1,2)<<jd(m,3,4,5)<<jd(m,6,7,8)<<jd(m,0,3,6)<<jd(m,1,4,7)<<jd(m,2,5,8)<<jd(m,0,4,8)<<jd(m,2,4,6)
  q=l.flatten!.index(true)
  puts q.nil? ? "d" : l[q+1]
end

Measured memory_bytes: 8712
#include <bits/stdc++.h>
#define MAX 50
using namespace std;
typedef long long ll;
typedef pair<double, ll> P;
typedef tuple<ll, ll, ll> T;

ll N, A, B;

ll a[MAX + 1][MAX + 1] = {{0}};
ll nCr(ll n, ll r){
    for(int i = 0; i <= MAX; i++) for(int j = 0; j <= i; j++) a[i][j] = (j == 0) ? 1 : (a[i - 1][j] + a[i - 1][j - 1]);
	return a[n][r];
}

int main(void){
    
    scanf("%lld %lld %lld", &N, &A, &B);
    map<double, ll> mp;
    for(int i = 0; i < N; ++i){ double v; scanf("%lf", &v); ++mp[v]; }
    
    vector<P> v;
    for(auto m : mp) v.push_back(m);
    sort(v.begin(), v.end(), greater<P>());
    
    int cnt = 0, idx = 0;
    for(int i = 0; i < v.size(); ++i){
        cnt += v[i].second;
        if(A <= cnt){ idx = i; break; }
    }
    
    if(idx == 0){
        ll combi = 0;
        for(int i = A; i <= B; ++i) combi += nCr(v[idx].second, i);
        printf("%f\n%lld\n", v[idx].first, combi);
    }
    else{
        double average = 0;
        ll cnt = 0, combi = 0;
        for(int i = 0; i <= idx; ++i) for(int j = 0; j < v[i].second && cnt < A; ++j) average += v[i].first, ++cnt;
        cnt = 0;
        for(int i = 0; i <= idx - 1; ++i) cnt += v[i].second;
        combi = nCr(v[idx].second, A - cnt);
        printf("%f\n%lld\n", average / A, combi);
    }
    
    return 0;
}

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

int main() {
    int n, d, x, a, ans = 0;
    cin >> n >> d >> x;
    REP(i,n){
        cin >> a;
        ans += (d-1)/a + 1;
    }
    ans += x;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[200010],d,n,ans;
int dpl[200010],dpr[200010];
signed main(){
	cin>>n>>d;
	for(int i=1 ;i<=n;i++)cin>>a[i],ans+=a[i];
	ans+=(n-1)*d;
	dpr[1]=a[1];
	for(int i=2;i<=n;i++)dpr[i]=min(a[i],dpr[i-1]+d);
	dpl[n]=a[n];
	for(int i=n-1;i>=1;i--)dpl[i]=min(a[i],dpl[i+1]+d);
	for(int i=2;i<n;i++)ans+=min(dpl[i],dpr[i]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4992
#include<iostream>
using namespace std;
int main(void){
    int a, b;
    char o;
    while(cin >> a >> o >> b){
        if(o == '?'){
            break;
        }
        switch(o) {
            case '+':
                cout << a + b << endl;
                break;
            case '-':
                cout << a - b << endl;
                break;
            case '*':
                cout << a * b << endl;
                break;
            case '/':
                cout << a / b << endl;
                break;
        }
    }
    return 0;
}



Measured memory_bytes: 3092
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let s: Vec<char> = iterator.next().unwrap().chars().collect();

    let mut ans = 100;
    for c in 'a' as u8 .. 'z' as u8 + 1 {
        let c = c as char;
        if !s.contains(&c) {
            continue;
        }

        let mut t = s.clone();
        let mut count = 0;
        while !t.iter().all(|it| *it == c) {
            for i in 0 .. t.len() - 1 {
                if t[i] == c || t[i + 1] == c {
                    t[i] = c;
                }
            }
            t.pop();
            count += 1;
        }
        ans = min(ans, count);
    }

    return ans.to_string();
}


Measured memory_bytes: 4352
#include <iostream>
using namespace std;
int main() {
    string s;
    cin>>s;
    if(s=="SUN"){
        cout<<"7";
    }
    else if(s=="MON"){
        cout<<"6";
    }
    else if (s=="TUE"){
        cout<<"5";
    }
    else if (s=="WED"){
        cout<<"4";
    }
    else if (s=="THU"){
        cout<<"3";
    }
    else if (s=="FRI"){
        cout<<"2";
    }
    else if (s=="SAT"){
        cout<<"1";
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    if ((n+1)/2 < k) cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
import numpy as np
A = np.zeros((3,3))
A[0,0],A[0, 1], A[0,2]  = map(int, input().split())
A[1,0],A[1, 1], A[1,2]  = map(int, input().split())
A[2,0],A[2, 1], A[2,2]  = map(int, input().split())

N = int(input())
b = np.ndarray(N)
for i in range(N):
  b[i] = int(input())

B = np.zeros((3,3))

for i in range(N):
  B[A==b[i]] = 1

B1 = np.sum(B, axis=0)
B2 = np.sum(B, axis=1)
B3 = B[0,0] + B[1,1] + B[2,2]
B4 = B[2,0] + B[1,1] + B[0,2]

if(sum(B1 == 3) + sum(B2 == 3) >=1):
  print('Yes')
elif(B3 == 3 or B4 == 3):
  print('Yes')
else:
  print('No')


Measured memory_bytes: 12012
#include <iostream>
#include <math.h>
#include <vector>
#include <set>
#include <algorithm>
#include <iomanip>


using namespace std;

int main(){
    string S;
    long long K;
    cin>>S;
    cin>>K;
    char ans='1';
    if(K>100)K=100;
    for(long long i=0;i<K;i++){
        if(S[i]!='1'){
            ans=S[i];
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Comparator;
import java.util.Collections;
import java.util.ArrayList;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int M, T, P, R;
			M = sc.nextInt();
			T = sc.nextInt();
			P = sc.nextInt();
			R = sc.nextInt();
			if (M == 0) {
				break;
			}
			
			ArrayList<Team> teams = new ArrayList<Team>();
			for (int i = 0; i < T; i++) {
				teams.add(new Team(i + 1, P));
			}
			//System.out.println(teams.size());
			for (int i = 0; i < R; i++) {
				int m, t, p, j;
				m = sc.nextInt();
				t = sc.nextInt();
				p = sc.nextInt();
				j = sc.nextInt();
				Team tmp = teams.get(t - 1);
				if (j == 0) {
					// 正解
					tmp.solved++;
					tmp.time += m + 20 * tmp.wa[p];
				} else {
					// 不正解
					tmp.wa[p]++;
				}
			}
			
			Collections.sort(teams, new TeamComp());
			for (int i = 0; i < T; i++) {
				Team tmp1 = teams.get(i);
				if (i > 0) {
					Team tmp2 = teams.get(i - 1);
					if (tmp1.equals(tmp2)) {
						System.out.print("=");
					} else {
						System.out.print(",");
					}
				}
				System.out.print(tmp1.num);
			}
			System.out.println();
		}
	}
}

class Team {
	int num; // チーム番号
	int solved; // 正解数
	int time; // ペナルティタイム
	int[] wa; // 各問題の不正解回数
	
	public Team(int n, int p) {
		this.num = n;
		wa = new int[p+1];
	}
	
	public boolean equals(Team t) {
		return this.solved == t.solved && this.time == t.time;
	}
}

class TeamComp implements Comparator<Team> {
	public int compare(Team a, Team b) {
		if (a.solved != b.solved) {
			return -(a.solved - b.solved);
		} else if (a.time != b.time) {
			return a.time - b.time;
		} else {
			return -(a.num - b.num);
		}
	}
}

Measured memory_bytes: 60748
class Solution:

    def solve(self, N: int) -> int:

        c = []
        for i in range(10):
            c.append([])
            for j in range(10):
                c[i].append(0)

        base = 1
        for n in range(1, N+1):
            if n % (10 * base) == 0:
                base *= 10

            first = n // base
            last = n % 10

            c[first][last] += 1

        answer = 0
        for i in range(1, 10):
            for j in range(1, 10):
                answer += c[i][j]*c[j][i]

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())

    # solve
    solution = Solution()
    print(solution.solve(N))

Measured memory_bytes: 3064
function Main(input){
    var input = parseInt(input, 10);
    const num = [1, 2, 4, 8, 16, 32, 64];

    for(var i = num.length - 1; -1 < i; i--){
        if(num[i] <= input){
            console.log(num[i]);
            break;
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 15432
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
int Max = 10 + 1e8;
int main()
{
	int n;
	cin >> n;
	vector<int> p(n);
	int Min = Max;
	int cnt = 0;
	rep(i, n) {
		int p;
		cin >> p;
		if (Min >= p) {
			cnt++;
			Min = p;
		}
	}
	cout << cnt;
}

Measured memory_bytes: 4020
import java.util.*
import kotlin.math.min

fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toLong() }
    val aaR = aa.reversed()

    val nodeSizes = Stack<NodeSize>()
    nodeSizes.push(NodeSize(n, aaR[0], aaR[0]))

    for (i in 1..n) {
        val size = nodeSizes.peek()
        val minSize = size.min/2 + size.min % 2 + aaR[i]
        val maxSize = size.max + aaR[i]
        nodeSizes.push(NodeSize(n-i, minSize, maxSize))
    }

    if (nodeSizes.peek().min != 1L) {
        println(-1)
        return
    }

    var sum = 1L
    var pMax = 1L
    nodeSizes.pop()

    while (nodeSizes.isNotEmpty()) {
        val size = nodeSizes.pop()
        val max = min(size.max, pMax * 2)
        pMax = max - aa[size.depth]
        sum += max
    }

    println(sum)
}

data class NodeSize(val depth: Int, val min: Long, val max: Long)

Measured memory_bytes: 59448
#include<bits/stdc++.h>
#define ll long long
#define rep(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
int main()
{
  long n,d,a[300000],c,ans,b[300000];
  ans=0;
  cin >> n;
  rep(i,n){cin >> a[i];
          }
  b[0]=0;
  FOR(i,1,n+1){b[i]=b[i-1]+a[i-1];
          }
  sort(b,b+n+1);
  d=0;
  rep(i,n+1){if(b[i]==b[i+1])d++;
             else{ans+=(d+1)*d/2;
                d=0;
               }
          }
  if(b[n+1]==0)ans+=(d-1)*d/2;
  printf("%ld",ans);
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  int a,b,c,x;
  cin>>a>>b>>c>>x;
  int cnt(0);
  for (int i(0);i<=a;i++){
    for (int j(0);j<=b;j++){
      for (int k(0);k<=c;k++){
        if (500*i+100*j+50*k==x)cnt+=1;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


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

using namespace std;

long long n, k, mx1=-1000000, cnt1, mx2=-1000000, cnt2, q, a[100005], b[100005];

int main () {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 0; i < n - 1; i++) {
		if(a[i] >= a[i+1]) {
			cnt1++;
		}
		else {
			if(cnt1 > mx1) {
				mx1 = cnt1;
			}
			cnt1 = 0;
		}
	}
	if(cnt1 > mx1) {
		mx1 = cnt1;
	}
	cout << mx1;
	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    int n; cin >> n;
    double ans = 0;
    if(n % 2 == 1) {ans = (n + 1) / 2; ans = ans / n;}
    else ans = 0.5;
    printf("%.10lf\n", ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  string s;
  cin >> s;
  if(s[0]!='A'){ cout<<"WA"<<endl; return 0;}
  int cnt=2;
  int k=0;
  while(cnt<s.size()-1){
    if(s[cnt]=='C'){ k++;}
    cnt++;
  }
  if(k!=1){ cout<<"WA"<<endl; return 0;}
  k=1;
  while(k<s.size()){
    if(s[k]<'a' && s[k]!='C'){ cout<<"WA"<<endl; return 0; }
    k++;
  }
  
  cout << "AC" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long N, K;
	cin >> N >> K;
	long long H[N];
	for (long long i = 0; i < N; i++) {
		cin >> H[i];
	}
	sort(H, H + N);
	long long D[N - K+1];
	for (long long i = 0; i <=N - K+1; i++) {
		D[i] =H[i + K - 1] -H[i];
	}
	sort(D, D + N - K+1);
	cout << D[0] << endl;
	return 0;
}

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

using namespace std;

int a,b;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
  	cin>>a>>b;
 	cout<<max(a-b,max(a+b,a*b));
  	return 0;
}


Measured memory_bytes: 256