akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void) {
	int i;
	int n;
	int max;
	int min;
	long int sum = 0;
	int a[10000];
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	max = min = a[0];
	for(i = 0; i < n; i++) {
		if(a[i] > max) {
			max = a[i];
		} else if(a[i] < min) {
			min = a[i];
		}
		sum += a[i];
	}
	printf("%d %d %ld\n", min, max, sum);
	return 0;
}
	

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
ll modpow(ll x,ll y,ll mod){
    ll res=1;
    for(ll i=0;i<y;i++){
        res=res*x%mod;
    }
    return res;
}*/
long long modpow( long long a,  long long n,  long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res%mod * a % mod;
        a = a%mod * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
    ll N;
    cin>>N;
    ll ans=(modpow(10,N,1000000007)-2*modpow(9,N,1000000007)%1000000007+modpow(8,N,1000000007))%1000000007;
    ans%=1000000007;
    ans=(ans+1000000007)%1000000007;
    cout<<ans<<"\n";
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cstring>

using namespace std;
int ch[26];
int main(){
	while (true){
		string str = "";
		getline(cin, str); if (str == "") break;
		for (int i = 0; i < str.size(); ++i){
			char tmp; tmp = str[i];
			if (isupper(tmp)) tmp = tolower(tmp);
			if (0 <= tmp - 'a' && tmp - 'z' <= 0) ++ch[tmp - 'a'];
		}
	}
	for (int i = 0; i < 26; ++i){
		char tmp; tmp = 'a' + i;
		cout << tmp << " : " << ch[i] << '\n';
	}
}

Measured memory_bytes: 1188
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		String josushi = "hon";
		
		N %= 10;
		
		if(N == 0 || N == 1 || N == 6 || N == 8) {
			josushi = "pon";
		}else if(N == 3) {
			josushi = "bon";
		}
		
		System.out.println(josushi);
		
	}

}


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

const int INF = 1e9;
const int MOD = 1e9 + 7;

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

	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int r = 0;
	r += min(a, k);
	k = max(0, k - a);
	k = max(0, k - b);
	r -= min(c, k);
	cout << r << endl;

  return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(int argc,char* argv[]){
  int a,b,r;
  int hishi = 0,tyou = 0;
  
  while(scanf("%d,%d,%d",&a,&b,&r) != EOF){
    if(a == b){
      ++hishi;
    }else if(a*a + b*b == r*r){
      ++tyou;
    }
  }

  printf("%d\n%d\n",tyou,hishi);
  
  return 0;
  
}

Measured memory_bytes: 0
#[test]
fn check_solve() {
    println!("input:\n6\noutput:\n{}\n", solve("6\n"));
    println!("input:\n2\noutput:\n{}\n", solve("2\n"));
    println!("input:\n7\noutput:\n{}\n", solve("7\n"));
    println!("input:\n14\noutput:\n{}\n", solve("14\n"));
    println!("input:\n11\noutput:\n{}\n", solve("11\n"));
}

fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let n: usize = sc.read();
    let mut brd = vec![vec!['.'; n]; n];

    if n == 2 {
        return "-1\n".to_string();
    } else if n % 3 == 0 {
        for i in 0..n/3 {
            brd[3*i][3*i] = 'a';
            brd[3*i][3*i+1] = 'a';
            brd[3*i+1][3*i+2] = 'a';
            brd[3*i+2][3*i+2] = 'a';
        }
    } else if n == 7 {
        return "aabbcc.\ndde...f\ng.e...f\nghh...i\n...jjki\n...n.kl\n...nmml".to_string()
    } else if n == 11 {
        return "aa.aa.b....\n..a..ab....\n..a..ac....\naa.aa.c....\n..a..ab....\n..a..ab....\nbbccbb.....\n.......aabc\n.......ddbc\n.......bcaa\n.......bcdd\n".to_string()
    } else {
        let mut i = 0;
        while (n-i) % 4 != 0 {
            brd[i][i] = 'a';
            brd[i][i+1] = 'a';
            brd[i][i+2] = 'b';
            brd[i][i+3] = 'b';
            brd[i][i+4] = 'a';
            brd[i+1][i+4] = 'a';
            brd[i+2][i+4] = 'b';
            brd[i+3][i+4] = 'b';
            brd[i+4][i+4] = 'a';
            brd[i+4][i+3] = 'a';
            brd[i+4][i+2] = 'b';
            brd[i+4][i+1] = 'b';
            brd[i+4][i] = 'a';
            brd[i+3][i] = 'a';
            brd[i+2][i] = 'b';
            brd[i+1][i] = 'b';
            brd[i+1][i+1] = 'c';
            brd[i+1][i+2] = 'c';
            brd[i+2][i+3] = 'c';
            brd[i+3][i+3] = 'c';
            i += 5;
        }
        while n > i {
            brd[i][i] = 'a';
            brd[i][i+1] = 'a';
            brd[i+1][i] = 'b';
            brd[i+1][i+1] = 'b';
            brd[i+2][i] = 'c';
            brd[i+3][i] = 'c';
            brd[i+2][i+1] = 'd';
            brd[i+3][i+1] = 'd';
            brd[i][i+2] = 'e';
            brd[i+1][i+2] = 'e';
            brd[i][i+3] = 'f';
            brd[i+1][i+3] = 'f';
            brd[i+2][i+2] = 'g';
            brd[i+2][i+3] = 'g';
            brd[i+3][i+2] = 'h';
            brd[i+3][i+3] = 'h';
            i += 4;
        }
    }


    let mut ret = String::new();
    use std::fmt::Write;
    
    for v in brd {
        writeln!(&mut ret, "{}", v.into_iter().collect::<String>()).unwrap();
    }
    
    ret
}

