akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
        StringBuilder sb1 = new StringBuilder(s);
        if(!(s.equals(sb1.reverse().toString()))){
        	System.out.println("No");
            return;
        }
        String s2 = s.substring(0, (s.length() - 1) / 2);
        StringBuilder sb2 = new StringBuilder(s2);
        if(!(s2.equals(sb2.reverse().toString()))){
        	System.out.println("No");
            return;
        }
        String s3 = s.substring(((s.length() + 3) / 2) - 1);
        StringBuilder sb3 = new StringBuilder(s3);
        if(!(s3.equals(sb3.reverse().toString()))){
        	System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 35580
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
#define int long long
inline int read(){
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9'){ x = x * 10 + (ch ^ 48); ch = getchar(); }
	return x * f;
}
int n, x, ans;
map <int, int> vis;
signed main(){
	n = read();
	for(int i = 1; i <= n; ++i) x = read(), ans += vis[x - i], vis[-x - i]++;
	printf("%lld\n", ans); return 0;
}

Measured memory_bytes: 26400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define div 1e9+7
#define pi 3.14159265358979
using ll = long long;
using P = pair<int,int>;
int main(){
	int r;
	cin>>r;
	cout << setprecision(20)<<2*r*pi<<endl;
}


Measured memory_bytes: 3788
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	if(s.size()>t.size()){
		cout<<"GREATER"<<endl;
	}
	else if(s.size()<t.size()){
		cout<<"LESS"<<endl;
	}
	else if(s==t){
		cout<<"EQUAL"<<endl;
	}
	else{
		if(s>t){
			cout<<"GREATER"<<endl;
		}
		else{
			cout<<"LESS"<<endl;
		}
	}
}

Measured memory_bytes: 3572
#include<stdio.h>

int main()
{
    long long x,k;

    scanf("%lld%lld",&x,&k);

    if(k>x)
    {
        if(k-x<x)
            printf("%lld",k-x);
        else
            printf("%lld",x);
    }
    else
    {
        long long rem=x%k;

        if(k-rem<rem)
            printf("%lld",k-rem);
        else
            printf("%lld",rem);
    }

    return 0;
}


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


int main(void) {
  char c;

  cin >> c;

  switch(c) {
    case 'a':
    case 'i':
    case 'u':
    case 'e':
    case 'o':
      cout << "vowel" << endl; break;
    default:
      cout << "consonant" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int N = Integer.parseInt(in.readLine());
		int ac = 0, wa = 0, tle = 0, re = 0;
		for (int i = 0; i < N; ++i) {
			String str = in.readLine();
			if (str.equals("AC")) {
				++ac;
			} else if (str.equals("WA")) {
				++wa;
			} else if (str.equals("TLE")) {
				++tle;
			} else {
				++re;
			}
		}
		System.out.println("AC x " + ac);
		System.out.println("WA x " + wa);
		System.out.println("TLE x " + tle);
		System.out.println("RE x " + re);
		
	}

	void calc() {
	}

	void showResult() {
	}
}

Measured memory_bytes: 34120
a, b = [int(x) for x in input().split()]
 
if (b < a):
    temp = b
    b = a
    a = temp
 
 
