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

const int N = 2e5 + 10, mod = 1e9 + 7;

int n;
long long dp[N][2][3];


int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    //scanf("%d", &tc);
    for(int i = 1; i < N; i++) {
        for(int j = 0; j < 3; j++) dp[i][0][j] = dp[i][1][j] = -(1LL << 61);
    }
    while(tc--) {
        scanf("%d", &n);
        int all = (n % 2) + 1;
        bool st = (n / 2) % 2;
        long long ans = dp[1][1][1];
        for(int i = 1; i <= n; i++) {
            int x; scanf("%d", &x);
            if(i - 1 <= all) dp[i][1][i - 1] = x;
            for(int j = 0; j <= all; j++) {
                if(i - 2 - j < 1) break;
                for(int k = 0; k <= all - j; k++) {
                    dp[i][0][j + k] = max(dp[i][0][j + k], dp[i - 2 - j][1][k] + x);
                    dp[i][1][j + k] = max(dp[i][1][j + k], dp[i - 2 - j][0][k] + x);
                }
            }
        }
        for(int i = n - all; i <= n; i++) ans = max(ans, dp[i][st][i - (n - all)]);
        printf("%lld\n", ans);
    }    
    return 0;
}

Measured memory_bytes: 13196
import java.util.*;class Main{public static void main(String[]z){Scanner s=new Scanner(System.in);for (int n,p,i,t,a[];(n=s.nextInt())>0;System.out.println(i))for(a=new int[n],t=p=s.nextInt(),i=-1;a[i=(i+1)%n]<p;)a[i]=t-->0?a[i]+1:0&(t=a[i]);}}

Measured memory_bytes: 20192
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <utility>

using namespace std;

int *uf;
int root(int i) { return (uf[i] < 0 ? i : uf[i] = root(uf[i])); }
int merge(int i, int j) {
    if((i = root(i)) == (j = root(j))) return 0;
    if(uf[j] < uf[i]) swap(i, j);
    uf[i] += uf[j];
    uf[j] = i;
    return 1;
}

int c[200000];
int d[200000];
map <pair <int, int>, int> box;

int main() {
    memset(c, -1, sizeof c);
    memset(d, -1, sizeof d);
    int n, m, k;
    int u, v;
    cin >> n >> m >> k;
    uf = c;
    while(m--) {
        cin >> u >> v;
        merge(--u, --v);
    }
    
    uf = d;
    while(k--) {
        cin >> u >> v;
        merge(--u, --v);
    }
    
    for(int i = 0; i < n; ++i) {
        uf = d;
        int rx = root(i);
        uf = c;
        box[{root(i), rx}] += 1;
    }
    
    for(int i = 0; i < n; ++i) {
        uf = d;
        int rx = root(i);
        uf = c;
        cout << box[{root(i), rx}] << ' ';
    }
    
    return 0;
}

Measured memory_bytes: 16608
#include<stdio.h>
#include<math.h>
int main(void) {
	int n, d;
	scanf("%d %d", &n, &d);
	int x[10][10];
	for (int j = 0; j < n; j++) {
		for (int i = 0; i < d; i++) {
			scanf("%d",&x[j][i] );
		}
	}
	int c = 0;
	int sum = 0;
	double s;
	for (int i = 0; i < n; i++) {
		for (int m = i + 1; m < n; m++) {
			for (int j = 0; j < d; j++) {
				sum +=pow((x[i][j] - x[m][j]), 2);
			}
			s = sqrtf(sum);
			if (ceil(s) == floor(s)) {
				c++;
			}
			sum = 0;
		}
	}
	printf("%d\n", c);
	return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int s[4];
    cin>>s[0];
    cin>>s[1];
    cin>>s[2];
    cin>>s[3];
    cout << fmin(s[0],s[1]) + fmin(s[2],s[3]);
  
}


Measured memory_bytes: 3728
strings = list(input())
before_number = 100000
flag = False
for number in strings:
  #前の番号と今の番号が一致したら
  if before_number == int(number):
    flag = True
  else:
    before_number = int(number)

if flag == True:
  print("Bad")
else:
  print("Good")

Measured memory_bytes: 3060
import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

import sys
sys.setrecursionlimit(10**7)