fn main() {
    let mut buf = String::new();
    use std::io;
    use std::io::{Read, Write};
    io::stdin().read_to_string(&mut buf).unwrap();
    io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}

struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.get().chars().collect()
    }
}

Measured memory_bytes: 8444
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <stack>
#include <set>

#define rep(i,n) for(int i = 0;i< (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;

//priority_queue<int, vector<int>, greater<int>> min_heap;
//long long ccw(const Point& A, const Point& B, const Point& C) {
//   return 1LL * (B.x - A.x)*(C.y - A.y) - 1LL * (B.y - A.y)*(C.x - A.x);
//}

int main() { // E 
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n;
	cin >> n;
	if (n & 1) {
		double t = (n / 2 + 1) / (double)n;
		printf("%.8f", t);
	}
	else {
		double t = (n / 2) / (double)n;
		printf("%.8f", t);

	}






}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 200005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
#define ld long double
typedef long long int ll;
using  namespace std;
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	string s;
	cin>>s;
	int m=0;
	for(int i=0;i<s.length();i++){
		m=(m*10+s[i]-'0')%9;
	}
	if(m)
	cout<<"No";
	else
	cout<<"Yes";
}


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

int main(){
    int a,b;
    cin>>a>>b;
    if(b!=1){
        int ans = a;
        int count = 1;
        while(b>ans){
            ans = ans - 1;
            ans = ans + a;
            count++;
        }
        cout<<count;
    }
    else{
        cout<<0;
    }
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>

using namespace std;

int A[100200];
int N;
int j;
int kotae;
int now;
int k;
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	sort(A,A+N);
	while(now<N){
		j=A[now];
		while(j==A[now] && now<N){
			now++;
		}
		if((now-k)%2==1){
			kotae ++;
		}
		k=now;
	}
	cout << kotae << endl;
	return 0;

}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
#include <memory>
#include <stack>
#include <set>
#include <map>

#define INF 1000000000
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

