akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int n,x,ans;
		while(true){
			n=scan.nextInt();
			x=scan.nextInt();
			ans=0;
			if(n==0&&x==0) break;
			for(int i=1;i<=n;i++){
				for(int j=i+1;j<=n;j++){
					for(int k=j+1;k<=n;k++){
						if(i+j+k==x){
							ans++;
							break;
						}
						if(x<i+j+k){
							break;
						}
					}
					if(x<=i+j){
						break;
					}
				}
				if(x<=i){
					break;
				}
			}
			System.out.println(ans);
		}
		scan.close();
	}
}

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

int main(void){
  int n,m;
  while(cin>>n>>m,n+m){
    vector<vector<int> > ary(n,vector<int>(m));
    for(int i = 0 ; i < n ; i ++){
      int cnt = 0;
      char c;
      for(int j = 0 ; j < m ; j ++){
	cin>>c;
	if(c=='.'){
	  cnt ++;
	}else{
	  cnt = 0;
	}
	ary[i][j] = cnt;
      }
    }
    
    int ret = 0;
    for(int i = 0 ; i < n ; i ++){
      for(int j = 0 ; j < m ; j ++){
	int cal = 1e9;
	for(int k = i ; k < n ; k ++){
	  cal = min(cal, ary[k][j]);
	  if(!cal)break;
	  ret = max(ret,cal*(k-i+1));
	}
      }
    }
    cout<<ret<<endl;
  }
  
}

Measured memory_bytes: 2128
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    std::string S;
    std::cin >> S;

    const int N = S.size();

    std::map<char, int> dist;
    std::map<char, int> lastpos;

    for (int i = 0; i < N; ++i) {
        char c = S[i];
        if (lastpos.count(c) == 0) {
            dist[c] = i;
            lastpos[c] = i;
        }
        else {
            dist[c] = std::max(dist[c], i - lastpos[c] -1);
            lastpos[c] = i;
        }
    }

    for (auto& d : dist) {
        auto c = d.first;
        d.second = std::max(d.second, N - lastpos[c] -1);
    }

    int mindist = N;
    for (auto d : dist) {
        mindist = std::min(mindist, d.second);
    }

    std::cout << mindist << std::endl;

    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.Queue

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    val x, y = sc.nextInt
    val z = gcd(x, y)
    val x_ = x / z
    val y_ = y / z
    val ans = (x_ - 1 + y_ - 1 + 1) * z + 1
    println(ans)
  }

  def gcd(i: Int, j: Int): Int = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}




Measured memory_bytes: 45124
N = int(input())
s = [''.join(sorted(input())) for _ in range(N)]
dic = {}
count=0
for i in range(N):
    if s[i] in dic:
        dic[s[i]] = dic[s[i]] + 1
    else:
        dic.setdefault(s[i], 1)
for i in dic.values():
    if i > 1:
        count += i* (i - 1) // 2
print(count)

Measured memory_bytes: 19400
eq=list(map(str,input().split()))
n=len(eq)
ans=[]
for a in range(0,n):
    if eq[a]!="+" and eq[a]!="-" and eq[a]!="*":
        ans.append(int(eq[a]))
    elif eq[a]=="+":
        ans[-2]+=ans[-1]
        ans.pop()
    elif eq[a]=="-":
        ans[-2]=ans[-2]-ans[-1]
        ans.pop()
    elif eq[a]=="*":
        ans[-2]*=ans[-1]
        ans.pop()
print(ans[0])


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
int main()
{
	int i,n,m;ll t;
	scanf("%d %d %lld",&n,&m,&t);
	ll a[n],b[m];
	for(i=0;i<n;i++)	scanf("%lld",&a[i]);
	for(i=0;i<m;i++)	scanf("%lld",&b[i]);
	vector<ll> p_a(n,0ll),p_b(m,0ll);
	for(i=0;i<n;i++)
	{
		if(i==0)	p_a[i]=a[i];
		else		p_a[i]=p_a[i-1]+a[i];
	}
	for(i=0;i<m;i++)
	{
		if(i==0)	p_b[i]=b[i];
		else		p_b[i]=p_b[i-1]+b[i];
	}
	int ans=0;
	ans = upper_bound(p_b.begin(),p_b.end(),t) - p_b.begin();
	for(i=0;i<n;i++)
	{
		ll c = t - p_a[i];
		if(c<0)	continue;
		int p = upper_bound(p_b.begin(),p_b.end(),c)-p_b.begin();
	//	printf("%d\n",p);
		ans = max(ans ,i+p+1);
	}
	cout<<ans;
}


Measured memory_bytes: 9596
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define digit(a) to_string(a).size()
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))
using namespace std;
int main(void)

