akhauriyash/Code-Regression huggingface dataset:
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 

class Point
{
public:
	double x, y;

	Point(double x = 0, double y = 0) :x(x), y(y) {}


	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
	Point operator * (double k) { return Point(x * k, y * k); }
	Point operator / (double k) { return Point(x / k, y / k); }
	bool operator < (const Point &p)const { return x != p.x ? x < p.x : y < p.y; }
	bool operator ==(const Point &p)const { return fabs(x - p.x) < EPS&&fabs(y - p.y) < EPS; }

	double abs() { return sqrt(norm()); }
	double norm() { return x*x + y*y; }
};
typedef Point Vector;
struct Segment
{
	Point p1, p2;
};
typedef Segment Line;
class Circle
{
public:
	Point c;
	double r;
	Circle(Point c = Point(), double r = 0.0) :c(c), r(r) {}
};

double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; }//??????
double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }//??????
bool isOrthogonal(Vector a, Vector b) { return fabs(dot(a, b)) < EPS; }//??´??????
bool isOrthogonal(Point a1, Point a2, Point b1, Point b2) { return isOrthogonal(a1 - a2, b1 - b2); }
bool isOrthogonal(Line l1, Line l2) { return fabs(dot(l1.p2 - l1.p1, l2.p2 - l2.p1)) < EPS; }
bool isParallel(Vector a, Vector b) { return fabs(cross(a, b)) < EPS; }//?????????
bool isParallel(Point a1, Point a2, Point b1, Point b2) { return isParallel(a1 - a2, b1 - b2); }
bool isParallel(Line l1, Line l2) { return fabs(cross(l1.p2 - l1.p1, l2.p2 - l2.p1)) < EPS; }
Point project(Line s, Point p)
{
	Vector base = s.p2 - s.p1;
	double r = dot(p - s.p1, base) / base.norm();
	return s.p1 + base*r;
}


