akhauriyash/Code-Regression huggingface dataset:
using System;
class Program
{
	static void Main()
	{
	string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
	int a = int.Parse(input[0]);
	int b = int.Parse(input[1]);
    int c = int.Parse(input[2]);
    int x = int.Parse(input[3]);
    int y = int.Parse(input[4]);
      
      long cost = 0;
      long minCost = 0;
    if(x>=y)
    {
       for(int i = 0; i <= x; i++)//Aピザを先に買う
       {
         if(y-i>0) cost = a*(x-i) + c*2*i + b*(y-i);
         else cost = a*(x-i) + c*2*i;
         if(cost < minCost || minCost == 0) minCost = cost;
       }
    }
    else
   	{
      
      for(int i = 0; i <= y; i++)//Bピザを先に買う
       {
        if(x-i>0) cost = b*(y-i) + c*2*i + a*(x-i);
        else cost = b*(y-i) + c*2*i;
         if(cost < minCost || minCost == 0) minCost = cost;
       }
    }

     	 Console.WriteLine(minCost);
	}
}


Measured memory_bytes: 11092
import sys
input = sys.stdin.readline
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    print(A * B // gcd(A, B))
if __name__ == '__main__':
    # test
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)

Measured memory_bytes: 3060
N, M = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(M)]

b = []
for i in range(N):
  b.append([0] * N)

for i in range(M):
  b[a[i][0]-1][a[i][1]-1] += 1
  b[a[i][1]-1][a[i][0]-1] += 1
  
for i in range(N):
  print(sum(b[i]))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MAX_N 200000
using namespace std;
typedef long long lnt;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, m, c;
int main() {
	read(n), read(m), c = n/m;
	lnt ans = 1LL*c*c*c;
	if (!(m&1))
		c += n%m >= m/2, 
		ans += 1LL*c*c*c;
	return printf("%lld\n", ans), 0;
}

