akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vvp = vector<vector<pair<int,int>>>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;
template<typename T> bool chmax(T &a, T b) {if(a < b) {a = b;return 1;}return 0;}
template<typename T> bool chmin(T &a, T b) {if(a > b) {a = b;return 1;}return 0;}




int main(){

    int N;
    cin >> N;
    vl a(N);
    in(N,a);
    
    vvl dp(7100,vl(7100,0));
    
    reps(aa,1,N+1){
        rep(i,N+1){
            int j = aa+i;
            if((N-(j-i)) % 2 == 0){
                dp[i][j] = max(dp[i+1][j] + a[i], dp[i][j-1] + a[j-1]);
            }else{
                dp[i][j] = min(dp[i+1][j] - a[i], dp[i][j-1] - a[j-1]);
            }
        }
    }
    
 
    //outmat(dp);
    cout << dp[0][N] << endl;
    
    

    return 0;
}


Measured memory_bytes: 394496
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) cout << (j ? "Yes" : "No") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

int main()
{
    int n;cin >> n;
    int t[101];
    for(int i = 0 ; i < n ; i++) cin >> t[i];

    int m;cin >> m;
    int p[101],x[101];
    for(int i = 0 ; i < m ; i++) cin >> p[i] >> x[i];

    for(int i=0 ; i<m ; i++){
        int res = 0;
        for(int j = 0 ; j < n ; j++){
            if(p[i]-1==j) res += x[i];
            else res += t[j];
        }
        p(res)
    }
}

Measured memory_bytes: 256
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

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

