akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;

const int INF = 1e9 + 5;

int main() {
    long long int n,w;
    cin>>n>>w;
    vector<int> weight(n);
    vector<int> v(n);
    for (int i = 0; i < n; i++)
    {
      cin>>weight[i]>>v[i];
    }
    vector<vector<long long int>> dp(n+1,vector<long long int>(w+1));
    for(int i=0;i<=n;i++){
      for (int j = 0; j <= w; j++)
      {
        if(i==0 || j==0){
          dp[i][j]=0;
        }
        else if(weight[i-1] <= j){
          dp[i][j] = max(v[i-1]+dp[i-1][j-weight[i-1]], dp[i-1][j]);
        }
        else{
          dp[i][j] = dp[i-1][j];
        }

      }
    }
    cout<<dp[n][w]<<endl;
}

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

#define pb push_back
#define loop(i,l,r) for(int i = (l); i < (r); i++)
#define rloop(i,r,l) for(int i = (r-1); i >= (l); i--)
#define refloop(x, v) for(auto& x : (v))
#define exists(m,e) if((m).find(e) != (m).end())
#define nexists(m,e) if((m).find(e) == (m).end())
#define sortaka(v) sort((v).begin(), (v).end())
#define rsort(v) sort((v).rbegin(), (v).rend())
#define lower_bound_index(v, x) (lower_bound((v).begin(), (v).end(), x)-(v).begin()) // returns minimum i s.t v[i] >= x
#define upper_bound_index(v, x) (upper_bound((v).begin(), (v).end(), x)-(v).begin()) // returns minimum i s.t v[i] > x
#define scanint(x) scanf("%d", &(x))
#define scanfloat(x) scanf("%f", &(x))
#define scanll(x) scanf("%lld", &(x))
#define scanchar(x) scanf("%c", &(x))
#define scanstring(x) scanf("%s", &(x))
#define printint(x) printf("%d", x)
#define printfloat(x) printf("%.9f", x)
#define printll(x) printf("%lld", x)
#define printchar(x) printf("%c", x)
#define printstring(x) printf("%s", x)
#define printintnewline(x) printf("%d\n", x)
#define printfloatnewline(x) printf("%.9f\n", x)
#define printllnewline(x) printf("%lld\n", x)
#define printcharnewline(x) printf("%c\n", x)
#define printstringnewline(x) printf("%s\n", x)
#define square(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))

typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<long long, long long>> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef vector<string> vs;
typedef vector<vector<pair<int, int>>> vvpii;
typedef vector<vector<pair<long long, long long>>> vvpll;
typedef map<int,int> mii;
typedef map<string,int> msi;
typedef long long ll;

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

    int n; cin >> n;
    loop(i, 0, n){
        cout<<"ACL";
    }
}

Measured memory_bytes: 3648
#include <stdio.h>

