akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
#include<ctime>
#define R(i, n) for(int i = 0;i < n;i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define SA(i, n, a) R(i, n) scanf("%d", a + i)
#define P(a) printf("%d", a)
using namespace std;
using ll = long long;
using PR = pair<int, int>;
const ll MOD = 1e+9 + 7;

int N;

int main() {
	S(N);
	string s = to_string(N);
	R(i, s.size()) {
		if (s[i] == '7') {
			printf("Yes");
			return 0;
		}
	}
	printf("No");
}

Measured memory_bytes: 3788
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ArrayDeque<Integer> ans = new ArrayDeque<Integer>();

		while(sc.hasNext()){
			int count=0;
			int n = sc.nextInt();
			if(n<37){
				for(int a=0;a<10;a++){
					for(int b=0;b<10;b++){
						for(int c=0;c<10;c++){
							int t = n-(a+b+c);
							if(t>=0 && t<10)count++;
						}
					}
				}
			}
			ans.push(count);
		}
		int num = ans.size();
		for(int i=0;i<num;i++){
			System.out.println(ans.pollLast());
		}
	}
}

Measured memory_bytes: 18848
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

bool compare(const pair<pair<int,string>,int>  &a, const pair<pair<int,string>,int>  &b){
  if(a.first.second!=b.first.second) return a.first.second < b.first.second;
  else return a.first.first > b.first.first;
}

#if 0
#define DEBUG(x) do{cerr << x << endl;}while(0);
#else
#define DEBUG
#endif

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

	vector<int> x(n),y(n);
	
	for( int i=0; i<n; ++i ){
		cin >> x[i] >> y[i];
	}

	map<tuple<int, int>,int> hist;
	for( int i=0; i<n; ++i ){
		for( int j=0; j<n; ++j ){
			if( i != j ){
				int dx = x[j] - x[i];
				int dy = y[j] - y[i];
				
				tuple<int,int> key = make_tuple(dx,dy);
				if( hist.find(key) != hist.end()){
					hist[key]++;
					DEBUG("aaa");
				}
				else{
					hist[key] = 1;
					DEBUG("bbb");
				}
			}
		}
	}
	int max_val = 0;
	for( auto it = hist.begin(); it != hist.end(); ++it ){
		if( it->second > max_val ){
			max_val = it->second;
			DEBUG("hello");
		}
	}
	DEBUG(max_val);
	cout << (n - (max_val)) << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;



