akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define INF 100000000000000000ll
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#include <string>
string char_to_str(char c){string tem(1,c);return tem;}
 
typedef pair<int, int> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output
int main() 
{
	fastio;
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	int k;
	cin>>k;
	int a[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	int ans[n];
	ans[0]=0;
	ans[1]=abs(a[1]-a[0]);
	for (int i = 2; i < n; ++i)
	{
		int q=k;
		int min1=INT_MAX;
		while(q--){
			if(i-q>0){
				min1 = min(min1, ans[i-q-1]+abs(a[i]-a[i-q-1]));
				// cout<<min1<<" "<<i<<" "<<q<<" "<<ans[i-q]<<" "<<abs(a[i]-a[i-q])<<endl;
			}
		}
		ans[i] = min1;
	}
	cout<<ans[n-1];

    return 0;
} 

Measured memory_bytes: 1024
use std::collections::VecDeque;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let t:i32 = read();
    let mut queue: VecDeque<(String, i32)> = VecDeque::new();
    let mut cnt = 0;
    let mut ans:Vec<(String, i32)> = Vec::with_capacity(n);
    for _ in 0..n {
        let name:String = read();
        let time:i32 = read();
        queue.push_back((name, time));
    }
    while !queue.is_empty() {
        if queue[0].1 > t {
            queue[0].1 -= t;
            let tmp = queue.pop_front().unwrap();
            queue.push_back(tmp.clone());
            cnt += t;
        } else {
            let diff = t - queue[0].1;
            cnt += t-diff;
            ans.push((queue.pop_front().unwrap().0, cnt));
        }
    }
    let ans = ans.into_iter().map(|(c, k)| format!("{} {}", c, k)).collect::<Vec<String>>();
    for i in ans {
        println!("{}", i);
    }
}


Measured memory_bytes: 11116
s=input()

ans=0
memory=0

for i in range(len(s)):
    if s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C":
        memory+=1
    else:
        ans=max(ans,memory)
        memory=0

ans=max(ans,memory)
        
print(ans)

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

def readInts():
  return [int(s) for s in input().split(" ")]

def solve(L, R):
  if R - L >= 2019:
    return 0
  if R % 2019 <= L % 2019:
    return 0

  ans = 2019
  for i in range(L, R):
    for j in range(i+1, R+1):
      ans = min(ans, ((i % 2019) * (j % 2019)) % 2019)
  return ans

def main():
  L, R = readInts()
  ans = solve(L, R)
  print(ans)

if __name__ == "__main__":
  main()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,i;
  scanf("%d",&n);
  int ans=0;
  for(int i=1;i<=n;i++)
  {
    int x;
    scanf("%d",&x);
    if(i%2==1 && x%2==1)
      ans++;
  }
  printf("%d\n",ans);
}

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

using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    double pi = acos(-1);
    int n;
    cin >> n;
    double ans = 2 * pi * n;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main()
{
  ll a;
  string b, bb;
  cin >> a >> b;
  b = b.erase(1, 1);
  a = a* stoi(b) / 100;
  cout << a;
}


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

int n, m;
int a[5050], b[5050];

int main()
{
  cin >> n >> m;
  for (int i = 0; i < n; i++){
    cin >> a[i];
  }
  for (int j = 0; j < m; j++){
    cin >> b[j];
  }

  int ma = 0;
  for (int i = 0; i < m; i++){
    int l = i, r = i;
    for (int j = 0; j < n; j++){
      if (b[r] == a[j]) r++;
    }
    ma = max(ma, r - l);
  }

  cout << ma << endl;
}

Measured memory_bytes: 3112
#include <iostream>

using namespace std;

int main(void) {
	int n; cin >> n;
	double sum = 0;
	for (int i = 0; i < n; i++) {
		double a; cin >> a;
		sum += (1.0 / a);
	}
	cout << 1.0 / sum << endl;

	return 0;
}

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

int main()
{
	int n,k;
	cin>>n>>k;
	int A[n];
	for(int i=0;i<n;i++)
	cin>>A[i];
	int ans[k+1]={0};
	ans[0]=0;
	for(int i=1;i<=k;i++)
	{
		if(i<A[0])
		ans[i]=0;
		for(int j=0;j<n;j++)
		{
			if(i>=A[j] && ans[i-A[j]]==0)
			{
				ans[i]=1;
				break;
			}
		}
	}
	//for(int i=0;i<=k;i++)
	//cout<<ans[i]<<"*"<<i<<" ";
	if(ans[k]==1)cout<<"First";
	else cout<<"Second";
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>

int main() {
  std::string s;
  std::cin >> s;
  if (s == "Sunny") puts("Cloudy");
  if (s == "Cloudy") puts("Rainy");
  if (s == "Rainy") puts("Sunny");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  double x1, y1, x2, y2, xq, yq;
  while (scanf("%lf,%lf,%lf,%lf,%lf,%lf", &x1, &y1, &x2, &y2, &xq, &yq) != EOF) {
    double x2d = x2 - x1;
    double y2d = y2 - y1;
    double xqd = xq - x1;
    double yqd = yq - y1;
    double alpha = (x2d * xqd + y2d * yqd) / (x2d * x2d + y2d * y2d);
    double xans = alpha * x2d - (xqd - alpha * x2d) + x1;
    double yans = alpha * y2d - (yqd - alpha * y2d) + y1;
    printf("%.6lf %.6lf\n", xans, yans);
  }
}


Measured memory_bytes: 3132
using System;
using System.Web;
using System.IO;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using static System.Math;
 

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        Console.WriteLine(Enumerable.Range(1, n - 1).Max(x => s.Substring(0, x).Intersect(s.Substring(x)).Count()));
    }
}


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

