akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val h = sc.nextInt()
    val w = sc.nextInt()
    val grid = Array(h) { Array(w) { '.' } }
    val isWall = Array(h) { BitSet(w) }
    for (i in 0 until h) {
        val s = sc.nextLine()
        for (j in 0 until w) {
            grid[i][j] = s[j]
            isWall[i][j] = grid[i][j] == '#'
        }
    }
    val left = Array(h) { IntArray(w) }
    val right = Array(h) { IntArray(w) }
    val up = Array(h) { IntArray(w) }
    val down = Array(h) { IntArray(w) }
    for (i in 0 until h) {
        var count = 0
        for (j in 0 until w) {
            left[i][j] = count
            if (!isWall[i][j]) {
                count++
            } else {
                count = 0
            }
        }
    }
    for (i in 0 until h) {
        var count = 0
        for (j in w - 1 downTo 0) {
            right[i][j] = count
            if (!isWall[i][j]) {
                count++
            } else {
                count = 0
            }
        }
    }
    for (j in 0 until w) {
        var count = 0
        for (i in 0 until h) {
            up[i][j] = count
            if (!isWall[i][j]) {
                count++
            } else {
                count = 0
            }
        }
    }
    for (j in 0 until w) {
        var count = 0
        for (i in h - 1 downTo 0) {
            down[i][j] = count
            if (!isWall[i][j]) {
                count++
            } else {
                count = 0
            }
        }
    }
    var ans = 0
    for (i in 0 until h) {
        for (j in 0 until w) {
            if (isWall[i][j]) continue
            val num = left[i][j] + right[i][j] + up[i][j] + down[i][j] + 1
            ans = maxOf(ans, num)
        }
    }
    println(ans)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 114228
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
struct UnionFind {
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    int size(int x) {
        return -r[root(x)];
    }
};
 
 
int main() {
    int N, M;
    cin >> N >> M;
 
    UnionFind UF(N);
    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        A -= 1; B -= 1;
        UF.unite(A, B);
    }
 
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans = max(ans, UF.size(i));
    }
 
    cout << ans << endl;
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] Bstr = br.readLine().split(" ");
        int[] B = new int[N-1];

        for(int i = 0; i < N-1; i++){
            B[i] = Integer.parseInt(Bstr[i]);
        }
        
        int[] A = new int[N];
        
        int sum = 0;
        for(int i = 0; i < N-1; i++){
            if ( i == 0 ){
                A[i] = B[i];
            } else {
                A[i] = Math.min(A[i], B[i]);
            }
            
            sum += A[i];
            
            A[i+1] = B[i];
            
            if(i == N-2 ) sum+=A[N-1];
        }
        
        System.out.println(sum);
    }
}


Measured memory_bytes: 23124
n, m = map(int, input().split())

submit = []
for i in range(m):
    temp = [x for x in input().split()]
    submit.append(temp)

ac = [0] * (n + 1)
wa = [0] * (n + 1)

for i in range(m):
    result = submit[i][1]
    question = int(submit[i][0])

    if result == 'AC' and ac[question] == 0:
        ac[question] = 1
    elif result == 'WA' and ac[question] == 0:
        wa[question] += 1

for i in range(n + 1):
    if ac[i] != 1:
        wa[i] = 0

print(sum(ac), sum(wa))

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

#define int long long
#define x first
#define y second
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

void solve(){
	int n;
	cin >> n;
	vector<pair<int,int>> v;
	for(int i = 0;i < n;i++){
		int a,b;
		cin >> a >> b;
		v.push_back({a,b});
	}
	sort(v.begin(),v.end(),[&](pair<int,int> a, pair<int,int> b){
		return (a.x-a.y) < (b.x-b.y);
	});
	int ans = abs(v[0].x-v.back().x)+abs(v[0].y-v.back().y);
	sort(v.begin(),v.end(),[&](pair<int,int> a, pair<int,int> b){
		return (a.x+a.y) < (b.x+b.y);
	});
	ans = max(ans,abs(v[0].x-v.back().x)+abs(v[0].y-v.back().y));
	cout << ans << "\n";
}

signed main(){
	fastio
	int t = 1;
	//cin >> t;
	while(t--) solve();
}

