akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

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

  vector<ll> ans(N);
  // 逆から見て、0なら0確定。1なら1確定していく。
  for (ll i = N - 1; i >= (N + 1) / 2; i--) {
    if (A[i] == 0) {
      continue;
    } else {
      ans[i] = 1;
    }
  }
  // 残り半分は頑張る。
  for (ll i = (N + 1) / 2 - 1; i >= 0; i--) {
    ll subans = A[i];
    ll cnt = 0;
    for (ll j = i + (i + 1); j < N; j += (i + 1)) {
      cnt += ans[j];
    }
    if (cnt % 2 == 0) {
      if (subans == 0) {
        continue;
      } else {
        ans[i] = 1;
      }
    } else {
      if (subans == 0) {
        ans[i] = 1;
      } else {
        continue;
      }
    }
  }

  // output
  ll cnt = count_if(cbegin(ans), cend(ans), [](auto x) { return x == 1; });
  cout << cnt << endl;
  for (ll i = 0; i < N; i++) {
    if (ans[i] == 0) continue;
    cout << i + 1 << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define boost ios_base::sync_with_stdio(0); cin.tie(); cout.tie()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define endl '\n'
#define len(a) a.length()
#define TIME cout << endl << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;

#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;

typedef long long ll;

const long long inf = 1e18;
const double eps = 1e-6;
const long long mod = 1e9 + 7;

int cx[4] = {1, -1, 0, 0};
int cy[4] = {0, 0, 1, -1};

int hx[8] = {2, 2, -2, -2, 1, -1, 1, -1};
int hy[8] = {1, -1, 1, -1, 2, -2, -2, 2};

bool on_board (ll x, ll y, ll n, ll m) {
    return x >= 0 && y >= 0 && x < n && y < m;
}

bool be_pow_two (ll a) {
    return ((a & (a - 1)) == 0);
}

ll binpow (ll a, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1LL)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1LL;
	}
	return res;
}

ll string_to_int (string s) {
    reverse(all(s));
    int pw = 1;
    int ans = 0;
    for (int i = 0; i < len(s); i++) {
        ans += (s[i] - '0') * pw;
        pw *= 10;
    }
    return ans;
}

ll div_up (ll x, ll y) {
    if (x == 0)
        return 0;
    return (x - 1) / y + 1;
}

bool is_prime (ll a) {
    for (ll i = 2; i <= sqrt(a); i++)
        if (a % i == 0)
            return false;
    return true;
}

int len_num (int x) {
    int ans = 0;
    while (x > 0) {
        ans++;
        x /= 10;
    }
    return ans;
}

#define f first
#define s second

bool cmp (pair <int, pair <int, int>> &a, pair <int, pair <int, int>> &b) {
    if (a.s.f + a.s.s == 0) {
        a.f = 0;
    }
    else if (b.s.f + b.s.s == 0) {
        b.f = 0;
    }
    else if ((a.s.f + a.s.s != 0) && (b.s.f + b.s.s != 0)) {
        if (a.f / (a.s.f + a.s.s) == b.f / (b.s.f + b.s.s))
            return a.f < b.f;
        return a.f / (a.s.f + a.s.s) < b.f / (b.s.f + b.s.s);
    }
}

int32_t main()
{
    boost;
    string s, t; cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < len(s); i++) {
        if (s[i] != t[i]) {
            ans++;
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 3808
import java.io.*;
import java.util.*;
import java.util.stream.*;

class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		String t = saori.nextHayami();
		String[] st = t.split("");
		String a = st[st.length-1];
		s = s+a;
		if(s.equals(t)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 37332
// ABC 135 B - 0 or 1 Swap
//201909012

using System;
using System.Linq;
using static System.Math;
using System.Collections.Generic;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            int N = int.Parse(Console.ReadLine());
            int[] P = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int count = 0;

            for (int i = 0; i < N; i++)
            {
                count += (i+1 == P[i] ? 0 : 1);
            }

            if(count > 2) Console.WriteLine("NO");
            else Console.WriteLine("YES");


        }
    }
}


Measured memory_bytes: 11348
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    StringBuilder bl = new StringBuilder();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int u = 0;
    int k = 0;
    int v = 0;
    int M[][] = new int[n][n];

    for(int i = 0; i<n; i++){
      for(int j = 0; j<n; j++){
        M[i][j] = 0;
      }
    }

    for(int i = 0; i<n; i++){
      u = sc.nextInt();
      k = sc.nextInt();
      for(int j =0; j<k; j++){
        v = sc.nextInt();
        M[u-1][v-1] = 1;
      }
    }

    for(int i = 0; i<n; i++){
      for(int j = 0; j<n; j++){
        if(j!=0)bl.append(" ");
        bl.append(M[i][j]);
      }
      bl.append("\n");
    }
    System.out.print(bl);
  }
}


Measured memory_bytes: 29416
using System;
using System.Linq;