int main(){
	int D;
	cin>>D;
	cout<<"Christmas";
	for(int i=0;i<25-D;i++){
		cout<<" Eve";
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 764
/*-------------------------------"ANJAN AGARWALA"-----------------------------

         _/_/_/_/    _/_/    _/   _/_/_/_/   _/_/_/_/    _/_/    _/   
        _/    _/    _/ _/   _/         _/   _/    _/    _/ _/   _/        
       _/_/_/_/    _/   _/ _/         _/   _/_/_/_/    _/  _/  _/         
      _/    _/    _/    _/_/   _/    _/   _/    _/    _/    _/_/  
     _/    _/    _/      _/   _/_/_/_/   _/    _/    _/      _/   

-------------------------------------@anjn98---------------------------------*/

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

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

typedef long long int ll;
typedef long long int LL;
typedef unsigned long long int ull;
ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;*/

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define PR(a)           cout<<"("<<a<<")";
#define ED              cout<<'\n';
#define endl            '\n'
#define loop(j,a,n)     for(int j=a;j<=n;j++)
#define loop1(j,a,n)    for(int j=a;j>=n;j--)
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define SC(n)           scanf("%d",&n)
#define PB              push_back
#define MP              make_pair
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007

const int N=3e3+99;
int n;
ll a[N],pf[N],dp[N][N];

ll solve(int st,int en)
{
    if(st==en) return a[st];
    
    if(dp[st][en]!=-1 )    return dp[st][en];

    ll c1= a[st] + pf[en]-pf[st]  - solve(st+1, en )  ;
    ll c2= a[en] + pf[en-1]-pf[st-1]  - solve(st, en-1)  ;
    dp[st][en]=max(c1,c2);
    return dp[st][en];
}



int main() 
{
    IO

    memset(dp,-1,sizeof(dp));
    cin>>n;
    
    for(int i=1;i<=n;i++) cin>>a[i] ,  pf[i]=a[i]+pf[i-1];

    ll X=solve(1,n);
    ll Y=pf[n]-X;
    cout<<X-Y<<endl;

}




 

Measured memory_bytes: 75520
import java.util.ArrayDeque

fun main(){
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
    val g = Array(N+1){ mutableListOf<Int>()}
    for (i in 0 until M){
        val (A, B) = readLine()!!.split(" ").map { it.toInt() }
        g[A].add(B)
        g[B].add(A)
    }
    val visited = BooleanArray(N+1){false}
    val before = IntArray(N+1)
    before[1] = 0
    val queue = ArrayDeque<Int>()
    queue.add(1)
    visited[1] = true
    while (queue.isNotEmpty()){
        val e = queue.poll()
        g[e].forEach {
            if(!visited[it]) {
                queue.add(it)
                before[it] = e
                visited[it] = true
            }
        }
    }
    println("Yes")
    for(i in 2..N){
        println(before[i])
    }
}

Measured memory_bytes: 84112
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INF = 200005;
int main(void) {
  int n;
  cin >> n;
  int p;
  int ans = 0;
  int prev = INF;
  rep(i, n) {
    cin >> p;
    if(p < prev) {
      ans++;
      prev = p;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
  int N;
  cin>>N;
  string S;
  long long C[5]={0};
  for(int i=0;i<N;i++){
    cin>>S;
    if(S[0]=='M')C[0]+=1;
    else if(S[0]=='A')C[1]+=1;
    else if(S[0]=='R')C[2]+=1;
    else if(S[0]=='C')C[3]+=1;
    else if(S[0]=='H')C[4]+=1;
  }
  unsigned long long ans=0;
  ans+=C[0]*C[1]*C[2];
  ans+=C[0]*C[1]*C[3];
  ans+=C[0]*C[1]*C[4];
  ans+=C[0]*C[2]*C[3];
  ans+=C[0]*C[2]*C[4];
  ans+=C[0]*C[3]*C[4];
  ans+=C[1]*C[2]*C[3];
  ans+=C[1]*C[2]*C[4];
  ans+=C[1]*C[3]*C[4];
  ans+=C[2]*C[3]*C[4];
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll C[200005];
//! 長さNであるもので、
ll P[200005];
ll Q[200005];

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> C[i];
    }

    P[0] = 1;
    REP(i, N) {
        P[i + 1] = (P[i] * 4LL) % MOD;
    }
    Q[0] = 0;
    ll p = 1;
    REP(i, N) {
        Q[i + 1] = (p * 2LL * (i + 1)) % MOD;
        Q[i + 1] = (Q[i + 1] * p) % MOD;
        p = (p * 2) % MOD;
    }

    sort(C, C + N, [](ll a, ll b) { return a > b; });

    ll ans = 0;
    ll s = 0;
    REP(i, N) {
        ans = (ans + (P[N - 1] * C[i] * 2LL) % MOD) % MOD;
        ll t = (2LL * Q[i] * P[N - 1 - i]) % MOD;
        ans = (ans + C[i] * t) % MOD;
    }

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

Measured memory_bytes: 4992
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.concurrency;

void main() {
    int K, S;
    readf("%d %d\n", &K, &S);
    K++;
    K.iota.map!(x => K.iota.map!(y => S-x-y).count!(z => 0<=z && z<K)).sum.writeln;
}



// -------------------------------------------
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}

// fold was added in D 2.071.0.
static if (__VERSION__ < 2071) {
    template fold(fun...) if (fun.length >= 1) {
        auto fold(R, S...)(R r, S seed) {
            static if (S.length < 2) {
                return reduce!fun(seed, r);
            } else {
                return reduce!fun(tuple(seed), r);
            }
        }
    }
}


Measured memory_bytes: 256
#include<stdio.h>
int a[12];
int b[12];
int d[12];
int p[30];
int main(){
	int c;
	while(scanf("%d",&c),c){
		for(int i=0;i<c;i++){
			scanf("%d",a+i);
			b[i]=a[i];
		}
		int count=0;
		while(1){
			for(int i=0;i<30;i++)p[i]=0;
			for(int i=0;i<c;i++)p[b[i]]++;
			for(int i=0;i<c;i++)d[i]=p[b[i]];
			bool ok=true;
			for(int i=0;i<c;i++)if(d[i]-b[i])ok=false;
			if(ok)break;
			for(int i=0;i<c;i++)b[i]=d[i];
			count++;
		}
		printf("%d\n",count);
		for(int i=0;i<c;i++){
			if(i)printf(" ");
			printf("%d",d[i]);
		}
		printf("\n");
	}
}

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

using namespace std;

int main() {
  int N;
  string S;
  cin >> N >> S;
  for (int i = 0; i < S.length(); i++) {
    char k = S[i] + N;
    if (k > 'Z') {
      k = 'A' + (k - 'Z' - 1);
    }
    S[i] = k;
  }
  cout << S;

  return 0;
}


Measured memory_bytes: 256
a, b =map(int, input().split())
#A^2 -2AK-K^2=B^2 -2BK -K^2
#A^2-B^2=2(A-B)K
#(A+B)/2=K

c = (a+b)/2
if c-int(c)!=0:
  print("IMPOSSIBLE")
else:
  print(int(c))

Measured memory_bytes: 2940
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<map>
#include<string>
using namespace std;
int P[205],K[205],ans;
bool flag[205];
int n,x,y;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&x,&y);
        P[x]=y;K[x]=0;
    }
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&x,&y);
        P[x]=y;K[x]=1;
    }
    for(int i=0;i<=2*n-1;i++)
    {
        int Pnum=-1,nq=-1;
		if(K[i])
		{
			for(int j=i-1;j>=0;j--)
			{
				if(!flag[j]&&K[j]!=K[i]&&P[j]<P[i])
				{
					if(Pnum<P[j])
					{Pnum=P[j];nq=j;}
				}
			}
			//printf("%d %d\n",i,Pnum);
			if(Pnum==-1)continue;
			flag[nq]=1;flag[i]=1;ans++;
		}
    }
    printf("%d",ans);
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let h: usize = sc.cin();
    let w: usize = sc.cin();
    let rows: Vec<Vec<char>> = (0..h).map(|_| {
        let c: Vec<char> = sc.cin::<String>().chars().collect();
        if c.iter().filter(|&&a| a == '#').count() == 0 {
            None
        } else {
            Some(c)
        }
    })
        .filter(|o| o.is_some())
        .map(|o| o.unwrap())
        .collect();
    let h2 = rows.len();
    let w_count: Vec<usize> =
        (0..w).map(|j| (0..h2).filter(|&i| rows[i][j] == '#').count()).collect();
    let ws: Vec<bool> = (0..w).map(|j| w_count[j] > 0).collect();

    for row in rows {
        for j in 0..w {
            if ws[j] {
                print!("{}", row[j]);
            }
        }
        println!("");
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define f(i,l,h) for(ll i=l;i<h;i++)
#define fr(i,h,l) for(ll i=h;i>=l;i--)

using namespace std;

typedef pair<ll,ll> pll;
const ll INF=(ll)(998244353);
typedef vector<ll> vll;

ll power(ll a, ll b){
    ll res=1;
    while(b>0){
        if(b&1) res=(res*a)%INF;
        b>>=1;
        a=(a*a)%INF;
    }
    return res;
}

int main()
{
    //cout << "Hello world!" << endl;
    ll n,s;
    cin>>n>>s;
    ll a[n];
    f(i,0,n) cin>>a[i];
    ll dp[n+1][s+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=power(2,n);

    ll inv2=power(2,INF-2);
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=s;j++){
            if(j<a[i-1]){
                dp[i][j]=dp[i-1][j]%INF;
            }else{
                dp[i][j]=(dp[i-1][j] + (dp[i-1][j-a[i-1]]*inv2))%INF;
            }
        }
    }

    cout<<dp[n][s]<<endl;



    return 0;
}