ll l,n;
ll X[200020];
ll R[200020],L[200020];
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    cin >> l >> n;
    rep(i,n){
        cin >> X[i];
        L[i+1] = L[i] + X[i];
    }
    rrep(i,n){
        R[(n-1) - i + 1] = R[(n-1) - i] + (l - X[i]);
    }    
    long long ans = 0;
    chmax(ans,X[n-1]);
    chmax(ans,l-X[0]);
    for(int x = 0;x <= n-2;x++){
        ll sum = 0;
        int y = (n-1+x)/2;
        sum += 2*(L[y+1] - L[x]);
        //cout << 2*(L[y+1] - L[x]) << " , ";
        int z  = (n-1) - (y+1);
        sum += 2*R[z+1];
        //cout << 2*R[z+1] << " , ";
        if((n-1-x+1)%2==0){
            sum -= (l - X[y+1]);
            //cout << l - X[y+1] << '\n';
        }else{
            sum -= X[y];
            //cout << X[y] << '\n';
        }
        chmax(ans,sum);
    }
    //cout << '\n';
    for(int x = 0;x <= n-2;x++){
        ll sum = 0;
        int y = (n-1+x)/2;
        sum += 2*(R[y+1] - R[x]);
        //cout << 2*(R[y+1] - R[x]) << " , ";
        int z = (n-1) - (y+1);
        sum += 2*L[z+1];
        //cout << 2*L[z+1] << " , ";
        if((n-1-x+1)%2==0){
            sum -= X[z];
            //cout << X[z] << '\n';
        }else{
            sum -= (l-X[z+1]);
            //cout << l - X[y] << '\n';
        }
        chmax(ans,sum);
    }
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll> 
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,c,x,y;cin>>a>>b>>c>>x>>y;
  ll ans=a*x+b*y,ans_=ans,anum=x,bnum=y;
  while(!(anum==0&&bnum==0)) {
    ans_+=2*c;
    if(anum>0) {ans_-=a;anum--;}
    if(bnum>0) {ans_-=b;bnum--;}
    ans=min(ans,ans_);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10
    tmp = 0
    S = list(input())
    N = len(S)+1
    A = [0]*N
    num_conti = 0
    for i in range(N-1):
        if S[i] == '<':
            num_conti += 1
        else:
            num_conti = 0
        A[i+1] = num_conti
    num_conti = 0
    for i in range(N-2,-1,-1):
        if S[i] == '>':
            num_conti += 1
        else:
            num_conti = 0
        A[i] = max(A[i],num_conti)
    print(sum(A))
    dbg(A)





    
main()

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

int main()
{
	string S;
	cin >> S;
	int res = S.size();
	for (int i = 1; i < (int)S.size(); i++) {
		if (S[i - 1] != S[i]) res = min(res, max(i, (int)S.size() - i));
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>

using namespace std;
int main(){
  int N,L;
  cin >> N >> L;

  vector<string> s(N);

  for(int i= 0; i < N; i++) {
    cin >> s[i];
  }

  std::sort(s.begin(),s.end());

  string r;
  for(int i = 0; i < N; i++){
    r = r + s[i];
  }

  cout << r << endl;

  return 0;
}

Measured memory_bytes: 256
mod = 1000000007

class combination():
    def __init__(self, n):
        self.fact = [1] * (n+1)
        self.ifact = [1] * (n+1)
        for i in range(1, n+1):
            self.fact[i] = self.fact[i-1]*i % mod
        self.ifact[n] = pow(self.fact[n], mod-2, mod)
        for i in range(n, 0, -1):
            self.ifact[i-1] = self.ifact[i]*i % mod
    def comb(self, n, k):
        if k < 0 or k > n: return 0
        comb = self.fact[n]*self.ifact[k]*self.ifact[n-k] %mod
        return comb

def main():
    import sys
    input = sys.stdin.readline

    r1, c1, r2, c2 = map(int, input().split())

    comb = combination(2000010)

    # c1 ~ c2+1, r1 ~ r2+1
    ans = comb.comb(c2+r2+2, r2+1) - 1
    ans -= comb.comb(c1+r2+1, c1) - 1
    ans -= comb.comb(c2+r1+1, r1) - 1
    ans += comb.comb(c1+r1, r1) - 1
    print(ans % mod)

main()

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

int main()
{
  int n;
  while (cin >> n, n){
    int a;
    stack<pair<int, int> > st;
    
    cin >> a;
    st.emplace(a, 1);
    for (int i = 2; i <= n; i++){
      cin >> a;
      if (i % 2){
        auto &po = st.top();
        if (po.first == a){
          po.second++;
        } else {
          st.emplace(a, 1);
        }
      } else {
        auto po = st.top(); st.pop();
        if (po.first == a){
          po.second++;
          st.emplace(po);
        } else {
          if (st.empty()){
            st.emplace(a, po.second + 1);
          } else {
            st.top().second += 1 + po.second;
          }
        }
      }
    }

    int cnt = 0;
    while (!st.empty()){
      auto po = st.top(); st.pop();
      if (po.first) continue;
      cnt += po.second;
    }

    cout << cnt <<  endl;
  }
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
 
#define int         long long
#define endl        "\n"
#define pii         pair<int, int>
 
 
void solve(int TC) { 
    int n; cin >> n;
    bool ok = 0;
    for(int i=1; i<=9; i++) for(int j=1; j<=9; j++) {
        if(i*j == n) {
            ok = 1;
        }
    }
    if(ok) {
        cout << "Yes";
    } else {
        cout << "No";
    }
}
 
signed main() {
 
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);
 
 
    int T = 1;
    //cin >> T;
    for(int i=1; i<=T; i++) {
        solve(i);
    }
    return 0;
 
}

Measured memory_bytes: 3524
def main():
    total_num = int(input())
    total_list = list()
    for i in range(total_num):
        total_list.append(str(input()))

    str_AC = 'AC'
    int_AC= 0
    str_WA = 'WA'
    int_WA= 0
    str_TLE = 'TLE'
    int_TLE= 0
    str_RE = 'RE'
    int_RE= 0

    for i in total_list:
        if i == str_AC:
            int_AC += 1
        elif i == str_RE:
            int_RE += 1
        elif i == str_TLE:
            int_TLE += 1
        elif i == str_WA:
            int_WA += 1

    print(str_AC + ' x ' + str(int_AC))
    print(str_WA + ' x ' + str(int_WA))
    print(str_TLE + ' x ' + str(int_TLE))
    print(str_RE + ' x ' + str(int_RE))


if __name__ == '__main__':
    main()


Measured memory_bytes: 16248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // Atcoder
    // template: cpp
    ll R, G, B, N;
    cin >> R >> G >> B >> N;
    ll cnt = 0;

    rep(r, N + 1) {
        rep(g, N + 1) {
            ll Bb = N - r * R - g * G;
            if(Bb % B == 0 && Bb / B >= 0)
                cnt++;
        }
    }
    cout << cnt;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2104
AC
"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    t = int(input())
    for _ in range(t):
        n, k = map(int, input().split())
        houses = [int(x) for x in input().split()]

        if k >= n:              #  ????????¨?????????????????¨?????§????????´???
            print(0)
            continue

        # ??¶??????????????¢????¨????????????????????????¨????????????????????????
        gaps = []
        prev = houses[0]
        for i, h in enumerate(houses[1:]):
            gaps.append((h - prev, i))
            prev = h

        # gap?????§????????¨??????????????????????????????????????´????????????
        gaps.sort(reverse=True)
        gaps = gaps[:k-1]


        # ???????????????????????±????????????????¨??????????
        cable_total = 0
        prev = 0
        for _, p in gaps:
            cable_total += houses[p] - houses[prev]
            prev = p + 1
        if prev != (n - 1):
            cable_total += houses[-1] - houses[prev]

        print(cable_total)


if __name__ == '__main__':
    main(sys.argv[1:])

Measured memory_bytes: 29248
var input = require("fs").readFileSync("/dev/stdin", "utf8");

var lines = input.split('\n');
var N = Number(lines[0]);
var words = lines[1].split(' ');

var map = {};
for (var i = 0; i < N; i++) {
    var n = Number(words[i]);
    map[n] = map[n] || 0;
    map[n]++;
}

var sum = 0;
for (key in map) {
    var n = Number(key);
    var v = map[key];
    var diff = v - n;
    if (diff > 0) {
        sum += diff;
    } else if (diff < 0) {
        sum += v;
    }
}
console.log(sum);


Measured memory_bytes: 28948
fun main(args : Array<String>) {
    val (W, H, x, y) = readLine()!!.split(" ").map { it.toDouble() }

    val medX = W / 2.0
    val medY = H / 2.0
    val answer = W * H / 2.0
    if (x == medX && y == medY) {
        println(answer.toString() + " 1")
    }  else {
        println(answer.toString() + " 0")
    }
}

Measured memory_bytes: 37980
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

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

	int N,K,S; cin >> N >> K >> S;
	int inf = 1e9;
	if (inf == S) {
		inf = 1;
	}

	for (int i = 0; i < N; i++) {
		if (i < K) {
			cout << S << " ";
		}else {
			cout << inf << " ";
		}
	}
	cout << endl;
	

	
	return 0;
}


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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		int ab = Integer.parseInt(a+b);
		for(int i=1;i<1000;i++) {
			if(i*i==ab) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main()
{
    ll n; cin >> n;
    vector<ll> a(n+1000); rep(i, n) cin >> a[i];
    ll q; cin >> q;
    ll sum = 0;
    rep(i,n) sum += a[i];
    vector<ll> cnt(130000,0);
    rep(i,n){
        cnt[a[i]]++;
    }
    rep(i,q){
        //rep(i,n) cout << cnt[i] << " ";
        //cout << endl;
        ll b,c; cin>> b >> c;
        ll d = c-b;
        //bの数を数える
        sum += cnt[b]*d;
        cout << sum << endl;
        cnt[c] += cnt[b];
        cnt[b] = 0;
    }
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ d.cpp
./a.out

サンプルのダウンロードは oj d https://atcoder.jp/contests/abc171/tasks/abc171_d
テストは oj t
*/


Measured memory_bytes: 5028
import sys
input = sys.stdin.readline
a,b = map(int,input().split())
if a >0:
    a-=1
bit = [0]*42
c = b+0
i= 0
while c>1:
    c//=2
    i+=1
bit[i] += b - 2**i+1
for j in range(i):
    bit[j] += 2**i//2
for j in range(i):
    bit[j] += (b-2**i)//(2**(j+1))*(2**j)
    bit[j] += max(0,(b-2**i)%(2**(j+1))-2**j+1)

b = a
c = b+0
i= 0
while c>1:
    c//=2
    i+=1
bit[i] -= b - 2**i+1
for j in range(i):
    bit[j] -= 2**i//2
for j in range(i):
    bit[j] -= (b-2**i)//(2**(j+1))*(2**j)
    bit[j] -= max(0,(b-2**i)%(2**(j+1))-2**j+1)

ans = 0
for i in range(42):
    if bit[i] %2 == 1:
        ans += 2**i
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
int main(void) {
	int N, M, C;
	scanf("%d%d%d", &N, &M, &C);
	int B[20];
	int A[20][20];
	int sum = 0;
	int count = 0;
	for (int i = 0; i < M; i++) {
		scanf("%d", &B[i]);
	}
	for (int i = 0; i < N; i++) {
			for (int j = 0; j < M; j++) {
			scanf("%d", &A[i][j]);
			sum += A[i][j]*B[j];
			if (j == M - 1) {
				if (sum+C > 0) {
					count++;
				}
				sum = 0;
			}
		}
	}

	printf("%d", count);
	return 0;

	}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    ll N, P;
    cin >> N >> P;

    if (N == 1) {
        cout << P << '\n';
        return 0;
    }

    ll ans = 1;
    for (ll i = 2; i * i <= P; ++i) {
        ll tmp    = P;
        bool flag = true;
        rep(j, N) {
            if (tmp % i != 0) {
                flag = false;
                break;
            }
            tmp /= i;
        }
        if (tmp < 1) break;
        if (flag) ans = max(ans, i);
    }
    cout << ans << endl;
}


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

#include <iostream>
using namespace std;


int main() {

	int n;
	cin >> n;

	vector<int> a(n, 0);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	int x = floor((float)sum / n);
	int y = ceil((float)sum / n);

	long long totalStaminax = 0;
	long long totalStaminay = 0;
	for (int i = 0; i < n; i++) {
		totalStaminax += pow((a[i] - x), 2);
		totalStaminay += pow((a[i] - y), 2);
	}

	if (totalStaminax < totalStaminay) {
		cout << totalStaminax;
	}
	else {
		cout << totalStaminay;
	}
}

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

int main(){
    int N, M;
    cin >> N;
    vector<string> s(N);
    for (int n=0; n<N; n++){
        cin >> s.at(n);
    }
    cin >> M;
    vector<string> t(M);
    for (int m=0; m<M; m++){
        cin >> t.at(m);
    }
    int max_payment = 0;
    for (int n=0; n<N; n++){
        int payment = 0;
        for (int i=0; i<N; i++){
            if (s.at(n) == s.at(i)) payment++;
        }
        for (int j=0; j<M; j++){
            if (s.at(n) == t.at(j)) payment--;
        }
        if (payment > max_payment) max_payment = payment;
    }
    /*
    for (int m=0; m<M; m++){
        int payment = 0;
        for (int i=0; i<N; i++){
            if (t.at(m) == s.at(i)) payment++;
        }
        for (int j=0; j<M; j++){
            if (t.at(m) == t.at(j)) payment--;
        }
        if (payment > max_payment) max_payment = payment;
    }
    */
    cout << max_payment << endl;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a), _##i = (b); i < _##i; ++i)
#define REP(i, a) for (int i = 0, _##i = (a); i < _##i; ++i)
#define pb push_back
typedef long long LL;
LL s,c;
int main(){
//	freopen("test.in","r",stdin);	
	cin >> s >> c;
	if(s*2 >= c ){				
		cout << c/2  << endl;
	}else{
		c-= 2*s;
		cout << s + c/4 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {

    int D, N;

    cin >> D >> N;
    int i, ans;

    if( N < 100 )
    {
        ans = N;
    }
    else
    {
        ans = N+1;
    }
    
    for( i = 0; i < D; i++ )
    {
        ans *= 100;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

string s;
int n;
map<string, int> weight;
bool unknown;

int number(int &i) {
  int res = 0;
  while (isdigit(s[i])) res = res*10 + (s[i++]-'0');
  return res;
}

string atom(int &i) {
  string res = string(1, s[i++]);
  while (islower(s[i])) res += s[i++];
  return res;
}

int molecule(int &i) {
  if (i < n && s[i] != ')') {
    if (isupper(s[i])) {
      string m = atom(i);
      int num = number(i);
      if (weight.find(m) == weight.end()) unknown = true;
      return weight[m] * (num ? num : 1) + molecule(i);
    } else if (s[i] == '(') {
      i++;  // (
      int w = molecule(i);
      i++;  // )
      int num = number(i);
      return w * (num ? num : 1) + molecule(i);
    }
  }
  return 0;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (getline(cin, s), s != "END_OF_FIRST_PART") {
    stringstream ss(s);
    string atom;
    int w;
    ss >> atom >> w;
    weight[atom] = w;
  }

  while (cin >> s, s != "0") {
    n = s.size();
    unknown = false;
    int i = 0, ans = molecule(i);
    if (unknown) cout << "UNKNOWN" << endl;
    else cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 3132
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n,t;
  cin>>n>>t;
  vector<string> name(n);
  vi ans;
  vi t1(n,0),t2(n,0);
  rep(i,n){
    string s1,s2,s3,s4;
    cin>>s1>>s2>>s3>>s4;
    name[i]=s4;
    t1[i]=(s1[0]*10+s1[1])*60+s1[3]*10+s1[4];
    t2[i]=(s3[0]*10+s3[1])*60+s3[3]*10+s3[4];
  }
  rep(i,n-1)
    if(t1[i+1]-t2[i]>=t)ans.push_back(i);
  cout<<ans.size()<<endl;
  rep(i,ans.size())
    cout<<name[ans[i]]<<" "<<t1[ans[i]+1]-t2[ans[i]]<<endl;
}

Measured memory_bytes: 3236
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        char[] s = sc.next().toCharArray();
        int now = 0;
        for(char c : s){
            now += c-'0';
        }
        pw.println(now % 9 == 0 ? "Yes" : "No");
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

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

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

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

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

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

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

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

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


Measured memory_bytes: 30008
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <tuple>
#include <cmath>
#include <iomanip>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
using namespace std;

int N;
int A[100000 + 10];
int B[100000 + 10];
pair<ll, ll> diff[100000 + 10];

int main(void) {
    cin >> N;
    ll A_sum = 0;
    rep(i, N) {
        cin >> A[i];
        A_sum += A[i];
    }
    ll B_sum = 0;
    rep(i, N) {
        cin >> B[i];
        B_sum += B[i];
    }
    
    if (A_sum < B_sum) {
        cout << -1 << endl;
        return 0;
    }
    
    ll insuf = 0;
    int insuf_num = 0;
    rep(i, N) {
        diff[i] = mp(B[i]-A[i], i);
        if (B[i]-A[i] > 0) {
            insuf += B[i]-A[i];
            insuf_num++;
        }
    }
    
    if (insuf == 0) {
        cout << 0 << endl;
        return 0;
    }
    sort(diff, diff+N); //大幅に足りている→全然足りてない の順にソート
    
    int ans=0;
    bool flag = false;
    for (int i=0; diff[i].fi < 0; i++) {
        if (insuf > -(diff[i].fi)) {
            insuf += diff[i].fi;
            ans++;
        } else {
            flag = true;
            ans++;
            break;
        }
    }
    
    if (flag) {
        cout << ans + insuf_num << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 2560
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class A
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = Scanner.Scan<int>();
            var n = N % 10;
            var answer = "";
            switch (n)
            {
                case 2:
                case 4:
                case 5:
                case 7:
                case 9: answer = "hon"; break;
                case 0:
                case 1:
                case 6:
                case 8: answer = "pon"; break;
                case 3: answer = "bon"; break;
                default: break;
            }

            Console.WriteLine(answer);
        }

        public static class Scanner
        {
            private static Queue<string> queue = new Queue<string>();
            public static T Next<T>()
            {
                if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item);
                return (T)Convert.ChangeType(queue.Dequeue(), typeof(T));
            }
            public static T Scan<T>() => Next<T>();
            public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>());
            public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>());
            public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>());
            public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>());
            public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T)));
        }
    }
}


