akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
  int n,k;
  ll ans = 0;
  cin >> n >> k;
  vector<ll> h(n+k);

  rep(i,n) cin >> h[i];
  sort(h.begin(),h.end(),greater<ll>());
  rep(i,k) h[i] = 0;
  rep(i,n) ans += h[i];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
import sys


def input():
    return sys.stdin.readline()[:-1]

# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}


a=int(input())
if a==1:
    print("Hello World")
else:
    b=int(input())
    c=int(input())
    print(b+c)

Measured memory_bytes: 2940
def end():
    print('No')
    exit()

n = int(input())
t, x, y = [0]*n, [0]*n, [0]*n
for i in range(n):
    t[i], x[i], y[i] = map(int, input().split())

temp = abs(x[0]) + abs(y[0])
if t[0] % 2 == temp % 2:
    if t[0] < temp:
        end()
else:
    end()

for i in range(1, n):
    temp = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if (t[i]-t[i-1]) % 2 == temp % 2:
        if t[i]-t[i-1] < temp:
            end()
    else:
        end()

print('Yes')

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

void check(int);

int _5_count = 2, _7_count = 1;

int main() {

	int A, B, C;
	cin >> A >> B >> C;
	check(A);
	check(B);
	check(C);

	if(_5_count == 0 && _7_count == 0) {
		cout << "YES";
	}else {
		cout << "NO";
	}

	return 0;

}

void check(int input) {
	if (input == 5) {
		_5_count -= 1;
	}else if (input == 7) {
		_7_count -= 1;
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var nm = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var s1 = nm[0] * (nm[0] - 1) / 2;
        var s2 = nm[1] * (nm[1] - 1) / 2;
        Console.WriteLine(s1 + s2);
    }
}

Measured memory_bytes: 11348
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var N = input[0];
            var Z = input[1];
            var W = input[2];
            var a = ReadArrayInt();
            var ans = 0;
            if (N == 1) ans = Math.Abs(a[0] - W);
            else ans = Math.Max(Math.Abs(a[N - 1] - W), Math.Abs(a[N - 2] - a[N - 1]));

            Console.WriteLine(ans);
            Console.ReadLine();
        }        

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}


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

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

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) printf(f,##__VA_ARGS__),fflush(stdout)

typedef long long ll;

const int N=233,P=2333;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }

ll q,h,s,d,n,ans;

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("dat.in","r",stdin);
	freopen("my.out","w",stdout);
#endif
	cin>>q>>h>>s>>d>>n;
	cmin(h,2*q);
	cmin(s,2*h);
	cmin(d,2*s);
	ans=n/2*d+n%2*s;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
A,B,C,D = list(input())
#print(A,B,C,D)

for i in range(2**3):
  argo = ["-","-","-"]
  
  for j in range(3):
    if i>>j & 1:
      argo[3-1-j] = "+"
  #print(argo)
  
  if eval(str(A)+argo[0]+str(B)+argo[1]+str(C)+argo[2]+str(D)) == 7:
    print(str(A)+argo[0]+str(B)+argo[1]+str(C)+argo[2]+str(D)+"=7")
    break

Measured memory_bytes: 61904
// header {{{
using namespace std;

// C++
#include <algorithm>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <streambuf>
#include <string>
#include <utility>
#include <vector>

#pragma GCC optimization_level 3

// util {{{
#define print(x)	        cout << (x)
#define printvec(x,y)       for(int i = 0;i < (y);i++)cout << (x).at(i) << " ";cout << endl
#define println(x)	        cout << (x) << endl
#define printn		        cout << endl
#define read(x)	            cin >> (x)
#define readvec(x,y)        for(int i = 0; i < (y);i++)cin >> (x).at(i)

#define rep(i, n)	        for(int i = 0; i < (int)(n); i++)
#define rep_1(i, n) 	    for(int i = 1; i <=(int)(n); i++)

#define all(x) 		        (x).begin(),(x).end()
#define vint                vector<int>
#define outif(x,y,z)        if(x) cout<<(y)<<endl; else cout<<(z)<<endl
#define loop 		        while(true)

// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

void solve() {
    int a,b;
    read(a);
    read(b);
    print(a*b);
    print(" ");
    println(2 * a + 2 * b);
}

signed main() {
    solve();
    return 0;
}



Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define int long long
#define double long double
#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,sse")
using namespace std;

bool comp(int a, int b) {
    return abs(a) > abs(b);
}

const int MOD = 1e9 + 7;
const double EPS = 1e-9;

bool can(int a, int b, int k) {
    if (b % 2) {
        b--;
    }
    if (k % 2) {
        return a + b >= k && a > 0;
    } else {
        return a + b >= k;
    }
}

