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

int main() {
  string S;
  cin >> S;
  if (S.at(0)==S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3)) {
    cout << "Bad" << endl;
  }
  else {
    cout << "Good" << endl;
  }
}

Measured memory_bytes: 256
S = str(input())

tlist = ['dream', 'dreamer', 'erase', 'eraser']

S = S[::-1]
for i in range(len(tlist)):
    tlist[i] = tlist[i][::-1]

k = 0
suc = True
while k < len(S):
    suc2 = False
    for t in tlist:
        if S[k:k+len(t)] == t:
            suc2 = True
            k += len(t)
    if not suc2:
        suc = False
        break

if suc:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int n, h[100005], dp[100005];

int go(int idx){
    if(idx >= n-1)return 0;
    if(dp[idx] != -1)return dp[idx];
    int ans = go(idx+1) + abs(h[idx]-h[idx+1]);
    if(idx + 2 <= n-1){
        ans = min(ans, go(idx+2) + abs(h[idx]-h[idx+2]));
    }
    return dp[idx] = ans;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }
    for(int i = 1; i < n; i++){
        dp[i] = dp[i-1] + abs(h[i-1] - h[i]);
        if(i-2 >= 0){
            dp[i] = min(dp[i], dp[i-2] + abs(h[i-2] - h[i]));
        }
    }
    cout << dp[n-1] << endl;
    //memset(dp, -1, sizeof dp);
    //cout << go(0) << endl;
    return 0;
}

Measured memory_bytes: 1024
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let a: u64 = s.next().unwrap().parse().unwrap();
	let b: u64 = s.next().unwrap().parse().unwrap();
	println!("{}", a * b / gcd(a, b));
}

fn gcd(a: u64, b: u64) -> u64 {
	let mut a = a;
	let mut b = b;
	let mut r;
	loop {
		r = a % b;
		if r == 0 {
			break;
		}
		a = b;
		b = r;
	}
	b
}


Measured memory_bytes: 4352
x, y, a, b, c = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p_ = sorted(p)[-x:]
q_ = sorted(q)[-y:]
s = p_ + q_ + r
s_ = sorted(s)[-(x + y):]

print(sum(s_))


