akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[fastout]
fn main() {
    input! {
        n:usize,q:usize,
    }
    let mut uf = UnionFind::new(n);
    for _ in 0..q {
        input! {
            t:usize,u:usize,v:usize
        }
        if t == 0 {
            uf.unite(u, v);
        } else {
            println!("{}", if uf.find(u) == uf.find(v) { "1" } else { "0" });
        }
    }
}
pub struct UnionFind {
    parent: Vec<usize>,
    sizes: Vec<usize>,
    size: usize,
}

impl UnionFind {
    pub fn new(n: usize) -> UnionFind {
        UnionFind {
            parent: (0..n).map(|i| i).collect::<Vec<usize>>(),
            sizes: vec![1; n],
            size: n,
        }
    }

    pub fn find(&mut self, x: usize) -> usize {
        if x == self.parent[x] {
            x
        } else {
            let px = self.parent[x];
            self.parent[x] = self.find(px);
            self.parent[x]
        }
    }

    pub fn unite(&mut self, x: usize, y: usize) -> bool {
        let parent_x = self.find(x);
        let parent_y = self.find(y);
        if parent_x == parent_y {
            return false;
        }

        let (large, small) = if self.sizes[parent_x] < self.sizes[parent_y] {
            (parent_y, parent_x)
        } else {
            (parent_x, parent_y)
        };

        self.parent[small] = large;
        self.sizes[large] += self.sizes[small];
        self.sizes[small] = 0;
        self.size -= 1;
        true
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write_all(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 6544
local n, t = io.read("*n", "*n")
local min = nil
for i = 1, n do
  local a, b = io.read("*n", "*n")
  if b <= t then
    if not min then min = a
    else min = math.min(min, a)
    end
  end
end
if min then print(min) else print("TLE") end


Measured memory_bytes: 888
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;

const int inf = 0x3f3f3f3f;
typedef long long ll;
const double pi=4*atan(1.0);
int main()
{
    double r;
    scanf("%lf",&r);
    printf("%lf\n",2*pi*r);

    return 0;
}

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

#define faster      ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi          acos(-1.0)
#define nl          '\n'

///Library
#define mem(a,b)    memset(a,b,sizeof(a))
#define all(a)      a.begin(),a.end()
#define Sort(x)     sort(x.begin(),x.end())
#define Reverse(x)  reverse(x.begin(),x.end())
#define SortA(ar,s) sort(ar,ar+s)
#define SortD(ar,s) sort(ar,ar+s,greater<int>())
#define gcd(a,b)    __gcd(a,b)
#define lcm(a,b)    (a*(b/gcd(a,b)))
#define sq(x)       (x)*(x)

#define for0(a, n)      for(int i=a; i<n; i++)
#define for1(a, n)      for(int i=a; i<=n; i++)
#define rfor0(n, a)     for(int i=n-1; i>=a; i--)
#define rfor1(n, a)     for(int i=n; i>a; i--)

#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min(b,min(c,d)))
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max(b,max(c,d)))
#define ABS(x)             ((x)<0?-(x):(x))
#define pb                 push_back
#define mod                1000000007
#define end                printf("\n")
#define yes                printf("YES\n")
#define no                 printf("NO\n")

///data type
typedef long long int ll;
typedef unsigned long long int  llu;

int main()
{
    string s;
    cin>>s;
    int sz=s.size();
    if(s[sz-1]=='s')
        cout<<s<<"es"<<nl;
    else cout<<s<<"s"<<nl;
    return 0;
}


Measured memory_bytes: 3588
s = input()
#print(s[-7:])
if s[0:7] == "keyence":
  print("YES")
elif s[-7:] == "keyence":
  print("YES")
elif s[0:1]=="k" and s[-6:] == "eyence":
  print("YES")
elif s[0:2] =="ke" and s[-5:] == "yence":
  print("YES")
elif s[0:3] == "key" and s[-4:] == "ence":
  print("YES")
elif s[0:4] == "keye" and s[-3:] == "nce":
  print("YES")
elif s[0:5] == "keyen" and s[-2:] =="ce":
  print("YES")
elif s[0:6] == "keyenc" and s[-1:] == "e":
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong p) {
	int i=0;
	for(int j = 0; j < k; j++ ) {
		llong sum = 0;
		while( sum + T[i] <= p) {
			sum += T[i];
			i++;
			if(i == n ) return n;
		}
	}
	return i;
}

int solve() {
	llong left = 0;
	llong right = 100000 * 10000;
	llong mid; 
	while(left <= right) {
		mid = left + (right - left) / 2;
		int v = check(mid);
		if(v >= n) right = mid -1;
		else left = mid + 1;
	}
	return left;
}

main() {
	cin >> n >> k;
	for( int i = 0; i < n; i++) cin >> T[i];
	llong ans = solve();
	cout << ans << endl;
}

 

Measured memory_bytes: 3860
#include <iostream>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <numeric> // accumulate(begin,end,初期値)
#include <string>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#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 SUM(vec) accumulate(all(vec),0)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<#a<<':'<<a<<endl

const ll INF = 1e9+7;

// 各桁の和
template<typename T>inline T digit(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;}

int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  string s;cin>>s;
  bool ok = false;
  rep(i,s.size()){
    if(i % 2 == 0){
      if(s[i] == 'L'){print("No");return 0;}
    } else {
      if(s[i] == 'R'){print("No");return 0;}
    }
  }

