akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T> inline T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }





int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    
    double d[n]; // i番目の丸太の中心座標
    d[0] = a[0];
    int table[505] = {0};
    
    rep3(i, 1, n) {
        // 手前のどれか(左の壁を含む)と接してる
        // その最大値
        d[i] = a[i];
        int id = -1;
        rep(j, i) {
            int y = a[i] + a[j];
            int x = abs(a[i] - a[j]);
            double D = d[j] + sqrt(y * y - x * x);
            if (d[i] < D) {
                d[i] = D;
                id = j;
            }
        }
        rep3(j, id + 1, i) {
            table[j] = 1;
        }
    }
    // どれが右端と接してるか
    rep(i, n) {
        rep3(j, i + 1, n) {
            int y = a[i] + a[j];
            int x = abs(a[i] - a[j]);
            double D = sqrt(y * y - x * x);
            if (!(a[i] > a[j] + D)) break;
            if (j == n - 1) {
                rep3(k, i + 1, n) table[k] = 1;
            }
        }
    }
    
    vector<int> b;
    rep(i, n) if (table[i] == 0) b.eb(a[i]);
    // rep(i, sz(b)) cout << b[i] << " "; cout << endl;
    
    double ans = b[0] + b[sz(b) - 1];
    rep3(i, 1, sz(b)) {
        int j = i - 1;
        int y = b[i] + b[j];
        int x = abs(b[i] - b[j]);
        double D = sqrt(y * y - x * x);
        ans += D;
    }
    cout << fixed << setprecision(5) << ans << '\n';
}



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

using namespace std;

int main()
{
  long long a, b, n; cin >> a >> b >> n;
  if(n >= b-1)
 	 n =(((n+1)/b) * b)-1;
  cout << ((long long)(a*n)/b) - (((long long)n/b)*a)<< endl;
}

Measured memory_bytes: 3516
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>

using namespace std;


int main()
{
	string S;
	cin >> S;
	int K;
	cin >> K;
	int N = S.size();
	for (int i = 0; i < N; i++) {
		int d = 'z' - S[i] + 1;
		if (S[i] == 'a')
			continue;	//'a'
		if (K < d)
			continue;
		K -= d;
		S[i] = 'a';
	}
	int c = S[N - 1] - 'a';
	c = (c + K) % 26;
	S[N - 1] = (char)('a' + c);
	cout << S << endl;
	return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}


signed main() {
  int a = -1, z = 0;
  string s;
  cin >> s;
  rep(i, 0, s.length()) {
    if(s[i] == 'A' && a == -1) a = i;
    if(s[i] == 'Z') z = i;
  }
  cout << z - a + 1 << endl;
}