namespace ARC071_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var S = new string[n];
            var alphabet = "abcdefghijklmnopqrstuvwxyz";
            var alphabetcnt = new int[alphabet.Length][];

            for (int i = 0; i < alphabet.Length; i++)
            {
                alphabetcnt[i] = new int[n];
            }

            for (int i = 0; i < n; i++)
            {
                S[i] = Console.ReadLine();
                for (int a = 0; a < alphabet.Length; a++)
                {
                    alphabetcnt[a][i] = S[i].Where(x => x == alphabet[a]).Count();
                }
            }

            var result = "";
            for (int a = 0; a < alphabet.Length; a++)
            {
                result += new string(alphabet[a], alphabetcnt[a].Min());
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#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++)
using ll = long long;
using namespace std;

int main() {
	string s;
	bool ans = false;
	cin >> s;
	string match_s[16] = { "AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR",
						"AKIHABR","AKIHBRA","AKIHBRA","KIHABRA","KIHBARA","KIHABAR",
						"AKIHBR","KIHABR","KIHBAR","KIHBRA","KIHBR" };
	for (string t : match_s) if (s == t)ans = true;

	if (ans) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))


N = int(input())
S = ["" for i in range(N)]
for i in range(N):
    S[i] = str(input())


print(len(set(S)))





Measured memory_bytes: 37248
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, M;
    scan(N, M);
    writeln((N == M) ? "Yes" : "No");
}


