akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  vector<ll> jyou(40);
  jyou[0] = 1;
  for(int i = 1;i <= 39;i++){
    jyou[i] = jyou[i - 1] * -2;
  } 
  int keta = 0;
  int now = 0;
  vector<int> res;
  while(1){
    if(now == n)break;
    if((n - now) % abs(jyou[keta + 1]) != 0){
      res.push_back(1);
      now += jyou[keta];
      //cout << "A" << endl;
    }
    else res.push_back(0);
    keta++;
    //cout << now << endl;
  }
  for(int i = res.size() - 1;i >= 0;i--){
    cout << res[i];
  }
  if(res.size() == 0){
    cout << 0;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
while gets do
  str = $_.chomp
  alp = ('a'..'z').to_a

  26.times do
    wl = str.split(' ')
    flag = false
    wl.each do |st|
      if st =~ /^(the|that|this)$/
        flag = true
        break
      end
    end
    break if flag

    str.size.times do |i|
      next unless str[i] =~ /[a-z]/
      str[i] = alp[(alp.index(str[i])+1)%26]
    end
  end
  puts str
end

Measured memory_bytes: 6120
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;

const double eps = 1e-7;

int main()
{
	double D,d,px,py,vx,vy;
	while(cin >> D, D)
	{
		cin >> px >> py >> vx >> vy;

		//cout << "cross:" << abs(px*vy-py*vx) << endl;
		if(abs(px*vy-py*vx) > eps)
		{
			cout << "impossible" << endl;
			continue;
		}

		//cout << "dot  :" << px*vx+py*vy << endl;
		d=sqrt(px*px+py*py);	
		if(px*vx+py*vy>0)
		{
			d=2.0-d;
		}

		if(D>=d)
		{
			printf("%.8lf\n", d);
		}
		else
		{
			cout << "impossible" << endl;
		}
	}
}

Measured memory_bytes: 0
from functools import reduce

def binom(n, r):
    if n < r or n < 0 or r < 0: return 0
    
    if n - r < r: r = n - r
    if r == 0: return 1
    elif r == 1: return n

    numerator = [n - r + 1 + k for k in range(r)]  # (n-r+1)*(n-r+2)*...*(n-1)*n
    denominator = [1+ k for k in range(r)]         # 1*2*...*(r-1)*r

    # reduce prod(numerator)//prod(denominator)
    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] //= pivot
                denominator[k] //= pivot
    
    # calculate nCr
    return reduce(lambda x, y: x*y, numerator)

N, P = map(int, input().split())
*A, = map(int, input().split())
even = 0; odd = 0;
for a in A:
    if a % 2 == 0:
        even += 1
    else:
        odd += 1
ans = 2**even
temp = 0
if P == 0:
    for i in range(0, odd+1, 2):
        temp += binom(odd, i)
else:
    for i in range(1, odd+1, 2):
        temp += binom(odd, i)
ans *= temp
print(ans)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#define ll long long
#define MAX 1000003
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
using namespace std;

int main(){
	IOS;
	int n; cin>>n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		{
			cin>>a[i];
			/* code */
		}	
	int ctr=0;
	for(int i=1;i<n-1;i++){
		if((a[i]>a[i-1] and a[i]<a[i+1]) or (a[i]<a[i-1] and a[i]>a[i+1])){
			ctr++;
		}
	}
	cout<<ctr;
return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::stdin;
use std::ops::*;
use std::process::exit;
use std::str::FromStr;

const MOD: usize = 1000000007;

fn main() {
    let n: usize = input();
    let s: String = input();
    let mut map = HashMap::new();
    for c in s.chars() {
        let h = map.entry(c).or_insert(0);
        *h += 1usize;
    }

    let mut ans = 1;
    for v in map.values() {
        ans *= v + 1;
        ans %= MOD;
    }
    ans -= 1;
    ans %= MOD;
    println!("{}", ans);
}

pub fn input<T: FromStr>() -> T {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().ok().unwrap()
}

pub fn input_vec<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|x| x.parse().ok().unwrap())
        .collect::<Vec<_>>()
}

pub fn input_lines<T: FromStr>(l: usize) -> Vec<T> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input());
    }
    res
}

pub fn input_lines_two<T: FromStr, U: FromStr>(l: usize) -> Vec<(T, U)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_two());
    }
    res
}

pub fn input_lines_three<T: FromStr, U: FromStr, V: FromStr>(l: usize) -> Vec<(T, U, V)> {
    let mut res = Vec::new();
    for _i in 0..l {
        res.push(input_three());
    }
    res
}

pub fn input_two<T: FromStr, U: FromStr>() -> (T, U) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
    )
}