x = 1
while True:
    if (int(x*0.08) == a and int(x*0.1) == b):
        print(x)
        break
    else:
        if (x > 1500):
            print(-1)
            break
        else:
            x += 1


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main(void){
    string s1,s2;
    cin>>s1;
    while(s1!=s2){
        s1.pop_back();
        s1.pop_back();
        s2=s1.substr(s1.size()/2);
        s2+=s2;
    }
    cout<<s1.size()<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int  main(){
    int a,b,c;
    cin >>a>>b>>c;
    if(a<b){
        if(b<c){
            cout<<"Yes"<<endl;
        }else{
            cout <<"No"<<endl;
        }
        }else{
            cout <<"No"<<endl;
    }
   
    return 0;
    
}


Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

long long int n;
long long int a[200000] = {0};

long long int calc(long long int b) {
  long long int sum = 0;
  for (long long i = 0; i < n; i++) {
    //sum += abs(a[i] - (b + i + 1));
    sum += abs(a[i] - b);
  }
  return sum;
}

int main(void) {
  std::cin >> n;

  for (size_t i = 0; i < n; i++) {
    std::cin >> a[i];
    a[i] -= i + 1;
  }

  std::sort(a, a + n);

  long long int median = (n % 2 == 0) ? a[n/2-1] : a[n/2];

  auto sum = calc(median);

  std::cout << sum << std::endl;

  return 0;
}

Measured memory_bytes: 1792
/*==============================================*\
ID:          shahidul_brur

Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh

 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};

const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = 1005;
const int LOGN = 20;
int dp[maxn][maxn];
char s[maxn][maxn];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, m;
    cin>>n>>m;
    f0(i,n) cin>>s[i];

    fr(i,n-1,0) 
        if(s[i][m-1]=='#') break;
        else dp[i][m-1] = 1;
    fr(i,m-1,0) 
        if(s[n-1][i]=='#') break;
        else dp[n-1][i] = 1;
    fr(i,n-2,0)
    {
        fr(j,m-2,0)
        {
            if(s[i][j]!='#')
                dp[i][j] = (dp[i][j+1] + dp[i+1][j])%MOD;
        }
    }
    cout << dp[0][0] << "\n";
    return 0;
}


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

using ll  = long long;
using pii = pair<int,int>;
#define dbg(n) cout<<'\n'<<#n<<" is "<<n<<'\n';
#define pb push_back
#define all(v) v.begin(), v.end()
#define cs(i) cout<<"Case "<<i+1<<": \n";
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);

const int N   = 3e3+5;
const int INF = 0x7fffffff;

double p[N];
double dp[N][N];


int main(){
    int n,t,hold=0;

    cin>>n;

    for(int i=0;i<n;i++)
        cin>>p[i];
    dp[0][0]=1.00;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=i;j++){
            if(j)
                dp[i][j]+=dp[i-1][j-1]*p[i-1];
            dp[i][j]+=dp[i-1][j]*(1.0-p[i-1]);
        }
    }
    double ans=0;

    for(int i=0;i<=n;i++)
        if(i>n-i)
            ans+=dp[n][i];
    /*dbg(n)
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
                cout<<dp[i][j]<<" ";
        } cout<<endl;
    }*/
    cout<<fixed<<setprecision(12);
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 68992
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >>n;
  vector<int>a(n);
  vector<bool>A(n,true);
  for( int i=0;i<n;i++){
    int s;
    cin >>s;
    a.at(i) =s-1;
  }
  int i = 0;
  int ans=0;
  while(A.at(i)){
    ans++;
    A.at(i) = false;
    i = a.at(i);
    if(i==1){
      cout <<ans;
      return 0;
    }
  }
  cout << "-1";
  
}

Measured memory_bytes: 640
from itertools import product
N, *P = map(int, input().split())
L = []
for _ in range(N):
    L.append(int(input()))
res = []
for p in product((0,1,2,3),repeat=N):
    tmp = [0]*4
    cnt = [0]*4
    for i in range(N):
        tmp[p[i]] += L[i]
        cnt[p[i]] += 1
    if cnt[1]>=1 and cnt[2]>=1 and cnt[3]>=1:
        res.append(sum(abs(tmp[i]-P[i-1]) + (cnt[i]-1)*10 for i in range(1,4)))
print(min(res))

