akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;


vvll dp(3005, vll(3005));

int main() {
    string s, t; cin >> s >> t;
    int n = s.size(), m = t.size();
    rep(i, n) {
        rep(j, m) {
            if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
            else dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
        }
    }

    //dp[n][m]がLCSの長さ

    int k = n, l = m;
    string ans = "";
    while (k > 0 && l  > 0) {
        if (dp[k][l] == dp[k - 1][l]) k--;
        else if (dp[k][l] == dp[k][l - 1]) l--;
        else {
            ans = s[k - 1] + ans;
            k--, l--;
        }
    }

    cout << ans << endl;

}


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



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

    long long int 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;

    cin>>m>>n;
    vector <long long int> v1;
    for(i=0;i<n;i++)
    {
        cin>>a;
        v1.push_back(a);
    }
    c=INT_MAX;
    for(i=0;i<n;i++)
    {
        if(i==0)
        {
            a=v1[n-1]-v1[0];
        }
        else
        {
            a=v1[n-1]-v1[i]+v1[i-1]+(m-v1[n-1]);
        }
        c=min(c,a);
    }
    cout<<c<<"\n";
    return 0;


}


Measured memory_bytes: 2420
((input: string): void => {
    const h: number[] = input.split(/\n/)[1].split(" ").map(Number);
    const hoge = h.filter(
        (_, i) => (
            (foo: number[]) => Math.max(...foo) == foo.slice(-1)[0]
        )(h.slice(0, i+1))
    )
    console.log(hoge.length);
})(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = unsigned long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
int const mod = 1e9+7;
#define END {cout<<END<<'\n'; return 0;}
#define ALL(vec) vec.begin(),vec.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,s,n) for(int i=s; i<n; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,(n)-1)cout<<a[i]<<' '; cout<<a[(n)-1]<<'\n';
template<class T> inline bool cmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool cmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int n,m,q,_,x,y;
string s,sb;
bool ok;
char ch;

Int dp[4001][4001];
int k[4001][4001];

int main(){
  cin.tie(nullptr); ios::sync_with_stdio(0);
  
  cin>>n; Int a[n],s[n+1]={}; rep(i,n){cin>>a[i]; s[i+1]=a[i]+s[i];}
  fill(dp[0],dp[4001],1e18);
  rep(i,n-1){dp[i][i+2]=a[i]+a[i+1]; k[i][i+2]=i+1;}
  rep(i,n)dp[i][i+1]=0;
  rer(h,3,n+1)rep(i,n+1-h){
    int id=k[i][i+h-1];
    rer(j,k[i][i+h-1]+1,k[i+1][i+h]+1)if(dp[i][j]+dp[j][i+h]<dp[i][id]+dp[id][i+h])id=j;
    k[i][i+h]=id;
    dp[i][i+h]=dp[i][id]+dp[id][i+h]+s[i+h]-s[i];
  }
  pri1(dp[0][n]);
}



Measured memory_bytes: 173500
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int D = sc.nextInt();
    
    String ans = "Balanced";
    if (A + B > C + D) {
      ans = "Left";
    } else if (A + B < C + D) {
      ans = "Right";
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
n,x= map(int,input().split())
from collections import deque
if x == 2*n-1 or x == 1:
  print("No")
else:
  print("Yes")
  ans = deque([])
  ans.append(x)
  ans.appendleft(1)
  ans.append(2*n-1)
  for i in range(2,n):
    if x != i:
      ans.append(i)
    if x != 2*n-i:
      ans.appendleft(2*n-i)
  if x != n and x>n:
    ans.appendleft(n)
  if x != n and x<n:
    ans.append(n)
  for i in ans:
    print(i)

Measured memory_bytes: 54236
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break

    for i in range(H):
        if i == 0 or i == H - 1:
            print("#" * W)
        else:
            print("#" + "." * (W - 2) + "#")
    print("")



Measured memory_bytes: 5612
H1, M1, H2, M2, K = map(int, input().split())

if (H1*60+M1) <= (H2*60+M2):
    if (H2*60+M2) - (H1*60+M1) >= K:
        print((H2*60+M2) - (H1*60+M1) - K)
    else:
        print(0)
else:
    if (24*60) + (H2*60+M2) - (H1*60+M1) >= K:
        print((24*60) + (H2*60+M2) - (H1*60+M1) - K)
    else:
        print(0)

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

int main() {
  int K, N;
  cin >> K >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    int d;
    cin >> d;
    v.at(i) = d;
  }
  priority_queue<int> q;
  q.push(K + v.at(0) - v.at(N - 1));
  for (int i = 0; i < N - 1; i++) {
    q.push(v.at(i+1) - v.at(i));
  }
  cout << K - q.top() << endl;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
# define mod 1000000007
# define INF (1 << 29)
/* ちゃんと考えて実装して問題なくACできた時嬉しいよ！！ */

int main(void){
    int n;
    string s;
    cin >> n;
    cin >> s;
    if(n % 2 != 0){
        cout << "No";
    }
    else{
        int flag = 0;
        for(int i=0; i<n/2; i++){
            if(s[i] != s[i+(n/2)]){
                flag = 1;
            }
        }
        if(flag == 0){
            cout << "Yes";
        }
        else{
            cout << "No";
        }
    }
    return 0;
}

Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const A = parseInt(arg[0].split(" ")[0]);
    const P = parseInt(arg[0].split(" ")[1]);
    
    console.log(Math.floor(((A * 3) + P) / 2));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<stdio.h>
int main(void){
  int A;
  int B;
  scanf("%d",&A);
  scanf("%d",&B);
  if(((A==1)&&(B==2))||((A==2)&&(B==1))){
    printf("%d",3);
  }
  if(((A==2)&&(B==3))||((A==3)&&(B==2))){
    printf("%d",1);
  }
  if(((A==1)&&(B==3))||((A==3)&&(B==1))){
    printf("%d",2);
  }
}

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

int main(){
  int n,b[50][3][2];
  cin>>n;
  for(int i=0;i<n;i++)
    for(int j=0;j<3;j++)
      for(int k=0,h,m;k<2;k++)
	cin>>h>>m,b[i][j][k]=h*60+m;
  int ans=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      for(int k=0;k<n;k++){
	int res=0;
	for(int p=0;p<n;p++){
	  if(b[p][0][0]<=b[i][0][1]&&b[i][0][1]<=b[p][0][1]&&
	     b[p][1][0]<=b[j][1][1]&&b[j][1][1]<=b[p][1][1]&&
	     b[p][2][0]<=b[k][2][1]&&b[k][2][1]<=b[p][2][1])res++;
	}
	ans=max(ans,res);
      }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if(a + b > c + d){
    cout << "Left" << endl;
  }
  else if(a + b < c + d){
    cout << "Right" << endl;
  }
  else
    cout << "Balanced" << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a, b, c, i, ans = 0;
	scanf("%d%d%d", &a, &b, &c);

	for(i = a; i <= b; i++) {
		if(c % i == 0) ans++;
	}

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

	return 0;
}



Measured memory_bytes: 2100
n = int(input())
slist = [int(input()) for _ in range(n)]
total = sum(slist)

if total % 10 != 0:
    print(total)
    exit()
else:
    nonten = []
    for i in range(n):
        if slist[i] % 10 != 0:
            nonten.append(slist[i])
    if len(nonten) == 0:
        print(0)
    else:
        nonten = sorted(nonten)
        total -= nonten[0]
        print(total)

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

using namespace std;
int nine[5]={0,9,99,999,9999};
int dg(int tn)
{
    if(tn/10==0)
        return 0;
    return tn%10+dg(tn/10)*10;
}
int main()
{
    int n;
    cin >> n;
    int tn=n,cnt=0,th=-1,tb=-1,tz=0;
    tz=dg(n/10);
    while(tn)
    {
        cnt++;
        if(tb==-1)tb=tn%10;
        th=tn%10;
        tn/=10;
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(i%10==0)continue;
        int h,b,ti=i;
        h=b=-1;
        while(ti)
        {
            if(h==-1)
                h=ti%10;
            b=ti%10;
            ti/=10;
        }
        if(h==b)
            ans++;
        for(int j=2;j<=cnt;j++)
        {
            int t=h;
            for(int k=1;k>j;k++)
            {
                t*=10;
            }
            t+=b;
            if(t>n)
                break;
            if(j!=cnt)
                ans+=nine[j-2]+1;
            else
            {
                if(h<th)
                {
                    ans+=nine[j-2]+1;
                }
                else if(h==th)
                {
                    ans+=tz-(b>tb)+1;
                }
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
def gcd(a, b) :
    if (a == 0) :
        return b
        
    return gcd(b % a, a)
 
# Function to return LCM of two numbers
def lcm(a,b):
    return (a*b) // gcd(a,b)
 
# Driver program to test above function

n=int(input())
ans=0
arr=list(map(int,input().split()))
if(n==1):
    print(arr[0]-1)
else:
    z=lcm(arr[0],arr[1])
    i=2
    while(i<n):
        z=lcm(z,arr[i])
        i+=1
ans=0
for i in range(n):
    ans+=((z-1)%arr[i])
print(ans)


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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int m1, d1, m2, d2;
  cin >> m1 >> d1 >> m2 >> d2;
  if (m1 != m2) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0
#define br break
#define con continue;
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
int main()
{
    ios;
    unordered_map<string,ll> mpp;
    ll n ;
    cin >> n ;
    string s ;
    cin >> s ;
    mpp[s]++;
    string prev = s;
    ll foo = -1;
    forn(i , 2 , n ){
       string ss ;
       cin >> ss;
       if(mpp[ss]!=0){
          foo = 0 ;
       }
       else if(mpp[ss]==0){
          if(ss[0] != prev[prev.length()-1]){
            foo = 0;
          }
          else {
            prev = ss ;
            mpp[ss]++;
          }
       }
    }
    if(foo == 0){
        cout <<"No\n";
        ro;
    }
    else cout <<"Yes\n";
    ro ;
}























Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	string S; cin >> S;
	int C = S.size();
	if (S[0] == S[S.size() - 1])C++;
	if (C % 2 == 1)cout << "First" << endl;
	else cout << "Second" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<int, int, int, int> tp;
///-------------------------

int main()
{
    Phuong_; /// <3333
    int n;
    ll k;
    cin >> n >> k;
    vector<int> a(n);
    for(int &x:a){
        cin >> x;
        x--;
    }
    vector<int> dis(n,-1);
    int head=0;
    dis[head]=0;
    while (dis[a[head]]==-1 && k>0)
    {
        k--;
        dis[a[head]]=dis[head]+1;
        head=a[head];
    }
    if (k==0) cout << head+1; else
    {
        ll len = dis[head]- dis[a[head]]+1;
        k%=len;
        if (k<0) k+=len;
        while (k>0){
            k--;
            head=a[head];
        }
        cout << head+1;
    }
    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second

#define DUMP(x) cout<<#x<<":"<<(x)<<endl
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class T>
istream& operator>>(istream& is, vector<T>& xs){
  for(auto& x: xs)
	is >> x;
  return is;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
ostream& operator<<(ostream& os, const vector<T>& xs){
  for(unsigned int i=0;i<xs.size();++i)
	os << (i?" ":"") << xs[i];
  return os;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int N;

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

  cin >> N;
  VS vs(N);
  cin >> vs;

  int ans = 0;
  REP(x,N){
	bool ok = true;
	REP(y,N) REP(x,N){
	  if(vs[y][x] != vs[x][y]){
		ok = false;
		break;
	  }
	}
	if(ok) ++ans;

	REP(y,N){
	  auto bk = vs[y][0];
	  REP(x,N-1){
		vs[y][x] = vs[y][x+1];
	  }
	  vs[y][N-1] = bk;
	}
  }

  cout << ans*N << endl;

  return 0;
}


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

int main() {
        static const double pi = 3.141592653589793;
        double a, b, h, m, hhari, mhari, cdeg;
        cin >> a >> b >> h >> m;

        hhari = (m / 60.0) * 360.0;
        mhari = 30.0 * h + (m /60.0) * 30.0;

        if (hhari - mhari >= 0) {
                cdeg = hhari - mhari;
//              crad = cdeg / (180/pi);
        }
        else {
                cdeg = mhari - hhari;
        }

        double crad = cdeg / (180/pi);

        double c = sqrt(a * a + b * b - 2.0 * a * b * cos(crad));
        //cout << c << endl;
        cout << fixed << setprecision(20) << c << endl;
}

Measured memory_bytes: 4236
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    vector<int> v(1000,0);
    
    for(int i=a;i<b;i++)v[i]++;
    for(int i=c;i<d;i++)v[i]++;
    
    int ans = 0;
    rep(i,v.size())if(v[i]==2)ans++;
    
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <queue>
#include <climits>
#include <set>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ve vector
#define umap unordered_map
#define iter iterator
ll dp[87];

void solve() {
    dp[0] = 2;
    dp[1] = 1;
    ll n;cin>>n;
    for(int i=2;i<=n;i++) {
        dp[i] = dp[i-1] + dp[i-2];
    }
    cout << dp[n] << endl;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e9 + 7, MOD = 1e9 + 7;
const long long LINF = 1e18;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	if (a[0] != 0) {
		cout << -1 << endl;
		return 0;
	}
	int tmp = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] > i) {
			cout << -1 << endl;
			return 0;
		}
	}
	int cmp = 0;
	for (int i = 0; i < n - 1; i++) {
		if (a[i + 1] == a[i] + 1) {
			cmp = a[i + 1];
		} else if (a[i] == a[i + 1]) {
			tmp += cmp;
		} else if (a[i] > a[i + 1]) {
			tmp += cmp;
			cmp = a[i + 1];
		} else if (a[i + 1] - a[i] > 1) {
			// if (i - a[i + 1] > a[i + 1] - a[i]) {
			// 	tmp += cmp;
			// 	cmp = a[i + 1];
			// } else {
			// 	cout << -1 << endl;
			// 	return 0;
			// }
			cout << -1 << endl;
			return 0;
		}
		// cout << "i:" << i << " tmp:" << tmp << endl;
	}
	cout << tmp + cmp << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

ll DP[100100];

int main(){
    ll H, N;
    cin >> H >> N;
    vector<ll> A(N);
    vector<ll> B(N);
    REP(i,N){
        ll a, b;
        cin >> a >> b;
        A[i] = a;
        B[i] = b;
    }

    MEMS(DP, 1000000);
    DP[0] = 0;
    REP(k,1e5){
        REP(i,N){
            ll a = A[i];
            ll b = B[i];
            ll next = min(k+a, H);
            chmin(DP[next], DP[k] + b);
        }
    }

    //REP(i,H+1){
    //    printf("%d : %lld\n", i, DP[i]);
    //}

    ll ans = 0;
    ans = DP[H];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <utility>
#include <vector>
using namespace std;
using W = double;
using P = complex<W>;
using L = pair<P,P>;
using C = pair<P,W>;

#define X real()
#define Y imag()
constexpr W EPS = 1e-10, INF = 1e10;

W dot(const P &a, const P &b){ return a.X*b.X + a.Y*b.Y; }
W cross(const P &a, const P &b){ return a.X*b.Y - a.Y*b.X; }
P projection(P a, P b){ return dot(a,b)/norm(b)*b; }

W pl_dist(P a, L s){
  P sf = s.first, ss = s.second;
  return abs(cross(sf-ss,a-ss))/abs(sf-ss);
}

vector<P> cpcl(C c, L l){
  W d = pl_dist(c.first,l), r = c.second;
  P lf = l.first, ls = l.second;
  P m = lf + projection(c.first-lf,ls-lf);
  P x = sqrt(r*r-d*d)/abs(ls-lf)*(ls-lf);
  vector<P> cp(2,m);
  cp[0] -= x;
  cp[1] += x;
  return cp;
}

int main(){
  int N;
  cin >> N;
  vector<W> R(N);
  vector<P> V;
  for(int i = 0; i < N; ++i){
    W x;
    cin >> x >> R[i];
    V.emplace_back(x,0);
  }
  W ok = 0, ng = INF;
  for(int i = 0; i < 100; ++i){
    W h = (ok+ng)/2;
    W maxL = -INF, minR = INF;
    bool f = true;
    L l(P(0,h),P(10,h));
    for(int j = 0; j < N; ++j){
      if(pl_dist(V[j],l) > R[j] + EPS){
        f = false;
        break;
      }
      vector<P> cps = cpcl(C(V[j],R[j]),l);
      W l = cps[0].X, r = cps[1].X;
      if(l > r) swap(l,r);
      maxL = max(maxL,l);
      minR = min(minR,r);
    }
    if(minR < maxL)
      f = false;
    if(not f){
      ng = h;
    }else{
      ok = h;
    }
  }
  printf("%.12f\n",(ok+ng)/2);
}



Measured memory_bytes: 5788
#include <bits/stdc++.h>
#define ll long long 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int MAXN=2e5;
int main(){
	IOS;
	
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
	
	}

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

int main(){
  int A, B, C;
  cin>>A>>B>>C;
  if((A==B||B==C||C==A)&&(A!=B||B!=C)){
      cout<<"Yes"<<endl;
  }
  else{
      cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dfs(int x, int y, int h, int w, int col, int st, vvi &p) {
  int cnt = 1;
  for(int i=0;i<4;++i) {
    int nx = x + dx[i], ny = y + dy[i];
    if(!(0 <= nx && nx < h && 0 <= ny && ny < w)) continue;
    if(p[nx][ny] == st) {
      p[nx][ny] = col;
      cnt += dfs(nx, ny, h, w, col, st, p);
    }
  }
  return cnt;
}
int solve(int h, int w, int c, int cnt, int col, vvi p) {
  if(cnt == 0) {
    int ma = 0;
    for(int i=1;i<=6;++i) {
      ma = max(ma, solve(h, w, c, cnt+1, i, p));
    }
    return ma;
  } else if(cnt == 5) {
    int st = p[0][0];
    p[0][0] = c;
    if(st != c) dfs(0, 0, h, w, c, st, p);
    return dfs(0, 0, h, w, 0, c, p);
  } else {
    int st = p[0][0];
    p[0][0] = col;
    if(st != col) dfs(0, 0, h, w, col, st, p);
    int ma = 0;
    for(int i=1;i<=6;++i) {
      ma = max(ma, solve(h, w, c, cnt+1, i, p));
    }
    return ma;
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  while(1) {
    int h, w ,c; cin >> h >> w >> c;
    if(h == 0) break;
    vvi p(h, vi(w, 0));
    for(int i=0;i<h;++i) {
      for(int j=0;j<w;++j) {
        cin >> p[i][j];
      }
    }
    if(h == 1 && w == 1) cout << 1 << endl;
    else cout << solve(h, w, c, 0, 0, p) - 1 << endl;
  }
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

signed main() {
    string s, t;
    cin >> s >> t;
    int cnt = 0;
    for (int i = 0; i < sz(s); i++) {
        if (s[i] == t[i]) cnt++;
    }
    cout << cnt << "\n";
}



Measured memory_bytes: 256
#include<stdio.h>
main(){
	int m,f,r;

	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if(m == -1 && f == -1 && r == -1) break;
		if(m == -1 || f == -1){
			printf("F\n");
		}
		else{
			if(m+f >= 80){
				printf("A\n");
			}
			if(m+f < 80 && m+f >= 65){
				printf("B\n");
			}
			if(m+f < 65 && m+f >= 50){
				printf("C\n");
			}
			if(m+f < 50 && m+f >= 30){
				if(r >= 50){
					printf("C\n");
				}
				else{
					printf("D\n");
				}
			}
			if(m+f < 30){
				printf("F\n");
			}
		}
	}
}

Measured memory_bytes: 1016
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.nextLine());
    String[] S = sc.nextLine().split(" ");
    int sum = 0;
    int[] num = new int[N+1];
    for(int i = 1; i <= N; i++){
      num[i] = Integer.parseInt(S[i-1]);
      sum += Math.abs(num[i]-num[i-1]);
    }
    sum += Math.abs(num[N]);
    for(int i = 1; i <= N; i++){
      int ans = sum;
      if(i != N){
        ans = ans - Math.abs(num[i]-num[i-1]) - Math.abs(num[i]-num[i+1]) + Math.abs(num[i-1]-num[i+1]);
      }else{
        ans = ans -  Math.abs(num[i]-num[i-1]) - Math.abs(num[N]) + Math.abs(num[N-1]);
      }
      System.out.println(ans);
    }
  }
}

Measured memory_bytes: 61748
#include <iostream>

using namespace std;

constexpr int Z = 1e9+7;

int mpow(int a, int x) {
    int r = 1;
    for (int i = 0; i < x; i++) {
        r = 1ll * r * a % Z;
    }
    return r;
}

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

    int n;
    cin >> n;

    cout << (0ll + mpow(10, n) - mpow(9, n) - mpow(9, n) + mpow(8, n) + 2 * Z) % Z << endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    string ans = "ARC";
    if (n < 1200) ans = "ABC";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int mod;
typedef long long ll;
int n,phi,dp[100005],ans[100005];
vector<int>g[100005];
void dfs1(int x,int par){
	int mul=1;
	for(auto to:g[x]){
		if(to!=par){
			dfs1(to,x);
			mul=(ll)mul*(dp[to]+1)%mod;
		}
	}
	if(g[x].size()>1||par==-1)dp[x]=(mul)%mod;
	else dp[x]=1;
}
void dfs2(int x,int par){
	ans[x]=dp[x];
	vector<int>son;
	for(auto to:g[x])son.push_back(dp[to]+1);
	vector<int>pre(son.size()+3),suf(son.size()+3);
	suf[son.size()]=1;
	for(int i=0;i<son.size();i++)pre[i]=(ll)(i==0?1:pre[i-1])*son[i]%mod;
	for(int i=son.size()-1;i>=0;i--)suf[i]=(ll)suf[i+1]*son[i]%mod;
	int pos=0;
	for(auto to:g[x]){
		if(to==par){
			pos++;
			continue;
		}
		int val=(ll)(pos==0?1:pre[pos-1])*(pos==g[x].size()-1?1:suf[pos+1])%mod;
		int dpto=dp[to],dpx=dp[x];
		dp[x]=val;
		dp[to]=(ll)dp[to]*(dp[x]+1)%mod;
		if(to!=par)dfs2(to,x);
		dp[x]=dpx;dp[to]=dpto;
		pos++;
	}
}
signed main(){
	scanf("%lld%lld",&n,&mod);
	phi=mod;int tmp=mod;
	for(int i=2;i*i<=tmp;i++){
		if(tmp%i==0)phi=phi/i*(i-1);
		while(tmp%i==0){
			tmp/=i;
		}
	}
	for(int i=1;i<n;i++){
		int a,b;
		scanf("%lld%lld",&a,&b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	dfs1(1,-1);
	dfs2(1,-1);
	for(int i=1;i<=n;i++)printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 29056
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    StringBuffer a = new StringBuffer(N);
    String b = a.reverse().toString();
    if(N.equals(b)){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
    int n,i;
    cin>>n;
    string s[n],str[n];
    int maxi=-1,c=0;
    map<string ,int> mp;
    set<string> st;
    for(i=0;i<n;i++)
    {
        cin>>s[i];
        mp[s[i]]++;
    }
    for(i=0;i<n;i++)
    {
        maxi=max(mp[s[i]],maxi);
    }
    for(i=0;i<n;i++)
    {
        if(mp[s[i]]==maxi)
        {
            st.in(s[i]);
            c++;
        }
    }
   for(auto it=st.begin();it!=st.end();it++)
    cout<<*it<<e;
}


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


int main(){
    for (int i = 0; i < 3; i++){
	int h, m, s;
	cin >> h >> m >> s;
	int sec = -(h * 3600 + m * 60 + s);
	cin >> h >> m >> s;
	sec += 3600 * h + m * 60 + s;

	int hour = sec / 3600;
	sec -= hour * 3600;
	int minutes = sec / 60;
	sec -= minutes * 60;
	cout << hour << " " << minutes << " " << sec << endl;
    }
}

Measured memory_bytes: 1160
# include <cmath>
# include <iostream>
# include <queue>
# include <set>
# include <stack>
# include <string>
# include <vector>


using namespace std;


const int INF = 1001001001;


int main() {
    int h, w; cin >> h >> w;

    vector<vector<char>> s(h, vector<char>(w, 'z'));
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            cin >> s[i][j];
        }
    }

    vector<vector<int>> g(h*w, vector<int>(h*w, INF));
    for (int i=0; i<h*w; i++) {
        g[i][i] = 0;
    }

    for (int i=0; i<h; i++) {

        for (int j=0; j<w; j++) {
            if (s[i][j] == '#') continue;

            if (j!=0 and s[i][j-1] == '.') {
                g[(i*w)+j][(i*w)+j-1] = 1;
                g[(i*w)+j-1][(i*w)+j] = 1;
            }

            if (j!=w-1 and s[i][j+1] == '.') {
                g[(i*w)+j][(i*w)+j+1] = 1;
                g[(i*w)+j+1][(i*w)+j] = 1;
            }

            if (i!=0 and s[i-1][j] == '.') {
                g[((i-1)*w)+j][(i*w)+j] = 1;
                g[(i*w)+j][((i-1)*w)+j] = 1;
            }

            if (i!=h-1 and s[i+1][j] == '.') {
                g[((i+1)*w)+j][(i*w)+j] = 1;
                g[(i*w)+j][((i+1)*w)+j] = 1;
            }
        }
    }

    for (int k=0; k<h*w; k++) {
        for (int i=0; i<h*w; i++) {
            for (int j=0; j<h*w; j++) {
                g[i][j] = min(g[i][j], g[i][k]+g[k][j]);
            }
        }
    }


    int ans = -INF;
    for (int i=0; i<h*w; i++) {
        for (int j=0; j<h*w; j++) {
            if (g[i][j] == INF) continue;
            ans = max(ans, g[i][j]);
        }
    }

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



Measured memory_bytes: 1528
#include "bits/stdc++.h"

using namespace std;
using LL = long long;

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

    string s;
    cin >> s;
    int n = s.size();

    bool ok = true;
    for (int i = 0; i < n; i ++) {
        if (i % 2 == 0) {
            if (s[i] == 'L') ok = false;
        } 
        else {
            if (s[i] == 'R') ok = false;
        }
    }
    cout << (ok? "Yes" : "No") << endl;
}

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

using namespace std;

int main()
{
	long long H;
	cin >> H;

	long long res = 0;
	long long _tmp = 1;
	while (H >= 1)
	{
		res += _tmp;
		H /= 2;
		_tmp *= 2;
	}

	cout << res << endl;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x"=" << x <<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3

#define MAX_N 1000000001

int main(){
	cin.sync_with_stdio(false);
	int n, k;
	cin >> n >> k;

	bool dislike[10];
	rep(i, 10) {
		dislike[i] = false;
	}

	rep(i, k) {
		int dis;
		cin >> dis;
		dislike[dis] = true;
	}


	string s = "";
	bool ok = true;
	repl(i, n, n * 10) {
		ok = true;
		s = to_string(i);
		rep(i, s.size()) {
			if (dislike[s[i] - '0']) {
				ok = false;
				break;
			}
		}
		if (ok) break;
	}

	cout << s << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # xの根を返す
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # xとyを統合する
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    # xとyが同じグループかどうか判定する
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xのメンバーの要素を返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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

uf = UnionFind(N)
FRIEND = [0] * N

for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1

    uf.union(a, b)
    FRIEND[a] += 1
    FRIEND[b] += 1

BLOCK = [0] * N

for _ in range(K):
    c, d = map(int, input().split())
    c, d = c - 1, d - 1

    if uf.same(c, d):
        BLOCK[c] += 1
        BLOCK[d] += 1


ANS = []
for i in range(N):
    r = uf.size(i)
    r -= FRIEND[i]
    r -= BLOCK[i]
    r -= 1
    ANS.append(str(r))

print(' '.join(ANS))


Measured memory_bytes: 16836
n, m = gets.split.map(&:to_i)
arr = [0] + gets.split.map(&:to_i)

flag = Array.new(n+1, true)
flag[0] = false
m.times do
  a, b = gets.split.map(&:to_i)
  ind = arr[a] < arr[b] ? a : b
  flag[ind] = false
  flag[a] = false if arr[a] == arr[b]
end
puts flag.select{|a| a}.count

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin>>s;
    for(auto i=0;i<s.size();++i)
        cout<<"x";
    return 0;
}

Measured memory_bytes: 256
def main():
    N, M, C = map(int, input().split())
    B = [int(i) for i in input().split()]
    count = 0
    for i in range(N):
        A = [int(i) for i in input().split()]
        total = 0
        for j in range(M):
            total += A[j] * B[j]
        total += C
        if total > 0:
            count += 1
    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
h,w = map(int,input().split())
x = 0
y = 0
time = 0
cou = 0
lis = ""
for i in range(h):lis += str(input())
for i in range(h * w):
    if lis[i] == "#":
        cou += 1
for i in range(h):
    while lis[i * w + x] == "#" and y == 0:
        x += 1
        time += 1
        if x == w:
            x -= 1
            y = 1
    if i == h-1 and time == (h + w)-1 and time == cou:
        print("Possible")
        exit()
    time += 1
print("Impossible")

Measured memory_bytes: 3064
def ri():
    return int(input())


def rii():
    return [int(v) for v in input().split()]


def solve():
    X, N = rii()
    P = set(rii())
    n = m = float("inf")
    if not P:
        print(X)
        return

    for i in range(min(P)-1, max(P)+2):
        if i not in P:
            d = abs(i - X)
            if d == m:
                n = min(n, i)
            elif d < m:
                m = d
                n = i
    
    print(n)



if __name__ == "__main__":
    solve()

Measured memory_bytes: 9152
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	int n, k;
	cin >> n >> k;
	if(k == 1)
		cout << "0\n";
	else
		cout << n - k << "\n";
	return 0;
}

Measured memory_bytes: 256
class BIT():

    __slots__ = ["n", "data"]

    def __init__(self, li):
        self.n = len(li) + 1
        self.data = [0] + li
        for i in range(1, self.n):
            if i + (i & -i) < self.n:
                self.data[i + (i & -i)] += self.data[i]

    def add(self, i, a):
        i += 1
        while i < self.n:
            self.data[i] += a
            i += i & -i
        
    def acc(self, i):
        res = 0
        while i > 0:
            res += self.data[i]
            i -= i & -i
        return res
    
    def fold(self, l, r):
        res = 0
        while l < r:
            res += self.data[r]
            r -= r & -r
        while r < l:
            res -= self.data[l]
            l -= l & -l
        return res

import sys
input = sys.stdin.buffer.readline
n, q = map(int, input().split())
A = list(map(int, input().split()))
bit = BIT(A)
for _ in range(q):
    t, p, x = map(int, input().split())
    if t == 0:
        bit.add(p, x)
    else:
        print(bit.fold(p, x))

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<ll> a(n);
  int left = 0;
  int right = k - 1;
  ll ans = 1000000000000000;
  rep(i, n) cin >> a[i];
  rep(i,n){
    if(right >= n) break;
    ans = min(ans, abs(a[left]) + abs(a[right] - a[left]));
    ans = min(ans, abs(a[right]) + abs(a[right] - a[left]));
    left++;
    right++;
  }
  cout << ans << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(N), B(N), C(N-1);
  for(int i=0; i<N; i++){
    cin >> A.at(i);
  }
  for(int i=0; i<N; i++){
    cin >> B.at(i);
  }
  for(int i=0; i<N-1; i++){
    cin >> C.at(i);
  }

  int satis = 0;
  int eat = 0;
  int pre = -10;  
  for(int i=0; i<N; i++){
    eat = A.at(i) - 1;
    satis += B.at(eat);
    if(eat == pre + 1){
      satis += C.at(pre);
    }
    pre = eat;
  }
  
  cout << satis << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod=1e9+7;
//const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e5+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    string s;
    cin>>s;
    s='.'+s;
    if(s[3]==s[4]&&s[5]==s[6])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 256
using System;

namespace ABC088_A_Infinite_Coins
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			int a = int.Parse(Console.ReadLine());

			int amari = n % 500;
			if (amari <= a)
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
		}
	}
}

Measured memory_bytes: 11092
n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(1, n - 1):
    if (p[i-1] < p[i] and p[i] <= p[i+1]) or (p[i+1] < p[i] and p[i] <= p[i-1]):
        ans = ans+1
print(ans)

Measured memory_bytes: 3060
using System;
using System.Linq;
namespace ABC156
{
    class C
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] X = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long res = int.MaxValue;
            for (int i = 0; i < 100; i++)
            {
                long sum = 0;
                for (int j = 0; j < N; j++)
                {
                    sum += (long)Math.Pow(X[j] - i, 2);
                }
                res = Math.Min(res, sum);
            }
            Console.WriteLine(res);
        }
    }
}


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

#define sieve_ul int(1e6)
#define endl "\n"
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define debug(x) do{cout<<#x<<" is "<<x<<endl;}while(false);
#define debugarr(x) do{ cout<<#x<<" array is \n";for(auto varl: x)cout<<varl<<' ';cout<<endl;}while(false);

// ll sieve_arr[sieve_ul + 10];
// vector<ll> primes;

ll fastexp(ll b, ll e)
{
    ll ans = 1;
    ll lpow = b;

    while(e)
    {
        if(e & 1)
            ans *= lpow;
        lpow *= lpow;
        e = (e >> 1);
    }
    return ans;
}

bool isprime(ll x)
{
    for(ll i=2; i <= sqrt(x); i++)
        if(x%i == 0)
            return false;
    return true;
}

// void sieve()
// {
//     primes.clear();
//     memset(sieve_arr, -1, sizeof(sieve_arr));

//     for(int i=2; i<= sieve_ul; i++)
//     {
//         if(sieve_arr[i] == -1)
//             for(int j=2; j*i <= sieve_ul; j++)
//                 sieve_arr[i*j] = 1;
//     }

//     for(int i=2; i<= sieve_ul; i++)
//         if(sieve_arr[i] == -1)
//             primes.push_back(i);
// }
vector<int> factorize(int n) {
    vector<int> res;
    for (int i = 2; i * i <= n; ++i) {
        while (n % i == 0) {
            res.push_back(i);
            n /= i;
        }
    }
    if (n != 1) {
        res.push_back(n);
    }
    return res;
}

static bool cmp(pair<ll,ll>& a,pair<ll,ll>& b)
{
    return sqrt(a.first*a.first+a.second*a.second) <= sqrt(b.first*b.first+b.second*b.second);
}

void solve()
{
    string s;
    cin>>s;
    
    ll res = 0;
    
    for(char c:s)
        res += c-'0';
    if(res%9==0)
        cout<<"Yes";
    else
        cout<<"No";
}

int main()
{

    //ll tc;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //cin>>tc;

    //for(ll i=1;i<=tc;i++)
    //{
        solve();
    //}

}

Measured memory_bytes: 3740
#include<iostream>
#include <cmath>
#include <limits>
using namespace std;

int main() {
	long double a, b, x;
	cin >> a >> b >> x;
	long double tan;
	long double ans;
	if (2.0 * x >= a * a * b) {
		tan = (a * b - x / a) * 2.0 / a / a;
	}
	else {
		tan = a * b * b / 2.0 / x;
	}
	long double PI = acos(-1.0);
	ans = atan(tan) / PI * 180.0;
	cout << std::fixed << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for(int i=1; i<10; i++){
    if(i*100 + i*10 + i >= n){
      cout << i*100 + i*10 + i << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, k, a[600], sum;
vector<int> vec;
stack<int> stk;
multiset<int> mst;

void fun()
{
	for (int i = 1; 1; i++) {
		if (sum%i == 0) {
			int j = sum / i;
			if (j < i) break;
			vec.pb(i);
			if (j != i) stk.push(j);
		}
	}
	while (!stk.empty()) {
		vec.pb(stk.top());
		stk.pop();
	}
}

bool gun(int v)
{
	long long cnt = 0;
	long long ba = 0;
	int tmp;
	for (int i = 0; i < n; i++) {
		tmp = a[i] % v;
		if (tmp == 0) continue;
		mst.insert(tmp);
	}
	while (1) {
		if (mst.empty()) break;
		auto x = mst.begin();
		tmp = *x;
		mst.erase(x);
		cnt += tmp;
		while (tmp) {
			if (mst.empty()) break;
			x = mst.end();
			x--;
			if (tmp >= (v - *x)) {
				tmp -= (v - *x);
			}
			else {
				int tt = tmp;
				mst.insert(*x + tt);
				tmp -= tt;
			}
			mst.erase(x);
		}
	}
	if (tmp != 0) return false;
	if (cnt > k) return false;
	return true;
}

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	fun();
	int sz = vec.size();
	int cur = 0;
	for (int i = 0; i < sz; i++) {
		if (gun(vec[i])) cur = i;
	}
	cout << vec[cur] << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
int n,a,b;
scanf ("%d",&n);
a=n%4;
b=n%7;
if(n>=18) {printf("Yes");
	}else if(a==0) {printf("Yes");
		}else if(b==0){ printf("Yes");
			}else if(n<11){ printf("No");
					}else if (n==13){ printf("No");
                                    }else if(n==17){printf("No");
							}else printf("Yes");
return 0;
}

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

int N;
tuple<string,int,int> A[100];

int main () {
    cin >> N;
    for (int i =0; i<N; i++){
        string name;
        cin >> name;
        int rating;
        cin >> rating;
        A[i] = make_tuple(name, -rating, i+1);
    }

    sort(A,A+N);

    for (int i=0; i<N; i++){
        cout << get<2>(A[i]) << "\n";
    }

    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

const int INF = 1e9 + 5;

int main() {
    int i, j, n, k;
    cin >> n;
    cin >> k;
    int h[n], dp[n];
    for(i = 0; i < n; i++) {
        cin >> h[i];
        dp[i] = INF;
    }
    dp[0] = 0;
    for(i=0;i<n;i++) {
        for(j=i+1;j<=i+k && j<n;j++) {
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


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

using namespace std;

string s, t;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	cin >> s >> t;
	for (int i = 0; i < s.size(); ++i)
		if (s[i] != t[i])
			return cout << "No", 0;

	cout << "Yes" << endl;
}


Measured memory_bytes: 3624
#include<stdio.h>

int main(){
	int n,a[200001],element,max=0,second=0;
	scanf("%d",&n);
    int i;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	    if(a[i]>second && a[i]>max){
			element=i;
			second = max;
			max =a[i];
		}
		else if(a[i]>second){
			second = a[i];
		}
	}
	for(i=0;i<n;i++){
		if(i==element)
			printf("%d\n",second);
		else
			printf("%d\n",max);
	}
	return 0;
}
			
		

Measured memory_bytes: 2304
using System;

namespace ITP1_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b;
            int t;
            while(true)
            {
                string[] str = Console.ReadLine().Split(' ');
                a = int.Parse(str[0]);
                b = int.Parse(str[1]);
                if ((a == 0) && (b == 0))
                    break;

                if(a>b)
                {
                    t = a;
                    a = b;
                    b = t;
                }

                Console.WriteLine("{0} {1}", a, b);

            }
        }
    }
}

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

int main() {
    int N; cin >> N;
    int M = 0, cnt = 0;
    vector<int> H(N);
    for (int i = 0; i < N; i++) {
        cin >> H.at(i);
        if (H.at(i) == max(M, H.at(i))) {
            cnt++;
            M = max(M, H.at(i));
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256