pub fn input_three<T: FromStr, U: FromStr, V: FromStr>() -> (T, U, V) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse::<T>().ok().unwrap(),
        s[1].parse::<U>().ok().unwrap(),
        s[2].parse::<V>().ok().unwrap(),
    )
}

pub fn input_four<T: FromStr, U: FromStr, V: FromStr, W: FromStr>() -> (T, U, V, W) {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    let s: Vec<&str> = buf.split_whitespace().collect();
    (
        s[0].parse().ok().unwrap(),
        s[1].parse().ok().unwrap(),
        s[2].parse().ok().unwrap(),
        s[3].parse().ok().unwrap(),
    )
}


Measured memory_bytes: 4352
#include <iostream>
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;

int main()
{
  int n;
  cin >> n;
  double memo, result = 0.0;
  REP (i, n) {
    cin >> memo;
    result += 1.0 / memo;
  }
  cout << 1.0 / result << endl;
  return 0;
}


Measured memory_bytes: 256
A,B=map(int,input().split())
S=input()

cnt=0
for i in range(len(S)):
  if(S[i] == "-"):
    cnt+=1
if cnt > 1:
  print("No")
  exit()

if (len(S) == A+B+1) and (S[A] == "-"):
  print("Yes")
else:
  print("No")

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

// input
string S[3];


void input() {
    rep(i, 3) cin >> S[i];
}


