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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)



void solve(){
    int K;
    cin >> K;
    if(K%2==0) cout << -1 << endl;
    else{
        int t = 0;
        for(int i=1;;i++){
            t = t*10 + 7;
            t%=K;
            if(t==0){
                cout << i << endl;
                return;
            }
            if(i>100000000){cout << -1 << endl; return;}
        }
        
    }

}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <set>
using namespace std;
using ll = long long;
ll BASE_NUM = 1000000007;

const int NONE = -1;

template <typename T>
struct S
{
  long long node, prev;
  T cost;
  S(long long n, T c, long long p) : node(n), cost(c), prev(p) {}
  bool operator>(const S &s) const
  {
    return cost > s.cost;
  }
};

template <typename T>
class Dijkstra
{
  long long n;
  vector<map<long long, T>> G;

public:
  vector<T> minc;
  vector<long long> prev;

  Dijkstra(vector<map<long long, T>> &G) : n(G.size()), G(G), minc(n, NONE), prev(G.size()) {}

  void solve(long long start)
  {
    minc.assign(n, NONE);
    priority_queue<S<T>, vector<S<T>>, greater<S<T>>> pq;
    pq.push(S<T>(start, 0, NONE));
    while (!pq.empty())
    {
      S<T> s = pq.top();
      pq.pop();
      if (minc[s.node] != NONE)
      {
        continue;
      }
      minc[s.node] = s.cost;
      prev[s.node] = s.prev;
      for (auto itr = G[s.node].begin(); itr != G[s.node].end(); ++itr)
      {
        pq.push(S<T>(itr->first, s.cost + itr->second, s.node));
      }
    }
  }

  void print()
  {
      for (int i = 0; i < n; i++)
      {
          cout << i << ":" << minc[i] << endl;
      }
  };
};

int main()
{
  // 整数の入力
  ll N, M, S;
  cin >> N >> M >> S;
  ll MAX_MONEY = 50 * N + 1;
  vector<map<ll, ll>> G(N * MAX_MONEY);
  for (int i = 0; i < M; i++)
  {
    ll u, v, a, b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    for (int j = 0; j < MAX_MONEY; j++)
    {
      if (j - a >= 0){
        G[u * MAX_MONEY + j][v * MAX_MONEY + j - a] = b;
        G[v * MAX_MONEY + j][u * MAX_MONEY + j - a] = b;
      }
    }
  }

  for (int i = 0; i < N; i++)
  {
    ll c, d;
    cin >> c >> d;
    for (int j = 0; j < MAX_MONEY; j++)
    {
      if  (j + c < MAX_MONEY)
      {
        G[i * MAX_MONEY + j][i * MAX_MONEY + j + c] = d;
      }else{
        G[i * MAX_MONEY + j][i * MAX_MONEY +  MAX_MONEY - 1] = d;
      }
    }
  }
  Dijkstra<ll> dickstra(G);
  dickstra.solve(min(S,MAX_MONEY - 1));
  // dickstra.print();
  // cout << MAX_MONEY << endl;
  for (int i = 1; i < N; i++)
  {
    ll min_m = numeric_limits<ll>::max();
    for (int j = 0; j < MAX_MONEY; j++)
    {
      min_m = min(min_m, dickstra.minc[i * MAX_MONEY + j]);
    }
    cout << min_m << endl;
  }
  return 0;
}


Measured memory_bytes: 99488
#include<stdio.h>
int a[300008],b[2000008];
int main(){
    int n,t=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",a+i),b[i]=0;
    for(int i=n;i>=1;i--){
          int   s=b[i];
        for(int j=2;j*i<=n;j++){
            s+=b[i*j];
        }
        if(s%2!=a[i]){
            s++;
            t++;
            b[i]=1;
            if(s%2!=a[i]){
                printf("-1\n");
                return 0;
            }
        }
    }
    printf("%d\n",t);
    for(int i=1;i<=n;i++){
        if(b[i]){
            printf("%d ",i);
        }
    }
    printf("\n");
}


