akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, M, Q;
  cin >> N >> M >> Q;
  
  int a, b, c, d;
  vector<vector<int>> rule(Q, vector<int>(4)); 
  for (int i = 0; i < Q; i++) {
    cin >> a >> b >> c >> d;
    rule.at(i).at(0) = a - 1;
    rule.at(i).at(1) = b - 1;
    rule.at(i).at(2) = c;
    rule.at(i).at(3) = d;
  }
  
  int score = 0;
  vector<int> arr(N, 1);
  while(true) {
    int tmp = 0;
    for (int i = 0; i < Q; i++) {
      a = rule.at(i).at(0);
      b = rule.at(i).at(1);
      c = rule.at(i).at(2);
      d = rule.at(i).at(3);
      if (arr.at(b) - arr.at(a) == c) {
        tmp += d;
      }
    }
    
    score = max(score, tmp);
    
    if (arr.at(N - 1) < M) {
      arr.at(N - 1) += 1;
    } else {
 	  bool fin = true;
      int j = N - 2;
      for (j = N - 2; j >= 0; j--) {
        tmp = arr.at(j); 
    	if (tmp < M) {
          fin = false;
          tmp++;
          break;
        }
      }
      if (fin) {
        break;
      }
      for (int k = j; k < N; k++) {
        arr.at(k) = tmp;
      }
    }
  }
      
  cout << score;  
}

Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
using namespace std;
using ll = long long;
using lli = long long int;
ll MM = 1000000000;
ll mod = MM + 7;
#define INF (ll)1e18
int main(){
    int n; cin >> n;
    string s;
    map<string, int> mp;

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

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <memory>
#include <memory.h>
#include <fstream>
#include <cmath>
#include <math.h>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)

bool field[6000][6000];
int X1[1000], X2[1000];
int Y1[1000], Y2[1000];

int compress(int *x1, int *x2, int n, int sz){
	vector<int> xs;
	int d[] = {-1, 0, 1};
	rep(i, n)rep(j,3){
		if(0 <= x1[i] + d[j] && x1[i] + d[j] < sz) xs.push_back(x1[i] + d[j]);
		if(0 <= x2[i] + d[j] && x2[i] + d[j] < sz) xs.push_back(x2[i] + d[j]);
	}
	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());

	rep(i, n){
		x1[i] = find(xs.begin(), xs.end(), x1[i]) - xs.begin();
		x2[i] = find(xs.begin(), xs.end(), x2[i]) - xs.begin();
	}
	return (int)xs.size();
}

int w, h;

void bfs(int x, int y){
	queue<P> que;
	field[x][y] = true;
	que.push(P(x, y));
	int dx[] = {-1, 0, 1, 0};
	int dy[] = {0, 1, 0, -1};

	while(!que.empty()){
		P p = que.front();
		que.pop();
		x = p.first;
		y = p.second;
		rep(i, 4){
			int x2 = x + dx[i];
			int y2 = y + dy[i];
			if(0 <= x2 && x2 < w && 0 <= y2 && y2 < h && !field[x2][y2]) {
				field[x2][y2] = true;
				que.push(P(x2, y2));
			}
		}
	}
}

