akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
 #include<string.h>
 
int main(void)
{
 
  int i, j;
 
  /* 文字列の数 */
  int num;
  int length; 
  scanf("%d %d",&num,&length);


  /* 文字列 */
  char moji[101][101], tmp[101];
 
  /* 3つの文字列を入力 */
  for (i=0;i<num;i++) {
    scanf("%s", moji[i]);
  }
 
  for(i=1;i<num;i++){
    for(j=1;j<num;j++){
      if(strcmp(moji[j-1], moji[j])>0){
        strcpy(tmp, moji[j-1]);
        strcpy(moji[j-1], moji[j]);
        strcpy(moji[j], tmp);
      }
    }
  }
  for (i=0;i<num;i++)
    printf("%s", moji[i]);
 
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

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

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

using namespace std;

int main() {
    int N; cin >> N;
    vector<int> d(N);
    rep (i, N) {
        cin >> d[i];
    }

    vector<int> sums(N+1, 0);
    rep (i, N) {
        sums[i+1] = sums[i] + d[i];
    }

    int ans = 0;
    rep (i, N) {
        ans += d[i]*(sums[N] - sums[i+1]);
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define pb push_back
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MAXN = 100100, MAXK = 25;
const ll MOD = 1e9+7;

ll dp[MAXN];
ll h[MAXN];

int main()
{
    FAST_IO;

    int n; cin >> n;
    FOR(i, 1, n) cin >> h[i];

    dp[2] = abs(h[2]-h[1]);
    FOR(i, 3, n)
        dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]), dp[i-1] + abs(h[i-1] - h[i]));

    cout << dp[n] << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n,d,a[100][100],ans;
int32_t main(){
CODE_START;
cin>>n;
cin>>d;
for(ll i=0;i<n;i++)
    for(ll j=0;j<d;j++)
    cin>>a[i][j];
for(ll i=1;i<n;i++)
    for(ll j=0;j<i;j++)
if(i!=j){
    ll s=0;
    for(ll c=0;c<d;c++)
        s=s+(a[i][c]-a[j][c])*(a[i][c]-a[j][c]);
    ll x=sqrt(s);
    if(x*x==s){
        ans++;
    }
}
cout<<ans<<endl;
}



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

int main() {
    string s,t;
    cin >> s >> t;
    int res = 0;
    rep(i,s.size()){
        if(s[i]!=t[i]) ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 3900
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL N;

int main(){
	cin>>N;
	if(N%2==1){
		cout<<0<<endl;
	}else{
		N/=2;
		LL ans=0;
		LL temp=10;
		/*while(temp<=N){
			ans+=N/temp;
			temp*=10;
		}*/
		temp=5;
		while(temp<=N){
			ans+=N/temp;
			temp*=5;
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

#define INF 1e18
#define MOD 1000000007
//#define DEBUG

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::default_random_engine e(seed);
std::mt19937 rng((int) seed);

ll qtd[10000010];

void solvetask() {
    for(ll i = 1; i <= 10000000; i++) {
        for(ll j = i; j <= 10000000; j+=i) {
            qtd[j]++;
        }
    }
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i <= n; i++) {
        ans += i * qtd[i];
    }
    cout << ans << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);

    int t = 1;

    while(t--) solvetask();
}


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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const int mx = 710000;

int x, y;
ll fac[mx], finv[mx],inv[mx];

void COMinit(){
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < mx; 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;
	}
}
ll COM(int n, int k){
	if(n < k)return 0;
	if(n < 0 || k < 0)return 0;
	// cout << fac[n] <<" " << finv[k] <<" " << finv[n-k] << endl;
	return fac[n] * (finv[k] * finv[n-k] % mod) %mod;
}

int main(){
	cin >> x >> y;
	if((x+y)%3!=0){
		cout << 0 << endl;
		return 0;
	}
	
	int n = (2 * x - y)/3;
	int m = (2 * y - x)/3;
	if(n < 0 or m < 0){
		cout << 0 << endl;
		return 0;
	}
	// cout << m << " " << n  << endl;
	COMinit();
	// cout << m+n << " " << n << endl;
	cout << COM(n+m,n) << endl;
}


Measured memory_bytes: 16896
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve();
	}

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] s = sc.next().toCharArray();
		int[] a = new int[n];
		int[] sz = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = s[i] - '0';
		}
		for (int i = 0; i < n; ++i) {
			if (a[i] == 1) {
				sz[i] = (i > 0 ? sz[i - 1] : 0) + a[i];
			}
		}

		int[] dp = new int[n];
		for (int i = 2; i < n; ++i) {
			dp[i] = dp[i - 1];
			if (a[i] == 0)
				continue;
			if (a[i - 1] == 0 && a[i - 2] == 1) {
				for (int d = 0; d < 3 && sz[i - 2] - d > 0; ++d) {
					dp[i] = Math.max(dp[i],
							(sz[i - 2] - d) + (i - 2 - (sz[i - 2] - d) >= 0 ? dp[i - 2 - (sz[i - 2] - d)] : 0));
				}
			}
			if (i - sz[i] - 1 >= 0 && a[i - sz[i] - 1] == 1) {
				dp[i] = Math.max(dp[i], sz[i] + (i - 2 - sz[i] >= 0 ? dp[i - sz[i] - 2] : 0));
			}
		}
		System.out.println(dp[n - 1]);
	}

}


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

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}