class RangeMinimumQuery:
    def __init__(self, n):
        self.n0 = 2**(n-1).bit_length()
        self.data = [0]*(2*self.n0)

    def query(self, l,r):
        l += self.n0
        r += self.n0
        res = 0
        while l < r:
            if r&1:
                r -= 1
                res = max(res, self.data[r-1])
            if l&1:
                res = max(res, self.data[l-1])
                l += 1
            l >>=1
            r >>=1
        return res

    def update(self, i, x):
        i += self.n0-1
        self.data[i] = x
        while i:
            i = ~-i//2
            self.data[i] = max(self.data[2*i+1], self.data[2*i+2])


n = int(input())
a = list(map(int, input().split()))
d = {j:i for i,j in enumerate(sorted(set(a)))}
m = len(d)
a = [d[i] for i in a]

G = [[] for i in range(n)]
for i in range(n-1):
    u,v = map(int, input().split())
    u,v = u-1, v-1
    G[u].append(v)
    G[v].append(u)

RMQ = RangeMinimumQuery(m+10)
ans = [0]*n
def dfs(cur, prev):
    ai = a[cur]
    now = RMQ.query(ai, ai+1)
    nxt = max(RMQ.query(0, ai)+1, now)
    RMQ.update(ai, nxt)
    ans[cur] = RMQ.query(0, m+1)
    for to in G[cur]:
        if to != prev:
            dfs(to, cur)
    RMQ.update(ai, now)
dfs(0,-1)

print(*ans, sep="\n")



Measured memory_bytes: 538760
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    int N;
    cin >> N;
    vector<int> L(N);
    REP(i, N) cin >> L[i];

    sort(L.begin(), L.end(), greater<int>());
    
    int ans = 0;
    for (int i=0; i< L.size(); ++i) {
        for (int j=i+1; j<L.size(); ++j) {
            for (int k=j+1; k<L.size(); ++k) {
                if ((L[i] < L[j] + L[k]) && (L[j] < L[i] + L[k]) && (L[k] < L[i] + L[j])) {
                    ans += 1;
                } else {
                    break;
                }
            }
        }
    }
    print(ans);
}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
from collections import deque

S = deque([x for x in input()])
Q = int(input())
switch = 0
for _ in range(Q):
    inp = input()
    if len(inp) == 1:
        T = int(inp)
        if switch:
            switch = 0
        else:
            switch = 1
    else:
        T, F = map(int, inp.split()[:2])
        C = inp.split()[-1]
        if F == 1:
            if switch:
                S.append(C)
            else:
                S.appendleft(C)
        else:
            if switch:
                S.appendleft(C)
            else:
                S.append(C)
if switch:
    print("".join(list(S)[::-1]))
else:
    print("".join(S))


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

namespace TestApp2
{
    class Program
    {
        static void Main()
        {
            var x = int.Parse(Console.ReadLine());
            Console.WriteLine(x/3);
        }
    }

}

Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>

typedef long long ll;

int main() {
	ll a, b, c;
	scanf("%lld%lld%lld", &a, &b, &c);
	ll d = c - a - b;
	if (d>0&&4*a*b<d*d) {
		printf("Yes\n");
	}
	else printf("No\n");

	return 0;
}


Measured memory_bytes: 2088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

const double PI=3.14159265358979323846;

void solve(istream& cin, ostream& cout) {
  int r;
  cin >> r;
  double ans = r * 2 * PI;
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


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

#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ins insert
#define ph push
#define f first
#define s second
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define btinpct(x) __builtin_popcountll((x))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss
string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?b:gcd(b%a,a); }

#define ll long long int 
#define ld long double
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
typedef pair <ll, ll> pi; typedef pair <ll, pi> spi; typedef pair <pi, pi> dpi;

