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


using namespace std;

using ll   = long long;
using ii   = pair   < int , int >;
using i3   = pair   < int , ii  >;
using li   = pair   < ll  , int >;
using lii  = pair   < ll  , ii  >;
using pll  = pair   < ll  , ll  >;
using vi   = vector < int       >;
using vl   = vector < ll        >;
using vii  = vector < ii        >;
using vli  = vector < li        >;
using vpll = vector < pll       >;
using vi3  = vector < i3        >;
using vlii = vector < lii       >;


const int N = 2e5 + 5;
const ll INF = 1e17 + 7;
const double eps = 1e-9 , PI = acos(-1);

int n;
ll D , A;

pll a[N];
ll  x[N];
ll  h[N];
ll curr[N];

void solve(int testCase){

    scanf("%d %lld %lld" , &n , &D , &A);

    for(int i = 0 ; i < n ; i ++){
            scanf("%lld %lld" , &a[i].first , &a[i].second);
    }

    sort(a , a + n);

    for(int i = 0 ; i < n ; i ++){
            x[i] = a[i].first;
            h[i] = a[i].second;
    }

    ll sum = 0;
    ll ans = 0;
    for(int i = 0 ; i < n ; i ++){
        sum -= curr[i];
        if(sum * A >= h[i])continue;

        h[i] -= sum * A;
        ll add = (h[i] + A - 1ll) / A;
        ans += add;
        sum += add;
        int dx = upper_bound(x , x + n , x[i] + 2ll*D) - x;
        if(dx >= n)continue;
        curr[dx] += add;
    }

    printf("%lld\n" , ans);
}

main(){

    int t = 1;
    // scanf("%d" , &t);

    for(int testCase = 1 ; testCase <= t ; testCase ++){
            solve(testCase);
    }

    return 0;
}


Measured memory_bytes: 8064
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        Console.WriteLine(Math.Max(input[0] * input[1], input[2] * input[3]));
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
bitset<33> ans(0);

int to_m2(int x){
    if(x==0) return 0;
    int i=0;
    ll base = 1;
    while(x!=0){
        if(x%(base*2)!=0){
            ans.set(i,1);
            x-=base;
        }
        i++;
        base *= -2;        
    }
    return 0;
}