Measured memory_bytes: 256
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = || -> String {
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [$t:tt]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
fn main() {
    input! { n: usize, m: usize, a: [[usize1]; n] }
    let mut counts = vec![0;m];
    for arr in a {
        for i in arr {
            counts[i] += 1;
        }
    }
    let ret = counts.iter().filter(|&&i| i==n).count();
    println!("{}", ret);
}

Measured memory_bytes: 4352
#include <stdio.h>
int main(void){
 int n,k,x,i,c=0;
 scanf("%d%d",&n,&k);
 for(i=0;i<n;i++){
  scanf("%d",&x);
  if(k/2<x) c+=(k-x)*2;
  else c+=x*2;
 }
 printf("%d",c);
 return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <set>

using namespace std;
typedef long long ll;

int H, W;
char board[110][110];
set <int> h, w;

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> H >> W;
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
        {
            cin >> board[i][j];
            if (board[i][j] == '#')
            {
                h.insert(i);
                w.insert(j);
            }
        }

    for (set<int>::iterator it = h.begin(); it != h.end(); it++)
    {
        int x = *it;
        for (set<int>::iterator it2 = w.begin(); it2 != w.end(); it2++)
        {
            int y = *it2;
            cout << board[x][y];
        }
        cout << "\n";
    }
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int n; scanf("%d", &n);
  int p = -1;
  int res = 0, n0w = 0;
  for(int i = 0; i < n; ++i){
    int v; scanf("%d", &v);
    if(p >= v) n0w++;
    else{
      if(res < n0w) res = n0w;
      n0w = 0;
    }
    p = v;
  }
  if(res < n0w) res = n0w;
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 128
def resolve():
    o = input()
    e = input()
    if len(o) == len(e):
        ans = "".join([oi + ei for oi, ei in zip(o, e)])
    elif len(o) > len(e):
        ans = "".join([oi + ei for oi, ei in zip(o, e)]) + o[-1]
    else:
        ans = "".join([oi + ei for oi, ei in zip(o, e)]) + e[-1]
    print(ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3064
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (a > c) swap(a, c), swap(b, d);

    if (b > d) print(d - c);
    else print(max(0, b - c));
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    int H, W;
 
    cin >> H >> W;
 
    vector<string> a(H);
 
    for (int i = 0; i < H; i++)
    {
        cin >> a.at(i);
    }
 
    vector<bool> row(H, false);
    vector<bool> col(W, false);
    for (int i = 0; i < H; i++)
    {
        for (int j = 0; j < W; j++)
        {
            if (a.at(i).at(j) == '#')
            {
                row.at(i) = true;
                col.at(j) = true;
            }
        }
        
    }
 
    for (int i = 0; i < H; i++)
    {
        if(row.at(i))
        {
            for (int j = 0; j < W; j++)
            {
                if (col.at(j))
                {
                    cout << a.at(i).at(j);
                }
            }
            cout << endl; 
        }
    }
    
       
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
int main()
{
    char s[15];
    scanf("%s",s);
    int l=strlen(s);
    if(l%2)
    printf("No\n");
    else
    {
        int flag=1,i=0;
        while(i<l)
        {
            if(s[i]!='h'||s[i+1]!='i')
            {
                flag=0;
                break;
            }
            i+=2;
        }
        if(flag==1)
        printf("Yes\n");
        else
        printf("No\n");
    }
}


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

int main() {
	int n;
	cin>>n;
	int flag=0;
	while(n!=0)
	{
	    int r=n%10;
	    if(r==7)
	    {
	        flag=1;
	        break;
	    }
	    n=n/10;
	}
	if(flag)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    int N,M; cin>>N>>M;
    vector<int> S(M),C(M);
    vector<int> exist(N,-1);
    bool flag = true;
    REP(i,M){
        int s,c; cin>>s>>c;
        if(exist[s-1] == -1){
            exist[s-1] = c;
        }
        else{
            if(exist[s-1] == c)continue;
            else{
                flag = false; break;
            }
        }
    }
    if(!flag || ( N > 1 &&exist[0] == 0)){
        cout << -1 <<endl;
        return 0;
    }
    
    REP(i,N){
        if(exist[i] == -1){
            if(i == 0 && N > 1)exist[i] = 1;
            else exist[i] = 0;
        }
    }
    int ans = 0;
    REP(i,N){
        ans += exist[i] * pow(10,N-i-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3716
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(list(map(int, input().split())))

ans = 0
for i in range(N):
    S = C
    for j in range(M):
        S  += A[i][j] * B[j]
    if S > 0: ans += 1

print(ans)

Measured memory_bytes: 3064
/// 25-03-2018
/// MD:NUR ALAM

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {

    ll x=INT_MAX,y=INT_MAX;
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    x=min(a,b);
    y=min(c,d);
    cout<<abs(x+y)<<endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var H, W, i, j int
	for {
		fmt.Scan(&H, &W)
		if H == 0 && W == 0 {
			break
		}

		for i = 0; i < H; i++ {
			for j = 0; j < W; j++ {
				fmt.Print("#")
			}
			fmt.Print("\n")
		}
		fmt.Print("\n")
	}

}



Measured memory_bytes: 1128
//package april2020;

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn = new FastReader();
		
		int ht = scn.nextInt();
		int st = scn.nextInt();
		
		int ha = scn.nextInt();
		int sa = scn.nextInt();
		
		int t = 0;
		while(ht>0) {
			ht-=sa;
			t++;
		}
		int a = 0;
		while(ha>0) {
			ha-=st;
			a++;
		}
		if(a>t) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }

}


Measured memory_bytes: 32660
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <ctime>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#include <cmath>
#include <functional>
#include <map>
#include <set>
const int INF = 1000000009;

int n;
int a[2][100];
int dp[2][100];
int main(){
	scanf("%d", &n);
	for(int i = 0; i < 2; i++){
		for(int j = 0; j < n; j++){
			scanf("%d", &a[i][j]);
		}
	}
	dp[0][0] = a[0][0];
	dp[1][0] = dp[0][0] + a[1][0];
	for(int i = 1; i < n; i++){
		dp[0][i] = dp[0][i-1] + a[0][i];
		dp[1][i] = std::max(dp[1][i-1], dp[0][i]) + a[1][i];
	}
	printf("%d\n", dp[1][n-1]);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int l;
  cin>>l;

  struct edge{
    Int from,to,cost;
    edge(){}
    edge(Int from,Int to,Int cost):from(from),to(to),cost(cost){}    
  };

  vector<edge> G;
  const Int n = 20;
  for(Int i=0;i+1<n-1;i++){
    G.emplace_back(i,i+1,0<<i);
    G.emplace_back(i,i+1,1<<i);
  }

  Int x=l>>(n-2);
  for(Int i=0;i<x;i++){
    G.emplace_back(n-2,n-1,i<<(n-2));
  }

  for(Int i=0;i<n-2;i++){
    if((~l>>i)&1) continue;
    G.emplace_back(i,n-1,(l>>(i+1))<<(i+1));    
  }
  
  cout<<n<<" "<<G.size()<<endl;
  for(auto e:G){
    cout<<e.from+1<<" "<<e.to+1<<" "<<e.cost<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m;
const int maxn = 20;
typedef pair<int, int> pii;
#define mp(a, b) make_pair(a, b)
bool vis[maxn], vis2[maxn];
vector<pii> match;
char s[maxn][maxn];
string ss[maxn];
inline bool check(const int & l, const int & r)
{
	for(int i = 0; i < match.size(); ++i)
		if(s[match[i].first][l] != s[match[i].second][r] || s[match[i].first][r] != s[match[i].second][l])
			return 0;
	return true;
}
void dfs2(int now)
{
	if(now == m / 2)
	{
		puts("YES");
		exit(0);
	}
	for(int i = 0; i < m; ++i)
		if(!vis2[i])
		{
			vis2[i] = 1;
			for(int j = i + 1; j < m; ++j)  
				if(!vis2[j] && check(i, j))
				{
					vis2[j] = 1;
					dfs2(now + 1);
					vis2[j] = 0;
				}
			vis2[i] = 0;
			break;
		}
}
void solve()
{
	/*
	for(int i = 0; i < match.size(); ++i) cout << '(' << match[i].first << ' ' << match[i].second << ')' << ' ';
	cout << endl;
	*/
	if(m & 1)
	{
		for(int i = 0; i < m; ++i)
		{
			vis2[i] = 1;
			dfs2(0);
			vis2[i] = 0;
		}
	}
	else
		dfs2(0);
}
void dfs(int now)
{
	if(now == n / 2) 
	{
		solve();
		return;
	}
	for(int i = 0; i < n; ++i)
		if(!vis[i])
		{
			vis[i] = 1;
			for(int j = i + 1; j < n; ++j)  
				if(!vis[j] && ss[i] == ss[j])	
				{
					vis[j] = 1;
					match.push_back(mp(i, j));
					dfs(now + 1);
					match.pop_back();
					vis[j] = 0;
				}
			vis[i] = 0;
			break;
		}
}
int main()
{
	scanf("%d%d", &n, &m);
	for(int i = 0; i < n; ++i)
	{
		scanf("%s", s[i]);
		ss[i] = string(s[i]);
		sort(ss[i].begin(), ss[i].end());
	}
	if(n & 1)
	{
		for(int i = 0; i < n; ++i)
		{
			vis[i] = 1;
			match.push_back(mp(i, i));
			dfs(0);
			match.pop_back();
			vis[i] = 0;
		}
	}
	else
		dfs(0);
	puts("NO"); 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
using namespace std;

#define TEXT_MAX 1000

bool compareText(const char *t1, char const *t2, int len);

int main (void)
{
	char t[TEXT_MAX + 1] = "\0";
	char p[TEXT_MAX + 1] = "\0";
	cin >> t >> p;

	int length;
	for (length = 0; p[length] != '\0'; length++);

	for (int i = 0; t[i + length - 1] != '\0'; i++) {
		if (compareText(&t[i], &p[0], length)) cout << i << endl;
	}

	return 0;	
}

bool compareText(const char *t1, const char *t2, int len)
{
	for (int i = 0; i < len; i++) {
		if (*(t1 + i) != *(t2 + i)) return false;
	}
	return true;
}

Measured memory_bytes: 3088
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int A,B,C,D;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	while(1)
	{
		C = C - B;
		if(C<=0)
		{
			printf("Yes");
			break;
		}
		A = A - D;
	    if(A<=0)
	    {
			printf("No");
			break;
		}		
	}

	return 0;
}

Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define fordebug int hoge;cin>>hoge;
#define DEKAI 1000000007;
#define INF (1LL<<60)
#define int long long
#define double long double
#define floot10 cout<<fixed<<setprecision(10)
#define Int long long

int min(int a,int b){
  if(a<b) return a;
  return b;
}
int max(int a,int b){
  if(a>b) return a;
  return b;
}

int gcd(Int a, Int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(Int a, Int b) {
  return a / gcd(a, b)*b;
}
// a x + b y = gcd(a, b)
int extgcd(Int a, Int b, Int &x, Int &y) {
  Int g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}

vector<int> g[100010];
int done[100010];



signed main(){
  int n,m;
  cin>>n>>m;
  int x=pow(2,m);
  cout<<x*(1900*m+100*(n-m))<<endl;
  return 0;
}
 


Measured memory_bytes: 2816
// ＡＢＣのＡ過去問を解くだけだよ
// フォント    x:小文字(ｘ)    X:大文字(Ｘ)

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a, b, x;
    cin >> a >> b >> x;

    x -= a;

    if (0 <= x && x <= b)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
int main() {
	int N, Q;
	string S;
	cin >> N >> Q;
	cin >> S;
	vector<int>count(N+1,0);
	vector<bool>can(N+1, false);
	for (int i = 0; i < N - 1; ++i) {
		if (S[i] == 'A'&&S[i + 1] == 'C') {
			can[i] = true;
		}
	}
	for (int i = 0; i < N; ++i) {
		count[i] = 0;
	}
	for (int i = 0; i < N; ++i) {
		count[i+1] = count[i];
		if (can[i]) {
			count[i + 1]++;
		}
	}
	vector<int>ans(Q, 0);
	for (int i = 0; i < Q; i++) {
		int l, r;
		cin >> l >> r;
		l--; r--;
		ans[i] += count[r]-count[l];
	}
	for (int i = 0; i < Q; ++i) {
		cout << ans[i] << endl;
	}
	return 0;
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;
  int cnt = 1;
  reps(i, 1, n) {
    if(a[i-1] != a[i]) {
      ans += cnt/2;
      cnt = 1;
    }
    else cnt++;
  }
  ans += cnt/2;
  cout << ans << endl;

  return 0;
}


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

int main(void){
    int a = 0, b = 0, x = 0; 

    scanf("%d%d%d", &a, &b, &x);

    if(x >= a && x <= (a + b)){
        printf("YES\n");
    }else{
        printf("NO\n");
    }



    return 0;

} 


Measured memory_bytes: 256
A, B = map(int, input().split())
S = input()
l = "0123456789"
cnta = 0
cntb = 0
if S[A] != "-":
    print("No")

else:
    for i in S[:A]:
        if l.count(i) == 1:
            cnta += 1
    
    for j in S[A + 1:]:
        if l.count(j) == 1:
            cntb += 1
    if cnta == A and cntb == B:
        print("Yes")
    else:
        print("No")
        

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cmath>

#define endl '\n'

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	
	int N;
	cin >> N;

	//minimal number of votes of each candidate
	long long int v1 = 1, v2 = 1;
	//portion of votes received by each candidate
	long long int p1, p2;
	//multiplier
	long long int m = 0;

	for (int i=0;i<N;++i){

		cin >> p1 >> p2;

		m = ceil ( max( (long double) (v1) / p1, (long double) (v2) / p2 ) );

		v1 = p1 * m;
		v2 = p2 * m;
	}

	cout << v1 + v2;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#define int long long
using namespace std;
signed main() {
	int n, m; vector<int>v;
	cin >> n; m = n;
	for (int i = 2; i <= sqrt(n); i++) {
		while (m % i == 0) {
			v.push_back(i);
			m /= i;
		}
	}
	if (m != 1)v.push_back(m);
	cout << n << ':'; for (int i : v)cout << ' ' << i; cout << endl;
}


Measured memory_bytes: 3164
#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<set> 
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#define ll long long
#define db double
#define inf 200001
#define INF (int)1e9
#define mod (int)(1e9+7)
#define pi acos(-1)
#define rd(n) {n=0;char ch;int f=0;do{ch=getchar();if(ch=='-'){f=1;}}while(ch<'0'||ch>'9');while('0'<=ch&&ch<='9'){n=(n<<1)+(n<<3)+ch-48;ch=getchar();}if(f)n=-n;}
using namespace std;
int n;

struct edge{
	int y,nxt;
	edge(){}
	edge(int yy,int nn){
		y=yy,nxt=nn;
	}
}e[inf*2];
int head[inf],ecnt;

void addedge(int x,int y){
	ecnt++;
	e[ecnt]=edge(y,head[x]);
	head[x]=ecnt;
	return;
}

int siz[inf],fa[inf],far[inf],cnts[inf];

void dfs1(int u,int last){
	fa[u]=last;
	siz[u]=1;
	int mx=0;
	for (int i=head[u];i;i=e[i].nxt){
		int v=e[i].y;
		if (v==last){
			continue;
		}
		cnts[u]++;
		dfs1(v,u);
		mx=max(mx,far[v]+1);
		siz[u]+=siz[v];
	}
	if (cnts[u]==1){
		far[u]=mx;
	}
	return;
}

void dfs2(int u){
	int cnt=0;
	for (int i=head[u];i;i=e[i].nxt){
		int v=e[i].y;
		if (v==fa[u]){
			continue;
		}
		dfs2(v);
		if (siz[v]>0){
			cnt++;
		}
	}
	if (cnt>=2){
		puts("First");
		exit(0);
	}
	if (u==1 && cnt==0){
		puts("First");
		exit(0);
	}
	if (u==1 && cnt==1){
		puts("Second");
		exit(0);
	}
	if (cnt==0){
		return;
	}
	if (cnt==1){
		siz[u]=-1;
	}
	return;
}

int main(){
	rd(n)
	if (n==2){
		puts("Second");
		return 0;
	}
	int x,y;
	for (int i=1;i<n;i++){
		rd(x) rd(y)
		addedge(x,y);
		addedge(y,x);
	}
	dfs1(1,0);
	dfs2(1);
	return 0;
}

Measured memory_bytes: 5504
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
#define ll long long
const ll N = 1e6+10 ;
int f[N];
int main(){
   ll n,k;
   cin >> n >> k;
   for(int i = 1;i <= n;++i){
      cin >> f[i];
   }
   sort(f + 1, f + n + 1);
   ll sum = 0;
   for(int i = 1;i <= n - k; ++i){
      sum += f[i];
   }
   cout<<sum<<endl;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
int INF = INT_MAX / 2;
double EPS = 1e-10;

int main() {
	int N; cin >> N;
	int a, d; cin >> a >> d;
	map<int, int> mp;
	int M; cin >> M;
	while (M--) {
		int x, y, z;
		cin >> x >> y >> z;
		if (!mp.count(y)) mp[y] = y;
		if (!mp.count(z)) mp[z] = z;
		if (x == 0) swap(mp[y], mp[z]);
		if (x == 1) mp[y] = mp[z];
	}
	int K; cin >> K;
	if (!mp.count(K)) mp[K] = K;
	cout << a + (mp[K] - 1) * d << endl; 
}

Measured memory_bytes: 1196
#include<stdio.h>
int main(void)

{
	int A,B,k=1,x[100];
	scanf("%d%d",&A,&B);
	if(A>B){
		for(int i=B;i>0;i--){
			if(A%i==0 && B%i==0){
				x[k]=i;
				//printf("%d\n",x[k]);
				k++;
			}
		}
	}else{
		for(int i=A;i>0;i--){
			if(A%i==0 && B%i==0){
				x[k]=i;
				//printf("%d\n",x[k]);
				k++;
			}
		}
	}
	scanf("%d",&k);
	printf("%d\n",x[k]);
	return 0;
}


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

using namespace std;

const int inf = 1e9 + 10;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  vector<int> dp(n, inf);
  dp[0] = 0;
  for (int i = 0; i < n - 1; i++) {
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
    if (i + 2 < n) {
      dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
    }
  }
  cout << dp[n - 1] << "\n";
}


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

using ll=long long;
using P=pair<int,int>;

const int MOD=1e9+7;
const int INF=1<<30;
const int MAX=1e5;

int n;

template<class T>
inline void xmin(T &a, T b){a=(a<b)?a:b;}
template<class T>
inline void xmax(T &a, T b){a=(a>b)?a:b;}
template<class T>
inline void vmin(T a, T b){return (a<b)?a:b;}
template<class T>
inline void vmax(T a, T b){return (a>b)?a:b;}



void solve(){
    string s;
    string t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]==t[i]){
            cnt++;
        }
    }
    cout<<cnt<<endl;
}

signed main(){
    //while(1)
    solve();
}


Measured memory_bytes: 256
n = int(input())
ryouri = list(map(int, input().split()))
manzoku = list(map(int, input().split()))
tuika = list(map(int, input().split()))

base = 0
for i in range(n):
  base += manzoku[i]

for i in range(n-1):
  if ryouri[i+1]-ryouri[i] == 1:
    base += tuika[ryouri[i]-1]

print(base)

Measured memory_bytes: 3064
def main():
    n, x, m = map(int, input().split())
    a = x
    a_dict = {a: 0}
    loop_s, loop_e = -1, -1
    res = a

    for _ in range(n-1):
        a = a * a
        a %= m
        if a in a_dict:
            loop_s = a_dict[a]
            loop_e = len(a_dict)
            break
        else:
            a_dict[a] = len(a_dict)
            res += a

    if loop_s != -1:
        a_loop = list(a_dict.keys())[loop_s:]
        l_size = len(a_loop)
        r_size = n - len(a_dict)
        res += (r_size // l_size) * sum(a_loop) + sum(a_loop[:r_size%l_size])

    print(res)
        



if __name__ == "__main__":
    main()

Measured memory_bytes: 76008
def solve(m,n):
	l = []
	if m%2 == 0:
		l = [n,1,n^1,0]
	else:
		l = [m,m^n,m-1,(m-1)^n]
	return l[(n-m)%4]


a,b = map(int, raw_input().split())
print solve(a,b)

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

int main() {
	string s;
	cin >> s;
	if(s[0] != 'A'){
		cout << "WA" << endl;
		return 0;
	}
	int k;
	bool a = false;
	for(int i = 2; i < s.size() - 1; i++){
		if(s[i] == 'C' && a == false){
			a = true;
			k = i;
		}else if(s[i] == 'C' && a == true){
			cout << "WA" << endl;
			return 0;
		}
	}
	if(a == false){
		cout << "WA" << endl;
		return 0;
	}
	for(int i = 1; i < s.size(); i++){
		if(97 <= int(s[i]) && int(s[i]) <= 122 || i == k){
			
		}else{
			 //cout << i << endl;
			cout << "WA" << endl;
			return 0;
		}
	}
	cout << "AC" << endl;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			int r = sc.nextInt();
			if (n == 0 && r == 0)
				break;
			int[] cards = new int[n];
			for (int i = 0; i < n; i++)
				cards[i] = n - i;
			for (int i = 0; i < r; i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				int old[] = new int[p + c - 1];
				for (int j = 0; j < p + c - 1; j++)
					old[j] = cards[j];
				for (int j = 0; j < c; j++)
					cards[j] = old[j + p - 1];
				for (int j = 0; j < p - 1; j++)
					cards[j + c] = old[j];
			}
			System.out.println(cards[0]);
		}
	}
}

Measured memory_bytes: 37616
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define rep(i, k) for (i = 0; i < k; i++) 
typedef long long ll;
typedef pair<ll, ll> l_l;
int i, j;

int main() {
	ll a, b, k, n=0, z = 0;
	string s;
	cin >> n>>k;
	double d=0;
	ll o[20];
	double p[20];
	o[0] = 1;
	p[0] = 1;
	rep(i, 19) {
		o[i + 1] = o[i] * 2;
		p[i + 1] = p[i] / 2;
	}
	for (i = 1; i <= n; i++) {
		rep(j, 20) {
			if (i * o[j] >= k) {
				d += p[j];
			//	cout <<j<<" "<< d << "\n";
				break;
			}
		}
	}
	d =double(d/n);
	cout << setprecision(12)<<d;
}


Measured memory_bytes: 256
#ifndef Local
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx")
#endif

#include <bits/stdc++.h>

#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

#define popCnt(x) (__builtin_popcountll(x))
#define sz(x) ((int)(x.size()))
#define all(v) begin(v), end(v)
typedef long long Long;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef Local
  freopen("test.in", "r", stdin);
#else
#define endl '\n'
#endif

  int a, b;
  cin >> a >> b;
  cout << a * b << endl;

  return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstring>
using namespace std;
int main()
{

	char c;
	int i, j, n, f = 1;
	for (i = 0; i < 3; i++)
	{
		char sil[15];
		memset(sil, 0, sizeof(sil));
		cin >> sil;
		j = 14;
		while (sil[j] == NULL)
		{
			j--;
		}
		//cout << sil << "  " << j << endl;
		if (i > 0)
		{
			if (c != sil[0])
			{
				cout << "NO" << endl;
				if (i == 1) cin >> sil;
				f = 0;
				break;
			}
		}
		c = sil[j];
		//n = j;
	}
	if (f)
	{
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m;
int main()
{
	scanf("%lld%lld",&n,&m);
	if(n==1&&m==1) cout<<1;
	else if(n==1||m==1) cout<<(m+n)-3;
	else if(n>1&&m>1)cout<<(n-2)*(m-2);
	return 0;
}

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

// fundamental
using ll = long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define FOR(i,s,n) for (ll i = (s); i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(x) ((ll)1e##x)
#define MAXC(c,x) (c = max(c, x))
#define MINC(c,x) (c = min(c, x))
const ll mod = TEN(9) + 7;

// vector
using vl = vector<ll>; using vvl = vector<vl>; using vvvl = vector<vvl>;
template<class T, size_t N, class A = size_t> auto mdv(A size = 0) -> typename enable_if<N==1, vector<T>>::type { return vector<T>(size); }
template<class T, size_t N, class A = size_t> auto mdv(A size = 0) -> vector<decltype(mdv<T, N - 1>())> { return vector<decltype(mdv<T, N - 1>())>(size); }
template<class T, size_t N, class A, class... B> auto mdv(A size, B... rest) -> typename enable_if<N!=1, vector<decltype(mdv<T, N - 1>(rest...))>>::type { return vector<decltype(mdv<T, N - 1>(rest...))>(size, mdv<T, N - 1>(rest...)); }
template<class T, class... A> auto mdv(A... size) -> decltype(mdv<T, sizeof...(size), A...>(size...)) { return mdv<T, sizeof...(size), A...>(size...); }
// template<size_t N, class A, class... B> auto mdvl(A size, B... rest) -> decltype(mdv<N, ll, A, B...>(size, rest...)) { return mdv<N, ll, A, B...>(size, rest...); }

// template<class T, class A> auto mdv(A size) -> vector<T> { return vector<T>(size); }
// template<class T, class A, class... B> auto mdv(A size, B... rest) -> vector<decltype(mdv<T>(rest...))> { return vector<decltype(mdv<T>(rest...))>(size, mdv<T>(rest...)); }

// io
template<class T> istream& operator >>(istream& is, vector<T>& vec){ for(T& x: vec) is >> x; return is; }
template<class T, class U> istream& operator >>(istream& is, pair<T, U>& p){ is >> p.first >> p.second; return is; }
template<class T> void input(T& t) { cin >> t; assert(cin); } template<class T, class... Ts> void input(T& t, Ts&... ts) { cin >> t; input(ts...); }
template<class T> void print(T&& t) { cout << t; } template<class T, class... Ts> void print(T&& t, Ts&&... ts) { cout << t; print(ts...); }
template<class T> void println(T&& t) { cout << t << endl; } template<class T, class... Ts> void println(T&& t, Ts&&... ts) { cout << t; println(ts...); }
template<class T> string join(const vector<T>& v, const string & sep) { stringstream ss; REP(i, v.size()) ss << (i != 0 ? sep : "") << v[i]; return ss.str(); }

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(50);
	ll n,q;
	string s;
	cin >> n >> q >>s;
	vector<vector<char>> vs(q, vector<char>(2));
	REP(i, q) REP(j, 2) cin >> vs[i][j];
	reverse(ALL(vs));

	ll r = n;
	REP(i, q) {
		if (r > 0 && vs[i][0] == s[r - 1] && vs[i][1] == 'R') r--;
		if (r != n && vs[i][0] == s[r] && vs[i][1] == 'L') r++;
	}

	ll l = -1;
	REP(i, q) {
		if (l < n - 1 && vs[i][0] == s[l + 1] && vs[i][1] == 'L') l++;
		if (l != -1 && vs[i][0] == s[l] && vs[i][1] == 'R') l--;
	}

	cout << max(0ll, n - (n - r) - (l + 1)) << endl;
}


Measured memory_bytes: 11412
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            //string[] word = cin.ReadStrArray(2);
            //int[] data = cin.ReadIntArray(2);
            string suteta = cin.ReadLine;
            string ans = "";
            for(int i = 0; i < suteta.Length; i++)
            {
                ans += "x";
            }

            Console.WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 13268
///A drunk man will find his way home, but a drunk bird may get lost forever...i
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair <int, int> pii;
#define pb push_back
#define pf push_front
#define f first
#define s second
#define sz(x) (int)x.size()
#define smin(x , y) x = min(x , y)
#define mp make_pair
const int mx = 1000 * 100 + 5;
queue < int > q[2];
vector < int > ad[mx];
int d[2][mx], inf = 1e8, s[2];
void bfs(int x, int a){
	d[x][a] = 0;
	q[x].push(a);
	while(sz(q[x])){
		int v = q[x].front();
		q[x].pop();
		for(int u : ad[v])
			if(d[x][u] > inf){
				d[x][u] = d[x][v] + 1;
				q[x].push(u);
			}
	}
	return;
}
int32_t main(){		
	ios_base::sync_with_stdio(false);
    cin.tie(0);
	cout.tie(0);
	int n, u, v;
	cin >> n >> s[0] >> s[1];
	s[0]--, s[1]--;
	for(int i = 0; i < n - 1; i++){
		cin >> u >> v;
		u--, v--;
		ad[u].pb(v);
		ad[v].pb(u);
	}
	for(int i = 0; i < 2; i++){
		memset(d[i], 63, sizeof d[i]);
		bfs(i , s[i]);
	}
	int mini = 0;
	for(int i = 0 ; i < n; i++)
		if(d[0][i] < d[1][i])
			mini = max(mini , d[1][i] - 1);
	cout << mini << endl;
	return 0;
}


Measured memory_bytes: 8064
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(IN())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	tt = [1000]*30
	gi = lambda c : ord(c)-ord('a')
	for i in range(n):
		s = input()
		t = [0]*30
		for c in s:
			t[gi(c)]+=1
		for i, (tn, ttn) in enumerate(zip(t, tt)):
			tt[i] = min(tn, ttn)
			
	v = ['']*30
	for i, n in enumerate(tt):
		o = chr(i+ord('a'))
		v[i] = o*n
	ret = ''.join(v)
	print(ret)
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

typedef long long ll;

int n, d;
ll a[200005], b, ans;

int main()
{
    d = scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        d = scanf("%lld", a+i);
        a[i] -= (ll) i;
    }
    sort(a+1, a+n+1);
    b = a[n/2+1];
    for (int i = 1; i <= n; i++)
    {
        ans += abs(a[i] - b);
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 1000

int main(void) {
    int c;
    char x[MAX], buf[2], *p;
    for(buf[0] = 0; scanf("%s", x), atoi(x); printf("%d\n", c)) {
        for(c = 0, p = x; *p; c += atoi(strncpy(buf, p++, 1)));
    }
    return 0;
}

Measured memory_bytes: 560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>

using namespace std;

int main() {
    long long x;
    cin >> x;

    long long a = 100;
    long long ans = 0;
    while (a < x) {
        a *= 1.01;
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3676
fun main (args: Array<String>) {
	val list = readLine()!!.split(" ").map(String::toInt)
	
	var num1 = list[0]
	var num2 = list[1]
	
	var count = 0
	var result = 0
	
	while (count < 2) {
		
		if (num1 > num2 || num1 == num2) {
			result += num1
			num1--
			count++
		} else if (num1 < num2) {
			result += num2
			num2--
			count++
		}
		
	}
	
	println("${result}")
	
}

Measured memory_bytes: 37608
#include<stdio.h>

int main()
{
	int a, b;

	scanf("%d%d", &a, &b);

	if(a> 0)
		printf("Positive\n");
	else
	{
		if(b>= 0)
			printf("Zero\n");
		else
		{
			if((a- b+ 1)% 2)
				printf("Negative\n");
			else
				printf("Positive\n");
		}
	}

	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
# C

import sys
# 再起回数上限変更
# sys.setrecursionlimit(1000000)

N, M = map(int, input().split())



class Graph(object):
    def __init__(self, n:int):
        """ ノードのつながりを辞書型で表現する
        要素数nであり、要素は0からn-1である想定
        >> - usage
        g = Graph(n=n)

        """
        self.adjacency_dict = {}
        self.val = [0] * n
        self.good = [1] * n
        self.n = n
        for i in range(n):
            self.add_vertex(i)

    def add_vertex(self, v: int):
        """ ノードを追加する """
        self.adjacency_dict[v] = []

    def add_edge(self, v1: int, v2: int, undirected=False):
        self.adjacency_dict[v1].append(v2)
        if undirected:
            self.adjacency_dict[v2].append(v1)


g = Graph(N)

h = list(map(int, input().split()))
for i in range(N):
    g.val[i] = h[i]

for m in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    g.add_edge(a, b, undirected=True)
    val_a, val_b = h[a], h[b]

    if val_a == val_b:
        g.good[a] = 0
        g.good[b] = 0
    if val_a > val_b:
        g.good[b] = 0
    if val_a < val_b:
        g.good[a] = 0


ans = 0
for i in g.good:
    if i == 1:
        ans += 1
print(ans)


Measured memory_bytes: 94664
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
const int maxn=2e6+100;
long long n,k,a[maxn],ans;
long long num[maxn],sum[maxn];
map<long long,int> p;
int main()
{
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		sum[i]=sum[i-1]+a[i];
		num[i]=(sum[i]-i+k)%k;
	}
	int m=min(k-1,n);
	for(int i=0;i<=m;i++)
	{
		ans+=p[num[i]];
		p[num[i]]++;
	}
	for(int i=m+1;i<=n;i++)
	{
		p[num[i-k]]--;
		ans+=p[num[i]];
		p[num[i]]++;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 22528
n,p = map(int,input().split())
a = list(map(int,input().split()))

cnt = 0
for x in a:
    if x % 2 == 0:
        cnt += 1
        
if cnt == n:
    if p == 0:
        print(2**n)
    else:
        print(0)
else:
    print(2**n//2)

Measured memory_bytes: 3060
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 200005;

int n, m;
int lt[N];
int rt[N];

struct transfer
{
	int x, y;

	friend bool operator < (const transfer &a, const transfer &b)
	{
		return a.x < b.x;
	}
}tran[N];

signed main(void)
{
	cin >> n >> m;
	for (int i = 1; i <= m; ++i)
		cin >> tran[i].x >> tran[i].y;
	sort(tran + 1, tran + 1 + m);
	for (int i = 1; i <= n; ++i)
		lt[i] = rt[i] = 1;
	for (int i = 1; i <= m; ++i)
	{
		int a = tran[i].y, b = a + 1;
		lt[a] = lt[b] + 1;
		rt[b] = rt[a] + 1;
	}
	for (int i = 1; i < n; ++i)
		cout << lt[i] + rt[i] - 1 << " ";
	cout << lt[n] + rt[n] - 1 << endl;	//system("pause");
}

Measured memory_bytes: 5484
#include<algorithm>
#include<iostream>
#include<cstring>
#include<iomanip>
#include<sstream>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<cmath>
#include<stack>
#include<set>
#include<map>
#define rep(i,x,n) for(int i=x;i<=n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
#define sz(a) int(a.size())
#define rson mid+1,r,p<<1|1
#define pii pair<int,int>
#define lson l,mid,p<<1
#define ll long long
#define pb push_back
#define mp make_pair
#define se second
#define fi first
using namespace std;
const double eps=1e-8;
const int mod=1e9+7;
const int N=5e5+10;
const int inf=1e9;
int n,q;
int c[N];
struct ppo{
	int l,r,i;
	bool operator <(const ppo &o) const{
		return l<o.l;
	}
};
ppo a[N];
vector<int>g[N];
int tr[N],ans[N];
void add(int x,int k){
	while(x<=n) tr[x]+=k,x+=x&-x;
}
int dor(int x){
	int ret=0;
	while(x) ret+=tr[x],x-=x&-x;
	return ret;
}
int main(){
	ios::sync_with_stdio(false);
	//freopen("in","r",stdin);
	cin>>n>>q;
	rep(i,1,n){
		cin>>c[i];
		if(sz(g[c[i]])==0) add(i,1);
		g[c[i]].pb(i);
	}
	rep(i,1,q){
		cin>>a[i].l>>a[i].r;
		a[i].i=i;
	}
	sort(a+1,a+q+1);
	int now=1;
	rep(i,1,n){
		while(i==a[now].l){
			ans[a[now].i]=dor(a[now].r);
			now++;
		}
		add(i,-1);
		auto it=upper_bound(g[c[i]].begin(), g[c[i]].end(),i);
		if(it!=g[c[i]].end()) add(*it,1);
	}
	rep(i,1,q){
		cout<<ans[i]<<'\n';
	}
	return 0;
}


Measured memory_bytes: 42816
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

while true
    s=get
    break if s[1]=="?"
    a=s[0].to_i
    op=s[1]
    b=s[2].to_i 
    case op
    when "+" then
        puts a+b
    when "-" then
        puts a-b
    when "/" then
        puts a/b
    when "*" then
        puts a*b
    end
end


Measured memory_bytes: 6880
#include<bits/stdc++.h>
using namespace std;
#define mo 1000000007
#define maxn 2005
int a[maxn],b[maxn],c[maxn];
int main(){
	int n,k,x;scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&x);
		b[x]+=a[x],c[x]++;
		for(int j=x+1;j<=2000;j++)a[j]++;
	}
	int ans=0;
	for(int x=1;x<=2000;x++){
		b[x]=a[x]*c[x]-b[x];
		a[x]=1ll*a[x]*c[x]%mo*(k-1)%mo;(a[x]+=b[x])%=mo;
		(ans+=1ll*(b[x]+a[x])*k%mo*500000004%mo)%=mo;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
/*
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  rep(i,n) for(li i=0;i<(n);i++)
#define  red(i,n) for(li i=(n)-1;i>=0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
using li = long long;
using vi = vector<li>;
using vs = vector<string>;



int main()
{
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0)cout<<"Possible\n";
    else cout<<"Impossible\n";
       
    
    return 0;
}

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

const int N = 123;
const int INF = 2e9;
const int mod = 1e9+7;

int ans, n, m, k;
int a[N];
string s;

int main() {
  scanf("%d%d", &n, &m);
  cin >> s;
  for (int i = 0; i < n; ++i) {
    if (!isdigit(s[i])) return !printf("No");
  }
  if (s[n] != '-') return !printf("No");
  for (int i = 0; i < m; ++i) {
    if (!isdigit(s[n+i+1])) return !printf("No");
  }

  printf("Yes");
  return 0;
}


Measured memory_bytes: 256