int sum[7];
int main(void)
{
	int i, _j, n;
	int m, e, j;
	float ave;
	
	while (scanf("%d", &n), n != 0){
		for (_j = 0; _j < n; _j++){
			scanf("%d %d %d", &m, &e, &j);
			ave = (m + e + j) / 3.0;
			
			if (m == 100 || e == 100 || j == 100){
				printf("A\n");
			}
			else if ((m + e) / 2.0 >= 90){
				printf("A\n");
			}
			else if (ave >= 80){
				printf("A\n");
			}
			else if (ave >= 70){
				printf("B\n");
			}
			else if (ave >= 50 && (m >= 80||e >= 80)){
				printf("B\n");
			}
			else {
				printf("C\n");
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 584
import bisect,sys
from itertools import accumulate
input = sys.stdin.readline
def prime(n):
  prime_table = [2]
  for i in range(3,n+1):
    f = 1
    for j in prime_table[:bisect.bisect_right(prime_table,int(i**0.5))]:
      if i % j == 0:
        f = 0
        break
    if f:
      prime_table.append(i)
  return prime_table

q = int(input())
prime_table = prime(10**5)
like_2017 = [0]*(10**5+1)
for i in range(1,10**5+1,2):
  if i in prime_table and (i+1) //2 in prime_table:
    like_2017[i] = 1
like_2017 = list(accumulate(like_2017))
for i in range(q):
  l,r = map(int,input().split())
  print(like_2017[r] - like_2017[l-1])

Measured memory_bytes: 54748
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();

        if((A+B+C)>=22){
            System.out.println("bust");
            return;
        }else {
            System.out.println("win");
            return;
        }
    }
}

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

int main(){
  int n;
  cin>>n;
  if(n==1){
    cout<<1<<endl; return 0;
  }
  int num[n+1];
  for(int i=0;i<n+1;i++) num[i]=1;
  for(int i=2;i<=n;i++){
    int log =i;
    for(int j=2;j<n+1;j++){
      while(log%j==0){
        num[j]++;
        log/=j;
      }if(log<j) break;
    }
  }long long ans=1;
  for(int i=1;i<n+1;i++){
    ans*=num[i];
    ans%=1000000007;
  }cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}
int dx[4]={0,1,-1,0};
int dy[4]={1,0,0,-1};



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    int n;
    cin>>n;
    int a[n];
    int ans = 0;
    for(int i=0;i<n;i++){cin>>a[i];}
    sort(a,a+n);
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[i] == a[j])continue;
            for(int k=j+1;k<n;k++){
                if(a[i] == a[k])continue;
                if(a[j] == a[k])continue;
                if(a[k] < a[i]+a[j])ans++;
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

const long long MOD = 1000000007;
const long long MAX = 2000000;
long long gcd(long long a, long long b) {
    return b != 0 ? gcd(b, a % b) : a;
}
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
long long extgcd(long long a, long long b, long long &x, long long &y) {
    long long g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}

int main() {
    long long N;
    cin>>N;
    if(N%2==1){
        cout<<0<<endl;
    }else{
        long long sum=0;

        for(long long i=5;N>=i;i=i*5){
            sum+=N/i/2;


            //cout<<sum<<endl;
        }

        cout<<sum<<endl;
    }











}


Measured memory_bytes: 256
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%llu\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	const int num = data->getNum()[0];

	const int ans = 0 == num % 2 ? num / 2 : (num / 2) + 1;

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

	delete(data);

	return 0;
}


Measured memory_bytes: 256
a = input().split(" ")
N = int(a[0])
D = int(a[1])

count = 0

l = []
for _ in range(N):
  x = input().split(" ")
  l.append([int(x[0]), int(x[1])])

sq = D**2
for p in l:
  b, c = int(p[0]), int(p[1])
  r = b**2 + c**2
  if r <= sq:
    count += 1
    
print(count)

Measured memory_bytes: 39244
n = int(input())
P =[]
s = 0
for i in range(n):P.append([int(i) for i in input().split()])
P.append(P[0])
for i in range(n):
    a = P[i][0] ; b = P[i][1]; c = P[i+1][0] ; d = P[i+1][1]
    s += a * d - b * c
print(abs(s)*0.5)

Measured memory_bytes: 7732
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>
#include <math.h>

using namespace std;

typedef long long ll;
const ll mod=1000000007;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
    ll A,B;
    cin>>A>>B;
    vector<int> vec;
    ll n=1;
    while(true){
        vec.push_back((((B/n)%2)*((B%n)+1)+((A/n)%2)*(n-A%n))%2);
        if(B/2<n) break;
        n=n*2;
    }
    ll ans;
    n=2;
    rep(i,vec.size()-1){
        ans+=vec[i+1]*n;
        n=n*2;
    }
    ans=ans+((A/2+B/2+B%2)%2);
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    long N,M;
    long ans=0,wa=0;
    cin >> N >> M;
    vector<long> A(M),A1(N+1),A2(N+1);
    vector<string> B(M);

    for (long i = 0; i < M; i++) {
        cin >> A.at(i) >> B.at(i);
    }

    for (long i = 0; i < M; i++) {
        if(A1.at(A.at(i))==1) continue;
        if(B.at(i)=="AC"){
            A1.at(A.at(i))=1;
        }
        if(A1.at(A.at(i))<1){
            if(B.at(i)=="WA") A2.at(A.at(i))++;
        }
    }
    for (long i = 0; i < N+1; i++) {
        ans+=A1.at(i);
        if(A1.at(i)==1) wa+= A2.at(i);
    }
    
    cout << ans << ' ' << wa << endl;
}

Measured memory_bytes: 8064
package main

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

func main() {
	n, val, min, max := 0, 0, 0, -2147483648
	sc := bufio.NewScanner(os.Stdin)
	if sc.Scan() {
		n, _ = strconv.Atoi(sc.Text())
	}
	if sc.Scan() {
		min, _ = strconv.Atoi(sc.Text())
	}
	for i := 1; i < n; i++ {
		if sc.Scan() {
			val, _ = strconv.Atoi(sc.Text())
		}
		if max < val-min {
			max = val - min
		}
		if min > val {
			min = val
		}
	}
	fmt.Println(max)
}



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

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 1e5+50;
const int inf = 1e9;

ll x[maxn];
int v[maxn];
ll w[maxn];
ll sum_pre[maxn], sum_suf[maxn];
ll max_pre[maxn], max_suf[maxn];

