akhauriyash/Code-Regression huggingface dataset:
#pragma comment(linker, "/stack:200000000")
       #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
         
         
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=1e9+7;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
        
        bool check(int n)
        {
            for(int i=2;i<=sqrt(n);++i)
                if(n%i==0)
                    return false;
                return true;
        }
          
        
        
        int32_t main()
        {
            IOS
           
             
            int a,b;
            cin>>a>>b;
            set<int> s;
            for(int i=1;i<=sqrt(a);++i)
            {
                if(a%i==0)
                {
                    s.insert(i);
                    s.insert(a/i);
                }
            }
            set<int> s1;
            for(int i=1;i<=sqrt(b);++i)
            {
                if(b%i==0)
                {
                    if(s.find(i)!=s.end())
                    s1.insert(i);
                    if(s.find(b/i)!=s.end())
                    s1.insert(b/i);
                }
            }
            vector<int> v(s1.begin(),s1.end());
            map<int,int> m;
            for(int i=0;i<v.size();++i)
            {
                m[v[i]]++;
            }
            
            int count=1;
            
            for(int i=1;i<v.size();++i)
                if(check(v[i]))
                    count++;
                cout<<count;


        }

Measured memory_bytes: 1408
N = int(input())
S = input()
redPref = [0 for i in range(0, N)]

if S[0] == 'R':
    redPref[0] += 1

for i in range(1, N):
    redPref[i] += redPref[i - 1]
    if S[i] == 'R':
        redPref[i] += 1

def query(l, r, pref):
    a, b = 0, pref[r]
    if l - 1 >= 0:
        a = pref[l - 1]
    return b - a


ans = min(N - redPref[-1], redPref[-1])

for i in range(0, N - 1):
    leftRed = query(0, i, redPref)
    leftWhite = i - leftRed + 1

    rightRed = query(i + 1, N - 1, redPref)
    rightWhite = ((N - 1) - (i + 1) + 1) - rightRed

    swaps = min(leftWhite, rightRed)
    leftWhite -= swaps
    rightRed -= swaps
    leftRed += swaps
    rightWhite += swaps

    ans = min(ans, leftWhite + rightRed + swaps)

print(ans)


Measured memory_bytes: 17392
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

number = 10**5+1


q = int(input())
lr = [[int(i) for i in input().split()] for j in range(q)]

ans = [0]*(number)
tmp = False

for i in range(number):
    num = i*2+1
    if num >= number:
        break
    if is_prime(num) and is_prime((num+1)/2):
        ans[i] = 1
    else:
        ans[i] = 0

rui = [0]*(number)

#print(ans)

for i in range(1,number):
    rui[i] = rui[i-1] + ans[i-1]

#print(rui)

