akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			var nm = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
			int n = nm[0];
			int m = nm[1];

			var fromIsland1 = new List<int>();
			var toIslandN = new List<int>();

			for (var i = 0; i < m; ++i) {
				var array = Console.ReadLine().Split(' ').Select(j => int.Parse(j)).ToArray();

				if (array[0] == 1) {
					fromIsland1.Add(array[1]);
				}

				if (array[1] == n) {
					toIslandN.Add(array[0]);
				}
			}

			bool canVoyage = false;

			if (fromIsland1.Count == 0 || toIslandN.Count == 0) {
			} else {
				var interSect = fromIsland1.Intersect(toIslandN).ToList();
				if (interSect.Count > 0) {
					canVoyage = true;
				}
			}
			

			if (canVoyage) {
				Console.WriteLine("POSSIBLE");
			} else {
				Console.WriteLine("IMPOSSIBLE");
			}

			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 21264
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 500009
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int N;
  cin>>N;
  vector<int> a(N);
  map<int,int> m;
  for(int i=0;i<N;i++){
    cin>>a.at(i);
    m[a.at(i)]++;
  }
  sort(a.begin(),a.end());
  int M=a.at(N-1);
  if(M>=N){
    cout<<"Impossible"<<endl;
  }else if(M%2==0){
    bool flag=true;
    if(m[M/2]!=1){
      flag=false;
    }
    for(int i=M/2+1;i<=M;i++){
      if(m[i]<2){
        flag=false;
      }
    }
    for(int i=1;i<M/2;i++){
      if(m[i]>0){
        flag=false;
      }
    }
    if(flag){
      cout<<"Possible"<<endl;
    }else{
      cout<<"Impossible"<<endl;
    }
  }else{
    bool flag=true;
    for(int i=(M+1)/2;i<=M;i++){
      if(m[i]<2){
        flag=false;
      }
    }
    for(int i=1;i<(M+1)/2;i++){
      if(m[i]>0){
        flag=false;
      }
    }
    if(m[(M+1)/2]!=2){
      flag=false;
    }
    if(flag){
      cout<<"Possible"<<endl;
    }else{
      cout<<"Impossible"<<endl;
    }
  }
}


Measured memory_bytes: 256
using System;

namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {

                var input = Console.ReadLine().Split(' ');
                var x = int.Parse(input[0]);
                var y = int.Parse(input[1]);

                if (x == 0 && y == 0) break;

                if (x < y)
                    Console.WriteLine($"{x} {y}");
                else
                    Console.WriteLine($"{y} {x}");
            }
        }
    }
}



Measured memory_bytes: 13900
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;
using LL = long long;
const int INF = 1e9;

int main(void)
{
    LL N;
    string S;
    cin >> N;
    cin >> S;

    for (size_t i = 0; i < S.size(); i++) {
        S[i] = ((S[i]-'A')+N)%26 + 'A';
    }
    cout << S << endl;

    return 0;
}



Measured memory_bytes: 256
fun main(args:Array<String>) {
  val n = readLine()!!.toInt()
  val s = readLine()!!
  
  val set1 = mutableSetOf<Int>()
  for( i in (0..n-1) ) {
    //println("${s.slice(0..i).toSet()}, ${s.slice(i+1..n-1).toSet()}" )
    val f1 = s.slice(0..i).toSet()
    val f2 = s.slice(i+1..n-1).toSet()
    set1.add( f1.intersect(f2).size )
  }
  set1.max().let(::println)
}

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

using namespace std;

int main(void){
    
    int n;
    bool card[4][13] = {};
    
    string type;
    int num;
    
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 13; j++) {
            card[i][j] = false;
        }
    }
    
    cin >> n;
    
    for(int i = 0; i < n; i++) {
    
        cin >> type >> num;
        
        if(type == "S" || type == "s") {
            card[0][num - 1] = true;
        } else if(type == "H" || type == "h") {
            card[1][num - 1] = true;
        } else if(type == "C" || type == "c") {
            card[2][num - 1] = true;
        } else if(type == "D" || type == "d") {
            card[3][num - 1] = true;
        }
        
    }
    
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 13; j++) {
            if(card[i][j] == false) {
                if(i == 0) {
                    cout << "S " << j + 1 << endl;
                } else if(i == 1) {
                    cout << "H " << j + 1 << endl;
                } else if(i == 2) {
                    cout << "C " << j + 1 << endl;
                } else if(i == 3) {
                    cout << "D " << j + 1 << endl;
                }
            }
        }
    }
    
    return 0;
    
}

Measured memory_bytes: 3156
#![allow(non_snake_case)]

use std::cmp;

#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

#[allow(dead_code)]
const INF: i64 = 1_010_000_000_000_000_000;

struct Solver {
    N: i64,
    G: Vec<Vec<i64>>,
    memo: Vec<Option<i64>>,
}

impl Solver {
    fn new(N: i64, G: Vec<Vec<i64>>) -> Self {
        Solver {
            N: N,
            G: G,
            memo: vec![None; N as usize],
        }
    }