Measured memory_bytes: 76540
#include<bits/stdc++.h>
#define M 1000000007
#define pi ld(acos(-1.0))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(ll i=a;i<=(ll)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fi first
#define se second
#define ii pair<int,int>
#define bye(x) {cout<<x;return 0;}
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    cs
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(auto &i:v) cin>>i;
    vector<int> vv(k+1);
    repp(i,1,k) {
        rep(j,n) {
            if(i>=v[j]&&!vv[i-v[j]]) {vv[i]=1;break;}
        }
    }
    cout<<(vv[k]?"First":"Second");
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

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; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui a, b; cin >> a >> b;
  if(a > b) --a;
  cout << a << CRLF;
  return;
}

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

  solve();

  return 0;
}


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

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



Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
using LL = long long; using PII = pair<LL, LL>; using VI = vector<LL>; using VVI = vector<VI>;
using VB = vector<bool>; using VS = vector<string>; using VP = vector<PII>;
#define VV(T)        vector<vector<T>>
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x)         {cout << #x << " = " << (x) << endl;}

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

void solve(std::string S){
    map<char, LL> counter;
    EACH(c, S) {
        counter[c]++;
    }
    if (SZ(counter) != 2) {
        cout << NO << endl;
        return;
    }
    EACH(x, counter) {
        if (x.second != 2) {
            cout << NO << endl;
            return;
        }
    }
    cout << YES << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;

int GCD(int a, int b){ return b ? GCD(b, a % b) : a; }

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

	for(int i = 0; i < N; ++i) cin >> A[i];

	vector<int> left(N+1, 0), right(N+1, 0);
	// left累積GCD
	for(int i = 0; i < N; ++i) {
		left[i+1] = GCD(left[i], A[i]);
	}
	for(int i = N-1; i >= 0; --i){
		right[i] = GCD(right[i+1], A[i]);
	}

	int max = 0;
	for(int i = 0; i < N; ++i){
		int l = left[i], r = right[i+1];

		int g = GCD(l, r);
		if(max < g) max = g;
	}

	cout << max << endl;

	return 0;
}


Measured memory_bytes: 1408
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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, 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")
    };
}

fn main() {
    input!{
        n: usize,
        q: usize,
        s: chars,
        td: [[String;2]; q],
    }

    let get_pos = |m: i64| -> i64 {
        let mut cur = m;
        for td_ in td.iter() {
            if cur >= 0 && cur < s.len() as i64 && td_[0] == s[cur as usize].to_string() {
                if td_[1] == 'L'.to_string() {
                    cur -= 1
                } else {
                    cur += 1
                }
            }
        }
        cur
    };
    let l = {
        let mut l = -1;
        let mut r = n as i64;

        while (r - l) > 1 {
            let m = (l + r) / 2;
            if get_pos(m) < 0 {
                l = m;
            } else {
                r = m;
            }
        }
        l
    };

    let r = {
        let mut l = -1;
        let mut r = n as i64;

        while (r - l) > 1 {
            let m = (l + r) / 2;
            if get_pos(m) >= n as i64 {
                r = m;
            } else {
                l = m;
            }
        }
        r
    };

    println!("{}", r - l - 1);
}


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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int sum = 1;
    for (int i=1; i<n; i++) {
        if (s[i] != s[i-1]) sum++;
    }

    cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3744
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, s: String);
    let a = match s.as_str() {
        "ABC" => "ARC",
        "ARC" => "ABC",
        _ => "",
    };
    println!("{}", a);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2048
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<queue>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 3; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX 210000

vector<int> G[MAX];
int N, M;
int S, T;

typedef long long ll;
typedef pair<ll,pair<ll,ll>> P;

ll d[4][MAX], V;

int dijkstra(){
	priority_queue<P,vector<P>,greater<P>> q;
	
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < MAX; j++){
			d[i][j] = INF;
		}
	}
	
	d[0][S] = 0;
	q.push(P(0,make_pair(0,S)));
	
	while(!q.empty()){
		P p = q.top();q.pop();
		ll v = p.second.second;
		
		if(d[p.second.first][v] < p.first) continue;
		
		for(int e : G[v]){
			if(d[(p.second.first+1)%MOD][e] > d[p.second.first%MOD][v] + (p.second.first == 2)){
				d[(p.second.first+1)%MOD][e] = d[p.second.first%MOD][v] + (p.second.first == 2);
				q.push(P(d[(p.second.first+1)%MOD][e],make_pair((p.second.first+1)%MOD,e)));
			}
		}
	}
	
	if(d[0][T] == INF) return -1;
	else return d[0][T];
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int u, v;
	
	cin>>N>>M;
	
	for(int i = 0; i < M; i++){
		cin>>u>>v;
		G[u].push_back(v);
		// G[v].push_back(u);
	}
	
	cin>>S>>T;
	
	cout<<dijkstra()<<endl;
	
	return 0;
}

Measured memory_bytes: 15604
num = int(input())
list1=[]
for i in range(num):
	x = input()
	list1.append(x)
