akhauriyash/Code-Regression huggingface dataset:
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
# fractions.gcd() を用いること
# math.log2()はatcoderでは対応していない．留意せよ．

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n, k = map(int, input().split())
    d = int(math.log(n, k) + 1)
    print(1 if d == 0 else d)


if __name__ == '__main__':
    main()


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

using namespace std;
typedef pair<int,int> pii;
typedef long long int ll;

#define INF 1 << 30
#define REP(i,n) for(ll i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(ll i=(k);i<(int)(n);i++)




string s;

ll cs =0;
ll ct =0;
ll cnt = 0;
int main(){
  cin >> s;
  REP(i,s.size()){
    if(s[i]=='S') cs++;
    if(cs>0 && s[i]=='T'){
      cs--;
      cnt++;
    }
  }
  cout << s.size() - cnt*2 << endl;
}


Measured memory_bytes: 640
/*
                        Author: Ankit Kaul
**********************Code Belongs to Respective Author Only************************************
*/
/*#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
#define endl       '\n'
#define PI          3.141592653589
#define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define M           1000000007
#define int         long long int
#define inf         INT_MAX
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
using namespace std;
int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
int power(int x,int n){
    int result=1;
    while(n>0)
        {   if(n % 2 ==1)
            result=(result * x)%M;
            x=(x*x)%M;
            n=n/2;
        }
    return result%M;
}      
bool isPrime(int n)
    {
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
    }
int inv(int a,int m)
{   return power(a,m-2);
}
int lcm(int a,int b)
{   return a*b/(gcd(a,b));
}
signed main()
{   jaldi
    string str;
    cin>>str;
    if(str[2]==str[3] && str[4]==str[5])
    cout<<"Yes";
    else
    cout<<"No";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;
ll mod = 1e+9 + 7;

using Graph = vector<vector<int>>;

// DFS
vector<bool> seen;
void dfs(const Graph &G, int v) {
    seen[v] = true;

    for (auto next_v : G[v]) { 
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v);
    }
}

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

    Graph G(N);
    REP(i, M) {
        int a, b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    seen.assign(N, false);

    int res = 0;    //閉路の数
    REP(i, N){
        if(seen[i] == false){
            dfs(G, i);
            res++;
        }
    }

    int ans = res - 1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9520
var
    l,i,t,k,cnt,n:longint;
begin
    readln(l);n:=l;
    while l>0 do
        begin
            inc(k);
            if l mod 2=1 then inc(cnt);
            l:=l>>1;
        end;
    dec(cnt);
    writeln(k,' ',2*(k-1)+cnt);
    t:=1;
    for i:=1 to k-1 do
        begin
            writeln(i,' ',i+1,' ',0);
            writeln(i,' ',i+1,' ',t);
            t:=t*2;
        end;
    cnt:=k-1;dec(n,1<<cnt);
    for i:=k-2 downto 0 do
        begin 
            if n>=1<<i then 
                begin
                    dec(n,1<<i);
                    writeln(cnt,' ',k,' ',t);
                    inc(t,1<<i);
                end;
            dec(cnt);
        end;
end.

Measured memory_bytes: 128
# Generated by AtcoderGreedy on 2018-05-26
# ARC098 D
# Your code here

N = gets.chomp.to_i
A = gets.chomp.split(' ').map(&:to_i)

Span = Struct.new(:head, :tail, :xor) do
  def self.singleton(i)
    new(i, i, A[i])
  end

  def drop
    self.class.new(head + 1, tail, xor - A[head])
  end

  def append(i)
    current = self
    current = current.drop while current.xor & A[i] != 0
    self.class.new(current.head, current.tail + 1, current.xor + A[i])
  end
end

current = Span.singleton(0)

ret = 1

(1...N).map do |i|
  current = current.append i
  ret += current.tail - current.head + 1
end

puts ret


Measured memory_bytes: 22284
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {

	int n, k;
	cin >> n >> k;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		int t;
		cin >> t;
		v.push_back(t);
	}

	long long int s = 0;
	long long int res = 0;
	for (int i = 0; i < k; i++) {
		s += v[i];
	}
	res = max(res, (s + k));
	for (int i = k; i < n; i++) {
		s += v[i];
		s -= v[i - k];
		res = max(res, (s + k));
	}
	cout << res / 2;
	if (res % 2 == 1)
		cout << ".5";
	cout << endl;
}









Measured memory_bytes: 1400
#include "bits/stdc++.h"
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define IOS std::cin.tie(0),std::ios::sync_with_stdio(false)

namespace idaten {

	using namespace std;
	using ll = int_fast64_t;
	using ull = uint_fast64_t;
	using P = std::pair<int64_t, int64_t>;
	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<class T> inline std::istream& operator >> (std::istream& is, std::vector<T>& v) { for (T& x : v) { is >> x; }return is; }
	template<class T> inline std::ostream& operator << (std::ostream& os, const std::vector<T>& v) {
		for (auto itr = v.begin(); itr != v.end();) { os << (*itr) << ((++itr != v.end()) ? " " : ""); }
		return os;
	}
	template<class V, typename T>inline void fill(V& v, const T& val) { v = val; }
	template<class V, typename T>inline void fill(std::vector<V>& v, const T& val) { for (V& x : v) { fill(x, val); } }
	template<class V, typename H>inline void resize(std::vector<V>& v, const H h) { v.resize(h); }
	template<class V, typename H, typename... T>inline void resize(std::vector<V>& v, const H& h, const T& ... t) { v.resize(h); for (auto& x : v) { resize(x, t...); } }
	inline void put() {}
	template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
	template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }

	void solve() {
		IOS;
		ll n, k;
		cin >> n >> k;
		vector<ll> a(n);
		cin >> a;
		REP(i, n) {
			a[i]--;
		}
		vector<ll> loop(n, -1);
		//loop[0] = 0;
		int now = 0;
		int next = 0;
		ll l = 0;
		ll c = 0;
		REP(i, n*4) {
			next = a[now];
			if (loop[next] >= 0) {
				l = i+1 - loop[next];
				c = loop[next];
				break;
			} else {
				loop[now] = i;
				now = next;
			}
		}
		ll res = 0;
		if (k <= c) {
			int now = 0;
			REP(i, k) {
				now = a[now];
			}
			res = now;
		} else {
			k -= c;
			k %= l;
			k += c;
			int now = 0;
			REP(i, k) {
				now = a[now];
			}
			res = now;
		}
		put(res + 1);
	}
} // namespace idaten


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


Measured memory_bytes: 6368
A,B,K = map(int,input().split())
l = []
for i in range(A,A+K):
  if i > B:
    break
  l.append(i)

for i in range(B, B-K,-1):
  if i < A:
    break
  if not i in l:
    l.append(i)
l.sort()

for i in l:
  print(i)


Measured memory_bytes: 9176
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(void)
{
    int N,MAX=100000000;
    cin >> N;
    vector<int> array(N,0);
    for(int i = 0;i<N;i++)
    {
        cin >> array[i];    
    }
    for(int i=0;i<=100;i++)
    {
        int sum =0;
        for(int j=0;j<N;j++)
        {
            sum+=pow(array[j]-i,2);
        }
        MAX = min(sum,MAX);
    }
    cout << MAX << endl;
}


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

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

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

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

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

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

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

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

#[allow(unused_mut)]
#[allow(non_snake_case)]
fn main() {
    input!{
        H: i32,
        W: i32,
        h: i32,
        w: i32,
    }
    println!("{}", H*W - H*w - h*W + h*w);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE

int dp[2000][40][40];
int ok[40][40][40][40];
int wt[40][40],wy[40][40];

int dist[40][40];

void solve(){
  int h,w;
  cin>>h>>w;
  if(h==0&&w==0) exit(0);
  memset(ok,0,sizeof(ok));
  for(int i=0;i<40;i++)
    for(int j=0;j<40;j++)
      wt[i][j]=wy[i][j]=1;
  
  for(int i=0;i<h;i++){    
    for(int j=1;j<w;j++) cin>>wy[i][j];
    if(i+1==h) break;
    for(int j=0;j<w;j++) cin>>wt[i+1][j];
  }
    
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(!wt[i][j]) ok[i][j][i-1][j]=1;
      if(!wt[i+1][j]) ok[i][j][i+1][j]=1;
      
      if(!wy[i][j]) ok[i][j][i][j-1]=1;
      if(!wy[i][j+1]) ok[i][j][i][j+1]=1;
    }
  }

  auto idx=
    [](int y,int x,int k){
      int res=0;
      if(k>=2) res+=1000;
      if(k==0) x++;
      if(k==2) y++;
      res+=y*32+x;
      return res;
    };
  
  const int INF = 1e7;
  int dy[]={0,0,1,-1};
  int dx[]={1,-1,0,0};
  auto in=[&](int y,int x){return 0<=y&&y<h&&0<=x&&x<w;};

  using P = pair<int, int>;
  auto precalc=
    [&](int val){      
      for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
          dp[val][i][j]=INF;
      
      queue<P> qu;
      dp[val][h-1][w-1]=0;
      qu.emplace(h-1,w-1);
      
      while(!qu.empty()){
        int y,x;
        tie(y,x)=qu.front();qu.pop();
        for(int k=0;k<4;k++){
          if(idx(y,x,k)==val) continue;
          int ny=y+dy[k],nx=x+dx[k];
          if(!in(ny,nx)) continue;
          if(!ok[y][x][ny][nx]) continue;          
          int nd=dp[val][y][x]+1;
          if(dp[val][ny][nx]<=nd) continue;
          dp[val][ny][nx]=nd;      
          qu.emplace(ny,nx);
        }
      }
    };

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){      
      if(!wy[i][j]) precalc(idx(i,j,1));
      if(!wt[i][j]) precalc(idx(i,j,3));
    }
  }      
  
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      dist[i][j]=INF;
  
  using P = pair<int, int>;
  using PP = pair<int, P>;
  priority_queue<PP, vector<PP>, greater<PP> > pq;
  
  dist[h-1][w-1]=0;
  pq.emplace(dist[h-1][w-1],P(h-1,w-1));
  
  while(!pq.empty()){
    int d=pq.top().first;
    int y,x;
    tie(y,x)=pq.top().second;
    pq.pop();
    if(dist[y][x]<d) continue;
    for(int k=0;k<4;k++){
      int ny=y+dy[k],nx=x+dx[k];
      if(!in(ny,nx)) continue;
      if(!ok[y][x][ny][nx]) continue;
      int nd=max(d+1,dp[idx(y,x,k)][ny][nx]);
      if(dist[ny][nx]<=nd) continue;
      dist[ny][nx]=nd;      
      pq.emplace(dist[ny][nx],P(ny,nx));
    }        
  }
  
  if(dist[0][0]>=INF) dist[0][0]=-1;
  cout<<dist[0][0]<<endl;
}
signed main(){
  while(1) solve();  
  return 0;
}



Measured memory_bytes: 24156
//template
import java.util.*;
import java.util.stream.*;
import java.io.*;
public class Main{
	static BufferedReader in= new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter out= new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	private static final int HUNDRED = 100;
	public static void main(String[] args) throws IOException{
		
		StringTokenizer st=new StringTokenizer(in.readLine());
		double d=Double.parseDouble(st.nextToken());
		double t=Double.parseDouble(st.nextToken());
		double s=Double.parseDouble(st.nextToken());
		if(d/s<=t)
			out.append("Yes");
		else
			out.append("No");
		
		out.flush();
		in.close();
		out.close();
	}
	private static double f(long num) {
		long copy=num;
		long sum=0;
		while(copy>0) {
			sum+=copy%10;
			copy/=10;
		}
		return (double)num/sum;
	}
	private static int modulo(int S, int N) { return ((S) & (N - 1)); } // returns S % N, where N is a power of 2
	private static int isPowerOfTwo(int S) { return (S & (S - 1)) == 0 ? 1 : 0; }
	private static int[] readInts() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
	}
	private static int readInt() throws IOException {
		return Integer.parseInt(in.readLine());
	}
	private static long[] readLongs() throws IOException {
		return Stream.of(in.readLine().split(" ")).mapToLong(Long::parseLong).toArray();
	}
	private static long readLong() throws IOException {
		return Long.parseLong(in.readLine());
	}
	 
}


Measured memory_bytes: 33268
N, K = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))
s_h = sorted(h)

d = float('inf')
for i in range(N - K + 1):
    div = s_h[i + K - 1] - s_h[i]
    if div < d:
        d = div
print(d)


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

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

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/27  Problem: 076_arc_b / Link: https://arc076.contest.atcoder.jp/tasks/arc076_b?lang=en  ----- */
/* ------問題------

平面上に、N 個の街があります。i 個目の街は、座標 (xi,yi) にあります。同じ座標に、複数の街があるかもしれません。
座標 (a,b) にある街と座標 (c,d) にある街の間に道を造るのには、min(|a−c|,|b−d|) 円かかります。街と街の間以外に、道を造ることはできません。
任意の 2 つの街の間を、道を何本か通って行き来できるようにするためは、最低で何円必要でしょうか。

-----問題ここまで----- */
/* -----解説等-----

あとで最小全域木をつくるならx,y別の辺を貼ればよい。
最小を選択すれば良いのでx,yは独立して考えることができる。
各軸について最小化するとき、明らかに近いものに辺をつなげたほうが良い。
従って各軸について独立にsortしてやる

----解説ここまで---- */