    // 頂点 i から始まる有向パスの最大長
    fn f(&mut self, i: i64) -> i64 {
        if self.memo[i as usize].is_none() {
            let mut res = 0;
            for j in 0..self.G[i as usize].len() {
                let to = self.G[i as usize][j as usize];
                res = cmp::max(res, 1+self.f(to));
            }
            self.memo[i as usize] = Some(res);
        }
        self.memo[i as usize].unwrap()
    }

    fn solve(&mut self) -> i64 {
        let mut res = 0;
        for i in 0..self.N {
            res = cmp::max(res, self.f(i));
        }
        res
    }
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let N = sc.value::<i64>();
    let M = sc.value::<i64>();
    let mut G = vec![vec![]; N as usize];
    for _ in 0..M {
        let x = sc.value::<i64>() - 1;  // 0-based
        let y = sc.value::<i64>() - 1;  // 0-based
        G[x as usize].push(y);
    }

    let mut sol = Solver::new(N, G);
    let ans = sol.solve();

    println!("{}", ans);
}


Measured memory_bytes: 17276
#include<stdio.h>
int main()
{
  int A[100];
  int i,j;
  int temp=0;
  int hant_num=0;
  int num,mini;
 
  scanf("%d",&num);
  for(i=0;i<num;i++)
   {
    scanf("%d",&A[i]);
     
     }
   
   for (i=0;i<num;i++)
   {
     mini = i;
     for (j=i;j<num;j++)
    {
     if (A[j] < A[mini]) mini = j;
    }
     if (A[i] > A[mini])
     {
      temp = A[i];
      A[i] = A[mini];
      A[mini] = temp;
      hant_num++;
      }
    }
   for (i=0;i<num;i++)
   {
    printf("%d",A[i]);
     if (i<num-1) printf(" ");
     }
    printf("\n%d\n",hant_num);
   return 0;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int N;
    string S;
    cin >> N >> S;
    int l = 0, r = 0;
    string ans = S;
    rep(i, N){
        if(S[i] == '(') l++;
        else r++;
        if(r > l) l++, ans = '(' + ans;
    }
    rep(i, l-r) ans += ')';
    cout << ans << endl;
}

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

#include <math.h>
#include <stdlib.h>


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

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; }

// const int INF = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n ; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }

    vector<bool> vis(n, false);
    vis[0] = true;

    int pos = 0;
    int cnt = 0;
    while(cnt < n+1){
        pos = a[pos];
        cnt++;
        if(pos == 1) {
            cout << cnt << endl;
            return 0;
        }
        if(vis[pos]) {
            cout << -1 << endl;
            return 0;
        }
        vis[pos] = true;
    }

    return 0;
}


Measured memory_bytes: 640
import sys
import math
from collections import defaultdict, deque
from copy import deepcopy
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
def end_of_loop():raise StopIteration
    
    
def main():
    N, M = MI()
    Switch = [LI() for i in range(M)]
    P = LI()
    result = 0
    for i in range(2**N):
        result += 1
        for index, swich in enumerate(Switch):
            if swich[0] == 0:
                continue
            temp = 0
            for j in range(swich[0]):
                if i >> (swich[j+1]-1) & 1 == 1:
                    temp += 1
            if temp % 2 != P[index]:
                result-=1
                break
            
    print(result)
                    
                    
            
            
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 74720
#include <iostream>

auto main () -> int
{
    int a , b;
    std::cin >> a >> b;
//    std::cout << (a / b) << ' ' << (a % b) << ' ' << (static_cast <double> (a) / b) << std::endl;
    std::cout << (a / b) << ' ' << (a % b) << ' ';
    std::printf ("%.5f\n" , (double)a/b);
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
//typedef vector<vector<ll> > Graph;
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; }
//const ll INF = 1e18;

//テンプレート
//辺の構築
template< typename T = ll >
struct Edge {
  ll from, to;
  T cost;
  ll idx;

  Edge() = default;

  Edge(ll from, ll to, T cost = 1, ll idx = -1) : from(from), to(to), cost(cost), idx(idx) {}

  operator ll() const { return to; }
};

template< typename T = ll >
struct Graph {
  vector< vector< Edge< T > > > g;
  ll es;

  Graph() = default;

  explicit Graph(ll n) : g(n), es(0) {}

  size_t size() const {
    return g.size();
  }

  void add_directed_edge(ll from, ll to, T cost = 1) {
    g[from].emplace_back(from, to, cost, es++);
  }

  void add_edge(ll from, ll to, T cost = 1) {
    g[from].emplace_back(from, to, cost, es);
    g[to].emplace_back(to, from, cost, es++);
  }

  void read(ll M, ll padding = -1, bool weighted = false, bool directed = false) {
    for(ll i = 0; i < M; i++) {
      ll a, b;
      cin >> a >> b;
      a += padding;
      b += padding;
      T c = T(1);
      if(weighted) cin >> c;
      if(directed) add_directed_edge(a, b, c);
      else add_edge(a, b, c);
    }
  }
};

template< typename T = ll >
using Edges = vector< Edge< T > >;



/**
 * @brief Bellman-Ford(単一始点最短路)
 * 負の辺がある時にも使える
 */