print("AC x "+str(list1.count("AC")))
print("WA x "+str(list1.count("WA")))
print("TLE x "+str(list1.count("TLE")))
print("RE x "+str(list1.count("RE")))

Measured memory_bytes: 16172
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N; cin >> N;
    VI A(N);
    REP(i,N)
    {
        cin >> A[i];
    }

    sort(A.begin(), A.end());
    int tmpmin = A[0];
    int reg = tmpmin;
    int inreg = 0;
    int count = 0;
    int tmpreg = 0;
    while(1)
    {
        if(count == N-1) break;
        dump(tmpmin)
        dump(inreg)

    REP(i,N)
    {
        int change = 0;
        dump(i)
        dump(inreg)
        if(i == inreg)
        {
            dump("inreg")
            dump(i)
            continue;
        }
        if(A[i] != 0) change = 1;
        A[i] = A[i] % tmpmin;

        if(A[i] < tmpmin && 1 <= A[i]) 
        {
            reg = A[i];
            tmpreg = i;
        }
        if(A[i] == 0 && change == 1) count++;
    }
    tmpmin = reg;
    inreg = tmpreg;


    }
    cout << tmpmin << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,n,t;
    string s;
    cin>>s;
    if(s=="Sunny"){
        cout<<"Cloudy"<<endl;
    }
    else if (s=="Cloudy"){
        cout<<"Rainy"<<endl;
    }
    else if(s=="Rainy"){
        cout<<"Sunny"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
fun main(args : Array<String>) {
    val (n, x) = readLine()!!.split(" ").map { it.toInt() }
    val aa = readLine()!!.split(" ").map { it.toInt() }.sorted()

    var cnt = 0
    var given = 0
    var lastIndex = 0

    for(i in aa.indices) {
        if (given + aa[i] <= x) {
            given += aa[i]
            lastIndex = i
            cnt++
        } else {
            break
        }
    }

    if (cnt == 0) {
        println(0)
        return
    }

    if (given == x || lastIndex < n-1) {
        println(cnt)
    } else {
        println(cnt-1)
    }
}

Measured memory_bytes: 37868
/*
 * Author: Anmol Choudhary
 */
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
// using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
const ll mod = 1000000007;
const ll maxn = 500005;
const ll mm = 1e+18;
void solve()
{
    int n;
    cin>>n;
    int an=0;
    rep1(i,n){
        if(i%3&&i%5) an+=i;
    }
    pr(an);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3648
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, D = LI()
    X = [LI() for _ in range(N)]

    MAX_DIST = 16000
    square_num = set()
    i = 1
    while i ** 2 <= MAX_DIST:
        square_num.add(i ** 2)
        i += 1

    ans = 0
    for i, j in itertools.combinations(range(N), 2):
        if sum([(k - l) ** 2 for k, l in zip(X[i], X[j])]) in square_num:
            ans += 1

    print(ans)

if __name__ == '__main__':
    resolve()


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

int main(void){

    unsigned long long h;
    cin >> h;

    unsigned long long count = 1;
    unsigned long long index = 1;
    while(h != 1) {
        h /= 2;
        if(count == 1) count = 3;
        else count += (unsigned long long) pow(2, index);
        index++;
    }
    
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
import sys

def main():
    s = input()
    sl = list(s)
    sl_o = [c == 'h' for c in s[::2]]
    sl_e = [c == 'i' for c in s[1::2]]
    if all(sl_o) and all(sl_e) and s[-1] == ('i'):
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

const ll INF = (1LL << 58);
const bool DEBUG = 0;

int N;
std::vector<int> v;

map<int, int> freq;

int main()
{
	int i, j;

	si(N);

	fl(i,0,N)
	{
		int temp;
		si(temp);
		v.PB(temp);
		freq[temp]++;
	}

	map<int, int>::iterator itr;
	int extra = 0;
	for(itr = freq.begin(); itr != freq.end(); itr++)
	{
		if(itr -> second > 1)
		{
			extra += (itr -> second - 1);
		}
	}

	int distincts = freq.size();
	int ans;
	if(extra % 2 == 0)
	{
		ans = distincts;
	}
	else
	{
		ans = distincts - 1;
	}

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


	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 5368
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<utility>
#include<vector>
using namespace std;
//--------------------

int main() {

	long res = INT_MAX;

	long L, R; cin >> L >> R;

	long limit; limit = min(L + 6000, R);

	long mymod[100000] = {};

	for (int i = 0; i <= limit - L; i++) mymod[i] = (L + i) % 2019;

	for (int i = 0; i <= limit - L; i++) for (int j = i + 1; j <= limit - L; j++) {
		res = min(res, (mymod[i] * mymod[j]) % 2019);
	}

	cout << res << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;
    for (ll i = 0; i < s.size(); i++)
    {
        if (i % 2 == 0)
        {
            if (s[i] != 'R' && s[i] != 'U' && s[i] != 'D'){
                cout << "No" << endl;
                exit(0);
            }
        }
        else{
            if (s[i] != 'L' && s[i] != 'U' && s[i] != 'D')
            {
                cout << "No" << endl;
                exit(0);
            }
        }
    }

    cout << "Yes" << endl;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;
Node treeSearch(Node u, int k){
  while(u!=NIL &&  k!=u->key){
    if(k < u->key){u=u->left;
    }
    else u = u->right;
  }
  return u;
}
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x != NIL){
    y = x;
    if(z->key < x->key){
      x = x->left;
    }
    else{x=x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
    root=z;
  }
  else{if(z->key < y->key){
      y->left = z;
    }else {y->right = z;
    }
  }
}

void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }

  return 0;
}




Measured memory_bytes: 20540
fn main() {
    use std::io::Read;
    let mut stdin = String::new();
    std::io::stdin().read_to_string(&mut stdin).unwrap();
    let mut iter = stdin
        .split_whitespace()
        .map(|w| w.parse::<usize>().unwrap());
    let n = iter.next().unwrap();
    let mut neighbors = vec![Vec::new(); n + 1];
    for _ in 0..n - 1 {
        let a = iter.next().unwrap();
        let b = iter.next().unwrap();
        neighbors[a].push(b);
        neighbors[b].push(a);
    }
    let mut parents = vec![0; n + 1];
    let mut depth = vec![0; n + 1];
    fn visit(
        i: usize,
        p: usize,
        d: usize,
        parents: &mut Vec<usize>,
        depth: &mut Vec<usize>,
        neighbors: &Vec<Vec<usize>>,
    ) {
        parents[i] = p;
        depth[i] = d;
        for &j in &neighbors[i] {
            if j != p {
                visit(j, i, d + 1, parents, depth, neighbors);
            }
        }
    }
    visit(1, 0, 0, &mut parents, &mut depth, &neighbors);
    let m = iter.next().unwrap();
    let paths: Vec<u64> = (0..m)
        .map(|_| {
            let mut u = iter.next().unwrap();
            let mut v = iter.next().unwrap();
            let mut path = 0;
            while depth[u] > depth[v] {
                path |= 1 << u;
                u = parents[u];
            }
            while depth[v] > depth[u] {
                path |= 1 << v;
                v = parents[v];
            }
            while u != v {
                path |= 1 << u;
                u = parents[u];
                path |= 1 << v;
                v = parents[v];
            }
            path
        })
        .collect();
    let mut res: i64 = 0;
    fn dfs(paths: &[u64], edges: u64, count: u64, res: &mut i64) {
        if paths.is_empty() {
            if count & 1 == 0 {
                *res += 1 << edges.count_ones();
            } else {
                *res -= 1 << edges.count_ones();
            }
        } else {
            dfs(&paths[1..], edges, count, res);
            dfs(&paths[1..], edges & !paths[0], count + 1, res);
        }
    }
    dfs(&paths, (1 << (n + 1)) - 4, 0, &mut res);
    println!("{}", res);
}

Measured memory_bytes: 4352
// template {{{
#include <bits/stdc++.h>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define sz(c) (static_cast<int>(c.size()))
#define endl "\n"

using ld = long double;
using ll = long long;

inline ll addm(ll __a, ll __b, ll __m);
inline ll subm(ll __a, ll __b, ll __m);
inline ll mulm(ll __a, ll __b, ll __m);
ll powm(ll __a, ll __b, ll __m);
ll inv(ll __x, ll __m);
// }}}

const ll INFL = numeric_limits<ll>::max() / 2;
const ll INF = numeric_limits<int>::max() / 2;
const ll MOD = 1e9+7;

const int N = 100500;
vector<int> g[N];
int d[N];
void dfs(int v)
{
    int mx = 0;
    for (int u: g[v]) {
        if (d[u] == -1) dfs(u);
        mx = max(mx, d[u]);
    }
    d[v] = mx+1;
    /* cout << v << " " << d[v] << endl; */
}
void solve()
{
    int n, m; cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int x, y; cin >> x >> y;
        --x; --y;
        g[x].push_back(y);
    }
    fill(d, d+n, -1);
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (d[i] == -1) dfs(i);
        ans = max(d[i], ans);
    }
    cout << ans-1 << endl;
}