LL N;

LL ans = 0LL;

struct UnionFind {
	vector<int> data;
	UnionFind(int n) { data.assign(n, -1); }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) { return root(x) == root(y); }
	int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
	int size(int x) { return -data[root(x)]; }
};


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

	cin >> N;

	using tp = tuple<LL, int, int>;
	vector<PII>a(N);
	vector<PII>b(N);
	UnionFind uf(N);
	vector<tp> edge;

	FOR(i, 0, N) {
		int x, y;
		cin >> x >> y;
		a[i] = PII(x, i);
		b[i] = PII(y, i);
	}


	SORT(a);
	SORT(b);
	FOR(i, 0, N - 1) {
		edge.push_back(tp(abs(a[i].first - a[i + 1].first), a[i].second, a[i + 1].second));
		edge.push_back(tp(abs(b[i].first - b[i + 1].first), b[i].second, b[i + 1].second));
	}

	SORT(edge);

	FOR(i, 0, SZ(edge)) {
		LL a, b, c;
		tie(a, b, c) = edge[i];
		if (!uf.same(b, c)) {
			ans += a;
			uf.unionSet(b, c);
		}
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 8432
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e9+7;
const ll N = 1002;


ll waru2(ll x){
	ll ans=0;
	while(x){
		if(x%2==1)break;
		else ans++;
		x/=2;
	}
	return ans;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,a,ans=0;
	cin>>n;
	FOR(i,0,n){
		cin>>a;
		ans+=waru2(a);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int x;
	vector<int> v;
	for (int i = 0;i < 3;i++) {
		cin >> x;
		v.push_back(x);
	}
	sort(v.begin(), v.end());
	int c = 0;
	for (int i = 0;i < 2;i++) {
		c += abs(v[i] - v[i + 1]);
	}
	cout << c << endl;

	return 0;
}

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

int main(){
  int n, m, a, b;
  cin >> n >> m;
  vector<int> h(n);
  vector<bool> peaks(n, true);
  for(int i = 0; i < n; i++) cin >> h[i];
  for(int i = 0; i < m; i++){
    cin >> a >> b;
    if(h[a-1] <= h[b-1]) peaks[a-1] = false;
    if(h[a-1] >= h[b-1]) peaks[b-1] = false;
  }
  
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(peaks[i] == true) ans++;
  }
  
  cout << ans << endl;
  
  return 0;
}


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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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;
}

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 200005;