  print("Yes");
  return 0;
} 

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

class Cmondai
{
    static void Main()
    {
        var L = Int64.Parse(Console.ReadLine());
        var A = new List<long>();
        for (int i=0;i<L;++i)
        {
            A.Add(Int64.Parse(Console.ReadLine()));
        }
        var dp = new long[L,5];
        for (int i=0;i<L; ++i)
        {
            var num = A[i] % 2;
            var even = A[i] == 0 ? 2 : num == 0 ? 0 : 1;
            var odd = A[i] == 0 ? 1 : num == 0 ? 1 : 0;
            var value = GetValue(dp,i,0);
            dp[i, 0] = A[i] + value;
            value = GetValue(dp, i, 1,value);
            dp[i, 1] = even+value;
            value = GetValue(dp, i, 2,value);
            dp[i, 2] = odd+value;
            value = GetValue(dp, i, 3,value);
            dp[i, 3] = even + value;
            value = GetValue(dp, i, 4, value);
            dp[i,4]= A[i] + value;
        }
        var ans = Math.Min(dp[L - 1, 0],
                  Math.Min(dp[L - 1, 1],
                  Math.Min(dp[L - 1, 2],
                  Math.Min(dp[L-1,3],dp[L - 1, 4]))));
        Console.WriteLine(ans);
    }
    static long GetValue(long[,] dp,long num,int section,long value=long.MaxValue)
    {
        if (num == 0) return 0;
        else
        {
            switch (section)
            {
                case 0:return dp[num - 1, section];
                default:return Math.Min(value, dp[num - 1, section]);
            }
        }
    }
}

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

int main() {
  string a,b,c;
  cin>>a>>b>>c;
  char x,y,z;
  x=a.at(0);
  y=b.at(0);
  z=c.at(0);
  cout<<x<<y<<z<<endl;
}


Measured memory_bytes: 256
def Insertion_Sort(A, N):
    print(A)
    A = list(map(int, A.split()))
    for i in range(1,N):
        v = A[i]  
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(" ".join(map(str,A)))

N = int(input())
A = input()
Insertion_Sort(A, N)


Measured memory_bytes: 5604
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()
	m := readInt()
	
	var types []int
	for i := 0; i < m; i++ {
		types = append(types, 0)
	}
	for i := 0; i < n; i++ {
		// person
		k := readInt()
		for j := 0; j < k; j++ {
			// type
			x := readInt() - 1
			types[x] = types[x] + 1
		}
	}
	
	var answer int
	for i := 0; i < m; i++ {
		if types[i] == n {
			answer++
		}
	}
	fmt.Println(answer)
}

func read() string {
	sc.Scan()
	return sc.Text()
}

func readInt() int {
	i, e := strconv.Atoi(read())
	if e != nil {
		panic(e)
	}
	return i
}

func solve(s, t string) (answer string) {
	answer = "You will lose"
	for i := 0; i < len([]rune(s)); i++ {
		_s := string([]rune(s)[i : i+1])
		_t := string([]rune(t)[i : i+1])
		if !match(_s, _t) {
			return
		}
	}
	answer = "You can win"
	return
}

func match(s, t string) bool {
	if s == "@" || t == "@" {
		if s == "@" && strings.Contains("atcoder@", t) {
			return true
		}
		if t == "@" && strings.Contains("atcoder@", s) {
			return true
		}
		return false
	} else if s != t {
		return false
	}
	return true
}


Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef float f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b, int mod) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int a[200005];
void solve() {
	int n;
	cin>>n;
	fr(i,1,n)
		cin>>a[i];
	multiset<int> lol;
	fr(i,1,n) {
		auto it=lol.lower_bound(a[i]);
		if(it!=lol.begin()) {
			it--;
			lol.erase(it);
		}
		lol.insert(a[i]);
	}
	cout<<sz(lol)<<endl;
}
 
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	fr(i,1,t) {
		solve();
	}
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 8960
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <set>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> As(N);
	for (auto& a : As)cin >> a;

	for (int i = 0; i < N - K; i++) {
		print(As[i] < As[i + K] ? "Yes" : "No");
	}
}


