akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

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

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

const int N = 2e5 + 5;
int p[N];
int pos[N];

void solve() {
	int n;
    sc(n);
    fr(i, 1, n) {
        sc(p[i]);
        pos[p[i]] = i;
    }
    int ans = 0;
    fr(i, 1, n) {
        int pp = i;
        while(pp < n && pos[pp + 1] > pos[pp]) pp++;
        ans = max(ans, pp - i + 1);
        i = pp;
    }
    cout << n - ans;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define endl "\n"

#define aim_cpo do{ios::sync_with_stdio(false);\
cin.tie(nullptr);cout.precision(10);cout<<fixed;}while(0)

#define LOCAL_INPUT do{FILE *stream1;\
stream1=freopen("/Users/aim_cpo/CLionProjects/competitive/in.txt","r",stdin);\
if(stream1==nullptr)return 0;}while(0)

#define LOCAL_OUTPUT do{FILE *stream2;\
stream2 = freopen("out.txt", "w", stdout);\
if (stream2 == nullptr) return 0;}while(0)

#ifdef LOCAL_DEFINE
#define show(x) cerr << #x << " = " << (x) << endl
#else
#define show(x)
#endif

typedef long long ll;
typedef unsigned long long ull;

constexpr const int INT_INF=0x3f3f3f3f; // 1061109567
constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f; // 4557430888798830399

template <typename T> bool chmin(T &a, T b){return a>b?(a=b,true):false;}

template <typename T> bool chmax(T &a, T b){return a<b?(a=b,true):false;}

// INT
#define GCD(a, b) __gcd(a, b)
template <typename T> T LCM(T a, T b) {return a / GCD(a, b) * b;}
template <typename T> T EXTGCD(T a, T b, T& x, T& y) {
    T d = a;
    if (b != 0) {d=EXTGCD(b,a%b,y,x);y-=(a/b)*x;}
    else x=1,y=0;
    return d;
}
template <typename T> bool is_prime(T a) {
    for(int i=2;i*i<=a;i++)if(a%i==0)return 1;
    return 0;
}

// MOD
ll MOD = 1000000000L + 7L;
#define add(a, b) ((a % MOD) + (b % MOD)) % MOD
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define sub(a, b) ((a % MOD) + MOD - (b % MOD)) % MOD
template <typename T> T mod_inverse(T a, T mod, bool prime){ // if mod is prime, "prime" is true.
    if(prime){
        T tmp=mod-2,now=a,res=1;while(tmp){if(tmp&1)res=mul(res,now);now=mul(now,now);tmp>>=1;}
        return res;
    }else{T x,y;EXTGCD(a,mod,x,y);return (mod+x%mod)%mod;}
}
#define divide(a, b) ((a % MOD) * (mod_inverse(b, MOD, true))) % MOD

//LLの数値をつかう時は最後にLをつける癖をつけよう
//
//  ┏┓┏┓　┓　┏┓
//  ┏┛┃┃　┃　┗┫
//  ┗┛┗┛　┻　┗┛
//
//   謹┃賀┃新┃年┃
//   ━┛━┛━┛━┛
//WWWWWWWWWWWWWWWWWWWWWW

int n, h, w;

int main() {
    aim_cpo; // インタラクティブのときは消すように.
#ifdef LOCAL_DEFINE
    LOCAL_INPUT; // インタラクティブのときは消すように.
//    LOCAL_OUTPUT; // ファイルに出力したいときのみ
    show(MOD);
#endif
    cin >> n >> h >> w;
    cout << (n - h + 1) * (n - w + 1) << endl;
#ifdef  LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s." << endl;
#endif
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100;
char s[maxn];
int len;
bool flag = false;

int main() {
#ifdef __AiR_H
    freopen("in.txt", "r", stdin);
#endif
    scanf("%s", s); len = strlen(s);
//    printf("%s\n", s);
    for (int i = 0; i < len - 1; ++i) {
        if (s[i] == 'A' && s[i + 1] == 'C') {
            flag = true; break;
        }
    }
    if (flag) { printf("Yes\n"); }
    else { printf("No\n"); }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int n,x,a[100],i,j,min,zah,ans = 0;
  scanf("%d %d",&n,&x);
  for (i = 0;i < n;i++) {
      scanf("%d",&a[i]);
  }
  for (i = 0;i < n;i++) {
      min = 2000000000;
      for (j = 0;j < n;j++) {
          if (a[j] < min) {
              min = a[j];
              zah = j;
          }
      }
      a[zah] = 2000000000;
      if (i == n - 1) {
          if (min == x) ans++;
      } else {
          if (min > x) {
              break;
          } else {
              ans++;
              x -= min;
          }
      }
  }
  printf("%d\n",ans);
  return 0;
}


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

int A, B, C;
 
signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> A >> B >> C;
    int M = max({A, B, C});
    int d = 3*M-A-B-C;
    if (d%2==0) cout << d/2 << endl;
    else cout << (d+3)/2 << endl;
}