namespace Modop {
    ll modAdd(ll a, ll b) {
        return (a + b) % MOD;
    }
    
    ll modSub(ll a, ll b) {
        return (((a - b) % MOD) + MOD) % MOD;
    }
    
    ll modMul(ll a, ll b) {
        return ((a % MOD) * (b % MOD)) % MOD;
    }

    ll modExp(ll base, ll power) {
        if (power == 0) {
            return 1;
        } else {
            ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
            if (power % 2 == 1) cur = cur * base;
            cur = cur % MOD;
            return cur;
        }
    }
    
    ll modInv(ll a) {
        return modExp(a, MOD - 2);
    }
    
    ll modDiv(ll a, ll b) {
        return modMul(a, modInv(b));
    }
}

using namespace Modop;

ll N, M, K;
ll groupCnt[MX];
ll ans;

void solve() {
	cin >> N >> M >> K;
	// ll ans = modMul(modExp(N - 1, M - 1), M);
	ll ways = 1;
	for (int pairs = 0; pairs <= K; ++pairs) {
		ll regions = N - pairs;
		// cout << regions << " " << ways << "\n";
		ans += modMul(modMul(modExp(M - 1, regions - 1), M), ways);
		
		// Prepare for next group
		ways = modMul(ways, modInv(pairs + 1));
		ways = modMul(ways, (N - 1) - pairs);
		// cout << ans << "\n";
	}
	cout << ans % MOD;
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3656
/*Read the problem carefully before starting to work on it*/
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;

//ll ncr(ll n,ll r){ll ans=1;r=min(r,n-r);for (int i=1;i<=r;i++){ans*=(n-r+i);ans/=i;}return ans;}

#define pb push_back
#define eb emplace_back
#define mp(x,y) make_pair(x,y)
#define mod 1000000007

double PI=3.1415926535897932384626;

//template<typename T> T power(T x,T y,ll m=mod){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1LL;x=(x*x)%m;}return ans%m;}

//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ost;

#define fi first
#define se second

vector< vector<ll> >adj(610);

long double dp[610];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m;
	cin>>n>>m;
	for(ll i=0;i<m;i++)
	{
		ll s,t;
		cin>>s>>t;
		adj[s].eb(t);
	}
	long double ans=LLONG_MAX;
	for(ll i=0;i<n;i++)
	{
		// we will drop one edge at i
		// i==0 means that we won't drop any edge
		// dpj j=i+1...n is not affected by dpi
		// it is optimal
		dp[n]=0;
		for(ll j=n-1;j>=1;j--)
		{
			long double sum=0.0;
			long double mx=0.0;
			ll num=adj[j].size();
			for(auto &nei:adj[j])
			{
				sum+=dp[nei];
				mx=max(mx,dp[nei]);
			}
			if(j==i && num>=2)
			{
				num--;
				sum-=mx;
			}
			dp[j]=sum/num+1;
		}
		ans=min(ans,dp[1]);
	}
	cout<<fixed<<setprecision(10);
	cout<<ans;
    return 0;
}