static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;

vector<pair <int,int> > adj[MAX];

void a();

int main(){
  int k,u,v,c;

  cin >> n;

  for(int i=0;i<n;i++){
    cin >> u >> k;
    for(int j=0;j<k;j++){
      cin >> v >> c;
      adj[u].push_back(make_pair(v,c));
    }
  }
  a();
  return 0;
}

void a(){
  priority_queue<pair <int,int> > PQ;
  int color[MAX],d[MAX];

  for(int i=0;i<n;i++){
    d[i]=INFTY;
    color[i]=WHITE;
  }
  d[0]=0;
  PQ.push(make_pair(0,0));
  color[0]=GRAY;

  while(!PQ.empty()){
    pair<int,int>
    f = PQ.top();
    PQ.pop();
    int u=f.second;
    color[u]=BLACK;

    if(d[u]<f.first * (-1))continue;

    for(int j=0;j<adj[u].size();j++){
      int v = adj[u][j].first;

      if(color[v]==BLACK)continue;
      if(d[v]>d[u]+adj[u][j].second){
        d[v]=d[u]+adj[u][j].second;
        PQ.push(make_pair(d[v]*(-1),v));
        color[v]=GRAY;
      }
    }
  }
  for(int i=0;i<n;i++){
    cout << i << " " << (d[i]==INFTY ? -1 : d[i]) << endl;
  }
}



Measured memory_bytes: 8088
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(string[] args){
    var vals = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
    var N=vals[0];
    var K=vals[1];
    var h= Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
   /*  var h=new List<int>();
    for(int i=0;i<N;i++){
        h.Add(int.Parse(Console.ReadLine()));
    }*/
    h.Sort((a, b) => b - a);
    int cnt=0;
    for(int i=0;i<N;i++){
        if(h[i]>=K){cnt++;}
        else{break;}
    }
    Console.WriteLine(cnt);
    }
}

Measured memory_bytes: 21984
import * as fs from "fs"

function Main(input: string) {
  const [a, b, c] = input.split(" ").map(num => parseInt(num, 10)).sort((a, b) => a - b)

  if (a + b === c) {
    console.log("Yes")
  }
  else {
    console.log("No")
  }
}


fs.readFile('/dev/stdin', (err, data) => {
  if(err){
    Main(fs.readFileSync('./input.txt', 'utf8'))
    return false
  }
  Main(data.toString())
  return false
})

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
static const int MAX_N = 50;

int main()
{
	int n;
	pair<int, int> xy[MAX_N];
	set<pair<int, int>> pqs;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> xy[i].first >> xy[i].second;
	}
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if (i == j)
			{
				continue;
			}
			else
			{
				int dx = xy[i].first - xy[j].first;
				int dy = xy[i].second - xy[j].second;
				pqs.insert(make_pair(dx, dy));
			}
		}
	}
	int count = 0;
	for (auto &pq : pqs)
	{
		int x = 0;
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				int dx = xy[i].first - xy[j].first;
				int dy = xy[i].second - xy[j].second;
				if (i != j && pq.first == dx && pq.second == dy)
				{
					++x;
				}
			}
		}
		count = max(count, x);
	}
	cout << n - count << endl;
}

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

string s, t;
int m = 1000, n;