template< typename T >
vector< T > bellman_ford(const Edges< T > &edges, ll V, ll s) {
  const auto INF = 1e16;
  vector< T > dist(V, INF);
  dist[s] = 0;
  for(ll i = 0; i < V - 1; i++) {
    for(auto &e : edges) {
      if(dist[e.from] == INF) continue;
      dist[e.to] = min(dist[e.to], dist[e.from] + e.cost);
    }
  }
  for(auto &e : edges) {
    if(dist[e.from] == INF) continue;
    if(dist[e.from] + e.cost < dist[e.to]);
  }
  return dist;
}

template< typename T >
bool bellman_ford2(const Edges< T > &edges, ll V, ll s,vector<ll> ans) {
  const auto INF = 1e16;
  vector< T > dist(V);
  rep(i,V){
      dist[i]=ans[i];
  }
  for(ll i = 0; i < V - 1; i++) {
    for(auto &e : edges) {
      if(dist[e.from] == INF) continue;
      dist[e.to] = min(dist[e.to], dist[e.from] + e.cost);
      if(dist[V-1]!=ans[V-1])return false;
    }
  }
  return true;
}

int main(){
    ll n,m;
    cin >> n >> m;
    Edges<ll>e(m);
    rep(i,m){
        ll a,b;ll c;
        cin >> a >> b >> c;
        a--;b--;
        e[i]={a,b,-c};
    }
    auto ans = bellman_ford(e,n,0);
    if(ans.size()==0||(!bellman_ford2(e,n,0,ans))){
        cout << "inf" << endl;
    }
    else{
        cout << -ans[n-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
bool cond(vector<ll> a) {
	int n = a.size();
	rep(i, n - 1)if (a[i] > a[i] + 1) return false;
	return true;
}
void out(int x, int y) {
	cout << x << " " << y << endl;
}
int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n)cin >> a[i];
	auto mait = max_element(all(a));
	auto miit = min_element(all(a));
	ll ma = *mait;
	ll mi = *miit;
	int m = 2 * n;
	cout << m << endl;
	if (labs(ma) >= labs(mi)) {
		int imax = distance(a.begin(), mait);
		rep(i, n) {
			if (i != imax)out(imax + 1, i + 1);
		}
		out(imax + 1, imax + 1);
		out(imax + 1, 1);
		rep(i, n - 1)out(i + 1, i + 2);
	}
	else {
		int imin = distance(a.begin(), miit);
		rep(i, n)if (i != imin)out(imin + 1, i + 1);
		out(imin + 1, imin + 1);
		out(imin + 1, n);
		for (int i = n - 1; i >= 1; i--)out(i + 1, i);
	}


	return 0;
}





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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_156() {
	ll n, r;
	ll ans = 0;

	cin >> n >> r;

	if (n<10){
		ans = r + (10-n)*100;
	}
	else{
		ans = r;
	}

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

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

	solve_156();

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int d, n;
	int num;
	
	cin >> d >> n;
	
	if (d == 0) {
		cout << (n == 100 ? 101 : n) << endl;
	}
	else if (d == 1){
		cout << (n == 100 ? 10100 : n * 100) << endl;
	}
	else {
		cout << (n == 100 ? 1010000 : 100 * 100 * n) << endl;
	}
	
	return (0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}
 
int main() {
    string s,t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if (s == u) {
        a--;
    }
    if (t == u) {
        b--;
    }
    cout << a << " "  << b << "\n";
}

Measured memory_bytes: 256
#![allow(unused_imports, dead_code)]
use std::f64::*;
use std::cmp::*;
use std::collections::*;

macro_rules! dump{
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

const INF: i64 = 0x3f3f3f3f3f3f3f3f;
const MOD: i64 = 1000000007;
const NOTHING: usize = std::usize::MAX;
const DX: [usize; 4] = [1, 0, std::usize::MAX, 0];
const DY: [usize; 4] = [0, 1, 0, std::usize::MAX];

fn main() {
    let n: usize = readln();
    let xs: Vec<usize> = readln();
    let mut fact: Vec<i64> = vec![1;n+10];
    for i in 1..n + 10 {
        fact[i] = fact[i - 1] * i as i64 % MOD;
    }

    let mut l = 0;
    let mut r = 0;
    let mut used: Vec<usize> = vec![NOTHING;n+1];
    for i in 0..n + 1 {
        if used[xs[i]] == NOTHING {
            used[xs[i]] = i;
        } else {
            l = used[xs[i]];
            r = i;
            break;
        }
    }

    for k in 1..n + 2 {
        let p = binom_mod(n + 1, k, &fact);
        let q = binom_mod(l + n - r, k - 1, &fact);
        let res = (p - q + MOD) % MOD;
        println!("{}", res);
    }

}

fn binom_mod(n: usize, k: usize, fact: &Vec<i64>) -> i64 {
    //    dump!(n, k);
    if n < k {
        return 0;
    }
    fact[n] * inv_mod(fact[k] * fact[n - k] % MOD, MOD) % MOD
}

pub fn inv_mod(x: i64, modulus: i64) -> i64 {
    let mut r0 = x;
    let mut r1 = modulus;
    let mut x0 = 1;
    let mut x1 = 0;
    while r1 > 0 {
        let q = r0 / r1;
        r0 = r0 % r1;
        std::mem::swap(&mut r0, &mut r1);
        x0 = x0 - q * x1;
        std::mem::swap(&mut x0, &mut x1);
    }
    let res = x0 % modulus;
    if res < 0 { res + modulus } else { res }
}

trait Read {
    fn read(s: &str) -> Self;
}

fn readln<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl Read for String {
    fn read(s: &str) -> Self {
        s.to_string()
    }
}

impl Read for Vec<char> {
    fn read(s: &str) -> Self {
        s.chars().collect()
    }
}

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

impl<A: Read, B: Read, C: Read, D: Read> Read for (A, B, C, D) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]), D::read(tokens[3]))
    }
}