Measured memory_bytes: 720
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	
	
	static boolean[] status=new boolean[1100002];
	static void siv()
	{
		int N=1000000;
		int sq=(int) Math.sqrt(N);
		for(int i=4;i<=N;i+=2) status[i]=true;
		for(int i=3;i<=sq;i+=2){
			if(status[i]==false)
			{		
				for(int j=i*i;j<=N;j+=i) status[j]=true;
			}
		}
		status[1]=true;
		
	}

	public static void main(String[] args) {
		Scanner scan=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		siv();
		try {
			while(scan.hasNext()){
				int n=scan.nextInt();
				int c=0;
				for (int i = 1; i <= n; i++) {
					if(!status[i])
						c++;
				}
				System.out.println(c);
			}
					
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
		


}

Measured memory_bytes: 22180
n = gets.to_i
s = gets.chomp!

array = s.split('')

i_j_k_sum = array.count('R') * array.count('G') * array.count('B')
count = 0

(0...n).each do |i|
  ((i + 1)...n).each do |j|
    k = 2 * j - i
    next if k >= n

    if array[i] != array[j] && array[i] != array[k] && array[j] != array[k]
      count += 1
    end
  end
end

puts i_j_k_sum - count


Measured memory_bytes: 14416
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
//mapを使う
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    map<int,int> p;
    rep(i,n){
        cin>>a[i];
        p[a[i]]++;
    }
    vector<int> b(p.size());
    int i=0;
    for(auto c:p){
        b[i]= c.second;
        i++;
        //cout<<c.first<<" "<<c.second<<endl;
    }
    sort(b.begin(),b.end());
    /*
    rep(i,p.size()){
        cout<<b[i]<<endl;
    }
    */
    int ans=0;
    if(k>=p.size()){//減らす必要がない
        cout<<0<<endl;
    }
    else{
        int t = p.size()-k;
        rep(i,t){
            ans += b[i];
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 11136
#include <iostream>
#include <cmath>

using namespace std;
using ll = long long;

int main() {
  ll n;
  cin >> n;
  ll ans = 1e3;
  for (ll a = 1; a <= sqrt(n)+1; ++a) {
    ll b = n / a;
    if (a * b != n)
      continue;
    ll tmp = max(a, b);
    ll cnt = 0;
    while (tmp) {
      ++cnt;
      tmp /= 10;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include<cmath>
#include <limits>
using namespace std;
typedef long long ll;

typedef pair<ll, ll> P;
const int INF = 100000000;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

#define REP(i, a,b) for(i=a;i<b;i++) 
#define REP1(i,b,a) for(i=b-1;i>=a;i--)
#define output(x) cout<<x<<endl;
#define pb(x) push_back(x);
const int MOD = 1000000007;


int main() {
	ll i, j, k, l, m, n, sum, flag, cc, M, N, K, A, B, C, D;
	cc = 0;
	flag = 0;
	cin >> N >> A >> B >> C >> D;
	char S[200001];
	cin >> S;
	A--;
	B--;
	C--;
	D--;
	for (i = A; i < C; i++) {
		if (S[i] == '#'&&S[i + 1] == '#') {
			output("No");
			return 0;
		}
	}
	for (i = B; i < D; i++) {
		if (S[i] == '#'&&S[i + 1] == '#') {
			output("No");
			return 0;
		}
	}
	ll sukima, iwa, space;
	iwa = space = 0;
	if (D>C) {
		output("Yes");
		return 0;
	}
	else {
		for (i = B - 1; i+2 <= D+1; i++) {
			if (S[i] != '#'&&S[i + 1] != '#'&&S[i + 2] != '#') {
				output("Yes");
				return 0;
			}
			
		}
		
	}
	output("No");
	return 0;
}








Measured memory_bytes: 384
import math
import sys 
input = sys.stdin.readline

N = int(input())
x = list(map(int,input().split()))
mod = 10**9+7

d = [0]*(N-1)

for i in range(N-1):
    d[i] = x[i+1]-x[i]
    d[i] %= mod


kaijou = 1
for i in range(1,N):
    kaijou *= i
    kaijou %= mod #これをしないとkaijouが発散


ans=0
x=0

def pow_a(a,n): #(modを取るように改良)
    if n==0:
        return 1
    
    K = 1
    while n>1:
        if n%2 != 0:
            K *= a
            K %= mod
        a *= a
        a %= mod
        n //= 2

    return K*a

for i in range(N-1):
    y = pow_a(i+1,mod-2) #i+1の逆元
    x += kaijou*y
    ans += d[i]*x
    ans %= mod

print(ans)


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

public static class Permi
{
    public static IEnumerable<IEnumerable<T>> Perm<T>(this IEnumerable<T> items, int? k = null)
    {
        if (k == null) k = items.Count();
        if (k == 0) yield return Enumerable.Empty<T>();
        else
        {
            var i = 0;
            foreach (var x in items)
            {
                var xs = items.Where((_, index) => i != index);
                foreach (var c in Perm(xs, k - 1))
                    yield return c.Before(x);
                i++;
            }
        }
    }
    public static IEnumerable<T> Before<T>(this IEnumerable<T> items, T first)
    {
        yield return first;
        foreach (var i in items) yield return i;
    }
}

public class hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = Enumerable.Range(1, n).Perm();
        var sb = new StringBuilder();
        foreach (var x in a)
        {
            sb.Append(string.Join(" ", x) + "\n");
        }
        Console.Write(sb);
    }
}



Measured memory_bytes: 51504
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int A, B;

void solve() {
	cin >> A >> B;
	debug(A, B);
	if(A > B) swap(A, B);
	if(A == B) cout << A + B << "\n";
	else cout << 2 * B - 1 << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cout.precision(6);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


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

int main() { 
    int N;
    cin >> N;
    double deno = 0.0;
    for (int i=0; i<N; i++) {
        int a;
        cin >> a;
        deno += 1/(double)a;
    }

    cout << fixed << setprecision(5) << 1 / deno << endl;


    
    return 0;
}

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

int table[7][7] = { { 0, 300, 500, 600, 700, 1350, 1650},
		    { 6,   0, 350, 450, 600, 1150, 1500},
		    {13,   7,   0, 250, 400, 1000, 1350},
		    {18,  12,   5,   0, 250,  850, 1300},
		    {23,  17,  10,   5,   0,  600, 1150},
		    {43,  37,  30,  25,  20,    0,  500},
		    {58,  52,  45,  40,  35,   15,    0} };

int main()
{
  int sic;
  while (cin >> sic) {
    if (sic == 0)
      break;

    int sh, sm, tic, th, tm;
    cin >> sh >> sm >> tic >> th >> tm;
    --sic;
    --tic;

    bool half = false;
    if (((17*60+30 <= sh*60+sm && sh*60+sm <= 19*60+30) ||
	 (17*60+30 <= th*60+tm && th*60+tm <= 19*60+30)) &&
	table[max(sic, tic)][min(sic, tic)] <= 40)
      half = true;

    int ans = table[min(sic, tic)][max(sic, tic)];
    if (half) {
      ans /= 2;
      if (ans % 50 != 0)
	ans = ((ans+49) / 50) * 50;
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 0
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	var N int
	scanner.Scan()
	fmt.Sscanf(scanner.Text(), "%d", &N)

	ps := make([]float64, N+1)
	for i := 1; i < N+1; i++ {
		scanner.Scan()
		fmt.Sscanf(scanner.Text(), "%f", &ps[i])
	}

	dp := make([][]float64, N+1)
	for i := 0; i < len(dp); i++ {
		dp[i] = make([]float64, N+1)
	}

	dp[0][0] = 1
	for i := 0; i < len(dp); i++ {
		for j := 0; j < len(dp); j++ {
			if i+j > N {
				continue
			}
			if i == 0 && j == 0 {
				continue
			}
			if j == 0 {
				dp[i][j] = dp[i-1][j] * ps[i+j]
				continue
			}
			if i == 0 {
				dp[i][j] = dp[i][j-1] * (1.0 - ps[i+j])
				continue
			}
			dp[i][j] = dp[i][j-1]*(1.0-ps[i+j]) + dp[i-1][j]*ps[i+j]
		}
	}

	/*
		for i := 0; i < len(dp); i++ {
			for j := 0; j < len(dp); j++ {
				fmt.Printf("%f\t", dp[i][j])
			}
			fmt.Println()
		}
	*/

	ans := 0.0
	for i, j := N, 0; i > j; i, j = i-1, j+1 {
		ans = ans + dp[i][j]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 44672
s = int(input())
l = [int(x) for x in list(str(s))]
k = int(input())
gosencho = 1

if k <= 100:
    for i in range(k):
        if l[i] != 1:
            gosencho = l[i]
            break
else:
    for i in range(len(l)):
        if l[i] != 1:
            gosencho = l[i]
            break

print(gosencho)

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

int main(){
	while(1){
		int w, q;
		int a[101];
		
		scanf(" %d %d", &w, &q);
		if(w==0) break;
		
		memset(a, -1, sizeof(a));
		for(int i=0; i<q; ++i){
			char order;
			scanf(" %c", &order);
			
			if(order=='s'){
				int x, y;
				scanf(" %d %d", &x, &y);	
				
				bool flag=true;
				for(int i=0; i+y<=w; ++i){
					if(a[i]==-1){
						bool sl=true;
						for(int j=0; j<y; ++j){
							if(a[i+j]!=-1){
								sl=false;
								break;	
							}
						}
						
						if(sl){
							for(int j=0; j<y; ++j) a[i+j]=x;	
							printf("%d\n", i);
							flag=false;
						}	
					}
					
					if(!flag) break;
				}
				
				if(flag) printf("impossible\n");
			}
			else if(order=='w'){
				int z;
				scanf(" %d", &z);
				
				for(int i=0; i<w; ++i){
					if(z==a[i]) a[i]=-1;	
				}
				
			}
			
		}
		printf("END\n");
	}
} 

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

int main() {
    cin.tie(0)->sync_with_stdio(false);

    int a, b, c;
    cin >> a >> b >> c;

    if (a == b && b == c) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int[] a = sc.IntArray();

        long[] sum = new long[n];

        for (int i = 0; i < n; i++)
        {
            sum[i] = i == 0 ? a[i] : sum[i - 1] + a[i];
        }

        long total = sum[n - 1];
        long answer = long.MaxValue;

        for (int i = 0; i < n - 1; i++)
        {
            long diff = Math.Abs((total - sum[i]) - sum[i]);
            answer = Math.Min(answer, diff);
        }

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


Measured memory_bytes: 33884
let mcm p n =
  let dp = Array.make_matrix (n + 1) (n + 1) max_int in
  for i = 1 to n do dp.(i).(i) <- 0 done;
  for l = 1 to n - 1 do
    for i = 1 to n - l do
      let j = i + l in
      for k = i to j - 1 do
        dp.(i).(j) <- min dp.(i).(j) (dp.(i).(k) + dp.(k+1).(j) + p.(i-1)*p.(k)*p.(j))
      done
    done
  done;
  dp.(1).(n)

let () =
  let n = read_int () in
  let p = Array.make (n + 1) 0 in
  for i = 0 to n - 1 do
    let (r, c) = Scanf.scanf "%d %d\n" (fun r c -> (r, c)) in
    p.(i) <- r;
    p.(i+1) <- c;
  done;
  mcm p n |> Printf.printf "%d\n"

Measured memory_bytes: 2432
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
    }
    let mut ans = 0;
    for ki in k..=n + 1 {
        let max: usize = (n - (ki - 1)..=n).sum();
        let min: usize = (0..=ki - 1).sum();
        ans += max - min + 1;
        ans %= 1_000_000_007;
    }
    println!("{}", ans);
}


Measured memory_bytes: 2152
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = ReadLine();
            var X = long.Parse(N);
            var FX = N.Select(n => n - '0').Sum();
            if (0 == X % FX)
                WriteLine("Yes");
            else
                WriteLine("No");
        }

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 28256
n=list(input())
if n[0]==n[1]==n[2]:
    print(n[0]+n[1]+n[2])
else:
    if int(n[0])>int(n[1]) or (int(n[0])==int(n[1]) and int(n[0])>int(n[2])):
        print(n[0]+n[0]+n[0])
    else:
        n[0]=int(n[0])+1
        n[0]=str(n[0])
        print(n[0]+n[0]+n[0])

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::string S; std::cin >> S;
  if ( S == "AAA" || S == "BBB" ) std::cout << "No" << std::endl;
  else std::cout << "Yes" << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

class XorShift {
	unsigned int x, y, z, w, t;
public:
	XorShift() {
		x = 133553533;
		y = 314867339;
		z = 664298413;
		w = 999999937;
		t = 0;
	}
	unsigned int rand() {
		t = x ^ (x << 11);
		x = y;
		y = z;
		z = w;
		w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
		return w & 0x7fffffff;
	}
};

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

	cin >> N;
	if (N == 1) {
		cout << "? 1" << endl;
		string s;
		cin >> s;
		if (s[0] == 'R') {
			cout << "! RB" << endl;
		}
		else {
			cout << "! BR" << endl;
		}
		return 0;
	}
	vector<int>red(N * 2 + 1);
	for (int i = 1; i <= 1; i++) {
		cout << "?";
		for (int j = 0; j < N; j++) {
			cout << " " << (i + j <= N * 2 ? i + j : i + j - N);
		}
		cout << endl;
		string s;
		cin >> s;
		if (s[0] == 'R')red[i] = 1;
		else red[i + N] = 1;
	}
	L = 1, R = N + 1;
	while (R - L > 1) {
		int mid = (R + L) / 2;
		cout << "?";
		for (int j = 0; j < N; j++) {
			cout << " " << mid + j;
		}
		cout << endl;
		string s;
		cin >> s;
		if (s[0] == 'R')red[mid] = 1;
		else red[mid + N] = 1;
		if (red[mid] == red[L])L = mid;
		else R = mid;
	}
	string ret(2 * N + 1, ',');
	for (int i = 1; i <= N * 2; i++) {
		if (i < R || i >= R + N - 1) {
			cout << "? " << i;
			for (int j = R; j < R + N - 1; j++) {
				cout << " " << j;
			}
			cout << endl;
			string s;
			cin >> s;
			if (s[0] == 'R')ret[i] = 'R';
			else ret[i] = 'B';
		}
	}
	vector<int>r;
	vector<int>b;
	for (int i = 1; i <= N * 2; i++) {
		if (ret[i] == 'R')r.push_back(i);
		else if(ret[i]=='B') b.push_back(i);
	}
	r.resize(N / 2);
	b.resize(N / 2);
	for (int i = R; i < R + N - 1; i++) {
		cout << "? " << i;
		for (auto j : r)cout << " " << j;
		for (auto j : b)cout << " " << j;
		cout << endl;
		string s;
		cin >> s;
		ret[i] = s[0];
	}
	cout << "! ";
	for (int i = 1; i <= 2 * N; i++)cout << ret[i];
	cout << endl;

}

Measured memory_bytes: 724
import java.util.Scanner;

public class Main {

    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());
        String S = scanner.nextLine();

        if(n >= S.length()){
            System.out.println(S);
        } else {
            System.out.println(S.substring(0, n)+"...");
        }

        scanner.close();
    }

}


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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    int n,k;
    cin >> n >> k;
    int x[n];
    REP(i,n){
        cin >> x[i];
    }
    ll max1 = LINF;
    if(x[0]>=0)COUT(x[k-1]);
    else if(x[n-1]<=0)COUT(abs(x[n-k]));
    else{
        for(int i=0;i<n-k+1;i++){
            ll ans = 0;
            int num = min(abs(x[0+i]),abs(x[k+i-1]));
            ans += abs(x[i]);
            ans += abs(x[k+i-1]);
            max1 = min(max1,ans+num);
        }
        COUT(max1);
    }
    return 0;
}

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

int a, b, x, y;

int main() {
  cin >> a >> b;
  if (a > b) {
    cout << "a > b";
  }
  if (a < b) {
    cout << "a < b";
  }
  if (a == b) {
    cout << "a == b";
  }
  cout << endl;
  return 0;
}

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

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

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

const int INF=INT_MAX;
const ld PI=acos(-1);//3.1415926535897932384626433
const ld E=2.71828183;
const int MOD=1e9+7;

vi bfs(vector<vi>adj,int src){
    //adjacency list, not-weighted, possibly directed ,src is 1-indexed, adj[0].size()=0!!!
    //for n vertices, adj.size()=n+1. (constructed via push_back() ).

    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return dst;
}
vi bfsParents(vector<vi>adj,int src){
    vi parents=vi(adj.size(),INF);
    parents[src]=-1;
    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                parents[nbr]=c;
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return parents;
}
vi shortestPath(vector<vi>adj,int src,int dst){
    vi bfsParetns=bfsParents(adj,src);
    vi ans;
    while(src!=dst){
        if(bfsParetns[src]==INF)
            return {};
        ans.push_back(src);
        src=bfsParetns[src];
    }
    return ans;
}
int powMod(int base,int exp,int mod){
    //(base^exp) %mod
    int ans=1;
    for(int i=0; i<exp; i++)
        ans=((ans%mod)*(base%mod))%mod;
    return ans;
}
vi divisorsOf(int n){
    //vector of divisors of n (inc. 1 , excl.n)
    vi ans;
    for(int i=1; i*i<=n; i++){
        if(n%i==0)
            ans.push_back(i);
        if(i*i!=n && i!=1)
            ans.push_back(n/i);
    }
    return ans;
}
int gcd(int a,int b){
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}

ld log (ld a,ld b){return log(b)/log(a);}
ll power(ll base, ll exp){
    ll res=1;
    while(exp){
        exp--;
        res*=base;
    }
    return res;
}
void solve();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
        solve();
    return 0;
}
void solve (){
    string s,t;
    cin >> s >> t;
    int ans=0;
    int n=s.size();
    for(int i=0; i<n; i++)
        if(s[i]!=t[i])
            ans++;
    cout << ans << "\n";
}

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

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

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

int dy[4]={-1,1,0,0};
int dx[4]={0,0,1,-1};

int main(){
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    FOR(i, 1, 4) {
        if ((A*B*i)%2 == 1) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

const ll mod = 1000000007;
//const ll mod = 998244353;

template<int MOD> class Fp {
    ll val;
public:
    constexpr Fp(ll v = 0) noexcept : val(v % MOD) {
        if(val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator- () const noexcept { return val ? MOD - val : 0; }
    constexpr Fp operator+ (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator- (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator* (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator/ (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator+= (const Fp& r) noexcept {
        val += r.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator-= (const Fp& r) noexcept {
        val -= r.val;
        if(val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator*= (const Fp& r) noexcept {
        (val *= r.val) %= MOD;
        return *this;
    }
    constexpr Fp& operator/= (const Fp& r) noexcept {
        ll a = r.val, b = MOD, u = 1, v = 0;
        while(b){
            ll t = a/b;
            a -= t*b; swap(a, b);
            u -= t*v; swap(u, v);
        }
        (val *= u) %= MOD;
        if(val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator== (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator!= (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    constexpr bool operator> (const Fp& r) const noexcept {
        return this->val > r.val;
    }
    constexpr bool operator< (const Fp& r) const noexcept {
        return this->val < r.val;
    }
    friend constexpr ostream& operator<< (ostream &os, const Fp<MOD>& x){
        ll tmp = x.val;
        os << tmp;
        return os;
    }
    friend constexpr istream& operator>> (istream &is, const Fp<MOD>& x){
        ll tmp;
        is >> tmp;
        x = Fp<MOD>(tmp);
        return is;
    }
    constexpr Fp<MOD> modpow(ll n) noexcept {
        if(n == 0) return 1;
        auto t = modpow(n>>1);
        t *= t;
        if(n & 1) t *= *this;
        return t;
    }
};
using mint = Fp<mod>;

vector<pair<ll,ll>> factorial(ll n){
    vector<pair<ll, ll>> ans;
    for(ll i = 2; i*i <= n; i++){
        ll ex = 0;
        while(n%i == 0){
            ex++;
            n /= i;
        }

        ans.emplace_back(i, ex);
    }
    if(n != 1) ans.emplace_back(n, 1);
    return ans;
}

int main(){
    ll n; cin >> n;
    map<ll, ll> div;
    for(ll i = 1; i <= n; ++i){
        vector<pair<ll,ll>> t = factorial(i);
        for(auto j : t){
            div[j.first] += j.second;
        }
    }
    mint ans(1);
    for(auto i : div){
        ans *= (i.second+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const int INF = 1000000000; // 10^9
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int K;
    string S;
    cin >> K >> S;

    if(S.length() <= K){
        cout << S << endl;
        return 0;
    } else {
        cout << S.substr(0,K) << "..." << endl;
    }
}


Measured memory_bytes: 3632
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const A = input[1].map(Number);

  A.sort((a, b) => a - b);

  return A[A.length - 1] - A[0];
};

console.log(main(read()));


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



using ll=long long;


ll func(ll n){
	if(n==1)return 1;
	return 2*func(n/2)+1;
}


int main(){
	
	
	#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll h;
	cin>>h;
	ll ans=func(h);
	cout<<ans;
	return 0;
	
	
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void bubbleSort(int A[], int N)
{
	int flag = 1, k = 0;
	while (flag) {
		flag = 0;
		int i = 0;
		for (int j = N - 1; j > i; j--) {
			if (A[j] < A[j - 1]) {
				int t = A[j - 1];
				A[j - 1] = A[j];
				A[j] = t;
				flag = 1;
				k++;
			}
		}
		i++;
	}

	for (int i = 0; i < N - 1; i++) {
		cout << A[i] << " ";
	}
	cout << A[N - 1] << endl;

	cout << k << endl;
}


int main()
{
	const int MAX = 100;
	int A[MAX], N;

	cin >> N;

	for (int i = 0; i < N; i++) cin >> A[i];

	bubbleSort(A, N);
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e18+7;

int H,W;
int a[505][505];
int go[300000][5];

int main(){ 

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

cin>>H>>W;

for(int i=0; i<H; i++){
	for(int j=0; j<W; j++){
		cin>>a[i][j];
	}
}

int N=0;
for(int i=0; i<H; i++){
	if(i%2){
		for(int j=W-1; j>=0; j--){
			if(j==W-1){
				if(a[i-1][j]%2){
					a[i-1][j]--;
					a[i][j]++;
					go[N][0]=i-1; go[N][1]=j; go[N][2]=i; go[N][3]=j;
					N++;
				}
			}else{
				if(a[i][j+1]%2){
					a[i][j+1]--;
					a[i][j]++;
					go[N][0]=i; go[N][1]=j+1; go[N][2]=i; go[N][3]=j;
					N++;
				}
			}
		}
	}else{
		for(int j=0; j<W; j++){
			if(i==0&&j==0) continue;
			if(j==0){
				if(a[i-1][j]%2){
					a[i-1][j]--;
					a[i][j]++;
					go[N][0]=i-1; go[N][1]=j; go[N][2]=i; go[N][3]=j;
					N++;
				}
			}else{
				if(a[i][j-1]%2){
					a[i][j-1]--;
					a[i][j]++;
					go[N][0]=i; go[N][1]=j-1; go[N][2]=i; go[N][3]=j;
					N++;
				}
			}
		}
	}
}

cout<<N<<endl;
for(int i=0; i<N; i++){
	cout<<go[i][0]+1<<" "<<go[i][1]+1<<" "<<go[i][2]+1<<" "<<go[i][3]+1<<endl;
}

}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int N;

void dfs(string &S, char l) {
    // dump(S);
    if (S.size() == N) {
        cout << S << endl;
        return;
    }

    for (char nxt = 'a'; nxt <= l + 1; nxt++) {
        S.push_back(nxt);
        dfs(S, max(nxt, l));
        S.pop_back();
    }
}

int main() {
    cin >> N;

    string S = "a";
    dfs(S, 'a');

    return 0;
}

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

int main() {
    ll n, a, ans;
    cin >> n;

    cin >> ans;

    for (int i=0; i<n-1; i++) {
        cin >> a;
        if (a == 0) {
            ans = 0;
            break;
        }
        if (ans != -1) {
            if (ans*a < ans || ans*a >= 1000000000000000001) {
                ans = -1;
            } else {
                ans = ans * a;
            }
        }      
    } 

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(){
	int low[100],a,b,k;
	char c;
	for(a=0;;a++){
		if(scanf("%c",&c) == EOF){break;}
		if(c == 'I'){low[a] = 1;}
		else if(c == 'V'){low[a] = 5;}
		else if(c == 'X'){low[a] = 10;}
		else if(c == 'L'){low[a] = 50;}
		else if(c == 'C'){low[a] = 100;}
		else if(c == 'D'){low[a] = 500;}
		else if(c == 'M'){low[a] = 1000;}
		if(c == 10){
			k = 0;
			for(b=0;b<a-1;b++){
				if(low[b]<low[b+1]){k+=low[b+1]-low[b];b++;}
				else{k+=low[b];}
			}
			if(a>1){if(low[a-2]>=low[a-1]){k+=low[a-1];}}
			if(a == 1){k += low[0];}
			printf("%d\n",k);
			a = -1;
		}
	}
	return 0;
}

Measured memory_bytes: 0
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a) vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    ll n,c,k;cin>>n>>c>>k;
    vecrep(n,a);
    sort(range(a));
    a.pb(inf);
    ll ang=a[0]+k,lau=0,cus=0,ans=0;
    rep(i,0,n){
        cus+=1;
        if(cus>=c||a[i+1]>ang){
            cus=0;
            lau=a[i];
            ans++;
            ang=a[i+1]+k;
        }
    }
    cout<<ans<<nnn;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll i,o,t,j,l,s,z;cin>>i>>o>>t>>j>>l>>s>>z;
    ll ans1 = i/2*2+o+j/2*2+l/2*2;
    if(i>0&&j>0&&l>0){
        ll i2=i-1, j2=j-1, l2=l-1;
        ll ans2 = i2/2*2+o+j2/2*2+l2/2*2+3;
        ans1 = max(ans1,ans2);
    }

    cout<<ans1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main() {
	int N, X[100], i, j, min = 999999, check = 0;
	cin >> N;
	for (i = 0;i < N;i++) {
		cin >> X[i];
	}
	for (i = 1;i < 101;i++) {
		for (j = 0;j < N;j++) {
			check += abs(X[j] - i) * abs(X[j] - i);
		}
		if (min > check) {
			min = check;
		}
		check = 0;
	}
	cout << min << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
	}
	else{
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, L, R;
  int sum;
  int i;
  cin >> N;
  
  sum = 0;
  for (i=0; i < N; i++) {
    cin >> L >> R;
    sum += R - L + 1;
  }
    cout << sum;
}

Measured memory_bytes: 256
N=int(input())
import math

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers

# 関数の呼び出し
pr=callIsPrime(1000)
ans=1
for i in range(len(pr)):
  count=0
  j=1
  while(N>=pr[i]**j):
    count+=N//(pr[i]**j)
    j+=1
  ans=(ans*(count+1))%(10**9+7)
print(ans)

Measured memory_bytes: 3064
n,y=map(int,input().split())
a=0
b=0
c=(y%5000)//1000
n-=c
y-=c*1000
buf=0
if n*10000<y or n*1000>y:
    print(-1,-1,-1)
elif n==0:
    print(0,0,c)
else:
    for i in range(y//10000+1):
        y0=y-i*10000
        n0=n-i
        for j in range(y0//5000+1):
            if j*5000+(n0-j)*1000==y0:
                buf=1
                a=i
                b=j
                c+=n0-j
                break
        if buf==1:
            print(a,b,c)
            break
    if buf==0:
        print(-1,-1,-1)

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

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

#define DEBUG(x) cerr << #x << " = " << x << endl
int F[20][20];

const int INF = (int)1e9;
const int dy[4] = { 0, -1, 0, 1 };
const int dx[4] = { 1, 0, -1, 0 };

int W, H;
int ans;

void solve(const int y, const int x, const int depth) {
  if(F[y][x] == 3) {
    ans = min(ans, depth);
    return;
  }
  if(depth >= 10) return;
  for(int k = 0; k < 4; ++k) {
    int ny = y, nx = x;
    if(0 <= ny + dy[k] && ny + dy[k] < H && 0 <= nx + dx[k] && nx + dx[k] < W && F[ny + dy[k]][nx + dx[k]] == 1) continue;
    bool ok = true;
    int sy = -1, sx = -1;
    while(true) {
      if(F[ny][nx] == 3) break;
      ny += dy[k];
      nx += dx[k];
      if(ny < 0 || ny >= H || nx < 0 || nx >= W) {
        ok = false;
        break;
      }
      if(F[ny][nx] == 1) {
        sy = ny;
        sx = nx;
        F[sy][sx] = 0;
        ny -= dy[k];
        nx -= dx[k];
        break;
      }
    }
    if(ok)
      solve(ny,nx,depth+1);
    if(sy != -1 && sx != -1) {
      F[sy][sx] = 1;
    }
  }
}

int main() {
  while(true) {
    cin >> W >> H;
    if(W == 0 && H == 0) break;
    REP(i,H) REP(j,W) cin >> F[i][j];
    ans = INF;
    REP(i,H) REP(j,W) {
      if(F[i][j] == 2) solve(i,j,0);
    }
    if(ans == INF) cout << -1 << endl;
    else cout << ans << endl;
  }
}

Measured memory_bytes: 1156
import sys
input = sys.stdin.readline
h, w, d = map(int, input().split())
num = h * w
x = [0] * (num + 1)
y = [0] * (num + 1)
mp = [0] * (num + 1)
for i in range(h):
    for j, a in enumerate(map(int, input().split())):
        x[a], y[a] = [i+1, j+1]
for i in range(d+1, num+1):
    mp[i] = mp[i-d] + abs(x[i] - x[i-d]) + abs(y[i] - y[i-d])
q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(mp[r]-mp[l])



Measured memory_bytes: 9928
#include <iostream>


using namespace std;

int main()
{

int a,b,x;
cin>>a>>b>>x;
if(a>x){
    cout<<"NO";
}
else if((a+b)<x){
    cout<<"NO";
}
else if((a+b)>x &&a<=x){
    cout<<"YES";
}


    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
int main(void){
    
    int a;
    int b;
    
    scanf("%d %d", &a, &b);
    
    if(a<=9&&b<=9){
        
        printf("%d", a*b);
        
    } else {
        
        printf("-1");
        
    }
    
    return 0;
    
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
    
    

    int n;
    cin>>n;
    ll ans=1;
    for(int i=1;i<=n;i++){
        ans*=i;
        ans%=MOD;
    }
    fin(ans);

}


Measured memory_bytes: 256
#include <stdio.h>

int min1(int a, int b) {
    if (a < b)
        return a;
    else
        return b;
}

int main(int argc, const char * argv[]) {
    int N;
    scanf("%d", &N);
    int b[N-1];
    for(int i=0;i<N-1;i++){
        scanf("%d", &b[i]);
    }
    int sc=0;
    if(N==2){
        printf("%d\n", b[N-2]*2);
        return 0;
    }
    for(int i=0;i<N;i++){
        if(i==0){
            sc += b[0];
        }else if(i == N-1){
            sc += b[N-2];
        }else{
            sc += min1(b[i-1], b[i]);
        }
    }
    printf("%d\n", sc);
    return 0;
}

Measured memory_bytes: 128
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu) FUNC(printe) FUNC(printe0);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> as(n); cin >> as;
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += (~i & 1) && (as[i] & 1);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
int main(){
    string str ;
    cin >> str ;
    int ret=0;
    if(str[0]==str[1] && str[2]==str[1] && str[0]=='R')ret=3;
    else if(str[0]==str[1] && str[0]=='R')ret=2;
    else if(str[1]==str[2] && str[1]=='R')ret=2;
    else if(str[0]=='R'||str[1]=='R'||str[2]=='R')ret=1;
    cout << ret << endl ;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

int main(void){
	long long int n, c;
	static long long int dpc[100001] = {}, dpi[100001] = {};
	cin >> n >> c;

	vector<long long int> x(n + 2), v(n + 1);

	for (int i = 1; i < n + 1; i++){
		cin >> x[i] >> v[i];
	}

	x[0] = 0;
	v[0] = 0;
	x[n+1] = c;

	long long int m = 0;
	long long int sum = 0;

	//clockwise
	for (int i = 1; i < n + 1; i++){
		sum = sum + v[i] - (x[i] - x[i-1]);
		dpc[i] = max(sum, dpc[i-1]);
		m = max(m, sum);
	}

	//inverse
	sum = 0;
	for (int i = n; i >= 1; i--){
		sum = sum + v[i] - (x[i+1] - x[i]);
		m = max(m, sum);
		dpi[i] = max(sum, dpi[i+1]);
	}

	for (int i = 1; i < n + 1; i++){
		sum = 0;
/*		for (int j = 1; j <= i; j++){
			sum = sum + v[j] - (x[j] - x[j-1]);
		}*/

		m = max(m, dpc[i] + dpi[i+1] - x[i]);
	}

	for (int i = 1; i < n + 1; i++){
		sum = 0;
/*		for (int j = n; j >= i; j--){
			sum = sum + v[j] - (x[j+1] - x[j]);
		}*/
		m = max(m, dpi[i] + dpc[i-1] - (c - x[i]));
	}


	cout << m << endl;
}

Measured memory_bytes: 3328