akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    int max_a = 0;
    int tmp = 0;
    vector<int> num(1010101, 0);
    REP(i, n) {
        cin >> a[i];
        max_a = max(max_a, a[i]);
        tmp = __gcd(tmp, a[i]);
        num[a[i]]++;
    }

    if (tmp != 1) {
        cout << "not coprime" << endl;
        return 0;
    }

    int i;
    for(i = 2; i <= 1000000; i++) {
        int x = 0;
        for(int j = i; j <= 1000000; j+=i) x += num[j];
        if (x >= 2) break;
    }

    for(int k = 1; k < 16; k++) {
        cerr << k << " " << num[k] << endl;
    }

    if (i == 1000001) {
        cout << "pairwise coprime" << endl;
    } else {
        cout << "setwise coprime" << endl;
        
    }




    return 0;
}

Measured memory_bytes: 11072
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n,m;
	scanf("%d %d",&n,&m);
	int count[n];
	fill(count,count+n,0);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d %d",&a,&b);
		count[a-1]++;
		count[b-1]++;
	}
	for(int i=0;i<n;i++)
		printf("%d\n",count[i]);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
B = list(map(int, input().split()))

A = [0] * n

if n == 2:
  A[0] = A[1] = B[0]
elif n == 3:
  A[0] = B[0]
  A[1] = min(B[0], B[1])
  A[-1] = B[-1]
elif n > 3:
  A[0] = B[0]
  A[-1] = B[-1]
  
  for i in range(1, n-1):
    A[i] = min(B[i-1], B[i])

print(sum(A))

Measured memory_bytes: 3064
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