int main()
{
	cin >> s >> t;
	
	int u = s.size(), v = t.size();

	for (int i = 0; i < u - v + 1; i++) {
		n = v;

		for (int j = i; j < i + v; j++)
			if (s[j] == t[j - i])
				n--;

		m = min(m, n);
	}

	cout << m << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>

using namespace std;

struct Tree {
	Tree() : left(NULL), right(NULL) { }
	Tree *left, *right;
};

Tree *build(const char **ptr){
	Tree *cur = NULL;
	if(**ptr == '('){
		cur = new Tree();
		++*ptr;
		cur->left = build(ptr);
		++*ptr;
		cur->right = build(ptr);
		++*ptr;
	}
	return cur;
}

void destroy(Tree *t){
	if(t == NULL){ return; }
	if(t->left != NULL){ destroy(t->left); }
	if(t->right != NULL){ destroy(t->right); }
	delete t;
}

Tree *intersect(const Tree *a, const Tree *b){
	Tree *cur = NULL;
	if(a != NULL && b != NULL){
		cur = new Tree();
		cur->left = intersect(a->left, b->left);
		cur->right = intersect(a->right, b->right);
	}
	return cur;
}

Tree *unite(const Tree *a, const Tree *b){
	Tree *cur = NULL;
	if(a != NULL || b != NULL){
		cur = new Tree();
		cur->left = unite(
			a != NULL ? a->left : NULL,
			b != NULL ? b->left : NULL);
		cur->right = unite(
			a != NULL ? a->right : NULL,
			b != NULL ? b->right : NULL);
	}
	return cur;
}

string to_str(const Tree *t){
	string result = "(";
	if(t->left != NULL){ result += to_str(t->left); }
	result += ",";
	if(t->right != NULL){ result += to_str(t->right); }
	result += ")";
	return result;
}

void dump(Tree *t, int d = 0){
	if(t->left != NULL){ dump(t->left, d + 1); }
	cout << string(d * 2, ' ') << "*" << endl;
	if(t->right != NULL){ dump(t->right, d + 1); }
}

int main(){
	string command, a, b;
	while(cin >> command >> a >> b){
		const char *sa = a.c_str();
		const char *sb = b.c_str();
		Tree *ta = build(&sa);
		Tree *tb = build(&sb);
		Tree *result = NULL; 
		if(command == "i"){
			result = intersect(ta, tb);
		}else if(command == "u"){
			result = unite(ta, tb);
		}
		cout << to_str(result) << endl;
		destroy(result);
		destroy(ta);
		destroy(tb);
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
list = list(map(int, input().split()))

ans=0

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):

            if list[i]+list[j]>list[k] and list[j]+list[k]>list[i] and list[k]+list[i]>list[j] and list[i]!=list[j] and list[i]!=list[k] and list[j]!=list[k]:
                ans+=1

print(ans) 

Measured memory_bytes: 9200
H, W = map(int, input().split())
C = [list(map(int, input().split())) for j in range(10)]
for i in range(10):
    for j in range(10):
        for k in range(10):
            C[j][k] = min(C[j][k], C[j][i] + C[i][k])

S = 0
for i in range(H):
    for x in list(map(int, input().split())):
        if x != -1:
            S += C[x][1]
print(S)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define REPEACH(i,k) for(auto& i:k)
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;

signed main() {
	int n;
	cin >> n;
	vector<int> a(n);
	int count=0;
	REP(i,n){
		cin >> a[i];
	}
	int nowand=0;
	int count1=0;
	REP(i,n){
		nowand+=a[i];
		if(nowand*((i%2)*2-1)>=0){
			count1+=abs(nowand)+1;
			nowand=-((i%2)*2-1);
		}
	}
	int count2=0;
	nowand=0;
	REP(i,n){
		nowand+=a[i];
		if(nowand*((i%2)*2-1)<=0){
			count2+=abs(nowand)+1;
			nowand=((i%2)*2-1);
		}
	}
	cout << min(count1,count2) << endl;
}

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

using namespace std;
using ll = long long;

#define REP2(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; ++i)
#define REP3(i, l, r) for (int i = (l), i##_len = (int)(r); i < i##_len; ++i)
#define GET_MACRO_REP(_1, _2, _3, NAME, ...) NAME
#define REP(...) GET_MACRO_REP(__VA_ARGS__, REP3, REP2) (__VA_ARGS__)
#define RREP2(i, n) for (int i = (n - 1); i >= 0; --i)
#define RREP3(i, l, r) for (int i = (r - 1), i##_len = (l); i >= i##_len; --i)
#define GET_MACRO_RREP(_1, _2, _3, NAME, ...) NAME
#define RREP(...) GET_MACRO_REP(__VA_ARGS__, RREP3, RREP2) (__VA_ARGS__)
#define IN(type, n) type n; cin >> n
#define INALL(type, v) REP(i, v.size()) { IN(type, _tmp); v.at(i) = _tmp; }
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#ifdef _DEBUG
#define DEBUG(x) cout << #x << ": " << x << endl
#else
#define DEBUG(x)
#endif

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

int count_digit(ll n) {
  int count = 0;
  while (n != 0) {
    n /= 10;
    count++;
  }

  return count;
}

int main() {
  IN(ll, N);
  int min = 20;
  REP(i, 1, sqrt(N + 1) + 1) {
    if (N % (ll)i == 0) {
      ll tmp_n = N / (ll)i;
      int f = count_digit((ll)i);
      chmax(f, count_digit(tmp_n));
      chmin(min, f);
    }
  }
  cout << min << endl;

  return 0;
}


Measured memory_bytes: 3652
using System;

namespace _128A
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] AP = Console.ReadLine().Split(' ');

            int A = int.Parse(AP[0]);
            int P = int.Parse(AP[1]);

            Console.WriteLine((A*3+P)/2);

        }
    }
}


Measured memory_bytes: 11092
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b
def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

def main():
    N = int(input())
    abc= [list(map(int, input().split())) for _ in range(N)]

    A = [0]
    B = [0]
    C = [0]

    for i in range(N):
        a = max(B[-1], C[-1]) + abc[i][0]
        b = max(C[-1], A[-1]) + abc[i][1]
        c = max(A[-1], B[-1]) + abc[i][2]
        A.append(a)
        B.append(b)
        C.append(c)

    print(max(A[-1], B[-1], C[-1]))

if __name__ == '__main__':
    main()


Measured memory_bytes: 111240
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+10,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
ll fac[N];
ll ksm(ll a,ll n){
	ll ans=1;
	while(n){
		if(n&1) ans=ans*a%mod;
		a=a*a%mod;
		n>>=1; 
	}
	return ans;
}
ll C(ll n,ll m){
	if(n<m||n<0||m<0) return 0;
	return fac[n]*ksm(fac[m]*fac[n-m]%mod,mod-2)%mod;
}
int main(){
	int h,w,a,b;
	scanf("%d%d%d%d",&h,&w,&a,&b);
	fac[0]=1;
	for(int i=1;i<=2e5+5;i++)
		fac[i]=i*fac[i-1]%mod;
	ll ans=0;
	for(int i=b;i<=w-1;i++){
		ans+=C(h-a+i-1,i)*C(a+w-i-2,w-i-1)%mod;
		ans%=mod;
	}
	printf("%lld\n",(ans%mod+mod)%mod);
	return 0;
}

Measured memory_bytes: 5396
#include <stdio.h>

int max(int a,int b){
  if(a > b){
    return a;
  }
  return b;
}

int main(void){
  int A,B,K;
  scanf("%d%d%d",&A,&B,&K);

  for(int i = max(A,B);i > 0;i--){
    if(A%i == 0 && B%i == 0) K--;
    if(K == 0){
      printf("%d\n",i);
      break;
    }
  }
  
   

  return 0;
}