int main() {
    input();
    string ans = "";
    rep(i, 3) {
        char c = S[i][0];
        c -= 32;
        ans += c;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3556
def match(index_num):
    if answer[index_num] == "S":
        if s[index_num] == "o":
            if answer[(index_num+1)%N] == answer[index_num-1]:
                return True
        else:
            if answer[(index_num+1)%N] != answer[index_num-1]:
                return True
    else:
        if s[index_num] == "o":
            if answer[(index_num+1)%N] != answer[index_num-1]:
                return True
        else:
            if answer[(index_num+1)%N] == answer[index_num-1]:
                return True
    return False
 
N = int(input())
s = list(input())
SorW = ["S","W"]
 
for i in SorW:
    for j in SorW:
        answer = []
        append = answer.append
        append(i)
        append(j)
 
        for k in range(2,N):
            if answer[k-1] == "S":
                if s[k-1] == "o":
                    append(answer[k-2])
                else:
                    if answer[k-2] == "S":
                        append("W")
                    else:
                        append("S")
            else:
                if s[k-1] == "o":
                    if answer[k-2] == "W":
                        append("S")
                    else:
                        append("W")
                else:
                    append(answer[k-2])
        
        for k in [0,N-1]:
            if not match(k):
                break
            if k == N-1:
                print("".join(answer))
                exit()
print(-1)

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

// Template for atcoder
public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    private static final int[] dx = {0, -1, 0, 1};
    private static final int[] dy = {1, 0, -1, 0};

    void solve() throws IOException {
        int H = nextInt();
        int W = nextInt();
        long[][] dp = new long[H][W];
        char[][] mat = new char[H][W];
        for (int i = 0; i < H; i++) {
            mat[i] = nextString().toCharArray();
        }
        dp[0][0] = 1;
        for (int i = 1; i < H; i++) {
            if (mat[i][0] == '#') {
                break;
            } else {
                dp[i][0] = 1;
            }
        }
        for (int j = 1; j < W; j++) {
            if (mat[0][j] == '#') {
                break;
            } else {
                dp[0][j] = 1;
            }
        }

        for (int i = 1; i < H; i++) {
            for (int j = 1; j < W; j++) {
                if (mat[i][j] == '#') {
                    continue;
                }
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
                dp[i][j] = dp[i][j] % MOD;
            }
        }

        outln(dp[H - 1][W - 1]);
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}


Measured memory_bytes: 49044
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()

    var way = 0
    var pre = 0
    var ans = 1

    for (i in 0 until n) {
        val now = sc.nextInt()
        if (i == 0 || now - pre == 0) {
        } else if (way == 0) {
            way = sgn(now - pre)
        } else if (sgn(now - pre) != way) {
            ans++
            way = 0
        }
        pre = now
    }
    println(ans)
}

fun sgn(x: Int): Int {
    if (x == 0) {
        return 0
    }
    if (x > 0) {
        return 1
    }
    return -1
}


Measured memory_bytes: 52908
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>


int main() {
	int n; std::cin >> n;
	std::vector<long double> goods(n); for (auto& v : goods) std::cin >> v;
	std::sort(goods.begin(), goods.end());
	long double result = goods.front();
	for (auto i = 1; i < n; ++i) {
		result = (result + goods[i]) / 2;
	}
	std::cout << std::setprecision(15) << std::fixed << result << std::endl;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
string N;
bool n[3] = {false, false, false};
long long rec(int keta, bool tight) {
  if (keta == N.size()) {
    for (int i = 0; i < 3; i++)
      if (!n[i]) return 0;
    return 1;
  }
  int x = N[keta] - '0';
  int r = tight ? x : 9;
  long long sum = 0;
  for (int i = 0; i <= r; i++) {
    if (i == 3 || i == 5 || i == 7) {
      bool prev = n[(i / 2) - 1];
      n[(i / 2) - 1] = true;
      sum += rec(keta + 1, tight && i == r);
      n[(i / 2) - 1] = prev;
    } else if (i == 0) {
      bool q = false;
      for (int i = 0; i < 3; i++)
        if (n[i]) q = true;
      if (!q) sum += rec(keta + 1, tight && i == r);
    }
  }
  return sum;
}
int main() {
  cin >> N;
  cout << rec(0, true) << endl;
  return 0;
}

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

#define int int64_t

using namespace std;

#define MAX 105
#define MAX_K 100005
#define MOD 1000000007

int n, k, a[MAX], dp[MAX][MAX_K], sum[MAX_K];

// int f(int i, int r)
// {
//     // printf("%lld %lld\n", i, r);
//     if (r < 0)
//         return 0;
//     if (r == 0)
//         return 1;
//     if (i == n)
//         return 0;
//     if (dp[i][r] != -1)
//         return dp[i][r];
//     int count = 0;
//     for (int j = 0; j <= min(r, a[i]); j++)
//     {
//         count += f(i + 1, r - j) % MOD;
//         count %= MOD;
//     }
//     return dp[i][r] = count;
// }

signed main()
{
    scanf("%lld %lld", &n, &k);
    for (int i = 1; i <= n; i++)
        scanf("%lld", a + i);
    // for (int i = 0; i <= n; i++)
    //     for (int j = 0; j <= k; j++)
    //         dp[i][j] = -1;

    for (int i = n + 1; i > 0; i--)
    {
        sum[0] = dp[i + 1][0];
        for (int r = 1; r <= k; r++)
            sum[r] = (sum[r - 1] + dp[i + 1][r]) % MOD;
        for (int r = 0; r <= k; r++)
        {
            if (r == 0)
                dp[i][r] = 1;
            else if (i == n + 1)
                dp[i][r] = 0;
            else
            {
                int count = sum[r];
                if (r - min(r, a[i]) > 0)
                    count = (count - sum[r - min(r, a[i]) - 1] + MOD) % MOD;

                //summe von dp[i+1][r-min(r,a[i])] bis dp[i+1][r]
                /*   for (int j = 0; j <= min(r, a[i]); j++)
                {
                    count += dp[i + 1][r - j] % MOD;
                    count %= MOD;
                } */
                dp[i][r] = count;
            }
        }
    }

    printf("%lld\n", dp[1][k]);

    /*
    for (int i = 0; i <= k; i++)
    {
        dp[n][i] = a[n] >= i ? 1 : 0;
        dp[n][i] += dp[n][i - 1];
        dp[n][i] %= MOD;
    }
    for (int i = n - 1; i >= 1; i--)
        for (int j = 0; j <= k; j++)
        {
            dp[i][j] = (dp[i + 1][j] + MOD - dp[i + 1][min(j - a[i], min(0L, j - 1))]) % MOD;
            dp[i][j] += dp[i][j - 1] % MOD;
            dp[i][j] %= MOD;
        }
    printf("%lld\n", dp[1][k] - dp[1][k - 1]);
    for (int i = 1; i <= n; i++, printf("\n"))
        for (int j = 1; j <= k; j++)
            printf("%lld ", dp[i][j]);
    // printf("%lld\n", f(0, k)); */
}


Measured memory_bytes: 81408
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a = n%10;
    int b = (n/10)%10;
    int c = (n/100)%10;
    int d = (n/1000);
    if((a == b && b == c)||(b==c && c == d))
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2;
cin>>s1>>s2;
reverse(s1.begin(),s1.end());
s1=s2+s1;
for(int i=0;i<s1.size();i++){
if(i%2)cout<<s1[i/2];
else cout<<s1[s1.size()-1-i/2];
}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
int main(){
    int N;
    string S;
    cin >> N >> S;
    int x = 0;
    int max = 0;
    REP(i,N){
        if(S[i] == 'I') x++;
        else x--;
        if(x > max) max = x;
    }
    cout << max << endl;
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
A=[]
B=[]
for i in range(n):
  a=list(input())
  A.append(a)
for i in range(m):
  b=list(input())
  B.append(b)
for i in range(n-m+1):
  for j in range(n-m+1):
    C=[]
    for k in range(m):
      c=A[k+j][i:i+m]
      C.append(c)
    if B==C:
      print('Yes')
      exit()
print('No')

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

using namespace std;

int main(){

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

	int ans = 0;

	int now = 0;
	for (int i = 0;; i++){
		if (i % 2 == 0)
			now += Z;

		else{
			now += Y;
			ans++;
		}
		if (now > X){
			ans--;
			break;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
import os


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

    N, M = list(map(int, sys.stdin.buffer.readline().split()))
    mi = 1
    mx = N

    for m in range(M):
        L, R = map(int, sys.stdin.buffer.readline().split())
        mi = max(mi, L)
        mx = min(mx, R)

    print(max(0, mx - mi + 1))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			long a = cin.Long();
			long b = cin.Long();
			long k = cin.Long();

			long c = k - a;
			a = Math.Max(0, a - k);
			if (c > 0) {
				b = Math.Max(0, b - c);
			}

			string ans = $"{a} {b}";
			Console.WriteLine(ans);
		}
	}

	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private string[] buf_;
		private int index_;
		Func<string> reader_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "yes" : "no");}
//----------------------------------------------------------------
int main(void) {
  int n;
  cin >> n;
  arr(a,n);

  int cur=1;
  int ct=0;
  rep(i,n+100){
    ct++;
    cur = a[cur-1];
    if(cur==2){
      prt(ct);
      return 0;
    }
  }

  prt(-1);
}


Measured memory_bytes: 640
bingo = [list(input().split()) for _ in range(3)]
n = int(input())

# ヒットした数字に○をつける
for i in range(n):
    hit = input()
    for line in bingo:
        if hit in line:
            i = line.index(hit)
            line[i] = '○'
            break

# ビンゴしているか判定する
is_bingo = False

for line in bingo:
  if line[0] == line[1] == line[2]:
    is_bingo = True

for i in range(3):
  if bingo[0][i] == bingo[1][i] == bingo[2][i]:
    is_bingo = True

if bingo[0][0] == bingo[1][1] == bingo[2][2]:
  is_bingo = True
elif bingo[0][2] == bingo[1][1] == bingo[2][0]:
  is_bingo = True

if is_bingo:
    print("Yes")
else:
    print("No")

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


cost = 10000
res = [0,0]

for i in range(n[0]):
    get = input().split(" ")
    get = list(map(int,get))
    
    if get[1] <= n[1]:
        res[1] = get[1]
        if get[0] < cost:
            cost = get[0]


if res[1]==0:
    print('TLE')
else:print(cost)


Measured memory_bytes: 3060
#include<stdio.h>
#include<math.h>

int main(void)
{
int x=0;
char a[5];
fgets(a,5,stdin);

   
if(a[0]==a[1])
{
x=x+1;
}
   
if(a[0]==a[2])
{
x=x+1;
}
   
if(a[0]==a[3])
{
x=x+1;
}
   
if(a[1]==a[2])
{
x=x+1;
}
   
if(a[1]==a[3])
{
x=x+1;
}
   
if(a[2]==a[3])
{
x=x+1;
}

  
  
if(x==2)
{
printf("Yes");
}else
{
printf("No");
}

return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
class P{
public:
	double x,y;
	P(){}
	P(double xx,double yy){
		x=xx;
		y=yy;
	}
	P operator +(P p){
		return P(x+p.x,y+p.y);
	}
	P operator -(P p){
		return P(x-p.x,y-p.y);
	}
	P operator /(double d){
		return P(x/d,y/d);
	}
};

int n;
P p[301];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%lf%lf",&p[i].x,&p[i].y);
		}
		int res=1;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				P np=p[j]-p[i];
				//printf("%lf %lf\n",np.x,np.y);
				double blen=np.x*np.x/4.0+np.y*np.y/4.0;
				if(blen>1.0)continue;
				double len=sqrt(1-blen);
				double dir=atan2(np.y,np.x);
				P cp=(p[i]+p[j])/2+P(len*cos(dir+M_PI/2),len*sin(dir+M_PI/2));
				int cnt=0;
				for(int k=0;k<n;k++){
					double len2=sqrt((cp.x-p[k].x)*(cp.x-p[k].x)+(cp.y-p[k].y)*(cp.y-p[k].y));
					if(len2<=1.0001)cnt++;
				}
				res=max(res,cnt);
				cp=(p[i]+p[j])/2+P(len*cos(dir-M_PI/2),len*sin(dir-M_PI/2));
				cnt=0;
				for(int k=0;k<n;k++){
					double len2=sqrt((cp.x-p[k].x)*(cp.x-p[k].x)+(cp.y-p[k].y)*(cp.y-p[k].y));
					if(len2<=1.0001)cnt++;
				}
				res=max(res,cnt);
			}
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};
int miti[300000];
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second