Measured memory_bytes: 2432
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define pi acos(-1.0)
#define ms(a, x) memset(a, x, sizeof(a))
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define binarycount __builtin_popcount(x)
#define tr t[root]
#define lson t[root << 1]
#define rson t[root << 1 | 1]
#define debug(x) cout<<x<<'\n'
#define pii pair<ll,pair<ll,ll> >
using namespace std;
const int inf = 0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9+7;
const double eps = 1e-8;
ll gcd(ll a, ll b) {return b==0?a:gcd(b, a%b);}
ll lcm(ll a, ll b) {return a/gcd(a, b)*b;}
ll powmod(ll a,ll b){
    ll ans = 1, pow = a;
    while(b) { if(b&1) ans = (ans*pow)%mod; pow = (pow*pow)%mod; b >>= 1; }
    return ans;
}
ll mul(ll a,ll b){//大数取模乘法防止溢出
    ll ans=0;
    a%=mod,b%=mod;
    while(b) { if(b&1) ans = (ans+a)%mod; a = (a*2)%mod; b >>= 1; }
    return ans;
}
//(b/a)%p=b*a^(p-2)%p
int pr(ll num){//判断素数
     if(num == 1) return 0;
     if(num ==2|| num==3 ) return 1 ;
     if(num %6!= 1&&num %6!= 5) return 0 ;
     int tmp =sqrt( num);
     for(int i= 5;i <=tmp; i+=6 )
          if(num %i== 0||num %(i+ 2)==0 )return 0 ;
     return 1 ;
}
int Day(int y,int m, int d){
    if(m==1||m==2) { m+=12; y--; }
    int w=(d+2*m+3*(m+1)/5+y+y/4-y/100+y/400)%7;
    return w+1;
}
inline int read() {
    int c = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        c = c * 10 + ch - '0';
        ch = getchar();
    }
    return c * f;
}

//#pragma comment(linker, "/STACK:1024000000,1024000000")//外挂开栈
//stable_sort 排序不处理相同元素
//map<int,int>::reverse_iterator rit;
//for(rit=mp.rbegin();rit!=mp.rend();rit++)
//vec动态二维数组
//vector<vector<int>> g(26,vector<int>(100005));
//初始化vec里面套了n个vec

//lower_bound(begin,end,num) 有序数列中返回第一个>=num的数字的地址
//upper_bound( begin,end,num) 返回第一个>num的数字的地址

const int maxn=1e5+5;
int main(){
    ll x,a=101;
    cin>>x;
    int cnt=0;
    while(a<x){
        a*=1.01;
        cnt++;
    }
    cout<<cnt+1<<endl;
    return 0;
}


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

using namespace std;

using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    string s;cin >> s;
    auto sub = [&](int l,int r){
        return s.substr(l,r-l);
    };
    cout << sub(0,5) << " " << sub(6,13) << " " << sub(14,19) << endl;
    return 0;
}

Measured memory_bytes: 3608
package main

import (
	"bufio"
	"fmt"
	"os"
)

const inf = 1 << 60

var sc = bufio.NewScanner(os.Stdin)

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func larger(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	n, wCap := ri(), ri()
	x := make([]int, wCap+1)
	for i := 0; i < n; i++ {
		w, v := ri(), ri()
		y := make([]int, wCap+1)
		for j := 0; j <= wCap; j++ {
			if j-w >= 0 {
				y[j] = larger(x[j], x[j-w]+v)
			} else {
				y[j] = x[j]
			}
		}
		x = y
	}
	fmt.Println(x[wCap])
}


Measured memory_bytes: 11520
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

#define MAX_V 1000000

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Y;
	cin >> N >> Y;

	rep(x, 0, N + 1) rep(y, 0, N + 1) {
		if(x + y > N) continue;
		int z = N - x - y;
		if(10000 * x + 5000 * y + 1000 * z == Y) {
			cout << x << " " << y << " " << z << endl;
			return 0;
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;

}


Measured memory_bytes: 256
def f(n, x):
	if n==0:
		return 0 if x<= 0 else 1
	elif x<=1+a[n-1]:
		return f(n-1,x-1)
	else:
		return p[n-1]+1+f(n-1,x-2-a[n-1])


n,x=map(int, input().split())
a,p=[1],[1]
for i in range(n):
	a.append(a[i] * 2 + 3)
	p.append(p[i] * 2 + 1)
    
print(f(n, x))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		int maxH = 0;
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
			maxH = Math.max(maxH, h[i]);
		}
		
		int ans = 0;
		for (int i = 0; i < maxH; i++) {
			for (int j = 0; j < n; j++) {
				if (h[j] > 0) {
					h[j]--;
					if (j + 1 == n || h[j + 1] == 0) {
						ans++;
					}
				}
			}
		}
		
		System.out.println(ans);
	}
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i_len=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back
#define mp make_pair

