akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include <string.h>
int isPrime(int x){
	int i;
	if(x<2) return 0;
	else if(x==2) return 1;
	if(x%2==0) return 0;
	for(i=3;i*i<=x;i+=2){
		if(x%i==0) return 0;
	}
	return 1;
}
int p,cnt,cnt2,food;
int n,d=0,g,kakaku[31],flag,youso[1000001]={0};
int main()
{
	scanf("%d %d",&n,&p);
	while(1){
		memset(kakaku, 0, sizeof(kakaku));
		memset(youso, 0, sizeof(youso));
		if(n==0&&p==0){
			break;
		}
		for(cnt=1;cnt<=n;cnt++){
			scanf("%d",&food);
			youso[food]=1;
			kakaku[cnt]=food;
		}
		for(cnt=0;cnt<=p;cnt++){
			if(youso[cnt]==1){
				for(cnt2=1;cnt2<=n;cnt2++){
					if(cnt+kakaku[cnt2]<=p){
						youso[cnt+kakaku[cnt2]]=1;
					}
				}
			}
		}
		flag=0;
		for(cnt=p;cnt>=0;cnt--){
			if(youso[cnt]==1){
				g=cnt;
				d=isPrime(g);
				if(d==1){
					flag=1;
					d=cnt;
					printf("%d\n",d);
					break;
				}
			}
		}
		if(flag==0){
			printf("NA\n");
		}
		d=0;
		flag=0;
		
		scanf("%d %d",&n,&p);
	}
	return 0;
}

Measured memory_bytes: 6504
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