for i in range(q):
    print(rui[lr[i][1]//2+1]-rui[lr[i][0]//2])

Measured memory_bytes: 26296
a = int(input())
t = [input() for i in range(a)]
cnt = 0
dict = {}
for i in range(a):
    src = "".join(sorted(t[i]))
    if src in dict.keys():
        dict[src] += 1
    else:
        dict[src] = 0
ans = 0
for a in dict.values():
    ans += a*(a+1)/2
print(int(ans))

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

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

  for (int i = 1; i <= 9; i++) {
    if ( ( N % i ) == 0 && ( N / i ) < 10 ) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//二項係数の計算
int nCr(int A, int B) {
    ll ans = 1;
    for (int i = 0; i < B; i++) {
        ans *= A - i;
    }
    for (int i = 0; i < B; i++) {
        ans /= i + 1;
    }
    return ans;
}
int main() {
    int X,Y,Z;
    cin>>X>>Y>>Z;
    cout<<Z<<" "<<X<<" "<<Y<<endl;
}

Measured memory_bytes: 3620
import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }


int N, A, B, C, D;
string S;

void main() {
  try {
    for (; ; ) {
      N = readInt();
      A = readInt() - 1;
      B = readInt() - 1;
      C = readInt() - 1;
      D = readInt() - 1;
      S = readToken();
      
      auto a = new bool[N];
      auto b = new bool[N];
      auto c = new bool[N];
      auto d = new bool[N];
      a[A] = b[B] = c[C] = d[D] = true;
      foreach (x; 0 .. N) if (a[x]) foreach (xx; [x + 1, x + 2]) if (xx < N) if (S[xx] != '#') a[xx] = true;
      foreach (x; 0 .. N) if (b[x]) foreach (xx; [x + 1, x + 2]) if (xx < N) if (S[xx] != '#') b[xx] = true;
      foreach_reverse (x; 0 .. N) if (c[x]) foreach (xx; [x - 1, x - 2]) if (xx >= 0) if (S[xx] != '#') c[xx] = true;
      foreach_reverse (x; 0 .. N) if (d[x]) foreach (xx; [x - 1, x - 2]) if (xx >= 0) if (S[xx] != '#') d[xx] = true;
      debug {
        writeln("a = ", a.map!(f => f ? 'o' : 'x'));
        writeln("b = ", b.map!(f => f ? 'o' : 'x'));
        writeln("c = ", c.map!(f => f ? 'o' : 'x'));
        writeln("d = ", d.map!(f => f ? 'o' : 'x'));
      }
      
      bool ans;
      if (C < D) {
        ans = a[C] && b[D];
      } else {
        foreach (x; B .. D + 1) {
          ans = ans || (a[x - 1] && c[x + 1] && b[x] && d[x]);
        }
      }
      writeln(ans ? "Yes" : "No");
    }
  } catch (EOFException e) {
  }
}


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

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

#define MAX 100010
int N,Q;
ll A[MAX], cnt[MAX];

int main() {
  cin >> N;
  ll sum = 0;
  rep(i,N) {
    cin >> A[i];
    ++cnt[A[i]];
    sum += A[i];
  }
  cin >> Q;
  ll B,C;
  rep(_,Q) {
    cin >> B >> C;
    if( cnt[B] > 0 ) {
      ll tmp = cnt[B];
      cnt[B] = 0;
      sum -= ( tmp * B );
      ll tmp2 = cnt[C];
      cnt[C] += tmp;
      sum += ( tmp * C);
    }
    cout << sum << endl;
  }
  return 0;
}


Measured memory_bytes: 5176
import sys
input = sys.stdin.readline

N, Q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]

class Tree:
  C = {}
  N, D = None, None
  def __init__(s, num):
    s.N = num
  def setC(s, a, b):
    if a in s.C: s.C[a].append(b)
    else: s.C[a] = [b]
    if b in s.C: s.C[b].append(a)
    else: s.C[b] = [a]
  def exe(s):
    L = [-1] * N
    A = [0] * N
    for p, x in px:
      p -= 1
      A[p] += x
    S = [0]
    while S != []:
      t = S.pop()
      L[t] = 1
      for i in s.C[t]:
        if L[i] == -1:
          L[i] = 1
          A[i] += A[t]
          S.append(i)
    for i in range(N):
      print(A[i], end = " ")

T = Tree(N)
for a, b in ab:
  a -= 1
  b -= 1
  T.setC(a, b)

T.exe()



Measured memory_bytes: 136404
class _in{struct my_iterator{int it;const bool rev;explicit constexpr my_iterator(int it_, bool rev=false):it(it_),rev(rev){}constexpr int operator*(){return it;}constexpr bool operator!=(my_iterator& r){return it!=r.it;}void operator++(){rev?--it:++it;}};const my_iterator i,n;public:explicit constexpr _in(int n):i(0),n(n){}explicit constexpr _in(int i,int n):i(i,n<i),n(n){}constexpr const my_iterator& begin(){return i;}constexpr const my_iterator& end(){return n;}};

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

using i64 = long long;
const i64 INF = 1e18;

int R, C, N;
const int MAX_V = 200010;
vector<pair<int, i64>> adj[MAX_V];
bool used[MAX_V];
i64 weight[MAX_V];
void dfs(int cur_v, i64& minR, i64& minC) {
    used[cur_v] = true;
    for(const auto& e : adj[cur_v]) {
        int nxt_v; i64 cost;
        tie(nxt_v, cost) = e;
        i64 w = cost - weight[cur_v];
        if(used[nxt_v]) {
            if(w != weight[nxt_v])
              minC = minR = -INF;
            continue;
        }
        
        weight[nxt_v] = w;
        if(nxt_v < R)
          minR = min(minR, w);
        else
          minC = min(minC, w);
        dfs(nxt_v, minR, minC);
    }
}

int main() {
    cin >> R >> C >> N;
    for(int _ : _in(N)) {
        int r, c;
        i64 x;
        cin >> r >> c >> x;
        --r;
        --c;
        c += R;
        adj[r].emplace_back(c, x);
        adj[c].emplace_back(r, x);
    }
    for(int i : _in(R)) if(!used[i]) {
        i64 minR = 0LL, minC = INF;
        weight[i] = 0LL;
        dfs(i, minR, minC);
        if(minC + minR < 0LL) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 18176
#include<bits/stdc++.h>
#define pb push_back
//#define ll long long
using namespace std;


const int maxn = 1e6+5;
//int k[34] = {0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
    unsigned long long a, b, c; cin >> a >> b >> c;
    if(a+b >= c) cout << "No" << endl;
    else{
        unsigned long long d = c-(a+b);
        unsigned long long e = 4*a*b;
        //cout << d << ' ' << e << endl;
        d = d*d;
        if(e < d) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int town = 10;
	static int path = 46;
	static int INF = 1<<29;
	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = 0;
			while ((n = in.nextInt()) != 0) {

				int[][] d = new int[town][town];
				for (int i = 0; i < d.length; i++) {
					Arrays.fill(d[i], INF);
				}
				for (int i = 0; i < d.length; i++) {
					d[i][i] = 0;
				}
				for (int i = 0; i < n; i++) {
					int a = in.nextInt();
					int b = in.nextInt();
					int c = in.nextInt();
					d[a][b] = c;
					d[b][a] = c;
				}

				warshallFloyd(d);

				int[] ans = new int[town];
				for (int i = 0; i < d.length; i++) {
					for (int j = 0; j < d.length; j++) {
						if (d[i][j] != INF) {
							ans[i] += d[i][j];
						}
					}
				}

				int cost = 1 << 29;
				int tt = -1;
				for (int i = 0; i < ans.length; i++) {
					if (ans[i] != 0 && ans[i] < cost) {
						cost = ans[i];
						tt = i;
					}
				}

				out.println(tt + " " + cost);
			}

		}

		void warshallFloyd(int[][] d) {
			int n = d.length;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					for (int k = 0; k < n; k++) {
						d[j][k] = Math.min(d[j][k], d[j][i] + d[i][k]);
					}
				}
			}
		}
	}


	static class ArrayUtils {
		public static Map<Integer, Integer> getCountMap(int[] array) {
			Map<Integer, Integer> map = new TreeMap<>();
			for (int x : array)
				map.merge(x, 1, Integer::sum);
			return map;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}



Measured memory_bytes: 24432
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans = 0;
    if (a >= 13) {
      ans = b;
    } else if (a >= 6) {
      ans = b / 2;
    }
    System.out.println(ans);
  } 
}

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

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

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