Measured memory_bytes: 28244
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli,lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout<<(x?"Yes":"No")<<endl;
#define out(s) cout<<s<<endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define LINF 9000000000000000000
#define all(s) s.begin(),s.end()
void vout(vi v){
    for(int i=0;i<v.size();i++)
    cout<<v.at(i)<<endl;
}
int main(){
    string a = "AAA", b = "BBB", s;
    cin >> s;
    YN(s != a && s != b);
}

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

typedef long long ll;

static const int MAX = 2005;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
    return arg1.first > arg2.first;
}

int main(void) {
    int n, x, y;
    cin >> n >> x >> y; x--; y--;

    vector<int> ans(n);
    int d;
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            d = min({abs(j-i), abs(abs(x-i)+abs(j-y)+1)});
            ans.at(d)++;
        }
    }

    for(int i=1;i<n;i++) {
        cout << ans.at(i) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    char s[100000] = {0};
    scanf("%s",s);
    int n = 0;
    while(s[n]){
        n++;
    }
    int i;
    int zero = 0, one = 0; 
    for(i = 0; i < n; i++){
        if(s[i] == '1'){
            one++;
        }else{
            zero++;
        }
    }
    if(one < zero){
        printf("%d\n",one*2);
    }else{
        printf("%d\n",zero*2);
    }
    return 0;
}


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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define mod2 1000000000
#define mod1 998244353
#define lol ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define F(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define ss second
int main()
{
    ll x,n;cin >> x;cin >> n;
    set <ll> s1;
    while(n--)
    {
        ll x1;cin >> x1;
        s1.insert(x1);
    }
    ll x1 = x;
    ll x2 = x;
    if(s1.find(x1)==s1.end())
    {
        cout << x1 << endl;
        return 0;
    }
    x1++;
    x2--;
    while(1)
    {
        if(s1.find(x2)==s1.end())
        {
            cout << x2 << endl;
            return 0;
        }
        if(s1.find(x1)==s1.end())
        {
            cout << x1 << endl;
            return 0;
        }
        x1++;
        x2--;
    }
}

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