Measured memory_bytes: 73888
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define DEBUG(x)           cout << '>' << #x << ':' << x << endl;
#define forn(i,n)          for(int i=0;i<(int)n;++i)
#define for1(i,n)          for(int i=1;i<=(int)n;++i)
#define forr(i,n)          for(int i=(int)n-1;i>=0;--i)
#define forre(i,a,b)       for(int i=(int)b;i>=(int)a;--i)
#define fore(i,a,b)        for(int i=(int)a;i<=(int)b;++i)
#define input(i,arr)       for(int& i:arr)cin>>i;
#define output(i,arr)      for(int& i:arr)cout<<i<<" ";
#define for_each(arr)      for(auto& it:arr)
#define ff                 first
#define ss                 second
#define PI                 acos(-1.0)
#define all(a)             a.begin(),a.end()
#define rall(a)            a.rbegin(),a.rend()
#define Unique(a)          sort(all(a)),a.erase(unique(all(a)),a.end())
#define pb(x)              push_back(x)
#define eb(x)              emplace_back(x) 
#define ppb(x)             pop_back(x)
#define pf(x)              push_front(x)
#define ppf(x)             pop_front(x)
#define in(x,y)            insert({x,y})
#define Sort(a)            sort(a.begin(),a.end())
#define mem(arr,a)         memset(arr,a,sizeof arr)
#define ins(a)             insert(a)
#define max2(a,b)          max(a,b)
#define max3(a,b,c)        max(a,max(b,c))
#define max4(a,b,c,d)      max(a,max3(b,c,d))
#define min2(a,b)          min(a,b)
#define min3(a,b,c)        min(a,min(b,c))
#define min4(a,b,c,d)      min(a,min3(b,c,d))
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<char> vc;
typedef vector<double> vd;
/*inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void Set(int & n, int b) { n |= two(b); }
inline void Reset(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }*/
/*int fx1[]={+1,-1,+0,+0};
int fy1[]={+0,+0,+1,-1};
int fx2={+0,+0,+1,-1,-1,+1,-1,+1};
int fy2={-1,+1,+0,+0,+1,+1,-1,-1};
*/

ll a,b,c,n,ans,cn1,cn2,cn3,t;
string s,s1,s2;