int main(){
    int n ; cin >> n;
    to_m2(n);
    bool flag = false;
    for(int i=31;i>=0;i--){
        if(ans.test(i)) flag = true;
        if(flag){
            cout << (int)(ans.test(i)) ;
        }
    }
    if(!n) cout << 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;

#define INF 1e+9
#define MAX_V 300

struct edge {
    int to;
    int cost;
};
using P = pair<ll, ll>;
ll gcd(ll x, ll y)
{
  if(x<y)
  {
    swap(x,y);
  }
  while(y>0)
  {
    ll r=x%y;
    x=y;
    y=r;
  }
  return x;
}
int main(){
  ll n,k;cin>>n>>k;
  VL a(n);
  REP(i,n){cin>>a[i];}
  for(int i=k;i<n;i++){
    if(a[i]>a[i-k]){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

Measured memory_bytes: 4460
#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
int H, W;
int dp[1000005]; //0 ?°????, 1??\??? ???????????????
int X[1000005], Y[1000005];
int mas[1005][1005];
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};

int main()
{
    int ans = 0;
    fill_n(*mas, 1005 * 1005, INF);
    cin >> H >> W;
    for(int i = 1; i <= H; i++) {
        for(int j = 1; j <= W; j++) {
            cin >> mas[i][j];
            Y[mas[i][j]] = i;
            X[mas[i][j]] = j;
        }
    }

    for(int i = 1; i <= H * W; i++) {
        int c = -1;
        for(int j = 0; j < 4; j++) {
            int ny = Y[i] + dy[j], nx = X[i] + dx[j];
            if(mas[ny][nx] < i && c != 0) {
                if(c == -1) c = dp[mas[ny][nx]];
                else if(c != dp[mas[ny][nx]]) c = 0;
            }
        }
        if(c == -1) dp[i] = i;
        else dp[i] = c;
        ans += dp[i] == 0;
    }

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

Measured memory_bytes: 18752
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define rrep(i,n) for (int i = (n - 1);i >= 0;i--)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

    bool flag = false; // 奇数が含まれるか
    int n,p;
    cin >> n >> p;
    int a;
    rep(i,n){
        cin >> a;
        if(a % 2 != 0) flag = true;
    }
    if(flag) printf("%ld\n",(ll)pow(2,n-1));
    else if(p == 1) cout << 0 << endl;
    else printf("%ld\n",(ll)pow(2,n));
}

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

plus = True
minus = True

ans = 0
for i in range(1, n):
    if plus and minus:
        if A[i] - A[i-1] > 0:
            minus = False
        elif A[i] - A[i-1] < 0:
            plus = False
    if plus and not minus and A[i] - A[i-1] < 0:
        ans += 1
        minus = True
    elif not plus and minus and A[i] - A[i-1] > 0:
        ans += 1
        plus = True

ans += 1

print(ans)


Measured memory_bytes: 14224
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());

const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
int main()
{
    ll a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    while (ans < 1e6)
    {
        if (a % 2 || b % 2 || c % 2)
            break;
        ll x, y, z;
        x = (c + b) / 2;
        y = (a + c) / 2;
        z = (a + b) / 2;
        a = x;
        b = y;
        c = z;
        ans++;
    }
    if (ans == 1e6)
        cout << -1 << endl;
    else
        cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
robot = []
for _ in range(N):
  r = []
  x, l = map(int, input().split())
  a = x + l
  b = x - l
  r += [a, b]
  robot.append(r)
Robot = sorted(robot)
 
robot_count = [Robot[0]]
for i in range(1, N):
  if Robot[i][1] >= robot_count[-1][0]:
    robot_count.append(Robot[i])
 
print(len(robot_count))

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second

typedef pair<lint, lint> P;
const lint MOD = 1e9+7;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD9;
        a = a * a % MOD9;
        n >>= 1;
    }
    return res;
}

int main(){
    int n; cin >> n;
    vector<lint> vec(MAX);
    rep(i, n-1) vec[i] = 0;
    lint d_max = 0;
    rep(i, n){
        lint d; cin >> d;
        if((i == 0 && d != 0) || (i != 0 && d == 0)){
            cout << 0 << endl;
            return 0;
        }
        if(d > d_max) d_max = d;
        vec[d]++;
    }
    lint ans = 1;
    repn(i, d_max-1){
        lint p = modpow(vec[i], vec[i+1]);
        ans = (ans * p) % MOD9;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int N;
ll C, X[101010], V[101010];

vector<ll> vs1, vs2;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> C;
    vs1.resize(N); vs2.resize(N);
    for (int j = 0; j < N; ++j) {
        cin >> X[j] >> V[j];
    }

    vs1[0] = V[0];
    for (int j = 1; j < N; ++j) vs1[j] = vs1[j-1] + V[j];

    vs2[N-1] = V[N-1];
    for (int j = N-2; j >= 0; --j) vs2[j] = vs2[j+1] + V[j];

    vector<ll> vs1b = vs1, vs2b = vs2;

    vs1b[0] = max(0LL, vs1[0] - 2*X[0]);
    for (int j = 1; j < N; ++j) {
        vs1b[j] = max(vs1b[j-1], vs1[j] - 2*X[j]);
    }

    vs2b[N-1] = max(0LL, vs2[N-1] - 2*(C-X[N-1]));
    for (int j = N-2; j >= 0; --j) {
        vs2b[j] = max(vs2b[j+1], vs2[j] - 2*(C-X[j]));
    }

    ll ans = 0LL;

    vs1[0] = max(0LL, vs1[0] - X[0]);
    ans = max(ans, vs1[0]);
    for (int j = 1; j < N; ++j) {
        vs1[j] = max(vs1[j-1], vs1[j] - X[j]);
        ans = max(ans, vs1[j]);
    }

    vs2[N-1] = max(0LL, vs2[N-1] - (C - X[N-1]));
    ans = max(ans, vs2[N-1]);
    for (int j = N-2; j >= 0; --j) {
        vs2[j] = max(vs2[j+1], vs2[j] - (C - X[j]));
        ans = max(ans, vs2[j]);
    }

    for (int j = 0; j < N-1; ++j) {
        ans = max(ans, vs1b[j] + vs2[j+1]);
        ans = max(ans, vs1[j] + vs2b[j+1]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
struct BIT{
    int size;
    vector<int> bit;
    void init(int n){
        size = n;
        bit.assign(size+1, 0);
    }

    int sum(int x){
        int res = 0;
        while(x > 0){
            res += bit[x];
            x -= (x & -x);
        }
        return res;
    }

    void add(int x, int y){
        while(x <= size){
            bit[x] += y;
            x += (x & -x);
        }
    }
};
long long inv_num(int n, vector<int> array){
    long long res = 0;
    vector<int> v;
    BIT b;
    b.init(n);
    v.assign(array.begin(), array.end());
    sort(v.begin(), v.end());
    auto tmp = unique(v.begin(), v.end());
    v.erase(tmp, v.end());
    for(int i=0;i<n;i++){
        int val = (int)(lower_bound(v.begin(), v.end(), array[i]) - v.begin()) + 1;
        res += i - b.sum(val);
        b.add(val, 1);
    }
    return res;
}

int main(void){
    int n, c = 0;
    string s;
    vector<int> p;
    stack<int> a[26];
    cin >> s;
    n = s.length();
    for(int i=0;i<n;i++){
        a[s[i]-'a'].push(i);
    }

    for(int i=0;i<26;i++){
        if(a[i].size() % 2 == 1){
            if(c == 0){
                c = 1;
            }else{
                cout << -1 << endl;
                return 0;
            }
        }
    }
    p.assign(n, -1);
    c = 0;
    for(int i=0;i<n;i++){
        int t = s[i] - 'a';
        if(p[i] != -1)continue;
        int x = a[t].top();
        a[t].pop();
        if(i == x){
            p[i] = n/2;
        }else{
            p[i] = c++;
            p[x] = n-1 - p[i];
        }
    }
    cout << inv_num(n, p) << endl;
}


Measured memory_bytes: 4484
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
  char C; cin >> C;
  if (C == 'A') cout << "T" << endl;
  else if (C == 'C') cout << "G" << endl;
  else if (C == 'T') cout << "A" << endl;
  else cout << "C" << endl;

  return 0;
}


Measured memory_bytes: 3608
#include <iostream>
using namespace std;
int main(void){
    int A;cin>>A;
    int B;cin>>B;
    int C;cin>>C;
    
    if(A==B&&B==C){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    
    return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	int A, B, T;
	cin >> A >> B>> T ;

	int ans = 0;
	int cnt = 0;
	while (true) {
		cnt += A;
		if (cnt > T){
			break;
		}
		ans += B;
	}

	cout << ans << "\n";

	return 0;
}


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

int main(void){
    int n;
    cin >> n;
    typedef long long ll;
    
    map <string,int> mp;
    
    rep(i,n){
        string s;
        cin >> s;
        sort(s.begin(),s.end());
        mp[s]++;//同じ文字列が存在した場合その文字列を++する
    }
    ll ans = 0;
    for(auto& p:mp){//auto&で型推測を自動化し、mpの存在するpを全て列挙してくれる
        int s =p.second; //2番目の値を持ってくる　つまり、string int のint成分を持ってくるということ　p.firstはstring持ってくる
        ans += (ll)s*(s-1)/2;
    }
    cout << ans <<endl;
    
    
    
    
    return 0;
}




Measured memory_bytes: 11136
#include <stdio.h>
int main()
{
  int count[26] = {};
  int n, i;
  char ch;
  while( scanf("%c", &ch) != EOF ){
    if(ch >= 'a' && ch <= 'z'){  
  n = ch - 'a';
  count[n]++;
    }
    else if(ch >= 'A' && ch <= 'Z'){
      n = ch - 'A';
      count[n]++;
    }
  }
  for(i = 0; i < 26; i++){
    printf("%c : %d\n",'a'+i, count[i]);
  } 
  return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
#define forloop for(int i = 0; i < n; i++)
int main(){
	double n; cin >> n;
	vector<vector<double>> vec;
	forloop{
		double a, b; cin >> a >> b;
		vector<double> temp;
		temp.push_back(a), temp.push_back(b);
		vec.push_back(temp);
	}
	double sum = 0;
	for (int i = 0; i < n; i++){
		for (int k = i+1; k < n; k++){
			double x = vec[i][0] - vec[k][0], y = vec[i][1] - vec[k][1];
			sum += pow(x*x+y*y, 0.5);
		}
	}
	double temp = 1;
	/*for (int i = 1; i <= n - 2; i++){
		temp *= i;
	}*/
	double a = 2 * sum /(n);
	printf("%lf", a);
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = []
for _ in range(N):
    S.append(input())
C = [0] * 4

for i in range(N):
    Si = S[i]
    if Si[0] == 'A':
        C[0] += 1
    if Si[0] == 'W':
        C[1] += 1
    if Si[0] == 'T':
        C[2] += 1
    if Si[0] == 'R':
        C[3] += 1

print('AC x ' + str(C[0]))
print('WA x ' + str(C[1]))
print('TLE x ' + str(C[2]))
print('RE x ' + str(C[3]))

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

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    vector<int> gram(11);
    gram.at(0) = x;
    auto f = [&](int i) {gram.at(i) =  r * gram.at(i - 1) - d;};
    for (int i = 0; i < 10; ++i) {
        f(i + 1);
        cout << gram.at(i + 1) << endl;
    }
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N =  INT()
p = LIST()

cnt = 0
for i in range(N):
	if i+1 != p[i]:
		cnt += 1
if cnt >= 3:
	print("NO")
else:
	print("YES")

Measured memory_bytes: 5716
#include <cstdio>
#include <cstring>
#define MAXN 3010

struct edge{
	int to,next;
	edge(int _to=0,int _next=0):to(_to),next(_next){}
}e[MAXN<<1];

int n;
int a[MAXN];
int g[MAXN],nume;

void addEdge(int u,int v){
	e[nume]=edge(v,g[u]);
	g[u]=nume++;
}

bool dfs(int x,int p){
	for(int i=g[x];~i;i=e[i].next)
		if(a[x]>a[e[i].to])
			if(!dfs(e[i].to,x)) return 1;
	return 0;
}

int main(){
	memset(g,-1,sizeof g);
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",a+i);
	for(int i=1;i<n;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		addEdge(u,v);
		addEdge(v,u);
	}
	for(int i=1;i<=n;i++)
		if(dfs(i,0)) printf("%d ",i);
	return 0;
}


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


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

  string s;
  cin >> s;
  if(s.size()<26){
    vector<int> a(26,0);
    rep(i,s.size()){
      int pos = s[i] - 'a';
      a[pos] = 1;
    }
    cout << s;
    rep(i,26){
      if(a[i]==0) {
        cout << ((char) ('a'+i)) << endl;
        return 0;
      }
    }
  }
  else{
    set<char> st;
    st.insert(s[25]);
    for(int i = 24; i>=0;i--){
      if(s[i]<s[i+1]){
        rep(j,i) cout << s[j];
        for(auto j:st) {
          if(j>s[i]){
            cout << j << endl;
            return 0;
          }
        }
      }
      st.insert(s[i]);
    }
    cout << -1 << endl;

  }
  
  return 0;
    

}


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

Graph g;

void dfs(int v, vector<bool> &seen, int &res) {
    bool end = true;
    rep(i, seen.size()) if(!seen[i] && i != v) end = false;
    if(end) {
        res++;
        return;
    }

    seen[v] = true;
    for(auto next : g[v]) {
        if(seen[next]) continue;
        dfs(next, seen, res);
    }
    seen[v] = false;
}

int main() {
    int n, m;
    cin >> n >> m;
    g.resize(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<bool> seen(n, false);
    int res = 0;
    dfs(0, seen, res);

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxN = 3000 + 5;
const int MOD = 998244353;

int n, s;
int a[maxN];
int memo[maxN][maxN];

int dp(int i, int rem) {
    if(i == n + 1) {
        if(rem == 0)
            return 1;
        return 0;
    }

    if(memo[i][rem] != -1)
        return memo[i][rem];

    int ans = 0;

    ans = (ans + dp(i + 1, rem)) % MOD;
    ans = (ans + dp(i + 1, rem)) % MOD;

    if(rem - a[i] >= 0) {
        ans = (ans + dp(i + 1, rem - a[i])) % MOD;
    }

    return (memo[i][rem] = ans);
}

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

    cin >> n >> s;

    for(int i = 1; i <= n; i++)
        cin >> a[i];

    for(int i = 1; i <= n; i++)
        for(int j = 0; j <= s; j++)
            memo[i][j] = -1;

    cout << dp(1, s) << '\n';

    return 0;
}


Measured memory_bytes: 39036
#include <bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define met memset(a,0,sizeof(a))
using namespace std;
const int mod=1e9+7;
char a[100],b[100];
int c[100];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int i,j,k,m,n;
    ll ans=1,bns;
    ll cnt=0;
    cin>>n;
    cin>>a>>b;
    for(i=0; i<n; i++)
    {
        if(a[i]==b[i])
            c[++cnt]=1;
        else if(a[i]==a[i+1]&&b[i]==b[i+1]&&(i+1)<n)
        {
            c[++cnt]=2;
            i++;
        }
    }
    if(c[1]==1)
        ans=3;
    else
        ans=6;
    for(i=2; i<=cnt; i++)
    {
        if(c[i]==1)
        {
            if(c[i-1]==1)
                ans=(ans*2)%mod;
            else
                ans%=mod;
        }
        else
        {
            if(c[i-1]==1)
                ans=(ans*2)%mod;
            else
                ans=(ans*3)%mod;
        }
    }
    cout<<ans%mod<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

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

		Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();

        if(A <= 8 && B <= 8){
        	System.out.println("Yay!");
        }else{
        	System.out.println(":(");
        }

	}
}

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

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

int main() {
  ll n,W,ans=0;
  cin >> n >> W;
  vector<vector<ll>>dp(n+5,vector<ll>(W+5,0));
  vector<ll>w(n);vector<ll>v(n);
  rep(i,n) cin >> w.at(i) >> v.at(i);
  rep(i,n) rep(j,W+1){
    if(j-w[i]>=0) chmax(dp[i+1][j],dp[i][j-w[i]]+v[i]);
    chmax(dp[i+1][j],dp[i][j]);
  }
  cout << dp[n][W] << endl;
}


Measured memory_bytes: 83328
#include <iostream>
#include <cmath>
#include <climits>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string.h>
#include <iomanip>
#include <ctype.h>

#define ll          long long int
#define ull         unsigned long long int
#define pb          push_back
#define pii         pair<int,int>
#define F           first
#define S           second
#define vi          vector<int>
#define vli          vector<ll>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define M_PI        3.14159265358979323846
#define mp          make_pair
#define sz(x)       (int)x.size()
//#define hell        1000000007
#define matrix      vector<vector<ll>>
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define eps 0.000000001
#define all(a)      (a).begin(),(a).end()
const long long INF = (long long) 1e7+1;
const long long mod = (long long) 998244353;
const long long hell = (long long) 1000000007;

using namespace std;
#include <stdio.h>

ll power(ll x,ll y)
{
  ll res=1;
  while(y>0)
  {
    if(y%2) res=(x*res);
    x=(x*x);
    y=y/2;
  }
  return res;
}

ll modinv(ll x){
  return power(x,hell-2);
}

void solve();


void fastIO() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}

int main(){
   fastIO();
    solve();
}
//void sieve();
ll pw(ll k,ll x);
ll gcd(ll x,ll y);
/*
void sieve(){

  for(int i=2;i<=500000;i++){
    if(prime[i]==true){
      for(int j=i*i;j<=500000;j+=i)
      prime[j]=false;
    }
  }

}*/


bool comp(pair<int,int> a,pair<int,int> b){
  if(a.F!=b.F)
  return (a.F<b.F);
  else
  return a.S<b.S;
}

void solve(){
  int test;
  //cin>>test;
  test=1;
  while(test--){
    int a,b;
    cin>>a>>b;
    cout<<(6-(a+b));
  }
}




/*bool issafe(int x,int y){
  return (x>=0 && y>=0 && x<n && y<m);
}*/

///Before submit=>
///    *check for integer overflow,array bounds
///    *check for n=1

ll gcd(ll x,ll y){
  if(x==0)
  return y;
  else
  return gcd(y%x,x);
}


ll pw(ll k,ll x){
  if(x==0)
  return 1;
  if(x&1)
  return ((pw(k,x-1))*k);
  else
  return ((pw(k,x/2))*(pw(k,x/2)));
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
#define fori(n) for ( int i = 0; i < (n);i++)
#define forj(n) for ( int j = 0; j < (n);j++)
#define fork(n) for ( int k = 0; k < (n);k++)
#define forghj(n) for ( int ghj = 0; ghj < (n);ghj++)
#define fori1(n) for ( int i = (n)-1; i >= 0;i--)
#define all(vector) (vector).begin(),(vector).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
/*
                            |~~~~~~~|
                            |       |
                            |       |
                            |       |
                            |       |
                            |       |
 |~.\\\_\~~~~~~~~~~~~~~xx~~~         ~~~~~~~~~~~~~~~~~~~~~/_//;~|
 |  \  o \_         ,XXXXX),                         _..-~ o /  |
 |    ~~\  ~-.     XXXXX`)))),                 _.--~~   .-~~~   |
  ~~~~~~~`\   ~\~~~XXX' _/ ';))     |~~~~~~..-~     _.-~ ~~~~~~~
           `\   ~~--`_\~\, ;;;\)__.---.~~~      _.-~
             ~-.       `:;;/;; \          _..-~~
                ~-._      `''        /-~-~
                    `\              /  /
                      |         ,   | |
                       |  '        /  |
                        \/;          |
                         ;;          |
                         `;   .       |
                         |~~~-----.....|
                        | \             \
                       | /\~~--...__    |
                       (|  `\       __-\|
                       ||    \_   /~    |
                       |)     \~-'      |
                        |      | \      '
                        |      |  \    :
                         \     |  |    |
                          |    )  (    )
                           \  /;  /\  |
                           |    |/   |
                           |    |   |
                            \  .'  ||
                            |  |  | |
                            (  | |  |
                            |   \ \ |
                            || o `.)|
                            |`\\\\) |
                            |       |
                            |       |
                            |       |
*/


int main() {
    ios::sync_with_stdio(false);
    int n;
    vector < bool > a;
    n = 55556;
    a.resize(n);
    for ( int x = 2; x < n; x++) {
        for ( int i = x*2; i < n;i+=x) {
            a[i] = true;
        }
    }
    vector < int > kek;
    for ( int i = 2; i < n;i++) {
        if (a[i] == false) kek.pb(i);
    }
    vector < int > kek2;
    fori(kek.size()) if (kek[i]%5 == 1) kek2.pb(kek[i]);
    kek = kek2;
    cin >> n;
    fori(n) cout << kek[i] << " ";
}














Measured memory_bytes: 384
#include <stdio.h> 
int main(void)
{
	int W,H,x,y,r;
	
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	
	if((x+r)>W || (x-r)<0)
		printf("No\n");
	else
	{
		if((y+r)>H || (y-r)<0)
			printf("No\n");
		
		else
			printf("Yes\n");
	}
	
	return 0;
}

Measured memory_bytes: 584
n,m = map(int,input().split())
L = []
R = []
for i in range(m):
    l,r = map(int,input().split())
    L.append(l)
    R.append(r)
ans = 0
L = max(L)
R = min(R)
for i in range(1,n+1):
    if L <= i and R >= i:
        ans += 1
print(ans)

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

int main() {
  int A, B;
  cin >> A >> B;

  if (A % 2 == 1 && B % 2 == 1){
  	cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,a,b;
	cin>>n;
	cin>>a>>b;
	if(abs(a-b)%2==0){
		cout<<abs(a-b)/2<<endl;
		return 0;
	}else{
		if(min(max(a-1,b-1),max(n-a,n-b))==max(a-1,b-1)){
			cout<<(a+b-1)/2<<endl;
		}else{
			cout<<(n-a+n-b+1)/2<<endl;
		}
		return 0;
	}
	return 0;
} 

Measured memory_bytes: 256
let cnt = ref 0
let (g : int list ref) = ref []

let insertion_sort (a : int array) n g =
  let rec insert j v =
    if j < 0 || a.(j) <= v then a.(j + g) <- v
    else (a.(j + g) <- a.(j); incr cnt; insert (j - g) v)
  in
  let rec doit i =
    if i < n then (insert (i - g) a.(i); doit (i + 1))
  in
  doit g

let generate_g n =
  let rec doit i g lst =
    if g > n then lst
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: lst)
  in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  g := generate_g n;
  let rec doit = function
    | [] -> ()
    | hd :: tl -> (insertion_sort a n hd; doit tl)
  in
  doit !g

let () =
  let n = read_int () in
  let a = Array.make n 0 in
  let rec doit i =
    if i < n then (a.(i) <- read_int (); doit (i + 1))
  in
  doit 0;
  shell_sort a n;
  print_int (List.length !g);
  print_newline ();
  List.iteri (fun i n -> if i <> 0 then print_string " "; print_int n) !g;
  print_newline ();
  print_int !cnt;
  print_newline ();
  Array.iter (fun n -> print_int n; print_newline ()) a

Measured memory_bytes: 12412
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main(){
  int N;
  cin >> N;
  priority_queue<long long> pos, neg;
  for(int i = 0; i < N; ++i){
    long long a;
    cin >> a;
    if(a >= 0) pos.push(-a);
    else neg.push(a);
  }
  vector<pair<long long,long long>> A;
  long long ans = 0;
  if(N == 2 and pos.size() == 2){
    long long p = -pos.top(); pos.pop();
    long long q = -pos.top(); pos.pop();
    cout << q-p << endl;
    cout << q << " " << p << endl;
    return 0;
  }
  while(1){
    //cerr << pos.size() << " " << neg.size() << endl;
    if(pos.size() == 1 and neg.size() == 1){
      A.emplace_back(-pos.top(),neg.top());
      ans = -pos.top()-neg.top();
      pos.pop();neg.pop();
      break;
    }
    if(neg.empty() and pos.size() == 1){
      ans = pos.top();
      break;
    }
    if(pos.empty() and neg.size() == 1){
      ans = neg.top();
      break;
    }
    if(neg.empty()){
      long long p = -pos.top(); pos.pop();
      long long q = -pos.top(); pos.pop();
      A.emplace_back(p,q);
      neg.push(p-q);
    }else if(pos.empty()){
      long long p = neg.top(); neg.pop();
      long long q = neg.top(); neg.pop();
      A.emplace_back(p,q);
      pos.push(p-q);
    }else if(pos.size() > 1){
      long long p = -pos.top(); pos.pop();
      long long q = neg.top(); neg.pop();
      A.emplace_back(q,p);
      neg.push(q-p);
    }else{
      long long p = -pos.top(); pos.pop();
      long long q = neg.top(); neg.pop();
      A.emplace_back(p,q);
      pos.push(-(p-q));
    }
  }
  cout << ans << endl;
  for(auto a : A){
    cout << a.first << " " << a.second << endl;
  }
}


Measured memory_bytes: 4976
import fractions

# N個の最大公約数
# ユークリッド互除法


def good(A, N):
    # A = sorted(A)
    ans = A[0]
    for i in range(1, N):
        ans = fractions.gcd(A[i], ans)
    print(ans)


def my(A, N):
    A = sorted(A)

    while True:
        v = A[0]
        tmp = [v]
        for i in range(len(A)):
            if A[i] % v == 1:
                print(1)
                return
            if A[i] % v == 0:
                pass
            else:
                tmp.append(A[i] % v)

        if len(A) == 1:
            print(A[0])
            return

        A = sorted(tmp)
        # print(A)


def main():
    N = int(input())
    A = list(map(int, input().split()))

    good(A, N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 88428
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		//int N = stdIn.nextInt();
		int N;
		while((N=stdIn.nextInt()) != 0){
			int a=0;
			int count=0;
			for(int i=1;i<N;i++){
				for(int j=i;a<N;j++){
					a += j;
					if(a==N){
						count++;
						break;
					}
					else if(a>N){
						break;
					}
				} 
				a=0;
			}
			System.out.println(count);
		}
	}
}

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

bool hantei(long long x){
	for(long long i=2; i*i<=x; i++){
		if(x%i==0) return 0;
	}
	return x>1;
}

int main(){
	ll n; cin>>n;
	map<ll,ll> m;
	if(hantei(n)){
		cout << 1 << endl;
		return 0;
	}
	else if(n==1){
		cout << 0 << endl;
		return 0;
	}
	else{
		ll b{2};
		while(1){
			if(n%b==0){
				m[b]++;
				n/=b;
				if(n==1) break;
				if(hantei(n)){
					m[n]++;
					break;
				}
			}
			else b++;
		}
	}
	vector<ll> a(10);
	for(int i=1; i<10; i++){
		a.at(i)=a.at(i-1)+i;
	}
	ll ans{};
	for(auto i:m){
		ll e = i.second;
		auto it = upper_bound(a.begin(),a.end(),e);
		ans += it - a.begin()-1;
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 3628
import sys
import math


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


def main():
    N, A, B, C, D = map(int, input().split())
    S = input()
    flag = 0
    b=B
    a =A
    while A < C:
        if flag ==1 and S[A]=="#":
            print("No")
            exit()
        elif S[A] =="#":
            flag =1
        else:
            flag =0

        A +=1

    while B < D:
        if flag ==1 and S[B]=="#":
            print("No")
            exit()
        elif S[B] =="#":
            flag =1
        else:
            flag =0

        B +=1

    if C>D:
        j=b-1
        while j<D:
            if S[j-1]=="." and S[j]=="." and S[j+1]==".":
                print("Yes")
                exit()
            j+=1
        print("No")
        exit()
    else:
        print("Yes")




if __name__ == "__main__":
    main()


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

typedef long long ll;

int n;
ll a[100005];
__int128_t ans;

int main(){

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

    cin>>n;
    ans=1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]==0){
            cout<<0<<endl;
            return 0;
        }
    }
    for(int i=0;i<n;i++){
        ans*=a[i];
        if(ans>1000000000000000000ll){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<(ll)ans<<endl;

    return 0;
}

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

typedef long long ll;

const ll Inf = 1000000000000000ll;
const int Maxn = 100005;

int n;
int a[Maxn];
ll mx[Maxn];
ll res;

int main()
{
    scanf("%d", &n);
    mx[0] = 1;
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        if (a[i] >= mx[i]) { printf("-1\n"); return 0; }
        mx[i + 1] = min(Inf, (mx[i] - a[i]) * 2ll);
    }
    scanf("%d", &a[n]);
    if (a[n] > mx[n]) { printf("-1\n"); return 0; }
    ll cur = a[n]; res += a[n];
    for (int i = n - 1; i >= 0; i--) {
        cur = min(mx[i], cur + a[i]);
        res += cur;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 4828
import sys
from math import log2,floor,ceil,sqrt
# import bisect
# from collections import deque
sys.setrecursionlimit(7*10**4)

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD =  998244353

# for _ in range(int(ri())):
n = int(ri())
s = set()
for i in range(n):
    temp = ri()
    s.add(temp)
print(len(s))


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

signed main(void)
{
	string s;
	int ans;
	bool ok;

	cin >> s;
	ok = true;
	ans = 9 * (s.size() - 1) + (s[0] - '0');
	for(int i = 1; i < s.size(); i++)
	{
		if (s[i] != '9')
			ok = false;
	}
	if (!ok && s.size() != 1) ans--;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;

class Program
{
	static void Main()
	{
		string D;
		while ((D = Console.ReadLine()) != "0 0")
		{
			string s = "";
			string[] sD = D.Split(' ');
			int H = int.Parse(sD[0]), W = int.Parse(sD[1]);
			for (int i = 0; i < W; i++)
			{
				s += "#";
			}
			for (int i = 0; i < H; i++)
			{
				Console.WriteLine(s);
			}
			Console.WriteLine();
		}
	}
}

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



int main(){
    string x;cin>>x;
    stack<int> st;
    ll cn=0;
    rep(i,0,x.size()){
        if(x.at(i)=='S'){
            st.push(1);
        }
        if(x.at(i)=='T'&&!st.empty()){
            st.pop();
            cn++;
        }
    }
    cout<<x.size()-2*cn<<endl;
}







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

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		double a=nextInt();
		double b=nextInt();
		double x=nextInt();

		//平面に変換
		x/=a;
		double ans ;
		if(x>=(a*b)/2){
			ans=Math.atan2((2*(a*b-x)),(a*a))*180/Math.PI;
		}else{
			ans=Math.atan2(b*b,(2*x))*180/Math.PI;

		}

		System.out.printf("%.10f\n",ans);
	}


	public static long[] disassemblyAlph(String s) {
		long[] alph = new long['z' - 'a' + 1];
		Arrays.fill(alph, 0);
		for (int i = 0; i < s.length(); i++) {
			alph[s.charAt(i) - 'a']++;
		}
		return alph;
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define ull unsigned long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mod 1000000007

ll max(ll a,ll b)
{
    if(a>b)
    {
        return a;
    }
    return b;
}

ll min(ll a,ll b)
{
    if(a<b)
    {
        return a;
    }
    return b;
}

ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

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


ll fact(ll n)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
        res = res * i;
    return res;
}

ll nCr(ll n, ll r)
{
    return fact(n) / (fact(r) * fact(n - r));
}

ull bin(ull a, ull b)
{
    ull res = 1;
    while(b)
    {
        if(b&1) res = (res*a)%mod;
        a = ((a%mod)*(a%mod))%mod;
        a %= mod;
        b >>= 1;
    }
    return res%mod;
}

class DSU {
public:
    int n;
    vector<int> parent,size;

    DSU(int a) {
        n = a;
        parent.assign(n,0);
        size.assign(n,0);
        for(int i=0 ; i<n ; i++) {
            parent[i] = i;
            size[i] = 1;
        }
    }

    void makeSets(int k) {
        for(int i=0 ; i<n ; i++) {
            if(find(i) != i) {
                size[i] = 0;
            }
        }
    }

    int find(int a) {
        int root = a;
        while(root != parent[root]) {
            root = parent[root];
        }
        while(root != a) {
            int temp = parent[a];
            parent[a] = root;
            a = temp;
        }
        return root;
    }

    void unionSet(int a, int b) {
        int root_a = find(a);
        int root_b = find(b);
        if(root_a == root_b) return;
        if(size[a] < size[b]) {
            parent[root_a] = root_b;
            size[root_b] += size[root_a];
        }
        else {
            parent[root_b] = root_a;
            size[root_a] += size[root_b];
        }
    }
};

ll sum(ll a[],ll l,ll r)
{
    ll s=0;
    for(int i=l;i<=r;i++)
    {
        s+=a[i];
    }
    return s;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


string s;
cin>>s;
if(s[2]==s[3]&&s[4]==s[5])
{
    cout<<"Yes"<<endl;
} else{
    cout<<"No"<<endl;
}
    return 0;


}

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

#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

using namespace std;

const int size = 1e5 + 10;
vector <ll> adj[size];
int val[size];
int ans = 0;
void addedge(ll from, ll to)
{
    adj[from].pb(to);
}

int dfs(bool isvisited[], ll v)
{
	if (val[v] != -1) return val[v];
	//cout << v << " ";
    isvisited[v] = 1;
    int cnt = 1, mx = 0;
    for (auto x : adj[v])
    {
    	mx = max(mx, dfs(isvisited, x));
    }
    ans = max(ans, cnt + mx);
    //cout << cnt << " ";
    val[v] = cnt + mx;
    return cnt + mx;
}

int main()
{
    fastio;

    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
    	int from, to;
    	cin >> from >> to;
    	addedge(from, to);
    }
    bool isvisited[n + 1];
    memset(isvisited, 0, sizeof(isvisited));
    memset(val, -1, sizeof(val));
    for (int i = 1; i <= n; i++)
    {
    	if (!isvisited[i])
    		dfs(isvisited, i);
    }
    cout << ans - 1;
    return 0;
}




Measured memory_bytes: 8320
#include<stdio.h>
#include<math.h>
#include<string.h>
#define FOR(N) for(int i = 0;i < N;i++)
#define PRN(N) printf("%d\n",N)
#define PRS(S) printf("%s\n",S)

int main(void){
  int n,cnt = 0;
  scanf("%d",&n);
  int a[n];
  FOR(n){
    scanf("%d",&a[i]);
  }
  for(int i = 1;i < n - 1;i++){
    if((a[i - 1] - a[i]) * (a[i] - a[i + 1]) > 0){
      cnt++;
    }
  }
  PRN(cnt);
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node{int p,l,r;};

Node T[MAX];
int n, D[MAX];

void print(int u){
	int i,c;
	cout <<"node "<<u<<": ";
	cout <<"parent = "<<T[u].p<<", ";
	cout <<"depth = "<<D[u]<< ", ";
	
	if(T[u].p==NIL)cout<<"root, ";
	else if(T[u].l==NIL)cout<<"leaf, ";
	else cout<<"internal node, ";
	
	cout<<"[";

	for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
		if(i)cout<<", ";
		cout<<c;
	}
	cout<<"]"<<endl;
}


int rec(int u,int p){
	D[u]=p;
	if(T[u].r!= NIL)rec(T[u].r,p);
	if(T[u].l!= NIL)rec(T[u].l,p+1);
	return 0;
}

int main(){
	int i,j,d,v,c,l,r;
	cin>>n;
	for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
	
	for(i=0;i<n;i++){
		cin>>v>>d;
		for(j=0;j<d;j++){
			cin>>c;
			if(j==0)T[v].l=c;
			else T[l].r=c;
			l=c;
			T[c].p=v;
		}
	}
	for(i=0;i<n;i++){
		if(T[i].p==NIL)r=i;
	}
	rec(r,0);
	
	for(i=0;i<n;i++)print(i);
	
	return 0;
}


Measured memory_bytes: 7772
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    ll n, k;
    cin >> n >> k;
    // for (ll i = 1; i <= n; ++i) {
    //     for (ll j = 1; j <= k; ++j) {
    //         cout << (2 * j + 2 * i - 1) * i << " " << (2 * j + 5 * i - 1) * i / 2 << "\n";
    //     }
    // }
    ll left  = (2 * k + 2 * n - 1) * n;
    ll right = (2 * k + 5 * n - 1) * n / 2;
    if (left > right) {
        cout << -1 << "\n";
        return 0;
    } else {
        vl a(n), b(n), c(n);
        if (n % 2 == 1) {
            for (ll i = 0; i < n; ++i) {
                c[i] = k + 2 * n + i;
            }
            for (ll i = 0; i < n / 2 + 1; ++i) {
                a[i] = k + i * 2;
                b[i] = k + 2 * n - 1 - n / 2 - i;
            }
            for (ll i = 0; i < n / 2; ++i) {
                a[i + n / 2 + 1] = k + 1 + i * 2;
                b[i + n / 2 + 1] = k + 2 * n - 1 - i;
            }
            for (ll i = 0; i < n; ++i) {
                cout << a[i] << " " << b[i] << " " << c[i] << "\n";
            }
            return 0;
        } else {
            for (ll i = 0; i < n; ++i) {
                c[i] = k + 2 * n + i;
            }
            for (ll i = 0; i < n / 2; ++i) {
                a[i] = k + i * 2;
                b[i] = k + 2 * n - n / 2 - i;
            }
            a[n / 2] = k + n - 1;
            b[n / 2] = k + n;
            for (ll i = 0; i < n / 2 - 1; ++i) {
                a[i + n / 2 + 1] = k + 1 + i * 2;
                b[i + n / 2 + 1] = k + 2 * n - 1 - i;
            }
            for (ll i = 0; i < n; ++i) {
                cout << a[i] << " " << b[i] << " " << c[i] << "\n";
            }
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 4608
let rec pow x n = 
  if n = 0
  then 1
  else 
    let res = pow x (n/2) in
    if n mod 2 = 0
    then res * res
    else res * res * x

(* purpose: calulate 26^1 + 26^2 + .. + 26^n *)
(* for convenience, sum 0 = 0 *)
(* sum: int -> int *)
let rec sum n =
  if n = 0
  then 0
  else pow 26 n + sum (n-1)

let digit n =
  let rec iter i =
    if n < sum i
    then i
    else iter (i+1)
  in iter 1

(* purpose : encode n into k-digits alphabet *)
let encode n k =
  let rec iter num i str =
    if i = k+1
    then str
    else 
      let add = Char.chr (Char.code 'a' + (num mod 26)) in
      let new_str = String.make 1 add ^ str in
      iter (num/26) (i+1) new_str
  in iter n 1 ""

let () = Scanf.scanf "%d" @@ fun n ->
  let n = n-1 in
  let k = digit n in
  let n = n - sum (k-1) in
  let ans = encode n k in
  Printf.printf "%s\n" ans

Measured memory_bytes: 3720
N,C,K = list(map(int, input().split()))
T = [int(input()) for _ in range(N)]
T.sort()

i = 0
n_b = 0
n_passenger_on_waiting_bus = 0
departure_limit=-1

while i < N:
  if T[i] > departure_limit or n_passenger_on_waiting_bus == C:
    n_b +=1
    n_passenger_on_waiting_bus = 1
    departure_limit = T[i] + K
  else:
    n_passenger_on_waiting_bus += 1
  i += 1
    
print(n_b)

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


typedef long long ll;

ll a[7];

int main(){
  for(int i = 0; i < 7; i++){
    cin >> a[i];
  }

  ll ans1  = 0, ans2 = 0;

  ans1 += a[1];
  ans2 += a[1];

  if(a[0] % 2 == 0){
    ans1 += a[0];
  }else{
    ans1 += a[0] - 1;
  }

  if(a[3] % 2 == 0){
    ans1 += a[3];
  }else{
    ans1 += a[3] - 1;
  }

  if(a[4] % 2 == 0){
    ans1 += a[4];
  }else{
    ans1 += a[4] - 1;
  }

  if(a[3] >= 1 && a[4] >= 1 &&  a[0] >= 1){
    ans2 += 3;
    a[0]--;
    a[3]--;
    a[4]--;
  }

  if(a[0] % 2 == 0){
    ans2 += a[0];
  }else{
    ans2 += a[0] - 1;
  }

  if(a[3] % 2 == 0){
    ans2 += a[3];
  }else{
    ans2 += a[3] - 1;
  }

  if(a[4] % 2 == 0){
    ans2 += a[4];
  }else{
    ans2 += a[4] - 1;
  }





  cout << max(ans1, ans2) << endl;
}

Measured memory_bytes: 256