int main()
{
    int n;
    ll c;
    cin >> n >> c;
    for (int i = 0; i < n; ++i)
    {
        cin >> x[i] >> v[i];
    }
    for (int i = 0; i < n; ++i)
    {
        sum_pre[i] = !i ? v[i] : sum_pre[i-1] + v[i];
        max_pre[i] = !i ? v[i]-x[i] : max(max_pre[i-1], sum_pre[i]-x[i]);        
    }
    for (int i = n-1; i >= 0; --i)
    {
        sum_suf[i] = (i == n-1) ? v[i] : sum_suf[i+1] + v[i];
        max_suf[i] = (i == n-1) ? v[i]-c+x[i] : max(max_suf[i+1], sum_suf[i]-c+x[i]);
    }
    ll ans = 0, tmp = 0;
    for (int i = 0; i < n; ++i)
    {
        tmp = sum_pre[i] - x[i];
      //  printf("%d %lld ", i, tmp);
        tmp += max(0LL, max_suf[i+1]-x[i]);
       // printf("%lld ", tmp);
        ans = max(ans, tmp);
        tmp = sum_suf[i] - c + x[i];
        //printf("%lld ", tmp);
        tmp += max(0LL, max_pre[i-1]-c+x[i]);
        ans = max(ans, tmp);
        //printf("%lld\n", tmp);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 5376
#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;
  deque<int> a;
  rep(i,n) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  deque<int> b;
  while(a.size()!=0) {
    bool ok=false;
    for(int i=a.size()-1; i>=0; i--) {
      if(a[i]==i+1) {
        a.erase(a.begin()+i);
        b.push_front(i+1);
        ok=true;
        break;
      }
    }
    if(!ok) {
      cout << -1 << endl;
      return 0;
    }
  }
  for(auto p : b) cout << p << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    N,M = map(int, input().split())
    mod = 10**9 + 7
    MAX = 2*10**5
    kaijo = [1]*MAX
    for i in range(2,MAX):
        kaijo[i] = (kaijo[i-1] * i)%mod
    
    if M == 1:
        print(1)
        sys.exit()
    
    def p_prime(n): 
        prime = [2]
        for i in range(3,n+1):
            flag = 0
            for j in prime:
                if i%j == 0:
                    flag = 1
                    break
                if i**0.5 < j:
                    break
            if flag == 0:
                prime.append(i)
        return prime
    prime = p_prime(10**5)
    
    a = {}
    for p in prime:
        count = 0
        while M%p ==0:
            count += 1
            M //= p
        if count > 0:
            a[p] = count
    if M != 1:
        a[M] = 1
    ans = 1
    for p in a:
        i = a[p]
        ans = (ans * kaijo[i+N-1])%mod
        ans = (ans * pow(kaijo[i],mod-2,mod))%mod
        ans = (ans * pow(kaijo[N-1],mod-2,mod))%mod
    print(ans)
    
    
main()

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  double h,w,x,y;
  cin >> w >> h >> x >> y;
  cout << h*w/2 SP (x==w/2&&y==h/2?1:0) << endl;
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

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

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i64 = read();
    let k: i64 = read();
    let mut ans = n;
    let n_s = n.to_string();
    let k_s = k.to_string();

    
    if n_s.len() != k_s.len() {
        if n > k {
            ans = n % k;
        }
    }
    while ans > (ans - k).abs() {
        ans = (ans - k).abs();
    }



    println!("{}",ans);

}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>

using namespace std;

const int INF = 1 << 25;

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

    int cnt[N];
    fill(cnt, cnt + N, 0);
    // 隣接する頂点数
    // ただし白頂点は除外
    // 塗られたものはINF

    vector<int> path[N];

    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        ++cnt[--a], ++cnt[--b];
        path[a].push_back(b);
        path[b].push_back(a);
    }

    vector<int> one;
    // cnt[v] = 1なる頂点の集合

    for (int v = 0; v < N; ++v) {
        if (cnt[v] == 1) one.push_back(v);
    }

    // ここから白はリーチを掛けまくる
    while (!one.empty()) {
        int v = one.back();
        one.pop_back();
        if (cnt[v] != 1) continue;

        int w;
        // vに隣接する頂点
        // これを白に塗ることでcnt[v] = 0(リーチ)にする

        for (int sv : path[v]) {
            if (cnt[sv] < INF) w = sv;
        }

        cnt[w] = INF * 2;

        vector<int> zero;
        // cnt[v] = 0なる頂点の集合
        // 黒はこれら全てを塞がなければならない

        for (int sv : path[w]) {
            --cnt[sv];
            if (cnt[sv] == 1) one.push_back(sv);
            if (cnt[sv] == 0) zero.push_back(sv);
        }

        // 黒が1ターンに塞げる頂点は1個なので、
        // 2個以上リーチがあると詰み
        if (zero.size() > 1) {
            cout << "First" << endl;
            return 0;
        }

        // 逆に1個なら黒が塞ぐ
        cnt[zero.back()] = INF * 2;
    }

    // 万策尽きました
    cout << "Second" << endl;
    return 0;
}


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