int main()
{
    FIO;
  //  #ifndef ONLINE_JUDGE
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
  //  #endif
    cin>>s;
    if(s.size()&1){
    	cout<<"No"<<endl;
    	return 0;
    } 
    bool hh=false;
    for(int i=0;i<s.size();i+=2){
    	if(s[i]=='h'&&s[i+1]=='i')
    		continue;
    	else{
    		cout<<"No"<<endl;
    		return 0;
    	}
    	
    }
    cout<<"Yes"<<endl;

    
   	
    #ifdef ONLINE_JUDGE
    cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
    #endif
   return 0;
}
 


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

int main(){
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    if(n>k){
        cout<<(n-k)*y+k*x;
    }
    else{
        cout<<n*x;
    }
    return 0;
}


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


int main() {
  int n,a; cin>>n;
  set<int> s;
  for(int i=0; i<n;i++){
    cin>>a;
    s.insert(a);}
  if(s.size()==n)cout<<"YES";
  else{cout<<"NO";}
}






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

int main()
{
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if (A1 + A2 + A3 >= 22)
    {
        cout << "bust" << endl;
    }
    else
    {
        cout << "win" << endl;
    }
}


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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define pb push_back


/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};
const string alpha = "abcdefghijklmnopqrstuvwxyz";

/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




/* main */



signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);


    int n = input();

    if(n == 22){
        print("Christmas Eve Eve Eve");
        return 0;
    }

    if(n == 23){
        print("Christmas Eve Eve");
        return 0;
    }

    if(n == 24){
        print("Christmas Eve");
        return 0;
    }

    print("Christmas");
    




}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

int n, m, q;
int a[50], b[50], c[50], d[50];
int A[10];

int dfs(int depth, int pre){
    if(depth == n){
        int res = 0;
        rep(i, q) {
            if (A[b[i]] - A[a[i]] == c[i]){
                res += d[i];
            }
        }
        return res;
    }
    int res = 0;
    for (int i = pre; i <= m; i++) {
        A[depth] = i;
        res = max(res, dfs(depth + 1, i));
    }
    return res;
}

signed main() {
    cin >> n >> m >> q;
    rep(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    cout << dfs(0, 1) << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 2e9
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
 
int main()
{
  int a, b, h, m;
  cin >> a >> b >> h >> m;
 
  ld theta = abs(30.0L * (ld)h - 5.5L * (ld)m);
  if (theta > 180.0L)
  {
    theta = 360.0L - theta;
  }
 
  ld r = sqrt((ld)(a * a) + (ld)(b * b) - (ld)(2.0L * a * b) * cos(PI * theta / 180.0L));
 
  printf("%.20Lf\n", r);
}

Measured memory_bytes: 4136
n, a, b = [int(i) for i in input().split()]
ans = 0
for i in range(1, n + 1):
    sum = 0
    now = i
    while now > 0:
        sum += now % 10
        now //= 10
    if a <= sum and sum <= b:
        ans += i
print(ans)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC126A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int K = int.Parse(input[1]);// int　整数型

            string S = Console.ReadLine();// string　文字型

            char[] answer = new char[N];

            for (int i = 0; i < N; i++)
            {
                answer[i] = S[i];//入力文字をバラバラにする
            }
            int pos = K - 1;//配列の添字は０から始まる　１文字目→０　２文字目→１
            if (answer[pos]=='A')
            {
                answer[pos] = 'a';
            }
            if (answer[pos]=='B')
            {
                answer[pos] = 'b';
            }
            if (answer[pos]=='C')
            {
                answer[pos] = 'c';
            }
            for (int i = 0; i < N; i++)
            {
                Console.Write(answer[i]);
            }


        }
    }
}


Measured memory_bytes: 11092
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

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

   int sq = 0;
   int ans = -1;
      for(int i= 1;;i++){
         sq = i*i;
      if(sq>n) {
         ans = (i-1)*(i-1);
         break;
         }
      }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
n, m, x = map(int,input().split())
a_l = list(map(int,input().split()))

cost_to_l = 0
x_to_l = x
while x_to_l > 0:
    x_to_l -= 1
    if x_to_l in a_l:
        cost_to_l += 1

cost_to_r = 0
x_to_r = x
while x_to_r < n:
    x_to_r += 1
    if x_to_r in a_l:
        cost_to_r += 1

print(min(cost_to_l,cost_to_r))