Measured memory_bytes: 4044
use std::io::{BufRead, BufReader};

fn main(){
    let lines = read::<String>();
    let a: Vec<i32> = 
        lines[1]
        .split(' ')
        .map(|i| i.parse().unwrap())
        .collect();
    println!("{}",solve(a, 0));
}

fn solve(a: Vec<i32>, c: i32) -> i32 {
    if a.iter().filter(|&i| i % 2 == 0).count() == a.len() {
        solve(a.iter().map(|i| i / 2).collect(), c + 1)
    } else {
        c
    }
}

fn read<T>() -> Vec<T>
where
  T: std::str::FromStr,
  T::Err: std::fmt::Debug,
{
    let lines: Vec<T> =
        BufReader::new(std::io::stdin())
        .lines()
        .map(|l| l.unwrap().parse::<T>().unwrap())
        .collect();
    lines
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define deb(x) cout<<#x<<"="<<x<<endl
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 1000000000000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;


void Main(){

  int x,y;

  cin>>x>>y;

  if(x==2) cout<< ( y==2 ? "Yes" : "No" )<<"\n";
  else if(x==4 or x==6 or x==9 or x==11) cout<< ( y==4 or y==6 or y==9 or y==11 ? "Yes" : "No" )<<"\n";
  else{
    cout<<( y==4 or y==6 or y==9 or y==11 or y==2 ? "No" : "Yes" )<<"\n";
  }

}
//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>       // for next_permutation
#include <vector>
#include <string>

using std::cin;
using std::cout;
using std::endl;

int factorial(int n)
{
  int fact = 1;
  for (int i = n; i > 0;i--) fact *= i;
  return fact;
}

void count_order()
{
  int n;
  cin >> n;

  std::vector<int> p(n);
  std::vector<int> q(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n; i++) cin >> q[i];


  int p_cnt = 0, q_cnt = 0;
  for (int i = 0; i < n; i++)
  {
    p_cnt += (p[i]-1) * factorial(n - 1 - i);
    for (int j = i + 1; j < n; j++) {
      if (p[j] > p[i]) p[j]--;
    }
  }
  for (int i = 0; i < n; i++)
  {
    q_cnt += (q[i] - 1) * factorial(n - 1 - i);
    for (int j = i + 1; j < n; j++) {
      if (q[j] > q[i]) q[j]--;
    }
  }
  cout << std::abs(p_cnt - q_cnt);
}

void welcome_atcoder()
{
  int n, m;
  cin >> n >> m;
  int pena = 0;
  std::vector<int> ac(n + 1, 0);//インデックスを無理やりpに合わせた
  std::vector<int> wa(n + 1, 0);

  for (int i = 0; i < m; i++) 
  {
    int p; 
    std::string s;
    cin >> p >> s;

    if (s == "WA") wa[p]++;
    if (ac[p] == 1) continue;
    if (ac[p] == 0 && s == "AC")
    {
      ac[p] = 1;
      pena += wa[p];
    }
  }

  int ans = 0;
  for (int i = 0; i < n + 1; i++) if (ac[i] == 1) ans++;
  cout << ans << " " << pena << endl;
}


int main() 
{
  //count_order();
  welcome_atcoder();
}

Measured memory_bytes: 1024
#include <stdio.h>

#define MAX 8

int N,ans = 0;

void visit(int r, int C[][MAX+1], int u[])
{
    int f = 1;
    int B[MAX+1][MAX+1];
    int w[MAX+1];

    for (int i = 0; i <= N; i++) {
        w[i] = u[i];
        for (int j = 0; j <= N; j++) {
            B[i][j] = C[i][j];
        }
    }
    w[r] = 1;
    for (int i = 1; i <= N; i++) {
        if (w[i] == 0) {
            f = 0;
            break;
        }
    }
    if (f == 1) {
        ans++;
    }
    for (int i = 1; i <= N; i++) {
        if (B[r][i] == 1 && w[i] == 0) {
            visit(i,B,w);
        }
    }
}

int main(void)
{
    int A[MAX+1][MAX+1];
    int v[MAX+1];
    int M;
    int a, b;

    scanf("%d%d",&N,&M);

    for (int i = 0; i <= N; i++) {
        v[i] = 0;
        for (int j = 0; j <= N; j++) {
            A[i][j] = 0;
        }
    }

    for (int i = 0; i < M; i++) {
        scanf("%d%d",&a,&b);
        A[a][b] = A[b][a] = 1;
    }

    visit(1, A, v);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
N=int(input())
B=list(map(int,input().split()))
A=[0]*N

A[0]=B[0]
A[1]=B[0]

for i in range(1,N-1):
    if B[i]>=B[i-1]:
        A[i+1]=B[i]
    else:
        A[i]=B[i]
        A[i+1]=B[i]

print(sum(A))

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    private struct Pair<T> { public T x, y; public Pair(T xx, T yy) { x = xx; y = yy; } }
    private static int[] dx = { 1, 0, -1, 0 };
    private static int[] dy = { 0, -1, 0, 1 };
    public static void Main()
    {
        int N = NextInt();
        long C = NextLong();
        long[] x = new long[N];
        long[] v = new long[N];
        for (int i = 0; i < N; i++) { x[i] = NextLong(); v[i] = NextLong(); }
        long pt1 = I_Hate_Sushi(N, C, x, v);
        Array.Reverse(x);
        Array.Reverse(v);
        for (int i = 0; i < N; i++) x[i] = (C - x[i]);
        long pt2 = I_Hate_Sushi(N, C, x, v);
        Console.WriteLine(Math.Max(pt1, pt2));
    }

    public static long I_Hate_Sushi(int N, long C, long[] x, long[] v)
    {
        //iまで逆から参照した時の最大値
        long[,] mx = new long[2, N + 1];

        long score = 0;
        long max_score = 0;
        long ret_score = 0;
        long walk = 0;
        for (int i = N - 1; i >= 0; i--)
        {
            score += v[i];
            walk = C - x[i];
            if (score - walk > max_score)
            {
                max_score = score - walk;
                ret_score = score - 2 * walk;
            }
            mx[0, i] = max_score;
            mx[1, i] = ret_score;
        }

        score = max_score = ret_score = walk = 0;
        for (int i = 0; i < N; i++)
        {
            score += v[i];
            walk = x[i];
            ret_score = Math.Max(score - 2 * walk + mx[0, i + 1], mx[1, i + 1] + score - walk);
            max_score = Math.Max(Math.Max(score - walk, ret_score), max_score);
        }
        return max_score;
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static char NextChar() { Confirm(); return char.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 19900
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <math.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int a[n];

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    double b[n];
    double sum = 0;
    for(int i = 0; i < n; i++){
        b[i] = 1.0 / a[i];
        sum += b[i];
    }

    cout << 1.0 / sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

ll dp[110][110][400];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,W;
    cin >> n >> W;
    vl w(n),v(n);
    ll w0;
    rep(i,n) {
        cin >> w[i] >> v[i];
        if(i == 0) {
            w0 = w[0];
        }
        w[i] -= w0;
    }
    rep(i,110) rep(j,110) rep(k,400) dp[i][j][k] = -linf;
    dp[0][0][0] = 0;
    rep(i,n) rep(j,i+2) rep(k,400) {
        chmax(dp[i+1][j][k],dp[i][j][k]);
        if(w[i] <= k && j > 0) {
            chmax(dp[i+1][j][k], dp[i][j-1][k-w[i]]+v[i]);
        }
    }
    ll ans = 0;
    rep(i,n+1) {
        ll nW = W-w0*i;
        if(nW < 0) continue;
        for(int j = 0; j < 400 && j <= nW; j++) chmax(ans,dp[n][i][j]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 38144
# coding: utf-8
# Your code here!

s = input()

ans = 0
point = 0
for i in s:
    if i == ">":
        point += 1
        ans += point
    else:
        break

point2 = 0
for i in s[::-1]:
    if i == "<":
        point2 += 1
        ans += point2
    else:
        break

if point2:
    s = s[point: -point2]
else:
    s = s[point:]

l_p = 0
r_p = 0
for i in s:
    if i == "<":
        if l_p:
            ans -= min(l_p, r_p)
            r_p = 0
            l_p = 0
        r_p += 1
        ans += r_p
    else:
        l_p += 1
        ans += l_p
ans -= min(l_p, r_p)
print(ans)

Measured memory_bytes: 48496
#include<stdio.h>

int main (void){
  int N,num[1000],cnt=0;
  scanf("%d",&N);
  while(N>cnt){
      scanf("%d",&num[cnt]);
      if(num[cnt] % 2 == 0){
          if(num[cnt] % 3 != 0 && num[cnt] % 5 != 0)
          {
              printf("DENIED");
              return 0;
          }
      }
      cnt ++;
  }
  printf("APPROVED");
  return 0;

}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int hoge(int *n){cin>>*n;return *n;}
int main(){
	int n,num,ice[10];
	while(hoge(&n)){
		for(int i=0;i<10;i++) ice[i]=0;
		while(n--) cin >> num,ice[num]++;
		for(int i=0;i<10;i++){
			if(ice[i]) while(ice[i]--) cout<< "*";
			else cout << "-";
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
 
int main(void) {
      int a,b,c;
     scanf("%d %d",&a,&b);
     c=a+b;
     if(c>=10)
     {
          printf("error\n");
     }
     else
     {
        printf("%d\n",c);
     }
 
	return 0;
}

Measured memory_bytes: 128
import numpy

n,m,k = map(int,input().split())
li_a = list(map(int,input().split()))
li_b = list(map(int,input().split()))

li_A = [0] + list(numpy.cumsum(li_a))
li_B = [0] + list(numpy.cumsum(li_b))

ans, j = 0,m
for i in range(n+1):
    if li_A[i] > k:
        break
    while li_B[j] + li_A[i]> k:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Measured memory_bytes: 60780
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)
#define RREP(i, a, n) for(int i=n-1; i>=a; i--)

struct St {
	int xmin, xmax, ymin, ymax;
	St() :xmin(100), xmax(-100), ymin(100), ymax(-100) {}

	void check(int h, int w) {
		xmin = min(xmin, w);
		xmax = max(xmax, w);
		ymin = min(ymin, h);
		ymax = max(ymax, h);
	}
};

int main()
{
	int N;
	cin >> N;
	REP(k, 0, N) {
		int H, W;
		cin >> H >> W;

		vector< vector<char> > mater(H, vector<char>(W));
		set<char> c;
		map<char, St> rect;
		REP(i, 0, H) REP(j, 0, W) {
			cin >> mater[i][j];
			if (mater[i][j] != '.') c.insert(mater[i][j]);
		}
		if (c.empty()) {
			cout << "SAFE" << endl;
			continue;
		}

		vector<char> nc;
		for (auto itr : c) {
			nc.push_back(itr);
		}
		
		for(auto itr : nc){
			St state;
			REP(i, 0, H) {
				REP(j, 0, W) {
					if (mater[i][j] == itr) {
						state.check(i, j);
					}
				}
			}

			rect[itr] = state;
		}
		
		bool safe_flag = false;
		do {
			vector< vector<char> > nmater(H, vector<char>(W, '.'));
			for (auto itr : nc) {
				REP(i, rect[itr].ymin, rect[itr].ymax + 1) {
					REP(j, rect[itr].xmin, rect[itr].xmax + 1) {
						nmater[i][j] = itr;
					}
				}
			}

			if (nmater == mater) {
				safe_flag = true;
				break;
			}
		} while (next_permutation(nc.begin(), nc.end()));
		
		if (safe_flag) cout << "SAFE" << endl;
		else cout << "SUSPICIOUS" << endl;
	}
	return 0;
}

Measured memory_bytes: 3156
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;


int al[26], di[10];

int main() {
	string s;
	cin >> s;
	for (char c: s) {
		if (isdigit(c)) {
			di[c-'0']++;
		} else {
			al[c-'a']++;
		}
	}

	int sm = 0;
	for (int i = 26; i >= 1; i--) {
		for (int j = 0; j <= 26-i; j++) {
			int mi = 10000;
			for (int k = 0; k < i; k++) {
				mi = min(mi, al[j+k]);
			}
			if (mi) {
//				printf("%d %d %d\n", i, j, mi);
			}
			sm += mi * min(3, i);
			for (int k = 0; k < i; k++) {
				al[j+k] -= mi;
			}
		}
	}

	for (int i = 10; i >= 1; i--) {
		for (int j = 0; j <= 10-i; j++) {
			int mi = 10000;
			for (int k = 0; k < i; k++) {
				mi = min(mi, di[j+k]);
			}
			sm += mi * min(3, i);
			for (int k = 0; k < i; k++) {
				di[j+k] -= mi;
			}
		}
	}
	printf("%d\n", sm);
    return 0;
}

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

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

template <int T_size> class Union_Find{
	int p[T_size];
	LL x[T_size];
	int uni_count;
	
public:
	
	Union_Find(vector<LL> V){
		fill(p,p+T_size,-1);
		repp(i,0,V.size()) x[i] = V[i];
		uni_count = 0;
	}
	
	int boss(int a){
		return p[a] >= 0 ? boss(p[a]) : a;
	}
	
	tuple<LL,LL,int,int> uni(int a , int b){
		int s = boss(a);
		int t = boss(b);
		auto y = get_x(s);
		auto z = get_x(t);
		if(s != t){
			++uni_count;
			if(p[s] > p[t]){
				swap(s,t);
				swap(a,b);
				swap(y,z);
			}
			x[s] += x[t];
			p[s] += p[t];
			p[t] = s;
		}
		return make_tuple(y,z,s,t);
	}

	void cut(LL y, LL z, int s, int t){
		p[s] = -1;
		p[t] = -1;
		x[s] = y;
		x[t] = z;
	}

	bool find(int a , int b){
		return boss(a) == boss(b);
	}
	
	int count(){
		return uni_count;
	}
	
	int member(int a){
		return -p[boss(a)];
	}

	LL get_x(int a){
		return x[boss(a)];
	}
};

int main(){
	int N,M; cin >> N >> M;
	vector<LL> X(N+1);
	repp(i,0,N) cin >> X[i+1];
	vector<tuple<LL,int,int>> E(M);
	repp(i,0,M){
		LL Y; int A,B; cin >> A >> B >> Y;
		E[i] = make_tuple(Y,A,B);
	}
	sort(E.begin(),E.end());
	Union_Find<100010> uf(X);
	vector<tuple<LL,LL,int,int>> V(M,make_tuple(-1,-1,-1,-1));
	repp(i,0,M) if(!uf.find(get<1>(E[i]),get<2>(E[i]))){
		V[i] = uf.uni(get<1>(E[i]),get<2>(E[i]));
	}
	int ans = 0;
	repm(i,M-1,-1){
		if(uf.get_x(get<1>(E[i])) < get<0>(E[i])){
			++ans;
			
			if(get<0>(V[i]) != -1){
				uf.cut(get<0>(V[i]),get<1>(V[i]),get<2>(V[i]),get<3>(V[i]));
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 6128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/
struct mint {
    long long x;
    mint(long long _x=0):x((_x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint modpow(long long t) const {
        if (!t) return 1;
        mint a = modpow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return modpow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
struct combination {
    vector<mint> fact, ifact;
    //constructor(initiation)
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint Comb(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
    mint H(int n, int m){
        return Comb(n + m, m);
    }
};

combination comb(1e7+1);
// (0, 0) ~ (a, b)までの和
// (2, 2)だったら、(3 + 3) C (3) - 1
mint f(int a, int b){
    return comb.Comb(a+1 + b + 1, a + 1) - 1;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int a,b,c,d;
    cin>>a>>b>>c>>d;

    mint ans = f(c, d) - f(a-1, d) - f(c, b-1) + f(a-1, b-1);
    cout<<ans.x<<endl;
}

Measured memory_bytes: 156544
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


A, B, C = _li()

ans = B + min(A+B+1, C)
print(ans)


Measured memory_bytes: 3060
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#define ios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
typedef long long ll;
const int MAXN=2e5+100;
const ll MOD=1e9+7;
struct node{
    int x,y;
}p[MAXN];
int main()
{
    ios;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>p[i].x>>p[i].y;
    int maxn1=-1e9,maxn2=-1e9;
    int minn1=1e9,minn2=1e9;
    for(int i=1;i<=n;i++){
        maxn1=max(maxn1,p[i].x+p[i].y);
        minn1=min(minn1,p[i].x+p[i].y);
        maxn2=max(maxn2,p[i].x-p[i].y);
        minn2=min(minn2,p[i].x-p[i].y);
    }
    int ans1=maxn1-minn1;
    int ans2=maxn2-minn2;
    int ans3=-ans2;
    cout<<max(ans1,max(ans2,ans3))<<'\n';
    return 0;
}

Measured memory_bytes: 5168
#include <cstdio>
#include <cstring>
bool s[33];
int main(void){
  memset(s,true,sizeof(s));
  for(int i = 0; i < 28; i++){
    int n;
    scanf("%d",&n);
    s[n]=false;
  }
  for(int i = 1; i <= 30; i++){
    if(s[i])printf("%d\n",i);
  }
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	double a, b, x;
	cin >> a >> b >> x;
	
	double h = x / (a * a);
	double hig = b;
	double low = 2*h - b;
	double arg;
	if (low >= 0) arg = atan((hig - low) / a) * 180 / M_PI;
	else {
		double len = x * 2 / a / b;
		arg = atan(b / len) * 180 / M_PI;
	}
	
	printf("%.15f\n", arg);
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m,a[100005],b[100005],val,cnt=0;
int main()
{
	scanf("%lld%lld",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	if(a[1]>=m)
	{
		b[1]=m;
	}else
	{
		b[1]=a[1];
	}
	for(int i=2;i<=n;i++)
	{
		val=m-b[i-1];
		if(a[i]>val)
		{
			b[i]=val;
		}else
		{
			b[i]=a[i];
		}
	}
	for(int i=1;i<=n;i++)
	{
		cnt+=(a[i]-b[i]);
	}
	printf("%lld\n",cnt);
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const ll  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1000000007;

/*vll adj[MAXN];ll visit[MAXN]={};
ll dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
ll dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
*/
// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m,k,d,w,summ;
string s,t;
vll a,b;

// <------------- Implement Functions Here ----------> //

// <------------- Start of main() -------------------> //

void MAIN(ll _) {
	cin >> n;
	a = vll(n);
	b = vll(n);
	
	for(ll i=0;i<n;i++) cin>>a[i];
	
	b[n-1] = a[n-1];
	for(ll i=n-2;i>=0;i--) b[i]+=b[i+1]+a[i], b[i]%=MOD;

	ll ans = 0;
	for(ll i=0;i<n-1;i++) {
		ans += ((a[i])*(b[i+1]));
		ans%=MOD;
	}

	cout<<ans;newl;
}	

int main() {
	fastio;randomINT;
	//freopen("out_hc.txt","w+",stdout);
	//cin>>T;
	for(ll i=1;i<=T;i++) {
		MAIN(i);
	}
	return 0;
}



Measured memory_bytes: 6400
using System;
class ProgramA
    {
        static void Main(string[] args)
        {
            //入力
            string[] input = Console.ReadLine().Split(' ');
            string s = input[0];
            string t = input[1];
            string[] input2 = Console.ReadLine().Split(' ');
            int a = int.Parse(input2[0]);
            int b = int.Parse(input2[1]);
            string u = Console.ReadLine();

            //h/aであまりが生じないならそのまま、それ以外は1回足す
            
                if(s == u)
                    Console.WriteLine((a -1) + " "+ b);
                else
                    Console.WriteLine(a + " "+ (b-1));
            
            
        }
    }

Measured memory_bytes: 11092
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 
const ll inf=1e18+1e17;
const ll mod =1e9+7;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=	(a*a)%mod;b>>=1;}return (res%mod);}
const int N=1e5+5;
ll arr[N];
void solve(){
	int n;
	cin>>n;
	for ( int i=0;i<n;i++)
		cin>>arr[i];
	arr[n]=0;
	n++;
	ll cnt=0,ans=0;
	for ( int i=0;i<n;i++){
		if ( arr[i]==0){
			ans+=cnt/2;
			cnt=arr[i];
		}
		else
			cnt+=arr[i];
	}
	cout<<ans<<'\n';


}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
}

Measured memory_bytes: 4380
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

int main (int argc, char const *argv[])
{
    int64_t N, K;
    int64_t ans = 0;

    scanf("%"PRId64"%"PRId64, &N, &K);

    printf("%"PRId64"\n", N - K + 1);
}


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

// 総数を1000000007（素数）で割った余り
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; }

const string YES = "Yes";
const string NO = "No";

int main(){
    int n;
    cin >> n;
    bool can = false;
    rep1(i, 9) {
        rep1(j, 9) {
            if (n == i*j) can = true;
        }
    }
    cout << (can?YES:NO) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int PRIME_MAX = 200000;
bool isPrime[PRIME_MAX];
int main () {
	fill(isPrime, isPrime + PRIME_MAX, true);
	isPrime[0] = isPrime[1] = false;
	for (int i = 2; i * i <= PRIME_MAX; i++) {
		if (isPrime[i]) {
			for (int j = i << 1; j < PRIME_MAX; j += i) {
				isPrime[j] = false;
			}
		}
	}
	int n, p;
	while (cin >> n >> p, n != -1 || p != -1) {
		vector<int> primes;
		for (int i = n + 1; primes.size() <= 100; i++) {
			if (isPrime[i]) primes.push_back(i);
		}
		vector<int> sums;
		for (unsigned i = 0; i < primes.size(); i++) {
			for (unsigned j = i; j < primes.size(); j++) {
				sums.push_back(primes[i] + primes[j]);
			}
		}
		sort(sums.begin(), sums.end());
		cout << sums[p - 1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1472
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e6+500;
char S[N],T[N];
int q[N],n;
int main()
{
    scanf("%d",&n);
    scanf("%s",S+1);scanf("%s",T+1);
    if(strcmp(S+1,T+1)==0){puts("0");return 0;}
    int i=n,j=n;int head=1,tail=0;int ans=1;
    while(j)
    {
        while(j!=1&&T[j-1]==T[j])--j;
        while(i&&(i>j||S[i]!=T[j]))--i;
        if(!i){puts("-1");return 0;}
        while(head<=tail&&(q[head]-(tail-head)>j))++head;
        if(i!=j)q[++tail]=i;
        ans=max(ans,tail-head+2);
        --j;
    }
    cout<<ans<<endl;
}

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

 
int main() {
    string s;
    cin>>s;
    int a=s[0]-'0', b=s[1]-'0', c=s[2]-'0', d=s[3]-'0',ans;//記憶しておく
    for(int i = 0; i < (1<<3);i++){
        char op1='+',op2='+',op3='+';
        if(i&(1<<0))ans=a+b;
        else {
            ans=a-b;
            op1='-';
        }
        if(i&(1<<1))ans=ans+c;
        else {
            ans=ans-c;
            op2='-';
        }
        if(i&(1<<2))ans=ans+d;
        else {
            ans=ans-d;
            op3='-';
        }
        if(ans==7){
            cout<<a<<op1<<b<<op2<<c<<op3<<d<<"=7"<<endl;
            return 0;
        }
    }
}

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

using namespace std;

long long MOD=1000000007;

long long Power(long long a, long long k)
{
    long long S=a, t=1, R=1;
    while (k > 0)
    {
        if (k % (2*t) != 0)
        {
            k -= t;
            R *= S;
            R %= MOD;
        }
        S *= S;
        S %= MOD;
        t *= 2;
    }
    return R;
}

int main()
{
    long long n, m, N, M, a, b, Re=0, A, B, F[200001];
    cin >> n >> m >> N >> M;
    F[1] = 1;
    F[0] = 1;
    for (int i = 2; i <= 200000; i++)
    {
        F[i] = F[i-1] * i;
        F[i] %= MOD;
    }
    for (int i = M; i < m; i++)
    {
        a = i;
        b = n-N-1;
        A = F[a+b];
        A *= Power(F[a], MOD-2);
        A %= MOD;
        A *= Power(F[b], MOD-2);
        A %= MOD;
        a = m-i-1;
        b = N-1;
        B = F[a+b];
        B *= Power(F[a], MOD-2);
        B %= MOD;
        B *= Power(F[b], MOD-2);
        B %= MOD;
        Re += (A*B) % MOD;
        Re %= MOD;
    }
    cout << Re;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define maxn 1000086

using namespace std;

const int p = 1e9 + 7;

inline int fpow(int x, int y){
	int ans = 1;
	while(y){
		if(y & 1) ans = 1ll * ans * x % p;
		x = 1ll * x * x % p, y >>= 1;
	}
	return ans;
}

int n, m, k;
int sum[maxn], inv[maxn], pw[maxn];

inline int C(int n, int m){
	return 1ll * sum[n] * inv[n - m] % p * inv[m] % p;
}


int main(){
	sum[0] = 1;for(int i = 1;i < maxn;i++) sum[i] = 1ll * sum[i - 1] * i % p;
	inv[maxn - 1] = fpow(sum[maxn - 1], p - 2);
	for(int i = maxn - 2;~i;i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % p;
	pw[0] = 1;for(int i = 1;i < maxn;i++) pw[i] = 1ll * pw[i - 1] * 3 % p;
	scanf("%d%d%d", &n, &m, &k);
	int ans = 0;
	if(m > k) swap(m, k);//m <= k
	int x = 1;
	for(int i = 0;i <= m + k;i++){
		ans = (ans + 1ll * C(n - 1 + i, n - 1) * pw[m + k - i] % p * x) % p;
		if(i < m) x = x * 2 % p;
		else if(i < k) x = (2ll * x + p - C(i, m)) % p;
		else x = (2ll * x + 2 * p - C(i, m) - C(i, k)) % p;
	}
	printf("%d", ans);
}

Measured memory_bytes: 15532
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
template<class T> inline void chmin(T &a, T b){if(a>=b)a=b;}
template<class T> inline void chmax(T &a, T b){if(a<=b)a=b;}
typedef long long ll;

template<int MOD> struct ModInt {
    static const int Mod = MOD; unsigned x; ModInt() : x(0) { }
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
    ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const { long long a = x, b = MOD, u = 1, v = 0;
        while (b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); }
        return ModInt(u); }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const { ModInt t; t.x = x == 0 ? 0 : Mod - x; return t; }
};
template<int MOD> ostream& operator<<(ostream& st, const ModInt<MOD> a) { st << a.get(); return st; };
template<int MOD> ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1; while (k) { if (k & 1) r *= a; a *= a; k >>= 1; } return r; }
typedef ModInt<1000000007> mint;


int N;


int main(){
    cin >> N;
    map<int,int> m; // キーが約数、値が約数の数

    for(int i=1;i <= N;++i){
        int n = i;
        for(int i=2;i*i <= n;++i){
            while(n % i == 0){ // 約数iがある分だけカウント
                ++m[i];
                n /= i; // どんどん減らしていく
            }
        }
        if(n != 1) ++m[n]; // nの更新がなかった -> nは素数だった。
    }
    mint ans = 1;
    for(map<int,int>::iterator itr = m.begin(); itr != m.end(); ++itr){
        ans *= ((itr->second)+1); // 持ってる約数を、[使う*持ってる数分　+ 使わない]という選び方がある。 
    }
    cout << ans << endl;
    return 0;
}

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

import statistics
import sys


def main():
    while True:
        n = int(sys.stdin.readline())
        if n == 0:
            sys.exit(0)
        print(statistics.pstdev([int(num) for num
                                in sys.stdin.readline().split()]))


if __name__ == '__main__':
    main()

Measured memory_bytes: 10284