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

int main()
{
	int n, i, dp;
	while (scanf("%d", &n) != EOF) 
	{
		dp = 1;
		for (i = 1; i <= n; i++)
		{
			dp += i;
		}
		printf("%d\n", dp);
	}
	return 0;
}


Measured memory_bytes: 596
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    N,M = map(int, input().split())
    A = list(map(int, input().split()))
    X = sum(A)/(4*M)
    c = sum([1 for i in A if i >= X])
    if c>=M:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <queue>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <functional>
using namespace std;

long long K;

int main() {
	cin >> K;
	long long A = (K + 1) / 2;
	long long B = K / 2;
	cout << A * B << endl;
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  string s;
  cin>>s;
  bool ok=true;
  if(s[2]!=s[3])ok=false;
  if(s[4]!=s[5])ok=false;
  cout<<(ok?"Yes":"No")<<endl;

}

Measured memory_bytes: 256
import java.util.*;

class Main {

    public static int pivot(int[] a,int i,int j){
	int k=i+1;
	while(k<=j && a[i]==a[k])
	    k++;
	if(k>j)
	    return -1;
	if(a[i]>=a[k])
	    return i;
	return k;
    }

    public static int partition(int[] a,int b[],int i,int j,int x) {
	int l=i,r=j;

	while(l<=r){
	    while(l<=j && a[l]<x)
		l++;
	    while(r>=i && a[r]>=x)
		r--;
	    if(l>r)
		break;
	    int t=a[l];
	    a[l]=a[r];
	    a[r]=t;
	    int s=b[l];
	    b[l]=b[r];
	    b[r]=s;
	    l++;
	    r--;
	}
	return l;
    }

    public static void quickSort(int[] a,int[] b,int i,int j){
	if(i==j)
	    return;
	int p=pivot(a,i,j);
	if(p!=-1){
	    int k=partition(a,b,i,j,a[p]);
	    quickSort(a,b,i,k-1);
	    quickSort(a,b,k,j);
	}
    }
    
    public static void main(String[] args)  {
	Scanner sc = new Scanner(System.in);

	int N = sc.nextInt();
	int A[] = new int[N];
	int B[] = new int[N];
	for (int i = 0; i < N; i++) {
	    A[i] = sc.nextInt();
	    B[i] = i + 1 ;
	}

	quickSort(A,B,0,N - 1);

	for (int i = 0; i < N; i++)
	    System.out.print(B[i] + " ");

	System.out.println();
    }
}

Measured memory_bytes: 62844
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; ll k; cin >> n >> k;
  vector<ll> A(n), F(n);
  rep(i, n) cin >> A[i];
  rep(i, n) cin >> F[i];
  sort(all(A));
  sort(all(F), greater<ll>());
  auto bsearch = [&]() {
                   auto test = [&](ll t) {
                                 vector<ll> B(n);
                                 rep(i, n) B[i] = t/F[i];
                                 ll need = 0;
                                 rep(i, n) need += max(0LL, A[i]-B[i]);
                                 return need <= k;
                               };
                   ll ok = longinf, ng = -1;
                   while(ok-ng>1) {
                     ll mid = (ok+ng)/2;
                     (test(mid) ? ok : ng) = mid;
                   }
                   return ok;
                 };
  cout << bsearch() << endk;
  return 0;
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner();
		int x = sc.nextInt();
		int y = sc.nextInt();
		System.out.println(x + y / 2);
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  ll n;cin>>n;
  vector<ll>a(n);
  rep(i, n)cin>>a[i];
  ll q;cin>>q;
  vector<pll>ab(q);
  rep(i, q)cin>>ab[i].first>>ab[i].second;

  map<ll, ll>m;

  for(auto c:a)m[c]++;
  ll sum = 0;
  for(auto c:m)sum += c.first*c.second;

  rep(i, q){
    ll b=ab[i].first;
    ll c=ab[i].second;

    if(m[b]==0){
      cout<<sum<<endl;
      continue;
    }

    sum -= b*m[b];
    sum += c*m[b];

    m[c]+=m[b];
    m[b]=0;

    cout<<sum<<endl;

  }

  return 0;
}