Measured memory_bytes: 3188
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll N;
  string s;
  cin >> N >> s;
  vector<ll> sum_black(N);
  for (auto i = 0; i < N; i++) {
    if (i > 0)
      sum_black[i] = sum_black[i-1];
    if (s[i] == '#')
      sum_black[i]++;
    // cout << "sum_black[" << i << "]=" << sum_black[i] << endl;
  }
  ll res = N - sum_black[N-1];
  for (auto i = 0; i < N; i++)
  {
    ll cost1 = sum_black[i];
    ll cost2 = (N - 1 - i) - (sum_black[N - 1] - sum_black[i]);
    res = min(res, cost1 + cost2);
    // cout << "i=" << i << " cost1=" << cost1 << " cost2=" << cost2
    //   << " res=" << res << endl;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 2180
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define pb push_back
using namespace std;
const int INF = 1e9;
typedef long long ll;

int main(){
  ll n,m;
  string s;
  ll a,b;
  string str;
  cin >> s >> str;
  if(s < str)
    cout << "<" << endl;
  else if(s == str)
    cout << "=" << endl;
  else
    cout << ">" << endl;
  return 0;
}


Measured memory_bytes: 764
#include <iostream>
using namespace std;
int main(void){
    double x;
    double y;
    double W;
    double H;
    double r;
    cin >>W>>H>>x>>y>>r;

    if(x < 0 || y< 0){
        cout <<"No"<<endl;
    }
    else {
        if((H/2)>=y && (W/2)>=x){
            if(x>=r && y>=r){
               cout <<"Yes"<<endl;  
            }else{
              cout <<"No"<<endl;
            }
        }else if((H/2)>=y && (W/2)<x){
             if((W-x)>=r && y>=r){
               cout <<"Yes"<<endl;  
            }else{
              cout <<"No"<<endl;
            }
        }else if((H/2)<y && (W/2)>=x){
             if(x>=r && (H-y)>=r){
               cout <<"Yes"<<endl;  
            }else{
              cout <<"No"<<endl;
            }
        }else if((H/2)<y && (W/2)<x){
            if((W-x)>=r && (H-y)>=r){
               cout <<"Yes"<<endl;  
            }else{
              cout <<"No"<<endl;
            }
        }
        
    }
    
    
    return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  string s;
  cin >> s;
  ll dp[100005][4] = {};
  int n = s.size(), m = 1000000007;
  for (int i = n; i >= 0; i--) {
    for (int j = 3; j >= 0; j--) {
      if (i == n) dp[i][j] = (j == 3 ? 1 : 0);
      else {
	dp[i][j] = dp[i+1][j] * (s[i] == '?' ? 3LL : 1LL);
	if (j < 3 && (s[i] == '?' || s[i] == "ABC"[j])) {
	  dp[i][j] += dp[i+1][j+1];
	}
	dp[i][j] %= m;
      }
    }
  }
  dump(dp[0][0]);
  return 0;
}


Measured memory_bytes: 3584
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            String S = in.next();

            int[] head = new int[N + 1];
            Arrays.fill(head, 0);
            int count = 1;
            for (int i = 1; i < N; i++) {
                if (S.charAt(i - 1) != S.charAt(i)) {
                    head[count++] = i;
                }
            }
            head[count] = N;

            int max = 1;
            for (int i = 0; i < count; i++) {
                boolean zero = S.charAt(head[i]) == '0';
                int last = Math.min(i + K * 2 + (zero ? 0 : 1), count);
                int sum = head[last] - head[i];
                max = Math.max(sum, max);
            }
            out.println(max);
        }

    }
}



Measured memory_bytes: 25948
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
//		String s = sc.next();
		int n = sc.nextInt();

		boolean deny = false;

		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			if(a%2==0) {
				if(a%3==0||a%5==0) {
					//nothing
				}else {
					deny = true;
					System.out.println("DENIED");
					break;
				}
			}

		}

		if(!deny) {
			System.out.println("APPROVED");
		}



	}
}


Measured memory_bytes: 23252
n=gets.to_i
as=gets.split.map(&:to_i)
b = as[-1]*2
ans = []
bunshi = 0

as.each_with_index do |a, i|
  break if i == n-1
  if i.even?
    bunshi -= a*2
  else
    bunshi += a*2
  end
end
bunshi -= b
ans << (bunshi/(-2))

(1...n).each do |i|
  ans << as[i-1]*2 - ans[i-1]
end

puts ans * ' '


Measured memory_bytes: 14084
#include <stdio.h>
 
int main() {
  char S[3];
  int judge=0;
  scanf("%s",S);
  for(int i=0;i<2;i++) {
    if(S[i] !=S[i+1]) {
      printf("Yes");
      judge++;
      break;
    }
  }
  if(judge==0) {
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 1720
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int a;
	cin>>a;
	vector<int> v;
	int b;
	rep(i, a){
		cin>>b;
		v.push_back(b);
	}
	int c=v[0], d=0;
	rep(i, a){
		if(c>=v[i])
			d++;
		c=min(c, v[i]);
	}
	cout<<d<<endl;
	return 0;
}

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

int n;
vector<lint> a;

int main() {
    cin >> n;
    a.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    // dp[i][j]:左からi,右からj個掘った段階から最適に行動したときの"X-Y"
    vector<vector<lint>> dp(n + 1, vector<lint>(n + 1, 0));
    // i:掘る数の合計
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j <= i; j++) {
            dp[j][i - j] = max(a[j] - dp[j + 1][i - j], a[n - i + j - 1] - dp[j][i - j + 1]);
        }
    }
    cout << dp[0][0] << endl;
}