Measured memory_bytes: 128
/**
 *      purpose : 
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) { os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}'; return os; }
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  /*
  int n = 5;
  vector<int> v(n);
  iota(v.begin(), v.end(), 1);
  debug(v);
  vector<int> cnt(n + 1, 0);
  do {
    vector<int> v2 = v;
    vector<int> v3 = v2;
    //debug(v2);
    while (v2.size() > 1) {
      vector<int> t;
      for (size_t i = 0; i < v2.size() - 2; ++i) {
        vector<int> t2;
        for (size_t j = i; j < i + 3; ++j) {
          t2.emplace_back(v2[j]);
        }
        sort(t2.begin(), t2.end());
        t.emplace_back(t2[1]);
      }
      v2 = t;
    }
    //debug(v2[0]);
    if (v2[0] == 2) {
      debug(v3);
    }
    ++cnt[v2[0]];
  } while (next_permutation(v.begin(), v.end()));
  debug(cnt);
  */

  
  int n, x; cin >> n >> x;
  n = 2 * n - 1;
  if (x == 1 || x == n) {
    cout << "No" << endl;
  } else {
    vector<int> ans(n);
    if (x == n / 2 + 1) {
      // 中央値にしたいときは、その前後のどちらかと隣り合わせて真ん中に置く
      queue<int> q;
      for (int i = 1; i <= n; ++i) {
        if (i != x && i != x + 1) {
          q.push(i);
        }
      }
      ans[n / 2] = x;
      ans[n / 2 + 1] = x + 1;
      for (int i = 0; i < n; ++i) {
        if (i == n / 2 || i == n / 2 + 1) continue;
        ans[i] = q.front(); q.pop();
      }
    } else if (x > n / 2 + 1) {
      // n に近いほうと隣り合わせて真ん中に置く
      queue<int> q;
      for (int i = 1; i <= n; ++i) {
        if (i != x && i != x + 1) {
          q.push(i);
        }
      }
      ans[n / 2] = x;
      ans[n / 2 + 1] = x + 1;
      for (int i = 0; i < n; ++i) {
        if (i == n / 2 || i == n / 2 + 1) continue;
        ans[i] = q.front(); q.pop();
      }
    } else {
      // 1 に近いほうと隣り合わせて置く
      queue<int> q;
      for (int i = 1; i <= n; ++i) {
        if (i != x && i != x - 1) {
          q.push(i);
        }
      }
      ans[n / 2] = x;
      ans[n / 2 + 1] = x - 1;
      for (int i = 0; i < n; ++i) {
        if (i == n / 2 || i == n / 2 + 1) continue;
        ans[i] = q.front(); q.pop();
      }
    }
    cout << "Yes" << '\n';
    for (int i = 0; i < n; ++i) {
      cout << ans[i] << '\n';
    }
  }

  return 0;
}

Measured memory_bytes: 2396
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
   int n;
   cin >> n;
   
   vector<int> re(n);
   for ( int i = 0; i < n; ++ i) {
       cin >> re.at(i);
   }
   reverse( re.begin(), re.end() );
   
   for ( int i = 0; i < n; ++i ) {
       cout << re.at(i);
      if ( i == n - 1 ){
          break;
      }
      cout << " ";
       
   }
   cout << endl;
    
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;