Measured memory_bytes: 9340
#include <stdio.h>
int main(){
    char a[3];
    char b[3];
    scanf("%s",&a);
    scanf("%s",&b);
    int count=0;
    for(int i=0;i<3;i++){
        if(a[i]==b[i]){
            count++;
        }
    }
    printf("%d",count);
}

Measured memory_bytes: 128
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;
double EPS=1e-9;
int main(){
	int a;
	scanf("%d",&a);
	double al=-1;
	double ar=-1;
	double bl=-1;
	double br=-1;
	int la=2;
	int lb=0;
	int lf=0;
	int lx,ly;
	for(int i=0;i<a;i++){
		int b,c,d,e,f;
		scanf("%d%d%d%d%d",&b,&c,&d,&e,&f);	
		if(la<2&&la==d&&lb!=c){
			double dist=sqrt((e-lx)*(e-lx)+(f-ly)*(f-ly));
			if(d==0&&(al+EPS<dist||(al-EPS<dist&&ar>1.0/60*(b-lf)))){
				al=dist;ar=1.0/60*(b-lf);
			}
			if(d==1&&(bl+EPS<dist||(bl-EPS<dist&&br>1.0/60*(b-lf)))){
				bl=dist;br=1.0/60*(b-lf);
			}
		}
		la=d;lb=c;lf=b;
		lx=e;ly=f;
	}
	printf("%f %f\n%f %f\n",al,ar,bl,br);
	/*
	if(al>-0.5)printf("%f %f\n",al,ar);
	else printf("-1 -1\n");
	if(bl>-0.5)printf("%f %f\n",bl,br);
	else printf("-1 -1\n");*/
}

Measured memory_bytes: 1068
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;
const long long INFL = 1LL<<60;

int dp[10005][10005];

int main() {
  int n;
  cin >> n;
  rep(k, n) {
    string a, b;
    cin >> a >> b;
    int m = a.size();
    int n = b.size();
    rep(i, 10005) {
      dp[0][i] = 0;
      dp[i][0] = 0;
    }
    for (int i = 1; i < n + 1; i++) {
      for (int j = 1; j < m + 1; j++) {
        if (b[i-1] == a[j-1]) {
          dp[i][j] = max(max(dp[i-1][j], dp[i][j-1]), dp[i-1][j-1] + 1);
        } else {
          dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
      }
    }
    cout << dp[n][m] << endl;
  }

  return 0;
}



Measured memory_bytes: 47004
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import qualified Data.IntMap as IM

type Map = IM.IntMap Int

readIntsLines :: IO [[Int]]
readIntsLines = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

countUp :: Int -> Int -> Map -> Map
countUp = IM.insertWithKey f
  where f _ new old = old + new

build :: [[Int]] -> Map -> Map
build [] m = m
build ([a, b]:abs) m = build abs $ countUp a b m

solve :: [(Int, Int)] -> Int -> Int -> Int
solve [] _ _ = -1
solve ((n, c):ncs) total target = if next >= target
                              then n
                              else solve ncs next target
  where next = total + c

main :: IO ()
main = do
  [n, k] <- map read . words <$> getLine
  abs <- readIntsLines
  let built = IM.toList $ build abs IM.empty
  print $ solve built 0 k

Measured memory_bytes: 31100
# coding: utf-8
# Your code here!
import bisect

N=int(input())
l=list(map(int,input().split()))
l.sort()

ans=0
for i in range(N-2):
    for j in range(i+1,N-1):
        insert_index = bisect.bisect_left(l,l[i]+l[j])
        ans+=(insert_index-j-1)
        
print(ans)


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

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

bool g[50][50];
bool v[50];

void dfs(int nv){
  v[nv]=true;
  for(int v2=0;v2<n;++v2){
    if(g[nv][v2]==false) continue;
    if(v[v2]==true) continue;

    dfs(v2);
  }
}

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

  for(int i=0;i<m;++i){
    g[a[i]][b[i]]=g[b[i]][a[i]]=false;

    for(int j=0;j<n;++j) v[j]=false;

    dfs(0);

    bool br=false;

    for(int j=0;j<n;++j) if(v[j]==false) br=true;
    if(br) ans+=1;

    g[a[i]][b[i]]=g[b[i]][a[i]]=true;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int, int> ii;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 1e5 + 5;

int n, cnt;
vector<int> a;

int main() {
    //freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    int y = 0, x;
    rep(i, 1, n + 1) {
        cin >> x;
        if(x != y) a.pb(x);
        y = x;
    }
    int f, j = 0;
    rep(i, 1, SZ(a)) {
        if(i == j) continue;
        int g = a[i] > a[i - 1];
        if(j == i - 1) f = g;
        if(f != g) j = i, cnt ++;
    }
    cout << cnt + 1 << endl;
}



Measured memory_bytes: 892
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
ll INF=2000000000000;

struct edge{ll from,to,cost;};

edge es[2005],es2[2005];
ll d[2005];
bool f[2005]={0};
ll V,E,a,b,c;




ll sp(int s)
{
	for(int i=0;i<V;i++)d[i]=INF;
	d[s]=0;
	for(int N=0;N<V-1;N++)
	{
		for(int i=0;i<E;i++)
		{
			edge e=es[i];
			if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost)
			{
				d[e.to]=d[e.from]+e.cost;
			}
		}
	}
	ll r=d[V-1];
	for(int N=0;N<V;N++)
	{
		for(int i=0;i<E;i++)
		{
			edge e=es[i];
			if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost)
			{
				d[e.to]=d[e.from]+e.cost;
				f[e.to]=1;
			}
			f[e.to]|=f[e.from];
		}
	}
	return r;
}

