akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

double dp[310][310][310];
int main() {
  int n;
  cin >> n;
  vi a(n),c(4);
  rep(i,n){
    cin >> a[i];
    c[a[i]]++;
  }
  dp[0][0][0] = 0;
  rep(i,n+1){
    rep(j,n+1){
      rep(k,n+1){
        double sum = i+j+k;
        if(sum == 0){
          dp[i][j][k] = 0;
          continue;
        }
        dp[i][j][k] = n/sum;
        if(i-1>=0) dp[i][j][k]+= dp[i-1][j+1][k]*i/sum;
        if(j-1>=0) dp[i][j][k]+= dp[i][j-1][k+1]*j/sum;
        if(k-1>=0) dp[i][j][k]+= dp[i][j][k-1]*k/sum;
      }
    }
    
  }
  printf("%.10lf\n",dp[c[3]][c[2]][c[1]]);
  return 0;
}

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


int main()
{
    long N;
    std::cin >> N;
    std::vector<long> a;
    for(long i=0; i<N; i++){
        long temp;
        std::cin >> temp;
        a.push_back(temp);
    }
    std::sort(a.begin(),a.end());

    bool flag=true;
    for(long i=N-1; i>1; i-=2){
        if(i!=0){
            if(a[i]!=i || a[i-1]!=i){
                flag=false;
            }
        }else{
            if(a[0]!=0){
                flag=false;
            }
        }
    }
    if(!flag){
        std::cout << 0 << std::endl;
    }else{
        long result=1;
        for(long i=0; i<N/2; i++){
            result=result*2;
            result=result%(1000000000+7);
        }
        std::cout << result << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1400
a, b, k = map(int, input().split())

li = []
for i in range(a, min(a+k,b+1)):
    li.append(i)
for i in range(max(b-k+1, a), b+1):
    li.append(i)
for i in sorted(list(set(li))):
    print(i)

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

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); ++i)
double const PI = 3.1415926535897932384626433;
using P = pair<int, int>;

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if (s == "abc")
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

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

		int ans = n / 3;

//		if(n % 3 > 0 && ans > 0) {
//			ans++;
//		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 21716
n, m = map(int, input().split())
lr = [[int(i) for i in input().split(" ")] for i in range(m)]
a = max(lr, key=lambda x: x[0])[0]
b = min(lr, key=lambda x: x[1])[1]
if a <= b:
    print(b-a+1)
else:
    print(0)



Measured memory_bytes: 59992
#include <stdio.h>
int main(void)
{
  int n, a[102], i, j, col=0, t=0, max, min;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
    if(a[i] >= 3200) t++;
  }

  for(i = 0; i < 8; i++){
    for(j = 0; j < n; j++){
      if(400*i <= a[j] && a[j] < 400*(i+1)){
	col++;
	break;
      }
    }
  }
  max = col+t;

  if(col != 0) min = col;
  else min = 1;

  printf("%d %d\n", min, max);
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

// h(n, r) = c(n+r-1, r)
struct combination
{
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1)
  {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i)
    fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i)
    ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k)
  {
    if (k < 0 || k > n)
    return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};

int main()
{
  int k; cin >> k;
  queue<ll> q;
  for(int i = 1; i < 10; ++i) q.push(i);

  ll ans = 0;
  rep(i, k) {
    ans = q.front(); q.pop();
    int x = ans%10;
    for(int z = max(0, x-1); z <= min(9, x+1); ++z) q.push(ans*10+z);
  }
  cout << ans << endl;
}

Measured memory_bytes: 5100
#include<stdio.h>

int main(void)
{
 char s[100001]={0};
 char k[50001]={0};
 unsigned i;

 scanf("%s",s);

 for(i=0;s[i]!='\0';i++){
  if(i%2==0){
   k[i/2]=s[i];
  }
 }

printf("%s\n",k);

return 0;
}

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

using namespace std;
typedef long long ll;
ll a, b, c, k;