int main()
{
    int t;
    cin >> t;

    if (t >= 30)
    {
        std::cout << "Yes" << endl;
    }
    else
    {
        std::cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, n) for(int i = 0; i < n; i = i + 2)
#define repv(i, n, v) for(int i = 0; i < n; i = i + v)
#define rrep(i, n) for(int i = n; i >= 0; i--)
#define sortI(a, b, c) c == 0 ? sort(a, a + b) : sort(a, a + b, greater<int>())
#define sortS(s, a) a == 0 ? sort(s.begin(), s.end()) : sort(s.begin(), end(), greater<char>)
#define vi vector<int>
#define vf vector<float>
#define vc vector<char>
#define vs vector<string>
#define vb vector<bool>
#define ll long long
#define lint long int
#define llint long long int
#define atoz abcdefghijklmnopqrstuvwxyz
#define atoZ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
#define AtoZ ABCDEFGHIJKLMNOPQRSTUVWXYZ
#define mapSI map<string, int>
#define mapII map<int, int>
#define mapSS map<string, string>
#define pb push_back

int digit(int n){
  int res = 0;
  while(n > 0){
    res += n%10;
    n /= 10;
  }
 
  return res;
}

int main(void){

  //入力
  int N, K;
  cin >> N >> K;
  
  //配列
  vi A(N);			//受け取った値
  vi count(200001, 0);	//各数字のカウント
  vb check(200001, false);	//入力来たことあるかのチェック用
  vi item(N, 0);	//最大N種類の項目
  rep(i, N){
    cin >> A[i];
    count[ A[i] ]++;
    //入力されたのがなかったら項目に追加
    if(!check[ A[i] ]){
      check[ A[i] ] = true;
      item[i] = A[i];
    }
  }
  
  //項目名からカウント数に書き換える
  for(int i = 0; i < N; i++){
    item[i] = count[ item[i] ];
  }
  
  //大きい順にソート
  sort(item.begin(), item.end(), greater<int>());
  
  //大きいほうからK個足していく
  int sum = 0;
  rep(i, K) sum += item[i];
  
  //N-K個までの数で変わってもらう分を求める
  int ans = N - sum;
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long llong;
#define MAX 3000000
#define VALMAX 20000

// 計数ソート実行関数
void CountingSort(vector<int>& vecA, vector<int>& vecB, int k, int n)
{
    vector<int> vecC;
    vecC.reserve(VALMAX);

    for (int i = 0; i < k; i++)
    {
        vecC[i] = 0;
    }
    
    // vecC[i]にiの出現数を記録する
    for (int j = 0; j < n; j++)
    {
        vecC[vecA[j]] = vecC[vecA[j]] + 1;
    }

    // vecC[i]にi以下の数の出現数を記録する(累積和)
    // どこまで計算すればよいかは、
    // 入力された数値が何種類あるかによって異なるため
    // 想定された入力数より多くループさせる
    for (int i = 1; i < k; i++)
    {
        vecC[i] = vecC[i] + vecC[i-1];
    }

    // 出力配列にソートした結果を詰めていく
    // 入力配列の末尾から逆に辿っていくことで
    // 安定ソートになる
    for (int j = n-1; j >= 0; j--) {
        vecB[vecC[vecA[j]]] = vecA[j];
        vecC[vecA[j]] = vecC[vecA[j]] - 1;
    }
}

int main() {
    vector<int> vec_in, vec_out;
    vec_in.reserve(MAX);
    vec_out.reserve(MAX);

    int n = 0;
    int m = 0;
    char str[200];

    scanf("%d",&n);

    for (int i=0; i<n; i++)
    {
        scanf("%d",&m);
        vec_in[i] = m;
    }

    CountingSort(vec_in, vec_out, VALMAX, n);

    // 開始インデックスを1始まりとしているのは
    // カウンタ配列vecC[x]には入力配列にx以下の要素がいくつ
    // 記録されているかを示しているので
    // idx = 0は飛ばす(出現回数=0なので存在しない)
    for (int i = 1; i <= n; i++)
    {
        if (i == n)
        {
            printf("%d\n", vec_out[i]);
        }
        else
        {
            printf("%d ", vec_out[i]);
        }
    }
}


Measured memory_bytes: 18596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define all(x) x.begin(), x.end()
using ll = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> l(m), r(m);
    vector<ll> c(m);
    rep(i,0,m) {
        cin >> l[i] >> r[i] >> c[i];
        --l[i];
    }
    int nn = 1;
    while(n>nn) nn *= 2;
    int nodes = 4*nn+m;
    vector<vector<pair<int,ll>>> g(nodes);
    rep(i,1,nn) {
        g[2*i+1].emplace_back(2*(2*i)+1,0);
        g[2*i+1].emplace_back(2*(2*i+1)+1,0);
        g[2*(2*i)].emplace_back(2*i,0);
        g[2*(2*i+1)].emplace_back(2*i,0);
    }
    rep(i,0,n) g[2*(nn+i)+1].emplace_back(2*(nn+i),0);
    rep(j,0,m) {
        int u = 4*nn+j;
        function<void(int,int,int,int,int)> construct =
            [&](int i, int nodel, int noder, int left, int right) {
            if(left>=right || left>=noder || right<=nodel) return;
            if(left<=nodel && right>=noder) {
                g[2*i].emplace_back(u,c[j]);
                g[u].emplace_back(2*i+1,0);
                return;
            }
            int nodem = (nodel+noder)/2;
            construct(2*i, nodel, nodem, left, min(nodem, right));
            construct(2*i+1, nodem, noder, max(nodem,left), right);
        };
        construct(1,0,nn,l[j],r[j]);
    }
    const ll INFTY=LLONG_MAX;
    vector<ll> dist(nodes,INFTY);
    using T = pair<ll,int>;
    priority_queue<T,vector<T>,greater<T>> pq;
    pq.emplace(0,2*nn);
    while(!pq.empty()) {
        ll d;
        int u;
        tie(d,u) = pq.top();
        pq.pop();
        if(d<dist[u]) {
             dist[u] = d;
             for(const auto &e:g[u]) {
                 pq.emplace(d+e.second, e.first);
             }
        }
    }
    ll ans = dist[2*(nn+n-1)];
    if(ans==INFTY) ans = -1;
    cout<<ans<<endl;
}


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

int main(){
    int w,h,n;
    cin >> w >> h >> n;
    int wleft=0,wright=w,hlow=0,hhigh=h;
    for(int i=0;i<n;i++){
        int x,y,a;
        cin >> x >> y >> a;
        if(a==1){wleft=max(wleft,x);}
        else if(a==2){wright=min(wright,x);}
        else if(a==3){hlow=max(hlow,y);}
        else if(a==4){hhigh=min(hhigh,y);}
    }
    cout << max(0,(wright-wleft))*max(0,(hhigh-hlow)) << endl;
    return 0;
}

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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)

int main(void){
  int n,a;
  cin>>n>>a;
  if(n%500<=a)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


return 0;}


Measured memory_bytes: 256
sum=0
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
    B=input().split()
    k=2*i
    x[k]=(B[0])
    x[k+1]=(int)(B[1])
while len(x)>0:
    s=x[1]-t
    if s>0: 
        sum+=t
        x.append(x[0])
        x.append(s)
        del x[0]
        del x[0]
    if s<=0:
        sum+=x[1]
        print( x[0],sum)
        del x[0]
        del x[0]



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

int main(){
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    for (int i = 0; i < N; i++){
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    int ans = 0;
    for (int i = 0; i < K; i++){
        ans += p[i];
    }
    cout << ans << endl;
}




Measured memory_bytes: 3628
import Control.Applicative
import Data.List

main = do 
	xs <- map words . takeWhile (not . isInfixOf "?") . lines <$> getContents
	mapM (putStrLn . show . calclator) xs


calclator :: [String] -> Integer
calclator (a:op:b:_) = case op of
	"+"	-> n + m
	"-" -> n - m
	"*" -> n * m
	"/" -> n `div` m
	where
		n = read a :: Integer
		m = read b :: Integer



Measured memory_bytes: 4196
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	int n, i;
	scanf("%d", &n);
	char s[n];
	scanf("%s", s);
	
	int cnt=1;
	for(i=1; i<n; i++){
		if(s[i-1]!=s[i]){
			cnt++;
		}
		else{continue; }
	}
	
	printf("%d", cnt);
	
return 0;
}

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

