akhauriyash/Code-Regression huggingface dataset:
#get targets
def get (K):
	ret = [K]
	for r in range(31):
		if ((K >> r) & 1) == 1 :
			tmp = K
			tmp &= (~(1 << r))
			tmp |= (1 << r) - 1
			ret.append(tmp);
	return ret

#input
N, K = map(int, input().split())
items = []
for steps in range(N):
	A, B = map(int, input().split())
	items.append([A, B])
#process
targets = get(K)
answer = 0
for target in targets:
	cur = 0
	for a, b in items:
		if(target | a == target):
			cur += b;
	answer = max(answer, cur)

print(answer)


Measured memory_bytes: 21620
#include <bits/stdc++.h> 
using namespace std; 
  
// Return the maximum volume. 
double maxvolume(double s) 
{ 
    // finding length 
    double length = s / (3*1.0); 
  
    s -= length; 
  
    // finding breadth 
    double breadth = s /( 2*1.0); 
  
    // finding height 
    double height = s - breadth; 
  
    return length * breadth * height; 
} 
  
// Driven Program 
int main() 
{ 
    double s;
    cin>>s;
    cout <<fixed<<setprecision(12)<<maxvolume(s) << endl; 
    return 0; 
} 

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

struct square {
	long long l, r, d, u;
};

int main() {
	long long X, Y, NL = 0, NR = 0, ND = 0, NU = 0, H = 1, W = 1;
	cin >> X >> Y;
	vector<square> V;
	V.push_back({ 0, 0, 0, 0 });
	for (int i = 0; ; i++) {
		square SQ;
		if (i % 4 == 0) {
			SQ.l = NR + 1, SQ.r = NR + H, SQ.d = ND, SQ.u = NU;
			W += H;
			NR = SQ.r;
		}
		if (i % 4 == 1) {
			SQ.l = NL, SQ.r = NR, SQ.d = NU + 1, SQ.u = NU + W;
			H += W;
			NU = SQ.u;
		}
		if (i % 4 == 2) {
			SQ.l = NL - H, SQ.r = NL - 1, SQ.d = ND, SQ.u = NU;
			W += H;
			NL = SQ.l;
		}
		if (i % 4 == 3) {
			SQ.l = NL, SQ.r = NR, SQ.d = ND - W, SQ.u = ND - 1;
			H += W;
			ND = SQ.d;
		}
		V.push_back(SQ);
		if (100000000 <= H) break;
	}
	for (int i = 0; i < V.size(); i++) {
		if (V[i].l <= X && X <= V[i].r && V[i].d <= Y && Y <= V[i].u) {
			cout << i % 3 + 1 << endl;
			return 0;
		}
	}
}


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

    string str;
    cin>>str;

    sort(str.begin(),str.end());

    int count = 1;
    bool flag = true;
    for(int i=0;i<str.size()-2 && flag;i++){

        if(str[i]==str[i+1]){
            count++;
            continue;
        }
        if(count%2==0){
            count=1;

        }
        else{
            flag = false;
        }
    }

    if(flag){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }


    return 0;
}

Measured memory_bytes: 3604
package main

import (
	"fmt"
)

func linearsearch(s []int, q int) bool {
	s[len(s)-1] = q // 番兵
	var i int
	for s[i] != q {
		i++
	}
	if i == len(s)-1 {
		return false
	}
	return true
}

func main() {
	var n int
	fmt.Scan(&n)
	S := make([]int, n+1) // 番兵のスペース確保
	for i := 0; i < n; i++ {
		fmt.Scan(&S[i])
	}
	var q, ans int
	fmt.Scan(&q)
	for i := 0; i < q; i++ {
		var key int
		fmt.Scan(&key)
		if linearsearch(S, key) {
			ans++
		}
	}
	fmt.Println(ans)
}



Measured memory_bytes: 1720
#define _USE_MATH_DEFINES 1
#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 MOD 1000000007ll
#define INF 1000000000000000000ll
#define EPS 1e-9
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock

typedef long long         ll;
typedef long double       ld;
typedef pair <ll,ll>      pl;
typedef tuple <ll,ll,ll>  tl;

ll TC, N, A[200005], occ[1000005], C;
bool sie[1000005];

int main() {

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	TC = 1;
	
	for (ll q = 1; q <= TC; q++) {
		
		cin >> N;
		memset(occ, 0, sizeof occ);
		memset(sie, 1, sizeof sie);
		
		for (ll i = 1; i <= N; i++) {
			cin >> A[i];
			occ[A[i]]++;
		}
		
		C = 0;
		for (ll v = 1; v <= 1000000; v++) {
			if (occ[v] == 0 || sie[v] == 0) continue;
			if (occ[v] == 1) C++;
			for (ll w = v; w <= 1000000; w += v) sie[w] = 0;
		}
		
		cout << C << "\n";
	
	}
	
    return 0;
}


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

typedef pair<ll, ll> P;