{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    if (x == 3 || x == 5 || x == 7)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 3604
# -*- coding: utf-8 -*-
N = int(input())

x_y_hs = [list(map(int, input().split(' ')))
          for _ in range(N)]

cx_candidates = range(101)
cy_candidates = range(101)

candidates = []
for cx in cx_candidates:
    for cy in cy_candidates:
        chs = set()
        for x, y, h in x_y_hs:
            if h == 0:
                continue
            else:
                ch = h + abs(x - cx) + abs(y - cy)
                chs.add(ch)

        if len(chs) == 1:
            ch = list(chs)[0]
            candidates.append([cx, cy, ch])

# print(candidates)
for cx, cy, ch in candidates:
    solved = True
    for x, y, h in x_y_hs:
        if h != max(ch - abs(x - cx) - abs(y - cy), 0):
            solved = False
            break
    if solved:
        print(cx, cy, ch)
        exit()




Measured memory_bytes: 42860
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0589?year=2006>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    int n; cin >> n;
    map<string,ll> mp;
    for(int i = 0; i < n;i++){
        string s; ll v; cin >> s >> v;
        mp[s]+=v;
    }
    
    vector<pair<string,ll>> ans(mp.begin(),mp.end());
    sort(ans.begin(),ans.end(),[](const pair<string,ll>& l,const pair<string,ll>& r){
        if(l.first.length() == r.first.length()) return l.first < r.first;
        else return l.first.length() < r.first.length();
    });
    
    for(auto p:ans){
        cout << p.first << " " << p.second << endl;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    solve(0);
    // cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}



Measured memory_bytes: 3208
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
				var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];

			if (N %2 ==1) {
				var ans = 0;
				Console.WriteLine(ans);
				return;
			}


			long tenCount = 0;
			N = N / 10;
			tenCount += N;
			while (true) {
				 N = N / 5;
				tenCount += N;

				if (N==0) {
					break;
				}

			}

			//答えの出力
			Console.WriteLine(tenCount);
		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

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

  if(sum%10 != 0){
    cout << sum << endl;
    return 0;
  }
  
  rep(i,n){
    if(sum%10 == 0){
      sum -= sc[i];
    }
    if(sum%10 != 0){
      cout << sum << endl;
      return 0;
    }
    sum += sc[i];
  }

  if(sum%10 == 0){
    sum = 0;
    cout << sum << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3628
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
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; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,c; cin >> a >> b>> c;
    int ans = 0;
    ans = max(0,c-(a-b));
    ct(ans);
}



Measured memory_bytes: 256
# encoding:utf-8
import copy
import numpy as np
import random

n,m = map(int,input().split())

shops = []
for i in range(n):
    a,b = map(int,input().split())
    shops.append([a,b])


# i　何軒めの店まで見ているか，何本買うか
# dp[i][j]

# dp = [[10**10 for i in range(m)] for j in range(n)]

shops.sort()
ans = 0
count = m
# print(shops)
i = 0
while True:
    # print(count,ans)
    yen,num = shops[i]
    if count-num > 0:
        count -= num
        ans += yen*num
        # print(ans)
        i += 1
    else:
        ans += yen*count
        # print(ans)
        count -= count
        break


print(ans)


Measured memory_bytes: 29796
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, BinaryHeap, VecDeque, BTreeSet, BTreeMap};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn check(i: usize, k: usize, aa: &[usize]) -> bool {
    let mut dp = vec![false; k];
    dp[0] = true;

    for j in 0..aa.len() {
        if j == i {
            continue;
        }

        for w in (aa[j]..k).rev() {
            dp[w] |= dp[w - aa[j]];
            if dp[w] && w + aa[i] >= k {
                return true;
            }
        }
    }
    false

}


fn main() {
    let (n, k) = get!(usize, u64);
    let mut aa: Vec<usize> = util::gets::<u64>()
        .into_iter()
        .filter(|&a| a < k)
        .map(|a| a as usize)
        .collect();
    aa.sort();


    let k = k as usize;
    let mut l = 0;
    let mut r = aa.len();

    while l != r {
        let mid = (l + r) / 2;
        if check(mid, k, &aa) {
            r = mid;
        } else {
            l = mid + 1;
        }
    }

    println!("{}", l);

}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>
 
const long long INF = 1e6+7;
const long long MOD = 1e9+7;
 
using namespace std;
 
int main(){
	
	string s;
	cin >> s;
	int cnt=0;
	int ans=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='R'){
			cnt++;
		}else{
			ans=max(ans,cnt);
			cnt=0;
		}
	}
	ans=max(ans,cnt);
	cout << ans << endl;		
	return 0;
}

Measured memory_bytes: 3560
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    long long int n,k;
    cin >> n >> k;
    vector<long long int> v1,v2;
    for(int i = 0;i < n;i++)
    {
        long long int a;
        cin >> a;
        v1.push_back(a);
    }
    v2 = v1;
    sort(v2.begin(),v2.end());
    long long int sum = 0;
    for(int i = 0;i < n;i++)
    {
        sum += lower_bound(v2.begin(),v2.end(),v1[i]) - v2.begin();
        sum = sum % MOD;
    }
    long long int inv = 0;
    for(int i = 0;i < v1.size();i++)
    {
        for(int j = i + 1;j < v1.size();j++)
        {
            if(v1[i] > v1[j])
            {
                inv++;
            }
        }
    }
    cout << ((inv * k) % MOD + (sum * ((k * (k - 1) / 2) % MOD)) % MOD) % MOD << "\n";

    return 0;
}

Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
s = []
cnt = 0
for i in range(n):
    s.append(list(map(int,input().split())))