#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
// #define cerr if(0)cout
#define MAXN (300006)
ll n, m;
int main()
{
	FAST
	cin>>n>>m;
	ll ans = 0;
	if(n==1) ans += 3e5;
	else if(n==2) ans += 2e5;
	else if(n==3) ans += 1e5;
	if(m==1) ans += 3e5;
	else if(m==2) ans += 2e5;
	else if(m==3) ans += 1e5;
	if(n==1&&m==1) {
		ans += 4e5;
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <cmath>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
const ll MOD = 998244353;

int main() {
    ll n;
    cin >> n;
    map<ll,ll> S[2];
    vector<ll> m(2,0);
    vector<ll> p(2,0);

    int cur = 0;
    for (ll i = 0; i < n; ++i) {
        ll v;
        cin >> v;
        S[cur][v]++;
        if (m[cur] < S[cur][v]) {
            m[cur] = S[cur][v];
            p[cur] = v;
        }
        cur = 1 - cur;
    }

    if (p[0] != p[1]) {
        cout << n - m[0] - m[1] << endl;
    } else {
        ll v1 = 0, v2 = 0;
        for (auto & s : S[0]) {
            if (s.first != p[0]) {
                v1 = max(v1, s.second);
            }
        }
        for (auto & s : S[1]) {
            if (s.first != p[0]) {
                v2 = max(v2, s.second);
            }
        }
        cout << n - max(m[0] + v2, m[1] + v1) << endl;
    }



}


Measured memory_bytes: 6528
#include<iostream>
using namespace std;
void call(int n){
  int i = 1;
 CHECK_NUM:
  int x = i;
  if ( x % 3 == 0 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
 INCLUDE3:
  if ( x % 10 == 3 ){
    cout << " " << i;
    goto END_CHECK_NUM;
  }
  x /= 10;
  if ( x ) goto INCLUDE3;
 END_CHECK_NUM:
  if ( ++i <= n ) goto CHECK_NUM;
 
  cout << endl;
}
int main(){
    int m;
    cin >> m;
    call(m);
    return 0;
}


Measured memory_bytes: 3084
fun main(args: Array<String>) {
  readLine()
  val p = readLine()!!.split(" ").map(String::toLong)
  var m: Long = p[0]
  var a: Long = 0
  for (i in p) {
    m = Math.min(m, i)
    if (m >= i) {
      a += 1
    }
  }
  println(a)
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string s;
    cin >> s;
    int i = s.find('A');
    reverse(ALL(s));
    int j = s.find('Z');
    OP(s.size() - j - i);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#define MAX(a,b) ((a)>(b)?(a):(b))

int main(void) {
   int N,W;
   scanf("%d %d", &N, &W);
   int L[N][2];
   for (int i = 0; i < N; i++) {
      scanf("%d %d", &L[i][0], &L[i][1]);
   }
   long long int dp[104][100010] ;
   for (int i = 0; i < N + 1; i++) {
     for (int w = 0; w < W + 1; w++) {
        dp[i][w] = 0;
     } 
   }
   for (int i = 0; i < N ; i++) {
     for (int w = 0; w < W + 1; w++) {
        if (w + L[i][0] <= W) {
         dp[i+1][w + L[i][0]] = MAX(dp[i+1][w + L[i][0]], dp[i][w] + L[i][1]);
        }
        dp[i+1][w] = MAX(dp[i+1][w], dp[i][w]);
     } 
   }
   long long int ans = 0;
   for (int w = 0; w < W+1; w++) {
      ans = MAX(ans,dp[N][w]);
   }
   printf("%lld\n",ans);
   return 0;
}


Measured memory_bytes: 81024
#include<stdio.h>

int main()
{
  int N,res=10000000,y=0,i,A[201];
  scanf("%d",&N);
  for(i=0;i<N;i++)
    scanf("%d",&A[i]);
  for(i=0;i<N;i++){
    y=0;
    while(A[i] % 2 == 0){
      A[i] /= 2;
      y++;
    }
    if(y < res)
      res = y;
  }
  printf("%d\n",res);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main()
{
	string s;
  	int a;
  	int i;
  
	cin >> s;
  
 	a=s.size();
  	for(i=0;i<a;i++){
      s[i]='x';
    }
  	cout << s;
	return 0;
}

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

using namespace std;

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

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    ll n = 1;
    vector<ll> v;
    while (n * n <= M) {
        if (M % n == 0) {
            v.push_back(n);
            v.push_back(M / n);
        }
        n++;
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    v.push_back(INF);
    REP(i, v.size()) {
        if (v[i] * N > M) {
            cout << v[i - 1] << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const* argv[])
{

    int a, b, c, x;
    std::cin >> a >> b >> c >> x;

    int count = 0;
    for(int c_i=0; c_i <= c; ++c_i)
    {
        for(int b_i = 0; b_i <= b; ++b_i)
        {
            for(int a_i = 0; a_i <= a; ++a_i)
            {
                if(x == ((a_i * 500) + (b_i * 100) + (c_i * 50)))
                {
                    count++;
                }
            }
        }
    }

    std::cout << count << std::endl;
    return 0;
}

Measured memory_bytes: 256
k = int(input())

a = [list(range(1, 10))]
while True:
    new = []
    for aa in a[-1]:
        mod = aa % 10
        if mod != 0:
            new.append(aa * 10 + mod - 1)
        new.append(aa * 10 + mod)
        if mod != 9:
            new.append(aa * 10 + mod + 1)
    a.append(new)

    if sum([len(aa) for aa in a]) > k:
        break
flat = sorted(sum(a, []))

print(flat[k - 1])


Measured memory_bytes: 14708
k = int(input())

a = 7
counter = 1
flag = 0

for i in range(k):
    r = a%k
    if(r == 0):
        print(counter)
        flag = 1
        break
    else:
        counter += 1
        a = 10*r + 7%k

if(flag == 0):
    print("-1")


Measured memory_bytes: 9108
#encoding:utf-8

N = int(input())
A = [int(i) for i in input().split()]

A.sort(reverse=True)
answer = 0
alice = 0
bob = 0
for i in range(len(A)):
    if i % 2 == 0:
        alice += A[i]
    else:
        bob += A[i]

print(alice-bob)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;

map<string, int> number;
vector<int> source[109];
int cost[109];
string str;

int solve(int x){
  int ans = 0;
  if(source[x].empty())return cost[x];
  for(int i = 0;i < source[x].size();i++){
    ans += solve(source[x][i]);
  }
  return min(cost[x], ans);
}

int main(){
  int n, p, m, k;
  while(1){
    number.clear();
    for(int i = 0;i < 109;i++)source[i].clear();
    cin >> n;
    if(n == 0)return 0;
    for(int i = 0;i < n;i++){
      cin >> str >> p;
      number[str] = i;
      cost[i] = p;
    }
    cin >> m;
    for(int i = 0;i < m;i++){
      cin >> str >> k;
      int num = number[str];
      for(int j = 0;j < k;j++){
	cin >> str;
	source[num].push_back(number[str]);
      }
    }
    cin >> str;
    cout << solve(number[str]) << endl;
  }
}

Measured memory_bytes: 1248
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

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

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, m;
    cin >> n >> m;
    vector<P> v(n);
    rep(i, n){
        int a, b;
        cin >> a >> b;
        v[i] = {a, b};
    }
    sort(ALL(v));

    int ans = 0;
    rep(i, n){
        if(m <= 0){
            continue;
        }
        ans += v[i].first * min(m, v[i].second);
        m -= v[i].second;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
const int mod=1e9+7;
int power(int a,int b) {
	int res=1;
	while(b) {
		if(b&1) res=1ll*res*a%mod;
		b>>=1,a=1ll*a*a%mod;
	}
	return res;
}
int inv(int x) {
	return power(x,mod-2);
}
int n,a[100005],fac[100005],tmp[100005];
int c(int n,int m) {
	if(m>n) return 0;
	return 1ll*fac[n]*inv(fac[m])%mod*inv(fac[n-m])%mod;
}
int main() {
	scanf("%d",&n);
	int x;
	rep(i,1,n) {
		scanf("%d",a+i);
		if(tmp[a[i]]) x=tmp[a[i]]+n-i;
		else tmp[a[i]]=i;
	}
	fac[0]=1;
	rep(i,1,n+1) fac[i]=1ll*fac[i-1]*i%mod;
	rep(i,1,n+1) {
		int ans=(c(n+1,i)+mod-c(x,i-1))%mod;
		printf("%d\n",ans);
	}
	return 0;
}

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

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

vector<int> divisor(int n) {
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    reverse(ret.begin(), ret.end());
    return ret;
}

int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    int x = gcd(a, b);
    vector<int> y = divisor(x);
    cout << y[k - 1] << endl;
    return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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; }

#define DEBUG

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

	vi num;
	rep(i, s.size() - 2)
		num.push_back(stoi(s.substr(i,3)));


	ll ans = INF;
	sort(all(num));
	rep(i, num.size())
	{
		chmin(ans, abs(753 - (ll)num[i]));
	}
	cout << ans << endl;
	return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int N;
  cin >> N;
  vector<int> ds(N);
  REP(i, N) { cin >> ds[i]; }
  int ans = 0;
  REP(i, N) {
    FOR(j, i + 1, N) { ans += ds[i] * ds[j]; }
  }
  cout << ans << endl;

  return 0;
}

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

int main() {
    int N,sum=0;
    cin >> N;

    vector<string> gacha(N);

    for(int i=0;i<N;i++){
        cin >> gacha.at(i);
    }

    sum = N;

    sort(gacha.begin(),gacha.end());

    auto n = unique(gacha.begin(),gacha.end());

    gacha.erase(n,gacha.end());
    
  //  gacha.erase(unique(gacha.begin(),gacha.end(),gacha.end()));

    cout << gacha.size() << endl;

}



Measured memory_bytes: 9592
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string s;
    cin >> s;
    int ret = 0;
    for (int i = 0; i < s.size(); i++) {
        int x = i;
        while (x < s.size() && (s[x] == 'A' || s[x] == 'C' || s[x] == 'G' || s[x] == 'T'))x++;
        ret = max(ret, x - i);
    }
    cout << ret << endl;
    return 0;
}

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

using namespace std;

#undef INT_MIN
#undef INT_MAX
#define LL long long
#define INT_MIN -2147483647
#define INT_MAX 1000000009
#define LL_MIN -9223372036854775807
#define LL_MAX 9223372036854775807

int N,W;
int w[105],v[105];
int dp[105][100010];


int main(){
	cin >> N >> W;
	for(int i=0; i<N; i++){
		cin >> w[i] >> v[i];
	}

	for(int i = 0; i <= N; i++){
		dp[i][0] = 0;
		for(int j = 1; j <= N * 1000; j++){
			dp[i][j] = INT_MAX;
		}
	}

	for(int i = N - 1; i >= 0; i--){
		for(int j = 1; j <= N * 1000; j++){
			dp[i][j] = dp[i + 1][j];
			if(j - v[i] >= 0){
				dp[i][j] = min(dp[i][j], dp[i + 1][j - v[i]] + w[i]);
	//			cout << i << " " << j << " " << dp[i][j] << endl;
			}
		}
	}

	for(int i = N * 1000; i >= 0; i--){
		if(dp[0][i] <= W){
			cout << i << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 41216
N = int(input())
x = []
l = []
for i in range(N):
    x1,l1=[int(i) for i in input().split()]
    x.append(x1)
    l.append(l1)

Range = []

for i in range(N):
  max_i = x[i] + l[i]
  min_i = x[i] - l[i]
  Range.append((min_i,max_i))

Range = sorted(Range, key = lambda x:x[1])

a = 1
for i in range(N-1):
  if Range[a][0] >= Range[a-1][1]:
    a += 1
  else:
    Range.pop(a)

print(a)

Measured memory_bytes: 26888
N = int(input())
S = list(input())

num_W = 0
num_E = 0
for i in range(1,N):
    if S[i] == "E":
        num_E += 1
min_ct = num_W + num_E

for i in range(1,N):
    if S[i-1] == "W":
        num_W += 1
    if S[i] == "E":
        num_E -= 1
    ct = num_W + num_E
    if min_ct > ct:
        min_ct = ct


print(min_ct)


Measured memory_bytes: 5796
mod = 998244353
N,S = map(int,input().split())
A = list(map(int,input().split()))
dp = [[0]*(S+1) for _ in range(N)]
dp[0][0] = 1
if A[0] <= S:
    dp[0][A[0]] = 1
for i in range(1,N):
    for j in range(S+1):
        if j+A[i] <= S:
            dp[i][j+A[i]] += dp[i-1][j]
            dp[i][j+A[i]] %= mod
        dp[i][j] += dp[i-1][j]
        dp[i][j] %= mod
    dp[i][0] += 1
    dp[i][0] %= mod
    if A[i] <= S:
        dp[i][A[i]] += 1
        dp[i][A[i]] %= mod
ans = 0
for i in range(N):
    ans += dp[i][S]
ans %= mod
print(ans)

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

int main(void){
    int w,a,b;
    std::cin >> w >> a >> b;
    int ans = 0;
    if(a+w < b) ans = b-(a+w);
    else{
        if(b+w < a) ans = a-(b+w);
        else ans = 0;
    }
    std::cout << ans;
    return 0;
}



Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

int main() {
	vector<int> vec(3);
	for (int i = 0; i < 3; i++) {
		cin >> vec.at(i);
	}
	sort(vec.begin(), vec.end());
	cout << vec.at(0) << " " << vec.at(1) << " " << vec.at(2) << endl;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  c-=b;
  b-=a;
  if(c==b) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define x first
#define y second

using namespace std;

const double eps = 1e-9;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string ln;
  cin >> n >> ln;
  if (ln.size() <= n) cout << ln;
  else cout << (ln.substr(0, n) + "...");
  return 0;
}


Measured memory_bytes: 3656
/******************************************
* AUTHOR : ARPIT *
* NICK : arpitfalcon *
* INSTITUTION : BIT MESRA *
* Ab m game m hu. *
******************************************/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007 -
#define vll vector<ll>
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define vin                    \
    ll n;                      \
    cin >> n;                  \
    vector<ll> x(n);           \
    for (ll i = 0; i < n; i++) \
    cin >> x[i]
#define vout                   \
    for (ll i = 0; i < n; i++) \
    cout << x[i] << " "
#define T     \
    ll t = 1; \
    cin >> t; \
    while (t--)
#define ain                    \
    ll n, k;                   \
    cin >> n >> k;             \
    ll a[n];                   \
    for (ll z = 0; z < n; z++) \
    cin >> a[z]
#define aout                   \
    for (ll i = 0; i < n; i++) \
    cout << a[i] << " "
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define max4(a, b, c, d) max(a, max3(b, c, d))
#define min4(a, b, c, d) min(a, min3(b, c, d))
#define blink                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double PI = 3.141592653589793238463;

#define forn(i, n) for (ll(i) = 0; (i) < (n); ++(i))
#define for1(i, n) for (ll(i) = 1; (i) <= (n); ++(i))
#define forr(i, n) for (ll(i) = (n)-1; (i) >= 0; --(i))
#define forab(i, a, b, c) for (ll(i) = a; (i) <= (b); (i) += (c))

/*
__builtin_ffs(x)
  Number of set bits: __builtin_popcount(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
*/

int main()
{
    blink
#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    // your code goes here
    long long int d, n;
    cin >> d >> n;

    long long int mult = 1;
    for (int i = 0; i < d; i++)
        mult *= 100;

    if (n % 100 == 0)
        cout << (n + 1) * mult;
    else
        cout << n * mult;

    return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n;
double a, ac;
int main(){
	scanf("%d", &n);
	rep(i,n){
		scanf("%lf", &a);
		ac += 1 / a;
	}
	printf("%.8f\n", 1/ac);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <fstream>
#include <iostream>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define maxim INT_MAX
#define fi first
#define se second

/* 1. If you can't keep solution in mind, then visualize it on a paper.
 * 2. Try to identify the type of problem - DP, Greedy, Graph, Constructive,
 * 	  Prefix/Suffix, Difference Array, BIT/Segment Tree, etc.
 * 3. Look at the problems from different perspectives - reverse the problem,
 * 	  add instead of delete (maybe?)
 * 4. Divide difficult solutions into cases and/or sequences.
 * 5. Use math rules to solve Nested Summation.
 * 6. Optimisation problems are generally solved with DP, greedy, binary search or brute-force.
 * 7. Try fixing a solution then proving we can't do better or worse than that.
 * ------------------------------------------------------------------
 */
 ll n,w;
 ll ar[105];
 ll dp[105][100005];
 ll br[105];
 ll ans=0;
 ll holiday(ll i, ll W)
 {
    if(i==0||W==0)
        return 0;
    if(dp[i][W]!=0)
        return dp[i][W];
    if(ar[i]<=W)
    {
        ans=max(holiday(i-1,W-ar[i])+br[i],holiday(i-1,W));
    }
    else
    {
        ans=holiday(i-1,W);
    }
    return dp[i][W]=ans;
 }
int main()
{
    cin>>n>>w;
    for(ll i=1;i<=n;i++)
        cin>>ar[i]>>br[i];
    memset(dp,0,sizeof(dp));
    ll ans=holiday(n,w);
    cout<<ans<<endl;

}


Measured memory_bytes: 85636
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	static int N;
	static int M;
	static long X;
	static long[] C;
	static long[][] A;
	public static void main(String[] args) throws IOException {
		//		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		//		String W	 = in.readLine();
		//		int num = Integer.parseInt(W.split(" ")[0]);

		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		M = sc.nextInt();
		X = sc.nextInt();
		C = new long[N];
		A = new long[N][M];

		for(int i = 0; i<N; i++) {
			C[i] = sc.nextInt();
			for(int j = 0;j<M ; j++) {
				A[i][j] = sc.nextInt();
			}
		}

		long ans =Long.MAX_VALUE;

		boolean[] tmp = new boolean[N];

		ans = solve(tmp, 0);

		if(ans == Long.MAX_VALUE) {
			ans =-1;
		}
		System.out.println(ans);


	}

	static long solve(boolean[] tmp, int idx) {
		if(idx==N) {
			return evaluatePrice(tmp);
		}else {
			tmp[idx] = true;
			long thisTrue = solve(tmp,idx+1);
			tmp[idx] = false;
			long thisFalse = solve(tmp, idx+1);
			return Math.min(thisTrue,thisFalse );
		}
	}


	static long evaluatePrice(boolean[] tmp) {
		long[] scores = new long[M];

		for(int i=0;i<N;i++) {
			//i札目の本
			if(tmp[i]) {
				//j番目のアルゴリズムを学習
				for(int j=0; j<M;j++) {
					scores[j]+=A[i][j];
				}
			}
		}

		for(long score:scores) {
			if(score<X) {
				return Long.MAX_VALUE;
			}
		}
		//学習できた場合
		long ans = 0;
		for(int i=0;i<N;i++) {
			if(tmp[i]) {
				ans+=C[i];
			}
		}
		return ans;
	}



	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}



}


Measured memory_bytes: 38356
void main() {
	auto N = ri;
	if(N <= 999) {
		"ABC".writeln;
	} else {
		"ABD".writeln;
	}
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

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

int main(){
    using namespace std;
    size_t N, M;
    cin >> N >> M;
    if(M & 1)return 0 & puts("-1");
    vector<vector<unsigned long>> edge(N);
    map<unsigned long, unsigned long> mp;
    for(unsigned long i = 0, a, b; i < M; ++i){
        cin >> a >> b;
        edge[--a].push_back(--b);
        edge[b].push_back(a);
        ++mp[a];
        ++mp[b];
    }
    vector<unsigned long> b(N), vis(N), dep(N);
    unordered_set<unsigned long> st;
    [rec = [&b, &edge, &st, &vis, &dep](auto f, auto now, auto prev, auto d) -> unsigned long{
        vis[now] = 1;
        dep[now] = ++d;
        for(const auto& i : edge[now])if(vis[i]){
            if(dep[i] < d && i != prev){
                b[now] ^= 1;
                cout << now + 1 << " " << i + 1 << endl;
            }
        }else f(f, i, now, d);
        auto ret = b[now];
        if(now != prev){
            cout << (b[now] ? now : prev) + 1 << " " << (b[now] ? prev : now) + 1 << endl;
            (b[now] ? b[now] : b[prev]) ^= 1;
        }
        return ret;
    }](auto start){rec(rec, start, start, 0UL);}(0);
    for(const auto& i : b)assert(!i);
    return 0;
}

Measured memory_bytes: 28800
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N,K; cin>>N>>K;
    vector<int64_t> H(N);
    rep(n,0,N) cin>>H.at(n);

    sort(ToEnd(H));
    int64_t ans=INT64_MAX;
    rep(n,0,N-K+1) ans=min(ans,H.at(n+K-1)-H.at(n));

    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string S;
int ans[105000];

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> S;
    int l = 0;
    int N = S.size();
    S.push_back('R');
    while(l < N) {
        int r = l;
        while(S[r] == 'R') r++;
        int ansl = r - 1;
        int ansr = r;
        while(S[r+1] == 'L') r++;
        for(int i = l; i <= r; i++) {
            if(i % 2 == ansl % 2) ans[ansl]++;
            else ans[ansr]++;
        }
        l = r + 1;
    }
    for(int i = 0; i < N; i++) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 1104
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++)
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define int_maxvalue numeric_limits<int>::max()
int n;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	string a ="" ;
	cin >> a;
	int ans = 700;
	if (a[0] == 'o') { ans += 100; }
	if (a[1] == 'o') { ans += 100; }
	if (a[2] == 'o') { ans += 100; }
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import itertools
n = int(input())
d = list(map(int, input().split()))
combination_takoyaki = list(itertools.combinations(d, 2))
takoyaki = []
for i in combination_takoyaki:
    i_1 = i[0]
    i_2 = i[1]
    power = i_1 * i_2
    takoyaki.append(power)
takoyaki_power = sum(takoyaki)
print(takoyaki_power)

Measured memory_bytes: 3188
#include <stdio.h>
int main(){
	char input[4];
	scanf("%s", &input);//input 100-999
	
	if(input[0]=='7'||input[1]=='7'||input[2]=='7'){
		puts("Yes");
	}
	else{
		puts("No");
	}
	return 0;
}

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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
string s;
vector<ll> A;

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

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

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

  return 0;
}


Measured memory_bytes: 256
def f(n, s, max = 10)
  if n == 1
    #p [max, s]
    if max > s and s != 0
      return 1
    else
      return 0
    end
  elsif (max - 1 + max - n) * n  / 2 < s
    return 0
  else
    result = 0
    for i in (s + n * (n + 1) / 2) / (n + 1)...max
      if i <= s
        #p [n, s, max, i]
        result += f(n - 1, s - i, i)
      end
    end
    return result
  end
end
while (n, x = gets.split(" ").map(&:to_i)) != [0,0]
  puts f(3, x, n + 1)
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
int w[105],n,sum;
int main()
{
//freopen("in.txt","r",stdin);
    cin>>n;
    for(int i=0;i<n;i++) {cin>>w[i];sum+=w[i];}
    for(int i=1;i<n;i++) w[i]+=w[i-1];
    int t=0;
    for(int i=1;i<n;i++){
        if(abs(w[t]-sum/2.0)>abs(w[i]-sum/2.0)) t=i;
    }
    cout<<abs(sum-w[t]-w[t])<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
 
#define MAXC 30
#define MAXN 500
#define INF 2147483647
int N,C;
int W[MAXN+5][MAXN+5],Num[3][MAXC+5];
 
int main(){
    scanf("%d%d",&N,&C);
    for(int i=1;i<=C;i++)
        for(int j=1;j<=C;j++)
            scanf("%d",&W[i][j]);
    for(int i=1;i<=N;i++)
        for(int j=1;j<=N;j++){
            int Color;
            scanf("%d",&Color);
            Num[(i+j)%3][Color]++;
        }
    int Ans=INF,T[3];
    for(T[0]=1;T[0]<=C;T[0]++){
        for(T[1]=1;T[1]<=C;T[1]++){
            if(T[0]==T[1]) continue;
            for(T[2]=1;T[2]<=C;T[2]++){
                if(T[0]==T[2]||T[1]==T[2]) continue;
                int Sum=0;
                for(int p=0;p<3;p++){
                    for(int q=1;q<=C;q++)
                        Sum+=Num[p][q]*W[q][T[p]];
                }
                Ans=min(Ans,Sum);
            }
        }
    }
    printf("%d",Ans);
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
constexpr double PI = acos(-1);

signed main(){

  double a;
  cin>>a;
  cout<<fixed<<setprecision(10);
  cout<< 2*a*PI <<endl;

}

Measured memory_bytes: 3780
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    String s = sc.next();
    int min = Integer.MAX_VALUE;
    for (int i = 0; i + 3 <= s.length(); i++) {
      int n = Integer.parseInt(s.substring(i, i + 3));
      min = Math.min(min, Math.abs(n - 753));
    }
    System.out.println(min);
  }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
using namespace std;
int main(){
string s1,s2,s3;
cin>>s1>>s2>>s3;
s1[0]=toupper(s1[0]);
s2[0]=toupper(s2[0]);
s3[0]=toupper(s3[0]);
cout<<s1[0]<<s2[0]<<s3[0]<<endl;
return 0;
}

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

using namespace std;


int main() {
	string S,T;
	int count = 0;
	cin >> S>>T;
	for (int i = 0; i < S.length(); i++) {
		if (S[i] != T[i]) {
			count++;
		}
	}
	cout << count << endl;
	return 0;
}

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

using namespace std;

template<int mod> class modint {
public:
  int x;
  modint(): x(0) {}
  modint(int a) { x = a % mod; if (x < 0) x += mod; }
  modint &operator+=(modint that) { x = (x + that.x) % mod; return *this; }
  modint &operator-=(modint that) { x = (x + mod - that.x) % mod; return *this; }
  modint &operator*=(modint that) { x = (long long) x * that.x % mod; return *this; }
  modint &operator/=(modint that) { return *this *= that.inverse(); }
  modint operator-() { return modint(-this->x); }
  friend ostream& operator<<(ostream &out, modint m) { return out << m.x; }
  modint inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return modint(u);
  }
#define op(o, p) modint operator o(modint that) { return modint(*this) p that; }
  op(+, +=) op(-, -=) op(*, *=) op(/, /=)
#undef op
#define op(o) bool operator o(modint that) { return x o that.x; }
  op(==) op(!=) op(<) op(<=) op(>) op(>=)
#undef op
};

typedef modint<1000000007> mint;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<mint> p(n);
  mint ans = 0, nfact = 1;
  for (int i = 1; i <= n; i++) {
    nfact *= i;
  }
  vector<mint> sums(n + 1);
  sums[0] = 1;
  for (int i = 1; i <= n; i++) {
    sums[i] = sums[i - 1] + mint(1) / (i + 1);
  }
  for (int i = 0; i < n; i++) {
    p[i] = sums[i] + sums[n - i - 1] - 1;
    ans += p[i] * nfact * a[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1408