akhauriyash/Code-Regression huggingface dataset:
using System;

public class AtCoderB
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());

        var line = Console.ReadLine();
        var words = line.Split(' ');
        for (int i = 0; i < n; i++)
        {
            int num = int.Parse(words[i]);
            if (num % 2 == 0)
            {
                if (num % 3 != 0 && num % 5 != 0)
                {
                    Console.WriteLine("DENIED");
                    return;
                }
            }
        }
        Console.WriteLine("APPROVED");
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<numeric>
#define ll long long
#define MOD = 1e9+7
 
using namespace std;
 
int main() {
  string s;
  cin >> s;
  reverse(s.begin(),s.end());

  map<int,int> cnt;
  cnt[0]++;
  int sum=0,ans=0,base=1;
  for(int i=0;i<s.size();i++){
    sum += base * (s[i]-'0');
    sum %= 2019;
    ans += cnt[sum];
    cnt[sum]++;
    base *= 10;
    base %= 2019;
  }
  cout << ans << endl;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long


#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)

const int N=1e5+5;
const int mod=1e9+7;
int32_t main() {
int n;
string s;
cin>>n>>s;
 int x=0,ans=0;
    for (int i = 0; i < n; ++i) {
        ans=max(ans,x+(s[i]=='I'?1:-1));
        if(s[i]=='I')x++;
        else x--;
    }
    cout<<ans;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); 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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}


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

  vector<ll> c(N);
  vector<ll> s(N);
  vector<ll> f(N); rep(i, N - 1) cin >> c[i] >> s[i] >> f[i];
  rep(ss, N) {
  ll t = 0;
  for(ll i = ss;i <  N - 1; i++ ) {
    if(t > s[i]) {
      t = (t + f[i] -1) / f[i] * f[i] + c[i];
    } else {
      t = s[i] + c[i];
    }
    cerr << i << ":" << t << endl;
  }
  cout << t << endl;
  }
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3700
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

void dfs(ll a, ll p, ll g, ll t, ll mx, set<ll> c, vector<set<ll>> &ans, const vvll &e){
    if(t > mx){
        return;
    }
    if(p != INF&&a == g){
        ans.emplace_back(c);
        return;
    }
    for(auto x:e[a]){
        set<ll> h = c;
        if(x == g){
            dfs(x, a, g, t+1, mx, h, ans, e);
            continue;
        }
        if(h.find(x) == h.end()){
            h.insert(x);
            dfs(x, a, g, t+1, mx, h, ans, e);
        }
    }
}

int main(){
    ll n, m; cin >> n >> m;
    vvll e(n+1, vll(0));
    rep(i, 0, m){
        ll a, b; cin >> a >> b;
        e[a].emplace_back(b);
    }
    ll mn = INF;
    ll S;
    vll ans;
    rep(i, 1, n+1){
        ll s = i;
        queue<ll> q;
        q.push(s);
        bool b = false;
        vll dis(n+1, 0);
        dis[s] = 0;
        map<ll, ll> Mp;
        while(!q.empty()&&b == false){
            ll x = q.front();
            q.pop();
            for(auto z:e[x]){
                if(dis[z] > 0&&z != s){
                    continue;
                }
                dis[z] = dis[x] + 1;
                Mp[z] = x;
                if(z == s){
                    b = true;
                    break;
                }
                q.push(z);
            }
        }
        if(dis[s] != 0&&dis[s] < mn){
            mn = dis[s];
            S = s;
            vll a(0);
            a.emplace_back(S);
            ll g = Mp[S];
            while(g != S){
                a.emplace_back(g);
                g = Mp[g];
            }
            ans = a;
        }
    }
    if(mn == INF){
        prtl(-1);
        return 0;;
    }
    prtl(sz(ans));
    for(auto x: ans){
        prtl(x);
    }
}



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

int main(){
  string S;
  cin >> S;
  int cnt = 0;
  int maxi = 0;
  rep(i, 3){
   if(S.at(i) == 'S'){
    maxi = max(cnt, maxi);
    cnt = 0; 
   }else{
    cnt++; 
   }
  }
  maxi = max(cnt, maxi);
  cout << maxi << endl;
  return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void) {
  int N;
  scanf("%d", &N);

  int A, B, C;
  A = N / 100;
  if(A == 9) A = 1;
  else if(A == 1) A = 9;

  B = (N	/ 10) % 10;
  if(B == 9) B = 1;
  else if(B == 1) B = 9;

  C = N % 10;
  if(C == 9) C = 1;
  else if(C == 1) C = 9;

  printf("%d%d%d\n", A, B, C);

  return 0;
}


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

int main(){
  int a,b;
  while(true){
    cin>>a>>b;
    if(a==0 && b==0)break;
    if(a<b)cout<<a<<" "<<b<<endl;
    else   cout<<b<<" "<<a<<endl;
  }
}


Measured memory_bytes: 3000
#include <vector>
#include <iostream>

using namespace std;