// main {{{
int main()
{
    cin.sync_with_stdio(0); cin.tie(NULL);
    solve();
    return 0;
}

inline ll addm(ll __a, ll __b, ll __m = MOD) {
    return ((__a+__b)%__m);
}
inline ll subm(ll __a, ll __b, ll __m = MOD) {
    return (((__a-__b)%__m+__m)%__m);
}
inline ll mulm(ll __a, ll __b, ll __m = MOD) {
    return ((__a*__b)%__m);
}
ll powm(ll __a, ll __b, ll __m = MOD) {
    ll ret = (!__b) ? 1 : powm(__a, __b/2, __m);
    return (!__b) ? 1 : mulm(mulm(ret, ret, __m), (__b%2) ? __a : 1, __m);
}
ll inv(ll __x, ll __m = MOD) {
    return powm(__x, __m-2, __m);
}
// }}}


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

#define MAX_N 402

int n;
int a[MAX_N];

long long dp[MAX_N][MAX_N];
long long solve(int l ,int r){
    if(l == r)
        return 0;
    auto&ret = dp[l][r];
    if(~ret)
        return ret;

    long long sub = a[r]; ret = 9e18;
    for(int i=l; i<r; i++)
        ret = min(ret ,solve(l ,i)+solve(i+1 ,r)) ,sub += a[i];
    return ret += sub;
}