//252908XL

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

#define mod 1000000007

using namespace std;

long long int gcd(long long int c, long long int d){
	long long int tmp;
	if(c < d){
		tmp = d;
		d = c;
		c = tmp;
	}
	while(c % d != 0){
		tmp = d;
		d = c % d;
		c = tmp;
	}
	return d;
}
 
int main(void){
	
	long long int A, B, C, D, N;
	
	cin >> A >> B >> C >> D;
	
	N = B - A;
	
	long long int cb, db, cdb, ca, da, cda;
	
	cb = B / C;
	db = B / D;
	ca = (A - 1) / C;
	da = (A - 1) / D;
	
	long long int l;
	
	l = C * D / gcd(C, D);
	cdb = B / l;
	cda = (A - 1) / l;
	
	cout << N - ((cb + db - cdb) - (ca + da - cda)) + 1;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//Ball
public class Main{

	public static int[] b;
	public static int[] f;
	public static int[] s;
	public static boolean ok;

	public static boolean check(){
		s[0] = s[1] = 0;
		for(int i=0;i<10;i++){
			if(s[f[i]]>=b[i])return false;
			s[f[i]] = b[i];
		}
		return true;
	}

	public static void dfs(int k){
		if(k==10){
			ok |= check();
		}
		else{
			f[k] = 0;
			dfs(k+1);
			f[k] = 1;
			dfs(k+1);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(n--!=0){
			b = new int[10];
			for(int i=0;i<10;i++)b[i]=sc.nextInt();
			f = new int[10];
			s = new int[2];
			ok = false;
			dfs(0);
			System.out.println(ok?"YES":"NO");
		}
	}
}

Measured memory_bytes: 12000
def is_keepable(size, sub, add, start):
    small, big = 1, size
    for i in range(N - 1, -1, -1):
        if T[i] == sub:
            big = min(big + 1, size)
        elif T[i] == add:
            small = max(small - 1, 1)
        if S[i] == sub:
            small += 1
        elif S[i] == add:
            big -= 1
        if small > big:
            return False
    return small <= start <= big


H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = input()
T = input()
if is_keepable(H, "U", "D", sr) and is_keepable(W, "L", "R", sc):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9652
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int n;
	int a[110];
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	bool can = true;
	rep(i, n) {
		if (a[i] % 2 == 0) {
			if (a[i] % 3 != 0 && a[i] % 5 != 0) {
				can = false;
			}
		}
	}

	cout << (can ? "APPROVED":"DENIED") << endl;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

const ll MAXVAL = 1000000000;

int main() {
	ll N, K, S;
	cin >> N >> K >> S;

	for (int ii = 0; ii < K; ++ii){
		cout << S << " ";
	}
	ll rem = (S == MAXVAL) ? 1 : MAXVAL;
	for (int ii = K; ii < N; ++ii){
		cout << rem << " ";
	}	

	cout << "\n";

	return 0;
}


Measured memory_bytes: 1280
let line = readLine()!.split(separator: " ").map { Int($0)! }
var a = line[0], b = line[1], c = line[2]
let k = line[3]

var ans = 0
var card = k - a
if card <= 0 {
  ans += k
} else if card > 0 {
  ans += a
  card -= b
  if card > 0 {
    ans -= card
  }
}
print(ans)

Measured memory_bytes: 8164
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
 
#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;
const double PI = acos(-1);
const long double EPS = 1e-9;
using namespace std;

bool a[26];

void solve(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        a[s[i] - 97] = true;
    }
    for(int i = 0; i < 26; i++)
        if(!a[i]) {
            cout << (char)(i + 97);
            return;
        }
    
    cout << "None";
}
int main(){
    int q = 1;
    //cin >> q;}
    while(q--) solve();
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    vvi v(3,vi(3));
    rep(i,3)rep(j,3)cin >> v[i][j];
    int n;
    vi a(1000,0);
    cin >> n;
    rep(i,n){
        int t;
        cin >> t;
        a[t] = 1;
    }
    bool ans = false;
    rep(i,3){
        int cnt = 0;
        rep(j,3)cnt += a[v[i][j]];
        if(cnt == 3)ans = true;
    }
    rep(j,3){
        int cnt = 0;
        rep(i,3)cnt += a[v[i][j]];
        if(cnt == 3)ans = true;
    }
    if(a[v[0][0]] && a[v[1][1]] && a[v[2][2]])ans = true;
    if(a[v[0][2]] && a[v[1][1]] && a[v[2][0]])ans = true;

    if(ans)cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(void)
{
  ll n;
  cin >> n;
  ll num = n;
  string c;
  
  while (num>0){
    num -= 1;
    c.push_back(num%26 + 'a');
    num /= 26;
  }
  reverse(c.begin(), c.end());
  
  cout << c << endl;
  
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}


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

string S;

long long solve() {
    vector<long long> val(2019, 0);
    long long tenfactor = 1;
    long long cur = 0;
	long long N = S.length();
    val[cur]++;
    for (int i = 0; i < N; ++i) {
        cur = (cur + (S[N-i-1]-'0') * tenfactor) % 2019;
        tenfactor = (tenfactor * 10) % 2019;
        val[cur]++;
    }
    long long res = 0;
    for (int p = 0; p < 2019; ++p) res += val[p] * (val[p] - 1) / 2;
    return res;
}

int main() {
    cin >> S;
    cout << solve() << endl;
}

Measured memory_bytes: 3668
#include<stdio.h>
int main(){
  int r,d,x[11],i;
  scanf("%d%d%d",&r,&d,&x[0]);
  for(i=0; i<10; i++){
    x[i+1]=r*x[i]-d;
    printf("%d\n",x[i+1]);
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static int[] par;
	public static int[] rank;

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

			par = new int[n];
			rank = new int[n];
			for (int i = 0; i < n; i++) {
				par[i] = i;
				rank[i] = 0;
			}

			for (int i = 0; i < m; i++) {
				int a = sc.nextInt() - 1;
				int b = sc.nextInt() - 1;
				unit(a, b);
			}
			for (int i = 0; i < n; i++) {
				find(i);
			}

			//			for(int i = 0; i < n ; i++) {
			//				System.out.println(par[i]);
			//			}

			Arrays.sort(par);
			int max_num = 1;
			int num = 1;
			for (int i = 1; i < n; i++) {
				if (par[i - 1] == par[i]) {
					num++;
				} else {
					max_num = Math.max(max_num, num);
					num = 1;
				}
			}
			max_num = Math.max(max_num, num);

			System.out.println(max_num);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public static int find(int x) {
		if (par[x] == x) {
			return x;
		} else {
			return par[x] = find(par[x]);
		}
	}

	public static void unit(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) {
			return;
		}
		if (rank[x] < rank[y]) {
			par[x] = y;
		} else {
			par[y] = x;
			if (rank[x] == rank[y]) {
				rank[x]++;
			}
		}
	}

}

Measured memory_bytes: 62064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = pow(10, 9) + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divCeil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << A << endl; exit(0);}

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

  map<char, ll> mp;
  mp['M'] = 0, mp['A'] = 0, mp['R'] = 0, mp['C'] = 0, mp['H'] = 0;
  for (ll i = 0; i < N; i++)
  {
    string S;
    cin >> S;
    char C = S.front();
    if (mp.count(C))
      mp.at(C)++;
  }

  ll ans = 0;
  for (auto x : mp)
  {
    for (auto y : mp)
    {
      if (x.first >= y.first)
        continue;
      for (auto z : mp)
      {
        if (y.first >= z.first)
          continue;
        ll X = x.second, Y = y.second, Z = z.second;
        ans += X * Y * Z;
      }
    }
  }
  cout << ans << endl;
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;
  ll ans = 1;
  rep(i, n) ans = (ans*(i + 1))%mod;
  cout << ans << endl;

  return 0;
}


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