#[derive(Eq, PartialEq, Clone, Debug)]
pub struct Rev<T>(pub T);
impl<T: PartialOrd> PartialOrd for Rev<T> {
    fn partial_cmp(&self, other: &Rev<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }
}
impl<T: Ord> Ord for Rev<T> {
    fn cmp(&self, other: &Rev<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

fn solve() {
    let (n,c) = get!(usize, usize);
    let stc = get!(usize, usize, usize; n);
    let mut time = vec![vec![0; 200_100]; c+1];
    for (s,t,c) in stc {
        time[c][2*s-1] = 1;
        time[c][2*t] = -1;
    }
    let mut mx = 1;
    for t in 0..200_010 {
        let mut count = 0;
        for ch in 1..c+1 {
            time[ch][t+1] += time[ch][t];
            if time[ch][t] > 0 {
                count += 1;
            }
        }
        mx = max!(mx, count);
    }
    println!("{}", mx);
}


Measured memory_bytes: 43260
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V< V<int> > a(n, V<int>(n));
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> a[i][j];

    vll dp(1 << n);
    for (int state = 1; state < (1 << n); state++) {
        for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
            if ((state >> i & 1) && (state >> j & 1)) dp[state] += ll(a[i][j]);
        }
        for (int subset = state; subset > 0; subset = (subset - 1) & state) {
            chmax(dp[state], dp[subset] + dp[state ^ subset]);
        }
    }
    cout << dp.back() << '\n';
    return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> adj[200005];
vector<int> ans;
vector<bool> visited;

void dfs(int v, int p=-1) {
  for (int u : adj[v]) {
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main() {
  int n, q;
  cin >> n >> q;
  for(int i=0;i<n-1;i++) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  ans.resize(n);
  for(int i=0;i<q;i++) {
    int p, x;
    cin >> p >> x;
    --p;
    ans[p] += x;
  }
  dfs(0);
  for(int i=0;i<n;i++) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 24352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll n, t, s;
  in2(n, t);
  vector<ll> a(n);
  rep(i, n)
    in(a[i]);
  s = t;
  rep(i, n - 1)
    s = s + min(t, a[i + 1] - a[i]);
  out(s);
  memi;
}

Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int x, y, z;
	cin >> x >> y >> z;

	int left = x - 2 * z;
	int people = 0;
	while (left >= y) {
		++people;
		left -= (y + z);
	}

	cout << people << "\n";

	return 0;

}

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

int main() {
	int n;
	cin >> n;


	vector<vector<int>> a(100, vector<int>(2));



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

	for (int i = 0; i < n-2; i++) {
		if (a[i][0] == a[i][1] && a[i + 1][0] == a[i + 1][1] && a[i + 2][0] == a[i + 2][1]) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
}

Measured memory_bytes: 3640
using System;

namespace B___Count_ABC
{
    class Program
    {
        static void Main (string[] args)
        {
            var n = int.Parse (Console.ReadLine ());
            var s = Console.ReadLine ();
            var count = 0;
            for (var i = 0; i < s.Length - 2; i++)
            {
                if (s.Substring (i, 3) == "ABC")
                    count++;
            }
            Console.WriteLine (count);
        }
    }
}

Measured memory_bytes: 11092
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, M = get_ints
S = []
C = []
M.times do |i|
  S[i], C[i] = get_ints
end

ans = '0' * N
ans[0] = '1' if N != 1

hash = {}

M.times do |i|
  s = S[i] - 1
  if hash[s] && ans[s] != C[i].to_s
    ans = -1
    break
  end
  hash.push(s, C[i])
  ans[s] = C[i].to_s
end

if ans == -1
  puts ans
else
  if ans.to_i.to_s != ans
    puts -1
  else
    puts ans
  end
end



Measured memory_bytes: 14500
#include<iostream>
#include<algorithm> //swap??§??????
using namespace std;

int partition(int A[], int p, int r){
 int x = A[r];
 int i = p-1;
 for(int j=p; j<=r-1; j++){
  if(A[j] <= x){
   i = i+1;
   swap(A[i],A[j]); //int a = A[i]; A[i] = A[j]; A[j] = a;
  }
 }
 swap(A[i+1],A[r]); //int b = A[i+1]; A[i+1] = A[r]; A[r] = b;
 return i+1;
}

int main(){
 int n;
 cin >> n;
 int A[n];
 for(int i=0; i<n; i++){
  cin >> A[i];
 }

 int q = partition(A, 0, n-1);
 
/*
 for(int i=0; i<n; i++){
  if(i==q){
   cout << '[' << A[i] << ']' << ' ';
  }else{
   cout << A[i] << ' ';
  }
 }
*/

 for(int i=0; i<n; i++){
  if(i==q){
   cout << '[' << A[i] << ']';
  }else{
   cout << A[i];
  }
  if(i<n-1){
   cout << ' ';
  }else{
   cout << endl;
  }
 }

 return 0;
}

Measured memory_bytes: 3468
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    if N % 2 != 0:
        print(0)
        return
    ans = 0
    x = 10
    while x <= N:
        ans += N // x
        x *= 5
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
const int mod=998244353;
#define Rint register int
#define C(n,m) (n<m?0:1ll*fac[n]*invfac[n-m]%mod*invfac[m]%mod)
using namespace std;
int T,n,m,p,k;
bool f[310][310][310];
int dp[310][310][310],C[610][610],ans=0;
char s[310];
int main(){
	scanf("%s",s),n=strlen(s);
	for(int i=0;i<=2*n;i++){
		C[i][0]=1;
		for(int j=1;j<=i;j++) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod; 
	} 
	for(int j=0;j<=n;j++) for(int k=0;k<=n;k++) dp[n][j][k]=C[j+k][j];
	for(int i=n-1;i>=0;i--) for(int j=0;j<=i;j++) for(int k=0;k<=i;k++){
		dp[i][j][k]=dp[i+1][j][k];
		if(s[i]=='0'&&k) dp[i][j][k]=(dp[i][j][k]+dp[i][j][k-1])%mod;
		if(s[i]=='1'&&j) dp[i][j][k]=(dp[i][j][k]+dp[i][j-1][k])%mod;
	}
	f[0][0][0]=true;
	for(int i=0;i<=n;i++){
		for(int j=i;j>=0;j--){
			for(int k=i;k>=0;k--){
				if(j&&j+k>=2) f[i][j-1][k]|=f[i][j][k];
				if(k&&j+k>=2) f[i][j][k-1]|=f[i][j][k];
				if(i+1<=n){
					if(j&&s[i]=='1') f[i+1][j-1][k+1]|=f[i][j][k];
					if(k&&s[i]=='0') f[i+1][j+1][k-1]|=f[i][j][k];
					if(j+k) f[i+1][j][k]|=f[i][j][k];
				}
				if(i+2<=n){
					if(s[i]=='0'||s[i+1]=='0') f[i+2][j+1][k]|=f[i][j][k];
					if(s[i]=='1'||s[i+1]=='1') f[i+2][j][k+1]|=f[i][j][k];
				}
			}
		}
	}
	for(int i=n;i>=0;i--){
		for(int j=i;j>=0;j--){
			for(int k=i;k>=0;k--){
				if(!f[i][j][k]) continue;
				ans=(ans+dp[i][j][k])%mod;
				int cnt[2]={};
				for(int l=i-1;l>=0;l--){
					cnt[s[l]-'0']++;
					if(j<cnt[0]||k<cnt[1]) break;
					f[l][j-cnt[0]][k-cnt[1]] = false;
				}
			}
		}
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 76208
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    while(true){
        int n, m;
        cin >> n >> m;
        if(n == 0 && m == 0){
            break;
        }

        P st;
        vector<vector<bool>> area(m, vector<bool>(n, false));
        rep(i, m){
            rep(j, n){
                char c;
                cin >> c;

                if(c == '.'){
                    area[i][j] = true;
                }
                if(c == '@'){
                    area[i][j] = true;
                    st = make_pair(i, j);
                }
            }
        }

        vector<int> d = {0, 1, 0, -1};

        vector<vector<bool>> mark(m, vector<bool>(n, false));
        queue<P> que;
        que.push(st);
        int ans = 0;
        while(not que.empty()){
            P p = que.front();
            que.pop();

            int x = p.first;
            int y = p.second;
            if(mark[x][y] || not area[x][y]){
                continue;
            }

            mark[x][y] = true;
            ans++;
            rep(i, 4){
                int nx = x + d[i];
                int ny = y + d[i^1];
                if(0 <= nx && nx < m && 0 <= ny && ny < n){
                    que.push(make_pair(nx, ny));
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  int n,x;
  cin >> n >> x;
  if(n*500 >= x) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int k,a,b;
	int c = 0;
	scanf("%d",&k);
	scanf("%d %d",&a,&b);
	for ( int i = a; i <= b; i++)
	{
		if ( i % k == 0)
		{
			c = 1;
			break;
		}
	}
	
	if (c == 1)
	{
		printf("OK\n");
	} else {
		printf("NG\n");
	}
	
	return 0;
}

Measured memory_bytes: 1632
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
// const long long INF = 1LL<<60;
const int INF = 1<<29;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
    int N,M;cin>>N>>M;
    vector<int> a(M,0),b(M,0),c(M,0);
    vector<vector<int>> dist(N,vector<int>(N,INF)); 
    rep(i,N) dist[i][i] = 0;
    rep(i,M) {
        cin>>a[i]>>b[i]>>c[i];
        a[i]--;b[i]--;
        dist[a[i]][b[i]] = c[i];
        dist[b[i]][a[i]] = c[i];
    }
    rep(k,N) rep(i,N) rep(j,N) {
        dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
    }
    int ans = 0;
    rep(i,M) {
        if(c[i] != dist[a[i]][b[i]]) ans++;
    }
    cout<<ans<<endl;
}

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

// @author: pashka

int main() {
    ios::sync_with_stdio(false);
    
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    
    vector<long> prefsum(n + 1);
    for (int i = 0; i < n; i++) {
        prefsum[i + 1] = prefsum[i] + p[i];
    }
    
    long mx = 0;
    for (int i = 0; i + k <= n; i++) {
        long s = prefsum[i + k] - prefsum[i];
        mx = max(mx, s);
    }
    
    cout << setprecision(20) << (mx + k) * 0.5 << "\n";

    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   for(int i=0;i<(n);++i)
#define SORT(c)    sort((c).begin(),(c).end())
#define CLR(a)     memset((&a), 0 ,sizeof(a))//clear memory
#define dump(x)    cerr << #x << " = " << (x) << endl;//debug
#define debug(x)   cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define EPS        1e-10//sample:if((double)>=(double)+EPS)
//cin,cout release
//std::cin.tie(0);
//ios::sync_with_stdio(false);

using namespace std;
#define N 3
#define N2 9
#define LIMIT 100

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

int MDT[N2][N2];

struct puzzle {
  int f[N2],space,MD;
};
puzzle state;
int limit=100;
int path[100];

int getallmd(puzzle pz){
  int sum=0;
  rep(i,N2){
    if(pz.f[i]==N2)continue;
    sum+=MDT[i][pz.f[i]-1];
  }
  return sum;
}
bool isSolved(){
  rep(i,N2)if(state.f[i]!=i+1)return 0;
  return 1;
}
bool dfs(int depth,int prev){
  if(state.MD==0){
    return 1;
  }
  if(depth+state.MD>limit)return 0;
  int sx=state.space/N;
  int sy=state.space%N;
  puzzle tmp;
  rep(r,4){
    int tx=sx+dx[r];
    int ty=sy+dy[r];
    if(tx<0||ty<0||tx>=N||ty>=N)continue;
    if(max(prev,r)-min(prev,r)==2)continue;
    tmp=state;
    state.MD -= MDT[tx*N+ty][state.f[tx*N+ty]-1];
    state.MD += MDT[sx*N+sy][state.f[tx*N+ty]-1];
    swap(state.f[tx*N+ty],state.f[sx*N+sy]);
    state.space = tx*N+ty;
    if(dfs(depth+1,r)){
      path[depth]=r;
      return 1;
    }
    state=tmp;
  }
  return 0;
}

int iterative_deeping(puzzle in){
  in.MD=getallmd(in);
  for(limit=in.MD;limit<=LIMIT;limit++){
    state=in;
    if(dfs(0,-100)){
      int ans=0;
      rep(i,limit)ans+=1;
      return ans;
    }
  }
  return -1;
}



int main(){
  rep(i,N2)rep(j,N2)MDT[i][j]=abs(i/N-j/N)+abs(i%N-j%N);
  puzzle in;
  rep(i,N2){
    cin>>in.f[i];
    if(in.f[i]==0){
      in.f[i]=N2;
      in.space=i;
    }
  }
   int ans = iterative_deeping(in);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3112
fun main(args: Array<String>){
    val n = readLine()!!.toInt()
    val s = readLine()!!

    val lCumSum = mutableListOf(0)
    for(i in 1..n) {
        lCumSum.add(lCumSum[i - 1] + if(s[i-1] == '#') 1 else 0)
    }

    var minAns = n
    for(i in 0..n) {
        val ans = lCumSum[i] + ((n - i) - (lCumSum[n] - lCumSum[i]))
        minAns = listOf(minAns, ans).min()!!
    }
    println(minAns)
}

Measured memory_bytes: 56124
while 1:
    n=input()
    if n==0: break
    ar=raw_input()+' '
    for i in range(n):
        cnt=1
        tmp=''
        for i in range(len(ar)-1):
            if ar[i]==ar[i+1]:
                cnt+=1
            else:
                tmp+="%d%s"%(cnt,ar[i])
                cnt=1
        ar=tmp+' '
    print ar.rstrip()

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
int main(){
    long long ans=0;
    long long n;
    cin>>n;
    rep2(i,n){
        if(i%3==0 || i%5==0){
            continue;
        }
        else{
            ans+=i;
        }
    }
    cout<<ans<<endl;
    return 0;

}
/*


*/


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

using namespace std;
#define int long long
#define N 666666
map<int,int> mp;
int f(int num){
	int s=0;
	mp.clear();
	for(int i=1;i<=(int)sqrt(num);i++){
		if(num%i==0){
			if(!mp[i]){
				s++;
			}			
			mp[i]=1;
			if(!mp[num/i]){
				mp[num/i]=1;
				s++;
			}
		}
	}
	
	return s;
}
int F(int num){
	int s=0;
	mp.clear();
	for(int i=2;i<=(int)sqrt(num);i++){
		if(num%i==0){
			if(!mp[i]){
				int t=num;
				while(t%i==0) t/=i;
				if((t-1)%i==0)
					s++;
			}			
			mp[i]=1;
			if(!mp[num/i]){
				mp[num/i]=1;
				
				int t=num;
				while(t%(num/i)==0) t/=(num/i);
				if((t-1)%(num/i)==0)
					s++;
			}
		}
	}return s;
}
signed main(){
	int n;
	cin>>n;
	cout<<f(n-1)+F(n);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    long n=sc.nextLong();
    StringBuilder sb=new StringBuilder();
    while(n>0)
    {
      if(n%26==0)
      {
        sb.append('z');
        n=n/26-1;
      }
      else
      {
        sb.append((char)(n%26+96));
        n/=26;
      }
    }
    System.out.println(sb.reverse());
  }
}

Measured memory_bytes: 35784
#include <iostream>

using namespace std;

int main()
{
    int N, M;
    bool IsPossible[100000];
    int count_ball[100000];
    cin >> N >> M;
    for (int i = 0; i < N; i ++)
    {
        IsPossible[i] = false;
        count_ball[i] = 1;
    }
    IsPossible[0] = true;
    int count_possible = 1;
    int a, b;
    for (int i = 0; i < M; i++)
    {
        cin >> a >> b;
        a--;
        b--;
        count_ball[a]--;
        count_ball[b]++;
        if(IsPossible[a])
        {
            if(!IsPossible[b])
            {
                IsPossible[b] = true;
                count_possible++;
            }
            if(count_ball[a] == 0)
            {
                IsPossible[a] = false;
                count_possible --;
            }
        }
    }
    cout << count_possible << endl;
    return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

typedef pair<int,double> P;

const int MAX_N=1e4;

int N,M;
int x[MAX_N],y[MAX_N];

vector<P> G[MAX_N];

double mincost[MAX_N];
bool used[MAX_N];

double prim(){
	fill(mincost,mincost+N,-1);
	mincost[0]=0;
	double ans=0;
	while(1){
		int v=-1;
		REP(i,N){
			if (!used[i] && (v==-1 || mincost[v]<mincost[i])){
				v=i;
			}
		}
		if (v==-1) break;
		used[v]=true;
		if (mincost[v]!=-1){
			ans+=mincost[v];
		}
		REP(i,G[v].size()){
			P p=G[v][i];
			mincost[p.first]=max(mincost[p.first],p.second);
		}
	}
	return ans;
}

int main(){
	double sum=0;
	scanf("%d %d",&N,&M);
	REP(i,N){
		scanf("%d %d",&x[i],&y[i]);
	}
	REP(i,M){
		int p,q;
		scanf("%d %d",&p,&q);
		p--;
		q--;
		double cost=sqrt((double)(x[p]-x[q])*(x[p]-x[q])+(y[p]-y[q])*(y[p]-y[q]));
		G[p].push_back(P(q,cost));
		G[q].push_back(P(p,cost));
		sum+=cost;
	}
	printf("%.5f\n",sum-prim());
	return 0;
}

Measured memory_bytes: 3056
<?php
$N = intval(trim(fgets(STDIN)));
$A = explode(' ', trim(fgets(STDIN)));
$c1=$c2=$c3=0;
foreach($A as $a){
    if($a == '1')$c1++;
    if($a == '2')$c2++;
    if($a == '3')$c3++;
}
$dp = array_fill(0, $N+1, array_fill(0,$N+1, array_fill(0,$N+1,0)));
for($k = 0; $k <= $c3; ++$k){
    $dpk = &$dp[$k];
    if($k>0)$dpkm = $dp[$k-1];
    for($j = 0, $J = $c2 + $c3 - $k; $j <= $J; ++$j){
        for($i = 0, $I = $c1+$c2+$c3-$k-$j; $i <= $I ; ++$i){
            if($i==0&&$j==0&&$k==0)continue;
            $tmp = $N;
            if($i>0)$tmp+=$i*$dpk[$j][$i-1];
            if($j>0)$tmp+=$j*$dpk[$j-1][$i+1];
            if($k>0)$tmp+=$k*$dpkm[$j+1][$i];
            $dpk[$j][$i] = $tmp/($i+$j+$k);
        }
    }
}
echo $dp[$c3][$c2][$c1];


Measured memory_bytes: 926200
#include <iostream>
using namespace std;
int main()
{
    int n, a;
    cin >> n >> a;
    /*
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    */

    if(n%a==0) cout << n/a << endl;   
    else cout << n/a+1 << endl;   
    return 0;
}

Measured memory_bytes: 256
# ABC084B - Postal Code
def main():
    A, B = tuple(map(int, input().split()))
    S = input().rstrip()
    flg = S[A] == "-" and all(i in "0123456789" for i in S[:A] + S[A + 1 :])
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
  int i, c;
  char S[4], T[4];
  c = 0;
  scanf("%s", S);
  scanf("%s", T);
  for(i = 0;i < 3;i++) if(S[i] == T[i]) c++;
  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int tmp = c-(a-b);
  if(tmp < 0){
    cout << 0 << endl;
    return 0;
  }
  cout << c - (a-b) << endl;
  return 0;
}

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

using namespace std;

const int maxn = 20;
int n;
vector<pair<pair<int, int>, bool>> edge;

int main()
{
    ios::sync_with_stdio(false);
    cin >> n;

    for (int i = 1, m; i <= n; i++)
    {
        cin >> m;

        for (int j = 0, x, y; j < m; j++)
            cin >> x >> y, edge.push_back({{i, x}, y});
    }

    int ans = 0;
    for (int mask = 0; mask < 1 << n; mask++)
    {
        for (auto e : edge)
        {
            auto u = e.first;
            bool type = e.second;

            -- u.first, -- u.second;
            if ((mask >> u.first & 1) && bool(mask >> u.second & 1) != type)
                goto next;
        }

        ans = max(ans, __builtin_popcount(mask));

    next:;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> v(n);
    vector<int>::iterator it;
    for(int i=0;i<n;i++){ cin>>v[i];}
    int q;cin>>q;
    while(q--){
        int a;cin>>a;
        it=lower_bound(v.begin(),v.end(),a);
        cout<<it-v.begin();
        cout<<"\n";
    }

}




Measured memory_bytes: 3096
# Input the amount of money Takahashi paid
N = int(input())

# Check if the price before tax is X, for X = 1, 2, 3, ..., N
ans = -1
for i in range(1, N + 1):
	if int(i * 1.08) == N:
		ans = i

# Print answer
if ans != -1:
	print(ans)
else:
	print(":(")


Measured memory_bytes: 9156
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin>>n>>m;
    vector<int>v(n);
    vector<pair<int,int>>sums;
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    for(int i=0;i<m;i++){
        int b,c;
        cin>>b>>c;
        sums.push_back({c,b});
    }
    int ptr=0;
    sort(v.begin(),v.end());
    sort(sums.rbegin(),sums.rend());
    for(int i=0;i<n;i++){
        if(v[i]>=sums[ptr].first){
            break;
        }
        v[i]=sums[ptr].first;
        sums[ptr].second--;
        if(sums[ptr].second==0){
            ptr++;
        }
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum+=v[i];
    }
    cout<<sum<<endl;
    
    return 0;
    
}



Measured memory_bytes: 3188
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

struct Food
{
	int a,b;
	Food(){}
};

signed main() {
	int n,t;
	std::cin >> n >> t;
	std::vector<Food> f(n);
	rep(i,n) {
		int a,b;
		std::cin >> a >> b;
		f[i].a = a; f[i].b = b;
	}
	std::vector<std::vector<int> > dp1(n+1,std::vector<int>(t,0));
	for(int i=1;i<=n;i++) {
		if(i==0) continue;
		for(int x = t-1;x>=0;x--) {
			if(x-f[i-1].a>=0) dp1[i][x] = std::max(dp1[i-1][x-f[i-1].a]+f[i-1].b, dp1[i-1][x]);
			else dp1[i][x] = dp1[i-1][x];
		}
	}
	debug(dp1);
	std::vector<std::vector<int> > dp2(n+1,std::vector<int>(t,0));
	for(int i=n-1;i>=0;i--) {
		for(int x = t-1;x>=0;x--) {
			if(x-f[i].a>=0) dp2[i][x] = std::max(dp2[i+1][x-f[i].a]+f[i].b, dp2[i+1][x]);
			else dp2[i][x] = dp2[i+1][x];
		}
	}
	debug(dp2);
	int max = 0;
	for(int i=1;i<=n;i++) {
		int m = 0;
		rep(j,t) {
			m = std::max(m, dp1[i-1][j] + dp2[i][t-1-j]);
		}
		max = std::max(max,m+f[i-1].b);
		debug(max,m);
	}
	print(max);

	return 0;
}


Measured memory_bytes: 141184
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int M = in.nextInt();
            long[] x = new long[N];
            long[] y = new long[N];
            long[] z = new long[N];
            for (int i = 0; i < N; i++) {
                x[i] = in.nextLong();
                y[i] = in.nextLong();
                z[i] = in.nextLong();
            }

            long[] sum = new long[N];
            long max = 0;
            for (int dx = -1; dx <= 1; dx += 2) {
                for (int dy = -1; dy <= 1; dy += 2) {
                    for (int dz = -1; dz <= 1; dz += 2) {
                        for (int i = 0; i < N; i++) {
                            sum[i] = dx * x[i] + dy * y[i] + dz * z[i];
                        }
                        Arrays.sort(sum);
                        long s = 0;
                        for (int i = 0; i < M; i++) {
                            s += sum[N - 1 - i];
                        }
                        max = Math.max(max, s);
                    }
                }
            }

            System.out.println(max);
        }
    }
}


Measured memory_bytes: 27200
#include<stdio.h>
int main()
{
  int a,b,i,j;
  while(1)
	   {
  scanf("%d%d",&a,&b);
  if(a == 0 && b == 0){
      break;
      
  }

  for(i=1;i<=a;i++)
    {
      for(j=1;j<=b;j++)
	{
	  if(i > 1 && i < a && j < b && j > 1)
	  printf(".");
	  else 
	  printf("#");
	}
      printf("\n");
    }
  printf("\n");
    
	   }
  return 0;
}


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

long long gcd(long long x, long long y){
    while(y){
        long long tmp = x%y;
        x = y;
        y = tmp;
    }
    return x;
}

int main(){
    int n;
    long long t,lcm=1;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>t;
        lcm = lcm/gcd(lcm,t)*t;
    }
    cout<<lcm<<endl;
}

Measured memory_bytes: 256
X, N = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
ans = X
for i in range(100):
    if X-i not in p:
        ans = X-i
        break
    elif X+i not in p:
        ans = X+i
        break
    
    
print(ans) 

Measured memory_bytes: 9120
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u32 = itr.next().unwrap().parse().unwrap();
    let m: u32 = itr.next().unwrap().parse().unwrap();

    let s = m * 1900 + (n - m) * 100;
    println!("{}", s * 2u32.pow(m));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
//CLOCKS_PER_SEC
#define se second
#define fi first
#define ll long long
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define Pii pair<int,int>
#define Pli pair<ll,int>
#define ull unsigned long long
#define pb push_back
#define fio ios::sync_with_stdio(false);cin.tie(0)
const double Pi=3.14159265;
const int N=1e4+5;
const ull base=163;
const int INF=0x3f3f3f3f;
using namespace std;
int path[600][600];
int ans[600][600];
bool vis[600][600];
int n,m,q;
int dfs(int l,int r){

    if(l>r)return 0;
    if(vis[l][r])return ans[l][r];
    vis[l][r]=1;
    return ans[l][r]+=dfs(l+1,r)+dfs(l,r-1)-dfs(l+1,r-1);
}
int main(){
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1,u,v;i<=m;++i){
        scanf("%d%d",&u,&v);
        ans[u][v]++;
    }
    dfs(1,n);
    for(int i=1,u,v;i<=q;++i){
        scanf("%d%d",&u,&v);
        printf("%d\n",ans[u][v]);
    }
    return 0;
}


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

#[fastout]
fn main() {
    input! {
        n: usize,
        height: [usize; n],
    }

    let res = solve(&height);
    println!("{}", res);
}

fn solve(hei: &[usize]) -> usize {
    let mut res = 0;
    let mut c = 0;
    let mut old = 0;
    for &h in hei {
        if h <= old {
            c += 1;
        } else {
            res = std::cmp::max(res, c);
            c = 0;
        }
        old = h;
    }
    res = std::cmp::max(res, c);
    res
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  string S;
  cin>>S;
  int c=0;
  rep(i,S.size()) if(S[i]=='o') c++;
  if(15-S.size()+c>=8) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

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

namespace _0251
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] nm = RArInt();
                if (nm.Sum() == 0) break;
                UnionFind uf = new UnionFind(nm[0]);
                Console.WriteLine(CanDraw(uf, nm) ? "yes" : "no");
            }

        }