int main()
{
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",&a[i]);
    memset(dp ,-1 ,sizeof dp);
    printf("%lld\n",solve(0 ,n-1));
}


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


int main() {
	int n = 0;
	cin >> n;
	set<string> s;
	for (int i = 0; i < n; i++) {
		char str[100] = "";
		cin >> str;
		s.insert(str);
	}
	cout << s.size() << endl;
	return 0;
}

Measured memory_bytes: 19264
# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys
MOD = 10**9 + 7
def main(N, M):
    if N > M:
        return 0
    fu = FactorialUtils(M)
    a = fu.permutation(M, N)
    t = Mint(a)
    for i in range(1, N + 1):
        t += (-1) ** (i & 1) * fu.choose(N, i) * fu.permutation(M - i, N - i)
    return t * a

class FactorialUtils:
    def __init__(self, n):
        self.fac = [1] * (n + 1)
        self.ifac = [1] * (n + 1)
        for i in range(2, n + 1): self.fac[i] = self.fac[i - 1] * i % MOD
        self.ifac[n] = pow(self.fac[n], MOD - 2, MOD)
        for i in range(n, 1, -1): self.ifac[i - 1] = self.ifac[i] * i % MOD

    def choose(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.ifac[n - r] % MOD) * self.ifac[r] % MOD

    def multichoose(self, u, k):
        return (self.fac[u + k - 1] * self.ifac[u - 1] % MOD) * self.ifac[k] % MOD

    def permutation(self, n, r):
        if r < 0 or r > n: return 0
        return self.fac[n] * self.ifac[n - r] % MOD