signed main() 
{
  int a,b,c; cin>>a>>b>>c;
  if(a==b&&b==c) print(1);
  else if(a==b||b==c||c==a) print(2);
  else print(3);

  return 0;
}

Measured memory_bytes: 256
/*
 _____ _             _              _           _ 
|_   _| |__   ___   / \   _ __  ___| |__  _   _| |
  | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  | | | | | |  __// ___ \| | | \__ \ | | | |_| | |
  |_| |_| |_|\___/_/   \_\_| |_|___/_| |_|\__,_|_|                                                

*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll,ll>
#define msi         map<string,ll>
#define mis         map<ll, string>
#define rep(i,a,b)    for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)
#define trav(a, x) 	for(auto& a : x)
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pair<ll, ll>>
#define vs          vector<string>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define max(a,b)	(a>b?a:b)
#define min(a,b)	(a<b?a:b)

/*	For Debugging	*/
#define DEBUG 		cerr<<"\n>>>I'm Here<<<\n"<<endl;
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
#define what_is(x)  cerr << #x << " is " << x << endl;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace __gnu_pbds;
using namespace std;
#define PI 3.141592653589793
#define N  100005

void solve()
{
	ll n,m;
	cin>>n>>m;
	vi v(n);
	ll sum=0;
	rep(i,0,n)
	{
		cin>>v[i];
		sum+=v[i];
	}
	ll ans=0;
	rep(i,0,n)
	{
		if(v[i]*4*m>=sum)
			ans++;
	}
	if(ans>=m)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return;
}
int main()
{
	FAST
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		solve();
	}
	TIME
	return 0;
}

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

N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

from itertools import accumulate
import bisect

SA=[0]+list(accumulate(A))
SB=[0]+list(accumulate(B))

ANS=0
for i in range(N+1):
    if K-SA[i]<0:
        break
    x=bisect.bisect_right(SB,K-SA[i])
    ANS=max(ANS,i+x-1)
print(ANS)


Measured memory_bytes: 50712
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n),b(n);
  for(Int i=0;i<n;i++) cin>>a[i]>>b[i];
  using P = pair<Int, Int>;
  vector<P> v;
  for(Int i=0;i<n;i++) v.emplace_back(a[i],i);
  for(Int i=0;i<n;i++) v.emplace_back(b[i],n+i);
  sort(v.begin(),v.end());

  Int sum=0;
  vector<Int> used(n*2,0);
  for(Int i=0;i<n;i++){
    sum+=v[i].first;
    used[v[i].second]=1;
  }
  
  for(Int k=0;k<=n;k+=n){
    Int flg=1;
    for(Int i=0;i<n;i++) flg&=used[k+i];
    if(flg){
      cout<<sum<<endl;
      return 0;
    }
  }

  for(Int i=0;i<n;i++){
    if(used[i]&&used[n+i]){
      cout<<sum<<endl;
      return 0;
    }
  }
  
  Int ans=sum+v[n].first;
  for(Int i=0;i<n;i++){
    Int res=sum-v[i].first;
    res+=v[n+((v[i].second%n)==(v[n].second%n))].first;
    chmin(ans,res);
  }
  cout<<ans<<endl;
  return 0;
}


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