for i in range(n):
    result = 0
    for j in range(m):
        result += s[i][j]*b[j]
    result += c
    if result > 0:
        cnt += 1
print(cnt)

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

typedef long long ll;

ll  xorworld(ll x) {
	if (x < 0) return 0;
	switch (x%4) {
		case 0: return x;
		case 1: return 1;
		case 2: return x | 1;
		case 3: return 0;
	}
}
int main() {
	ll a, b;

	cin >> a >> b;
	cout << (xorworld(b) ^ xorworld(a-1)) << endl;
	return 0;
}



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


int main()
{

    int a,b,c,x,i,j,k,s=0;
	cin>>a>>b>>c;
	cin>>x;
	for(i=0;i<=a;i++)
	 for(j=0;j<=b;j++)
	   for(k=0;k<=c;k++)
	   if(i*500+j*100+k*50==x)  s++;
	cout<<s<<endl;
  return 0;
} 

Measured memory_bytes: 256
N = int(input())
if(N%10==2 or N%10==4 or N%10==5 or N%10==7 or N%10==9):
	print("hon")
elif(N%10==0 or N%10==1 or N%10==6 or N%10==8):
	print("pon")
elif(N%10==3):
	print("bon")

Measured memory_bytes: 9192
#include<iostream>

using namespace std;

int main(){

  int S;

  cin >> S;

  int a = S/100;
  int b = S%100;

  if(1 <= a && a <= 12){
    if(1 <= b && b <= 12){
       cout << "AMBIGUOUS" << endl;
    }else{
       cout << "MMYY" << endl;
    }
  }else{
    if(1 <= b && b <= 12){
       cout << "YYMM" << endl;
    }else{
       cout << "NA" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <ctype.h>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define ENDL '\n'
#define FOR(i, n) for (int i = 0; i < n; i++)
#define FOR_EACH(i, v) for (auto&& i : v)

int N;
int M;
int ans = 0;
bool* used;

/* 無向辺クラス。自己ループあり。二重辺、重みなし。*/
class MySide {
public:
	bool* mSide;
	int mNConst;

	MySide(int n, bool initial)
	{
		int t = n * (n + 1) / 2;
		mSide = new bool[t];
		for (int i = 0; i < t; i++) {
			mSide[i] = initial;
		}
		mNConst = 2 * n - 1;
	}

	~MySide()
	{
		delete[] mSide;
	}

	int coordToI(int x, int y)
	{
		return (x * (mNConst - x) + 2 * y) / 2;
	}

	void set(int x, int y, bool value)
	{
		if (y < x) {
			swap(x, y);
		}
		mSide[coordToI(x, y)] = value;
	}

	bool get(int x, int y)
	{
		if (y < x) {
			swap(x, y);
		}
		return mSide[coordToI(x, y)];
	}
};

MySide* side;

void calc(int pos, int count)
{
	if (count == N) {
		ans++;
		return;
	}

	for (int i = 1; i < N; i++) {
		if (!used[i] && side->get(pos, i)) {
			used[i] = true;
			calc(i, count + 1);
			used[i] = false;
		}
	}
}

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

	cin >> N >> M;
	side = new MySide(N, false);
	used = new bool[N];
	FOR(i, N) {
		used[i] = false;
	}
	FOR(i, M) {
		int a;
		int b;
		cin >> a >> b;
		side->set(a - 1, b - 1, true);
	}

	used[0] = true;
	calc(0, 1);

	cout << ans << ENDL;

	delete side;
	delete[] used;
	return 0;
}

Measured memory_bytes: 3600
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>

#define rep(i,p) for(int i=1;i<=p;i++)
#define ll long long

using namespace std;

int main(){

 int A,B;
  cin >> A >> B;
  int ans[7];

	 ans[1*2]=3;
  	ans[1*3]=2;
	ans[2*3]=1;
	cout << ans[A*B];











	return 0;

}



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

struct Node{
	Node* l;
	Node* r;
	Node() : l(nullptr), r(nullptr){};
};

string s;
int c;
Node* f(){
	Node* n = new Node();
	c++;
	if(s[c] == '('){
		n->l = f();
		c++;
	}
	assert(s[c] == ',');
	c++;
	if(s[c] == '('){
		n->r = f();
		c++;
	}
	return n;
}

bool intersection;
void g(Node* t1, Node* t2){
	if(t1 == nullptr && t2 == nullptr) return;
	if(intersection && (t1 == nullptr || t2 == nullptr)) return;
	cout << '(';
	Node* c1 = t1 == nullptr ? nullptr : t1->l;
	Node* c2 = t2 == nullptr ? nullptr : t2->l;
	g(c1, c2);
	cout << ',';
	c1 = t1 == nullptr ? nullptr : t1->r;
	c2 = t2 == nullptr ? nullptr : t2->r;
	g(c1, c2);
	cout << ')';
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	char op;
	while(cin >> op >> s){
		intersection = op == 'i';
		c = 0;
		Node* t1 = f();

		cin >> s;
		c = 0;
		Node* t2 = f();

		g(t1, t2);
		cout << endl;
	}
}

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

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

using namespace std;

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

	return 0;
}


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

typedef long long ll;

int n, m;

int main()
{
	scanf("%d %d", &n, &m);
	if (n > m) swap(n, m);
	if (n == 1)
		if (m == 1) printf("1\n");
		else printf("%d\n", m - 2);
	else cout << ll(n - 2) * (m - 2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int n;
	cin >> n;
	//n = 200000;
	vector<long long int>a(n);
	vector<long long int>b(n+1);
	long long int ans=0;
	int i,j;
	b.at(0) = 0;
	for (i = 0; i < n; i++)
	{
		cin >> a.at(i);

		//a.at(i) = 1000000000;
		b.at(i+1) +=  b.at(i)+a.at(i);
	}
	for (i = 1; i < n; i++)
	{
		ans += a.at(i) * (b.at(i) % 1000000007);
		ans = ans % 1000000007;
		//cout << ans << endl;
	}
	cout << ans << endl;

	
}

Measured memory_bytes: 6420
#include <iostream>
using namespace std;
int main()
{
	int a,b;
	while(cin>>a>>b)
	{ 
		int x=a+b;
		int n=0; 
		while(x) 
		{ 
			n++;
			x/=10;
		}
		cout<<n<<endl;
	} 
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

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


void solve(long long N, std::vector<long long> A){
  vector<ll> v(N+1, 0);
  for(auto x:A)
    v[x]++;
  for(ll i=1; i<=N; i++) {
    std::cout << v[i] << std::endl;
  }
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> A(N-2+1);
  for(int i = 0 ; i < N-2+1 ; i++){
    scanf("%lld",&A[i]);
  }
  solve(N, std::move(A));
  return 0;
}



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

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double c = (x/(a*a))*2 - b;
    double ans;
    if(c >= 0){
        ans = atan2(a,b-c);
        ans = 90 - ans*360/(2*M_PI);
    }
    else{
        c = 2*x/(a*b);
        ans = atan2(c,b);
        ans = 90 - ans*360/(2*M_PI);
    }
    cout << setprecision(20) <<  ans << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace atcoder_BegginerContest94_Question2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Int32.Parse(input[0]);
            int m = Int32.Parse(input[1]);
            int x = Int32.Parse(input[2]);

            string[] input2 = Console.ReadLine().Split(' ');

            int[] mass = new int[100];

            foreach (var i in input2)
            {
                mass[Int32.Parse(i)] = 1;
            }
            //x to n
            int costToN = 0;
            for (int i = x; i < n; i++)
            {
                if (mass[i] == 1) costToN++;
            }

            //x to 0
            int costToZero = 0;
            for (int i = x; i > 0; i--)
            {
                if (mass[i] == 1) costToZero++;
            }

            if (costToZero < costToN)
            {
                Console.WriteLine(costToZero);
            }
            else
            {
                Console.WriteLine(costToN);
            }
        }
    }
}


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