int main(){
	int n , w, h;
	cin >> n >> w >>h;
	int wifi[n][3];
	REP(i,n){
		cin >> wifi[i][0] >> wifi[i][1] >>wifi[i][2];
	}
	//x軸を調べる
	REP(i,10020)miti[i]=0;

	REP(i,n){
		int a = wifi[i][0];
		int b = wifi[i][2];
		int minx = max(0,a-b);
		int maxx = a+b;

		miti[minx]++;
		miti[maxx]--;
	}
	int total = 0;
	bool flag = true;
	REP(i,w){
		total += miti[i];
		//cout << miti[i] << i <<endl;
		if(total <= 0){
			flag = false;
			break;
		}
	}
	if(flag){
		cout << "Yes"  <<endl;
		return 0;
	}

		
	REP(i,10020)miti[i]=0;

	REP(i,n){
		int a = wifi[i][1];
		int b = wifi[i][2];
		int miny = max(0,a - b);
		int maxy = a + b ;

		miti[miny]++;
		miti[maxy]--;
	}
	total = 0;
	flag = true;
	REP(i,h){
		total += miti[i];
		//cout << miti[i] <<' ' <<i<<endl; 
		if(total <= 0){
			flag = false;
			break;
		}
	}
	if(flag){
		cout << "Yes" <<endl;
		return 0;
	}

	cout <<"No"<<endl;


	return 0;
}