ll modnum = 1000000000+7;

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    string l; cin >> l;
    ll ans = 0;
    ll tmpans = 1;
    rep(i, l.size()) {
        int n = l[i] - '0';
        if(n == 1) {
            ll x = modpow(3, l.size()-1-i, modnum);
            ans += x * tmpans;
            ans %= modnum;

            tmpans *= 2;
            tmpans %= modnum;
        }
    }

    ans += tmpans;
    ans %= modnum;

    cout << ans << endl;
    return 0;

}

// 161999316
// 162261460
//    524288

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

int main() {
  int h, a;
  cin >> h >> a;
  int ans = h/a;
  if (h%a != 0) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

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

        int i, a[n], b[n];
        for(i=0; i<n; i++){
                a[i] = 1;
                b[i] = 0;
        }

        int m, tmp;
        scanf("%d", &m);
        for(i=0; i<m; i++){
                scanf("%d", &tmp);
                a[tmp-1]--;
        }

        scanf("%d", &m);
        for(i=0; i<m; i++){
                scanf("%d", &tmp);
                b[tmp-1]++;
        }

        scanf("%d", &m);
        for(i=0; i<m; i++){
                scanf("%d", &tmp);
                a[tmp-1]++;
                b[tmp-1]++;
        }

        int ans = 0;
        for(i=0; i<n; i++){
                if(a[i]==2 || b[i]==2) ans++;
        }
        printf("%d\n", ans);
        return 0;
}


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

using namespace std;

const int N = 1000, M = 1000;

char cc[N][M + 1];
int qu[N * M];
int dd[N][M];

int main() {
	int n, m; cin >> n >> m;
	int i1, j1; cin >> i1 >> j1, i1--, j1--;
	int i2, j2; cin >> i2 >> j2, i2--, j2--;
	for (int i = 0; i < n; i++)
		cin >> cc[i];
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			dd[i][j] = n * m;
	int head = 0, cnt = 0;
	qu[head + cnt++] = i1 * m + j1, dd[i1][j1] = 0;
	while (cnt) {
		int x = qu[cnt--, head++];
		int i = x / m, j = x % m;
		for (int di = -2; di <= 2; di++)
			for (int dj = -2; dj <= 2; dj++)
				if (di || dj) {
					int i_ = i + di, j_ = j + dj;
					if (0 <= i_ && i_ < n && 0 <= j_ && j_ < m && cc[i_][j_] == '.')
						if (abs(di) + abs(dj) <= 1) {
							if (dd[i_][j_] > dd[i][j])
								qu[cnt++, --head] = i_ * m + j_, dd[i_][j_] = dd[i][j];
						} else {
							if (dd[i_][j_] > dd[i][j] + 1)
								qu[head + cnt++] = i_ * m + j_, dd[i_][j_] = dd[i][j] + 1;
						}
				}
	}
	int ans = dd[i2][j2];
	cout << (ans != n * m ? ans : -1) << '\n';
	return 0;
}


Measured memory_bytes: 10384
#include <stdio.h>

