akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
 
using namespace std;
 
typedef long long ll;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
    
 #define sz(x) (int)(x).size()
 #define mp make_pair
 #define pb push_back
 #define all(x) x.begin(), x.end()
 
 #define PI 3.14159265358979323846264338327950L
const int MOD = 1000000007;
 
int main() 
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    int n;cin>>n;
    int d1,d2;
    
    int c=0;
    bool flag = false;
    for(int i=0;i<n;++i)
    {
        cin>>d1>>d2;
        if(d1==d2) c++;
        else c=0;

        if(c==3)
        {
            flag = true;
            break;
        }
    }

    if(flag) cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define sym cout<<"---------"<<endl;
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0
#define int ll

int have,a,book;

signed main(){
  cin>>have>>a>>book;
  if(have>=book){
    cout<<0<<en;
    RE;
  }else if(book>a+have){
    cout<<"NA"<<en;
    RE;
  }else{
    cout<<book-have<<en;
  }
  RE;
}




Measured memory_bytes: 3104
import java.util.*;
import java.math.*;
import java.awt.geom.*;
import java.io.*;
    
    
public class Main {
	static int INF = 2 << 27;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if(n == 0) break;
			int[] count = new int[3];
			int[] sum   = new int[3];
			for(int i = 0; i < n; i++) {
				String[] in = sc.next().split(":");
				if(in[0].equals("00")) {
					in[0] = "24";
				}
				if(in[0].equals("01")) {
					in[0] = "25";
				}
				int MM = sc.nextInt();
				int time = Integer.parseInt(in[0]) * 60 + Integer.parseInt(in[1]);
				
				int TIMEA = Integer.parseInt(in[0]) * 60 + MM - time;
				int TIMEB = Integer.parseInt(in[0]) * 60 + MM + 60 - time;
				int DIS   = (TIMEA < 0)?TIMEB:Math.min(TIMEA, TIMEB);
				if(time >= 11 * 60 && time <= 14*60 + 59) {
					count[0]++;
					if(DIS <= 8) {
						sum[0]++;
					}
				}
				else if(time >= 18 * 60 && time <= 20 * 60 + 59) {
					count[1]++;
					if(DIS <= 8) {
						sum[1]++;
					}
				}
				else if(time >= 21 * 60 && time <= 25 * 60 + 59) {
					count[2]++;
					if(DIS <= 8) {
						sum[2]++;
					}
				}
			}
			double A = 0;
			double B = 0;
			double C = 0;
			if(count[0] != 0) A = (sum[0]/(double)count[0]) * 100;
			if(count[1] != 0) B = (sum[1]/(double)count[1]) * 100;
			if(count[2] != 0) C = (sum[2]/(double)count[2]) * 100;
			
			int AA = (int)A;
			int BB = (int)B;
			int CC = (int)C;
			
			System.out.println("lunch " + ((count[0] == 0)?"no guest":AA));
			System.out.println("dinner " + ((count[1] == 0)?"no guest":BB));
			System.out.println("midnight " + ((count[2] == 0)?"no guest":CC));
			
		}
	}
}

Measured memory_bytes: 34680
/*ॐॐ*/
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different.
Change variable names or change some Data structres or anything just make sure MOSS do not
Detect Anything.
Yours Faithfully
Shobhit Yadav */

/* I do not fear this new challenge. Rather like a true warrior I will rise to meet it. 
                                       -Prince Vegeta  */

 /* “Strength is the only thing that matters in this world. Everything else is just a delusion for the weak.” – Vegeta */

#include<bits/stdc++.h>
using namespace std;
#define ll long long int



double D,S,T;
/*ll freq[200005];*/
void solve(){
   /*memset(freq,0,sizeof(freq));*/
  cin>>D>>T>>S;

  double ans ;

  ans = double(D/S);

  if(ans<=T)
    cout<<"Yes"<<'\n';

  else
    cout<<"No"<<'\n';




}



int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  
   solve();

  return 0;
}


