akhauriyash/Code-Regression huggingface dataset:
function Main(input) {
	const ab = input.split(" ");
  const a  = parseFloat(ab[0]);
  const b  = parseFloat(ab[1]);
  const list = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1];
  const aI = list.indexOf(a);
  const bI = list.indexOf(b);
  if(aI < bI){
    console.log("Bob");
    return;
  }
  if(bI < aI){
    console.log("Alice");
    return;
  }
  if(aI == bI){
    console.log("Draw");
    return;
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
/***********************
*  Author: xuziyuan    * 
***********************/

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define replet(c) for(char c='a';c<='z';c++)
#define LL long long
#define pii pair <LL,LL>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair
#define sqr(a) ((a)*(a))

using namespace std;

const LL MOD=1e9+7;

LL n,t,dp[200010][510],all=0,ans;//dp[val][used items' numbers]=real_val>=val,min_weight
pii vw[510];

int main()
{
	rep(i,100005) rep(j,105) dp[i][j]=1e18;
	cin>>n>>t;
	repn(i,n) cin>>vw[i].se>>vw[i].fi,all+=vw[i].fi;
	sort(vw,vw+n);
	dp[0][0]=0;
	rep(i,all+1)
	{
		repn(j,n)
		{
			dp[i][j]=min(dp[i][j],dp[i][j-1]);
			dp[i+vw[j].fi][j]=dp[i][j-1]+vw[j].se;
		}
	}
	rep(i,all+1) if(dp[i][n]<=t) ans=i;
	cout<<ans<<endl;
	rt0;
}

Measured memory_bytes: 403712
#include <iostream>
#define create_tmp_num(a, b) a * 10 + b

using namespace std;
int main(void){
    cin.tie(0);
    iostream::sync_with_stdio(false);
    int input;
    cin >> input;
    int num_times[9];
    int output;
    for(int i=0; i < 9; i++){
        num_times[i] = 111 * (i+1);
    }
    if(input <= 111){
        cout << 111 << '\n';
    }else{
        for(int i=0; i < 9; i++){
            if(num_times[i] < input && input <= num_times[i+1]){
                cout << num_times[i+1] << '\n';
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  while(true){
	int a, L; cin >> a >> L;
	if(a == 0 && L == 0) break;
	
	map<int,int> mpii;
	mpii.insert(MP(a, 0));
	for(int t=1;;++t){
	  VI dig(10, 0);
	  int cnt = 0;
	  while(a>0){
		++dig[a%10];
		a /= 10;
		++cnt;
	  }
	  dig[0] += L - cnt;
	  int M = 0, m = 0;
	  for(int i=9;i>=0;--i)
		for(int j=0;j<dig[i];++j)
		  M = M * 10 + i;
	  for(int i=0;i<10;++i)
		for(int j=0;j<dig[i];++j)
		  m = m * 10 + i;
	  a = M - m;
	  map<int,int>::iterator it = mpii.find(a);
	  if(it != mpii.end()){
		cout << it->second << " " << a << " " << t - it->second << endl;
		break;
	  }
	  mpii.insert(MP(a, t));
	}
  }

  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using L = long long;

#define FOR(i, l, r) for(int i = l; i <= r; ++i)
#define REP(i, n) FOR(i, 0, n - 1)
#define FORD(i, l, r) for(int i = r; i >= l; --i)
#define REPD(i, n) FORD(i, 0, n - 1)
constexpr int inf = 0x3f3f3f3f;
template<class T> int size(T &x) {
	return int(x.size());
}

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

	int n;
	cin >> n;
	vector<double> dp(n + 1);
	dp[0] = 1;
	REP(i, n) {
		double p;
		cin >> p;
		FORD(j, 1, i + 1)
			dp[j] += p * (dp[j - 1] - dp[j]);
	}
	cout << fixed << setprecision(10);
	cout << dp[(n + 1) / 2] << '\n';
}


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

int main()
{
  string s, t;
  cin >> s >> t;
  string ans = "";
  rep(i, t.size()) {
    ans += s[i];
    ans += t[i];
  }
  if(s.size() > t.size()) ans+= s[s.size() - 1];
  cout << ans << endl;
  

  return 0;
}


Measured memory_bytes: 3612
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
x=gets.to_i
puts yn_judge(x>=1200,"ARC","ABC")

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

// {{{ Li Chao Tree
// 順番の関係ない Convex hull Trickの実装
// 直線追加と最小値計算がどちらも O(long N)
// Nはxの取りうる座標
struct LiChaoTree {
  const ll INF = ((ll)1) << 62;

  ll f(std::pair<ll, ll> line, ll x) {
    return line.first * x + line.second;
  }

  std::vector< ll > xs;
  std::vector< std::pair<ll, ll> > seg;
  ll N;

  explicit LiChaoTree(const std::vector< ll > &x) : xs(x) {
    N = 1;
    while (N < xs.size())
      N *= 2;
    while (xs.size() < N)
      xs.push_back(xs.back() + 1);
    seg.assign(2 * N - 1, std::pair<ll, ll>(0, INF));
  }

  void add_line(std::pair<ll, ll> line, int k, int l, int r) {
    ll m = (l + r) / 2;
    bool left = f(line, xs[l]) < f(seg[k], xs[l]);
    bool mid = f(line, xs[m]) < f(seg[k], xs[m]);

    if (mid)
      swap(seg[k], line);

    if (l + 1 >= r)
      return;
    else if (left != mid)
      add_line(line, 2 * k + 1, l, m);
    else
      add_line(line, 2 * k + 2, m, r);
  }

  void add_line(ll a, ll b) {
    add_line({a, b}, 0, 0, N);
  }

  // xの値、ただしxはコンストラクタに含まれていなければならない
  ll get_min(ll x) {
    ll k = lower_bound(begin(xs), end(xs), x) - begin(xs);
    k += N - 1;
    ll res = f(seg[k], x);
    while (k > 0) {
      k = (k - 1) / 2;
      res = std::min(res, f(seg[k], x));
    }
    return res;
  }
};
// }}}

ll N, C;
vector<ll> h;
ll dp[300000];

signed main() {
  cin >> N >> C;
  h.resize(N);
  rep(i, N) {
    cin >> h[i];
  }

  LiChaoTree lct(h);
  dp[0] = 0;
  lct.add_line(-2 * h[0], dp[0] + h[0] * h[0]);
  for (int i=1; i<N; i++) {
    dp[i] = lct.get_min(h[i]) + h[i] * h[i] + C;
    lct.add_line(-2 * h[i], dp[i] + h[i] * h[i]);
  }
  cout << dp[N-1] << endl;

  return 0;
}



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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vs c(h);
    rep(i, h) cin >> c[i];
    int ans = 0;
    rep(i, 1<<h) rep(j, 1<<w) {
        int cnt = 0;
        rep(i2, h) rep(j2, w) {
            if ((i>>i2)&1 || (j>>j2)&1) continue;
            if (c[i2][j2] == '#') ++cnt;
        }
        if (cnt == k) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3612
#![allow(non_snake_case,unused_imports)]

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

// Module
use std::cmp::{min,max};
use std::collections::{HashSet};

// Main
fn main(){
    input!{
        n: String,
    }
    for c in n.chars(){
        print!("{}", if c=='1'{'9'}else{'1'});
    }
}


Measured memory_bytes: 4476
import itertools

n, k = map(int, input().split())

t = ( n - 1 ) * ( n - 2 ) // 2 - k

if t < 0:
  print( -1 )

else:
  print( n - 1 + t )
  
  for i in range(1, n):
    print(1, i+1)
  
  for j in range(1, n):
    for i in range(1, j): 
      if t == 0:
        break
      print(i+1,j+1)
      t -= 1

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

int main() {
  char c;
  cin>>c;
  if(c == 'a' ||c == 'i' ||c == 'u' ||c == 'e' ||c == 'o'){
  cout<<"vowel"<<endl;
  }
  else{
  cout<<"consonant"<<endl;
  }
}


Measured memory_bytes: 3596
s = [False for i in range(13)]
h = [False for i in range(13)]
c = [False for i in range(13)]
d = [False for i in range(13)]

n = int(input())
for i in range(n):
    g, t = map(str, input().split())
    if g == "S":
        s[int(t) - 1] = True
    elif g == "H":
        h[int(t) - 1] = True
    elif g == "C":
        c[int(t) - 1] = True
    elif g == "D":
        d[int(t) - 1] = True

for i in range(13):
    if s[i] == False:
        print("S", i + 1)
for i in range(13):
    if h[i] == False:
        print("H", i + 1)
for i in range(13):
    if c[i] == False:
        print("C", i + 1)
for i in range(13):
    if d[i] == False:
        print("D", i + 1)


Measured memory_bytes: 5616
import sys,collections,math,random,fractions,bisect,itertools;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]
 
n = I()
L1 = I()
df = collections.defaultdict(int)
for e in L1:
    df[e] += 1
cb = itertools.combinations(df, 3)
ans = 0
for e in cb:
    a,b,c = e
    if a + b > c and b + c > a and c + a > b:
        ans += df[a] * df[b] * df[c]
print(ans)

Measured memory_bytes: 78296
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip> 

using ll = long long;
using ull = unsigned long long;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;(i) < ((int)(n));++(i))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

// const int dx[4] = { 1, 0, -1, 0 };
// const int dy[4] = { 0, 1, 0, -1 };

const int dx[8] = {1, 1, 0,-1,-1,-1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0,-1,-1,-1};

int inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T SUM(vector<T> vec){return accumulate(all(vec),(T)0);} // vectorの中身を全部足す
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
template<typename T>inline void print(T&& x){cout<<setprecision(32)<<x<<endl;}// 改行付き出力

ll dp[3000][3000];
bool flag[3000][3000];
vector<ll> a;

ll f(ll l,ll r){
  if(flag[l][r])return dp[l][r];
  flag[l][r] = true;
  if(l == r)return dp[l][r] = a[l];
  return dp[l][r] = max(a[l] - f(l+1,r), a[r] - f(l,r-1));
}

// TODO: write
int main() {
  int n;cin>>n;
  vector<ll> b(n);rep(i,n)cin>>b[i];
  a = b;
  print(f(0,n-1));
  return 0;
}

Measured memory_bytes: 58668
#include<iostream>
using namespace std;
#define MAX 2000000000
int main(){
    int x,y,ans=MAX;
    cin>>x>>y;
    ans=min(ans,(y-x)>0?(y-x):MAX);
    ans=min(ans,abs(y+x)+1);
    ans=min(ans,(-y-x)>0?(-y-x)+1:MAX);
    ans=min(ans,(-y+x)>0?(-y+x)+2:MAX);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
unordered_map<int, int> mp;

int main(){
    int N;
    cin >> N;
    int a[100010];
    for(int i = 0; i < N; i++){
        cin >> a[i];
        mp[a[i]] = i;
    }
    sort(a, a+N);

    int res = 0;
    for(int i = 0; i < N; i++){
        if(mp[a[i]] % 2 != i % 2){
            res++;
        }
    }

    cout << res / 2 << endl;


    return 0;
}


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

int main(){
	int p;
	int n[1000000];
	while(cin >>  p, p){
		int ans = 0;
		for(int i=0; i < p; i++){
			cin >> n[i];
		}
		for(int i=0; i < p; i++){
			for(int j = 0; j < p-i-1; j++){
				if(n[j] > n[j+1]){
					swap(n[j], n[j+1]);
					ans++;
				}
			}
		}
		cout << ans << endl;
	}
}

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

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        k: usize
    }
    let d = 924844033;
    let mut dp: Vec<Vec<usize>> = vec![vec![0; 2]; n + 1];
    dp[0][1] = 1;
    for _ in 0..2 * (k - n % k) {
        for _ in 0..n / k - 1 {
            let mut next = vec![vec![0; 2]; n + 1];
            next[0][1] = 1;
            for j in 0..n {
                next[j + 1][0] = dp[j][1];
                next[j + 1][1] = (dp[j + 1][0] + dp[j + 1][1]) % d;
            }
            dp = next;
        }
        for j in 0..n + 1 {
            dp[j][1] = (dp[j][0] + dp[j][1]) % d;
            dp[j][0] = 0;
        }
    }
    for _ in 0..2 * (n % k) {
        for _ in 0..n / k {
            let mut next = vec![vec![0; 2]; n + 1];
            next[0][1] = 1;
            for j in 0..n {
                next[j + 1][0] = dp[j][1];
                next[j + 1][1] = (dp[j + 1][0] + dp[j + 1][1]) % d;
            }
            dp = next;
        }
        for j in 0..n + 1 {
            dp[j][1] = (dp[j][0] + dp[j][1]) % d;
            dp[j][0] = 0;
        }
    }
    let mut st = vec![1; n + 1];
    for i in 1..n + 1 {
        st[i] = st[i - 1] * i % d;
    }
    let mut ans = 0;
    for i in 0..n + 1 {
        if i % 2 == 1 {
            ans = (ans + d - st[n - i] * dp[i][1] % d) % d;
        } else {
            ans = (ans + st[n - i] * dp[i][1]) % d;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define vl          vector<ll>
#define vi          vector<int>
#define pi          pair<int,int>
#define pl          pair<ll,ll>
#define all(a)      a.begin(),a.end()
#define mem(a,x)    memset(a,x,sizeof(a))
#define pb          push_back
#define mp          make_pair
#define F           first
#define S           second
#define trace(x)     cerr<<#x<<":"<<x<<endl;
#define trace2(x,y) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<endl;
#define trace3(x,y,z) cerr<<#x<<":"<<x<<"|"<<#y<<":"<<y<<"|"<<#z<<":"<<z<<endl;
#define fast_io     std::ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

int main(){
	fast_io;
	ll a,b,n;
	cin>>a>>b>>n;
	ll ans;
	if(n<b){
		ans = n;
	}
	else{
		ans = b-1;
	}
	ll t = floor(a*ans/b) - (a*floor(ans/b));
	cout<<t;
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 3600
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif


int main() {

    int N;
    cin >> N;
    
    lint sum = 0;
    for(int i=0;i<=N;i++) if(i%3&&i%5) sum+=i;
    cout <<sum<< endl;
}


Measured memory_bytes: 3620
import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))


Measured memory_bytes: 14180
/*
	JAI JAGANNATH!
*/
//@Author : zanj0

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

typedef long long int lli;

#define ff              first
#define ss              second
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            lli x; cin>>x; while(x--)

void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}
void solve() {
	lli n;
	cin >> n;
	vector <lli> v(n);
	for (lli i = 0; i < n; i++) {
		cin >> v[i];
	}
	bool pairwise = true;
	bool setwise = true;
	lli x = v[0];
	for (lli i : v) {
		x = __gcd(x, i);
	}
	setwise = (x == 1);
	unordered_set <lli> visited;
	for (lli i = 0; i < n && pairwise; i++) {
		lli val = v[i];
		lli temp = val;
		for (lli curr = 2; curr * curr <= val && pairwise; curr = (curr == 2 ? curr + 1 : curr + 2)) {
			if (temp % curr == 0) {
				if (visited.count(curr)) {
					pairwise = false;
				}
				visited.insert(curr);
				while (temp % curr == 0) {
					temp /= curr;
				}
			}
		}
		if (temp > 1) {
			if (visited.count(temp)) {
				pairwise = false;
			}
			visited.insert(temp);
		}
	}
	if (pairwise) {
		cout << "pairwise coprime" << endl;
	} else if (setwise) {
		cout << "setwise coprime" << endl;
	} else {
		cout << "not coprime" << endl;
	}
}
int main()
{
	zanj0();
	solve();
	return 0;
}

Measured memory_bytes: 11088
#include <bits/stdc++.h>
#define pb(a)           push_back(a)
#define ll              long long int
#define scd(a)          scanf("%d",&a)
#define mp(a,b)         make_pair(a,b)
#define scl(w)          scanf("%I64d",&w)
#define scdd(a,b)       scanf("%d %d",&a,&b)
#define srt(a)          sort(a.begin(),a.end())
#define rsrt(a)         sort(a.rbegin(),a.rend())
#define scll(a,b)       scanf("%I64d %I64d",&a,&b)
#define input(v,n)      for (ll i=0;i<n;i++){ll a;cin >> a;v.push_back(a);}
#define input2(v1,v2,n) for (ll i=0;i<n;i++){ll a,b;cin >> a>>b;v1.push_back(a);v2.pb(b);}
#define rep(a,n)        for(ll i=a;i<n;i++)
#define vll             vector<ll>

using namespace std;

int main()
{
    ll n,res=0,i,t;
    cin>>n;
    t=n;
    while(t>0)
    {
        res+=t%10;
        t/=10;
    }
    if(n%res==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

int main() {
  long N, K;
  cin >> N >> K;
  vector<pair<int, int>> V(N);
  for (int i = 0, a, b; i < N && cin >> a >> b; i++) V.at(i) = {a, b};
  sort(V.begin(), V.end());
  for (auto [a, b] : V) {
    K -= b;
    if (K <= 0) return cout << a << "\n", 0;
  }
}

Measured memory_bytes: 3984
from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
g = a[0]
for i in range(n):
  g = gcd(g, a[i])
counter = 0
while(True):
  if g % 2 != 0:
    break
  else:
    counter += 1
    g = g // 2
print(counter)

Measured memory_bytes: 64748
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main(void){
  int n;
  scanf("%d",&n);
  int N[n];
  int temp;
 int ave;
 scanf("%d %d",&temp,&ave);
for(int k=0;k<n;k++){
   scanf("%d",&N[k]);
 };
 double absdif[n];
 for(int k=0;k<n;k++){
   absdif[k] = fabs(ave-(temp- 0.006*N[k]));
 };
 int least;
 least = 0;
 for(int k=0;k<n;k++){
   if(absdif[least]>absdif[k]){
     least = k;
   };

};
 printf("%d",least+1);


 return 0;
}

Measured memory_bytes: 128
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException
    {
       
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int i = 1;
 
        do{
            String line1 = reader.readLine();
            int a = Integer.parseInt(line1);
            if(a == 0){
                break;
            }

            System.out.println("Case "+ i + ": "+a);
            i++;
            
        }while(true);
       
    }

}



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

#define int long long

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(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 pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

#define MAX_N 100010

int N;
int a[MAX_N];
int cnt[MAX_N];
int x,xx,xxx;
bool used=true;

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    cin.tie(0);
	ios::sync_with_stdio(false);
    cin>>N;
    rep(i,0,N+1){
        cin>>a[i];
        cnt[a[i]]++;
        if(cnt[a[i]]==2)x=a[i];
    }
    
    rep(i,1,N+2){
        if(a[i-1]==x){
            if(used){
                xx=i-1;
                used=false;
            }else{
                xxx=N-i+1;
            }
            
        }
    }
    
    COMinit();
    int ans=0;
    
    cout<<N<<endl;
    
    rep(i,2,N+2){
        ans=COM(N+1,i);
        ans-=COM(xx+xxx,i-1);
        if(ans<0)ans+=MOD;
        cout<<ans<<endl;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 14720
#include <iostream>
using namespace std;
int main() 
{
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
	return 0;
}


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

using namespace std;

int main() {

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

	string s;
	cin >> s;
	if (s == "Sunny") cout << "Cloudy";
	else if (s == "Cloudy") cout << "Rainy";
	else cout << "Sunny";
	cout << "\n";
	return 0;
}

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

using namespace std;

int main() {
    vector<int> A;
    int N;

    for (int i = 0; i < 3; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        A.insert(A.end(), a);
        A.insert(A.end(), b);
        A.insert(A.end(), c);
    }

    cin >> N;

    bool A2[9] = { false };
    // for (bool f : A2) {
    //     cout << f << " ";
    // }
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;

        for (int j = 0; j < 9; j++) {
            if (b == A[j]) {
                A2[j] = true;
                break;
            }
        }
    }

    // for (bool f : A2) {
    //     cout << f << " ";
    // }

    bool f = false;
    if (A2[0] && A2[1] && A2[2]) {
        f = true;
    } else if (A2[3] && A2[4] && A2[5]) {
        f = true;
    } else if (A2[6] && A2[7] && A2[8]) {
        f = true;
    } else if (A2[0] && A2[3] && A2[6]) {
        f = true;
    } else if (A2[1] && A2[4] && A2[7]) {
        f = true;
    } else if (A2[2] && A2[5] && A2[8]) {
        f = true;
    } else if (A2[0] && A2[4] && A2[8]) {
        f = true;
    } else if (A2[2] && A2[4] && A2[6]) {
        f = true;
    }

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

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 100000 + 10;
int damage1[maxn], damage2[maxn], H, n;
#define _for(i, a, b) for(int i = a; i < b; i++)
#define Fi first
#define Se second

int solve() {
    cin >> n >> H;
    
    _for(i, 0, n) {
        cin >> damage1[i] >> damage2[i];
    }
    int cnt = 0;
    sort(damage2, damage2 + n);
    int maxn = 0;
    _for(i, 0, n) maxn = max(maxn, damage1[i]);
    for(int i = n - 1; i >= 0; i--) {
        if(damage2[i] <= maxn) continue;
        H -= damage2[i];
        cnt++;
        if(H <= 0) return cnt;
    }
    //cout << H << endl;
    return (H-1)/maxn + 1 + cnt;
}

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

Measured memory_bytes: 1024
#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;

int main(){
	long x,t;
	cin >> x >> t;
	long ans=x-t;
	if(ans<0)ans=0;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
#define rrep(i, n) for(i = n - 1; i >= 0; i--)
using namespace std;

string toS(int x) {
	string s;
	while (x > 0) {
		int digit = x % 10;
		s += (char)(digit + '0');
		x /= 10;
	}
	return s;
}

bool check(int x) {
	string s = toS(x);
	int l = 0, r = s.length() - 1;
	while (l < r) {
		if (s[l] != s[r]) return false;
		l++; r--;
	}
	return true;
}

int main() {
	int a, b;
	
	cin >> a >> b;
	
	int ans = 0;
	for (int i = a; i <= b; i++) {
		if (check(i)) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Numeric

main :: IO()
main = do
  { _ <- getInts
  ; xs <- getInts
  ; putInts (reverse xs)
  }
--


getInts :: IO[Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO()
putInts = putStrLn . unwords . map show

getDoubles :: IO[Double]
getDoubles = map read . words  <$> getLine

putDoubles :: [Double] -> IO()
putDoubles = putStrLn . unwords . map showDouble

showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""



Measured memory_bytes: 4280
//https://atcoder.jp/contests/dp/tasks/dp_k
#include <bits/stdc++.h>
#include <sstream> 
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define pi 2*acos(0.0)
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repe(i,a,b) for(ll i=a;i<=b;++i)
#define CPrint(c)  for(auto i:(c)) { cout<<i<<" "; } nl 
#define eb   emplace_back
#define ef   emplace_front
#define pb   push_back
#define pf   push_front
#define popb pop_back
#define popf pop_front
#define mp   make_pair
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
//Allows to traverse any type of macro
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
//debuggers
#define trace2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define trace3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define trace4(w,x,y,z) cout<<#w<<"="<<w<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
typedef long long ll;
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<ll,ll> pll;
const int lim = 1e5+5;
int main()
{
	int n,k;
	FAST_IO;
	//odd
	cin >> n >> k;
	ll a[n];
	/*
	we have a pile of k stones. Choose and element x from A and remove x stones
	Player loses if unable to play
	*/
	// dp[i]= true if first player wins if there are i stones remaining
	vector<bool>dp(k+1);
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	for(int stones=0;stones<=k;stones++)
	{
		for(int x: a)
		{
			if(stones >=x && !dp[stones-x])//first player who will move for stones-x being false
			{
				dp[stones] = true;
			}
		}
	}
	if(dp[k])
	{
	cout  << "First" << endl;// Taro wins
	}
	else {
	cout << "Second" << endl; // Jiro wins
	}

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			System.out.println((n * 100 + m * 1800) * pow(2, m));
		}
	}

	/**
	 * nのmべき乗を返す
	 * 
	 * @param n
	 * @param m
	 * @return nのmべき乗
	 */
	private static int pow(int n, int m) {
		int result = 1;
		while (m > 0) {
			if (1 == (m & 1)) {
				result *= n;
			}
			n *= n;
			m >>= 1;
		}
		return result;
	}
}


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

int main(){
  ll N;cin>>N;
  vll a(N);rep(i,N)cin>>a[i];
  vll cumsum(N);
  cumsum[0]=a[0];
  for(int i=1;i<N;++i){
    cumsum[i]=cumsum[i-1]+a[i];
  }
  //+-
  ll ans=0,tmp=0;
  for(int i=0;i<N;++i){
    if(i%2==0){
      if(cumsum[i]+tmp<=0){
        ans += abs(cumsum[i]+tmp)+1;
        tmp += abs(cumsum[i]+tmp)+1;
      }
    }
    else{
      if(cumsum[i]+tmp>=0){
        ans += cumsum[i]+tmp+1;
        tmp -= cumsum[i]+tmp+1;
      }
    }
  }
  //-+
  ll ans2=0,tmp2=0;
  for(int i=0;i<N;++i){
    if(i%2==1){
      if(cumsum[i]+tmp2<=0){
        ans2 += abs(cumsum[i]+tmp2)+1;
        tmp2 += abs(cumsum[i]+tmp2)+1;
      }
    }
    else{
      if(cumsum[i]+tmp2>=0){
        ans2 += cumsum[i]+tmp2+1;
        tmp2 -= cumsum[i]+tmp2+1;
      }
    }
  }
  cout << min(ans,ans2) << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,r;
    cin>>s;
    int moves=0;
    int i=1;
    int f=0;
    while(s.size()>2&&i<s.size())
    {
         f=0;
        if((i+1)<s.size())
        {
            if(s[i-1]!=s[i+1])
            {
                f=1;
                s.erase(i,1);
                moves++;
            }
    
        }
        if(!f)
            i++;
        else
            i=max(1,i-1);

    }
    if(moves%2)
        printf("First");
    else
        printf("Second");
    return 0;
}


Measured memory_bytes: 640
import sys
input = sys.stdin.readline

S = input()

d = ["A","T","C","G"]

l = len(S)

acgt = []
a = ""

for i in range(l):
    if S[i] in d:
        a = a + S[i]
        if i == l-1:
            acgt.append(a)
    else:
        acgt.append(a)
        a = ""

max = 0

for a in acgt:
    if len(a) > max:
        max = len(a)

print(max)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
int a[20];
using namespace std;
signed main(){
    string s;
    cin>>s;
    int n=s.size();
    int sum=0;
    int ans=0;
    for(int i=0;i<n;i++){
        a[i]=-1;
        if(s[i]=='A'||s[i]=='G'||s[i]=='C'||s[i]=='T'){
            a[i]=i;
        }
    }
    for(int k=0;k<n;k++){
        if(a[k]>=0){
            sum++;
        }
        else{
            sum=0;
        }
        if(sum>ans){
            ans=sum;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys

def main():
	n = int(input())
	
	ins = []
	for _ in range(n):
		t, a = map(int, input().split(" "))
		ins.append((t, a))
		
	takahashi = 0
	aoki = 0
	takahashi, aoki = ins[0]
	
	for i, val in enumerate(ins):
		if i == 0: continue
		t, a = val
		m = max(-(-takahashi // t), -(-aoki // a))
		takahashi, aoki = t * m, a * m
		
	print(takahashi + aoki)

if __name__ == "__main__":
	main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
const int cost[10] = {0,2,5,5,4,5,6,3,7,6};

const int INF = 1e9;

void chmax(int &a, int b){if(a<b)a = b;}

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

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(M);
    rep(i,M){
        cin >> A[i];
    }
    vector<int> dp(N+1,-INF);//dp[i] = i本使って作れる最大桁数
    //max(dp[i-f(A[j])]+1 : j=1~M )
    dp[0] = 0;
    for(int i = 1;i <= N; i++){
        for(int j = 0; j < M ; j++){
            if(i-cost[A[j]] >= 0)chmax(dp[i],dp[i-cost[A[j]]]+1);
        }
    }
    vector<pair<int,string>> p(M);
    rep(i,M){
        string s = {(char)('0'+A[i])};
        p[i] = make_pair(cost[A[i]],s);
    }
    sort(p.begin(),p.end(),comp);

    int remain = dp[N];//残り桁数
    int match = N;//残りのマッチ数
    string ans = "";
    while(match > 0){
        rep(i,M){
            if(match - p[i].first >= 0 && dp[match -p[i].first] == remain-1){
                ans += p[i].second;
                match -= p[i].first;
                remain--;
                break;
            }
        }
    }
    //辞書順最小
    //sort(ans.begin(),ans.end());
    //reverse(ans.begin(),ans.end());
    
    cout << ans << endl;
    return 0;
}

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

int main(){
  int n,s;
  cin>>n>>s;
  int a[n];
  rep(i,0,n) cin>>a[i];
  ll dp[n+1][s+1];
  dp[0][0]=1;
  rep(i,1,s+1) dp[0][i]=0;
  rep(i,0,n){
    rep(j,0,s+1){
      if(a[i]<=j){
        dp[i+1][j]=(dp[i][j]+dp[i][j-a[i]])%mod;
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
    dp[i+1][0]++;
  }
  ll ans=0;
  rep(i,1,n+1){
    ans+=dp[i][s];
    ans%=mod;
  }
  cout<<ans<<endl;
}

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

int main() {
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if((x + r) > W) {
        cout << "No" << endl;
    } else if((y + r) > H) {
        cout << "No" << endl;
    } else if(sqrt(x*x + y*y) < r) {
        cout << "No" << endl;
    } else if(x <= 0 || y <= 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}


Measured memory_bytes: 3136
//                                                   ¯\_(ツ)_/¯
  //#pragma GCC optimize("Ofast")
 //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long
#define pi pair<int,int>
const int N=1e6+5,MOD=1e9+7;

using namespace std;

int n,m,ans;

vector<int>g[N];

int memo[N];

int dfs(int u){

	if(memo[u]!=-1)return memo[u];

	memo[u]=0;

	for(auto v : g[u]){

		memo[u]=max(memo[u],1+dfs(v));
	}

	return memo[u];
}

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

	scanf("%d %d",&n,&m);

	for(int i=0,a,b;i<m;i++)scanf("%d %d",&a,&b),g[a].pb(b);

	memset(memo,-1,sizeof(memo));

	for(int i=1;i<=n;i++)ans=max(ans,dfs(i));

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

Measured memory_bytes: 32128
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn main() {
  let cs1: String = read();
  let cs2: String = read();
  
  let ans = if cs1.chars().rev().collect::<String>() == cs2 { "YES" } else { "NO" };
  println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#define mod 3.1415926535897932384626 
using namespace std;
typedef long long ll;
  int main()
  {  double n;
      scanf("%lf",&n);
      printf("%.7f\n",2*n*mod);
   } 

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    int a, b, c; cin >> a >> b >> c;
    if(a+b+1>=c){
        cout << b+c << endl;
    }else{
        cout << a+b+1+b << endl;
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define SLAY ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define LL long long
#define PII pair<int , int>
#define PLL pair<long long , long long>
#define INPUT freopen("/Users/amrfahmy/Documents/Problem solving/CF/CF/input.txt", "r", stdin);
using namespace std;
 
const LL MOD = 1000000007;
LL n,q,c,cnt,mx,m,temp,k;
string str;
 
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b){
    return (a.first < b.first);
}
 
int main()
{
    cin>>n>>k;
    LL r , s , p;
    cin>>r>>s>>p;
    cin>>str;
    LL ans=0;
    vector<LL> score(n , 0);
    for(int i = 0 ; i < k ; i++){
        if(str[i]=='r'){
            score[i]=p;
        }else if(str[i]=='p'){
            score[i]=s;
        }else if(str[i]=='s'){
            score[i]=r;
        }
    }
    for(int i = (int) k ; i < n ; i++){
        if(str[i]=='r'){
            score[i]=p;
        }else if(str[i]=='p'){
            score[i]=s;
        }else if(str[i]=='s'){
            score[i]=r;
        }
        if(score[i]==score[i-k]  && str[i] == str[i - k])score[i]=0;
    }
    for(int i = 0 ; i < n ; i++){
        ans+=score[i];
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 1280
import java.util.*;
import java.io.*;

class Main {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
  for(;;){
  String n1=sc.next();
  String n2=sc.next();
  if(n1.equals("0"))break;
  char m1[]=n1.toCharArray();
  char m2[]=n2.toCharArray();
  
  int h=0; int blo=0;
  for(int i=0; i<4; i++)if(m1[i]==m2[i])h++;
  for(int i=0; i<4; i++){
	  for(int j=0;j<4; j++){
		  if(m1[i]==m2[j])blo++;
	  }
  }
System.out.print(h+" ");
System.out.println(blo-h);
  }
    }
}

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

int a,b,c;

int main(){
    cin>>a;
    cin>>b>>c;
    for(int i =b;i<=c;i++){
        if(i%a==0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;

}


Measured memory_bytes: 3592
#k
k=int(input())

ans = [0
,1
,9
,30
,76
,141
,267
,400
,624
,885
,1249
,1590
,2208
,2689
,3411
,4248
,5248
,6081
,7485
,8530
,10248
,11889
,13687
,15228
,17988
,20053
,22569
,25242
,28588
,31053
,35463
,38284
,42540
,46581
,50893
,55362
,61824
,65857
,71247
,76884
,84388
,89349
,97881
,103342
,111528
,120141
,128047
,134580
,146316
,154177
,164817
,174438
,185836
,194157
,207927
,218812
,233268
,245277
,257857
,268182
,288216
,299257
,313635
,330204
,347836
,362973
,383709
,397042
,416448
,434025
,456967
,471948
,499740
,515581
,536073
,559758
,583960
,604833
,633651
,652216
,683712
,709065
,734233
,754734
,793188
,818917
,846603
,874512
,909496
,933081
,977145
,1006126
,1041504
,1073385
,1106467
,1138536
,1187112
,1215145
,1255101
,1295142
,1342852
,1373253
,1422195
,1453816
,1502376
,1553361
,1595437
,1629570
,1691292
,1726717
,1782111
,1827492
,1887772
,1925853
,1986837
,2033674
,2089776
,2145333
,2197483
,2246640
,2332104
,2379085
,2434833
,2490534
,2554600
,2609625
,2693919
,2742052
,2813988
,2875245
,2952085
,3003306
,3096024
,3157249
,3224511
,3306240
,3388576
,3444609
,3533637
,3591322
,3693924
,3767085
,3842623
,3912324
,4027884
,4102093
,4181949
,4270422
,4361548
,4427853
,4548003
,4616104
,4718640
,4812789
,4918561
,5003286
,5131848
,5205481
,5299011
,5392008
,5521384
,5610705
,5739009
,5818390
,5930196
,6052893
,6156139
,6239472
,6402720
,6493681
,6623853
,6741078
,6864016
,6953457
,7094451
,7215016
,7359936
,7475145
,7593865
,7689630
,7886244
,7984165
,8130747
,8253888
,8403448
,8523897
,8684853
,8802826
,8949612
,9105537
,9267595
,9376656
,9574704
,9686065
,9827097
,9997134
,10174780
,10290813
,10493367
,10611772
,10813692
]

print(ans[k])


Measured memory_bytes: 9392
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
   int a , b;
   cin >> a >> b;
   if(a > 8 || b > 8){
        cout << ":("  << endl;
    } else {
        cout << "Yay!" << endl; 
    }
   
    return 0;
}


Measured memory_bytes: 256
def is_prime(q):
    if q < 2:
        return False

    p = 2
    while p * p < q:
        if q % p == 0:
            return False
        p += 1

    return True


X = int(input())

if not is_prime(X):
    if X & 1 == 0:
        X += 1

    while True:
        if is_prime(X):
            break
        X += 2

print(X)


Measured memory_bytes: 2940
julia -En,s=`tr '
' ,`1";A=3n;f(b,n)=n<b?n:f(b,n÷b)+n%b;g(b)=b>1&&f(b,n)==s?min(A,b):A;A=g(n+1);for b=1:isqrt(n);A=g(b);A=g((n-s)÷b+1);end;A>2n?-1:A"

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

int main(){
  
  vector<vector<int>> c(3,vector<int>(3));

  
  for(ll i=0;i<3;i++){
    for(ll j=0;j<3;j++){
      cin>>c[i][j];
    }
  }
  
  if(c[0][1]+c[1][0]-c[1][1]==c[0][0]&&c[2][0]-c[2][1]+c[0][1]==c[0][0]&&c[2][2]-c[0][2]==c[2][1]-c[0][1]&&c[0][0]==c[0][2]-c[1][2]+c[1][0]){
  
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

int main() {
    int n, m;
    cin >> n >> m;
    string t = "";
    rep(i, n) t += '0';

    vi check(4, -1);

    bool out = false;
    rep(i, m) {
        int s, c;
        cin >> s >> c;
        s--;
        if(check[s] != -1 && check[s] != c) {
            out = true;
            //cout << 123 << endl;
        }
        check[s] = c;
        t[s] = c + '0';
    }
    if(n >= 2 && check[0] == 0) {
        out = true;
    }
    if(n >= 2 && check[0] == -1) {
        t[0] = '1';
    } 

    if(out == true) cout << -1 << endl;
    else cout << t << endl;

    return 0;
}


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


int main() {
int N,M;
  cin >> N >> M;
 vec K(N,0);
  for(int i=0;i<M;i++){
   int a ,b;
    cin >> a >>b;
    K[a-1]++;
    K[b-1]++;
  }
  for(int i=0;i<N;i++) cout << K[i] <<endl;
}
  


Measured memory_bytes: 256