int main(){
	int n;
	scanf("%d",&n);
	string s,t;
	cin >> s >> t;
	for(int i = 0;i < n;i++) printf("%c%c",s[i],t[i]);
	cout << endl;
	return 0;
} 

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

int main()
{
	string s;
	cin >> s;

	map<char, int> mp;
	for (auto &&c : s)
	{
		mp[c]++;
	}

	for (auto &&p : mp)
	{
		if (1 < p.second)
		{
			cout << "no" << endl;
			return 0;
		}
	}

	cout << "yes" << endl;

	return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String x = sc.next();
        int count = 0;
        while(true){
            String a = sc.next();
            if(a.equals("END_OF_TEXT")) break;
            if(a.equalsIgnoreCase(x)) count++;
        }
        System.out.printf("%d\n",count);
    }
}


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

namespace _0036
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] map = MakeWholeMap();
            Console.WriteLine(CheckParts(map));
            while (Console.ReadLine() != null)
            {
                map = MakeWholeMap();
                Console.WriteLine(CheckParts(map));
            }
        }
        static string[] MakeWholeMap()
        {
            string[] map = new string[8];
            for (int i = 0; i < 8; ++i)
            {
                map[i] = Console.ReadLine();
            }
            return map;
        }
        static string CheckParts(string[] map)
        {
            if (PartsB(map))
                return "B";
            else if (PartsC(map))
                return "C";
            else
                return PartsADEFG(map);
        }
        static bool PartsB(string[] map)
        {
            for (int i = 0; i < 8; ++i)
            {
                for (int j = 0; j < 5; ++j)
                {
                    if (map[j].Substring(i, 1) == "1" && map[j + 3].Substring(i, 1) == "1")
                        return true;
                }
            }
            return false;
        }
        static bool PartsC(string[] map)
        {
            for (int i = 0; i < 8; ++i)
            {
                for (int j = 0; j < 5; ++j)
                {
                    if (map[i].Substring(j, 1) == "1" && map[i].Substring(j + 3, 1) == "1")
                        return true;
                }
            }
            return false;
        }
        static string PartsADEFG(string[] map)
        {
            for (int i = 0; i < 8; ++i)
            {
                for (int j = 0; j < 7; ++j)
                {
                    if (map[i].Substring(j, 2) == "11")
                    {
                        if (map[i + 1].Substring(j, 1) == "1" && map[i + 1].Substring(j + 1, 1) == "1")
                            return "A";
                        if (i != 0)
                        {
                            if (map[i + 1].Substring(j, 1) == "1" && map[i - 1].Substring(j + 1, 1) == "1")
                                return "D";
                            else if (map[i - 1].Substring(j, 1) == "1" && map[i + 1].Substring(j + 1, 1) == "1")
                                return "F";
                        }
                        if (j != 6)
                        {
                            if (map[i + 1].Substring(j + 1, 1) == "1" && map[i + 1].Substring(j + 2, 1) == "1")
                                return "E";
                        }
                        if (j != 0)
                        {
                            if (map[i + 1].Substring(j - 1, 1) == "1" && map[i + 1].Substring(j, 1) == "1")
                                return "G";
                        }
                    }
                }
            }
            return "MISS";
        }
    }
}