int N, A[25], B[25], C[25], points;

int main() {
  cin >> N;
  for (int i = 1; i <= N; i++)
    cin >> A[i];

  for (int i = 1; i <= N; i++)
    cin >> B[i];

  for (int i = 1; i <= N - 1; i++)
    cin >> C[i];

  points = 0;
  for (int i = 1; i <= N; i++) {
    points += B[A[i]];
    if (i > 1 && A[i] == A[i - 1] + 1)
      points += C[A[i - 1]];
  }

  cout << points << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = (1LL << 61) - 1;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, n, t, r, k, w, l, ans, i, j, u, v;
string S, T;
vl A, B;
void input() { cin >> x; }
void solve() {
    x = __gcd(x, 360LL);
    cout << 360 / x << endl;
}
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
}

Measured memory_bytes: 3648
# C
N, M = map(int, input().split())
X = list(map(int, input().split()))
if N >= M:
    print(0)
else:
    X.sort()
    new_list = []
    for j in range(1, M):
        new_list.append(abs(X[j] - X[j-1]))
    new_list.sort()
    new_list.reverse()
    
    for i in range(M-N):
        new_list.pop()
    ans=(max(X)-min(X))-sum(new_list)
    
    print(ans)

Measured memory_bytes: 13968
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N; cin >> N;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            if (i * 4 + j * 7 == N) {
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}


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

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

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

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"math"
)

func abs(x float64) float64 {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var a, b, h, m float64
	fmt.Scan(&a, &b, &h, &m)

	l := 360 * (m / 60)
	s := 30*h + 30*(m/60)
	ang := abs(l - s)
	if ang >= 180 {
		ang = 360 - ang
	}
	fmt.Println(math.Sqrt(a*a + b*b - 2*a*b*math.Cos(math.Pi*ang/180)))
}


Measured memory_bytes: 1820
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;


template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}
 
template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}


//vector<pair<int,int>> pairs;  pairs[i] = make_pair(value, value);
//sort(a.begin(),a+index_number);

//cin>>  cout<<'\n'