int main() {

    vector<int> data(5);
    vector<int> data2(5);
    int ans, tmp, sum, min;

    for (int i = 0; i < data.size(); i++) {
        cin >> data.at(i);
    }

    for (int i = 0; i < data2.size(); i++) {
        ans = 0;
        tmp = 0;
        if (data.at(i) % 10 != 0) {
            if (data.at(i) > 10) {
                tmp = data.at(i) - data.at(i) % 10;
                ans = data.at(i) % 10;
                ans += 10 - ans;
                ans += tmp;
            } else {
                ans = data.at(i) % 10;
                ans += 10 - ans;
            }
            data2.at(i) = ans;
        } else {
            data2.at(i) = data.at(i);
        }
        
    }


    for (int i = 0; i < data.size(); i++) {
        sum = 0;
        if (i == 0) {
            sum += data.at(i);
            for (int j = 1; j < data2.size(); j++) {
                sum += data2.at(j);
            }
            // 初回は必ずminに代入
            min = sum;
        } else if (i == 1) {
            sum += data.at(i);
            for (int j = 0; j < i; j++) {
                sum += data2.at(j);
            }

            for (int k = i + 1; k < data2.size(); k++) {
                sum += data2.at(k);
            }

            if (sum < min) {
                min = sum;
            }
        } else if (i == 2) {
            sum += data.at(i);
            for (int j = 0; j < i; j++) {
                sum += data2.at(j);
            }

            for (int k = i + 1; k < data2.size(); k++) {
                sum += data2.at(k);
            }

            if (sum < min) {
                min = sum;
            }
        } else if (i == 3) {
            sum += data.at(i);
            for (int j = 0; j < i; j++) {
                sum += data2.at(j);
            }

            for (int k = i + 1; k < data2.size(); k++) {
                sum += data2.at(k);
            }

            if (sum < min) {
                min = sum;
            }
        } else if (i == 4) {
            sum += data.at(i);

            for (int j = 0; j < i; j++) {
                sum += data2.at(j);
            }

            if (sum < min) {
                min = sum;
            }
        }
    }
    
    cout << min << endl;
}

Measured memory_bytes: 256
use v5.18;
use warnings;
sub read_line { chomp(my $str = <STDIN>); $str }
sub splited_read_line { split / /, read_line }

my ($a, $b, $c, $d) = splited_read_line;
say( ( abs($a - $c) <= $d || ( abs($a - $b) <= $d && abs($b - $c) <= $d ) ) ? 'Yes' : 'No' );


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#define MAX 3000

using namespace std;

double dp[MAX];
int main()
{
    int n;

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

    dp[0] = 1;

    cin >> n;

    for(int i = 1; i <= n; i++)
    {
        double pHead;

        cin >> pHead;

        for(int coin = i; coin > 0; coin--)
            dp[coin] = dp[coin - 1] * pHead + dp[coin] * (1 - pHead);

        dp[0] = dp[0] * (1 - pHead);
    }

    double sol = 0;
    for(int i = n / 2 + 1; i <= n; i++)
        sol += dp[i];

    cout << setprecision(10) << sol;

    return 0;
}


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

int main(void){
    int i,flag;
    string s,t;
    flag = 0;
    cin >> s >> t;

    for(i=0; i<s.size(); i++){
        if(s.at(i) != t.at(i)){
            flag = 1;
            break;
        }
    }

    if(flag == 0){
        cout << "Yes" << endl;
    }else if(flag == 1){
        cout << "No" << endl;
    }else{
        cout << "Error!" << endl;
    }
}

Measured memory_bytes: 3596
def resolve():
    import itertools
    import math
    N = int(input())
    X = []
    Y = []
    for _ in range(N):
        x, y = map(int, input().split())
        X.append(x)
        Y.append(y)
    ans = 0
    ichi = 0
    for i in itertools.permutations(range(1, N+1)):
        count = 0
        for p in range(N-1):
            count += math.sqrt((X[i[p+1]-1]-X[i[p]-1])**2+(Y[i[p+1]-1]-Y[i[p]-1])**2)
        ans += count
        ichi += 1
    print(ans/ichi)
resolve()

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

void solve(std::string S, std::string T)
{
    int cnt = 0;
    for (int i = 0; i < 3; i++)
        if (S[i] == T[i])
            cnt++;

    cout << cnt << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}