using namespace std;

int f(int k, int digits, vector<int> ds) {
    int pow_10 = pow(10, digits-1);
    int main_digit = k / pow_10;
    int total = 0;
    for (int d : ds) {
        if (d < main_digit) {
            total += pow((int) ds.size(), digits-1);
        } else if (d == main_digit) {
            if (digits == 1) {
                ++total;
            } else {
                total += f(k - main_digit * pow_10, digits-1, ds);
            }
        }
    }
    return total;
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int digits = 1;
    while (pow(10, digits) <= n) {
        ++digits;
    }
    int a = f(n, digits, vector<int>{3, 5, 7});
    int b = f(n, digits, vector<int>{3, 5}) + f(n, digits, vector<int>{3, 7}) + f(n, digits, vector<int>{5, 7});
    int c = f(n, digits, vector<int>{3}) + f(n, digits, vector<int>{5}) + f(n, digits, vector<int>{7});
    int total = a - b + c; // ones with the same number of digits
    for (int i = 1; i < digits; ++i) {
        total += pow(3, i) - 3 * pow(2, i) + 3;
    }
    cout << total << endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int cnt = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if ((i+1) % 2 == 1 and a % 2 == 1) cnt++;
    }
    cout << cnt << endl;
}

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

int A[3][3];
bool ok[3][3];

int main(){
  for (int i=0;i<3;++i){
    for (int j=0;j<3;++j){
      cin >> A[i][j];
    }
  }
  int n;
  cin >> n;
  for (int i=0;i<n;++i){
    int b;
    cin >> b;
    for (int j=0;j<3;++j){
      for (int k=0;k<3;++k){
        if(A[j][k] == b) ok[j][k] = true;
      }
    }
  }
  //ここまででマルバツの配列に変換できた
  
  bool bingo = false;
  for (int i=0;i<3;++i){
    int cnt = 0;
    for (int j=0;j<3;++j) if(ok[i][j]) cnt++;
    if (cnt == 3) bingo = true;
  }
  for (int j=0;j<3;++j){
    int cnt = 0;
    for (int i=0;i<3;++i) if(ok[i][j]) cnt++;
    if (cnt == 3) bingo = true;
  }
  //ここまでで縦横
  int cnt = 0;
  for (int i=0;i<3;++i){
    if (ok[i][i]||ok[i][2-i]) cnt++;
    if (cnt == 3) bingo = true;
  }
  //ここまでで縦横斜め

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


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
cs = input()
r_num = 0
w_num = 0
# RRR|WWWW にする
r_num = cs.count('R')
w_num = cs.count('W')

if r_num == 0 or w_num == 0:
    print(0)
else:
    ans = []
    W = 0
    rl_num = 0
    for c in cs:
        if c == 'R':
            rl_num += 1
        elif c == 'W':
            W += 1
        R = r_num - rl_num
        ans.append(max(W, R))

    print(min(ans))


Measured memory_bytes: 17344
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
int n;
mpii mp;
vi v;
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	rep(i,n){
		int a;
		cin>>a;
		if(!mp[a])
		v.pb(a);
		mp[a]++;
	}
	int ans=0;
	rep(i,sz(v)){
		if(mp[v[i]]<v[i])
		ans+=mp[v[i]];
		else
		ans+=mp[v[i]]-v[i];
	}
	cout<<ans;
	re 0;
}


Measured memory_bytes: 5112
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int A;
  int B;
  cin >>A>>B;
  if (B !=1) {
  int a=A-1;
  repl(i,1,inf) {
    int y=a*i+1;
    if (y<B) {
      continue;
    }
  if(y>=B) {
    cout << i<< endl;
    break;
  }
  }
  }
  else {
    cout << 0 << endl;
  }



}
  
  

Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    int n, m, i, maru, pena, p, j;
    int seikai[100000] = {};
    int batu[100000] = {};
    char s[3];
    scanf("%d %d", &n, &m);
    maru=0; pena=0;
    for (i=0; i<m; i++) {
        scanf("%d %s", &p, s);
        if (s[0] == 'A') {
            if (seikai[p] == 0) {
                maru++;
                seikai[p] = 1;
                pena += batu[p];
            }
        } else {
            if (seikai[p] == 0) {
                batu[p]++;
            }
        }
    }

    printf("%d %d", maru, pena);
    return 0;
}

Measured memory_bytes: 896
import java.util.*;

public class Main {

    static int k;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int n = sc.nextInt();

        if(h<w){
            if(n%w==0){
                k=n/w;
                System.out.println(k);
            }else {
                k = n / w + 1;
                System.out.println(k);
            }
        }else{
            if(n%h==0){
                k=n/h;
                System.out.println(k);
            }else {
                k = n / h + 1;
                System.out.println(k);
            }
        }

    }
}


Measured memory_bytes: 21844
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		String s = sc.next();

		long r = 0;
		long g = 0;
		long b = 0;

		for ( int i=0; i<n; i++ ) {
			if ( s.charAt(i)=='R' ) {
				r++;
			} else if ( s.charAt(i)=='G' ) {
				g++;
			} else {
				b++;
			}
		}

		if ( r*g*b==0 ) {
			System.out.println(0);
			System.exit(0);
		}

		long f = 0;
		for ( int i=0; i<n-2; i++ ) {
			for ( int j=i+1; j<n; j++ ) {
				int k = 2*j-i;
				if ( k < n ) {
					if ( s.charAt(i)!=s.charAt(j) && s.charAt(j)!=s.charAt(k) && s.charAt(k)!=s.charAt(i) ) {
						f++;
					}
				}
			}
		}

		System.out.println(r*g*b-f);
	}

}