using namespace std;

int main()
{
        int64_t n, m, k, ans = 0, i, j, best;
        cin >> n >> m >> k;
        auto a = vector<int64_t>(n + 1, 0);
        auto b = vector<int64_t>(m + 1, 0);
        auto aa = vector<int64_t>(n + 1, 0);
        auto bb = vector<int64_t>(m + 1, 0);


        for (i = 1; i <= n; i++)
        {
                cin >> a[i];
                aa[i] = a[i] + aa[i - 1];
        }

        for (i = 1; i <= m; i++)
        {
                cin >> b[i];
                bb[i] = b[i] + bb[i - 1];
        }
        best = m;

        for (i = 0; i <= n; i++)
        {
                if (aa[i] > k)
                {
                        break;
                }

                for (j = best; j >= 0; j--)
                {
                        if (bb[j] <= k - aa[i])
                        {
                                best = j;
                                break;
                        }
                }

                ans = max(ans, i + j);
        }

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

Measured memory_bytes: 9572
#include <iostream>
using namespace std;
int main(){
    int H , W, i, k;
    while (1){
        cin >> H >> W;
        if (H==0 && W==0){
            break;
        } else{
            for (k=0; k<H; k++){
                for (i=0; i<W; i++){
                    cout << "#";
                }
                cout << endl;
            }
        }cout << endl;    }
    return 0;
}



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

using namespace std;
using ll = long long;

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

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

int main()
{
    ll N, M;
    cin >> N >> M;
    ll p;
    string S;
    vector<vector<ll>> rec(N, vector<ll>(2, 0));
    REP(i,0,M) {
        cin >> p >> S;
        --p;
        if(rec[p][0] == 0) {
            if(S == "AC") ++rec[p][0];
            else ++rec[p][1];
        }
    }
    ll ok = 0, ng = 0;
    REP(i,0,N) {
        ok += rec[i][0];
        if(rec[i][0] == 1) ng += rec[i][1];
    }
    _PS(ok); _PR(ng);


    return 0;
}

/*



*/

Measured memory_bytes: 5760
K = int(input())

lunlun = [[] for _ in range(11)]
lunlun[1] = list(range(1, 10))

for i in range(2, 11):
    tmp = []
    for j in lunlun[i-1]:
        x = int(str(j)[-1])
        if 1 <= x <= 8:
            tmp.extend([int(str(j) + str(x-1)), int(str(j) + str(x)), int(str(j) + str(x+1))])
        elif int(str(j)[-1]) == 0:
            tmp.extend([int(str(j) + str(x)), int(str(j) + str(x+1))])
        else:
            tmp.extend([int(str(j) + str(x-1)), int(str(j) + str(x))])
    lunlun[i] = list(set(tmp))

lunlun_flat = []
for x in lunlun:
    for y in x:
        lunlun_flat.append(y)
lunlun_flat = list(set(lunlun_flat))
lunlun_flat.sort()

print(lunlun_flat[K-1])

Measured memory_bytes: 84304
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 30

int main()
{
	int n = 1, dp[40] = {1};
	rep(i, 31) {
		if (i == 0) continue;
		if (i >= 1) dp[i] += dp[i - 1];
		if (i >= 2) dp[i] += dp[i - 2];
		if (i >= 3) dp[i] += dp[i - 3];
	}
	while (true) {
		cin >> n;
		if (!n) break;
		cout << (dp[n] + 3649)/ 3650 << endl;
	}
}




Measured memory_bytes: 2992
#include<bits/stdc++.h>
using namespace std;
int palindrome(int n)
{
    int r=0;
    int temp=n;
    while(temp>0)
    {
        r=r*10+(temp%10);
        temp=temp/10;
    }
    if(r==n)
        return 1;
    else
        return 0;
}
int check_palindrome(int a, int b)
{
    int cnt=0;
    for(int i=a; i<=b; i++)
    {
        if  (palindrome(i)==1)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}
int main()
{
    int a,b;
    cin >> a >> b;
    check_palindrome(a, b);
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
typedef pair<int,int> P;

int main(){
  int n,m; cin >>n >> m;
  int path[n][n];
  int ans = 0;
  rep(i,n) rep(j,n) path[i][j] = 0;
  rep(i,m){
    int x,y; cin >> x >> y;
    path[x-1][y-1] = 1;
    path[y-1][x-1] = 1;
  }
  vector<int> ar(n);
   rep(i,n) ar[i] = i+1;
  do{
    bool frag = true;
    if(ar[0] != 1) frag = false;
    else{ 
      rep(i,n-1){
        if(path[ ar[i]-1 ][ ar[i+1]-1 ] == 0) frag = false;
        // cout <<ar[i]-1 << " " << ar[i+1]-1 <<" ";
      }
      cout << "\n";
    }
    if(frag) ans++;
  }while(next_permutation(ar.begin(),ar.end()));

  cout << ans <<"\n";
}

Measured memory_bytes: 256
# S, T = input().split()
# A, B = map(int, input().split())
# U = input()
# if S == U: A -= 1
# else: B -= 1
# print(A, B)

def main():
    A1 =list(map(int,input().split()))
    A2 =list(map(int,input().split()))
    A3 =list(map(int,input().split()))

    N = int(input())
    B =[]

    for i in range(N):
    
        B.append(int(input()))

    A=[]

    A.append(A1)
    A.append(A2)
    A.append(A3)

    flags = [[False,False,False],[False,False,False],[False,False,False]]


    for i in B:
        for j in range(3):

            if A[0][j] == i:
                flags[0][j] = True
            if A[1][j] == i:
                flags[1][j] = True
            if A[2][j] == i:
                flags[2][j] = True
            
            for k in range(3):
                if flags[k][0] == True and flags[k][1] == True and flags[k][2] == True:
                    print("Yes")
                    return
                if flags[0][k] == True and flags[1][k] == True and flags[2][k] == True:
                    print("Yes")
                    return

            if flags[0][0] == True and flags[1][1] == True and flags[2][2] == True : 
                print("Yes")
                return
            if flags[0][2] == True and flags[1][1] == True and flags[2][0] == True :
                print("Yes")
                return

    print("No")

main()
        

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

int main()
{
  	int n,m,l;
  
 	cin >> n >> m >> l;

  	long a[n][m],b[m][l],c[n][l];
  	
    for(int i = 0;i < n;i++)
     for(int j = 0;j < m;j++)
       cin >> a[i][j];

  	for(int i = 0;i < m;i++)
     for(int j = 0;j < l;j++)
       cin >> b[i][j];

  	for(int i = 0;i < n;i++){
     for(int j = 0;j < l;j++){
       c[i][j] = 0;
       for(int k = 0;k < m;k++){
         c[i][j] += a[i][k] * b[k][j];
       }
       cout << c[i][j];
       if(j < l-1)
         cout << " ";
     }
      cout << endl;
    }
  	
}


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

int main(){
    ll a;
    double b;
    cin >> a >> b;
    ll mid=b*100+0.5;
    ll ans;
    ans=mid*a/100;
    cout << ans << endl;
}

Measured memory_bytes: 3728
#include<stdio.h>
#include<math.h>
int main(void)
{
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f) != EOF){
		x=(double)(c*e-b*f)/(a*e-b*d);
		y=(double)(d*c-a*f)/(b*d-e*a);
		if(fabs(x)<1e-6)x=0;
		if(fabs(y)<1e-6)y=0;
		printf("%.3f %.3f\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 636
#include <iostream>
using namespace std;
int sum=0;
int main(){
	int i,j,k,n,l;
	cin>>n>>k;
	for(i=0;i<=n;i++)
	for(j=0;j<=n;j++)
	if(k-i-j>=0&&k-i-j<=n)sum++;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Fr(i,a,b) for(int i=(a);i<=(int)(b);++i)
#define Dr(i,a,b) for(int i=(a);i>=(int)(b);--i)
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
#define debug(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define bug(x) cout<<#x<<"="<<x<<" "
const int M=1e5+5;
int n,a[M],A[M];
ll s;
int main() {
	cin>>n;
	Fr(i,1,n)scanf("%d",&a[i]),s+=a[i];
	for(int i=2; i<=n; i+=2)s-=a[i]<<1;
	A[1]=s;
	Fr(i,2,n)A[i]=a[i-1]+a[i-1]-A[i-1];
	Fr(i,1,n)printf("%d ",A[i]);
}

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

int main() {
  int n,k;
  cin>>n>>k;
  vector<char> d;
  bool loop=true;
  
  for(int i=0;i<k;i++){
    char a;
    cin>>a;
    d.push_back(a);
  }
  
  
  while(loop){
    loop=false;
    string s=to_string(n);
  
    for(int i=0;i<s.size();i++){
      for(int j=0;j<k;j++){
        if(s.at(i)==d.at(j)){
          n++;
          s=to_string(n);
          loop=true;
        }
      }
    }

  }
  cout<<n<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 2e5+5;

int a[sz];

int main()
{
   int n;
   cin >> n;
   for(int i=0; i<n; i++) scanf("%d", &a[i]);

   sort(a, a+n, greater<int>());

   int k = n-2;
   ll ans = a[0];
   for(int i=1; i<n && k; i++) {
      ll x = min(k, 2);
      ans += x * a[i];
      k -= x;
   }
   cout << ans << endl;
}


Measured memory_bytes: 4428
import numpy as np
def solve(n, m, c, b, A):
    b = np.asarray(b)
    A = np.asarray(A)
    ans = 0
    for i in range(n):
        if np.dot(b, A[i]) + c > 0:
            ans += 1
    return ans

n, m, c = map(int, input().split())
b = list(map(int, input().split()))
A = []
for i in range(n):
    A.append(list(map(int, input().split())))
print(solve(n, m, c, b, A))

Measured memory_bytes: 12508
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;

int main() {
  int a,b,c;
  cin >> a >> b >> c;
  if(a==b&&b!=c){
    cout << "Yes" << endl;
    return 0;
  }
  if(b==c&&c!=a){
    cout << "Yes" << endl;
    return 0;
  }
  if(c==a&&a!=b){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll n;
vector<ll> a,b;
vector<ll> ans;


bool judge(int K){
    bool j=true;
    for(int i=0;i<n;i++){
        vector<bool> dp(51,false);
        dp[a[i]]=true;
        for(auto &I:ans){
            for(int h=0;h<=50;h++){
                if(dp[h]){dp[h%I]=true;}
            }
        }
        for(int k=K-1;k>0;k--){
            for(int h=0;h<=50;h++){
                if(dp[h]){dp[h%k]=true;}
            }
        }
        if(dp[b[i]]==false){j=false;}
    }
    return j;
}

int main(){
    cin>>n;
    a.resize(n); b.resize(n);
    for(auto &I:a){cin>>I;}
    for(auto &T:b){cin>>T;}
    if(!judge(51)){cout<<-1<<endl; return 0;}
    for(int K=50;K>0;K--){
        if(!judge(K)){ans.push_back(K);}
    }
    ll A=0;
    for(auto &I:ans){A^=1LL<<I;}
    cout<<A<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next().toUpperCase();
		String s2 = sc.next().toUpperCase();
		String s3 = sc.next().toUpperCase();
		System.out.println(s1.split("")[0] + s2.split("")[0] + s3.split("")[0]);
		sc.close();
	}
}

Measured memory_bytes: 21844