using namespace std;
using ll = long long int;

int main(void) {
    constexpr ll MOD = 1e9 + 7;
    constexpr double PI = acos(-1);
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n, c;
    cin >> n >> c;
    vector<ll> x(n), v(n);
    for(ll i=0; i<n; i++)
        cin >> x[i] >> v[i];

    vector<ll> rx(n);
    for(ll i=0; i<n; i++)
        rx[i] = c - x[i];
    reverse(rx.begin(), rx.end());

    vector<ll> dx(n), drx(n);
    adjacent_difference(x.begin(), x.end(), dx.begin());
    adjacent_difference(rx.begin(), rx.end(), drx.begin());

    vector<ll> l(n+1), l2(n+1), r(n+1), rr(n+1);
    for(ll i=1; i<=n; i++) {
        r[i] = r[i-1] + (v[i-1] - dx[i-1]);
        rr[i] = rr[i-1] + (v[i-1] - 2*dx[i-1]);

        l[i] = l[i-1] + (v[n-i] - drx[i-1]);
        l2[i] = l2[i-1] + (v[n-i] - 2*drx[i-1]);
    }

    for(ll i=1; i<=n; i++) {
        r[i] = max(r[i], r[i-1]);
        rr[i] = max(rr[i], rr[i-1]);
        l[i] = max(l[i], l[i-1]);
        l2[i] = max(l2[i], l2[i-1]);
    }

    ll res = max(l[n], r[n]);
    for(ll i=1; i<=n; i++)
        res = max({res, l2[i] + r[n-i], rr[i] + l[n-i]});

    cout << res << endl;

}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    int sum = 0;
    int maxv = 0;
    for(int i=0; i<N; i++){
        int x; cin >> x;
        sum += x;
        maxv = max(maxv, x);
    }

    if(maxv < (sum-maxv)) cout << "Yes" << endl;
    else cout << "No" << endl;

}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 1e5 + 42;
int dp[N][3];
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  int n = 0;

  cin >> n;

  cin >> dp[0][0] >> dp[0][1] >> dp[0][2];

  for(int i = 1; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
    dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b;
    dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c;
  }

  cout << max(dp[n - 1][0], max(dp[n - 1][1], dp[n - 1][2]));

  return 0;
}
/*

*/


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

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

    if(a > 0 && b > 0){
        cout << "Positive" << endl;
    }else if(a >= 0 || b >= 0){
        cout << "Zero" << endl;
    }else{
        if((a - b) % 2 == 0){
            cout << "Negative" << endl;
        }else{
            cout << "Positive" << endl;
        }
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI3(N, A, B);
  GS(S);
  int c = 0, c2 = 0;
  FOR(i, N) {
    if (S[i] == 'a' && c < A + B) {
      cout << "Yes" << endl;
      c++;
    } else if (S[i] == 'b' && c < A + B && c2 < B) {
      cout << "Yes" << endl;
      c++;
      c2++;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 896
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()

def many_lcm(l):
    tmp = l[0]
    for i in range(1, len(l)):
        tmp = tmp * l[i]//gcd(tmp, l[i])
    return tmp

lm = many_lcm(A)
ans = 0
for a in A:
    ans += lm // a
print(ans % mod)

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

int tmp[10];

bool solve(int n, int f) {
	bool judge = false;
	if (f == 4) {
		for (int i = 1; i < 10; i++) {
			if (tmp[i] == 2) {
				return true;
			}
		}
		return false;
	}

	if (tmp[n] >= 3) {
		tmp[n] -= 3;
		judge = solve(n, f + 1);
		if (judge) return true;
		tmp[n] += 3;
	}

	if (n <= 7 && tmp[n] >= 1 && tmp[n + 1] >= 1 && tmp[n + 2] >= 1) {
		tmp[n]--; tmp[n + 1]--; tmp[n + 2]--;
		judge = solve(n, f + 1);
		if (judge) return true;
		tmp[n]++; tmp[n + 1]++; tmp[n + 2]++;
	}

	if (n < 9) {
		judge = solve(n + 1, f);
	}
	return judge;
}

int main() {
	string source;
	while (cin >> source) {
		int pai[10] = { 0 };
		for (int i = 0; i < 13; i++) {
			pai[source[i] - '0']++;
		}

		vector <int> v;
		for (int i = 1; i < 10; i++) {
			if (pai[i] < 4) {
				pai[i]++;
				for (int j = 0; j < 10; j++) {
					tmp[j] = pai[j];
				}
				if (solve(1, 0)) {
					v.push_back(i);
				}
				pai[i]--;
			}
		}

		if (v.empty()) cout << 0 << endl;
		else {
			for (int i = 0; i < (int)v.size() - 1; i++) {
				cout << v[i] << ' ';
			}
			cout << v[v.size() - 1] << endl;
		}
	}
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int l=0;
  rep(i,s.size()){
    if(i%2==0&&s[i]!='0'||i%2==1&&s[i]!='1')
    l++;
  }
  int r=s.size()-l;
  cout << min(l,r) << endl;
}

Measured memory_bytes: 512
function Main(input){
  input = input.split(' ');
  var a = Number(input[0]);
  var b = Number(input[1]);
  var c = Number(input[2]);

  if( c <= b && c >= a) {
    console.log('Yes');
  } else {
      console.log('No');
  }

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

const int MAX = 105;
int top;
int S[MAX];

void push(int n) {
  S[++top] = n;
}

int pop() {
  return S[top--];
}

int main() {
  string s;
  int a, b;
  while (cin >> s) {
    if (s == "+") {
      a = pop();
      b = pop();
      push(a + b);
    } else if (s == "-") {
      a = pop();
      b = pop();
      push(b - a);
    } else if (s == "*") {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(stoi(s));
    }
  }
  cout << pop() << endl;
  return 0;
}



Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
struct Job {
	int delay, pay;
};
int main(){
	int n, m; std::cin >> n >> m;
	std::vector<Job> jobs(n); for (auto& j : jobs) std::cin >> j.delay >> j.pay;
	std::sort(jobs.begin(), jobs.end(), [](const Job& a, const Job& b) { return a.delay < b.delay; });
	std::priority_queue<Job, std::vector<Job>, std::function<bool(const Job&, const Job&)>> queue([](const Job& a, const Job& b) {return a.pay < b.pay; });
	int j = 0;
	long long int result = 0;
	for (auto day = 0; day <= m; ++day) {
		while (j < jobs.size() && jobs[j].delay <= day) {
			queue.push(jobs[j++]);
		}
		if (!queue.empty()) {
			result += queue.top().pay;
			queue.pop();
		}
	}
	std::cout << result << std::endl;
}



Measured memory_bytes: 2168
#include <iostream>
#include <stdio.h>
#define LEN 100005
using namespace std;
struct pp{
    char name[100];
    int time;
};
struct pp Q[LEN];
int head, tail;
void enqueue (struct pp x){
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}
pp dequeue (){
    struct pp x = Q[head];
    head = (head + 1) % LEN;
    return x;
};
int main()
{
    int n, q;
    int nt = 0;
    struct pp u;
    scanf("%d %d", &n, &q);
    for (int i = 0; i < n; ++i) {
        scanf("%s %d", Q[i].name, &Q[i].time);
    }
    head = 0;
    tail = n;
    while (head != tail){
        u = dequeue();
        int c = min(q, u.time);
        u.time = u.time - c;
        nt += c;
        if (u.time > 0){
            enqueue(u);
        }
        else{
            cout << u.name << " " << nt << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 13280
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);const tn=():number=>{const a=input[0];input.shift();return Number(a)};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{const a=input[0];input.shift();return String(a)};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const tc=():string=>{let a=input[0].split('');const b=a[0];a.shift();if(a.length>0){input[0]=a.join('')}else{input.shift()}return String(b)};const tcc=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(tc())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const ceil=(a)=>{return Math.ceil(a)};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const gojo=(a:number,b:number):number=>{if(a%b===0)return b;return gojo(b,a%b)};const deduplicate=(a:number[])=>{return Array.from(new Set(a))};
const main=()=>{
  let s=ts(),ans=''
  for(let i=0;i<s.length;i++){
    if(i%2==0){
      ans+=s[i]
    }
  }
  to(ans)
}
main()


Measured memory_bytes: 10188
#!/usr/bin/env python3
import itertools
n = int(input())
s = input()
t = input()
for l in itertools.count(n):
    it = (s + 'a' * l)[: l - len(t)] + t
    if len(it) >= n and it.startswith(s) and it.endswith(t):
        break
print(len(it))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll llmax(ll a,ll b){return a<b ? b:a;}
int main(void){
    ll n,k; cin>>n>>k; if(!k) {cout<<n*n<<endl; return 0;}
    ll ans=0;
    for(ll i=n;i>0;i--){
        ll r = n/i;
        ll rest = n%i;
        ans += llmax(0,(i-k)*r) + llmax(0,(rest-k+1));
    }
    cout<<ans<<endl;
}


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

namespace ABC087A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x, a, b, c;
            x = int.Parse(Console.ReadLine());
            a = int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());

            c = (x - a) % b;

            Console.WriteLine(c);

            Console.ReadKey();
        }
     }
    
}


Measured memory_bytes: 11092
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    s=input()
    
    if s[2]==s[3] and s[4]==s[5]:
        print("Yes")
    else:
        print("No")

main()


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

int main(void){
    int N,K;
    cin>>N>>K;
    int A[N];
    for(int i=0;i<N;i++) cin>>A[i];
    for(int i=K;i<N;i++){
        if(A[i-K]>=A[i]){
            cout<<"No\n";
        }else{
            cout<<"Yes\n";
        }
    }
    return 0;
}

Measured memory_bytes: 4400
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
#define double long double
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    int n;
    while(scanf("%d", &n) && n){
        vector<int> d[35];
        rep(i, n){
            int f;
            scanf("%d", &f);
            rep(_, f){
                int t;
                scanf("%d", &t);
                d[t].push_back(i);
            }
        }
        lint dp[n];
        rep(i, n) dp[i] = 1LL << i;
        int ans = -1;
        rep(i, 35){
            lint tmp = 0;
            for(auto x: d[i]) tmp |= dp[x];
            for(auto x: d[i]) dp[x] = tmp;
            if(tmp == (1LL << n) - 1){
                ans = i;
                break;
            }
        }
        printf("%d\n", ans);
    }
}


Measured memory_bytes: 3228
from collections import deque
_in = list(open(0))
h, w = list(map(int, _in[0].split()))

a = [[False]*(w+2)]
for y in _in[1:]:
    a.append([False] + [x!='#' for x in y.strip()] + [False])
a.append([False]*(w+2))

ans = 0
for x in a:
    ans += sum(x)

s = deque()
s.append((1,1))

while s:
    ns = deque()
    for i, j in s:
        if i==h and j==w:
            ns = deque()
            break
        if a[i-1][j]:
            a[i-1][j] = False
            ns.append((i-1, j))
        if a[i+1][j]:
            a[i+1][j] = False
            ns.append((i+1, j))
        if a[i][j-1]:
            a[i][j-1] = False
            ns.append((i, j-1))
        if a[i][j+1]:
            a[i][j+1] = False
            ns.append((i, j+1))
        
    s = ns
    ans -= 1

if i==h and j==w:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 3316
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    string s, sr, t, tr;
    cin >> s;
    ll n = s.size();
    t = s.substr(0, (n - 1) / 2);
    tr = t;
    sr = s;
    reverse(t.begin(), t.end());
    reverse(s.begin(), s.end());
    cout << (t == tr && s == sr ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

using namespace std;
#define rep(i,l,r) for (int i=(l);i<=(r);i++)
const int maxn=20;
int a[maxn],b[maxn];
bool u[maxn];
int n,m;

int main() {
	while (scanf("%d%d\n",&n,&m),n+m) {
		rep(i,1,n) scanf("%d",a+i);
		rep(i,1,m) scanf("%d",b+i);
		memset(u,true,sizeof(u));
		rep(i,1,m) {
			rep(j,1,n)
				if (u[j]&&a[j]==b[i]) {
					u[j]=false;
					b[i]=0;
					break;
				}
		}
		int ans=0;
		rep(i,1,n) ans+=a[i];
		rep(i,1,m) ans+=b[i];
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1032
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
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;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////

int main() {
   int ans = 0;
   int N,K;
   cin >> N >> K;
   rep(i,N){int a; cin >> a;}
   int a =(N-1);
   int b =(K-1);
	ans =(a + (b - 1)) / b;
   cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;
using intk = int64_t;

int main() {
int N,K,Q;
  cin >> N>>K>>Q;
  vec P(N,0);
  for(int i=0;i<Q;i++){
	int A;
    cin >> A;
    P[A-1]++; 
  }
  for(int i=0;i<N;i++){
   // cout <<K-P[i] <<endl;
 if(0 < K+ P[i] - Q) cout <<"Yes"<<endl; 
   else cout <<"No"<<endl;
  }
}
  


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1LL << 60;

int main() {
	string S;
	cin >> S;
	if (S == "Sunny") cout << "Cloudy" << endl;
	else if (S == "Cloudy") cout << "Rainy" << endl;
	else cout << "Sunny" << endl;
}

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

int main()
{
    int N, M, C;
    cin >> N >> M >> C;

    vector<int> B;
    copy_n(istream_iterator<int>(cin), M, back_inserter(B));

    vector<vector<int>> A(N);
    for (auto &&a : A)
    {
        copy_n(istream_iterator<int>(cin), M, back_inserter(a));
    }

    vector<int> score;
    for (auto &&a : A)
    {
        int sum = C;
        for (int m = 0; m < M; ++m)
        {
            sum += a[m] * B[m];
        }
        score.push_back(sum);
    }

    cout << count_if(score.begin(), score.end(), [](int score) { return score > 0; }) << endl;
    return 0;
}


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

void main_()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> As;
    As.reserve(N);
    copy_n(istream_iterator<ll>(cin), N, back_inserter(As));

    auto As_max = *max_element(begin(As), end(As));
    auto As_gcd = accumulate(begin(As) + 1, end(As), As.front(), [](auto acc, auto n) { return __gcd(acc, n); });
    if (K > As_max || K % As_gcd != 0) {
        cout << "IMPOSSIBLE\n";
    } else {
        cout << "POSSIBLE\n";
    }
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n, mod, f[505][255][255], L[505], R[505];
pair<int, int> a[505];
inline void Add(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}
inline void Sub(int &x, int y) {
	x -= y;
	if (x < 0) x += mod;
}
int main() {
	scanf("%d%d", &n, &mod);
	for (int i = 0; i < 2 * n; i++) {
		int j;
		for (j = 0; j < 2 * n && i * i + j * j <= 4 * n * n; j++);
		R[i] = j - 1;
		if (i < n) {
			for (j = 0; j < 2 * n && i * i + j * j < n * n; j++);
			L[i] = j;
			a[i] = make_pair(L[i] - 1, R[i]);
		} else {
			L[i] = 0;
			a[i] = make_pair(R[i], -1);
		}
	}
	sort(a, a + 2 * n);
	for (int j = 0; j <= n; j++) f[0][j][j] = 1;
	for (int i = 0, u = 0, v = 0; i < 2 * n; i++) {
		a[i].first++;
		a[i].second++;
		for (int j = 0; j <= n; j++) {
			for (int k = 0; k <= j; k++) if (f[i][j][k]) {
				if (!a[i].second) {
					if (a[i].first - u - j + k > 0) Add(f[i + 1][j][k], 1ll * f[i][j][k] * (a[i].first - u - j + k) % mod);
				} else {
					if (k && a[i].first - u - j + k > 0) Sub(f[i + 1][j][k - 1], 1ll * f[i][j][k] * (a[i].first - u - j + k) % mod);
					if (a[i].second - n - v - k > 0) Add(f[i + 1][j][k], 1ll * f[i][j][k] * (a[i].second - n - v - k) % mod);
				}
			}
		}
		if (!a[i].second) u++;
		else v++;
	}
	int ans = 0;
	for (int j = 0; j <= n; j++) Add(ans, f[2 * n][j][0]);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 127360
import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
import numpy as np

INF = float('inf')
NIL = - 1


def main():
    N = int(input())
    arr = np.arange(N + 1)
    arr[::3] = 0
    arr[::5] = 0
    print(sum(arr))

    # total = 0
    # for n in range(1, N + 1):
    #     if n % 3 == 0 and n % 5 == 0:
    #         pass
    #     elif n % 3 == 0:
    #         pass
    #     elif n % 5 == 0:
    #         pass
    #     else:
    #         total += n
    # print(total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 34680
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n, d, cnt = 0;
    long x, y;
    cin >> n >> d;
    for(int i = 0; i < n; i++){
        cin >> x >> y;
        if(sqrt(x*x + y*y) <= d){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(void)
{
	int w;
	int sum;
	int i;
	
	while (scanf("%d", &w), w != -1){
		sum = 1150;
		if (30 < w){
			sum += (w - 30) * 160 + 1250 + 1400;
		}
		else if (20 < w){
			sum += (w - 20) * 140 + 1250;
		}
		else if (10 < w){
			sum += (w - 10) * 125;
		}
		printf("%d\n", 4280 - sum);
	}
	
	return (0);
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
    using namespace std;
    int main(){
		int h,w;
		string s[10];
		cin>>h>>w;
		for(int i=0;i<h;i++){
			cin>>s[i];
		}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(s[i][j]=='#'){
				if(i!=h-1 && j!=w-1){
				if(s[i+1][j]=='#' && s[i][j+1]=='#' || s[i+1][j]!='#' && s[i][j+1]!='#'){
					cout<<"Impossible"<<endl;
					return(0);
				}
				}
				}
				if(i!=0 && j!=0){
				if(s[i-1][j]=='#' && s[i][j-1]=='#'){
					cout<<"Impossible"<<endl;
					return(0);
				}
				}
			}
		}
		cout<<"Possible"<<endl;
      return(0);
    }

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


int main(){
  
  
  long long x;
  cin>>x;
  int flag = 0;
  int A,B;
  for(int i=-500 ;i<=500;i++){
   for(int j=-500;j<=500;j++){
    long long a=i,b=j;
	A = a;
	B = b;
     for(int k=1;k<=4;k++){
      a = a*i;
       b = b*j;
     }
	 //A =a;
	 //B = b;
     if(a - b == x){
      cout<<A<<" "<<B<<endl;
       return 0;
     }
   }
  }
  //cout<<A<<" "<<B<<endl;
  
  
  
  
 //return 0; 
  
  
}

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

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

int main(){
    ll n,m,ans=0;
    cin >> n >> m;
    vector<ll> h(n);
    vector<ll> hh[n];
    rep(i,n) cin >> h[i];
    for(ll i=0;i<m;i++){
        ll a,b;
        cin >> a >> b;
        hh[a-1].push_back(b-1);
        hh[b-1].push_back(a-1);
    }
    
    for(ll i=0;i<n;i++){
        bool flag=true; 
        for(ll j=0;j<hh[i].size();j++){
           if(h[i]<=h[hh[i][j]]) flag=false;
        }
        if(flag) ans++;
        //if(flag) cout << i << endl;
    }
    //cout << hh[5][0] << endl;
    //cout << hh[0].size() << endl;
    cout << ans << endl;
    return 0;
}











Measured memory_bytes: 9856
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;
long long n,a[1000000+100],sol,duz[1000000+100],q,k;
vector<pair<long long,long long>>v[1000000+100];
bool obidjen[1000000+100];
string s;
void dfs(long long x)
{
    for (long long i=0;i<v[x].size();i++)
    {
        long long y = v[x][i].first;
        if (obidjen[y])continue;
        duz[y]=duz[x]+v[x][i].second;
        obidjen[y]=true;
        dfs(y);
    }
}
int main()
{
    scanf("%lld",&n);
    for (long long i=1;i<n;i++)
    {
        long long x,y,c;
        scanf("%lld %lld %lld",&x,&y,&c);
        v[x].push_back({y,c});
        v[y].push_back({x,c});
    }
    scanf("%lld %lld",&q,&k);
    obidjen[k]=1;
    dfs(k);
    for (long long i=1;i<=q;i++)
    {
        long long x,y;
        scanf("%lld %lld",&x,&y);
        cout<<duz[x]+duz[y]<<endl;
    }
    return 0;
}


Measured memory_bytes: 36864
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>
#include <limits>
#include <tuple>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()

/*
グラフ G = (V, E) および各辺 e ∈ E の長さ length(e) を入力として受け取る。

// 初期化
for each i ∈ {1,...,n}
	for each j ∈ {1,...,n}
		di,j ← i と j を結ぶ辺 e があれば length(e) なければ 無限大

// 本計算
for each k ∈ {1,...,n}
	for each i ∈ {1,...,n}
		for each j ∈ {1,...,n}
			if (di,j > di,k + dk,j)
				di,j ← di,k + dk,j
				*/

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<int>> G(N, vector<int>(N, numeric_limits<int>::max()/3));
	vector<tuple<int, int, int>> paths;
	rep(i, N) {
		G[i][i] = 0;
	}
	rep(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		G[a][b] = c;
		G[b][a] = c;
		paths.emplace_back(a, b, c);
	}
	auto d(G);
	rep(k, N) {
		rep(i, N) {
			rep(j, N) {
				if (d[i][j] > d[i][k] + d[k][j]) {
					d[i][j] = d[i][k] + d[k][j];
				}
			}
		}
	}

	
	int ans = 0;
	for (const auto& path: paths) {
		int a, b, c;
		tie(a, b, c) = path;
		rep(i, N) {
			if (d[i][a] + c == d[i][b]) {
				ans++;
				break;
			}
		}
	}

	cout << (M-ans) << endl;
	return 0;
}


Measured memory_bytes: 384
h,w=map(int,input().split())
s=["."*(w+2)]
for i in range(h):
    s.append("."+input()+".")
s.append("."*(w+2))
dx=[-1,0,1,1,1,0,-1,-1]
dy=[1,1,1,0,-1,-1,-1,0]
ans=[]
for i in range(1,h+1):
    wp=""
    for j in range(1,w+1):
        if s[i][j]=="#":
            wp+="#"
            continue
        count=0
        for k in range(8):
            if s[i+dy[k]][j+dx[k]]=="#":
                count+=1
        wp+=str(count)
    ans.append(wp)
print(*ans,sep="\n")

Measured memory_bytes: 9192
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    a,b,c = i_map()
    ra = a%2
    rb = b%2
    rc = c%2
    if ra == rb == rc:
        m = max(a,b,c)
        ans = 0
        for i in [a,b,c]:
            ans += (m-i)//2
        print(ans)
    else:
        if ra == rb:
            a += 1
            b += 1
        elif ra == rc:
            a += 1
            c += 1
        else:
            b += 1
            c += 1
        ans = 1
        m = max(a,b,c)
        for i in [a,b,c]:
            ans += (m-i)//2
        print(ans)


if __name__=="__main__":
    main()


Measured memory_bytes: 67452