akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;


int main() {
   char c;
   cin>>c;
   if(c=='A'){
       cout<<'T';
   }
   if(c=='T'){
       cout<<'A';
   }
   if(c=='C'){
       cout<<'G';
   }
   if(c=='G'){
       cout<<'C';
   }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define MAX 510000
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    vvl v(n,vl(n-1));
    rep(i,n){
        rep(j,n-1){
            ll a; cin >> a; a--;
            v[i][j] = a;
        }
    }
    vl index(n,n-2);
    ll ans = 0;
    set<ll> se,se2;
    vl finish;
    while(1){
        if(ans == 0){
            rep(i,n){
                ll t = v[i][index[i]];
                if(se.find(i) != se.end()) continue;
                if(se.find(t) != se.end()) continue;
                if(index[t]>=0 && v[t][index[t]] == i){
                    //cout << i << t << "a" << endl;
                    se.insert(i);
                    se.insert(t);
                    v[i].pop_back();
                    v[t].pop_back();
                    index[i]--;
                    index[t]--;
                }
            }
        }
        else{
            if(finish.size()==n) break;
            if(se.empty()){
                ans = -1;
                break;
            }
            se2 = se;
            for(auto i : se2){
                if(index[i]==-1){
                    se.erase(i);
                    continue;
                }
                ll t = v[i][index[i]];
                se.erase(i);
                if(se.find(t) != se.end()) continue;
                if(index[t]>=0 && v[t][index[t]] == i){
                    se.insert(i);
                    se.insert(t);
                    v[i].pop_back();
                    v[t].pop_back();
                    index[i]--;
                    index[t]--;
                    if(index[i]==-1) finish.push_back(i);
                    if(index[t]==-1) finish.push_back(t);
                }
            }
        }
        ans++;
        /*for(auto i : se){
            cout << i << " ";
        }
        cout << ans << endl;
        cout << "v.size" << v.size() << endl;*/
    }
    cout << ans << endl;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;
int H, W, K;
string field[10];

int main() {
    cin >> H >> W >> K;
    for(int h = 0; h < H; h++) cin >> field[h];
    int ans = 1e9;
    for(int bits = 0; bits < (1 << (H-1)); bits++) {
        vector<vector<int>> v;
        v.push_back({0});
        for(int i = 1; i < H; i++) {
            if(!(bits & (1 << (i-1)))) v.back().push_back(i);
            else v.push_back({i});
        }
        int n = v.size();
        int val = __builtin_popcount(bits);
        vector<int> num(n);
        //cerr << "n:" << bits << " " << n << endl;
        for(int w = 0; w < W; w++) {
            vector<int> now(n);
            for(int i = 0; i < v.size(); i++) {
                for(auto tmp : v[i]) {
                    if(field[tmp][w] == '1') now[i]++;
                }
                if(now[i] > K) {
                    w = W;
                    val = 1e9;
                    break;
                }
            }
            bool cut = false;
            if(val == 1e9) break;
            for(int i = 0; i < n; i++) {
                num[i] += now[i];
                //cerr << "now:" << i << " " << now[i] << endl;
                if(num[i] > K) cut = true;
            }
            if(cut) {
                //cerr << bits << " " << w << endl;
                val++;
                for(int i = 0; i < n; i++) {
                    num[i] = 0;
                }
                w--;
            }
        }
        //cerr << bits << " "<< val << endl;
        chmin(ans, val);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;


//基本的に勝つ手をだす．
//勝つ手がなければ，K回後に勝つ手以外を出す．

int main(){
  ll n,k,pr,ps,pp;
  cin>>n>>k>>pr>>ps>>pp;
  string t;
  cin>>t;
  vector<char> out(2*n+1);//i回目に出せない手
  ll ans=0;

  rep(i,n){
    out[i]='e';//未定
    t.push_back('e');

  }

  rep(i,n){
    switch(t[i]){
      case 'r':
        if(out[i]=='p'){//pを出せない時
          if(t[i+k]=='s'){//k回後がsの場合，sを出す．
            out[i+k]='s';
          }else{//t[i+k]=p or r　-> rを出す
            out[i+k]='r';
          }
        }else{
          out[i+k]='p';
          ans+=pp;
        }
        break;
      case 's':
        if(out[i]=='r'){
          if(t[i+k]=='p'){
            out[i+k]='p';
          }else{
            out[i+k]='s';
          }
        }else{
        out[i+k]='r';
        ans+=pr;
        }
        break;

      case 'p':
        if(out[i]=='s'){
          if(t[i+k]=='r'){
            out[i+k]='r';
          }else{
            out[i+k]='p';
          }
        }else{
          out[i+k]='s';
          ans+=ps;
        }


        break;

    }

  }

  cout<<ans<<endl;




  return 0;
}


Measured memory_bytes: 3824
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using ll = long long;
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b) cout << c << endl;
  else if (a == c) cout << b << endl;
  else cout << a << endl;
}


Measured memory_bytes: 256
#![allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let a: i32 = read();
    let mut b = a;
    let mut ans = 0;
    for _ in 0..3 {
        ans += b;
        b *= a;
    }
    println!("{}", ans);
}