Measured memory_bytes: 24240
#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  if(a%2>0 && b%2>0 && c%2>0){
    cout<<min(a*b,min(b*c,c*a))<<endl;
  }
  else cout<<0<<endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int factor[200]={},tc,i;
	for(i=3;i<=199;i+=2){
		int c=0;
		for(int j=1;j<=i;j++)(i%j==0)&&(c++);
		//cout<<i<<' '<<c<<endl;
		(c==8?factor[i]=factor[i-2]+1:factor[i]=factor[i-2]);
	}
	while(cin>>tc){
		cout<<factor[(tc-1)/2*2+1]<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
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++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
#define PI 3.14159265359
#define dij priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
typedef long long ll;
//
int main(){
  int n;cin>>n;
  vector<vector<int>>v(n,vector<int>(3));
  rep(i,n)cin>>v[i][0]>>v[i][1]>>v[i][2];
  vector<vector<int>> dp(n,vector<int>(3));
  rep(i,3)dp[0][i]=v[0][i];
  rep(i,n-1){
    rep(j,3){
      int b=0;
      rep(k,3){
        if(j==k)continue;
        b=max(b,dp[i][k]);
      }
      dp[i+1][j]=b+v[i+1][j];
    }
  }
  //for(auto e:dp)cout<<e[0]<<" "<<e[1]<<" "<<e[2]<<endl;
  int ans=0;
  rep(i,3){
    ans=max(ans,dp[n-1][i]);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 14048
package main

import (
	"fmt"
)

func main() {
	var N int
	var value int
	var j int = 0

	fmt.Scanln(&N)
	var evenList = make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&value)
		if value%2 == 0 {
			evenList[j] = value
			j++
		}
	}
	count := 0
	for i := 0; i < j; i++ {
		if evenList[i]%3 == 0 || evenList[i]%5 == 0 {
			count++
		} else {
			fmt.Println("DENIED")
			break
		}
	}
	if count == j {
		fmt.Println("APPROVED")
	}
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << x << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  ll ans = 0;
  int I,O,T,J,L,S,Z;

  cin >> I >> O >> T >> J >> L >> S >> Z;

  ans += O;
  
  // I + I = 2;
  // L + J + I = 3;
  // L + L = 2;
  // J + J = 2;

  if(I > 1){
    ans += (I-1)/2 * 2;
    I -= (I-1)/2 * 2;
  }
  if(J > 1){
    ans += (J-1)/2 * 2;
    J -= (J-1)/2 * 2;
  }
  if(L > 1){
    ans += (L-1)/2 * 2;
    L -= (L-1)/2 * 2;
  }
  
  int p = (I >= 2) + (J >= 2) + (L >= 2);
  int q = (I >= 1) + (J >= 1) + (L >= 1);

 
  if(p >= 2 || q != 3){
    ans += p*2;
  }else{
    ans += 3;
  }

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


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

ll gcd(ll a, ll b){
   if (a%b == 0)  return(b);
   else  return(gcd(b, a%b));
}
ll lcm(ll a, ll b){
   return a * b / gcd(a, b);
}



int main(){
    FIN;
    ll a,b,c,d;
    cin >> a >> b >> c >> d;

    ll p1,p2,q1,q2;
    p1 = a/c; if(a%c != 0) p1++;
    p2 = b/c;
    q1 = a/d; if(a%d != 0) q1++;
    q2 = b/d;

    ll p,q;
    p = a/lcm(c,d); if(a%lcm(c,d) != 0) p++;
    q = b/lcm(c,d);

    cout << (b-a+1) - (p2-p1+1) - (q2-q1+1) + (q-p+1) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>
#include <complex>

using namespace std;

int main()
{
	char buf[32];
	int am, pm;
	while (scanf(" %s %d %d", buf, &am, &pm) != EOF)
		printf("%s %d %d\n", buf, am+pm, 200*am+300*pm);

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main () {
	int a,b,c,x;
	cin >> a >> b >> c >> x;
	int count = 0;
	for (int ai = 0; ai <= a; ++ai)
	{
		for (int bi = 0; bi <= b; ++bi)
		{
			for (int ci = 0; ci <= c; ++ci)
			{
				if(x == 500 * ai + 100 * bi + 50 * ci){
					count++;
				}
			}
		}
	}
    cout << count << endl;
}

Measured memory_bytes: 256
from sys import stdin, setrecursionlimit as srl
from threading import stack_size
srl(int(1e9)+7)
stack_size(int(1e8))

def get(i, value, vis):
    if vis[i]:
        return value[i]
    vis[i] = True
    ans = 0
    for j in adj[i]:
        ans = max(ans, 1+get(j, value, vis))
    value[i] = ans
    return ans


n, m = map(int, input().split())
adj = {}
for i in range(n):
    adj[i] = []
for i in range(m):
    x, y = map(int,input().split())
    adj[x-1].append(y-1)
vis = [False for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
    value[i] = get(i, value, vis)
x = 0
for i in value:
    x = max(x, i)
print(x)

Measured memory_bytes: 149148
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 0xccccccc;
const ll LINF = 922337203685477580LL;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int N = 3010;

//head

int n;
int a[N];
ll dp[N][N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  rep(i, n) cin >> a[i];
  rep(i, n+1) rep(j, i) {
    int u = i-j-1;
    if((n-i+u)&1) {
      dp[u][i] = min(dp[u+1][i] - a[u], dp[u][i-1] - a[i-1]);
    }
    else {
      dp[u][i] = max(dp[u+1][i] + a[u], dp[u][i-1] + a[i-1]);
    }
  }
  cout << dp[0][n] << endl;
}

Measured memory_bytes: 49824
#include <stdio.h>
int main(void) {
  int A, B;
  scanf("%d%d", &A, &B);
  if (A >= 13) {
    printf("%d\n", B);
  } else if (6 <= A && A <= 12) {
    B = (B/2);
    printf("%d\n", B);
  } else{
    printf("0\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(){
    int i,sum;
    char x[1000];
    
    while(1){
        sum = 0;
        scanf("%s", x);
        
        if(x[0] == '0'){
            break;
        }
        
        for(i = 0; x[i] != '\0'; i++){
            sum += x[i] - '0';
        }
        printf("%d\n", sum);
    }
    return 0;
}

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

int Pow(int a, int n){
        int b = 1;
        for(int i=0; i<n; i++) b *= a;
        return b;
}


int main()
{
        int N, K;
        cin >> N;
        cin >> K;
        cout << K*Pow((K-1), (N-1));

}

Measured memory_bytes: 256
k = int(input())
memo = [[-1 for i in range(k+1)] for j in range(k+1)]
def gcd(a, b):
    if b == 0:
        return a
    else:
        if memo[a][b] == -1:
            memo[a][b] = gcd(b, a % b)
        return memo[a][b]
ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += gcd(gcd(a,b), c)

print(ans)


Measured memory_bytes: 68796
/*
Look at the star
Look at the shine for U
*/
#include<bits/stdc++.h>
#define ll long long
#define PII pair<int,int>
#define sl(x) scanf("%lld",&x)
using namespace std;
const int N = 1e6+5;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
ll inv(ll b){if(b==1)return 1; return (mod-mod/b)*inv(mod%b)%mod;}
ll fpow(ll n,ll k){ll r=1;for(;k;k>>=1){if(k&1)r=r*n%mod;n=n*n%mod;}return r;}

int main()
{
	double x,y;
	cin >> x >> y;
	printf("%.6lf\n\n",x/y);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String S = sc.next();



        int c = 0;
        switch (S){
            case("RRR"): c=3; break;
            case("SSS"): c=0; break;
            case("RRS"): c=2; break;
            case("SRR"): c=2; break;
            default: c=1; break;
        }



        System.out.println(c);

    }
}

Measured memory_bytes: 35628
unittest
{
	assert( [ "3 5" ].parse.expand.solve == 0 );
	assert( [ "7 5" ].parse.expand.solve == 10 );
	assert( [ "6 6" ].parse.expand.solve == 10 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto xa = input.front.split.to!( long[] );
	return tuple( xa[ 0 ], xa[ 1 ] );
}

auto solve( long x, long a )
{
	return ( x < a ) ? 0 : 10;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  char s;
  cin >> s;
  if (s == 'a' || s == 'i' || s == 'u' || s == 'e' || s == 'o') cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define INF 100000000
#define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
ll mod = 1000000007;
ll mod2 = 998244353;

int main(){
    vector<pair<int,int>> ans;
    while (true){
        int b;cin>>b;
        b*=2;
        if (b==0) break;
        pair<int,int> p;
        p.first = 0;
        for(int i=1;i<sqrt(b)+2;i++){
            if (b%i==0 && i<=b/i && ((i+b/i)%2==1)){
                int n = (b/i-1+i)/2;
                int m = (b/i-1-i)/2;
                if (p.first<n-m){
                    p.first = n-m;
                    p.second = m+1; 
                }
            }
        }
        ans.push_back(p);
    }
    for (pair<int,int> x:ans){
        cout<<x.second<<" "<<x.first<<endl;
    }
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define all(c) c.begin(),c.end()
#define sz(c) ((int)c.size())
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;

signed main() {
    double d;
    cin >> d;
    double sqrt2 = sqrt(2);
    double ans = sqrt2 * d;
    rep(x2, 0, 11) {
        double tmp = d * d - x2 * x2;
        if (tmp < 0) continue;
        double y1y2 = sqrt(tmp);
        double t = x2 + (y1y2 < 1 ? 1 : y1y2);
//        cerr << x2 << " :: " << y1y2 << "--> " << t << endl;
        ans = max(ans, t);
    }
    cout << fixed << setprecision(20) << ans << endl;
}



Measured memory_bytes: 3284
n = int(input())
p = 0

for i in range(n + 1)[1::2]:
    c = 0
    j = i
    k = i
    while j > 0:
        if k % j == 0:
            c += 1
        j -= 1
    if c >= 8:
        p += 1

print(p)

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

using namespace std;
using ll = long long;

int main() {
  string S;
  cin >> S;
  ll o = 0;
  for (int i = 0; i < S.size(); ++i) {
    if(S[i]=='0')
      o++;
  }
  ll l = S.size()-o;
  if(l>o)
    cout << o*2;
  else
    cout << l*2;
}


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

int main(){
    int N,M;
    cin>>N>>M;
    int c=0;
    int m[N];
    vector< pair<int,int> > l(M);
    fill(m,m+N,0);
    for(int i=0;i<M;i++){
        pair<int,int> p;
        cin>>p.first>>p.second;
        l[i]=p;
    }
    sort(l.begin(),l.end(),[](const pair<int,int>& x, const pair<int,int>& y){return x.second<y.second;});
    for(auto itr=l.begin();itr!=l.end();itr++){
        auto q=find(m-1+itr->first,m-1+itr->second,1);
        if(q==m-1+itr->second){m[-2+itr->second]=1;c++;}
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int a;
	cin>>a;
	while(a!=0)
	{
		if(a%10==9)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		a/=10;
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1LL<<50)
using namespace std;
typedef long long ll;
ll a[52],b[52];
ll n,m;
ll mem[52][52][52][52][2][3],used[52][52][52][52][2][3];
  
ll cal(ll arr[],int s,int g){
  ll res=0;
  while(s<g) res+=arr[s++];
  return res;
}
  
int saiki(int x,int y,int turn,int pass,int A,int B,ll sum){
  int nt=!turn;
  ll res,res2;
  res=res2=turn?INF:-INF;
  
  if(pass==3)return sum+(cal(a,A,x)-cal(b,B,y)); 
  
  if(used[x][y][A][B][turn][pass])return sum+mem[x][y][A][B][turn][pass];
  used[x][y][A][B][turn][pass]=1;
  
  if(x<n&&turn==0){
    if(!a[x]) res=saiki(x+1,y,nt,0,A,y,sum);
    else res=saiki(x+1,y,nt,0,A,B,sum);
  }
  if(y<m&&turn==1){
    if(!b[y])res=saiki(x,y+1,nt,0,x,B,sum);
    else res=saiki(x,y+1,nt,0,A,B,sum);
  }
   
  
  res2=saiki(x,y,nt,pass+1,x,y,sum+(cal(a,A,x)-cal(b,B,y)));  
  if(turn==0) res=max(res,res2);
  if(turn==1) res=min(res,res2);
  mem[x][y][A][B][turn][pass]=res-sum;
  return res;
}
  
int main(){
  cin>>n>>m;
  for(int i=0;i<n;i++) cin>>a[i],a[i]=max(0LL,a[i]);
  for(int i=0;i<m;i++) cin>>b[i],b[i]=max(0LL,b[i]);
  cout <<saiki(0,0,0,0,0,0,0)<<endl;  
  return 0;
}

Measured memory_bytes: 243700
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    ll k,n;
    cin>>k>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) cin>>a[i];

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

    ll ans = a[n-1] - a[0];

    for(int i=0;i<n-1;i++){
        ans = min( ans, k-a[i+1] + a[i] );
    }

    cout<<ans<<endl;
}

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

#include <vector>
#include <cmath>
#include <limits>
#include <functional>
using namespace std;

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

    vector<int> vec(51);
    for (int i = 0; i < N; i++)
        cin >> vec[i];
    sort(vec.begin(), vec.end(), greater<int>()); // 降順（大きい順）でソー
    for (int i = 0; i < K; i++)
    {
        ans += vec[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>	// require printf
//#include <fstream>	// require freopen

using namespace std;

int main()
{
//	cut here before submit 
//	freopen("testcase.se2", "r", stdin);
	double a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f ){
		x = (c*e - b*f) / (a*e - b*d);
		y = (a*f - c*d) / (a*e - b*d);
		if (x == -0. ){
			x = 0.;
		} // end if
		if (y == -0. ){
			y = 0.;
		} // end if
		
		printf ("%.3lf %.3lf\n", x, y );
	} // end loop
		
	return 0;
}

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

#define fori(i, a, b) for (int i = a; i < b; ++ i)
#define fori2(i, a, b) for (int i = a; i <= b; ++ i)
#define ford(i, a, b) for (int i = a; i >= b; -- i)

using namespace std;

typedef long long ll;

const int N = 2e5;

int n;

vector <int> adj[N];

pair <int, int> visit(int u, int u2) {
		pair <int, int> ans;

		ans.first = 0;
        ans.second = u;

		pair <int, int> a;

		for (int v: adj[u]) {
                if (v == u2)
                        continue;

                a = visit(v, u);
                if (a.first + 1 > ans.first) {
                        ans.first = a.first + 1;
                        ans.second = a.second;
                }
		}

		return(ans);
}

void process() {
		cin >> n;

		fori(i, 0, n - 1) {
				int u, v;

				cin >> u >> v;

				-- u;
				-- v;

				adj[u].push_back(v);
				adj[v].push_back(u);
		}

		int ans, v;

		v = visit(0, -1).second;

		ans = visit(v, -1).first;

		if (ans % 3 == 1) {
				cout << "Second";
				return;
		} else {
				cout << "First";
				return;
		}
}

int main() {
        ios::sync_with_stdio(false);
        process();
}



Measured memory_bytes: 23680
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a[] = new int[4];
		int b[] = new int[2];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		a[3] = sc.nextInt();
		b[0] = sc.nextInt();
		b[1] = sc.nextInt();
		Arrays.sort(a);
		Arrays.sort(b);
		System.out.println(a[1]+a[2]+a[3]+b[1]);
	}
}

Measured memory_bytes: 26124
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    K, N = read_ints()
    A = read_ints()
    distance = K-(A[0]+(K-A[N-1]))
    for i in range(N-1):
        distance = min(distance, K-(A[i+1]-A[i]))
    return distance


if __name__ == '__main__':
    print(solve())


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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

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

	int k,s;
	cin>>k>>s;
	int ans=0;
	REP(i,k+1){
		REP(j,k+1){
			if(0<=s-i-j&&s-i-j<=k)ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define fastio ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define display(v) for (auto x : v) cout << x << ", "
#define print(x) cout << (#x) << " = [ ";display(x); cout << "]\n"
#define endl '\n'
#define pb push_back
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
 
// DEBUG TEMPLATE by livw
void __print(int x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifdef INCLUDEWHENOFFLINE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int main()
{
    fastio;
    
    int n;
    cin >> n;
    int dp[n + 1][3];
    int arr[n][3];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for (int i = 1; i <= n; i++)
    {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + arr[i - 1][0];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + arr[i - 1][1];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + arr[i - 1][2];
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2]));
    return 0;
}



Measured memory_bytes: 2560
//by tzupengwang™
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<iostream>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;

int n, m;
map<int, int> mp;

void init() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i ++) {
    int x;
    scanf("%d", &x);
    if (!mp.count(x)) mp[x] = 0;

    mp[x] ++;
  }
}

void process() {
  int ans = 0;
  vector<int> v;
  for (ii x : mp) {
    v.push_back(x.second);
  }
  sort(v.begin(), v.end());
  int pt = 0;
  while ((int)v.size() - pt > m) {
    ans += v[pt];
    pt ++;
  }
  printf("%d\n", ans);
}

int main() {
/*
#ifdef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
  int Cases;
  scanf( "%d" , &Cases ) ;
  for ( int cases = 1 ; cases <= Cases ; cases ++ ) {
*/
    init() ;
    process() ;
/*
  }
*/
  return 0 ;
}


Measured memory_bytes: 10748
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
  int N;
  cin>>N;
  if (N == 1) {
    cout<<"Hello World"<<endl;
  } else {
    int A,B;
    cin>>A>>B;
    cout<<A+B<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import math
n=int(input())
a=int(math.log10(n))
i=0
p=0
while i<a:
    if i%2==0:
        p+=9*10**i
    i+=1
if a%2==0:
    print(p+n-10**a+1)
else:
    print(p)
    

Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int check_dev9 = 0;
		for(int i=0;i<N.length();i++) {
			check_dev9 = check_dev9 + (int)(N.charAt(i) - '1' +1);
		}

		if(check_dev9 % 9 == 0) {
			System.out.println("Yes");

		}else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 31144
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MAXK 100010
ll ceilk(ll n, ll d) {
	if ((n % d) == 0LL) 
		return n/d;
	return (n/d) + 1LL;
}
int k; 
ll a[MAXK], gmin[MAXK], gmax[MAXK];
int main() {
	cin >> k;
	for (int i=1; i<=k; i++) {
		cin >> a[i];
	}
	if (a[k] != 2) {
		cout << -1 << endl;
		return 0;
	}
	gmin[k] = 2;gmax[k] = 3;
	for (int i=k-1; i>=1; i--) {
		ll cmin = a[i]*ceilk(gmin[i+1],a[i]), cmax = a[i]*(gmax[i+1]/a[i] + 1LL) - 1LL;
		if (a[i] > gmax[i+1])  {
			cout << -1 << endl;
			return 0;
		}
		else if (a[i]*(gmax[i+1]/a[i]) < gmin[i+1]) {
			cout << -1 << endl;
			return 0;
		}
		gmin[i] = cmin;gmax[i] = cmax;
	}
	cout << gmin[1] << " " << gmax[1] << endl;
	return 0;
}

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

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}
//void chmax(ll &a,ll b){	if(a<b) a = b ;}
//void chmin(ll &a,ll b){ if(a>b) a = b ;}
void strmax(string &a,string &b){
    if(a.size()<b.size()) a = b ;
    else if(a.size()==b.size()){
        for(int i=(int)a.size()-1;i>=0;i--){
            if(a[i]>b[i]) break ;
            if(a[i]<b[i]){
                a = b ;
                break ;
            }
        }
    } 
}

int main(){
    ll n,m ;
    cin >> n >> m ;
    vll cnt = {0,2,5,5,4,5,6,3,7,6} ;
    for(int i=0;i<m;i++){
        ll a ; cin >> a ;
        cnt[a] -= INF ;
    }
    for(int i=0;i<10;i++) cnt[i] += INF ;
    vector<string> dp(n+1,"") ;
    for(int i=1;i<=n;i++){
        string s = "" ;
        for(int j=1;j<10;j++){
            if(cnt[j]>i) continue ;
            if(i-cnt[j]!=0&&dp[i-cnt[j]]=="") continue ;
            s = dp[i-cnt[j]]+(char)(j+'0') ;
            strmax(dp[i],s) ;
        }
    }
    string ans = dp[n] ;
    reverse(all(ans)) ;
    cout << ans << endl ;
    // for(int i=1;i<=n;i++){
    //     cout << i << " : " << dp[i] << endl ;
    // }
}

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


int n;
int binary_search(vector<int> a,int key,int n)
{
    int low,high,middle;
    low = 0;
    high = n - 1;

    while(low <= high){
        middle = (low + high)/ 2;
        if(key == a[middle])
        return a[middle];
        else if(key < a[middle])
        high = middle - 1;
        else
        {
            low = middle + 1;
        }
        
    }
    return -1;
}
int main(){
    cin >> n; int count = 0;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    int b;
    cin >> b;
    int c;
    for(int i = 0; i < b; i++){
        cin >> c;
    int found = binary_search(a,c,n);
    if(found > -1){
        count++;
    }
    }
    cout << count << endl;
}


Measured memory_bytes: 3568
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define INF 1000000000
 
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int main() {
	int a, b;
	long ans = 0;
	long i, j;
	
	scanf("%d %d", &a, &b);
	
	if(a <= 0 && b >= 0) {
		printf("Zero\n");
		return 0;
	}
	
	if(a > 0) {
		printf("Positive\n");
	} else {
		if((abs(a) - abs(b))%2) {
			printf("Positive\n");
		} else {
			printf("Negative\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
const int dy[]={0,-1,0,1,1,-1,-1,1};
const int dx[]={1,0,-1,0,1,1,-1,-1};

int dp[1010][1010];
int main() {
	int h, w; cin >> h >> w;
	rep(i,h)rep(j,w) dp[i][j] = INF;
	int sy, sx; cin >> sy >> sx;
	--sy, --sx;
	int gy, gx; cin >> gy >> gx;
	--gy, --gx;
	char c[h][w];
	rep(i,h)rep(j,w) cin >> c[i][j];
	deque<tuple<int, int, int>> que;
	que.emplace_back(sy, sx, 0);
	dp[sy][sx] = 0;
	while(not que.empty()) {
		auto[y, x, co] = que.front();
		que.pop_front();
		for(int i = 0; i < 4; ++i) {
			int ny = y + dy[i];
			int nx = x + dx[i];
			if(ny < 0 or h <= ny) continue;
			if(nx < 0 or w <= nx) continue;
			if(c[ny][nx] == '#') continue;
			if(co < dp[ny][nx]) {
				dp[ny][nx] = co;
				que.emplace_front(ny, nx, co);
			}
		}
		for(int dy = -2; dy <= 2; ++dy) {
			for(int dx = -2; dx <= 2; ++dx) {
				int ny = y + dy;
				int nx = x + dx;
				if(ny < 0 or h <= ny) continue;
				if(nx < 0 or w <= nx) continue;
				if(c[ny][nx] == '#') continue;
				if(co + 1 < dp[ny][nx]) {
					dp[ny][nx] = co + 1;
					que.emplace_back(ny, nx, co + 1);
				}
			}
		}
	}
	cout << (dp[gy][gx] == INF ? -1 : dp[gy][gx]) << '\n';
	return 0;
}

Measured memory_bytes: 8560
aryPrm = gets.split
strComparisonOperator = ""
if aryPrm[0].to_i < aryPrm[1].to_i
    strComparisonOperator = "<"
elsif aryPrm[0].to_i == aryPrm[1].to_i
    strComparisonOperator = "=="
else
    strComparisonOperator = ">"
end
puts "a #{strComparisonOperator} b"

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

int main() {
  int N;
  cin >> N;
  vector<string> a(N); 

  for (int i = 0; i < N; i++) 
    cin >> a.at(i);

  int M;
  cin >> M;
  vector<string> b(M); 

  for (int j = 0; j < M; j++) 
    cin >> b.at(j);

  int c = 0;
  for (int i = 0; i < N; i++) {
     int num =0;
     for (int k = 0; k < N; k++) {
         if (a.at(i)==a.at(k))
            num++;
     }
     for (int j = 0; j < M; j++) {    
         if (a.at(i)==b.at(j))
            num--; 
     }
  if (num>=c)
         c=num;
  }
  cout << c << endl;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (true) {
			int n = in.nextInt();
			if(n==0) break;
			ArrayList<ArrayList<Character>> head = new ArrayList<>();
			String[] body = new String[n];
			for (int i = 0; i < n; i++) {
				head.add(new ArrayList<Character>());
				String txt = in.next();
				int j = 0;
				while (txt.charAt(j) == '.') {
					head.get(i).add(' ');
					j++;
				}
				body[i] = txt.substring(j);
			}

			for (int i = 0; i < n; i++) {
				ArrayList<Character> line = head.get(i);
				int col = line.size() - 1;
				if (line.size() == 0)
					continue;
				line.set(col, '+');
				int j = i - 1;
				while (head.get(j).size() - 1 > col) {
					head.get(j).set(col, '|');
					j--;
				}
			}

			for (int i = 0; i < n; i++) {
				ArrayList<Character> line = head.get(i);
				for (int j = 0; j < line.size(); j++) {
					System.out.print(line.get(j));
				}
				System.out.println(body[i]);
			}
			System.gc();
		}
	}
}

Measured memory_bytes: 77468
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,x,y,z,p,q;
    ll n,m,tmp;
    string s[200000];
    string str;
    ll sum=0;
    ll strr[200005];
    cin>>n>>m;
    if(n>m){
        rep(i,n){
            cout<<m;
        }
    }else{
        rep(i,m){
            cout<<n;
        }
    }
    ln;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;

ll gcd( ll a, ll b ){//最大公約数
    ll tmp;
    if( a < b ) { tmp = a; a = b; b = tmp; }
    if( b < 1 ) return -1;

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

ll lcm(ll a, ll b){//最小公倍数
    return a * b / gcd(a, b);
}


//入力

int main(){

    int a, b;
    cin >> a >> b;

    cout << 6 - a - b << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	
	if(a%3 == 0 || b%3 == 0 || (a+b)%3 == 0) {
		printf("Possible\n");
	}
	else {
		printf("Impossible\n");
	}
	
	return 0;
}

Measured memory_bytes: 128
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		String text = scan.next();
		LinkedList<Character> tikei = new LinkedList<Character>();
		LinkedList<Integer> underpos = new LinkedList<Integer>();
		ArrayList<Integer> leftpos = new ArrayList<Integer>();
		ArrayList<Integer> leftmenseki = new ArrayList<Integer>();
		ArrayList<Integer> mizuHyouji = new ArrayList<Integer>();
		int mizuAmount = 0;
		int allMizuArea = 0;
		int kyori = 0;
		int area= 0;


		for(int textpos=0; textpos<text.length(); textpos++){
			tikei.addLast(text.charAt(textpos));
		}
		//??????????????????????????§??°?????????
		for(int textpos=0; textpos<text.length(); textpos++){

//			?????????????????§?¨?????¨????????????????
			if(tikei.get(textpos) == '\\' ){
				underpos.addLast(textpos);
				leftpos.add(textpos);
				leftmenseki.add(0);
			}
			
//			?????????????????¢???????¨?????????????
			else if(tikei.get(textpos) == '/' ){
//					??????????????????=??????????±±?????´???
				if(underpos.size() == 0){
//						System.out.println("???????????????????????????????????????");
				}
				else{
//						"???"??¨?????±??????"???"???????????¢ -1 ??§??????????????¢??????????????? ???????????§?¨???¨??¢???????¨???????????????????
					kyori = textpos;
					int leftnaname = underpos.pollLast();
					kyori -= leftnaname;
					area = kyori ;
					int ser = leftpos.indexOf(leftnaname);
					leftmenseki.set(ser,area);
				}
			}
//			??´?????????????????????
			else if(tikei.get(textpos) == '_' ){
			}
		}
		int x=0;
		//
		for (int i=0;i<leftpos.size();i++){
			area = 0;
			if(leftmenseki.get(i) == 0){
			}
			else if (x <leftpos.size()){
					//?°´???????????????????????§??????
					while(true){
						//?¨?????????????????????????????????¢???????¶??????????????????????????????????????????????????????????????????§?¨???§????????????????°´???????????????
						if((leftmenseki.get(i))+(leftpos.get(i)) >= leftpos.get(x)){
//							System.out.println("?°´?????????????????¢???????¶????");
							area += leftmenseki.get(x);
							x++;
							if(x == leftpos.size()){
								break;
							}
						}
						else{
//							System.out.println("?°´??????????????????");
							break;
						}
					}
				
			}
//			//??¢??????0????????§????????????????°´??????????????£?????´???????¨??????????
			if(area != 0.0){
				mizuAmount += 1;
				allMizuArea += area;
//				System.out.println("???????°´???????????¢?????? "+area);
				mizuHyouji.add(area);
			}
		}
		
		
		
//		System.out.println("????????° "+mizuAmount);
//		System.out.println("?????¢?????? "+allMizuArea);
		System.out.println(allMizuArea);
		System.out.print(mizuAmount);
		for(int i=0; i<mizuHyouji.size();i++){
			System.out.print(" "+mizuHyouji.get(i));
		}
		System.out.println("");
	}
}

Measured memory_bytes: 30380
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll MOD = 1000000007;
int main() {
  int A, B;
  cin >> A >> B;
  int num = 1;
  int id = 0;
  while (num < B) {
    num--;
    id++;
    num += A;
  }
  cout << id << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     PI                       acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
void GO(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
const int N=200000+9,mod=1e9+7;
ll a[N],b[N];
int vis1[N],vis2[N];
priority_queue< pair<int,int> > pq;
pair<int,int> get_sec(){

  pair<int,int> tmp = pq.top();
  pq.pop();
  pair<int,int> ret= pq.top();
  pq.pop();
  pq.push(tmp);
  return ret;
}
int main(){
    GO();

    int T;
  //  cin>>T;
    T=1;
    while(T--){
        int n;
        cin>>n;

        for(int i=0;i<n;i++) cin>>a[i],vis2[a[i]]++;

        for(int i=0;i<n;i++){
            int no;
            cin>>no;
            vis1[no]++;
        }
        for(int i=1;i<=200000;i++){
            if(vis1[i]){
                pq.push(mp(min(vis1[i],vis2[i]),i));
            }
        }
        for(int i=0;i<n;i++){
            int num= pq.top().second;
            int cnt= pq.top().first;
            if(num!=a[i]){
                pq.pop();
                b[i]=num;
                vis1[num]--;
                int nw_cnt= min(vis1[num],vis2[num]);
                if(vis1[num]){
                    pq.push(mp(nw_cnt,num));
                }
            }
            else if(sz(pq)>1){
                pair<int,int> p= get_sec();
                num= p.second;
                cnt=p.first;

                b[i]=num;
                vis1[num]--;
                int nw_cnt= min(vis1[num],vis2[num]);
                if(vis1[num]){
                    pq.push(mp(nw_cnt,num));
                }
            }
            else{
                cout<<"No\n";
                return 0;
            }
            vis2[a[i]]--;
        }
        cout<<"Yes\n";
        for(int i=0;i<n;i++) cout<<b[i]<<" ";
        cout<<"\n";
    }

}





















































































































































































Measured memory_bytes: 9332
#include "bits/stdc++.h"

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

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


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

int main() {
  int a1,b1,a2,b2;
  cin>>a1>>b1>>a2>>b2;
  if (a1!=a2&&b2==1) cout<<1<<endl;
  else cout<<0<<endl;
}

Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())

S = set()

for i in range(N):
    S.add(input())

print(len(S))

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

string S;
string T;
int dp[3010][3010];
int snum;
int tnum;

int main()
{
    cin >> S >> T;
    for(int i = 0; i < 3010; i++)for(int j = 0; j < 3010; j++) dp[i][j] = 0;
    snum = S.size();
    tnum = T.size();
    for(int i = 0; i < snum; i++)
    {
        for(int j = 0; j < tnum; j++)
        {
            if(S[i] == T[j])
            {
                dp[i + 1][j + 1] = dp[i][j] + 1;
            }
            else
            {
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
            }       
        }
    }
    
    string res = "";
    int d = dp[S.size()][T.size()];
    int s = S.size();
    int t = T.size();

    while (true)
    {
        if(d == 0) break;
        if(dp[s - 1][t] == d) s--;
        else if(dp[s][t - 1] == d) t--;
        else
        {
            res += S[s - 1];
            s--, t--, d--;
        }
    } 

    for(int i = res.size() - 1; i >= 0; i--)
    {
        cout << res[i];
    }
    cout << endl;
}

Measured memory_bytes: 35712
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<set>
#include<map>
#include<random>
#include<functional>
#include<utility>

typedef long long ll;

#define rep(i,n) for(int i=0; i<n; i++)
#define pb push_back
#define P pair<int, int>
#define PLI pair<ll, int>
#define PLL pair<ll, ll>
#define VI vector<int>
#define VII vector<VI>

using namespace std;


const int INF = 1e9;

struct edge
{
	int to;
	bool ex = true;
	edge(int t) :to(t){}
};

int N, M, Q;
int u[200005], v[200005], R[200005];
int cost[100005], indeg[100005];
vector<edge> G[100005];
queue<int> que;
int main() {
	cin >> N >> M >> Q;
	rep(i, M) {
		cin >> u[i] >> v[i];
		u[i]--; v[i]--;
		G[u[i]].emplace_back(v[i]);
		G[v[i]].emplace_back(u[i]);
	}
	rep(i, Q) cin >> R[i], R[i]--;

	rep(i, N) cost[i] = INF;
	cost[0] = 0;
	que.push(0);
	while (!que.empty())
	{
		int now = que.front(); que.pop();
		for (int i = 0; i < G[now].size(); i++) {
			int to = G[now][i].to;
			if (cost[to] == cost[now] || cost[to] + 1 == cost[now])  G[now][i].ex = false;
			if (cost[to] == cost[now] + 1) indeg[to]++;
			if (cost[to] != INF) continue;
			cost[to] = cost[now] + 1;
			indeg[to]++;
			que.push(to);
		}
	}
	rep(i, M) {
		if (cost[u[i]] > cost[v[i]]) swap(u[i], v[i]);
	}

	indeg[0] = 1;
	int cnt = 0;
	rep(i, Q) {
		int r = R[i];
		if (cost[u[r]] == cost[v[r]] || indeg[u[r]] == 0 || indeg[v[r]] == 0) {
			cout << cnt << endl;
			continue;
		}
		for (int j = 0; j < G[u[r]].size(); j++) {
			if (G[u[r]][j].to != v[r]) continue;
			G[u[r]][j].ex = false;
			break;
		}
		que.push(v[r]);
		while (!que.empty())
		{
			int now = que.front(); que.pop();
			indeg[now]--;
			if (indeg[now] != 0) continue;
			cnt++;
			for (auto e : G[now]) {
				if (e.ex == false) continue;
				if (indeg[e.to] == 0) continue;
				que.push(e.to);
			}
		}
		cout << cnt << endl;
	}

	return 0;
}



Measured memory_bytes: 14944
'use strict'

function main(input) {
    input = input.split(/\n|\s/).map(v => ~~v)

    let ans = 'No'
    if (input[1] >= input[0] % 500) ans = 'Yes'

    console.log(ans)

}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
static long long dp[102][100002];
ll fun(vector<pair<ll,ll>> &a,ll w,ll n){
	if(n<=0 or w<=0) return 0;
	if(dp[n][w]!=-1) return dp[n][w];
	ll ans;
	if(w>=a[n-1].first) 
	ans=max(fun(a,w,n-1),fun(a,w-a[n-1].first,n-1)+a[n-1].second);
	else
	ans=fun(a,w,n-1);
	dp[n][w]=ans;
	return ans;
}
int main(){
	ll n,w; cin>>n>>w;
	memset(dp,-1,sizeof dp);
	vector<pair<ll,ll>> a(n);
	for(int i=0;i<n;i++) cin>>a[i].first>>a[i].second;
	cout<<fun(a,w,n)<<endl;
}

Measured memory_bytes: 80000
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


int main(){
    int a,b;cin >>a >> b;
    if(a<=9&&b<=9) cout << a * b << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc052/tasks/arc067_a
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
const int MOD = 1e9 + 7;

// 素因数分解
map<ll, int> enumpr(ll n) {
    map<ll, int> V;

    for (int i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            V[i]++;
            n /= i;
        }
    }
    if (n > 1)
        V[n]++;
    return V;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    map<ll, int> a;
    FOR(i, 1, n + 1) {
        auto t = enumpr(i);
        for (auto &x : t) {
            a[x.first] += x.second;
        }
    }
    ll sum = 1;
    for (auto &x : a) {
        sum *= (x.second + 1);
        sum %= MOD;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll mod = 1000000007;
int main(){
    int n,counter,ans;
    cin >> n;
    counter = 0;
    ans = 0;
    vector<P> vec(n);
    rep(i,n){
        cin >> vec[i].first >> vec[i].second;
    }
    rep(i,n){
        if (vec[i].first == vec[i].second){
            counter += 1;
        }
        else {
            counter = 0;
        }
        ans = max(ans,counter);
    }
    if (ans > 2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3624
#include<cstdio>
inline int max(int a,int b){return a>b?a:b;}
const int N=1e5+3;
int a[N][3],n,dp[N][3];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	  for(int j=0;j<3;j++)scanf("%d",&a[i][j]);
	for(int i=1;i<=n;i++)
	  for(int j=0;j<3;j++)
		for(int k=0;k<3;k++)if(j^k)
		  dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
	printf("%d",max(dp[n][0],max(dp[n][1],dp[n][2])));
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    if (s.at(0) == s.at(1) && s.at(1) == s.at(2)) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256