class Mint:
    def __init__(self, value=0):
        self.value = value % MOD
        if self.value < 0: self.value += MOD

    @staticmethod
    def get_value(x): return x.value if isinstance(x, Mint) else x

    def inverse(self):
        a, b = self.value, MOD
        u, v = 1, 0
        while b:
            t = a // b
            b, a = a - t * b, b
            v, u = u - t * v, v
        if u < 0: u += MOD
        return u

    def __repr__(self): return str(self.value)
    def __eq__(self, other): return self.value == other.value
    def __neg__(self): return Mint(-self.value)
    def __hash__(self): return hash(self.value)
    def __bool__(self): return self.value != 0

    def __iadd__(self, other):
        self.value = (self.value + Mint.get_value(other)) % MOD
        return self

    def __add__(self, other):
        new_obj = Mint(self.value)
        new_obj += other
        return new_obj
    __radd__ = __add__

    def __isub__(self, other):
        self.value = (self.value - Mint.get_value(other)) % MOD
        if self.value < 0: self.value += MOD
        return self

    def __sub__(self, other):
        new_obj = Mint(self.value)
        new_obj -= other
        return new_obj

    def __rsub__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj -= self
        return new_obj

    def __imul__(self, other):
        self.value = self.value * Mint.get_value(other) % MOD
        return self

    def __mul__(self, other):
        new_obj = Mint(self.value)
        new_obj *= other
        return new_obj
    __rmul__ = __mul__

    def __ifloordiv__(self, other):
        other = other if isinstance(other, Mint) else Mint(other)
        self *= other.inverse()
        return self

    def __floordiv__(self, other):
        new_obj = Mint(self.value)
        new_obj //= other
        return new_obj

    def __rfloordiv__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj //= self
        return new_obj

if __name__ == '__main__':
    input = sys.stdin.readline
    N, M = map(int, input().split())
    print(main(N, M))


Measured memory_bytes: 81280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = ll;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