int main(void){
    int a, b;
    cin>>a>>b;
    cout<<lcm(a, b)<<endl;
}

Measured memory_bytes: 256
m500 = int(input())
m100 = int(input())
m50 = int(input())
X = int(input())

count = 0

for i in range(m500+1):
    for j in range(m100+1):
        for k in range(m50+1):
            if X == i*500+j*100+k*50:
                count += 1

print(count)

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


struct State {
  int i, j, t;
};

const int INF = 1<<28;
const int MAXN = 1001;
int H, W;
char C[MAXN][MAXN];
int G[MAXN][MAXN];

int main() {
  while(cin >> H >> W) {
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        cin >> C[i][j];
      }
    }
    memset(G, 0, sizeof(G));
    queue<State> que;
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        if(!isdigit(C[i][j])) {
          G[i][j] = INF;
          continue;
        }
        for(int di = -1; di <= 1; ++di) {
          for(int dj = -1; dj <= 1; ++dj) {
            if(di == 0 && dj == 0) continue;
            int ni = i + di;
            int nj = j + dj;
            if(C[ni][nj] == '.') ++G[i][j];
          }
        }
        if(G[i][j] >= C[i][j]-'0') {
          que.push((State){i, j, 1});
        }
      }
    }
    int res = 0;
    while(que.size()) {
      const State s = que.front();
      que.pop();
      res = s.t;
      for(int di = -1; di <= 1; ++di) {
        for(int dj = -1; dj <= 1; ++dj) {
          if(di == 0 && dj == 0) continue;
          int ni = s.i + di;
          int nj = s.j + dj;
          if(G[ni][nj] >= C[ni][nj]-'0') continue;
          if(++G[ni][nj] >= C[ni][nj]-'0') {
            que.push((State){ni, nj, s.t + 1});
          }
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 6128
import itertools
import numpy as np

N = int(input(''))
L = (list(map(int, input('').split(' '))))
L = np.array(sorted(L))
set_L = set(L)

if len(set_L) <= 2:
    print(0)
else:
    K = {i:len(L[L==i]) for i in set_L}
    
    i = 0
    for team in itertools.combinations(K.keys(), 3):
        if (team[0] < team[1] + team[2]) & (team[1] < team[0] + team[2]) & (team[2] < team[0] + team[1]):
            i += K[team[0]]*K[team[1]]*K[team[2]]
    print(i)

Measured memory_bytes: 27248
#include <iostream>
#include <cmath>

using ll = long long;


ll F(const ll &x) {
    ll ans;
    switch(x%4) {
        case 0:
            ans = x;
            break;
        case 1:
            ans = 1;
            break;
        case 2:
            ans = x+1;
            break;
        case 3:
            ans = 0;
            break;
        default:
            break;
    }
    return ans;
}

void solve(const ll &A, const ll &B) {
    std::cout << ( F(A-1) ^ F(B) ) << std::endl;
}

int main() {
    ll A, B;
    std::cin >> A >> B;
    solve(A, B);
    return 0;
}

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

using namespace std;

int main(){
    int n,m;
    cin>>n>>m;
    vector<long long> dp(n,0ll);
    if(m==0){
        dp[0]=1;
        dp[1]=2;
        for (int i = 2; i < n; ++i) {
            dp[i]=(dp[i-1]+dp[i-2])%1000000007;
        }
    }
    else{
        vector<int> a(m);
        for (int i = 0; i < m; ++i) {
            cin>>a[i];
            --a[i];
        }
        int ti=0;
        if(a[ti]!=0)dp[0]=1ll;
        else {
            while(a[ti]==0)++ti;
        }
        if(a[ti]!=1)dp[1]=1ll+dp[0];
        else {
            while(a[ti]==1)++ti;
        }
        for (int i = 2; i < n; ++i) {
            if(a[ti]!=i)dp[i]=(dp[i-1]+dp[i-2])%1000000007;
            else {
                while(ti<m-1&&a[ti]==i)++ti;
            }
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}

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

#define ll long long

using namespace std;

int main(){
    int n;
    bool cnt[8] = {false};
    int exc=0;
    int maxv=0;

    cin >> n;
    ll hairetu[n];
    for(int i=0; i<n; i++){
        cin >> hairetu[i];
    } 
    
    for(int i=0; i<n; i++){
        if(hairetu[i]>=1 && hairetu[i] <= 399){
            cnt[0] = true;
        }else if(hairetu[i]>=400 && hairetu[i] <= 799){
            cnt[1] = true;
        }else if(hairetu[i]>=800 && hairetu[i] <= 1199){
            cnt[2] = true;
        }else if(hairetu[i]>=1200 && hairetu[i] <= 1599){
            cnt[3] = true;
        }else if(hairetu[i]>=1600 && hairetu[i] <= 1999){
            cnt[4] = true;
        }else if(hairetu[i]>=2000 && hairetu[i] <= 2399){
            cnt[5] = true;
        }else if(hairetu[i]>=2400 && hairetu[i] <= 2799){
            cnt[6] = true;
        }else if(hairetu[i]>=2800 && hairetu[i] <= 3199){
            cnt[7] = true;
        }else{
            exc++;
        }
    }

    for(int i=0; i<8; i++){
        if(cnt[i] == true){
            maxv++;
        }
    }
    if(exc > 0 && maxv > 0){
        cout << maxv << " " << maxv+exc << endl;
    }else if(exc > 0 && maxv == 0){
        cout << 1 << " " << exc << endl;
    }else{
        cout << maxv << " " << maxv << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#define rep(i,l,r) for(int i=(l);i<(r);i++)
using namespace std;



int main(void){
    // Your code here!
    int a,d,n;
    int stbl[1000000];
	for(int i = 0; i < 1000000; i++){
		stbl[i] = 1;
	}
	for(int i = 2; i < sqrt(1000000); i++){
		if(stbl[i]){
			for(int j = 0; i * (j + 2) < 1000000; j++){
				stbl[i *(j + 2)] = 0;
			}
		}
	}
	stbl[1] = 0;
// 	rep(i,0,100) cout << stbl[i];
    while(1){
        int ncnt=0,ans=0;
        cin >> a >> d >> n;
        if(a==0&&d==0&&n==0) break;
        for(int i=0;i<10000000;i++){
            if(stbl[a+i*d]) ncnt++;
            if(ncnt == n){
                ans = a+i*d;
                cout << ans << endl;
                break;
            }
        }
    }
}



Measured memory_bytes: 6984
def solve():
    import heapq
    from sys import stdin
    lines = stdin
    
    n, q = map(int, lines.readline().split())
    
    # hq element: [number of caught fish, participant number]
    hq = [(0, i) for i in range(1, n + 1)]
    heapq.heapify(hq)
    fish = [0] * (n + 1) # number of caught fish
    
    ans = ""
    for i in range(q):
        a, v = map(int, lines.readline().split())
        # Because of Python heapq specification, negative values are used for fishing.
        v *= -1
        
        fish[a] += v
        heapq.heappush(hq, (fish[a], a))
        
        while hq[0][0] != fish[hq[0][1]]:
            heapq.heappop(hq)
        
        ans += f"{hq[0][1]} {-hq[0][0]}\n"
    
    print(ans, end="")

solve()


Measured memory_bytes: 132124
a = list(map(int,input().split()))
X=a[0]
Y=a[1]

crain = (4*X-Y)/2
turtle = (Y-2*X)/2

if crain.is_integer() and crain >= 0:
    if turtle.is_integer() and turtle >= 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

int main() {
	int n, m, a[50], b[50],count[50];

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

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

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

using namespace std;

int main(){
	int n; cin >> n;
	int a[n];
	for(int i = 0; i < n; i++ ) cin >> a[i];
	sort(a, a+n);
	int ans = 0;
	for(int i = 0; i < n; i++) {
		for(int j = i+1; j <n ; j++) {
			if(a[j] == a[i]) continue;
			for(int k = j+1; k < n; k++) {
				if(a[k] == a[j]) continue;
				if(a[i] + a[j] > a[k]) ans++;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	int n,m;cin>>n>>m;
	int x[m];
	rep(i,m) cin>>x[i];
	sort(x,x+m);
	int s[m-1];
	rep(i,m-1) s[i]=x[i+1]-x[i];
	sort(s,s+m-1);

	int ans=0;
	rep(i,m-n) ans+=s[i];

	cout<<ans<<"\n";
}

Measured memory_bytes: 1024
#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

const int MAX_N = 300000;
typedef unsigned long long ull;
typedef long long ll;
const ull mod = 1000000000 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

int main(){
    string a,b,c;
    cin >> a >> b >> c;
    cout << char((int)a[0] - 32) << char((int)b[0] - 32) << char((int)c[0] - 32) <<endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.range, std.conv, std.string, std.array, std.functional, std.math, std.regex, std.file, std.range, std.traits;
import std.algorithm.comparison, std.algorithm.iteration, std.algorithm.mutation, std.algorithm.searching, std.algorithm.setops, std.algorithm.sorting;
import std.container.binaryheap;
import std.typecons; 

void main()
{
    auto input = readln().split.to!(long[]);
    auto X = input[0];
    auto Y = input[1];
    auto Z = input[2];
    auto K = input[3];

    auto aList = readln().split.to!(long[]);
    auto bList = readln().split.to!(long[]);
    auto cList = readln().split.to!(long[]);
    aList.sort!"a>b";
    bList.sort!"a>b";
    cList.sort!"a>b";
    long[] list;
    foreach(a; 0..aList.length)
    {
        foreach(b; 0..bList.length)
        {
            if(a*b > K) break;
            foreach(c; 0..cList.length)
            {
                if(a*b*c > K) break;
                list ~= aList[a] + bList[b] + cList[c];
            }
        }
    }
    sort!"a>b"(list);
    foreach(i; 0..K)
    {
        writeln(list[i]);
    }
}

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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   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 dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

int main(){
   ll n; cin >> n;
   Vi a(n), b(n);
   REP(i, n) cin >> a[i];
   REP(i, n) cin >> b[i];
   ll diff_neg = 0, diff = 0, ans = 0;
   Vi diff_pos;
   REP(i, n){
      diff += a[i] - b[i];
      if(a[i] < b[i]){
         diff_neg += b[i] - a[i]; ans ++;
       }
      else{
         diff_pos.pb(a[i] - b[i]);
      }
   }
   if(diff < 0){
      cout << -1 << endl; return 0;
   }
   RSORT(diff_pos);
   ll i = 0;
   while(diff_neg > 0){
      ans++;
      diff_neg -= diff_pos[i];
      i++;
   }
   cout << ans << endl;




}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
const int P=1e9+7;
vector<int>v[N],vv;
int a[N],b[N],c[N],n;
int dfs(int x)
{
    if(x==n){c[1]=x;return 1;}
    for(int i:v[x])
    if(!b[i])
    {
        b[i]=1;
        int y=dfs(i);
        if(y>0){c[y+1]=x;return y+1;}
        b[i]=0;
    }
    return 0;
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int i,j;
    ll sum=0;
    cin>>n;
    for(i=0;i<n-1;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        v[x].push_back(y);
        v[y].push_back(x);
    }
    memset(b,0,sizeof b);
    b[1]=1;
    int y=dfs(1);
    v[c[y/2]].clear();
    i=0;
    vv.push_back(1);
    memset(b,0,sizeof b);
    b[1]=1;
    while(i<vv.size())
    {
        int x=vv[i];
        for(int j:v[x])
        if(b[j]==0)
        {
            b[j]=1;
            vv.push_back(j);
        }
        i++;
    }
    if(vv.size()*2>n+2)cout<<"Fennec";
    else cout<<"Snuke";
    return 0;
}


Measured memory_bytes: 11520
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd${0:#:TARGET}

int memoneMomo[401][401];
int ruisekiSum[401];
int data[401];

int mmnmm(int st, int en)
{
    if (memoneMomo[st][en] != INF) return memoneMomo[st][en];
    int ret = INF;
    for (int i = st; i < en; i++) {  // i は左
        ret = min(ret, mmnmm(st, i) + mmnmm(i+1, en) + ruisekiSum[i+1] - ruisekiSum[st] + ruisekiSum[en+1] - ruisekiSum[i+1]);
    }
    return memoneMomo[st][en] = ret;
}

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

    Int(n);
    rep(i, n) {
        cin >> data[i];
    }
    rep(i, n) {
        ruisekiSum[i+1] = ruisekiSum[i] + data[i];
    }

    rep(i, n) {
        rep(j, n) {
            memoneMomo[i][j] = INF;
        }
    }
    rep(i, n) {
        memoneMomo[i][i] = 0ll;
    }

    cout << mmnmm(0, n-1) << endl;

    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n;
    cin >> n;
    deque<int> dq;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        if (i%2) {
            dq.emplace_back(a);
        } else {
            dq.emplace_front(a);
        }
    }

    if (n%2==0) reverse(dq.begin(), dq.end());
    for (int i=0; i<n; i++) {
        if (i!=0) cout << " ";
        cout << dq.front(); dq.pop_front();
    }
    cout << endl;
}

Measured memory_bytes: 3908
#include<bits/stdc++.h>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
#include<chrono>
using namespace std;
using namespace std::chrono;
//using namespace __gnu_pbds;
#define fastio     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi         first
#define se         second
#define int         long long
#define pb         push_back
#define emp        emplace_back
#define vv(x)      vector<x>
#define mp(x,y)    map<x,y>
#define dq(x)      deque<x>
#define pql(x)     priority_queue<x>
#define pqs(x)     priority_queue<x,vv(x),greater<x> >
#define mod         1000000007
#define forf(i,a,b) for(int i=a;i<b;i++)
#define it(x)      x::iterator
#define ll         long long
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d)  for(long blockTime = 0; (blockTime == 0 ? (blockTime=clock()) != 0 : false); debug("%s time : %.4fs", d, (double)(clock() - blockTime) / CLOCKS_PER_SEC))
#define vii        vector<int>
#define big        3e18
#define sm         -2e9
#define mkr        make_pair
#define vpi        vector<pair<int,int> >
#define pii        pair<int,int>
#define rng        500005
#define sz(x)      (int)x.size()
#define rv(x)      reverse(x.begin(),x.end())
#define out(x)     cout<<x.fi<<" "<<x.se<<endl;
 
//#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
 
void pr_init()
{
 
#ifndef ONLINE_JUDGE
  freopen("gin.txt", "r", stdin);
  //freopen("gout.txt", "w", stdout);
#endif
}

vector<vpi>gp;
vii ed,ch;

void dfs(int i,int p,int t)
{
  int j=0;
  for(auto x:gp[i])
    if(x.fi!=p)
    {
      if(ch[j]==t) j++;
      ed[x.se] = ch[j];
      dfs(x.fi,i,ch[j]);
      j++; 
    }

}
void solve()
{
  int n;
  cin >> n;
  
  gp.assign(n+1,vpi());
  ed.assign(n+1,0);

  forf(i,0,n-1)
  {
    int u,v;
    cin >> u >> v;
    gp[u].pb({v,i});
    gp[v].pb({u,i});
  }
  
  int cl = -1;
  for(int i=1;i<=n;i++)
  {
     cl = max(cl,sz(gp[i]));
  }
  for(int i=1;i<=cl;i++) ch.pb(i);

  dfs(1,-1,0);

  cout<<cl<<"\n";
  for(int i=0;i<n-1;i++)
  {
    cout<<ed[i]<<"\n";
  }
}
 
 
int32_t main()
{
  pr_init();
  fastio;
   
  
  solve();
   
}
 


Measured memory_bytes: 11600
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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; }
const ll INF = 1e11;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n;
    cin >> n;
    if (n == 1) PRINT("Hello World");
    else{
        int a,b;
        cin >> a >> b;
        PRINT(a+b);
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		int E = sc.nextInt();
		int F = sc.nextInt();

		Set<Integer> water = new TreeSet<Integer>();
		Set<Integer> suger = new TreeSet<Integer>();
		int ans1 = 100 * A ; int ans2 = 0;
		for(int i = 0 ; i <= F ; i++) {
			for(int j = 0 ; j <= F ; j++) {
				if(100 * A * i + 100 * B * j <= F) {
					water.add(100 * A * i + 100 * B * j);
				}
			}
		}
		for(int i = 0 ; i <= F ; i++) {
			for(int j = 0 ; j <= F ; j++) {
				if(C * i + D * j <= F) {
					suger.add(C * i + D * j);
				}
			}
		}
		for(int w : water) {
			for(int s : suger) {
				if(100 * s <= w * E) {
					if(s + w <= F) {
						if(ans2 * (s + w) < s * ans1) {
							ans1 = s + w;
							ans2 = s;
						}
					}
				}
			}
		}
		System.out.println(ans1 + " " + ans2);
	}
}

Measured memory_bytes: 24644
<?php
  $t = array(0,0,0);
  for($i=0; $i<10;$i++) {
      $j = (int)fgets(STDIN);

      if($j>$t[2]) {
          if($j>$t[1]) {
              if($j>$t[0]) {
                  $t[2] = $t[1];
                  $t[1] = $t[0];
                  $t[0] = $j;
              } else {
                  $t[2] = $t[1];
                  $t[1] = $j;
              }
          } else {
              $t[2] = $j;
          }
      }
  }
  echo $t[0]."\n".$t[1]."\n".$t[2]."\n";

Measured memory_bytes: 15404
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

int main(){
    int a,b; cin >> a >> b;
    if((a+b)%2==0){
        cout << (a+b)/2 << endl;
    }
    else{
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int x;
  cin >> x;
  int c;
  if (400 <= x && x < 600)
  {
    c = 8;
  }
  else if (600 <= x && x < 800)
  {
    c = 7;
  }
  else if (800 <= x && x < 1000)
  {
    c = 6;
  }
  else if (1000 <= x && x < 1200)
  {
    c = 5;
  }
  else if (1200 <= x && x < 1400)
  {
    c = 4;
  }
  else if (1400 <= x && x < 1600)
  {
    c = 3;
  }
  else if (1600 <= x && x < 1800)
  {
    c = 2;
  }
  else if (1800 <= x && x < 2000)
  {
    c = 1;
  }
  cout << c << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define pc(x) putchar(x)
namespace ib {char b[100];}
inline void pi(int x){
	if(x==0) {pc(48); return;}
	if(x<0) {pc('-'); x=-x;}
	char *s=ib::b;
	while(x) *(++s)=x%10,x/=10;
	while(s!=ib::b) pc((*(s--))+48);
}
inline void ri(int &x){
	x=0; static char c; bool t(0);
	while(c=getchar(),c<'0'||c>'9') if(c=='-') t=1; else t=0;
	do x=(x<<1)+(x<<3)+c-'0'; while(c=getchar(),c>='0'&&c<='9');
	if(t) x=-x;
}
const int N=4024,M=1e9+7,NS=200024;
int x[NS],y[NS],f[N][N];
int jc[2*N],njc[2*N];
int ksm(int n,int c){
	int jc=1;
	while(c){
		if(c&1) jc=(long long)jc*n%M;
		n=(long long)n*n%M;
		c>>=1;
	}
	return jc;
}
void build(){
	int i;
	jc[0]=njc[0]=1;
	for(i=1;i<=8005;++i) jc[i]=(long long)jc[i-1]*i%M;
	njc[8005]=ksm(jc[8005],M-2);
	for(i=8005;i;--i) njc[i-1]=(long long)njc[i]*i%M;
}
inline int c(int n,int m){
	return (long long)jc[m]*njc[n]%M*njc[m-n]%M;
}
int main(){
	int i,j,n,ans=0;
	ri(n); build();
	for(i=0;i<n;++i){
		ri(x[i]); ri(y[i]);
		++f[2001-x[i]][2001-y[i]];
	}
	for(i=1;i<=4005;++i)
	for(j=1;j<=4005;++j)
		f[i][j]=(f[i-1][j]+f[i][j-1]+f[i][j])%M;
	for(i=0;i<n;++i) ans=(ans+f[x[i]+2001][y[i]+2001])%M;
	for(i=0;i<n;++i) ans=(ans+M-c(x[i]+x[i],x[i]+y[i]+x[i]+y[i]))%M;
	ans=(long long)ans*njc[2]%M;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 65152
def get_E(p):
    return sum(range(1, p + 1)) / p


N, K = map(int, input().split())
P = [int(x) for x in input().split()]
E = [get_E(p) for p in P]

left = 0
cur = 0
res = 0
for right in range(N):
    cur += E[right]
    while right - left + 1 > K:
        cur -= E[left]
        left += 1
    if right - left + 1 == K:
        res = max(res, cur)
print(res)

Measured memory_bytes: 74504
# ARC058D - いろはちゃんとマス目 / Iroha and a Grid (ABC042D)
def comb(n: int, r: int) -> int:
    return fact[n] * inv[n - r] * inv[r]


def main():
    global fact, inv
    H, W, A, B = tuple(map(int, input().split()))
    MOD = 10 ** 9 + 7
    # table of factorials
    fact, x = [1] * (H + W + 1), 1
    for i in range(1, H + W + 1):
        x = (x * i) % MOD
        fact[i] = x
    # table of inverse factorials
    inv = [1] * (H + W + 1)
    inv[-1] = pow(fact[-1], MOD - 2, MOD)
    x = inv[-1]
    for i in range(H + W - 1, 0, -1):
        x = (x * (i + 1)) % MOD
        inv[i] = x

    ans = 0
    for i in range(B, W):
        ans += comb(i + H - A - 1, i) * comb(W - i - 1 + A - 1, A - 1)
    print(ans % MOD)


if __name__ == "__main__":
    main()

Measured memory_bytes: 18804
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;cin>>s;
    if(s[2]==s[3]&&s[4]==s[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}







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

int main(){
  vector<int> a{1,4,8,9,16,25,27,32,36,49,64,81,100,121,125,128,144,169,196,216,225,243,256,289,324,343,361,400,441,484,512,529,576,625,676,729,784,841,900,961,1000};
  int x;
  cin >> x;
  int ans=0;
  for(int i=0; i<a.size(); i++){
    if(a[i] > x){
      break;
    }
    ans = a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)
long long cnt[2][4000][4000];
int main() {
	int n, t;
	cin >> n >> t;
	vector<pair<long long, long long>> inputs;
	REP(i, n) {
		long long a, b;
		cin >> a >> b;
		inputs.push_back(make_pair(a, b));
	}
	for (int i = 0; i < inputs.size(); ++i) {
		REP(q, t) {
			cnt[0][i + 1][q] = max(cnt[0][i + 1][q], cnt[0][i][q]);
			if (q + inputs[i].first < t) {
				cnt[0][i + 1][inputs[i].first + q] = max(cnt[0][i + 1][inputs[i].first + q], cnt[0][i][q] + inputs[i].second);
			}
		}
		for (int q = 0; q < t; ++q) {
			cnt[0][i + 1][q + 1] = max(cnt[0][i + 1][q + 1], cnt[0][i+1][q]);
		}
	}
	for (int i = inputs.size()-1; i >= 0; --i) {
		REP(q, t) {
			cnt[1][i][q] = max(cnt[1][i][q], cnt[1][i+1][q]);
			if (q + inputs[i].first < t) {
				cnt[1][i][inputs[i].first + q] = max(cnt[1][i][inputs[i].first + q], cnt[1][i+1][q] + inputs[i].second);
			}
		}
		for (int q = 0; q < t; ++q) {
			cnt[1][i][q + 1] = max(cnt[1][i][q + 1], cnt[1][i][q]);
		}
	}
	long long ans = 0;
	for (int i = 0; i < inputs.size(); ++i) {
		for (int q = 0; q < t; ++q) {
			ans = max(ans, cnt[0][i][q] + cnt[1][i + 1][t - q - 1] + inputs[i].second);
		}
	}
	cout << ans << endl;
}


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

int main()
{
    int p1,p2,p3,j1,j2;
    cin >> p1>>p2>>p3>>j1>>j2;
    cout << min(p1,min(p2,p3))+min(j1,j2)-50<< endl;
    return 0;
}



Measured memory_bytes: 3100
n, m = map(int, input().split())
inputs = []
for i in range(n):
	temp = list(map(int, input().split()))
	del temp[0]
	inputs.append(temp)

count = {}

for i in range(n):
	for j in inputs[i]:
		if j in count.keys():
			count[j] += 1
		else:
			count[j] = 1

total = 0
for keys in count:
	if count[keys] == n:
		total += 1
print(total)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;
const ll INF = 1e18;

int main(int argc, char* argv[])
{
  std::vector< ll > va(3, 0);

  std::cin >> va[0] >> va[1] >> va[2];
  //std::cout << __LINE__ << " " << N << std::endl;

  ll x = *std::max_element(va.begin(), va.end());
  std::cout << x * 9 + std::accumulate(va.begin(), va.end(), 0) << std::endl;
  
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(){
    int i, j;
    int h, w;
    
    while(scanf("%d %d", &h, &w), h > 0 && w > 0){
        for(i = 0; i < h; ++i){
            for(j = 0; j < w; ++j){
                putchar(i == 0 || j == 0 || i == h - 1 || j == w - 1 ? '#' : '.');
            }
            
            putchar('\n');
        }
        
        putchar('\n');
    }
    
    return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
void solve(){
    int n; cin >> n;
    vector<int> dp(3);

    for(int day = 0; day < n; day++){
        vector<int> new_dp(3, 0);
        int c[3];
        cin >> c[0] >> c[1] >> c[2];

        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 3; j++){
                if(i != j){
                    new_dp[j] = max(new_dp[j], dp[i]+c[j]);
                }
            }
        }
        dp = new_dp;
    }
    cout << max({dp[0], dp[1], dp[2]}) << endl;
}
int main(){
    solve();
}

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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


int main()
{
    int W,a,b;
    cin >> W >> a >> b;
    
    cout << max(0, max(a,b) - (min(a,b) + W)) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define f first
#define s second
#define int long long
int a[114514];
int ans[114514];
bool p(int x){
	if(x==1)return false;
	rep(2,i,x){
		if(x%i==0)return false;
	}
	return true;
}		
signed main(){
    int n,p;
	cin>>n>>p;	
	int sum=0;
	rep(0,i,n){
		cin>>a[i];
		a[i]=a[i]%2;
		if(a[i]%2==1){
			sum++;
		}	
	}
	int ans=1;
	if(sum==0&&p==0){
	    rep(0,i,n){
	        ans*=2;
	    }
	    c(ans)
	} 
	else if(sum==0&&p==1){
		c(0)
		return 0;
	}
	else{
		rep(0,i,n-1){
			ans=ans*2;
		}
		c(ans)
	}		
}	
            

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

signed main() {
	int a, b,x;
	cin >>a>>b>>x;
	if(a+b>=x&&x>=a) puts("YES");
	else puts("NO");
}


Measured memory_bytes: 3608
#include<stdio.h>

int main(){

	int i,j,n,a[10],b,c,nflag;

	scanf("%d",&n);

	for(i=0;i<n;i++){
		nflag=0;
		for(j=0;j<9;j++) scanf("%d ",&a[j]);
		scanf("%d",&a[9]);

		b=a[0];
		c=0;
		for(j=1;j<10;j++){
			if(b<a[j]) b=a[j];
			else if(c<a[j]) c=a[j];
			else{
				printf("NO\n");
				nflag=1;
				break;
			}
		}
		if(nflag) continue;
		printf("YES\n");

	}



	return 0;

}

Measured memory_bytes: 580
#include <stdio.h>
#define REP(a) for(i = 0; i < a; i++)

int main(void)
{
    int n,k,i,x = 1;
    scanf("%d%d",&n,&k);
    REP(n) {
        if (2 * x < x + k) {
            x = 2 * x;
        } else {
            x = x + k;
        }
    }
    printf("%d\n",x);
    return 0;
 }

Measured memory_bytes: 128