Measured memory_bytes: 70784
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iostream> 
#include <cmath>
 
using namespace std;
typedef long long ll;
typedef long double ld;

//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)

ll P_POW(ll i, ll n) {
  if(n==0) return 1;

  n--;
  ll rep = i;

  while(n) {
    rep = rep * i;
    n--;
  }
  return rep;
} 

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}

ll n;


long long solve2(long long N) {
    if (N % 2 == 1) return 0;

    long long res = 0;
    N /= 2;
    while (N) {
        res += N / 5;
        cout << "N/5: " << N/5 <<  endl;
        cout << "res1: " << res <<  endl;
        N /= 5;
    }
    return res;
}


ll solve(ll n) {
    if (n % 2 == 1) return 0;

    ll res = 0;
    n /= 2;
    int c = 1;

    while ((ll) n/((ll)pow(5,c))) {
      res += n/P_POW(5,c);
      c++;
    }
    return res;
}

void f(int rest, string s) {
  char abc[] = "abc";
  if(rest == 0) {
    cout << s << endl;
  } else {
    for(int i=0; i < 3; i++) {
      f(rest - 1, s+abc[i]);
    }
  }
}

int main() {
  ll n;
  cin >> n;
  ll c = 0;
  if(n < 7) {
    cout << 1 << endl;
  } else {
    if((2*n)%11 == 0) {
      c = (2*n)/11;
      cout << c << endl;
    } else {
      c = ceil((n-6)/5.5) + 1;
      cout << c << endl;
    }
  }
}


Measured memory_bytes: 256
def isUruu(y):
    if y % 4 == 0:
        if y % 100 == 0:
            if y % 400 == 0:
                return True
            else:
                return False
        else:
            return True
    else:
        return False

first = True
while True:
    a,b = [int(i) for i in input().split()]
    if a == 0 and b == 0:
        break

    if first:
        first = False
    else:
        print("")

    flag = False
    for i in range(a,b+1):
        if isUruu(i):
            flag = True
            print(i)

    if not flag:
        print("NA")




Measured memory_bytes: 5732
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	fmt.Println((nextInt() + 1) / 2)
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<map>

using namespace std;

const int maxx = 1e5 + 5;
typedef long long ll;
ll sum;

int main(){
	int n, m;
	while(scanf("%d %d", &n, &m) == 2){
		int t, k;
		scanf("%d %d", &t, &k);
		printf("%d\n", n * m - (t * m + k * n) + t * k);
	}
	return 0;
}

Measured memory_bytes: 256
hel=["A","C","G","T"]

#p hel
n = gets.chomp
x = n.chars
#p x
cnt = 0
for i in 0..x.length-1
    for j in 0..x.length-1
    c = 0
        for k in i..j
        #puts hel.include?(x[k])
            if hel.include?(x[k])
            c=(j-i+1)
            else
                c = 0
                break
            end
        end
        #c = (j-i)
        if cnt <= c
            cnt=c
        end
        #p cnt
    end
end

puts cnt

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll n,k;
    cin>>n>>k;
    map<ll, ll> mp; 
    rep(i,n){
        ll tmp,tmpb;
        cin>> tmp>>tmpb;
        mp[tmp]+=tmpb;
    }
    for(auto x:mp){
        if(k>x.second){
            k-=x.second;
        }else{
            cout << x.first << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 4224
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

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

char itoc(int i){
  return i+'0';
}

char ctoi(char c){
  return c-'0';
}

bool LeftIsBigger(const std::string& l,const std::string& r){
  // cerr<<"In Function"<<endl;
  // cerr<<l<<" "<<r<<endl;
  if(l.size()>r.size()) return true;
  if(l.size()<r.size()) return false;
  for(int i=0;i<l.size();i++){
    if(l[i]!=r[i]){
      return l[i]>r[i];
    }
  }
  return false;
}

std::string dp[10001];

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);



  int n,m;
  cin>>n>>m;
  std::vector<int> a(m);
  for(int i=0;i<m;i++){
    cin>>a[i];
  }

  std::vector<int> match={-1,2,5,5,4,5,6,3,7,6};


  for(auto v:a){
    if(n-match[v]>=0){
      dp[n-match[v]]=std::string{itoc(v)};
    }
  }

  for(int i=n;i>=0;i--){
    for(auto v:a){
      if(i+match[v]<=n){
        if(dp[i+match[v]].empty()) continue;
        // cerr<<itoc(v)<<endl;
        std::string pre=itoc(v)+dp[i+match[v]];
        std::string suf=dp[i+match[v]]+itoc(v);
        if(dp[i+match[v]].empty()){
          dp[i]=pre;
        }
        // cerr<<pre<<" "<<suf<<endl;
        if(LeftIsBigger(pre,dp[i])){
          dp[i]=pre;
        }
        if(LeftIsBigger(suf,dp[i])){
          dp[i]=suf;
        }
      }
    }
  }

  cout<<dp[0]<<endl;




  return 0;
}