const int MAX = 200000;
ll fac[MAX], finv[MAX], inv[MAX];
bool Pre = true;
void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    FOR(i, 2, MAX) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
ll com(int n, int k) {
    if (Pre) {
        cominit();
        Pre = false;
    }
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

int main() {
    init();

    ll n, m, k; cin >> n >> m >> k;

    ll ans = 0;
    FOR(i, 0, n) {
        (ans += (i * (i + 1) / 2) % mod
            * (m * m) % mod
            * com(n * m - 2, k - 2) % mod)
            %= mod;
    }
    FOR(i, 0, m) {
        (ans += (i * (i + 1) / 2) % mod
            * (n * n) % mod
            * com(n * m - 2, k - 2) % mod)
            %= mod;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4992
import sys
sys.setrecursionlimit(1000000)

def input():
    return sys.stdin.readline()

N, Q = map(int, input().split())

edge = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    edge[a].append(b)
    edge[b].append(a)

counter = [0] * (N + 1)
for _ in range(Q):
    p, x = map(int, input().split())
    counter[p] += x

# print(edge)
# print(counter)

visited = [False] * (N + 1)
visited[1] = True
ans = [0] * (N + 1)

def dfs(fro, p):
    visited[fro] = True
    now = counter[fro] + p
    for to in edge[fro]:
        if not visited[to]:
            dfs(to, now)
    ans[fro] = now
    return

dfs(1, 0)

print(*ans[1:])


Measured memory_bytes: 238464
#include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define nl '\n'
#define precision(n) setprecision(n)
typedef long double ld;
typedef long long ll;

const int size = 100;
char grid[size][size];

int main() { _
    int a, b; cin >> a >> b;
    a--; b--;
    for (int i = 0; i < size / 2; i++) {
        for (int j = 0; j < size; j++) {
            if ((i % 2 == 1 && j % 2 == 1)
                && b) {
                grid[i][j] = '#';
                b--;
            } else {
                grid[i][j] = '.';
            }
        }
    }
    
    for (int i = size / 2; i < size; i++) {
        for (int j = 0; j < size; j++) {
            if ((i % 2 == 1 && j % 2 == 1)
                && a) {
                grid[i][j] = '.';
                a--;
            } else {
                grid[i][j] = '#';
            }
        }
    }
    
    cout << size << " " << size << nl;
    forn(i, 0, size){
        forn(j, 0, size){
            cout << grid[i][j];
        }
        cout << nl;
    }
    return 0;
}


Measured memory_bytes: 256
import numpy as np
N = int(input())
S = input()

F = np.zeros(N, dtype=int)

F[0] = S[1:].count('E')

for i in range(1, len(S)):
    F[i] = F[i-1]
    if S[i-1] == 'W':
        F[i] += 1

    if S[i] == 'E':
        F[i] -= 1

minv = np.amin(F)
print(minv)


Measured memory_bytes: 21652
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e5;  
using  p = pair<int,int>;

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

   auto ans = 0;
   int i = 0;
   while (i<b-1)
   {
      i+=a-1;
      ans++;
   }

   cout << ans;
   
}
  
  

Measured memory_bytes: 256
# 要復習
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    N = INT()
    A = LIST()
    print(max(A) - min(A))

if __name__ == "__main__":
    main()




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




int main(){
    ll n,m;cin>>n>>m;
    ll sum=0;
    rep(i,0,m){
        ll a;cin>>a;
        sum+=a;
    }
    if(sum<=n)cout<<n-sum<<endl;
    else cout<<-1<<endl;
}
    









Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
 
/* vector<int> A(N); 
    vector<pair<int, int> > tasks; ＃ソートした場合、１つ目でソート
　tie(b, a) = p.at(i); #pairを分割
    tasks.emplace_back(b, a)  ＃配列tasksの最後に(b,a)を追加
　xの二乗:  pow(x, 2.0) 
    小さい順: sort(v.begin(), v.end());
    大きい順: reverse(v.begin(), v.end());
    int: -2,147,483,648 ～ 2,147,483,647
    ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
    // int型の2次元配列(3×4要素の)の宣言
    vector<vector<int>> data(3, vector<int>(4));
*/
 
int main() {
  
  ll A, B, C, count=0, ans=0;
  string D, E;
  cin >> A;
  rep(i,A){
  	if(((i+1)%3!=0) && ((i+1)%5!=0)) count+= (i+1);
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3628
while data = gets.chomp.split.map(&:to_i)
  break if data.all?(&:zero?)
  b, r, g, c, s, t, = data
  puts (15*(b+r) + 13*(5*b+3*r) + 7*g + 2*c - 3*(t-(s+5*b+3*r)) + 100)
end

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

public class Main
{
	static Scanner scan = new Scanner(System.in);
	public static void solve() throws Exception
	{
		//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//StringTokenizer tk = new StringTokenizer(in.readLine());
		int n = scan.nextInt();
		int k = scan.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++)
		{
			nums[i]=scan.nextInt();
		}
		Arrays.sort(nums);
		long ans =0;
		for(int i=0;i<(int)Math.min(n,k);i++)
		{
			ans+=nums[i];
		}
		System.out.println(ans);
	}
	public static void main(String[] args) throws Exception
	{
		if(scan.hasNext())
		{
			//int t= scan.nextInt();
			int t= 1;
			while(t-->0)
			{	
				solve();
			}
		}
	}
}

Measured memory_bytes: 38980
n = int(input())
a = list(map(int, input().split()))
a = [0] + a
 
c = [0] * (n+1)
 
for i in range(n, 0, -1):
    c[i] = a[i]
    tmp = i * 2
    while tmp <= n:
        c[i] -= c[tmp]
        tmp += i
    c[i] = c[i] % 2
    
print(sum(c))
for i in range(1, n+1):
    if c[i] == 1:
        print(i)

Measured memory_bytes: 7220
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
map<ll,bool>mp;
void solve(){
	ll n;
	cin>>n;
	vector<ll>q;
	vector<ll>res;
	rep(i,9){q.push_back(i+1);res.pb(i+1);}
	int s=0;
	while(res.size()<=300000){
		ll a=q[s];
		ll dig=a%10ll;
		if(dig-1>=0){
			ll a1=a*10ll+dig-1;
			if(mp[a1]==0){
				q.pb(a1);
				res.pb(a1);
				mp[a1]=1;
			}
		}
		if(dig+1<=9){
			ll a1=a*10ll+dig+1;
			if(mp[a1]==0){
				q.pb(a1);
				res.pb(a1);
				mp[a1]=1;
			}
		}
		ll a1=a*10ll+dig;
		if(mp[a1]==0){
			q.pb(a1);
			res.pb(a1);
			mp[a1]=1;
		}
		s++;
	}
	sort(res.begin(), res.end());
	cout<<res[n-1];
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 27096