Measured memory_bytes: 37304
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    ll x[N];
    for(int i = 0; i < N; i++) cin >> x[i];

    ll ans = inf;

    for(int i = 0; i < N - K + 1; i++) {
        ll tmp;
        if(x[i] >= 0)
            tmp = x[i + K - 1];
        else if(x[i + K - 1] <= 0) {
            tmp = -1 * x[i];
        } else {
            tmp = abs(x[i]) + abs(x[i + K - 1]);
            if(x[i] * x[i + K - 1] < 0) tmp += min(abs(x[i]), abs(x[i + K - 1]));
        }
        ans = min(ans, tmp);
    }

    cout << ans << "\n";
    return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n,k;cin>>n>>k;
  vector<int>p(n);
  rep(i, n)cin>>p[i];
  sort(p.begin(), p.end());
  int sum = 0;
  rep(i, k)sum+=p[i];
  cout<<sum;

  return 0;
}

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

int main(){
    int r,g,b;
    int k;
    cin >> r >> g >> b;
    cin >> k;
    int good = 0;

    for(int i = 0 ; i < k ; i++){
        if(r >= b){
            b *= 2;
        }else if(r >= g){
            g *= 2;
        }else if(g >= b){
            b *= 2;
        }

        if(r < g && g < b){
            good = 1;
            break; 
        }
    }
    //cout << r << g << b << endl;

    if(good == 1){
        cout << "Yes" << endl; 
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;





public class Main {

	int Rows,Columns;
	Point start,goal;
	String[][] board;
	Boolean[][] checked;
	int[][] distancefromstart;
	static final String kabe="#";
	int masukazu;

	int countKabe;

	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		
		scanInputData();
		
		initializeChecked();
		initializeDistance();

		masukazu=Rows*Columns;



		int keiro=bfs();
      
      	if(keiro!=-1){

          int result=masukazu-keiro-countKabe-1;
          
          System.out.println(result);
        }else{
          System.out.println("-1");
        }
	}



	void scanInputData()  {
//
		//String pathname="C:\\pleiades\\eclipse\\text\\atcoder.txt";

		//File file=new File(pathname);

		//Scanner scanner=new Scanner(file) ;

		Scanner scanner=new Scanner(System.in);

		Rows=scanner.nextInt();
		Columns=scanner.nextInt();


		start=new Point(0,0);

		int goaly=Rows-1;
		int goalx=Columns-1;

		goal=new Point(goaly,goalx);

		String buf="";

		board=new String[Rows][Columns];

		countKabe=0;

		for(int i=0;i<Rows;i++) {
			buf=scanner.next();

			for(int j=0;j<Columns;j++) {
				board[i][j]=buf.substring(j, j+1);

				if(board[i][j].equals(kabe)) {
						countKabe++;
				}
			}

		}


		scanner.close();
	}

	void initializeChecked() {
		checked=new Boolean[Rows][Columns];

		for(Boolean[] a:checked) {
			Arrays.fill(a,false);
		}


	}

	void initializeDistance() {
		distancefromstart=new int[Rows][Columns];

		for(int[] a:distancefromstart) {
			Arrays.fill(a,0);
		}
	}

	boolean isInvalidPoint(int nextY,int nextX) {

		boolean isOutOfBoard=nextY<0 || nextY>Rows-1 || nextX<0 || nextX>Columns-1;

		boolean isInWall=false;
		boolean hasReachedYet=false;

		if(!isOutOfBoard) {
			 isInWall=board[nextY][nextX].equals(kabe);
			 hasReachedYet=checked[nextY][nextX];
		}


		return isOutOfBoard || isInWall || hasReachedYet;

	}

	int bfs() {
		Queue<Point> nowq=new LinkedList<Point>();

		nowq.add(start);

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

		while(!nowq.isEmpty()) {

			Point tyakumokuPoint=nowq.poll();

			for(int j=0;j<4;j++) {

				//起点を中心に4方向に動いていく。
				int nextY=tyakumokuPoint.y+dy[j];
				int nextX=tyakumokuPoint.x+dx[j];

				//例外値だけ先に省いてしまう。動いた先が無効なら次へとばす。
				if(isInvalidPoint(nextY,nextX)) {
					continue;
				}

				//到達しましたよ。
				checked[nextY][nextX]=true;


				//距離の更新
				distancefromstart[nextY][nextX]=distancefromstart[tyakumokuPoint.y][tyakumokuPoint.x]+1;

				//進んだ先がゴールだったらmainに手数を返して探索終了
				if(nextY==goal.y && nextX==goal.x) {
					return distancefromstart[nextY][nextX];
				}

				nowq.add(new Point(nextY,nextX));
			}

		}

		return -1;

	}



}




class Point{

	int y;
	int x;

	Point(int y,int x){
		this.x=x;
		this.y=y;
	}

}


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



int main()
{
	int A, B,size,num;
	num = 0;
	string S;
	cin >>A>>B>>S;
	size = S.length();
    for (int i = 0; i < size; i++){
			if ((i == A)&&(S[i] =='-'))num++;
			else if ((0 <= S[i]-'0' && S[i]-'0' <= 9)&&!(i==A))num++;
		}
	
	
	if (num == size) cout << "Yes" << endl;
	else cout << "No" << endl;
	
}

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


using namespace std;

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	string s;
	cin >> s;


	int ca = 0;
	int cb = 0;

	for (int i = 0; i < N; i++) {
		if (ca + cb >= A + B) {
			cout << "No" << endl;
		} else {
			if (s[i] == 'a') {
				cout << "Yes" << endl;
				ca++;
			} else if (s[i] == 'b') {
				if (cb < B) {
					cout << "Yes" << endl;
					cb++;
				} else {
					cout << "No" << endl;
				}
			} else {
				cout << "No" << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 896
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;//例: VVI dp(10, vector<int>(10, INF);
typedef priority_queue<int, vector<int>, less<int> > QUE_int;
const int INF = 2 * pow(10, 9) + 1;//+1しないとREになるかも(out of rangeになるんかな?? )

vector<int> dx = { -1, 0, 1, 0, -1, -1, 1, 1 };
vector<int> dy = { 0, -1, 0, 1, -1, 1, -1, 1 };

ll max(ll a, ll b) { return (a > b) ? a : b; }
ll min(ll a, ll b) { return (a < b) ? a : b; }


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

	ll ans = 0;
	while (true) {
		ans++;
		if (N < pow(K, ans)) {
			break;
		}

	}

	cout << ans << endl;
}


Measured memory_bytes: 384
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str):
    mae = int(S[0:2])
    ushiro = int(S[2:])
    if 1 <= mae <= 12 and 1 <= ushiro <= 12:
        print("AMBIGUOUS")
    elif 1 <= mae <= 12:
        print("MMYY")
    elif 1 <= ushiro <= 12:
        print("YYMM")
    else:
        print("NA")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: str
    solve(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
     int i, ch;
     int cnt[26] = {0};

     while(scanf("%c", &ch) != EOF){
         if(ch >= 'a' && ch <= 'z')
             cnt[ch - 'a']++;
         if(ch >= 'A' && ch <= 'Z')
             cnt[ch - 'A']++;
     }
     for(i = 0; i <= 25; i++){
         printf("%c : %d\n", 'a' + i, cnt[i]);
     }
     return 0;
}



Measured memory_bytes: 2040
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
string str;
string ss="keyence";
string tt="ecneyek";
int main()
{
    cin>>str;
    string rts=str;
    reverse(rts.begin(),rts.end());
    for(int i=0;i<=7;i++)
    {
        if(str.substr(0,i)==ss.substr(0,i)&&rts.substr(0,7-i)==tt.substr(0,7-i))
        {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
    return 0;
}



Measured memory_bytes: 256
### constant

DXYS = [[1, 0], [0, -1], [-1, 0], [0, 1]]
MAX_K = 5
MAX_C = 6

### subroutines

def count_area(flds)
  return 0 if flds[0] != $c

  used = $hw.times.map{false}

  ar = 1
  used[0] = true
  q = [[0, 0]]

  while ! q.empty?
    x0, y0 = q.shift
    DXYS.each do |dx, dy|
      x1 = x0 + dx
      y1 = y0 + dy
      if x1 >= 0 && x1 < $w && y1 >= 0 && y1 < $h
        id = y1 * $w + x1
        if flds[id] == $c && ! used[id]
          ar += 1
          used[id] = true
          q << [x1, y1]
        end
      end
    end
  end

  ar
end

def paint(c, flds)
  c0 = flds[0]
  return if c0 == c

  flds[0] = c
  q = [[0, 0]]

  while ! q.empty?
    x0, y0 = q.shift
    DXYS.each do |dx, dy|
      x1 = x0 + dx
      y1 = y0 + dy
      if x1 >= 0 && x1 < $w && y1 >= 0 && y1 < $h
        id = y1 * $w + x1
        if flds[id] == c0
          flds[id] = c
          q << [x1, y1]
        end
      end
    end
  end
end

def count_rec(k, flds)
  c0 = flds[0]

  if k == 1
    return if c0 == $c

    paint($c, flds)
    ar = count_area(flds)
    $max_ar = ar if $max_ar < ar
    return
  end

  for c1 in (1..MAX_C)
    next if c0 == c1

    flds0 = flds.clone
    paint(c1, flds0)
    count_rec(k - 1, flds0)
  end
end

### main

loop do
  $h, $w, $c = gets.split.map(&:to_i)
  break if ($h | $w | $c) == 0

  $hw = $h * $w

  flds = []
  $h.times.each{flds += gets.split.map(&:to_i)}
  #p $flds

  $max_ar = 0
  count_rec(MAX_K, flds)

  p $max_ar
end

Measured memory_bytes: 6648
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  n = int(read())
  print(((n+1)//2)/n)
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5076
require 'bigdecimal'

x = gets
y = x.split(" ")
a = y[0].to_f
b = y[1].to_f

tubo = 3.305785

mennseki = a * b

ans = BigDecimal(mennseki.to_s) / BigDecimal(tubo.to_s)
ansnum = ans.to_f

puts ansnum


Measured memory_bytes: 6996
def q2():
    t_hp, t_atk, a_hp, a_atk = [int(i) for i in input().split(" ")]

    while True:
        a_hp -= t_atk
        if a_hp <= 0:
            print('Yes')
            return
        
        t_hp -= a_atk
        if t_hp <= 0:
            print('No')
            return
        

q2()


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

int main(){
    int k,n;
    cin>>k>>n;
    ll ans=0;
    vector<int> v;
    rep(i,n){
        int tmp;cin>>tmp;
        v.push_back(tmp);
    }
    v.push_back(k+v[0]);
    int mx = 0;
    rep(i,n){
        mx = max(mx,v[i+1]-v[i]);
    }
    cout<<k-mx<<endl;
}

Measured memory_bytes: 1528