Measured memory_bytes: 256
from fractions import gcd
from functools import reduce
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
Y = reduce(lambda a, b: a * b // gcd(a, b), A)
print(M // (Y // 2) - (M // Y) if all((Y // a) % 2 for a in A) else 0)

Measured memory_bytes: 16236
#include<stdio.h>
int main(void)
{
	long i, n, max, min, sum, data[10000];
	scanf("%ld",&n);
	for(i=0; i<n; i++) scanf("%ld",&data[i]);
	
	max = min = data[0];
	sum=0;
	for(i=0; i<n; i++){ 
		if(max < data[i]) max = data[i];
		if(min > data[i]) min = data[i];
		sum+=data[i];
	}
	
	printf("%ld %ld %ld\n",min, max, sum);
	return 0;
}

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

int N, A, B;

int main()
{
    cin >> N >> A >> B;
    cout << min(N * A, B) << endl;
}

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

using namespace std;

#define int long long
int n;
int a[200010];
int b[200010];

main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    bool ok = true;
    for(int i = 0; i < n; i++){
        if(a[i] != b[i]) ok = false;
    }
    if(ok){
        cout << 0 << endl;
        exit(0);
    }
    int su = 0;
    int mn = INT_MAX;
    for(int i = 0; i < n; i++){
        su += a[i];
        if(a[i] > b[i]) mn = min(mn, b[i]);
    }
    cout << su - mn << endl;
}


Measured memory_bytes: 640
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const ll MOD = 1e9+7;
//}}}

int main(){
  char S[11];
  cin >> S;
  bool ans = true;

  if(S[0] != 'A') ans = false;
  bool f = true;
  int N = strlen(S);
  rep(i, 1, N){
    if(isupper(S[i])){
      if(f && i != 1 && i != N - 1 && S[i] == 'C'){
        f = false;
      }else{
        ans = false;
      }
    }
  }
  if(f) ans = false;

  puts(ans ? "AC" : "WA");
  return 0;
}


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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMinimum(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T> inline bool changeMaximum(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {

    string S;
    cin >> S;
    string ans;
    if (S == "ABC") { ans = "ARC"; }
    if (S == "ARC") { ans = "ABC"; }
    cout << ans << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String text = sc.next();

        char first = '8';
        char second = '8';

        int cntFirst = 0;
        int cntSecond = 0;

        for(char c: text.toCharArray()){
            if(c == first){
                cntFirst++;
            }else if(c == second){
                cntSecond++;
            }else if(first == '8'){
                first = c;
                cntFirst = 1;
            }else if(second == '8'){
                second = c;
                cntSecond = 1;
            }
        }

        if(cntFirst == 2 && cntSecond ==2){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 21588
#include<stdio.h>
#include<stdlib.h>
#define N 100
int main(){
  int A[N],i,j,v,kosuu,k;
  scanf("%d",&kosuu);
  if(kosuu < 1 || kosuu > 100) exit(1);
 for(k = 0;k < kosuu ;k++)
	{
	  scanf("%d",&A[k]);
	  if(0>A[k] || 1000<A[k]) exit(2); 
	}
 for(k=0;k < kosuu-1 ; k++)
	{
	  printf("%d ",A[k]);
	}
      printf("%d\n",A[k]);
  
  for(i = 1;i<kosuu;i++)
    {v = A[i];
      j = i-1;
      while( j>=0 && A[j] > v)
	{
	  A[j+1]=A[j];
	  j--;
	}
      A[j+1] = v;

      for(k=0;k < kosuu-1 ; k++)
	{
	  printf("%d ",A[k]);
	}
      printf("%d\n",A[k]);
    }
  return 0;
}



Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	string s1, s2;
	cin >> s1 >> s2;
	if (s1 > s2) swap(s1, s2);
	int size = 0;
	size = s2[0] - '0';
	for (int i = 0; i < size; i++)
	{
		cout << s1;
	}



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
//#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int mod_pow(int x, int n, int mm) {
    int res = 1;
    while(n > 0) {
        if(n & 1) res = res * x % mm;
        x = x * x % mm;
        n >>= 1;
    }
    return res;
}
int extgcd(int a, int b, int &x, int &y) {
    int d = a;
    if(b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1;
        y = 0;
    }
    return d;
}
int mod_inverse(int a, int mm) {
    int x, y;
    extgcd(a, mm, x, y);
    return (mm + x % mm) % mm;
}
signed main() {
    int K, N;
    cin >> N >> K;
    vector<int> dp(K + 1, 0);
    for(int i = K; i >= 1; i--) {
        int ss = mod_pow((K / i), N, mod) * i % mod;
        int res = ss;
        for(int j = 2; j * i <= K; j++) {
            res = ((res - dp[j * i] * mod_inverse(j, mod)) % mod + mod) % mod;
        }
        dp[i] = res;
    }
    int ans = 0;
    for(int i = 1; i <= K; i++) ans = (ans + dp[i]) % mod;
    cout << (ans % mod + mod) % mod << endl;
}


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

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define each(c,itr) for(auto itr=(c).begin();itr!=(c).end();itr++)

template<class T> void pv(T& a) { for (auto i : a) cout << i << ' '; cout << endl; }

int main() {
  int N;
  int dp[40];

  while(1) {
    cin >> N;
    if (N == 0) break;

    rep(i,40) dp[i] = 0;

    dp[1] = 1;
    dp[2] = 2;
    dp[3] = 4;
    for (int i = 4; i <= N; i++) {
      dp[i] += dp[i-1];
      dp[i] += dp[i-2];
      dp[i] += dp[i-3];
    }

    // pv(dp);
    cout << ceil(dp[N] / 3650.0) << endl;
  }

  return 0;
}

Measured memory_bytes: 1228
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>
#include<stack>
#include<queue>
#include<map>
#include<deque>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
#define Pa pair<ll,ll>
const ll mod=1000000007;
const ll INF=10e12;
const ll inf=-1;
ll ABS(ll a){return max(a,-a);}


int main(void){
    vector<ll> ans(0);
    queue<ll> lunlun;
    rep(i,9) lunlun.push(i+1);
    while(!lunlun.empty()){
        if(lunlun.front()>3234566667){
            lunlun.pop();
            continue;
        }
        ll X=lunlun.front();
        ll sita=X%10;
        rep(i,3){
            ll f=sita+i-1;
            if(f>=0 && f<=9) lunlun.push(X*10+f);
        }
        ans.push_back(X);
        lunlun.pop();
    }
    
    sort(ALLOF(ans));
    ll N;
    cin>>N;
    cout<<ans.at(N-1)<<endl;
    return 0;
}


Measured memory_bytes: 2676
#include <bits/stdc++.h>
using namespace std;
int main(){
  random_device rnd;
  mt19937 mt(rnd());
  int D;
  cin >> D;
  vector<int> c(26);
  for (int i = 0; i < 26; i++){
    cin >> c[i];
  }
  vector<vector<int>> s(D, vector<int>(26));
  for (int i = 0; i < D; i++){
    for (int j = 0; j < 26; j++){
      cin >> s[i][j];
    }
  }
  vector<int> last(26, -1);
  for (int i = 0; i < D; i++){
    vector<pair<int, int>> d(26);
    for (int j = 0; j < 26; j++){
      d[j].first = s[i][j] + c[j] * (i - last[j]);
      d[j].second = j;
    }
    sort(d.begin(), d.end());
    int t = d[__builtin_ctz(mt() + 1)].second;
    cout << t + 1 << endl;
    last[t] = i;
  }
}

Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <stdio.h>
#include <cmath>
#include <map>
#include <deque>
using namespace std;

#define MOD 1000000007
#define ll long long int

int main() {
	int n;
	cin >> n;
	deque<int> q;
	bool toend = true;
	for(int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if(toend) {
			q.push_back(a);
		} else {
			q.push_front(a);
		}
		toend = !toend;
	}
	if(n%2 == 0) {
		for(int i = 0; i < n; i++) {
			cout << q.at(i) << " ";
		}
	} else {
		for(int i = 0; i < n; i++) {
			cout << q.at(n-i-1) << " ";
		}
	}
	return 0;
}



Measured memory_bytes: 2944
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class Pair
{
	public long X { get; private set; }
	public long Y { get; private set; }

	public Pair(long x, long y)
	{
		X = x;
		Y = y;
	}
}


public class D
{
	public static void Main()
	{
		string[] args;
		
		args = Console.ReadLine().Split(' ');
		int N = Int32.Parse(args[0]);
		int K = Int32.Parse(args[1]);

		List<Pair> pairs = new List<Pair>(N);
		List<long> xRank = new List<long>(N);
		List<long> yRank = new List<long>(N);
		for(int i = 0; i < N; i++)
		{
			args = Console.ReadLine().Split(' ');
			long x = Int64.Parse(args[0]);
			long y = Int64.Parse(args[1]);
			pairs.Add(new Pair(x,y));
			xRank.Add(x);
			yRank.Add(y);
		}
		xRank.Sort();
		yRank.Sort();

		int[,] plot = new int[N+1,N+1];
		foreach(Pair pair in pairs)
		{
			int ix = xRank.BinarySearch(pair.X) + 1;
			int iy = yRank.BinarySearch(pair.Y) + 1;
			plot[ix,iy] = 1;
		}			

		int[,] csum = new int[N+1,N+1];
		for(int iy = 1; iy <= N; iy++)
			for(int ix = 1; ix <= N; ix++)
				csum[ix,iy] += csum[ix-1,iy] + plot[ix,iy];

		for(int iy = 1; iy <= N; iy++)
			for(int ix = 1; ix <= N; ix++)
				csum[ix,iy] += csum[ix,iy-1];

		long minArea = Int64.MaxValue;
		for(int ilx = 1; ilx <= N - 1; ilx++)
		{
			long lx = xRank[ilx - 1];
			for(int irx = ilx + 1; irx <= N; irx++)
			{
				long rx = xRank[irx - 1];
				for(int idy = 1; idy <= N - 1; idy++)
				{
					long dy = yRank[idy - 1];
					for(int iuy = idy + 1; iuy <= N; iuy++)
					{
						long uy = yRank[iuy - 1];
						int numVertices = 
							csum[irx,iuy] + csum[ilx-1, idy-1] - 
							csum[ilx-1,iuy] - csum[irx,idy-1];
						if(numVertices < K)
							continue;

						long area = (rx - lx) * (uy - dy);
						minArea = Math.Min(minArea, area);
					}
				}
			}
		}

		Console.WriteLine(minArea);
	}
}





Measured memory_bytes: 13396
from collections import deque

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def main():

    N = int(input())
    fact = factorization(N)
    ans = 0

    if N == 1:
        print(0)
        return

    kasuus = [f[0] for f in fact]
    sisuus = [f[1] for f in fact]
    ks = deque(kasuus)
    ss = deque(sisuus)

    while ss:
        sisuu = ss.popleft()
        cnt = 1
        while True:
            sisuu -= cnt
            if sisuu < 0:
                break
            else:
                ans += 1
                cnt += 1

    print(ans)

    


if __name__ == "__main__":
    main()

Measured memory_bytes: 9736
n,k = map(int,input().split())

sc=list(map(int,input().split()))
c=[]
t=[]

for i in range(n):
  c.append((1+sc[i])/2)
t.append(0.0)
for i in range(n):
  t.append(c[i]+t[i])
total = 0
for i in range(n-k+1):
  #print(t[i+k] - t[i])
  if total < t[i+k] - t[i]:
    total = t[i+k] - t[i]
print(total)

Measured memory_bytes: 24804
function Main(input: string) {
  const lines = input.split('\n');
  const params1 = lines[0].split(' ');
  const params2 = lines[1].split(' ');

  const n = parseInt(params1[0]);
  const s = params2[0];

  let cnts: number[] = [s.slice(1).split('').filter(x => x === 'E').length];
  for (let i = 1; i < n; i++) {
    let tmp = cnts[i - 1];
    const prev = s[i - 1];
    const cur = s[i];
    if (prev === 'W') tmp++;
    if (cur === 'E') tmp--;
    cnts.push(tmp);
  }

  const min = cnts.reduce((m, n) => Math.min(m, n));

  console.log(min);
}

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

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

int main() {
  int N, x, a, b, c;

  cin >> N ;
  
  a = (N / 100);
  b = (N % 100)/10;
  c = (N % 10);


  x = a + b + c;
  
  cout << x << endl; 

}

Measured memory_bytes: 256
#include <iostream>
#define str_length 10

int main(void)
{
    int a;
    char str[str_length];
    //整数の入力
    std::cin>>a;
    //文字列の入力
    std::cin>>str;

    if ( a > 3199 ){
    
        std::cout << str << std::endl;
        return 0;
    }
    std::cout << "red" << std::endl;
    return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()

const double pi = acos(-1.0);

int main(){
    while(1){
        double n; cin >> n;
        if(n == 0)break;

        double m2 = 0, m = 0;
        rep(i,n){
            double s;
            cin >> s;
            m += s;
            m2 += s*s;
        }

        m /= n;
        m2 /= n;

        printf("%.10f\n", sqrt(m2-m*m));
    }
    return 0;
}


Measured memory_bytes: 3284
#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; }
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
#define MAX 100000
vector<vector<int>>edge(MAX);
bool visited[MAX];
int prenum[MAX],parent[MAX],lowest[MAX],timer;
int N;
void dfs(int current,int prev){
    prenum[current]=lowest[current]=timer;
    timer++;
    visited[current]=true;
    int  next;
    for(int i=0;i<edge[current].size();i++){
        next=edge[current][i];
        if(!visited[next]){
            parent[next]=current;
            dfs(next,current);
            lowest[current]=min(lowest[current],lowest[next]);
        }else if(next != prev){
            lowest[current] = min(lowest[current],prenum[next]);
        }
    }
}
void art_point(){
    timer=1;
    dfs(0,-1);
    map<int,int>Mp;
    int np=0;
    for(int i=1;i<N;i++){
        int p=parent[i];
        if(p==0)np++;
        else if(prenum[p]<=lowest[i])Mp[p]++;
        if(np>1)Mp[0]++;
    }
        for(auto itr:Mp)
            cout<<itr.first<<endl;
    
}
signed main(){
    int m;
    cin>>N>>m;
    edge.resize(N);
    rep(i,N)visited[i]=false;
    for(int i=0;i<m;i++){
        int s,t;
        cin>>s>>t;
        edge[s].push_back(t);
        edge[t].push_back(s);
    }
    art_point();
}

Measured memory_bytes: 6480
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
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; }

ll MOD = 1000000007;
ll INF =1<<30;


int main(){
    int n;
    cin >> n;
    vector<int> d(100000,0);
    for(int i = 1;i<=100;i++){
        for(int j = 1;j<=100;j++){
            for(int k = 1;k<=100;k++){
                d[i*i+j*j+k*k+i*j+j*k+k*i]++;
            }
        }
    }
    rep(i,n){
        cout << d[i+1] <<endl;
    }
}


Measured memory_bytes: 3780
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>

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

	std::cin>>a>>b>>c;

	if(a+b+c>=22)
		std::cout<<"bust"<<std::endl;
	else
		std::cout<<"win"<<std::endl;

	return 0;
}

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

#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0)

bool mycomp(int a, int b) {
  return a > b;
}
int main() {
  FASTIO;
  int n, m;
  cin >> n >> m;
  vector<int> v(n);
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    sum += v[i];
  }
  int wtf = 0;
  sort(v.begin(), v.end(), mycomp);
  for (int i = 0; i < n; i++) {
    if (v[i] / (double)sum >= 1 / (double)(4*m)) 
      wtf++;
  }
  if (wtf >= m)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}

Measured memory_bytes: 256
//is there any case of -1 or any special corner cases ?
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  = 3*1e5 , limit = 9*1e18 , MOD=1e9+7;
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int pow (int x, int n,int mod) {if (n == 0) return 1; int res = pow (x, n / 2,mod);res = (res * res) % mod;if (n % 2) res = (res * x ) % mod;return res;}
#define endl '\n';
int32_t main(){
    boost;
    int n;
    cin>>n;
    vector<int>v;
    vector<int>v1;
    for(int i =0 ;i < n ; i++ ){
        int x,y;
        cin>>x>>y;
        v.pb(x+y);
        v1.pb(x-y);
    }
    sort(all(v));
    sort(all(v1));
    int ans=0;
    ans  =  max({ans , abs(v[0]-v[n-1]) , abs(v1[0]- v1[n-1])});
    cout<<ans<<endl;
}

Measured memory_bytes: 6688
# -*- coding: utf-8 -*-

[C11, C12, C13] = [int(i) for i in input().split()]
[C21, C22, C23] = [int(i) for i in input().split()]
[C31, C32, C33] = [int(i) for i in input().split()]

b1 = C11
b2 = C12
b3 = C13

# a2が存在する？
flag_a2 = False
if (C21 - b1) == (C22 - b2) and (C21 - b1) == (C23 - b3):
    flag_a2 = True

# a3が存在する？
flag_a3 = False
if (C31 - b1) == (C32 - b2) and (C31 - b1) == (C33 - b3):
    flag_a3 = True

if flag_a2 is True and flag_a3 is True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const long long mo=1e9+7;
int n,x,y,z,hk,sum;
long long ans,dp[45][1<<18];
int main(){
	scanf("%d%d%d%d",&n,&x,&y,&z);
	memset(dp,0,sizeof dp);
	hk=1<<x+y+z-1;
    hk|=1<<y+z-1;
    hk|=1<<z-1;
	sum=(1<<x+y+z)-1;
	dp[0][0]=1; ans=1;
	for(int i=1;i<=n;i++){
		ans=ans*10%mo;
		for(int j=0;j<=sum;j++){
		  if(dp[i-1][j]==0) continue;
		  for(int k=1;k<=10;k++){
		  	int now=(j<<k)|(1<<k-1); 
			now&=sum;// avoid"now"boom
		  	if((now&hk)!=hk) 
			  dp[i][now]=(dp[i][now]+dp[i-1][j])%mo;
		  }
		}
	}
	for(int j=0;j<=sum;j++) ans=(ans-dp[n][j]+mo)%mo;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 92416
#include<iostream>

int main(){
	int n, m, k;
	std::cin >> n >> m >> k;
	

	int dp[n + 1][m + 1];
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			dp[i][j] = 0;
		}
	}

	for(int i = 0; i < n; i++){
		dp[i + 1][0] = dp[i][0] + m;
		for(int j = 0; j < m; j++){
			
			dp[i][j + 1] = dp[i][j] + n - i * 2;
		}
	}	

	bool ans = false;
	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= m; j++){
			//std::cerr << "i = " << i << ",j = " << j << "=>" << dp[i][j] << " ";
			if(dp[i][j] == k)ans = true;
		}
		//std::cerr << std::endl;
	}

	std::cout << (ans ? "Yes" : "No") << std::endl;

}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int main(){
    string o,e;
    cin>>o>>e;
    for (int i = 0; i < e.size(); i++)
    {  
        cout<<o[i]<<e[i];
    }
    if(o.size()==e.size()) cout<<endl;
    else {
        cout<<o.back()<<endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cstring>
using namespace std;

int N, to[100010], dist[100010];
typedef pair<int, int> pii;
const int INF = 1 << 25;

struct UnionFind {
    int node[100010], edge_cnt[100010];
    UnionFind() {
        memset(node, -1, sizeof(node));
        memset(edge_cnt, 0, sizeof(edge_cnt));
    }
    int find(int x) {return node[x] < 0 ? x : node[x] = find(node[x]);}
    int size(int x) {return -node[find(x)];}
    void unite(int x, int y) {
        x = find(x), y = find(y);
        if(size(x) > size(y)) swap(x, y);
        edge_cnt[y]++;
        if(x == y) return;

        // x を y に統合
        node[y] += node[x];
        node[x] = y;
        edge_cnt[y] += edge_cnt[x];
    }
    int edge(int x) {return edge_cnt[find(x)];}
};

UnionFind uf;
int main() {
    scanf("%d", &N);
    for(int i=0; i<N; i++) {
        scanf("%d", &to[i]);
        if(to[i] != 0) uf.unite(i, i+to[i]);
    }
    for(int i=0; i<N; i++) {
        dist[i] = INF;
        if(uf.size(i) <= uf.edge(i)) {
            to[i] = INF;
        }
        // printf("operate: %d, size = %d\n", to[i], uf.size(i));
    }

    dist[0] = 0;
    priority_queue< pii, vector<pii>, greater<pii> > que;
    que.push(make_pair(0, 0));

    while(que.size()) {
        pii cur = que.top(); que.pop();
        int pos = cur.second, cost = cur.first;

        if(pos == N-1) {
            printf("%d\n", dist[pos]);
            return 0;
        }

        if(to[pos] == 0) {
            for(int k=1; k<=6; k++) {
                int npos = min(pos + k, N-1);
                if(to[npos] == INF) continue;
                if(dist[npos] > dist[pos] + 1) {
                    dist[npos] = dist[pos] + 1;
                    que.push(make_pair(dist[npos], npos));
                }
            }
        }
        else {
            int npos = to[pos] + pos;
            if(dist[npos] > dist[pos]) {
                dist[npos] = dist[pos];
                que.push(make_pair(dist[npos], npos));
            }
        }
    }
    return 0;
}


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

int main()
{
  int N;
  cin >> N;
  vector<int64_t> d(3);
  for (int i = 0; i < 3; i++)
  {
    cin >> d.at(i);
  }
  vector<pair<int, int>> vp;
  char c1, c2;
  for (int i = 0; i < N; i++)
  {
    cin >> c1 >> c2;
    vp.emplace_back((int)(c1 - 'A'), (int)(c2 - 'A'));
  }
  vector<char> ans;
  auto add = [&](int a, int b) {
    d[a]++, d[b]--;
    ans.push_back((char)(a + 'A'));
  };
  vp.emplace_back(0, 1);
  for (int i = 0; i < N; i++)
  {
    int a, b;
    tie(a, b) = vp[i];
    if (!d[a] && !d[b])
    {
      cout << "No" << endl;
      return 0;
    }
    if (!d[a])
    {
      add(a, b);
    }
    else if (!d[b])
    {
      add(b, a);
    }
    else
    {
      int na, nb;
      tie(na, nb) = vp[i + 1];
      if (a == na || a == nb)
      {
        add(a, b);
      }
      else
      {
        add(b, a);
      }
    }
  }
  cout << "Yes" << endl;
  for (char c : ans)
  {
    cout << c << endl;
  }
}

Measured memory_bytes: 4292
import collections

n = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

li = {}

for i in range(2, n+1):

    c = collections.Counter(prime_factorize(i))
    keys = list(c.keys())
    values = list(c.values())
    for i in range(len(keys)):
        if keys[i] in li:
            li[keys[i]] += values[i]
        else:
            li[keys[i]] = values[i]

ans = list(li.values())
ans = [i+1 for i in ans]

count = 1
mod = (10**9) + 7
for i in ans:
    count = count * i % mod
print(count)

Measured memory_bytes: 3316
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)


map<ll,int> prime_factorization(ll n){
	map<ll,int> ret;
	
	for(ll div=2;div<=1+sqrt(n);div++){
		while(n%div==0){
			ret[div]++;
			n/=div;
		}
	}
	if(n!=1)ret[n]++;
	return ret;
}

int main(){
	ll n;
	while(cin>>n&&n){
		map<ll,int> mp = prime_factorization(n);
		int m = mp.size();
		vector<int> num;
		for(auto &elm:mp) num.pb(elm.second);
		int c=0;
		ll ans = 0;
		rep(i,1<<m){
			rep(j,1<<m){
				if( (i|j) != ((1<<m)-1) )continue;
				if(i==j){
					ans+=2;
					continue;
				}
				ll tmp = 1;
				rep(k,m){
					if( (i&(1<<k))==0 )tmp*=num[k];
					if( (j&(1<<k))==0 )tmp*=num[k];
				}
				ans+=tmp;
			}
		}
		cout<<ans/2<<endl;
	}
}

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

public class Main {
	public static void main (String [] args) {
		new Main().execute();
	}
	
	public void execute() {
		Scanner scanner = new Scanner(System.in);
		final int N = scanner.nextInt();
		final int MOD = 1000000007;
		int count = 0;
		
		int [] reports = new int[N];
		
		for (int i =0;i<N;i++) {
			reports[i] = scanner.nextInt();
		}
		Arrays.sort(reports);
		
		if(!validateReport(reports)) {
			System.out.println(count);
			scanner.close();
			return;
		}
		
		int ptn;
		count = 1;
		if( N>=2 && N%2 ==0) {
			 ptn = reports[reports.length-1] / 2 + 1;
		}else {
			 ptn = reports[reports.length-1] / 2 ; 
		}
		for (int i=0; i< ptn; i++) {
			count = (count *2) % MOD;
		}
		
		System.out.println(count);
		scanner.close();
		
	}
	
	private boolean validateReport(int [] rep) {
		int n = rep.length;
		
		if( n%2 ==0) {
			int val = 1;
			for ( int i = 0; i<rep.length; i++) {
				if(i>0 && i%2 ==0) {
					val +=2;
				}
				if(rep[i] != val) {
					return false;
				}
			}
		}
		else {
			int val = 0;
			for ( int i = 0; i<rep.length; i++) {
				if(i%2 !=0) {
					val +=2;
				}
				if(rep[i] != val) {
					return false;
				}
			}
		}
		return true;
	}
	
}


Measured memory_bytes: 51116
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
  int ans = 0;
  int bmax = -1;
  for (int i=0; i<3; i++) {
    int a; cin>>a;
    ans += a;
    bmax = max(bmax,a);
  }

  cout << ans - bmax << endl;
}

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