int main()
{
	scanf("%lld%lld",&V,&E);
	for(int i=0;i<E;i++)
	{
		scanf("%lld%lld%lld",&a,&b,&c);
		a--;b--;
		es[i].from=a;
		es[i].to=b;
		es[i].cost=-c;
	}
	ll r=-sp(0);
	if(f[V-1])puts("inf");
	else printf("%lld\n",r);
	return 0;
}


Measured memory_bytes: 256
fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let n: usize = iter.next().unwrap().parse().unwrap();
    let a: Vec<i64> = (&mut iter).take(n).map(|x| x.parse().unwrap()).collect();
    
    let mut b: Vec<i64> = a.iter().enumerate().map(|(i, &x)| x - (i as i64 + 1)).collect();
    b.sort();
    let center = if n % 2 == 0 {
        (b[n/2] + b[n/2-1]) / 2
    } else {
        b[n/2]
    };
    let mut ret = 0;
    for i in 0..n {
        ret += (a[i] - (i as i64 + 1) - center).abs();
    }
    println!("{}", ret);
}


Measured memory_bytes: 11512
#include <bits/stdc++.h>
#define ll long long int  

using namespace std;

void solve(){

	ll n;
	cin>>n;

	ll sum = 0;
	std::vector<ll> v;
	ll k = 0;
	for(ll i=1;i<=n;i++){
		if(i%5 == 0 && i%3==0){
			continue;
		} else if(i%3 == 0){
			continue;
		} else if(i%5==0){
			continue;
		} else {
			v.push_back(i);
			k++;
		}
	}
	// sort(v.begin(), v.end());
	std::vector<ll> pv(v.size(),0);
	pv[0] = v[0];
	for(ll i=1;i<v.size();i++){
		pv[i] = pv[i-1] + v[i];
	}

	cout<<pv[k-1]<<endl;
}

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	ll t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}

}

Measured memory_bytes: 11816
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)

int main(void)
{
    int a, b;
    cin >> a >> b;

    string Sa, Sb;

    Sa = to_string(a);
    Sb = to_string(b);

    string Sab = Sa + Sb;

    int ab = stoi(Sab.c_str());
    
    bool f = false;
    for(int i = 0; i < 1000; i++)
    {
        if(ab == i  * i)
            f = true;
    }

    if(f)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0;

}


Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main {

  def times(m:Long, n:Long, z:Long) =  ( (m%z) * (n%z) ) % z

  def pow(x:Long, y:Long, z:Long):Long = {
    def scan(m:Long, n:Long, odd:Long):Long =
      if(n==0) 1
      else if(n==1) times(m,odd,z)
      else scan(times(m,m,z), n/2, (if(n%2==1) times(odd, m, z) else odd))
    scan(x, y, 1)
  }

  def main(args: Array[String]) = {
    val n = readLine().split(" ").map(_.toLong)
    println(pow(n(0),n(1),1000000007))
  }
}

Measured memory_bytes: 43776
#include <bits/stdc++.h>
#pragma GCC optimize("O999")
//示例：#define ll long long
//unsigned long long ;
const int INF=0x3f3f3f3f;
const int maxn=50000005;
using namespace std;