Measured memory_bytes: 3724
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
#include <cassert>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	vector<int> v(n);
	for (auto& x : v) cin >> x;
	sort(v.begin(), v.end());
	LL ans = 0;
	for (int i = 0; i < v.size(); i++)
	{
		int ptr = 0;
		for (int j = i + 1; j < v.size(); j++)
		{
			while (ptr < v.size() && v[ptr] < v[i] + v[j]) ptr++;
			ans += ptr - 1 - j;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
def solve(string):
    *abcde, = map(int, string.split())
    abcde.sort(key=lambda x: (x-1) % 10)
    return "{}".format(abcde[0] + sum([((i - 1) // 10 + 1) * 10 for i in abcde[1:]]))


if __name__ == '__main__':
    print(solve('\n'.join([input() for _ in range(5)])))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 11;
int L[N], R[N], n, mark[N], ans[N];
int head[N], nex[N<<1], to[N<<1], size;
void add(int u, int v){
    nex[++size] = head[u];
    to[size] = v;
    head[u] = size;
}
void dfs(int u, int fa){
    for(int i = head[u];i;i = nex[i]){
        int v = to[i];
        if(v == fa)continue;
        dfs(v, u);
        if(mark[v] == -1)continue;
        if(mark[u] == -1)mark[u] = mark[v] ^ 1;
        else{
            if((mark[v] ^ 1) != mark[u]){
                puts("No");
                exit(0);
            }
        }
        L[u] = max(L[u], L[v] - 1);
        R[u] = min(R[u], R[v] + 1);
    }
    if(L[u] > R[u]){
        puts("No");
        exit(0);
    }
    if(ans[u] != ans[0]){
        if(mark[u] == -1)mark[u] = ans[u] & 1;
        if(L[u] > ans[u] || R[u] < ans[u] || (ans[u] & 1) != mark[u]){
            puts("No");
            exit(0);
        }
        L[u] = R[u] = ans[u];
    }
}
void get(int u, int fa){
    //printf("u=%d ans[u]=%d ans0=%d\n", u, ans[u], ans[0]);
    if(ans[u] == ans[0]){
        if(ans[fa] + 1 >= L[u] && ans[fa] + 1 <= R[u])ans[u] = ans[fa] + 1;
        else if(ans[fa] - 1 >= L[u] && ans[fa] - 1 <= R[u]) ans[u] = ans[fa] - 1;
        else {
            puts("No"); exit(0);
        }
        //printf("u=%d ans=%d\n", u, ans[u]);
    }
    //puts("XBX");
    for(int i = head[u];i;i = nex[i]){
        int v = to[i];
        //printf("u=%d v=%d fa=%d\n", u, v, fa);
        if(v == fa)continue;
        get(v, u);
    }
}
int main(){
    cin>>n;
    int u, v;
    for(int i = 1;i < n; i++){
        scanf("%d%d", &u, &v);
        add(u, v); add(v, u);
    }
    int k;
    scanf("%d", &k);
    memset(L, -127, sizeof(L));
    memset(R, 127, sizeof(R));
    memset(ans, -127, sizeof(ans));
    memset(mark, -1, sizeof(mark));
    for(int i = 1;i <= k; i++){
        scanf("%d", &u);
        scanf("%d", &ans[u]);
        mark[u] = ans[u] & 1;
    }
    dfs(u, u);
    get(u, u);
    puts("Yes");
    for(int i = 1;i <= n; i++){
        //printf("i=%d L=%d R=%d ans=%d mark=%d\n", i, L[i], R[i], ans[i], mark[i]);
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 9088
class Pond:
    def __init__(self, down_x, area):
        super().__init__()
        self.down_x = down_x
        self.area = area


s = []
ponds = []
all_area = 0
x = 0
for c in input():
    if "\\" == c:
        s.append(x)
    elif "/" == c and s:
        down_x = s.pop()
        area = x - down_x
        all_area += area
        while ponds and ponds[-1].down_x > down_x:
            area += ponds[-1].area
            ponds.pop()
        ponds.append(Pond(down_x, area))
    x += 1
print(all_area)
if ponds:
    print(len(ponds), ' '.join(map(lambda pond: str(pond.area), ponds)))
else:
    print(0)



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

long long int countNum(long long int a, long long int b, long long int n)
{
    return b / n - max((a-1)/n,0ll);
}

long long int ggd(long long int c, long long int d)
{
    long long int x = c, y = d;
    if(d > c)
    {
        x = d;
        y = c;
    }
    while(x % y != 0)
    {
        long long int t = y;
        y = x % y;
        x = t;
    }
    return y;
}

long long int lcm(long long int c, long long int d)
{
    return c*d/ggd(c,d);
}

int main()
{
    long long int a,b,c,d;
    cin >> a >> b >> c >> d;
    long long int cnum = countNum(a,b,c);
    long long int dnum = countNum(a,b,d);
    long long int cdLcm = lcm(c,d);
    long long int cdnum = countNum(a,b,cdLcm);
    cout << b-a+1 - cnum - dnum + cdnum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    cin >> N;
    vector<int64_t> A(N);
    set<int64_t> B[2];
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        B[i % 2].insert(A[i]);
    }
    sort(A.begin(), A.end());
    int ans = 0;
    for(int i = 0; i < N; i++) {
        if( !B[i & 1].count(A[i]) ) {
            ans++;
        }
    }
    cout << (ans / 2) << endl;
    return 0;
}

Measured memory_bytes: 5760
#include<iostream>
using namespace std;
int main() {
	char s[100001];
	cin >> s;
	int ans = 0;
	for (int i = 0;s[i] != '\0';i++) {
		if (i % 2 == 0) {
			if (s[i] == 'g') {
				
			}
			else {
				ans--;
			}
		}
		else {
			if (s[i] == 'g') {
				ans++;
			}
			else {

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

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

using namespace std;

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i <= n; i++) {
    int cnt = i * m;
    for (int j = 0; j <= m; j++) {
      cnt -= i;
      cnt += n - i;
      if (cnt == k) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;

  return 0;
}

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

int main() {
    string s;
    bool f = true;
    cin >> s;
    vector<string> vec;
    vec = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};

    rep(i,vec.size()){
        if(s == vec.at(i)){
            f = false;
        }
    }

    if(f){
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    }

    return 0;
}



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

/************************** definations *******************************/
#define pi              2*acos(0.0)
#define ll              long long int
#define sc1(a)          scanf("%lld",&a)
#define sc2(a,b)        scanf("%lld %lld",&a,&b)
#define pf1(a)          printf("%lld\n",a)
#define pf2(a,b)        printf("%lld %lld\n",a,b)
#define Case(a)         printf("Case %d: ",a)
#define Casel(a)        printf("Case %lld: ",a)
#define INF             1e9
#define INFL            1e18
#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair
#define NEWLINE         cout << endl;
#define DONE            cerr << "Done" << endl
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << endl
#define READ            freopen("alu.txt", "r", stdin)
#define WRITE           freopen("vorta.txt", "w", stdout)
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)
#define M               10000007
#define mod             100000007
/************************** definations *******************************/

int main()
{
    FASTIO;
    int m,n;
        cin>>m>>n;
        n =2*n;
        int d= m-n;
        if(d>=0){
            cout<<d<<endl;
        }
        else {
            cout<<0<<endl;
        }

}

Measured memory_bytes: 256
import sys
from math import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    K = int(readline())

    ans = 0
    for a in range(1, K + 1):
        for b in range(1, K + 1):
            g = gcd(a, b)
            for c in range(1, K + 1):
                ans += gcd(g, c)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 69904
#include<stdio.h>
int main(void)
{
	char a[1200];
	int b;
	for(b=0;a[b-1]!='\n';b++){
		scanf("%c",&a[b]);
		if(65<=a[b] && 90>=a[b]){
			a[b]+=32;
		}else{
			if(97<=b[a] && 122>=a[b]){
				a[b]-=32;
			}
		}
	}
	a[b-1]=0;
	printf("%s\n",a);
	return 0;
}


Measured memory_bytes: 2088
D = int(input())
C = list(map(int, input().split()))
S = [tuple(map(int, input().split())) for _ in range(D)]
Z = 26

last = [-1] * Z
T = []
for d in range(D):
    maxScore = -float('inf')
    cand = 0
    for i in range(26):
        tmp = last[i]
        last[i] = d
        up = S[d][i]
        down = sum(C[j] * (d - last[j]) for j in range(Z))
        score = up - down
        if maxScore < score:  # ここの比較を"<="にするかどうかで得点が変わりそう...試していないが..
            cand = i
            maxScore = score
        last[i] = tmp
    last[cand] = d
    T.append(cand + 1)
print(*T, sep='\n')

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

using namespace std;

int arr[2005][2005];
int Count[2005];

int main()
{
    int i,j,k,n,x,y;

    cin >> n >> x >> y;

    for(i=1; i<n; i++)
    {
        for(j=i+1; j<=n; j++)
        {
            arr[i][j] = 1 + arr[i][j-1];
        }
    }

    arr[x][y] = 1;

    ///right
    for(i=x, j=y+1; j<=n; j++)
    {
        if(arr[i][j] > arr[i][j-1]+1)
            arr[i][j] = arr[i][j-1]+1;
        else
            break;
    }
    ///left
    for(i=x, j=y-1; j>0; j--)
    {
        if(arr[i][j] > arr[i][j+1]+1)
            arr[i][j] = arr[i][j+1]+1;
        else
            break;
    }
    ///down
    for(i=x+1, j=y; i<n; i++)
    {
        if(arr[i][j] > arr[i-1][j]+1)
            arr[i][j] = arr[i-1][j]+1;
        else
            break;
    }
    ///up
    for(i=x-1, j=y; i>0; i--)
    {
        if(arr[i][j] > arr[i+1][j]+1)
            arr[i][j] = arr[i+1][j]+1;
        else
            break;
    }

    ///right-down
    for(i=x+1; i<n; i++)
    {
        for(j=y+1; j<=n; j++)
        {
            if(1 + min(arr[i-1][j], arr[i][j-1])<arr[i][j])
                arr[i][j] = 1 + min(arr[i-1][j], arr[i][j-1]);
            else
                break;
        }
    }
    ///right-up
    for(i=x-1; i>0; i--)
    {
        for(j=y+1; j<=n; j++)
        {
            if(1 + min(arr[i+1][j], arr[i][j-1])<arr[i][j])
                arr[i][j] = 1 + min(arr[i+1][j], arr[i][j-1]);
            else
                break;
        }
    }
    ///left-down
    for(i=x+1; i<n; i++)
    {
        for(j=y-1; j>0; j--)
        {
            if(1+min(arr[i-1][j], arr[i][j+1])<arr[i][j])
                arr[i][j] = 1 + min(arr[i-1][j], arr[i][j+1]);
            else
                break;
        }
    }
    ///left-up
    for(i=x-1; i>0; i--)
    {
        for(j=y-1; j>0; j--)
        {
            if(1+min(arr[i+1][j], arr[i][j+1])<arr[i][j])
                arr[i][j] = 1 + min(arr[i+1][j], arr[i][j+1]);
            else
                break;
        }
    }

    for(i=1; i<=n; i++)
    {
        for(j=i+1; j<=n; j++)
        {
            Count[arr[i][j]]++;
            //cout << arr[i][j] << " " ;
        }
        //cout << endl;
    }

    for(i=1; i<n; i++)
    {

        cout << Count[i] << endl;
    }

    return 0;
}



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

using namespace std;

#define endl '\n'
typedef long long ll;
using namespace std;

int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	int N, K;
	cin >> N;
	vector<vector<ll>> A(N, vector<ll>(3));
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			cin >> A[i][j];
		}
	}

	vector<vector<ll>> dp(N, vector<ll>(3,0));
	dp[0][0] = A[0][0];
	dp[0][1] = A[0][1];
	dp[0][2] = A[0][2];

	for (int i = 1; i < N; ++i)
	{
		/*for (int j = 0; j < 3; ++j)
		{*/
			dp[i][0] = A[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
			dp[i][1] = A[i][1] + max(dp[i - 1][0], dp[i - 1][2]);
			dp[i][2] = A[i][2] + max(dp[i - 1][0], dp[i - 1][1]);

			//dp[i][j] = max(f, max(s, t));
		//}
	}
	ll ans = INT_MIN;
	for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			ans = max(ans, dp[i][j]);
		}
	}

	/*for (int i = 0; i < N; ++i)
	{
		for (int j = 0; j < 3; ++j)
		{
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/
	cout << ans << endl;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#define int long long
using namespace std;

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
#define ford(i,n) for (int i = n-1; i >= 0; i--)
#define ford2(i,a,b) for (int i = a-1; i >= b; i--)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
#define EXP1 2.718281828459045
#define BIG 1000000000000000000

#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sllll(n,m,k,o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf(" %c", &c)
#define ss(s) scanf("%s", s)
#define sal(t,n) fin(iz,n) { scanf("%lld", &t[iz]); }
#define sad(t,n) fin(iz,n) { scanf("%lf", &t[iz]); }
#define gl(t) scanf(" %[^\n]", t);

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pss(s) printf("%s\n", s.c_str())
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pal(t,n) fin(rz,n) { printf("%lld ", t[rz]); } printf("\n")
#define pad(t,n) fin(rz,n) { printf("%lf ", t[rz]); } printf("\n")

#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
 
#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")

#define ll int
#define vl vector<ll>
#define vvl vector<vl>
#define vvvl vector<vvl>

#define dll pair<ll, ll>
#define vdll vector<dll>
#define vvdll vector<vdll>

#define vb vector<bool>
#define vvb vector<vb>
#define vd vector<double>
#define vvd vector<vd>
#define vc vector<char>
#define vvc vector<vc>

#define all(v) v.begin(), v.end()
#define vlen(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second

const int b2 = (int)(1e5) + 5;
int dp[2][b2];
int n, w;

signed main()
{
    sll(n, w);
    fin(i, n) {
        int poids, val;
        sll(poids, val);
        fin2(i, poids, w+1) {
            chmax(dp[1][i], dp[0][i-poids] + val);
            chmax(dp[1][i], dp[0][i-1]);
        }
        fin(i, w+1) dp[0][i] = dp[1][i];
    }
    pl(dp[0][w]);
}

Measured memory_bytes: 1792
abcd = input()
a,b,c,d = int(abcd[0]),int(abcd[1]),int(abcd[2]),int(abcd[3])
op = ["+","-"]
def calc(op1,op2,op3):
    if op1 == "+":
        tmp = a + b
    else:
        tmp = a - b
    if op2 == "+":
        tmp += c
    else:
        tmp -= c
    if op3 == "+":
        tmp += d
    else:
        tmp -= d
    return tmp
def solve():
    for op1 in op:
        for op2 in op:
            for op3 in op:
                if calc(op1,op2,op3) == 7:
                    print("%d%s%d%s%d%s%d=7"%(a,op1,b,op2,c,op3,d))
                    return
solve()

Measured memory_bytes: 38384
import java.util.Scanner;

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 tmp = 0;
    if(a>b){
      tmp = a;
      a = b;
      b = tmp;
    }
    if(b>c){
      tmp = b;
      b = c;
      c = tmp;
    }
    if(a>b){
      tmp = a;
      a = b;
      b = tmp;
    }
    System.out.printf("%d %d %d\n", a, b, c);
  }
}


Measured memory_bytes: 26196
n,k = map(int,input().split())
x = list(map(int,input().split()))


ans = 1000000000000000000000000000
for l in range(n):
    r = l+k-1
    if r >= n:
        break
    if x[r]*x[l]<0:
        ans = min(ans,min(abs(x[l]),abs(x[r]))*2+max(abs(x[l]),abs(x[r])))
    else:
        ans = min(ans,max(abs(x[l]),x[r]))

print(ans)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
char bl[1010],al[1010];
int n,ans=0,l1=1,l2=1;
int main(){
	scanf("%s",al+1);
	scanf("%s",bl+1);
	while(al[l1])
		l1++;
	while(bl[l2])
		l2++;
	l1--,l2--;
	for(int i=1;i<=l1-l2+1;++i){
		int anss=0;
		for(int j=1;j<=l2;++j)
			if(al[i+j-1]==bl[j])
				anss++;
		ans=max(ans,anss);
	}
	printf("%d\n",l2-ans);
	return 0;
}

Measured memory_bytes: 3820
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int const nMax = 1010;
long long road[2200][2200];
int n,m,L,x,y,cost,judge,g[2200][2200],tot;
int use[2200],from[2200];
struct SANTA{
    int house;
    long long time;
}santa[nMax];
struct present{
    int a;
    long long time;
}pre[nMax];
bool match(int x)
{
    for(int i = L;i < 2 * L;i++){
        if( g[x][i] && !use[i] ){
            use[i] = 1;
            if(from[i]==-1||match(from[i])){
                from[i] = x;
                return true;
            }
        }
    }
    return false;
}
int hungary(){
    tot = 0;
    memset(from,-1,sizeof(from));
    for(int i = 0;i < L;i++){
        memset(use,0,sizeof(use));
        if(match(i))
            ++tot;
    }
    return tot;
}
int main()
{
    while(scanf("%d%d%d",&n,&m,&L),n||m||L){
        int ans = 0;
        memset(road,63,sizeof(road));
        for(int i = 1;i <= m;i++){
            scanf("%d%d%d",&x,&y,&cost);
            if( road[x][y] > cost )
                road[x][y] = road[y][x] = cost;
        }
        for(int k = 0;k < n;k++){
            for(int i = 0;i < n;i++){
                for(int j = 0;j < n;j++)
                    if( road[i][j] > road[i][k] + road[k][j] ) road[i][j] = road[i][k] + road[k][j];
            }
        }
        for(int i = 0;i < n;i++) road[i][i] = 0;
        for(int i = 0;i < L;i++) scanf("%d%d",&pre[i].a,&pre[i].time);
        memset(g,0,sizeof(g));
        for(int i = 0;i < L;i++){
            for(int j = 0;j < L;j++)
                if( i != j && road[pre[j].a][pre[i].a] <= pre[j].time - pre[i].time && pre[j].time >= pre[i].time ) g[i][j + L] = 1;
        }
        ans = L - hungary();
        printf("%d\n",ans);
    }
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    string str = "ABC";

    // 処理
    str[0] = toupper(s1[0]);
    str[1] = toupper(s2[0]);
    str[2] = toupper(s3[0]);

    // 出力
    cout << str << endl;

    return 0;
}


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


int main(){
    ll n, k, ans = 0;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h.at(i);
    sort(h.begin(),h.end(), greater<ll>());
    rep(i,n){
        if(i <= k - 1) continue;
        else ans += h.at(i);
    }
    cout << ans << endl;
}

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


int main()
{

  int n;
  cin>>n;

  vector<pair<int,int>>v;

  for(int i=0;i<n;i++){
    int x,y;
    cin>>x>>y;
    v.push_back({x,y});
  }

  bool exist  = false;
  for(int i=0;i<=n-3;i++){
   int cnt =1;
   if(v[i].first != v[i].second)continue;
    for(int j=i+1;j<i+3;j++){
       if(v[j].first != v[j].second)break;
        cnt++;
    }

    if(cnt >= 3){
       exist = true;
       break;
    }
  }

  if(exist){
    cout<<"Yes\n";
  }else{
  cout<<"No\n";
  }

  return 0;
}


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

int main() {
    int N; cin >> N;
    ll now = 1;
    rep(i, N){
        ll t; cin >> t;
        ll g = __gcd(now, t);
        t /= g;
        now *= t;
    }

    cout << now << endl;


    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int size = s.size();
  int pt = 0;
  
/*  rep(i, size) {
    char c = s[i];
    char nc = s[i+1];
    if(c == 'D') ++pt;
    else if(c == '?') ++pt;
    else if(c == 'P' && (nc == 'D' || nc == '?')) ++pt;
  } */
  
  rep(i, size) {
    if(s[i] == '?') s[i] = 'D';
  }
  
  cout << s << endl;

  return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	bool color[8];
	for( int i = 0; i < 8; ++i ) color[i] = false;
	int cnt = 0;
	int varcnt = 0;
	for( int i = 0; i < n; ++i ){
		int temp;
		cin >> temp;
		if( temp >= 3200 ){
			++varcnt;
		} else if( !color[temp/400] ){
			++cnt;
			color[temp/400] = true;
		}
	}
	if( varcnt == 0 ){
		cout << cnt << ' ' << cnt << endl;
	} else if ( cnt == 0 ){
		cout << 1 << ' ' << varcnt << endl;
	} else {
		cout << cnt << ' ' << cnt+varcnt << endl;
	}	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <iterator>
#include <ext/pb_ds/assoc_container.hpp>

#define x first
#define y second
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define bit __builtin_popcount
#define all(x) x.begin(),x.end()

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

const ll INF=1e18+123;
const ld EPS=1e-9;
const int inf=1e9+123;
const int MOD=1e9+7;
const int N=1e5+123;
const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin>>s;
    ll k;
    cin>>k;
    int ans=1;
    for(int i=0;i<min(k,0ll+sz(s));i++){
        if(ans==1 && s[i]!='1')ans=s[i]-'0';
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(int argc, const char *argv[])
{
  long long l, r;
  cin >> l >> r;

  if (r - l > 3000) {
    cout << "0\n";
    return 0;
  }

  long long res = l * (l + 1) % 2019;
  for (long long i = l; i < r; i++) {
    for (long long j = i + 1; j <= r; j++) {
      res = min(res, i * j % 2019);
    }
  }

  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define BUF_SIZE 510000+50

// size: specify sizeof(str)
int get_str(char *str, int size) {
    if(!fgets(str, size, stdin)) return -1;
    return 0;
}

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

int get_int2(int *a1, int *a2) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d", a1, a2);
#else
#error
#endif
  return 0;
}

int get_int3(int *a1, int *a2, char *a3) {
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return -1;
  sscanf(line, "%d %d %c", a1, a2, a3);
#else
#error
#endif
  return 0;
}

#define OFFSET 210000

enum COMMAND {
    NONE,
    REVERSE,
    ADD,
};

enum {
    UNDEF,
    HEAD,
    TAIL
};

int main(void) {
    static char buf[BUF_SIZE];
    get_str(&buf[OFFSET], BUF_SIZE-OFFSET);
    char *s = &buf[OFFSET];
    size_t len = strlen(s) - 1;
    int pos[3];
    int inc[3] = {0, -1, +1};
    pos[1] = OFFSET-1;
    pos[2] = OFFSET+len;

    int queries = get_int();
    int i;
    int dist = 1;
    for(i = 0; i < queries; i++) {
        int type, where; char ch;
        int idx;
        get_int3(&type, &where, &ch);
        where = (where == 1) ? 1 : -1;
        switch(type) {
            case REVERSE:
                dist = -dist;
                break;
            case ADD:
                idx = (where*dist==1) ? HEAD : TAIL;
                buf[pos[idx]] = ch;
                len++;
                pos[idx] += inc[idx];
                break;
            default:
                break;
        }
#ifdef DEBUG
        printf("%s\n", &buf[pos[1]+1]);
        printf("[%d] dist:%d -> len: %lu (%d, %d)\n", type, dist, len, pos[1], pos[2]);
#endif
    }
//     int start = (dist==1) ? pos[1]+1 : pos[2]-1;
// #ifdef DEBUG
//     printf("start: %d\n", start);
// #endif
//     for(i = start; i > start-len && i < start+len; i=i+(dist)) {
//         putchar(buf[i]);
//     }
//     putchar('\n');
    if(dist==1) {
        int start = pos[1]+1;
        for(i = start; (i < (start+len)); i=i+dist) {
            putchar(buf[i]);
        }
    } else {
        int start = pos[2]-1;
        for(i = start; (i > (start-len)); i=i+dist) {
            putchar(buf[i]);
        }
    }
    putchar('\n');
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    string s;
    cin >> s;
    int n = s.size(), cnt = 0;
    fore(i,1,n) {
        cnt += (s[i]!=s[i-1]);
    }
    cout << cnt << endl;
}


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

using namespace std;
 
const int MOD=1e9+7;




//const int MOD=998244353;


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    string s;
    cin>>s;
    int tot=0;
    for(char c:s)tot+=c-'0';
    cout<<(tot%9?"No":"Yes");
    
    return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>
using namespace std;
#define rep(i, m, n) for (int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for (int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
using Edge = pair<int, long long>;
using Graph = vector<vector<Edge>>;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef vector<vector<vector<ll>>> mat3;
typedef vector<string> svec;
typedef vector<vector<string>> smat;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
// constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
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;
}

long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }

vector<pair<long long, long long>> prime_factorize(long long N) {
    vector<pair<long long, long long>> res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0;
        while (N % a == 0) {
            ++ex;
            N /= a;
        }
        res.push_back({a, ex});
    }
    if (N != 1) res.push_back({N, 1});
    return res;
}
// ~~~~~~~~~~~~~~memo~~~~~~~~~~~~~~
// for (int i = 0; i < n; ++i)
// vector<long long> v(n), c(n);
// cout << res << endl;
// cout << res << '\n';
// int型の2次元配列(h×w要素の)の宣言
// vector<vector<int>> data(h, vector<int>(w));
// rotate(s.begin(), s.begin() + 1, s.end());
// sort(all(a),greater<int>());
// s.substr(0,2) 先頭から2文字切り出す
// for (auto it = mp.rbegin();it != mp.rend(); ++it)
// vector<vector<vector<int>>> dp(n + 1, vector<vector<int>>(w + 1, vector<int>(k+1, 0)));

// ll dp[1005][3] = {99999999};

int main() {
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    ll H, W;
    cin >> H >> W;
    vector<string> s(H);
    rep(i, 0, H) cin >> s[i];
    vector<vector<ll>> dp(H+2, vector<ll>(W+2,0));
    dp[1][1] = 1;
    rep(i, 1, H+1) {
        rep(j, 1, W+1) {
            if (s[i-1][j-1] == '#') {
                continue;
            }
            if (i > 1) dp[i][j] += dp[i-1][j];
            if (j > 1) dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
        }
    }

    cout << dp[H][W] << '\n';
    return 0;
}


Measured memory_bytes: 13024
#include<iostream>
#include<set>
#include<string>
using namespace std;

int main()
{
 int n; cin >> n;
 set<string> s;
 for(int i=0;i<n;i++){
   string p; cin >> p;
   s.insert(p);
 }
 cout << s.size() << endl;
 return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    int d = a + b;
    int e = a - b;
    int f = a * b;
    int g;
    if (a + b > a - b)
    {
        g = a + b;
    }
    else
    {
        g = a - b;
    }
    if (a * b > g)
    {
        g = a * b;
    }
    cout << g;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const LL INF = 1e14;
const LL MOD = 1e9 + 7;

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  string tmp1 = "", tmp2 = "";
  REP(i, 7)
  {
    tmp1 += s[i];
    tmp2 = s[s.size()-i-1] + tmp2;
  }
  if (tmp1 == "keyence" || tmp2 == "keyence") cout << "YES" << endl;
  else
  {
    REP(i, 6)
    {
      string tmp = "";
      REP(j, i+1) tmp += tmp1[j];
      REP2(j, i+1, 7) tmp += tmp2[j];
      if (tmp == "keyence")
      {
        cout << "YES" << endl;
        return 0;
      }
    }
    cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
import math
import string
import fractions
import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop

# from itertools import accumulate
# from collections import deque
import random




def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def main():
    a,b = map(int, input().split())
    if a>=13:
        print(b)
    elif 6<=a<=12:
        print(int(b/2))
    else:
        print(0)

if __name__ == '__main__':
    main()


Measured memory_bytes: 7752
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

string can[] = { "dream", "dreamer", "erase", "eraser" };

bool func(string& S, int index)
{
	if (index >= S.length())
	{
		return true;
	}

	for (auto i = 0; i < 4; ++i)
	{
		auto len = can[i].length();
		if (S.compare(index, len, can[i]) == 0)
		{
			if (func(S, index + len) != false)
			{
				return true;
			}
		}
	}

	return false;
}

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

	if (func(S, 0) != false)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    int ans = 1;
    for (int i = 1; i * i <= m; i++) {
        if (m % i == 0) {
            if (m / i >= n && i > ans) {
                ans = i;
            }
            if (m / (m / i) >= n && (m / i) > ans) {
                ans = m / i;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#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(){

   string a,s,c;
   cin >> a >> s >> c;

   cout << a[0] << s[0] << c[0] << endl;

   return 0;
}

Measured memory_bytes: 384
inp = input()
flag = 1

if inp.find("AA") != -1:
  flag = 0
if inp.find("KA") != -1:
  flag = 0
if inp.find("IA") != -1:
  flag = 0

if inp.replace("A","") != "KIHBR":
  flag = 0
  
if flag == 1:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3064
#!/usr/bin/env ruby

n = gets.strip.to_i
data = n.times.map { gets.strip.split.map(&:to_i) }

def reachable?(current, next_data)
  ct, cx, cy = current
  ft, fx, fy = next_data
  dt = ft - ct
  dd = (fx - cx).abs + (fy - cy).abs
  dd <= dt && (dt % 2) == (dd % 2)
end

current = [0, 0, 0]
data.each do |next_data|
  unless reachable?(current, next_data) then
    puts 'No'
    exit
  end
  current = next_data
end

puts 'Yes'

Measured memory_bytes: 9468
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int m,n;
    cin >> m >> n;
    int a[n];
    REP(i,n){
        cin >> a[i];
    }
    if(m == 2){
        int cnt1 = 0, cnt2 = 0;
        REP(i,n){
            if(i % 2 == 0 && a[i] == 1){
                cnt1++;
            }else if(i % 2 == 1 && a[i] == 2){
                cnt1++;
            }
        }
        REP(i,n){
            if(i % 2 == 0 && a[i] == 2){
                cnt2++;
            }else if(i % 2 == 1 && a[i] == 1){
                cnt2++;
            }
        }
        cout << min(cnt1, cnt2) << endl;
    }else{
        int now = 1;
        vector<int> vec;
        for(int i = 1; i < n; i++){
            if(a[i] == a[i - 1]) now++;
            else{
                vec.emplace_back(now);
                now = 1;
            }
        }
        vec.emplace_back(now);
        int ans = 0;
        for(int v : vec){
            ans += v / 2;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3876
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>

using namespace std;

inline int read()
{
  int x=0,f=1;char ch=getchar();
  while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
  while (isdigit(ch)) {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
  return x*f;
}

long long a,b,c,k;
 
int main()
{
  cin>>a>>b>>c>>k;
  if (k%2==1) 
    cout<<b-a;
  else cout<<a-b;
  return 0;
}


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

#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

signed main() {
        IOS;

        string s;
        cin>>s;

        for(int i=0;i<19;i++)
        {
            if(i==5||i==13)
                cout<<" ";
            else
                cout<<s[i];
        }


return 0;
}

		

Measured memory_bytes: 256
//om namah shivaaay//
#include <bits/stdc++.h>
#define Om_namah_Shivaay ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
 #define ll long long
 using namespace std;
 int main()
 {
    Om_namah_Shivaay;
 ll a,b,c;
 cin>>a>>b>>c;
 swap(a, b);
 swap(a, c);
  cout<<a<<" "<<b<<" "<<c; 
}
    


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

using namespace std;

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<int>> C(10, vector<int>(10));
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      cin >> C[i][j];
    }
  }
  for (int k = 0; k < 10; k++) {
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        chmin(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int a;
      cin >> a;
      if (a == -1) continue;
      ans += C[a][1];
    }
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	#ifdef UTP
	freopen("input.txt", "r", stdin);
	#endif
	int n; cin >> n;
	vector<int> x(n), y(n);
	for (int i = 0; i < n; i++)
		cin >> x[i] >> y[i];
	vector<int> order(n);
	for (int i = 0; i < n; i++) order[i] = i;
	int nf = 0;
	double sum = 0;
	do {
		double dist = 0;
		for (int i = 1; i < n; i++) {
			int dx = x[order[i]] - x[order[i - 1]];
			int dy = y[order[i]] - y[order[i - 1]];
			dist += sqrt(dx * dx + dy * dy);
		}
		sum += dist;
		nf++;
	} while (next_permutation(order.begin(), order.end()));
	cout << fixed << setprecision(8) << sum / nf << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;



int main(){
   int n; cin >> n;
   vector<ll> a(n);
   rep(i,n) cin >> a[i];

    vector<ll> sum(n+1);
    rep(i,n){
        sum.at(i+1) = sum.at(i) + a.at(i);
    }

    map<ll,ll> nums;
    rep(i,n+1) nums[sum[i]] ++;

   
    ll ans=0;
    for(auto it:nums){
        ll num = it.second;
      ans += num*(num-1)/2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 18808
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <boost/range/algorithm.hpp>
#include <boost/integer/common_factor_rt.hpp>
#define MAX 100000000

using namespace std;

int N;

int main()
{
    while (cin >> N)
    {
        int A[N + 1], B[N];
        for (int i = 0; i < N + 1; i++)
        {
            cin >> A[i];
        }
        for (int i = 0; i < N; i++)
        {
            cin >> B[i];
        }
        long long int sum = 0;
        for (int i = N; i > 0; i--)
        {
            sum += min(A[i], B[i - 1]);
            B[i - 1] -= min(A[i], B[i - 1]);
            sum += min(A[i - 1], B[i - 1]);
            A[i - 1] -= min(A[i - 1], B[i - 1]);
        }
        cout << sum << endl;
    }

    return 0;
}


Measured memory_bytes: 1024
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100001
#define INF (ll)1e18
#define pll pair<ll,ll>
#define pii pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define pi 3.1415926535897



int main() {

    get2(x,y);
    ll sum = 0;
    if(x<4)
    sum+=4-x;
    if(y<4)
    sum+=4-y;
    if(x==1 && y==1)
        sum+=4;
    printf("%lld\n", sum*100000);

    return 0;  
}

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

int main(){
    int i = 1;
    while(i <= 10010){
        int x;
        cin >> x;
        if(x == 0){
            break;
        }
        printf("Case %d: %d\n",i,x);
        i++;
    }
    return 0;
}


Measured memory_bytes: 3072