Measured memory_bytes: 256
fn main() {
    let mut sc = Scanner::new();
    let n = sc.usize_read();
    let k: usize = sc.read();
    let mut a: Vec<usize> = sc.read_vec(n);
    a.sort();

    let is_needed = |m: usize| -> bool {
        let mut ok = vec![false; k];
        ok[0] = true;
        for i in 0..n {
            if i == m {
                continue;
            }
            for t in (0..k).rev() {
                if ok[t] && t + a[i] < k {
                    ok[t + a[i]] = true;
                }
            }
        }
        for a in 0..a[m] {
            if k < a + 1 {
                break;
            }
            if ok[k - (a + 1)] {
                return true;
            }
        }
        return false;
    };

    let mut no_need = 0;
    let mut need = n;
    while need - no_need > 1 {
        let m = (need + no_need) / 2;
        if is_needed(m) {
            need = m;
        } else {
            no_need = m;
        }
    }
    if no_need == 0 && is_needed(0) {
        println!("0");
    } else {
        println!("{}", need);
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


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

int main()
{
	int a[3]{};
	for (int i = 0; i < 3; i++)
		scanf("%d", a + i);
	std::sort(a, a + 3);
	if (a[0] == 5 && a[1] == 5 && a[2] == 7)
		printf("YES\n");
	else
		printf("NO\n");

	return 0;
}

Measured memory_bytes: 256
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_B&lang=jp
sentinel = pow(10,9) + 1
def merge(target_list, left_index, mid_index,right_index):
    
    l = target_list[left_index:mid_index] + [sentinel]
    r = target_list[mid_index:right_index] + [sentinel]
    l_target, r_target, count = 0, 0, 0
    #print(left_index, right_index, mid_index, l,r)
    for k in range(left_index, right_index):
        if l[l_target] < r[r_target]:
            target_list[k] = l[l_target]
            l_target += 1
        else:
            target_list[k] = r[r_target]
            r_target += 1

    return l_target + r_target
    #print(target_list)
            
def merge_sort(target_list, left_index, right_index):
    count = 0
    if left_index + 1 < right_index:
        mid_index = (left_index + right_index) // 2

        count += merge_sort(target_list, left_index, mid_index)
        count += merge_sort(target_list, mid_index, right_index)
        count += merge(target_list, left_index, mid_index,right_index)
        
    return count
if __name__ == "__main__":
    l = input()
    target_list = [int(a) for a in input().split()]
    count = merge_sort(target_list, 0, len(target_list))
    print(" ".join([str(n) for n in target_list]))
    print(count)

Measured memory_bytes: 68964
package main

import (
	"fmt"
	"sort"
)

type Asbs struct {
	as []int
	bs []int
}

func (asbs Asbs) Len() int {
	return len(asbs.as)
}

func (asbs Asbs) Swap(i, j int) {
	asbs.as[i], asbs.as[j] = asbs.as[j], asbs.as[i]
	asbs.bs[i], asbs.bs[j] = asbs.bs[j], asbs.bs[i]
}

func (asbs Asbs) Less(i, j int) bool {
	return asbs.as[i] < asbs.as[j]
}

func main() {
	var N, M int
	fmt.Scanf("%d%d", &N, &M)
	a := make([]int, M)
	b := make([]int, M)
	for i := 0; i < M; i++ {
		fmt.Scanf("%d%d", &a[i], &b[i])
	}
	sort.Sort(Asbs{as: a, bs: b})
	as := make([]int, 0)
	bs := make([]int, 0)
	for i := 0; i < M; i++ {
		for j := 0; j < len(as); j++ {
			//fmt.Printf("%d %d\n", as[j], bs[j])
			if as[j] < b[i] && a[i] < bs[j] {
				if as[j] < a[i] {
					as[j] = a[i]
				}
				if b[i] < bs[j] {
					bs[j] = b[i]
				}
				goto BREAK
			}
		}
		as = append(as, a[i])
		bs = append(bs, b[i])
	BREAK:
	}
	fmt.Printf("%d\n", len(as))
}


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

using namespace std;

int main()
{
    int n;
    cin>>n;
    long long int ans=0;
    vector<long long int> v;
    while(n--)
    {
        int temp;cin>>temp;
        v.push_back(temp);
    }
    
    for(int i=1;i<v.size();++i)
    {
        if(v[i]<v[i-1]){ans+=v[i-1]-v[i];v[i]+=v[i-1]-v[i];}
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 5336
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}
const ll MOD = 1000000007;
int upcmpii(const void *a, const void *b){
    return (*(int*)a == *(int*)b ? 0 : (*(int*)a > *(int*)b ? 1 : -1));
}
void sort_ui(int *a, int n){ qsort(a, n, sizeof(int), upcmpii);}

int main(){
    int n;
    scanf("%d", &n);
    int v[101010];
    rep(i, n) scanf("%d", v+i);

    int oc[101010] = {0}, ec[101010] = {0};
    rep(i, n){
        if(i % 2 == 0) oc[v[i]]++;
        else ec[v[i]]++;
    }
    int val[2] = {0}, cnt[2] = {0};
    rep(i, 100001){
        if(oc[i] == 0) continue;
        if(oc[i] > cnt[1]){
            cnt[1] = oc[i];
            val[1] = i;
        }
    }
    rep(i, 100001){
        if(ec[i] == 0) continue;
        if(ec[i] > cnt[0]){
            cnt[0] = ec[i];
            val[0] = i;
        }
    }

    ll ans = 0;
    if(val[0] != val[1]){
        ans = n - cnt[0] - cnt[1];
    }else{
        int vals[2] = {0}, cnts[2] = {0};
        rep(i, 100001){
            if(oc[i] == 0 || i == val[1]) continue;
            if(oc[i] > cnts[1]){
                cnts[1] = oc[i];
                vals[1] = i;
            }
        }
        rep(i, 100001){
            if(ec[i] == 0 || i == val[0]) continue;
            if(ec[i] > cnts[0]){
                cnts[0] = ec[i];
                vals[0] = i;
            }
        }
        ans = n - max(cnt[0]+cnts[1], cnt[1]+cnts[0]);
    }

    printf("%lld", ans);
}

Measured memory_bytes: 2908
import sys

X,Y=(int(x) for x in input().split())
#print(X,Y)
if Y%2==1:
  print('No')
  sys.exit()
if Y<2*X:
  print('No')
  sys.exit()
  

check=int((Y-2*X)/2)
#print(check)
if check<=X:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9188
let cut cards n k =
  Array.append (Array.sub cards k (2*n-k)) (Array.sub cards 0 k);;

let riffle cards n =
  let a = Array.sub cards 0 n and
      b = Array.sub cards n n in
  Array.init (2*n) (fun x -> if x mod 2 = 0 then a.(x/2) else b.( (x-1)/2 ) );;

let () =
  let n = read_int () and
      times = read_int () in
  let init = Array.init (2*n) (fun x -> (x+1)) in
  let rec read cards = function
      0 -> Array.iter (fun x -> Printf.printf "%d\n" x) cards
  | i ->
     let k = read_int () in
     if k = 0 then
       read (riffle cards n) (i-1)
     else
       read (cut cards n k) (i-1)
  in
  read init times;;

Measured memory_bytes: 4416
import sys
sys.setrecursionlimit(160000)

N = int(input())
A = [int(a) for a in input().split()]

dp = [[0]*N for _ in range(N)]
flag = [[False]*N for _ in range(N)]
S = [0]*(N+1)

for i in range(N):
    flag[i][i] = True

S[0] = A[0]
for i in range(N):
    S[i+1] = S[i]+A[i]
    
def f(l, r):
    if flag[l][r]:
        return dp[l][r]
    flag[l][r] = True
    res = 10**18
    for m in range(l, r):
        res = min(res, f(l, m)+f(m+1, r))
    dp[l][r] = res+S[r+1]-S[l]
    return dp[l][r]

print(f(0, N-1))

Measured memory_bytes: 44508
import numpy as np
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N,M,Q = map(int,readline().split())
lines = readlines()
L,R = np.array([line.split() for line in lines[:M]],np.int32).T
P,Q = np.array([line.split() for line in lines[M:]],np.int32).T

cnt = np.zeros((N+1,N+1),dtype=np.int32)
np.add.at(cnt,(L,R),1)

np.cumsum(cnt,axis=0,out=cnt)
np.cumsum(cnt,axis=1,out=cnt)

P -= 1
x = cnt[Q,Q] - cnt[Q,P] - cnt[P,Q] + cnt[P,P]
print('\n'.join(x.astype(str)))

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

int main(){
    std::string str;
    std::cin >> str;
    
    int q;
    std::cin >> q;
    std::string order;
    int a, b;
    std::string rep;
    while(q--){
        std::cin >> order;
        if(order=="replace"){
            std::cin >> a >> b >> rep;
            str.replace(a,b-a+1,rep);
        }else if(order=="reverse"){
            std::cin >> a >> b;
            rep = str.substr(a,b-a+1);
            std::reverse(rep.begin(), rep.end());
            str.replace(a,b-a+1,rep);
        }else if(order=="print"){
            std::cin >> a >> b;
            for(int i=a; i<=b; i++){
                std::cout << str[i];
            }
        	std::cout << std::endl;
        }else{
            return -1;
        }
    }
    return 0;
}


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


int main() {
    char c;
    int sum = 700;
    rep(i,3){
        cin >> c;
        if(c != 'x')sum += 100;
    }
    cout << sum << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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

using namespace std;

const int MAX_V = 1e5+10;

int V;
vector<int> G[MAX_V], rG[MAX_V], vs;
bool visited[MAX_V];
int topo[MAX_V];

void add_edge(int from, int to){
	G[from].push_back(to);
	rG[to].push_back(from);
}

void dfs(int v){
	visited[v] = true;
	for (int i = 0; i < G[v].size(); ++i)
	{
		int next = G[v][i];
		if (!visited[next]) dfs(next);
	}
	vs.push_back(v);
}

void rdfs(int v, int k){
	visited[v] = true;
	topo[v] = k;
	for (int i = 0; i < rG[v].size(); ++i)
	{
		int next = rG[v][i];
		if (!visited[next]) rdfs(next, k);
	}
}

void Kosaraju() {
	fill(visited, visited+V, false);
	vs.clear();
	for (int v = 0; v < V; ++v)
	{
		if (!visited[v]) dfs(v);
	}
	fill(visited, visited+V, false);
	int k = 0;
	for (int i = vs.size()-1; i >= 0; --i)
	{
		if (!visited[vs[i]]) rdfs(vs[i], k++);
	}
}

int main(int argc, char const *argv[])
{
	int E;
	cin >> V >> E;
	for (int i = 0; i < E; ++i)
	{
		int s, t;
		cin >> s >> t;
		add_edge(s, t);
	}
	int q;
	vector<pair<int, int> > question;
	cin >> q;
	for (int i = 0; i < q; ++i)
	{
		int u, v;
		cin >> u >> v;
		question.push_back(make_pair(u, v));
	}

	Kosaraju();
	for (int i = 0; i < q; ++i) {
		int u = question[i].first, v = question[i].second;
		if (topo[u]==topo[v]) cout << 1 << endl;
		else cout << 0 << endl;
	}
	return 0;
}


Measured memory_bytes: 9148
n = int(input())
info = [list(map(int, input().split())) for _ in range(n)]
for i in info:
    if i[2] > 0:
        x, y, h = i[0], i[1], i[2]
        break
for i in range(101):
    for j in range(101):
        H = h + abs(x - i) + abs(y - j)
        if all(max(H - abs(k[0] - i) - abs(k[1] - j), 0) == k[2] for k in info):
            print(i, j, H)

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

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

    vector<long long> A(N + 1);
    for (long long &a : A)
    {
        cin >> a;
    }

    vector<long long> limit(N + 1, 0);
    limit[0] = 1 - A[0];
    for (size_t i = 1; i <= N; i++)
    {
        limit[i] = min(2 * limit[i - 1] - A[i], (long long)1e17);
    }
    for (long long l : limit)
    {
        if (l < 0)
        {
            cout << -1 << endl;
            return 0;
        }
    }

    long long prev = A[N];
    long long ans = prev;
    for (size_t i = N - 1; i < N; i--)
    {
        if (2 * limit[i] < prev)
        {
            cout << -1 << endl;
            return 0;
        }
        prev = min(prev, limit[i]) + A[i];
        ans += prev;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4840
n = int(input())
s = ["A","C","G","T"]
lis = ["AGC","ACG","GAC"]

d = {}
for i in s:
    for j in s:
        for k in s:
            if i + j + k in lis:
                d[i + j + k] = 0
            else:
                d[i + j + k] = 1

dd = {}
for _ in range(n-3):
    for i in s:
        for j in s:
            for k in s:
                num = 0
                for nu in s:
                    if nu + j + k != "AGC" and nu + i + k != "AGC":
                        num += d[nu + i + j]
                    if i + j + k in lis:
                        dd[i + j + k] = 0
                    else:
                        dd[i + j + k] = num % (10 ** 9 + 7)
    dd,d = d,dd

print(sum(d.values()) % (10 ** 9 + 7))

Measured memory_bytes: 3064
N = int(raw_input())
a = raw_input()

b = list(a)
check = 0
j = 0
k = 0
for i in range(N):
	if b[i] == "(":
		check = check + 1
	else:
		check = check - 1
	
	if check < 0:
		j += 1
		check = check + 1
for i in range(j):
	b = ["("] + b

for i in range(check):
	b = b + [")"]
	k += 1
import six
for i in range(N+j+k):
	six.print_(b[i],end = "")

Measured memory_bytes: 2816
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
    print((B - A) // 2)
else:
    print(min(A  + (B - A - 1) // 2,  N - B + 1 + (N - (A + (N - B) + 1)) // 2))

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;

class P
{
    static void Main()
    {
        string s = Console.ReadLine();
        long scount = 0;
        long splace = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (s[i] == 'W')
            {
                scount++;
                splace += (i + 1);
            }
        }
        Console.WriteLine(splace - (scount + 1) * scount / 2);
    }
}

class State
{
    string seq;
    int[] remain;
    public State(string seq, int[] remain)
    {
        this.seq = seq;
        this.remain = remain.ToArray();
    }
}

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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				Vint;
typedef vector<Vint>			VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		100010
#define MAX_V 		102
#define MAX_E 		1005

const ll LINF = (ll)1e18+7;		//
const int INF = 100100100;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//

// int DP[MAX];

//
int main(){
	int N;cin >> N;
	vector<P> A(N,P(0,0));
	REP(i,N)
	{
		cin >> A[i].first;
		A[i].second = i;
	}

	sort(ALL(A));

	REP(i,N)cout << A[i].second+1 << " ";
	cout << endl;

	return 0;
}




Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define rep(i,from,to) for(int i=from; i<to; ++i)
#define REP(i,from,to) for(int i=from; i<=to; ++i)
using namespace std;
template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i] << endl;
	}
	return out;
}
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last) {
			out << ",";
		}
	}
	out << "]";
	return out;
}

int n;
bool isPrime(int k) {
	if (k < 2) {
		return false;
	} else if (k == 2) {
		return true;
	}
	for (int i = 2; i * i <= k; i++) {
		if (k % i == 0) {
			return false;
		}
	}
	return true;
}

void solve() {
	cin >> n;
	int ans = 0;
	rep(i,0,n)
	{
		int k;
		cin >> k;
		if (isPrime(k)) {
			ans++;
		}
	}
	cout << ans << endl;
}

int main() {
	solve();
}

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

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>


using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef queue<int> qi;


int n , m;

vi dp(100005);
vi hi(100005);
vi ho(100005);
vvi adjLst(100005);

void fill(){
    for(int i=0 ;i <100005; i++)
        dp[i] = -1;

}

void dfs(int node)
{   
    // cout<< "here going in loop for "<< node+1 <<endl;

    for(int& p : adjLst[node])
    {   
        // cout<<" parent : "<< p+1<<" node :"<<node+1<<" ";

        if(dp[p]!=-1){
            // cout << "before : "<<dp[node]<<" ";
            dp[node] = max(dp[p]+1 ,dp[node]);
            // cout << "after "<<dp[node]<<endl;
            
        }
        else{
            if(ho[p]==0){
                dp[p] = 0;
                // cout<< "return 0 for node "<<p+1<<endl;
                
            }
            else{
                // cout << "called dfs : "<<p+1 <<endl;
                dfs(p);
            }
        }
        dp[node] = max(dp[p]+1 ,dp[node]);
    }
    // cout << "out of loop for "<<node+1<<endl;

}
   


int main()
{   
    // int n ,m;
    fill();
    cin >> n>>m;

    // vvi adjLst(n);
    // vi hi(n) , dp(n);
    // vi dp(n);
    int x ,y;
    // cout << adjLst[0][0];
    for(int i=0; i<m; i++)
    {
        cin >> x >> y;
        adjLst[x-1].push_back(y-1);
        // cout<< adjLst[x-1][0];
        ++hi[y-1];
        ++ho[x-1];
    }
    int mx =0;
    for(int i=0; i<n; i++){
        // cout << hi[i] << " ";
        if(hi[i]==0){
            dfs(i);
            // cout << dp[i] << " ";
            mx = max(dp[i] , mx);
            // break;
        }
    }

    // for(int i=0; i<n; i++){
    //     cout <<dp[i]<<" ";
    // }

    // cout <<dfs(4)<< " " <<dp[4]<<endl;
    

    cout << mx<<endl;




    return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
 
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }


signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif
    
    string s;
    cin >> s;
    int n = s.size() + 1;
    vector<int> a(n, -1);
    for (int i = 0; i < n; ++i)
    {
        if ((!i || s[i - 1] == '>') && (i == n - 1 || s[i] == '<'))
        {
            a[i] = 0;
        }
        else if (i > 0 && i < n - 1 && s[i - 1] == '<' && s[i] == '<')
        {
            a[i] = a[i - 1] + 1;
        }
    }
    for (int i = n - 1; i >= 0; --i)
    {
        if (i > 0 && i < n - 1 && s[i - 1] == '>' && s[i] == '>')
            a[i] = a[i + 1] + 1;
    }
    for (int i = 0; i < n; ++i)
    {
        if (a[i] == -1)
        {
            if (i == 0)
                a[i] = a[i + 1] + 1;
            else if (i == n - 1)
                a[i] = a[i - 1] + 1;
            else
                a[i] = max(a[i - 1], a[i + 1]) + 1;
        }
    }
    ll sum = 0;
    for (auto e : a)
        sum += e;
    cout << sum << '\n';
    
    return 0;
}



