akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

struct Edge { int a; int b; int c; };

int main2() {
  int L = nextInt() - 1;

  int N = 20;
  vector<Edge> es;

  for (int i = 0; i < N - 2; i++) {
    es.push_back({i, i+1, 1 << i});
    es.push_back({i, i+1, 0});
  }

  int l = L;
  for (int i = N - 2; i >= 0; i--) {
    int w = (1 << i) - 1;
    while (w <= l) {
      es.push_back( { i, N-1, l - w } );
      l = l - w - 1;
    }
  }

  cout << N << " " << es.size() << endl;
  for (Edge e : es) {
    cout << (e.a + 1) << " " << (e.b + 1) << " " << e.c << endl;
  }
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

using namespace std;

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

    vector<int64_t> L(N+1);
    L.at(0) = 2;
    L.at(1) = 1;
    for(int i=2; i<N+1; i++){
        L.at(i) = L.at(i-1) + L.at(i-2);
    }
    cout << L.at(N) << endl;
}

Measured memory_bytes: 3160
// g++ -std=c++11 test.cpp && ./a.out
// g++ -std=c++11 test.cpp && ./a.out < test.txt

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>

using namespace std;

#define INF (1<<29)
#define SZ(X) ((int)(X).size())
#define PRINT(A) {for (auto it=A.begin(); it != A.end(); ++it) {cout << *it << ' ';} cout << endl;}
#define SUM(A) accumulate(A.begin(), A.end(), 0)
#define MAX(A) *max_element(A.begin(), A.end())
#define BIT_LENGTH(N) floor(log2(N)) + 1
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define RREP(I, N) for (int I = N-1; I >= 0 ; --I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RREPP(I, A, B) for (int I = A; I > (B); --I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
typedef vector<int> VI;
typedef map<int, int> MII;
typedef set<int> SI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;

void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }

int main() {
    int N;
    int C;
    _R(N);
    _R(C);

    int S[N];
    int T[N];
    int CH[N];
    REP(i, N) {
        int s, t, c;
        _R(s);
        _R(t);
        _R(c);
        S[i] = s;
        T[i] = t;
        CH[i] = c-1;
    }

    const int MAX_SIZE = 200002;
    int accu[MAX_SIZE] = {0};
    REP(i, C) { // deal with channel i;
        int channels[MAX_SIZE] = {0};
        REP(j, N) {
            if (CH[j] == i) {
                REPP(k, S[j]*2 - 1, T[j]*2) {
                    channels[k] = 1;
                }
            }
        }
        REP(j, MAX_SIZE) {
            if (channels[j] > 0) {
                accu[j] += 1;
            }
        }
    }

    int ans = 0;
    REP(i, MAX_SIZE) {
        ans = max(ans, accu[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6448
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    ss=STR()
    ans=[]
    for s in ss:
        if s=='0'or s=='1':
            ans.append(s)
        elif s=='B':
            if len(ans)>0:
                d=ans.pop(-1)
                #print(d)
            else:
                pass
    print(*ans,sep='')
            
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
n, y = map(int, input().split())
for x in range(n+1):
    for y_2 in range(n+1):
        z = n - x - y_2
        if y == 10000*x + 5000*y_2 + 1000*z and z>=0:
            print(x, y_2, z)
            exit()
print(-1, -1, -1)

Measured memory_bytes: 3060
package main
import (
  "fmt"
)
func main() {
	var (
		K int
		S int
	)
	var count  =  0
	fmt.Scan(&K, &S)
	//fmt.Println(S)
	for x := 0; x <= K; x++ {
		for y := 0; y <= K; y++{
			z := S-x-y
			if 0 <=z && z <= K{
				//fmt.Println(x,y,z)
				count += 1
			}
		}
	}
	fmt.Println(count)
}

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

int main() {
	int e;
	while (cin >> e, e) {
		int x = 0, m = 81671422;
		for (int z = 0; z*z*z <= e; z++) {
			for (int y = 0; y*y <= e - z*z*z; y++) {
				x = e - z*z*z - y*y;
				m = min(m, x + y + z);
			}
		}
		cout << m << endl;
	}
}

Measured memory_bytes: 1160
#include <stdio.h>

int main(int argc, const char * argv[])
{
    int r, c, i, j, sum1=0,sum2=0, sum3=0;
    int a[100][100];
    scanf("%d %d", &r, &c);
    for (i=0; i<r; i++) {
        for (j=0; j<c; j++) {
            scanf("%d", &a[i][j]);
        }
    }
    for (i=0; i<r; i++) {
           for (j=0; j<c; j++) {
               printf("%d", a[i][j]);
               printf(" ");
               sum1+=a[i][j];
               if(j==c-1){
                   printf("%d", sum1);
                   sum3+=sum1;
                   sum1=0;
                }
           }
        printf("\n");
    }
    for (j=0; j<c; j++) {
        for (i=0; i<r; i++) {
            sum2+=a[i][j];
        }
        
        printf("%d", sum2);
        printf(" ");
        sum2=0;
        if (j==c-1) {
            printf("%d\n",sum3);
        }
        
    }
    return 0;
}



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

int main(){
	int n;
	cin>>n;
	int ans=0;
	for(int i=1; i<=n; i+=2){
		int cnt=0;
		for(int j=1; j<=n; j++){
			if(i%j==0) cnt++;
		}
		if(cnt==8) ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
inline int read()
{
	int x = 0 , f = 1; char ch = getchar();
	while(ch < '0' || ch > '9')	{if(ch == '-')	f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
const int N = 2e5 + 50 , inf = 1e8;
const ll INF = 1e18;
int n , s , t;
namespace Dinic
{
	struct Edge
	{
		int to , cap , dis; Edge *nxt , *pre;
		Edge(int to = 0,int cap = 0,int dis = 0,Edge *nxt = NULL) : to(to) , cap(cap) , dis(dis) , nxt(nxt) { pre = NULL;}
	} *head[N] , pool[N << 2] , *tail = pool , *cur[N];
	inline void add(int u,int v,int w,int f) { head[u] = new (tail ++) Edge(v,w,f,head[u]); head[v] = new (tail ++) Edge(u,0,-f,head[v]); head[u] -> pre = head[v]; head[v] -> pre = head[u];}
	ll dis[N];
	bool vis[N];
	inline bool spfa()
	{
		for(int i = 0;i <= t;i ++) dis[i] = -INF , vis[i] = 0;
		std::queue<int> q; q.push(s); dis[s] = 0;
		while(!q.empty())
		{
			int x = q.front(); q.pop(); vis[x] = 0;
			for(Edge *i = head[x];i;i = i -> nxt)
			{
				int to = i -> to;
				if(i -> cap && dis[to] < dis[x] + i -> dis)
				{
					dis[to] = dis[x] + i -> dis;
					if(!vis[to]) q.push(to) , vis[to] = 1;
				}
			}
		}
		return dis[t] > -inf;
	}
	int dfs(int x,int want)
	{
		if(x == t || !want) return want;
		int get = 0 , flow; vis[x] = 1;
		for(Edge *&i = cur[x];i;i = i -> nxt)
		{
			int to = i -> to;
			if(!vis[to] && dis[to] == dis[x] + i -> dis && (flow = dfs(to,min(i -> cap,want))))
			{
				i -> cap -= flow; i -> pre -> cap += flow;
				get += flow; want -= flow;
				if(!want) break;
			}
		}
		return get;
	}
	inline ll zkw()
	{
		ll ans = 0;
		while(spfa())
		{
			vis[t] = 1;
			while(vis[t])
			{
				for(int i = 0;i <= t;i ++) cur[i] = head[i] , vis[i] = 0;
				ans += dis[t] * dfs(s,inf);
			}
		}
		return ans;
	}
}
using namespace Dinic;
int main()
{
	n = read(); int p1 = 2 * n + 1 , p2 = p1 + 1 , p3 = p2 + 1 , p4 = p3 + 1; t = p4 + 1;
	for(int i = 1;i <= n;i ++)
	{
		int x = read() , y = read() , w = read();
		add(s,i,w,0);
		add(i,p1,inf,x + y);
		add(i,p2,inf,x - y);
		add(i,p3,inf,y - x);
		add(i,p4,inf,-x - y);
	}
	for(int i = 1;i <= n;i ++)
	{
		int x = read() , y = read() , w = read();
		add(n + i,t,w,0);
		add(p1,n + i,inf,-x - y);
		add(p2,n + i,inf,y - x);
		add(p3,n + i,inf,x - y);
		add(p4,n + i,inf,x + y);
	}
	printf("%lld\n",zkw());
}

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

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if(a >= 13){
		cout << b;
	}else if(a >= 6 && a <= 12){
		cout << b / 2;
	}else{
		cout << "0";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		while(true) {
			
	        int n = scan.nextInt();		//n人	
	        int[] point = new int[n];
	        
	        if(n == 0) {
	        	break;
	        }
	        
			double sum = 0;
	        
	        for(int i=0; i<n; i++) {
	        	
	        	point[i] = scan.nextInt();		
	            sum += point[i];
	            
	        }
	        
	        double m = sum / n;
			double a = 0;
	        
            for(int i=0; i<n; i++) {
	           	a += Math.pow(point[i] - m, 2) / n;
            }
            System.out.println(Math.sqrt(a));
		}
	}
}


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

typedef long long ll;

int main() {
    int N;
    cin >> N;
    vector<ll> L(N + 1);
    L[0] = 2;
    L[1] = 1;
    for (int i = 2; i <= N; i++) L[i] = L[i - 1] + L[i - 2];
    cout << L[N] << endl;
}

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



int main()
{
    int tmp = 10000;
    int sum = 0;

    int n;
    cin >> n;
    while (n--) {
        int s;
        cin >> s;
        sum += s;
        if (s % 10) tmp = min(tmp, s);
    }

    if (sum % 10 == 0) {
        if (tmp == 10000) cout << 0;
        else cout << sum - tmp;
    }
    else cout << sum;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N, K, sum=0;
  	cin >> N >> K;
  for(int i = 0; N > i; i++){
    int x, A, B;
    cin >> x;
    A = x;
    B = K - x;
   if(B > A){
   sum += A * 2;
   }else if(A >= B){
   sum += B * 2;
   }
  }
    cout << sum << endl;
  }

Measured memory_bytes: 256
{
  const main = (input: string): void | string | number => {
    const r = _reader(input)
    const N = r.n()
    const [S, T] = r.ss()
    const ss = S.split('')
    const tt = T.split('')

    let res = ''

    for (let i = 0; i < N; i++) {
      res += ss[i] + tt[i]
    }

    return res
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
}


Measured memory_bytes: 9420
#include <atcoder/convolution>
#include <atcoder/modint>
#include <iostream>

using namespace std;
using namespace atcoder;

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

    vector<long long> c = convolution(a, b);
    // or: vector<long long> c = convolution<998244353>(a, b);

    for (int i = 0; i < n + m - 1; i++) {
        cout << c[i] << " ";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 27280
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();

		if (a == b) {
			System.out.println(c);
		} else if (a == c) {
			System.out.println(b);
		} else {
			System.out.println(a);
		}
	}
}

Measured memory_bytes: 22356
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<bitset>
#include<deque>
#define N 3002
#include<cstdlib>
#include<set>
#include<ctime>
#define ll long long
#define mp make_pair
using namespace std;
ll read()
{
	ll x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return f*x;
}
int n,a[N],head[N],size,du[N];
struct edge{
	int next,to;
}mem[N<<1];
void addedge(int u,int v)
{
	mem[++size].to=v;mem[size].next=head[u];head[u]=size;
}
bool sg[N];
void dfs(int x,int fa)
{
	if(du[x]==1&&fa) 
	{
		sg[x]=0;
		return ;
	}
	sg[x]=1;
	for(int i=head[x];i;i=mem[i].next)
	{
		int v=mem[i].to;
		if(v==fa||a[v]>=a[x]) continue;
		dfs(v,x);sg[x]&=sg[v];
	}
	sg[x]=!sg[x];
}
int main()
{
	n=read();
	for(int i=1;i<=n;++i) a[i]=read();
	for(int i=1;i<n;++i) 
	{
		int x=read(),y=read();
		du[x]++,du[y]++;
		addedge(x,y);addedge(y,x);
	}
	for(int i=1;i<=n;++i)
	{
		dfs(i,0);
		if(sg[i]) cout<<i<<" ";
	}
	return 0;
 }


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

#define INF 1e9
using namespace std;

int main() {

    int N, K; cin >> N >> K;

    double ans = 0;

    for (int i = 1; i <= N; ++i) {
        //除算を整数同士で行うと、答えは整数になってしまう
        double temp = 1.0 / N;

        int point = i;

        while (point < K) {
            point *= 2;
            temp /= 2;
        }

        ans += temp;
    }

    cout << setprecision(10) << ans << endl; //桁数の指定
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)   for(signed i=0; i<n; i++)
#define yn(b)   cout << ((b)?"Yes":"No") << endl
#define YN(b)   cout << ((b)?"YES":"No") << endl
#define pr(r)   cout << r << endl
#define str string
int main(void){
    long long N, i, r=0;
    cin >> N;
    long long a[N];
    rep(i, N) cin >> a[i];
    sort(a, a+N);
    long long b=0;
    long long tmp_a=a[0];
    rep(i, N){
        if(a[i] != tmp_a){
            tmp_a = a[i];
            if(N > 1) if(b<a[i-1]) r+=b;
            b=1;
        }else if(b == a[i]){
            r++;
        }else{
            b++;
        }
    }
    if(b<a[N-1]) r+=b;
    pr(r);
}

Measured memory_bytes: 1024
#include <iostream>  
using namespace std;  
int main()  
{  
  int n,r,sum=0,temp;    

  cin>>n;    
 temp=n;    
 while(n>0)    
{    
 r=n%10;    
 sum=(sum*10)+r;    
 n=n/10;    
}    
if(temp==sum)    
cout<<"Yes";    
else    
cout<<"No";   
  return 0;  
}  

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

int main(void){
  int n,m; cin >> n >> m;
  int l[m],r[m];
  rep(i,m) cin >> l[i] >> r[i];
  int kagen = 1, jogen = n;
  rep(i,m){
    if(l[i] > kagen) kagen = l[i];
    if(r[i] < jogen) jogen = r[i];
  }
  if(jogen - kagen + 1 > 0)printf("%d",jogen - kagen + 1);
  else cout << 0 << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <sstream>
using namespace std;

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

ll n;

void solve() {
  stringstream ss;
  ss << n;
  string s = ss.str();
  for(int i = 0 ; i < s.size() ; i++){
    if( s[i] == '9') cout << 1;
    else if( s[i] == '1') cout << 9;
    else cout << s[i];
  }
  cout << endl;
}

void input() {
  n = ll();
  scanf("%lld", &n);
}

int main() {
  input();
  solve();
  return 0;
}


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

typedef long long ll;

using namespace std;
int main(){
	ll n;
	cin >> n;
	int counter = 0;
	string ret = "";
	ll m = n;
	if (n==0){
		cout << '0' << endl;
		return 0;	
	}
	while(true){
		if (m==pow(-2,counter)){
			ret = '1' + ret;
			break;
			}			
		ll x = pow(2,counter+1);
		if (m%x != 0){
			m -= pow(-2,counter);
			ret = '1'+ret; 
		}else{
			ret = '0' + ret;
		}
		++counter;
	}
	cout <<  ret << endl;
	return 0;
}

Measured memory_bytes: 256
// atcoder/abc150/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  string s;
  while (cin >> n >> s) {
    int cnt = 0;
    for (int i = 0; i + 2 < s.size(); ++i) {
      cnt += (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C');
    }
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 892
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)2e5+5;
const ll MOD =(ll)1e9+7;
const ll INF = (ll)1e18+5;
const int nn=1e5+5;

int main()
{
    _SAD()
    int ans=0;
    string s;
    cin>>s;
    rep(i,3)
    {
        int cnt=0;
        if(s[i]=='R')
        {
            while(i<3&&s[i]=='R')
            {
                cnt++;
                i++;
            }
            ans=max(cnt,ans);
            i--;
        }
    }
    cout<<ans<<nl;
    return 0;
}


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

int main() {
    int N, K;
    cin >> N >> K;

    int res = 1;
    rep(i, N) {
        if (res * 2 < res + K) {
            res *= 2;
        } else {
            res += K;
        }
    }
    cout << res << endl;
}

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

using namespace std;

int W, H, x, y;

void Move(char c, vector<string> &map)
{
    if (c == 'U') {
        map[y][x] = '^';
        if (y - 1 >= 0 && map[y - 1][x] == '.') {
            swap(map[y][x], map[y - 1][x]);
            --y;
        }
    }
    else if (c == 'D') {
        map[y][x] = 'v';
        if (y + 1 < H && map[y + 1][x] == '.') {
            swap(map[y][x], map[y + 1][x]);
            ++y;
        }
    }
    else if (c == 'L') {
        map[y][x] = '<';
        if (x - 1 >= 0 && map[y][x - 1] == '.') {
            swap(map[y][x], map[y][x - 1]);
            --x;
        }
    }
    else if (c == 'R') {
        map[y][x] = '>';
        if (x + 1 < W && map[y][x + 1] == '.') {
            swap(map[y][x], map[y][x + 1]);
            ++x;
        }
    }
    else if (c == 'S') {
        int dx = 0, dy = 0;
        if (map[y][x] == '^')
            dy = -1;
        else if (map[y][x] == '>')
            dx = 1;
        else if (map[y][x] == 'v')
            dy = 1;
        else if (map[y][x] == '<')
            dx = -1;

        for (int i = 1; ; ++i) {
            if (x + i * dx < 0 || x + i * dx >= W ||
                y + i * dy < 0 || y + i * dy >= H)
                break;
            if (map[y + i * dy][x + i * dx] == '*') {
                map[y + i * dy][x + i * dx] = '.';
                break;
            }
            if (map[y + i * dy][x + i * dx] == '#')
                break;
        }
    }
}

int main()
{
    int T;

    cin >> T;
    while (T--) {
        cin >> H >> W;
        vector<string> map(H);

        for (int i = 0; i < H; ++i)
            cin >> map[i];
        for (int i = 0; i < H; ++i)
            for (int j = 0; j < W; ++j)
                if (map[i][j] == '^' || map[i][j] == '>' ||
                    map[i][j] == 'v' || map[i][j] == '<')
                    x = j, y = i;

        string order;
        int num;

        cin >> num;
        cin >> order;

        for (int i = 0; i < num; ++i)
            Move(order[i], map);

        // Output
        for (int i = 0; i < H; ++i)
            cout << map[i] << "\n";
        if (T != 0)
            cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1200
#include <utility>
#include <stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define YES(b) std::cout<< (b ? "Yes" : "No")
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	char s;
	cin >> s;
	if (s == 'a' || s == 'i' || s == 'e' || s == 'o' || s == 'u') {
		cout << "vowel";
		return 0;
	}
	cout << "consonant";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;

signed main(){
    int X;
    cin >> X;
    
    int ans = 0,amari = 0;
    
    ans += (X/500);
    amari = X-(ans*500);
    
    ans = ans*1000;
    ans += (amari/5)*5;
    
    cout << ans << endl;
    return 0;
}



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

int main()
{
  int n;
  cin >>n;
  int u, a[n][n], v, num;
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      a[i][j]=0;
    }
  }
  for(int i=0; i<n; i++){
    cin >> num >> u;
    for(int j=0; j<u; j++){
      cin >> v;
      a[i][v-1] += 1;

    }
    for(int k=0; k<n-1; k++){
      cout << a[i][k] << ' ';
    }
    cout << a[i][n-1] <<endl;
  }

  return 0;
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define LL  long long
#define MOD  998244353
//#define mod  998244353

LL N, M, K;
//ll qpow(ll a,ll b) {return b?qpow(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

LL qpow(LL base, LL pow) {
    LL res = 1;
    while(pow) {
        if(pow&1) {
            res = res*base%MOD;
        }
        base = base*base%MOD;
        pow /= 2;
    }
    return res%MOD;
}

int main() {
    cin >> N >> M >>K;
    LL ans = 0;
    LL temp = 1;
    for(int k=0; k<=K; k++) {
        ans += ((M * temp)%MOD * qpow(M-1, N-1-k))%MOD;
        ans %= MOD;
        temp = (temp * (N-k-1))%MOD * qpow(k+1, MOD-2);
        temp %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

const long long int mod = 1e9 + 7;

int main() {
  int H, W;
  cin >> H >> W;
  vector<string> a(H);
  for(int i=0; i<H; i++){
    cin >> a[i];
  }

  vector<vector<long long int>> dp(H, vector<long long int>(W, 0));
  dp[0][0] = 1;

  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      if(i <  H - 1) {
        if(a[i+1][j] == '.') {
          dp[i+1][j] += dp[i][j];
          dp[i+1][j] %= mod;
        }
      }
      if(j < W -1) {
        if(a[i][j+1] == '.') {
          dp[i][j+1] += dp[i][j];
          dp[i][j+1] %= mod;
        }
      }
    }
  }

  cout << dp[H-1][W-1]%mod << endl;

  return 0;
}


Measured memory_bytes: 9216
#include<stdio.h>

struct test{
    signed short mid;
    signed short fin;
    signed short re;
    unsigned char eval;
};
unsigned char evaluate(signed short mid, signed short fin, signed short re);
int main(){
    struct test test[50];
    unsigned i;
    short unsigned count = 0;
    for(i = 0;i < 50;i++){
        scanf("%d %d %d", &test[i].mid, &test[i].fin, &test[i].re);
        if(test[i].mid == -1 && test[i].fin == -1 && test[i].re == -1){
            break;
        }
        test[i].eval = evaluate(test[i].mid, test[i].fin, test[i].re);
        count++;
    }
    for(i = 0;i < count;i++){
        printf("%c\n", test[i].eval);
    }
    return 0;
}

unsigned char evaluate(signed short mid, signed short fin, signed short re){
    if(mid == -1 || fin == -1){
        return 'F';
    }
    if(mid + fin >= 80){
        return 'A';
    }
    else if(mid + fin >= 65){
        return 'B';
    }
    else if(mid + fin >= 50){
        return 'C';
    }
    else if(mid + fin >= 30){
        if(re >= 50){
            return 'C';
        }
        else{
            return 'D';
        }
    }
    else{
        return 'F';
    }
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  char e;
  cin>>n>>a;
  ll ar[n];
  rep(i,0,n) cin>>ar[i];
  sort(ar,ar+n);
  per(i,n-1-a,-1) k+=ar[i];
  cout<<k;
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
//   cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 5212
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  lol a[n + 5] = {};
  reps(i, n){
    cin >> a[i];
  }
  lol ans = 0;
  reps(i, n){
    if(a[i - 1] > a[i]){
      ans += a[i - 1] - a[i];
      a[i] = a[i - 1];
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 5196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

void pr(bool f){
    cout << (f ? "Yes" : "No") << endl;
    exit(0);
}

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    vll b(n);
    rep(i, n){
        cin >> b[i];
    }
    ll suma = accumulate(ALL(a), 0ll);
    ll sumb = accumulate(ALL(b), 0ll);
    ll need = 0;
    rep(i, n){
        if(a[i] > b[i]){
            need += a[i]-b[i];
        }else if((b[i]-a[i])&1){
            need++;
        }
    }
    pr(sumb-suma>=need);
    
    return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main(void)
{
	int w,h,c,x,a,b;
	scanf("%d %d %d",&w,&h,&c);
	if(w>h){
		x=h;
	}
	if(h>w){
		x=w;
	}
	while(1){
		if(h%x==0&&w%x==0){
			break;
		}
		x=x-1;
	}
		a=(h/x)*(w/x);
		b=a*c;
		printf("%d\n",b);
return 0;
}

	


Measured memory_bytes: 2760
#include <iostream>
#include <string>

int main() {
    std::string s;
    long long k;
    std::cin >> s >> k;
    for (auto i = 0; i < k; i++) {
        if (i >= s.size()) break;
        if (s[i] != '1') {
            std::cout << s[i] << std::endl;
            return 0;
        }
    }

    std::cout << 1 << std::endl;

    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
a_list = gets.split("\s").map {|s|s.to_i}
a_list.sort! {|a,b| b <=> a}
sum = 0
a_list.each_with_index do |val,i|
  if i%2 == 0 then
    sum += val
  else
    sum -= val
  end
end
p sum

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

using namespace std;

const int mxn = 1e5;

int main(){
    int n, k;
    int a[mxn + 11];
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++){
        scanf("%d", a + i);
    }
    printf("%d\n", (n - 2)/(k - 1) + 1);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#include "E:\CP\Debugger\debugger.h"
#else 
#define debug(x...)
#endif
#define int long long
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define TC int tc; cin>>tc; for(int cn=1; cn<=tc; ++cn) 
const int mx = 2e6+2, neg = -1e6, pos = 1e6;
bitset<mx> vis;

signed main(){
    int k, x;
    cin>>k>>x;

    int st = (x-k+1 >= neg? x-k+1: neg);
    int ed = (x+k-1 <= pos? x+k-1: pos);

    for(int i= st; i<=ed; ++i)
        cout<<i<<' ';

    return 0;
}

Measured memory_bytes: 3552
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <fstream>
#include <vector>
#include <bitset>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int n,ans;

int main()
{
	scanf("%d",&n);
	ans = 1e9;
	for (int a = 1,b = n - 1;a <= b;a++,b--)
		ans = min(ans,a / 10000 + a / 1000 % 10 + a / 100 % 10 + a / 10 % 10 + a % 10 + b / 10000 + b / 1000 % 10 + b / 100 % 10 + b / 10 % 10 + b % 10);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;

int main(){
    int a , b , c , d;
    cin>>a>>b>>c>>d;
    if(a + b > c + d) cout<<"Left"<<endl;
    else if(a + b == c + d) cout<<"Balanced"<<endl;
    else cout<<"Right"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    string ans = "Impossible";
    if((a+b)%3==0){
        ans = "Possible";
    }
    if(a%3==0){
        ans = "Possible";
    }
    if(b%3==0){
        ans = "Possible";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

n = int(input())
t = [0] * n
for i in range(n):
    t[i] =input()[0]
t2 = [t.count(i) for i in ["M","A","R","C","H"]]
ans = 0
for i in range(5):
    for j in range(5):
        if j == i:
            break
        for k in range(5):
            if k == j:
                break
            ans += t2[i] * t2[j] * t2[k]
print(ans)

Measured memory_bytes: 3828
n,k=map(int,input().split())
dp=[[0]*(n+1) for _ in range(n+1)]
mod=10**9+7
dp[0][0]=1
dp[1][0]=1
dp[1][1]=1
for i in range(2,n+1):
    for j in range(n+1):
        dp[i][j]=(dp[i-1][j-1]+dp[i-1][j])%mod
for a in range(1,k+1):
    if n-k+1<a:
        print(0)
        continue
    else:
        print(dp[n-k+1][a]*dp[k-1][a-1]%mod)   


Measured memory_bytes: 106176
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()


int fie[404][404];

int d[] = {1,-1,0,0};

#define int long long


int H,W;
void dfs(int x,int y,int c, pair<int,int>& p) {
  if(x < 0 || H <= x) return;
  if(y < 0 || W <= y) return;
  if(fie[x][y] == -1) return;
  if(fie[x][y] != c) return;
  fie[x][y] = -1;
  if(c == 0) p.first++;
  else p.second++;
  for(int dd = 0;dd < 4;dd++) {
    int i = x + d[dd];
    int j = y + d[dd ^ 2];
    dfs(i,j,c ^ 1 , p);
  } 
}

signed main() {
  cin >> H >> W;
  rep(i,0,H - 1) {
    string s;
    cin >> s;
    rep(j,0,W - 1) {
      if(s[j] == '.') fie[i][j] = 1;
    }
  }

  int ans = 0;

  for(int i = 0;i < H;i++) {
    for(int j = 0;j < W;j++) {
      if(fie[i][j] != -1) {
        pair<int,int> p = {0,0};
        dfs(i,j,fie[i][j],p);
        ans += p.first * p.second;
      }
    }
  }
  cout << ans << endl;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> xs(5);
    int sum = 0;
    int subtract = 0;
    for (int& x : xs) {
        cin >> x;
        int y = 10*((x+9)/10);
        sum += y;
        subtract = max(subtract, y-x);
    }
    cout << sum - subtract << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace A
{
    partial class Program
    {
        public IEnumerable<string> Solve()
        {
            var s = Str;
            var b = s.GroupBy(x => x).All(x => x.Count() == 2);

            if (b)
                yield return "Yes";
            else
                yield return "No";

        }
    }

    class StartingPoint
    {
        static void Main(string[] args)
        {
            if (args?.Any() == true)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var resourceName = "AtCoder.Resources.In.txt";
                var stream = assembly.GetManifestResourceStream(resourceName);
                var streamReader = new StreamReader(stream, Encoding.UTF8);
                var str = streamReader.ReadToEnd();
                var textReader = new StringReader(str);
                Console.SetIn(textReader);
            }

            try
            {
                foreach (var s in new Program().Solve())
                {
                    Console.WriteLine(s);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                if (args?.Any() != true)
                    throw e;
            }

            if (args?.Any() == true)
                Console.ReadLine();
        }
    }

    partial class Program
    {
        long[] Nums(long count) => Enumerable.Range(0, (int)count).Select(_ => Num).ToArray();
        long Num => long.Parse(Str);
        double NumD => (double)Num;

        StringBuilder sb = new StringBuilder();

        string Str => GetStr();
        string GetStr()
        {
            sb.Clear();

            int r = 0;
            bool? b = null;
            do
            {
                r = Console.Read();
                b = IsBreak(r);
            } while (b == true);

            if (b == null)
                throw new Exception("input error: unexpected end of stream");

            do
            {
                sb.Append((char)r);
                r = Console.Read();
                b = IsBreak(r);
            } while (b == false);

            return sb.ToString();
        }

        bool? IsBreak(int c)
        {
            switch (c)
            {
                case -1:
                    return null;
                case (int)' ':
                case (int)'\n':
                case (int)'\r':
                    return true;
                default:
                    return false;
            }
        }
    }
}

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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  int x,y;
  cin >> x >> y;
  if((x%2==1&&x<8)||(x%2==0&&x>7))
    if((y%2==1&&y<8)||(y%2==0&&y>7)) print("Yes");
    else print("No");
  else if((x%2==0&&x>3&&x<7)||(x%2==1&&x>8))
    if((y%2==0&&y>3&&y<7)||(y%2==1&&y>8)) print("Yes");
    else print("No");
  else print("No");
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
using namespace std;



void solve()
{
	string s;
	cin >> s;
	int n = (int)s.length();

	if (n & 1)
	{
		cout << "No";
		return;
	}

	for (int i = 0; i < n; i+=2)
	{
		if (!(s[i] == 'h' && s[i + 1] == 'i'))
		{
			cout << "No";
			return;
		}
	}

	cout << "Yes";
}

int main()
{
	//freopen("file.in", "w", stdin); freopen("file.out", "w", stdout);
	solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=210;
int n,s[maxn],t[maxn];
ll dis[maxn],sz[maxn],mx[maxn];
ll ans1=1LL<<60,ans2;
vector<int> g[maxn];
void dfs(int u,int p) {
	for (int i=0;i<g[u].size();i++) {
		int v=g[u][i];
		if (v==p) continue;
		dis[v]=dis[u]+1; sz[u]++;
		dfs(v,u);
	}
}
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%d",&n);
	for (int i=1;i<n;i++) {
		scanf("%d %d",&s[i],&t[i]);
		g[s[i]].push_back(t[i]);
		g[t[i]].push_back(s[i]);
	}
	for (int i=1;i<=n;i++) {
		memset(dis,0,sizeof(dis));
		memset(sz,0,sizeof(sz));
		dis[i]=1; dfs(i,0);
		ll a1=0,a2=1;
		for (int j=1;j<=n;j++) a1=max(a1,dis[j]);
		memset(mx,0,sizeof(mx));
		for (int j=1;j<=n;j++) mx[dis[j]]=max(mx[dis[j]],sz[j]);
		for (int j=1;j<a1;j++) a2*=mx[j];
		if (a1<ans1||(a1==ans1&&a2<ans2)) {
			ans1=a1; ans2=a2;
		}
		//printf("%lld %lld\n",a1,a2);
	//	printf("%d\n",i);
	}
	for (int i=1;i<n;i++) {
		memset(dis,0,sizeof(dis));
		memset(sz,0,sizeof(sz));
		dis[s[i]]=dis[t[i]]=1; dfs(s[i],t[i]); dfs(t[i],s[i]);
		ll a1=0,a2=2;
		for (int j=1;j<=n;j++) a1=max(a1,dis[j]);
		memset(mx,0,sizeof(mx));
		for (int j=1;j<=n;j++) mx[dis[j]]=max(mx[dis[j]],sz[j]);
		for (int j=1;j<a1;j++) a2*=mx[j];
		if (a1<ans1||(a1==ans1&&a2<ans2)) {
			ans1=a1; ans2=a2;
		}
		//printf("%lld %lld\n",a1,a2);
	//	printf("%d\n",i);
	}
	printf("%lld %lld\n",ans1,ans2);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
#define pi 3.141592653589793
#define mod 998244353
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
//bitset<365> a;const double PI = acos(-1);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;
using namespace std;
const int INF = 1e9 + 5;
int main() {
    ll N, K;
    cin >> N >> K;
    vi dp(N, INF);
    vi height(N);
    for(auto &it:height) cin >> it;
    dp[0] = 0;
    for(int i = 0; i < N; ++i) {
        for(int j = i + 1; j <= i + K; ++j) {
            if(j < N) {
                dp[j] = min(dp[j], dp[i] + abs(height[j] - height[i]));
            }
        }
    }
    cout << dp[N - 1] << endl;
}


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

int main(){
   int N, K;
   std::cin >> N >> K;
   std::vector<int> p(N);
   for (int i=0; i<N; i++){
      std::cin >> p.at(i);
   }
   std::vector<double> e(N);
   for (int i=0; i<N; i++){
      e.at(i) = (1+p.at(i)) * p.at(i) / p.at(i) / 2.0;
      //std::cerr << e.at(i) << std::endl;
   }
   double init_sum = 0.0;
   for (int i=0; i<K; i++){
      init_sum = init_sum + e.at(i);
   }
   //std::cerr << init_sum << std::endl;
   double tmp_sum = init_sum;
   double max_sum = init_sum;
   int j=0;
   for (int i=K; i<N; i++){
      tmp_sum = tmp_sum + e.at(i) - e.at(j);
      //std::cerr << tmp_sum << std::endl;
      max_sum = std::max(max_sum, tmp_sum);
      j++;
   }
   std::cout << std::setprecision(10) << max_sum << std::endl;

}



Measured memory_bytes: 5612
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define df 0
int dc=100000;
typedef long int li;
#define MAX 512
long int n,a[MAX],k;
li r[MAX];
li s=0;
int ok(li d);
int comp(const void* a,const void* b){
  li x=*((li*)a),y=*((li*)b);
  return y-x;
}

int main(){
  if(df)printf("*** debug mode ***\n");
  int i;
  scanf("%d%d",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    s+=a[i];
  }
  li max=0;
  for(i=1;i<=sqrt(s);i++){
    if(s%i)continue;
    if(ok(s/i)){max=s/i;break;}
    if(ok(i)) max=i;
  }
  

  printf("%ld",max);
  return 0;
}
int ok(li d){
  if(df)printf("%ld:\n",d);
  int i;
  li sum=0;
  for(i=0;i<n;i++){
    r[i]=a[i]%d;
    sum+=r[i];
  }
  if(df){
    for(i=0;i<n;i++)printf("%ld ",r[i]);
    printf(":r\n");
  }
  li x=sum/d;
  qsort(r,n,sizeof(li),comp);
  if(df){
    for(i=0;i<n;i++)printf("%ld ",r[i]);
    printf(":r (orderd)\n");
  }
  
  sum=0;
  for(i=0;i<x;i++){
    sum+=d-r[i];
  }
  if(df)printf("need: %ld\n",sum);

  return (sum<=k)?1:0;
}

/// confirm df==0 ///


Measured memory_bytes: 252
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll N,M,K;
  cin>>N>>M>>K;//値を読み込む
  vector<ll> A(N+1);//数列Aの累積
  vector<ll> B(M+1);//数列Bの累積
  A.at(0)=0;//都合上初項を０にしておく
  B.at(0)=0;//都合上初項を０にしておく
  for(ll i=1;i<=N;i++){
    ll a;
    cin>>a;//値を読み込む
    A.at(i)=a+A.at(i-1);//Aの累積和を計算
  }
  for(ll i=1;i<=M;i++){
    ll a;
    cin>>a;//値を読み込む
    B.at(i)=a+B.at(i-1);//Bの累積和を計算
  }
  ll answer=0;//答え
  for(ll i=0;i<=N;i++){//iはAの累積和がどこまでかを表している
    if(A.at(i)>K){continue;}//もしAの累積和だけでKを超えてるならBの累積和に限らずダメ
    ll ans=0;
    //二分探索
    ll left=0,right=M;//Bにおいてleft=左端(0)からright=右端(M)まで
    while(left<=right){
      ll mid=left+(right-left)/2;//midは中央
      if(B.at(mid)<=K-A.at(i)){//もしAとBの累積和の合計がK以下ならansを大きいものに更新
        left=mid+1;ans=max(ans,mid);
      }
      else{right=mid-1;}
    }
    answer=max(answer,ans+i);//答えをi(Aの累積和何個分か)+ans(Bの累積和何個分か)と比べて大きい方に更新
  }
  cout<<answer<<endl;//答え出力
}

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

map<long long,long long> mp;

int main ()
{
	int i,n,m,bj=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
		int tmp;
		cin>>tmp;
		mp[tmp]++;
	}	
	cin>>m;
	for(i=0;i<m;i++)
	{
		int tmp2;
		cin>>tmp2;
		mp[tmp2]--;
		if(mp[tmp2]<0)
			bj++;
	}
	if(bj==0)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 12800