int main(int argc, char *argv[])
{
    char S[(int)(2e5 + 1)];
    long long wnum = 0, ans = 0;
    int i;

    gets(S);

    for (i = 0; S[i]; i++) {
        if (S[i] == 'W') {
            ans += i - wnum;
            wnum++;
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
)

func main() {
	var A,B int
	var S string
	fmt.Scan(&A,&B,&S)
	
	judge := true
	for i := 0; i < len(S); i++ {
		if i == A {
			if S[i] != '-' {
				judge = false
				break
			}
		} else {
			if S[i] == '-' {
				judge = false
				break
			}
		}
	}
	if judge {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
#include<climits>

#define forn(e,n,s) for(int i = e; i < n;i += s)
#define forr(e,n,s) for(int i = e; i >= n; i -= s)
#define PI 3.14159265358979323846264338327950L
#define ll long long

using namespace std;

const int MOD = 1e9+7;

void go(){
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout<<fixed;
  cout<<setprecision(20);

  #ifndef ONLINE_JUDGE
       freopen("input.txt","r",stdin);
       freopen("output.txt","w",stdout);
  #endif
}


void solve(){
    int n;cin>>n;
    int a[n],b[n];
    forn(0,n,1) {
        cin>>a[i];
        cin>>b[i];
    }
    for(int i = 0; i <= (n-3); i++){
        if(a[i]==b[i] and a[i+1]==b[i+1] and a[i+2]==b[i+2]){
            cout<<"Yes";
            return;
        }
    }
    cout<<"No";
}

int main(){
    go(); 

    // code here
    int t = 1;
    while(t--) solve();
   
}









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

using namespace std;

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

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		if (i % 2 == 1 && a % 2 == 1) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
#include <atcoder/all>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define ins insert

#define debug(a) cerr<<(a)<<endl
#define dbrep(a,n) rep(_i,n) cerr<<(a[_i])<<" "; cerr<<endl
#define dbrep2(a,n,m) rep(_i,n){rep(_j,m) cerr<<(a[_i][_j])<<" "; cerr<<endl;}

using namespace std;
using namespace atcoder;

using mint = modint998244353;

template<class A, class B>
ostream &operator<<(ostream &os, const pair<A,B> &p){return os<<"("<<p.fi<<","<<p.se<<")";}
template<class A, class B>
istream &operator>>(istream &is, pair<A,B> &p){return is>>p.fi>>p.se;}

// operand
struct S {
    mint v, c;
};
S e(){return S{0,0};}
// operator
using O = int;
O id(){return 0;}

// functions
S f(S x, S y){return S{x.v+y.v, x.c+y.c};}
S g(O x, S y){return (x==id())?y:S{y.c*x, y.c};}
O h(O x, O y){return (x==id())?y:x;}

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,Q; cin>>N>>Q;
    vector<S> v(N);
    mint m=1;
    rep(i,N){
        v[i] = S{m,m};
        m*=10;
    }
    reverse(all(v));
    lazy_segtree<S,f,e,O,g,h,id> seg(v);
    while(Q--){
        int l,r,d; cin>>l>>r>>d; l--;
        seg.apply(l,r,d);
        cout<<seg.prod(0,N).v.val()<<"\n";
    }
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int A=0,B=0,C=0,D=0;
  bool a=false;
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='N'){
      A++;
    }
    else if(S.at(i)=='W'){
      B++;
    }
    else if(S.at(i)=='S'){
      C++;
    }
    else{
      D++;
    }
  }
  if(A==0 &&C!=0){
    a=true;
  }
  else if(A!=0 && C==0){
    a=true;
  }
  else if(B==0 && D!=0){
    a=true;
  }
  else if(B!=0 && D==0){
    a=true;
  }
  if(!a){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

namespace train
{
	class Program
	{
		static void Main(string[] args)
		{
			int num = int.Parse( Console.ReadLine());
			string strFlowers = Console.ReadLine();
			string[] flower = strFlowers.Split(' ');
			int[] flowers = flower.Select(f => int.Parse(f)).ToArray();

			int water = 0;
			while (flowers.Sum() > 0)
			{
				int min = -1;
				int max = -1;
				int lastIndex = flowers.Length -1;
				for (int n = 0; n < flowers.Length; n++)
				{
					if (min == -1)
					{
						if (flowers[n] > 0)
						{
							min = n;
							if (n == lastIndex)
								max = n;
						}
					}
					else
					{
						if (flowers[n] == 0)
							max = n - 1;
						else if (n == lastIndex)
							max = n;
					}
					if (min >= 0 && max >= min)
						break;
				}

				if (min >= 0 && max >= 0)
				{
					water++;
					for (int n = min; n <= max; n++)
						flowers[n]--;
				}

			}

			Console.WriteLine(water);
		}
	}
}

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

int main() {
	// your code goes
	int a,b,c,temp;
	cin>>a>>b>>c;
	
	temp=a;
	a=b;
	b=temp;
	
	temp=a;
	a=c;
	c=temp;
	
	cout<<a<<" "<<b<<" "<<c;
	
	
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func calc_seq(xs []int) []int {
	seq := []int{}
	count := 1
	for i := 0; i < len(xs) - 1; i++ {
		if xs[i] == xs[i+1] {
			count++
		} else {
			seq = append(seq, count)
			count = 1
		}
	}
	seq = append(seq, count)
	return seq
}

func form_seq(xs []int) []int {
	seq := calc_seq(xs)
	if xs[0] == 0 {
		seq = append([]int{0}, seq...)
	}
	if len(seq) % 2 == 0 {
		seq = append(seq, 0)
	}
	return seq
}

func sum(xs []int, i0, i1 int) int {
	val := 0
	for i := i0; i <= i1; i++ {
		val += xs[i]
	}
	return val
}

func main() {
	var s1 string
	fmt.Scan(&s1)
	n, _ := strconv.Atoi(s1)

	var s2 string
	fmt.Scan(&s2)
	k, _ := strconv.Atoi(s2)

	var s3 string
	fmt.Scan(&s3)
	ss := strings.Split(s3, "")
	xs_length := len(ss)
	xs := make([]int, xs_length)
	for i, s := range ss {
		xs[i], _ = strconv.Atoi(s)
	}

	seq := form_seq(xs)
	m := len(seq)
	i := 1
	if i + 2*k > m {
		fmt.Print(n)
		return
	}
	val := sum(seq, i-1, i-1 + 2*k)
	biggest := val
	i += 2
	for i + 2*k <= m {
		val += sum(seq, i-1+2*k-1, i-1+2*k) - sum(seq, i-1-2, i-1-1)
		if biggest < val {
			biggest = val
		}
		i += 2
	}
	fmt.Print(biggest)
}

Measured memory_bytes: 7424
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n, k;
LL a[100010];

void init() {

}

void input() {
  cin >> n >> k;
  REP(i, n) cin >> a[i];
}

void solve() {
  LL res = 1000000010LL;
  sort(a, a+n);
  REP(i, n-k+1) {
    chmin(res, a[i+k-1] - a[i]);
  }
  cout << res << endl;
}

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


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

using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = (1 << 30);
constexpr ll L_INF = (1ll << 62);

//==================================

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

    int N;
    cin >> N;

    string ans;

    while (N != 0) {
        if (abs(N) & 1) {
            ans += "1";
            N -= 1;
            N /= -2;
        }
        else {
            ans += "0";
            N /= -2;
        }
    }

    reverse(ans.begin(), ans.end());

    if (ans.empty()) ans = "0";

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def selectionSort(a, n):
    count = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if a[j] < a[minj]:
                minj = j
        a[i], a[minj] = a[minj], a[i]
        count += 1 if i != minj else  0
    return count

def show(a, n):
    for i in range(n):
        if i == n-1:
            print "%d" % a[i]
        else:
            print "%d" % a[i],

n = input()
a = map(int, raw_input().split())
c = selectionSort(a, n)
show(a, n)
print "%d" % c

Measured memory_bytes: 6476
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int cnt = 0;
    for (int i = 0; i <= max(b, d);i++){
        if(a<=i&&i<=b&&c<=i&&i<=d)
            cnt++;
    }
    cout << max(cnt - 1, 0) << endl;
    return 0;
}

Measured memory_bytes: 256
var input = require( 'fs' ).readFileSync( '/dev/stdin' ).toString();
  var data = input.split( " " ).map( Number );
  var a = data[0];
  var b = data[1];
  var C = data[2]*(Math.PI/180);
  var h = Math.sin( C )*b;
  var S = (a*h)/2;
  var ta = (a-Math.cos( C )*b);
  var L = a+b+Math.sqrt( ta*ta+h*h );
  console.log( S+'\n'+L+'\n'+h );

Measured memory_bytes: 15652
a,b = map(int,input().split())
ansl = []
if min(a,b) == 1:
  print(max(a,b))
else:
  for i in range(1,min(a,b)+1):
    if a%i == 0 and b%i == 0:
      ansl.append(i)
  if not ansl:
    print(a*b)
  else:
    print(int(a*b/max(ansl)))

Measured memory_bytes: 3060
using System.Collections.Generic;
using static System.Console;

class Program
{
    static void Main()
    {
        var s = new Dictionary<int, string> { };

        for (var i = 0; i < 3; i++)
            s['A' + i] = NextString();

        int turn = 'A';

        while (s[turn] != "")
        {
            var pre = turn;
            turn = s[turn][0] - 'a' + 'A';
            s[pre] = s[pre].Remove(0, 1);
        }
        WriteLine((char)turn);
    }

    static string NextString()
    {
        var result = new List<char>();
        while (true)
        {
            int next = Read();
            if (next < 0)
                break;
            var nextChar = (char)next;
            if (!char.IsWhiteSpace(nextChar))
                result.Add(nextChar);
            else if (nextChar != '\r')
                break;
        }
        return string.Join("", result);
    }
}


Measured memory_bytes: 13152
#include <bits/stdc++.h>
#define x first
#define y second
#pragma gcc optimize("O3")
#pragma gcc optimize("Ofast")
#pragma gcc optimize("unroll-loops")
using namespace std;
const long long INF = 1e18;
const int mod = 100003;
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pi;
typedef pair <ll,ll> pl;
typedef vector <int> vec;
char a[10005];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> a+1;
	int n = strlen(a+1);
	if(a[n] != 's') cout << a+1 << 's';
	else cout << a+1 << "es";
}

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

import static java.lang.Integer.parseInt;

/**
 * Microwave
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		int A, B, C, D, E;
		A = parseInt(br.readLine());
		B = parseInt(br.readLine());
		C = parseInt(br.readLine());
		D = parseInt(br.readLine());
		E = parseInt(br.readLine());

		int elapse = 0;
		int temp = A;

		if (temp < 0) {
			elapse += -temp * C;
			temp = 0;
		}

		if (temp == 0) {
			elapse += D;
		}

		elapse += (B - temp) * E;

		System.out.println(elapse);

	}
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

int main(){
  int p,q,r,ans;
  cin>>p>>q>>r;
  ans=p+q+r-max(p,max(q,r));
  cout<<ans<<endl;
}


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

import sys
import os


def input_to_list():
    return list(map(int, input().split()))

H, W = input_to_list()
M = []
for i in range(H):
    lis = input_to_list()
    s = sum(lis)
    lis.append(s)
    M.append(lis)

# vertical sum
last = []
for i in range(W + 1):
    s = 0
    for j in range(H):
        s += M[j][i]
    last.append(s)
M.append(last)

# print
for i in range(H + 1):
    print(*M[i])

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

using namespace std;



int main(int argc, char *argv[])
{
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin >> N;
    
    
    int output = 0;
    
    for (int i = 1; i <= N; i += 2) {
        int cnt = 0;
        for (int j = 1; j <= i; j++) {
            if (i % j == 0) {
                cnt++;
            }
        }
        if (cnt == 8) {
            output++;
        }
    }
    
    cout << output << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int ans[4]={0,0,0,0};
  int a,b,c;
  for(;cin>>a>>b>>c;)
    {
      if(a+b<=c||c+b<=a||a+c<=b)
	break;
      ans[0]++;
      if(c<a)
	swap(a,c);
      if(c<b)
	swap(b,c);
      if(a*a+b*b==c*c)
	ans[1]++;
      else if(a*a+b*b>c*c)
	ans[2]++;
      else if(a*a+b*b<c*c)
	ans[3]++;
    }
  cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]<<" "<<ans[3]<<endl;
}

Measured memory_bytes: 1164
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  rep (i, n) {
    scanf("%d", &a[i]);
  }

  ll univ = 1;
  rep (i, n) {
    univ *= 3;
  }
  ll subs = 1;
  rep (i, n) {
    if (a[i] % 2 == 0) {
      subs *= 2;
    } else {
      subs *= 1;
    }
  }
  printf("%lld\n", univ - subs);

  return 0;
}


Measured memory_bytes: 888
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#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 n[6], m[6];
  rep(i, 6) cin >> n[i];
  string s;
  cin >> s;

  rep(i, s.size()) {
    rep(j, 6) m[j] = n[j];
    if (s[i] == 'N') {
      m[0] = n[1];
      m[1] = n[5];
      m[4] = n[0];
      m[5] = n[4];
      rep(j, 6) n[j] = m[j];
    } else if (s[i] == 'S') {
      m[0] = n[4];
      m[1] = n[0];
      m[4] = n[5];
      m[5] = n[1];
      rep(j, 6) n[j] = m[j];
    } else if (s[i] == 'W') {
      m[0] = n[2];
      m[2] = n[5];
      m[3] = n[0];
      m[5] = n[3];
      rep(j, 6) n[j] = m[j];
    } else {
      m[0] = n[3];
      m[2] = n[0];
      m[3] = n[5];
      m[5] = n[2];
      rep(j, 6) n[j] = m[j];
    }
  }

  cout << n[0] << endl;

  return 0;
}


Measured memory_bytes: 3232
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline bool isPower2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll getMaxEffectiveBit(ull a)
{
	ll index = -1;
	for (; a != 0; a >>= 1)
	{
		++index;
	}
	return index;
}

inline ll getSpecifiedBit(ull a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull getGcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return getGcd(b, a % b);
}

template<class Integer>
inline Integer getPower(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

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

	ll L, R;
	cin >> L >> R;

	if ( R / 2019LL - L / 2019LL > 0 )
	{
		cout << 0LL<< endl;
		return 0;
	}

	L = L % 2019LL;
	R = R % 2019LL;

	ll res = 2020LL;
	for (ll i = L; i <= R; ++i)
	{
		for (ll j = i + 1; j <= R; ++j)
		{
			res = min(res, (i * j) % 2019LL);
		}
	}

	cout << res << endl;
	return 0;
}


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

using namespace std;

int main() {
    int a;
    cin >> a;
    int m = 1e3, M = 0;
    while (cin >> a) {
        m = min(m, a);
        M = max(M, a);
    }
    cout << M - m << 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>;

const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main() {
  int h, w;
  cin >> h >> w;
  //スタートの座標
  int si, sj;
  cin >> si >> sj;
  //ゴールの座標
  int ti, tj;
  cin >> ti >> tj;
  --si; --sj; --ti; --tj;
  //迷路
  vector<string> s(h);
  rep(i,h) cin >> s[i];

  const int INF = 1e9;
  //移動距離
  vector<vector<int>> dist(h,vector<int>(w,INF));
  dist[si][sj] = 0;
  //キューに前後から詰めるため、dequeを使う
  deque<P> q;
  q.emplace_back(si,sj);
  
  while (!q.empty()) {
    int i = q.front().first;
    int j = q.front().second;
    int d = dist[i][j];
    q.pop_front();

    //?
    if (dist[i][j] != d) continue;

    //通常の前後左右の移動
    rep(v,4) {
      int ni = i+di[v], nj = j+dj[v];
      if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
      if (s[ni][nj] == '#') continue;
      if (dist[ni][nj] <= d) continue;//
      dist[ni][nj] = d;
      //ワープ回数が増えない場合は、前から詰める
      q.emplace_front(ni,nj);
    }
    //ワープ移動
    for (int ei = -2; ei <= 2; ++ei) {
      for (int ej = -2; ej <= 2; ++ej) {
        int ni = i+ei, nj = j+ej;
        if (ni < 0 || ni >= h || nj < 0 || nj >= w) continue;
        if (s[ni][nj] == '#') continue;
        if (dist[ni][nj] <= d+1) continue;
        dist[ni][nj] = d+1;
        //ワープ回数が増えるものは後ろから詰める
        q.emplace_back(ni,nj);
      }
    }
  }
  int ans = dist[ti][tj];
  if (ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9496
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)

	N, Q := getInt(), getInt()
	S := getString()
	S = S + "T"

	a := make([]int, N+1)
	b := make([]int, N+1)
	c := byte(' ')
	cnt := 0
	for i := 0; i <= N; i++ {
		if c == 'A' && S[i] == 'C' {
			cnt++
			b[i-1] = 1
			b[i] = 2
		}
		c = S[i]
		a[i] = cnt
	}
	// out(N, Q)
	// out(a)
	// out(b)

	for i := 0; i < Q; i++ {
		l, r := getInt()-1, getInt()
		n := a[r] - a[l]
		if b[r] == 2 {
			n--
		}
		// out(S[l:r])
		out(n)
	}

}


Measured memory_bytes: 5248
function main(input) {
  let [n, m] = input[0].trim().split(" ").map(i => parseInt(i));
  let h = input[1].trim().split(" ").map(i => parseInt(i));

  let base = [];
  for(let i=0;i<n;i++){
    base[i] = true;
  }

  for(i=0;i<m;i++){
    let [a, b] = input[i+2].trim().split(" ").map(i => parseInt(i)-1);
    if(h[a]<h[b]){
      base[a]=false;
    }else if(h[a]===h[b]){
      base[a]=false;
      base[b]=false;
    }else{
      base[b]=false;
    }
  }
  let counter = 0;
  for(let i=0;i<n;i++){
    if(base[i]===true){
      counter++;
    }
  }
  console.log(counter);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 60124
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n;
	cin>>n;
	int x[n+1];
	for(int i=1;i<=n;i++){
		cin>>x[i];
	}
	sort(x+1,x+n+1);
	int sum=1e9;
	int ans=0;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=n;j++){
			ans+=(max(x[j],i)-min(x[j],i))*(max(x[j],i)-min(x[j],i));
		}
		sum=min(sum,ans);
		ans=0;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
#include<stdio.h>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    string S;
    cin >> S;
    int L=S.length();
    bool exist=true;
    for(int i=0;i<L;++i){
        if(i%2==0){
        if(S[i]!='R' && S[i]!='U' && S[i]!='D'){
            exist=false;
            break;
        }
    }
    else{
        if(S[i]!='L' && S[i]!='U' && S[i]!='D'){
            exist=false;
            break;
        }
    }
    }
    
    if(exist) cout << "Yes";
    else cout << "No";
    }

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

typedef struct {
  double x;
  double y;
}p;

void kock(int,p,p);

int main()
{
  int n;
  p p1={0.0,0.0};
  p p2={100.0,0.0};
  scanf("%d",&n);
 printf("%f %f\n",p1.x,p1.y);
  kock(n,p1,p2);
 printf("%f %f\n",p2.x,p2.y);

  return 0;
}
void kock(int n,p p1,p p2)
{
  p s={0.0,0.0};
  p u={0.0,0.0};
  p t={0.0,0.0};

  if(n==0)return ;

  s.x=(2*p1.x+1*p2.x)/3.0;
  s.y=(2*p1.y+1*p2.y)/3.0;
  t.x=(1*p1.x+2*p2.x)/3.0;
  t.y=(1*p1.y+2*p2.y)/3.0;
  u.x=(t.x-s.x)*cos(M_PI/3.0)-(t.y-s.y)*sin(M_PI/3.0)+s.x;
  u.y=(t.x-s.x)*sin(M_PI/3.0)+(t.y-s.y)*cos(M_PI/3.0)+s.y;
  kock(n-1,p1,s);
  printf("%f %f\n",s.x,s.y);
  kock(n-1,s,u);
  printf("%f %f\n",u.x,u.y);
  kock(n-1,u,t);
  printf("%f %f\n",t.x,t.y);
  kock(n-1,t,p2);
 
}

Measured memory_bytes: 636
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main(){
    int H,W;
    vector<bool> row(H,false);
    vector<bool> col(W,false);

    cin >> H >>W;
    string List[H];
    for (int i = 0;i<H;i++){
        cin >> List[i];
    }
    for (int i =0;i<H;i++){
        for(int j = 0;j<W;j++){
            if (List[i][j]=='#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }

    for(int i=0;i<H;i++){
       if (row[i]){
           for(int j=0;j<W;j++){
               if (col[j]){
                   cout << List[i][j];
               }
           }
            cout<<endl;
       }
    }

}

Measured memory_bytes: 256
#include <fstream>
#include <cmath>
#include <vector>
#include <iostream>

// BE CAREFUL WITH HASH TABLE & UNORDERED MAP
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
using namespace std;

#define MOD 998244353
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= (a); i--)
#define RF0(i,b) RFO(i,0,b)
#define lli long long int
#define pii pair<int,int>
#define add(a,b) ((int) (((lli) (a) + (b))%MOD))
#define mul(a,b) ((int) (((lli) (a) * (b))%MOD))
#define PB emplace_back
#define F first
#define S second

// ifstream cin ("cinput.in");
// ofstream cout ("coutput.out");

string N;
int K;
int dp0 [100][4] = {{0}}; // not confirmed
int dp1 [100][4] = {{0}}; // confirmed

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> K;
    F0R(i,N.size()) dp1[i][0] = 1;
    dp1[0][1] = N[0]-'0'-1;
    dp0[0][1] = 1;
    F0R(i,N.size()) {
        if (i == 0) continue;
        F0R(j,K) {
            dp1[i][j+1] = dp1[i-1][j]*9 + dp1[i-1][j+1] + max(0,dp0[i-1][j]*(N[i]-'0'-1)) + dp0[i-1][j+1]*(N[i] != '0');
            if (N[i] == '0') dp0[i][j+1] = dp0[i-1][j+1];
            else dp0[i][j+1] = dp0[i-1][j];
        }
    }
    cout << dp1[N.size()-1][K] + dp0[N.size()-1][K] << '\n';
}

// Already read the editorial. Implementing
// Decisions: 10 choices

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cout << VEC[i] << " ";
  }
  cout << "\n";
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i, MAT.size()){
    REP(j, MAT[i].size()){
      cout << MAT[i][j] << " ";
    }
    cout << "\n";
  }
};

template <typename CLASS1, typename CLASS2>
class HOGE{
  public:
    CLASS1 key;
    CLASS2 value;
    HOGE(void){
      return;
    };
    HOGE(CLASS1 key, CLASS2 value){
      this->key = key;
      this->value = value;
    };
    ~HOGE(void){
      return;
    };

    void print(void){
      cout << "key : " << key << ", value : " << value << "\n";
      return;
    };
    
    bool operator==(const HOGE &obj){
      return (this->value == obj.value);
    };
    bool operator<(const HOGE &obj){
      return (this->value < obj.value);
    };
    bool operator>(const HOGE &obj){
      return (this->value > obj.value);
    };
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

vvll Path;
deque<ll> dq;
vb cand;

void search(vb& cand, bool forward_flag){
  ll pos = dq.front();
  if(forward_flag) pos = dq.back();
  for(ll target : Path[pos]){
    if(!cand[target]) continue;
    if(forward_flag) dq.push_back(target);
    else dq.push_front(target);
    cand[target] = false;
    search(cand, forward_flag);
    break;
  }
  return;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N, M;
  cin >> N >> M;
  Path.resize(N+2);
  REP(i, M){
    ll A, B;
    cin >> A >> B;
    Path[A].push_back(B);
    Path[B].push_back(A);
  }

  cand.resize(N+2, true);
  dq.push_back(1);
  cand[1] = false;

  search(cand, true);
  search(cand, false);

  printf("%d\n", dq.size());
  printf("%d", dq.front());
  dq.pop_front();
  while(!dq.empty()){
    printf(" %d", dq.front());
    dq.pop_front();
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 11392
#include <stdio.h>

int main(void)
{
 long long int n,sum = 0,i;
  
  scanf("%lld", &n);
  
  for(i = 1; i<=n ;i++){
    if(i%3 != 0 && i%5 != 0)
      sum += i;
  }
  
  printf("%lld", sum);
  
  return 0;
  
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int n;cin>>n;
  int a[100000]={};
  int a0=0;
  int a1=0;
  int a2=0;
  REP(i,n){
    int x;cin>>x;
    if(x%2==0){
      a[i]++;
      x/=2;
      if(x%2==0){
        a[i]++;
      }
    }
  }
  // REP(i,n){
  //   P(a[i]);
  // }
  REP(i,n){
    if(a[i]==0)a0++;
    if(a[i]==1)a1++;
    if(a[i]==2)a2++;
  }
  if(a1>0){
    if(a0<=a2){
      P("Yes");
      return 0;
    }
  }else{
    if(a0-1<=a2){
      P("Yes");
      return 0;
    }
  }
  P("No");
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a * b / gcd(a, b); }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll n, m;
	string ans="IMPOSSIBLE";
	in(n);
	in(m);

	ll a, b;
	vector<bool> flg1(n, false), flg2(n, false);
	rep(i, 0, m) {
		in(a);
		in(b);

		if (a == 1) {
			flg1[b] = true;
		}
		if (b == n) {
			flg2[a] = true;
		}
	}

	rep(i, 0, n) {
		if (flg1[i] && flg2[i]) {
			ans = "POSSIBLE";
		}
	}
	outn(ans);

	return 0;

	}
	

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 100010;

char s[MAXN];

int main ()
{
    scanf("%s", &s);
    int len = strlen(s);
    int count = 0;
    for (int i = 0; i < len; i ++)
    {
        if (s[i] == 'p')
        {
            count ++;
        }
    }
    int maxn = len / 2;
    int ans = maxn - count;
    printf("%d\n", ans);
    return 0;
}


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

int main() {
    int x;
    int y;
    cin >> x;
    cin >> y;

    bool ans = false;
    for (int i = 0; i <= x; i++) {
        if (i * 2 + (x - i) * 4 == y) {
            ans = true;
            break;
        }
    }

    if (ans) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC148B()
{
	int N;
	cin >> N;
	string S, T;
	cin >> S >> T;
	string X;
	for (int i = 0; i < N; ++i)
	{
		X.push_back(S[i]);
		X.push_back(T[i]);
	}
	cout << X << endl;
}

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


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

int main() {
  int R;
  cin >> R;
  
  if (R < 1200) {
    cout << "ABC" << endl;
  } else if (R < 2800) {
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }
}

Measured memory_bytes: 256
# coding: utf-8

W, H, N = map(int, raw_input().split())
w = [0, W]
h = [0, H]

for i in xrange(N):
    x, y, a = map(int, raw_input().split())
    if a == 1 and w[0] < x:
        w[0] = x
    elif a == 2 and w[1] > x :
        w[1] = x
    elif a == 3 and h[0] < y:
        h[0] = y
    elif a == 4 and h[1] > y:
        h[1] = y

print max(w[1] - w[0], 0) * max(h[1] - h[0], 0)

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

int main(){
	string s;
	int a=0;
	cin>>s;
	if(s[0]=='o')a++;
	if(s[1]=='o')a++;
	if(s[2]=='o')a++;
	cout<<700+(a*100)<<endl;
	return 0;
}


Measured memory_bytes: 256
n = gets.to_i
h = gets.split.map(&:to_i)
result = 0
cnt = 0
(1..n-1).each do |i|
  if h[i-1] >= h[i]
    cnt += 1
  else
    if result < cnt 
      result = cnt
    end
    cnt = 0
  end
end
 if result < cnt 
	result = cnt
 end
puts result

Measured memory_bytes: 8580
import numpy as np
def proc(C, L, R, Order, N, Q):
    pl = pr = 0
    ans = 0
    A = np.zeros(N+1, dtype=np.int32)
    Ans = np.zeros(Q, dtype=np.int32)
    for idx_LR in Order:
        l = L[idx_LR]
        r = R[idx_LR]
        while pr < r:
            pr += 1
            c = C[pr]
            if A[c] == 0:
                ans += 1
            A[c] += 1
        while pl > l:
            pl -= 1
            c = C[pl]
            if A[c] == 0:
                ans += 1
            A[c] += 1
        while pr > r:
            c = C[pr]
            A[c] -= 1
            if A[c] == 0:
                ans -= 1
            pr -= 1
        while pl < l:
            c = C[pl]
            A[c] -= 1
            if A[c] == 0:
                ans -= 1
            pl += 1
        Ans[idx_LR] = ans
    return Ans


numba_config = [
    ["proc", "i4[:](i4[:],u4[:],u4[:],i8[:],i4,i4)"]
]
import os
import sys
if sys.argv[-1] == "ONLINE_JUDGE":
    from numba.pycc import CC
    cc = CC("my_module")
    for func_name, types in numba_config:
        cc.export(func_name, types)(vars()[func_name])
        cc.compile()
    exit()
elif os.name == "posix":
    exec(f"from my_module import {','.join(func_name for func_name, _ in numba_config)}")
else:
    from numba import njit
    for func_name, types in numba_config:
        vars()[func_name] = njit(types, cache=True)(vars()[func_name])
    print("compiled", file=sys.stderr)


def main():
    input = sys.stdin.buffer.readline
    N, Q = map(int, input().split())
    C = np.empty(N+1, dtype=np.int32)
    C[0] = 0
    C[1:] = np.array(input().split(), dtype=np.int32)
    LR = np.array(sys.stdin.buffer.read().split(), dtype=np.uint32)
    L = LR[::2]
    R = LR[1::2]
    B = L>>9<<20|R
    Idx = (L>>9&1).astype(np.bool)
    B[Idx] = L[Idx]>>9<<20|(1<<20)-R[Idx]
    Order = np.argsort(B)
    Ans = proc(C, L, R, Order, N, Q)
    print("\n".join(map(str, Ans.tolist())))

main()


Measured memory_bytes: 99364
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int gcd(int x,int y){
	if(y==0)
		return x;
	return gcd(y,x%y);
}

int main(){
	ios::sync_with_stdio(false);
	int x;
	cin>>x;
	cout<<360/gcd(x,360);
	
	
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

int main(){
    int n;
    cin>>n;
    double x[n],y[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
    }
    int num[] = {0,1,2,3,4,5,6,7};

    double keiro = 0;
    double ans = 0;
    do{
        for(int i=0;i<n-1;i++){
            ans += sqrt( pow(x[num[i]]-x[num[i+1]],2) + pow(y[num[i]]-y[num[i+1]],2) );
        }
        keiro++;
    }while(next_permutation(num,num+n));
    
    ans /= keiro;
    printf("%.10f\n", ans);
}

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

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

    string num1 = "", num2 = "";
    num1 += s[0]; num1 += s[1];
    num2 += s[2]; num2 += s[3];
    int n1 = stoi(num1), n2 = stoi(num2);
    bool f1 = false, f2 = false;
    if(1<=n1&&n1<=12) f1 = true;
    if(1<=n2&&n2<=12) f2 = true;

    if(f1&&f2) cout << "AMBIGUOUS" << endl;
    else if(f1) cout << "MMYY" << endl;
    else if(f2) cout << "YYMM" << endl;
    else cout << "NA" << endl;

    return 0;
}

Measured memory_bytes: 256
s=input().split()
n,m=int(s[0]),int(s[1])
arr=[[],[],[],[],[],[],[],[]]
for i in range(n):
 s=input().split()
 x,y,z=int(s[0]),int(s[1]),int(s[2])
 arr[0].append(x+y+z)
 arr[1].append(x+y-z)
 arr[2].append(x-y+z)
 arr[3].append(x-y-z)
 arr[4].append(-x+y+z)
 arr[5].append(-x+y-z)
 arr[6].append(-x-y+z)
 arr[7].append(-x-y-z)
for i in range(8):
 arr[i].sort(reverse=True)
print(max([sum(arr[i][:m]) for i in range(8)]))

Measured memory_bytes: 3316