Measured memory_bytes: 13844
import java.util.Scanner;
public class Main {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);

		String N = null;
		int result = 0;

		N = sc.next();
		result = N.indexOf("9");

		if(result != -1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}


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

using namespace std;

typedef long long ll;
 
const int MOD = 1e9 + 7;
 
ll n,dp[3100][3100];

char s1[3100],s2[3100],sol[3100];

int main() {
	
	scanf("%s %s",s1,s2);
	
	int n1 = strlen(s1);
	int n2 = strlen(s2);
	
	for(int i = 1; i <= n1; i++) {
		for(int j = 1; j <= n2; j++) {
			if(s1[i - 1] == s2[j - 1]) dp[i][j] = dp[i - 1][j - 1] + 1;
			else dp[i][j] = max(dp[i - 1][j],dp[i][j - 1]);
		}
	}
	int i = n1, j = n2, br = 0;
	while(dp[i][j]) {
		//printf("%d %d %d\n",dp[i][j],i,j);
		if(s1[i - 1] == s2[j - 1]) {
			//printf("%d %c %c\n",br,s1[i - 1],s2[j - 1]);
			
			i--; j--;
			sol[br] = s1[i];
			br++;
		}
		else if(dp[i - 1][j] > dp[i][j - 1]) i--;
		else j--;
	}
	
	for(int i = br - 1; i >= 0; i--) printf("%c",sol[i]);
	
	return 0;
}

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> void YesNo(T a) {cout<<(a?"Yes":"No")<<endl;}
template<class T> void YESNO(T a) {cout<<(a?"YES":"NO")<<endl;}
void vin(Vi &v){REP(i,0,(v).size()) cin>>v[i];}
void vin(Vi &v,Vi &v2){REP(i,0,(v).size()) cin>>v[i]>>v2[i];}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
void accum(Vi &v){REP(i,1,(v).size()) v[i]+=v[i-1];}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    Vi a(n);
    REP(i,0,n) cin>>a[i];

    int now=1,ans=0;
    REP(i,0,n){
        if(a[i]==now) now++;
        else ans++;
    }
    if(ans==n) cout<<-1<<endl;
    else cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <limits.h>