long long int gcd(long long int a,long long int b){
  if (b>a){
    int r;
    r=a;
    a=b;
    b=r;
  }
  if (b==0) return a;
  if (a%b==0) return b;
  return gcd(b,a%b);
}

int main(){
  int N;
  cin >> N;
  long long int A[N];
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  long long int L[N+2];
  long long int R[N+2];
  L[0]=0;
  R[N+1]=0;
  for(int i=1;i<N+1;i++){
    L[i]=gcd(L[i-1],A[i-1]);
    //cout << L[i] << " ";
  }
  for(int i=N;i>0;i--){
    R[i]=gcd(A[i-1],R[i+1]);
    //cout << R[i] << " ";
  }
  long long int max=0;
  for(int i=1;i<=N;i++){
    if (gcd(L[i-1],R[i+1])>max){
      max=gcd(L[i-1],R[i+1]);
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main()
{
	int A,B,C;
	cin>>A>>B>>C;
	if(A==B)
		if(C!=A)
			cout<<"Yes";
		else
			cout<<"No";
	else if(A==C)
		cout<<"Yes";
	else if(B==C)
		cout<<"Yes";
	else
		cout<<"No";	
	return 0; 
} 

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

using namespace std;

int getIndex(int* arr, int index) {
  if ((arr[index - 1] >= arr[index]) && (arr[index - 1] >= arr[index + 1])) {
    return index - 1;
  }
  return arr[index] >= arr[index + 1] ? index : index + 1;
}

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

  int city[n + 1];
  long sum = 0;
  int saver[n];

  for (int i = 0; i < n + 1; ++i) {
    int a;
    scanf("%d", &a);
    city[i] = a;
    sum += a;
  }
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    saver[i] = a;
  }

  for (int i = 0; i < n; ++i) {
    int current_saver = saver[i];
    int current_city = city[i];
    int next_city = city[i + 1];

    if (current_saver >= current_city) {
      city[i] = 0;
      city[i + 1] = max(next_city - (current_saver - current_city), 0);
    } else {
      city[i] = current_city - current_saver;
    }
  }

  long cnt = 0;
  for (int i = 0; i < n + 1; ++i) {
    cnt += city[i];
  }
  printf("%ld\n", sum - cnt);

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define fi first
#define se second
#define For(type, i, a, b) for (type i = (a); i <= (b); ++i)
#define Ford(type, i, a, b) for (type i = (a); i >= (b); --i)
#define Rep(type, i, a, b) for (type i = (a); i < (b); ++i)
#define Repd(type, i, a, b) for(type i = (a); i > (b); --i)
#define endl '\n'
using namespace std;

typedef long long ll;
typedef pair<ll, ll> ii;

const ll maxN = 1e18;
const ll minN = -1e18;
const ll MOD = 1e9 + 7;

const ll limit = 1e3 + 5;
const ll limit1 = 1e4 + 5;
const ll limit2 = 2e5 + 5;
const ll limit3 = 1e6 + 5;


ll test;
ll n, m, k, x, y, z, u, v;
ll res = 0, sum = 0, ans = 0, kd, hkd, answer;
bool ok = false;
ll a[limit3], b[limit3], c[limit3], dp[limit3];
string s;
void FastIn(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void ReadIn(){

    cin >> n >> k;
    For(ll, i, 1, n)
        cin >> a[i];

    dp[1] = 0;

    For(ll, i, 2, n){
        ans = 1e18;
        For(ll, j, 1, k){
            if(i - j >= 1){
            x = abs(a[i - j] - a[i]) + dp[i - j];
            ans = min(ans, x);
            }
        }
        dp[i] = ans;
    }
    cout << dp[n];
}

int main(){
    FastIn();
    ReadIn();
}



Measured memory_bytes: 5164
H, W, A, B = map(int, open(0).read().split())
MOD = 10**9+7

factorials = [1] * (H + W + 1)
inv_factorials = [1] * (H + W + 1)

for i in range(H + W):
    factorials[i+1] = factorials[i] * (i + 1) % MOD

inv_factorials = list(map(lambda n: pow(n, MOD - 2, MOD), factorials))

def modcomb(m, n, mod):
    return factorials[m] * inv_factorials[n] * inv_factorials[m - n] % MOD
 
total = modcomb(H + W - 2, W - 1, MOD)
 
for i in range(B):
    total -= modcomb(H - A - 1 + i, i, MOD) * modcomb(A - 1 + W - 1 - i, W - 1 - i, MOD)
    total %= MOD
 
print(total)

Measured memory_bytes: 91404
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
n = int(input())
ans = num2alpha(n)
print(ans.lower())

Measured memory_bytes: 61792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;



int main() {
	vector<int> table;
	int n;
	while(cin >> n, n) {
		table.clear();
		int cnt=0;
		for(int i=1; i<=n/2+1; i++) {
			for(int j=0; j<table.size(); j++) {
				table[j] = table[j] + i;
				if(table[j] >= n) {
					if(table[j] == n)
						cnt++;
					table.erase(table.begin() + j);
					j--;
				}
			}
			table.push_back(i);
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
read N
read W
W=($W)

sum=$(printf "%s\n" ${W[@]} | awk '{sum+=$1} END {print sum}')
arr=()

for ((i=0; i<$N; i++)); do
    left=${W[@]:0:$i}
    X=$(printf "%s\n" ${left[@]} | awk '{sum+=$1} END {print sum}')
    Y=$((sum-X))
    
    if [ $X -gt $Y ]; then
        V=$((X-Y))
    else
        V=$((Y-X))
    fi
    arr+=($V)
done

printf "%s\n" ${arr[@]} | sort -n | head -n 1


Measured memory_bytes: 2724
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, k;
	string s;

	cin >> n >> k >> s;

	vector<ll> v;
	ll cnt = 0;
	s = s + "#";

	REP(i, s.size() - 1) {
		cnt++;
		if (s[i] != s[i + 1]) {
			if (s[i] == '1') {
				v.push_back(-cnt);
			}
			else {
				v.push_back(cnt);
			}
			cnt = 0;
		}
	}

	ll nowl = 0;
	ll nowr = 0;
	ll ans = 0;
	ll sum = 0;
	cnt = 0;

	while (nowr < v.size()) {
		if (v[nowr] < 0) {
			sum += -v[nowr];
		}
		else {
			cnt++;
			sum += v[nowr];
		}
		if (cnt > k) {
			sum -= v[nowr];
			ans = max(ans, sum);
			if (v[nowl] < 0) {
				sum += v[nowl];
				sum -= v[nowl + 1];
				nowl += 2;
			}
			else {
				sum -= v[nowl];
				nowl++;
			}
			cnt--;
			sum += v[nowr];
		}
		nowr++;
	}
	
	cout << max(ans, sum) << endl;
}

Measured memory_bytes: 1524
from sys import stdin

def main():

    input = stdin.readline

    K = int(input())
    A,B = map(int,input().split())

    for i in range(A,B+1):
        if i % K == 0:
            print("OK")
            return 0
    else:
        print("NG")

    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9180