        private static bool CanDraw(UnionFind uf, int[] nm)
        {
            bool res = true;
            int[] degree = new int[nm[0]];
            for (int i = 0; i < nm[1]; i++)
            {
                int[] vs = RArInt();

                if (res)
                {
                    int u = vs[0] - 1;
                    int v = vs[1] - 1;

                    if (uf.IsSameGroup(u, v)) res = false;
                    degree[u]++;
                    degree[v]++;
                    if (degree[u] >= 3 || degree[v] >= 3) res = false;
                    uf.Unite(u, v);
                }
            }
            return res;
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

    class UnionFind
    {
        private readonly int[] parents;
        private readonly int[] rank;

        public UnionFind(int n)
        {
            parents = new int[n];
            rank = new int[n];
            for (int i = 0; i < n; i++) parents[i] = i;
        }

        public int Find(int x)
        {
            if (parents[x] == x) return x;
            else return parents[x] = Find(parents[x]);
        }

        public void Unite(int x, int y)
        {
            x = Find(x);
            y = Find(y);
            if (x == y) return;

            if (rank[x] < rank[y])
            {
                parents[x] = y;
            }
            else
            {
                parents[y] = x;
                if (rank[x] == rank[y]) rank[x]++;
            }
        }

        public bool IsSameGroup(int x, int y)
        {
            return Find(x) == Find(y);
        }
    }
}



Measured memory_bytes: 21060
#include <iostream>
#include <utility>
#include <stdint.h>
#include <vector>
#include <algorithm>

using namespace std;

#define R 2000

int main()
{
  int64_t X;
  cin >> X;

  vector<int64_t> A5(2*R,0);

  for (int64_t a = -R; a<R; ++a) {
    A5[a+R] = a*a*a*a*a;
  }

  for (int64_t a = -R; a<R; ++a) {
    int64_t a5 = A5[a+R];
    int64_t b5 = a5-X;

    auto itr = lower_bound(A5.begin(), A5.end(), b5);

    if (itr == A5.end())
      continue;

    if (*itr != b5) {
      //cerr << a << ":" << b5 << "!=" << *itr << endl;
      continue;
    }
    
    int64_t b = distance(A5.begin(), itr)-R;

    //cerr << a << ":" << b5 << "==" << *itr << " b:" << b << endl;

    if (A5[a+R]-A5[b+R]!=X)
      continue;

    //cerr << A5[a+R] << " " << A5[b] << " " << A5[a] - A5[b] << endl;

    cout << a << ' ' << b << endl;
    break;
  }

  return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
int main(){
  int a,b,c;
  scanf("%d %d %d", &a, &b ,&c);
  int num = (a * b);
  for(int i = a;i<= num;i  += a){
    
    if(i % b == c){
      printf("YES");
      goto end;
    }
  
  }
  printf("NO");
  end:
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
using namespace std;

int main(){
  int a,b;
  char op;
  cin >> a >> op >> b;
  while(op!='?'){
    int c;
    if(op=='+') c=a+b;
    if(op=='-') c=a-b;
    if(op=='*') c=a*b;
    if(op=='/') c=a/b;
    cout << c << endl;
    cin >> a >> op >> b;
  }
  return 0;
}



Measured memory_bytes: 3092
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	int a[3];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	if(a[0]+a[1]==a[2])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main() {
	ll n;
	cin >> n;
	ll a[n];
	ll m[n+1];
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	m[0] = 0;
	for(int i=0; i<n; i++){
		if(i%2) m[0]-=a[i];
		else m[0]+=a[i];
	}
	for(int i=0; i<n; i++){
		m[i+1] = 2*a[i]-m[i];	
		cout << m[i] << " ";
	}
	return 0;
}

Measured memory_bytes: 2816
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
  static InputReader in;
  static PrintWriter out;

  static class Solution {
    void solve() throws IOException {
       double r = in.nextDouble();        
       out.printf("%.5f %.5f", r*r*Math.PI, 2*r*Math.PI);
  }
}
    
  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }

    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }

    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken());
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }

    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }

  }

}

