akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;

const int INF = 1000000;
const int di[4] = {0, 1, 0, -1};
const int dj[4] = {1, 0, -1, 0};
int h, w;
char maze[60][60];
int d[60][60];

int bfs(int si, int sj, int gi, int gj){
  queue<P> que;
  que.push(P(si, sj));
  d[si][sj] = 0;
  while(que.size()){
    P p = que.front(); que.pop();
    if(p.first == gi && p.second == gj){
      cerr << "a" << endl;
      break;
    }
    rep(i, 4){
      int ni = p.first + di[i], nj = p.second + dj[i];
     // cerr << ni << " "<< nj << endl;
      if(0 <= ni && 0 <= nj && ni < h && nj < w && maze[ni][nj] != '#' &&
         d[ni][nj] == INF){
        cerr << ni << " "<< nj << endl;
        que.push(P(ni, nj));
        d[ni][nj] = d[p.first][p.second] + 1;
      }
    }
  }
  return d[gi][gj];
}
int main(){
  cin >> h >> w;
  int black = 0;
  rep(i, h){
    rep(j, w){
      cin >> maze[i][j];
      if(maze[i][j] == '#'){
        black++;
      }
      d[i][j] = INF;
    }
  }
  //rep(i, h){rep(j, w)cerr << d[i][j]; cerr << endl;}
  //cerr <<  bfs(0, 0, h - 1, w - 1) <<" "<< black<<endl;
  int dist = bfs(0, 0, h - 1, w - 1);
  if(dist == INF){
    cout << -1 << endl;
  }else{
    cout << h * w - dist - black - 1<< endl;
  }
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;

char str[1000];

signed main()
{
	cin >> str;
	int len = strlen(str);
	REP(i, len) cout << "x";
	cout << endl;
}


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

namespace Stack
{
    class Program
    {
        static void Main(string[] args)
        {
            var stack = new Stack<int>(); 
            foreach(var s in Console.ReadLine().Split(' '))
            {
                switch(s)
                {
                    case "+":
                        stack.Push(stack.Pop() + stack.Pop());
                        break;
                    case "-":
                        int a = stack.Pop();
                        int b = stack.Pop();
                        stack.Push(b - a);
                        break;
                    case "*":
                        stack.Push(stack.Pop() * stack.Pop());
                        break;
                    default:
                        stack.Push(int.Parse(s));
                        break;
                }
            }
            Console.WriteLine(stack.Pop());
        }
    }
}



Measured memory_bytes: 16380
N = int(input())
ABs = []
for i in range(N - 1):
    ABs.append(tuple(map(int, input().split())))

Cs = [0] * (N + 1)
Tr = [[] for _ in range(N + 1)]
for i in range(N - 1):
    Cs[ABs[i][0]] += 1
    Cs[ABs[i][1]] += 1
    p = min(ABs[i][0], ABs[i][1])
    c = max(ABs[i][0], ABs[i][1])
    Tr[p].append((c, i))
K = max(Cs)
print(K)

import collections

d = collections.deque()
d.append(1)

Pc = [0] * (N + 1)
Nc = [1] * (N + 1)
ABsc = [0] * (N + 1)
Cis = [1] * N
while (len(d) > 0):
    p = d.popleft()
    for (c, i) in Tr[p]:
        d.append(c)
        col = Nc[p]
        if Pc[p] == col:
            col += 1
        Nc[p] = col + 1
        Pc[c] = col
        Cis[i] = col

for i in range(N - 1):
    print(Cis[i])

Measured memory_bytes: 85720
#include <bits/stdc++.h>  
using namespace std;
using ll = long long int;

int main() {
  ll n; cin>>n;
  ll k= n/ 11;
  ll ans= 2*k;
  ll r=n % 11;
  if(r!=0){ans++;}
  if(r>6){ans++;}
  cout<<ans;
}



Measured memory_bytes: 3604
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""
s = input()[:-1]
ss = input()[:-1]

for i in range(len(s)):
    if s[i] != ss[i]:
        print("No")
        exit()

print("Yes")






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

using namespace std;

int n, m, a[105], sum;

int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	int ans = 0;
	for(int i = 1; i <= n; i++)
		if(a[i] * 4 * m >= sum) ans++;
	if(ans >= m) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	
	private static Scanner sc;
	
	public static void main (String args[]) {
		sc = new Scanner(System.in);
		//f(n)のnを取得 1<=n<=10^4
		int n = Integer.parseInt(sc.next());
		int[] result = culc(n);
		for(int res : result) {
			System.out.println(res);
		}
	
	}
	
	private static int[] culc(int n) {
		int[] result = new int[n];
		for (int x=1; x<n; x++) {
			for (int y=1; y<n; y++) {
				for (int z=1; z<n; z++) {
					int ans =x*x + y*y + z*z + x*y + y*z + z*x;
					if (ans<=n) {
						result[ans-1]++;
					} else {
						break;
					}
				}
			}
		}
		return result;
	}
		
}