int main()
{
    ll N;
    cin >> N;
    string S;
    map<string,ll> C;
    REP(i,0,N) {
        cin >> S;
        ++C[S];
    }

    ll m = 0;
    FORR(c,C) m = MAX(c.second,m);
    FORR(c,C) {
        if(c.second == m) PR(c.first);
    }

    return 0;
}

/*



*/

Measured memory_bytes: 25216
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
using namespace std;

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

  long  N,K;
  cin>>N>>K;
  vector<vector<long >>dp(2,vector<long  >(K+1,-1));
  vector<long   >a(N+1);
  for(long  i=0;i<N;i++)
  {
    cin>>a[i+1];
  }
  for(long  i=0;i<K+1;i++)
  {
    if(a[1]>=i)dp[1][i]=i+1;
    else  dp[1][i]=a[1]+1;
  }
  for(long  i=2;i<N+1;i++)
  {
    dp[i%2][0]=1;
    for(long  j=1;j<K+1;j++)
    {
      if(j>a[i])dp[i%2][j]=dp[i%2][j-1]+dp[(i+1)%2][j]-dp[(i+1)%2][j-a[i]-1];
      else dp[i%2][j]=dp[i%2][j-1]+dp[(i+1)%2][j];
      dp[i%2][j]%=1000000007;
    }
  }
  if(dp[N%2][K]<0){dp[N%2][K]+=(long )10*1000000007;}
  dp[N%2][K]%=1000000007;
  long  res=dp[N%2][K]-dp[N%2][K-1];
  if(res<0){res+=(long )10*1000000007;}
  res%=1000000007;
  if(K>0){cout<<res;return 0;}
  cout<<dp[N%2][K];
  cout<<endl;

}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};