Measured memory_bytes: 5024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MAX_N = 1e5 + 5;
const int MAX_L = 20; // ~ Log N
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int,int> mi;
typedef map<ll,ll> mll;
typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> umll;

#define LSOne(S) (S & (-S))
#define isBitSet(S, i) ((S >> i) & 1)
#define fi first
#define se second
#define ins(x,y) insert({x,y}) 
#define pb(x) push_back(x)
#define cnt(x) count(x)


void solve() {

}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int tc=1; //cin >> tc;
    for (int t = 1; t <= tc; t++) {
        //cout << "Case #" << t  << ": ";
        string s;
        cin>>s;
        int sum=0;
        for(auto i:s)
        {
			if(!(sum%9))
				sum=0;
			sum=(sum+(int)(i-'0'))%MOD;
		}
		if(sum%9)
			cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
		
        solve();
    }
}


Measured memory_bytes: 3728
/*
ID: wangjun30
LANG: C++14
TASK:
*/
#include<iostream>
//#include<fstream>
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
int main(){
	string s;
	cin>>s;
	int b=0,r=0;
	for(int i=0;i<s.size();i++)
		if(s[i]=='0')
			b++;
		else
			r++;
	cout<<min(b,r)*2;
	return 0;
}

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

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

  int a,b,c;
  cin >> a >> b >> c;
  if(c >= a && a + b >= c) cout << "YES" << endl;
  else cout << "NO" << endl;

}

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

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
	int N;
	cin >> N;
	vector<int> a(N+1, 0);
	for(int i=1; i<=N; i++) cin >> a[i];

	vector<bool> is_putonBall(N+1, false);
	for(int i=N; i>=1; i--){
		int sum = 0;
		for(int j=i+i; j<=N; j+=i){
			if(is_putonBall[j]) sum++;
		}
		if(sum%2 != a[i]) is_putonBall[i] = true;
	}

	int ans = 0;
	for(int i=1; i<=N; i++) ans += is_putonBall[i];
	cout << ans << endl;
	for(int i=1; i<=N; i++) if(is_putonBall[i]) cout << i << " ";
	cout << endl;
}



Measured memory_bytes: 4036
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //int N = sc.nextInt();
        int[][] c = new int[4][4];
        for(int row=1;row<=3;row++){
            for(int col=1;col<=3;col++){
                c[row][col]=sc.nextInt();
            }
        }
        String ans = "Yes";
        for(int col=2;col<=3;col++){
            int cur = c[1][1]-c[1][col];
            int d1 = c[2][1]-c[2][col];
            int d2 = c[3][1]-c[3][col];
            if(cur!=d1||cur!=d2)  ans  = "No";
        }
        if(!(c[1][2]-c[1][3]==c[2][2]-c[2][3]&&c[1][2]-c[1][3]==c[3][2]-c[3][3])) ans = "No";

        for(int row=2;row<=3;row++){
            int cur = c[1][1]-c[row][1];
            int d1 = c[1][2]-c[row][2];
            int d2 = c[1][3]-c[row][3];
            if(cur!=d1||cur!=d2)  ans  = "No";
        }
        if(!(c[2][1]-c[3][1]==c[2][2]-c[3][2]&&c[2][1]-c[3][1]==c[2][3]-c[3][3])) ans = "No";


        System.out.println(ans);


    }
}

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