int main(){
	int n;
	while(cin >> w >> h && (w || h)){
		cin >> n;
		rep(i, n){
			cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
			X2[i]--, Y2[i]--;
		}
		w = compress(X1, X2, n, w);
		h = compress(Y1, Y2, n, h);

		memset(field, false, sizeof(field));
		rep(i, n){
//			cout << X1[i] << " " << X2[i] << " " << Y1[i] << " " << Y2[i] << endl;
			rep2(j, X1[i], X2[i]+1)rep2(k,Y1[i], Y2[i]+1) field[j][k] = true;
		}
		int cnt = 0;
		rep(i, w){
			rep(j, h){
				if(!field[i][j]){
					cnt++;
					bfs(i, j);
					//cout << 1;
				}//else cout << 0;
			}
		//	cout << endl;
		}
		cout << cnt << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> v,p(n,0),q(n,0);
    for(int i=0;i<n;i++){
        cin>>p[i];
    }
    for(int i=0;i<n;i++){
        cin>>q[i];
    }
    int a,b,i=0;
    bool flag=true;
    for(int i=1;i<=n;i++){
        v.push_back(i);
    }
    do{
        i++;
        if(v==p){
            a=i;
        }
        if(v==q){
            b=i;
        }
    }while(next_permutation(v.begin(),v.end()));
    cout<<abs(a-b)<<"\n";
    return(0);
}

Measured memory_bytes: 3556
#include<stdio.h>
int main(void)
{
    int a,b,c,d,n;
    int count;
    while(scanf("%d",&n)!=EOF){
        count=0;
    for(a=0;a<=9;a++){
        for(b=0;b<=9;b++){
            for(c=0;c<=9;c++){
                for(d=0;d<=9;d++){
                    if(a+b+c+d==n){
                        count++;
                    }
                }
            }
        }
    }
    printf("%d\n",count);
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

vector<vector<int>> adj;
vector<bool> inpath;
vector<int> ans, anss, last;
bool found;
vector<int> st;

void solve(int step, int id) {
	//if (found) return;

	if (inpath[id]) {
		anss.clear();
		for (int i = step - 1; i >= 0; i--) {
			anss.push_back(st[i]);
			if (st[i] == id) break;
		}
		if (!found) ans = anss;
		else if (anss.size() < ans.size()) ans = anss;
		found = true;

		return;
	}

	if (step < last[id]) {
		last[id] = step;

		inpath[id] = true;
		st[step] = id;

		for (auto p : adj[id]) {
			solve(step + 1, p);
			//if (found) return;
		}

		inpath[id] = false;

	}
}

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

	int n, m, i, j, k, a, b, id;
	cin >> n >> m;
	adj.resize(n + 1);
	for (i = 0; i < m; i++) {
		cin >> a >> b;
		adj[a].push_back(b);
	}

	last.assign(n + 1, n * 10);
	inpath.assign(n + 1, false);
	st.resize(n + 1);
	found = false;

	for (i = 1; i <= n; i++) {
		if (last[i] == n * 10) {
			solve(0, i);
		}
	}

outer:;
	if (found) {
		cout << ans.size() << "\n";
		for (auto p : ans) cout << p << "\n";
	}
	else cout << "-1\n";
	   
	return 0;
}


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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
typedef long long ll;

int main() {
  int A, B; cin >> A >> B;
  int X = (A + B + 1) / 2;
  cout << X << endl;
}

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

int main()
{
  string s;
  int ans = 0;
  cin >> s;
  for(int i=0; i<s.size()/2; i++)
  {
    if(s[i] != s[s.size()-1 - i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
package main

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

// const abcd = "abcdefghijklmnopqrstuvwxyz"
// const ABCD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

// var dy = [...]int{1, 1, 0, -1, -1, -1, 0, 1}
// var dx = [...]int{0, 1, 1, 1, 0, -1, -1, -1}

// var dx = [...]int{0, 1, 0, -1}
// var dy = [...]int{1, 0, -1, 0}

var inf int = 1e13
var mod = 1000000007

// ---------------------------------------------------------
func main() {
	log.SetFlags(log.Lshortfile)
	next := newScanner()
	n := next.Int()
	a := next.Ints(n)
	sort.Ints(a)
	fmt.Println(a[len(a)-1] - a[0])
}

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

// Pair is liked C++ pair
type Pair struct {
	a, b int
}

// Pairs is sorted by []Pair struct
type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a < p[j].a {
		return true
	} else if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return false
}

// -------------------------------
func in(c, a, z int) bool {
	return c >= a && c < z
}

func btoi(b bool) int {
	if b {
		return 1
	}
	return 0
}

func itob(a int) bool {
	if a == 0 {
		return false
	}
	return true
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a []int) int {
	r := 0
	for i := 0; i < len(a); i++ {
		r += a[i]
	}
	return r
}

func pow(a []int) int {
	r := 1
	for i := 0; i < len(a); i++ {
		r *= a[i]
	}
	return r
}

func fill(a []int, n int) []int {
	for i := 0; i < len(a); i++ {
		a[i] = n
	}
	return a
}

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

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

// ---------- buffered scanner -----------------------------------------
type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 10000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) Line() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) String() string {
	return s.next()
}
func (s *scanner) Int() int {
	v, _ := strconv.Atoi(s.next())
	return v
}
func (s *scanner) Ints(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = s.Int()
	}
	return r
}
func (s *scanner) Int64() int64 {
	v, _ := strconv.ParseInt(s.next(), 10, 64)
	return v
}
func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
#include<iostream>
#include<map>
#include<vector>
#include<utility>
#include<algorithm>

int main(){

    size_t n, k;
    std::cin >> n >> k;

    std::map<size_t, size_t> a;
    for(size_t i = 0; i < n; i++){
        size_t ai;
        std::cin >> ai;

        if(!a.emplace(ai, 1).second){
            a[ai]++;
        }
    }

    std::vector<std::pair<size_t, size_t>> v(a.begin(), a.end());
    std::sort(v.begin(), v.end(), [](const auto& x, const auto& y){ return x.second < y.second; });

    if(a.size() <= k){
        std::cout << 0 << std::endl;
    }else{
        size_t cnt = 0;
        for(size_t i = 0; i < a.size() - k; i++){
            cnt += v.at(i).second;
        }
        std::cout << cnt << std::endl;
    }

    return 0;
}


Measured memory_bytes: 15872
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0: break
    for i in range(H):
        for j in range(W):
            if (i + j) % 2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()



Measured memory_bytes: 7008
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

vector<pint> g[100001];
int ans[100001];
ll dist[100001];
void dfs(int v,ll d){
    dist[v]=d;
    ans[v]=(d&1);
    rep(i,g[v].size())if(dist[g[v][i].first]==-1){
        dfs(g[v][i].first,d+g[v][i].second);
    }
}
int main(){
    memset(dist,-1,sizeof(dist));
    int n;
    cin>>n;
    int vi,ui,wi;
    rep(i,n-1){
        cin>>ui>>vi>>wi;
        --ui,--vi;
        g[ui].pb(vi,wi);
        g[vi].pb(ui,wi);
    }
    dfs(0,0);
    rep(i,n) cout<<ans[i]<<endl;
    return 0;
}


Measured memory_bytes: 9216
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
import numpy as np
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

start = time.time()

D = ni()
c = na()
s = [na() for _ in range(D)]
#out = [ni() for _ in range(D)]
sat = 0
last = [0] * 26
t = []
for d in range(D):
    li = []
    for k in range(26):
        last_t = last.copy()
        sat_t = sat
        j = k
        last_t[j] = d + 1
        for i in range(26):
            sat_t -= (d + 1 - last_t[i]) * c[i]
        sat_t += s[d][j]
        li.append(sat_t)
    sat = max(li)
    day = np.argmax(li)
    last[day] = d + 1
    #print(day+1, sat)
    t.append(day+1)

now = sat
while time.time() - start < 1.8:
    d = random.randint(1, D)
    q = random.randint(1, 26)
    if t[d - 1] == q:
        continue
    old = t[d-1]
    t[d-1] = q
    sat = 0
    last = [0] * 26
    for k in range(D):
        j = t[k] - 1
        last[j] = k + 1
        for i in range(26):
            sat -= (k + 1 - last[i]) * c[i]
        sat += s[k][j]
    if now > sat:
        t[d-1] = old
    #print(sat, last)
for i in range(D):
    print(t[i])

Measured memory_bytes: 27320
n = input()

a = input()
temp = a
b = input()
temp = b if b < temp else temp
for _ in xrange(n-2):
    now = input()
    if (b - a) < (now - temp):
        a, b = temp, now
    if now < temp:
        temp = now
    elif now > b:
        b = now
print b - a

Measured memory_bytes: 6440
#include <iostream>
using namespace std;
int main(void){
    int N,A,a;// Your code here!
    cin>>N;
    cin.ignore();
    cin>>A;
    a = N%500;
    if(a<A+1){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	for(int i=0;i<3;i++){
	int h,m,s,h1,m1,s1,t;
	cin>>h>>m>>s>>h1>>m1>>s1;
	t=(h1*3600+m1*60+s1)-(h*3600+m*60+s);	
	cout<<t/3600<<' '<<t%3600/60<<' '<<t%3600%60<<endl;
}	

return 0;
}


Measured memory_bytes: 3100
# cook your dish here
import bisect
n=int(input())

if n == 0:
    print(0)
else:
    p = [1]
    m = []
    ps = 5
    ms = 2
    w = 4
    while w<abs(n)*4:
        p.append(ps)
        m.append(ms)
        w = w *4
        ps += w
        ms += w//2
    #print(p)
    #print(m)
    ass =[]
    
    while n != 0:
        if n > 0:
            jkl = bisect.bisect_left(p,n)
            ass.append(jkl*2)
            n -=4**jkl
        if n < 0:
            n = (-1)*n
            jkl = bisect.bisect_left(m,n)
            ass.append(jkl*2+1)
            n = n*(-1)
            n += (4**jkl)*2
    ans = 0
    for i in range(len(ass)):
        ans += 10**ass[i]
    print(ans)
            
        

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] p = new int[n];
		
		for(int i=0;i<n;i++) {
			p[i] = sc.nextInt();
		}
		
		Arrays.sort(p);
		
		int ans = 0;
		for(int i=0; i<k; i++) {
			ans += p[i];
		}
		
		System.out.println(ans);

	}

}