int main() 
{
    cin>>a>>b>>c>>k;
    if (k&1 == 1) printf("%lld\n", b-a);
    else printf("%lld\n", a-b);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define mod 1000000007
#define MOD 998244353
#define INF 40000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
signed main() {
    int A, B, K;
    cin >> K >> A >> B;
    for(int i = A; i <= B; i++) {
        if(i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  string str[3];
  rep(i,3) cin >> str[i];
  cout << str[0][0] << str[1][1] << str[2][2] << endl;
}


Measured memory_bytes: 3492
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

template <typename T>
bool chmax(T &a, T &b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, T &b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
T gcd(T a, T b) {
  if(b == 0) return a;
  else return gcd(b,a%b);
}


int main(){
  int N;cin >> N;
  string s; cin >> s;
  if(N <3) {
    cout << 0 << endl;
    return 0;
  }
  ll R=0,G=0,B=0;
  rep(i,N){
    if(s[i] == 'R') R++;	
    if(s[i] == 'G') G++;	
    if(s[i] == 'B') B++;	
  }
  ll dob = 0;
  for(int dis = 1; dis*2+1<=N; dis++) {
    for(int st=0; st <=N; st++) {
      int i = st;
      int j = st + dis;
      int k = st + dis + dis;
      if(k >= N) break;
      if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) dob++;
    }
  }
  cout << R*B*G - dob << endl;
  return 0;
}


Measured memory_bytes: 3164
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"3 70
7 60
1 80
4 50"# => "4",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize, t: usize,
        ct: [(usize, usize); n],
    }
    let mut l:Vec<(usize, usize)> = ct.into_iter().filter(|i| i.1 <= t).collect();

    if l.len() == 0 {
        "TLE".to_string()
    } else {
        l.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap());
        l[0].0.to_string()
    }
}

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

int main() {
  int N,count =0;
  cin>>N;
  string S;
  cin>>S;
  
  for(int i=0;i<N-2;i++){
    if(S.at(i)=='A' && S.at(i+1)=='B' && S.at(i+2)=='C') {
      count++;
    }
    
  }
  cout <<count<<endl;
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
    ll a, b;
    cin >> a >> b;
    if(a*b<0) {
        cout << "Zero" << endl;
        return 0;
    }
    if(a > 0 || (b - a)%2) {
        cout << "Positive" << endl;
    } else {
        cout << "Negative" << endl;
    }

    return 0;
}

Measured memory_bytes: 3676
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
q=deque(list(range(1,10)))
c=0
while c<a:
  t=q.popleft()
  c+=1
  if t%10!=0:
    q.append(10*t+(t%10)-1)
  q.append(10*t+(t%10))
  if t%10!=9:
    q.append(10*t+(t%10)+1)
print(t)

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

ll mod = 1e9 + 7;

vector<int> primes;
const int sieve_size = 1000;
vector<bool> sieve(sieve_size + 1, true);
void prime_sieve() {
  sieve[0] = false;
  sieve[1] = false;
  for (int i = 2; i <= sieve_size; i++) {
    if (sieve[i]) {
      primes.push_back(i);
      for (int j = 2; i * j <= sieve_size; j++)
        sieve[i * j] = false;
    }
  }
}

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

  prime_sieve();

  vector<int> v(N + 1, 0);
  for (int i = 1; i <= N; i++) {
    int n = i;
    for (auto p : primes) {
      while (n % p == 0) {
        v[p]++;
        n /= p;
      }
    }
  }

  ll ans = 1;
  rep(i, N + 1) if (v[i] != 0) ans = ans * (v[i] + 1) % mod;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