Measured memory_bytes: 2164
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,flag=0;cin>>N;
  char s;
  for(int i=0;i<N;i++){
    cin>>s;
    if(s=='Y'){
      flag++;break;
    }
  }
  if(flag==0)cout<<"Three"<<endl;
  else cout<<"Four"<<endl;
}

Measured memory_bytes: 256
import itertools, heapq, bisect
from collections import defaultdict as ddic, deque, Counter

rr = raw_input
rri = lambda: int(raw_input())
rrm = lambda: map(int, raw_input().split())
MOD = 10 ** 9 + 7

###
N = rri()
A = rrm()

cur = 1
ans = 0
for x in A:
    if x == cur:
        cur += 1
        continue
    else:
        ans += 1
print ans if ans < N else -1


Measured memory_bytes: 51340
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  int BB, CC;
 
  if (B >= C){
    cout << "Yes" << endl;
    return 0;
  }

  BB = C / B;
  if (C % B != 0){
    BB += 1;
  }
  
  CC = A / D;
  if (A % D != 0){
    CC += 1;
  }
   
  if (BB > CC){
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;
	s += "?";

	vector<long long> vn;
	vector<char> vc;

	char prev = '?';
	int cnt = 0;
	for (char c: s) {
		if (c != prev) {
			if (prev != '?') {
				vc.emplace_back(prev);
				vn.emplace_back(cnt);
			}
			cnt = 1;
			prev = c;
		} else {
			cnt++;
		}
	}

	long long ans = 0;
	int st = 0;
	if (vc[0] == '>') {
		st = 1;
		ans += vn[0] * (vn[0] + 1) / 2;
	}

	int ed = vc.size();
	if (vc.back() == '<') {
		ans += vn.back() * (vn.back() + 1) / 2;
		ed--;
	}

	for (int i = st; i < ed; i += 2) {
		auto a = vn[i];
		auto b = vn[i+1];

		if (a < b) {
			swap(a, b);
		}

		ans += a * (a + 1) / 2;
		ans += (b - 1) * (b - 1 + 1) / 2;
	}

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


Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define E endl
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << 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...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		map<int,int>mp;
		fn{
			int x;
			cin>>x;
			mp[x]++;
			if(mp[x]==2){
				return cout <<"NO",0;
			}
		}
		cout<<"YES";
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

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

struct BIT {
  int N;
  vector<int> data;
  BIT(int n) : N(n), data(n + 1) {}
  void add(int a, int w) {
    a++;
    for (int i = a; i <= N; i += i & -i) data[i] += w;
  }
  int sum(int a) {
    int res = 0;
    for (int i = a; i > 0; i -= i & -i) res += data[i];
    return res;
  }
  int sum(int a, int b) { return sum(b) - sum(a); }
};

int main(){
  int N; string S; cin >> N >> S;
  vector<BIT> BITs(26, N);
  vector<int> now(N);
  rep(i, N) {
    int c = S[i] - 'a';
    BITs[c].add(i, 1);
    now[i] = c;
  }

  int Q; cin >> Q;
  rep(q, Q) {
    int type; cin >> type;
    if (type == 1) {
      int A; char B; cin >> A >> B;
      A--;
      int c = B - 'a';
      BITs[now[A]].add(A, -1);
      BITs[c].add(A, 1);
      now[A] = c;
    } else {
      int l, r; cin >> l >> r; l--;
      int ans = 0;
      rep(i, 26) {
        if (BITs[i].sum(l, r) > 0) ans++;
      }
      cout << ans << endl;
    }
  }
}


Measured memory_bytes: 53636
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        a: i64, b: i64,
    }

    let v = vec![a + b, a - b, a * b];
    println!("{}", v.iter().max().unwrap());
}


Measured memory_bytes: 4352
import sys

BASE = [1.1, 0.6, 0.2, 0.0]
COUNT = len(BASE)