int main(){
	//freopen(".in", "r",stdin );
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(0);
	int n, ans=0;
	cin >> n;
	for(int i=1; i<n; i++){
		int x=n/i;
		if(n%i==0)x--;
		ans+=x;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3652
from collections import deque
import sys

INF = 10 ** 8

H, W = map(int,input().split())
C = list(map(int,input().split()))
D = list(map(int,input().split()))
MAP = []
for _ in range(H):
    MAP.append(list(input()))
d = [[INF for i in range(W)] for j in range(H)]
tx = [1, 0, -1, 0]
ty = [0, 1, 0, -1]
tx_y = [(i, j) for i in range(-2, 3) for j in range(-2, 3)]

Q = deque()
Q.append([C[0]-1, C[1]-1, 0])

while len(Q) != 0:
    x, y, cnt = Q.popleft()
    
    if x == D[0]-1 and y == D[1]-1:
        print(cnt)
        sys.exit()
    
    for i in range(4):
        nx = x + tx[i]
        ny = y + ty[i]
        if 0 <= nx < H and 0 <= ny < W and MAP[nx][ny] == "." and d[nx][ny] > cnt:
            d[nx][ny] = cnt
            Q.appendleft([nx, ny, cnt])
    
    for i, j in tx_y:
        nx = x + i
        ny = y + j
        if 0 <= nx < H and 0 <= ny < W and MAP[nx][ny] == "." and d[nx][ny] > cnt+1:
            d[nx][ny] = cnt+1
            Q.append([nx, ny, cnt+1])

print(-1)

Measured memory_bytes: 133452
H,W = map(int,input().split())
s = []
for i in range(H):
    a = list(input())
    s.append(a)
for i in range(H):
    for j in range(W):
        count = 0
        if s[i][j] == ".":
            for k in range(i-1,i+2):
                for l in range(j-1,j+2):
                    if (0 <= k <= H-1) and (0 <= l <= W-1) and s[k][l] == "#":
                        count += 1
            s[i][j] = str(count)
for i in range(H):
    print("".join(s[i]))


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

int main(){
	int n;
	for(;;){
		cin >> n;
		if(n==0) break;

		int zai[30], lim[30];
		for(int i=0; i<n; i++){
			cin >> zai[i] >> lim[i];
		}

		int sum = 0;
		for(int i=0; i<n; i++){
			sum += zai[i];
		}

		for(int i=n-1; i>=0; i--){
			for(int j=0; j<i; j++){
				if(lim[j]<lim[j+1]){
					int tmp = zai[j]; zai[j]=zai[j+1]; zai[j+1]=tmp;
					tmp = lim[j]; lim[j]=lim[j+1]; lim[j+1]=tmp;
				}
			}
		}

		int k;
		for(k=0; k<n; k++){
			if(lim[k]<sum){
				break;
			}else{
				sum -= zai[k];
			}
		}
		if(k==n){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
	}
	return 0;
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int X = line[0], A = line[1];

            if (X < A)
                Console.WriteLine(0);
            else
                Console.WriteLine(10);
        }
    }
}


Measured memory_bytes: 11348
use std::io;
use std::str::FromStr;
use std::collections::VecDeque;
use std::cmp::max;

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn input_tuple() -> (u64, u64, u64) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<u64> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2])
}

fn main() {
    let (n, m, k) = input_tuple();
    let a_vec = input_vec();
    let b_vec = input_vec();
    let mut queue: VecDeque<u64> = VecDeque::new();
    let mut sum = 0;
    let mut count = 0;
    for a in a_vec {
        if sum + a <= k {
            queue.push_front(a);
            sum += a;
            count += 1;
        } else {
            break;
        }
    }
    let mut ans = count;
    for b in b_vec {
        sum += b;
        count += 1;
        while !queue.is_empty() && sum > k { 
            sum -= queue.pop_front().unwrap();
            count -= 1;
        }
        if sum > k {
            break;
        }
        ans = max(ans, count);
    }
    println!("{}", ans);
}


Measured memory_bytes: 8240
from math import floor
def Main(A, B):
    a = A * 12.5
    b = B * 10
    st = floor(min(a, b))
    for i in range(st, 1251):
        if floor(i * 0.08) == A and floor(i * 0.1) == B:
            return i
    return -1 
                     

def main():
    A, B = map(int, input().split())
    print(Main(A, B))

if __name__ == '__main__':
    main()

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

template <typename T>
void print(const T &v);

int main()
{
    string ss;
    cin >> ss;
    ss.push_back('Z'); // ダミー
    string s;
    for (int i = 0; i < ss.size(); i++)
    {
        if (ss[i] == 'A')
        {
            s.push_back('A');
        }
        else if (ss[i] == 'B' && ss[i + 1] == 'C')
        {
            s.push_back('B');
            i++;
        }
        else
        {
            s.push_back('C');
        }
    }
    int n = s.size();
    int a_cnt = 0;
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'A')
        {
            ++a_cnt;
        }
        else if (s[i] == 'B')
        {
            ans += a_cnt;
        }
        else
        {
            a_cnt = 0;
        }
    }
    cout << ans << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
	char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
	vector<char*> v({token});
	while(token = strtok(NULL,", ")) v.push_back(token);
	return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
	debug() << " [" << args.back() << ": " << H << "] ";
	args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define print(x) cout << x << "\n";
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main(){
	IOS;
	int n,k,i;
	cin>>n>>k;
	int a[n];
	REP(i,0,n-1) cin>>a[i];
	int l;
	l=0;
	REP(i,k,n-1){
		cout<<(a[l]<a[i]?"Yes\n":"No\n");
		l++;
	}
	return 0;
}

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