Measured memory_bytes: 11284
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
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;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    int N;
    scan(N);
    ll ans = 0;
    FOR(i, 1, N / 2 + 1) {
        ll x = N - i;
        if (x != i)
            ans++;
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 256
// In the Name of Allah. Ya Ali!
#include<bits/stdc++.h>
typedef long long ll;
const ll MAX_N = 3000+5;
const ll MOD = 1e9+7;
using namespace std;

int dp[MAX_N][MAX_N];
pair<int,int> d[MAX_N][MAX_N];
int a[MAX_N];
int b[MAX_N];
int n,m;

int main()
{
    string s,t;
    cin >> s >> t;
    n = s.length();
    m = t.length();
    for(int i = 1;i<=n;++i)
        a[i] = (s[i-1]-'a');
    for(int i = 1;i<=m;++i)
        b[i] = (t[i-1]-'a');
    for(int i = 1;i<=n;++i)
    {
        for(int j = 1;j<=m;++j)
        {
            if (a[i]==b[j])
                dp[i][j] = dp[i-1][j-1]+1,d[i][j] = {i-1,j-1};
            else
            {
                if (dp[i-1][j]>dp[i][j-1])
                    d[i][j] = {i-1,j};
                else
                    d[i][j] = {i,j-1};
                dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    vector<int> ans;
    int i = n;
    int j = m;
    while(i and j)
    {
        if (d[i][j] == make_pair(i-1,j-1))
            ans.push_back(a[i]);
        pair<int,int> pr = d[i][j];
        i = pr.first;
        j = pr.second;
    }
    reverse(ans.begin(),ans.end());
    for(auto x:ans)
        cout << (char)(x+'a');
    return 0;
}


Measured memory_bytes: 106112
#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;

int main()
{
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  cout << max(A*B,C*D) << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){

  ll a , v , b , w ,t;
    cin>>a>>v>>b>>w>>t;
    ll d = abs(a-b);
    if(v<=w) 
      cout<<"NO\n";
    else{
        if(t*(v-w)>=d) 
          cout<<"YES\n";
        else
         cout<<"NO\n";
    }

  return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define m0(x) memset(x, 0, sizeof(x))

int A[100000];

int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  rep(i, n) scanf("%d", &A[i]);
  int sum = 0;
  rep(i, n) if (A[i] >= k) sum++;
  printf("%d", sum);
}


Measured memory_bytes: 640
import math
def distance(x,y):
  return math.sqrt(x**2+y**2)

n,d=input().split()
n=int(n)
d=int(d)
count=0
for i in range(n):
  x,y=input().split()
  x=int(x)
  y=int(y)
  r=distance(x,y)
  if(r<=d):
    count+=1

print(count)

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

typedef vector<int> 	vi;
typedef vector<vi>		vvi;
typedef long long int	ll;

int main(){

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	string s;
	cin >> s;

	int a = atoi(s.substr(0, 2).c_str());
	int b = atoi(s.substr(2, 2).c_str());

	if(a >= 1 && a <= 12){
		if(b >= 1 && b <= 12){
			cout << "AMBIGUOUS" << endl;
		}else{
			cout << "MMYY" << endl;
		}
	}else{
		if(b >= 1 && b <= 12){
			cout << "YYMM" << endl;
		}else{
			cout << "NA" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
def check_bingo(s):
    for l in s:
        if all(l):
            return True

    for i in range(3):
        if s[0][i] and s[1][i] and s[2][i]:
            return True

    if s[0][0] and s[1][1] and s[2][2]:
        return True
    
    if s[0][2] and s[1][1] and s[2][0]:
        return True

    return False

a = list()
sheet = list()
for i in range(3):
    a.append(list(map(int, input().split())))
    sheet.append([False]*3)
    
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                sheet[j][k] = True

if check_bingo(sheet):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int a, b, k;

int main()
{
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 0; i--)
    {
        k -= a % i == 0 && b % i == 0;
        if (k == 0)
        {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin >> s;
  int N = s.size();

  int p = N - 1;
  while(p!=-1){
    if(p <= 3){
      cout << "NO" << endl;
      return 0;
    }

    string t = "hogeh";
    t[0] = s[p-4];
    t[1] = s[p-3];
    t[2] = s[p-2];
    t[3] = s[p-1];
    t[4] = s[p];
    //cout << t << endl;

    if(t == "dream"){
      p = p-5;
    }
    else if(t == "eamer"){
      if(p < 6){
        cout << "NO" << endl;
        return 0;
      }
      if(s[p-5] == 'r' && s[p-6] == 'd'){
        p = p-7;
      } else {
        cout << "NO" << endl;
        return 0;
      }
    }
    else if(t == "erase"){
      p = p-5;
    }
    else if(t == "raser"){
      if(p < 5){
        cout << "NO" << endl;
      }
      if(s[p-5] == 'e'){
        p = p-6;
      } else {
        cout << "NO" << endl;
        return 0;
      }
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define clr(x,y) memset(x,y,sizeof(x))
#define in(a) a=read()
#define out(a) printf("%d\n",a)
inline ll read(){
    char c=getchar();ll f=1,x=0;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+(c-'0'),c=getchar();
    return x*f;
}
#define mod 998244353
void MOD(int &x){if(x>=mod)x-=mod;}
#define maxn 1000010
#define inf (1<<30)
int f[maxn],inv[maxn];
int power(int a,int b){
	int ans=1;
	while(b){
		if(b&1)ans=1ll*ans*a%mod;
		a=1ll*a*a%mod;
		b>>=1;
	}
	return ans;
}
int C(int n,int m){return 1ll*f[n]*inv[m]%mod*inv[n-m]%mod;}
int invc(int n,int m){return 1ll*inv[n]*f[m]%mod*f[n-m]%mod;}
int main(){
	int n,m;
	in(n);in(m);
	f[0]=1;FOR(i,1,n+m)f[i]=1ll*f[i-1]*i%mod;
	inv[n+m]=power(f[n+m],mod-2);
	FORD(i,n+m-1,0)inv[i]=1ll*inv[i+1]*(i+1)%mod;
	if(n>m)swap(n,m);
	int ans=0;
	FOR(i,1,n)MOD(ans+=1ll*C(2*i,i)*C(n-i+m-i,n-i)%mod);
	ans=1ll*ans*invc(n+m,n)%mod;
	ans=1ll*ans*power(2,mod-2)%mod;
	MOD(ans+=m);
	out(ans);
}

Measured memory_bytes: 8064
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


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

  vector<string> ws;
  ws.push_back("Sunny");
  ws.push_back("Cloudy");
  ws.push_back("Rainy");

  string S;
  cin >> S;
  int n = find(rng(ws), S) - ws.begin();
  n++;
  if (n == ws.size()) n = 0;
  cout << ws[n];
}
#endif


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

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

  if (s == "a" || s == "e" || s == "i" || s == "o" || s == "u"){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
n,k = gets.split.map(&:to_i)
v = gets.split.map(&:to_i)

ans = -10000

for i in 0..k
  for j in 0..i
    if n-1-i >= 0
      left = v[j..(n-1-i+j)]
      #p "#{j} ~ #{(n-1-i+j)}"
    else
      left = []
    end
    
    get = v - left
    #p "残り操作回数:#{k-i}"
    (k-i).times do
      break if get.empty?  
      get.delete(get.min) if !get.min.nil? && get.min < 0
    end
    #p "get:#{get}"
    ans = [ans, get.inject(&:+) ? get.inject(&:+) : 0].max
  end
end

puts ans

Measured memory_bytes: 1916
import           Control.Monad
import           Data.Array.IO
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Maybe
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

main = do
  n <- getInt

  as <- VM.new n
  bs <- VM.new n
  cs <- VM.new n
  forM_ [0..n-1] $ \i -> do
    [a, b, c] <- getIntList
    VM.write as i a
    VM.write bs i b
    VM.write cs i c

  dp <- newArray ((0,0),(n-1,2)) 0 :: IO (IOUArray (Int,Int) Int)

  a0 <- VM.read as 0
  b0 <- VM.read bs 0
  c0 <- VM.read cs 0
  writeArray dp (0,0) a0
  writeArray dp (0,1) b0
  writeArray dp (0,2) c0

  forM_ [1..n-1] $ \i -> do
    ai <- VM.read as i
    bi <- VM.read bs i
    ci <- VM.read cs i
    dp0 <- readArray dp (i-1, 0)
    dp1 <- readArray dp (i-1, 1)
    dp2 <- readArray dp (i-1, 2)
    writeArray dp (i,0) (max dp1 dp2 + ai)
    writeArray dp (i,1) (max dp2 dp0 + bi)
    writeArray dp (i,2) (max dp0 dp1 + ci)

  dp0 <- readArray dp (n-1, 0)
  dp1 <- readArray dp (n-1, 1)
  dp2 <- readArray dp (n-1, 2)

  let ans = max dp0 (max dp1 dp2)
  print ans

Measured memory_bytes: 6524
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
//#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n; cin>>n;
    vector<int>v(n);rep(i,n)cin>>v[i];
    int ans=0;
    int a; cin>>a;
    vector<int>u(a);rep(i,a)cin>>u[i];
    rep(i,a){
        int f=u[i];
        int imin=-1;
        int imax=n;
        while(imax-imin>1){
            int mid=(imax+imin)/2;
            if(v[mid]>f)imax=mid;
            else imin=mid;
        }
        if(v[imin]==f)ans++;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    string s; cin >> s;
    cout << s.at(0) <<  s.at(1) << s.at(2) << endl;
    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),v.end()
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
vector<int> dy={-1,0,1,0},dx={0,-1,0,1};
ll dp[1000010];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    fill(dp,dp+n,inf);
    dp[n]=0;
    vector<ll> tmp;
    tmp.push_back(1);
    ll six=6,nine=9;
    while(six<=n){
        tmp.push_back(six);
        six*=6;
    }
     while(nine<=n){
        tmp.push_back(nine);
        nine*=9;
    }
    sort(all(tmp));
    for(int i=n;i>=1;i--){
        for(int j=0;j<tmp.size();j++){
            if(i<tmp[j])break;
            dp[i-tmp[j]]=min(dp[i-tmp[j]],dp[i]+1);
        }
    }
    cout<<dp[0]<<endl;
}
   


Measured memory_bytes: 1024
N, K = [int(n) for n in input().split()]
scores = [int(n) for n in input().split()]
min_pointer = 0
max_pointer = K
for i, score in enumerate(scores, start=1):
    if i > K:
        if scores[max_pointer] > scores[min_pointer]:
            print('Yes')
        else:
            print('No')
        min_pointer += 1
        max_pointer += 1

Measured memory_bytes: 105680
#include <complex>
#include <cmath>

using Real = long double;

const Real EPS = 1e-10;

// 宇宙船演算子
inline Real compare(Real a, Real b) {
    if (std::abs(a - b) < EPS) return 0;
    return a - b > 0 ? 1 : -1;
}

template <class T>
inline T sq(T x) { return x * x; }


using Point = std::complex<Real>;
using Segment = std::pair<Point, Point>;

inline Real length(Segment s) {
    return std::abs(s.second - s.first);
}

// inner product
inline Real dot(Point x, Point y) {
    return std::real(std::conj(x) * (y));
}

// outer product
inline Real cross(Point x, Point y) {
    return std::imag(std::conj(x) * (y));
}

// lに対するxの正射影
Point proj(Segment s, Point p) {
    Real ratio = dot(s.second - s.first, p - s.first) / sq(length(s));
    return s.first + (s.second - s.first) * ratio;
}

// lを軸としてxに対称な点
Point refl(Segment s, Point p) {
    Point t = proj(s, p);
    return t + (t - p);
}

// lに対するpの位置
// counter clockwise -> 1, clockwise   -> -1
// online front      -> 2, online back -> -2
// on segment        -> 0
int side(Segment s, Point p) {
    Real c = cross(s.second - s.first, p - s.first);
    if (compare(c, 0) != 0) return compare(c, 0);

    Real d = dot(s.second - s.first, p - s.first);
    if (compare(d, 0) < 0) return -2;

    return (compare(length(Segment(s.first, p)), length(s)) > 0 ? 2 : 0);
}

inline bool isorthogonal(Segment s1, Segment s2) {
    return compare(dot(s1.second - s1.first, s2.second - s2.first), 0) == 0;
}

inline bool isparallel(Segment s1, Segment s2) {
    return compare(cross(s1.second - s1.first, s2.second - s2.first), 0) == 0;
}

bool intersect(Segment s1, Segment s2) {
    return (side(s1, s2.first) * side(s1, s2.second) <= 0) &&
           (side(s2, s1.first) * side(s2, s1.second) <= 0);
}

Point intersection(Segment s1, Segment s2) {
    Real c1 = cross(s2.second - s2.first, s1.second - s1.first);
    Real c2 = cross(s2.second - s2.first, s1.first - s2.first);
    return s1.first + (s1.second - s1.first) * (-c2 / c1);
}


#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    cout << fixed << setprecision(10);

    int Q;
    cin >> Q;

    for (int q = 0; q < Q; ++q) {
        Segment s[2];
        for (int i = 0; i < 2; ++i) {
            Point p[2];
            for (int j = 0; j < 2; ++j) {
                Real x, y;
                cin >> x >> y;
                p[j] = Point(x, y);
            }
            s[i] = Segment(p[0], p[1]);
        }

        Point res = intersection(s[0], s[1]);
        cout << res.real() << " " << res.imag() << endl;
    }
    return 0;
}



Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
char ch[MAX_N];
int t;
int cnt;
string str1, str2;
int main(void)
{
	scanf("%s", ch);
	int len = strlen(ch);
	int cnt = 1;
	str1 = ch[0];
	for (int i = 1; i < len; i++)
	{
		str2 += ch[i];
		if (str1 != str2) 
		{
			str1 = str2;
			str2.clear();
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

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

#define rep3(i, s, n ,a) for (int i = (s); i < (int)(n); i+=a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

int main(){
    long a, b, c, k;
    cin >> a >> b >> c >> k;
    if(a>=k){
        cout << k << endl;
    }else{
        k -= a;
        if(b>=k){
            cout << a << endl;
        }else{
            cout << a - k + b << endl;
        }
    }
    return 0;
}

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

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

    int A, B, C;
    cin >> A >> B >> C;

    if (C <= (A + B))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 888
#[macro_use]
mod utils {
    macro_rules! input {
        ($($r:tt)*) => {
            let stdin = std::io::stdin();
            let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
            let mut next = move || -> String{
                bytes
                    .by_ref()
                    .map(|r|r.unwrap() as char)
                    .skip_while(|c|c.is_whitespace())
                    .take_while(|c|!c.is_whitespace())
                    .collect()
            };
            input_inner!{next, $($r)*}
        };
    }
    macro_rules! input_inner {
        ($next:expr) => {};
        ($iter:expr, ) => {};

        ($next:expr, _ : $t:tt $($r:tt)*) => {
            let _ = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
            let $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
        ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
            let mut $var = read_value!($next, $t);
            input_inner!{$next $($r)*}
        };
    }
    macro_rules! read_value {
        ($next:expr, ( $($t:tt),* )) => {
            ( $(read_value!($next, $t)),* )
        };
        ($next:expr, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        };
        ($next:expr, chars) => {
            read_value!($next, String).chars().collect::<Vec<char>>()
        };
        ($next:expr, usize1) => {
            read_value!($next, usize) - 1
        };
        ($next:expr, $t:ty) => {
            $next().parse::<$t>().expect("Parse error")
        };
    }
}

fn f(a: &[i32]) -> bool {
    let mut r = 0;

    for i in 0..a.len() {
        let c = if (a.len() - 1) & i == i { 1 } else { 0 };
        // println!("{} {}", i, c);
        if a[i] % 2 != 0 {
            r += c % 2;
            r %= 2;
        }
    }

    r % 2 == 1
}

fn main() {
    input! {
        _: usize,
        a: chars,
    }
    let mut a: Vec<_> = a
        .iter()
        .map(|x| x.to_digit(10).unwrap() as i32 - 1)
        .collect();

    if f(&a) {
        println!("1");
        return;
    }
    for x in a.iter_mut() {
        if *x == 1 {
            println!("0");
            return;
        }
        if *x == 2 {
            *x = 1;
        }
    }
    if f(&a) {
        println!("2");
    } else {
        println!("0");
    }
}


Measured memory_bytes: 13560
#include <bits/stdc++.h>
using namespace std;
#define ft              first
#define sd              second
#define ll          long long
#define pb              push_back
#define mkp           make_pair
#define pll             pair<ll,ll>
#define vll             vector<int>
#define mll             map<ll,ll>
#define pqg             priority_queue<ll>
#define pqs             priority_queue<ll,vll,greater<ll>>
#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 MAXN   10000001
void online_judge()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
}

void ISO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main() {

    ISO();
    //online_judge();
    string s,t;
    cin >> s >> t;
    ll cnt = 0;
    for(int i=0;i<s.length();++i)
    {
        if(s[i] != t[i])
        {
            s[i]= t[i];
            cnt++;
        }
        else
        {
            continue;
        }
    }
    cout << cnt <<"\n";
  //  cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
    return 0;
}

Measured memory_bytes: 3808
#include <bits/stdc++.h>
#define ff first
#define ss second
#define int long long
#define all(x) (x).begin(), (x).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define eb emplace_back
#define pii pair<int, int>

using namespace std;

void solve()
{
    string s;
    cin >> s;
    int sum = 0;
    for (auto &i : s)
    {
        sum += (i - '0');
    }
    cout << (sum % 9 == 0 ? "Yes" : "No");
}

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

Measured memory_bytes: 3728
N = int(input())

res = 10**10

for i in range(N+1):
  count = 0
  six = i
  while six>0:
    count += six%6
    six = six//6
  nine = N-i
  while nine>0:
    count += nine%9
    nine = nine//9
  res = min(res,count)

print(res)

Measured memory_bytes: 3060
import java.util.*;

public class Main{
  public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int ans = -1;

    for (int i=1; i<1010; i++) {
    	if ( (int) ((int)i *0.08) == A && (int)((int) i *0.1) == B) {
    		ans = i;
    		break;
    	}
    }

	System.out.println(ans);
    
  }
}

Measured memory_bytes: 23636
def isCLKWISE(ph):
    if (ph[-1][0] - ph[-3][0])*(- ph[-3][1] + ph[-2][1]) - (ph[-2][0] - ph[-3][0])*(- ph[-3][1] + ph[-1][1] ) < 0 : return False
    else : return True
     
def ConvexHullScan(P):
    P = sorted(P)
    phU = [P[0],P[1]]
    for p in P[2:]:
        phU.append(p)
        while(True):
            if isCLKWISE(phU) : break
            else :
                del phU[-2]
                if len(phU) == 2 : break
    phL = [P[-1],P[-2]]
    for p in P[-3::-1]:
        phL.append(p)
        while(True):
            if isCLKWISE(phL) : break
            else :
                del phL[-2]
                if len(phL) == 2 : break
    ph = phU + phL[1:-1]
    return ph
 
n = int(input())
P = []
for i in range(n):
    P.append([int(x) for x in input().split()])
     
Q = ConvexHullScan(P)
Q.reverse()
print(len(Q))
idx = min([[x[1][1],x[1][0],x[0]] for x in enumerate(Q)])[2]
R = Q[idx:] + Q[:idx]
for r in R:
    print(r[0],r[1])

Measured memory_bytes: 33452
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define ind(a) scanf("%d", &a)
#define inlld(a) scanf("%lld", &a)
#define ind2(a, b) scanf("%d%d", &a, &b)
#define inlld2(a, b) scanf("%lld%lld", &a, &b)
#define ind3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define inlld3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)

using namespace std;

const int N=55;
const int MOD=1e9+7;

typedef long long ll;
typedef long double ld;

struct matrix
{
    ll mat[N][N];
};

ll n, k;
matrix arr, identity;

matrix mulmat(matrix x, matrix y)
{
    matrix ret;
    for(ll a=1; a<=n; a++)
        for(ll b=1; b<=n; b++)
            ret.mat[a][b]=0;
    for(ll a=1; a<=n; a++)
        for(ll b=1; b<=n; b++)
            for(ll c=1; c<=n; c++)
                ret.mat[a][b]=(ret.mat[a][b]
                                +x.mat[a][c]*y.mat[c][b])%MOD;
    // printf("\n\n");
    // for(ll a=1; a<=n; a++)
    // {
    //     for(ll b=1; b<=n; b++)
    //         printf("%lld ", ret.mat[a][b]);
    //     printf("\n");
    // }
    // printf("\n\n\n");
    return ret;
}

matrix expo(matrix x, ll req)
{
    // cout<<req<<"\n";
    if(req==0)
        return identity;
    if(req==1)
        return x;
    matrix here=expo(x, req/2);
    matrix ret=mulmat(here, here);
    if(req%2)
        ret=mulmat(ret, x);
    // printf("\n%lld\n", req);
    // for(ll a=1; a<=n; a++)
    // {
    //     for(ll b=1; b<=n; b++)
    //         printf("%lld ", ret.mat[a][b]);
    //     printf("\n");
    // }
    return ret;
}

int main() 
{
    inlld2(n, k);
    for(ll a=1; a<=n; a++)
        for(ll b=1; b<=n; b++)
        {
            inlld(arr.mat[a][b]);
            if(a==b)
                identity.mat[a][b]=1;
        }
    matrix here=expo(arr, k);
    ll ans=0;
    for(ll a=1; a<=n; a++)
        for(ll b=1; b<=n; b++)
            ans=(ans+here.mat[a][b])%MOD;
    printf("%lld\n", ans);
    return 0;
}



Measured memory_bytes: 11264
#include <stdio.h>

int main(){
  long long n, q, s[100001], t, i, min, max, mid, c = 0;

  scanf("%lld", &n);
  for(i = 0; i < n; ++i) scanf("%lld", s + i);

  scanf("%lld", &q);
  while(q--){
    scanf("%lld", &t);
    min = 0;
    max = n - 1;
    while(min <= max){
      mid = (min + max) / 2;
      if(s[mid] == t){ c++; break;}
      else if(s[mid] > t) max = mid - 1;
      else if(s[min] < t) min = mid + 1;
    }
  }
  printf("%lld\n", c);
  return 0;
}



Measured memory_bytes: 2580
#include<bits/stdc++.h>
    using namespace std;
    long long arr[1000000],arr1[1000000];
    int main()
    {
    	long long x,n,m,y,i,j,k,z,f,pp,qq,rr;
    	cin>>n>>x>>m;
    	arr[0]=1;
		z=0;k=0;
		arr[0]=x%m;
		arr1[x%m]=1;
		f=0;
		z=x;
		for (i=1;i<n;i++)
		{
			arr[i]=(arr[i-1]*arr[i-1])%m;
			if (arr1[arr[i]]==1)
			{
				f=1;
				pp=z;
				for (j=0;j<n;j++)
				{
					if (arr[j]==arr[i])
					{
						break;
					}
					pp-=arr[j];
				}
				qq=j;
				k=i-j;
				break;
			}
			else if (arr[i]==0)
			{
				cout<<z<<endl;
				return 0;
			}
			arr1[arr[i]]=1;
			z=z+arr[i];
		}
		if (f==0)
		{
			cout<<z<<endl;
			return 0;
		}
		z=z+pp*((n-i)/k);
		rr=qq+(n-i)%k;
		for (i=qq;i<rr;i++)
		{
			z=z+arr[i];
		}
		cout<<z<<endl;
    }

Measured memory_bytes: 4748
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
from itertools import permutations

n,m,R = map(int, input().split())
r = list(map(int, input().split()))
r = [i-1 for i in r]
abc = [list(map(int, input().split())) for i in range(m)]
edge = [[10 ** 9] * (n) for i in range(n)]
for a,b,c in abc:
  a-=1
  b-=1
  edge[a][b] = c
  edge[b][a] = c
d = floyd_warshall(edge)
ans = 10 ** 18
for i in permutations(r):
  tmp = 0
  for j in range(R-1):
    tmp += d[i[j]][i[j+1]]
  ans = min(ans,tmp)
print(int(ans))

Measured memory_bytes: 19720
/**********************************************************
* @Author: 			   Maple
* @Date:   			   2020-03-07 20:16:48
* @Last Modified by:   Maple
* @Last Modified time: 2020-03-07 20:21:01
* @Remark: 
**********************************************************/
#include <bits/stdc++.h>
#define lowbit(x) (x&(-x))
#define CSE(x,y) memset(x,y,sizeof(x))
#define INF 0x3f3f3f3f
#define Abs(x) (x>=0?x:(-x))
#define FAST ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll , ll> pll;

const int maxn=1000;


int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("in.in","r",stdin);
	// #endif
	int a,b;
	cin>>a>>b;
	int ans=1;
	for(;ans<=1000;ans++){
		int x=ans*0.08;
		int y=ans*0.1;
		if(x==a&&y==b)
			break;
	}
	if(ans<=1000)
		cout<<ans<<endl;
	else
		cout<<"-1"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define pw(x) (1LL<<(x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define dbv(a) cerr << #a << " = "; for (auto xxxx: a) cerr << xxxx << " "; cerr << endl

using namespace std;

typedef long long ll;
typedef double dbl;
const int INF = 1.01e9;
const ll MOD = 998244353;


ll mul(ll a, ll b) {
  return (a * b) % MOD;
}

ll bin_pow(ll a, ll k) {
  ll res = 1;
  for (; k > 0; k /= 2) {
    if (k % 2 == 1) {
      res = (res * a) % MOD;
    }
    a = (a * a) % MOD;
  }
  return res;
}

int main() {
#define TASK "A"
#ifdef HOME
  assert(freopen(TASK".in", "r", stdin));
#endif
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i]);
  }
  vector<vector<int>> dv(mx + 1);
  for (int i = 1; i <= mx; i++) {
    for (int j = i; j <= mx; j += i) {
      dv[j].pb(i);
    }
  }
  vector<ll> sum_up(mx + 1);
  for (auto x: a) {
    for (auto down: dv[x]) {
      sum_up[down] = (sum_up[down] + x) % MOD;
    }
  }

  vector<ll> magic_cof(mx + 1);
  for (int i = 1; i <= mx; i++) {
    ll sum = 0;
    for (auto d: dv[i])  {
      sum = (sum + (magic_cof[d] * (i / d)) % MOD) % MOD;
    }
    magic_cof[i] = (1 - sum + MOD) % MOD;
  }
  vector<ll> rev(mx + 1);
  for (int i = 1; i <= mx; i++) {
    rev[i] = bin_pow(i, MOD - 2);
  }

  for (int i = 1; i <= mx; i++) {
    sum_up[i] = (sum_up[i] * rev[i]) % MOD;
  }

//  dbv(magic_cof);
//  dbv(sum_up);
//  dbv(dv[2]);
//  dbv(dv[3]);

  ll answer = 0;

  for (auto x: a) {
    for (auto d: dv[x]) {
      answer = (answer + mul(x, mul(sum_up[d], magic_cof[d])));
    }
    answer = (answer - x + MOD) % MOD;
  }
  answer = (answer * rev[2]) % MOD;

  cout << answer << endl;






  return 0;
}




Measured memory_bytes: 139008
#include<iostream>
#include<algorithm>

using namespace std;
 
int main(){
    int n, k;
    cin >> n >> k;
    long long int h[n], res = 0;
    for(int i=0; i<n; i++) 
      cin >> h[i];
    sort(h, h+n);
    for(int i=0; i<n-k; i++) 
      res += h[i];
    cout << res;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main()
{
	int i, j=0, k, sl, al;
	string S, a = { "abcdefghijklmnopqrstuvwxyz" };

	cin >> S;
	sl = S.length();
	al = a.length();

	if (S[0] == 'A') {
		for (i = 2; i < sl-1; i++) {
			if (S[i] == 'C') {
				j++;
				k = i;
			}
		}
			if (j == 1) {
				S.erase(S.begin() + k);
				S.erase(S.begin());
				k = 0;
				for (i = 0; i < sl-2; i++) {
					for (j = 0; j < al; j++) {
						if (S[i] == a[j])
							k++;
					}
				}
				if (k == sl-2) {
					cout << "AC" << endl;
					return 0;
				}
			}
	}

		cout << "WA" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

string s;

int main(){
  cin >> s;
  string res = "No";
  if(s == "hi") res = "Yes";
  if(s == "hihi") res = "Yes";
  if(s == "hihihi") res = "Yes";
  if(s == "hihihihi") res = "Yes";
  if(s == "hihihihihi") res = "Yes";
  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;


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

	int n = s.size();
	s += "X";
	string t;
	int i = 0;
	while (i < n) {
		if (s[i] == 'B' && s[i+1] == 'C') {
			t += 'D';
			i += 2;
		} else {
			t += s[i];
			i++;
		}
	}
	t += 'X';

	// cout << s << endl;
	// cout << t << endl;

	long long ans = 0;
	i = 0;
	int na = 0;
	for (auto c: t) {
		switch (c) {
			case 'A':
				na++;
				break;
			case 'D':
				ans += na;
				break;
			default:
				na = 0;
				break;
		}
	}

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


Measured memory_bytes: 776
N, M = gets.split.map(&:to_i)

def divisor(n)
  ans = []
  for i in (1..Math.sqrt(n))
    d, m = n.divmod(i)
    if m == 0
      ans << i   
      ans << d if i != d
    end
  end
  ans.sort! 
end

puts divisor(M).inject(1) {|acc, x| M / x >= N ? x : acc}

Measured memory_bytes: 3836
/*
                                Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
 
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
 
#include <bits/stdc++.h>
 
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
 
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x) % M;
        x=(x*x)% M;
        n=n/2;
    }
    return result % M;
}
signed main()
{   jaldi
	int n,k,score=0;
	cin>>n>>k;
	int r,s,p;
	cin>>r>>s>>p;
	string str;
	cin>>str;
	bool a[n+1+k],b[n+1+k],c[n+1+k];
	memset(a,false,sizeof(a));
	memset(b,false,sizeof(b));
	memset(c,false,sizeof(c));
	for(int i=0;i<n;i++)
	{	if(i<k)
		{	if(str[i]=='r')
			{	score+=p;
				c[i+k]=true;
			}
			else if(str[i]=='s')
			{	score+=r;
				a[i+k]=true;
			}
			else
			{	score+=s;
				b[i+k]=true;
			}
		}
		else
		{	if(str[i]=='r')
			{	if(c[i]==false)
				{	score+=p;
					c[i+k]=true;
				}
			}
			if(str[i]=='s')
			{	if(a[i]==false)
				{	score+=r;
					a[i+k]=true;
				}
			}
			if(str[i]=='p')
			{	if(b[i]==false)
				{	score+=s;
					b[i+k]=true;
				}
			}
		}
	}
	cout<<score;
}

Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,a;
  cin >> n >> a;
  if(a==0){
    if(n%500==0){
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }else{
  	n=n%500;
  	if(n<=a){
    	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++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
	int l,r,d;
	cin>>l>>r>>d;
	int cnt = 0;
	for (int i = l; i <= r; i++)
	{
		if(i%d==0) cnt++;
	}
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 3596
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>
#include <deque>
#include <bitset>
#include <complex>
using namespace std;
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPS(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#define REVERSE(i,n) for(int (i) = n-1;(i) >= 0 ; --i)
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(auto(it,(c).begin());it != (c).end();)
#define cx real()
#define cy imag()
#define px first
#define py second
#define LL long long
#define int LL
#define inf  (1LL << 60)
#define mod 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
#define lower lower_bound
#define upper upper_bound
#define ZERO(c,n) memset(&c[0],0,sizeof(int)*n)
#define ZERO2(c,n) memset(&c[0][0],0,sizeof(int)*n
#define pl(a) cout << ""#a": " << a << endl;
#ifdef _DEBUG
#define debug_io fstream cin("input.txt");ofstream cout("output.txt");
#else
#define debug_io ;
#endif
#define debug_input debug_io
#define DOWN(T) std::greater<T>()
template<class T>void scan(vector<T>& a, int n, istream& cin)
{
	T c; REP(i, n) { cin >> c; a.push_back(c); }
}
using vs = vector<string>; using vi = vector<int>; using pii = pair<int, int>;
using psi = pair<string, int>; using vvi = vector<vi>; using pss = pair<string, string>;
using vpii = vector<pii>;
template<class T>bool valid(T x, T w) { return 0 <= x&&x < w; }
int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 };
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------


vpii v[4];
int vsum[4][100];
int n, w;


signed main()
{
	QUICK_CIN;
	debug_input;

	vpii vw;
	cin >> n >> w;
	REP(i, n) {
		int c, d;
		cin >> c >> d;
		vw.push_back({d,c});
	}
	int mod_r = vw[0].second;
	int aw[4] = {0};

	REP(i, n) {
		v[vw[i].second-mod_r].push_back(vw[i]);
		aw[vw[i].second-mod_r] = vw[i].second;
	}

	REP(i, 4) {
		sort(ALL(v[i]),DOWN(pii));
	}

	REP(i, 4) {
		REP(j, v[i].size()) {
			vsum[i][j+1] = vsum[i][j] + v[i][j].first;
		}
	}

	int max_d = 0;

	REP(i, v[0].size()+1) {
		REP(j, v[1].size()+1) {
			REP(k, v[2].size()+1) {
				REP(m, v[3].size()+1) {
					if (aw[0] * i + aw[1] * j + aw[2] * k + aw[3] * m <= w) {
						max_d = max(max_d, vsum[0][i] + vsum[1][j] + vsum[2][k] + vsum[3][m]);
					}
				}
			}
		}
	}

	cout << max_d << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl

signed main(){
    string S[7]={"thu","fri","sat","sun","mon","tue","wed"};
    int y;
    cin >> y;
    cout << S[y%7] << endl;
    return 0;
}   


Measured memory_bytes: 3204