int dp__[100];

//最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x % y);
}
//最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp__[n] = 1;
  if(dp__[n] != -1) return dp__[n];
  return dp__[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(int x, int y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}


int main(){
  int n, m;
  cin >> n >> m;
  int lmax = -1;
  int rmin = 1e9;
  rep(i, m){
    int l, r;
    cin >> l >> r;
    lmax = max(lmax, l);
    rmin = min(rmin, r);
  }
  int ans = rmin - lmax + 1;
  cout << max(ans, 0) << endl;
}




Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

int main(){
	int a,b,c,x;
	int ans = 0;
	cin >> a >> b >> c >> x;
	rep(i,a+1){
		rep(k,b+1){
			rep(j,c+1){
				if(x == i*500+k*100+j*50) ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 764
'use strict'
function main(input) {
  input = input.trim().split(' ')
  const start = Math.min(Number(input[0]), Number(input[1]))
  const goal = Math.max(Number(input[0]), Number(input[1]))
  const result = start < Number(input[2]) && Number(input[2]) < goal
  console.log(result ? 'Yes' : 'No')
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 21064
use std::io::*;
use std::str::FromStr;
use std::collections::VecDeque;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn solve(seq: &Vec<i32>, k: usize, q: usize, min_value: i32, max_value: i32) -> bool {
    let n = seq.len();
    let mut que = VecDeque::<usize>::new();
    let mut use_flags = vec![false; n];
    let mut l = 0;
    let mut cnt = 0;
    let mut small_value = 0;
    let mut large_value = 0;
    let mut ans = 0;
    for i in 0..n {
        cnt += 1;
        if seq[i] < min_value {
            small_value += 1;
        } else if max_value < seq[i] {
            large_value += 1;
        } else {
            que.push_back(i);
        }
        while cnt > k {
            let v = seq[l];
            if v < min_value {
                small_value -= 1;
                cnt -= 1;
            } else if max_value < v {
                large_value -= 1;
                cnt -= 1;
            } else if !use_flags[l] {
                que.pop_front();
                cnt -= 1;
            }
            l += 1;
        }
        if cnt == k && small_value == 0 && large_value != k {
            let index = que.pop_front().unwrap();
            use_flags[index] = true;
            cnt -= 1;
            ans += 1;
            if ans == q {
                return true;
            }
        }
    }
    return false;
}

fn main() {
    let n = read::<usize>();
    let k = read::<usize>();
    let q = read::<usize>();
    let mut seq = vec![0; n];
    for i in 0..n {
        seq[i] = read::<i32>();
    }
    let mut sort_seq = seq.clone();
    sort_seq.sort();
    let mut best_values = vec![1e+9 as i32; n];
    for i in 0..n {
        if i + q - 1 < n {
            best_values[i] = sort_seq[i + q - 1] - sort_seq[i];
        }
    }
    let mut ans = sort_seq[n - 1] - sort_seq[0];
    for i in 0..n {
        if i != 0 && sort_seq[i - 1] == sort_seq[i] {
            continue;
        }
        let min_value = sort_seq[i];
        let mut left = best_values[i] - 1;
        let mut right = ans;
        while right - left > 1 {
            let mid = (left + right) / 2;
            if solve(&seq, k, q, min_value, min_value + mid) {
                right = mid;
            } else {
                left = mid;
            }
        }
        ans = right;
    }
    println!("{}", ans);
}


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

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define FOR(i, a, b) for(int i = a;i < b;++i)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999
using namespace std;
#define lint long long

int main(){
  lint n,k,q; cin >> n >> k >> q;
  string s;
  vector<lint> a(q);
  REP(i,q){
   cin >> a[i]; 
  }
  vector<lint> score(n,0);
  REP(i,q){
    ++score[a[i]-1];
  }
  
  REP(i,n){
    if(score[i] > q-k || q-k < 0) cout << "Yes" << "\n"; 
    else cout << "No" << "\n";
  }
}




Measured memory_bytes: 2176
M=10**9+7
n,k=map(int,input().split())
l=[0]*(k+1)
a=0
for i in range(k,0,-1):
  l[i]=pow(k//i,n,M)
  for j in range(i*2,k+1,i):
    l[i]-=l[j]
  a+=i*l[i]
print(a%M)

Measured memory_bytes: 68868
#include<bits/stdc++.h>
using namespace std;
#define very_slow       ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vec             vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define inf             1e18
#define MAX             1e9
#define MIN            -1e9
#define no_of_test(x)        int x; cin>>x; while(x--)
//Actual Code Is At The Top
const int mod = 1e9 + 7;
int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
int binary_exponentation(int a, int b)
{
	int ret = 1;
	while (b)
	{
		if (b & 1) ret = (ret * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ret;
}
const int N=1e6+5;
int a[N];
int32_t main()
{   
	very_slow
//	no_of_test(x)
	{  
        int k,n,d=-1;
        cin>>k>>n;
        for(int i=1;i<=n;i++)  cin>>a[i];
        for(int i=1;i<=n;i++)
        {
            int temp;
            if(i==1)
            temp=(k-a[n])+a[1];
            else
            {
                temp=a[i]-a[i-1];
            }
            d=max(d,temp);   
        }
        cout<<k-d<<'\n';
	}
	return 0;
}

Measured memory_bytes: 5188
import java.io.*;
import java.util.*;
public class Main {
static PrintWriter pw =new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) {
	// write your code here
        MyScanner mc = new MyScanner();
        boolean game= false;
        int K = mc.nextInt(); int A = mc.nextInt(); int B = mc.nextInt();
        int count =0;
        while (count<=1000){
            if (count>=A&&count<=B){
                game = true;
            }
            count+=K;
        }
        if (count>=A&&count<=B){
            game = true;
        }
        pw.println(game?"OK":"NG");
        pw.flush();
    }

public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;

      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }

      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt() {
          return Integer.parseInt(next());
      }

      long nextLong() {
          return Long.parseLong(next());
      }

      double nextDouble() {
          return Double.parseDouble(next());
      }

      String nextLine(){
          String str = "";
	  try {
	     str = br.readLine();
	  } catch (IOException e) {
	     e.printStackTrace();
	  }
	  return str;
      }

   }

}


Measured memory_bytes: 32696
#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

int32_t main(){
	IOS;
	int n, m, k;
	cin >> n >> m >> k;
	int ns[n+1], ms[m+1];
	ns[0] = ms[0] = 0;
	for(int i = 1; i <= n; i++)
		cin >> ns[i];
	for(int i = 1; i <= m; i++)
		cin >> ms[i];

	for(int i = 1; i <= n; i++)
		ns[i] += ns[i-1];

	for(int i = 1; i <= m; i++)
		ms[i] += ms[i-1];

	int mx = 0, mi = m, ni = 0;
	while( mi >= 0 ){
		int lf = k - ms[mi];
		if( lf >= 0 ){
			while( ni <= n && ns[ni] <= lf )
				ni++;
			mx = max(mx, mi + ni - 1);
		}
		mi--;
	}

	cout << mx << endl;
	return 0;
}

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

namespace ABC089B {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');
            bool ok = false;
            for(int i = 0; i < N; i++) {
                if(input[i] == "Y") {
                    ok = true;
                }
            }
            if (ok) {
                Console.WriteLine("Four");
            } else {
                Console.WriteLine("Three");
            }
        }
    }
}

Measured memory_bytes: 11092
import sys
from collections import deque

input = sys.stdin.readline

N, M = map(int, input().split())
T = [[] for _ in range(N)]
for _ in range(M):
    l, r, d = map(int, input().split())
    T[l - 1].append((r - 1, d))
    T[r - 1].append((l - 1, -d))

Nvisited = set(range(N))
pos = dict()


def dfs(v):
    D = deque()
    D.append(v)
    pos[v] = 0
    while D:
        x = D.pop()
        for y, d in T[x]:
            if y in Nvisited:
                pos[y] = pos[x] + d
                Nvisited.remove(y)
                D.append(y)
            elif pos[y] - pos[x] != d:
                print('No')
                sys.exit()


while Nvisited:
    dfs(Nvisited.pop())

print('Yes')


Measured memory_bytes: 81684
n,d = map(int,input().split())
lis = [list(map(int,input().split())) for _ in range(n)]
ans = 0

for i in range(n-1):
    
    for j in range(i,n-1):
        x = 0
        for k in range(d):
            x += (lis[i][k]-lis[j+1][k])**2
        
        if x**0.5 % 1 == 0:
            ans += 1
print(ans)

Measured memory_bytes: 3188
import java.io.*;

import java.util.*;

import java.math.*;



class Main{

	public static void calc_weight(int tw){
		int w=0;
		ArrayList <Integer> out = new ArrayList<Integer>();

		for(int i=9;i>=0;i--){
			if(tw < Math.pow(2,i))continue;
			if(tw-w-Math.pow(2,i) >= 0){
				w += Math.pow(2,i);
				out.add(0,(int)Math.pow(2,i));
			}
			if(tw-w == 0)break;
		}
		for(int i=0;i<out.size();i++){
			if(i != out.size()-1)System.out.print(out.get(i) + " ");
			else System.out.println(out.get(i));
		}
	}

	


	public static void weight(ArrayList<Integer> list){
		for(int i=0;i<list.size();i++){
			calc_weight(list.get(i));	
		}
	}

		

	public static void main(String args[]) throws IOException{

		String str;

		ArrayList <Integer> inp = new ArrayList<Integer>();



		Scanner scan = new Scanner(System.in);

		

		while(scan.hasNext()){

			

			str = scan.next();

			int x = Integer.valueOf(str).intValue();

			inp.add(x);

		}

		weight(inp);

	}

}

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

#define sc(x) scanf("%d",&x);
#define rep(x ,n) for(int x=0; x<n; x++)
#define ll long long
#define finish(x) return cout << x << endl,0;
#define scarr(a,n) for(int x=0; x<n; x++)scanf("%d",&a[x]);

bool isMonth(int x){
    return (1 <= x && x <= 12);
}
int main()
{
    string s;
    cin >> s;
    int mm = (s[0]-'0')*10 + (s[1]-'0');
    int yy = (s[2]-'0')*10 + (s[3]-'0');

    if(isMonth(mm) && isMonth(yy))
        cout << "AMBIGUOUS" << endl;
    else if(!isMonth(mm) && !isMonth(yy))
        cout << "NA" << endl;
    else if(mm < yy){
        if(mm != 0)
            cout << "MMYY" << endl;
        else
            cout << "YYMM" << endl;
    }
    else if(yy < mm){
        if(yy != 0)
            cout << "YYMM" << endl;
        else
            cout << "MMYY" << endl;
    }

}

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

int main(void) {
    std::string s;
    std::cin >> s;
    int ans;
    for (ans = s.length() - 2; ans > 2 && s.substr(0, ans / 2) != s.substr(ans / 2, ans / 2); ans -= 2);
    printf("%d\n", ans);     
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a[55],b[55],c[55],d[55],n,m,q,ans1,ans,dl[15];
int dg(int tms,int lst)
{
	ans1=0;
	if(tms==n)
	{
		for(int i=0;i<q;i++)
		{
			if(dl[b[i]-1]-dl[a[i]-1]==c[i])
			ans1+=d[i];
		}
		ans=max(ans,ans1);
		return 0;
	}
	for(int i=lst;i<=m;i++)
	{
		dl[tms]=i;
		dg(tms+1,i);
		dl[tms]=0;
	}
	return 0;
}
int main()
{
	cin>>n>>m>>q;
	for(int i=0;i<q;i++)
	cin>>a[i]>>b[i]>>c[i]>>d[i];
	dg(0,1);
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#define MAX 100000
#define INF 2e18

using namespace std;

long long dp[MAX + 5];

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

    long long n, g;

    cin >> n >> g;

    for(int i = 1; i <= MAX; i++)dp[i] = INF;

    for(long long i = 0; i < n; i++)
    {
        long long w, v;

        cin >> w >> v;

        for(long long i = MAX - v; i >= 0; i--)
            dp[i + v] = min(dp[i + v], dp[i] + w);
    }

    for(int i = MAX; i > 0; i--)
        if(dp[i] <= g)
        {
            cout << i;

            i = 0;
        }

    return 0;
}


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

int main(){
    string s;
    cin>>s;
    rep(i,s.size()-1){
        if(s[i]=='A'&&s[i+1]=='C'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
 
int main(){
    int H, W;
    cin >> H >> W;
    
    vector< vector<char> > field ;
    field.resize(H) ;
    for( int index = 0; index < H; index++ ) {
        field[index].resize(W) ;
    }

    for(int row = 0; row < H; row++) {
        for(int col = 0; col < W; col++) {
            cin >> field[row][col] ;
        }
    }

    for(int row = 0; row < H; row++) {
        for(int col = 0; col < W; col++) {
            if( field[row][col] == '#' ) {
                if( row != 0   && field[row-1][col] == '#' ) continue ;
                if( row != H-1 && field[row+1][col] == '#' ) continue ;
                if( col != 0   && field[row][col-1] == '#' ) continue ;
                if( col != W-1 && field[row][col+1] == '#' ) continue ;
                cout << "No" << endl;
                return 0 ;
            }
        }
    }

    cout << "Yes" << endl ; 
    return 0;
}


Measured memory_bytes: 256
a=input()
# print(a)
# print(type(a))
if a[0]=="1":
    b=1
else:
    b=0
# print(b)
if a[1]=="1":
    c=1
else:
    c=0

if a[2]=="1":
    d=1
else:
    d=0

print(b+c+d)

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

#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ll long long
#define ld long double
#define pb push_back
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define LDMX LDBL_MAX
#define LDMN LDBL_MIN
#define MAX 1000000
#define pll pair<ll, ll>
#define vl vector<ll>
#define vll vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >    

using namespace std;   


        
int main()
 {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t,n,x;
	cin>>n>>x>>t;
	if(n%x==0) cout<<n/x * t<<endl;
  	else cout<<(n/x + 1)*t<<endl;
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);

    int n,k;
    cin >> n >> k;

    vector<int> a(k);
    rep(i,k) cin >> a[i];
    sort(a.begin(),a.end());

    for(int i = n;; i++){
        int x = i;
        bool flag = true;
        while(x){
            int d = x % 10;
            if(binary_search(a.begin(),a.end(),d)){
                flag = false;
                break;
            }
            x /= 10;
        }
        if(flag){
            cout << i << endl;
            break;
        }
    }
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

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

    vector<int> cnt(n+1, 1);
    vector<bool> isRed(n+1, false);
    isRed[1] = true;

    for(int i=0; i<m; ++i){
        int x, y;
        cin >> x >> y;

        -- cnt[x];
        ++ cnt[y];
        if(isRed[x]){
            isRed[y] = true;
            if(cnt[x] == 0)
                isRed[x] = false;
        }
    }

    int ans = 0;
    for(int i=1; i<=n; ++i){
        if(isRed[i])
            ++ ans;
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> p(n);
  for (auto &&i : p)
  {
    cin >> i;
  }
  int ans = 0;
  for (int i = 1; i < n - 1; i++)
  {
    if (p[i-1] < p[i] && p[i] <= p[i + 1])ans++;
    if (p[i+1] < p[i] && p[i] <= p[i - 1])ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
    Washief Hossain Mugdho
    21 September 2020
    Educational DP Grouping
*/

#ifndef DEBUG
#pragma GCC optimize("O3")
#endif

#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define ms(a, b) memset(a, b, sizeof a)
#define mx 70000
using namespace std;
int n, m;
ll arr[18][18];
ll memo[mx];
ll group[mx];

ll dp(int mask)
{
    if (memo[mask] != -1)
        return memo[mask];

    ll res = max(group[mask], 0LL);
    for (int i = mask; i; i = (i - 1) & mask)
        if (group[i] >= 0)
            res = max(res, group[i] + dp(mask ^ i));

    return memo[mask] = res;
}

int main()
{
#ifdef LOCAL_OUTPUT
    freopen(LOCAL_OUTPUT, "w", stdout);
#endif
#ifdef LOCAL_INPUT
    freopen(LOCAL_INPUT, "r", stdin);
#endif

    cin >> n;
    ms(memo, -1);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            cin >> arr[i][j];

    m = (1 << n) - 1;
    for (int i = 0; i <= m; i++)
    {
        group[i] = 0;
        for (int j = 0; j < n; j++)
            if (i & (1 << j))
                for (int k = j + 1; k < n; k++)
                    if (i & (1 << k))
                        group[i] += arr[j][k];
    }
    cout << dp(m) << endl;
}


Measured memory_bytes: 4664
#入力
S = input()
T = input()

#一致した文字数
x = 0

#判定
if len(S)+1 == len(T):
    for i in range(len(S)):
     if S[i] == T[i]:
         x+=1

#出力
if x == len(S):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9048
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int n;
    cin >> n;
    vector<int> s(n);
    for(int i = 0; i < n; ++i)  cin >> s[i];

    ll ans = 0;
    for(int k = 1; k <= n / 2; ++k){
        vector<ll> LeftSum(1, 0), RightSum(1, 0);
        set<int> st;
        for(int l = k, r = n - k - 1; r > k; l += k, r -= k){
            if(l == r)  break;
            if(st.find(l) != st.end() || st.find(r) != st.end())    break;
            LeftSum.emplace_back(LeftSum.back() + s[l]);
            RightSum.emplace_back(RightSum.back() + s[r]);
            st.insert(l);
            st.insert(r);
        }
        int sz = LeftSum.size();
        for(int i = 1; i < sz; ++i){
            chmax(ans, LeftSum[i] + RightSum[i]);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 9172
import java.util.*;

public class Main {
	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int x = sc.nextInt();
			if (n == 0 && x == 0)
				break;
			int count = 0;
			for (int i = 1; i <= n - 2; i++)
				for (int j = i + 1; j <= n - 1; j++)
					for (int k = j + 1; k <= n; k++)
						if (i + j + k == x)
							count++;
			System.out.println(count);
		}
	}
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

// {{{
template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar[0].size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}

template<typename T>
T digitsum(T x){
    T y=0;
    while(x){
        y += x % 10;
        x /= 10;
    }

    return y;
}

template<typename T>
T gcd(T x, T y){
    if (x == 0 || y == 0) {
        return 0;
    }

    while (x != y){
        if (x > y) {
            x -= y;
        }else{
            y -= x;
        }
    }
    return x;
}

// }}}
/* vim:set foldmethod=marker: */

void solve(){
    string s;
    cin >> s;

    vector<char> str;
    int n=s.length();
    for (int i = 0; i < n; i++) {
        if (s[i] != 'B') {
            str.push_back(s[i]);
        }else if (sz(str) != 0){
            str.pop_back();
        }
    }

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

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}

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

int md = 1e9 + 7;
char s[2][53];

inline int id(int i){
	if (s[0][i] == s[1][i])return 1;
	return 2;
}

int main(){
	int n;
	scanf("%d", &n);
	f(i, 0, 2)scanf("%s", s[i]);
	int an;
	int i = 0;
	if (id(i) == 1)an = 3;
	else an = 6;
	i += id(i);
	while (i < n){
		int a = id(i - 1), b = id(i);
		if (a == 1 && b == 1)an = (ll)an * 2 % md;
		else if (a == 2 && b == 2)an = (ll)an * 3 % md;
		else if (a == 1 && b == 2)an = (ll)an * 2 % md;
		i += b;
	}
	printf("%d\n", an);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
int main()
{
    string s;
    cin >> s;
    int ans = 0;
    REP(i, s.size()/2) {
        if(s[i] != s[s.size()-1-i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M  1000000009
#define rep(i,n) for(int i=0;i<n;i++)
#define N 2010000
#define vi vector<int>
bool vis[105][105]={false};

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int r;
   cin>>r;
   cout<<3*r*r<<endl;
}


Measured memory_bytes: 256
// +build ignore
package main

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

func solve(sc *scanner, wr *bufio.Writer) int {
	A := sc.f()
	B := sc.f()
	H := sc.f()
	M := sc.f()

	radA := math.Pi * 2 * (H + M/60) / 12
	Ax := A * math.Cos(radA)
	Ay := A * math.Sin(radA)
	radB := math.Pi * 2 * M / 60
	Bx := B * math.Cos(radB)
	By := B * math.Sin(radB)

	X := Ax - Bx
	Y := Ay - By
	fmt.Println(math.Sqrt(X*X + Y*Y))

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


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

void solv() {
    string str;
    cin >> str;
    rep(i,str.size()){
        if(str.at(i) == ','){
            str.at(i) = ' ';
        }
        cout << str.at(i);
    }
    cout << endl;
}

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;

int INF = 1e9 + 7;

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

int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		int k, p;
		cin >> k >> p;
		if (k%p == 0) cout << p << endl;
		else cout << k % p << endl;
	}
}


Measured memory_bytes: 3096
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Int32;

class Program
{
    static void Main(string[] args)
    {
        label:
        ReadLine();
        int result = 0;
        foreach (var txt in ReadLine().Split())
        {
            int num = Parse(txt);
            while (num % 2 == 0)
            {
                num /= 2;
                ++result;
            }
        }
        WriteLine(result);
        //goto label;
    }
}


Measured memory_bytes: 13792
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int a;
  cin>>a;
  string s;
  cin>>s;
  if(a<3200) cout<<"red"<<endl;
  else cout<<s<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,t,u;
  cin>>s>>t;
  int a,b;
  cin>>a>>b;
  cin>>t;
  if(t==s)
     a -=1;
  else
      b -=1;
  cout<<a<<" "<<b;
  return 0;
}

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

#define pb push_back
#define fi first
#define se second
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int N = 1000007, inf = 0x3f3f3f3f;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);

    int ok = a[0] == a[1] and a[2] != a[0];
    ok = ok or (a[0] != a[1] and a[1] == a[2]);

    cout << (ok? "Yes" : "No") << endl;
}

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

typedef struct{
  char suit;
  int number;
} card;

int Partition(card A[], int p, int r){
  int j;
  int x = A[r].number;
  int i = p-1;
  card a;
  for(j = p;j < r;j++){
    if(A[j].number <= x){
      i++;
      a = A[i], A[i] = A[j], A[j] = a;
    }
  }
  a = A[i+1], A[i+1] = A[r], A[r] = a;
  return i+1;
}

void Quicksort(card A[], int p, int r){
  int q;
  if(p < r){
    q = Partition(A, p, r);
    Quicksort(A, p, q-1);
    Quicksort(A, q+1, r);
  }
}

void merge(card A[], int left, int mid, int right){
  int n1 = mid - left;
  int n2 = right - mid;
  int i, j, k;
  card L[n1 + 1], R[n2 + 1];
  for(i = 0;i < n1;i++)
    L[i] = A[left + i];
  for(i = 0;i < n2;i++)
    R[i] = A[mid + i];
  L[n1].number = 1000000001;
  R[n2].number = 1000000001;
  i = 0;
  j = 0;
  for(k = left;k < right;k++){
    if(L[i].number <= R[j].number){
      A[k] = L[i];
      i++;
    } else {
      A[k] = R[j];
      j++;
    }
  }
}

void mergeSort(card A[], int left, int right){
  if(left + 1 < right){
    int mid = (left + right) / 2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}

int main(void){
  int n, i;
  scanf("%d", &n);
  card A[n], B[n], C[n];
  for(i = 0;i < n;i++){
    scanf("\n%c %d", &A[i].suit, &A[i].number);
  }
  for(i = 0;i < n;i++)
    B[i] = A[i], C[i] = A[i];
  Quicksort(B, 0, n-1);
  mergeSort(C, 0, n);
  i = 0;
  while(B[i].suit == C[i].suit && B[i].number == C[i].number && i<n)
    i++;
  if(i == n)
    printf("Stable\n");
  else
    printf("Not stable\n");
  for(i = 0;i < n;i++)
    printf("%c %d\n", B[i].suit, B[i].number);
  return 0;
}

Measured memory_bytes: 4840
n = int(input())
A = []
for i in range(5):
  A.append(int(input()))
ma = min(A)
if n <= ma:
  print(5)
  exit()
else:
  if n % ma == 0:
    print(5 + n//ma - 1)
  else:
    print(5 + n//ma)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define rep(i, a, b) for (ll i = a; i < b; i++)
#define per(i, a, b) for (ll i = a; i > b; i--)
#define vi vector<int>
#define vii vector<vi>
#define vl vector<ll>
#define vll vector<vl>
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define a(v) (v.begin(), v.end())
#define intlimit 2e9 + 69
#define longlimit 8e18 + 69
#define MOD 1000000007
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
using namespace std;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll a,b,c;
    cin >> a >> b >> c;
    if(b*c>=a){
        cout << "Yes";
    }else{
        cout << "No";
    }
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,29)-1;


int main() {
  int N; cin >> N;
  string S; cin >> S;
  int w=0; rep(i,N) if (S[i]=='.') w++;
  int result = w;
  rep(i,N) {
    w += (S[i]=='#') ? 1 : -1;
    result = min(result, w);
    // cout << w << endl;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 640