using namespace std;

int main(){
	vector<int> a;
	for(int i = 0; i < 5; i++){
		int n; cin >> n;
		a.push_back(n);
	}
	sort(a.begin(), a.end(), greater<int>());
	for(int i = 0; i < 4; i++)
		cout << a[i] << " ";
	cout << a[4] << endl;
	return 0;
}

Measured memory_bytes: 1216
H, W = list(map(int,input().split()))
S = []
c = []
for h in range(H):
    S.append(input())
    c.append([0 for _ in range(W)])
for y in range(H):
    for x in range(W):
        if S[y][x]=="#":
            continue
        for cy in range(max(0,y-1),min(H,y+2)):
            for cx in range(max(0,x-1),min(W,x+2)):
                c[y][x] += 1 if ( (cy!=y or cx!=x) and S[cy][cx]=="#" ) else 0
for y in range(H):
    for x in range(W):
        print("#" if S[y][x]=="#" else c[y][x], end="")
    print("")

Measured memory_bytes: 9288
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner stdIn=new Scanner(System.in);
  int N=stdIn.nextInt();
  int A[][]=new int[2][N];
  int z=0,y=0,max=0,plus=0;
  while(y<2){
  A[y][z]=stdIn.nextInt();
    z++;
    if(z==N){
    z=0;y++;
    }
  }z=0;y=0;
  plus+=A[0][0];
  while(z<N){
  plus+=A[1][z];
    z++;
  }z=0;max=plus;
  while(z<N-1){
  plus-=A[1][z];
    plus+=A[0][z+1];
    if(plus>max)
      max=plus;
    z++;
  }
  System.out.println(max);
}
}

Measured memory_bytes: 23124
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        int X = scan.nextInt();
        int Y = scan.nextInt();
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        ArrayList<Integer> aValueList = new ArrayList();
        ArrayList<Integer> bValueList = new ArrayList();
        ArrayList<Integer> cValueList = new ArrayList();
        for(int i = 0 ; i < A; i++) {
            aValueList.add(scan.nextInt());
        }
        for(int i = 0 ; i < B; i++) {
            bValueList.add(scan.nextInt());
        }
        for(int i = 0 ; i < C; i++) {
            cValueList.add(scan.nextInt());
        }

        Collections.sort(aValueList, Collections.reverseOrder());
        Collections.sort(bValueList, Collections.reverseOrder());
        Collections.sort(cValueList, Collections.reverseOrder());

        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
        for(int i = 0 ; i < X; i++) {
            pq.offer(aValueList.get(i));
        }
        for(int i = 0 ; i < Y; i++) {
            pq.offer(bValueList.get(i));
        }
        pq.addAll(cValueList);

        long ans = 0;
        for(int i = 0; i < X+Y; i++) {
            ans += pq.poll();
        }

        os.println(ans);

    }
}

Measured memory_bytes: 100556
#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;
#define ll long long int
#define ld long double
#define pii 3.14
#define mod (ll)(1e9+7)
#define inf (ll)(1e18)
#define lim (ll)(1e10)
#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
#define pi pair<int,int>
#define N (ll)(2e5 + 5)

void solve()
{
    ll n;
    cin>>n;

    string s;

    ll a=0,b=0,c=0,d=0;

    while(n--)
    {
        cin>>s;
        if(s == "AC")
            a++;
        else if(s == "WA")
            b++;
        else if(s == "TLE")
            c++;
        else
            d++;
    }

    cout<<"AC x "<<a<<"\n";
    cout<<"WA x "<<b<<"\n";
    cout<<"TLE x "<<c<<"\n";
    cout<<"RE x "<<d<<"\n";

}

int main()
{
    fio;
    ll tc = 1;
    //cin>>tc;
    while(tc--)
    {
        solve();
    }
}


Measured memory_bytes: 3636
def main(a, b, c, d):
    while True:
        c -= b
        if c <= 0:
            print("Yes")
            return

        a -= d
        if a <= 0:
            print("No")
            return


if __name__ == "__main__":
    a, b, c, d = map(int, input().split())
    main(a, b, c, d)


Measured memory_bytes: 9176
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  long q, h, s, d;
  readf("%s %s %s %s\n", &q, &h, &s, &d);
  auto n = readln.chomp.to!long;
  
  auto res = long.max;
  res = min(min(res, q * 4 * n), h * 2 * n);
  res = min(res, s * n);
  res = min(res, d * (n / 2) + s * (n % 2));
  res = min(res, d * (n / 2) + h * 2 * (n % 2));
  res = min(res, d * (n / 2) + q * 4 * (n % 2));
  res.writeln;
}


Measured memory_bytes: 256
from collections import Counter

def main():
    n = int(input())
    a = tuple([int(t)for t in input().split()])
    s = sum(a)

    c = Counter(a)

    ans = []
    q = int(input())
    for _ in range(q):
        x,y = tuple([int(t)for t in input().split()])
        s += (y-x)*c[x]
        ans.append(s)
        c[y] += c[x]
        c[x] = 0

    for a_i in ans:
        print(a_i)