Measured memory_bytes: 256
using System;

namespace ITP1_2_A
{
  class Program
  {
    static void Main(string[] args)
    {
      var input = Console.ReadLine();
      string[] line = input.Split(' ');
      if (int.Parse(line[0]) < int.Parse(line[1]))
      {
        Console.WriteLine("a < b");
      }
      else if (int.Parse(line[0]) > int.Parse(line[1]))
      {
        Console.WriteLine("a > b");
      }
      else
      {
        Console.WriteLine("a == b");
      }


    }
  }
}



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

using namespace std;

int main(){
	int N;
	cin>>N;
	
	map<int64_t,vector<int>> ai;
	
	bool sea[N+2]={};
	
	sea[0]=sea[N+1]=true;

	int ans = 0;

	for(int i=1; i<=N; ++i){
		int64_t a;
		cin>>a;
		ai[a].push_back(i);
		if( a > 0 ){
			ans = 1;
		}
	}
	
	int n = 1;
	for(const auto & p : ai){
		for(const int i : p.second){
			sea[i] = true;
			if( !sea[i-1] && !sea[i+1]){ 
				++n;
			}
			if( sea[i-1] && sea[i+1]){
				--n;
			}
		}
		ans = max(ans, n);
	}
	
	cout << ans << endl;
}


Measured memory_bytes: 14168
#include<stdio.h>

int main(void){
  int i,j;
  int n;
  int m;
  int flag;
  char a[70],b[70];
  char s;

  while(1){
    scanf("%d ",&n);
    if(!n)break;

    for(i=0;i<n;i++)scanf("%c %c ",&a[i],&b[i]);
    
    scanf("%d ",&m);
    for(i=0;i<m;i++){
      scanf("%c ",&s);
      flag = 0;
      for(j=0;j<n;j++){
	if(s == a[j]){
	  printf("%c",b[j]);
	  flag = 1;
	  break;
	}
      }
      if(!flag)printf("%c",s);
    }
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
const int MAX_C = 1000;
long long Com[MAX_C][MAX_C];

void calc_com() {
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < MAX_C; ++i) {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_C; ++j) {
            Com[i][j] = (Com[i-1][j-1] + Com[i-1][j]);
        }
    }
}


int main(){
  int N, a, b; cin >> N >> a >> b;
  ll v[N];
  rep(i, N){
    cin >> v[i];
  }
  sort(v, v+N, greater<ll>()); ll sum = 0;
  rep(i, a){
    sum += v[i];
  }
  double h = (double)sum/a; printf("%.12lf\n", h); int dai;
  rep(i, N){
    if(v[i]==v[a-1]){dai = i; break;}
  }
  int cnt = 0, low=-1;
  rep(i, N){
    if(v[i]==v[a-1]) cnt++;
    if(v[i]<v[a-1]){low=i; break;} 
  }
  if(low==-1) low=N;
  //cout << cnt << endl;
  calc_com();
  if(v[0]!=v[a-1]){
    a-=dai; a=min(a, cnt);
    cout << Com[cnt][a] << endl; return 0;
  }
  ll ans = 0; b = min(b, low);
  //cout << a << " " << b << endl;
  for(int i=a; i<=b; i++){
    ll tmp = Com[cnt][i];
    ans+=tmp; 
  }
  cout << ans << endl;
}

Measured memory_bytes: 8064
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val t = in.readLine()

    @tailrec
    def count(t: List[Char], result: ArrayBuffer[Char]): ArrayBuffer[Char] = {
      t match {
        case Nil => result
        case 'P' :: Nil => result.append('P')
        case _ :: Nil => result.append('D')
        case 'P' :: 'P' :: rest => count('P' :: rest, result.append('P'))
        case 'P' :: _ :: rest => count(rest, result.append('P').append('D'))
        case 'D' :: rest => count(rest, result.append('D'))
        case '?' :: 'D' :: rest => count(rest, result.append('P').append('D'))
        case '?' :: '?' :: rest => count(rest, result.append('P').append('D'))
        case '?' :: rest => count(rest, result.append('D'))
      }
    }

    out.println(count(t.toList, ArrayBuffer.empty[Char]).mkString(""))

    out.flush()
  }
}