def pop_count(x):
    x = x - ((x >> 1) & 0x5555555555555555)
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
    x = x + (x >> 8)
    x = x + (x >> 16)
    x = x + (x >> 32)
    return x & 0x0000007f


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    # sys.stdin = open("sample.txt")
    N = Scanner.int()
    if N % 2 == 1:
        print(0)
    else:
        ans = 0
        while N > 0:
            ans += (N // 5) // 2
            N //= 5
        print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define int ll
#define tcase int t; cin>> t; for( ; t; --t)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;

int n;

int32_t main(){
	fastio;
	cin>> n;
	vi p(n);
	vi q(n);
	vi v(n);
	for(int i = 0; i<n ; ++i) cin>> p[i];
	for(int i = 0; i<n ; ++i) cin>> q[i];

	for(int i = 1; i<=n; ++i) v[i-1] = i;

	int counter = 0;
	int a, b;
	do{
   		if(p==v) a = counter;
   		if(q==v) b = counter;

   		counter++;
   	}while(next_permutation(all(v)));

   	cout<< abs(a-b)<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (){
	
	int H, W, N;
	scanf("%d %d %d", &H, &W, &N);
	
	int xx;
	
	if(H >= W) {
        if(N % H == 0) {
            xx = N / H;
        } else {
            xx = N / H + 1;
        }
    } else {
        if(N % W == 0) {
            xx = N / W;
        } else {
            xx = N / W + 1;
        }
    }
	printf("%d", xx);
	
	return 0;
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  int ac_num=0,wa_num=0,tle_num=0,re_num=0;
  for(int i=0;i<n;i++){
    string result;
    cin >> result;
    if(result=="AC"){
      ac_num++;
    }else if(result=="WA"){
      wa_num++;
    }else if(result=="TLE"){
      tle_num++;
    }else{
      re_num++;
    }
  }
  cout << "AC x " << ac_num << endl;
  cout << "WA x " << wa_num << endl;
  cout << "TLE x " << tle_num << endl;
  cout << "RE x " << re_num << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, n, k;
  string s = "IMPOSSIBLE";
  in2(n, k);
  vector<ll> c(n);
  rep(i, n){
    in(c[i]);
    if(c[i] == k)
      s = "POSSIBLE";
  }
  a = c[0];
  b = 0;
  rep(i, n){
    a = __gcd(a, c[i]);
    b = max(b, c[i]);
  }
  if(k % a == 0 && b >= k)
    s = "POSSIBLE";
  out(s);
  memi;
}

Measured memory_bytes: 1024
// Problem : D - Remainder Reminder
// Contest : AtCoder Regular Contest 091
// URL : https://atcoder.jp/contests/arc091/tasks/arc091_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using ll = long long;
using namespace std;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = 1e6 + 1, mod = 1e9 + 7;

int n, k;
ll ans = 0;

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n >> k;
	if (k == 0) {
		return cout << 1ll * n * n, 0;
	}
	for (int i = k; i <= n; i++) {
		int p = (n + 1) / i;
		ans += (i - k) * p + max(0, (n + 1) % i - k);
	}
	cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  string A,B,C;
  cin >> A >> B >> C;
  
  queue<char> qa,qb,qc;
  rep(i,A.size()) qa.push(A[i]);
  rep(i,B.size()) qb.push(B[i]);
  rep(i,C.size()) qc.push(C[i]);
  
  char turn = 'a';
  while(1){
    if(turn == 'a'){
      if(qa.empty()){ cout << "A" << endl; return 0; }
      else{ turn = qa.front(); qa.pop(); }
    }
    if(turn == 'b'){ 
      if(qb.empty()){ cout << "B" << endl; return 0; }
      else{ turn = qb.front(); qb.pop(); }
    }
    if(turn == 'c'){
      if(qc.empty()){ cout << "C" << endl; return 0; }
      else{ turn = qc.front(); qc.pop(); }
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func main() {
  var a, b, c, x int

  fmt.Scanf("%d", &a)
  fmt.Scanf("%d", &b)
  fmt.Scanf("%d", &c)
  fmt.Scanf("%d", &x)

  count := 0
  for _a:=0; _a<=a; _a++ {
    for _b:=0; _b<=b; _b++ {
      for _c:=0; _c<=c; _c++ {
        if 500 * _a + 100 * _b + 50 * _c == x { count++ }
      }
    }
  }

  fmt.Print(count)
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

ll llmin(ll a, ll b){
  if(a>b) return b;
  return a;
}
ll llmax(ll a, ll b){
  if(a>b) return a;
  return b;
}
int main(int argc, char const *argv[]) {
  ll N, K;
  std::cin >> N >> K;
  std::vector<ll> A(N);
  ll S=0;
  for(int i=0;i<N;i++) {
    std::cin >> A[i];
    S+=A[i];
  }
  std::vector<ll> candi;
  for(int i=1;i*i<=S;i++){
    if(S%i==0){
      if(i*i==0) candi.push_back(i);
      else {
        candi.push_back(i);
        candi.push_back(S/i);
      }
    }
  }
  sort(candi.begin(), candi.end());
  //for(int i=0;i<candi.size();i++) std::cout << candi[i] << '\n';
  ll ans = 0;
  for(int i=0;i<candi.size();i++){
    ll need=1000000007;
    //std::cout << "//-------------------------------------------------------------------" << '\n';
    //std::cout << candi[i] << '\n';
    multiset<ll> pl, mn;
    ll sss=0, SSS=0;
    for(int j=0;j<N;j++) {
      pl.insert(A[j]%candi[i]);
      mn.insert(candi[i]-(A[j]%candi[i]==0?candi[i]:A[j]%candi[i]));
      sss+=candi[i]-(A[j]%candi[i]==0?candi[i]:A[j]%candi[i]);
    }
    auto itr = pl.begin();
    for(int j=0;j<N;j++) {
      SSS+=*itr;
      sss-=(*itr==0?0:candi[i]-*itr);
      need = llmin(need, llmax(SSS, sss));
      //std::cout << SSS << " " <<sss<< " " <<need<< '\n';
      if(need <= K) ans = candi[i];
      itr++;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


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

using namespace std;

#define ll long long
#define vi vector<int>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

int A,B,C, max_v, ans = 0;

void solve(){
    max_v = max(max(A, B), C);

    ans = 3 * max_v - (A + B + C);

    if(ans % 2 == 0) cout << ans / 2 << endl;
    else cout << (ans + 3) / 2 << endl;
}

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

    solve();
}


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

int main() {
    long long k;
    std::cin >> k;
    std::cout << 50 << std::endl;
    const auto p = k / 50 + 50, q = p - 1 - (k % 50);
    for (int i = 0; i < k % 50; i++) {
        std::cout << p << " ";
    }
    for (int i = k % 50; i < 50; i++) {
        std::cout << q << " ";
    }
    std::cout << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const int maxn = 1e5 + 10;
LL v[maxn];

// edge
int cnt, h[maxn];
struct edge
{
    int to, pre;
} e[maxn<<1];
void add(int from, int to)
{
    cnt++;
    e[cnt].pre = h[from];
    e[cnt].to = to;
    h[from] = cnt;
}

int deg[maxn], ok;
LL dfs(int x, int f)
{
    if(deg[x] == 1) return v[x];
    LL ret = v[x] + v[x];
    for(int i = h[x]; i; i = e[i].pre)
    {
        int to = e[i].to;
        if(to == f) continue;
        LL tmp = dfs(to, x);
        if(tmp > v[x]) ok = 0;
        if(tmp > ret) ok = 0;
        ret -= tmp;
    }
    if(ret > v[x]) ok = 0;
    return ret;
}

int main(void)
{
    int N;
    scanf("%d", &N);
    for(int i = 1; i <= N; i++) scanf("%lld", v + i);
    for(int i = 1; i < N; i++)
    {
        int a, b;
        scanf("%d %d", &a, &b);
        add(a, b); add(b, a);
        deg[a]++; deg[b]++;
    }
    if(N == 2)
    {
        if(v[1] == v[2]) puts("YES");
        else puts("NO");
        return 0;
    }
    int rt = 0;
    for(int i = 1; i <= N; i++)
    if(deg[i] != 1) {rt = i; break;}
    ok = 1;
    if(dfs(rt, 0) != 0) ok = 0;
    puts(ok ? "YES" : "NO");
    return 0;
}


Measured memory_bytes: 7424
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	a,b = readline() |> split |> parseMap
	k = 0
	now = 1
	while now<b
		k += 1
		now += a-1
	end
	println(k)
end

main()

Measured memory_bytes: 110088
/*
    Stay motivated and keep working hard
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int dp[100007];
int h[100007];
const int INF = 1e9+7;
int recur(int n){
    if(n <= 0){
        return INF;
    }
    if(n == 1){
        return 0;
    }
    if(dp[n] != INF){
        return dp[n];
    }
    return dp[n] = min(abs(h[n] - h[n-1]) + recur(n-1), abs(h[n] - h[n-2]) + recur(n-2));
    // int ans1 = INT_MAX, ans2 = INT_MAX;
    // if(n == 2){
    //     ans1 = abs(h[2] - h[1]);
    // }
    // else if(n == 3){
    //     ans1 = abs(h[3] - h[1]);
    //     ans2 = abs(h[3] - h[2]) + recur(2);
    // }
    // else{
    //     ans1 = abs(h[n] - h[n-2]) + recur(n-2);
    //     ans2 = abs(h[n] - h[n-1]) + recur(n-1);
    // }
    // return dp[n] = min(ans1, ans2);
}
int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> n;
    // memset(dp, -1, sizeof(dp));
    for(int i=0;i<100007;i++){
        dp[i] = INF;
    }
    for(int i=1;i<=n;i++){
        cin >> h[i];
    }
    recur(n);
    cout << dp[n] << "\n";


    return 0;
}

Measured memory_bytes: 2560
n = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'

for t in range(1, 30):
    if n > 26 ** t:
        n -= 26 ** t
    
    else:
        n -= 1
        ans = [0] * t
        for i in range(t):
            ans[i] = n % 26
            n //= 26

        ans = ans[::-1]
        s = ''
        for i in range(t):
            s += alp[ans[i]]

        print(s)
        break

Measured memory_bytes: 9200
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int m, f, r;
    cin >> m >> f >> r;
    
    while ( !(m == -1 && f == -1 && r == -1 ) ) {
        if ( m == -1 || f == -1 ) {
            cout << "F" << endl;
        } else if ( m + f >= 80 ) {
            cout << "A" << endl;
        } else if ( m + f >= 65 ) {
            cout << "B" << endl;
        } else if ( m + f < 30 ) {
            cout << "F" << endl;
        } else if ( m + f >= 50 || r >= 50 ) {
            cout << "C" << endl;
        } else {
            cout << "D" << endl;
        }
        cin >> m >> f >> r;
    }
}

Measured memory_bytes: 3092
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple


def solve(values: List[str], nb: int) -> Dict[int, int]:
    subord = defaultdict(int)
    for v in values:
        subord[v] += 1
    return subord


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    N = int(input())
    values = list(map(int, input().split()))
    result = solve(values, N)
    for i in range(N):
        print(result[i + 1])


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result))


def configure_log(log_file: Optional[str] = None) -> None:
    "Configure the log output"
    log_formatter = logging.Formatter(
        "%(asctime)s - %(filename)s:%(lineno)d - " "%(levelname)s - %(message)s"
    )
    if log_file:
        handler = logging.FileHandler(filename=log_file)
    else:
        handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            # uncachable -- for instance, passing a list as an argument.
            # Better to not cache than to blow up entirely.
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)


Measured memory_bytes: 46820
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
struct __test {} test;
using namespace std;
template <typename T>const __test &operator<<(const __test& d,
const T& v) {return cerr << "\033[31m" << v << "\033[0m",d;}
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

const int N = 1e5+5;
int a[N],n;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
		ll k;
		if(i) {
			k = min(a[i-1],a[i]);
			ans += k;
			a[i] -= k;
		}
		k = a[i]/2;
		ans += k;
		a[i] &= 1;
		// cout << ans << "\n";
	}
	cout << ans << "\n";
}

Measured memory_bytes: 640
#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>

using namespace std;

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

#define X real()
#define Y imag()

typedef complex<double> P;
typedef pair<P, P> L;
typedef vector<P> Pol;

const double INF = 1e40;
const double EPS = 1e-8;
const double PI = acos(-1);

int sig(double r) {return (r < -EPS) ? -1 : (r > EPS) ? 1: 0;}
bool eq(double a, double b) {return abs(a - b) < EPS;}
double dot(P a, P b) {return a.X * b.X + a.Y * b.Y;}
double cross(P a, P b) {return a.X * b.Y - a.Y * b.X;}
P vec(L a) {return a.second - a.first;}
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(L s, P p) {
  P a = vec(s);
  p -= s.first;
  double cr = cross(a, p);
  if (eq(cr, 0)) {
    if (sig(dot(a, p)) < 0) return BACK;
    if (sig(norm(a) - norm(p)) < 0) return FRONT;
    return ON;
  }
  return (cr > 0) ? LEFT : RIGHT;
}
double ang(P p) {double theta = arg(p); return sig(theta - PI) < 0 ? theta : -PI;}
P dv(double theta) {return polar(1., theta);}
double vang(P base, P a, P b) {return ang((b - base) * dv(-ang(a - base)));}
bool iLSs(L a, L b) {return sig(cross(vec(a), b.first - a.first)) * sig(cross(vec(a), b.second - a.first)) < 0;}

P pLL(L a, L b) {return a.first + vec(a) * (cross(vec(b), b.first - a.first) / cross(vec(b), vec(a)));}

bool lessX(P a, P b){
  if(!eq(a.X, b.X)) return a.X < b.X;
  if(!eq(a.Y, b.Y)) return a.Y < b.Y;
  return false;
}
vector<P> convexHull(vector<P> p) {
  int m = 0;
  vector<P> q(p.size() * 2);
  sort(p.begin(), p.end(), lessX);
  for (int i = 0; i < int(p.size()); q[m++] = p[i++]) for (; m > 1 && sig(cross(q[m - 1] - q[m - 2], p[i] - q[m - 2])) <= 0; --m);
  for (int i = p.size() - 2, r = m; i >= 0; q[m++] = p[i--]) for (; m > r && sig(cross(q[m - 1] - q[m - 2], p[i] - q[m - 2])) <= 0; --m);
  q.resize(m - 1);
  return q;
}
vector<P> convexCut(vector<P> p, L l) {
  vector<P> q;
  rep (i, p.size()) {
    if (ccw(l, p[i]) & (LEFT | BACK | ON | FRONT)) q.push_back(p[i]);
    if (iLSs(l, L(p[i], p[(i + 1) % p.size()]))) q.push_back(pLL(l, L(p[i], p[(i + 1) % p.size()])));
  }
  return q;
}

int main() {
  int n;
  for (;;) {
    cin >> n;
    if (n == 0) break;
    Pol pol;
    rep (i, n) {
      P p;
      cin >> p.X >> p.Y;
      pol.push_back(p);
    }
    Pol convex = convexHull(pol);
    rep (i, n) {
      /*
      rep (j, convex.size()) {
	cout << convex[j] << endl;
      }
      cout << endl;
      //*/
      if (sig(vang(pol[(i + 1) % n], pol[(i + 2) % n], pol[i])) > 0) {
	convex = convexCut(convex, L(pol[i], pol[(i + 1) % n]));
	convex = convexCut(convex, L(pol[(i + 1) % n], pol[(i + 2) % n]));
      }
    }
    if (convex.size() > 0u) cout << 1 << endl;
    else cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll n, k;
    cin >> n >> k;
    ll a, gcd = 0, mx = 0;
    REP(i, n){
        cin >> a;
        mx = max(mx, a);
        if(gcd == 0) gcd = a;
        else gcd = __gcd(gcd, a);
    }
    if(k > mx  || k % gcd) cout << "IMPOSSIBLE" << endl;
    else cout << "POSSIBLE" << endl;
    return 0;
}

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

int main(){
  char S[100];
  int S_length;
  int i;
  int count = 0;

  scanf("%s", S);
  S_length = strlen(S);

  for(i=0;i<S_length/2;i++){
    if(S[i] != S[S_length - i - 1]){
      count++;
    }
  }

  printf("%d", count);

  return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(500000)

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

N = int(input())

tree = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    tree[a].append((b, c))
    tree[b].append((a, c))

Q, K = map(int, input().split())

def dfs(start, dist, dists, f=None):
    for n, d in tree[start]:
        if n == f:
            continue
        dists[n] = dist + d
        dfs(n, dist+d, dists, start)

xy = [list(map(int, input().split())) for i in range(Q)]

dists = [0] * (N+1)
dfs(K, 0, dists)

for i in range(Q):
    x, y = xy[i]
    print(dists[x] + dists[y])


Measured memory_bytes: 217264
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;

inline int read() {
	int x=0;char c=getchar();
	while (c<'0'||c>'9') c=getchar();
	while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x;
}
string x,y;
int main() {
	string a,b;
	cin>>a>>b;
	int n=a[0]-'0',m=b[0]-'0';
	for (int i=1;i<=n;++i) x+=b;
	for (int i=1;i<=m;++i) y+=a;
	if (x<y) cout<<x<<endl;
	else cout<<y<<endl;
	return 0;
}

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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;




int main() {

	int n, m;
	cin >> n >> m;
	int ans = n * (n - 1)/2 + m * (m - 1)/2;
	cout << ans << endl;


}

Measured memory_bytes: 256
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

int N;
P p[100000];
ll K;

void init()
{
}

void solve()
{
    sort(p, p+N);
    REP(i, N){
        if(K <= p[i].se){
            cout << p[i].fi << endl;
            break;
        }
        K -= p[i].se;
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i, N) cin >> p[i].fi >> p[i].se;
    solve();
    return 0;
}

// vim:set foldmethod=marker:


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  int n; cin>>n;
  cout << "ABC" << n << endl;
}

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


Measured memory_bytes: 256
import std.algorithm;
import std.ascii;
import std.array;
import std.container;
import std.conv;
import std.numeric;
import std.stdio;
import std.string;
import std.typecons;

void log(A...)(A arg) {
    stderr.writeln(arg);
}
int size(T)(in T s) {
    return cast(int)s.length;
}

const int INF = 10000;

int op(char c, int a, int b) {
    if (c == '+') return a + b;
    if (c == '-') return a - b;
    assert(false);
}

int next_op_index(in string s, int i) {
    for (int j = i; j < s.size; j++) {
        if (s[j] == '+' || s[j] == '-') return j;
    }
    throw new Exception("");
}
int prev_op_index(in string s, int i) {
    for (int j = i; j >= 0; j--) {
        if (s[j] == '+' || s[j] == '-') return j;
    }
    throw new Exception("");
}

void main() {
    string s = readln.chomp;

    auto t_index = new int[s.size]; t_index[] = -1;
    int cur = 0;
    foreach (i, c; s) {
        if (c == '(' || c == ')') continue;
        t_index[i] = cur++;
    }
    auto buf = new char[cur];
    foreach (i, c; s) {
        if (c == '(' || c == ')') continue;
        buf[t_index[i]] = c;
    }
    string t = buf.idup;

    int N = t.size;
    auto open_banned = new bool[N];
    auto close_banned = new bool[N];
    foreach (int i, c; s) {
        try {
            if (c == '(')      close_banned[t_index[next_op_index(s, i)]] = true;
            else if (c == ')') open_banned[t_index[prev_op_index(s, i)]] = true;
        } catch (Exception e) {}
    }

    auto dp_min = new int[][](N + 1, N + 1);
    auto dp_max = new int[][](N + 1, N + 1);
    foreach (ref a; dp_max) a[] = -INF;
    foreach (ref a; dp_min) a[] = INF;
    foreach (i, c; t) {
        if (c.isDigit) dp_max[i][i + 1] = dp_min[i][i + 1] = cast(int)(c - '0');
    }

    for (int k = 2; k <= N; k++) {
        for (int i = 0; i + k <= N; i++) {
            for (int j = i + 1; j < i + k; j++) {
                if (! (t[j] == '+' || t[j] == '-')) continue;
                int lcount = cast(int)t[i .. j].count!isDigit;
                int rcount = cast(int)t[j .. i + k].count!isDigit;
                if (lcount >= 2 && close_banned[j]) continue;
                if (rcount >= 2 && open_banned[j]) continue;
                switch (t[j]) {
                    case '+':
                        dp_max[i][i + k] = max(dp_max[i][i + k], dp_max[i][j] + dp_max[j + 1][i + k]);
                        dp_min[i][i + k] = min(dp_min[i][i + k], dp_min[i][j] + dp_min[j+ 1][i + k]);
                        break;
                    case '-':
                        dp_max[i][i + k] = max(dp_max[i][i + k], dp_max[i][j] - dp_min[j + 1][i + k]);
                        dp_min[i][i + k] = min(dp_min[i][i + k], dp_min[i][j] - dp_max[j + 1][i + k]);
                        break;
                    case '(':

                    default:
                        break;
                } 
            }
        }
    }
    /*
    foreach (L; dp_max) log(L);
    log();
    foreach (L; dp_min) log(L);
    */
    writeln(dp_max[0][t.size]);
}

Measured memory_bytes: 2772
k = int(input())
if k%2 == 0:
    ans = -1
else:
    x = 0
    ans = -1
    for i in range(10**6+1):
        x += 7*pow(10, i, k)
        x %= k
        if x%k == 0:
            ans = i+1
            break
print(ans)

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

int main() {
  string S;
  cin >> S;
  vector<char> vow = {'a','i','u','e','o'};
  int length = S.size();
  int flag = 0;
  for (int i = 0;i < length;i++){
    for (int j = 0;j<5;j++){
      if (vow[j] == S.at(i)){
        flag = 1;
        break;
      }
    }
    if (flag == 1) break;
  }
  if (flag == 1) cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int64_t X;
  cin >> X;
  
  int64_t mon = 100;
  int year = 0;
  
  while(mon < X){
    mon *= 1.01;
    year += 1;
  }
  cout << year << endl;
}

Measured memory_bytes: 3636
import sys
input = sys.stdin.readline
import numpy as np
def getNearestValue(list, num):
	idx = np.abs(np.asarray(list) - num).argmin()
	return list[idx]

N=int(input())
A=list(map(int,input().split()))
A.sort()
n=A.pop()
r=getNearestValue(A,n/2)



print(n,r)


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

string S;

int main() {
    cin >> S;

    string target = "abcdefghijklmnopqrstuvwxyz";
    string ans = "";
    rep(i, target.size()) {
        if (S.find(target[i]) == string::npos) {
            ans = target[i];
            break;
        }
    }

    cout << (ans == "" ? "None" : ans) << endl;
}

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

s = list(input())

count_red = s.count('R')
count_white = 0

A = []
for i in range(n):
    if s[i] == 'R':
        count_red -= 1
    if s[i] == 'W':
        count_white += 1
    A.append(max(count_red, count_white))

if len(set(s)) == 1 and list(set(s)) == ['W']:
    print(0)
else:
    print(min(A))

Measured memory_bytes: 95132
num = int(input())
if num < 600:
  print(8)
elif num < 800:
  print(7)
elif num < 1000:
  print(6)
elif num < 1200:
  print(5)
elif num < 1400:
  print(4)
elif num < 1600:
  print(3)
elif num < 1800:
  print(2)
else:
  print(1)


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

int main(){
  int n;
  cin >> n;
  int sum=0;
  vector<int> r(n);
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin >> r[i] >> l[i];
  }
  for(int i=0;i<n;i++){
    sum+=l[i]-r[i]+1;
  }
   cout << sum << endl;
}

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

typedef long long ll;
typedef pair<int,ll> P;
typedef pair<P,P> P2;
const ll inf=100000000000000001;
int main() {
	int n;
	cin>>n;
	ll t=0;
	ll a[200001]={};
	ll a1;
	for(int i=0;i<n;++i){
		cin>>a1;
		t+=a1;
		a[i]=t;
	}
	ll r=inf;
	for(int i=0;i<n-1;++i){
		r=min(r,abs(t-a[i]*2));
	}
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>


using namespace std;

bool solve(const string& str) {
	if (str[0] != 'A')
		return false;
	bool is_c = false;
	if (!islower(str[1])) {
		return false;
	}
	for (int i = 2; i < str.size() - 1; ++i) {
		if (str[i] == 'C' ) {
			if (is_c)
				return false;
			is_c = true;
		}
		else if(!islower(str[i])){
			return false;
		}
	}
	if (!is_c || !islower(str.back())) {
		return false;
	}
	return true;
}

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

	cout << (solve(s) ? "AC" : "WA") << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N;
    cin >> N;
    
    cout << fixed << setprecision(20);

    if (N >= 1000) cout << "ABD" << endl;
    else cout << "ABC" << endl;

}


Measured memory_bytes: 384
n,x,m = map(int,input().split())
if x == 1:
  print(n)
  exit()
u = [0 for _ in range(m)]
rs = [0 for _ in range(m+1)]
s = x
u[x] = 1
rs[1] = x
i = 2
while True:
  x = (x*x)%m
  if u[x] == 0:
    u[x] = i
    s += x
    rs[i] = s
    i += 1
  else:
    ls = u[x]
    le = i-1
    break
if n <= le:
  print(rs[n])
  exit()
ans = rs[ls-1]
ll = le-ls+1
nl = n-ls+1
lsum = rs[le] - rs[ls-1]
q = nl//ll
r = nl%ll
ans += q*lsum
ans += rs[ls-1+r] - rs[ls-1]
print(ans)

Measured memory_bytes: 79200
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 1 + 1e5;
const ll mod = 1e9 + 7;

typedef pair<int,int> II;

int h, w, a, b, dp[maxn];
ll gt[2 * maxn + 100], igt[2 * maxn + 100];
ll ans;

ll C(int n, int k) {
	return ((gt[n] * igt[k]) % mod * igt[n - k]) % mod;
}

ll Pow (int i, int j) {
	if (j == 0) return 1;
	if (j % 2) {
		return (i * Pow (i, j - 1)) % mod;
	}
	ll val = Pow (i, j / 2);
  return (val * val) % mod;
}

void calc () {
	gt[0] = 1;
	for (int i = 1; i <= 2 * maxn; ++i) {
		gt[i] = (gt[i - 1] * i) % mod;
	}
	igt[2 * maxn] = Pow (gt[2 * maxn], mod - 2);
  for (int i = 2 * maxn - 1; i >= 0; --i) {
    igt[i] = (igt[i + 1] * (i + 1) + mod) % mod;
  }
}

int main()
{
	#ifndef ONLINE_JUDGE
	freopen("abc.inp","r",stdin);freopen("abc.out","w",stdout);
//	freopen("abc.inp","r",stdin);freopen("abc.out","w",stdout);
	#endif //ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie();
	cout.tie();
	calc();

	cin >> h >> w >> a >> b;
	int _a = h - a, _b = w - b;
	for (int i = 0; i < _b; ++i)
		dp[i] = C(_a + b + i - 1, _a - 1);
	for (int i = 0; i < _b; ++i) {
		ans += (C (a + i - 1, i) * dp[_b - i - 1] ) % mod;
		ans %= mod;
//		cout << C (a + i - 1, i) << " " << dp[_b - i - 1] << '\n';
	}
	cout << ans;
   return 0;
}


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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  int n,h,w;
  cin>>n>>w>>h;
  int width[100100]={};
  int height[100100]={};
  bool ans=false;
  for(int i=0;i<n;i++){
    int x,y,W;cin>>x>>y>>W;
    width[max(0,x-W)]++;
    width[min(x+W,w)]--;
    height[max(0,y-W)]++;
    height[min(y+W,h)]--;
    if(max(w-x,x)<=W||max(h-y,y)<=W){
      
      ans=true;
    }

  }
  if(ans){
    cout<<"Yes"<<endl;
    return 0;
  }
  bool flag=true;
  int now=0;
  for(int i=0;i<w;i++){
    now+=width[i];
    if(now<=0){

      flag=false;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
    return 0;
  }
  now=0;
  flag=true;
  for(int i=0;i<h;i++){
    now+=height[i];
    if(now<=0){
      // cout<<i<<endl;
      flag=false;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }else
    cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3896
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair <int, int> pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 105;
const int MAXM = 3505;
const int mod = 1e9 + 7;

int n, m, ret, lst, f[MAXN][MAXM];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read();
	ret = n * m * (m + 1) / 2;
	for (int i = 1; i < n; i ++)
		ret = 1LL * ret * (m + 1) % mod;
	f[n + 1][0] = 1;
	for (int i = n; i; lst += (lst + min(i, m)) / i, i --)
		for (int j = 0; j <= lst; j ++)
			for (int k = 0; k <= m; k ++)
				if (k <= i)
					f[i][j + (j + k) / i] = (f[i][j + (j + k) / i] + f[i + 1][j]) % mod;
				else
					f[i][j] = (f[i][j] + f[i + 1][j]) % mod;
	for (int i = 1; i <= lst; i ++)
		ret = (ret - 1LL * f[1][i] * i % mod + mod) % mod;
	return printf("%d\n", ret), 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define repl(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    string s;
    cin >> s;
    int res = 0;
    rep(i,4){
        if(s[i] == '+')res++;
        else res--;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        long N = scanner.nextLong();
        if (N <= 1) {
            System.out.println(0);
            return;
        }

        long sqrt = (long) Math.sqrt(N);
        int count = 0;
        for (long i = 2 ; i * i <= N ; i++) {
            if (N % i == 0) {
                long z = i;
                while (N % z == 0) {
                    count++;
                    N /= z;
                    z *= i;
                }
                while (N % i == 0) {
                    N /= i;
                }
            }
        }

        if (N > 1) count++;
        System.out.println(count);
    }

    static void eratosthenes(int N) {
        boolean[] numbers = new boolean[N + 1];
        for (int i = 0 ; i <= N ; i++) {
            numbers[i] = true;
        }

        int sqrt = (int) Math.sqrt(N);
        for (int i = 2 ; i <= sqrt ; i++) {
            if (numbers[i]) {
                for (int j = i * i ; j <= N ; j+= i) {
                    numbers[j] = false;
                }
            }
        }

        for (int i = 1 ; i <= N ; i++) {
            if (numbers[i]) {
                System.out.printf("%3d ", i);
            } else {
                System.out.print("    ");
            }
            if (i % 10 == 0) {
                System.out.println();
            }
        }

    }
}


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

int main()
{
	vector<pair<int,int>> A(5);
	for (int i = 0; i < 5; i++)
	{
		cin >> A[i].second;
		if (A[i].second % 10!=0)
		{
			A[i].first = 10 - A[i].second % 10;
		}
		else
		{
			A[i].first = 0;
		}
	}
	sort(A.begin(),A.end());
	int ans = 0;
	for (int i = 0; i < 5; i++)
	{
		ans += A[i].first;
		ans += A[i].second;
	}
	ans -= A[4].first;
	cout << ans << endl;
	return 0;
}

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

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a;
cin >> a;
bool ans = true;
for (int i = 1; i<4;i++){
if (a[i-1] == a[i]){
ans = false;
break;
}
}
ans ? cout << "Good\n" : cout << "Bad\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
using namespace std;
 
int main(){
  double a, b, c, d, e, f;
  while( cin >> a >> b >> c >> d >> e >> f){
    double y = ( a * f - c * d) / ( a * e - b * d);
    double x = ( c - b * y ) / a;
    cout << fixed << setprecision(3) << x << " " << y << endl;
  }
  return 0;
}


Measured memory_bytes: 3216
from itertools import accumulate
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
S = input()[:-1]
l = [0]*(N+1)
for i, c in enumerate(S):
    if c == "I":
        l[i+1] += 1
    else:
        l[i+1] -= 1
l_acc = accumulate(l)
print(max(l_acc))


Measured memory_bytes: 3060
#include <iostream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(void){
    string S;
    cin >> S;
    int ans = 0;
    for(int i=0;i+1<S.size();i++){
        if(S[i] != S[i+1])ans++;
    }
    cout << ans << endl;
}


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

// Template Headers {{{
using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long; using vll = vector<long long>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
constexpr int INF = 0x3f3f3f3f; constexpr ll BINF = 0x3f3f3f3f3f3f3f3fLL;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}

int solve() {
	int n, k; cin >> n >> k;
	int fst = n - k + 1;
	if (k > 1)
		cout << fst - 1 << endl;
	else
		cout << 0 << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0);
	// precompute();
	// int t; cin >> t; for (int i=1;i<=t;i++)
	solve();
	// cout << (solve() ? "YES" : "NO") << endl;
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

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

// vim: fdm=marker


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x)   (x.begin(),x.end()) 
#define sz(v)     ((int)(v.size()))
#define INF 1e9+7
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 

int32_t main(){
  fast; 
  
    string s; cin>>s; 
    string t , u ; cin>>t; 
    int a,b; 
    cin>>a>>b; 
    cin>>u; 

    if(u==s){
      cout<<a-1<<" "<<b; 
    }
    else{
      cout<<a<<" "<<b-1; 
    }


}

Measured memory_bytes: 256
import java.util.Scanner;
//
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		double a =sc.nextInt();
		double b =sc.nextInt();
		int ans =-1;
		
		for (double d=1;d<=10000;d++) {
			int ai =(int)(0.08*d);
			int bi =(int)(0.1*d);
			if (ai==a&&bi==b) {
				ans = (int)(d);
				break;
			}
		}
		System.out.println(ans);
		
		//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
		}
		//----------------------------------------
		//メソッド置き場
		
		//----------------------------------------
	}

Measured memory_bytes: 22996
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		System.out.printf("%d %d %.5f\n",(int)a/b,a%b,a/(double)b);
		scan.close();
	}
}