Measured memory_bytes: 7416
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace::std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// #include <boost/numeric/interval.hpp>
// #include <boost/numeric/interval/io.hpp>
// #include <boost/intrusive/rbtree.hpp>
// #include <boost/geometry.hpp>
// #include <boost/geometry/geometries/linestring.hpp>
// #include <boost/geometry/geometries/polygon.hpp>
// #include <boost/geometry/geometries/point_xy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
using namespace::std;
// namespace mp = boost::multiprecision;
// typedef mp::number<mp::cpp_dec_float<0>> cfloat;
// typedef mp::cpp_int cint;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<lint> vec;
typedef vector<vector<lint>> mat;
typedef vector<vector<vector<lint>>> mat3;
typedef vector<double> dvec;
typedef vector<vector<double>> dmat;
typedef vector<vector<vector<double>>> dmat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef vector<vector<vector<string>>> smat3;
typedef vector<pair<lint,lint>> pvec;
typedef vector<vector<pair<lint,lint>>> pmat;
typedef vector<vector<vector<pair<lint,lint>>>> pmat3;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define irep(i) for(lint i = 0;; i++)
#define irep1(i) for(lint i = 1;; i++)
#define irep2(i) for(lint i = 2;; i++)
#define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--)
#define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define PI 3.141592653589793
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"");if(i>INF/2)cout<<"INF";else cout<<i;f=1;}cout<<"\n";}while(0)
#define output2(v) for(auto j:v)output(j);
#define input(a,n) lint n;cin>>n;vector<lint>a(n);rep(i,n)cin>>a[i];
#define SUM(v) accumulate(all(v),0LL)
#define INF (1LL<<60)
#define IINF (1<<30)
#define EPS (1e-10)
#define LINF 9223372036854775807
#define MOD 1000000007
#define endl "\n"
template<typename T=lint>T in(){return *istream_iterator<T>(cin);}
inline lint gcd(lint a,lint b){return b?gcd(b,a%b):a;}
inline lint lcm(lint a,lint b){return a*b/gcd(a,b);}
inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;}
inline bool chmax(auto& s,const auto& t){bool res=s<t;s=max(s,t);return res;}
vector<lint> dx={-1,1,0,0,1,1,-1,-1};
vector<lint> dy={0,0,-1,1,1,-1,1,-1};


int main(){
    lint n;
    cin>>n;
    vec a(n);
    rep(i,n)cin>>a[i];
    lint ans=0;
    rep(i,n)ans+=(a[i]%2);
    if(ans)cout<<"first";
    else cout<<"second";
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**7)

N = int(input())
X = list(input())

M = X.count("1")
a = -1
if M==1:
    a = X.index("1")

def f0(X,M):
    if M<=0: return 0
    ret = 0
    for i,x in enumerate(X[::-1]):
        if x=="1" :
            ret += pow(2,i,M)
            ret %= M
    return ret

def f(M):
    if M==0: return 0
    n = bin(M).count("1")
    return 1+f(M%n)

n0 = f0(X,M+1)
n1 = f0(X,M-1)

for i in range(N):
    if M==1 and a==i:
        print(0)
    else:
        if X[i] == "0":
            n = (n0 + pow(2,N-1-i,M+1))%(M+1)
        else:
            n = (n1 - pow(2,N-1-i,M-1))%(M-1)
        print(f(n)+1)

Measured memory_bytes: 12348
package main

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

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

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

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

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

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

//Main
var sc = bufio.NewScanner(os.Stdin)
var s, w int

func main() {
	sc.Split(bufio.ScanWords)
	s, w = nextInt(), nextInt()
	if w >= s {
		fmt.Println("unsafe")
	} else {
		fmt.Println("safe")
	}
}


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

#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) cerr << #x << "=" << static_cast<bitset<16> >(x) << endl;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 10000000;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
typedef pair<int, int> P;
/** Problem1186 : Integral Rectangles **/
int main()
{
	double h, w;
	while (cin>>h>>w, h||w) {
		vector<pair<P, int> >vec;
		
		REP(i, 1, 151) {
			REP(j, 1, 151) {
				if (i>j) {
					vec.push_back(pair<P, int>(P(i*i+j*j, j), i));
				}
			}
		}
		
		sort(vec.begin(), vec.end());
		vector<pair<P, int> >::iterator it = vec.begin();
		for (;it != vec.end(); it++) {
			if (it->first.second==h && it->second==w) {
				it++;
				cout << it->first.second << " " << it->second << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 1392
let rec iter a b f = if a >= b then [] else let v = f a in v :: iter (a+1) b f
let stat s =
  let res = Array.make 26 false in
  String.iter (fun c -> res.(int_of_char c - 97) <- true) s;
  res
let () =
  Scanf.scanf "%d %s" @@ fun n s ->
  iter 1 n (fun l ->
    let x, y = stat (String.sub s 0 l), stat (String.sub s l (n-l)) in
    iter 0 26 (fun i -> if x.(i) && y.(i) then 1 else 0)
    |> List.fold_left (+) 0)
  |> List.fold_left max 0 |> Printf.printf "%d\n"

Measured memory_bytes: 2560
use std::collections::BTreeSet;

#[derive(Ord, Eq, PartialEq, PartialOrd)]
enum QueryType {
    Start = 2,
    Stop = 1,
    Query = 3,
}

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let q: usize = sc.read();
    let mut events = vec![];
    for _ in 0..n {
        let s: i64 = sc.read();
        let t: i64 = sc.read();
        let x: i64 = sc.read();
        events.push((s - x, QueryType::Start, x));
        events.push((t - x, QueryType::Stop, x));
    }
    for _ in 0..q {
        let d: i64 = sc.read();
        events.push((d, QueryType::Query, 0));
    }
    events.sort();

    let mut stopping_heap = BTreeSet::new();
    for (_, t, x) in events.into_iter() {
        match t {
            QueryType::Start => {
                stopping_heap.insert(x);
            }
            QueryType::Stop => {
                stopping_heap.remove(&x);
            }
            QueryType::Query => match stopping_heap.iter().next() {
                Some(x) => {
                    println!("{}", x);
                }
                None => {
                    println!("-1");
                }
            },
        }
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 28276
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int k, a, b; cin >> k >> a >> b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}


Measured memory_bytes: 3584
N,M = map(int,input().split())
P = list(map(int,input().split()))

class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def check(self, x, y):
        return self.find(x) == self.find(y)

uf = UnionFind(N)

for _ in range(M):
    x,y = map(int,input().split())
    uf.union(x,y)

Ans = 0
for i,p in enumerate(P,1):
    Ans += 1 if uf.check(i,p) else 0

print(Ans)

Measured memory_bytes: 14008
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;



public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n=Integer.parseInt(br.readLine());
		String s=br.readLine();
		String[] a=s.split(" ");
		for(int i=a.length;i>0;i--){
			System.out.print(a[i-1]);
			if(i!=1)System.out.print(" ");
		}br.close();System.out.println();
}}

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

const int N = 2e5+1;
int n, a[N], cnt[N];
long res = 0;

int main()
{
  fastio;
  cin >> n;
  for (int i = 1; i <= n; i++){
    cin >> a[i]; 
    res += cnt[a[i]]; cnt[a[i]]++;
  }
  for (int i = 1; i <= n; i++) cout << res - cnt[a[i]] + 1 << '\n';
  return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
using namespace std;

int main(){
  int n;
  cin >> n;
  long long a, count=0;
  for (int i = 0; i < n; i++){
    cin >> a;
    while (a % 2 == 0){
      count += 1;
      a /= 2;
    }
  }
  cout << count << endl;
  return 0;
}


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

int main()
{
    int N;
    cin >> N;
    int64_t total = 0;
    int64_t a[N];
    int64_t ans = 1e17;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        total += a[i];
    }
    int64_t x = 0;
    for (int i = 0; i < N - 1; i++)
    {
        x += a[i];
        int64_t y = (total - x);
        int64_t absxy = abs(x - y);
        ans = min(ans, absxy);
    }
    cout << ans << endl;
}

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

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long 
#define mod 998244353
#define pb push_back
#define setto(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define sz(i) int(i.size())
#define len(s) int(s.length())
#define UNIQUE(a) ((a).erase(unique((a).begin(), (a).end()), (a).end()))
#define INF LONG_MAX
#define random() ((ll)rand() << 32 | rand())
#define C(c) c-'a'

using namespace std; 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}
template<class T> void smax(T& a, T val) {if (a < val) a = val;}
template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}