int main() {
    int n,m; cin >> n >> m;
    vector<P> p(m);
    int a,b;
    rep(i,m) {
        cin >> a >> b;
        p[i].first = b;
        p[i].second = a;
    }
    sort(all(p));
    int ans = 0;
    int t = 0;
    rep(i,m) {
        if (t <= p[i].second) {
            ans++;
            t = p[i].first;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4024
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

template<class T> inline bool chmin(T& a, T 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; }

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}


int main(){
    string s;
    cin >> s;
    int n = s.size();
    int a = 0, b = 0, c = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'a') a++;
        if(s[i] == 'b') b++;
        if(s[i] == 'c') c++;
    }

    string ans;
    if(a==b && abs(c-b)<=1) ans = "YES";
    else if(b==c && abs(a-c)<=1) ans = "YES";
    else if(c==a && abs(b-a)<=1) ans = "YES";
    else ans = "NO";

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


Measured memory_bytes: 3724
package main

import(
    "fmt"
)



func main() {
    var a,b int
    var op string
    fmt.Scan(&a,&op,&b)
    ans := 0
    if op == "+"{
        ans = a+b
    } else {
        ans = a-b
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


Measured memory_bytes: 512
<?php
# 入力
fscanf(STDIN, '%d', $n);
$a = array_map('intval', explode(' ', trim(fgets(STDIN))));

$a_sum = array_sum($a);
$tmp = 0;
for ($i = 1; $i <= $n - 2; $i += 2) {
    $tmp += $a[$i];
}
$x[0] = $a_sum - 2 * $tmp;

for ($j = 0; $j < $n - 1; $j++) {
    $x[$j + 1] = ($a[$j] - $x[$j] / 2) * 2;
}
echo implode(' ', $x).PHP_EOL;
?>

Measured memory_bytes: 20084
#include<bits/stdc++.h>
using namespace std;
bool cmp(int a,int b){
	return a>b;
}
int main(){
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n,cmp);
	long long s1=0,s2=0;
	for(int i=0;i<n;i+=2){
		s1+=a[i];
	} 
	for(int i=1;i<n;i+=2){
		s2+=a[i];
	} 
	cout<<s1-s2;
	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    int ans;
    ans = M * 1900 + (N-M) * 100;
    for (int i = 0; i < M; i++) {
        ans *= 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
class RangeSumQuery(object):

    def __init__(self, size):
        self.size = 1
        while self.size <= size:
            self.size *= 2
        self.data = [0] * (self.size*2+2)

    def add(self, idx, value):
        k = idx + self.size - 1
        self.data[k] += value
        while k > 0:
            k = (k - 1) / 2
            self.data[k] += value

    def get_sum(self, start, end):
        def query(k, left, right):
            if right <= start or end <= left:
                return 0
            if start <= left and right <= end:
                return self.data[k]
            vl = query(k*2+1, left, (left+right)/2)
            vr = query(k*2+2, (left+right)/2, right)
            return sum([vl, vr])
        return query(0, 0, self.size)


def main():
    n, q = map(int, raw_input().split())
    rsq = RangeSumQuery(n)
    for _ in xrange(q):
        com, x, y = map(int, raw_input().split())
        if com == 0:
            rsq.add(x, y)
        else:
            print rsq.get_sum(x, y+1)

if __name__ == "__main__":
    main()

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

using namespace std;

#define FOR(i,n) for(int i=0; i<n; ++i)
#define FORR(i,a,n) for(int i=a; i<n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
 
int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
void printfv(VI a){ int n = a.size(); FOR(i, n) cout << a[i] << " "; }

int main(void){

	int x, a;
	cin >> x >> a;
  
  	if(x < a){
      cout << "0";
    } else {
      cout << "10";
    }
  
    return 0;
}


Measured memory_bytes: 256
day = str(input())
day = day.upper()

if (day == 'SAT'):
    print('1\n')
    #print('It is Saturday today, and tomorrow will be Sunday.')
elif(day =='SUN'):
    print('7\n')
    #print('It is Sunday today, and seven days later, it will be Sunday again.')
elif(day=='MON'):
    print('6\n')
    #print('It is Monday today,and sex day later, it will be Sunday again.')
elif(day=='TUE'):
    print('5\n')
    #print('It is Tuesday today, and five days later, it will be Sunday again.')    
elif(day=='WED'):
    print('4\n')
    #print('It is Wednesday today, and four days later, it will be Sunday again.')    
elif(day=='THU'):
    print('3\n')
    #print('It is thursday today, and three days later, it will be Sunday again.')    
elif(day=='FRI'):
    print('2\n')
    #print('It is Friday today, and five days later, it will be Sunday again.')


Measured memory_bytes: 3060
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      a: [[usize; n]; 2]
   }
   let mut u = vec![0; n];
   u[0] = a[0][0];
   for i in 1..n {
      u[i] = u[i - 1] + a[0][i];
   }
   let mut d = vec![0; n];
   d[n - 1] = a[1][n - 1];
   for i in 1..n {
      d[n - i - 1] = d[n - i] + a[1][n - i - 1];
   }
   let mut ans = 0;
   for i in 0..n {
      ans = std::cmp::max(ans, u[i] + d[i]);
   }
   println!("{}", ans);
}


Measured memory_bytes: 4352
from sys import stdin
import itertools
N = int(stdin.readline().rstrip())
P = [int(x) for x in stdin.readline().rstrip().split()]
Q = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = 0
ans2 = 0
cnt = 1
for v in itertools.permutations(list(range(1,N+1))):
    if v == tuple(P):
        ans1 = cnt
    if v == tuple(Q):
        ans2 = cnt
    cnt += 1
print(abs(ans1-ans2))

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

using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;

ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}

//__builtin_popcount ();
int main() {
    FAST
    int arr[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin>>n;
    n--;
    cout<<arr[n]<<endl;
    return 0;
}

Measured memory_bytes: 256
// {{{ by unolight
#include <bits/stdc++.h>
#include <unistd.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-variable"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x),end(x)
#define RALL(x) rbegin(x),rend(x)
#define REP(i,n) for ( int i=0; i<int(n); i++ )
#define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ )
#define MP make_pair
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef pair<int,int> PII;
typedef vector<int> VI;
// }}}

int main() {
    LL n, p;
    cin >> n >> p;
    if ( n==1 ) {
        cout << p << '\n';
        return 0;
    }

    map<int,int> mp;
    for ( LL i=2; i*i<=p; i++ ) {
        while ( p&&p%i==0 ) {
            p/=i;
            mp[i]++;
        }
    }
    if ( p>1 ) mp[p]++;

    LL ans=1;
    for ( auto &p:mp ) {
        int cnt=p.second/n;
        if ( cnt>0 ) {
            REP(i,cnt) {
                ans*=p.first;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

// 2^3*3






Measured memory_bytes: 3548
#include <cstdio>
#include <utility>

int gcd(int m, int n) {
  while (n) std::swap(m %= n, n);
  return m;
}

int main() {
  int p, q;
  scanf("%d %d", &p, &q);

  int m = q / gcd(p, q);
  int res = 1;
  for (int i = 2; i*i <= m; ++i) {
    if (m % i == 0) {
      res *= i;
      do {
        m /= i;
      } while (m % i == 0);
    }
  }

  if (m > 1) res *= m;
      
  printf("%d\n", res);
}



Measured memory_bytes: 2756
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
#include <iostream>
using namespace std;



int main()
{
  int h,w,n;
  cin >> h >> w >> n;
  int a[100001]={};
  for(int i=0;i<n;i++)
    cin >> a[i];

  int map[101][101] = {};
  int count = 0;
  int k = 0;

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

      if(count == a[k]){
        k++;
        count = 0;
      }

      if(i%2 == 0){
        map[i][j] = k+1;
      }
      else{
        map[i][w-1-j] = k+1;
      }
      count++;
    }
  }


  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(j==w-1)
        cout << map[i][j] << endl;
      else
        cout << map[i][j] << " ";
    }
  }

  return 0;
}

Measured memory_bytes: 768
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int UF[110000];
int FIND(int a){
	if(UF[a]<0)return a;
	return UF[a]=FIND(UF[a]);
}
void UNION(int a,int b){
	a=FIND(a);b=FIND(b);if(a==b)return;
	UF[a]+=UF[b];UF[b]=a;
}
vector<int>g[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		int c;scanf("%d",&c);
		for(int j=0;j<c;j++){
			int d;scanf("%d",&d);d--;
			g[d].push_back(i);
		}
	}
	for(int i=0;i<a;i++)UF[i]=-1;
	for(int i=0;i<b;i++){
		for(int j=0;j+1<g[i].size();j++){
			UNION(g[i][j],g[i][j+1]);
		}
	}
	if(-UF[FIND(0)]==a)printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int a, b;
  cin >> a >> b;
  if(a*b%2) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int[] nums = new int[n];
        int count = 0;
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
            if(i>=2){
                if( (nums[i-2] <nums[i-1] && nums[i-1] <=nums[i]) ||
                        (nums[i] <nums[i-1] && nums[i-1] <=nums[i-2])
                ){
                    count++;
                }
            }
        }


        System.out.println(count);


    }

}


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