#ifndef ONLINE_JUDGE 
const bool DEBUG = true;
#else
const bool DEBUG = false;
#endif

// Reads a 1D vector
template <class T>
void read1d(vector<T> & arg) {
	const int l = arg.size();
	for (int i = 0; i < l; ++i) cin >> arg[i];
}

void read() {}
// Reads arbitrary values
template <class T1, class... T2>
void read(T1& var1, T2&... var2) { cin >> var1; read(var2...); }



void pln() { cout << (DEBUG ? "]\n" : "\n"); }
template <class T1, class... T2>
void pln(const T1& var1, const T2& ... var2) { cout << var1 << " "; pln(var2...); }

// Prints arbitrary values and goes to next line
template <class T1, class... T2>
constexpr void print(const T1& var1, const T2& ... var2) { cout << (DEBUG ? " [ " : ""); pln(var1, var2...); }

// Prints arbitrary values and goes to next line ONLY IF IN DEBUG MODE
template <class T1, class... T2>
constexpr void debug(const T1& var1, const T2& ... var2) { if (!DEBUG) return;  cout << " debug : [ "; pln(var1, var2...); }





using ll = long long;
using ull = unsigned long long;


#define all(x) begin(x), end(x)

const bool MULTIPLE_TEST_CASES = 0;


void exec() 
{
	int x;
	read(x);

	if (x > 29) print("Yes");
	else print("No");
}

















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

	if (!MULTIPLE_TEST_CASES)
		exec();
	else {
		int n;
		cin >> n;

		while (n--)
			exec();
	}

    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define eps 1e-14
#define INF 1e9
#define m0(x) memset(x, 0, sizeof(x))

using namespace std;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  int n, m;

  cin >> n;
  std::vector<std::string> s(n);
  std::map<string, int> mp;

  rep(i, n){
    cin >> s[i];
    if(mp.count(s[i])){
      mp[s[i]] += 1;
    }else{
      mp[s[i]] = 1;
    }
  }

  cin >> m;
  std::vector<string> t(m);
  
  rep(i, m){
    cin >> t[i];
  }
  
  int ans = 0;
  rep(i, n){
    int flag = false;
    int tmp = mp[s[i]];
    rep(j, m){
      if(s[i] == t[j]){
        if(tmp <= 0){
          flag = true;
        }
        tmp--;
      }
    }
    if(!flag){
      ans = max(ans, tmp);
    }
  }

  std::cout << ans << std::endl;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] strArray = Console.ReadLine().Split(' ');
            string S = strArray[0];
            string T = strArray[1];
            string result = "";
            for (int p =0; p<N; p++)
            {
                result += S.Substring(p, 1) +T.Substring(p,1);
            }
            Console.WriteLine(result);
        }
    }
}
// 文字列の入力
//string s = Console.ReadLine();

// 整数の入力
//long n = long.Parse(Console.ReadLine());

// 文字列配列の入力
//string[] inputStrArray = Console.ReadLine().Split(' ');

// 整数配列の入力
//long[] inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

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

int main(){
  int n;
  int i,j;
  cin >> n;
  vector<int> h(n);
  for(auto& e : h) cin >> e;
  int counter = 0;
  int hMax = h[0];
  for(i=0; i<n; ++i){
    if(hMax <= h[i]){
      counter++;
      hMax = h[i];
    }
  }
  cout << counter << endl;
  return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};

int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  reverse(a.begin(),a.end());
  ll dp[114514];
  rep(i,n+1)dp[i]=INF;
  rep(i,n){
    *upper_bound(dp,dp+n,a[i])=a[i];
  }
  ll ans=lower_bound(dp,dp+n,INF)-dp;
  cout<<ans<<endl;
}


Measured memory_bytes: 4820
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a==5&&b==5&&c==7) printf("YES\n");
  else if(a==5&&b==7&&c==5) printf("YES\n");
  else if(a==7&&b==5&&c==5) printf("YES\n");
  else printf("NO\n");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;cin>>n>>m;
    vector<vector<ll>> key(n,vector<ll>());
    bool chk[n]={};
    ll lim = 1<<30;
    ll cost[1<<14];
    rep(i,1<<14){
        cost[i]=1LL<<40;
    }
    rep(i,m){
        ll a,b;cin>>a>>b;
        ll bit = 0;
        rep(i,b){
            ll tmp;cin>>tmp;
            tmp--;
            chk[tmp]=true;
            key[tmp].push_back(i);
            bit += 1<<tmp;
        }
        chmin(cost[bit],a);
        DEBUG{
            cout << "bit" << endl;
            cout << bit << endl;
            cout << cost[bit] << endl;
        }
    }
    rep(i,n){
        if(!chk[i]){
            cout << -1 << endl;
            return 0;
        }
    }
    rep(k,11){
        repr(i,1,1<<12){
            repr(j,1,1<<12){
                chmin(cost[i|j],cost[i]+cost[j]);
            }
        }
    }
    cout << cost[(1<<n)-1] << endl;
    return 0;
}