def eye_test(num):
    for index, parameter in enumerate(BASE):
        if parameter <= num:
            return index


left_counter = [0] * COUNT
right_counter = [0] * COUNT

for line in sys.stdin:
    left, right = [float(item) for item in line[:-1].split(" ")]
    left_eye, right_eye = eye_test(left), eye_test(right)
    left_counter[left_eye] += 1
    right_counter[right_eye] += 1

for item1, item2 in zip(left_counter, right_counter):
    print(item1, item2)



Measured memory_bytes: 5580
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <deque>

using namespace std;

int main(int argc, char const *argv[])
{
	int num;

	cin >> num;

	if(num/1000 == 1) cout << "ABD" << "\n";
	else cout << "ABC" << "\n";

	return 0;
}

Measured memory_bytes: 256
N = int(input())
X = list(map(int, input().split()))

Y = sorted(X)
c1 = Y[N//2-1]
c2 = Y[N//2]

for i in range(N):
  if X[i]<=c1:
    ans = c2
  else:
    ans = c1
  print(ans)

Measured memory_bytes: 25228
#include <iostream>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  ll H;
  cin >> H;
  ll N = 1;
  ll S = 0;
  while (H > 0) {
    S += N;
    H /= 2;
    N *= 2;
  }
  cout << S << endl;
}

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

namespace ConsoleApplication54
{
    class Program
    {
        static void Main(string[] args)
        {
                int a = int.Parse(Console.ReadLine());
                string b = Console.ReadLine();
                int[] e = new int[a+1];
                int d = 0;
                e[0] = 0;
                for (int c = 0; c < a; c++)
                {
                    if (b[c] == 'I')
                        d++;
                    if (b[c] == 'D')
                        d--;
                    e[c+1] = d;
                }
                Array.Sort(e);
                Console.WriteLine(e[e.Length - 1]);
        }
    }
}


Measured memory_bytes: 2776
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

int main() {
  int n;
  cin >> n;
  vi a1(n + 1, 0), a2(n + 1, 0);
  rep(i, n) {
    cin >> a1[i + 1];
    a1[i + 1] += a1[i];
  }
  rep(i, n) {
    cin >> a2[i + 1];
    if(i > 0)
      a2[i + 1] += a2[i];
  }
  int res = 0;
  rep(i, n) {
    int sum = a1[i + 1] + a2[n] - a2[i];
    res = max(res, sum);
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#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(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
void yesOrNo(bool flg) {
  if (flg)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

void solve(ll N, std::string S) {
  bool result = false;
  if (N % 2 != 0) {
    result = false;
  } else {
    int i = 0;
    while (S.at(i) == S.at(N / 2 + i)) {
      if (i == N / 2 - 1) {
        result = true;
        break;
      }
      i++;
    }
  }

  yesOrNo(result);
}

int main() {
  ll N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


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

int main(){
  ll S;
  cin>>S;
  ll X1,Y1,X2,Y2;
  X2=(int)sqrt((double)S);
  Y1=X2;
  if(S==X2*Y1){
    X1=0;
    Y2=0;
  }else{
    Y1++;
    ll x=X2*Y1-S;
    if(x<0){
      X2++;
      x=X2*Y1-S;
    }
    X1=1;
    Y2=x;
  }
  cout<<0<<" "<<0<<" "<<X1<<" "<<Y1<<" "<<X2<<" "<<Y2<<endl;
}


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

int main() {
    int n;
    cin >> n;
    string w[n], ans = "Yes";
    map<string, bool> mp;
    rep(i, n) {
        cin >> w[i];
        if (mp[w[i]]) ans = "No";
        mp[w[i]] = true;
        if (i > 0) {
            if (w[i][0] != w[i-1][w[i-1].size()-1]) ans = "No";
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
    int a, b, c, d, e, f, g, h, A;
    a = N % 10;
    b = N % 100 / 10;
    c = N % 1000 / 100;
    d = N % 10000 / 1000;
    e = N % 100000 / 10000;
    f = N % 1000000 / 100000;
    g = N % 10000000 / 1000000;
    h = N % 100000000 / 10000000;
    A = a + b + c + d + e + f + g + h;
   if (N % A == 0)
    cout << "Yes" << endl;
   else
     cout << "No" << endl;
}


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

using namespace std;
typedef long long ll;
int a[200005];
int n;
int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++) scanf("%d", &a[i]);
	ll ans = 0;
	if(a[1] != 0){
		printf("-1\n");
		return 0;
	}
	for(int i = 2; i <= n; i ++){
		if(a[i] - a[i - 1] > 1){
			printf("-1\n");
			return 0;
		}
		if(a[i] - a[i - 1] == 1){
			ans += 1;
		}else{
			ans += a[i];
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
main(){for(int n,i,m,a[5000];std::cin>>n,n;std::cout<<m<<"\n"){for(i=0;i<n;i++)std::cin>>a[i];for(i=0,m=-1e9;i<n;i++)for(int j=i,s=0;j<n;m=s>m?s:m,j++)s+=a[j];}}

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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

int main() {
    // get values from input
    int N;
    READ(N);

    // main procedure
    string str_n = to_string(N);
    bool ans = count(ALL(str_n), '7') > 0 ? true : false;

    // output
    WRITE_N(ans ? "Yes" : "No");

    return 0;
}


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

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int K = scan.nextInt();
        if (K % 2 == 0) {
            System.out.println(K * K / 4);
        } else {
            int answer = K / 2 * (K / 2 + 1);
            System.out.println(answer);
        }
    }
}


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

using namespace std;
using ll = long long;

template<class T>
map<T,T> fact(T n){
    map<T,T> Map;
    for(T i = 2; i * i <= n; i++){
        while(n % i == 0){
            Map[i]++;
            n /= i;
        }
    }
    if(n == 1)return Map;
    Map[n]++;
    return Map;
}


int main()
{
    ll a, b;
    cin >> a >> b;
    ll gc = gcd(a, b);
    cout << fact(gc).size() + 1 << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <sstream>
using namespace std;

const int inf=0x3f3f3f3f;
const int maxn=100005;
int n, fa[maxn], cnt;

struct edge{
    int u, v, cost;
    edge(int cu, int cv, int ccost){u=cu, v=cv, cost=ccost;}
    edge(){}
    bool operator<(const edge &cmp) const{
    	return cost<cmp.cost;
    }
}E[maxn*4];

struct point{
    int x, y, id;
}P[maxn];

bool cmpx(point c1, point c2){return c1.x<c2.x;}
bool cmpy(point c1, point c2){return c1.y<c2.y;}

int Find(int x){
    return x==fa[x]?x:fa[x]=Find(fa[x]);
}
 
long long Kruskal(){
    for(int i=0;i<=n;i++)fa[i]=i;
    sort(E, E+cnt);
    long long ans=0;
    for(int i=0;i<cnt;i++){
        int fu=Find(E[i].u);
        int fv=Find(E[i].v);
        if(fu!=fv){
            ans+=E[i].cost;
            fa[fu]=fv;
        }
    }
    return ans;
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d%d", &P[i].x, &P[i].y);
        P[i].id=i;
    }
    cnt=0;
    sort(P, P+n, cmpx);
    for(int i=1;i<n;i++){
        E[cnt++]=edge(P[i-1].id, P[i].id, P[i].x-P[i-1].x);
    }
    sort(P, P+n, cmpy);
    for(int i=1;i<n;i++){
        E[cnt++]=edge(P[i-1].id, P[i].id, P[i].y-P[i-1].y);
    }
    printf("%lld\n", Kruskal());
    return 0;
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
string s, t;
int main() {
	cin >> s >> t;
	string ans;
	for (int i = 1; i <=(int)s.length()+(int)t.length(); i++) {
		if (i % 2 == 0) {
			ans += t[(i-1)/ 2];
		}
		else {
			ans += s[(i-1) / 2];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector <pair<int,int> >g[55];
int cnt=0;
bool u[55]={1};
void dfs(int k,int x){
	u[k]=0;
	for(int j=0;j<g[k].size();j++)
		if(u[g[k][j].first]&&g[k][j].second!=x)
			dfs(g[k][j].first,x);
}
int main() 
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		g[a].push_back(make_pair(b,i));
		g[b].push_back(make_pair(a,i));
	}
	for(int i=0;i<m;i++)
	{
		for(int z=1;z<=n;z++)
			u[z]=1;
		dfs(1,i);
		for(int z=1;z<=n;z++)
			if(u[z]){cnt++;
				break;}
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main(){
    string a,b;
    cin>>a>>b;
    ll s=stoi(a+b);
    string ans="No";
    for(ll i=0;i<100100;++i){
        if(i*i == s){
            ans="Yes";
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define NUM 5

int main(void){
    int a[NUM];
    int k;
    for(int i = 0; i < 5; i++){
        scanf("%d", &a[i]);
    }
    scanf("%d", &k);

    for(int i = 0; i < 5; i++){
        for(int j = i + 1; j < 5; j++){
            if (a[j] - a[i] > k){
                printf(":(\n");
                return 0;
            }
        }
    }

    printf("Yay!\n");
    return 0;
}


Measured memory_bytes: 888
import sys
sys.setrecursionlimit(10**6)

N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [None] * N

def solve(n):
    if dp[n] is not None:
        return dp[n]

    if n == 0:
        dp[n] = 0
    elif n == 1:
        dp[n] = abs(h[0] - h[1])
    else:
        ans = 10**10
        for i in range(1, K+1):
            if n - i < 0:
                break
            if dp[n - i] is not None:
                temp = dp[n - i]
            else:
                temp = solve(n - i)
            ans = min(ans, temp + abs(h[n - i] - h[n]))
        dp[n] = ans

    return dp[n]

print(solve(N-1))

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

int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    int A,B;

    cin>>A>>B;

    if((A <= 9 && A >= 1) && (B <= 9 && B >= 1)){
        cout<<A * B<<endl;
    }
    else{
        cout<<"-1"<<endl;
    }

    return 0;
}

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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    cout << (n - 1) / 2 << EOL;
}


Measured memory_bytes: 256
h, w = gets.split.map(&:to_i)
cm = Array.new(h + 2){Array.new(w + 2, 0)}
que = []
a = []
1.upto(h) do |i|
  s = gets.chomp
  1.upto(w) do |j|
    if s[j - 1] == '.'
      cm[i][j] = -1
      a << [i, j]
    end
  end
end
ans = 0
a.each do |b|
  dm = Marshal.load(Marshal.dump(cm))
  que << [b[0], b[1], 0]
  dm[b[0]][b[1]] = 0
  while que.size > 0
    y, x, r = que.shift
    ans = r + 1 if ans < r + 1
    if dm[y + 1][x] == -1
      dm[y + 1][x] = r + 1
      que << [y + 1, x, r + 1]
    end
    if dm[y - 1][x] == -1
      dm[y - 1][x] = r + 1
      que << [y - 1, x, r + 1]
    end
    if dm[y][x - 1] == -1
      dm[y][x - 1] = r + 1
      que << [y, x - 1, r + 1]
    end
    if dm[y][x + 1] == -1
      dm[y][x + 1] = r + 1
      que << [y, x + 1, r + 1]
    end
  end
end
puts ans - 1

Measured memory_bytes: 2428
/*..............................................*\
Author:Kishor Kumar Paroi
Dept:CSE-1703053
email.kishor.josephite@gmail.com
RUET,BANGLADESH
\*---------------------------*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <sstream>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include<bits/stdc++.h>
#include<iostream>
#include<iterator>

#define max(a,b) ((a>b)?a:b)                        //finding max
#define min(a,b) ((a<b)?a:b)                        //finding min
#define Max(a,b,c) max(a,max(b,c))                  //finding max between 3 numbers
#define Min(a,b,c) min(a,min(b,c))                  //finding min between 3 numbers
#define Pi acos(-1.0)                               //defining Pi for mathematical uses
#define Clear(a) memset(a,0,sizeof(a))              //clearing memory of an array
#define setfalse(a) memset(a,false,sizeof(a))       //setting the array into false
#define settrue(a) memset(a,true,sizeof(a))         //setting the array into true
#define clrstr(a) memset(a,'\0',sizeof(a))          //setting string array to null
#define open freopen("input.txt","r",stdin)         //opening input file
#define close freopen ("output.txt","w",stdout)     //opening output file
#define Case(a) printf("Case %d: ",a)               //printing case number
#define caseh(a) printf("Case #%d: ",a)             //printing case number having '#'
#define getcase(a) scanf("%d",&a)                   //scanning case number
#define caseloop(a,b) for(a=1;a<=b;a++)             //making case loop
#define EPS 1e-9                                    //small value for avoiding preccesion error
#define LL long long                                //long long short form
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vi vector<int>v
//const int N=100*1000;
//const int mod=1e9+7;

//# define int min3(int a,int b,int c){return min(a,min(b,c));}
//#define int max3(int a,int b,int c){return max(a,max(b,c));}
//#define int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
//#define int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,i,j;
    cin>>n;
    vi(n);
    for(i=0; i<n; i++)
        cin>>v[i];
    sort(v.begin(),v.end());
    for(i=v[1]; i>0; i--)
    {
        int x=0;
        for(j=0; j<n; j++)
        {
            if(v[j]%i!=0)
                x++;
        }
        if(x<2)
        {
            cout<<i<<endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 640
//Range Minimum Query
//AOJ DSL_2_A

//初期化→子ノードから再帰的にO(n)
//区間の最小値、更新→定数個のノードにしか
//アクセスしないのでO(log n)

//利点
//平衡処理が必要ない
//ノードの個数n+n/2+n/4+...<2n

//木の持ち方
//配列でノードに番号をつける
//上の段から、同じ段では左から順に番号を振る
//この振り方だと、
//番号nの親:(n-1)/2(を切り捨て)
//      子:2n+1,2n+2,...
#include<iostream>
using namespace std;

const int INT_MAX=2147483647;
const int MAX_N=100010;

int n;
int dat[MAX_N*4];

void init(){//初期化
    //全ての値をINT_MAXにする
    for(int i=0; i<n*2-1; i++)dat[i]=INT_MAX;
}

//値の更新
//場所iに対応する一番下のノードはn+i-1
//そこから(n-1)/2を繰り返して親をたどる
void update(int i,int x){//i番目の値をxに変更
    //葉のノードの番号
    i+=n-1;
    dat[i]=x;
    //登りながら更新
    while(i>0){
        i=(i-1)/2;//親ノード
        dat[i]=min(dat[i*2+1],dat[i*2+2]);//子ノードの中で小さいものを取る
    }
}

//最小値の取得→再帰
//区間[i,j]とそのノードの区間が一致しない→INT_MAXを返しておく
//区間[i,j]とそのノードの区間を完全に含む→その接点の持つ値を返す
//どちらでもない→2つの子ノードについて再帰的に計算
int query(int a,int b,int k,int l,int r){//要求区間[a,b)のmin,いまのノードk,対象区間[l,r)で再帰的に計算,query(a,b,0,0,n)と呼ぶ
    //区間が交差しない→
    if(r<=a || b<=l) return INT_MAX;
    //区間を完全に含む
    if(a<=l && r<=b) return dat[k];//その接点の持つ値
    else{
        int vl=query(a,b,k*2+1,l,(l+r)/2);//子ノード[l,(l+r)/2)についてminを計算
        int vr=query(a,b,k*2+2,(l+r)/2,r);
        return min(vl,vr);
    }
}

int main(){
    int q;
    cin>>n>>q;
    int n2=1;
    //nが2の階乗でない場合、nを2の階乗にする
    for(int i=0; i<32; i++){
        if(n2>=n){
            n=n2;
            break;
        }
        n2*=2;
    }//これを行うことでセグメント木は完全二分木となり扱いやすくなる
    
    init();
    for(int i=0; i<q; i++){
        int c,x,y;
        cin>>c>>x>>y;
        if(c==0)update(x,y);
        else if(c==1) cout<<query(x,y+1,0,0,n)<<endl;
    }
    return 0;
}


Measured memory_bytes: 4104
#include<bits/stdc++.h>
using namespace std;
int N;
int main(){
    cin>>N;int a[N], b[N];for(int i=0;i<N;i++){cin>>a[i];b[i]=a[i];}
    sort(a,a+N);
    int dif=0;
    for(int i=0;i<N;i++){
        if(a[i]!=b[i])dif++;
    }
    cout<<(dif>2?"NO":"YES")<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

int main()
{
    int n, k;
    cin >> n >> k;
    double p = 0;
    rep(i, n)
    {
        int num = i + 1;
        int a = 1;
        while (num < k)
        {
            num *= 2;
            a *= 2;
        }
        p += 1.0 / a / n;
    }
    printf("%.20f\n", p);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int  main()
{
	string s;
	cin>>s;
	int i,n,a=0,b=0,c=0,d=0;
	n=s.size();
	for(i=0;i<n;i++)
	{
		if(s[i]=='N')
		{
			a=1;
		}
		else if(s[i]=='W')
		{
			b=1;
		}
		else if(s[i]=='E')
		{
			c=1;
		}
		else if(s[i]=='S')
		{
			d=1;
		}
	}
	if((a!=d) || (c!=b))
	{
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	
}

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

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

    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a.begin(), a.end());
    int ans = -1;
    for (int i = 0; i < n; i++)
    {
        if (x >= a[i])
            x -= a[i];
        else
        {
            ans = i;
            break;
        }
        if (x == 0)
        {
            ans = i + 1;
            break;
        }
    }
    if (ans == -1)
        ans = n - 1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
}s(200000);

int main() {
    int x;
    cin >> x;
    while(true) {
        if(s.isPrime(x)) {
            cout << x << endl;
            return 0;
        }
        x++;
    }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define FOR(i) for(cin>>i;i>0;i--)
#define elif else if
#define pb push_back
#define ll long long
#define mp make_pair
#define all(x) x.begin(),x.end()
#define re(x) {cout<<x<<endl;return 0;}
//#define x first
//#define y second

using namespace std;
int n,a[200005]={0},k;
int main()
{
	cin>>n;
	rep(i,n-1)
	{
		cin>>k;
		a[k]++;
	}
	rep2(i,1,n+1)
	{
		cout<<a[i]<<endl;
	}
	return 0;}

Measured memory_bytes: 4404
#include <algorithm>
#include <bitset>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    ll n, k;
    cin >> n >> k;
    ll a[n+1];
    for(int i = 1; i<=n; i++) cin >> a[i];
    ll g[n+1] = {};
    ll idx = 1;
    for(ll i = k+1; i<=n; i++, idx ++) {
        ll rem = a[idx];
        ll add = a[i];
        if(add > rem) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
}

int main() {_
    int t = 1;
    //cin >> t;
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 6740
import itertools

n=int(input())
x=list(map(int,input().split()))

if n<=2:
  print(0)
  exit()
  
ans=0

for y in list(itertools.combinations(x,3)):
  lst=sorted(y)
  if lst[0]!=lst[1]:
      if lst[0]!=lst[2]:
          if lst[1]!=lst[2]:
            if abs(lst[1]-lst[0])<lst[2]<(lst[0]+lst[1]):
              ans+=1
      
      
print(ans)

Measured memory_bytes: 87156
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define mp make_pair
#define pb push_back
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
template<typename T> void ckmax(T&a, T b) { if (b > a) a = b; }
template<typename T> void ckmin(T&a, T b) { if (b < a) a = b; }

int main ()
{
	int x; scanf ("%d", &x);
	for (int i = 1; i <= 50000; ++i) {
		double tmp = i;
		tmp *= 1.08;
		int k = floor(tmp);
		if (k == x) { printf ("%d\n", i); return 0; }
	}
	printf (":(");
	return 0;
}







































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

int main() {
  int n;
  cin >> n;
  double a[n];
  for(int i=0; i<n; i++) cin >> a[i];
  sort(a,a+n);
  double ans=0;
  for(int i=0; i<n-1; i++) {
    double x=a[i+1]-a[i],y=0;
    for(int j=n-1,z=0; z<2&&j>=0; j--) {
      if(j!=i&&j!=i+1) {
        z++;
        y+=a[j];
      }
    }
    ans=max(ans,y/x);
  }
  printf("%.10f\n",ans);
  return 0;
}


Measured memory_bytes: 3332
#include <bits/stdc++.h>
using namespace std;
long long n, k;
int main() {
	scanf("%lld%lld", &n, &k);
	int c = n / k;
	long long ans = 1LL * c * c * c;
	if( !(k&1) && n >= k/2) {
		n -= (k >> 1); c = n / k + 1;
		ans += 1LL * c * c * c;
	}
	printf("%lld\n", ans);
}

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

using namespace std;

int main() {
	int n, m, a[1000], b, ans = 0;
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		cin >> a[i] >> b;
	}
	sort(a, a + m);
	for (int i = m - 1; i > 0; --i) {
		if (a[i] < n) ans += n - a[i];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3108
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<functional>
#include<stack>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<deque>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int a,b;cin >> a >> b;
	string str;cin >> str;
	REP(i,a)
	{
		if(!isdigit(str[i]))
		{
		//	cout << "!!" << endl;
			cout << "No" << endl;
			return 0;
		}
	}
	if(str[a] != '-')
	{
		cout << "No" << endl;
		return 0;
	}
	REP(i,b)
	{
		if(!isdigit(str[a+i+1]))
		{
		//	cout << "!!!" << endl;
			cout << "No" << endl;
			return 0;
		}
	}
	
	cout << "Yes" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int x, y;
  int i, j=0;
  scanf("%d%d", &x,&y);
  
  for(i=0; i<=x; i++){
    if(y-2*(x-i)-4*i==0){
      printf("Yes");
      j++;
      break;
    }
  }
  
  if(j==0){
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1700
#include<stdio.h>
int main()
{
  int A,B;
  scanf("%d %d",&A,&B);
  int i;
  int flag=-1;
  int C,D;
  for(i=0;i<=1250;i++)
  {
    C=i*0.08;
    D=i*0.1;
    if((C==A)&&(D==B)){
      flag=i;
      break;
    }
  }
  printf("%d",flag);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr long long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;

constexpr int MAX = 1001;
long long fac[MAX], inv[MAX], finv[MAX];
void CombInit(){
    fac[0] = inv[0] = finv[0] = 1;
    fac[1] = inv[1] = finv[1] = 1;
    for(int i=2; i<MAX; ++i){
        fac[i] = fac[i-1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
        finv[i] = finv[i-1] * inv[i] % MOD;
    }
}

long long Comb(int n,int k){
    if(n < 0 || k < 0 || n < k) return 0;
    return (fac[n] * finv[n-k] % MOD) * finv[k] % MOD;
}


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    CombInit();
    cout <<  Comb(n-1, k-1) << '\n';
    return 0;
}


Measured memory_bytes: 3228
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int d = scan.nextInt();
		if (b<=c || d <= a) {
			System.out.println(0);
			return;
		}
		if (a <= c) {
			if (d<=b) {
				System.out.println(d-c);
				return;				
			} else {
				System.out.println(b-c);
				return;
			}
		}
		if (a > c) {
			if (d<b) {
				System.out.println(d-a);
				return;				
			} else {
				System.out.println(b-a);
				return;
			}
		}
	}
}


Measured memory_bytes: 22996
package main
 
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)
 
var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n, _ = strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A *[]int) {
  S := make([]string, len((*A)))
  for i, a := range (*A) {
    S[i] = strconv.Itoa(a)
  }
  fmt.Fprintln(writer, strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

type Node struct {
  Index int
  Edge []int
  Degree int
  Undefined int
  Dist int
}
func main() {
  NM := NextIntVec()
  N, M := NM[0], NM[1]
  G := make([]Node, N)
  for i := range G {
    G[i] = Node{i, []int{}, 0, -1, -1}
  }
  E := make([][]int, M)
  for i := range E {
    AB := NextIntVec()
    A, B := AB[0] - 1, AB[1] - 1
    E[i] = []int{A, B}
    G[A].Edge = append(G[A].Edge, i)
    G[B].Edge = append(G[B].Edge, i)
  }
  G[0].Dist = 0
  Q := make([]int, N)
  pos := 1
  for i, _ := range Q {
    s := Q[i]
    for _, e := range G[s].Edge {
      if G[s].Undefined == e { continue }
      t := E[e][0]
      if t == s { t = E[e][1] }
      if G[t].Dist < 0 {
        Q[pos] = t
        pos++
        G[t].Undefined = e
        G[t].Dist = G[s].Dist + 1
      } else if E[e][0] == s {
        G[s].Degree++
      }
    }
  }
  for i := N - 1; 0 < i; i-- {
    s := Q[i]
    u := G[s].Undefined
    t := E[u][0]
    if t == s { t = E[u][1] }
    if G[s].Degree % 2 > 0 {
      E[u] = []int{s, t}
    } else {
      E[u] = []int{t, s}
      G[t].Degree++
    }
  }
  if M % 2 > 0 {
    Write(-1)
  } else {
    for i, e := range E {
      E[i] = []int{e[0] + 1, e[1] + 1}
      WriteIntVec(&E[i])
    }
  }
  Output()
}

Measured memory_bytes: 25852
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))

typedef long long ll;

int main() {
    string s;
    cin >> s;
    
    if ( s=="abc" || s=="acb" || s=="bac" || s=="bca" || s=="cab" || s=="cba") {
        cout1("Yes");
    } else {
        cout1("No");
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <bitset>
#include <boost/algorithm/string/replace.hpp>

using namespace std;

#define FOR(i, n) for (int i = 0; i < n; i++)
#define OUT(s) cout << s << endl;
#define IN(a) cin >> a;
#define PACK(a, n)                                                             \
  for (int i = 0; i < n; i++)                                                  \
    cin >> a[i];
#define LIST(a, n)                                                             \
  for (int i = 0; i < n; i++)                                                  \
    cout << "[" << i << "] " << a[i] << endl;

int main() {
  int N;
  IN(N);

  string currency;
  double amount;
  double sum = 0.0;

  for (int i = 0; i < N; i++) {
    cin >> amount;
    cin >> currency;
    if (currency == "BTC") {
      amount *= 380000.0;
      sum += amount;
    } else {
      sum += amount;
    }
  }

  std::cout << std::showpoint << std::fixed;
  OUT((double)sum);
}

Measured memory_bytes: 256