Measured memory_bytes: 2844
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(isdigit(ch))
	{
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int ch[2][1<<22],id[22][1<<21],cnt,a[22][1<<22],siz[22],c[22][1<<22],num[22][1<<22],ans[22],N,K;
inline void get()
{
	id[0][0]=++cnt;
	ch[0][id[0][0]]=ch[1][id[0][0]]=-1;
	for(int i=1;i<=20;i++)
	{
		int t=(1<<i),k=(t>>1);
		for(int s=0;s<t;s++)
		{
			id[i][s]=++cnt;
			int p=(s&k),q=(p?1:0);
			ch[q][id[i][s]]=id[i-1][s^p];
			ch[!q][id[i][s]]=ch[!q][id[i-1][s^p]];
		}
	}
}
inline void dfs(int d,int s)
{
	if(ans[d]==-1)ans[d]=s;
	for(int p=0;p<=1;p++)
	{
		int tot=0;
		for(int i=0;i<siz[d];i++)
		{
			int to=ch[p][a[d][i]];
			if(to==-1)continue;
			if(num[d+1][to]==-1)
			{
				num[d+1][a[d+1][siz[d+1]]=to]=siz[d+1];
				siz[d+1]++;
			}
			tot+=c[d][i];
			c[d+1][num[d+1][to]]+=c[d][i];
		}
		if(tot>=K)dfs(d+1,(s<<1)|p);
		for(int i=0;i<siz[d+1];i++)
		{
			num[d+1][a[d+1][i]]=-1;
			c[d+1][i]=0;
		}
		siz[d+1]=0;
	}
}
char s[1<<21];
int main()
{
	N=read();
	K=read();
	get();
	for(int i=0;i<=N;i++)for(int j=0;j<cnt;j++)num[i][j]=-1;
	for(int i=0;i<=N;i++)
	{
		scanf("%s",s);
		int t=(1<<i);
		for(int j=0;j<t;j++)if(s[j]=='1')
		{
			num[0][a[0][siz[0]]=id[i][j]]=siz[0];
			c[0][num[0][id[i][j]]]++;
			siz[0]++;
		}
		ans[i]=-1;
	}
	dfs(0,0);
	for(int i=N;i>=0;i--)if(ans[i]!=-1)
	{
		for(int j=i-1;j>=0;j--)putchar(((ans[i]>>j)&1)+'0');
		puts("");
		return 0;
	}
	return 0;
}
/*
*/

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

int main() {
  char a; cin >> a;
  int ai = a - '0';
  string ans = "A";
  if (ai >= 49) ans = "a";
  cout << ans << endl;
}

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

using ll = long long;
static const int MAX = 1005;
static const double INF = 1e18;

// ダイクストラ法 O(ElogV)
vector<pair<int, double>> G[MAX];
vector<double> dist; // 最短距離
// main関数からこれらを削除すること

void dijkstra(int n, int s) { // nは頂点数, sは開始頂点
  priority_queue<pair<double, int>, vector<pair<double, int>>, greater<pair<double, int>>> pq;
  // first:最短距離 second:頂点の番号
  dist = vector<double>(n, INF); // 初期化
  dist[s] = 0; // 開始点の距離は0
  pq.push(make_pair(0, s));
  
  while (!pq.empty()) {
    pair<double, int> p = pq.top();
    pq.pop();
    int v = p.second;
    if (dist[v] < p.first) continue;
    for (int i = 0; i < G[v].size(); i++) {
      pair<int, double> p2 = G[v][i];
      if (dist[p2.first] > dist[v] + p2.second) {
        dist[p2.first] = dist[v] + p2.second;
        pq.push(make_pair(dist[p2.first], p2.first));
      }
    }
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  double xs, ys, xt, yt;
  cin >> xs >> ys >> xt >> yt;
  
  int n;
  cin >> n;
  
  vector<vector<double>> v(n, vector<double>(3));
  for (int i = 0; i < n; i++) {
    cin >> v.at(i).at(0) >> v.at(i).at(1) >> v.at(i).at(2);
  }
  
  // vector<pair<int, double>> G[n + 2];
  
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      double dis = sqrt(pow(v.at(i).at(0) - v.at(j).at(0), 2) + pow(v.at(i).at(1) - v.at(j).at(1), 2));
      dis = max((double) 0, dis - (v.at(i).at(2) + v.at(j).at(2)));
      G[i].emplace_back(make_pair(j, dis));
      G[j].emplace_back(make_pair(i, dis));
    }
  }
  for (int i = 0; i < n; i++) {
    double dis = sqrt(pow(v.at(i).at(0) - xs, 2) + pow(v.at(i).at(1) - ys, 2));
    dis = max((double) 0, dis - v.at(i).at(2));
    G[i].emplace_back(make_pair(n, dis));
    G[n].emplace_back(make_pair(i, dis));
  }
  for (int i = 0; i < n; i++) {
    double dis = sqrt(pow(v.at(i).at(0) - xt, 2) + pow(v.at(i).at(1) - yt, 2));
    dis = max((double) 0, dis - v.at(i).at(2));
    G[i].emplace_back(make_pair(n + 1, dis));
    G[n + 1].emplace_back(make_pair(i, dis));
  }
  double dis = sqrt(pow(xs - xt, 2) + pow(ys - yt, 2));
  G[n].emplace_back(make_pair(n + 1, dis));
  G[n + 1].emplace_back(make_pair(n, dis));
  
  dijkstra(n + 2, n);
  
  cout << fixed << setprecision(10) << dist[n + 1] << '\n';
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

const int MAX = 2100000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[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 COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll calc(ll c, ll r){

  ll ret = 0;
  for(ll i = 1; i <= c+1; i++){
    ret = (ret + COM(r+i, i)) % MOD;
  }
  return ret;
}

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

  ll r1, c1, r2, c2;
  cin >> r1 >> c1 >> r2 >> c2;

  ll ans = calc(r2, c2);

  ans = (ans + MOD - calc(r2, c1-1)) % MOD;
  ans = (ans + MOD - calc(r1-1, c2)) % MOD;

  ans = (ans + calc(r1-1, c1-1)) % MOD;

  cout << ans << endl;

  

  return 0;
}


Measured memory_bytes: 49536
#include <iostream>
using namespace std;
int main(){
  string x,y;
  int a,b;
  cin>>x>>y;
  a=stoi(x, nullptr, 16); 
  b=stoi(y, nullptr, 16); 
  if(a<b){
    cout<<"<";
  }else if(a>b){
    cout<<">";
  }else{
    cout<<"=";
  }
  return 0;
}

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

using namespace std;

int main(void){
  int N, M;
  cin >> N >> M;
  vector<string> A(N), B(M);
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < M; i++) cin >> B[i];
  for(int i = 0; i + M <= N; i++){
    for(int j = 0; j + M <= N; j++){
      for(int ii = 0; ii < M; ii++){
        for(int jj = 0; jj < M; jj++){
          if(A[i + ii][j + jj] != B[ii][jj]) goto next;
        }
      }
      cout << "Yes" << endl;
      return 0;
      next:;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  long long int x,ans,kaisuu;

  scanf("%lld",&x);

  ans=x/11;

  if(x%11>=7){
    kaisuu=ans*2+2;
  } else if(x%11==0){
    kaisuu=ans*2;
  } else {
    kaisuu=ans*2+1;
  }

  printf("%lld\n",kaisuu);

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main()
{
    int a,b,c, count = 0;
    scanf("%d%d%d", &a,&b,&c);
    if(a == b && a == c)
        count = 1;
    else if(a == b && a!=c)
        count = 2;
    else if(a!=b && b==c)
        count = 2;
    else if(a==c && a!=b)
        count = 2;
    else
        count = 3;
    printf("%d", count);

}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
 
char map[22][22], mk[22][22];
int que[500][2], top, end;
int m[4][2] = {{1,0},{-1,0},{0,-1},{0,1}};
 
int main()
{
    int w, h, i, r, c, r2, c2, ans;
     
    while (scanf("%d%d", &w, &h) && w) {
        memset(mk, 0, sizeof(mk));
        for (i = 0, r = 0; r < h; r++) {
            scanf("%s", map[r]);
            if (!i) for (c = 0; c < w; c++) if (map[r][c] == '@') {
                que[0][0] = r, que[0][1] = c; mk[r][c] = 1, top = 0, end = 1, i = 1;
            }
        }
        while (top < end) {
            r = que[top][0], c = que[top++][1];
            for (i = 0; i < 4; i++) {
                r2 = r + m[i][0], c2 = c + m[i][1];
                if (r2 < 0 || r2 >= h || c2 < 0 || c2 >= w || map[r2][c2] == '#') continue;
                if (mk[r2][c2]) continue;
                mk[r2][c2] = 1;
                que[end][0] = r2, que[end++][1] = c2;
            }
        }
        for (ans = 0, r = 0; r < h; r++) for (c = 0; c < w; c++) ans += mk[r][c];
        printf("%d\n", ans);
    }
    return 0;
}


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

const int M=100010;
bool stu[410][410];
int n,m,a[M],b[M];
bool cant[410];

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d%d",a+i,b+i);
    for(int i=1;i<=n;i++)
    {
        stu[i][i]=1;
        for(int j=m;j>=1;j--)
        {
            bool x=stu[i][a[j]],y=stu[i][b[j]];
            if(x&&y){cant[i]=1;break;}
            else if(x) stu[i][b[j]]=1;
            else if(y) stu[i][a[j]]=1;
        }
    }
    int ans=0;
    for(int i=1;i<n;i++)
    {
        if(cant[i]) continue;
        for(int j=i+1;j<=n;j++)
        {
            if(cant[j]) continue;
            bool flag=1;
            for(int k=1;k<=n;k++)
                if(stu[i][k]&&stu[j][k]) flag=0;
            ans+=flag;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string S;
    cin >> S;
    sort( ALL( S ) );
    REP( i, (int)S.size() - 1 )
    {
        if( S[ i ] == S[ i + 1 ] )
        {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define nt _int128
#define mod 1000000007
int main()
{
#ifndef ONLINE_JUDGE
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    // cin >> t;
    t  = 1;
    while(t--)
    {
    	string s;
    	cin>>s;
    	ll ans=0;
    	ll n=s.size();
    	for(ll i=0;i<n;i++)
    	{
    		ans+=(s[i]-'0');
    	}
    	if(ans%9)
    		cout<<"No";
    	else
    		cout<<"Yes";
    }
    return 0;
}

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



int main() {
    int N, K;
    scanf("%d", &N);
    vector<vector<int>> edge(N+1);
    for (int i = 0; i < N-1; i++) {
        int A, B;
        scanf("%d %d", &A, &B);
        edge[A].push_back(B);
        edge[B].push_back(A);
    }
    scanf("%d", &K);
    vector<pair<int, int>> value(N+1, {-1, -1});
    queue<int> q;
    for (int i = 0; i < K; i++) {
        int V, P;
        scanf("%d %d", &V, &P);
        value[V] = {P, 0};
        q.push(V);
    }
    while(!q.empty()) {
        int now = q.front();
        q.pop();
        int a = value[now].first;
        int b = value[now].second+1;
        for (int nxt : edge[now]) {
            int c = value[nxt].first;
            int d = value[nxt].second;
            if (d == -1) {
                value[nxt] = {a, b};
                q.push(nxt);
            }else{
                if ((a+b+c+d)%2 == 1) {
                    cout << "No" << endl;
                    return 0;
                }
                int ma = min(a+b, c+d);
                int mi = max(a-b, c-d);
                if (ma < mi) {
                    cout << "No" << endl;
                    return 0;
                }
                int cen = (ma+mi)/2;
                if (mi > c-d || ma < c+d) {
                    value[nxt] = {cen, ma-cen};
                    q.push(nxt);
                }
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i <= N; i++) {
        printf("%d\n", value[i].first+value[i].second);
    }
    return 0;
}


Measured memory_bytes: 7800
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <map>
#include <set>
using namespace std;




int main()
{
	int a;
	cin >> a;
	if (a < 1200)
		cout << "ABC" << endl;
	else if (a < 2800)
		cout << "ARC" << endl;
	else
		cout << "AGC" << endl;

	return 0;

}

Measured memory_bytes: 256
from sys import stdin
input = stdin.readline
from fractions import gcd
 
mod = 10**9+7
 
n = int(input())
a = list(map(int,input().split()))
d = 1
for i in range(n):
  d *= a[i] // gcd(a[i],d)
ans = 0
for i in range(n):
  ans += d//a[i]
 
print(ans%mod)

Measured memory_bytes: 6200
package main

import (
  "fmt"
  "math"
)

func main() {
  var a, b, c, d float64
  fmt.Scanf("%f %f %f %f", &a, &b, &c, &d)
  if math.Ceil(c / b) > math.Ceil(a / d) {
    fmt.Println("No")
  } else {
    fmt.Println("Yes")
  }
}

Measured memory_bytes: 1820
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int n;//入力
int main()
{
  cin >>n;
  for(int i = 0;i < n;i++){
    int start;
    int finish;
    int ans;
    bool flag;
    cin >>start>>finish;
    if(start >5&&finish <=5){
      cout <<start;
      cout <<" ";
      ans = start;
      for(int j = 1;j <=(9-ans);j++){
	cout <<++start;
	cout <<" ";
      }
    for(int j = 5;j !=finish;j--){
      cout <<j;
      cout <<" ";
    }
    cout <<finish<<endl;
    continue;
    }
    if(start >6&&finish >5&&finish <start){
      cout <<start;
      cout <<" ";
      ans = start;
      for(int j = 1;j <=(9-ans);j++){
	cout<<++start;
	cout <<" ";
      }
      for(int j = 5; j!=-1;j--){
	cout <<j;
	cout <<" ";
      }
      for(int j = 1;j <finish;j++){
	cout <<j;
	cout <<" ";
      }
      cout <<finish<<endl;
      continue;
    }
    if(finish >start){
      ans = finish-start;
      flag =true;
    }
    else if(finish <start){
      ans = start-finish;
      flag =false;
    }
  
    if(flag){
    cout <<start;
    cout <<" ";
    for(int j = 1;j <ans;j++){
      cout <<++start;
      cout <<" ";
    }
    cout <<finish<<endl;
    }
    else if(!flag){
      cout <<start;
      cout <<" ";
      for(int j = 1;j <ans;j++){
	cout <<--start;
	cout <<" ";
      }
      cout <<finish<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <numeric>
#include <cassert>
#include <cmath>
#include <map>
#include <set>
#include <iostream>

using namespace std;

#define FOR(k,a,b) for(int k(a); k < (b); ++k)
#define REP(k,a) for(int k=0; k < (a); ++k)
#define ABS(a) ((a)>0?(a):-(a))
#define EPS 1e-9
typedef long long LL;
const LL MOD = 1e9 + 7;

int main(int argc, char** argv) {
#ifdef HOME
	freopen("in.txt", "rb", stdin);
	freopen("out.txt", "wb", stdout);
#endif
	int N;
	scanf("%d", &N);
	vector<int> v(N);
	REP(i,N)
		scanf("%d", &v[i]);
	LL res = 1;
	int ctr = 0;
	REP(i, N)
	{
		++ctr;
		if (v[i] < (2 * ctr - 1))
		{
			res *= ctr;
			res %= MOD;
			--ctr;
		}
	}
	while(ctr>0)
	{
		res *= ctr;
		res %= MOD;
		--ctr;
	}
	printf("%lld\n", res);
	return 0;
}


Measured memory_bytes: 640