Measured memory_bytes: 512
fun main(args: Array<String>) {
    val (k, n) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toInt() }
    val m = a.indices.map { (a[(it + 1) % n] - a[it] + k) % k }.max()!!
    println(k - m)
}

Measured memory_bytes: 82896
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	string s;
	cin >> s;

	int sz = s.size();

	int blacks = 0;
	long long ops = 0;
	for (int i = sz - 1; i >= 0; --i) {
		if (s[i] == 'B') {
			ops += sz - i - 1 - blacks;
			++blacks;
		}
	}

	cout << ops << "\n";

	return 0;

}

Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
string mo1,mo2;
long long int a,n,ans,s,sa;

long long cut(string target,string str){

    sa=0;
    int k=0;

    for(int i=0;i<str.size();i++){
            if(target[0]==str[i]){

        for(int j=i+1;j<str.size();j++){
            if(target[1]==str[j]){
                    sa=j+j-i;

             for( k=2;k<target.size();k++){
                if(sa>=str.size())break;
                if(target[k]!=str[sa]){
                    break;
                }
                sa+=j-i;
                }

                if(k==target.size()){

                        return 1;
                }
                sa=0;
            }
            }

        }
        }

        return 0;

}


int main(){

    cin >> n >> mo1;

    for(int i=0;i<n;i++){
        cin >> mo2;
        ans+=cut(mo1,mo2);

    }

    cout << ans << endl;

return 0;
}

Measured memory_bytes: 1216
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var sum = (ModInt)a.Sum();
        var res = sum * sum;
        foreach (var item in a)
            res -= ((ModInt)item) * item;
        Console.WriteLine(res / 2);
    }
}


struct ModInt
{
    public const int Mod = 1000000007;
    const long POSITIVIZER = ((long)Mod) << 31;
    long Data;
    public ModInt(long data) { if ((Data = data % Mod) < 0) Data += Mod; }
    public static implicit operator long(ModInt modInt) => modInt.Data;
    public static implicit operator ModInt(long val) => new ModInt(val);
    public static ModInt operator +(ModInt a, int b) => new ModInt() { Data = (a.Data + b + POSITIVIZER) % Mod };
    public static ModInt operator +(ModInt a, long b) => new ModInt(a.Data + b);
    public static ModInt operator +(ModInt a, ModInt b) { long res = a.Data + b.Data; return new ModInt() { Data = res >= Mod ? res - Mod : res }; }
    public static ModInt operator -(ModInt a, int b) => new ModInt() { Data = (a.Data - b + POSITIVIZER) % Mod };
    public static ModInt operator -(ModInt a, long b) => new ModInt(a.Data - b);
    public static ModInt operator -(ModInt a, ModInt b) { long res = a.Data - b.Data; return new ModInt() { Data = res < 0 ? res + Mod : res }; }
    public static ModInt operator *(ModInt a, int b) => new ModInt(a.Data * b);
    public static ModInt operator *(ModInt a, long b) => a * new ModInt(b);
    public static ModInt operator *(ModInt a, ModInt b) => new ModInt() { Data = a.Data * b.Data % Mod };
    public static ModInt operator /(ModInt a, ModInt b) => new ModInt() { Data = a.Data * GetInverse(b) % Mod };
    public static bool operator ==(ModInt a, ModInt b) => a.Data == b.Data;
    public static bool operator !=(ModInt a, ModInt b) => a.Data != b.Data;
    public override string ToString() => Data.ToString();
    public override bool Equals(object obj) => (ModInt)obj == this;
    public override int GetHashCode() => (int)Data;
    static long GetInverse(long a)
    {
        long div, p = Mod, x1 = 1, y1 = 0, x2 = 0, y2 = 1;
        while (true)
        {
            if (p == 1) return x2 + Mod; div = a / p; x1 -= x2 * div; y1 -= y2 * div; a %= p;
            if (a == 1) return x1 + Mod; div = p / a; x2 -= x1 * div; y2 -= y1 * div; p %= a;
        }
    }
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int N;

ll lcm(ll x, ll y)
{
  ll r0, r1, a0, a1, b0, b1, q0, q1, tmp;
  r0 = x; r1 = y;
  a0 = 1; a1 = 0;
  b0 = 0; b1 = 1;
 
  while(r1 > 0) {
    q1 = r0 / r1;
 
    // a2 = a0 - q1 * a1
    tmp = a1;
    // a1 := a2
    a1 = a0 - q1 * a1;
    a0 = tmp;
 
    // b2 = b0 - q1 * b1
    tmp = b1;
    // b1 := b2
    b1 = b0 - q1 * b1;
    b0 = tmp;
 
    // r2 = r0 - q1 * r1
    tmp = r1;
    // r1 := r2
    r1 = r0 - q1 * r1;
    r0 = tmp;
  }
  return (x / r0) * y;
}

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