Measured memory_bytes: 28160
// C++ 14
#include <bits/stdc++.h>
using namespace std;
template <typename T>  ostream& operator<<(ostream& os, const vector<T>& v)  {  os << "[";  for (int i = 0; i < v.size(); ++i) {  os << v[i];  if (i != v.size() - 1)  os << ", ";  }  os << "]";  return os;  }
template <typename T> void print(T v, string s = "\n") { cout << v << s; }
template <typename T> void in(T &v) { cin >> v; }
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  int n, m; in(n),in(m);
  vector<bool> ac(n+1, false);
  vector<int> wa(n+1, 0);
  int p; string s;
  loop(i,0,m) {
    in(p),in(s);
    if (ac[p]) continue;
    if (s == "WA") wa[p]++;
    else ac[p] = true;
  }
  loop(p,1,n+1) if (!ac[p]) wa[p] = 0;
  
  int ans1 = 0;
  for (auto&&b: ac) ans1+=b;
  int ans2 = 0;
  for (auto&&w: wa) ans2+=w;
  print(ans1, " ");
  print(ans2);
  return 0;
}


Measured memory_bytes: 3800
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <functional>
#include <algorithm>
using namespace std;

typedef long long ll;

#define rep(i,a) for(int i=0;i<(a);++i)
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

int field[101][101];

int main()
{
    int n, w, h, s, t;
    while(cin >> n && n) {
        memset(field, 0, sizeof(field));
        cin >> w >> h;
        for(int i = 0; i < n; i++) {
            int x, y;
            cin >> x >> y;
            field[y][x] = 1;
        }
        cin >> s >> t;
        
        int ret = 0;
        for(int i = 1; i <= h - t + 1; i++) {
            for(int j = 1; j <= w - s + 1; j++) {
                int tmp = 0;
                for(int ii = 0; ii < t; ii++) {
                    for(int jj = 0; jj < s; jj++) {
                        if(field[i + ii][j + jj] == 1)
                            tmp++;
                    }
                }
                ret = max(ret, tmp);
            }
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 0
import math

# A = 2
# B = 2
# V = 4
#
# A = 12
# B = 21
# V = 10
#
# A = 3
# B = 1
# V = 8

A,B,V = map(int,input().split())

def process(a,b,v):
    if v > a**2*b/2:
        y = 2*b - 2*v/(a**2)
        return  y/a
    elif v == a**2*b:
        return b/a
    else:
        x = 2*v / (a*b)
        return b / x




result = process(A,B,V)

print( math.degrees(math.atan(result)))

Measured memory_bytes: 3064
n = int(input())
cnt = {}
for i in range(n):
    str = input()
    if str in cnt:
        cnt[str] += 1
    else:
        cnt[str] = 1

max_num = max(cnt.values())

ans_list = []

for i in cnt.items():
    if i[1] == max_num:
        ans_list.append(i[0])
    else:
        pass

ans_list.sort()

for i in ans_list:
    print(i)

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

int main() {

    string s[] = {"gray","Brown","green","light_blue","blue","yellow","orange","red"};

    string hush[4801];

    for(int i=0; i<8; i++){
        for(int j=0; j<400; j++){
            hush[i*400+j] = s[i];
        }
    }

    for(int i=3200; i<=4800; i++){
        hush[i] = "all";
    }

    set<string> color_set;

    int n,all_player=0;

    cin >> n;

    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        color_set.insert(hush[a]);
        if(hush[a] == "all"){
            all_player++;
        }
    }

    int min_ans = color_set.size();

    //3200以上のレーティングの人の色を既存の色に変更する。
    if(color_set.find("all") != color_set.end() && min_ans != 1){
        min_ans--;
    }

    int max_ans = color_set.size() + all_player;

    //3200以上のレーティングの人の色は既存と被らないため
    if(color_set.find("all") != color_set.end()){
        max_ans--;
    }

    cout << min_ans << " " << max_ans << endl;

    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    String op = sc.next();
    int B = sc.nextInt();

      if (op.equals("+")){
        System.out.println(A + B);
      }
      if (op.equals("-")) {
        System.out.println(A - B);
      }
  }
}


Measured memory_bytes: 21716
s,t=([ord(c)-ord('a') for c in input()]for _ in'xx')
if set(t)-set(s):
  print(-1)
else:
  u=s+s
  nxt = [None for _ in range(len(u)+1)]
  nxt[len(u)]=[0 for _ in range(26)]
  for i in range(len(u)-1,-1,-1):
    nxt[i] = [v+1 for v in nxt[i+1]]
    nxt[i][u[i]]=0
  p = 0
  for c in t:
    p += nxt[p%len(s)][c]+1
  print(p)

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

const int N = (int) 1e5 + 5;

int k, n;
int a[N];

int main() {
	//freopen(".inp", "r", stdin); freopen(".out", "w", stdout);
	ios_base :: sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> k;
	for (int i = 1; i <= n; i++) cin >> a[i];
	cout << (n - 1 + k - 1 - 1) / (k - 1) << endl; // ceil((n - 1) / (k - 1))
	return 0;
}

Measured memory_bytes: 640
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  ll n; cin>>n;
  ll ans = 1;
  bool flag = true;
  ll num;
  rep(i,n) {
    cin >> num;
    if (num == 0) {
      cout << '0' << endl;
      return 0;
    }
    ll sho;
    sho = 1000000000000000000 / ans;
    if (sho < num) flag = false;
    else ans*=num;
  }
  cout << ((flag == false) ? -1 : ans) << endl;
}


