akhauriyash/Code-Regression huggingface dataset:
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

vector< vector<int> > c(100000, vector<int>(0));
vector<int> dist(100000);

void dfs(int root, int v, int parent){
    dist.at(root) = v;

    REP(i,c.at(root).size()){
        if(c.at(root).at(i) == parent) continue;

        dfs(c.at(root).at(i), v+1, root);
    }
}
vector<int> calcdist(int stt){
    dfs(stt,0,-1);
    return dist;
}

signed main() {
    int n,u,v;
    cin>>n>>u>>v;

    REP(i,n-1){
        int a,b;
        cin>>a>>b;
        c.at(a-1).push_back(b-1);
        c.at(b-1).push_back(a-1);
    }

    vector<int> distu = calcdist(u-1);
    vector<int> distv = calcdist(v-1);

    int mx = 0;
    REP(i,n){
        if(distu.at(i) < distv.at(i)){
            mx = max(mx, distv.at(i));
        }
    }
    int ans = mx - 1;
    cout<<ans<<endl;
    // cout << ans << endl;
    return 0;
}

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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    bool F[n][10];
    int P[n][11];
    rep(i,0,n){
       rep(j,0,10){
           cin >> F[i][j];
       }
    }
    rep(i,0,n){
       rep(j,0,11){
           cin >> P[i][j];
       }
    }
    ll ans = -(1e9+5);
    rep(bit,1,(1<<10)){
        int cnt[n] = {};
        ll calc=0;
        rep(shift,0,10){
            if(bit & (1<<shift)){
                rep(i,0,n){
                    if(F[i][shift])cnt[i]++;
                }
            }
        }
        rep(i,0,n){
           calc += P [i][cnt[i]];
        }
        ans = max(ans,calc);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn._
import scala.collection.mutable.PriorityQueue

object Main {
  def main(args: Array[String]) = {
    val Array(n, m) = readLine().split(" ").map(_.toInt)
    val q = PriorityQueue[Long]() ++ readLine().split(" ").map(_.toLong)
    for(_ <- 0 until m) {
      q.enqueue(q.dequeue()/2)
    }
    println(q.sum)
  }
}
    


Measured memory_bytes: 56744
a, b = [int(x) for x in input().split()]
sum = 0
if a > b:
    sum += a
    a = a - 1
else:
    sum += b
    b = b - 1

if a > b:
    sum += a
    a = a - 1
else:
    sum += b
    b = b - 1
 
print(sum)

Measured memory_bytes: 3060
/*
AizuOnline A0022
Maximum Sum Sequence
*/
#include <stdio.h>


main()
{
  int i;
  int kukan[11];
  int kyori[11];
  int v1,v2;
  float cross;
  
  kyori[0]=0;

  while(1){
  for(i=1;i<=10;i++)
    {
      if(EOF == scanf("%d,",&kukan[i]))
        goto END;
      else
        kyori[i] = kyori[i-1]+kukan[i];
    }
   scanf("%d,%d",&v1,&v2); 

  cross = (float)kyori[10] * (float)v1/((float)v1+(float)v2);

  
  for(i=1;i<=10;i++)
    {   
      if((float)kyori[i-1] <  cross && cross <= (float)kyori[i])
        printf("%d\n",i);
    }
  }
    END:
return(0);
}

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

int main()
{
    int w,a,b;
    while(scanf("%d%d%d",&w,&a,&b)!=EOF)
    {
        if(a>b)
        {
            int i;
            i=a;
            a=b;
            b=i;
        }
        if(a+w>=b)
            printf("0\n");
        else
            printf("%d\n",b-a-w);
    }
    return 0;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
a = []
for i in range(h):
  a.append(input())
ans = ""

for i in range(w + 2):
  ans += "#"
  
ans += "\n"

for i in a:
  ans += "#"
  ans += i
  ans += "#"
  ans += "\n"

for i in range(w + 2):
  ans += "#"

print(ans)

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

public class Main {
	public static void main(String[] args) {
		String num;
		int num1;
		int num2;
		int num3;

		Scanner scan = new Scanner(System.in);
		num = scan.nextLine();
		String numbers[] = num.split(" ");
		ArrayList<Integer> numList1= new ArrayList<>();
		for(String number:numbers) {
			numList1.add(Integer.parseInt(number));
		}
		num = scan.nextLine();
		numbers = num.split(" ");
		ArrayList<Integer> numList2= new ArrayList<>();
		for(String number:numbers) {
			numList2.add(Integer.parseInt(number));
		}
		num = scan.nextLine();
		numbers = num.split(" ");
		ArrayList<Integer> numList3= new ArrayList<>();
		for(String number:numbers) {
			numList3.add(Integer.parseInt(number));
		}

		int N = scan.nextInt();
		ArrayList<Integer> b = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			int a = scan.nextInt();
			b.add(a);
		}

		for(int i = 0; i<N; i++) {
			for(int j = 0; j<3; j ++ )
				if(numList1.get(j) == b.get(i)) {
					numList1.set(j,0);
			};
			for(int j = 0; j<3; j ++ )
				if(numList2.get(j) == b.get(i)) {
					numList2.set(j,0);
			};
			for(int j = 0; j<3; j ++ )
				if(numList3.get(j) == b.get(i)) {
					numList3.set(j,0);
			};
		}

		if((numList1.get(0)==0&&numList1.get(1)==0&&numList1.get(2)==0) || (numList2.get(0)==0&&numList2.get(1)==0&&numList2.get(2)==0) || (numList3.get(0)==0&&numList3.get(1)==0&&numList3.get(2)==0) || (numList1.get(0)==0&&numList2.get(0)==0&&numList3.get(0)==0) || (numList1.get(1)==0&&numList2.get(1)==0&&numList3.get(1)==0) || (numList1.get(2)==0&&numList2.get(2)==0&&numList3.get(2)==0) || (numList1.get(0)==0&&numList2.get(1)==0&&numList3.get(2)==0) || (numList1.get(2)==0&&numList2.get(1)==0&&numList3.get(0)==0)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}



	}
}


Measured memory_bytes: 21844
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

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

const int MOD = 1000000007;

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

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

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

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

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

int main(){
	cout<<fixed;
	double n;
	cin>>n;
	double odd;
	if((int)n%2){
		odd=n/2+0.5;
	}else{
		odd=n/2;
	}
	cout<<setprecision(9)<<odd/n<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
 	int a,b,c;
	int five = 0;
	int seven = 0;
  	cin >> a >> b >> c;
  	if( a == 5 )
        five++;
  	else if( a == 7 )
    	seven++;
  
  	if( b == 5 )
        five++;
  	else if( b == 7 )
    	seven++;
  
   	if( c == 5 )
        five++;
  	else if( c == 7 )
    	seven++;
  
  	if( five == 2 && seven == 1 )
		cout << "YES" << endl;
	else
    	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
// ABC167C - 

#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;

int main() {
	int N, M, X;
	cin >> N >> M >> X;
	int C[N];
	int A[N][M];

	for (int i = 0; i < N; i++) {
		cin >> C[i];
		for (int j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}

	int ans = 100000 * 15;
	bool found = false;

	int r[M];
	for (int i = 0; i < (1<<N); i++) {
		int cost = 0;
		for (int j = 0; j < M; j++) {
			r[j] = 0;
		}

		for (int k = 0; k < N; k++) {
			if (i & 1 << k) {
				for (int j = 0; j < M; j++) {
					r[j] += A[k][j];
				}
				cost += C[k];
			}
		}

		bool rOK = true;
		for (int j = 0; j < M; j++) {
			if (r[j] < X) {
				rOK = false;
				break;
			}
		}
		if (rOK) {
			found = true;
			ans = min(ans, cost);
		}
	}
	if (found) {
		cout << ans << endl;
	} else {
		cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3648
n, q = map(int, input().split())
parents = [[] for _ in range(n)]
points = [0] * n

for _ in range(n-1):
  a, b = map(int, input().split())
  parents[a-1].append(b)
  parents[b-1].append(a)
  
for _ in range(q):
  p, x = map(int, input().split())
  points[p-1] += x

done = [0] * n
key = [1]

while key:
  pos = key.pop()
  done[pos-1] = 1
  for j in parents[pos-1]:
    if done[j-1] != 1:
      points[j-1] += points[pos-1]
      key.append(j)
  
print(*points)

Measured memory_bytes: 105472
s = input()

ns = 0
we = 0

if "N" in s and "S" in s:
    ns = 1
elif "N" not in s and "S" not in s:
    ns = 1
if "W" in s and "E" in s:
    we = 1
elif "W" not in s and "E" not in s:
    we = 1
    
if ns == 1 and we == 1:
    print("Yes")
else:
    print("No")

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

#define ll            long long
#define pb            push_back
#define nikal_laura   ios::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr);
#define sc(c)          scanf("%d",&c);

ll n,x,q,t ;

int main(){

    ios::sync_with_stdio(false); cin.tie(nullptr);
    cin>>n>>t;
    cout<<n%t<<endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<stdio.h>
#include<vector>
#include<map>
using namespace std;

int r, D, x[11];
int ans;

int main() {
	cin >> r >> D >> x[0];
	for (int i = 1; i <= 10; i++) {
		x[i] = r * x[i - 1] - D;
		cout << x[i] << endl;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
int main(){
    int n;
    cin >> n;
    ll ans=1;
    vector<int> a(n);
    bool isPossible=true;
    for(int i = 0;i < n;i ++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    if(n%2 && a[0]) isPossible = false;
    if(n%2) a.erase(a.begin());
    for(int i = 0;i < a.size();i += 2){
        if(a[i+1]!=a[i] || a[i]!=i+1+n%2) isPossible = false;
    }
    if(isPossible){
        for(int i = 0;i < a.size()/2;i ++){
            ans = ans*2%mod;
        }
    }else ans = 0;
    cout << ans << endl;
    return 0;
}

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

int main(){
  string a;
  cin >> a;
  if(a=="hi" || a=="hihi" || a=="hihihi" || a=="hihihihi" || a=="hihihihihi"){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
    int n, i, j, count=0, m, divisors;
    scanf("%d", &n);
    if(n<105) printf("0\n");
    else
    {
        for(i=105; i<=n; i=i+2)
        {
            m=sqrt(i);
            divisors=2;
            for(j=3; j<=m; j=j+2)
            {
                if((i%j)==0) divisors+=2;
            }
            if(divisors==8) count++;
        }
        printf("%d\n", count);
    }
    return 0;
}


Measured memory_bytes: 128
package main

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

//scanで一行づつ読み込む
var sc = bufio.NewScanner(os.Stdin)
var wtr = bufio.NewWriter(os.Stdout)

//sort
// array := []int{5, 1, 4, 2, 3}
// sort.Sort(sort.IntSlice(array))

func main() {
	// a := make([]int, n)
	// A := strings.Split(nextLine(), " ")

	X := strings.Split(nextLine(), " ")
	Y := strings.Split(nextLine(), " ")
	Z := strings.Split(nextLine(), " ")
	// Z := strings.Split(nextLine(), " ")

	// n, _ := strconv.Atoi(input[0])

	// memo = make([]bool, n+1, n+2)

	a1, _ := strconv.Atoi(X[0])
	b1, _ := strconv.Atoi(X[1])
	a2, _ := strconv.Atoi(Y[0])
	b2, _ := strconv.Atoi(Y[1])
	a3, _ := strconv.Atoi(Z[0])
	b3, _ := strconv.Atoi(Z[1])

	ans := true

	arr := make(map[int][]int)

	check := make([]bool, 5)
	check[0] = true

	for i := 0; i < 4; i++ {
		arr[i+1] = make([]int, 0)
	}

	start := 0
	memo := make([]int, 5)
	memo[a1]++
	memo[b1]++
	memo[a2]++
	memo[b2]++
	memo[a3]++
	memo[b3]++
	for _, i := range memo {
		if i == 1 {
			start = i
			break
		}
	}

	arr[a1] = append(arr[a1], b1)
	arr[b1] = append(arr[b1], a1)
	arr[a2] = append(arr[a2], b2)
	arr[b2] = append(arr[b2], a2)
	arr[a3] = append(arr[a3], b3)
	arr[b3] = append(arr[b3], a3)

	check[start] = true
	for i := 0; i < 3; i++ {
		for _, j := range arr[start] {
			if check[j] == false {
				start = j
				check[start] = true
				break
			}
		}

	}

	for _, i := range check {
		if i == false {
			ans = false
			break
		}
	}
	// fmt.Println(check)

	if ans == true {
		fmt.Fprintln(wtr, "YES")
	} else {
		fmt.Fprintln(wtr, "NO")
	}

	_ = wtr.Flush()
}

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

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

	if a > b {
		return 0
	}
	return abs(a - b)
}

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

type dishh struct {
	first  int
	second int
}

type dish []dishh

func (p dish) Len() int {
	return len(p)
}

func (p dish) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p dish) Less(i, j int) bool {

	return p[i].first+p[i].second > p[j].first+p[j].second
}


Measured memory_bytes: 640
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), x.end()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 998244353;
const int inf = 1e9 + 7;
const int N = 3e3 + 5;
const double eps = 1e-9;
int dp[N][N];

inline int add(int x, int y) { return x+y < mod ? x+y : x+y-mod; }
inline int sub(int x, int y) { return x-y >=  0 ? x-y : x-y+mod; }
inline int mul(int x, int y) { return x * 1ll * y % mod; }
template<class T, class... O> int mul(T x, O... y) { return mul(x, mul(y...)); }

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c, d; cin >> a >> b >> c >> d;
  dp[a][b] = 1;
  for (int i = a; i <= c; i++) {
    for (int j = b; j <= d; j++) {
      if (i == a && j == b)
        continue;
      dp[i][j] = add(mul(dp[i-1][j], j), mul(dp[i][j-1], i));
      dp[i][j] = sub(dp[i][j], mul(dp[i-1][j-1], i-1, j-1));
    }
  }
  cout << dp[c][d] << endl;
  return 0;
}


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

using namespace std;

int main(){
	int N, max = 0, total = 0;
	int p[10];
	bool flg = false;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> p[i];
		if(max < p[i]){
			max = p[i];
		}
	}
	for(int i = 0; i < N; i++){
		if(max == p[i] && flg == false){
			p[i] = p[i] / 2;
			flg = true;
		}
		total += p[i];
	}
	cout << total;
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  
  string ans = "Yes\n";
  
  for(int i=0; i<s.size(); i++){
    if(i % 2 != 1){
      if(s.at(i) == 'L'){
        ans = "No\n";
        break;
      }
    }
    else{
      if(s.at(i) == 'R'){
        ans = "No\n";
        break;
      }
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
from collections import deque
N, u, v = map(int, input().split())
u -= 1
v -= 1
graph = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(lambda x:int(x)-1, input().split())
  graph[a] += [b]
  graph[b] += [a]

def bfs(s):
  dist = [-1]*N
  q = deque([s])
  dist[s] = 0

  while q:
    u = q.popleft()
    for v in graph[u]:
      if dist[v] == -1:
        dist[v] = dist[u] + 1
        q.append(v)

  return dist

d1 = bfs(u)
d2 = bfs(v)
ans = 0
for i in range(N):
  if d1[i] < d2[i]:
    ans = max(ans, d2[i]-1)

print(ans)



Measured memory_bytes: 67104
import java.util.*;
import java.io.*;

public class Main{
    public static void main(String... args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String number = br.readLine();
        
        int absMin = Math.abs(753 - Integer.parseInt(number.substring(0, 3)));
        for(int i = 1; i < number.length() - 2; i++){
            String cutNumber = number.substring(i, i + 3);
            int checknumber = Integer.parseInt(cutNumber);
            int checkAbs = Math.abs(753 - checknumber);
            if(absMin > checkAbs) absMin = checkAbs;
        }
        System.out.println(absMin);
    }
}

Measured memory_bytes: 21204
turn = int(input())
tarou_point = 0
hanako_point = 0
for x in range(turn):
    tarou,hanako = map(str,input().split())
    count = 0
    flg = False
    if len(tarou) >= len(hanako):
        count = len(hanako)
    else:
        count = len(tarou)

    for y in range(count):
        if ord(tarou[y:y+1]) > ord(hanako[y:y+1]):
            tarou_point += 3
            flg = True
            break
        elif ord(tarou[y:y+1]) < ord(hanako[y:y+1]):
            hanako_point += 3
            flg = True
            break
    
    if flg == False:
        if len(tarou) > len(hanako):
            tarou_point += 3
        elif len(tarou) < len(hanako):
            hanako_point += 3
        else:
            tarou_point += 1
            hanako_point += 1

print(tarou_point,end=' ')
print(hanako_point)



Measured memory_bytes: 5596
def f(s):
  while 1:
    b=s.find(")")
    if b<0: return g(s)
    a=s[:b].rfind("(")
    s=s.replace(s[a:b+1],f(s[a+1:b]))

def g(s):
  a=""
  f=1
  x=[]
  def F(a,b):
    x.append(a)
    x.append(b)
    return 1,""
  for c in s:
    if c=="=": continue
    elif c in "*/": f,a=F(a,c)
    elif c in "+-":
      if f==1: f,a=0,c
      else: f,a=F(a,c)
    else: f,a=0,a+c
  x.append(a)

  s=x[:]
  x=[]
  f=""
  for e in s:
    if e in "+-": x.append(e)
    elif e in "*/": f=e
    else:
      a=int(e)
      if f=="*": a*=x.pop()
      elif f=="/": a=int(1.0*x.pop()/a)
      x.append(a)
      f=""
  x="".join(map(str,x))
  return str(eval(x))

n=input()
for _ in [0]*n:
  print f(raw_input())

Measured memory_bytes: 4320
#include <bits/stdc++.h>
typedef long long ll;
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define dbg2(x,y) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<endl
#define dbg3(x,y,z) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<endl
#define dbg4(x,y,z,q) cout<<#x<<" = "<<x<<", "<<#y<<" = "<<y<<", "<<#z<<" = "<<z<<", "<<#q<<" = "<<q<<endl
#define dbg_array(x,sz) for (int i = 0; i < sz; ++i) cout << x[i] << " \n"[i==sz-1]
using namespace std;

const ll N = 100 + 9, M = 400 - 9, Max_ans = 1LL * (1e16);
int vis[N];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef ECLIPSE
	freopen("input.in", "rt", stdin);
	//freopen("output.out", "wt", stdout);
#endif
	int n;
	cin >> n;
	string s;
	while (n--) {
		cin >> s;
		++vis[s[0] - 'A'];
	}
	printf("AC x %d\n", vis['A' - 'A']);
	printf("WA x %d\n", vis['W' - 'A']);
	printf("TLE x %d\n", vis['T' - 'A']);
	printf("RE x %d\n", vis['R' - 'A']);
	return 0;
}



Measured memory_bytes: 3716
N = int(input())
P = list(map(float, input().split()))
dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[0][0] = 1
for i in range(1,N+1):
	for j in range(N+1):
		if j<=i:
			if j == 0:
				dp[i][j]=dp[i-1][j]*(1-P[i-1])
			else:
				dp[i][j]=dp[i-1][j-1]*P[i-1] + dp[i-1][j]*(1-P[i-1])
p=0
for i in range(N//2+1,N+1):
	p+=dp[-1][i]

print(p)

Measured memory_bytes: 223728
#include<bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  int num = a + b +c;
  if(num >= 22) {
      cout << "bust" << endl;
  } else {
      cout << "win" << endl;
  }
}

Measured memory_bytes: 256
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

H, W = list(map(int, sys.stdin.readline().split()))
A = np.array([list(sys.stdin.readline().rstrip()) for _ in range(H)])

ans = np.full(np.array(A.shape) + 2, '#', dtype=str)
ans[1:-1, 1:-1] = A
print('\n'.join(map(lambda r: ''.join(r), ans)))


Measured memory_bytes: 22340
#include <bits/stdc++.h>
using namespace std;
 int main() {
	int N,K;
   cin >> N >> K;
   int sum = 1;
     for(int i=0;i<N;i++){
       int sumA= sum + K;
       int sumB= sum*2;
       if(sumA >= sumB){
         sum=sumB;}
       if(sumB > sumA){
         sum = sumA;}
     }
   
   cout << sum << endl;
       
 }

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

int main() {
	int q;
	cin >> q;
	unordered_map<string, int> M;
	for (int i = 0; i < q; ++i) {
		int query;
		string key;
		cin >> query >> key;
		if (query == 0) {
			int x;
			cin >> x;
			M[key] = x;
		}
		else if (query == 1) cout << M[key] << endl;
		else M.erase(key);
	}
}


Measured memory_bytes: 26424
//To compile : type "$     g++ test.cpp -std=c++14 -I .    "
#include <atcoder/twosat>
#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("Ofast")
using namespace std;
using namespace atcoder;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
typedef pair<ll, ll> P;
const ll INF = (1LL<<60);

int main() {
    cin >> N >> K;
    vec x(N * 2);
	two_sat ts(N);
    rep(i, N) cin>>x[i]>>x[i + N];
    rep(i, N * 2){
        rep(j, i) {
            if(abs(x[i] - x[j]) < K) {
				ts.add_clause(i%N, i >= N, j%N, j >= N);
            }
        }
    }
    bool ok = ts.satisfiable();
    cout<<(ok ? "Yes" : "No")<<endl;
    if(ok){
		auto ans = ts.answer();
        rep(i, N){
            cout<<(ans[i] ? x[i] : x[i + N])<<endl;
        }
    }
}


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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define dbg(x) true
#endif

void solve(long long N, std::vector<long long> x, std::vector<long long> y) {
  vector<ll> a(N);
  REP(i, N) {
    a[i] = x[i] - y[i];
  }
  sort(ALL(a));
  ll ans = a[N - 1] - a[0];
  vector<ll> b(N);
  REP(i, N) {
    b[i] = x[i] + y[i];
  }
  sort(ALL(b));
  ans = max(ans, b[N - 1] - b[0]);
  cout << ans << endl;
}

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


Measured memory_bytes: 9524
n,y = map(int,input().split())

for i in range(n+1):
    for j in range(n+1-i):
        k = n-i-j
        if k >= 0:
            if 10000*i+5000*j+1000*k == y:
                print(i,j,k)
                exit()

print(-1,-1,-1)

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define mp make_pair
 
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<ll> > vvll;
 
#define PI 3.141592653589793
#define MOD 1000000007
 
int main()
{
    string a,b;int n=0;
    cin>>a;
    cin>>b;
    for(int i=0;i<a.size();i++)
    {
    	if(a[i]==b[i]) n++;
	}
	(n+1==b.size())?cout<<"Yes\n":cout<<"No\n";
	return 0;
}

Measured memory_bytes: 3636
// * template

#include <bits/stdc++.h>
#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

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

template<class T, class U> inline void fill_array(T &e, const U &v) { e = v; }
template<class T, class U, size_t s> inline void fill_array(T (&a)[s], const U &v) {for(auto&e:a)fill_array(e,v);}
template<class T, class U, size_t s> inline void fill_array(array<T, s> &a, const U &v) {for(auto&e:a)fill_array(e,v);}
template<class T, class U> inline void fill_array(vector<T> &a, const U &v) {for(auto&e:a)fill_array(e,v);}

struct range {
	typedef int Int;
	struct iter {
		Int i;
		const Int s;
		constexpr iter(const Int &i_, const Int &s_):i(i_), s(s_) {}
		constexpr bool operator!=(const iter &r) const { return s > 0 ? i < r.i : i > r.i; }
		constexpr const Int &operator*() const { return i; }
		iter &operator++() { i += s; return *this; }
	};
	const Int f, l, s;
	constexpr range(const Int &f_, const Int &l_, const Int &s_):f(f_), l(l_), s(s_) {}
	constexpr range(const Int &f_, const Int &l_):f(f_), l(l_), s(1) {}
	constexpr range(const Int &num):f(0), l(num), s(1) {}
	constexpr iter begin() const { return iter(f, s); }
	constexpr iter end() const { return iter(l, s); }
};

// * solve

void output(int index, int depth, const vector<string> &s, const vector<vector<int>> &children) {
	cout << string(depth, '.') << s[index] << endl;
	for(const auto &child : children[index]) {
		output(child, depth + 1, s, children);
	}
}

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

	int n;
	cin >> n;

	vector<vector<int>> children(n);
	vector<string> s(n);

	for(int i : range(n)) {
		int k;
		cin >> k >> s[i];
		if(i) children[k - 1].emplace_back(i);
	}

	output(0, 0, s, children);

	return EXIT_SUCCESS;
}

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

int main() {
  int K, A, B;
  cin >> K >> A >> B;
  
  for (int i = 1; i <= 1000/K+1; i++) {
    int t = K*i;
    if (A <= t && t <= B) {
      cout << "OK" << endl;
      return 0;
    }
  }
  
  cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  int num[n],pos = 0;
  string s[n];
  for(int t=0;t<n;t++){
    cin >> s[pos] >> num[pos];
    pos++;
    for(int tt=0;tt<pos-1;tt++){
      //cout << s[tt] << " " << s[pos-1] << endl;
      if(s[tt] == s[pos-1]){ 
	num[tt] += num[pos-1];
	pos--;
	break;
      }
    }

  }

  for(int i=0;i<pos;i++){
    for(int j=pos-1;j>i;j--){
      if(s[j].size()<s[j-1].size() || (s[j].size()==s[j-1].size() && s[j]<s[j-1])){
	swap(s[j],s[j-1]);
	swap(num[j],num[j-1]);
      }
    }
  }
  
  for(int i=0;i<pos;i++){
    cout << s[i] << " " << num[i] << endl;
  }

}

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

int main(void){
    int N,M,X; cin >> N >> M >> X;
    int left=0, right=0;
    for(int i=0; i<M; i++){
        int a; cin >> a;
        if(X<a) right++;
        else left++;
    }

    cout << min(right,left) << endl;
}

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

using namespace std;

int main(){ 
  int N; 
  cin >> N; 
  vector <int> v(N),cost(N);
  for(int  i = 0 ; i < N; i++) { 
    cin >> v[i]; 
  }
  cost[0] = 0 ; 
  cost[1 ] = abs( v[1] - v[0]); 
  int ans = 0 ; 
  for (int  i = 2 ; i < N;  i++){ 
    cost[i] = min(abs(v[i] - v[i-2]) + cost[i-2] , cost[i-1] + abs(v[i] - v[i -1] ));  
  } 
  cout << cost[N-1]  << endl; 
} 



Measured memory_bytes: 1024
#include "iostream"
#include "string.h"
using namespace std;
 
int main(){
 
  string S, T;
    
  cin >> S;
  cin >> T;
  
  T.pop_back();
  
  if(S == T) cout <<"Yes";
  else cout << "No";  
  
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    string S; cin >> S;
    rep(i,SZ(S)){
        int a=(int)(S[i]-'A');
        S[i]=(char)('A'+(a+N)%26);
    }
    cout << S << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a,b,c,d,e,f,x[10000],y[10000];
int main()
{
	cin>>a>>b>>c>>d>>e>>f;
	x[0]=y[0]=1;
	for(int i=0;i<=f;i++)
	{
		if(x[i])x[i+100*a]=x[i+100*b]=1;
		if(y[i])y[i+c]=y[i+d]=1;
	}
	int w=100*a,s=0;
	for(int i=100;i<=f;i+=100)
		if(x[i])for(int j=0;j<=min(i/100*e,f-i);j++)
			if(y[j]&&s*i<j*w)w=i,s=j;
	cout<<w+s<<' '<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a =  sc.nextInt();
		int b =  sc.nextInt();
		int r = a % b;
		int d = a / b;
		double f = (double)a / (double)b;
		System.out.print(d + " " + r + " ");
		System.out.printf("%.5f\n",f);
	}
}

Measured memory_bytes: 26480
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 205;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
vector<int> adj[MAXN];
queue<int> q;

int col[MAXN];
string s;
bool visited[MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    cin>>n;

    for(int i = 1; i <= n; i++){
        cin>>s;
        for(int j = 1; j <= n; j++){
            if(i > j){
                char c = s[j - 1];
                if(c == '0') continue;
                //cout<<i<<" "<<j<<endl;
                adj[i].push_back(j);
                adj[j].push_back(i);
            }
        }
    }

    int mx = -1;

    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            col[j] = 0;
            visited[j] = 0;
        }
        col[i] = 1;
        q.push(i);
        bool cn = 1;
        while(!q.empty()){
            int cur = q.front();
            q.pop();
            if(visited[cur]) continue;
            visited[cur] = 1;
            for(auto u: adj[cur]){
                if(col[u] != 0){
                    if(col[u] != col[cur] - 1 && col[u] != col[cur] + 1){
                        //cout<<i<<" "<<u<<" "<<cur<<endl;
                        //cout<<col[u]<<" "<<col[cur]<<endl;
                        cn = 0;
                        break;
                    }
                }else{
                    col[u] = col[cur] + 1;
                    q.push(u);
                }
            }
            if(!cn){
                while(!q.empty())
                    q.pop();
                break;
            }
        }
        if(!cn) continue;
        for(int j = 1; j <= n; j++){
            mx = max(mx, col[j]);
        }
    }
    cout<<mx<<endl;

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 512
string=list(input())
if int(string[0])==1:
    c=0
else:
    c=1
a=0
for s in string:
    if int(s)==0 and c==1:
        c-=1
    elif int(s)==0 and c==0:
        c+=1
        a+=1
    elif int(s)==1 and c==0:
        c+=1
    elif int(s)==1 and c==1:
        c-=1
        a+=1
print(a)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define SZ(a) int((a).size())
#define FI(i,a,b) for(int i=(a);i<=(b);++i)
#define FD(i,b,a) for(int i=(b);i>=(a);--i)
using namespace std;
using LL = long long;
using PII = pair<int, int>;

int main() {
    int n;
    cin >> n;
    vector<LL> A(n + 1), S(n + 1);
    FI(i, 1, n) scanf("%lld", &A[i]);
    FI(i, 1, n) S[i] = S[i - 1] + A[i];
    auto calc = [&](int l, int r) {
        auto check = [&](LL dis) {
            int ll = l + 1, rr = r;
            while (ll < rr) {
                int m = (ll + rr) / 2;
                LL left = S[m - 1] - S[l - 1];
                LL right = S[r - 1] - S[m - 1];
                if (abs(left - right) <= dis) return m;
                if (left > right) rr = m;
                else ll = m + 1;
            }
            return -1;
        };
        LL mi = 0, ma = 1LL << 32;
        while (mi < ma) {
            LL dis = (mi + ma) / 2;
            int pos = check(dis);
            // printf("%d, %d: (%lld, %d)\n", l, r, dis, pos);
            if (pos != -1) ma = dis;
            else mi = dis + 1;
        }
        int pos = check(mi);
        assert(pos != -1);
        LL left = S[pos - 1] - S[l - 1];
        LL right = S[r - 1] - S[pos - 1];
        return make_pair(left, right);
    };
    LL ans = 1LL << 32;
    for (int d = 3; d <= n - 1; d++) {
        auto p = calc(1, d);
        auto q = calc(d, n + 1);
        vector<LL> T;
        T.push_back(p.first);
        T.push_back(p.second);
        T.push_back(q.first);
        T.push_back(q.second);
        sort(T.begin(), T.end());
        LL tmp = T[3] - T[0];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,k,Q,a[100009];
int sol(int X){
  priority_queue<int,vector<int>,greater<int> >q,ANS;
  for(int i=0;i<n;i++){
    if(a[i]<X){L:;
      while(q.size()>=k)ANS.push(q.top()),q.pop();
      while(!q.empty())q.pop();
    }
    else q.push(a[i]);
    if(q.size()&&i==n-1)goto L;
  }
  if(ANS.size()<Q)return 1e9;
  int MIN=ANS.top(),cnt=1;
  while(cnt++!=Q)ANS.pop();
  return ANS.top()-MIN;
}
int main(){
  cin>>n>>k>>Q;
  r(i,n)cin>>a[i];
  int ans=1e9;
  r(i,n)ans=min(ans,sol(a[i]));
  cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int Solve(int N, long K, Tuple<int, int>[] tuples)
        {
            Array.Sort(tuples);
            foreach (var tuple in tuples)
            {
                if (K <= tuple.Item2) { return tuple.Item1; }
                K -= tuple.Item2;
            }
            return tuples.Last().Item1;
        }
        static void Main(string[] args)
        {
            long[] v1 = ReadLongs();
            int N = (int)v1[0];
            long K = v1[1];
            var tuples = new Tuple<int, int>[N];
            for (int i = 0; i < N; ++i)
            {
                int[] v2 = ReadInts();
                tuples[i] = new Tuple<int, int>(v2[0], v2[1]);
            }
            Console.WriteLine(Solve(N, K, tuples));
        }
    }
}


Measured memory_bytes: 20328
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
  int N;
  while(cin >> N, N){
	//vector<PII> tms;
	int range[24*60*60+1];
	fill(range, range+24*60*60+1, 0);
	REP(i,N){
	  int h[2], m[2], s[2];
	  scanf("%2d:%2d:%2d", &h[0], &m[0], &s[0]);
	  scanf("%2d:%2d:%2d", &h[1], &m[1], &s[1]);
	  int st = h[0]*60*60+m[0]*60+s[0], et = h[1]*60*60+m[1]*60+s[1];
	  ++range[st], --range[et];
	}
	//SORT(tms);
	int ans = 0, acc = 0;
	REP(i,24*60*60){
	  acc += range[i];
	  ans = max(ans, acc);
	}
	cout << ans << endl;
  }  
  
  return 0;
}

Measured memory_bytes: 1572
#include <bits/stdc++.h>
using namespace std;
int i,j,k,n,m,x,y,t,a[100010],ans;
int get(int x,int y){if (x==0)return 0;return (x-1)/y+1;}
int main(){
	scanf("%d%d",&n,&k);ans=1013687232;
	for (i=1;i<=n;i++)scanf("%d",&a[i]);
	for (i=1;i<=n;i++)if (a[i]==1){x=i;break;}
	for (i=max(x+k-n,1);i<=min(x,k);i++)ans=min(ans,get(x-i,k-1)+get(n-(x-i+k),k-1)+1);
	printf("%d\n",ans);
	return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];

        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        sc.close();

        Arrays.sort(nums);

        int max = nums[n - 1];
        int mid = 0;

        for (int i = 0; i < n; i++) {
            if (mid < Math.min(nums[i], nums[n - 1] - nums[i])) {
                mid = nums[i];
            }
        }
        System.out.println(max + " " + mid);
    }
}

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

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  int l = a + b;
  int r = c + d;
  if(l > r) cout<<"Left"<<endl;
  else if(l < r) cout<<"Right"<<endl;
  else cout<<"Balanced"<<endl;
  return 0;
}

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

long long N, A[200100];
long long psum[200100], pxor[200100];
long long ans = 0;

long long sum(int L, int R) {
	return psum[R]-psum[L-1];
}

long long sor(int L, int R) {
	return pxor[R]^pxor[L-1];
}

int main () {
	cin >> N;
	for(int i=1; i<=N; i++) {
		cin >> A[i];
		psum[i] = psum[i-1] + A[i];
		pxor[i] = pxor[i-1] ^ A[i];
	}
	for(int i=1; i<=N; i++) {
		int ki = i;
		int ka = N;
		int res= i;
		while(ki <= ka) {
			int mid = (ki+ka)/2;
			if (sum(i,mid)==sor(i,mid)) {
				res = mid;
				ki = mid+1;
			} else {
				ka = mid-1;
			}
		}
		//cout << i << " " << res << endl;
		ans += res-i+1;
	}
	cout << ans << endl;
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld PI = acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
//const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    int h,n;
    string s; cin >> h >> n;
    vi a(n); rep(i,n) cin  >> a[i];
    int sum = 0;
    rep(i,n) sum += a[i];
    cout << (sum>=h ? "Yes" : "No") <<'\n';

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<string.h>
int main(void)
{
    int i=0,j=0,k,tmp;
    char s[101],t[101];
    scanf("%s%s",s,t);
    while(s[i]!='\0'){
        k=i;
        while(s[k]!='\0'){
            if(s[i]>s[k]){
                tmp=s[i]; s[i]=s[k]; s[k]=tmp;
            }
            k++;
        }
        i++;
    }
    while(t[j]!='\0'){
        k=j;
        while(t[k]!='\0'){
            if(t[j]<t[k]){
                tmp=t[j]; t[j]=t[k]; t[k]=tmp;
            }
            k++;
        }
        j++;
    }
    if(strcmp(s,t)<0)
        printf("Yes\n");
    else 
        printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){

    long int a[20][20],b[20],i,j,n,m,c,count=0;long int sum;
    
    cin>>n>>m>>c;
    
    for(i=0;i<m;i++)
    cin>>b[i];
    
    for(i=0;i<n;i++)
     for(j=0;j<m;j++)
       {cin>>sum;a[i][j] = sum*b[j];}
     
    for(i=0;i<n;i++){
		sum=c;
		for(j=0;j<m;j++)
		 sum+=a[i][j];
		 
		if(sum>0)count++;
		 
	}
	cout<<count;
    
 }





Measured memory_bytes: 3596
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
#define MX 200
int main(){
	map<int, int> mp;
	int a,tp;
	cin >> a;
	for (int i = 0; i < a; i++) {
		cin >> tp;
		mp[tp]++;
	}
	int ans = 0;
	map<int, int>::iterator it;
	for (it = mp.begin(); it != mp.end(); it++) {
		if ((it->second) & 1)
			ans++;
	}
	printf("%d", ans);
//	system("pause");
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define my_max(a, b) ((a) > (b) ? (a) : (b))
#define my_min(a, b) ((a) < (b) ? (a) : (b))
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i, s, t) for(int i = (int)(s); i <= (int)(t); i++)
#define rev(i, t, s) for(int i = (int)(t); i >= (int)(s); i--)
#define lson rt << 1
#define rson rt << 1 | 1
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double lb;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<int> VI;
typedef std::vector<ll> VL;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> rbtree;
ll gcd(ll x, ll y){ return y % x == 0 ? x : gcd(y % x, x); }
template<class T>T my_abs(T a){ if(a < 0) a = -a; return a; }
inline ll read(){
    ll ret = 0, sign = 1;
    char c = getchar();
    while(c < '0' || c > '9'){ if(c == '-') sign = -1; c = getchar();}
    while(c >= '0' && c <= '9'){ ret = ret * 10 + c - '0'; c = getchar(); }
    return ret * sign;
}
inline void write(ll x){
    if(x < 0){
        putchar('-');
        x = -x;
    }
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

//void expand_stack_space(){
//    int size = 256 << 20; // 256MB
//    char *p = (char*)malloc(size) + size;
//    __asm__("movl %0, %%esp\n" :: "r"(p));
//}

int main(){
#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    string s;
    cin >> s;
    string a = "ABC", b = "ARC";
    if(s == a) cout << b << "\n";
    else cout << a << "\n";
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<P> a(n);
  rep(i, n) {
    cin >> a.at(i).first;
    a.at(i).second = i+1;
  }
  sort(all(a));
  rep(i, n) cout << a.at(i).second << " ";
}

Measured memory_bytes: 1536