akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';

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

  Int n;
  string s;

  cin>>n>>s;
  vector<Int> rs(n+1,0);
  vector<Int> gs(n+1,0);
  vector<Int> bs(n+1,0);
  for(Int i=0;i<n;i++){
    rs[i+1]=rs[i]+(s[i]=='R');
    gs[i+1]=gs[i]+(s[i]=='G');
    bs[i+1]=bs[i]+(s[i]=='B');
  }

  Int ans=0;
  for(Int i=0;i<n;i++){
    for(Int j=i;j<n;j++){
      if(s[i]==s[j]) continue;
      Int k=j+(j-i);
      if(k<n and s[i]!=s[k] and s[j]!=s[k]) ans--;

      // [j, n)
      if(s[i]=='R' and s[j]=='G') ans+=bs[n]-bs[j];
      if(s[i]=='G' and s[j]=='R') ans+=bs[n]-bs[j];
      if(s[i]=='R' and s[j]=='B') ans+=gs[n]-gs[j];
      if(s[i]=='B' and s[j]=='R') ans+=gs[n]-gs[j];
      if(s[i]=='G' and s[j]=='B') ans+=rs[n]-rs[j];
      if(s[i]=='B' and s[j]=='G') ans+=rs[n]-rs[j];
    }
  }

  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 3736
s = raw_input().split()
n = int(s[0])
m = int(s[1])

red = [False for x in range(n)]
red[0] = True

cnt = [1 for x in range(n)]

for _ in xrange(0, m):
    s = raw_input().split()
    x = int(s[0]) - 1
    y = int(s[1]) - 1

    cnt[x] = cnt[x] - 1
    cnt[y] = cnt[y] + 1

    if red[x]:
        red[y] = True
        if cnt[x] == 0:
            red[x] = False

print(sum(red))


Measured memory_bytes: 7384
import java.util.Scanner;

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

        int n = sc.nextInt();
        int m = sc.nextInt();

        System.out.println(solve(n, m));

        sc.close();
    }

    static int solve(int n, int m) {
        return (n - 1) * (m - 1);
    }
}

Measured memory_bytes: 21844
#ifndef KHOKHO
//#pragma GCC optimize("O3")
#endif
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
//#define CHKR
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define ARRS int(1e6+500)
#define MAX ((long long)(1e18+1))
#define EP ((double)(1e-12))
#define HS1 ((ll)(1000001329))
#define HS2 ((ll)(1000001531))
#define MOD ((long long)1000000007ll)
#define AT9 ((long long)1000000000ll)
#define PI 3.14159265358979323846264338327950288419716939937510
#define LG 20