//Check MAX size twiceeeeeeeeeeeeeeeeee, and verify it
const int MAX = 3*100010;

ll power(ll a, ll b, ll m){ll r = 1; while(b){if(b&1)r=(r*a)%m; a = (a*a)%m; b>>=1;}return r;}


#define int ll
ll f[MAX];
int n, a, b, k;
ll CC(ll n, ll r){
	ll nr = f[n];
	ll d1 = power(f[n-r], mod-2, mod);
	ll d2 = power(f[r], mod-2, mod);
	return ((nr*d1)%mod * d2) % mod;
}

main(){
	boost;

	f[0] = 1;
	for (int i = 1; i < MAX-5; ++i)
	{
		f[i] = (f[i-1] * i) % mod;
	}

	cin>>n>>a>>b>>k;

	ll ans = 0;
	for (ll i = 0; i <= n; ++i)
	{
		ll red = a*i;
		if(red >= 0 and red <= k){
			if((k-(a*i)) % b == 0){
				ll blue = (k-(1ll*a*i)) / b;
				if(blue >= 0 and blue <= n){
					ans+= (CC(n, i) * CC(n, blue)) % mod;
					ans%= mod;
				}
			}
		}
	}

	return cout<<ans, 0;
}

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


int main(){
    int A, B, C; cin >> A >> B >> C;
    if(A == B){
        if(A != C && B != C){
            cout << "Yes" << endl;
            return 0;
            }
    }

    if(B == C){
        if(C != A && C != A){
            cout << "Yes" << endl;
            return 0;
            }
    }

    if(C == A){
        if(C != B && A != B){
            cout << "Yes" << endl;
            return 0;
            }
    }

    cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 256
N = int(input())
count = 0
for i in range(N):
    K = list(map(int,input().split()))
    if K[0]>=K[1]+K[2] and K[0]%2==(K[1]+K[2])%2:
        count += 1
#print(count)   
if count == N:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

signed main() {
	int a, b; cin >> a >> b; a--;
	a = (a + b) % 24;
	cout << (a + 1) % 24 << endl;
}

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

int main(){
ll a,b; cin >> a >> b;
ll c=max(a,b); ll d=min(a,b);
for(;;){
    if(c==1 || d==1){
         cout << a*b << endl;
         break;
    }
    else if(c==0){
        a/=d; b/=d;
        cout << a*b*d << endl;
     	 break;
    }
    else if(d==0){
        a/=c; b/=c;
        cout << a*b*c << endl;
  	    break;
    }
    if(c<d) d=d%c;
    else c=c%d;
}
return 0;
}


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

bool check(int a, int b, int c){
    if(a*2 < b && b < c) return true;
    if(a < b*2 && b*2 < c) return true;
    if(a < b && b < c*2) return true;
    return false;
}

bool check(int a, int b, int c, int k){
    k--;
    if(k == 0){
        return check(a, b, c);
    }
    return check(a*2, b, c, k) || check(a, b*2, c, k) || check(a, b, c*2, k);
}

int main(){
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    if(check(a,b,c,k)) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3612
#include<stdlib.h>
#include<stdio.h>
#include<string.h>



int main(){
    long int X,Y=100;
    int i;
    long double y=100;
    scanf("%ld",&X);
    for (int i=1; Y<=1000000000000000000; i++) {
        y=Y;
        Y*=1.01;
        if(Y>=X){
            printf("%d\n",i);
            return 0;
        }
        
    }
    return 0;
}

Measured memory_bytes: 1732
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define INF 1000000
using namespace std;
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
int gcd(int a,int b){
    if(a<b) swap(a,b);
    return (a%b ? gcd(a%b,b) : b);
}
int main(){
    string str;
    while(cin >> str){
        int dir = 0,cnt = -1;
        if(str == "#") break;
        vector<int> vec;
        rep(i,str.size()){
            if(str[i] == 'n'){
                vec.push_back(0);
                i += 4;
            }
            else {
                vec.push_back(1);
                i += 3;
            }
        }
        reverse(vec.begin(),vec.end());
        rep(i,vec.size()){
            if(vec[i] == 1){
                dir = dir*2+90;
            }
            else {
                dir = dir*2-90;
                if(dir < 0) dir = 0;
            }
            cnt++;
        }
        if(dir == 0) {
            cout << 0 << endl;
            continue;
        }
        cnt = 1 << cnt;
        int a = gcd(dir,cnt);
        cout << dir/a;
        if(cnt/a != 1) cout << '/' << cnt/a;
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3212
import Foundation

let N = Int(readLine()!)!
let A = readLine()!.components(separatedBy: " ").map { Int($0)! }

if N == 0 && A[0] != 1 {
    print(-1)
    exit(EXIT_SUCCESS)
}

var minTop = Array<Int>.init(repeating: 0, count: N + 2)
var maxTop = Array<Int>.init(repeating: 0, count: N + 2)

for i in 0...N {
    minTop[N - i] = A[N - i] + lround(Double(minTop[N - i + 1]) / 2.0)
    maxTop[N - i] = A[N - i] + maxTop[N - i + 1]
}

var topCount = 0
for j in 0...N {
    if j == 0 {
        maxTop[0] = 1
    } else {
        let top = (maxTop[j - 1] - A[j - 1]) * 2
        if minTop[j] <= top {
            if top < maxTop[j] {
                maxTop[j] = top
            }
        } else {
            print(-1)
            exit(EXIT_SUCCESS)
        }
    }
    topCount += maxTop[j]
}

print(topCount)


Measured memory_bytes: 17536
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <time.h>
#include <random>
#include <string>
#include <cassert>
#include <vector>
#include <ostream>
#include <istream>
#include <stack>
#include <deque>
#include <queue>
#include <functional>
#include <chrono>
#include <stack>

using namespace std;

#define int long long
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define ld long double

ostream& operator<< (ostream &out, const vector<int> &b) {
    for (auto k : b) out << k << " ";
    return out;
}

istream& operator>> (istream& in, pii& b) {
    in >> b.first >> b.second;
    return in;
}

ostream& operator<< (ostream& out, const pii& b) {
    out << "{" << b.first << ", " << b.second << "}";
    return out;
}

template <typename T1, typename T2> inline bool chkmin(T1 &x, const T2 &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T1, typename T2> inline bool chkmax(T1 &x, const T2 &y) {if (x < y) {x = y; return 1;} return 0;}


#ifdef LOCAL
    #define dbg(x) cout << #x << " : " << (x) << "\n";
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 10;
#else
    #define dbg(x) 57
    const int INF = 1e18;
    // const int mod = 2600000069;
    // const int p = 179;
#endif

const ld PI = acos(-1);

#define time clock() / (double) CLOCKS_PER_SEC

// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,sse3,sse4")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC target("avx2")  
// #pragma GCC optimize("section-anchors")
// #pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
// #pragma GCC optimize("vpt")
// #pragma GCC optimize("rename-registers")
// #pragma GCC optimize("move-loop-invariants")
// #pragma GCC optimize("unswitch-loops")
// #pragma GCC optimize("function-sections")
// #pragma GCC optimize("data-sections")

mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n, 1), can(n, 0);
    can[0] = 1;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        x--, y--;
        cnt[x]--, cnt[y]++;
        if (can[x]) {
            can[y] = 1;
        }
        if (cnt[x] == 0) {
            can[x] = 0;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += can[i];
    }
    cout << ans << "\n";
}
/*

*/

Measured memory_bytes: 4788
#include<cstdio>
using namespace std;
int a[10101],f[105][105];
int main()
{
	int i,j,tmp,sum,n,m,xx,x,y; 
	scanf("%d%d",&n,&m);
	scanf("%d",&xx);
	for(i=1;i<=xx;i++)
	{
		scanf("%d",&a[i]);
	}
	x=1;y=1;tmp=1;sum=0;
	while(x<=n&&y<=m)
	{
		f[x][y]=tmp;
		sum++;
		if(sum==a[tmp])
		{
			sum=0;
			tmp++;
		}
		if(y==1&&x%2==0||y==m&&x%2==1)
			x++;
		else if(x%2==1)
			y++;
		else
			y--;
	}
	for(i=1;i<=n;i++)
	{ 
		for(j=1;j<=m;j++)
			printf("%d ",f[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
s = input()[::-1]
t = input()[::-1]
idx = -1
for si in range(len(s)):
    if si + len(t) > len(s): break

    find = True
    for ti in range(len(t)):
        if s[si + ti] != '?' and s[si + ti] != t[ti]:
            find = False
            break
    if find:
        idx = si
        break

if idx < 0:
    print('UNRESTORABLE')
    exit()

p1 = s[:idx] if idx > 0 else ''
p2 = s[idx + len(t):]
print((p1 + t + p2).replace('?', 'a')[::-1])

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

int main() {
	string S;
	cin >> S;

	if (S.at(0) != S.at(1) && S.at(1) != S.at(2) && S.at(2) != S.at(0))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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

double n,t,a;
double h[1010];

int main(){
    cin>>n>>t>>a;
    for(int i=0; i<n; i++){
        cin>>h[i];
        h[i]=t-(h[i]*0.006);
        h[i]-=a;
        if(h[i]<0)h[i]*=-1;
    }
    double ans=100000,t;
    for(int i=0; i<n; i++){
        if(h[i]<ans){
            ans=h[i];
            t=i+1;
        }
    }
    cout<<t<<endl;
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reps(i, n) for (int i = 1; i <= (int)n; i++)
#define vi vector<int>

#define ll long long
#define vl vector<ll>
#define vll vector<vl>

const int INF = 1e9;

int main() {
	int n;
	cin >> n;
	int a[200010];
	reps(i, n) cin >> a[i];
	ll sa[200010]={}, wa[200010]={};
	reps(i, n) if(i>a[i]) sa[i-a[i]]++;
	reps(j, n) if(j+a[j]<=n) wa[j+a[j]]++;
	ll ans=0;
	reps(i, n) ans+=sa[i]*wa[i];
	cout << ans << endl; 
	return 0;
}

Measured memory_bytes: 7536
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<map>
#include<set>
#include<queue>

using namespace std;

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(a) (a).begin(),(a).end()
#define PI 3.141592653589793238
#define INF 1050000000
#define INFL (long long)(4e18)

using vi = vector<int>;

template<class T>
struct Edge {
	int to;
	T cost;
	Edge() {};
	Edge(int to, T cost) : to(to), cost(cost) {};
};

template<class T>
class Graph {
	int n;
	bool directed;
	vector<vector<Edge<T>>> edges;
public:

	Graph(int n, bool directed) :n(n), directed(directed), edges(vector<vector<Edge<T>>>(n)) {};
	Graph() {};

	void add(int to, T cost) {
		emplace_back(to, cost);
	}

	int size() {
		return n;
	}
};


int main() {

	int N;

	cin >> N;

	vi A(N);

	REP(i, N) {
		cin >> A[i];
	}

	vector<long long> c(N);

	REP(i, N) {
		c[A[i] - 1]++;
	}

	long long whole = 0;

	REP(i, N) {
		whole += c[i] * (c[i] - 1) / 2;
	}


	REP(k, N) {
		cout << whole-c[A[k]-1]+1 << endl;
	}
	

	return 0;
}

Measured memory_bytes: 4992
#include<iostream>
using namespace std;
#define size 102
#define mod 100000
int dpTate[size][size];
int dpYoko[size][size];
int dpTateOnly[size][size];
int dpYokoOnly[size][size];

int main() {
	int w, h;
	while(cin >> w >> h, w||h) {
		for(int i = 0; i < h+2; i++){
			for(int j = 0; j < w+2; j++){
				dpTate[i][j] = 0;
				dpYoko[i][j] = dpTateOnly[i][j] = dpYokoOnly[i][j]
						= 0;
			}
		}
		
		dpTateOnly[1][1] = dpYokoOnly[1][1] = 1;
		
		for(int i = 1; i < h+1; i++){
			for(int j = 1; j < w+1; j++){
				if(i==1 && j==1) continue;
				dpTate[i][j] = (dpTate[i-1][j] + dpTateOnly[i-1][j]) % mod;
				dpYoko[i][j] = (dpYoko[i][j-1] + dpYokoOnly[i][j-1]) % mod;
				dpTateOnly[i][j] = dpYoko[i-1][j];
				dpYokoOnly[i][j] = dpTate[i][j-1];
			}
		}
		
		cout << (dpTate[h][w] + dpYoko[h][w] + dpTateOnly[h][w] + dpYokoOnly[h][w])
				% mod << endl;
	}
	
	
	
	return 0;
}

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

int main() {
  long n,ans=0,s;
  cin >> n;
  vector<long> aaa(n/2);
  vector<long> bbb(n/2,-1);
  for(long i=0;i<n;i++) {
    cin >> s;
    if(i*2+1!=n) aaa[min(i,n-i-1)]+=s;
  }
  for(long i=1;i<n/2;i++) {
    long x=0;
    for(long j=i;n-j>i;j+=i) {
      if(bbb[min(j,n-j-1)]==i) break;
      if(j*2+1==n) break;
      x+=aaa[min(j,n-j-1)];
      bbb[min(j,n-j-1)]=i;
      ans=max(ans,x);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void){
    int N,b;
    scanf("%d",&N);
    int a[N];
    
    for(int i=0;i<N;i++){
        scanf("%d",&a[i]);
        printf("%d",a[i]);
        if(i<N-1){
            printf(" ");
        }
    }
    printf("\n");
    for(int i=1;i<N;i++){
        for(int t=i;0<t;t--){
            if(a[t-1]>a[t]){
                b=a[t-1];
                a[t-1]=a[t];
                a[t]=b;
            }
        }
        for(int t=0;t<N;t++){
            printf("%d",a[t]);
            if(t<N-1){
                printf(" ");
            }
        }
        printf("\n");
    }    
    return 0;
}


Measured memory_bytes: 1976
#include <cstdio>
#include <cstring>
#include <algorithm>

const int N = 50 + 1, S = 1 << 10, INF = 0x3f3f3f3f;

inline bool check(int &lhs, int rhs) { if (rhs < lhs) return lhs = rhs, true; else return false; }

int n, m;

struct Info {
  int d, e, id;
  Info() {}
  Info(int _d, int _e, int _id): d(_d), e(_e), id(_id) {}
  inline bool operator< (const Info &rhs) const {
    return e < rhs.e;
  }
} info[N];

int go[N][N], ret[N][N];

int f[N][N];

struct State {
  int x, y;
  State() {}
  State(int _x, int _y): x(_x), y(_y) {}
};

void trans(int l, int r) {
  static int g[N][N][S];
  int tot = 1 << (r - l);
  for (int i = l; i < r; ++i)
    for (int j = l; j < r; ++j)
      for (int k = 0; k < tot; ++k)
        g[i][j][k] = INF;
  for (int i = l; i < r; ++i)
    for (int j = l; j < r; ++j)
      check(g[i][j][(1 << (i - l)) | ((1 << (j - l)))], f[i][j]);
  for (int s = 0; s < tot; ++s) {
    static State q[10 * N * N * S];
    static int tag[N][N], t;
    ++t;
    int cnt = 0;
    for (int i = l; i < r; ++i)
      for (int j = l; j < r; ++j)
        if (g[i][j][s] < INF) q[++cnt] = State(i, j), tag[i][j] = t;
    for (int i = 1; i <= cnt; ++i) {
      int x = q[i].x, y = q[i].y;
      tag[x][y] = 0;
      for (int a = l; a < r; ++a) if ((s >> (a - l) & 1) && check(g[a][y][s], g[x][y][s] + go[x][a]) && tag[a][y] != t) tag[a][y] = t, q[++cnt] = State(a, y);
      for (int b = l; b < r; ++b) if ((s >> (b - l) & 1) && check(g[x][b][s], g[x][y][s] + ret[y][b]) && tag[x][b] != t) tag[x][b] = t, q[++cnt] = State(x, b);
    }
    for (int i = l; i < r; ++i) {
      for (int j = l; j < r; ++j) {
        check(f[i][j], g[i][j][s]);
        for (int a = l; a < r; ++a) if (!(s >> (a - l) & 1)) check(g[a][j][s | (1 << (a - l))], g[i][j][s] + go[i][a] + info[a].d);
        for (int b = l; b < r; ++b) if (!(s >> (b - l) & 1)) check(g[i][b][s | (1 << (b - l))], g[i][j][s] + ret[j][b] + info[b].d);
      }
    }
  }
}

int main() {
  while (scanf("%d%d", &n, &m), n || m) {
    info[1] = Info(0, 0, 1);
    info[n] = Info(0, 1000, n);
    for (int i = 2; i < n; ++i) scanf("%d%d", &info[i].d, &info[i].e), info[i].id = i;
    static int pos[N];
    std::sort(info + 1, info + n + 1);
    for (int i = 1; i <= n; ++i) pos[info[i].id] = i;
    memset(go, 0x3f, sizeof go);
    memset(ret, 0x3f, sizeof ret);
    while (m--) {
      int a, b, c;
      scanf("%d%d%d", &a, &b, &c);
      a = pos[a], b = pos[b];
      if (info[a].e <= info[b].e) check(go[a][b], c);
      if (info[a].e >= info[b].e) check(ret[b][a], c);
    }
    memset(f, 0x3f, sizeof f);
    f[1][1] = 0;
    for (int i = 1, l = 1; i <= n; ++i) {
      if (i == l) {
        while (l <= n && info[l].e == info[i].e) ++l;
        trans(i, l);
      }
      for (int j = 1; j <= n; ++j) {
        int cur = f[i][j];
        if (cur == INF) continue;
        for (int k = i + 1; k <= n; ++k) check(f[k][j], cur + go[i][k] + (k != j ? info[k].d : 0));
        for (int k = j + 1; k <= n; ++k) check(f[i][k], cur + ret[j][k] + (k != i ? info[k].d : 0));
      }
    }
    printf("%d\n", f[n][n] < INF ? f[n][n] : -1);
  }
  return 0;
}

Measured memory_bytes: 11676
import java.util.Scanner;

//Electro-Fly
public class Main{

	public static long gcd(long a, long b){
		if(a < b){
			long tmp = a;
			a = b;
			b = tmp;
		}
		while(b!=0){
			long r = a%b;
			a = b;
			b = r;
		}
		return a;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int a1 = sc.nextInt();
			int m1 = sc.nextInt();
			int a2 = sc.nextInt();
			int m2 = sc.nextInt();
			int a3 = sc.nextInt();
			int m3 = sc.nextInt();
			if((a1|a2|a3|m1|m2|m3)==0)break;
			long x1 = 1;
			long x2 = 1;
			long x3 = 1;
			int x = a1%m1;
			int y = a2%m2;
			int z = a3%m3;
			while(x!=1){
				x1++;
				x = (x*a1)%m1;
			}
			while(y!=1){
				x2++;
				y = (y*a2)%m2;
			}
			while(z!=1){
				x3++;
				z = (z*a3)%m3;
			}
			System.out.println(x1*x2/gcd(x1, x2)*x3/gcd(x2,x3)/gcd(x1,x3)*gcd(x1, gcd(x2,x3)));
		}
	}
}

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

using namespace std;

int main() {
    int N;
    int h[100];
    int cnt = 0;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> h[i];
    }

    for (int i = 0; i < 100; i++) {
        /*                                                                      
        cout << "cnt=" << cnt;                                                  
        for (int j = 0; j < N; j++) {                                           
            cout << ", " << h[j];                                               
                                                                                
        }                                                                       
        cout << endl;                                                           
        */

        int j = 0;
        while (j < N) {
            if (h[j] == 0) {
                j++;
                continue;
            }

            cnt++;
            for (int k = j; k < N; k++) {
                if (h[k] == 0) {
                    j = k+1;
                    break;
                }
                h[k]--;
                j++;
            }
        }
    }
    cout << cnt << endl;

    return 0;
}



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

int main(){

    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    long int a,b,ab;

    a = A*X + B*Y;
    if(X > Y){
        b = 2*C*Y + A*(X-Y);
        ab = 2*C*X;
    }else{
        b = 2*C*X + B*(Y-X);
        ab = 2*C*Y;
    }

    cout << min(a,min(b,ab)) << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.*;
class Main{
	
    public static void main(String args[]){
    	Scanner sc=new Scanner(System.in);
    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	int c=sc.nextInt();
    	System.out.println(Math.min(a*b,c));
    }
}

Measured memory_bytes: 23124
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] voteList = new int[n];
    int totalV = 0;
    int chose = 0;
    String ans = "No";
    
    for (int i = 0; i < n; i++){
      int a = sc.nextInt();
      totalV += a;
      voteList[i] = a;
    }
    
    int min = totalV/(4*m);
    
    if (totalV%(4*m) > 0){
      min++;
    }
    
    for (int i = 0; i < n; i++){
      if (voteList[i] >= min){
        chose++;
      }
      if (chose >= m){
        ans = "Yes";
        break;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
//----->|try=0; while(!success) try++;|<------
//----->|Belief Yourself,Respect Yourself|<----
//----->|Be Proud Of Yourself,You're Doing Your best|<-----
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, n) for(int i = 1; i <= n; ++i)
#define rep1(i,start,n) for(int i=start;i<n;++i)
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#define XOR(a,b) ((a) ^ (b))
#define MP make_pair
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

template<typename T> T BigMod(T b,T p,T m) //BigMod Calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return r;
}

//||--------------------------->||Main_Code_Start_From_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    int row,col,r,c;
    char ar[26];
    string s;
    while(cin>>row>>col)
    {
        rep(i,row)
        {
            rep(j,col)
            {
                cin>>s;
                if(s=="snuke")
                {
                    r=j;
                    c=i;
                    //break;
                }
            }
        }
        //cout<<"r = "<<r<<" c = "<<c<<endl;
        int k=0;
        for(char ch='A';ch<='Z';ch++)
        {
           ar[k]=ch;
           k++;
        }
        cout<<ar[r]<<c+1<<endl;
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
//const ll mod =  1000000007;
//const ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vll = vector<ll>; // intの1次元の型に vi という別名をつける
using vvll = vector<vll>; // intの2次元の型に vvi という別名をつける
using vs = vector<string>; // stringの1次元の型に vs という別名をつける
using pll = pair<ll, ll>; // これ以降 pii という型名はpair<ll, ll> と同じ意味で使える
//---------------------------------------------------------------------------------------------------

int main(){
    string s;
    cin>>s;
    if(s=="AAA"||s=="BBB")cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    
}
   



Measured memory_bytes: 256
//Bismillahir Rahmanir Rahim
//In the name of Allah the Most Merciful
//Astagfirullahil laji
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define int long long  int
int i,j;
 main()
 {
    int a,b,c,s; int sum=0;
    cin>>a>>b>>c>>s;
    if(s>=a)
    {
        s=s-a;
        sum=sum+a;
    }
  else  if(s<a)
    {
        sum=sum+s;
        s=0;
    }
    if(s>0)
    {
        if(s>=b)
        {
            s=s-b;
        }
        else if(s<b)
        {
          s=0;

        }
    }
    if(s>0)
    {
        sum=sum+(-1*s);
    }
    cout<<sum<<endl;
 }


Measured memory_bytes: 3636
//#pragma comment(linker,"/STACK:102400000,102400000")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
#define _rep(i, a, b) for (int i = (a); i <= b; ++i)
const int max_number = 1000000;

int main()
{
    int a[2];
    for (int i = 0;;i++)
    {
        scanf("%d %d", &a[0], &a[1]);
        
        if(a[0]==0&&a[1]==0)
            break;
            sort(a,a+2);
        printf("%d %d\n", a[0], a[1]);
    }

    return 0;
}


Measured memory_bytes: 3268
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <chrono>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <cassert>
# include <array>
# include <tuple>
# include <cctype>
# include <unistd.h>
# include <unordered_map>
# include <unordered_set>
using namespace std;

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fast_work {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

const ll INF = 1e9 + 5, NMAX = 1e6 + 5, MOD = 1000000007, N = 1e9 + 5, LOG = 25;
const ld EPS = 1e-8, pi = 3.14159265358979323846;

signed main() {
    fast_work
    double t, d, s;
    cin >> d >> t >> s;

    if(d / s <= t) cout << "Yes"; else cout << "No";
}


Measured memory_bytes: 3736
#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
int find(int i,int a[]){
	if(a[i]==i)return i;
	return a[i]=find(a[i],a);
}
void uni(int i,int j,int a[],int sz[]){
	int x=find(i,a);
	int y=find(j,a);
	if(sz[x]>sz[y])a[y]=x;
	else a[x]=y;
	sz[x]+=sz[y];
	sz[y]=sz[x];
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int k,x,d;
    cin>>x>>k>>d;
    x=abs(x);
    int y=x/d;
    if(y>k){
    	cout<<x-k*d;
    	return 0;
    }
    if(y%2==k%2)cout<<x-y*d;
    else cout<<abs(x-(y+1)*d);
    return 0;
}


Measured memory_bytes: 3644
import sys
sys.setrecursionlimit(10**7)
MOD = 10**9+7

n = int(input())
g = [[] for _ in range(n)]
for _ in range(n-1):
    x, y = map(int, input().split())
    x -= 1; y -= 1
    g[x].append(y)
    g[y].append(x)

def dfs(v, pv):
    blk, wht = 1, 1
    for nv in g[v]:
        if nv == pv: continue
        nb, nw = dfs(nv, v)
        blk *= nw
        wht *= nb + nw
        blk %= MOD
        wht %= MOD
    return blk, wht

print(sum(dfs(0, -1)) % MOD)


Measured memory_bytes: 99760
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int x;
	int i;

	for (i = 1; ; i++) {
		scanf("%d", &x);
		if (x == 0) break;
		printf("Case %d: %d\n", i, x);
	}

	return (0);
}

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

int main()
{
  int n;
  cin>>n;
  
  int hieght[n+1];
 //nt dp[n+1]={0};
  
  for(int i=1;i<=n;++i)
  {
    cin>>hieght[i];
  }
  ll op2=0,op1=INT_MAX;
  for(int i=2;i<=n;++i)
  {
     ll a,b;
      a=abs(hieght[i]-hieght[i-1])+op2;
      
      b=abs(hieght[i]-hieght[i-2])+op1;
      
      op1=op2;
      op2=min(a,b);
  }
  
  cout<<op2<<endl;
    return 0;
}
             

Measured memory_bytes: 4028
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>

#define max 10000

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main()
{
    int n, m, i, a[max], ans=0;
    
    scanf("%d%d", &n, &m);
    for (i = 0; i < m; i++) {
        scanf("%d", &a[i]);
        ans += a[i];
    }
    
    if (n-ans<0) {
        printf("%d", -1);
    } else {
        printf("%d", n-ans);
    }
    
    return 0;
}



Measured memory_bytes: 1724
a,b,c,d=map(int,input().split());m=998244353;x=range(c+d);D=[[0]*6011for _ in[0]*6011];D[a][b]=1
for i in x:
 for j in x:D[i+1][j+1]+=(D[i+1][j]*(i+1)+D[i][j+1]*(j+1)-D[i][j]*i*j)%m
print(D[c][d])

Measured memory_bytes: 351284
N = int(input())
L = [int(i) for i in input().split()]
A = [0]*(1+(10**5))
num = 0
for l in L:
    A[l] += 1
    num += l
Q = int(input())
for _ in range(Q):
    B,C =[int(i) for i in input().split()]
    num += (C-B)*A[B]
    A[C] += A[B]
    A[B] = 0
    print(num)

Measured memory_bytes: 84192
#include <bits/stdc++.h>
#pragma GCC target("popcnt")

#define ul unsigned long long
#define all(x) (x).begin(),(x).end()
#define dlog(x) cerr<<#x<<'='<<x<<endl
#define dnew cerr<<endl;
#define endl '\n'

using namespace std;

vector<int>vec, dp;
int main(){
      ios::sync_with_stdio(false); cin.tie(nullptr);
      int n,k; cin>>n>>k;
      k=min(n,k);
      vec.resize(n);
      dp.resize(n,INT_MAX);
      for (int i=0; i<n; i++)
            cin>>vec[i];

      dp[0]=0;
      dp[1]=abs(vec[1]-vec[0]);
      for (int i=2; i<k; i++) {
            for (int j=0; j<i; j++) {
                  dp[i]=min(dp[i],dp[j]+abs(vec[i]-vec[j]));
            }
      }

      for (int i=k; i<n; i++) {
            for (int j=1; j<=k; j++) {
                  dp[i]=min(dp[i],dp[i-j]+abs(vec[i]-vec[i-j]));
            }
      }

      cout<<dp[n-1]<<endl;
      return 0;
}

Measured memory_bytes: 1024