using namespace std;
int main(void){

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    long long ans = (2 * C * 0) + (A * max(X-0,0)) + (B * max(Y-0,0));
    
    for(int i = 1; i <= 100000; i++){
        long long buy = (2 * C * i) + (A * max(X-i,0)) + (B * max(Y-i,0));
        if(ans > buy) ans = buy;
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int a[32] = {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() {
	int x; cin >> x; cout << a[x-1] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		while (true) {
			int h = scan.nextInt();
			int w = scan.nextInt();
			if (h == 0 && w == 0) break;
			for (int i = 0; i < h; i++) {
				boolean flag = true;
				for (int j = 0; j < w; j++) {
					if (i % 2 == 0) {
						if (flag == true) {
							System.out.print("#");
							flag = false;
						} else {
							System.out.print(".");
							flag = true;
						}
					} else {
						if (flag == true) {
							System.out.print(".");
							flag = false;
						} else {
							System.out.print("#");
							flag = true;
						}
					}
				}
				System.out.println();
			}
			System.out.println();
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int const N = 100;
int n;
double an[N], pi = acos(-1.0);

struct V{
	int x, y, id;
	V(){}
	V(int a, int b):x(a), y(b) {}
	void sc(int i) { scanf("%d%d", &x, &y); id = i; }
	bool operator <(V const o)const { if (x == o.x)return y < o.y; return x < o.x; }
	V operator -(V const o)const { return V(x - o.x, y - o.y); }
	V operator +(V const o)const { return V(x + o.x, y + o.y); }
	ll operator |(V const o)const { return (ll)x * o.y - (ll)o.x * y; }
	ll operator *(V const o)const { return (ll)x * o.x + (ll)o.y * y; }
	ll L() { return (ll)x * x + (ll)y * y; }
}p[N];

inline bool cmp0(V const a, V const b){
	V ap = a - p[0], bp = b - p[0];
	ll t = ap | bp;
	if (t == 0)return ap.L() < bp.L();
	return t > 0;
}
inline bool cmp(V const a, V const b, V const c) { return (a - c | b - c) >= 0; }

vector<int> v;

void ch(){
	v.push_back(0);
	v.push_back(1);
	f(i, 2, n){
		while ((int)v.size() > 1 && cmp(p[i], p[v.back()], p[v[v.size() - 2]]))v.pop_back();
		v.push_back(i);
	}
}

int main(){
	scanf("%d", &n);
	f(i, 0, n)p[i].sc(i);
	sort(p, p + n);
	sort(p + 1, p + n, cmp0);
	ch();
	if ((int)v.size() == 2)f(i, 0, v.size())an[p[v[i]].id] = 0.5;
	else f(i, 0, v.size()){
		int af = i + 1 == (int)v.size() ? 0 : i + 1, bf = i ? i - 1 : (int)v.size() - 1;
		V a = p[v[af]] - p[v[i]], b = p[v[i]] - p[v[bf]];
		double cth = b * a / (sqrt(b.L()) * sqrt(a.L()));
		double th = acos(cth);
		an[p[v[i]].id] = th / (2.0 * pi);
	}
	f(i, 0, n)printf("%.7lf\n", an[i]);
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define SORT(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }




int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n + 1);
	rep(i, m) {
		int b;
		cin >> b;
		a[b] = 1;
	}
	vector<ll> x(n + 1);
	x[0] = 1;
	FOR(i, 1, n + 1) {
		if (a[i] == 1) {
			x[i] = 0;
		}
		else {
			if (i >= 2) {
				x[i] = x[i - 1] + x[i - 2];
				x[i] = x[i] % mod;
			}
			else {
				x[i] = x[i - 1];
				x[i] = x[i] % mod;
			}
			
		}
	}
	cout << x[n] << endl;
}



Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 文字列の入力
		String s1 = sc.next();
		String s2 = sc.next();
      int counter =  s1.length();
		for(int i = 0; i < s1.length() ; i++){
			if(s1.substring( i, i + 1).equals (s2.substring(i, i + 1))){
				counter -= 1;
			}	
		}
		// 出力
		System.out.println(counter);
	}
}

Measured memory_bytes: 55200
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

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

   int ans = max({2*a-1,a+b,2*b-1});

   cout << ans << endl;






   return 0;
}

Measured memory_bytes: 256
N, K = [int(n) for n in input().split()]

count = 0
for b in range(1, N + 1):
  p = N // b 
  count += p * max(0, b - K)
  r = N % b
  count += max(r - K + 1, 0)
if K == 0:
  count -= N
print(count)
  



Measured memory_bytes: 2940
package main

import "fmt"

var INF int = 1001001001

func main() {
	var N, M int
	fmt.Scan(&N, &M)
	var A, B int
	E := make([][]int, N)
	for i := 0; i < N; i++ {
		E[i] = make([]int, 0)
	}
	for i := 0; i < M; i++ {
		fmt.Scan(&A, &B)
		A = A - 1
		B = B - 1
		E[A] = append(E[A], B)
		E[B] = append(E[B], A)
	}
	dist := make([]int, N)
	pre := make([]int, N)
	var q []int
	for i := 0; i < N; i++ {
		dist[i] = INF
		pre[i] = -1
	}
	dist[0] = 0
	q = append(q, 0)
	for len(q) > 0 {
		v := q[0]
		q = q[1:]
		for i := 0; i < len(E[v]); i++ {
			u := E[v][i]
			if dist[u] != INF {
				continue
			}
			dist[u] = dist[v] + 1
			pre[u] = v
			q = append(q, u)
		}
	}
	fmt.Println("Yes")
	for i := 1; i < N; i++ {
		ans := pre[i]
		ans++
		fmt.Println(ans)
	}
}


Measured memory_bytes: 19896
#include <iostream>
#define ll long long
#include <cstring>
using namespace std;

int arr[500005];
int main() {
  string s;
  cin >> s;

  memset(arr, 0, sizeof(arr));

  ll ans = 0;
  int cntr = 0;
  for (int i = 0; i < s.length(); i++){
    if (s[i] == '<'){
      arr[i+1] = arr[i]+1;
    }
  }

  for (int i = s.length()-1; i >= 0; i--){
    if (s[i] == '>'){
      if (arr[i] < arr[i+1] + 1)
        arr[i] = arr[i+1] + 1; 
    }
    ans = ans + arr[i];
  }


  cout << ans + arr[s.length()] << endl;
}

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

using namespace std;

int main() {
	#ifdef HOME
		freopen("input.txt", "rt", stdin);
	#endif
	int n, r;
	cin >> n >> r;
	int ans = 0;
	while (n > 0) {
		n /= r;
		ans++;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


void f(int w,int h){
  int maze[300][300]={};
  int d[300][300]={};
  rep(i,2*h-1){
    if(i%2==0){
      rep(j,w-1){
        cin>>maze[i][2*j+1];
      }
    }
    else{
      rep(j,w){
        cin>>maze[i][2*j];
      }
    }
  }


  rep(i,300){
    rep(j,300){
      d[i][j]=inf;
    }
  }
  d[0][0]=1;
  queue<P> q;
  q.push(P(0,0));

  while(q.size()){
    P p = q.front(); q.pop();
    for(int i=-2;i<=2;i+=2){
      for(int j=-2;j<=2;j+=2){
        if(i*j) continue;
        int x=p.first+i;
        int y=p.second+j;
        if(0<=x&&x<2*w&&0<=y&&y<2*h){
          if(i==2&&maze[y][x-1]) continue;
          if(j==2&&maze[y-1][x]) continue;
          if(i==-2&&maze[y][x+1]) continue;
          if(j==-2&&maze[y+1][x]) continue;
          if(d[y][x]>d[y-j][x-i]+1){
            d[y][x]=d[y-j][x-i]+1;
            q.push(P(x,y));
          }
        }
      }
    }
  }

  if(d[2*h-2][2*w-2]==inf){
    cout<<0<<endl;
  }
  else{
    cout<<d[2*h-2][2*w-2]<<endl;
  }
 

}


int main(){
  while(1){
    int w,h;
    cin>>w>>h;
    if(w==0) break;
    f(w,h);
  }

  return 0;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define in insert
#define vll vector<ll>
#define endl "\n"
#define pll pair<ll,ll>
#define all(x) (x).begin() , (x).end()
#define f first
#define s second
#define pr(x) cout<<x<<endl;
#define pr2(x,y) cout<<x<<" "<<y<<endl;
#define pr3(x,y,z) cout<<x<<" "<<y<<endl;
#define prv(v) for(auto x:v) cout<<x<<" ";
#define ffs fflush(stdout);
#define int ll
#define sz(x) (ll)x.size()
using namespace std;
 
 
const ll MOD = 1e9+7;
const ll INF = 1e9;
const ll LOG = 29;
#define PI 3.141592653589793238 
 
 
 


const ll N =(1e5+5);

ll fact[N];

long long binpow(long long a, long long b) {
     a%=MOD;    
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res * a)%MOD;
        a = (a * a)%MOD;
 
        
        b >>= 1;
    }
     res%=MOD;
    return res;
}
void ini(){
    fact[0] = 1;
    for(int i = 1;i < N;i++){
        fact[i] = (fact[i-1] * i)%MOD;
    }
}
ll ncr(ll n,ll r){
    ll ret = fact[n];
    ret = (ret * binpow(fact[r],MOD-2))%MOD;
    ret = (ret * binpow(fact[n-r],MOD-2))%MOD;
    return ret;
}
ll a[N];
map<ll,ll> idx;
ll b[N];
void solve(){
    ll n;
    cin >> n;

    for(int i =1;i<=n;i++){
        cin >> a[i];
        b[i] = a[i];
    }
    sort(b+1,b+n+1);
    for(int i = 1;i<=n;i++){
        idx[b[i]] = i;
    }
    ll ans = 0;
    for(int i = 1;i<=n;i++){
        if((i&1) == (idx[a[i]] & 1)){
            continue;
        }
        ans += 1;
    }    
    cout << ans/2 << endl;
}


 
   
 
 
 /*
 2 3 4 5 6 
 3 6 10 15 21 
 4 10 20 35 56 
 5 15 35 70 126 
 6 21 56 126 252 
*/
 
 
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
       
 
    ll tt=1;
    while(tt--){
        solve();
    }    
}

Measured memory_bytes: 8064