Measured memory_bytes: 39016
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#define ll long long
#define MOD_P 1000000007
using namespace std;

bool palindrome(string str, int l, int r)
{
	//printf("%d %d\n", l, r - 1);
	for (int i = l; i < r / 2; i++) {
		if (str[i] != str[r - i - 1]) {
			//printf("%c,%c\n", str[i], str[r - i - 1]);
			return false;
		}
	}

	return true;
}

int main()
{
	string str;
	int len;
	cin >> str;
	len = str.size();

	if (palindrome(str, 0, len) && palindrome(str, 0, len / 2) && palindrome(str, (len + 1) / 2, len))
	{
		printf("Yes");
	} else {
		printf("No");
	}
}

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

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var S = sc.next();
        int zero = S.Count(c => c == '0');
        int one = S.Count(c => c == '1');
        WriteLine(Math.Min(zero, one) * 2);
    }
}


class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;
public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		int N=in.nextInt();
		while(N-->0)
		{
			double xp1=in.nextDouble(),yp1=in.nextDouble();
			double xp2=in.nextDouble(),yp2=in.nextDouble();
			double xp3=in.nextDouble(),yp3=in.nextDouble();
			double xk=in.nextDouble(),yk=in.nextDouble();//enemy
			double xs=in.nextDouble(),ys=in.nextDouble();//me
			int kabe=0;
			
			if(judge(xp1,yp1,xp2,yp2,xk,yk,xs,ys)>0||judge(xk,yk,xs,ys,xp1,yp1,xp2,yp2)>0)
				;
			else
				kabe++;
			if(judge(xp2,yp2,xp3,yp3,xk,yk,xs,ys)>0||judge(xk,yk,xs,ys,xp2,yp2,xp3,yp3)>0)
				;
			else
				kabe++;
			if(judge(xp3,yp3,xp1,yp1,xk,yk,xs,ys)>0||judge(xk,yk,xs,ys,xp3,yp3,xp1,yp1)>0)
				;
			else
				kabe++;
			System.out.println(kabe==1 ? "OK":"NG");
		}
	}
	
	static double judge(double x1,double y1,double x2,double y2,double x3,double y3,double x4,double y4)
	{
		double tc=(x1-x2)*(y3-y1)+(y1-y2)*(x1-x3);
		double td=(x1-x2)*(y4-y1)+(y1-y2)*(x1-x4);
		return tc*td;
	}
}