Measured memory_bytes: 38932
ma = lambda: map(int, input().split())
t,u = ma(); a,c = ma(); b,d = ma()
p = (a-b)*t; q = (c-d)*u
if p < 0: p *= -1; q *= -1
if p+q > 0: print(0)
elif p+q == 0: print('infinity')
else:
  t = -p-q
  print(1+(p//t)*2 if p%t else (p//t)*2)

Measured memory_bytes: 3064
from collections import deque
H,W=map(int,input().split())
Ch,Cw=map(int,input().split())
Dh,Dw=map(int,input().split())
Ch-=1;Cw-=1;Dh-=1;Dw-=1
C=(Ch,Cw)
D=(Dh,Dw)
S=[list(input()) for i in range(H)]
dist=[[10**15 for j in range(W)] for i in range(H)]
dist[Ch][Cw]=0
q=deque([C])
dx=[1,0,-1,0]
dy=[0,1,0,-1]
while(len(q)>0):
    x,y=q.popleft()
    for k in range(4):
        nx=x+dx[k]
        ny=y+dy[k]
        if 0<=nx<H and 0<=ny<W:
            if S[nx][ny]=="#":
                continue
            if dist[nx][ny]>dist[x][y]:
                dist[nx][ny]=dist[x][y]
                q.appendleft((nx,ny))
    for i in range(-2,3):
        for j in range(-2,3):
            nx=x+i
            ny=y+j
            if 0<=nx<H and 0<=ny<W:
                if S[nx][ny]=="#":
                    continue
                if dist[nx][ny]>dist[x][y]+1:
                    dist[nx][ny]=dist[x][y]+1
                    q.append((nx,ny))
if dist[Dh][Dw]==10**15:
    print(-1)
else:
    print(dist[Dh][Dw])


Measured memory_bytes: 130788
#include <bits/stdc++.h>
// Hey! 僕の提出を見てくれてありがとう.
// ロボ子さん可愛いぞ！！！！！君もV沼にはまろう↓
// https://www.youtube.com/channel/UCDqI2jOz0weumE8s7paEk6g
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;// 任意長整数型
using bint = mp::cpp_int;// 仮数部長が32の浮動小数点数型
using real32 = mp::number<mp::cpp_dec_float<32>>;// 仮数部長が1024の浮動小数点数型
using real1024 = mp::number<mp::cpp_dec_float<1024>>;// ついでに有理数型
using rat = boost::rational<bint>;
*/
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
//sortを降順にする時は greater<型>()
ll n,ans=LLONG_MIN,minv = LLONG_MAX;
vector<ll> a;
int main(){ //srand((unsigned)time(NULL));
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  minv = a[0];
  for (int i = 1; i < n; i++) {
    ans = max(ans,a[i] - minv);
    minv = min(minv,a[i]);
  }
  cout << ans << endl;
}



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

int main(){
  string s;
  cin >> s;
  int hazime = 0;
  int saigo = 0;
  rep(i,s.size()){
   if(s[i] == 'A') {
     hazime = i;
     break;
   }
  }
   for(int i = s.size();i>0;i--){
     if(s[i] == 'Z'){
       saigo = i;
       break;
     }
  }
    cout << saigo - hazime + 1 << endl;
}


Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, k;
	cin>>a>>b>>k;
	int gcd = __gcd(a,b);
	vector<int> div;
	for(int i = 1; i <= sqrt(gcd);i++)
	{
		if(gcd % i == 0)
		{
			div.push_back(i);
			if(gcd/i!=i)
				div.push_back(gcd/i);
		}
	}
	sort(div.begin(),div.end());
	reverse(div.begin(),div.end());
	cout<<div[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

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

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var x int

const MAX = 100000

func main() {
	sc.Split(bufio.ScanWords)
	x = nextInt()

	ans := 0
	for i := x; x <= MAX; i++ {
		if isPrime(i) {
			ans = i
			break
		}
	}

	fmt.Println(ans)
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            Calc calc = new Calc();
            string str;
            List<int> n = new List<int>();
            List<int> result = new List<int>();

            while ((str = Console.ReadLine()) != null)
            {
                 n.Add(int.Parse(str));
            }

            for (int i = 0; i < n.Count(); i++)
            {
                bool[] number = new bool[n[i]+1];
                number = calc.PrimeNumber(n[i]);
                int count = 0;
                for (int j = 0; j <= n[i]; j++)
                {
                    if (number[j] == false)
                    {
                        count += 1;
                    }
                }
                result.Add(count);
            }

            foreach (int item in result)
            {
                Console.WriteLine(item);
            }
        }
    }

    class Calc
    {
        internal bool[] PrimeNumber(int n)
        {
            bool[] number = new bool[n+1];

            number[0] = true;
            number[1] = true;

            for (int i = 2; i <= n; i++)
            {
                if (number[i] == false)
                {
                    for (int j = i * 2 ; j <= n; j += i)
                    {
                        number[j] = true;
                    }
                }
                else
                {
                    continue;
                }
            }
            return number;
        }
    }

}




Measured memory_bytes: 34620
#include<bits/stdc++.h>
#define inf 1000000000000
#define int long long int
#define hell (int)(1e9+7)

using namespace std;

void solve(){
    int x;
    cin>>x;
    for(int a=1;a<=2000;a++){
        for(int b=-2000;b<=2000;b++){
            int p1,p2;
            p1=pow(a,5);
            p2=pow(b,5);
            if(p1-p2==x){
                cout<<a<<" "<<b;
                return;
            }
        }
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 4240
#include<cstdio>
#include<cstring>
#include<iostream>

using namespace std;
string s1;
int main()
{
  cin>>s1;
  if(s1.length()%2 != 0){printf("No");return 0;}
  for(int i=0;i<s1.length();i++)if((i%2 == 0 && s1[i]!='h' )|| (i%2 != 0 && s1[i]!='i')){printf("No");return 0;}
  printf("Yes");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using min_pqueue = priority_queue<ll, vector<ll>, greater<ll>>;

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

  vector<ll> v(N + 1);
  for (ll i = 1; i <= N; i++) {
    cin >> v[i];
  }

  ll min_val = -1e8;
  vector<vector<vector<ll>>> dp(N + 2, vector<vector<ll>>(N + 2, vector<ll>(K + 1, min_val)));
  vector<vector<vector<min_pqueue>>> q(N + 2, vector<vector<min_pqueue>>(N + 2, vector<min_pqueue>(K + 1)));
  dp[1][N][K] = 0;

  for (ll i = 1; i <= N + 1; i++) {
    for (ll j = N; 0 <= j; j--) {
      for (ll k = K; 1 <= k; k--) {
        if (i <= N && 1 <= k && i <= j && dp[i + 1][j][k - 1] < dp[i][j][k] + v[i]) {
          dp[i + 1][j][k - 1] = dp[i][j][k] + v[i];
          q[i + 1][j][k - 1] = q[i][j][k];
          q[i + 1][j][k - 1].push(v[i]);
        }
        if (0 < j && 1 <= k && i <= j && dp[i][j - 1][k - 1] < dp[i][j][k] + v[j]) {
          dp[i][j - 1][k - 1] = dp[i][j][k] + v[j];
          q[i][j - 1][k - 1] = q[i][j][k];
          q[i][j - 1][k - 1].push(v[j]);
        }
        if (!q[i][j][k].empty() && dp[i][j][k - 1] < dp[i][j][k] - q[i][j][k].top()) {
          dp[i][j][k - 1] = dp[i][j][k] - q[i][j][k].top();
          q[i][j][k - 1] = q[i][j][k];
          q[i][j][k - 1].pop();
        }
        if (dp[i][j][k - 1] < dp[i][j][k]) {
          dp[i][j][k - 1] = dp[i][j][k];
          q[i][j][k - 1] = q[i][j][k];
        }
      }
    }
  }

  ll ans = min_val;
  for (ll i = 0; i <= N + 1; i++) {
    for (ll j = 0; j <= N + 1; j++) {
      ans = max(ans, dp[i][j][0]);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 67584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			String s = in.next();
			String t = in.next();
			int a = in.nextInt();
			int b = in.nextInt();
			String u = in.next();
			if(s.equals(u)) {
				System.out.print(a - 1 + " ");
				System.out.println(b);
			}else {
				System.out.print(a + " ");
				System.out.println(b - 1);
			}
		}
	}

	static boolean permutation_2(String s, String t) {
		if (s.length() != t.length()) {
			return false;
		}

		int[] letters = new int[256];

		char[] s_array = s.toCharArray();
		for (char c : s_array) {
			letters[c]++;
		}

		for (int i = 0; i < t.length(); i++) {
			int c = (int) t.charAt(i);
			if (--letters[c] < 0) {
				return false;
			}
		}
		return true;
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}


Measured memory_bytes: 22612
import math
def dist(A,B):
    a,b = A
    c,d = B
    return math.sqrt((a-c)**2 + (b-d) **2)
import itertools
N = int(input())
L = list(itertools.permutations([_ for _ in range(1,N+1)]))
res = 0
City = []
for _ in range(N):
    x,y = map(int,input().split())
    City.append((x,y))
for s in L:
    for i in range(0,len(s)-1):
        res += dist(City[s[i]-1],City[s[i+1]-1])
print(res/math.factorial(N))

Measured memory_bytes: 8052
N = int(input())
word_list = ["AC","WA","TLE","RE"]
count_list = [0,0,0,0]
for i in range(N):
    word_ = input()
    count_list[word_list.index(word_)] += 1

for i in range(4):
    print(word_list[i]," x ",count_list[i])

Measured memory_bytes: 9164
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
  int cnt = 0, W, N;
  static int v[1000], w[1000], dp[1000+1][1000+1];
  while (~scanf("%d\n", &W)) {
    if (W == 0)
      break;

    for (int i = 0; i < 1001; ++i) {
      for (int j = 0; j < 1001; ++j)
	dp[i][j] = 0;
    }

    scanf("%d\n", &N);
    for (int i = 0; i < N; ++i)
      scanf("%d,%d\n", &v[i], &w[i]);

    int maxV = -1, minW = 1 << 30;
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j <= W; ++j) {
	if (j < w[i])
	  dp[i+1][j] = dp[i][j];
	else
	  dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
	if (maxV < dp[i+1][j]) {
	  maxV = dp[i+1][j];
	  minW = j;
	} else if (maxV == dp[i+1][j]) {
	  minW = min(minW, j);
	}
      }
    }

    ++cnt;
    printf("Case %d:\n%d\n%d\n", cnt, maxV, minW);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
    string s;
  	cin >> s;
    cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	char c ;
	cin >> c;
	if (c == 'A') {
		cout << "T\n";
	} else if (c == 'T') {
		cout << "A\n";
	} else if (c == 'C') {
		cout << "G\n";
	} else {
		cout << "C\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,t,ans=1001;
  cin >>n>>t;
  for(int i=0;i<n;i++){
    int a,b;
    cin >>a >>b;
    if(b<=t){
      ans = min(ans,a);
    }
  }
  if(ans!=1001){
    cout << ans <<endl;
  }
  else{
    cout << "TLE" << endl;
  }
}
  

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<queue>
#include<utility>
#include<cmath>
#include<sstream>
#include<istream>

using namespace std;


int main()
{

  int X,Y;
  cin >> X >> Y;

  if(X>3) X = 4;
  if(Y>3) Y = 4;

  int ans;
  ans = 100000*(4-X) + 100000*(4-Y);
  if(X*Y == 1)  ans += 400000;

  cout << ans << 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 repr(i, n) for (int i = (int)(n); i > 0; i++)
const int MOD =1e9+7;
using ll = long long;

int main(){
    int n, ans=0;
    string s;
    cin >> n >> s;
    set<string> cnt1,cnt2,cnt3;
    for(int i=0; i<n; i++){
        string L= "@@@";
        L[0]=s[i];
        if(cnt1.count(L)) continue;
        cnt1.insert(L);
        for(int j=i+1; j<n; j++){
            L[1]=s[j];
            if(cnt2.count(L)) continue;
            cnt2.insert(L);
            for(int k=j+1; k<n; k++){
                L[2]=s[k];
                if(cnt3.count(L)) continue;
                cnt3.insert(L);
                ans++;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include<stdio.h>

struct record{
	double a;
    double b;
};
int main(void)
{
    int a,i;
    double sum=0;
  
    scanf("%d",&a);
  
    struct record c[10000];
  
    for(i=0;i<a;i++){
    	scanf("%lf",&c[i].a);
     	c[i].b = 1.0 / c[i].a;
  		sum = sum + c[i].b;
    }
    printf("%f",1.0/sum);
	return 0; 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = INT32_MAX;
const ll INFL = INT64_MAX;
const int mod = 1e9 + 7;

template <typename T>
void print_vec(vector<T> v) {
  for (T i : v) cout << i << " ";
  cout << endl;
}

int main() {
  int x, n;
  cin >> x >> n;
  map<int, bool> p;
  rep(i, n) {
    int y;
    cin >> y;
    p[y] = true;
  }
  int ans = 0;
  int mn = INF;
  for (int i = 102; i >= 0; i--) {
    if (p[i]) continue;
    if (abs(x - i) <= mn) {
      mn = abs(x - i);
      ans = i;
    }
  }
  std::cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>

int main() {

  char X;
  char Y;

  std::cin >> X >> Y;

  if (X < Y) {
    std::cout << "<" << std::endl;
  } else if (X > Y) {
    std::cout << ">" << std::endl;
  } else if (X == Y) {
    std::cout << "=" << std::endl;
  }
  return 0;
}

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

int main() {
    int n, a, count4 = 0, count2 = 0;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> a;
        if(a%4 == 0) {
            count4++;
        } else if(a%2 == 0) {
            count2++;
        }
    } 

    if(count2 == 0) {
        if(count4 >= n/2) {
            cout << "Yes" << "\n";
        } else {
            cout << "No" << "\n";
        }
    } else {
        if(count4 >= (n-count2+1)/2) {
            cout << "Yes" << "\n";
        } else {
            cout << "No" << "\n";
        }
    }
}


Measured memory_bytes: 256
S = input()

UP = int(S) // 100
DN = int(S) % 100
if UP > 0 and UP < 13 and DN > 0 and DN < 13:
    print("AMBIGUOUS")
elif UP > 0 and UP < 13:
    print("MMYY")
elif DN > 0 and DN < 13:
    print("YYMM")
else:
    print("NA")

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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;

#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n-1; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second

template<typename T>
ll sz(vector<T> &vec){ return (ll)vec.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>> &pq) {return (ll)pq.size(); }
template<typename T>
ll sz(priority_queue<T, vector<T>, greater<T>> &pq) {return (ll)pq.size(); }
ll sz(string &s) {return (ll)s.size(); } 
ll gcd(ll a,ll b){ return ((!b) ?a :gcd(b, a%b)); }
ll lcm(ll a,ll b){ return a / gcd(a,b) * b; }
bool checkindex(ll i,ll n){ return (i < n && i >= 0); }

int main(){
    ll n,m;
    cin >> n >> m;
    
    ll d[n][n] = {};
    rep(i,0,n) rep(j,0,n) d[i][j] = ((i == j)?0:LINF);
    
    ll a[m],b[m],c[m];
    rep(i,0,m){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;b[i]--;
        d[a[i]][b[i]] = c[i]; d[b[i]][a[i]] = c[i];
    }

    rep(k,0,n) rep(i,0,n) rep(j,0,n) d[i][j] = min(d[i][j],d[i][k]+d[k][j]);

    ll cnt = 0;
    rep(i,0,m) if(d[a[i]][b[i]] != c[i]) cnt++;
    
    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 3672
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] stringArray = br.readLine().split("\\s");

		Stack<Integer> que = new Stack<Integer>();
		int a = 0;
		int b = 0;
		for (int i = 0; i < stringArray.length; i++) {
			if (stringArray[i].equals("+")) {
				a = que.pop();
				b = que.pop();
				que.add(b + a);
				continue;
			}
			if (stringArray[i].equals("-")) {
				a = que.pop();
				b = que.pop();
				que.add(b - a);
				continue;
			}
			if (stringArray[i].equals("*")) {
				a = que.pop();
				b = que.pop();
				que.add(b * a);
				continue;
			}
			if (stringArray[i].equals("/")) {
				a = que.pop();
				b = que.pop();
				que.add(b + a);
				continue;
			}
			que.push(Integer.parseInt(stringArray[i]));
		}
		System.out.println(que.pop());
	}
}

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

int main() {
  int N,A,B;
  1 <= N <= 20;
  1 <= A <= 100;
  1 <= B <= 2000;
  cin >> N >> A >> B;
  if (A*N <= B) {
    cout << A*N << endl;
  } else {
    cout << B << endl;
  }
}


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

struct Node {
	int pos, type;
	bool operator < (const Node & obj) {return pos < obj.pos;}
};
 
vector <Node> v[4];
stack <int> stk;
int R, C, n;

inline void add (int x, int y, int type) {
	if (x == 0) v[0].push_back({y,type});
	else if (y == 0) v[1].push_back({x,type});
	else if (x == R) v[2].push_back({y,type});
	else if (y == C) v[3].push_back({x,type});
}

int main (void) {
	int a, b, c, d;
	scanf("%d%d%d", &R, &C, &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d%d%d", &a, &b, &c, &d);
		if ((a == 0 || b == 0 || a == R || b == C) && (c == 0 || d == 0 || c == R || d == C)) {
			add(a,b,i);
			add(c,d,i);
		}
	}
	for (int i = 0; i <= 3; i++) {
		sort(v[i].begin(),v[i].end());
	}
	for (int i = (int)v[0].size() - 1; i >= 0; i--) {
		if (!stk.empty() && v[0][i].type == stk.top()) stk.pop(); 
		else stk.push(v[0][i].type);
	}
	for (int i = 0; i < (int)v[1].size(); i++) {
		if (!stk.empty() && v[1][i].type == stk.top()) stk.pop(); 
		else stk.push(v[1][i].type);
	}
	for (int i = 0; i < (int)v[2].size(); i++) {
		if (!stk.empty() && v[2][i].type == stk.top()) stk.pop();
		else stk.push(v[2][i].type); 
	} 
	for (int i = (int)v[3].size() - 1; i >= 0; i--) {
		if (!stk.empty() && v[3][i].type == stk.top()) stk.pop();
		else stk.push(v[3][i].type);
	}

	printf("%s\n", stk.empty() ? "YES" : "NO");
}

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

int main() {
	int x, y;
	
	int groups[] = {0, 1, 2, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1};
	
	cin >> x >> y;
	cout << (groups[x] == groups[y]?"Yes":"No") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath> // 変数名にy1が使えなくなるかも…。
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>

typedef __int128_t int128_t;
std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
    long long tmp; input >> tmp; value = tmp;
    return input;
}
std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
    output << (long long)value;
    return output;
}

const int MAX_N = 100050;
int N;
int128_t A, B;
int128_t X[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N >> A >> B;
    
    for (int i = 1; i <= N; i++) {
        std::cin >> X[i];
    }

    int128_t ret = 0;
    for (int i = 2; i <= N; i++) {
        ret += std::min(A*(X[i] - X[i-1]), B);
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 1792
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int N;
string S;
int K;

signed main(){

    in(N,S,K);
    char c=S[K-1];
    rep(i,N){
        if(S[i]!=c){
            cout<<'*';
        }else{
            cout<<S[i];
        }
    }
    cout<<endl;

    return 0;
}


Measured memory_bytes: 256
use proconio::*;
use proconio::marker::Usize1;
use std::cmp::*;

#[fastout]
fn run() {
    input! {
        n: usize,
        m: usize,
        s: usize,
        e: [(Usize1, Usize1, usize, u64); m],
        p: [(usize, u64); n],
    }
    let mut g = vec![vec![]; n];
    for (a, b, c, d) in e {
        g[a].push((b, c, d));
        g[b].push((a, c, d));
    }
    let w = 50 * 49;
    let mut dp = vec![vec![std::u64::MAX; w + 1]; n];
    dp[0][std::cmp::min(w, s)] = 0;
    let mut h = std::collections::BinaryHeap::new();
    h.push(Reverse((0, 0, std::cmp::min(w, s))));
    while let Some(Reverse((d, v, k))) = h.pop() {
        if d > dp[v][k] {
            continue;
        }
        for &(u, a, b) in g[v].iter() {
            if a > k {
                continue;
            }
            let d = d + b;
            if d < dp[u][k - a] {
                dp[u][k - a] = d;
                h.push(Reverse((d, u, k - a)));
            }
        }
        let d = d + p[v].1;
        let k = std::cmp::min(k + p[v].0, w);
        if dp[v][k] > d {
            dp[v][k] = d;
            h.push(Reverse((d, v, k)));
        }
    }
    for dp in dp.into_iter().skip(1) {
        let ans = dp.into_iter().min().unwrap();
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 4656
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


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


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


X = z()
if(X >= 30):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 42220
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; long long A, B; cin >> N >> A >> B; 
	if(A > B) swap(A, B); 
	long long S[100010] = {}; 
	S[0] = -2e18; 
	for(int i = 1; i <= N; i++) cin >> S[i]; 
	for(int i = 2; i <= N; i++){
		if(S[i] - S[i-2] < A){
			cout << 0 << endl; return 0; 
		}
	}
	int P = 1000000007; 
	int dp[100010] = {}; 
	int DP[100010] = {}; // 累積和
	int L = 0; int R = 0; // 最後にBに割り振った可能性として[L, R)がありうる 
	dp[0] = 1; DP[0] = 1; 
	for(int i = 1; i <= N; i++){
		if(i >= 2 && S[i-1] - S[i-2] < A) L = i-2; // 最後にBに割り振った番号はL以上
		while(R < L || S[i] - S[R] >= B) R++; // 最後にBに割り振った番号はR未満
		dp[i] = P + DP[R-1] - (L > 0 ? DP[L-1] : 0); 
		if(dp[i] >= P) dp[i] -= P; 
		DP[i] = DP[i-1] + dp[i]; 
		if(DP[i] >= P) DP[i] -= P; 
	}
	if(S[N] - S[N-1] < A) L = N-1; 
	int ans = P + DP[N] - (L > 0 ? DP[L-1] : 0); 
	if(ans >= P) ans -= P; 
	cout << ans << endl; 
}

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

bool isprime(int n) {
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (int i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;
  for (int i = n; ; i++) {
    if (isprime(i)) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm> 
using namespace std;
	int a[500000];
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	long long min=999999999;
	for(int i=0;i<n-m+1;i++){
		if((a[i+m-1]-a[i])<min)
		{
			min=a[i+m-1]-a[i];
			
		}
	}
cout<<min;
} 

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

int main(){
    int N;
    vector<int> value(N);
    vector<int> cost(N);
    vector<int> test(N);

    cin >>N;
    for(int i=0;i<N;i++){
       cin >> value.at(i);

    }
    for(int i=0;i<N;i++){
        cin >>cost.at(i);
    }
    for(int i=0;i<N;i++){
        test.at(i)=value.at(i)-cost.at(i);
    }

    sort(test.begin(),test.end());
  	reverse(test.begin(),test.end());
    int sum=0;
    for(int i=0;test.at(i)>0;i++){
        sum +=test.at(i);

    }
    cout <<sum<<endl;

}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    long double x1,x2,y1,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    long double a,b,c;
    long double cosA,cosB,cosC;
    long double tanA2,tanB2,tanC2;
    a = sqrt(pow(x3-x2,2)+pow(y3-y2,2));
    c = sqrt(pow(x1-x2,2)+pow(y1-y2,2));
    b = sqrt(pow(x3-x1,2)+pow(y3-y1,2));
    //cout << a << " " << b << " " << c << endl;
    cosA = ((x2-x1)*(x3-x1)+(y2-y1)*(y3-y1))/(b*c);
    cosB = ((x1-x2)*(x3-x2)+(y1-y2)*(y3-y2))/(c*a);
    cosC = ((x2-x3)*(x1-x3)+(y2-y3)*(y1-y3))/(a*b);
    //cout << cosA << " " << cosB << " " << cosC << endl;
    tanA2 = sqrt((1-cosA)/(1+cosA));
    tanB2 = sqrt((1-cosB)/(1+cosB));
    tanC2 = sqrt((1-cosC)/(1+cosC));
    //cout << tanA2 << " " << tanB2 << " " << tanC2 << endl;
    long double ans = 0;
    ans = max(ans,c/(2+(1/tanA2)+(1/tanB2)));
    ans = max(ans,a/(2+(1/tanC2)+(1/tanB2)));
    ans = max(ans,b/(2+(1/tanA2)+(1/tanC2)));
    cout << setprecision(20) << ans << endl;
}

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

using namespace std;



int main() {
	int w,h;
	vector <int>a;

	vector<int>b;
	
	vector <int>c;
	vector<int>d;
	int k;

	cin >> w>>h;
	for (int i = 1; i <= w; i++) {
		cin >> k;
		if (k > 0) { a.push_back(k); c.push_back(k); }
	}
	for (int i = 1; i <= h; i++) {
		cin >> k;
		if (k > 0) { b.push_back(k); d.push_back(k); }
	}
	//cout << a.size() << b.size() << endl;

	for (int i = 0; i < b.size(); i++) {
		sort(a.begin(), a.end());
		reverse(a.begin(),a.end());
		if (a.size() < b[i]) {
			cout << 0 << endl;
			return 0;
		}
		else {
			for (int j = 0; j < b[i]; j++) {
				a[j]--;

				if (a[j] < 0) {
					cout << 0 << endl;
					return 0;
				}
				
			}
			

		}

		//cout << "OK a" << i << endl;
	}
	for (int i = 0; i < c.size(); i++) {
		sort(d.begin(), d.end());
		reverse(d.begin(), d.end());

		//cout << "OK c" << i << endl;
		if (d.size() < c[i]) {
			cout << 0 << endl;
			return 0;
		}
		else {
			for (int j = 0; j < c[i]; j++) {
				d[j]--;
				if (d[j] < 0) {
					cout << 0 << endl;
					return 0;
				}
			
			}
			


		}

	}
	cout << 1 << endl;

}



Measured memory_bytes: 3180
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int pl=0, mi=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]=='-')mi++;
        else pl++;
    }
    int ans = pl-mi;
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
for(int n,m,p;cin>>n>>m>>p,n;){
int x[100],sum=0;
for(int i=0;i<n;i++)cin>>x[i],sum+=x[i];
if(x[m-1]==0)cout<<0<<endl;
else	cout<<100*sum*(100-p)/(100*x[m-1])<<endl;
}return 0;}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
const int MOD=1000000007;
const int INF=LLONG_MAX/2;
const int Maxa=200000;


signed main() {cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n,m,ans=0;
    cin>>n>>m;
    VVi a(Maxa);
    REP(i,0,n){
        int tmpa,tmpb;
        cin>>tmpa>>tmpb;
        a[tmpa].pb(tmpb);
    }
    
    multiset<int> se;
    REP(i,1,m+1){
        REP(j,0,a[i].size()){
            se.insert(a[i][j]);
        }
        if(se.size()!=0){
            auto itr=se.end();
            itr--;
            ans += *itr;
            se.erase(itr);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 10624
i,n;char a[100001],s[100001];f(x,y){*a=x;a[1]=y;for(i=1;i<n-1;i++)a[i+1]=a[i]==87^a[i-1]==87^s[i]=='o'?83:87;if(*a==87^*s=='o'^a[n-1]==a[1]||a[n-1]==87^s[n - 1]=='o'^a[n-2]==*a)return 0;puts(a);return 1;}main(){scanf("%d%s",&n,&s);if(!(f(83,83)||f(83,87)||f(87,83)||f(87,87)))puts("-1");return 0;}

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

int main(){
  int n;
  cin >> n;
  char s[100];
  
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
   
  int x = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'I') {
      x++;
    }
    if (s[i] == 'D') {
      x--;
    }
    ans = max(x, ans);
  }
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

void dfs(ll now, ll pre, ll &c_idx, const VV<ll> &edges, const V<ll> &C, V<ll> &ans) {
    ans[now] = C[c_idx++];
    for(ll nxt : edges[now]) {
        if(nxt == pre) continue;
        dfs(nxt, now, c_idx, edges, C, ans);
    }
}

int main() {
    ll N;
    cin >> N;
    VV<ll> edges(N);
    for(ll i = 1; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    V<ll> C(N);
    for(ll &e : C) cin >> e;
    sort(ALLR(C));
    ll c_idx = 0;
    V<ll> ans(N);
    dfs(0, -1, c_idx, edges, C, ans);

    ll M = 0;
    for(ll i = 0; i < N; i++) for(ll j : edges[i]) M += min(ans[i], ans[j]);
    M /= 2;

    cout << M << endl;
    for(ll i = 0; i < N; i++) cout << ans[i] << " \n"[i + 1 == N];
    return 0;
}


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

typedef pair<long long int,long long int>pa;
#define pb push_back 

long long int MAX= 200005;
long long int MOD=1e9+7;
long long int INF=1e18;


    
int main()
{
       ios_base::sync_with_stdio(false); 
       cin.tie(NULL);
       cout.tie(NULL);
     
       long long int i,j,k=0,l=0,r=0,m=0,n,p=0,cnt=0,cnt1=0,x=0,y,z,low,mid,high,ans=0,maxi=0,mini=INF,t;
      string s,s1;
    cin>>n>>m;
    vector<pa>V(m);
    mini=0;
    maxi=INF;
    for(i=0;i<m;i++)
    {
        cin>>V[i].first;
        cin>>V[i].second;
        mini=max(V[i].first,mini);
        maxi=min(V[i].second,maxi);
    }
    if(mini>maxi)
    {
        cout<<0;
    }
    else
cout<<maxi-mini+1<<endl;
    
    
}

Measured memory_bytes: 1792
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  ll N;
  cin >> N;
  vector<ll> a(N);
  for(ll i=0;i<N;++i){
    cin >> a.at(i);
    --a.at(i);
  }

  ll index=0;
  ll N_break=0;
  for(ll i=0;i<N;++i){
    if(a.at(i)==index){
      ++index;
      continue;
    }
    ++N_break;
    if(N_break==N) break;
  }

  if(N_break==N) cout << -1 << endl;
  else cout << N_break << endl;

  return 0;
}


Measured memory_bytes: 4828
def run():
    query=input()
    
    text_list=[]
    
    while True:
        line=input()
        
        if line=="END_OF_TEXT":
            break
        
        text_list.append(line)
        
    n=0
    for text in text_list:
        word_list=text.split()
        for w in word_list:
            
            if w.lower() == query:
                n+=1
            
    print(n)

run()


Measured memory_bytes: 5560