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

using namespace std;

int main() {
	vector <int> nums;
	int max = 0;
	int min = 0;
	int size = 0;
	int num = 0;
	long sum = 0;

	cin >> size;
	for (int i = 0; i < size; i++) {
		cin >> num;
		nums.push_back(num);
	}
	max = nums[0];
	min = nums[0];
	for (int i = 0; i < size; i++) {
		if (nums[i] > max) {
			max = nums[i];
		} else if (nums[i] < min) {
			min = nums[i];
		}
		sum += nums[i];
	}
	cout << min << ' ' << max << ' ' << sum << endl;
}



Measured memory_bytes: 3264
use std::io;
use std::fmt;

fn print_vec<U: fmt::Display>(a: &[U]) {
    let s: String = a.iter()
        .map(|e| e.to_string())
        .collect::<Vec<String>>()
        .connect(" ");
    println!("{}", s);
}

fn insert_sort(a: &mut [i32]){
    // i=0は整列済みであるとする
    for i in 1..a.len() {
        let v = a[i];
        let mut j = (i as i32)-1;
        while j >= 0 && a[j as usize] > v {
            a[(j+1) as usize] = a[j as usize];
            j-=1;
        }
        a[(j+1) as usize]=v;
        print_vec(&a);
    }
}

fn main(){
    let mut buf = String::new();
    let stdin = io::stdin();
    stdin.read_line(&mut buf).unwrap();

    let _n: usize = buf.trim().parse().unwrap();
    
    buf.clear();
    stdin.read_line(&mut buf).unwrap();
    let mut a: Vec<i32> = buf.split_whitespace().map(|e| e.parse().unwrap()).collect();
    print_vec(&a);

    insert_sort(&mut a);
}


Measured memory_bytes: 5056
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;

class set{
public:
  set(string w){word = w;}
  
  string word;
  vector<int> page;
};


int find(vector<set> a , string key){
  for(int i=0; i<a.size(); i++)if(a[i].word == key)return i;
  return -1;
}
bool comp(const set& a, const set& b){
  return a.word < b.word;
}

int main(){
  
  vector<set> ls;
  string w;
  int p;

  
  while(cin>>w>>p){
    int indx;
    if( (indx=find(ls,w)) == -1){
      set tmp(w);tmp.page.push_back(p);ls.push_back(tmp);
    }
    else{
      ls[indx].page.push_back(p);
    }
  }

  sort(ls.begin() , ls.end() , comp);

  for(int i=0; i<ls.size(); i++){
    sort(ls[i].page.begin() , ls[i].page.end());

    cout << ls[i].word << endl << ls[i].page[0];
    for(int j=1; j<ls[i].page.size(); j++)cout << ' ' << ls[i].page[j];
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
 
string S; int N, cnt;
 
int main() {
	int N;
    cin >> N;
    int c;
    int count=0;
    for(int i=1;i<=N;i++){
        cin >>  c;
        if(c!=i)count++;
    }
    if(count==0)cout << "YES" << endl;
    else if(count==2)cout << "YES" << endl;
    else cout << "NO" <<endl;

}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 100000000000000007
#define eps 0.000000000001
#define pi acosl(-1)
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll a[100009];
void solve()
{
    ll x;
    cin>>x;
    cout<<(x^1);
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    time_taken_start
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
    time_taken_end
}

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

signed main() {
  int N;
  cin >> N;
  
  vector<int> a(N);
  vector<int> b(N+1, 0);
  for( int i = 0; i < N; i++ ){
    cin >> a.at(i);
    b.at(i+1) += b.at(i)+a.at(i);
  }
  
  int ans = 3000000000;
  for( int i = 1; i < N; i++ ){
    if( abs( (b.at(N)-b.at(i)) - b.at(i) ) < ans ){
      ans = abs( (b.at(N)-b.at(i)) - b.at(i) );
    }
  }
  cout << ans << endl;
  
}





Measured memory_bytes: 3328
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm> // sort
#include <map> // pair

using namespace std;

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

    vector <int64_t> buffer;

    for(int64_t i=0;i<N;i++){
        int64_t temp;
        cin >> temp;
        buffer.push_back(temp);
    }
    sort(buffer.begin(),buffer.end(),std::greater<int64_t>());

    int64_t sum =buffer[0];
    int64_t count =1;
    for(int64_t i=2;i<N;){
        sum +=buffer[count];
        i++;
        if(i >= N){
            break;
        }
        sum +=buffer[count];
        i++;
        count++;
    }
    cout<<sum<<endl;

}



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

#define NDEBUG
#include <cassert>


typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


const ll MOD=1000000007LL;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

#define INTSPACE 12
char _buf[INTSPACE*1000000 + 3];

int loadint() {
    if (fgets(_buf, INTSPACE+3, stdin)==NULL) return 0;
    return atoi(_buf);
}

int loadvec(vector<int>& v, int N=-1) {
    if (N == 0) {
        v.clear();
        return 0;
    }
    if (N == -1) {
        N = loadint();
        if (N==0) return 0;
    }
    int bufsize = INTSPACE*N + 3;
    if (fgets(_buf, bufsize, stdin)==NULL) return 0;
    v.resize(N);

    int i=0;
    bool last = false;
    for (char *p=&_buf[0]; ;) {
        char *q = p;
        while (*q > ' ') ++q;
        if (*q == 0x0D || *q == 0x0A) last = true;
        *q = 0;
        v[i++] = atoi(p);
        if (last || i == N) break;
        p = q+1;
    }
    return i;
}
void read_cr() {
    fgets(_buf, 256, stdin);
}



int main() {
    string s; cin >> s;
    if (s[0]==s[1] || s[1]==s[2] || s[2]==s[3] ) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

const int MAXN = 100100;
const int MOD = 1e9+7;
int cnt[MAXN];

int solve(int N) {
	ll ans = 1;
	if (N % 2 == 1) {
		if (cnt[0] != 1) return 0;
		for (int i = 2; i < N; i += 2) {
			if (cnt[i] != 2) return 0;
			(ans *= 2) %= MOD;
		}
		return ans;
	} else {
		for (int i = 1; i < N; i+=2) {
			if (cnt[i] != 2) return 0;
			(ans *= 2) %= MOD;
		}
		return ans;
	}
}

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		cnt[a]++;
	}
	cout << solve(N) << endl;
	return 0;
}


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