bool sortbysec(const pair<string,int>&a, const pair<string,int> &b)
{
	return (a.second>b.second);
}

bool sortbyfirst(const pair<string,int>&a, const pair<string,int> &b)
{
	return (lexicographical_compare(a.first.begin(),a.first.end(),b.first.begin(),b.first.end()));
}

int main()
{
	int count[101];
	std::vector< pair<string,int> >v;
   int n;
   cin>>n;
   for(int i=0; i<n; i++)
   {
   		string s;
   		int p;
   		cin>>s;
   		cin>>p;
   		count[p] = i+1;
   		v.push_back(make_pair(s,p));

   }

   stable_sort(v.begin(), v.end(), sortbysec);
   stable_sort(v.begin(), v.end(), sortbyfirst);

   for(int i=0; i<n; i++)
   {
   	cout<<count[v[i].second] <<endl;
   }
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int memo[100001];
int dp(int h[],int n){
if(memo[n]!=-1)
return memo[n];
else{
	
memo[n]=min(abs(h[n]-h[n+1])+dp(h,n+1),abs(h[n]-h[n+2])+dp(h,n+2));
}
return memo[n];

}

int main(){
  ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
memset(memo,-1,sizeof(memo));
int n;
cin>>n;
int H[n];
for(int i=0;i<n;i++)
cin>>H[i];
memo[n-1]=0;
memo[n-2]=abs(H[n-1]-H[n-2]);
	dp(H,0);
cout<<memo[0];
return 0;

}


Measured memory_bytes: 4992
#![allow(unused_imports)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::{min, max};
use std::collections::{HashMap, HashSet, VecDeque, BinaryHeap};

fn main() {
    input!{
        mut n: usize
    }
    let mut ans = vec![];
    while n > 0 {
        n -= 1;
        ans.push(((n % 26) as u8 + 'a' as u8) as char);
        n /= 26;
    }
    println!("{}", ans.iter().rev().collect::<String>());
}


Measured memory_bytes: 2112
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

//const int INF = 1000 * 1000 * 1000 + 10;
const ll INF = 1LL<<60;
vector<ll> A;
//vector<pint> hist;
vector<bool> visited;
vector<ll> dp;
vector<int> ans;
vector<vector<int> > G;

void dfs(const int cur) {
  visited[cur] = true;
  int idx = lower_bound(dp.begin(), dp.end(), A[cur]) - dp.begin();
  ll old = dp[idx];
  dp[idx] = min(old, A[cur]);
  ans[cur] = lower_bound(dp.begin(), dp.end(), INF) - dp.begin() - 1;
  //  cout << cur+1 << " "; pp(dp, dp.size());
  REP(i,G[cur].size()) {
    const int nxt = G[cur][i];
    if(! visited[nxt]) {
      dfs(nxt);
    }
  }
  dp[idx] = old;
}

int main() {
  int N; cin>>N;
  A = vector<ll> (N);
  visited = vector<bool>(N, false);
  dp = vector<ll>(N+2, INF); dp[0] = -INF;
  G = vector<vector<int> > (N);
  ans = vector<int>(N);
  REP(i,N) {
    cin>>A[i];
  }
  REP(i, N-1) {
    int u, v; cin>>u>>v; u--; v--;
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs(0);
  REP(i,N) {
    cout << ans[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 26280
from math import gcd

n = int(input())
a = list(map(int, input().split()))
MAX = max(a)
d = {}; g = 0
for i in a:
    d[i] = 1 if i not in d else d[i] + 1
    g = gcd(g, i)

if g > 1:
    print('not coprime')
else:
    for i in range(2, MAX + 1):
        f = 0
        for j in range(i, MAX + 1, i):
            f += d[j] if j in d else 0
        if f > 1:
            print('setwise coprime')
            break
    else:
        print('pairwise coprime')


Measured memory_bytes: 224928
// 2012/01/10 Tazoe

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

int main()
{
	while(true){

	int n;
	cin >> n;
	if(n==0)
		break;

	int m;
	cin >> m;

	string s;
	cin >> s;

	int L;
	if(s[0]=='I')
		L = 1;
	else
		L = 0;

	int cnt = 0;
	for(int i=1; i<m; i++){
		if(s[i]=='I'){
			if(s[i-1]=='O'){
				L++;
			}
			else{
				int N = (L-1)/2;
				if(N>=n)
					cnt += (N-n+1);
				L = 1;
			}
		}
		else{
			if(s[i-1]=='I'){
				L++;
			}
			else{
				int N = (L-2)/2;
				if(N>=n)
					cnt += (N-n+1);
				L = 0;
			}
		}
	}

	if(L>=3){
		int N = (L-1)/2;
		if(N>=n)
			cnt += (N-n+1);
	}

	cout << cnt << endl;

	}

	return 0;
}

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

using namespace std;

#define endl '\n'

#define pb push_back
#define f first
#define s second
#define BUFF ios::sync_with_stdio(false);

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

const int MAX = (int)1e5+10;

int main(){

    BUFF;

	int n; cin >> n;

	vector<ll> v(n);
	for( int i=0; i<n; i++ ){
		cin >> v[i];
	}

	vector<ll> dp(n, INF);
	dp[n-1] = 0;
	dp[n-2] = abs(v[n-2]-v[n-1]);
	for( int i=n-3; i>=0; i-- ){
		dp[i] = min(dp[i+1]+abs(v[i]-v[i+1]), dp[i+2]+abs(v[i]-v[i+2]));
	}

	cout << dp[0] << endl;

    return 0;
}


Measured memory_bytes: 1792
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

#include <bits/stdc++.h>
using namespace std;

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

// ------------------------------------------------------------------------------------------------

ll n, l;

void func() {
    cin >> n >> l;
    cout << ((n * (n + 1)) >> 1) + (n - 1) * (l - 1) - min(max((ll) 1, 1 - l), n) << endl;
}

int main() {
    fast_io; cout.precision(32);
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}


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

int p[9]={2,5,5,4,5,6,3,7,6};

void chmax(string &a,string b){
    if(b.size()>a.size())a=b;
    else if(b.size()==a.size()&&b>a)a=b;
}

int main(void){
    int N,M;
    cin>>N>>M;
    
    int A[M];
    for(int i=0;i<M;i++)cin>>A[i];
    
    string d[11000];
    for(int i=0;i<=N;i++)d[i]="-";
    d[0]="";
    
    for(int i=0;i<=N;i++){
        if(d[i]=="-")continue;
        for(auto a:A)chmax(d[i+p[a-1]],d[i]+char('0'+a));
    }
    
    cout<<d[N]<<endl;
    
}

Measured memory_bytes: 45056
N = int(input())
S = input()
A = ['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']
for s in S:
    idx = A.index(s)+N
    if idx > 25:
        idx -= 26
    print(A[idx], end='')


Measured memory_bytes: 4468
H,W = [int(i) for i in input().split()]
line = [input() for i in range(H)]
ans = [[0]*W for i in range(H)]
dir = [[0,1],[1,0],[0,-1],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]]
for i in range(H):
    for j in range(W):
        if line[i][j] == "#":
            for a,b in dir:
                x = i+a
                y = j+b
                if 0 <= x < H and 0 <= y < W:
                    if ans[x][y] != "#":
                        ans[x][y] += 1
            ans[i][j] = "#"
print("\n".join("".join(map(str, i)) for i in ans))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long 
#define ld long double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX 10000003
using namespace std;
void solve()
{
    ll n,k;  cin>>n>>k;
    ll arr[n];
    rep(i,0,n)  cin>>arr[i];
    vector<vector<ll>> dp(n+1,vector<ll>(k+1,0));
    rep(i,0,n+1) dp[i][0]=1;
    rep(i,1,n+1)
    {
        vector<ll> prefix_sum(k+1,0);
        prefix_sum[0]=dp[i-1][0]%mod;
        rep(j,1,k+1) prefix_sum[j]+=(prefix_sum[j-1]+dp[i-1][j])%mod;
        rep(j,1,k+1)
        {
            if(j<=arr[i-1]) dp[i][j]=prefix_sum[j]%mod;
            else dp[i][j]=(prefix_sum[j]-prefix_sum[j-arr[i-1]-1]+mod)%mod;
           // rep(m,0,min(arr[i-1],j)+1) dp[i][j]+=dp[i-1][j-m];
        }
    }cout<<dp[n][k];
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    return 0;
}


Measured memory_bytes: 82996
/**
 *   @FileName	b.cpp
 *   @Author	kanpurin
 *   @Created	2020.08.02 21:02:40
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n;cin >> n;
    ll d;cin >> d;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ll x,y;cin >> x >> y;
        if (x * x + y * y <= d * d) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<cmath>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;
int main() {
	int n; cin >> n;
	int a, b; cin >> a >> b;

	if (n * a < b)cout << n * a;
	else cout << b;
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
#pragma endregion //#include
/////////

#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)4e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int X,t;
	cin>>X>>t;
	cout<< max(X-t,0) << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    N=int(input())
    ans=0
    for _ in range(N):
        x,u=input().split()
        x=float(x)
        if u=='JPY':
            ans+=x
        else:
            ans+=x*380000
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
 
const int inf = (int)1e18 + 10;

priority_queue < pii >  pq;
int a[N] , b[N];
signed main(){
  fast;
 

  int n , x , y , val , ans = 0;
  cin >> n;
  for(int i = 0 ; i < n ; i++)
       cin >> a[i];
  for(int i = 0 ; i < n ; i++){
       cin >> b[i];
       if(b[i] != a[i])
       pq.push(mp(b[i] , i));
     }
   int cnt = 0;
    while(pq.size() > 0){
          pii p = pq.top();
          pq.pop();
          x = p.ss;
          val = p.ff ;
          y = b[(x- 1 + n) % n] + b[(x + 1) % n];
          int r = (val - a[x])/y;
          if((val - a[x]) <  y){
            ans = -1;
            break;
          }
          
          ans += r;
          val = (val - a[x]) % y;
          b[x]  = val + a[x];
          if(b[x] != a[x]) 
          pq.push(mp(b[x]  , x));

    }
    
    cout << ans << endl;

 
}

Measured memory_bytes: 9072
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int ans = 0;
		int[] h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		for(int i = 0; i < n-1; i++) {
		int count = 0;
		if(n-i<=ans) {
			break;
		}
			for(int j = i+1; j < n; j++) {
				if(h[i] >= h[j]) {
					count++;
					h[i] = h[j];
				}
				else {
					break;
				}
			}
			ans = Math.max(ans,count);
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 50324
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 08/29/20 20:54:54
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
constexpr int MAX = 1e6;

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

  vector<vector<int>> elas(MAX+1);
  for (int k = 2; k <= MAX; k++) {
    if (!elas[k].empty()) continue;
    for (int j = k; j <= MAX; j += k) {
      elas[j].push_back(k);
    }
  }
  int n; cin>>n;
  vector<int> A(n); for (auto& a:A) cin>>a;
  int gcd_a = A[n-1];
  unordered_set<int> cpset;
  for (auto k:elas[A[n-1]]) {
    cpset.insert(k);
  }
  int type = 0;
  for (int i = n-2; i >= 0; i--) {
    if (type == 0) {
      bool ok = true;
      for (auto k:elas[A[i]]) {
        if (cpset.count(k) > 0) {
          ok = false;
          break;
        }
        cpset.insert(k);
      }
      if (!ok) {
        type = 1;
      }
    }
    gcd_a = gcd(gcd_a, A[i]);
  }

  if (type == 0) {
    cout << "pairwise coprime" << endl;
  } else if (gcd_a == 1) {
    cout << "setwise coprime" << endl;
  } else {
    cout << "not coprime" << endl;
  }

  return 0;
}


Measured memory_bytes: 62592
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int K, A, B; cin >> K >> A >> B;
    for (int i = 1; K * i <= B; i++) {
        if (A <= K * i && K * i <= B) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <string>
typedef long long ll;
using namespace std;
const  ll INF = 1e9;
const  ll MOD = 1e9 + 7;
#define repi(i,n,init) for(ll i=init;i<(n);i++)

int main()
{
    int h,w;
    cin >> h >> w;
    repi(i,h,0){
        string s;
        cin >> s;
        cout << s << "\n" << s << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
// #include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
  int n;
  cin >> n;
  int ma = 0;
  int sum = 0;
  int p[n];
  rep(i, n) {
    cin >> p[i];
    sum += p[i];
    ma = max(ma, p[i]);
  }
  cout << (sum - ma) + ma / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,b[105],ans;
int main()
{
    scanf("%d",&n);
    rap(i,1,n) scanf("%d",b+i);
    rep(i,1,n){
        if(i==1) ans+=b[1];
        else if(i==n) ans+=b[n-1];
        else ans+=min(b[i-1],b[i]);
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 256