// 最大公約数 greate common diviser
template<typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}

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

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

  int ans = INF;
  for(int i=0; i<N-1; i++) {
    ans = min(ans, gcd<int>(A[i], A[i+1]));
  }

  cout << ans << endl;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main(){
	ll N;
	cin >> N;
	vll A;
	int i, j, k;
	for (i = 0; i < N; i++){
		ll a;
		cin >> a;
		A.push_back(a);
	}
	sort(A.begin(), A.end());
	ll init = 0;
	ll sumA = std::accumulate(A.begin(), A.end(), init);
	ll ans = 0;
	for (i = N-1; i >= 0; i--){
		if (i == N - 1){
			ans++;
			continue;
		}
		sumA -= A[i + 1];
		if (A[i + 1] <= sumA * 2){
			ans++;
		}
		else{
			break;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 1400
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

ll N, P;
const int MAX_N = 50;
ll A[MAX_N];

int main(){
  cin >> N >> P;
  REP(i, N) cin >> A[i];

  int odd_n = 0, even_n = 0;
  REP(i, N) {
    if(A[i] % 2 == 0) {
      even_n++;
    } else {
      odd_n++;
    }
  }

  if(odd_n == 0) {
    if(P == 1) cout << 0;
    else cout << ll(pow(2, N)) << endl;
  } else {
    cout << ll(pow(2, even_n) * pow(2, odd_n - 1)) << endl;
  }



  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

string n;
vector<ll> s;
ll k;
vector<vector<vector<ll>>> table;
#define DP table[i][last][cnt]
ll dfs(ll i, ll last, ll cnt) {
  if (DP != -1) return DP;
  if (i == n.size()) {
    return DP = (n.size() - cnt) == k;
  }

  ll ans = 0;
  if (last) {
    ans += dfs(i + 1, true, cnt + (s[i] == 0));
    REP(j, s[i]) {
      ans += dfs(i + 1, false, cnt + (j == 0));
    }
  } else {
    REP(j, 10) {
      ans += dfs(i + 1, false, cnt + (j == 0));
    }
  }

  return DP = ans;
}

int main() {
  cin >> n >> k;
  REP(i, n.size()) s.push_back(n[i] - '0');
  table = vector<vector<vector<ll>>>(n.size() + 1,
      vector<vector<ll>>(2,
        vector<ll>(n.size() + 1, -1))
      );

  cout << dfs(0, true, 0);
}


Measured memory_bytes: 3788
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=3e5+10,oo=0x3f3f3f3f,MOD=998244353;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    string s;
    int n;
    cin>>s>>n;
    set<string>st;
    loop(sz(s),i,0){
        string temp;
        loop(min(sz(s)-i,1ll*n),j,0){
            temp+=s[i+j];
            st.insert(temp);
        }
    }
    vector<string>v(allv(st));
    sort(allv(v));
    cout<<v[n-1]<<endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


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

int main() {
    std::string S;
    std::cin >> S;
    
    int i = 0, j = S.size() -1;
    int cnt = 0;
    while (i < j) {
        if (S[i] != S[j]) {
            ++cnt;
        }

        ++i;
        --j;
    }

    std::cout << cnt << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define MOD 1000000007
#define INIT -1

int main() {
	int n;
	cin >> n;
	vector<pair<long long int, long long int> > v;
	for (int i = 0; i < n; i++) {
		long long int a, b;
		cin >> a >> b;
		v.push_back(make_pair(a + b, a));
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	long long int t = 0, a = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0)
			t += v[i].second;
		else
			a += v[i].first - v[i].second;
	}
	cout << t - a << endl;
}

Measured memory_bytes: 2420
use std::io;

fn main() {
    let s1=get_String();
    let s2=get_String();
    if s1==s2.as_str().chars().rev().collect::<String>() {
        println!("YES");
    }else {
        println!("NO");
    }
}

fn get_String()->String{
    let mut input =String::new();
    io::stdin().read_line(&mut input).expect("Fail!");        
    input.trim().to_string()
}

fn get_int()->i32{
    let mut input =String::new();
    io::stdin().read_line(&mut input).expect("Fail!");        
    input.trim().to_string().parse().unwrap()
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define mod 1000000007

using namespace std;

int main(){
  int64_t i,N;
  cin >> N;
  int64_t fi, bu, fibu;
  fi = N/3;
  bu = N/5;
  fibu = N/15;
  int64_t sum;
  sum = (N*(N+1) - fi*(fi+1)*3 - bu*(bu+1)*5 + fibu*(fibu+1)*15)/2;
  cout << sum;
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ri rd<int>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; --i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++i)

template<class T> T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - '0'; return f ? x : -x;
}

int main() {
	int a = ri(), b = ri();
	if (a % b == 0) puts("-1");
	else printf("%d\n", a);
	return 0;
}


Measured memory_bytes: 256
import numpy as np
n,m = map(int,input().split())
a = np.array([list(input()) for i in range(n)])
b = np.array([list(input()) for i in range(m)])
ans = 'No'
for i in range(n-m+1):
    for j in range(n-m+1):
        if (a[j:j+m,i:i+m] == b).all():
            ans = 'Yes'
            break
print(ans)

Measured memory_bytes: 12440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long mod = 1e9 + 7;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	string s;
	cin >> s;
	
	int ans = 0;

	for (int i = 0; i < s.length()/2; i++) {
		if (s[i] != s[s.length() - i - 1]) {
			ans++;
		}
	}

	cout << ans << endl;	
}


Measured memory_bytes: 764
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()

using namespace std;

int N, M;
int a[1005];
int b[1005];
int c[1005];

int dp[0b111111111111 + 1];

signed main()
{
	cin >> N >> M;
	REP(i, M)
	{
		cin >> a[i] >> b[i];
		c[i] = 0;
		REP(j, b[i])
		{
			int cc;
			cin >> cc;
			c[i] |= (1 << (cc - 1));
		}
	}

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

	dp[0] = 0;

	for (int i = 0; i < M; i++)
	{
		for (int j = 0; j <= 0b111111111111; j++)
		{
			if (dp[j] >= 0)
			{
				int bit = (j | c[i]);
				int aa = a[i] + dp[j];
				if (dp[bit] == -1 || aa < dp[bit])
				{
					dp[bit] = aa;
				}
			}
		}
	}

	int ans_bit = ((1 << N) - 1);
	cout << dp[ans_bit] << endl;
}



Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    string a,b;
    cin>>a>>b;
    if(a.size()>b.size())cout<<"GREATER"<<endl;
    else if(a.size()<b.size())cout<<"LESS"<<endl;
    else {
        for(int i=0;i<a.size();i++){
            if(a[i]>b[i]){
                cout<<"GREATER"<<endl;
                return 0;
            }
            else if(a[i]<b[i]){
                cout<<"LESS"<<endl;
                return 0;
            }
            else continue;
        }
        cout<<"EQUAL"<<endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i < n; i++) cin >> v[i];
    int pref[n+1];
    pref[0] = 0;
    for (int i=0; i < n; i++) pref[i+1] = pref[i] + v[i];
    int ans = 1e9;
    for (int i=2; i <= n-2; i++){
        int L = 1, R = i;
        while (R - L > 1){
            int M = (L+R)/2;
            int p1 = pref[M];
            int p2 = pref[i] - pref[M];
            if (p1 <= p2) L = M;
            else R = M;
        }
        int ll = 1, rr = n-i;
        while (rr - ll > 1){
            int mm = (ll+rr)/2;
            int p1 = pref[mm+i] - pref[i];
            int p2 = pref[n] - pref[mm+i];
            if (p1 <= p2) ll = mm;
            else rr = mm;
        }
        int A = 0, B = L, C = i, D = ll+i, E = n;
        int v1 = pref[B] - pref[A], v2 = pref[C] - pref[B], v3 = pref[D] - pref[C], v4 = pref[E] - pref[D];
        ans = min(ans, max(v1, max(v2, max(v3, v4))) - min(v1, min(v2, min(v3, v4))));
        if (B+1 != C){
            B++;
            v1 = pref[B] - pref[A], v2 = pref[C] - pref[B], v3 = pref[D] - pref[C], v4 = pref[E] - pref[D];
            ans = min(ans, max(v1, max(v2, max(v3, v4))) - min(v1, min(v2, min(v3, v4))));
            B--;
        }
        if (D+1 != E){
            D++;
            v1 = pref[B] - pref[A], v2 = pref[C] - pref[B], v3 = pref[D] - pref[C], v4 = pref[E] - pref[D];
            ans = min(ans, max(v1, max(v2, max(v3, v4))) - min(v1, min(v2, min(v3, v4))));
            D--;
        }
        if (B+1 != C && D+1 != E){
            B++;
            D++;
            v1 = pref[B] - pref[A], v2 = pref[C] - pref[B], v3 = pref[D] - pref[C], v4 = pref[E] - pref[D];
            ans = min(ans, max(v1, max(v2, max(v3, v4))) - min(v1, min(v2, min(v3, v4))));
        }
    }
    cout << ans;
    return 0;
}



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

typedef long long ll;

int main(){
	ll A,B,N;
	cin >> A >> B >> N;
	ll x = min(B-1,N);
	
	ll ans = A*x / B;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <queue>

#define CHECK_IMPL1(cond)                \
    if (!(cond)) {                       \
      DEBUG("expected cond: " << #cond); \
      assert(cond);                      \
    }

#define CHECK_IMPL2(cond, message)                                              \
    if (!(cond)) {                                                              \
      DEBUG("expected cond: " << #cond << " failed with message: " << message); \
      assert(cond);                                                             \
    }

#define CHECK_IMPL(_1, _2, NAME, ...) NAME
#define CHECK(...) CHECK_IMPL(__VA_ARGS__, CHECK_IMPL2, CHECK_IMPL1, CHECK_IMPL0)(__VA_ARGS__)

#ifdef __APPLE__
#define DEBUG(message) std::cerr << message << std::endl;
#else
#define DEBUG(message)
#endif

void solve() {
  std::string s, t;
  std::cin >> s >> t;

  int ans = t.size();

  for (size_t i = 0; i + t.size() - 1 < s.size(); ++i) {
    int now = 0;
    for (size_t j = 0; j < t.size(); ++j) {
      now += s[i + j] != t[j];
    }
    ans = std::min(ans, now);
  }

  std::cout << ans << std::endl;
}

int main() {
#ifdef __APPLE__
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  //std::cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3168
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;

bool solve(int target, int* val, int size);
int main(){
	int n;
	int q;

	cin >> n;

	int* A = (int*)malloc(n * sizeof(int));
	for(int i = 0; i < n; ++i){
		cin >> A[i];
	}

	cin >> q;
	int m;
	for(int i = 0; i < q; ++i){
		cin >> m;
		if(solve(m, A, n)){
			cout << "yes" << endl;
		}else{
			cout << "no" << endl;
		}
	}

	return 0;
}
bool solve(int target, int* val, int size){
	for(int i = 0; i < size; ++i){
		if(target == val[i]) return true;
		if(target < val[i]) return solve(target, val+1, size - i - 1);
		if(target > val[i]) return solve(target, val+1, size - i - 1) || solve(target - val[i], val+1, size - i - 1);
	}
	return false;
}

Measured memory_bytes: 1180
n, d = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)]
dpow = d*d
count = 0
for i in range(n):
    if dpow >= ( p[i][1] * p[i][1] + p[i][0] * p[i][0] ):
        count += 1

print(count)

Measured memory_bytes: 102440
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	var s = input[0]
  var ans = "ABC";
  if(s == "ABC") ans = "ARC";
  
	//出力
	console.log('%s', ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29632
use std::fmt::Debug;
use std::str::FromStr;

#[allow(dead_code)]
#[allow(deprecated)]
fn read_line_from_stdin() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    buffer.trim_right().to_owned()
}

#[allow(dead_code)]
#[allow(deprecated)]
fn parse_line_to_single<T>() -> T
where
    T: FromStr,
    T::Err: Debug,
{
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    T::from_str(buffer.trim_right()).unwrap()
}

#[allow(dead_code)]
#[allow(deprecated)]
fn parse_line_to_multiple<T>() -> Vec<T>
where
    T: FromStr,
    T::Err: Debug,
{
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).unwrap();
    buffer
        .trim_right()
        .split_whitespace()
        .flat_map(|s| T::from_str(s))
        .collect()
}

#[allow(unused_macros)]
macro_rules! parse_line {
    [$( $x:tt : $t:ty ),+] => {
        //declare variables
        $( let $x: $t; )+
        {
            use std::str::FromStr;
            // read
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            #[allow(deprecated)]
            let mut splits = buf.trim_right().split_whitespace();
            // assign each variable
            $(
                $x = splits.next().and_then(|s| <$t>::from_str(s).ok()).unwrap();
            )+
            // all strs should be used for assignment
            assert!(splits.next().is_none());
        }
    };
}

fn main() {
    let s = read_line_from_stdin();
    let t = read_line_from_stdin();

    if &s[..] == &t[..t.len() - 1] {
        println!("Yes",);
    } else {
        println!("No",);
    }
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }
 
int main(){
    int n;
    cin >> n;
    int a[n];
    int even = 0;
    for (int i = 0; i < n; i++){
        int a = 0;
        cin >> a;
        if (a % 2 == 0){
            even++;
        }
    }
    cout << pow(3, n) - pow(2, even) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,sum=0;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<n-k;i++)sum+=a[i];
    cout << sum<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef long long ll;
const int inf   = 1<<29;
const ll  mod = 998244353;
ll fact[500001],invfact[500001];

ll comb(int n,int k){
  if(k<0||k>n)return 0;
  ll ret=fact[n]*invfact[k]%mod;
  return ret*invfact[n-k]%mod;
  }

ll inv(ll n){
  ll k=mod-2,ret=1;
  while(k>0){
    if(k&1)ret=ret*n %mod;
    n=n*n %mod;
    k/=2;
    }
  return ret;
  }

int main(){
  int m,n;
  cin>>m>>n;
  fact[0]=invfact[0]=1;
  for(ll i=1;i<=n;i++){
    fact[i]=fact[i-1]*i %mod;
    invfact[i]=invfact[i-1]*inv(i) %mod;
    }
  ll ans=0;
  rep(i,n){
    if(n-i<m||n-i<i)break;
    if(n-i==i){
      ans+=comb(n-1,i-1);
      ans+=mod-comb(n-1,m+2*i-n-2);
      ans%=mod;
      }
    else{
      ans+=comb(n,i);
      ans+=mod-comb(n,m+2*i-n-1);
      ans%=mod;
      }
    }
  cout<<ans<<endl;
  return 0;
  }

Measured memory_bytes: 8064
mod = 10**9 + 7
from collections import defaultdict
############ ---- USER DEFINED INPUT FUNCTIONS ---- ############
def inp():
    return(int(input().rstrip()))
def inlt():
    return(list(map(int,input().rstrip().split())))
def insr():
    s = input().rstrip()
    return(s[:len(s) - 1])
def invr():
    return(map(int,input().rstrip().split()))
################################################################
n,m = invr()
left = 0
right = 0
l_a = 0
r_a = n

for i in range(m):
    left += l_a
    right += r_a
    l_a += 1
    r_a -= 1
#print(left,right)
ans = right - left + 1
while m <= n :
    left += l_a
    right += r_a
    l_a += 1
    r_a -= 1
    ans += (right - left + 1)%mod
    ans = ans%mod
    m += 1
print(ans)  
#print(n - s if s <= n else -1)
#print('No')
#print()



Measured memory_bytes: 67924
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<math.h>
#include<string>
#include <iomanip>
#include<deque>

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e8;

using namespace std;


//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用


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

	string s;

	cin >> s;

	vector<int> ans(s.size(), 0);

	int na = 1;

	int rlen = 1;
	int llen = 0;
	int poi;

	for (int i = 1; i < s.size(); i++)
	{
		if (s[i] == 'L')
		{
			llen++;
		}
		if (s[i - 1] == 'R' && s[i] == 'L')
		{
			poi = i;
		}
		if (s[i - 1] == 'L' && s[i] == 'R')
		{
			for (int j = i - (rlen + llen); j < i; j++)
			{
				if (s[j] == 'R')
				{
					if (rlen % 2 == 1)
					{
						ans[poi - 1]++;
					}
					else
					{
						ans[poi]++;
					}
					rlen--;
				}
				else if (s[j] == 'L')
				{
					if (llen % 2 == 0)
					{
						ans[poi - 1]++;
					}
					else
					{
						ans[poi]++;
					}
					llen--;
				}
			}
		}
		if (s[i] == 'L' && s[i + 1] == '\0')
		{
			for (int j = i - rlen - llen + 1; j <= i; j++)
			{
				if (s[j] == 'R')
				{
					if (rlen % 2 == 1)
					{
						ans[poi - 1]++;
					}
					else
					{
						ans[poi]++;
					}
					rlen--;
				}
				else if (s[j] == 'L')
				{
					if (llen % 2 == 0)
					{
						ans[poi - 1]++;
					}
					else
					{
						ans[poi]++;
					}
					llen--;
				}
			}
		}

		if (s[i] == 'R')
		{
			rlen++;
		}
	}

	cout << ans[0];
	for (int i = 1; i < s.size(); i++)
	{
		cout << " " << ans[i];
	}

}

Measured memory_bytes: 1104
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

int N;
int A[101][2];

signed main()
{
	cin >> N;
	REP(i, N) cin >> A[i][0];
	REP(i, N) cin >> A[i][1];

	int max = 0;
	for (int i = 0; i < N; i++)
	{
		int cnt = 0;
		for (int j = 0; j < N; j++)
		{
			if (j < i)
			{
				cnt += A[j][0];
			}
			else if (j == i)
			{
				cnt += A[j][0];
				cnt += A[j][1];
			}
			else
			{
				cnt += A[j][1];
			}
		}
		max = MAX(max, cnt);
	}
	cout << max << endl;
}






Measured memory_bytes: 888
#include<stdio.h>

int main() {
	int time;
	int sum = 0;
	int m, s;
	for (int i = 0; i < 4; i++) {
		scanf("%d", &time);
		sum += time;
	}
	m = sum / 60;
	s = sum % 60;
	printf("%d\n%d\n", m, s);

	return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
int n,c[30],v[30],ans;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>v[i];
    for(int i=1;i<=n;i++)cin>>c[i];
    for(int i=1;i<=n;i++){
        if(v[i]-c[i]>0){ans+=v[i]-c[i];}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
s = raw_input();
n = len(s);

p1 = "";
p2 = "";

ap1 = 0;
ap2 = 0;

for i in range(n):
	if (i % 2 == 0):
		p1 += "0";
		p2 += "1";
	else:
		p1 += "1";
		p2 += "0";

for i in range(n):
	if s[i] != p1[i]:
		ap1 += 1;

	if s[i] != p2[i]:
		ap2 += 1;

if ap1 < ap2:
	print(ap1);

else:
	print(ap2);


Measured memory_bytes: 6132
import java.util.Scanner;

public class Main {

	static long mod = 1000000000 + 7;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long[][] dp = new long[s.length()][13];
		for(int i = 0; i < s.length(); i++) {
			if(i == 0) {
				if(s.charAt(0) == '?') {
					for(int j = 0; j < 10; j++) {
						dp[0][j] = 1;
					}
				} else {
					dp[0][Integer.valueOf(s.substring(0, 1))] = 1;
				}
			} else {
				if(s.charAt(i) == '?') {
					for(int j = 0; j < 13; j++) {
						for(int k = 0; k < 10; k++) {
							dp[i][(j * 10 + k) % 13] += dp[i - 1][j];
							dp[i][(j * 10 + k) % 13] %= mod;
						}
					}
				} else {
					int v = Integer.valueOf(s.substring(i, i + 1));
					for(int j = 0; j < 13; j++) {
						dp[i][(j * 10 + v) % 13] += dp[i - 1][j];
						dp[i][(j * 10 + v) % 13] %= mod;
					}
				}
			}
		}

		System.out.println(dp[s.length() - 1][5]);
	}

}


Measured memory_bytes: 52936
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 62;
ll gcd(ll a, ll b) { return a ? gcd(b % a, a) : b; }
map<ll, int> primeFactor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main() {
  //
  ll a, b;
  cin >> a >> b;
  ll g = gcd(a, b);
  map<ll, int> m = primeFactor(g);
  cout << 1 + m.size() << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    string ans;
    while(n>0)
    {
        ll r;
        if(n<27)
        {
            r=n;
            n=0;
        }
        else
        {
            r=n%26;
            n/=26;
            if(r==0)
            {
                r=26;
                n--;
            }
        }
        ans.push_back((char)'a'-1+r);
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
}

Measured memory_bytes: 3636
K,S=map(int,input().split())
ANS=0
for i in range(K+1):
  if i > S:
    break
  for j in range(K+1):
    z = i + j
    
    if S - z >= 0 and S - z <= K:
      #print(i,j,S-z)
      ANS+=1
    else:
      if S - z <= 0:
      	break
print(ANS)

Measured memory_bytes: 40924
#include<iostream>
#include <string>
#include <string.h>
#include <algorithm>

int main()
{
  char s[100001];
  scanf("%s", s);
  
  const struct word_def
  {
    char *str;
    int length;
  } words[4] =
  {
    {"dream", 5},
    {"dreamer", 7},
    {"erase", 5},
    {"eraser", 6},
  };

  int length = strlen(s);
  char *p = s + length;
  bool found = true;
  while(s < p && found)
  {
    found = false;
    for(auto w : words)
    {
      char *p_cmp = p - w.length;
      if(s <= p_cmp && strncmp(p_cmp, w.str, w.length) == 0)
      {
        found = true;
        p = p_cmp;
        break;
      }
    }
  }
  
  printf("%s", (found) ? "YES" : "NO");
  
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
 
int main(void)
{

  double a, b;

  scanf("%lf", &a);
  scanf("%lf", &b);

  if (a == b){
    printf("a == b\n");
  }
  else if (a > b) {
    printf("a > b\n");
  }
  else {
    printf("a < b\n");
  }
 
  return 0;
}



Measured memory_bytes: 2036
#include <iostream>

using namespace std;

int main()
{
	int inValue, tmp;
	
	cin >> inValue;
	
	for(int i = 1; i <= inValue; i++)
	{
		tmp = i;
		if( (0 == i % 3) || (3 == i % 10) )
		{
			cout << " " << i;
			continue;
		}
		
		while(0 < tmp)
		{
			tmp /= 10;
			if(3 == tmp % 10)
			{
				break;
			}
		}
		
		if(0 != tmp)
		{
			cout << " " << i;
		}
	}
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 3076
#include <iostream>
#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1e9+7 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n,k ;
	cin >> n >> k ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	ll sum = 0 ;
	ll now = 0 ;
	for(int i=0;i<k;i++) now += a.at(i) ;
	sum = now ;
	for(int i=k;i<n;i++){
		now = now-a.at(i-k)+a.at(i) ;
		sum = max(sum,now) ;
	}
	fix_cout() ;
	cout << (sum+k)/2.0 << endl ;
}


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

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

  vector<string> s(n);
  for (int i = 0; i < n; i++)
  {
    cin >> s[i];
  }

  map<char,int> mp;
  for (int i = 0; i < (int)s[0].size(); i++)
  {
    mp[s[0][i]]++;
  }
  
  for (int i = 1; i < n; i++)
  {
    map<char,int> mps;
    for (int j = 0; j < (int)s[i].size(); j++)
    {
      mps[s[i][j]]++;
    }
    for(auto p:mp){
      mp[p.first] = min(mps[p.first],p.second);
    }
  }

  for(auto p:mp){
    for (int i = 0; i < p.second; i++)
    {
      cout << p.first;
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
A,B = map(int,input().split())

list_aaa = [1,2,3,4,5,6,7,8,9]

ans_a = 0
ans_b = 0

for i in list_aaa:
    if A == i :
        ans_a = 1
    if B == i:
        ans_b = 1
    else:
        ans = 2

if ans_a ==1 and ans_b ==1:
    print(A*B)
else:
    print('-1')

Measured memory_bytes: 3060
#!/usr/bin/env python3
import sys


def solve(r: int):
    print(pow(r, 2))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    r = int(next(tokens))  # type: int
    solve(r)


if __name__ == '__main__':
    main()


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

struct UnionFind
{
    vector<int> par;

    UnionFind(int N) : par(N, -1) {}

    int root(int x)
    {
        if (par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        x = root(x), y = root(y);
        if (x == y)
            return;
        if (par[x] > par[y])
            swap(x, y);
        par[x] += par[y];
        par[y] = x;
    }

    bool same(int x, int y)
    {
        return root(x) == root(y);
    }

    int size(int x)
    {
        return -par[root(x)];
    }
};

int main()
{
    long long int N, M;
    cin >> N >> M;
    vector<int> A(M), B(M);
    for (int i = 0; i < M; ++i)
    {
        cin >> A[i] >> B[i];
        --A[i];
        --B[i];
    }

    UnionFind uf(N);
    long long int inc = N * (N - 1) / 2;
    vector<long long int> ans;
    for (int i = 0; i < M; ++i)
    {
        ans.push_back(inc);
        int a = A[M - i - 1], b = B[M - i - 1];
        if (uf.same(a, b))
            continue;
        long long int aa = uf.size(a), bb = uf.size(b);
        inc -= aa * bb;
        uf.unite(a, b);
    }

    reverse(ans.begin(), ans.end());
    for (int i = 0; i < M; ++i)
        cout << ans[i] << endl;
}

Measured memory_bytes: 3444
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int X=sc.nextInt();
		int a=1;
		if(X==1) {
			System.out.println(a);
			System.exit(0);
		}
		for(int i=2;i*i<=X;i++) {
			for(int k=1;(int)Math.pow(i, k)<=X;k++) {
				if((int)Math.pow(i, k)>a) {
					a=(int)Math.pow(i, k);
				}
			}
		}
		System.out.println(a);
	}
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=ll(1e18)+ll(7);
const ll MOD=1000000007LL;
#define out(a) cout<<fixed<<setprecision((a))

class UnionFind{
public:
	vector<int> par,rank;
	//0-indexed
	UnionFind(int n){init(n);}
	void init(int n = 1) {
		par.resize(n);
		rank.resize(n,0);
		for (int i = 0; i < n; ++i) par[i] = i;
	}
	int root(int x = 1){
		if(par[x]==x)return x;
		return par[x] = root(par[x]);
	}
	void unite(int x = 1,int y = 1){
		x = root(x);
		y = root(y);
		if(x==y)return;
		if(rank[x]<rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x]==rank[y]){
				rank[x]++;
			}
		}
	}
	bool same(int x,int y){
		return root(x)==root(y);
	}
};


// なもりグラフ
// https://www.hamayanhamayan.com/entry/2019/08/25/090415

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N,H,W;
	ll ans = 0;
	cin >> N >> H >> W;
	UnionFind uf(H+W+6);
	priority_queue< pair<ll,P> > pq;
	FOR(i,0,N){
		int r,c,a;
		cin >> r >> c >> a;
		pq.push({a,{r,c}});
	}
	FOR(i,0,N){
		auto X = pq.top();
		int h = X.second.first;
		int w = X.second.second;
		int a = X.first;
		pq.pop();
		if(not uf.same(h,w+H)){
			ans += a;
			uf.unite(h,w+H);
		}else if(not uf.same(h,H+W+2)){
			ans += a;
			uf.unite(h,H+W+2);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 6516
#include<bits/stdc++.h>
using namespace std;
const int uchiha=1e3+5;
int main(){
    long long c=123456789,c1=0;
int x,t;
cin>>x;
for(int i=0;i<x;i++){
    cin>>t;
  while(t%2==0){
    c1++;
    t/=2;
  }
  c=min(c1,c);
  c1=0;
}
cout<<c;
}


Measured memory_bytes: 256
#include<iostream>  
#include<vector>  
#include<string>  
#include<set>  
#include<stack>  
#include<queue>  
#include<map>  
#include<algorithm>  
#include<cmath>  
#include<iomanip>  
#include<cstring>  
#include<sstream>  
#include<cstdio>  
#include<deque>  
#include<functional>  
using namespace std;  
  
const int MAX = 2005;  
int area[55][55];  
vector<int> R[MAX];  
int dist[MAX][55];  
int record[MAX];  
  
class Solve{  
public:  
    int N;  
  
    void Init(){  
        memset(record,0,sizeof(record));  
        for (int i = 1; i <= N; i++){  
            for (int j = 1; j <= N; j++)  
                cin >> area[i][j];  
        }  
        for (int i = 0; i < MAX; i++) R[i].clear();  
        memset(dist, 0, sizeof(dist));  
    }  
      
    void dfs(int i,int pa,int k){  
        for (int ind = 0; ind < R[i].size(); ind++){  
            int v = R[i][ind];  
            if (v == pa) continue;  
            dist[v][k] = dist[i][k] + 1;  
            dfs(v, i, k);  
        }  
    }  
  
    void Deal(){  
        Init();  
        int amount = 1;  
        for (int ind = 2; ind <= N; ind++){  
            for (int i = 1; i <= amount; i++){  
                int dis = area[ind][1] - dist[i][1];  
                int j;  
                for (j = 1; j < ind; j++){  
                    if (area[ind][j] - dist[i][j] != dis) break;  
                }  
                if (j == ind){  
                    while (dis > 0){  
                        amount++;  
                        R[amount].push_back(i);  
                        R[i].push_back(amount);  
                        record[amount]++;  
                        record[i]++;  
                        for (int k = 1; k < ind; k++){  
                            dist[amount][k] = dist[i][k] + 1;  
                        }  
                        dis--;  
                        i = amount;  
                    }  
                    dfs(i,0,ind);  
                    break;  
                }  
            }  
        }  
        sort(record+1,record+amount+1);  
        for (int i = 1; i < amount; i++){  
            if (record[i] > 1) cout << record[i] << " ";  
        }  
        cout << record[amount] << endl;  
    }  
};  
  
int main(){  
    Solve a;  
    while (cin >> a.N){  
        if (a.N == 0) break;  
        a.Deal();  
    }  
    return 0;  
}  


Measured memory_bytes: 3676