Measured memory_bytes: 66600
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef unsigned long long int ull;
typedef long long lint;

int main(void){
    lint A[3],K;
    cin >> A[0] >> A[1] >> A[2] >> K;
    rep(i,K){
        lint* p=max_element(A,A+3);
        *p=*p*2;
    }
    lint ans=0;
    rep(i,3) ans+=A[i];
    cout << ans << endl;
}

Measured memory_bytes: 256
#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;
    int ans = max(0, C - (A - B));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//
		// 画面入力
		//
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();

		//
		// 処理
		//
		// 境界値 0, 1000, 10000

		int count = 0;
		if(n % 1000 == 0) {
			count = n / 1000;
		}else {
			count = n / 1000 + 1;
		}
		System.out.println(1000 * count - n);

	}

}


Measured memory_bytes: 27012
(n,m),*a=[map(int,t.split())for t in open(0)]
p=[-1]*-~n
for a in a:
 a,b=map(r:=lambda x:x*(p[x]<0)or r(p[x]),a)
 if a!=b:
  if p[a]>p[b]:a,b=b,a
  p[a]+=p[b];p[b]=a
print(sum(i<0for i in p)-2)

Measured memory_bytes: 53256
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
    char A[256], B[256];
    int a, b;
    fgets(A, sizeof(A), stdin);
    fgets(B, sizeof(B), stdin);
    a = strlen(A);
    b = strlen(B);
    if ( a > b ){
        printf("GREATER\n");
    } else if ( a < b ){
        printf("LESS\n");
    } else {
        if ( (a=strcmp(A, B)) == 0 ){
            printf("EQUAL\n");
        } else if ( a > 0 ){
            printf("GREATER\n");
        } else {
            printf("LESS\n");
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include<unordered_map>
 
int main()
{
	int N = 0;
	std::cin >> N;
	std::string ans = "YES";
 
	std::unordered_map<int, int>S;
	for (int i = 0; i < N; i++)
	{
		int A;
		std::cin >> A;
		S[A]++;
	
	}
    
  	if (S.size() != N){
      ans = "NO";
    }
 
	std::cout << ans << std::endl;
 
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rept(i, a, b) for(int i=a ; i<=b; i++)
    
int main(){
    int n, m; cin >> n >> m;
    int l[m], r[m];
    rep(i, m) cin >> l[i] >> r[i];
    
    sort(l, l+m);
    sort(r, r+m);
    int L = l[m-1];
    int R = r[0];
    if(L<=R)
        cout << R-L+1 << endl;
    else 
        cout << 0 << endl;
}

                
    

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,x,ans=0;
    cin >> a >> b >> c >> x;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if((i*500+j*100+k*50)==x){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

int n;
string s;

void solve() {
  scanf("%d", &n);
  string ans = "No";
  for (size_t i = 1; i < 10; i++) {
    for (size_t j = 1; j < 10; j++) {
      if (i*j == n) {
        ans = "Yes";
      }
    }
  }
  cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <string>

using namespace std;

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

  int result1 = 0;
  int result2 = 0;

  for (int i = 0; i < s.size(); i++ ) {
    int bit1 = i % 2;
    int bit2 = (i+1) % 2;
    int s_int = s[i] - '0';

    if (s_int != bit1) {
      result1++;
    }

    if (s_int != bit2) {
      result2++;
    }
  }

  if (result2 > result1) {
    cout << result1 << endl;
  } else {
    cout << result2 << endl;
  }

  return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<double> a(n+1,0);
  for(int i=0; i<n; i++){
    double e;
    cin >> e;
    a[i+1] = a[i] + (e+1)/2;
  }
  
  double sum=0; 
  for(int i=0; i<n-k+1; i++){
    if(a[i+k] - a[i] > sum){
      sum=a[i+k] - a[i];
    }
  }
  cout << fixed << setprecision(12);
  cout << sum << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (ll) 1e9 + 7;

int main(){
    ll n, k;
    cin >> n >> k;
    vector<int> v = {0, 0, 0};
    v[n - 1] = 1;
    v[k - 1] = 1;
    for (int i = 0; i < 3; i++) {
        if (v[i] == 0)
            cout << i+1 << "\n";
    }
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
	System.out.println(new Point(0, 0).toString());
	koch(new Scanner(System.in).nextInt(),
	     new Point(0, 0),
	     new Point(100, 0));
	System.out.println(new Point(100, 0).toString());
    }

    public static void koch(int d, Point p1, Point p2) {
	if(d == 0) { return; }

	double
	    dx = p2.x - p1.x,
	    dy = p2.y - p1.y;
     	Point
	    s = new Point(p1.x + dx / 3, p1.y + dy / 3),
	    t = new Point(p1.x + dx / 3 * 2, p1.y + dy / 3 * 2);
	double
	    x = t.x - s.x,
	    y = t.y - s.y;
	Point
	    u = new Point(s.x + x / 2 - y / 2 * Math.sqrt(3),
			  s.y + x / 2 * Math.sqrt(3) + y / 2);
	
	koch(d - 1, p1, s);
	System.out.println(s);
	koch(d - 1, s, u);
	System.out.println(u);
	koch(d - 1, u, t);
	System.out.println(t);
	koch(d - 1, t, p2);
    }
}

class Point {
    double x, y;
    public Point(double x, double y){ this.x = x; this.y = y; }
    public String toString(){ return String.format("%.8f %.8f", this.x, this.y); }
}



Measured memory_bytes: 41496
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 110;
int H, W;

int cutph(int h, int w) {
    int h1 = h/3;
    int h2 = (h - h1) / 2;
    int h3 = h - h1 - h2;
    return (h3-h1)*w;
}

int cutpw(int h, int w) {
    int w1 = w/3;
    int w2 = (w - w1) / 2;
    int w3 = w - w1 - w2;
    return (w3-w1)*h;
}

int cutvh(int h, int w) {
    int h1 = h/3;
    int h23 = h - h1;
    int w2 = w/2;
    int w3 = w- w2; // w3 > w2
    int Smin = min(h1*w, h23*w2);
    int Smax = max(h1*w, h23*w3);
    return Smax - Smin;
}

int cutvh2(int h, int w) {
    int h1 = (h+2)/3;
    int h23 = h - h1;
    int w2 = w/2;
    int w3 = w- w2; // w3 > w2
    int Smin = min(h1*w, h23*w2);
    int Smax = max(h1*w, h23*w3);
    return Smax - Smin;
}

int cutvw(int h, int w) {
    int w1 = w/3;
    int w23 = w - w1;
    int h2 = h/2;
    int h3 = h- h2;
    int Smin = min(w1*h, w23*h2);
    int Smax = max(w1*h, w23*h3);
    return Smax - Smin;
}

int cutvw2(int h, int w) {
    int w1 = (w+2)/3;
    int w23 = w - w1;
    int h2 = h/2;
    int h3 = h- h2;
    int Smin = min(w1*h, w23*h2);
    int Smax = max(w1*h, w23*h3);
    return Smax - Smin;
}

int main(int argc, const char * argv[]) {
    cin >> H >> W;
    int ans = cutpw(H, W);
    chmin(ans, cutph(H, W));
    chmin(ans, cutvw(H, W));
    chmin(ans, cutvh(H, W));
    chmin(ans, cutvw2(H, W));
    chmin(ans, cutvh2(H, W));
    output(ans);
    return 0;
}

Measured memory_bytes: 256
l = int(input())
a = [int(input()) for _ in range(l)]

dp = [[0 for i in range(5)] for j in range(l+1)]

def cost(s, a):
    if s == 0 or s == 4:
        return a
    elif s == 1 or s == 3:
        if a > 0:
            return a%2
        else:
            return 2
    else:
        return (a+1)%2

for i in range(l):
    dp[i+1][0] = min(dp[i][:1]) + cost(0, a[i])
    dp[i+1][1] = min(dp[i][:2]) + cost(1, a[i])
    dp[i+1][2] = min(dp[i][:3]) + cost(2, a[i])
    dp[i+1][3] = min(dp[i][:4]) + cost(3, a[i])
    dp[i+1][4] = min(dp[i][:5]) + cost(4, a[i])

print(min(dp[l]))



Measured memory_bytes: 74108
#include<bits/stdc++.h>  
using namespace std;
const int INF = 999;
//世界一競技プログラミングができない人のソース2
#define int long long
int get_number(string str, int& idx){
  int ret = 0;
  while(isdigit(str[idx])){
    ret = ret * 10 + str[idx] - '0';
    ++idx;
  }
  return ret;
}

int Expression(string str, int& idx){
  int ret = get_number(str, idx);
  while(true){
    switch(str[idx]){
    case '*':
      ++idx;
      ret *= get_number( str, idx);
      break;
    default:
      return ret;
    }
  }
}

int nomal(string str, int idx = 0){
  int res = Expression(str, idx);
  while(true){
    switch(str[idx]){
    case '+':
      ++idx;
      res += Expression(str, idx);
      break;
    default:
      return res;
    }
  }
}
int special(string str, int idx = 0){
  int ret = get_number(str, idx);
  while(idx < str.size() - 1){
    if(str[idx] == '+') ret += get_number(str, ++idx);
    else if(str[idx] == '*') ret *= get_number(str, ++idx);
    else break;
  }
  return ret;
}
signed main(){
  string str;
  cin >> str;
  str += "~";
  int digit;
  cin >> digit;

  bool judge_a = nomal(str) == digit;
  bool judge_b = special(str) == digit;
  if(judge_a & judge_b){
    cout << "U" << endl;
  } else if( judge_a){
    cout << "M" << endl;
  } else if( judge_b){
    cout << "L" << endl;
  } else {
    cout << "I" << endl;
  }
}

Measured memory_bytes: 1212
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    N, M = map(int, readline().split())
    if M//2<=N:
        ans = M//2
    else:
        ans = N + (M-N*2)//4
    print(ans)
if __name__ == '__main__':
    main()

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

int main() {
    int n; cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else {
        int a, b; cin >> a >> b;
        cout << a + b << endl;
    }
    return 0;
}

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

int main(){
  int h,m,s;
  cin >> s;

  h = s / 3600;
  m = (s % 3600) / 60;
  s = ( (s % 3600) % 60 );

  cout << h << ":" << m << ":" << s << endl;
  return 0;
}

Measured memory_bytes: 3108
#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++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
int n,h,cnt=0;
int a[200000],b[200000];
priority_queue<pair<int,bool>>que;
signed main(){
    cin>>n>>h;
    rep(i,n){
        cin>>a[i]>>b[i];
        que.push(make_pair(a[i],true));
        que.push(make_pair(b[i],false));
    }
    while(h>0){
        pair<int,bool>p=que.top();
        h-=p.F;
        if(!p.S)que.pop();
        else{
            cnt+=(h+(p.F-1))/p.F;
            h=0;
        }
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 7152
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main() {
    ios_base::sync_with_stdio(0);
    int t, i, j, k, p, q, r, x, y, u, v, n, m;
	cin>>t>>i;
  if(t>i) cout<<"safe\n";
  else cout<<"unsafe\n";
    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
		g[u-1].pb(v-1);
		g[v-1].pb(u-1);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}



Measured memory_bytes: 10688
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define OUT(s) cout << s << "\n";
using namespace std;


int A,B,C,D;
// https://atcoder.jp/contests/abc164
void Main()
{
    int t = C/B;
    if ((C%B) != 0) {
        t = t+1;
    }
    int a = A/D;
    if ((A%D) != 0) {
        a = a+1;
    }
    if (t <= a) {
        OUT("Yes");
    } else {
        OUT("No");
    }

}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    cin >> A >> B >> C >> D;
    Main();
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
ll bpow(ll b, ll p, ll m = 1000000007LL) {
  ll rt = 1;
  for (; p; p >>= 1, b = b * b % m)
    if (p & 1)
      rt = rt * b % m;
  return rt;
}
int p[105];
int main() {
  IOS;
  int x, n;
  cin >> x >> n;
  for (int i = 0; i < n; i++)
    cin >> p[i];
  int mn = 1e9, ans = -1;
  for (int i = -105; i <= 105; i++) {
    int ok = 1;
    for (int j = 0; j < n; j++)
      if (p[j] == i)
        ok = 0;
    if (ok && abs(i - x) < mn)
      mn = abs(i - x), ans = i;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp43 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int x = st[0];
            int y = st[1];

            var group = new int[12] { 1, 3, 5, 7, 8, 10, 12, 4, 6, 9, 11, 2 };

            int x_group = Array.IndexOf(group, x);
            int y_group = Array.IndexOf(group, y);

            int x_groupind = FindGroupIndex(x_group);
            int y_groupind = FindGroupIndex(y_group);

            

            if (x_groupind == y_groupind) {
                Console.WriteLine("Yes");
            } else {
                Console.WriteLine("No");
            }

        }

        static int FindGroupIndex(int num) {
            if (0 <= num && num <= 6) {
                return 0;
            } else if (7 <= num && num <= 10) {
                return 1;
            } else {
                return 2;
            }
        }
    }
}


Measured memory_bytes: 13280
n = int(input())
d = {}
for i in range(n):
	s = input()
	if s in d:
		d[s] += 1
	else:
		d[s] = 1
l = list(d.items())
l = sorted(l, key=lambda x:x[1])
nn = len(l)
m = l[nn-1][1]
i = nn - 1
ll = []
while l[i][1] == m:
	ll.append(l[i][0])
	i -= 1
	if i == -1:
		break
ll.sort()
for i in range(len(ll)):
	print(ll[i])

Measured memory_bytes: 46556
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n, k, s;
  while (cin >> n >> k >> s, n) {
    int c = 0;
    rep(i, 1 << n) {
      if (bitset<32>(i).count() != k) continue;
      int x = 0;
      rep(j, n) if (i >> j & 1) x += j + 1;
      c += x == s;
    }
    cout << c << endl;
  }
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main(){
    map<string,int> mp;
    
    int n;
    cin>>n;
    rep(i,0,n) {
        string s;
        cin>>s;
        mp[s]++;
    }
    int m;
    cin>>m;
    rep(i,0,m){
        string t;
        cin>>t;
        mp[t]--;
    }
    
    int ans=0;
    for(auto p:mp){
        ans=max(ans,p.second);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
static const int MAX_N = 16;
static const int INFTY = (1 << 29);
int V;
int G[MAX_N][MAX_N];
int dp[1 << MAX_N][MAX_N];

int rec(int S, int v) {
    if (dp[S][v] >= 0) return dp[S][v];
    if (S == (1 << V) -1 && v == 0) return dp[S][v] = 0;
    int res = INFTY;
    for (int u = 0;  u < V; u++) {
        if (! (S >> u & 1)) {
            res = min(res, rec(S | 1 << u, u) + G[v][u]);
        }
    }
    return dp[S][v] = res;
}


int main()
{
    int E, source, target, cost;
    scanf("%d %d", &V, &E);
    for (int i = 0; i < V; i++) fill(G[i], G[i]+V, INFTY);
    for (int i = 0; i < E; i++) {
        scanf("%d %d %d", &source, &target, &cost);
        G[source][target] = cost;
    }

    memset(dp, -1, sizeof (dp));
    int res = rec(0, 0);
    (res == INFTY) ? printf("%d\n", -1) : printf("%d\n", res);
    return 0;
}



Measured memory_bytes: 7328
from enum import Enum
import sys

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

class Point():
    def __init__(self,arg_x,arg_y):
        self.x = arg_x
        self.y = arg_y

def calc_len(a,b):
    from math import sqrt
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))

x1,y1,x2,y2 = map(float,input().split())

p1 = Point(x1,y1)
p2 = Point(x2,y2)

print("%.10f"%calc_len(p1,p2))



Measured memory_bytes: 6356
a=[]
ra=[]
for i in range(5):
  a.append(int(input()))

for i in range(5):
  ra.append(a[i]%10)

tot=0
for i in range(5):
  if ra[i]==0:
    tot+=a[i]

  else:
    tot+=a[i]+10-ra[i]
    

ra.sort()
for i in range(5):
  if ra[i]==0:
    continue
  else:
    tot-=10-ra[i]
    break
print(tot)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 51;
ll a[MAXN];
int n;
int main() 
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    ll ans = 0, MAX;
    while ((MAX = *max_element(a + 1, a + 1 + n)) >= n)
    {
        for (int i = 1; i <= n; i++)
        {
            ll t = (a[i] - (a[i] % n)) / n;
            ans += t;
            a[i] %= n;
            for (int j = 1; j <= n; j++) if (j != i) a[j] += t;
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt

    for(i <- 1 to n) {
      i match {
        case i if i.toString.contains('3') =>
          print(" "+i)
        case i if i % 3 == 0 =>
          print(" "+i)
        case _ =>   
      }
    }
    println
  }
}

Measured memory_bytes: 49676
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
using namespace std;
static const int MAX = 10010;
static const int INF = INT_MAX;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

struct Node {
  int v, c;
};

bool operator > (const Node& v1, const Node& v2) {
  return v1.c > v2.c;
}

vector<Node> adj[MAX];
int color[MAX];
int d[MAX];
int n;

void dijkstra(int s) {
  rep(u, n) {
    color[u] = WHITE;
    d[u] = INF;
  }
  d[s] = 0;

  priority_queue<Node, vector<Node>, greater<Node>> PQ;
  PQ.push(Node{s, 0});

  while (!PQ.empty()) {
    Node n = PQ.top(); PQ.pop();
    int u = n.v;
    int c = n.c;

    color[u] = BLACK;

    if (d[u] < c) continue;

    rep(i, adj[u].size()) {
      Node nextNode = adj[u][i];
      int v = nextNode.v;
      if (color[v] != BLACK) {
        if (d[u] + nextNode.c < d[v]) {
          d[v] = d[u] + nextNode.c;
          color[v] = GRAY;
          PQ.push(Node {v, d[v]});
        }
      }
    }
  }
}

int main() {
  cin >> n;
  rep(i, n) {
    int u, k;
    cin >> u >> k;
    rep(j, k) {
      int v, c;
      cin >> v >> c;
      adj[u].push_back(Node {v, c});
    }
  }
  dijkstra(0);
  rep(v, n) cout << v << " " << d[v] << endl;
  return 0;
}



Measured memory_bytes: 8052
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n;
 cout<<n*n;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
 //  cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 3660
//{
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FILL(i,n) memset(i,n,sizeof i)
#define X first
#define Y second
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
#ifdef brian
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // brian
//}


const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);

int main()
{
    IOS();
    string s;
    cin>>s;
    for(char c:s)if(c=='1')cout<<9;else cout<<1;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>
 
using namespace std;
  
/********** TEMPLATE STARTS HERE ***********/
    
#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define test int t; cin >> t; while(t--)
#define skip continue
#define stop break
#define sz(v) (int)v.size()
#define endl '\n'
#define PI 3.1415926535897932384626433832795
#define EPS 1e-9
#define gcd __gcd 
#define mp make_pair
#define debug(a) cout << #a << ": " << a << endl
#define debug1(a, l, r) FR(i, l, r) cout << a[i] << " "; cout << endl
#define SET(a, b) memset(a, b, sizeof(a));
#define refresh fflush(stdout);
#define digits(n) (int)(log10(n) + 1)
  
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pii> vii;
typedef vector <pll> vll;
    
const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3f3f;
    
template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
   
/*********** TEMPLATE ENDS HERE *************/


main()
{
	IOS
	
	int n;
	cin >> n;
	
	if(n == 1)
		cout << "Hello World";
	else
	{
		int x, y;
		cin >> x >> y;
		cout << x + y;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <set>
#include <cmath>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b+1;i++)
#define Per(i,b,a) for(int i=b;i>=a;i--)
int main(){
    int P,Q,R;
    cin>>P>>Q>>R;
    int max_val = max(P,Q);
    max_val = max(R,max_val);
    cout<<P+Q+R-max_val<<endl;
    return 0;
}

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

int main(){
    int x, y, a=0;
    cin >> x >> y;
    for(int i=0; i<=x; i++){
        for(int j=0; j<=x-i; j++){
            if(2*i + 4*j == y && i+j == x){
                cout << "Yes" << endl;
                return 0;
            } 
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
int isprime(int n)
{
  for(int i = 2; i * i <= n; i++)
      if(n % i == 0) return 0;
  return 1;
}

int main(void)
{
  int n,i,t=0,MAX=0;
  while(1)
  {
    scanf("%d",&n);
    if(n==0)  break;
    for(i=n;i>0;i--)
    {
      if(isprime(i)==1 && isprime(i-2) == 1)
        {
          MAX=i;
          printf("%d %d\n",MAX-2,MAX);
          break;
        }
    }
  }
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define per(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pii> vii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  int n;
  cin >> n;

  int cnt = 0, ans = 0;
  rep(i,0,n) {
    int a, b;
    cin >> a >> b;

    if (a==b) {
      ++cnt;
      ckmax(ans, cnt);
    } else {
      cnt = 0;
    }
  }

  if (ans >= 3) cout << "Yes\n";
  else cout << "No\n";

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<int,pair<int,int>>;
#define MAX 200003
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  vector<int> x(5);
  for(int i=0;i<5;i++){
    cin>>x.at(i);
  }
  for(int i=0;i<5;i++){
    if(x.at(i)==0){
      cout<<i+1<<endl;
    }
  }
}


Measured memory_bytes: 3624
def main():
    S = input()
    T = input()
    if len(S) != len(T):
        return "No"
    for i in range(len(S)):
        if S[i] == T[0] and S[i:] + S[:i] == T:
            return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 2940
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, n = map(int, readline().split())
a = list(map(int, readline().split()))
if sum(a) >= h:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 12368
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
//#define shosu(n) setprecision(n)
//#define ENDL endl
using namespace std;
int main() {
  int A, B;
  char s;
  while (cin >> A >> s >> B) {
    if (s == '?')
      break;
    if (s == '+')
      cout << A + B << endl;
    if (s == '-')
      cout << A - B << endl;
    if (s == '*')
      cout << A * B << endl;
    if (s == '/')
      cout << A / B << endl;
  }
  return 0;
}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

int calc(ll n){
	if(n == 0) return 0;
	return n % 10 + calc(n / 10);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll n;
	cin >> n;
	ll wa = 99999999999999999;
	while(true){
		if(n >= wa){
			cout << calc(wa) << "\n";
			return 0;
		}
		else {
			ll we;
			for(we = 1; wa / we >= 10; we *= 10);
			wa -= we;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

int main(){
    lli n,k,a,ans=0;
    map<lli,lli> m;
    vector<lli> v;
    lli i;
    cin>>n>>k;
    rep(i,0,n){
        cin>>a;
        m[a]++;
    }
    if(k<m.size()){
        for(auto j=m.begin();j!=m.end();j++){
            v.push_back(j->second);
        }
        sort(v.begin(),v.end(),greater<>());
        rep(i,0,k){
            ans+=v[i];
        }
        ans=n-ans;
    }
    cout<<ans<<endl;
}


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

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int dataSet = scanner.nextInt();
			if (dataSet == 0) {
				break;
			}
			int[] scoreArray = new int[dataSet];
			for (int i = 0; i < dataSet; i++) {
				scoreArray[i] = scanner.nextInt();
			}

			Arrays.sort(scoreArray);

			int sum = 0;
			for (int i = 1; i < scoreArray.length - 1; i++) {
				sum += scoreArray[i];
			}

			System.out.println(sum / (dataSet - 2));
		}
	}
}

Measured memory_bytes: 20936
#include<bits/stdc++.h>
using namespace std;    
#define int long long        
#define endl "\n"
#define deb(x) cout<<#x<<" "<<x<<endl
#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar) for(int pen=0;pen<sizeof(ar)/8;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rt return 0;
#define mod 1000000007
const int N= 8*1e5+ 10;
int st[N]={0};
void update(int ss, int se, int i, int diff, int si)  
{  
    // Base Case: If the input index lies outside the range of  
    // this segment  
    if (i < ss || i > se)  
        return;  
  
    // If the input index is in range of this node, then update  
    // the value of the node and its children  
    st[si] = st[si] + diff;  
    if (se != ss)  
    {  
        int mid = (ss+se)/2;  
        update(ss, mid, i, diff, 2*si);  
        update(mid+1, se, i, diff, 2*si + 1);  
    }  
}  
int get_sum(int ss, int se, int qs, int qe, int si)  
{  
    // If segment of this node is a part of given range, then return  
    // the sum of the segment  
    if (qs <= ss && qe >= se)  
        return st[si];  
  
    // If segment of this node is outside the given range  
    if (se < qs || ss > qe)  
        return 0;  
  
    // If a part of this segment overlaps with the given range  
    int mid = (ss+se)/2;
    return get_sum(ss, mid, qs, qe, 2*si) +  
        get_sum(mid+1, se, qs, qe, 2*si+1);  
} 
signed main()
{
    int n;
    cin>>n;
    int ar[n],br[n],cr[n];
    for(int i=0;i<n;i++){
        cin>>ar[i]>>br[i]>>cr[i];
    }
    int dp[n][3];
    dp[0][0]=ar[0];
    dp[0][1]=br[0];
    dp[0][2]=cr[0];

    for(int i=1;i<n;i++){
        dp[i][0]=ar[i]+ max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=br[i]+ max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=cr[i]+ max(dp[i-1][0],dp[i-1][1]);
    }
    int mx=max(dp[n-1][0], max(dp[n-1][1],dp[n-1][2]));
    cout<<mx<<endl;
}

Measured memory_bytes: 4992
#include <cstdio>

using namespace std;

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

    long long maxim(0), wMax(0);

    int *v = new int[n + 1];
    int *w = new int[n + 1];
    long long *costuri = new long long[W + 1];

    for (int i = 1 ; i <= n ; i++)
    {
        scanf("%d %d",&w[i],&v[i]);
        for (int j = wMax ; j >= 1 ; j--)
        {
            if (j + w[i] <= W)
                if (costuri[j + w[i]] < v[i] + costuri[j] && costuri[j] != 0)
                {
                    costuri[j + w[i]] = v[i] + costuri[j];
                    if (v[i] + costuri[j] > maxim)
                        maxim = v[i] + costuri[j];
                    if (j + w[i] > wMax)
                        wMax = j + w[i];
                }
        }
        if (costuri[w[i]] < v[i] || costuri[w[i]] == 0)
        {
            costuri[w[i]] = v[i];
            if (v[i] > maxim)
                maxim = v[i];
            if (w[i] > wMax)
                wMax = w[i];
        }
    }
    printf("%lld",maxim);
}


Measured memory_bytes: 1024