if __name__ == "__main__":
    main()

Measured memory_bytes: 26980
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=998244353;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,j,n;cin>>n;
	vector<pair<int,int>>za(n);
	for(i=0;i<n;i++){cin>>za[i].fir>>za[i].sec;}
	SO(za);
	vector<int> zzz(n);
	for(i=0;i<n;i++){zzz[i]=za[i].sec;}
	SO(zzz);
	for(i=0;i<n;i++){za[i].sec=LBI(zzz,za[i].sec);}
	vector<llint>ni(n+1);
	ni[0]=1;
	for(i=1;i<=n;i++){ni[i]=ni[i-1]*2%mod;}
	//セグ木を使って左上数、右上数を出す
	vector<int>UL(n),UR(n),DL(n),DR(n);
	static int seg[524288]={0};
	for(i=0;i<n;i++){
		int bas=za[i].sec+262144;
		while(bas>1){
			if(bas%2==0){seg[bas]++;}
			else{UL[i]+=seg[bas-1];}
			bas/=2;
		}
		UR[i]=i-UL[i];
	}
	for(i=0;i<524288;i++){seg[i]=0;}
	for(i=n-1;i>=0;i--){
		int bas=za[i].sec+262144;
		while(bas>1){
			if(bas%2==0){seg[bas]++;}
			else{DL[i]+=seg[bas-1];}
			bas/=2;
		}
		DR[i]=(n-1-i)-DL[i];
	}
	llint ans=0;
	for(i=0;i<n;i++){
		//cerr<<UL[i]<<" "<<UR[i]<<" "<<DL[i]<<" "<<DR[i]<<endl;
		//cerr<<"ans="<<ans<<endl;
		ans+=ni[UL[i]];
		ans+=ni[UR[i]];
		ans+=ni[DL[i]];
		ans+=ni[DR[i]];
		ans-=ni[UL[i]+UR[i]];
		ans-=ni[UR[i]+DR[i]];
		ans-=ni[DL[i]+DR[i]];
		ans-=ni[UL[i]+DL[i]];
		ans+=ni[n]-1;
	}
	ans%=mod;ans+=mod;ans%=mod;
	cout<<ans<<endl;
}

Measured memory_bytes: 9344
n,k=map(int,input().split())
l=list(map(int,input().split()))
if k>=n:
    print(abs(l[n-1]-l[0]))
else:
    sumlmin=[0]*n
    sumlmin[1]=abs(l[1]-l[0])
    for i in range(2,n):
        m=[]
        j=1
        while j<=k and i-j>=0:
            m.append(sumlmin[i-j]+abs(l[i]-l[i-j]))
            j+=1
        sumlmin[i]=min(m)
    print(sumlmin[n-1])
    

Measured memory_bytes: 52448
import collections


class UnionFind:
    def __init__(self, max_size):
        self.parent = [i for i in range(max_size+1)]
        self.depth = [0 for _ in range(max_size+1)]
        self.cnt = [1 for i in range(max_size+1)]
    # 菲再起にしたい　Whileでスタックに突っこみながら見てスタックの中身全部に代入
    '''
    # 実はこっちのほうが速かったなんで？
    def find(self, x):
        t = x
        while t!=self.parent[t]:
            t = self.parent[t]
        self.parent[x]=t
        return t
    '''

    def find(self, x):
        deque = collections.deque()
        t = x
        while t != self.parent[t]:
            deque.append(t)
            t = self.parent[t]
        while deque:
            tmp = deque.pop()
            self.parent[tmp] = t
        return t

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        elif self.depth[x] < self.depth[y]:
            self.parent[x] = y
            self.cnt[y] += self.cnt[x]
        else:
            self.parent[y] = x
            self.cnt[x] += self.cnt[y]
            if self.depth[x] == self.depth[y]:
                self.depth[x] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return self.cnt[self.find(x)]


n, m = map(int, input().split())
utree = UnionFind(n+10)
for _ in range(m):
    x, y, z = map(int, input().split())
    utree.unite(x, y)
s = {utree.find(i) for i in range(1, n+1)}
print(len(s))


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

int main() {
  string a,b,c;
  cin >> a >> b >> c;
  if(a.at(a.size()-1) == b.at(0) && b.at(b.size()-1) == c.at(0)){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
N, K = map(int, input().split())
P = [int(a)-1 for a in input().split()]
C = [int(a) for a in input().split()]
ma = -10 ** 10
for i in range(N):
    l = 1
    j = P[i]
    s = C[j]
    ma = max(ma, s)
    while j != i:
        j = P[j]
        s += C[j]
        l += 1
        if K >= l:
            ma = max(ma, s)
    
    c = 1
    j = P[j]
    t = C[j]
    if K >= c:
        ma = max(ma, t + (K - c) // l * s)
    
    while j != i:
        j = P[j]
        t += C[j]
        c += 1
        if K >= c:
            ma = max(ma, t + (K - c) // l * s)

print(ma)

Measured memory_bytes: 68504