Measured memory_bytes: 17332
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <ctime>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    map<char, string> m;
    m[' '] = "101";
    m['\''] = "000000";
    m[','] = "000011";
    m['-'] = "10010001";
    m['.'] = "010001";
    m['?'] = "000001";
    m['A'] = "100101";
    m['B'] = "10011010";
    m['C'] = "0101";
    m['D'] = "0001";
    m['E'] = "110";
    m['F'] = "01001";
    m['G'] = "10011011";
    m['H'] = "010000";
    m['I'] = "0111";
    m['J'] = "10011000";
    m['K'] = "0110";
    m['L'] = "00100";
    m['M'] = "10011001";
    m['N'] = "10011110";
    m['O'] = "00101";
    m['P'] = "111";
    m['Q'] = "10011111";
    m['R'] = "1000";
    m['S'] = "00110";
    m['T'] = "00111";
    m['U'] = "10011100";
    m['V'] = "10011101";
    m['W'] = "000010";
    m['X'] = "10010010";
    m['Y'] = "10010011";
    m['Z'] = "10010000";

    string s;
    while(getline(cin,s)) {
        int l = s.length();
        string temp;
        rep(i,0,l) temp += m[(char)s[i]];
        int l2 = temp.length();
        rep(i,0,5 - (l2%5 == 0 ? 5 : l2%5)) temp += "0";

        l2 = temp.length();
        string ans;
        int ans_i;
        rep(i,0,l2 / 5) {
            ans_i = 0;
            string ans_s = temp.substr(i*5, 5);
            rep(j,0,5) {
                ans_i += ((int)((char)ans_s[j]) - 48) << (4-j);
            }
            if(ans_i <= 25) ans += (char)((char)ans_i + 'A');
            else {
                switch(ans_i){
                    case 26:
                        ans += " "; break;
                    case 27:
                        ans += "."; break;
                    case 28:
                        ans += ","; break;
                    case 29:
                        ans += "-"; break;
                    case 30:
                        ans += "\'"; break;
                    case 31:
                        ans += "?"; break;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1196