template<typename T = int, T mod = 1'000'000'007, typename U = long long>
struct umod{
	T val;
	umod(): val(0){}
	umod(U x){ x %= mod; if(x < 0) x += mod; val = x;}
	umod& operator += (umod oth){ val += oth.val; if(val >= mod) val -= mod; return *this; }
	umod& operator -= (umod oth){ val -= oth.val; if(val < 0) val += mod; return *this; }
	umod& operator *= (umod oth){ val = ((U)val) * oth.val % mod; return *this; }
	umod& operator /= (umod oth){ return *this *= oth.inverse(); }
	umod& operator ^= (U oth){ return *this = pwr(*this, oth); }
	umod operator + (umod oth) const { return umod(*this) += oth; }
	umod operator - (umod oth) const { return umod(*this) -= oth; }
	umod operator * (umod oth) const { return umod(*this) *= oth; }
	umod operator / (umod oth) const { return umod(*this) /= oth; }
	umod operator ^ (long long oth) const { return umod(*this) ^= oth; }
	bool operator < (umod oth) const { return val < oth.val; }
	bool operator > (umod oth) const { return val > oth.val; }
	bool operator <= (umod oth) const { return val <= oth.val; }
	bool operator >= (umod oth) const { return val >= oth.val; }
	bool operator == (umod oth) const { return val == oth.val; }
	bool operator != (umod oth) const { return val != oth.val; }
	umod pwr(umod a, U b) const { umod r = 1; for(; b; a *= a, b >>= 1) if(b&1) r *= a; return r; }
	umod inverse() const {
		U a = val, b = mod, u = 1, v = 0;
		while(b){
			U t = a/b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		if(u < 0)
			u += mod;
		return u;
	}
};
using U = umod<>;
template<typename U>
struct NCR {
	vector<U> fact, ifact;
	NCR(int size){
		fact.resize(size + 1); ifact.resize(size + 1);
		fact[0] = 1;
		for(int i = 1; i <= size; i++) fact[i] = fact[i - 1] * i;
		ifact[size] = fact[size].inverse();
		for(int i = size - 1; i >= 0; i--) ifact[i] = ifact[i + 1] * (i + 1);
	}
	U ncr(int n, int r){
		if(n < r) return 0;
		return fact[n] * ifact[r] * ifact[n - r];
	}
};
using N = NCR<U>;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<int> c(n);
	for(int i = 0; i < n; i++) cin >> c[i];
	sort(c.begin(), c.end());
	N kit(2 * n);
	U fa = 0, ans = 0, pw = U(2) ^ n;
	auto col = [&](int c){
		return U(2) ^ c;
	};
	auto fcol = [&](int c){
		if(c == 0) return U(1);
		return (U(2) ^ (c - 1)) * c + col(c);
	};
	for(int i = 0; i < n; i++){
		U ways = fcol(n - i - 1);
		ways *= (U(2) ^ (n - i));
		ways *= (U(2) ^ i);
		ways *= (U(2) ^ i);
		ans += ways * c[i];
	}
	cout << ans.val << endl;
	return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll M = 0;
ll C[3];
ll t;
ll ret = 0;
string s;
bool ok = true;

void input() {
  IN(N);
  IN(M);
  REP(i, 3) {
    C[i] = -1;
  }
  REP(i, M) {
    ll s, c;
    IN(s);
    IN(c);
    if (C[s-1] == -1) {
      C[s-1] = c;
    } else {
      if (C[s-1] != c) {
        ok = false;
      }
    }
  }
}

void solve() {
  
  if (N == 1) {
    if (C[0] == 0 || C[0] == -1) {
      PRINT(0);
      return;
    }
  }
  if (C[0] == 0) ok = false;
  if (!ok) {
    PRINT(-1);
    return;
  }

  REP(i, N) {
    if (i == 0) {
      if (C[i] == -1) {
        cout << 1;
      } else {
        cout << C[i];
      }
    } else {
      if (C[i] == -1) {
        cout << 0;
      } else {
        cout << C[i];
      } 
    }
  }
  cout << endl;
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
n,m = map(int,input().split())
xyz = [tuple(map(int,input().split())) for i in range(n)]
ma = 0
for i in range(-1,2,2):
  for j in range(-1,2,2):
    for k in range(-1,2,2):
      c = 0
      sx = sorted(xyz,key=lambda x:i*x[0]+j*x[1]+k*x[2],reverse=1)
      for l in range(m):
        c += i*sx[l][0]+j*sx[l][1]+k*sx[l][2]
      ma = max(ma,c)
print(ma)

Measured memory_bytes: 41004
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    // int A[N];

    int min_in_trend = INT_MAX;
    long money = 1000;
    int prev = -1;

    for (int i = 0; i < N; i++)
    {
        // cout << money << endl;
        int A;
        cin >> A;
        if (A < prev)
        {
            // sell
            money += (prev - min_in_trend) * (long)(money / min_in_trend);
            min_in_trend = INT_MAX;
        }
        if (A < min_in_trend)
        {
            min_in_trend = A;
        }
        prev = A;
    }
    if (prev > min_in_trend)
    {
        money += (prev - min_in_trend) * (long)(money / min_in_trend);
    }
    cout << money << endl;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

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

    long long sum = 0;

    for (int i = 1; i <= N; ++i) {
        if (i % 3 > 0 && i % 5 > 0) {
            sum += i;
        }
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
using namespace std;
 
int main(){
	long long s;
	cin>>s;
	
	const int v=1000000000;
	
	int x=(v-s%v)%v;
	int y=(s+x)/v;
	
	cout<<"0 0 1000000000 1 "<<x<<" "<<y<<endl;
	
	//system("pause");
}

Measured memory_bytes: 256
#!/usr/bin/env python3


def main():
    H, W = map(int, input().split())
    if H % 3 == 0 or W % 3 == 0:
        print(0)
    else:
        ans = min(W,H)

        # Hを1:2で分割
        for i in range(3):
            d = (H // 3)- 1 + i
            if d > 0:
                choco = [d * W, (H-d) * (W//2), (H-d) * (W - W//2)]
                ans = min(ans, max(choco) - min(choco))
        
        # Wを1:2で分割
        for i in range(3):
            d = (W // 3)- 1 + i
            if d > 0:
                choco = [d * H, (W-d) * (H//2), (W-d) * (H - H//2)]
                ans = min(ans, max(choco) - min(choco))
        
        print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
A, B, N = MAP()

x = N

ans1 = (A * (B-1)//B) - A * ((B-1) // B)
ans2 = ((A * N)//B) - A * (N // B)
# print(ans2)
# ans = max(A-1, ans2)

if N < B:
    print(ans2)
else:
    
    print(ans1)

# exit()

exit()
# exit()
memo = [0] * (B+1)
ma = 0
for x in range(1, B+1):
    memo[x] = int((A * (x)/B)) - A * ((x)  // B)
    ma = max(memo[x], ma)
# print(memo[N-1])
print(memo)
# print(N)

# exit()
if N >= B:
    ans = ma
else:
    ans = memo[N]
print(ans)


Measured memory_bytes: 10052
#include<bits/stdc++.h>
#define N 2000009
#define ll long long
#define ld long double
#define ff first
#define ss second
#define inf 1000000005
#define mod 1000000007
using namespace std;
ll n, dp[3001][3001], ans, p[3001];
string s;
int main() {
    cin>>n>>s;
    dp[1][1] = 1;
    for(int i=2;i<=n;i++) {
        for(int j=1;j<i;j++)
            p[j] = (dp[i - 1][j] + p[j - 1]) % mod;
        for(int last=1;last<=i;last++) {
            int l = last, r = i - 1;
            if(s[i - 2] == '<') {
                l = 1;
                r = last - 1;
            }
            dp[i][last] += (p[r] - p[l - 1]);
            if(dp[i][last] < mod)
                dp[i][last] += mod;
            if(i == n) {
                ans += dp[i][last];
                ans %= mod;
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 49744
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}
int main()
{
    ll n;
    cin>>n;
    vpll v;
    rep(i,n)
    {
        ll x,y;
        cin>>x>>y;
        v.pb(mp(x,y));
    }
    sort(all(v));
    ll coun=MAX;
    vpll p;
    if(n==1)
    {
        cout<<1;
        return 0;
    }
    rep(i,v.size()-1)
    {
        repA(j,i+1,v.size()-1)
        {
            if(v[j].f-v[i].f==0&&v[j].s-v[i].s==0)
                continue;
            p.pb(mp(v[j].f-v[i].f,v[j].s-v[i].s));
        }
    }
    sort(all(p));
    ll maxi=MIN;
    ll ans=1;
    rep(i,p.size()-1)
    {
        if(p[i].f==p[i+1].f&&p[i].s==p[i+1].s)
            ans++;
        else
        {
            maxi=max(maxi,ans);
            ans=1;
        }
    }
    maxi=max(maxi,ans);
    cout<<n-maxi;
    /*rep(i,p.size())
    {
        ll ans=1;
        repA(j,1,v.size()-1)
        {
            if(v[j].f-v[j-1].f==p[i].f&&v[j].s-v[j-1].s==p[i].s)
                continue;
            else
                ans++;
        }
        if(p[i].f==0&&p[i].s==0)
            continue;
        coun=min(coun,ans);
    }
    cout<<coun;*/
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
using namespace std;
int main(){
    int N,A,B;
    cin >> N >> A >> B;
    
    int train = 0;
    train = A*N;
    
    cout << min(train,B) << endl;
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

// int MOD = 998244353;
int MOD = 1000000007;

signed main(){
    
    ll n;
    cin >> n;
    ll cnt[2] = {0};
    vector<ll> x(n);
    vector<ll> y(n);
    vector<ll> u(n);
    vector<ll> v(n);
    rep(i,n){
        cin >> x[i]>> y[i];
        u[i] = x[i] + y[i];
        v[i] = x[i] - y[i];
        cnt[(abs(x[i])+abs(y[i]))%2]++;
    }
    if(cnt[0]*cnt[1] != 0){
        cout << -1 << endl;
        return 0;
    }

    ll d[33];
    d[32] = 1;
    for(int i = 31;i >= 0;i--)d[i] = 2*d[i+1];

    if(cnt[1]){
        cout << 33 << endl;
        rep(i,33)cout << d[i] << " ";
        cout << endl;
    }else{
        cout << 34 << endl;
        rep(i,33)cout << d[i] << " ";
        cout << 1 << endl;
    }

    rep(i,n){
        ll U=0,V=0; 
        if(cnt[0]){
            u[i]--;
            v[i]--;
        }
        rep(j,33){
            if(U < u[i] && V < v[i]){
                cout << 'R';
                U += d[j];
                V += d[j];
            }else if(U > u[i] && V < v[i]){
                cout << 'D';
                U -= d[j];
                V += d[j];
            }else if(U < u[i] && V > v[i]){
                cout << 'U';
                U += d[j];
                V -= d[j];
            }else if(U > u[i] && V > v[i]){
                cout << 'L';
                U -= d[j];
                V -= d[j];
            }
        }
        if(cnt[1])cout << endl;
        else cout << 'R' << endl;
    }








    
    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc111.contest.atcoder.jp/tasks/arc103_b


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
#include<map>
#include<functional>
using namespace std;

const int mod = 1e9+7;
typedef long long ll;
typedef unsigned long long ull;

struct Edge{
    int dst;
    int weight;
    Edge(int dst, int weight): dst(dst), weight(weight) {}
};

struct TmpDist{
    int vertex;
    int dist;
    TmpDist(int vertex, int dist): vertex(vertex), dist(dist) {}
    bool operator< (const TmpDist& right)const{
        return dist > right.dist;
    }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const int INFINT = INT_MAX/2;

vector<int> dijkstra(Graph &G, int r){
    int V = G.size();
    vector<int> dist(V, INFINT);
    priority_queue<TmpDist> pq;
    vector<bool> check(V, false);
    TmpDist init(r, 0);
    pq.push(init);
    while(!pq.empty()){
        TmpDist td = pq.top();pq.pop();
        int now = td.vertex;
        if(!check[now]){
            check[now] = true;
            dist[now] = td.dist;
            for (int i=0;i<G[now].size();i++){
                if(dist[G[now][i].dst] > td.dist + G[now][i].weight){
                    TmpDist tdCandidate(G[now][i].dst, td.dist + G[now][i].weight);
                    pq.push(tdCandidate);
                }
            }
        }
    }
    return dist;
}

int main(){
    int V, E, r;
    cin >> V >> E >> r;
    Graph G(V);
    int s, t, w;
    for(int i=0;i<E;i++){
        cin >> s >> t >> w;
        Edge e(t, w);
        G[s].push_back(e);
    }

    vector<int> dist = dijkstra(G, r);
    for (int i=0;i<V;i++){
        if(dist[i] == INFINT) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }
    return 0;
}


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

long long f(long long a) {
	if (a == 0) {
		return 64;
	}
	return __builtin_clzll(a);
}

long long get(long long l, long long r) {
	long long x = 63 - f(l), y = 63 - f(r);
//	cout << "72 " << l << " " << r << " " << x << " " << y << endl;
	if (r == l) {
		return 1;
	}
	if (r < l) {
		return 0;
	}
	if (x == y) {
	//	cout << "71 " << endl;
		return get(l - (1ll << x), r - (1ll << x));
	}
	else {
		long long c = r - (1ll << y);
		long long z = 64 - f(c);
		long long l2 = l;
		if (l2 % (1ll << z)) {
			l2 += (1ll << z) - (l % (1ll << z));
		}
		long long ans = (1ll << y) - l;
	//	cout << "74 " << ans << endl;
	//	return 1ll * (1ll << z) * (get(l2 >> z, (1ll << (y - z)) - 1) + 1) + get(l, (1ll << y) - 1);
		if (l <= (1ll << z)) {
			ans += (1ll << y);
		}
		else {
			ans *= 2;
			ans += (1ll << z);
		}
		return ans;
	}
}

int32_t main() {
	long long a, b;
	cin >> a >> b;
	cout << get(a, b) << endl;
	
	
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){

  char S[11],T[11],U[11];
  int s,t;
  scanf("%s %s",S,T);
  scanf("%d %d",&s, &t);
  scanf("%s", U);

  if(strcmp(S,U)==0){
    s--;
  }else{
    t--;
  }
  printf("%d %d\n",s,t);

  return 0;
}


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

using namespace std;

typedef long long ll;
const ll MAX = (1ll << 59);

ll dijkstra(auto& graph){
  int n = graph.size();
  vector<ll> dist(n, MAX);
  vector<bool> fin(n, false);
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq;
  
  int turn = 0;
  pq.push(make_pair(0ll, 0));
  do{
    auto s = pq.top();
    pq.pop();
    fin[s.second] = true;
    for(auto v : graph[s.second]){
      if(fin[v.second]) continue;
      dist[v.second] = min(s.first + v.first, dist[v.second]);
      pq.push(make_pair(dist[v.second], v.second));
    }
    turn++;
  }while(!pq.empty() && !fin[n - 1] && turn < 1e6);
  
  return dist[n - 1];
}

int main(){
  int N, M;
  cin >> N >> M;
  
  vector<vector<pair<ll, int>>> graph(N);
  
  for(int i = 1; i < N; i++) graph[i].emplace_back(make_pair(0, i - 1));
  
  for(int i = 0; i < M; i++){
    int L, R;
    ll C;
    cin >> L >> R >> C;
    graph[L - 1].emplace_back(make_pair(C, R - 1));
  }
  
  ll dist = dijkstra(graph);
  cout << (dist == MAX ? -1 : dist) << endl;
}

Measured memory_bytes: 39780
from collections import deque

def dfs(start):
  stack = deque([[start, 0]])
  while stack:
    p, c = stack.popleft()
    for next, distance in graph[p]:
      if visited[next] == -1:
        if distance % 2 == 0:
          visited[next] = int(c)
        else:
          visited[next] = int(not c)
        stack.append([next, visited[next]])

n = int(input())
graph = [[] for _ in range(n)]
for i in range(n-1):
  a, b, w = map(int, input().split())
  graph[a - 1].append([b - 1, w])
  graph[b - 1].append([a - 1, w])

visited = [-1] * n
visited[0] = 0
dfs(0)
for v in visited:
    print(v)

Measured memory_bytes: 46012
is_p = []
pre = []

N = 100003

for i in range(N):
    is_p.append(1)
    pre.append(0)

is_p[0] = 0
is_p[1] = 0
for i in range(2,N):
    if is_p[i] == 1 :
        for j in range(i*i,N,i) :
            is_p[j] = 0

for i in range(1,N) :
    if i % 2 == 1 :
        if is_p[i] and is_p[ (i+1)//2 ] :
            pre[i] = 1
    pre[i] = pre[i-1] + pre[i]

q=int(input())
for qaq in range(q) :
    l,r = map(int,input().split())
    print(pre[r] - pre[l-1])

Measured memory_bytes: 7256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef int ll;
typedef long double ld;
const ll N = 50005;
char en = '\n';
ll inf = 1e16;
ll mod = 1e9 + 7;
ll power(ll x, ll n, ll mod) {
  ll res = 1;
  x %= mod;
  while (n) {
    if (n & 1)
      res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;

  map<string, vector<pair<ll, ll>>> par;
  for (ll i = 1; i <= n; i++) {
    string s;
    ll x;
    cin >> s >> x;
    par[s].push_back({x, i});
  }

  for (auto &it : par) {
    vector<pair<ll, ll>> curr = it.second;
    sort(curr.begin(), curr.end());
    reverse(curr.begin(), curr.end());
    for (pair<ll, ll> &x : curr)
      cout << x.second << en;
  }
  return 0;
}

/*
1
11 5 8 3 4
NEESSWWNESE
 */

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

struct card{
	int rank;
	char suit[1];
};
typedef struct card Card;

int main(){
	Card trump[52],cards[52];
	char a,b;
	int i,k,j=0,n,idx[52];
	for(i=0;i<4;i++){
		for(k=1;k<=13;k++){
			trump[j].rank=k;
			if(i==0)strcpy(trump[j].suit,"S");
			if(i==1)strcpy(trump[j].suit,"H");
			if(i==2)strcpy(trump[j].suit,"C");
			if(i==3)strcpy(trump[j].suit,"D");
			j++;
		}
	}
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %d",&cards[i].suit,&cards[i].rank);
	}
	j=0;
	for(i=0;i<52;i++){
		for(k=0;k<n;k++){
			if(trump[i].rank==cards[k].rank){
				if(strcmp(trump[i].suit,cards[k].suit)==0)break;
			}
			if(k==n-1){
				if(trump[i].rank!=cards[k].rank || strcmp(trump[i].suit,cards[k].suit)!=0){
					idx[j]=i;
					j++;
				}
			}
		}
	}
	for(i=0;i<j;i++){
		k=idx[i];
		printf("%s %d\n",trump[k].suit,trump[k].rank);
	}
	return 0;
}


Measured memory_bytes: 1804
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<list>
#include<functional>
#define mp make_pair
#define X first
#define Y second
#define INF 1987654321
#define PI 3.14159265358979323846264
#define MOD 1000000007LL
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef complex<double> base;
ll POW(ll a, ll b) { if (b == 0)return 1; if (b == 1)return a; if (b & 1)return (a*POW(a, b - 1)) % MOD; ll t = POW(a, b / 2); return (t*t) % MOD; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
int dx[] = { 0,-1,1,0 }, dy[] = { 1,0,0,-1 };//동북남서

ll a[100002], b[100002], MAX1[100002], MAX2[100002];
int main() {
	int n;
	scanf("%d", &n);
	fup(i, 1, n, 1)scanf("%lld", a + i);
	fup(i, 1, n, 1)scanf("%lld", b + i);
	fup(i, 1, n, 1)
	{
		if (a[i] != a[i - 1])MAX1[i] = -a[i];
		else MAX1[i] = a[i];
	}
	fdn(i, n, 1, 1)
	{
		if (b[i] != b[i + 1])MAX2[i] = -b[i];
		else MAX2[i] = b[i];
	}
	ll ans = 1;
	fup(i, 1, n, 1)
	{
		ll A = MAX1[i], B = MAX2[i];
		if (A < 0 && B < 0)
		{
			if (A != B)
			{
				puts("0");
				return 0;
			}
		}
		else if (A > 0 && B < 0)
		{
			if (A < -B)
			{
				puts("0");
				return 0;
			}
		}
		else if (A < 0 && B > 0)
		{
			if (B < -A)
			{
				puts("0");
				return 0;
			}
		}
		else
			ans = (ans*(min(A, B))) % MOD;
	}
	printf("%lld", ans);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, n) {
    string s;
    cin >> s;
    sort(all(s));
    mp[s]++;
  }
  ll ans = 0;
  for (auto e : mp) ans += 1LL * e.S * (e.S - 1) / 2;
  cout << ans << endl;
}


Measured memory_bytes: 11264
#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

int main(){
    long N,T;
    cin>>N>>T;

    vector<long long> vec(N);
    long long ans=0;

    cin>>vec[0];

    ans+=T;

    for(long i=1;i<N;++i){
        cin>>vec[i];
        if(vec[i-1]+T<vec[i]){
            ans+=T;
        }else{
            ans+=vec[i]-vec[i-1];
        }
    }


    cout<<ans<<endl;
}

Measured memory_bytes: 1792
from collections import defaultdict
N, Q = map(int, input().split())
 
tree = defaultdict(set)
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a].add(b)
    tree[b].add(a)

counter = defaultdict(int)
for i in range(Q):
    p, x = map(int, input().split())
    counter[p] += x

cur_node = set()
cur_node.add(1)
pre_node = set()
while len(cur_node) != 0:
  next_node = set()
  for ni in cur_node:
    for nj in tree[ni]:
      if nj in pre_node:
        continue
      counter[nj] += counter[ni]
      next_node.add(nj)
  pre_node = cur_node
  cur_node = next_node
print(' '.join((str(counter[i]) for i in range(1, N + 1))))

Measured memory_bytes: 125740
# D
import math
X = int(input())

B = -math.floor(math.pow(X, 0.2))
for b in range(B, 100000):
    tmp = math.pow(X + b ** 5, 0.2)
    if math.floor(int(tmp) - tmp + 1.0e-6) == 0:
        break
        
tmp = int(tmp)
print(tmp, b)

Measured memory_bytes: 9440
import java.util.Scanner;
 
class Main
{
  public static void main(String[] args)
  {
     int n,u;
		      Scanner sc = new Scanner(System.in);
		      n = sc.nextInt();
		      u = n%10;
		    if(u == 2 ||u == 4 ||u == 5 ||u == 7 ||u == 9 )
		    {
		      System.out.println("hon");
		    }
		    if(u == 0 ||u == 1 ||u == 6 ||u == 8 )
		    {
		      System.out.println("pon");
		    }
		    if(u == 3)
		    {
		      System.out.println("bon");
		    }
		  
    
  }
}
  

Measured memory_bytes: 35740
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int h = n / 100;
		int t = (n % 100) / 10;
		int o = n % 10;

		if (h == 7 || t == 7 || o == 7) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}

		scanner.close();
	}

}


Measured memory_bytes: 35736
#include <iostream>
#include <stack>
#include <cstring>
#include <algorithm>
#include <vector> 
#include <map>
#include <string>
using namespace std;
int a[30];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	string s; cin >> s;
	for (int i = 0; i < 4; i++) {
		a[s[i] - 'A'] += 1;
	}
	int ans = 0;
	for (int i = 0; i < 27; i++) {
		if (a[i] > 0)ans++;
	}
	if (ans == 2) {
		cout << "Yes" << '\n';
	}
	else {
		cout << "No" << '\n';
	}



}

Measured memory_bytes: 256
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();
		boolean ans=false;
      if(b%2!=0){
        System.out.println("No");
                 }else{
      for(int i=0; i<=a; i++){
      if((2*i)+(4*(a-i))==b){
        ans=true;
        break;
      }
      }
      if(ans){
      System.out.println("Yes");
      }else{
      System.out.println("No");
      }}
	}
}

Measured memory_bytes: 35848
import bisect

N, M, K = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

da = [0 for _ in range(N+1)]
for i in range(N):
    da[i+1] = da[i] + a[i]
db = [0 for _ in range(M+1)]
for i in range(M):
    db[i+1] = db[i] + b[i]

ans = 0
for i in range(N+1):
    if da[i] > K:
        break
    ans = max(ans, i + bisect.bisect_right(db, K-da[i]) - 1)
print(ans)

Measured memory_bytes: 47300
n = int(input())
a = [int(input()) for _ in range(n)]
gr = 0
for x in a:
	gr ^= x
exist = set()
for i in range(n):
	cnt = 0
	while (a[i]>>cnt)&1 == 0:
		cnt += 1
	exist.add(cnt)
ok = True
ans = 0
for i in range(35, -1, -1):
	if (gr>>i)&1:
		if i not in exist:
			ok = False
		else:
			gr %= (1<<(i+1))
			gr = (1<<(i+1)) - gr - 1
			ans += 1
	else:
		gr %= (1<<(i+1))
if ok:
	print(ans)
else:
	print(-1)

Measured memory_bytes: 7052
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
 
int N,M;
int dp[60060];

signed main() {
    IOS();
    cin>>N>>M;
    vint c(M);
    rep(i,0,M){
        cin>>c[i];
    }
    
    rep(j,0,60060)dp[j]=INF;
    dp[0]=0;
    rep(j,0,50050){
        if(dp[j]==INF)continue;
        rep(i,0,M){
            chmin(dp[j+c[i]],dp[j]+1);
        }
    }
    cout<<dp[N]<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 3656
from collections import defaultdict
S = list(input())
N = len(S)
K = int(input())
T = S.copy()
S += S
ans = 0
cnt = 0
f = defaultdict(int)
for t in T:
    f[t] += 1
if len(f) == 1:
    print(N * K // 2)
    exit()
for i in range(1, N):
    if S[i - 1] == S[i]:
        cnt += 1
        S[i] = "-1"
ans += cnt
if T[0] == T[-1] and S[N - 1] != "-1":
    cnt2 = 1
    T[0] = "-1"
    for i in range(1, N):
        if T[i] == T[i - 1]:
            cnt2 += 1
            T[i] = "-1"
    ans += cnt2 * (K - 1)
else:
    ans += cnt * (K - 1)
print(ans)


Measured memory_bytes: 3316
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int ans = 0;

		if ((A <= 9) && (B <= 9)) {
			ans = (A * B);
		} else {
			ans = -1;
		}

		System.out.println(ans);

		sc.close();
	}
}

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

typedef long long ll;
const ll INF = 1e18;
const int BIG = 1e9 + 555;

string date[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
string s;

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

	cin >> s;

	if(s == "SUN"){
		cout << "7\n";
		return 0;
	}
	
	for(int i = 0; i < 7; i++){
		if(date[i] == s){
			int ans = 0;
			for(int j = i; ; j = (j + 1) % 7, ans++){
				if(date[j] == "SUN"){
					break;
				}
			}
			cout << ans << '\n';
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
a, b, c, d = map(int, input().split())  # x = 1, y = 2

i = 1
while a > 0 and c > 0:
    if i % 2 == 1:
        c = c - b
    else:
        a = a - d
    i += 1

# print(a, c)
if a < c:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
vector<int> a[10001];
vector<int> b;
list<int> q;
bool vis[10001];
int v,e,x,y;
void dfs(int x){
	 vis[x]=true;
	 for (int i=0; i<a[x].size(); i++){
	 	 if (!vis[a[x][i]])
	 	    dfs(a[x][i]);
	 }
	 q.push_back(x);
}
int main(){
	memset(vis,false,sizeof(vis));
	cin>>v>>e;
	for (int i=0; i<e; i++){
		cin>>x>>y;
		a[x].push_back(y); 
	}
	for (int i=0; i<v; i++){
		if (!vis[i])
		   dfs(i); 
	}
	for (list<int>::iterator it=q.begin(); it!=q.end(); it++)
	     b.push_back(*it);
	reverse(b.begin(),b.end());
	cout<<b[0];
	for (int i=1; i<b.size(); i++)
	    cout<<' '<<b[i];
	cout<<'\n';
	return 0;
}


Measured memory_bytes: 3844
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int c[1000005];

inline void solve(){
    int n; cin>>n; 
    int g=0,mx=0;
    for (int i=0,a;i<n;i++){
        cin >> a ; 
        c[a]++;
        g = __gcd(g,a);
    }
    if (g != 1){
        cout << "not coprime" << endl;
        return ;
    }
    int p=1;
    for (int i=2;i<=1000000;i++){
        int cur=0;
        for (int j=i;j<=1000000;j+=i) cur += c[j];
        if (cur>1) {
            p = 0; break;
        }
        if (i&1) i++;
    }
    if (p>0) cout << "pairwise coprime" << endl;
    else cout << "setwise coprime" << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}
// https://atcoder.jp/contests/abc177/tasks/abc177_e


Measured memory_bytes: 11452