Measured memory_bytes: 24856
while True:
    n, l, r = map(int, input().split())
    if n == 0: break
    A = [int(input()) for i in range(n)][::-1]
    y = [0]*(r+1)
    v = 2 - (n&1)   # v = 1 if n is odd
    for a in A:
        for i in range(a, r+1, a): y[i] = v
        v = 3-v
    ans = k = 0
    for i in range(l, r+1):
        if y[i] == 0: k += 1
        elif y[i] == 1: ans += 1
    if n & 1 == 0: ans += k
    print(ans)


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

int main() {
    int N;
    cin >> N;
    int Vetor[N];

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

    sort(Vetor, Vetor+N);

    cout << Vetor[N-1] - Vetor[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <functional>

using namespace std;

int d[105];

int main(void)
{
	int n, a, b, c;
	int i, cal;
	
	scanf("%d", &n);
	scanf("%d %d", &a, &b);
	scanf("%d", &c);
	
	cal = c / a;
	
	for (i = 0; i < n; i++){
		scanf("%d", &d[i]);
	}
	
	sort(d, d + n, greater<int>());
	
	for (i = 0; i < n; i++){
		if (cal * (a + b) < c + d[i]){
			c += d[i];
			a += b;
			cal = c / a;
		}
		else {
			break;
		}
	}
	
	printf("%d\n", cal);
	
	return (0);
}

Measured memory_bytes: 1040
#include <stdio.h>
int digsum(int n) {
	int r = 0;
	while (n > 0) {
		r += n % 10;
		n /= 10;
	}
	return r;
}
int main() {
	int n, min = 1e9, sum;
	scanf("%d", &n);
	for (int a = 1; a <= n / 2; a++) {
		int b = n - a;
		sum = digsum(a) + digsum(b);
		if (min > sum) {
			min = sum;
		}
	}
	printf("%d\n", min);
	return 0;
}

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

int main(){
	int n,i,j,k,s;
	
	cin>>s>>n;
	
	for(i=0;i<=n/10000;i++)
	  for(j=0;j<=n/5000;j++)
	  {
	  	k=s-i-j;
	  	if(k>=0)
	  	if(i*10000+j*5000+k*1000==n){
	  		cout<<i<<" "<<j<<" "<<k;
	  		return 0;
	  	}
	  }
	  cout<<"-1 -1 -1"<<endl;
	  
	  return 0;
}

Measured memory_bytes: 256
def main():
    from collections import Counter
    n, k, *a = map(int, open(0).read().split())
    b = Counter(a)
    l = len(b)
    if l <= k:
        ans = 0
    else:
        cnt = list(b.values())
        cnt.sort()
        ans = sum(cnt[:(l-k)])
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 33556
import kotlin.math.abs

fun main(args: Array<String>) {
    val line = readLine()!!.trim()
    val (x: Int, n: Int) = line.split(" ").map {it.toInt()}
    val ps: List<Int> = if (n > 0) {
        val line2 = readLine()!!.trim()
        line2.split(" ").map {it.toInt()}.take(n)
    } else {
        listOf()
    }

    val pset = ps.toSet()
    var result: Int = 500
    var min: Int = 500
    for (j in (-101..201)) {
        if (!pset.contains(j)) {
            if (abs(x - j) < min) {
                result = j
                min = abs(x - j)
            }
        }
    }

    println("${result}")
}


Measured memory_bytes: 36804
#include <iostream>
#include <string>
#include <algorithm>
#include <utility> 
#include <unordered_set>
#include <vector>
#include <list> 
#include <string>
#include <iterator> 
#include <deque>
#include <array>
#include <forward_list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <bitset>
#include <numeric>
using namespace std;


const long double PI = 3.14159265358979323846264338327950;
const int N = 2 * 1e5;


template <class T>
T gcd(T a, T b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

long long arr[N], L[N], R[N];

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

	int k, n;
	long long ans;

	cin >> k >> n;
	
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	L[0] = k - arr[n - 1] + arr[0];
	for (int i = 1; i < n; ++i)
		L[i] = arr[i] - arr[i - 1] + L[i -1];
	for (int i = n - 2; i >= 0; --i)
		R[i] = R[i + 1] + arr[i + 1] - arr[i];

	ans = LLONG_MAX;
	for (int i = 0; i < n - 1; ++i) {
		ans = min(ans, min(L[i] + R[i + 1], L[i] + R[i] - L[0]));
	}

	cout << ans << '\n';
}


Measured memory_bytes: 8320
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>

using namespace std;


void solve() {
    int N, K; cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    for (int i = 0; i < K; i++) {
        vector<int> imos(N+1);
        for (int j = 0; j < N; j++) {
            int l = max(0, j - A[j]);
            int r = min(N, j + A[j] + 1);
            imos[l]++; imos[r]--;
        }

        vector<int> sum(N);
        sum[0] = imos[0];
        for (int j = 1; j < N; j++) sum[j] = sum[j-1] + imos[j];

        if (A == sum) break;

        A = sum;
    }

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


int main() {
    solve();
    return 0;
}

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

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


Measured memory_bytes: 3156
a = gets.to_i
b = gets
c = []
b.split.each{|num|
    c << num.to_i
}
d = c.sort {|a, b| b <=> a }
sum = 0
for i in 0...a do
    if i%2 == 0 then
        sum += d[i]
    else
        sum -= d[i]
    end
end
print sum

Measured memory_bytes: 1788