  cin >> N;
  vector< ll > t(N);
  ll ans;
  REP(i, N) {
    cin >> t[i];
    if (i > 0) ans = lcm(ans, t[i]);
    else ans = t[i];
  }

  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
from bisect import bisect

def solve(N, A, B, H, total):
    class Solver:
        def __init__(self, N, A, B, H, total):
            self.N = N
            self.B = B
            self.BA = A-B
            self.H = H
            self.len = idiv(total, B)

        def __getitem__(self, k):
            Bk = self.B * k
            cnt = 0
            for i in range(self.N):
                h = H[i] - Bk
                if h < 0:
                    continue
                cnt += idiv(h, self.BA)
                if cnt > k:
                    return -1
            #print("[%d]"%k, cnt, k)
            return 1 if cnt <= k else -1

        def __len__(self):
            return self.len

    k0 = idiv(total, (B*N+A))
    s = Solver(N, A, B, H, total)
    k = bisect(s, 0, k0)
    print(k)

def main():
    input = open(0).readline
    N, A, B = map(int, input().split())
    H = [0]*N
    total = 0
    for i in range(N):
        h = int(input())
        H[i] = h
        total += h
    solve(N, A, B, H, total)

def idiv(x, y):
    if x <= 0:
        return 0
    q, r = divmod(x, y)
    return q + (1 if r > 0 else 0)



main()


Measured memory_bytes: 7028
import math
N=int(input())
X = [[int(i) for i in input().split()] for _ in range(N)]
 
v = 0
for i in range(N):
    for j in range(i+1, N):
        yz = [(y - z)**2 for y, z in zip(X[i], X[j])]
        v += math.sqrt(sum(yz))
print(2*v/N)

Measured memory_bytes: 3064
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
co=0
for i in range(n):
    l=[]
    a=list(map(int,input().split()))
    w=[]
    for i in range(m):
        w.append(a[i]*b[i])
    if sum(w)+c>0:
        co+=1
print(co)

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

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

  int K;
  cin >> K;

  char S[N+1];
  cin >> S;

  if(S[K-1] == 'A'){
    S[K-1] = 'a';
  }else if(S[K-1] == 'B'){
    S[K-1] = 'b';
  }else{
    S[K-1] = 'c';
  }
  
  cout << S << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int main(){
  int N;
  string S;
  cin >> N >> S;
  int ssize = S.size();
  vector<string> s1(ssize-1), s2(ssize-1);
  
  for(int i = 0; i < ssize - 1; i++){
    for(int j = 0; j < ssize; j++){
      if(j <= i) s1.at(i) += S.at(j);
      else s2.at(i) += S.at(j);
    }
    sort(ALL(s1.at(i))); sort(ALL(s2.at(i)));
  }

  int result = 0;
  for(int i = 0; i < ssize-1; i++){
    int counter = 0;
    for(int j = 0; j < s1.at(i).size(); j++){
      if(j != 0 && s1.at(i).at(j) == s1.at(i).at(j-1)) continue;
      for(int k = 0; k < s2.at(i).size(); k++){
        if(s1.at(i).at(j) == s2.at(i).at(k)){
          counter++;
          break;
        }
      }
    }
    result = max(result, counter);
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll inc(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
llfor;///////////////////////////////////////////////////////////
int main(){
 ll h,n;
 sc(h);sc(n);
 llpvec pair(n);
 ll a,b,dp[30000];//[i番目の魔法までを使って][減る体力]=消耗する魔力の最小

 rep(j,0,30000){dp[j]=llpow(10,8)+10;}
 rep(i,0,n){
  sc(a);sc(b);pair[i]={b,a};
  dp[a]=b;
 } 
  
 ll cnt=0;  
 ll ans=inc(h,pair[0].second)*pair[0].first;
 dp[0]=0;
 rep(i,0,h){
  rep(j,0,n){
   dp[i+pair[j].second]=min(dp[i]+pair[j].first,dp[i+pair[j].second]);

  }
 }
 rep(i,h,30000)ans=min(ans,dp[i]);
 pr(ans); 
  
return 0;}

Measured memory_bytes: 3888