/*
vector<int> vec(100,-1);全ての値に-1をセット
vector<std::vector<int>> vec{{ 1, 2, 3 },{ 4, 5, 6 }};
vec.size() vec[i].size()
vec.emplace_back(20);追加
*/

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s;
    string ans = "NO";
    cin >> s;
    int len = s.length();

    int count = 0;

    for(int i = 0;i < len;i++){
        if(s[i] == 'o'){
            count ++;
        }
    }

    if((15-len+count) >= 8)
        ans = "YES";

    cout << ans <<'\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int INF = 100000000;
int main(){
  int N, x;
  cin >> N >> x;
  vector<int> d(N), c(N);
  for (int i = 0; i < N; i++){
    cin >> d[i] >> c[i];
  }
  vector<int> cost(200001, INF);
  cost[0] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
  pq.push(make_pair(0, 0));
  while (!pq.empty()){
    int c_cost = pq.top().first;
    int pos = pq.top().second;
    pq.pop();
    for (int i = 0; i < N; i++){
      if (pos + d[i] <= 200000){
        if (cost[pos + d[i]] > c_cost + c[i]){
          cost[pos + d[i]] = c_cost + c[i];
          pq.push(make_pair(cost[pos + d[i]], pos + d[i]));
        }
      }
    }
    for (int i = 0; i < N; i++){
      if (pos - d[i] >= 0){
        if (cost[pos - d[i]] > c_cost + c[i]){
          cost[pos - d[i]] = c_cost + c[i];
          pq.push(make_pair(cost[pos - d[i]], pos - d[i]));
        }
      }
    }
  }
  if (cost[x] == INF){
    cout << -1 << endl;
  } else {
    cout << cost[x] << endl;
  }
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  ll N; cin >> N;
  ll A[N]; rep(i,N) cin >> A[i];
  ll sum[N+1] = {}; rep(i,N) sum[i+1] += sum[i]+A[i];
  ll result = LLINF;
  rep(i,N+1) result = min(result, abs(sum[N]-sum[i]*2));
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include<algorithm>
using namespace std;
int g[100],jyunni[100];
int n;
void katimake(int a,int b,int c,int d){
	if(c>d){g[a-1]+=3;}
	else if(d>c){g[b-1]+=3;}
	else{
		g[a-1]++;
		g[b-1]++;
	}
	}
int main() {
	cin>>n;
	for(int i = 0;i<100;i++){
		g[i]=0;
	}
	int p,q,r,s;
	while(cin>>p>>q>>r>>s){katimake(p,q,r,s);}
	int jyu = 1;
	int saidai=0;
	for(int i= 0;i<n;i++){saidai=max(saidai,g[i]);}
	for(int p=saidai;saidai>=0;saidai--){
		int y=0;
		for(int i =0;i<n;i++){
		if(g[i]==saidai){
			jyunni[i]=jyu;
			y++;
			}
		}
		jyu+=y;
	}
	for(int i = 0;i<n;i++){
		cout<<jyunni[i]<<endl;
	}
	return 0;
}

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

int main(void) {
	using namespace std;
	long long H, W;
	cin >> H >> W;
	if(H % 3 == 0 || W % 3 == 0) {
		cout << "0\n";
		return 0;
	}
	long long result = H * W;
	long long S1, S2, S3;
	for(int a = W / 3; a <= W / 3 + 1; ++a) {
		S1 = H * a;
		S2 = (H / 2) * (W - a);
		S3 = (H - (H / 2)) * (W - a);
		long long r = max({S1, S2, S3}) - min({S1, S2, S3});
		if(r < result) {
			result = r;
		}
	}
	for(int a = H / 3; a <= H / 3 + 1; ++a) {
		S1 = W * a;
		S2 = (W / 2) * (H - a);
		S3 = (W - (W / 2)) * (H - a);
		long long r = max({S1, S2, S3}) - min({S1, S2, S3});
		if(r < result) {
			result = r;
		}
	}
	if(H < result) result = H;
	if(W < result) result = W;
	cout << result << '\n';
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
struct Node
{
    char s[1010];
};
int L;
int n;
int cmp(Node a,Node b)
{
    return strcmp(a.s,b.s)<0;
}
int cmp1(Node a,Node b)
{
    for(int i=0;i<L;i++)
    {
        if(a.s[i]==b.s[i])
            i++;
        else
            return a.s[i]<b.s[i];
    }
    return 0;
}
int main()
{
    Node a[1010];
    scanf("%d%d",&n,&L);
    for(int i=0;i<n;i++)
        scanf("%s",a[i].s);
    sort(a,a+n,cmp);
    for(int i=0;i<n;i++)
        printf("%s",a[i].s);
        printf("\n");
    return 0;
}
//int main()
//{
//    string
//}


Measured memory_bytes: 384
N,W=map(int,input().split())
item=[tuple(map(int,input().split())) for _ in range(N)]
#item=(v,w)
dp=[[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(1,N+1):
    for w in range(1,W+1):
        if w>=item[i-1][1]:
            dp[i][w]=max(dp[i-1][w],dp[i-1][w-item[i-1][1]]+item[i-1][0])
        else:
            dp[i][w]=dp[i-1][w]
print(dp[N][W])


Measured memory_bytes: 25952
a,b,c,d = map(int, input().split())

t_count=0
while a>0:
    a=a-d
    t_count+=1
m_count=0
while c>0:
    c=c-b
    m_count+=1
    
#print(t_count,m_count)

if t_count>=m_count:
    print("Yes")
else:
    print("No")

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

int count = 0;
void printlist(int lst[], size_t len){
	for(size_t i = 0; i < len - 1; i ++){
		cout << lst[i] << " ";
	}
	cout << lst[len - 1] << endl;
}

int forgetind(int i, int x){
	int S = 1;
	int result = 0;

	while (S <= x){
		S *= i;
		result += 1;
	}
	return result - 1;
}

int power(int x, int i){
	int result = 1;
	for (int j = 0; j < i; j ++){
		result *= x;
	}
	return result;
}

void inserSort(int lst[], int n, int g){
	int select, j;

	for(int i = g; i < n; i ++){
		select = lst[i];
		j = i - g;

		while(j >= 0 && lst[j] > select){
			lst[j + g] = lst[j];
			j -= g;
			count ++;
		}

		lst[j + g] = select;
	}
}

void shellSort(int lst[], size_t len){
	int m = forgetind(3, 2 * len + 1);
	int G[m];
	cout << m << endl;

	for (int i = m - 1; i >= 0; i --){
		G[m - i - 1] = (power(3, i + 1) - 1) / 2;
	}
	printlist(G, m);

	for(int i = 0; i < m; i ++){
		inserSort(lst, len, G[i]);
	}
}


int main(int argc, char const *argv[])
{
	int N;
	cin >> N;
	int st[N];
	for (auto& i : st){
		cin >> i;
	}
	shellSort(st, sizeof(st) / sizeof(int));
	cout << count << endl;
	for(auto x:st){
		cout << x << endl;
	}
	return 0;
}


Measured memory_bytes: 7008
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,k;
    cin>>n>>m>>k;

    long long a[n],b[m];
    for (int i=0;i<n;i++)
    cin>>a[i];

    for (int i=0;i<m;i++)
    cin>>b[i];

    long long a1[n+1],b1[m+1];
    a1[0]=0;
    b1[0]=0;
    for (int i=1;i<=n;i++)
    a1[i]=a[i-1]+a1[i-1];

    for (int i=1;i<=m;i++)
    b1[i]=b[i-1]+b1[i-1];
    int ans=0;
    for (int i=0,j=m;i<=n;i++)
    {
        if (a1[i]>k)
        break;
        
        while (a1[i]+b1[j]>k)
        {
            j--;
        }
        ans = max(ans,i+j);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 9868
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
#include <chrono>
#include<unordered_map>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const LL inf = 1e18;

map<LL, LL> d;
LL go(LL N, int A, int B, int C, int D)
{
	LL res = inf;
	// Below works on G++, not in VS
	/*if (N*(__int128)D < res)
		res = N * D;*/
	if (N < res / D)
		res = N * D;
	if (!N)
		return 0;
	auto it = d.find(N);
	if (it != d.end())
		return it->second;

	auto K = { MP(2,A),MP(3,B),MP(5,C) };
	for (const auto &p : K)
	{
		{
			LL v = N / p.first;
			auto tmp = go(v, A, B, C, D);
			res = min(res, D*(N%p.first) + p.second + tmp);
		}
		{
			LL v = N / p.first + (N % p.first ? 1 : 0);
			if (v == N || v == N / p.first)
				continue;
			auto tmp = go(v, A, B, C, D);
			res = min(res, D*(p.first - N % p.first) + p.second + tmp);
		}
	}

	return d[N] = res;
}

int main()
{
	int T;
	scanf("%d", &T);
	REP(xxx, T)
	{
		LL N;
		int A, B, C, D;
		scanf("%lld%d%d%d%d", &N, &A, &B, &C, &D);

		printf("%lld\n", go(N, A, B, C, D));
		d.clear();
	}

	return 0;
}

// FOR GNU C++ use the following pattern:
// Uncomment the code below and change your main into main2
// It does not build in MS C++
// But it does increase the stack size from 256 MB on CF and uses GNU C++

//#include <Processthreadsapi.h>
//#include <iostream>
//#include <Synchapi.h>
//#include <windows.h>
//#include <process.h>
//
//DWORD WINAPI MyThreadFunction(LPVOID lpParam) {
//    main2(nullptr);
//    return 0;
//}
//int main() {
//    auto h = CreateThread(nullptr, 1024 << 20, MyThreadFunction, nullptr, STACK_SIZE_PARAM_IS_A_RESERVATION, nullptr);
//    WaitForSingleObject(h, INFINITE);
//}

Measured memory_bytes: 4076
using System;

    class Program
    {
        static void Main(string[] args)
        {
            int a, b, d, r;
            double f;
            string[] num = Console.ReadLine().Split(' ');
            a = int.Parse(num[0]);
            b = int.Parse(num[1]);

            d = a / b;
            r = a % b;
            f = (double)a / b;

            Console.Write(d + " " + r + " ");
            Console.WriteLine("{0:0.000000}", f); 
        }
    }



Measured memory_bytes: 9380
#include <stdio.h>
int main(void){
    char str[1500];
    int i;
    for (i=0; i<1500; i++){
    	str[i] = '\0';
    }

    fgets(str, sizeof(str), stdin);

    for (i=0; str[i]!='\0'; i++){
        if (str[i]>='A' && str[i]<='Z'){
            str[i] += 'a' - 'A';
        }else if (str[i]>='a' && str[i]<='z'){
        	str[i] -= 'a' - 'A';
        }
    }
    printf("%s", str);

    return 0;
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

int main(){
	IO_STREAM;
	int N;	cin>>N;
	vi ans(10000);
	int x,y,z;
	int x2,y2,z2;
	rep(j,1,101){
		x=j;
		x2=x*x;
//		if((x2+y2)>N) break;
		rep(k,1,101){
			y=k;
			y2=y*y;
//			if((x2+y2)>N) break;
			rep(p,1,101){
				int calc;
				z=p;
				z2=z*z;
//				if((x2+y2+z2)>N) break;
				calc=x2+y2+z2+x*y+y*z+z*x;
				if(calc<=10000)		ans[calc]++;
			}
		}
	}
	rep(i,1,N+1){
		cout<<ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define rep(i, k) for (i = 0; i < k; i++) 
typedef long long ll;
typedef pair<ll, ll> l_l;
int i, j;

ll b, k, n = 0,m, z = 0, x, y, a[200005] = {};
	vector<ll> v,vec;
	string s, t;
int main() {
	cin >> n>>m;
	rep(i, m) {
		cin >> b;
		z += b;
	}
	if (z > n)cout << "-1";
	else cout << n - z;

	return 0;

}


Measured memory_bytes: 3600
#include<stdio.h>
int main(void)
{
	int r,a;
	scanf("%d %d",&r,&a);
	if(r*-1>a){
		printf("-1\n");
	}
	if(r*-1==a){
		printf("0\n");
	}
	if(r*-1<a){
		printf("1\n");
	}
	return 0;
}



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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    for (int i = 0; i < m; i++) cin >> x[i];

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

    vector<int> len(m-1);
    for (int i = 0; i < m-1; i++)
        len[i] = x[i+1] - x[i];

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

    int ans = 0;
    for (int i = 0; i < m-n; i++)
        ans += len[i];

    printf("%d\n", ans);
}

Measured memory_bytes: 1024
# S = input()
# N = int(input())
# a = list(map(int, input().split()))
# X = [int(input()) for _ in range(N)]

N = int(input())
S = input()

ans1 = 0
ans2 = 0
kuro_frag = False

for i in S:
    if i == "#":
        kuro_frag = True
    elif kuro_frag:
        ans1 += 1

kuro_count = 0
siro_count = 0

for i in range(N):
    if S[i] == "#":
        kuro_count += 1
        siro_count = 0
        ans2 += 1
    else:
        kuro_count = 0
        siro_count += 1



# print(min(ans1,ans2-kuro_count))


sirokuro_list = []

if S[0] == ".":
    first_sirofrag = True
else:
    first_sirofrag = False

kuro_count = 0
siro_count = 0

for i in range(N):
    if S[i] == "#":
        kuro_count += 1
        if siro_count != 0:
            sirokuro_list.append(siro_count)
        siro_count = 0
    else:
        siro_count += 1
        if kuro_count != 0:
            sirokuro_list.append(kuro_count)
        kuro_count = 0

if siro_count != 0:
    sirokuro_list.append(siro_count)
if first_sirofrag:
    sirokuro_list.pop(0)


# print(sirokuro_list)


i = 2
if len(sirokuro_list) > 1:
    sirowa = [sirokuro_list[1]]
    kurowa = [sirokuro_list[0]]
    while True:
        if i == len(sirokuro_list):
            break

        if (i % 2) == 0:
            kurowa.append(sirokuro_list[i] + kurowa[-1])
        if (i % 2) == 1:
            sirowa.append(sirokuro_list[i] + sirowa[-1])
        i+=1

    # print(kurowa)
    # print(sirowa)

    ans3 = min(ans1, ans2)

    for i in range(0, len(kurowa)):
        ans_tmp = 0
        ans_tmp += kurowa[i]
        ans_tmp += sirowa[-1] - sirowa[i]
        # print(ans_tmp)
        if ans_tmp < ans3:
            ans3 = ans_tmp

    print(ans3)
else:
    print(0)



Measured memory_bytes: 12832
//41
#include<iostream>
#include<cstdlib>

#define S(X) ((X)*(X))

using namespace std;

int main(){
  for(char c[8];cin>>c,c[0]!='0';){
    int md=1<<30;
    int cn;
    unsigned cd=strtoul(c+1,0,16);
    for(int i=0;i<8;i++){
      unsigned d=0;
      for(int j=0;j<3;j++){
	static const unsigned cc[]={0x0,0xff,0xff00,0xffff,0xff0000,0xff00ff,0xffff00,0xffffff};
	d+=S((cd>>j*8&0xFF)-(cc[i]>>j*8&0xFF));
      }
      if(d<md){
	md=d;
	cn=i;
      }
    }
    const char *cstr[]={"black","blue","lime","aqua","red","fuchsia","yellow","white"};
    cout<<cstr[cn]<<endl;
  }
  return 0;
}
      
	

Measured memory_bytes: 0
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <ctype.h>
#include <cstdlib>
#include <string.h>


using namespace std;


int main()
{
	int count = 0, h = 0;
	string input;

	while (true)
	{
		
		cin >> input;
		cin >> count;

		if (input[0] == '-')
			break;

		for (int i = 0; i < count; i++)
		{
			cin >> h;

			input = input.erase(0, h) + input.substr(0, h);
		}

		cout << input << endl;
	}

	
}

Measured memory_bytes: 3140
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	ll out=in[0]-1;
	in[0]=1;
	ll t=2;
	loop(i,1,n){
		bool h=false;
		if(in[i]>t)h=true;
		ll c=(in[i]-1)/t;
		out+=c;
		in[i]-=c*t;
		if(h)in[i]=1;
		if(t==in[i])t++;
	}
	cout<<out<<endl;
}








Measured memory_bytes: 1152
n = int(input())
for i in range(1, n + 1):
    x = i
    if x % 3 == 0:
        print(f" {i}", end = "")
    else:
        while x >= 1:
            if x % 10 == 3:
                print(f" {i}", end = "")
                break
            else:
                x = int(x / 10)
print("")


Measured memory_bytes: 5884
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int num1 = A - (B*2);
    if(num1 >= 0){
      System.out.println(num1);
    }else{
      System.out.println("0");
    }
  }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B;
    cin>>A>>B;
    int i;
    for(i=1;i<=1000;i++)
        if((    (int)((double)i*0.08)==A)&&((int)((double)i*0.1)==B))
            break;
    if(i>1000)
        cout<<-1;
    else
        cout<<i;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
#input
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a,b,c,x,y = map(int,input().split())
if 2*c <= a and 2*c <= b:
    print(max(x,y)*2*c)
elif 2*c <= a:
    print(x*2*c + max(0,y-x)*b)
elif 2*c <= b:
    print(y*2*c + max(0,x-y)*a)
elif 2*c <= a+b:
    if y < x:
        print(y*2*c + (x-y)*a)
    else: print(x*2*c + (y-x)*b)
else:
    print(a*x + b*y)

Measured memory_bytes: 3064
#include"bits/stdc++.h"
using namespace std;
int a[1000000];
int main(){
	int num,point,ans;
	cin>>num>>point>>ans;
	if(ans<point){
		for(int i=0;i<ans;i++){
			scanf("%d",&a[i]);
		}
		for(int i=1;i<=num;i++){
			printf("Yes\n");
		}
	}
	else {
		int temp=ans-point,t;
		for(int i=0;i<ans;i++){
			scanf("%d",&t);
			a[t]++;
		}
		for(int i=1;i<=num;i++){
			if(a[i]>temp)printf("Yes\n");
			else printf("No\n");
		}
	}
}

Measured memory_bytes: 1024
H, W = gets.chomp.split(" ").map(&:to_i)
@m = []
@ans = Array.new(H){Array.new(W, 0)}

bomb = []
H.times do |i|
  row = gets.chomp.split("")
  W.times do |j|
    if row[j] == "#"
      @ans[i][j] = row[j]
      bomb << [i, j]
    end
  end
  @m << row
end

d = [[0, -1], [1, -1], [1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1]]
bomb.each do |i, j|
  d.each do |dx, dy|
    nx = j + dx
    ny = i + dy
    if nx >= 0 && nx < W && ny >= 0 && ny < H && @m[ny][nx] == "."
      @ans[ny][nx] += 1
    end
  end
end
@ans.each do |row|
  puts row.join("")
end

Measured memory_bytes: 2172
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int h1,h2,m1,m2,s1,s2,h,m,s;
	for(int i=0;i<3;i++){
		scanf("%d%d%d%d%d%d",&h1,&m1,&s1,&h2,&m2,&s2);
		h=h2-h1;
		m=m2-m1;
		s=s2-s1;
		if(m<0){
			h-=1;m+=60;
		}
		if(s<0){
			m-=1;s+=60;
		}
		if(m<0){
			h-=1;m+=60;
		}
		printf("%d %d %d\n",h,m,s);
	}
	return 0;
}

Measured memory_bytes: 1192
#include <stdio.h>
#include <string.h>
int max(int a,int b){
    if(a>b) return a;
    else return b;
}
int main(void){
    int n,m,i,j,ans=0;
    char s[100][11],t[100][11];
    scanf("%d",&n);
    for(i=0;i<n;i++) scanf("%s",s[i]);
    scanf("%d",&m);
    for(i=0;i<m;i++) scanf("%s",t[i]);
    for(i=0;i<n;i++){
        int cnt=0;
        for(j=0;j<n;j++){
            if(strcmp(s[i],s[j])==0) cnt++;
        }
        for(j=0;j<m;j++){
            if(strcmp(s[i],t[j])==0) cnt--;
        }
        ans = max(ans,cnt);
    }
    printf("%d",ans);
}

Measured memory_bytes: 128