Measured memory_bytes: 3196
#include<iostream>
#include<string>
using namespace std;
int main() {
	string s, t; cin >> s >> t;
	int ans = 0;
	for (int i = 0; i < 3; i++) {
		if (s.substr(i, 1) == t.substr(i, 1)) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class E
{
	public static void Main()
	{
		int N = GetInt();
		int K = GetInt();

		if(N == 2)
		{
			if(K == 0)
			{
				Console.WriteLine(1);
				Console.WriteLine("1 2");
				return;
			}

			Console.WriteLine(-1);
			return;
		}

		int comb = (int)combination((int)(N - 1), 2);
		if(K > comb)
		{
			Console.WriteLine(-1);
			return;
		}

		Console.WriteLine(N - 1 + comb - K);
		for(int i = 2; i <= N; i++)
			Console.WriteLine($"1 {i}");

		int rest = comb - K;
		for(int i = 2; i <= N; i++)
		{
			for(int j = i + 1; j <= N; j++)
			{
				if(rest == 0)
					return;
	
				Console.WriteLine($"{i} {j}");
				rest--;
			}
		}
	}

	private static long combination(long n, long k) 
	{
		long r = 1;
		for(long d = 1; d <= k; d++) 
		{
			r *= n--;
			r /= d;
		}
		return r;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}

//char arr[57][57];
int main(){
	Lancer();
	ll n, d, x,a,t;
	cin >> n >> d >> x;
	x += n;
	for (int i = 0; i < n; i++){
		cin >> a;
		t = a;
		while (t+1<=d)
		{
			x++;
			t += a;
		}
	}
	cout << x;
	cout << endl;
	return 0;
}


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

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;

    vector<vector<char>> field(H+2, vector<char>(W+2, 'n'));
    vector<vector<int>> count_white(H+2, vector<int>(W+2, -1));
    queue<pair<int, int>> checked;
    int i, j;
    int count_black = 0;
    int answer = 0;

    vector<int> delta_i{-1, 1, 0, 0};
    vector<int> delta_j{0, 0, -1, 1};

    for(int i = 1; i <= H; i++) {
        for(int j = 1; j <= W; j++) {
            cin >> field[i][j];
            if(field[i][j] == '#') {
                count_black++;
            }
        }
    }
        

    // 初期化
    checked = {};
    
    count_white[1][1] = 1;
    checked.push(pair<int, int>(1, 1));

    while(checked.empty() == false) {
        i = checked.front().first;
        j = checked.front().second;
        checked.pop();

        for(int k = 0; k < 4; k++) {                
            if(field[i + delta_i[k]][j + delta_j[k]] == '.') {
                if(count_white[i + delta_i[k]][j + delta_j[k]] != -1) {
                    continue;
                } else {
                    count_white[i + delta_i[k]][j + delta_j[k]] = count_white[i][j] + 1;
                    checked.push(pair<int, int>(i + delta_i[k], j + delta_j[k]));
                }
            }
            
        }
    }

    if(count_white[H][W] == -1) {
        answer = -1;
    } else {
        answer = H*W - count_black - count_white[H][W];
    }

    cout << answer << endl;
	return 0;
}

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

int main()
{
    string s;
    cin>>s;
    long long int i,n=s.length(),c=0,ans=0;
    
    for(i=0;i<n;i++)
    {
        if(s[i]=='R')
            c++;
        else
        {
            if(c!=0)
            {
                ans=max(ans,c);
                c=0;
            }
        }
    }
    if(c!=0)
        ans=max(ans,c);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3624
import sys


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


S = input()
N = len(S)

for i in range(N // 2):
    if S[i] == S[N - i - 1]:
        continue
    else:
        print("No")
        sys.exit()

for i in range(N // 4):
    if S[i] == S[(N - 1) // 2 - i - 1]:
        continue
    else:
        print("No")
        sys.exit()
    if S[(N + 1) // 2 + i] == S[N - i - 1]:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")


Measured memory_bytes: 3064