int main(){
    int N, M, C, ans = 0, buf = 0;
    cin >> N >> M >> C;
    vector<vector<int>> A(N, vector<int>(M));
    vector<int> B(M);
    for(int i = 0; i < M; ++i) cin >> B[i];
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < M; ++j){
            cin >> A[i][j];
        }
    }
    for(int i = 0; i < N; ++i){
        buf = C;
        for(int j = 0; j < M; ++j){
            buf += A[i][j] * B[j];
        }
        if(buf > 0) ++ans;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
const ll inf = 0x3f3f3f3f;
#define case(i) "Case #" << i << ": "
 
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
    out << '(' << p.first << ", " << p.second << ')';
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
    ll l = v.size();
    for (ll i = 0; i < l - 1; i++) out << v[i] << ' ';
    if (l > 0) out << v[l - 1];
    return out;
}

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

    char z;
    cin >> z;
    z++;
    cout << z << endl;
}

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

int A, B ,K;

int main () {
  cin >> A >> B >> K;

  rep(i,K) if(A + i <= B) cout << A + i << endl;
  rep(i,K) {
    int m = B - (K - 1 - i);
    if(m > A + K - 1) cout << m << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;
int main(){
	int k,n;
	int prev,a0;
	int maxdis=0;
	cin>>k>>n;
	int tg,t;
	cin>>a0;
	prev=a0;
	for(int i=1;i<n;i++){
		cin>>t;
		if(t-prev>maxdis) maxdis=t-prev;
		prev=t;
	}
	if(a0+k-t>maxdis) maxdis=a0+k-t;
	cout<<k-maxdis;
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = list(input())

    while len(s) >= 2:
        s.pop(-1)
        if len(s) % 2 == 0:
            if s[:len(s) // 2] == s[len(s) // 2:]:
                print(len(s))
                break


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <assert.h>
#include <vector>
#include <set>
#pragma warning(disable : 4996)

#define N_MAX 100000
#define Q_MAX 200000

char S[Q_MAX+N_MAX+Q_MAX+2];

int main(void) {
	scanf("%s", &S[Q_MAX+1]);
	int len = strlen(&S[Q_MAX + 1]);
	char *s = &S[Q_MAX + 1];//初めの文字
	char *e = &S[Q_MAX + 1 + (len-1)];//終わりの文字
	int Q;
	scanf("%d", &Q);
	bool reverse = false;
	for (int i = 0; i < Q; ++i) {
		int T;
		scanf("%d", &T);
		if (T == 1) {
			reverse = !reverse;
		}
		else {
			int F;
			char c;
			scanf("%d %c", &F, &c);
			if (F == 1) {
				if (reverse == false) {
					--s;
					*s = c;
				}
				else {
					++e;
					*e = c;
				}
			}
			else {
				if (reverse == false) {
					++e;
					*e = c;
				}
				else {
					--s;
					*s = c;
				}
			}
			++len;
		}
	}
	if (reverse == false) {
		char *p = s;
		while (true) {
			printf("%c", *p);
			if (p == e) break;
			p++;
		}
	}
	else {
		char *p = e;
		while (true) {
			printf("%c", *p);
			if (p == s) break;
			p--;
		}
	}

	return 0;
}
 

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
string st,st1;
int main()
{
	cin>>st>>st1;
	for (int ll=0;ll<=st.size();ll++)
	{
	  for (int i=st.size()-1;i>=0;i--)
	  {
	    st[i+1]=st[i];
	  }
	  st[0]=st[st.size()];
	  if (st==st1) {cout<<"Yes\n";return 0;}
    }
    cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
inline int read()
{
	int t=1,sum=0;char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') t=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
		sum=sum*10+ch-'0',ch=getchar();
	return t*sum;
}
const int Max=2e3+10,mod=924844033;
int f[Max<<1][Max][2],g[Max],fac[Max],vis[Max][2],a[Max<<1],n,m,tot;
int main()
{
	int i,j,x,y;
	n=read(); m=read();
	for(i=1;i<=n;i++)
		for(j=0;j<2;j++) if(!vis[i][j])
		{
			int len=0;
			for(x=i,y=j;x<=n;x+=m,y^=1)
				vis[x][y]=1,len++;
			tot+=len;
			a[tot]=1;
		}
	f[0][0][1]=1;
	for(i=1;i<=tot;i++)
		for(j=0;j<=i/2;j++)
		{
			f[i][j][0]=(f[i-1][j][0]+f[i-1][j][1])%mod;
			if(j&&!a[i-1])
				f[i][j][1]=f[i-1][j-1][0];
		}
	for(i=0;i<=n;i++) g[i]=(f[tot][i][0]+f[tot][i][1])%mod;
	for(fac[0]=i=1;i<=n;i++) fac[i]=1LL*fac[i-1]*i%mod;
	int ans=0;
	for(i=0;i<=n;i++)
		if(i&1)
			ans=(ans-1LL*g[i]*fac[n-i]%mod)%mod;
		else 
			ans=(ans+1LL*g[i]*fac[n-i]%mod)%mod;
	printf("%d\n",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 61568
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N;
int main() {
    while (cin >> N) {
        int m = 0;
        int sum = 0;
        for (int i = 0; i < N; ++i) {
            int a; cin >> a;
            chmax(m, a);
            sum += a;
        }
        if (m < sum - m) puts("Yes");
        else puts("No");
    }
}











Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

class UnionFind {
	vector<int>parent;
	vector<int>rank;
public:
	UnionFind(int num) {
		num++;
		parent.resize(num);
		rank.resize(num);
		for (int i = 0; i < num; i++) {
			parent[i] = i;
			rank[i] = 0;
		}
	}
	int Find(int node) {
		if (parent[node] == node)return node;
		else return parent[node] = Find(parent[node]);
	}
	void Unite(int u, int v) {
		u = Find(u);
		v = Find(v);
		if (u == v)return;
		if (rank[u] < rank[v])parent[u] = v;
		else {
			parent[v] = u;
			if (rank[u] == rank[v])rank[u]++;
		}
	}
	bool Check_Same(int u, int v) {
		return Find(u) == Find(v);
	}
};

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

	while (cin >> N >> M, N) {
		UnionFind uf(N);
		vector<pair<int, pair<int, int>>>v(M);
		for (auto &i : v)cin >> i.second.first >> i.second.second >> i.first;
		sort(v.begin(), v.end());
		int used = 0;
		for (auto i : v) {
			if (uf.Check_Same(i.second.first, i.second.second))continue;
			used++;
			uf.Unite(i.second.first, i.second.second);
			if (used * 2 == N) {
				cout << i.first << endl;
			}
		}
	}
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> height(n);
  for(int i=0;i<n;i++)
    cin>>height[i];
  vector<int> dp(n,INT_MAX);
  dp[n-1]=0;
  for(int i=n-2;i>=0;i--)
  {
    if((i+2)<n)
      dp[i]=dp[i+2]+abs(height[i+2]-height[i]);
    if((i+1)<n)
      dp[i]=min(dp[i],dp[i+1]+abs(height[i+1]-height[i]));
    }
  cout<<dp[0]<<"\n";
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define x real()
#define y imag()
using namespace std;
typedef complex<double> P;
typedef pair<int,int> Pi;
typedef pair<double,int> Pd;
typedef pair<Pd,Pi> S;

typedef pair<P,P> L; //Line, Segment

const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);

namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
}

/*
  ?????????????????????
  a.real() * b.real() + a.imag() * b.imag()
*/
double dot(P a, P b){ return real(conj(a)*b); }


/*
  ?????????????????????
  a.real() * b.imag() - a.imag() * b.real()
*/
double cross(P a, P b){ return imag(conj(a)*b); }

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;   // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(cross(b,c) < -EPS) return -1; // ????????????(b-a)????????´???????????????(c-a)????????¨?????????
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}


// ????????¨?????????????????????????????????????????????true???
bool isIntersect(L s1, L s2){
  
  //ccw ??????????????????????????¨, ????????????????????´?????????????????¨??????????????????????????????
  if(max(real(s1.first), real(s1.second)) + EPS < min(real(s2.first), real(s2.second)) ||
     max(imag(s1.first), imag(s1.second)) + EPS < min(imag(s2.first), imag(s2.second)) ||
     max(real(s2.first), real(s2.second)) + EPS < min(real(s1.first), real(s1.second)) ||
     max(imag(s2.first), imag(s2.second)) + EPS < min(imag(s1.first), imag(s1.second))) return false;

  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}

double getDistanceSP(L s, P p){
  if(dot(s.second - s.first, p - s.first) < -EPS) return abs(p - s.first);
  if(dot(s.first - s.second, p - s.second) < -EPS) return abs(p - s.second);
  return abs(cross(s.second - s.first, p - s.first) / abs(s.second - s.first));  //??´?????¨???????????¢
}


// ????????¨??????????????¢
double getDistanceSS(L s1, L s2){
  if(isIntersect(s1,s2)) return 0.0;
  return min( min(getDistanceSP(s1, s2.first), getDistanceSP(s1, s2.second)),
              min(getDistanceSP(s2, s1.first), getDistanceSP(s2, s1.second)));
}


double cal(L a,L b,double h){
  double d=getDistanceSS(a,b);
  if(h>d)return d;
  return (h*h+d*d)/2/h;
}

int main(){
  int n;

  while(cin>>n,n){
    double ans=1e9;
    P s,e;
    double minx,maxx,miny,maxy,h;
    cin>>s.x>>s.y>>e.x>>e.y;
    for(int i=0;i<n;i++){
      cin>>minx>>miny>>maxx>>maxy>>h;
      if(minx<=s.x&&s.x<=maxx&&miny<=s.y&&s.y<=maxy)ans=0;
      if(minx<=e.x&&e.x<=maxx&&miny<=e.y&&e.y<=maxy)ans=0;
      ans=min(ans,cal(L(s,e),L(P(minx,miny),P(minx,maxy)),h));
      ans=min(ans,cal(L(s,e),L(P(minx,maxy),P(maxx,maxy)),h));
      ans=min(ans,cal(L(s,e),L(P(maxx,maxy),P(maxx,miny)),h));
      ans=min(ans,cal(L(s,e),L(P(maxx,miny),P(minx,miny)),h));
    }
    printf("%.8lf\n",ans);
  }
  return 0;
}

Measured memory_bytes: 3176
#include <stdio.h>

int main(void)
{
	int k, c, sum;
	int i;
	
	while (scanf("%d", &k), k != 0){
		sum = 0;
		
		for (i = 1; i <= k * (k - 1) / 2; i++){
			scanf("%d", &c);
			sum += c;
		}
		
		printf("%d\n", sum / (k - 1));
	}
	
	return (0);
}

Measured memory_bytes: 600
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
#from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
#inf = 10**17
#mod = 10**9 + 7

S=input().rstrip()
i=0
n=len(S)
count=0
pa=[]
pb=[]
for i in range(n-1):
    if S[i]=="R" and S[i+1]=="L":
        count+=1
        pa.append(i)
    elif S[i]=="L" and S[i+1]=="R":
        pb.append(i+1)
Rs=[]
Ls=[]
Rs.append(pa[0]+1)
for i in range(count-1):
    Rs.append(pa[i+1]-pb[i]+1)
    Ls.append(pb[i]-pa[i]-1)
Ls.append(n-1-pa[-1])
ans=[0]*n
for i in range(count):
    ans[pa[i]]=floor(Ls[i]/2)+ceil(Rs[i]/2)
    ans[pa[i]+1]=floor(Rs[i]/2)+ceil(Ls[i]/2)
for an in ans:
    print(an,end=" ")
#answer=" ".join(map(str,ans))

Measured memory_bytes: 9784
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ENDL '\n'
#define all(a) begin(a),end(a)
#define sz(a) (int)(a.size())
#define deb(a) cout << #a << ": " << a << ENDL
#define fore(i, a, b) for(int i(a), ThkMk(b); i < ThkMk; ++i)
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli> ii;
typedef vector<lli> vi;

vector<vector<lli>> graph;
vector<lli> sol;
vector<lli> down;

lli m;

lli ddfs(int u, int pr) {
    lli ans = 1;
    for(auto it : graph[u]) {
        if(it == pr) continue;
        ans = (ans * (1LL + ddfs(it, u))) % m;
    }
    down[u] = ans;
    return ans;
}

lli dfs(int u, int pr, lli up) {
    int sz = sz(graph[u]);
    vector<lli> v(sz);
    fore(i, 0, sz) {
        if(graph[u][i] == pr) {
            v[i] = 1;
            continue;
        }
        v[i] = down[graph[u][i]] + 1;
    }
    vector<lli> prefix(sz);
    vector<lli> suffix(sz);
    prefix[0] = v[0];
    fore(i, 1, sz) prefix[i] = (prefix[i - 1] * v[i]) % m;
    suffix[sz - 1] = v[sz - 1];
    for(int i = sz - 2; i >= 0; --i) suffix[i] = (suffix[i + 1] * v[i]) % m;
    sol[u] = ((up + 1) * suffix[0]) % m;
    fore(i, 0, sz) {
        if(graph[u][i] == pr) continue;
        lli param = (up + 1) % m;
        if(sz == 1) {
            dfs(graph[u][0], u, param);
            break;
        }
        if(i == 0) param = (param * suffix[1]) % m;
        else if(i == (sz - 1)) param = (param * prefix[sz - 2]) % m;
        else param = (((param * prefix[i - 1]) % m) * suffix[i + 1]) % m;
        dfs(graph[u][i], u, param);
    }
    return sol[u];
}

int main()
{   _
    lli n, u, v; cin >> n >> m;
    graph.resize(n);
    sol.resize(n);
    down.resize(n);
    fore(i, 1, n) {
        cin >> u >> v;
        graph[u - 1].pb(v - 1);
        graph[v - 1].pb(u - 1);
    }
    if(n == 1) {
        cout << 1 << ENDL;
        return 0;
    }
    ddfs(0, -1);
    dfs(0, -1, 0);
    fore(i, 0, n) cout << sol[i] << ENDL;
    return 0;
}


Measured memory_bytes: 26100
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
 int main()
 {
 	 char X,Y;
 	 scanf(" %c %c",&X,&Y);
 	 if(X>Y)
	 {
	 	 printf(">\n");
	 }
 	 if(X<Y)
	 {
 	 	 printf("<\n");
	 }
 	 if(X==Y)
	 {
 	 	 printf("=\n");
	 }
 	 return 0;
 }

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

int main(){
    int n;
    cin>>n;
    vector<int> x(n),y(n);
    rep(i,n){
        cin>>x[i];
    }
    rep(i,n){
        cin>>y[i];
    }
    double p1=0.0;
    rep(i,n){
        p1+=abs(x[i]-y[i]);
    }
    double p2=0.0;
    rep(i,n){
        p2+=pow(abs(x[i]-y[i]), 2);
    }
    p2 = pow(p2,0.5);
    double p3=0.0;
    rep(i,n){
        p3+=pow(abs(x[i]-y[i]), 3);
    }
    p3 = pow(p3, 1.0/3);
    double pm=abs(x[0]-y[0]);
    rep(i,n){
        if(pm<abs(x[i]-y[i]))pm=abs(x[i]-y[i]);
    }
    cout<<fixed<<setprecision(10)<<p1<<endl<<p2<<endl<<p3<<endl<<pm<<endl;
    return 0;
}


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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    ll h,w,m;
    cin >> h >> w >> m;
    vector<ll> tate(h+1,0);
    vector<ll> yoko(w+1,0);
    
    vector<ll> aaa[h];
    
    vector<ll> h_h(m);
    vector<ll> w_w(m);
    rep(i,m){
        ll hh,ww;
        cin >> hh >> ww;
        h_h[i]=hh-1;
        w_w[i]=ww-1;
        tate[hh-1]++;
        yoko[ww-1]++;
        aaa[hh-1].push_back(ww-1);
    }
    
    vector<ll> hhh;
    vector<ll> www;
    ll max_h=0;
    rep(i,h){
        max_h=max(max_h,tate[i]);
    }
    rep(i,h){
        if(max_h==tate[i]) hhh.push_back(i);
    }
    
    ll max_w=0;
    rep(i,w){
        max_w=max(max_w,yoko[i]);
    }
    rep(i,w){
        if(max_w==yoko[i]) www.push_back(i);
    }
    
    ll goukei=hhh.size()*www.size();
    if(goukei>m){
        cout << max_w+max_h << endl;
        return 0;
    }
    
    ll total=0;
    rep(i,m){
        ll now_h=h_h[i];
        ll now_w=w_w[i];
        if(binary_search(hhh.begin(),hhh.end(),now_h)){
            if(binary_search(www.begin(),www.end(),now_w)){
                total++;
            }
        }
    }
    
    if(total==goukei) cout << max_w+max_h-1 << endl;
    else cout << max_w+max_h << endl;
    

    return 0;
}











Measured memory_bytes: 37312
#include <bits/stdc++.h>
using namespace std;
int main()
{
  //整数iを導入
  int N, A;
  //入力を求める
  cin >> N >> A;
  if (A >= N % 500)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		String S = sc.get();
		System.out.println(S.equals("ABC") ? "ARC" : "ABC");
	}
}

class Main {
	public static void main(String... args) {
		System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
		System.out.flush();
	}
}

Measured memory_bytes: 32532
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
bool Add(int &a,int b){a = (a + b) % MOD;}
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}

signed main(){
    int n;
    cin >> n;
    int A[n],B[n];
    REP(i,n){
        cin >> A[i];
    }
    REP(i,n) cin >> B[i];
    int tmp = 1;
    int ans = 0;
    int C[n];
    REP(h,29){
        REP(i,n) C[i] = B[i] % (2 * tmp) ;
        sort(C,C + n);
        int kosu = 0;
        REP(i,n){
            int hoge = A[i] % (2 * tmp);
            auto itr = lower_bound(C,C+n, max(llong(0), tmp - hoge) );
            auto itr2 = lower_bound(C,C + n, max(llong(0), 2 * tmp - hoge)  );
            kosu += itr2 - itr;
            itr = lower_bound(C,C+n, max(llong(0), 3 * tmp - hoge) );
            itr2 = lower_bound(C,C + n, max(llong(0), 4 * tmp - hoge)  );
            kosu += itr2 - itr;
        }
        if(kosu %2 == 1) ans += tmp;
        tmp *= 2;
    }
    cout << ans << endl;


}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const long long INF = 2e18;
const long long MOD = 1e9+7;

#define sx(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i < n; i++)
#define ALL(a) begin(a),end(a)

int main(void) {
    string S;
    cin >> S;
    int N = S.size();

    int ans = 0;

    for (int i=0; i<(1<<N); i++) {
        vector<bool> use(N, false);
        int t = i;
        REP(j, N) {
            use[j] = t%2;
            t /= 2;
        }
        string ss;
        REP(j, N) {
            if (use[j]) ss.pb(S[j]);
        }
        int n = ss.size();
        if (n%2 == 0) continue;
        bool flag = true;
        if (!(ss[n/2-1]=='i' && ss[n/2+1]=='i' && ss[n/2] == 'w')) flag = false;
        REP(j, n/2) {
            if (ss[j] == 'i') {
                if (ss[n-j-1] != 'i') flag = false;
                // cout << "a";
            }
            else if (ss[j] == 'w') {
                if (ss[n-j-1] != 'w') flag = false;
                //cout << "b";
            }
            else if (ss[j] == '(') {
                if (ss[n-j-1] != ')') flag = false;
                //cout << "c";
            }
            else if (ss[j] == ')') {
                if (ss[n-j-1] != '(') flag = false;
                //cout << "d";
            }
            else if (ss[j] == '[') {
                if (ss[n-j-1] != ']') flag = false;
                //cout << "e";
            }
            else if (ss[j] == ']') {
                if (ss[n-j-1] != '[') flag = false;
                //cout << "f";
            }
            else if (ss[j] == '{') {
                if (ss[n-j-1] != '}') flag = false;
                //cout << "g";
            }
            else if (ss[j] == '}') {
                if (ss[n-j-1] != '{') flag = false;
                //cout << "h";
            }
        }
        if (flag) ans = max(ans, n);

    }

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


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N, X, M;
    cin >> N >> X >> M;
    set<ll> S;
    S.insert(X);
    ll sum1 = X;
    N--;
    vector<ll> V, W; // value, accumulate
    W.push_back(0);
    V.push_back(X); W.push_back(0 + X);
    while (1) {
        X = X * X % M;
        if (S.count(X) > 0) break;
        S.insert(X);
        sum1 += X;
        V.push_back(X);
        W.push_back(W.back() + X);
        N--;
        if (N == 0) {
            cout << sum1 << endl;
            return 0;
        }
    }
    auto p = find(V.begin(), V.end(), X);
    auto n = distance(V.begin(), p);
    ll n2 = V.size() - n; // N already subbed 1 loop times
//    cout << W[n] + (W.back() - W[n]) * (N / n2) + W[n + N % n2] - W[n] << endl;
    cout << (W.back() - W[n]) * ((N + n2) / n2) + W[n + (N + n2) % n2] << endl;

}


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

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> a (n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    vector<pair<int,int>> ac;
    int now = a.at(0);
    int count = 1;
    for(int i=1; i<n; i++){
        if(a.at(i) == now) count++;
        else{
            ac.push_back(make_pair(count,now));
            now = a.at(i);
            count = 1;
        }
    }
    ac.push_back(make_pair(count,now));
    sort(ac.begin(),ac.end());
    int ans = 0;
    int si = ac.size();
    if(si > k){
        for(int i=0; i<ac.size()-k; i++){
            ans += ac.at(i).first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3188
n = int(input())
r = [int(i) for i in input().split()]
for i in range(1,n):
    r[i] += r[i-1]

a = r.copy()
ans_a = 0; change_v = 0
for i in range(n):
    a[i] += change_v
    if i%2 == 1:
        ans_a += max(0,1-a[i])
        change_v += max(0,1-a[i])
    else:
        ans_a += max(0,a[i]+1)
        change_v -= max(0,a[i]+1)

a = r.copy()
ans_b = 0; change_v = 0
for i in range(n):
    a[i] += change_v
    if i%2 == 0:
        ans_b += max(0,1-a[i])
        change_v += max(0,1-a[i])
    else:
        ans_b += max(0,a[i]+1)
        change_v -= max(0,a[i]+1)

print(min(ans_a,ans_b))


Measured memory_bytes: 14332
#include<iostream>

using namespace std;

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

    if(a+b == c || c+b == a || a+c == b) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
/*package whatever //do not write package name here */

// Working program with FastReader 
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.util.*;
public class Main 
{ 
	static class FastReader 
	{ 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			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; 
		} 
	} 

	public static void main(String[] args) 
	{ 
		FastReader ob=new FastReader(); 
		int n = ob.nextInt();
		HashMap<Long,Long> map = new HashMap<Long,Long>();
		boolean flag=true;
		for (int i=0;i<n ;i++) {
		    long k = ob.nextLong();
		    if(map.containsKey(k)){
		        flag=false;
		    }
		    else{
		        map.put(k,(long)0);
		    }
		}
		if(flag){
		    System.out.println("YES");
		}
		else{
		    System.out.println("NO");
		}
	
	
	} 
} 


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.println(in.nextInt() < 1200 ? "ABC" : "ARC");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 22864
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	N, M, K := nextInt(), nextInt(), nextInt()
	CsumA := make([]uint, N+1)
	CsumB := make([]uint, M+1)
	var ans int
	for i := 1; i <= N; i++ {
		CsumA[i] = CsumA[i-1] + uint(nextInt())
	}
	for i := 1; i <= M; i++ {
		CsumB[i] = CsumB[i-1] + uint(nextInt())
	}
	// 二分探索する
	// golangだと、srot.Searchでサクッと二分探索できる
	for i := 0; i <= N; i++ {
		if CsumA[i] > uint(K) {
			break
		}
		cnt := sort.Search(M+1, func(j int) bool { return CsumB[j]+CsumA[i] > uint(K) })
		ans = MaxOf(ans, i+cnt-1)
	}
	fmt.Println(ans)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

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

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

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 10392
#include <stdio.h>

int main() {
	
	int a, b, c;
	int count = 0;

	scanf("%d %d %d", &a, &b, &c);

	if (a == b && c % a == 0) {
		count++;
	}
	else {
		for (int i = a; i < b; i++) {
			if (c % i == 0) {
				count++;
			}
		}
	}

	if (a != b && b == c) {
		count++;
	}

	printf("%d\n", count);

	return 0;
}



Measured memory_bytes: 2080
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String[] v = br.readLine().split(" ");
			int w = Integer.parseInt(v[0]);
			int h = Integer.parseInt(v[1]);
			int x = Integer.parseInt(v[2]);
			int y = Integer.parseInt(v[3]);
			int r = Integer.parseInt(v[4]);

			if (x >= 0 && x <= w - r && y >= 0 && y <= h - r) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Measured memory_bytes: 24324
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define append push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;

int dp[105][4][2];

int main() {
  string s; int K;
  cin >> s >> K;
  int n = len(s);
  dp[0][0][0] = 1;
  rep(i,0,n) rep(j,0,4) rep(k,0,2) {
    int d = s[i]-'0';
    rep(nd,0,10) {
      int ni = i+1, nj = j, nk = k;
      if (nd != 0) nj++;
      if (nj > K) continue;
      if (k == 0) {
        if (nd > d) continue;
        else if (nd < d) nk = 1;
      }
      dp[ni][nj][nk] += dp[i][j][k];
    }
  }
  int ans = dp[n][K][0] + dp[n][K][1];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
//#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vl = vector<ll>;
using vi = vector<int>;
using Graph = vector<vi>;
ll divi_count(long long N) {
  ll res = 0;
  for (long long i = 1; i * i <= N; ++i) {
    if (N % i == 0) {
      res++;
      // 重複しないならば i の相方である N/i も push
      if (N / i != i) res++;
    }
  }
  return res;
}

map<long long, long long> prime_factorize(long long N) {
  map<long long, long long> res;
  for (long long a = 2; a * a <= N; ++a) {
    if (N % a != 0) continue;
    long long ex = 0;  // 指数

    // 割れる限り割り続ける
    while (N % a == 0) {
      ++ex;
      N /= a;
    }

    // その結果を push
    res[a] = ex;
  }

  // 最後に残った数について
  if (N != 1) res[N] = 1;
  return res;
}

Vl dp(10000001, 2);
vector<map<ll, ll>> mp;
set<ll> prime;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(15); //"for float-base
  // problem"
  int N;
  cin >> N;
  ll ans = 0;
  /*
  mp.push_back(prime_factorize(0));
  mp.push_back(prime_factorize(1));
*/
  for (int i = 2; i * i <= N; i++) {
    for (int j = i; i * j <= N; j++) {
      dp[i * j]++;
      if (i != j) dp[i * j]++;
    }
  }
  /*
    for (int i = 2; i <= N; i++) {
      map<ll, ll> pf;
      bool flag = false;
      for (auto p : prime) {
        if (i % p == 0) {
          pf = mp.at(i / p);
          pf[p]++;
          mp.push_back(pf);
          flag = true;
          break;
        }
      }
      if (flag) {
        ll count = 1;
        for (auto a : pf) {
          count *= (a.second + 1);
        }
        ans += i * count;
        //    for (auto p : pf) cout << p.first << " " << p.second << endl;
        continue;
      }
      prime.insert(i);
      pf[i] = 1;
      mp.push_back(pf);
      ans += i * 2;
      // cout << ans << endl;
    }
    */
  for (int i = 2; i <= N; i++) {
    ans += i * dp.at(i);
  }
  cout << ans + 1 << endl;
}

Measured memory_bytes: 81156
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    int n,T;//如果最多的蛋糕有n个，T是原题变量 
    cin>>n>>T;//输入 
    int k=0;//k就不用多说了吧，原题的变量 
    for(int i=1;i<=T;++i) //通过循环来尝试得出k的正确值 
    {
        int a;//要用另一个变量 
        cin>>a;//这个也是要输入的 
        k=max(k,a);//看看哪个大，把大的赋值给k 
    }
    cout<<max(k-1-(n-k),0)<<endl;//使用公式
    return 0; 
}

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

int main(){
    int N, A;
    int amari;

    cin >> N >> A;

    amari = N % 500;

    if (amari<=A) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    switch(n%10) {
        case 0:
            printf("pon\n");
            break;
        case 1:
            printf("pon\n");
            break;
        case 6:
            printf("pon\n");
            break;
        case 8:
            printf("pon\n");
            break;
        case 2:
            printf("hon\n");
            break;
        case 4:
            printf("hon\n");
            break;
        case 5:
            printf("hon\n");
            break;
        case 7:
            printf("hon\n");
            break;
        case 9:
            printf("hon\n");
            break;
        case 3:
            printf("bon\n");
    }   
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <string.h>

int main(void)
{
	char W[11], T[15];
	int count = 0, i;
	scanf("%s", W);
	for (i = 0; i < strlen(W); i++)
	{
		if('A' <= W[i] && W[i] <= 'Z')
		{
			W[i] = W[i] - 'A' + 'a';
		}
	}
	while(1)
	{
		scanf("%s", T);
		if (strcmp(T, "END_OF_TEXT") == 0)
			break;
		for(i = 0; i < strlen(T); i++)
		{
			if('A' <= T[i] && T[i] <= 'Z')
			{
				T[i] = T[i] - 'A' + 'a';
			}
		}
		if (strcmp(T, W) == 0)
			count++;
	}
	printf("%d\n", count);
	return 0;
}

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

using Point = complex<ll>;

Point dir[4] = {
    {-1, 0},
    {0, 1},
    {1, 0},
    {0, -1},
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    while (cin >> n, n) {
        vector<Point> pos(n);
        pos[0] = {0, 0};
        rep(i, n-1) {
            ll r, d; cin >> r >> d;
            pos[i+1] = pos[r] + dir[d];
        }
        ll mx = linf, my = linf;
        ll Mx = -linf, My = -linf;
        each(p, pos) {
            ll x = p.real(), y = p.imag();
            chmin(mx, x);
            chmax(Mx, x);
            chmin(my, y);
            chmax(My, y);
        }
        ll w = Mx - mx + 1;
        ll h = My - my + 1;
        cout << w << " " << h << endl;
    }
}

Measured memory_bytes: 3140