int main(){
	#ifdef KHOKHO
		freopen("in.in","r",stdin);
		freopen("out.out","w+",stdout);
	#endif //KHOKHO
	ll n,m,p;
	cin>>n>>m;
	ll mx=0;
	ll k;
	for(int i=0; i<n; i++){
		cin>>p;
		if(!i)k=p;
		else k=__gcd(p,k);
		mx=max(mx,p);
	}

	if(m<=mx&&(m%k==0)){
		cout<<"POSSIBLE";
	}
	else cout<<"IMPOSSIBLE";
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

type Position struct {
	time int
	x    int
	y    int
}

func main() {
	var n int

	fmt.Scan(&n)
	pst := make([]Position, n+1)
	pst[0] = Position{0, 0, 0}

 	for i := 1; i < n+1; i++ {
		fmt.Scan(&pst[i].time, &pst[i].x, &pst[i].y)
	}

	for i := 1; i < n+1; i++ {
		ts := pst[i].time - pst[i-1].time
		dxy := myAbs(pst[i].x-pst[i-1].x) + myAbs(pst[i].y-pst[i-1].y)
		if ts < dxy || ts%2 != dxy%2 {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

func myAbs(num int) int {
	if num >= 0 {
		return num
	}

	return -num
}


Measured memory_bytes: 5760
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
		sc = bufio.NewScanner(strings.NewReader(`
		5 2 2
		ccccc
	`))
		//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */

	n := nextInt()

	x := math.Ceil(float64(n) / 1.08)

	if int(math.Floor(x*1.08)) == n {
		fmt.Fprintln(out, x)
	} else {
		fmt.Fprintln(out, ":(")
	}
}

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

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

using ll = long long;

using namespace std;

int main() {
  in(int, a, b);
  out(a * b - (a + b) + 1);
}


Measured memory_bytes: 3636
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int a,b,c;
   cin >> a >> b >> c;

   int maxcnt = b/a;
   int ans = 0;
   if(maxcnt > c) ans = c;
   else ans = maxcnt;

   cout << ans << endl;






   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;
const int mod = 1000000007;

int main() {

  int A,B,M,mina=INF,minb=INF,ans=INF;
  cin>>A>>B>>M;
  vector<int> a(A),b(B);
  for(int i=0; i<A; i++){cin>>a[i];mina=min(mina,a[i]);}
  for(int i=0; i<B; i++){cin>>b[i];minb=min(minb,b[i]);}
  vector<vector<int>> m(M,vector<int>(3));
  ans=mina+minb;
  for(int i=0; i<M; i++){
    for(int j=0; j<3; j++){
      cin>>m[i][j];
    }
      ans=min(ans,a[m[i][0]-1]+b[m[i][1]-1]-m[i][2]);
  }
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  cout << ans << endl;
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
using ll = long long;

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

int main() {
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	ll lms = c * d / gcd(c, d);
	ll bl = b / c + b / d - b / lms;
	ll al = (a - 1) / c + (a - 1) / d - (a - 1) / lms;
	cout << b - a + 1 - (bl - al) << endl;
	return 0;
}

Measured memory_bytes: 256
N, K = map(int, (input().split()))

temp = [0 for i in range(N)]
for i in range(K):
    d = int(input())
    for a in list(map(int, input().split())):
        temp[a - 1] += 1

count = 0
for i in temp:
    if i == 0:
        count += 1
print(count)

Measured memory_bytes: 9188
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
int dx[4] = { 0,  0, 1, -1 };
int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int n, a; cin >> n >> a;
	vi k(n); int cnt = 0;
	rep(i, n) {
		cin >> k[i];
		if (k[i] >= a) cnt++;
	}
	ANS(cnt);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    int K;
    string S;

    cin >> N >> K;
    cin >> S;

    if(S.at(K-1) == 'A'){
        S.at(K-1) = 'a';
    }
    if(S.at(K-1) == 'B'){
        S.at(K-1) = 'b';
    }
    if(S.at(K-1) == 'C'){
        S.at(K-1) = 'c';
    }

    cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define MODB 998244353
#define INF 9223372036854775807
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}
signed main()
{
  int x=0,y=0,z=0,w=0,n=0,m=0;
string s="";
std::cin >>x >>s;
rep(i,x){
if(s[i]=='I'){
  y++;
  if(y>z)z=y;
}else{
  y--;

}
}
std::cout << z << '\n';

}


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

using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  int d=a/b;
  int r=a%b;
  double f=(double)a/b;
  cout<<d<<" "<<r<<" "<<setprecision(6)<<fixed<<f<<endl;
}

Measured memory_bytes: 1244
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n;

int main() {
	cin >> n;
	int b = n;
	int sum = 0;
	while (b > 0) {
		sum += b % 10;
		b /= 10;
	}
	if (n%sum == 0)cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main(){
    int A,B;
    int sum=0;
    cin >> A >>B;
    if(A>B){
        sum = A+A-1;
    }
    else if(B>A){
        sum = B+B-1;
    }
    else{
        sum =A+B;
    }
    cout << sum <<endl;
}

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

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



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

int main() {
  long long int n,x;
  cin >> n >> x;
  
  vector<long long int> a(n);
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= x;
    a[i] = abs(a[i]);
  }
  
  if (n == 1) {
    cout << abs(a[0]) << endl;
    return 0;
  }
  
  sort(a.begin(), a.end());
  vector<long long> diff(n-1);
  
  vector<long long> yakusuu;
  
  for(long long int i = 1; i < sqrt(a[0]) + 1; i++) {
    if (a[0] % i == 0) {
      yakusuu.push_back(i);
      yakusuu.push_back(a[0]/i);
    }
  }
  
  sort(yakusuu.begin(), yakusuu.end());

  int cnt;
  for(long long int y: yakusuu) {
    int flag = 1;
    for(long long int i = 0; i < n-1; i++) {
      if (a[i] % y > 0) {
        flag = 0;
        break;
      }
    }
    if (flag == 1) cnt = y;
  } 
  cout << cnt << endl;
}

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

using namespace std; 

#define pb push_back
#define fi first
#define se second
#define all(vec) vec.begin(),vec.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define fp(i,a,b,p) for(int i=a;i<b;i+=p)
#define SZ(x) (int)x.size()

typedef  vector<string> vs;
typedef  vector<int> vi;
typedef  vector<long long> vl;	


int main(){
	
	long long n,m;
	
	
	cin >> n >> m; 
	
	vector<pair<long long,long long>> v(n);
	
	f(i,0,n){
		cin >> v[i].fi  >> v[i].se ;
	}
	sort(all(v));
	
	
	int idx = 0;
	
	long long ans = 0;
	
	
	while(1){
	
		if(m<=v[idx].se){
			ans+= m * v[idx].fi; 
			break;
		}else{
			ans+= v[idx].fi * v[idx].se;
			m -= v[idx].se;
		}
		idx++;
	}
	
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int64_t a, b, c;
    cin >> a >> b >> c;
    if(c-a-b < 0) {
        cout << "No" << endl;
    } else if(4*a*b < (c-a-b)*(c-a-b)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, t;
    cin >> a >> b >> c;
    if(a > 2 * b)
        t = (c + 499) / 500 * b;
    else if(a < b || c % 1000 > 500)
        t = (c + 999) / 1000 * a;
    else if(c % 1000)
        t = c / 1000 * a + b;
    else
        t = c / 1000 * a;

    cout << t << endl;
}


Measured memory_bytes: 3184
N,K=map(int, raw_input().split())
V=map(int, raw_input().split())

max_len=min(N,K)

ans=0
for l in range(max_len+1):
	for r in range(max_len-l+1):
		T=V[:l]
		if r!=0:	T+=V[-1*r:]
		suteru=K-(l+r)
		#print "l,r,T :::: ",l,r,T
		T.sort()

		for i in range( min( suteru, len(T)) ):
			if T[i]<0:
				T[i]=0
		ans=max( ans, sum(T) )

print ans

Measured memory_bytes: 34028
<?php
$str = trim(fgets(STDIN));
$d = new dice($str);

$d->rotate(trim(fgets(STDIN)));
echo $d->top();
echo PHP_EOL;

class dice
{
    private $faces = [1,2,3,4,5,6,];
    private $view = [1,2,3,4,5,6,];

    public function __construct($str)
    {
        $this->faces = explode(" ",$str);
        $this->view = $this->faces;
    }
    
    public function rotate($str)
    {
        $direction = str_split($str);
        foreach($direction as $dir)
        {
            $this->turn($dir);
        }
    }

    private function turn($way)
    {
        switch($way)
        {
            case "N":
                $tmp = $this->view[4];
                $this->view[4] = $this->view[0];
                $this->view[0] = $this->view[1];
                $this->view[1] = $this->view[5];
                $this->view[5] = $tmp;
                break;
            case "E":
                $tmp = $this->view[2];
                $this->view[2] = $this->view[0];
                $this->view[0] = $this->view[3];
                $this->view[3] = $this->view[5];
                $this->view[5] = $tmp;
                break;
            case "S":
                $tmp = $this->view[4];
                $this->view[4] = $this->view[5];
                $this->view[5] = $this->view[1];
                $this->view[1] = $this->view[0];
                $this->view[0] = $tmp;
                break;
            case "W":
                $tmp = $this->view[2];
                $this->view[2] = $this->view[5];
                $this->view[5] = $this->view[3];
                $this->view[3] = $this->view[0];
                $this->view[0] = $tmp;
                break;
        }
    }
    
    public function top()
    {
        return $this->view[0];
    }
}

Measured memory_bytes: 15472
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;



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

	int A, B, C, X;
	cin >> A >> B >> C >> X;
	int res = 0;
	REP(i, A + 1)REP(j, B + 1)REP(k, C + 1) {
		if (500 * i + 100 * j + 50 * k == X) res++;
	}
	cout << res << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>//usage of stl queue<type> q, q.size(), q.front(), q.pop(), q.push(x), q.empty().
//#include<cstdio>
#include<queue>
//#include<string>
//#include<algorithm>
using namespace std;
int main()
{
  int n, q, t;
  string name;
  queue <pair<string, int>> Q;//try not to separate >> with blank in c++11.
  cin >> n >> q;

  for(int i=0; i<n; i++)
  {
    cin >> name >> t;
    Q.push(make_pair(name, t));
  }

  pair<string, int> u;
  int elaps = 0, a;

  while(!Q.empty())
  {
    u = Q.front(); Q.pop();
    a = min(u.second, q);
    u.second -= a;
    elaps += a;
    if(u.second > 0)
    {
      Q.push(u);
    }
    else
    {
      cout << u.first << " " << elaps << endl;
    }
  }


  return 0;
}



Measured memory_bytes: 6120
#include <iostream>

using namespace std;

int main()
{
    long long int N;
    cin>>N;
    int m = N%1000;
    if(m==0)
    {
        cout<<"0";
    }
    else if(m!=0)
    {
        cout<<1000-m;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  int d=max(a,max(b,c));
  int e=d;
  rep(i,0,k) e*=2;
  cout<<a+b+c-d+e<<endl;
}

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

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    for(int i=1; i<=n; ++i){
        if( floor(i*1.08) == n ){
            cout << i << "\n";
            exit(0);
        }
    }
    cout << ":(\n";
}


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

using namespace std;

int main() {
  int64_t x, y;
  cin >> x >> y;
  int64_t a = x;
  int64_t ans = 0;
  while (a <= y) {
    a *= 2;
    ++ans;
  }
  cout << ans << endl;

  return 0;
}


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

using namespace std;

const int N = 5e5 + 10;

int ans[N];
int to[N];

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

	int n, d;
	cin >> n >> d;
	vector<int> a(n);
	for (auto &t : a) {
		cin >> t;
	}
	to[n] = 1;
	for (int i = n - 1; i >= 0; i--) {
		if (a[i] >= 2 * to[i + 1]) {
			to[i] = to[i + 1];
		} else {
			to[i] = to[i + 1] + a[i];
		}
	}
	int c = d;
	for (int i = 0; i < n; i++) {
		if (to[i + 1] <= c) {
			ans[i] = 1;
		}
		c = min(c, abs(c - a[i]));
	}
	int q;
	cin >> q;
	while (q--) {
		int x;
		cin >> x;
		x--;
		if (ans[x]) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}
	}
}

Measured memory_bytes: 7808
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;



int main() 
{
  ll N; cin>>N;
  map<char,ll> mapname;
  mapname['M']=0;
  mapname['A']=0;
  mapname['R']=0;
  mapname['C']=0;
  mapname['H']=0;
  rep(i,N)
  {
    string name; cin>>name;
    if(mapname.count(name.at(0))) {mapname.at(name.at(0))++;}
  }
  vector<ll> vecnum(5);
  ll i=0;
  for(auto p:mapname)
  {
    vecnum.at(i)=p.second;
    i++;
  }
  ll ans=0;
  for(ll i=0;i<5;i++)
  {
    for(ll j=i+1;j<5;j++)
    {
      for(ll k=j+1;k<5;k++)
      {
        ans+=vecnum.at(i)*vecnum.at(j)*vecnum.at(k);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){
    string s,ans;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='0')ans=ans+'0';
        else if(s[i]=='1')ans=ans+'1';
        else if(s[i]=='B'){
            if(ans.length()==0)continue;
            else ans=ans.substr(0,ans.length()-1);
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

int main(){
  int N,K;
  cin >> N >> K;

  int i;
  vector<int> a(N);
  for(i=0 ; i<N ; i++) cin >> a[i];

  sort(a.begin(),a.end());
  /* for(i=0 ; i<N ; i++)
     cout << a[i] << endl;*/

  int k;
  int ans=0;
  for(k=N-1 ; k>=N-K ; k--){
    ans += a[k];
  }

  cout << ans << endl;
}


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

int main(){
    string s;
    int x,y;
    cin >> s >> x >> y;
    vector<int> move_x,move_y;
    bool x_frag=true;
    int count=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='T'){
            if(x_frag){
                move_x.push_back(count);
                x_frag=false;
            }
            else{
                move_y.push_back(count);
                x_frag=true;
            }
            count=0;
            continue;
        }
        if(x_frag){
            count++;
            if(i==s.size()-1) move_x.push_back(count);
        }
        else{
            count++;
            if(i==s.size()-1) move_y.push_back(count);
        }
    }
    
    int now_x=move_x[0], now_y=0;
    move_x[0] = 0;
    sort(move_x.begin(),move_x.end(),greater<int>());
    sort(move_y.begin(),move_y.end(),greater<int>());

    for(int i=0;i<move_x.size();i++){
        if(now_x <= x) now_x += move_x[i];
        else now_x -= move_x[i];
    }
    for(int i=0;i<move_y.size();i++){
        if(now_y <= y) now_y += move_y[i];
        else now_y -= move_y[i];
    }
    if(now_x==x&&now_y==y) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

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

  int cnt = 0;
  while (A >= B) {
    B *= 2;
    cnt++;
  }
  while (B >= C) {
    C *= 2;
    cnt++;
  }
  string ans = cnt <= K ? "Yes" : "No";
  cout << ans << endl;
}


Measured memory_bytes: 3596
#include <stdio.h>
long d[26]={},m=1e9+7,i,n,a=1;main(){scanf("%d\n",&n);for(;i<n;++i)d[getchar()-'a']++;for(i=0;i<26;++i)a=(a*(d[i]+1))%m;printf("%d\n",a-1);}

Measured memory_bytes: 128
n=int(input())
s=[int(input()) for i in range(n)]

li=[]
for i in s:
    if i%10!=0:
        li.append(i)
        
li.sort()

if n==1:
    print(0 if s[0]%10==0 else li[0])
elif len(li)>0:
    print(sum(s)-li[0] if sum(s)%10==0 else sum(s))
else:
    print(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll mod=1e9+7,i,j;
ll n;
ll a[300005];
ll x,y;
int main(){
    cin>>n;
    for(i=1;i<=n;i++) cin>>a[i];
    ll nr=1,ans=0;
    for(i=1;i<=n;i++){
        if(a[i]==nr){
            nr++;
            ans++;
        }
    }
    if(ans==0) cout<<"-1";
    else cout<<n-ans;
    return 0;
}



Measured memory_bytes: 1792
//b.c B-Digit Sums
#include<stdio.h>


int keta(int x){
    int num;
    while(x!=0){
        x /= 10;
        ++num;
    }
    return num;
}

int main(void){
    int n,m,k,sum=0,dig,s=1;
    scanf("%d",&n);
    dig = keta(n);
    m = n;
    k = n;

    for(int i=1;i<dig;++i){
        s *= 10;
    }

    for(int i=0;i<dig;++i){
        sum += n/s;
        n = n/s * s;
        n = m-n;
        m = n;
        s /= 10;
    }

    if(k%sum==0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String w=sc.next();
        String t;
        int count=0;
        while(!((t=sc.next()).equals("END_OF_TEXT"))){
            t=t.toLowerCase();
            if(t.equals(w)){
                count++;
            }
        }
        System.out.println(count);
        sc.close();
    }
}
    


Measured memory_bytes: 26168
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int t = sc.nextInt();
        System.out.println((n + x - 1) / x * t);
    }

}


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

int main()
{
  uint64_t D;
  std::cin >> D;
  
  switch(D) {
    case 25: std::cout << "Christmas"             << std::endl; break;
    case 24: std::cout << "Christmas Eve"         << std::endl; break;
    case 23: std::cout << "Christmas Eve Eve"     << std::endl; break;
    case 22: std::cout << "Christmas Eve Eve Eve" << std::endl; break;
  }
  
  return 0;
}

Measured memory_bytes: 256
// ????????????????????°??????: ??£??\?????????

// Library
#include<vector>
#include<queue>
#include<functional>
#include<cassert>
// Type
typedef int Vertex;
typedef int Weight;
struct Edge {
  Vertex from, to;
  Weight weight;
};
bool operator<(const Edge& lhs, const Edge& rhs) {
  if(lhs.weight != rhs.weight) return lhs.weight < rhs.weight;
  if(lhs.from != rhs.from) return lhs.from < rhs.from;
  return lhs.to < rhs.to;
}
bool operator>(const Edge& lhs, const Edge& rhs) {
  if(lhs.weight != rhs.weight) return lhs.weight > rhs.weight;
  if(lhs.from != rhs.from) return lhs.from > rhs.from;
  return lhs.to > rhs.to;
}
// Class
class Graph {
public:
  explicit Graph(int size);
  void add(const Vertex& from, const Vertex& to, const Weight& weight = 1);
  const std::vector<Edge> minimum_spanning_tree() const;
private:
  int size_;
  std::vector<std::vector<Edge>> edge_;
};
// Implement
Graph::Graph(int size) : size_(size), edge_(size) {
  assert(0 < size);
}
void Graph::add(const Vertex& from, const Vertex& to, const Weight& weight) {
  assert(from < size_ && to < size_);
  edge_.at(from).push_back({from, to, weight});
  edge_.at(to).push_back({to, from, weight});
}
// Minimum Spanning Tree: Prim's algorithm, O(|E| + |V| log |V|)
const std::vector<Edge> Graph::minimum_spanning_tree() const {
  std::vector<Edge> result;
  std::priority_queue<Edge, std::vector<Edge>, std::greater<Edge>> q(std::begin(edge_.front()), std::end(edge_.front()));
  std::vector<bool> visited(size_, false);
  visited.front() = true;
  while(!q.empty()) {
    auto current = q.top();
    q.pop();
    if(visited.at(current.to)) continue;
    visited.at(current.to) = true;
    result.push_back(current);
    for(const auto& e: edge_.at(current.to)) if(!visited[e.to]) q.push(e);
  }
  assert(result.size() == size_ - 1);
  return result;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
  int V, E;
  cin >> V >> E;
  Graph g(V);
  for(int i = 0; i < E; ++i) {
    int s, t, w;
    cin >> s >> t >> w;
    g.add(s, t, w);
  }
  auto mst = g.minimum_spanning_tree();
  cout << accumulate(begin(mst), end(mst), 0, [](int sum, Edge e){return sum + e.weight;}) << endl;
}

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

int main() {
	int x,n;
	cin>>x>>n;
	unordered_set<int> s;
	for(int i=0;i<n;i++){int b;cin>>b;s.insert(b);}
	int diff=0;int res;
	while(true){
	    int a=x-diff,b=x+diff;
	    if(s.find(a)==s.end()){res=a;break;}
	    else if(s.find(b)==s.end()){res=b;break;}
	    diff++;
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;


int main(){
  //整数の時はint
  int x,ans=0;
  //文字の時はstring
  //string s;
  cin>>x;
  if(x>=30)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3596
<?php
$str = trim(fgets(STDIN));
$str = str_replace("BC", "D", $str);
$str = str_replace("C", "B", $str);
$sum = 0;
foreach(explode("B", $str) as $block){
  if($block){
    $countA = 0;
    for($i = 0; $i < strlen($block); $i++){
      if($block[$i] == "A"){
        $countA++;
      }else{
        $sum+=$countA;
      }
    }
  }
}
echo $sum;


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

const double pi=acos(-1.0);

double num[3010];
int n,l;

inline int rd()
{
	int x=0;char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar());
	for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

int main()
{
	n=rd();l=rd();
	for (int i=1;i<=n;i++) num[i]=rd();
	double ansx=0,ansy=0;
	for (int i=1;i<n;i++) for (int j=i+1;j<=n;j++)
	{
		ansx+=cos((num[i]+num[j])/l*pi)*(n-(j-i+1));
		ansy+=sin((num[i]+num[j])/l*pi)*(n-(j-i+1));
		ansx+=cos((num[i]+num[j]+l)/l*pi)*(j-i-1);
		ansy+=sin((num[i]+num[j]+l)/l*pi)*(j-i-1);
	}
	double all=(double)n*(n-1)*(n-2)/6;
	printf("%.15lf %.15lf\n",ansx/all,ansy/all);
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int n,x,sum;
bitset<2000007>f;
int main(){
    cin>>n;
    f[0]=1;
    for(int i=1;i<=n;++i)
    {
        cin>>x;
        f|=f<<x;
        sum+=x;
    }
    for(int i=(sum+1)/2;i<=sum;++i)
        if(f[i]) {cout<<i<<endl;break;}
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

long long maxi,n,W,i,gr,p[101],w[101],d[101][100010];

int main()
{
    cin>>n>>W;
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>p[i];
    }

    d[1][w[1]]=p[1];
    for(i=2;i<=n;i++)
    {
        for(gr=0;gr<=W;gr++)
        {
            d[i][gr]=d[i-1][gr];
            if(gr-w[i]>=0)d[i][gr]=max(d[i][gr],d[i-1][gr-w[i]]+p[i]);
        }
    }

    for(gr=0;gr<=W;gr++)
        maxi=max(maxi,d[n][gr]);

    cout<<maxi;
    return 0;
}


Measured memory_bytes: 77568
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:1024000000,1024000000")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second

#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e6+5, LG = 17, MOD = 1e9+7;
const int SQ = 390;
const long double EPS = 1e-7;
vector<ll> val[11];
int32_t main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#endif // ONLINE_JUDGE

  val[0].pb(0);
  string s; cin >> s;

  f(i,0,s.size()){
    ll cur = 0;
    f(j,i,s.size()){
      cur = cur * 10 + (s[j] - '0');
      for(auto x : val[i])
        val[j+1].pb(x+cur);
    }
  }

  cout << accumulate(val[s.size()].begin(),val[s.size()].end(),0ll) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n,k,i,j,tmp;
  int l[50];
  
  scanf("%d %d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&l[i]);
  }
  
  for(i=n-1;i>0;i--){
    for(j=0;j<i;j++){
      if(l[j]<l[j+1]){
        tmp=l[j];
        l[j]=l[j+1];
        l[j+1]=tmp;
      }
    }
  }
  
  tmp=0;
  for(i=0;i<k;i++){
    tmp+=l[i];
  }
  printf("%d",tmp);
}

Measured memory_bytes: 128
n = int(input())

s={}

s["AC"] = 0
s["WA"] = 0
s["TLE"] = 0
s["RE"] = 0


for i in range(n):
    r = input()
    s[r] += 1


print('AC x ' + str(s["AC"]))
print('WA x ' + str(s["WA"]))
print('TLE x ' + str(s["TLE"]))
print('RE x ' + str(s["RE"]))



Measured memory_bytes: 74328
var cost:array[0..100005] of int64;
dp:array[0..100005] of int64;
i,o,p,l,k,m,n,h,indexx:longint;
begin
read(n);
for i:=1 to n do begin
        read(cost[i]);
        end;
dp[0]:=0;
dp[1]:=0;
dp[2]:=abs(cost[2]-cost[1]);
for i:=3 to n do begin
        if abs(cost[i]-cost[i-1])+dp[i-1] < abs(cost[i]-cost[i-2])+dp[i-2] then indexx:=i-1
        else indexx:=i-2;
        dp[i]:=abs(cost[i]-cost[indexx])+dp[indexx];
        //writeln('dp[',i,']= ',dp[i]);
        end;
writeln(dp[n]);
end.



Measured memory_bytes: 1664
n = int(input())
ans = 0
for i in range(1, n + 1, 2):
    j = 1
    cnt = 0
    while j * j <= i:
        if i % j == 0:
            cnt += 1
            if j != i // j:
                cnt += 1
        j += 1
    if cnt == 8:
        ans += 1
print(ans)


Measured memory_bytes: 2940
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        a: f64,
        v: f64,
        b: f64,
        w: f64,
        t: f64,
    }

    if v <= w {
        println!("NO");
    } else {
        let mut ans = (b - a) / (w - v);
        if ans < 0f64 {
            ans = -1f64 * ans;
        }
        if ans <= t {
            println!("YES");
        } else {
            println!("NO");
        }
    }
}


Measured memory_bytes: 2160
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N,Y;
		N = sc.nextInt();
		Y = sc.nextInt();
		for(int i = 0; i <= N; ++i) {
			for(int j = 0; j <= N-i; ++j) {
				int k = N-i-j;
				if(10000*i+5000*j+1000*k == Y) {
					System.out.println(i+" "+j+" "+k);
					return;
				}
			}
		}
		System.out.println(-1+" "+-1+" "+-1);
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    int R = count(all(s), 'R');
    vector<int> sumR(n + 1, 0), sumW(n + 1, 0);
    for(int i = 0; i < n; i++) {
        sumR[i + 1] = sumR[i] + (s[i] == 'R');
    }
    int ans = n;
    for(int i = 0; i <= n; i++) {
        int tmp = 0;
        tmp += abs(R - i);
        tmp += i - sumR[i];
        chmin(ans, tmp);
    }
    cout << ans << endl;

}

Measured memory_bytes: 5168
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define endl '\n'
#define pb push_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define TRACE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

const ll inf = 2e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;

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

	int x;
	cin >> x;
	if(x) {
		cout << 0;
	}
	else {
		cout << 1;
	}

	return 0;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
 //Compiler version g++ 6.3.0

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

Measured memory_bytes: 256
def solve()
    n = gets.to_i
    answers = gets.chomp.chars.map{|token| token == "o"}
    animals = Array.new(n)
 
    [true, false].repeated_permutation(2) do |head, tail|
        animals[0] = head
        animals[-1] = tail
 
        (0...n).each{|i| animals[i + 1] = (animals[i] == answers[i]) ? animals[i - 1] : !animals[i - 1]}
        return animals[0...-1].map{|animal| animal ? "S" : "W"}.join if animals[0] == animals[-1] && animals[-2] == tail
    end
 
    "-1"
end
 
puts solve()

Measured memory_bytes: 14332
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::{min, max};

#[fastout]
fn main() {
    input! {
    n: usize,
    t: f64,
    a: f64,
    h: [f64; n]
    }
    let mut d = 100000000.0;
    let mut ans = 0;
    for i in 0..n {
        if (a - (t - h[i] * 0.006)).abs() < d {
            d = (a - (t - h[i] * 0.006)).abs();
            ans = i + 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2200
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG // checks for container overflows
#pragma GCC optimize "trapv" // to chcek for int overflow
#pragma -Wduplicated-cond // dupilcate conditions
#endif

#include "bits/stdc++.h"
using namespace std;
using namespace chrono;
typedef unsigned long long int ull;
typedef long long ll;
int main()
{
#ifndef ONLINE_JUDGE
    auto start = high_resolution_clock::now();
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    register int  i;
    int n;
    ull p, k, t;

    cin >> n >> k;

    vector<int> a(n);

    for (i = 0; i < n; i++)
        cin >> a[i];
    p = a[0] * a[k - 1];

    t = a[0];

    for (i = 1; i + k - 1 < n; i++)
    {
        if (a[i - 1] < a[i + k - 1])
            cout << "Yes\n";
        else
            cout << "No\n";
    }


#ifndef ONLINE_JUDGE
    auto end = high_resolution_clock::now();
    double time_taken = duration_cast<nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cout << "\nTime : " << fixed << time_taken << setprecision(9);
#endif
    return 0;
}

Measured memory_bytes: 3984
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 200005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n>>k;
	ll ar[n+1];
	for(i=1;i<=n;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+n+1);

	ll an=0;
	for(i=1;i<=k;i++){
		an+=ar[i];
	}
	cout<<an;
	return 0;	
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

bool	acgt(string &s)
{
	for (char c : s) {
		if (c != 'A' and c != 'C' and c != 'G' and c != 'T')
			return false;
	}
	return true;
}

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

	string s;
	cin >> s;

	int n = s.size();
	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int len = 1; len <= n - i; len++) {
			string sub = s.substr(i, len);
			if (acgt(sub)) {
				chmax(ans, (int)sub.size());
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>

using namespace std;

int main()
{
    int N, M, X, S, ans;
    cin >> N >> M >> X;
    int m[N][M+1] = {0};
    int sum[M+1] = {0};
    for(int i=0; i < N; i++){
        for(int j = 0; j < M+1; j++){
            cin >> m[i][j];
            sum[j] = sum[j] + m[i][j];
        }
    }
    for(int j = 1; j < M+1; j++){
        if(sum[j] < X){
            ans = -1;
            break;
        }
        ans = sum[0];
    }


    for(int i = 0; i < pow(2,N); i++){
        S = i;
        int sum[M+1] = {0};
        for(int j = 0; j < N; j++){
            if(S >= pow(2, N-j-1)){
                for(int k = 0; k <= M; k++){
                    sum[k] = sum[k] + m[j][k]; 
                }
                S = S - pow(2, N-j-1);
            }
        }
        for(int j = 1; j < M+1; j++){
            if(sum[j] < X){
                break;
            }else if(j == M and sum[j] >= X){
                if(sum[0] < ans)
                    ans = sum[0];
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 4020
using System;

delegate T Function<T>(T v1, T v2);

class SegTree<T>
{

    public int Count { get; }
    
    int n_layer;
    int[] segsize;
    T[][] data;

    Function<T> function;
    
    public SegTree(int N, Function<T> function, T fill=default(T))
    {
        Count=N;

        this.function=function;
        
        n_layer=1;
        for(int k=1; k<N; k<<=1) n_layer+=1;

        segsize = new int[n_layer];
        data = new T[n_layer][];
        for(int l=0; l<n_layer; ++l) {
            segsize[l] = 1<<(n_layer-1-l);
            data[l] = new T[1<<l];
            for(int j=0; j<(1<<l); ++j) data[l][j]=fill;
        }
    }
    
    public void Update(int index, T value) {
        data[n_layer-1][index] = value;
        for(int l=n_layer-2; l>=0; --l) {
            index = index/2;
            data[l][index] = function(data[l+1][index*2], data[l+1][index*2+1]);
        }
    }

    public T Query(int ibgn, int iend, int l=0) {
        int ssize = segsize[l];
        if(ibgn%ssize==0 && iend-ibgn==ssize) return data[l][ibgn/ssize];

        int imid = ibgn - ibgn%ssize + ssize/2;
        if(iend<=imid || imid<=ibgn) return Query(ibgn, iend, l+1);
        return function(Query(ibgn, imid, l+1), Query(imid, iend, l+1));
    }
    

    public void Print()
    {
        Console.WriteLine($"Count   : {Count}");
        Console.WriteLine($"n_layer : {n_layer}");
        for(int l=0; l<n_layer; ++l) {
            Console.WriteLine($"[{l}] "+string.Join(" ", data[l]));
        }
    }
}


class Program
{
    static void Main()
    {
        var str = Console.ReadLine().Split(' ');
        int N = int.Parse(str[0]), K = int.Parse(str[1]);

        int Amax = 300000;
        var st = new SegTree<int>(Amax+1, Math.Max);

        for(long i=0; i<N; ++i) {
            var A = int.Parse(Console.ReadLine());
            st.Update(A, st.Query(Math.Max(0, A-K), Math.Min(Amax, A+K)+1)+1);
        }
        
        Console.WriteLine(st.Query(0, Amax+1));
    }
}


Measured memory_bytes: 42724
#include<bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<stack>
#include<vector>
#include<list>
#include<iomanip>
#include<map>
#include<queue>
#define pb push_back
#define pu push
#include<string>

using namespace std;

int main()
{
	string s;
	int n,i,j,c=0;
	cin>>n>>s;
	for(i=0;i<s.size();i++)
	{
		if(s[i]=='A')
		{
			for(j=i+1;j<=i+1;j++)
			{
				if(s[j]=='B')
				{
					if(s[j+1]=='C')
					{
						c++;
					}
				}
			}
		}
	}
	cout<<c<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    string s;
    cin>>s;
    if('A'!=s[0]){
        cout<<"WA"<<endl;
        return 0;
    }
    int ccnt=0;
    for(int i=1;i<s.length();i++){
        if(i>=2&i<s.length()-1){
            if('C'==s[i]){
                ccnt++;
            }
        }else{
           if('C'==s[i]){
                cout<<"WA"<<endl;
                return 0;
           }
        }
    }
    if(1!=ccnt){
        cout<<"WA"<<endl;
        return 0;
    }
    for(int i=0;i<s.length();i++){
        if('A'==s[i]||'C'==s[i]){
            continue;
        }else{
            if(!('a'<=s[i]&s[i]<='z')){
                cout<<"WA"<<endl;
                return 0;
            }
        }
    }
    cout<<"AC"<<endl;
    return 0;
}

Measured memory_bytes: 256