int main()
{
	int n; cin >> n;
	int a[6] = {};
	for (int i = 0; i < n; i++)
	{
		double x; cin >> x;
		int c = 0;
		if (x < 165.0)c = 0;
		else if (x < 170.0)c = 1;
		else if (x < 175.0)c = 2;
		else if (x < 180.0)c = 3;
		else if (x < 185.0)c = 4;
		else c = 5;
		a[c]++;
	}
	for (int i = 0; i < 6; i++)
	{
		cout << i + 1 << ":";
		for (int j = 0; j < a[i]; j++)cout << "*";
		cout << endl;
	}
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

typedef struct{ 
    int array[100]; 
}abc; 



int main() {

  ll N,K;
  cin>>N>>K;
  ll A[N];
  ll B[N];
  FOR(i,0,N-1){
    B[i]=-1;
  }
  FOR(i,0,N-1){
    cin>>A[i];
  }
  ll koyaku=gcd(A[0],A[1]);
  FOR(i,2,N-1){
    koyaku =gcd(koyaku,A[i]);
  }
  FOR(i,0,N-1){
    if(A[i]-K>=0){
      if((A[i]-K)%koyaku==0){
  cout<<"POSSIBLE"<<endl;
  return 0;
      }
    }
  }

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


Measured memory_bytes: 1792
#include<iostream> 
#include<fstream>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<cmath>
#include<vector> 
#include<array>
#include<deque>
#include<list>
#include<forward_list>
#include<stack>
#include<queue>
#include<algorithm>
#include<numeric>
#include<iterator>
#include<functional>
#include<map>
#include<unordered_map>
#include<set>
#include<utility>
#include<unordered_set>
 
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define sort_all(v) sort(v.begin(), v.end())
#define fill(a) memset(a, 0, sizeof(a))

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


void test() {
    ll a, b, c, d;
    scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
    cout << max(max(a * c, b * d), max(a * d, b * c));
}   

int main ()     
{
    // int t;
    // cin >> t;
    // while(t--) 
        test();
}


Measured memory_bytes: 3760
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

template <typename T>
inline T Gcd(T a, T b) {
    T c;
    while (b) {
        c = b;
        b = a % b;
        a = c;
    }
    return a;
}

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

    Int K;
    cin >> K;

    Int ans = 0;
    for (Int i = 1; i <= K; i++) {
        for (Int j = 1; j <= K; j++) {
            Int tem = Gcd(i, j);
            for (Int k = 1; k <= K; k++) {
                ans += Gcd(tem, k);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();
        String direction = "NSEW";
        int[] dirCount = new int[4];

        for (int i = 0; i < S.length(); i++) {
            dirCount[direction.indexOf(S.charAt(i))] ++;
        }

        boolean resultNS = (dirCount[0] == 0 && dirCount[1] == 0) ||
                (dirCount[0] != 0 && dirCount[1] != 0);
        boolean resultEW = (dirCount[2] == 0 && dirCount[3] == 0) ||
                (dirCount[2] != 0 && dirCount[3] != 0);

        System.out.println( (resultNS && resultEW) ? "Yes" : "No" );
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 100005;
int n, m, a, b, pn[MX], ans[MX];
vector<int> G[MX];
stack<int> st;
int main(){
	scanf("%d%d", &n, &m);
	rep(i,n+m-1){
		scanf("%d%d", &a, &b);
		G[a].push_back(b);
		pn[b]++;
	}
	rep(i,n) if(!pn[i+1]) st.push(i+1);
	while(!st.empty()){
		a = st.top(); st.pop();
		for(int nx: G[a]) if(!--pn[nx]){
			ans[nx] = a;
			st.push(nx);
		}
	}
	rep(i,n) printf("%d\n", ans[i+1]);
}

Measured memory_bytes: 7040
package main

import (
  "fmt"
  "strings"
)

func main() {
  var S, T string
  fmt.Scan(&S, &T)
  
  count := 0
  t := strings.SplitAfter(T, "")
  for idx, s := range(S) {
    if string(s) == t[idx] {
      count++
    }
  }
  fmt.Println(count)
}

Measured memory_bytes: 640
#include<bits/stdc++.h>    
using namespace std;
#define ll long long 
#define pi pair<ll,ll>
#define pb push_back
#define inf 1e16
#define mod 998244353
#define en '\n'
#define ld long double
ll pw(ll b, ll r){
	ll ans = 1;
	while(r){
		if(r&1)ans = (ans*b)%mod;
		b = (b*b)%mod;
		r>>=1;
	}
	return ans;
}
ll fact(ll n){
	ll ans = 1;
	for(int i = 1 ; i <= n ; i ++ )ans*=i;
	return ans;
}
ll findRank(ll arr[], ll n){
	ll ans = 0 ; 
	for(int i = 0 ; i < n ; i ++ ){
		ans+=fact(n-i-1)*(arr[i]-1);
	}
}
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll n,m;cin>>n>>m;
	ll arr[n];for(int i = 0 ; i < n ; i ++ )cin>>arr[i];
	ll lc = 1;
	ll lcb = 1;
	bool zero = false;
	bool ex = false;
	ll val = arr[0];
	ll counter = 0 ; 
	while(val%2==0){
		counter++;
		val/=2;
	}
	for(int i = 1 ; i < n ; i ++ ){
		ll val = arr[i],c=0;
		while(val%2==0){
			c++;
			val/=2;
		}
		if(c!=counter){
			zero=true;
			break;
		}
	}
	for(int i = 0 ; i < n ; i ++ ){
		ll g = __gcd(arr[i],lc);
		lc = lc*(arr[i]/g);
		if(lc>m || lcb<=0 ){
			ex = true;
			break;
		}
	}
	for(int i = 0 ; i < n ; i ++ ){
		ll g = __gcd(arr[i]/2,lcb);
		lcb = lcb*(arr[i]/(2*g));
		if(lcb>m || lcb<=0){
			zero=true;
			break;
		}
	}
	ll ans = 0 ; 
	if(!zero){
		ans=1;
		if(!ex)ans+=(m-lcb)/lc;
	}
	cout<<ans<<en; 
	return 0 ; 
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.length();
    int res = 0;
    for(int i=0;i<n/2;i++)
    {
        if(s[i] != s[n-i-1])
            res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x1, y1, x2, y2, x, y, dx, dy;
    cin >> x1 >> y1 >> x2 >> y2;
    
    x = x1;
    y = y1;
    dx = x2 - x1;
    dy = y2 - y1;
    
    for ( int i = 0; i < 3; i++ ) {
        x += dx;
        y += dy;
        if (i==2) cout << " ";
        if (i>0) {
            cout << x << " " << y;
        }
        swap( dx, dy);
        dx = -dx;
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// https://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/api/a01040_source.html
using namespace std;
#define REP(i, n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i, n) for(ll i=(ll)(n-1);i>=0;i--)
#define FOR(i, a, b) for(ll i=(ll)(a); i<=(ll)(b); i++)
#define RFOR(i, a, b) for(ll i=(ll)(a);i>=(ll)(b); i--)
#define pb push_back // 配列の最後にappendする
#define mp make_pair 
#define ALL(x) (x).begin(),(x).end()   // accumulateする場合、最初から最後までということか？
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

// #define LOCAL
#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

int main(){
  ll A,B,C,D,E,F,K,G,H,L,M,N,P,Q,R,W,X,Y,Z;
  string S,T,U;
  vector<ll> V,A_list,B_list;
  int ans_s, ans_t;

  cin >> N ;
  REP(i,N){ 
      cin >> A;
      A_list.pb(A);
  }
  sort(ALL(A_list));
  B_list = A_list;
  A_list.erase(unique(ALL(A_list)), A_list.end());
  if(B_list == A_list) 
    cYES;
  else
    cNO;
  return 0;
}

Measured memory_bytes: 3440
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int f(int&a, int&b, int c){
    int x=min(a/c,b);
    if(x<=0)return 0;
    a-=x*c;
    b-=x;
    return x;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    cout<<setprecision(10);
    int h,w;
    cin>>h>>w;
    int a=(h/2)*(w/2);
    int b=((h%2)*(w/2)+(h/2)*(w%2));
    int c=(h%2)*(w%2);
    dprint(a,b,c);

    map<char,int> m;
    REP(i,h){
        string s;
        cin>>s;
        REP(i,w)++m[s[i]];
    }
    dprint(m);

    for(const auto p:m){
        int d=p.S;
        cerr<<p.F<<endl;
        cerr<<"used 4:"<<f(d, a, 4)<<endl;
        cerr<<"used 2:"<<f(d, b, 2)<<endl;
        cerr<<"used 1:"<<f(d, c, 1)<<endl;
        if(d)c=-10000;
    }
    dprint(a,b,c);
    Yes(a==0 && b==0 && c==0);

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
const lint MOD =1000000007;
const lint MAX = 10000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;

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

void COMinit() // 二項係数を求める時は前処理としてCOMinit()をする
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return 0;
        }
    }

    // 素数である
    return 1;
}
lint lcm(lint a,lint b){
      return a/__gcd(a,b)*b;
  }
    
  int main(){
      lint N;
      cin>>N;
      lint A[N];
      rep(i,N)cin>>A[i];
      lint cnt=0,cnt1=0,cnt2=0;
      lint ans=1;
      lint count=0;
      rep(i,N){
           lint count=0;
            if(cnt==A[i])count++;
            if(cnt1==A[i])count++;
            if(cnt2==A[i])count++;
            ans*=count;
            ans%=MOD;
             if(cnt==A[i]){
                 cnt++;
                 continue;
             }
            if(cnt1==A[i]){
                cnt1++;
                continue;
            }
            if(cnt2==A[i]){
                cnt2++;
                continue;
            }
      }
      cout<<ans;
  }
  

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define L 100
#define Gard NULL

struct Tree{
  int nodekey;
  struct Tree *parent;
  struct Tree *leftch;
  struct Tree *rightch;
};

typedef struct Tree  *Search;
Search road;

void Insert(int );
void Pre(Search );
void In(Search );
Search Find(int ,Search);
void Delete(Search );
Search Suc(Search );
Search Min(Search );

int main(){
  int loop,numnode;
  char order[L];
  int i;
    
  scanf("%d",&loop);
  
  for(i=0;i<loop;i++){
    scanf("%s",order);
   
    if(order[0]=='i'){
      scanf("%d",&numnode);
      Insert(numnode);
    }
    
    else if(order[0]=='p'){
      In(road);
      printf("\n");
      Pre(road);
      printf("\n");
    }
    
    else if(order[0]=='f'){
      scanf("%d",&numnode);
    
      if(Find(numnode,road)!=Gard){
	printf("yes\n");
      }

      else{
	printf("no\n");
      }
    }

    else if(order[0]=='d'){
      scanf("%d",&numnode);
      Delete(Find(numnode,road));
    }
    
  }
  
  return 0;
}

void Insert(int numnode){
  Search xnode,ynode,znode;
  
  xnode=road;
  ynode=Gard;
  znode=(struct Tree *)malloc(sizeof(struct Tree));
  znode->nodekey=numnode;
  znode->leftch=Gard;
  znode->rightch=Gard;
  
  while(1){
    if(xnode==Gard)break;
    
    ynode=xnode;
    
    if(znode->nodekey<xnode->nodekey){
      xnode=xnode->leftch;
    }
    
    else{
      xnode=xnode->rightch;
    }
  }
  
  znode->parent=ynode;
  
  if(ynode==Gard){
    road=znode;
  }
  
  else if(znode->nodekey<ynode->nodekey){
    ynode->leftch=znode;
  }
  
  else{
    ynode->rightch=znode;
  }
  
}

void Pre(Search road){
  
  if(road==Gard){
    return;
  }
  
  printf(" %d",road->nodekey);
  
  Pre(road->leftch);
  Pre(road->rightch);
  
}

void In(Search road){
  
  if(road==Gard){
    return;
  }
  
  In(road->leftch);
  
  printf(" %d",road->nodekey);
  
  In(road->rightch);
}

Search Find(int numnode, Search road){
  
  if((road==Gard) || (numnode==road->nodekey)){
    return road;
  }
  
  else if(numnode<road->nodekey){
    return Find(numnode,road->leftch);
  }
  
  else{
    return Find(numnode,road->rightch);
  }
}

void Delete(Search znode){
  Search xnode,ynode;

  if((znode->leftch==Gard) || (znode->rightch==Gard)){
    ynode=znode;
  }

  else{
    ynode=Suc(znode);
  }

  if(ynode->leftch!=Gard){
    xnode=ynode->leftch;
  }

  else{
    xnode=ynode->rightch;
  }

  if(xnode!=Gard){
    xnode->parent=ynode->parent;
  }

  if(ynode->parent==Gard){
    road=xnode;
  }

  else if(ynode==ynode->parent->leftch){
    ynode->parent->leftch=xnode;
  }

  else{
    ynode->parent->rightch=xnode;
  }

  if(ynode!=znode){
    znode->nodekey=ynode->nodekey;
  }
}

Search Suc(Search znode){
  Search judge;

  if(znode->rightch!=Gard){
    return Min(znode->rightch);
  }

  judge=znode->parent;
  while((znode==judge->rightch) && (judge!=Gard)){
    znode=judge;
    judge=judge->parent;
  }

  return judge;
}

Search Min(Search zright){

  while(1){
    if(zright->leftch==Gard)break;

    else{
      zright=zright->leftch;
    }
  }

  return zright;
}



Measured memory_bytes: 20460
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == 500*i + 100*j + 50*k:
                cnt += 1

print(cnt)

Measured memory_bytes: 3060
package main

import (
	"fmt"
	"sort"
)

type sortRunes []rune

func (s sortRunes) Less(i, j int) bool {
	return s[i] < s[j]
}

func (s sortRunes) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func (s sortRunes) Len() int {
	return len(s)
}

func sortString(s string) string {
	r := []rune(s)
	sort.Sort(sortRunes(r))
	return string(r)
}

func main() {
	var N int
	fmt.Scanf("%d", &N)

	c := map[string]int{}

	for i := 0; i < N; i++ {
		var s string
		fmt.Scanf("%s", &s)
		key := sortString(s)
		_, ok := c[key]
		if ok {
			c[key] += 1
			continue
		}
		c[key] = 1
	}

	var total int64
	for _, count := range c {
		if count == 1 {
			continue
		}
		total += int64(count) * (int64(count)-1) / 2
	}

	fmt.Printf("%d", total)
}


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

//表計算を行うプログラム
int main(){
    int r, c, x, i, j, r_sum, c_sum;
    cin >> r >> c;
    int table[101][101] = {};

    i = 0;
    while(i < r){
        j = 0;
        while(j < c){
            cin >> x;
            table[i][j] = x;
            j++;
        }
        i++;
    }

    //行の合計の計算
    i = 0;
    while(i < r){
        r_sum = 0;
        j = 0;
        while(j < c){
            r_sum = r_sum + table[i][j];
            j++;
        }
        table[i][c] = r_sum;
        i++;
    }

    //列の合計の計算
    i = 0;
    while(i <= c){
    	c_sum = 0;
    	j = 0;
    	while(j < r){
    		c_sum = c_sum + table[j][i];
    		j++;
    	}
    	table[r][i] = c_sum;
    	i++;
    }
    
    //出力
    i = 0;
    while(i <= r){
        j = 0;
        while(j < c){
            cout << table[i][j] << " " ;
            j++; 
        }
        cout <<table[i][c] << endl;
        i++;
    }
    return 0;
}


Measured memory_bytes: 3128
n = int(input())
a = list( map(int, input().split()) )	# 1 2 3 4 5 ...

from fractions import gcd

def lcm(a, b):
	return a * b // gcd (a, b)

x=1
for i in range(n):
	x = lcm(x, a[i])

m = x-1
ans=0
for i in range(n):
	ans += m % a[i]

print(ans)



Measured memory_bytes: 5560
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include <bitset>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, ll> pr;

#define MAX 100000

vector<pr> e[MAX];
vector<ll> d(MAX, 0);

void dfs(int s, int p, ll c){
	d[s]=c;
	for(int i=0; i<e[s].size(); i++){
		if(e[s][i].first==p) continue;
		dfs(e[s][i].first, s, d[s]+e[s][i].second);
	}
	return;
}

int main(){
	int n;
	cin >> n;
	for(int i=0; i<n-1; i++){
		int u, v;
		ll w;
		cin >> u >> v >> w;
		e[u-1].push_back(make_pair(v-1, w));
		e[v-1].push_back(make_pair(u-1, w));
	}
	dfs(0,-1,0);
	for(int i=0; i<n; i++) cout << d[i]%2 << endl;
	return 0;
}

Measured memory_bytes: 11008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF= 1LL << 60;
#define REP(i,n) for(ll i=0; i<n; i++)
#define FOR(i,a,n) for(ll i=a; i<n; i++)
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
struct Point{
    int a,b;
};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<Point> Q(m);
    REP(i,m){
        cin >> Q[i].a >> Q[i].b;
    }
    int cnt= 0;
    REP(i,m){
        UnionFind uni(n+1);
        REP(j,m){
            if(i!=j){
                uni.unite(Q[j].a,Q[j].b);
            }
        }
        int f= 1;
        FOR(j,2,n+1){
            if(!uni.same(1,j)) f= 0;
        }
        if(f==0) cnt++;
    }
    cout << cnt << endl;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll N, L;
    cin >> N >> L;

    ll S = 0;
    REP(i, N)
    {
        S += L + i;
    }
    ll s = INF;
    REP(i, N)
    {
        ll t = S - (L + i);
        if (abs(S - s) > abs(S - t))
            s = t;
    }
    cout << s << endl;

    return 0;
}

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

int main(){

  int v[3];
  for(int i=0; i<3; ++i) cin >> v[i];
  sort(v, v+3);
  int ans;
  if(v[0] == v[1] && v[1] == v[2]){
    ans = 0;
  } else if(v[0] == v[1]){
    ans = v[2] - v[1];
  } else if(v[1] == v[2]){
    if((v[1]-v[0]) % 2 == 0){
      ans = (v[1]-v[0])/2;
    } else {
      ans = (v[1]-v[0]+1)/2 + 1;
    }
  } else {
    if((v[1]-v[0]) % 2 == 0){
      ans = (v[1]-v[0])/2 + (v[2]-v[1]);
    } else {
      ans = (v[1]-v[0]+1)/2 + (v[2]-v[1]) + 1;
    }
  }

  cout << ans << endl;

}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  // 整数の入力                                                                                                                                                                                                  
  int a;
  cin >> a;
  int b;
  cin >> b;

  cout << a*a - b << "\n";

  // // スペース区切りの整数の入力                                                                                                                                                                               
  // int b,c;                                                                                                                                                                                                    
  // cin >> b >> c;                                                                                                                                                                                              
  // // 文字列の入力                                                                                                                                                                                             
  // string s;                                                                                                                                                                                                   
  // cin >> s;                                                                                                                                                                                                   
  // // 出力                                                                                                                                                                                                     
  // cout << (a+b+c) << " " << s << endl;                                                                                                                                                                        
  return 0;
}



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

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

    int ans = 1;
    for(int i=2; i<=1000; i++){
        int cnt = 2;
        while(x >= pow(i, cnt)){
            int expo = pow(i, cnt);
            ans = max(ans, expo);
            cnt++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
H = list(map(int, input().split()))
num = 0
max = 0
for i in range(N-1):
    if H[i] >= H[i+1]:
        num += 1
    else:
        if max < num:
            max = num
        num = 0
if max < num:
    max = num
print(max)


Measured memory_bytes: 14252
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;
const int maxN = 1e3;

int mod_pow(int a, int b) {
    if (!b) return 1;
    if (b % 2) return a * mod_pow(a, b - 1) % MOD;
    int q = mod_pow(a, b / 2);
    return q * q % MOD;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> dp(k + 1);
    int ans = 0;
    for (int i = k; i >= 1; i--) {
        int res = mod_pow(k / i, n);
        for (int j = i * 2; j <= k; j += i) {
            res = (res - dp[j] + MOD) % MOD;
        }
        dp[i] = res;
        ans = (ans + res * i % MOD) % MOD;
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //int t;
    //cin >> t;
    int t = 1;
    //srand(time(0));
    while (t--) solve();
}

Measured memory_bytes: 3992
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(S):
    import math
    N = len(S)
    ans = [0] * N
    L = 0
    R = 0
    for i in range(N - 1):
        if S[i] == 'R':
            R += 1
        if S[i + 1] == 'L' and R > 0:
            ans[i] += math.ceil(R / 2)
            ans[i + 1] += math.floor(R / 2)
            R = 0
        if S[N - (i + 1)] == 'L':
            L += 1
        if S[N - (i + 1) - 1] == 'R' and L > 0:
            ans[N - (i + 1)] += math.ceil(L / 2)
            ans[N - (i + 1) - 1] += math.floor(L / 2)
            L = 0
    print(' '.join([str(i) for i in ans]))


if __name__ == '__main__':
    S = input()
    solve(S)


Measured memory_bytes: 17108
#include <iostream>
#include <queue>
#include <tuple>
#include <string>
using namespace std;
bool mtx[60][60];
bool visited[60][60];
int main(){
	int H,W;
	cin>>H>>W;
	int bsum=0;
	for(int i=1;i<=H;++i){
		string s;
		cin>>s;
		for(int j=0;j<s.length();++j){
			if(s[j]=='#'){
				mtx[j+1][i]=true;
				++bsum;
			}
		}
	}
	queue<tuple<int,int,int>> q;
	q.push(make_tuple(1,1,1));
	visited[1][1]=true;
	int x[4]{0,0,-1,1};
	int y[4]{-1,1,0,0};
	while(!q.empty()){
		auto tp=q.front();
		q.pop();
		//cout<<get<0>(tp)<<" "<<get<1>(tp)<<endl;
		if(get<0>(tp)==W&&get<1>(tp)==H){
			//cout<<"@"<<get<2>(tp)<<endl;
			cout<<H*W-get<2>(tp)-bsum<<endl;
			return 0;
		}
		for(int i=0;i<4;++i){
			int xt=get<0>(tp)+x[i],yt=get<1>(tp)+y[i],cnt=get<2>(tp);
			if((xt>=1&&xt<=W)&&
				(yt>=1&&yt<=H)&&
				mtx[xt][yt]!=true&&visited[xt][yt]!=true){
				q.push(make_tuple(xt,yt,cnt+1));
				visited[xt][yt]=true;
			}
		}
	}
	cout<<"-1"<<endl;
	return 0;
}


Measured memory_bytes: 888
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素



signed main(){
  int N,M;
  cin>>N>>M;
  if(N==M)cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
import math
a, b, h, m = map(int, input().split())
theta_long = 6 * m
theta_short = 30 * h + m / 2
theta = theta_short - theta_long
theta = min(theta, (360 - theta))
s = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(theta)))
print(s)

Measured memory_bytes: 9564
def main():

    h,w = map(int,input().split())
    d = []
    for i in range(10):
        a = list(map(int,input().split()))
        d.append(a)
    def WF(d):
        for k in range(10):
            for i in range(10):
                for j in range(10):
                    d[i][j] = min(d[i][j],d[i][k] + d[k][j])
        return d
    WF(d)
    L = []
    for i in range(h):
        b = list(map(int,input().split()))
        L.append(b)
    ans = 0
    for i in range(h):
        for j in range(w):
            if L[i][j] == 1 or L[i][j] == -1:
                continue
            else:
                ans += d[L[i][j]][1]
    print(int(ans))

if __name__ == '__main__':
	main()

Measured memory_bytes: 40668
/*hello! guys~*/
#include<bits/stdc++.h>
using namespace std;

int main()
{
int n,r;
scanf("%d%d",&n,&r);
if(n>=10)
printf("%d\n",r);
else{
	r+=100*(10-n);
	printf("%d\n",r);
}
return 0;
}

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

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

Measured memory_bytes: 580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,k,r,s,p;
  string str;
  cin>>n>>k>>r>>s>>p>>str;
  vector<char> kotae(n);
  for(int i=0; i<n; i++){
    if(str.at(i)=='r'){
      if(i>=k){
        if(kotae.at(i-k)!='p'){
          kotae.at(i)='p';
        }
      }
      else{
        kotae.at(i)='p';
      }
    }
    
    if(str.at(i)=='s'){
      if(i>=k){
        if(kotae.at(i-k)!='r'){
          kotae.at(i)='r';
        }
      }
      else{
        kotae.at(i)='r';
      }
    }
    
    if(str.at(i)=='p'){
      if(i>=k){
        if(kotae.at(i-k)!='s'){
          kotae.at(i)='s';
        }
      }
      else{
        kotae.at(i)='s';
      }
    }
  }
  
  long ans;
  ans=0;
  for(int i=0; i<n; i++){
    if(kotae.at(i)=='r'){
      ans=ans+r;
    }
    if(kotae.at(i)=='s'){
      ans=ans+s;
    }
    if(kotae.at(i)=='p'){
      ans=ans+p;
    }
  }
  cout<<ans;
}

Measured memory_bytes: 512
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cstring>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 305
#define mp make_pair
#define pb push_back
#define ll long long
#define uint unsigned int
#define pii pair<int, int>
#define ull unsigned long long
#define sz(v) ((int)(v).size())
#define foreach(it, v) for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); it++)
#define gc() fgetc(stdin)
template<typename T> void read(T &a) {
	register int b = 1, c; a = 0;
	for (c=gc(); c > 57 || c < 48; c=gc()) if (c == 45) b = -1;
	for (; c >= 48 && c <= 57; c=gc()) a = a * 10 + c - 48;
	a *= b;
}
#ifdef DEBUG
struct Timer {
	int Stime;
	Timer() { Stime = clock(); }
	~Timer() {
		printf("\nTimer Report : Current Running Time = %dms\n", clock() - Stime);
		system("pause");
	}
}Timer0;
#endif

int n;
string s[N * 2];
const ull hshmul = 233, hshmod = 998244353;
ull e[N * 4];

ull pw(ull x, ull y) {
	ull ans = 1;
	while (y) {
		if (y & 1) ans = (ans * x) % hshmod;
		x = (x * x) % hshmod;
		y >>= 1;
	}
	return ans;
}

int main() {
	ull hshmulrev = pw(hshmul, hshmod - 2);
	read(n);
	for (int i = 0; i < n; i++) cin >> s[i];
//	n = 300;
//	for (int i = 0; i < n; i++) s[i] = string(300, 'a');
	for (int i = 0; i < n; i++) s[i] += s[i];
	for (int i = n; i < (n << 1); i++) s[i] = s[i - n];
//	for (int i = 0; i < (n << 1); i++) printf("%s\n", s[i].c_str());
	e[0] = 1;
	for (int i = 1; i <= (n << 2); i++) e[i] = (e[i-1] * hshmul) % hshmod;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ull hsh[N * 4], hshback[N * 4];
		memset(hsh, 0, sizeof hsh);
		memset(hshback, 0, sizeof hshback);
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				hsh[j + k] = ((hsh[j + k] * hshmul) % hshmod + s[j + i][k]) % hshmod;
		for (int j = n-1; j >= 0; j--)
			for (int k = 0; k < n; k++)
				hshback[j + k] = ((hshback[j + k] * hshmul) % hshmod + s[j + i][k]) % hshmod;
		for (int j = 0; j < n; j++) {
			bool flag = 1;
			for (int k = 0; k < (n << 1) - 1; k++) {
				if (hsh[k] != hshback[k]) {
					flag = 0;
					break;
				}
			}
//			printf("%d %d\n", i, j);
//			for (int k = 0; k < (n << 1) - 1; k++) printf("%d %llu %llu\n", k, hsh[k], hshback[k]);
			if (flag) ans++;
			for (int k = 0; k < n; k++) {
				hshback[k] = (hshback[k] - (e[k] * s[i + k][j]) % hshmod + hshmod) % hshmod;
				hsh[k] = ((hsh[k] - s[i + k][j]) % hshmod + hshmod) % hshmod * hshmulrev % hshmod;
			}
//			for (int k = 0; k < (n << 1) - 1; k++) printf("%d %llu %llu\n", k, hsh[k], hshback[k]);
//			if (j != n - 1) if (hsh[0] || hshback[0]) printf("ERROR\n");
			for (int k = 0; k < (n << 1) - 2; k++) hsh[k] = hsh[k + 1], hshback[k] = hshback[k + 1];
			hsh[(n << 1) - 2] = hshback[(n << 1) - 2] = 0;
			for (int k = 0; k < n; k++) {
				hshback[k + n - 1] = ((hshback[k + n - 1] * hshmul) % hshmod + s[i + k][j + n]) % hshmod;
				hsh[k + n - 1] = (hsh[k + n - 1] + (e[n - 1 - k] * s[i + k][j + n]) % hshmod) % hshmod;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


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


int main(){
//A
/*
string s;
cin>>s;
if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
*/
//B
ll X;cin>>X;
ll x;
x=X%500;
//cout<<X/500*1000<<endl;
//cout<<x<<endl;
cout<<X/500*1000+x/5*5<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int b[201],n,ans;
inline void pre(){
	for(int i=1;i<=n;++i){
		for(int j=i;j<=n;j+=i){
			++b[j];
		}
		if((i&1)&&b[i]==8)ans++;
	}
}
int main(){
	scanf("%d",&n);
	pre();
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <queue>
#include <vector>
#include <set>


using namespace std;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

template<class T> inline bool chmin(T& a, T b) {
  //aの方が大きければbに値を更新、そうでなければ何もしない
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
bool compare_a_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが小さい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second < r.second;
  }
}
bool compare_a_b_big(pair<int,int> l,pair<int,int> r){
  //firstが大きい方からソート、firstが同じならbが大きい方から
  if(l.first != r.first){
    return l.first>r.first;
  }
  else{
    return l.second > r.second;
  }
}
bool compare_b_small(pair<int,int> l,pair<int,int> r){
  //secondが小さい方からソート、firstが同じならfirstが小さい方から
  if(l.second != r.second){
    return l.second<r.second;
  }
  else{
    return l.first < r.first;
  }
}
const int INF = 1e9;




int main(){
  long long int n;
  cin >> n;
  long long int i;
  for(i=sqrt(n)/1;i>=1;i--){
    if(n%i==0) break;
  }
  cout << i + (n/i) -2<< endl;




}


Measured memory_bytes: 256
#bin/usr/env python3

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

total_len = 0
for i in range(n):
    total_len += int(length[i])
    if total_len > x:
        print(i+1)
        break
    if i == n-1:
        print(n+1)





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

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

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

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

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

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

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

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

const BIG_STACK_SIZE: bool = true;

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

fn solve() {
    let (n, k) = get!(usize, usize);
    println!("{}", n-k+1);
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    int K, N; cin >> K >> N;
    vector<int> A(N); REP(i, N) cin >> A[i];

    int max_n = 0;
    for(int i = 0; i < N; ++i) {
        int b = A[i] - A[i - 1];
        if(max_n < b) {
            max_n = b;
        }
    }

    int b = 0;
    if(A[0] == 0) {
        b = K - A[N - 1];
    } else {
        b = A[0] + (K - A[N - 1]);
    }
    if(max_n < b) {
        max_n = b;
    }

    cout << K - max_n << endl;
}

Measured memory_bytes: 1024
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s, t = read().decode('utf8').split()
S=''.join(sorted(s))
T=''.join(sorted(t))

print('Yes' if S < T[::-1] else 'No')


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

int main(){
  int n,m,c,k=0;
  cin>>n>>m>>c;
  vector<int>b(m);
  for(int i=0;i<m;i++){
    cin>>b[i];
  }
  vector<vector<int>>a(n,vector<int>(m));
  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++){
    int nm=c;
    for(int j=0;j<m;j++){
      nm+=b[j]*a[i][j];
    }
    if(nm>0){
      k++;
    }
  }
  cout<<k<<endl;
}


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

count = 0

for i in range(n):
    ni0 = min(a[i], b[i])
    ni1 = min(a[i+1],b[i]-ni0)
    a[i] -= ni0
    a[i+1] -= ni1
    count += ni0+ni1

print(count)

Measured memory_bytes: 19116
#include <cstdio>
typedef long long ll;
int N;
ll L[87];
int main ()
{
    scanf("%d",&N);
    L[0]=2LL,L[1]=1LL;
    for(int i=2;i<=N;i++)L[i]=L[i-2]+L[i-1];
    printf("%lld\n",L[N]);
}

Measured memory_bytes: 128
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
C.count(0)>1 and S.each {|s|
  26.times {|i| if s[i]==0 && i!=(z||=i); s[z]<s[i] ? (s[z]=0; z=i) : (s[i]=0) end }
}
L,M,N = [-1]*27,3,5
def calc(d,n)
  s = S[d]
  t = (0..25).map {s[_1] > 0 ? C[_1]*(d-L[_1])+s[_1] : 0}
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    next t[i]  if n == 0 || d+1 >= D || t[i] == 0
    l,L[i] = L[i],d
    calc(d+1,n-1)[1].tap {L[i]=l}
  }
  [i, t[i]]
end
D.times { p 1 + i=calc(_1,N)[0]; L[i]=_1 }

Measured memory_bytes: 14720
n,k=map(int,input().split())
d=list(input().split())
x=list(range(1,100000)[::-1])
for i in d:
  a=[]
  for j in x:
    if i not in str(j):
      a.append(j)
  x=a
import bisect as bi
x=x[::-1]
print(x[bi.bisect_left(x,n)])

Measured memory_bytes: 45292