int n, k;
vector<int> arr;
vector<double> pa;
vector<double> pb;
vector<int> ra;
vector<int> rb;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> k;
    arr.resize(n);
    int a = 0;
    int b = 0;
    int z = 0;
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        if (arr[i] > 0) {
            a++;
        } else if (arr[i] < 0) {
            b++;
        } else {
            z++;
        }
    }
    sort(arr.begin(), arr.end(), comp);
    if (can(a, b, k)) {
        pa.push_back(0);
        pb.push_back(0);
        ra.push_back(1);
        rb.push_back(1);
        for (int x : arr) {
            if (x > 0) {
                pa.push_back(pa.back() + log(x));
                ra.push_back((ra.back() * x) % MOD);
            } else if (x < 0) {
                pb.push_back(pb.back() + log(-x));
                rb.push_back((rb.back() * -x) % MOD);
            }
        }
        double fin = -1;
        int ans = INT_MIN;
        for (int i = 0; i <= k; i += 2) {
            if (i < pb.size() && k - i < pa.size()) {
                if (pb[i] + pa[k - i] > fin) {
                    fin = pb[i] + pa[k - i];
                    ans = (rb[i] * ra[k - i]) % MOD;
                }
            }
        }
        cout << ans << '\n';
    } else if (z > 0) {
        cout << 0 << '\n';
    } else {
        int res = 1;
        for (int i = n - 1; i >= n - k; i--) {
            res = (((res * arr[i]) % MOD) + MOD) % MOD;
        }
        cout << res << '\n';
    }

    fflush(stdout);
    return 0;
}


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

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        if (a >= k) {
                cout << k << endl;
        } else if (a + b >= k) {
                cout << a << endl;
        } else {
                cout << a - (k - a - b) << endl;
        }

        return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(){
  int n, a, b, c;
  int l[8];
  cin >> n >> a >> b >> c;
  for(int i = 0;i < n;i++){
    cin >> l[i];
  }
  int dp[2][256];
  int dp2[256];
  int lo, mp;
  for(int i = 1;i < (1 << n);i++){
    lo = 0;
    mp = 0;
    for(int j = 0;j < n;j++){
      if(i & (1 << j)){
        lo += l[j];
        mp += 10;
      }
    }
    mp -= 10;
    mp += abs(lo - a);
    dp[0][i] = mp;
  }
  for(int i = 1;i < (1 << n);i++){
    lo = 0;
    mp = 0;
    for(int j = 0;j < n;j++){
      if(i & (1 << j)){
        lo += l[j];
        mp += 10;
      }
    }
    mp -= 10;
    mp += abs(lo - b);
    dp[1][i] = mp;
  }
  int mi = 100000000;
  for(int i = 1;i < (1 << n);i++){
    mi = 100000000;
    lo = 0;
    mp = 0;
    for(int j = 1;j < (1 << n);j++){
      if((j | i) == i && (j != i)){
        mi = min(mi, dp[1][j] + dp[0][i - j]);
      }
    }
    dp2[i] = mi;
  }
  int ans = 100000000;
  for(int i = 1;i < (1 << n);i++){
    lo = 0;
    mp = 0;
    for(int j = 0;j < n;j++){
      if(i & (1 << j)){
        lo += l[j];
        mp += 10;
      }
    }
    mp -= 10;
    mp += abs(lo - c);
    for(int j = 1;j < (1 << n);j++){
      if(!(j & i)){
        ans = min(ans, mp + dp2[j]);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// ABC170
function main(input) {
  var inputs = input.trim().split('\n');
  var N = parseInt(inputs[0], 10);
  var A = typeof(inputs[1]) !== 'undefined' ? inputs[1].split(' ').map(n => parseInt(n, 10)) : [];

  var full = [];
  for (var i = 0; i < 1000001; i++) {
    full.push(0);
  }

  for (var i = 0; i < N; i++) {
    if (full[A[i]] > 1) continue;

    loop = 1;
    while (true) {
      var temp = loop * A[i];
      if (temp > 1000001) {
        break;
      } else {
        if (full[temp] > 1) {
          loop += 1;
          continue;
        } else {
          full[temp] += 1;
          loop += 1;
        }
      }
    }
  }

  var counter = 0;
  for (var n = 0; n < N; n++) {
    if (full[A[n]] === 1) counter += 1;
  }

  console.log(counter);
}

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

Measured memory_bytes: 85752
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        while(in.hasNext()){
        int H = in.nextInt();
        int W = in.nextInt();
        if(H==0&&W==0){
            break;
        }
        for(int i = 0; i<H ; i++){
            for(int j = 0; j<W ; j++){
                if((i==0||j==0)||(i==H-1||j==W-1)){
                    System.out.print("#");
                }else{
                    System.out.print(".");
                    }
                        }
                    System.out.println();
                            }
                        System.out.println();
                }
            }
        }




Measured memory_bytes: 33852
#include <iostream>
using namespace std;
int main(void){
    int n, d, x[10][10], ans = 0;
    cin >> n >> d;
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin >> x[i][j];
        }
    }
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            int s = 0;
            for(int k=0;k<d;k++){
                s += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            for(int k=0;k*k<=s;k++){
                if(s == k*k){
                    ans++;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n;
  long long int fib1,fib2,fib3;
  cin>>n;
  fib1=1;
  fib2=1;
  if(n==0){
    cout<<0<<endl;
  }else if(n==1){
    cout<<1<<endl;
  }else if(n>=2){
    for(int i=0;i<n-1;i++){
      fib3=fib1+fib2;
      fib1=fib2;
      fib2=fib3;
    }
    cout<<fib3<<endl;
  }
}

Measured memory_bytes: 3088
#include<iostream>
#include<vector>
using namespace std;
typedef long long int64;
struct Hash
{
	int n;
	static const int64 moda=1000000007ll,modb=2147483647ll;
	vector<int64> a,b,p,q;
	Hash(const string &s):n(s.size()),a(n+1,0),b(n+1,0),p(n+1,1),q(n+1,1)
	{
		for(int i=0;i<n;i++)
		{
			a[i+1]=(a[i]*17+s[i])%moda;
			b[i+1]=(b[i]*19+s[i])%modb;
			p[i+1]=p[i]*17%moda;
			q[i+1]=q[i]*19%modb;
		}
	}
	pair<int64,int64> query(int l,int r){return make_pair((p[r-l]*a[l]-a[r]+moda)%moda,(q[r-l]*b[l]-b[r]+modb)%modb);}
};
int64 cnt[300000][33];
vector<int64> add(vector<int64> a,vector<int64> b)
{
	for(int i=0;i<26;i++)a[i]+=b[i];
	return a;
}
pair<vector<int64>,int64> f(int64 n,int64 l,vector<int64> left,int64 r,vector<int64> right)
{
	vector<int64> ans(26);
	if(l+r<=n)
	{
		int64 tot=l+r;
		vector<int64> sum=add(left,right);
		auto x=f(n,tot,sum,l,left);
		ans=add(ans,x.first);
		n=x.second;
	}
	if(l<=n)
	{
		ans=add(ans,left);
		n-=l;
	}
	return make_pair(ans,n);
}
int main()
{
	string s;
	int64 l,r,k=0;
	cin>>s>>l>>r;
	s=s.substr(0,s.size()>>1);l--;
	int64 n=s.size();
	Hash h(s);
	for(int i=0;i<n;i++)
		if(h.query(0,i)==h.query(n-i,n))k=i;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<26;j++)cnt[i+1][j]=cnt[i][j];
		cnt[i+1][s[i]-'a']++;
	}
	if(!k)
	{
		for(int i=0;i<26;i++)
		{
			cout<<cnt[n][i]*(r/n)+cnt[r%n][i]-cnt[n][i]*(l/n)-cnt[l%n][i];
			if(i==25)cout<<endl;
			else cout<<' ';
		}
		return 0;
	}
	vector<int64> left(26,0),right(26,0);
	for(int i=0;i<26;i++)
	{
		left[i]=cnt[n-k][i];
		right[i]=cnt[n][i]-cnt[n-k][i];
	}
	auto lower=f(l,n-k,left,k,right),upper=f(r,n-k,left,k,right);
	for(int i=0;i<26;i++)
	{
		cout<<upper.first[i]+cnt[upper.second][i]-lower.first[i]-cnt[lower.second][i];
		if(i==25)cout<<endl;
		else cout<<' ';
	}
	return 0;
}

Measured memory_bytes: 30384
# たてH cm よこ W cm の長方形を描くプログラムを作成して下さい。
# 1 cm × 1cm の長方形を '#'で表します。

while True:
    H, W = map(int, input().split())
    if H==0 and W==0:
        break
    for _ in range(H):
        print(f'{"#"*W}')
    print('')



Measured memory_bytes: 5620
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 

int a[2000005];
vi marks;
 
int32_t main()
{
    fast;
    int n, k; cin >> n >> k;
    Rep(i, 1, n) cin >> a[i];
   Rep(i, k+1, n) {
       if(a[i] > a[i-k]) cout << "Yes\n";
       else cout << "No\n";
   }



   

    
    
    
    return 0;
}

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

int main() {
    int A,B;
    cin>>A>>B;
    for(int i=1;i<=10000000;i++)
    {
        int tmp=i*8,tmp2=i*10;
        tmp/=100; tmp2/=100;
        if(tmp==A && tmp2==B)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
	return 0;
}


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

int main() {
  int n; std::cin >> n;
  
  std::map<int, int> d;
  while (n--) {
    int a; std::cin >> a;
    d[a]++;
  }
  bool ok = true;
  for (std::map<int,int>::iterator itr = d.begin(); itr != d.end(); ++itr) {
    if (itr->second != 1) ok = false;
  }
  if (ok) std::cout << "YES" << std::endl;
  else std::cout << "NO" << std::endl;
  
  return 0;
}

Measured memory_bytes: 12928
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
int n,a[111111],b[111111],c[111111];
int ma[111111],mb[111111],cs[111111];
int ans=0;
signed main(){
    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>b[i];
    rep(i,n)cin>>c[i];
    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    rep(i,n){
        mb[i]=0;
        if(i>0&&b[i]==b[i-1]){
            mb[i]=mb[i-1];
            continue;
        }
        int l=-1,r=n;
        while(r-l>1){
            int mid=(l+r)/2;
            if(b[i]>=c[mid])l=mid;
            else r=mid;
            if(r-l==1)mb[i]+=n-r;
        }
    }  
    rep(i,n){
        if(i==0)cs[0]=mb[0];
        else cs[i]=cs[i-1]+mb[i];
    }
    rep(i,n){
        ma[i]=0;
        if(i>0&&a[i]==a[i-1]){
            ma[i]=ma[i-1];
            continue;
        }
        int l=-1,r=n;
        while(r-l>1){
            int mid=(l+r)/2;
            if(a[i]>=b[mid])l=mid;
            else r=mid;
            if(r-l==1){
                if(r!=0)ma[i]=cs[n-1]-cs[r-1];
                else ma[i]=cs[n-1];
            }
        }
    }
    rep(i,n){
      ans+=ma[i];
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5120
#include<iostream>
using namespace std;
int n,OUT,SCORE;
bool F,S,T;
string str;
int main(){
  cin>>n;
  while(n--){
    OUT=SCORE=0;
    F=S=T=false;
    while(OUT<3){
      cin>>str;
      if(str=="OUT")OUT++;
      else if(str=="HIT"){
    if(T){SCORE++;T=false;}
    if(S){T=true;S=false;}
    if(F){S=true;}
    F=true;
      }else if(str=="HOMERUN"){
    if(T)SCORE++;
    if(S)SCORE++;
    if(F)SCORE++;
    SCORE++;
    T=S=F=false;
      }
    }
    cout<<SCORE<<endl;
  }
  return 0;
}


Measured memory_bytes: 3172
n, m = map(int, input().split())
a = [list(input()) for _ in range(n)]
b = [list(input()) for _ in range(m)]
x = 0
for i in range(n - m + 1):
    for j in range(n - m + 1):
        c = 0
        for k in range(m):
            for l in range(m):
                if a[i + k][j + l] == b[k][l]:
                    c += 1
        if c == m ** 2:
            x = 1
            break
    if x == 1:
        break
if x == 1:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

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


	int N;
	cin >> N;
	ll kotae = 0;

	rep1(i, N) {
		if (i % 3 && i % 5) kotae += i;
	}
	co(kotae);

	Would you please return 0;
}


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

int main(){
    ll n,d=0,aa;
    cin>>n;
    ll k[100009];
    rep(i,100009) k[i]=0;
    rep(i,n){
        cin>>aa;
        if(aa>100000) d++;
        else k[aa]++;
    }
    rep(i,100009){
        if(i<=k[i]) d += k[i]-i;
        else d+= k[i];
    }
    cout<<d<<endl;
}


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

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

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

  float compare = (float)sum / (4 * m);

  int valid = 0;
  for (int i = 0; i < n; i++) {
    if (compare <= a[i]) {
      valid++;
    }
  }

  if (valid >= m) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
  int n;
  cin >> n;
  int num[n];
  int num_count[n];
  for (int i = 0; i < n; i++) {
    num_count[i] = 0;
  }

  int max_num = 0;
  bool flag_d0_is_zero = true;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (i == 0 && x != 0) {
      flag_d0_is_zero = false;
    }
    num[i] = x;
    num_count[x]++;
    max_num = max(x, max_num);
  }
  if (num_count[0] != 1 || !flag_d0_is_zero) {
    cout << 0 << endl;
    return 0;
  }

  long long count_num = 1;
  for (int i = 1; i < n; i++) {
    count_num *= num_count[num[i] - 1];
    count_num %= 998244353;
  }
  cout << count_num << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	if (A <= 5)
	{
		cout << 0 << endl;
	}
	else if (A <= 12)
	{
		cout << B / 2 << endl;
	}
	else
	{
		cout << B << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
unsigned long long  a[11000];
unsigned long long b[11000];
int main()
{
int n;
	while(cin >> n){
		for(int i = 0; i < n; i++)
            cin>>a[i];
		for(int i = 0; i < n; i++)
		    cin>>b[i];
		long long time = 0;
		for(int i = 0; i < n; i++)
			if(a[i] < b[i])
			 time += (b[i] - a[i])/2;
			else if(a[i] > b[i])
			time -= a[i] - b[i];
		if(time >= 0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}

    return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define mp std::make_pair
#define pb push_back
using ll = long long;
int main()
{
	// freopen("keyence2019-A.in", "r", stdin);
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	std::vector<int> vec = {a, b, c, d}, goal = {1, 4, 7, 9};
	std::sort(vec.begin(), vec.end());
	for (int i = 0; i < 4; i++)
	{
		if (vec[i] != goal[i])
		{
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << (a + b == 15 ? '+' : a * b == 15 ? '*' : 'x') << '\n';
}


Measured memory_bytes: 256
/**
 *  winners never quit
**/

#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define pp pop_back
#define mp make_pair
typedef long long Long;
void FastIO(){
  ios::sync_with_stdio(0);
  cin.tie(0);cout.tie(0);
}

const int N = 1e5;

Long ar[N+1];

int main()
{
  FastIO();
  int tc, ca = 0;
  Long n, el;
  cin >> n;
  Long sum = 0;
  for (int i = 0;i < n;i++){
    cin >> el;
    sum += el;
    ar[el]++;
  }
  int q;
  cin >> q;
  while (q--){
    Long a, b;
    cin >> a >> b;
    Long ac = ar[a];
    ar[a] -= ac;
    sum -= (ac*a);
    sum += (ac*b);
    ar[b] += ac;
    cout << sum << '\n';
  }
  return 0;
}


Measured memory_bytes: 4428
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    while (1)
    {
        int n, m;
        cin >> n >> m;
        if (n == 0 && m == 0)
            break;
        vector<int> a(n), b(m);
        rep(i, n) cin >> a[i];
        rep(i, m) cin >> b[i];
        int suma = 0, sumb = 0;
        rep(i, n) suma += a[i];
        rep(i, m) sumb += b[i];
        int ans = INF, x, y;
        rep(i, n) rep(j, m)
        {
            int tmpa = suma - a[i] + b[j];
            int tmpb = sumb + a[i] - b[j];
            if (tmpa == tmpb)
            {
                int sum = a[i] + b[j];
                if (ans > sum)
                {
                    ans = sum;
                    x = a[i];
                    y = b[j];
                }
            }
        }
        if (ans == INF)
            cout << -1 << endl;
        else
            cout << x << " " << y << endl;
    }
}



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

int main(){
  int N;
  cin >> N ;
  vector<int>s(N);
  for( int i = 0 ; N > i ; i++){
    cin >> s.at(i);
  }
  sort( s.begin(),s.end() );
  reverse ( s.begin() , s.end() );
  int sum1 = 0, sum2 =0;
  for( int i = 0 ; N > i ; i += 2){
    sum1 += s.at(i);
  }
  for( int i = 1 ; N > i ; i += 2 ){
    sum2 += s.at(i);
  }
  cout << sum1 - sum2 << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;

const int maxn = 1e5 + 5;
int a[5];

int main(){
	cin >> a[1] >> a[2] >> a[3];
	sort(a + 1,a + 1 + 3);
	int a1 = a[3] - a[1],b1 = a[3] - a[2];	
	int x;
	int flag = 0;
	x = a1 - b1;
	if((x & 1)) flag = 1;
	cout << b1 + (x + 1) / 2 + flag << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

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 T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

template<typename T>
map<T, int> prime_factor(T n) {
    map<T, int> res;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1) res[n] = 1;
    return res;
}

int main() {
    ll a;
    string bs;
    cin >> a >> bs;
    ll nb = (bs[0] - '0') * 100 + (bs[2] - '0') * 10 + (bs[3] - '0');

    if (a == 0 || nb == 0) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = a * nb / 100;
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<vector>
#include<numeric>
using namespace std;
int main(){
    int n,a,x=0,v;
    vector<int>color(8,0);
    cin>>n;
    for(int i = 0; i < n; i++)
    {
        cin>>a;
        if(a/400>7)x++;
        else if(!color[a/400])color[a/400]++;
    }
    v=accumulate(color.begin(),color.end(),0);
    cout<<(v>0?v:1)<<" "<<v+x<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split()))
count = 0
for i in range(n):
  for j in range(n - i - 1):
    for t in range(n - i - j - 2):
      a = l[i]
      b = l[j + i + 1]
      c = l[t + j + i + 2]
      if abs(a - b) < c and c < a + b and a != b and b != c and c != a:
        count += 1
print(count)

Measured memory_bytes: 9196
#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i, s, t) for(i = s; i <= t; ++i)
#define dep(i, s, t) for(i = s; i >= t; --i)
#define imp {puts("-1"); return 0;}

using namespace std;

const int N = 3e5 + 10;
int n, A, B;
int ans[N], l[N], r[N], pos[N];

void put(int x, int num) {
	int t, i, R = n-l[x]+1, L = R-(r[x]-l[x]);
	t = L+num;
	rep(i, l[x], r[x]-num) ans[i] = t++;
	t = L+num-1;
	rep(i, r[x]-num+1, r[x]) ans[i] = t--;
}

int main() {
	int i, t;
	scanf("%d%d%d", &n, &A, &B);
	if(A > n || B > n) imp;
	if(B > n-A+1) imp;
	if(B < ((n-1)/A+1)) imp;
	B -= ((n-1)/A+1);
	
	rep(i, 1, n) {
		pos[i] = (i-1) / A + 1;
		if(!l[pos[i]]) l[pos[i]] = i;
		r[pos[i]] = i;
	}
	dep(i, pos[n], 1) {
		t = min(B, r[i]-l[i]); B -= t;
		put(i, t);
	}
	rep(i, 1, n) printf("%d ", ans[i]); puts("");
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll N;
    vector<pair<ll, ll>> A;
    cin >> N;
    A.resize(N);
    for(ll i = 0;i < N;i++) {
        ll temp;
        cin >> temp;
        A.emplace_back(i, temp);
    }
    sort(A.begin(), A.end(), [](pair<ll, ll> a, pair<ll, ll> b) { return a.second < b.second; });
    pair<ll, ll> a = A[A.size() - 1];
    pair<ll, ll> b = A[A.size() - 2];
    for(ll i = 0;i < N;i++) {
        if(i == a.first) cout << b.second << endl;
        else cout << a.second << endl;
    }
    return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define vd vector<double>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

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

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

int main(void)
{
    ll n;
    cin >> n;
    vllll num(10, vll(10));
    rep(i, 1, n + 1)
        num[i / pow(10, to_string(i).size() - 1)][i % 10]++;
    ll sum = 0;
    rep(i, 0, 10)
        rep(j, 0, 10)
            sum += num[i][j] * num[j][i];
    cout << sum << endl;
}

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

int main() {
    int n, m; cin >> n >> m;
    vector<pair<int, int>> v(m); 
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b;
        v[i] = make_pair(b, a);
    }
    sort(v.begin(), v.end());
    int ans = 0, t = 0;
    for (int i = 0; i < m; i++) {
        if (t <= v[i].second) {
            ans++;
            t = v[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
int x,y,n,p,m;
struct xx
{
	int x,y,mc;
}s[100001],a[100001];
bool cmp(xx a,xx b)
{
	if(a.x==b.x)
	  return a.y<b.y;
	else
	  return a.x<b.x;
}
int main()
{
	cin>>m>>n;
	for(int i=1;i<=n;i++)
	  {
	  	cin>>s[i].x>>s[i].y;
	  	s[i].mc=i;
	  	a[i].x=s[i].x;
	  	a[i].y=s[i].y;
	  }
	sort(s+1,s+n+1,cmp);
	for(int i=1;i<=n;i++)
	  	if(s[i].x==s[i-1].x)
	  	  	a[s[i].mc].y=i-p+1;
		else
		  {
		  	p=i;
		  	a[s[i].mc].y=i-p+1;
		  }
	for(int i=1;i<=n;i++)
	  	cout<<setw(6)<<setfill('0')<<a[i].x<<setw(6)<<setfill('0')<<a[i].y<<endl;
	return 0;
}

Measured memory_bytes: 3840
def main():
    import bisect
    s = input()
    n = len(s)
    ans = [0 for i in range(n)]
    R = []
    L = []
    E = []
    for i in range(n):
        if s[i]=='R' and s[i+1]=='L':
            R.append(i)
        elif s[i]=='L' and s[i-1]=='R':
            L.append(i)
        else:
            E.append(i)
    for i in range(len(E)):
        if s[E[i]]=="R":
            p = bisect.bisect_left(L,E[i])
            if (L[p]-E[i])%2==0:
                ans[L[p]]+=1
            else:
                ans[L[p]-1]+=1
        else:
            p = bisect.bisect_right(R,E[i])
            if (E[i]-R[p-1])%2==0:
                ans[R[p-1]]+=1
            else:
                ans[R[p-1]+1]+=1
    for r in R:
        ans[r]+=1
    for l in L:
        ans[l]+=1
    print(' '.join(list(map(str,ans))))

if __name__ == "__main__":
    main()

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

int main(){
    int n;
    cin >> n;
    long long sum = 0;
    for(int i = 0; i < n; ++ i){
        int a;
        cin >> a;
        sum += a - 1;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
def main():
  n=int(input())
  poll=[input() for i in range(n)]

  dic={}
  for string in poll:
    if string not in dic:
      dic[string]=1
    else:
      dic[string]+=1
  
  x=max(dic.values()) 
  max_k=[k for k, v in dic.items() if v==x]
  max_k.sort()
  print(*max_k,sep='\n')
  
if __name__=='__main__':
  main()

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

int main() {
    int a, b, c;  cin >> a >> b >> c;
    cout << min({a+b, b+c, a+c}) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;


int main()
{
    vector<int> s;
    int N, M;
    cin>>N>>M;

    if(M%N==0)
    {
        cout<<M/N<<endl;
        return 0;
    }

    for(int i=1; i*i<M; ++i)
    {
        if(M%i==0) {
            s.push_back(i);
            s.push_back(M / i);
        }
    }

    sort(s.begin(), s.end(), greater<int>());

    for(auto si : s)
    {
        if(M / si >= N)
        {
            cout<<si<<endl;
            return 0;
        }
    }



    return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import Data.Char

toTuple bs =
    let
        Just (a, bs') = B.readInt bs
        Just (b, _) = B.readInt $ B.dropWhile isSpace bs'
    in
        (a, b)

solve xys = let (a, b) = VU.foldl' step (1, 1) xys in a + b 
    where
        step (a, b) (x, y) = (m*x, m*y)
            where
                h i j = let (q, r) = quotRem i j in if r == 0 then q else q + 1
                qr = h a x
                st = h b y 
                m = max qr st

main = do
    n <- readLn :: IO Int
    tas <- VU.replicateM n (toTuple <$> B.getLine)
    print $ solve tas

Measured memory_bytes: 1020
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let d: i32 = read();
    let mut s = "Christmas".to_string();

    for _ in 0..25 - d {
        s += " Eve";
    }
    println!("{}", s);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  string vec;
  cin>>vec;
  ll b=1000;
  ll x=vec.size();
  for(ll i=0;i<vec.size()-2;i++){
    ll c,d,e;
    c=vec.at(i)-'0';
    d=vec.at(i+1)-'0';
    e=vec.at(i+2)-'0';
    b=min(b,abs(100*c+10*d+e-753));
  }
  cout<<b<<endl;
  return 0;
}
    
    
  


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>

using namespace std;
using ll = long long int;
using vec = vector<int>;

#define rep(n) for(int i = 0; i < (n); ++i)
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
const int INF = 2147483647;
const ll  MOD = 1000000007;

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

    auto a = s.find_first_of('A');
    auto z = s.find_last_of('Z');

    cout << z - a + 1;
}

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

int INF = 1e9;
vector< int > G[100005], vis(100005);
vector< pair< int, int > > dp(100005);

void dfs(int node, int d){
	vis[node] = 1;
	//cout<<node<<endl;
	dp[node].first = d;
	if(!G[node].size()) dp[node].second = d;
	for(int i : G[node]){
		if(!vis[i]){
			dfs(i, d + 1);
			dp[node].second = max(dp[i].second, dp[node].second);
		}else{
			dp[node].second = max(dp[node].first + dp[i].second - dp[i].first + 1, dp[node].second);
		}
	}
}

void solve(){
	int n, m; cin>>n>>m;
	for(int i = 0; i<m; i++){
		int a, b; cin>>a>>b;
		G[a].push_back(b);
	}
	
	for(int i = 1; i<=n; i++){
		dp[i] = {0, -1};
	}

	for(int i = 1; i<=n; i++){
		if(!vis[i]){
			dfs(i, 0);
		}
	}
	int ans = 0;
	for(int i = 1; i<=n; i++){
		ans = max(ans, dp[i].second);
	}
	cout<<ans<<endl;

}

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



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

using ll = long long int;

int main() {
	int n;
	std::cin >> n;

	long long int d, a;
	std::cin >> d >> a;

	std::pair<std::pair<ll, ll>, ll> monst[200010];
	for (int i = 0; i < n; ++i)
		std::cin >> monst[i].first.first >> monst[i].first.second;

	std::sort(monst, monst + n);

	int i = 0, j = 0;
	ll rollsum = 0;
	ll ans = 0;
	while (i < n) {
		while (monst[j].first.first - monst[i].first.first + 1 <= 2*d + 1 && j < n) {
			++j;
		}
		--j;

	//	std::cout << i << " " << j << "\n";
		rollsum += monst[i].second;
		monst[i].first.second -= rollsum;
		int left = monst[i].first.second;
	//	std::cout << left << "\n";
		if (left > 0) {
			ll nratt = (left + a - 1) / a;
			ans += nratt;
			rollsum += nratt * a;
			monst[j+1].second -= nratt * a;
		}

	//	std::cout << ans << "\n\n";
		++i;
	}

	std::cout << ans;
}

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


int main()
{
	int i = 0;
	while (1) {
		i++;
		int x;
		cin >> x;
		if (x == 0)break;
		cout << "Case " << i << ": " << x << endl;
	}
	return 0;
}

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

using namespace std;

int main()
{
    int n, a[110];
    long long int ans = 1000000;

    cin >> n;

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

    for (int i = -100; i <= 100; i++) {
        int ans2 = 0;
        for (int j = 0; j < n; j++) {
            ans2 += pow(a[j]-i, 2);
        }
        if (ans > ans2) {
            ans = ans2;
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)
template <class T>
T calcgcd(T x, T y)
{
    if (x < y)
    {
        std::swap(x, y); //小さい方をyとする
    }
    T r = x % y;
    while( r != 0 )
    {
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}
int main()
{
    int N, X;
    cin >> N >> X;
    vector<int> dist(N);
    REP(i, N)
    {
        int c;
        cin >> c;
        c -= X;
        if (c < 0) c = -c;
        dist[i] = c;
    }

    for (int i = 1; i < N; ++i)
    {
        dist[i] = calcgcd<int>(dist[i], dist[i - 1]);
    }
    cout << dist[N - 1] << endl;
    return 0;
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]+a[1]==a[2]) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3628
N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('inf')]*N
dp[0] = 0
for i in range(N):
    for k in range(1,K+1):
        if i+k >= N:
            continue
        dp[i+k] = min(dp[i+k],dp[i]+abs(h[i]-h[i+k]))
print(dp[N-1])

Measured memory_bytes: 55264
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

const int MAXN = 300000;

vector<pair<int, int> > A;

int ret[MAXN];

int N;

int main() {
	ios_base::sync_with_stdio(false);
	A.clear();
	cin >> N;
	int x;
	FOR (i, N) {
		cin >> x;
		A.pb(make_pair(x, i));
	}
	sort(all(A));
	FOR (i, A.sz) {
		if (i < N / 2)
			ret[A[i].second] = A[N / 2].first;
		else
			ret[A[i].second] = A[N / 2 - 1].first;
	}
	FOR (i, N)
		cout << ret[i] << endl;
		
	return 0;
}

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

const int maxn = 55;
bool can[maxn][maxn][maxn];

signed main() {
#ifdef LOCAL
  assert(freopen("c.in", "r", stdin));
#endif
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i = 0; i < maxn; ++i) {
    can[0][i][i] = true;
  }
  for (int m = 1; m < maxn; ++m) {
    for (int a = 0; a < maxn; ++a) {
      for (int b = 0; b < maxn; ++b) {
        can[m][a][b] = can[m - 1][a][b] || can[m - 1][a % m][b];
      }
    }
  }
  vector<ll> A(n);
  for (int i = 0; i < n; ++i) {
    A[i] = 1ll << a[i];
  }
  ll res = 0;
  for (int m = maxn - 1; m > 0; --m) {
    bool ok = true;
    for (int i = 0; i < n; ++i) {
      bool ok1 = false;
      for (int j = 0; j < maxn; ++j) {
        if (!(A[i] & (1ll << j))) {
          continue;
        }
        ok1 |= can[m - 1][j][b[i]];
      }
      ok &= ok1;
    }
    if (!ok) {
      if (m == maxn - 1) {
        cout << -1 << '\n';
        return 0;
      }
      res += 1ll << m;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < maxn; ++j) {
          if (A[i] & (1ll << j)) {
            A[i] |= 1ll << (j % m);
          }
        }
      }
    }
  }
  cout << res << '\n';
}


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

int main() {
    string S;
    cin >> S;
    int N = S.size();
    int flag = 0;
    for (int i = 0;i < N;i++){
        if (i % 2 == 1){
            if (S[i] == 'R') flag = 1;
        }
        else if (i % 2 == 0){
            if (S[i] == 'L') flag = 1;
        }
    }
    if (flag == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
 }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  int N;
  cin >> N;
  long long A[N];
  rep(i, N)
    cin >> A[i];

  long long MAX = 1000000000000000000;

  rep(i, N){
    if(A[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  
  long long ans = 1;
  rep(i, N){
    if(ans <= MAX/A[i])
      ans *= A[i];
    else{
      cout << -1 << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 4396
#include <stdio.h>
long abs(long);
int main(){
  int n,k,h[100000],j;
  long dp[100000],min;
  scanf("%d%d",&n,&k);
  for (int i=0;i<n;i++) scanf("%d",&h[i]);
  dp[0]=0;
  for (int i=1;i<n;i++){
    j=1;
    min=1000000000;
    while (i>=j && j<=k){
      if (min>dp[i-j]+abs(h[i]-h[i-j])) min=dp[i-j]+abs(h[i]-h[i-j]);
      j++;
    }
    dp[i]=min;
  }
  printf("%ld\n",(long)dp[n-1]);
  return 0;
}
long abs(long num){
  if (num<0) num=-num;
  return num;
}


Measured memory_bytes: 1280