Measured memory_bytes: 104044
#include <iostream>
using namespace std;
int main() {
    int a, b, ans = -1;
    cin >> a >> b;
    for (int i = 0; i <= 1250; i++) {
        if (int(0.08 * i) == a && int(0.1 * i) == b) {
            ans = i;
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdint.h>
#include <iostream>
#include <string>
#include <memory>
using namespace std;

int main() {
	int N;
	string str;
	cin >> N >> str;
	unique_ptr<int[]>out = make_unique<int[]>(N);
	//-1 = 未設定,0 = 羊,1 = 狼
	auto check = [&](int v1, int vn)->bool {
		auto pstr = str.data();
		auto ptr = out.get();
		for (size_t i = 0; i < N; i++)
		{
			*ptr = -1;
			ptr++;
		}
		ptr = out.get();
		ptr[N - 1] = vn;
		ptr[0] = v1;
		for (size_t i = 0; i < N - 2; i++)
		{
			bool sim = ptr[i] == 0 ^ pstr[i] == 'x';
			if (sim) {
				ptr[(i + 1)] = ptr[(i + N - 1) % N];
			}
			else {
				ptr[(i + 1)] = (ptr[(i + N - 1) % N] == 0) ? 1 : 0;
			}
		}
		bool sim = ptr[N - 2] == 0 ^ pstr[N - 2] == 'x';
		if (sim) {
			sim = (ptr[N - 3] == ptr[N - 1]);
		}
		else {
			sim = (ptr[N - 3] != ptr[N - 1]);
		}
		if (!sim)return false;
		sim = ptr[N - 1] == 0 ^ pstr[N - 1] == 'x';
		if (sim) {
			return ptr[N - 2] == ptr[0];
		}
		else {
			return ptr[N - 2] != ptr[0];
		}
	};
	auto dout = [&]()->void {
		auto ptr = out.get();
		for (size_t i = 0; i < N; i++)
		{
			cout << ((*ptr == 0) ? 'S' : 'W');
			ptr++;
		}
	};
	bool vout;
	if (vout = check(0, 0)) {
		dout(); }
	else if (vout = check(0, 1)) {
		dout(); }
	else if (vout = check(1, 0)) {
		dout(); }
	else if (vout = check(1, 1)) {
		dout(); }
	else { cout << -1; }

	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h>/*限界*/

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

#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)

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

//abc 130 c

int main(void)
{
  int w, h, x, y;
  scanf("%d %d %d %d", &w, &h, &x, &y);
  printf("%lf ",(double)w * (double)h /2.0);
  if (x*2 == w && y*2 == h) {
    printf("1\n");
  }else{
    printf("0\n");
  }
  return 0;
}


Measured memory_bytes: 128
function Main(input) {
    var tax = 1.08;
    var invalid = ":(";

	var input = input.split("\n");
	var n = parseInt(input[0], 10);

    var x = Math.floor( n / tax);

    var reverse_n = Math.floor(x * tax);

    if (n == reverse_n) {
        console.log(x);
        return;
    } 

    var x_u = x + 1;
    if ((Math.floor((x_u) * tax)) == n) {
        console.log(x_u);
        return;
    }

    var x_u2 = x + 2;
    if ((Math.floor((x_u2) * tax)) == n) {
        console.log(x_u2);
        return;
    }

    var x_d = x - 1;
    if ((Math.floor((x_d) * tax)) == n) {
        console.log(x_d);
        return;
    }

    var x_d = x - 2;
    if ((Math.floor((x_d) * tax)) == n) {
        console.log(x_d);
        return;
    }

    console.log(invalid);

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21192
#include "bits/stdc++.h"
using namespace std;
int main(){
    string s;
    cin >> s;
    set<char> st;
    int n = s.size();
    for(int i = 0; i < n; i++){
        st.insert(s.at(i));
    }
    if(s.size() == st.size())
    cout << "yes" << endl;
    else 
    cout << "no" << endl;
    return 0; 
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    float a,b,c,d,e,f,x,y;
    while (scanf("%f %f %f %f %f %f",&a,&b,&c,&d,&e,&f) !=EOF)
        {
            y=(c*d-a*f)/(b*d-a*e);
            x=(c-b*y)/a;
            printf("%.3f %.3f\n",x,y);
        }
    return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define endl "\n"

using namespace std;

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

    string a;
    int arr[26] = {0};
    cin >> a;
    for (char x : a)
    {
        arr[x - 'A']++;
    }

    int c = 0;
    for (int i = 0; i < 26; i++)
    {
        c += arr[i] == 2;
    }
    if (c == 2)
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}

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

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

    cin >> n;

    for (int i=1; i<=n; i++){
        cin >> a >> b >> c;

        if(a*a + b*b == c*c || a*a + c*c == b*b || b*b + c*c == a*a){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 0
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"3200
pink"# => r#"pink"#,
r#"3199
pink"# => r#"red"#,
r#"4049
red"# => r#"red"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        s: String
    }
    if a >= 3200 {
        s
    } else {
        "red".to_string()
    }
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;
using Tapris = tuple<int, int, int>;

#define REP(i, n) for(LL i = 0; i < n; ++i)
#define FOR(i, a, n) for(LL i = a; i < n; ++i)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

//#define int long long

/*************** using variables ***************/
int N, W, H;
vector<int>x, y, w;
int imosw[100005];
int imosh[100005];
/**********************************************/

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

    cin >> N >> W >> H;
    x.resize(N);
    y.resize(N);
    w.resize(N);
    REP(i, N) cin >> x[i] >> y[i] >> w[i];
    
    REP(i, N){
        imosw[max(x[i]-w[i], 0)]++;
        imosw[min(x[i]+w[i], W)]--;

        imosh[max(y[i]-w[i], 0)]++;
        imosh[min(y[i]+w[i], H)]--;
    }

    bool flag1 = imosw[0] != 0;
    bool flag2 = imosh[0] != 0;
    FOR(i, 1, W){
        imosw[i] += imosw[i-1];
        flag1 &= imosw[i] != 0;
    }
    FOR(i, 1, H){
        imosh[i] += imosh[i-1];
        flag2 &= imosh[i] != 0;
    }
    cout << (flag1 || flag2 ? "Yes":"No") << endl;
}



Measured memory_bytes: 4892
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int maxN = 1000001;
int32_t main(){
    SPEED;
    int n;
    cin >> n;
    int arr[n];
    map<int, int> a;
    for(int i = 0; i < n; ++i){
        cin >> arr[i];
        a[arr[i]]++;
        a[arr[i] + 1]++;
        a[arr[i] - 1]++;
    }
    int ans = 0;
    for(auto it: a){
        ans = max(ans, it.se);
    }
    cout << ans << endl;
}

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

const int N = 1e5 + 10;
int n, m, indx[N], mark[N], par[N];
vector <int> vec, adj[N], inv[N];

void dfs(int v) {
	mark[v] = 1;
	for (int i : adj[v])
		if (!mark[i])
			dfs(i);
	vec.push_back(v);
}

int main() {
	cin >> n >> m;
	for (int i = 0; i < n + m - 1; i++) {
		int v, u;
		cin >> v >> u;
		v--; u--;
		adj[v].push_back(u);
		inv[u].push_back(v);
	}
	
	for (int i = 0; i < n; i++)
		if (!mark[i])
			dfs(i);
	reverse(vec.begin(), vec.end());
	
	for (int i = 0; i < n; i++)
		indx[vec[i]] = i;
		
	for (int i = 0; i < n; i++)
		par[i] = vec[0];
		
	for (int i = 0; i < n; i++)
		for (int j : inv[i])
			if (indx[j] > indx[par[i]])
				par[i] = j;
				
	for (int i = 0; i < n; i++)
		if (par[i] == i)
			cout << "0\n";
		else
			cout << par[i] + 1 << '\n';
}

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

using namespace std;

int main(void)
{
	int a,b,k;
	int ind1,ind2,ans;
	int cnt=0;

	cin>>a>>b>>k;

	if(a>b){
		 ind1=a;
		 ind2=b;
	 }
	else{
		ind1=b;
		ind2=a;
	}

	for(int i=ind2;i>0;i--){
		if((ind2%i)==0){
			if((ind1%i)==0){
					cnt++;
					if(cnt==k){
						ans=i;
						break;
					}
				}
			}
		}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
using ll = long long;
using namespace std;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int N,K;
int main(){
    cin >> N >> K;
    long ans = 0;
    rep1(b,N) ans += (N/b)*max(0,(b-K)) + max(0,(N%b-K+1));
    if(K==0) ans -= N;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

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

     int x=(n+a-1)/a*b;
     int y=(n+c-1)/c*d;

     if(x<y){
            printf("%d\n", x);
     }else{
            printf("%d\n", y);
     }

     return 0;
}
              
    



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

using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

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

const int INF = 100000002;

 
int l_bound(vi &v, int k){
	int s = v.size();
	int l = -1, r = s;
	int mid;
	while(r-l > 1){
		mid = (l+r)/2;
		if (v[mid] < k){
			l = mid;
		}else{
			r = mid;
		}
	}
	return s-r;
}
 
int u_bound(vi & v, int k){
	int s = v.size();
	int l = -1, r = s;
	int mid;
	while(r-l > 1){
		mid = (l+r)/2;
		if(v[mid] > k){
			r = mid;
		}else{
			l = mid;
		}
 
	}
	return l+1;
}
 


int main(){
	int n; cin >> n;
	vi a(n), b(n), c(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) cin >> c[i];
	sort(all(a)); sort(all(b)); sort(all(c));
	ll ans = 0;
	rep(i,n){
		// int eval = b[i];
		// ll a_pos = lower_bound(all(a), eval) - a.begin();
		// ll c_pos = c.end() - upper_bound(all(c), eval);
		// ans += a_pos * c_pos;
		int eval = b[i];
		ll ca = u_bound(a, eval-1);
		ll cc = l_bound(c, eval+1);
		ans += ca*cc;
	}
	cout << ans << endl;
}




Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include <deque>

using namespace std;
typedef long long ll;

vector<pair<ll, ll>> ans;

int main() {
	while (1) {
		ll n, m, s1[101] = {}, s2[101] = {}, sum[3] = {}, mi[3] = {};
		bool flag = false;
		mi[1] = mi[2] = 200;
		cin >> n >> m;
		if (n == 0 && m == 0)break;
		for (int i = 1; i <= n; i++) {
			cin >> s1[i];
			sum[1] += s1[i];
		}
		for (int i = 1; i <= m; i++) {
			cin >> s2[i];
			sum[2] += s2[i];
		}
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= m; j++) {
				if (2*(s1[i] - s2[j]) == sum[1] - sum[2] && s1[i] + s2[j] < mi[1] + mi[2]) {
					mi[1] = s1[i];
					mi[2] = s2[j];
					flag = true;
				}
			}
		}
		ans.push_back(make_pair(mi[1], mi[2]));
	}
	for (int i = 0; i < ans.size(); i++) {
		if (ans[i].first == 200) {
			cout << -1 << endl;
		}
		else {
			cout << ans[i].first << " " << ans[i].second << endl;
		}
	}
	return 0;
}


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

int main() {
  int a, b, c, d; cin >> a >> b >> c >> d;
  if (max(a, c) - min(a, c) <= d || (max(a, b) - min(a, b) <= d && max(b, c) - min(b, c) <= d)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
class dice:
    def __init__(self,label):
        self.top,self.front,self.right,self.left,self.rear,self.bottom\
            = label
    def roll(self, order):
        if order== "N":
            self.top, self.front, self.bottom, self.rear \
                = self.front, self.bottom, self.rear, self.top
        elif order=="E":
            self.top, self.left, self.bottom, self.right\
                = self.left, self.bottom, self.right, self.top
        elif order=="W":
            self.top, self.right, self.bottom, self.left\
                = self.right, self.bottom, self.left, self.top
        elif order=="S":
            self.top, self.rear, self.bottom, self.front\
                = self.rear,self.bottom,self.front,self.top
    def print_top(self): print(self.top)

label = list(input().split())
order_list = list(input())
d = dice(label)
for order in order_list:
    d.roll(order)
d.print_top()

Measured memory_bytes: 7452
def solve():
  N, K, C = map(int, input().split())
  workable = [i+1 for i, s in enumerate(input()) if s=="o"]
  if len(workable) == K:
    return workable
    
  latest = set()
  prev = workable[-1]+C+1
  for x in reversed(workable):
    if prev - x > C:
      latest.add(x)
      prev = x
      if len(latest) > K:
        return []
  must = []
  prev = -C-1
  for x in workable:
    if x - prev > C:
      if x in latest:
        must.append(x)
      prev = x
  return must

print("\n".join(map(str, solve())))

Measured memory_bytes: 23968
N = gets.to_i
a_list = gets.split.map(&:to_i)
MIN = -(10 << 60)
dp = Array.new(N + 10)
dp[0] = [0, MIN]
(0...N).each do |i|
  a = a_list[i]
  dp[i + 1] = Array.new(2)
  dp[i + 1][0] = [
    dp[i][0] + a,
    dp[i][1] + (-a)
  ].max
  dp[i + 1][1] = [
    dp[i][0] + (-a),
    dp[i][1] + a
  ].max
end
puts dp[N][0]


Measured memory_bytes: 17420
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
#define ll long long

using namespace std;

int main(){
    ll X,res;
    cin >> X;

    res = 1;

    ll tmp=0;

    for(ll i = 1; i <= X; i++)
    {
        tmp = i;
        for(ll j = 2; j <= X; j++)
        {
            tmp *= i;
            if(tmp > X)break;
            else
            {
                res = max(res,tmp);
            }
        }
    }
    cout << res << endl;

    return 0;

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Sparsh Sanchorawala
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B1 solver = new B1();
        solver.solve(1, in, out);
        out.close();
    }

    static class B1 {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            long x = s.nextLong();
            long val = 100;
            long count = 0;
            while (val < x) {
                count++;
                val = val + val / 100;
            }
            w.println(count);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32460
# -*- coding: utf-8 -*-
"""
A - Curtain
https://atcoder.jp/contests/abc143/tasks/abc143_a

"""
import sys


def solve(A, B):
    return max(0, A - B * 2)


def main(args):
    A, B = map(int, input().split())
    ans = solve(A, B)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 3060
fn read() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf
}

#[inline]
fn gcd(a: usize, b: usize) -> usize {
    let mut m = a;
    let mut n = b;
    let shift = (m | n).trailing_zeros();
    n >>= n.trailing_zeros();
    while m != 0 {
        m >>= m.trailing_zeros();
        if n > m {
            std::mem::swap(&mut n, &mut m)
        }
        m -= n;
    }
    n << shift
}

fn main() {
    let _ = read();
    let a: Vec<usize> = read()
        .trim()
        .split(' ')
        .map(|x| x.parse().unwrap())
        .collect();

    let mut ans = a[0];
    for hp in a {
        ans = gcd(ans, hp);
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
long long gcd(long long a, long long b)
{
    return b ? gcd(b, a % b) : a;
}
map<long long, long long> prime_factor(long long n)
{
    map<long long, long long> res;
    for (long long i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ++res[i];
            n /= i;
        }
    }
    if (n != 1)
        res[n] = 1;
    return res;
}
int main()
{
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    rp(i, 0, n) cin >> a[i];
    ll g = a[0] / 2;
    rp(i, 1, n) g = gcd(g, a[i] / 2);
    ll l;
    if (n >= 2)
        l = (a[0] / 2) * (a[1] / 2) / gcd(a[0] / 2, a[1] / 2);
    else
        l = a[0] / 2;
    rp(i, 2, n)
    {
        l = l * (a[i] / 2) / gcd(l, a[i] / 2);
    }
   // cout << l << endl;
    ll e = 0, o = 0;
    rp(i, 0, n)
    {
        if ((l / (a[i] / 2)) % 2 == 0)
            e++;
        else
            o++;
    }
    ll ans = 0;
    if (o == n && m >= l)
    {
        ans = (m - l) / (l * 2) + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <algorithm>
#define ll long long
using namespace std;
const int MAXN = 2e5+5;
int a[MAXN];
int main()
{

    int n,k;
    cin>>n>>k;
    for(int i = 0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll ans = 0;
    for(int i = 0;i<(n-k);i++)
    {
        ans += a[i];
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  int w;
  while(cin >> w) {
    int data[10];
    int p = 0;
    for(int i = 512; i > 0; i /= 2) {
      if(i <= w) {
	data[p++] = i;
	w -= i;
	if(w == 0) {
	  break;
	}
      }
    }
    for(p--; p >= 0; p--) {
      cout << data[p];
      if(p == 0) {
	cout << endl;
      } else {
	cout << ' ';
      }
    }
  }
  return 0;
}

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

int main(){
  int a,s;
  while(cin>>a){//EOF?????§
    s=0;
    for(int i=a;i<600;i+=a){
      s+=i*i*a;
    }
    cout<<s<<endl;
  }
  return 0;
}
  

Measured memory_bytes: 1160
n = int(input())
abc = [tuple(map(int, input().split())) for i in range(n)]

dp = [[0] * 3 for i in range(n)]
dp[0] = abc[0]

for i in range(1, n):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i][j] = max(dp[i][j], dp[i - 1][k] + abc[i][j])

print(max(dp[-1]))


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

#define rep(i, n) for(int i = 0; i<(n); i++)
using namespace std;

int main(void) {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<long long> A(X), B(Y), C(Z);

    rep(i, X) cin >> A[i];
    rep(i, Y) cin >> B[i];
    rep(i, Z) cin >> C[i];

    vector<long long> AB;
    rep(i, X) {
        rep(j, Y) {
            AB.push_back(A[i] + B[j]);
        }
    }

    sort(AB.begin(), AB.end());
    reverse(AB.begin(), AB.end());

    vector<long long> ABC;
    rep(i, min(K, (int) AB.size())) {
        rep(j, Z) {
            ABC.push_back(AB[i] + C[j]);
        }
    }

    sort(ABC.begin(), ABC.end());
    reverse(ABC.begin(), ABC.end());

    rep(i, K) cout << ABC[i] << endl;
}

Measured memory_bytes: 43240
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <queue>
#include <set>
using namespace std;

int main(){
    int N;
    std::cin >> N;
    std::vector<int> P(N);
    for (int i = 0; i < N; ++i)
    {
        std::cin >> P[i];
    }
    int count = 0;
    for (int i = 0; i < N-2; ++i)
    {
        if((P[i + 1] > P[i])&&(P[i + 1] < P[i + 2])) count++;
        if((P[i + 1] < P[i])&&(P[i + 1] > P[i + 2])) count++;
    }
    std::cout << count << "\n";
}

Measured memory_bytes: 256
n, m = list(map(int, input().split()))
ans = 1
mod = 10**9+7
a = lambda x, y: x*y % mod
if n==m:
    for i in range(1, n+1):
        ans = a(ans, i)
    print((ans**2*2)%(mod))
elif abs(n-m)==1:
    for i in range(1, n+1):
        ans = a(ans, i)
    for i in range(1, m+1):
        ans = a(ans, i)
    print(ans)
else:
    print(0)

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

int main(){
    int X, N;
    int P[110];

    cin >> X >> N;
    for(int i=0; i<N; i++){
        cin >> P[i];
    }
/*
    int tmp;
    for(int i=N; i>0; i--){
        for(int j=0; j<i; j++){
            if(P[j]>P[j+1]){
                tmp=P[j];
                P[j]=P[j+1];
                P[j+1]=tmp;
            }
        }
    }
*/
    int k=1;
    int check;
    while(1){
        check=0;
        for(int i=0; i<N; i++){
            if(X==P[i]){
                check=1;
            }
        }
        if(check==0){
            cout << X << endl;
            break;
        }

        X-=k;
        k++;

        check=0;
        for(int i=0; i<N; i++){
            if(X==P[i]){
                check=1;
            }
        }
        if(check==0){
            cout << X << endl;
            break;
        }

        X+=k;
        k++;
    }

    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;i++)

int N,M;
int P[100000], Y[100000];
vector<int> yd[100001];

int main() {
  cin >> N >> M;
  rep(i, M) {
    cin >> P[i] >> Y[i];
    yd[P[i]].push_back(Y[i]);
  }
  rep(i, N) {
    sort(yd[i+1].begin(), yd[i+1].end());
  }
  rep(i, M) {
    printf("%012lld\n", ll(P[i])*1000000 + int(lower_bound(yd[P[i]].begin(), yd[P[i]].end(), Y[i]) - yd[P[i]].begin())+1);
  }
}

Measured memory_bytes: 7808
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),b = sc.nextInt(),c = sc.nextInt();
		if(a == b && b == c && c == a && a % 2 == 0)
			System.out.println(-1);
		else{
			int count = 0;
			while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
				int temp_a = b / 2 + c / 2;
				int temp_b = c / 2 + a / 2;
				c = a / 2 + b / 2;
				a = temp_a;
				b = temp_b;
				count++;
				
				if(count == 10000){
					count = -1;
					break;
				}
			}
			System.out.println(count);
		}
	}
 
}

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

int main()
{
    int N, K,sum=0;
    cin >> N >> K;
    vector<int> p(N);
    for (int i = 0; i < N;i++)
    {
        cin >> p.at(i);
    }
    sort(p.begin(), p.end());

    for (int i = 0; i < K;i++)
    {
        sum += p.at(i);
    }
    cout << sum << endl;
}


Measured memory_bytes: 3624
def makeDiv(n):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    div.sort()
    return div

N = int(input())
L = makeDiv(N)
ans = 0
shou = 0
for i in L:
    shou = (N-i)//i
    if shou > i and N == shou*i+i and shou != 1:
        ans += shou
print(ans)


Measured memory_bytes: 3268
import java.util.Scanner;
class Main{
    public static void main(String[] args){
		int x,y;
		Scanner sc=new Scanner(System.in);
		while(true){
			x=sc.nextInt();
			y=sc.nextInt();
			if(x==0&&y==0)break;
			if(x>y){
				System.out.println(y+" "+x);
			}else{
				System.out.println(x+" "+y);
			}
		}
    }
}


Measured memory_bytes: 34476
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main() {
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    sort(S.begin(), S.end());
    for (int i = 0; i < N; i++) cout << S[i];
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll,ll> P;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;

ll n,k;
string s;

void input(void){
	cin>>n;
}

void solve(void){
    cout<<n*n*n<<endl;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

Measured memory_bytes: 256