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

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vp;
const int inf = 1e9;
const ll INF = 1e18;
const db eps = 1e-10;

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define ep emplace
#define mem(a) memset(a, 0, sizeof(a))
#define copy(a, b) memcpy(a, b, sizeof(b))
#define PA cout << "pass\n"
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define TM cout << db(clock()) / CLOCKS_PER_SEC << '\n'

mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count());

template <class A, class B>
string to_string(pair<A, B> p);

template <class A, class B, class C>
string to_string(tuple<A, B, C> p);

template <class A, class B, class C, class D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <class A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <class A, class B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <class A, class B, class C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <class A, class B, class C, class D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug(){cerr << endl;}
template<class T, class... U>
void debug(const T& h,const U&... t){
    cerr << to_string(h) << ' ';
    debug(t...);
}

int n, k, s;

int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    cout << fixed << setprecision(10);
    cin >> n >> k >> s;
    vi res(n + 1);
    for(int i = 1; i <= k; i++) res[i] = s;
    for(int i = k + 1; i <= n; i++) res[i] = (s == inf ? inf - 1 : s + 1);
    for(int i = 1; i <= n; i++) cout << res[i] << " \n"[i == n];
    return 0;

}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  	long long a , b , c ;
  	cin >> a >> b >> c ;
  	if(a%b==0){
    	cout << (a/b)*c << endl;
    }
  	else{
      cout << ((a/b)+1)*c << endl;
    }
	return 0;
}


Measured memory_bytes: 3640
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<map>
#include<string>
#define ll long long
using namespace std;
int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
int a,b;
int main()
{
	a=read();b=read();
	if(a>8||b>8) printf(":(");
	else printf("Yay!");
	return 0;
 } 

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	int former = Integer.parseInt(s.substring(0,2));
	int later = Integer.parseInt(s.substring(2,4));
	boolean a = false;
	boolean b = false;
	if(former > 0 && former <= 12) a = true;
	if(later > 0 && later <= 12) b = true;
	if(a && b){
		System.out.println("AMBIGUOUS");
	}else if(a && !b){
		System.out.println("MMYY");
	}else if(!a && b){
		System.out.println("YYMM");
	}else{
		System.out.println("NA");	
	}
}
}


Measured memory_bytes: 21844
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

class Main {
	public static void main(String args[]) throws IOException {
		@SuppressWarnings("resource")
		Scanner cin = new Scanner(System.in);
		ArrayList<String> inLines = new ArrayList<String>();
		for (; cin.hasNext();) {
			inLines.add(cin.nextLine());
		}
		Solver solver = new Solver();
		solver.solve(inLines);
	}
}

class Solver {

	public void solve(ArrayList<String> inLines) {
		int N = Integer.parseInt(inLines.get(0));
		String str = inLines.get(1);
		int maxX = 0;
		int x = 0;
		for (int i = 0; i < N; i++) {
			if (str.charAt(i) == 'I')
				x++;
			else if (str.charAt(i) == 'D')
				x -= 1;
			if (x > maxX)
				maxX = x;
		}
		System.out.println(maxX);
	}
}


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


int main()
{
	int n, b, f, r, v;
	int count[4][3][10];
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 10; k++){
				count[i][j][k] = 0;
			}
		}
	}

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		count[b - 1][f - 1][r - 1] += v;
	}

	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 10; k++){
				cout << " " << count[i][j][k];
			}
			cout << endl;
		}
		if (i != 3){
			cout << "####################" << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3100
using System.Collections.Generic;
    using System.Collections;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System;

    namespace cysharp_test
    {
        class Program
        {
            static void Main (string[] args)
            {
                new Program ().solve ();
            }

            void solve ()
            {
                int N = int.Parse (Console.ReadLine ());
            var dic = new Dictionary<string, int>();
            for (int i = 0; i < N;i++){
                var input = Console.ReadLine();
                if(dic.Keys.Contains(input)){
                    dic[input]++;

                }else{
                    dic.Add(input, 1);
                }
            }
            Console.WriteLine(dic.Count);
            Console.ReadKey();
        }

        }

        struct Vector2
        {
            public Vector2 (long x, long y)
            {
                this.x = x;
                this.y = y;
            }

            public long x, y;

            public string ToString ()
            {
                return "(" + this.x + "," + this.y + ")";
            }

            public static Vector2 operator + (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x + b.x, a.y + b.y);
            }

            public static Vector2 operator - (Vector2 a, Vector2 b)
            {
                return new Vector2 (a.x - b.x, a.y - b.y);
            }

            public static Vector2 operator * (Vector2 a, long scala)
            {
                return new Vector2 (a.x * scala, a.y + scala);
            }

            public static bool operator == (Vector2 a, Vector2 b)
            {
                return a.x == b.x && a.y == b.y;
            }

            public static bool operator != (Vector2 a, Vector2 b)
            {
                return !(a.x == b.x && a.y == b.y);
            }
        }
    }

Measured memory_bytes: 46160
import java.util.Scanner;

class Main {
    public static void main (String args[]) {
	Scanner scan = new Scanner(System.in);
	int[] box = new int[10];
	int i = 0;

	while (scan.hasNext()) {
	    int n = scan.nextInt();

	    if (n == 0) {
		i--;
		System.out.println(box[i]);
	    }
	    else {
		box[i] = n;
		i++;
	    }
	}
    }
}

Measured memory_bytes: 25896
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();
        int M = sc.nextInt();

        int[][] sw = new int[M][N];
        int[] p = new int[M];
        int[][] sw_all = new int[(int) Math.pow(2, N)][N];

        for (int i = 0; i < M; i++) {
            int k = sc.nextInt();
            for (int j = 0; j < k; j++) {
                int s = sc.nextInt() - 1;
                sw[i][s] = 1;
            }
        }

        for (int i = 0; i < M; i++) {
            p[i] = sc.nextInt();
        }

        for (int i = 0; i < (int) Math.pow(2, N); i++) {
            for (int j = 0; j < N; j++) {
                if ((1 & i >> j) == 1) {
                    sw_all[i][j] = 1;
                }
            }
        }

        int ans = 0;

        for (int i = 0; i < Math.pow(2, N); i++) {
            for (int j = 0; j < M; j++) {
                int count = 0;
                for (int k = 0; k < N; k++) {
                    if (sw[j][k] == 1 && sw_all[i][k] == 1) {
                        count++;
                    }
                }
                if (count % 2 != p[j]) {
                    break;
                }
                if (j == M - 1) {
                    ans++;
                }
            }
        }

        System.out.println(ans);

        sc.close();
    }
}

Measured memory_bytes: 21844
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	int N;
	cin >> N;
	vvi count(N, vi(26, 0));
	string S;
	REP(i, N) {
		cin >> S;
		REP(j, S.length()) {
			count[i][S[j] - 'a']++;
		}
	}

	string ans;
	REP(i, 26) {
		int c = INF;
		REP(j, N) {
			c = min(c, count[j][i]);
		}
		REP(k, c) {
			ans += ('a' + i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  bool ok = false;
  if (s[0] == '7') ok = true;
  if (s[1] == '7') ok = true;
  if (s[2] == '7') ok = true;
  cout << (ok ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

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

    vector<ll> left(n+1, 0), right(n+1, 0);
    rep(i, 0, n) left[i+1] = __gcd(left[i], a[i]);
    for(int i = n-1; i >= 0; i--) right[i] = __gcd(right[i+1], a[i]);

    ll ans = 0;
    rep(i, 0, n) chmax(ans, __gcd(left[i], right[i+1]));
    cout << ans << endl;
}

Measured memory_bytes: 2560
def make_reverse_index(s):
    idx = dict()

    for pos, c in enumerate(s):
        if c not in idx:
            idx[c] = list()
        idx[c].append(pos)

    return idx

def solve(s, t):
    idx1 = make_reverse_index(s)
    idx2 = make_reverse_index(t)

    for i1 in idx1.values():
        c2 = t[i1[0]]
        i2 = idx2[c2]

        if i1 != i2:
            return False

    return True

def main():
    s = input()
    t = input()

    if solve(s, t):
        print('Yes')
    else:
        print('No')

main()


Measured memory_bytes: 20656
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

int n , m , q , res [ 10 ] ;
map < pair < int , int > , bool > mark ;
vector < pair < int , int > > vc ; 

bool val ( int x , int y ) {
	return x > 0 && y > 0 && x <= n && y <= m ; 
}

void add ( int x , int y ) {
	bool isok = 1 ; 
	int cnt = 0 ; 
	for ( int i = x ; i <= x + 2 ; ++ i ) {
		for ( int j = y ; j <= y + 2 ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ; 
	for ( int i = x - 1 ; i <= x + 1 ; ++ i ) {
		for ( int j = y ; j <= y + 2 ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	} 
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ;
	for ( int i = x - 2 ; i <= x  ; ++ i ) {
		for ( int j = y ; j <= y + 2 ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ;
	for ( int i = x ; i <= x + 2 ; ++ i ) {
		for ( int j = y - 1 ; j <= y + 1 ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ;
	for ( int i = x - 1 ; i <= x + 1 ; ++ i ) {
		for ( int j = y - 1 ; j <= y + 1 ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ; 
	for ( int i = x - 2 ; i <= x ; ++ i ) {
		for ( int j = y - 1 ; j <= y + 1 ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ;
	for ( int i = x ; i <= x + 2 ; ++ i ) {
		for ( int j = y - 2 ; j <= y ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ;
	for ( int i = x - 1 ; i <= x + 1 ; ++ i ) {
		for ( int j = y - 2 ; j <= y ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ;
	isok = 1 , cnt = 0 ;
	for ( int i = x - 2 ; i <= x ; ++ i ) {
		for ( int j = y - 2 ; j <= y ; ++ j ) {
			isok &= val ( i , j ) ;
			cnt += mark [ { i , j } ] ; 
		}
	}
	if ( isok )
		++ res [ cnt ] ; 
}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m >> q ;
	while ( q -- ) {
		int a , b ;
		cin >> a >> b ;
		vc . push_back ( { a , b } ) ;
		mark [ { a , b } ] = 1 ; 
	}
	for ( auto e : vc )
		add ( e . first , e . second ) ;
	int All = ( n - 2 ) * ( m - 2 ) ;
	for ( int i = 1 ; i < 10 ; ++ i ) {
		res [ i ] /= i ;
		All -= res [ i ] ; 
	}
	cout << All << '\n' ;
	for ( int i = 1 ; i < 10 ; ++ i )
		cout << res [ i ] << '\n' ; 
	cout << '\n' ; 
}



Measured memory_bytes: 158064
# math.gcd is introduced in python 3.5
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

N = int(input())
A = [int(a) for a in input().split()]

# L[i] = gcd(A[:i + 1])
# R[i] = gcd(A[i:])
L = [0] * N
L[0] = A[0]
for i in range(1, N):
    L[i] = gcd(L[i-1], A[i])
R = [0] * N
R[-1] = A[-1]
for i in range(N - 2, -1, -1):
    R[i] = gcd(R[i+1], A[i])

G = [0] * N
G[0]  = R[1]
G[-1] = L[-2]
for i in range(1, N - 1):
    G[i] = gcd(L[i-1], R[i+1])

print(max(G))


Measured memory_bytes: 14400
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String s = sc.next();
		char arr[] = s.toCharArray();
		int wcount=0;
		int count=0;
		for(int i=0;i<N;i++){
		    if(arr[i]=='W'){
		        wcount++;
		    }
		}
		for(int i=N-wcount;i<N;i++){
		    if(arr[i]=='R'){
		        count++;
		    }
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 40948
#include<stdio.h>

int main(){
	
	int w,h,x,y,r;
	
	scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
	
	if((0>(x-r))||(0>(y-r))||(w<(x+r))||(h<(y+r))){
		printf("No\n");
	}else{
		printf("Yes\n");
	}
	
	return 0;
}

Measured memory_bytes: 584
#![allow(unused_imports, non_snake_case, dead_code)]
use proconio::{
    input, fastout,
    marker::{Chars, Bytes, Usize1}
};
struct UnionFind {
    size: usize,
    pos: Vec<isize>,
}
impl UnionFind {
    fn new(n: usize) -> Self {
        let size = n;
        let pos = vec![-1; n + 1];
        UnionFind { size, pos }
    }
    fn find(&mut self, x: usize) -> usize {
        if self.pos[x] < 0 {
            x
        } else {
            let v = self.pos[x] as usize;
            self.pos[x] = self.find(v) as isize;
            self.pos[x] as usize
        }
    }
    fn unite(&mut self, x: usize, y: usize) -> Result<(), ()> {
        let mut x = self.find(x);
        let mut y = self.find(y);
        if x == y {
            return Err(());
        };
        if self.pos[x] > self.pos[y] {
            std::mem::swap(&mut x, &mut y);
        }
        self.pos[x] += self.pos[y];
        self.pos[y] = x as isize;
        Ok(())
    }
    fn same(&mut self, x: usize, y: usize) -> bool {
        self.find(x) == self.find(y)
    }
    fn size(&mut self, x: usize) -> usize {
        let x = self.find(x);
        -self.pos[x] as usize
    }
}

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
        par: [(Usize1, Usize1); m]
    }
    let mut uf = UnionFind::new(n);
    for &(x, y) in &par {
        uf.unite(x, y).ok();
    }
    let mut ans = 1;
    for i in 0..n {
        ans = std::cmp::max(ans, uf.size(i));
    }
    println!("{}", ans);
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}


int nextInt() { int x; scanf("%d", &x); return x;}

bool vis[3333];

int main2() {
  int A = nextInt();
  int B = nextInt();
  int C = nextInt();
  int D = nextInt();
  int E = nextInt();
  int F = nextInt();

  memset(vis, 0, sizeof(vis));

  int ansy = 0;
  int ansx = 100 * min(A,B);
  for (int a = 0; a * 100 * A <= F; a++) {
    for (int b = 0; a * 100 * A + b * 100 * B <= F; b++) {
      int x = a * 100 * A + b * 100 * B;
      if (x <= 0 || x > F) continue;
      if (vis[x]) continue;
      vis[x] = true;
      for (int c = 0; c * C + x <= F; c++) {
        for (int d = 0; c * C + d * D + x <= F; d++) {
          int y = c * C + d * D;
          if (x + y > F) continue;
          if (y * (100 + E) <= E * (x + y)) {
            if (ansy * (x + y) < y * (ansx + ansy)) {
              ansx = x;
              ansy = y;
            }
          }
        }
      }
    }
  }
  cout << (ansx+ansy) << " " << ansy << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws) main2();
  return 0;
}



Measured memory_bytes: 256
import typing
n = int(input())

res = set()
str_num = ""
def dfs(str_num:str, i:int):
    global res
    if i == 10 :
        # print(str_num)
        if str_num and int(str_num) <= n and len(set(str_num)) == 3:
            res.add(str_num)
            # print(res, str_num)
        return 0
    dfs(str_num + "3", i + 1)
    dfs(str_num + "5", i + 1)
    dfs(str_num + "7", i + 1)
    dfs(str_num      , i + 1)

if __name__ == "__main__":
    dfs(str_num, 0)
    print(len(res))


Measured memory_bytes: 13784
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var a,b int
    fmt.Scan(&a,&b)
    ans := 10
    if a < b{
        ans = 0
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
vector<pair<int,int>> v;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x,n; cin>>x>>n;
    int arr[MAX]={0};
    for(int i=0;i<n;i++){
        int a; cin>>a;
        arr[a]=1;
    }
    for(int i=-200;i<=200;i++){
        if(i<0)
        {
            v.push_back({abs(i-x),i});
        }
        else {
            if(arr[i]==0)
            {
                v.push_back({abs(i-x),i});
            }
        }
    }
    sort(v.begin(),v.end());
    cout<<v[0].second<<endl;
}

Measured memory_bytes: 4052
#include <bits/stdc++.h>
#include <unordered_map> 
using namespace std; 
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI1 3.14159265358979311599796346854418516159057617187500

typedef long long int ll;  
ll MOD = 1e9 + 7;

ll power(ll a , ll n)
{
    unsigned long long int result=1,x=a;
    while(n>0)
    {
        if(n % 2 ==1)
            result = (result * x)%MOD;
        x = (x * x)%MOD;
        n=n/2;
    }
    return result;
}

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


int main() 
{ 
    FIO
    int t;
    t=1;
    while(t--)
    {   
        int a[5];
        cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

        for(int i=0;i<5;i++)
        {
            if(a[i]==0)
            {
                cout << i+1 << endl;
                return 0;   
            }
        }
    }
    return 0; 
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

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

	if (n > k) {
		sort(h.rbegin(), h.rend());
		rep(i, k) h[i] = 0;
		ll sumh = 0;
		rep(i, n) sumh += h[i];
		dunk(sumh);
	}
	else dunk(0);
}


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

int main() {
    int n;
    cin >> n;
    int count=0;
    int ans=0;
    for(int i=1;i<=n;i+=2){
        int count=0;
        for(int j=1;j<=i;j+=2){
            if(i%j==0) count++;
        }
        if(count==8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/
ll dp[maxn];
ll n,W;
ll v[maxn];
ll w[maxn];
int main()
{
    memset(dp,0x3f,sizeof(dp));
    gbtb;
    cin>>n>>W;
    repd(i,1,n)
    {
        cin>>w[i]>>v[i];
    }
    ll ans=0ll;
    dp[0]=0;
    repd(i,1,n)
    {
        for(int j=1e5;j>=v[i];--j)
        {
            {
                dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
                if(dp[j]<=W)
                    ans=max(ans,(ll)(j));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}

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

int main() {
	long long int n,count=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		if(i%3==0 && i%5==0 || i%3==0 || i%5==0){
			continue;
		}
		else{
			count+=i;
		}
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <math.h>
#include <string>
#include <cmath>
#include <algorithm>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++) 
using namespace std;

int main(){
    ll k,n;
    cin >> k >> n;
    ll b;
    vector <ll> a;
    rep(i,n){
        cin >> b;
        a.push_back(b);
        //cout << b << endl;
    }
    sort(a.begin(),a.end());
    ll mx = k - a[n-1] + a[0];
    rep(j,n){
        //cout << mx << " " << endl;;
        if(j != 0){
            b = a[j] - a[j-1];
            if(mx < b){
                mx = b;
            }
        }
    }
    cout << k-mx << endl;
    return 0;
}

Measured memory_bytes: 2420
def val(x):
    sum = 0
    while x > 0:
        sum += x%10
        x //= 10
    return sum

a,n,m = map(int, input().split())
cnt = 0

for y in range(1, 73):
    x = 1
    for t in range(1, n+1):
      x *= (y+a)
    if x <= m and val(x) == y:
        cnt += 1

print(cnt)


Measured memory_bytes: 5600
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;

template <typename T>
constexpr bool chmin(
    T a, T b, function<bool(T, T)> f = [](T a, T b) { return a > b; }) {
  // when f is true, b is more 'smaller'
  if (f(a, b)) {
    swap(a, b);
    return true;
  }
  return false;
}
template <typename T> constexpr bool chmax(T a, T b) {
  return chmin(a, b, [](T a, T b) { return a < b; });
}
template <typename ite> void print_ite(ite start, ite end, char c = ' ') {
  for (auto i = start; i != end; i++)
    cout << i << c;
  cout << endl;
}
template <typename ite> void scan_ite(ite start, ite end) {
  for (auto i = start; i != end; i++)
    cin >> (*i);
}
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

int main() {
  string s;
  cin >> s;
  Yes(s[2] == s[3] && s[4] == s[5]);
}


Measured memory_bytes: 256
#include<iostream>

int n;
bool *isPrime;

int solve(){
	int p = 0;
	for(int i=0; i<=n; i++)
		isPrime[i] = true;
	isPrime[0] = isPrime[1] = false;
	for(int i=2; i<=n; i++){
		if(isPrime[i]){
			p++;
			for(int j=2*i; j<=n; j+=i)
				isPrime[j] = false;
		}
	}
	return p;
}

int main(){
	while(std::cin >> n){
		isPrime = new bool[n+1];
		std::cout << solve() << std::endl;
		delete[] isPrime;
	}
	return 0;
}

Measured memory_bytes: 2008
/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	vector<int> in(n, 0);
	vector< pair<int, int> > G[n];
	for(int i = 0, u, v; i + 1 < n; i++) {
		cin >> u >> v, u--, v--;
		in[u]++, in[v]++;
		G[u].push_back({v, i});
		G[v].push_back({u, i});
	}
	int mx = 0;
	for(int i = 0; i < n; i++) {
		mx = max(mx, in[i]);
	}
	cout << mx << "\n";
	vector<int> res(n, 0);
	function<void(int, int, int)> dfs = [&](int u, int p, int c) {
		int nw = c + 1;
		for(auto& v : G[u]) {
			if( v.first == p ) continue;
			nw %= mx;
			res[v.second] = nw;
			dfs( v.first, u, nw );
			nw++, nw %= mx;
		}
	};
	dfs( 0, -1, -1 );
	for(int i = 0; i + 1 < n; i++) {
		cout << res[i] + 1  << "\n";
	}
}

Measured memory_bytes: 8576
# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect
#import numpy as np
#from copy import deepcopy
#from collections import deque
#from decimal import Decimal
#from numba import jit

INF = 1 << 50



def run():
    N, *A = map(int, read().split())
    ans = 0
    cache = A[0]
    for a in A:
        if cache > a:
            ans += cache - a
        else:
            cache = a

    print(ans)


if __name__ == "__main__":
    run()

Measured memory_bytes: 30796
//   PIGMEISTER™   //

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

#define ll long long
#define ull unsigned long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);i++)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);i--)
#define mi map<ll,ll>
#define vi vector<ll>
#define si set<ll>
#define pi pair<ll,ll>
#define vp vector<pair<ll,ll>>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define test ll _;cin>>_;while(_--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define endl '\n'
#define mod (ll)1000000007
//#define mod (ll)998244353
#define MAX 200005
ll powah(ll, ll);

int main()
{
    jaldi;
    
    ll x;
    cin >> x;
    ll ans = 0;
    ans += 1000*(x/500);
    x %= 500;
    ans += 5*(x/5);
    cout << ans << endl;
    
    return 0;
}

ll powah(ll x, ll y) { 
    ll res = 1; x = x % mod;
    while (y > 0) { 
        if (y & 1) res = (res*x) % mod; 
        y = y>>1; x = (x*x) % mod; } 
    return res; 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <utility>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long int X, Y; cin >> X >> Y;
  long long int n = X;
  long long int ans = 0;
  while (n <= Y) {
    n *= 2;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <string>
#include <vector>

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

    if(a<b){
        if(a+x < b){
            std::cout << "dangerous";
            return 0;
        }
        else{
            std::cout << "safe";
            return 0;
        }
    }
    else{
        std::cout << "delicious";
        return 0;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll a,b,c;
	cin>>a>>b>>c;
	cout<<((a!=b || a!=c || b!=c)?"No":"Yes");
	return 0;
}

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

int main(void){
  int N;
  int num[256] = { 0 };
  int count = 0;
  char *tok = NULL;
  char buf[4096] = { 0 };
  
  //個数読み込み
  fgets(buf, sizeof(buf), stdin);
  sscanf(buf, "%d", &N);
  
  //数字読み込み
  fgets(buf, sizeof(buf), stdin);
  tok = strtok(buf, " ");
  for(int i = 0; i < N; i++){
    num[i] = atoi(tok);
    tok = strtok(NULL, " ");
  }
  
  //偶数チェック
  int i;
  for(;;){
    for(i = 0; i < N; i++){
      if(num[i] % 2 != 0) break;
  	  num[i] = num[i] / 2;
    }
    if(i != N) break;
    count++;
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 1708
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MODS 100005
#define MOD 1000000007
#define all(x) (x).begin(), (x).end()
#define ll long long int
#define ld long double
#define bigint int64_t
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define mp make_pair
#define pb push_back
#define test ll t;read(t);while(t--)
#define pll pair<ll,ll>
#define vvll vector<vector<ll>>
#define fst first
#define scd second
#define ins insert
#define line "\n"
string yes="YES";
string no="NO";

#define forn(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define for1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
#define forr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
#define forab(i,a,b,c) for(ll (i) = a ; (i) <= (b) ; (i)+=(c))

template <typename T>
void read(T &x){
    cin >> x;
}
template <typename T , typename T0>
void read(T &x,T0 &y){
    cin >> x >> y;
}

template <typename T , typename T0 , typename T1>
void read(T &x,T0 &y,T1 &z){
    cin >> x >> y >> z;
}

template <typename T , typename T0 , typename T1 , typename T2>
void read(T &x,T0 &y,T1 &z,T2 &w){
    cin >> x >> y >> z >> w;
}

template <typename T , typename T0>
void read(pair< T , T0 > &p){
    cin >> p.fst >>p.scd;
}

template <typename T>
void read(vector< T > &oneD,ll n){
    forn(i,n)
    {
        ll x;
        read(x);
        oneD.push_back(x);
    }
}

template <typename T>
void read(T oneD[] , ll n){
    for(ll i=0;i<n;i++){
        read(oneD[i]);
    }
}

template <typename T>
void write(T &x){

    cout << x << " ";
}

template <typename T>
void wrtline(T &x){

    cout << x << line;
}

template <typename T , typename T0>
void write(T &x,T0 &y){
    cout << x << " " << y << "\n";
}

template <typename T , typename T0 , typename T1>
void write(T &x,T0 &y,T1 &z){
    cout << x << " " << y << " " << z << "\n";
}

template <typename T , typename T0 , typename T1 , typename T2>
void write(T &x,T0 &y,T1 &z,T2 &w){
    cout << x << " " << y << " " << z << " " << w << "\n";
}

template <typename T , typename T0>
void write(pair< T , T0 > &p){
    write(p.fst);
    write(p.scd);
    cout << line;
}

template <typename T>
void write(vector< T > &oneD,ll n){
    for(ll i=0;i<n;i++){
        cout<<oneD[i]<<" ";
    }
    cout << line;
}

template <typename T>
void write(T oneD[] ,int n){
    for(ll i=0;i<n;i++){
        write(oneD[i]);
    }
    cout <<line;
}

template <typename T , typename T0>
void write(map< T , T0 > &mpp){
    for(auto it : mpp){
        write(it.fst);
        cout << ": ";
        write(it.scd);
        cout << "\n";
    }
    cout<<line;
}
void write(vvll rc,ll n,ll m)
{
    forn(i,n)
    {
        forn(j,m)
        {
            cout<<rc[i][j]<<" ";
        }
        cout<<line;
    }
}
void solve()
{
    char c;
    read(c);
    if(c>='A' and c<='Z')
        cout<<'A'<<line;
    else
        cout<<'a'<<line;
}
int main() {
    /*#ifndef ONLINE_JUDGE
         freopen("input.txt", "r", stdin);
         freopen("output.txt", "w", stdout);
     #endif*/
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//*******************************************************//
/*test*/
solve();

return 0;
}


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

int main(){
	int n;
	cin >> n;
	int m;
	int a[100010];
	memset(a,0,sizeof(a));
	for(int i = 0;i < n;i++){
		cin >> m;
		a[m]++;
	}
	int max = 0;
	int sum = 0;
	for(int i = 0;i < 100005;i++){
		if(i==0){
			max = a[0] + a[1];
		}
		else{
			sum = a[i] + a[i - 1] + a[i + 1];
		}
		if(sum > max){
			max = sum;
		} 
	}
	printf("%d\n",max);
	return 0;
}

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

int a, b, c, d, e, k, x, y, z, h, w;

void input()
{
    cin >> a >> b >> c >> d >> e >> k;
}

void solve()
{
    if (e - a > k)
    {
        cout << ":(" << endl;
    }
    else
    {
        cout << "Yay!" << endl;
    }
}
int main()
{
    input();
    solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	int i,j,n,f=1;
	cin>>n;
	for(i=0;i<=n/7;i++)
		for(j=0;j<=n/4;j++)
			if(i*7+j*4==n)f=0;
	if(f)cout<<"No";
	else cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
from math import gcd
def solve():
    K = int(input())

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

if __name__ == '__main__':
    solve()


Measured memory_bytes: 9176
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N = sc.next();
        char C = N.charAt(0);

        String alphabetList = "abcdefghijklmnopqrstuvwxyz";

        char[] Sc = alphabetList.toCharArray();
        char ans='z';

        for(int i=0; i<Sc.length; i++){
            if(C == Sc[i] && C != 'z'){
                ans = Sc[i+1];
            }
        }

        System.out.println(ans);

    }
}



Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        long h = scanner.nextLong();

        long base = 1;
        long answer = 0;
        while (h > 0) {
            answer += base;
            base *= 2L;
            h /= 2;
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 25044
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)


int main(){
  ll N,X,Y;
  cin>>N>>X>>Y;

ll kosuu=0;
ll cc=0;
  for(int i=1;;i++){

cc++;
if(X*i>=N)
break;
  }
cout<<cc*Y<<endl;

}











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

int main() {
	string b ;
  	cin >>b;
  	string ans;
  
  	if(b == "A"){
      ans = "T";
    }
  	if(b == "T"){
      ans = "A";
    }
  	if(b == "C"){
      ans = "G";
    }
  	if(b == "G"){
      ans = "C";
    }
  	cout <<ans <<endl;
  	
	
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <random>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector <int> a(n);
  for (int i = 0; i < n; i++) {
	  cin >> a[i];
	}
  int c   = 1;
  int ans = 0;
  for (int i = 1; i < n; i++) {
	  if (a[i] == a[i - 1]) {
		  c++;
		} else {
		  ans += c / 2;
		  c    = 1;
		}
	}
  cout << ans  + c / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 1e5 + 7;
int n, m;
vector <int> g[N];
bool used[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].app(v); g[v].app(u);
    }
    vector <int> ans = {1};
    used[1] = 1;
    while (1) {
        int u = ans.back();
        for (int v : g[u]) {
            if (!used[v]) {
                ans.app(v);
                used[v] = 1;
                break;
            }
        }   
        if (ans.back() == u)
            break;
    }   
    reverse(all(ans));
    while (1) {
        int u = ans.back();
        for (int v : g[u]) {
            if (!used[v]) {
                ans.app(v);
                used[v] = 1;
                break;
            }
        }   
        if (ans.back() == u)
            break;
    }   
    cout << ans.size() << endl;
    for (int e : ans)
        cout << e << ' ';
    cout << endl;            
}

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

const int maxn = 3000;
int A[maxn], n, a, b;

int main()
{
    scanf("%d%d%d", &n, &a, &b);
    for(int i = 0; i < n; i++)
        scanf("%d", &A[i]);
    if(n == 1)
        printf("%d\n", abs(A[0] - b));
    else
        printf("%d\n", max(abs(A[n - 1] - b), abs(A[n - 1] - A[n - 2])));
    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

char a[12];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    set<string> s;
    int n = gi();
    for (int i = 0; i < n; i++) {
        scanf("%s", a);
        s.insert(a);
    }
    cout << s.size() << endl;

    return 0;
}


Measured memory_bytes: 19340
#include<stdio.h>
#include<math.h>

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(void){
  long long int i, count,  ans;
  char S[200002];

  scanf("%s", S);
  ans=0;
  for(i=0; i<200002; i++){
//    printf("%d %d %d \n",  ans, ctoi(S[i]), ans+ctoi(S[i]));
    if(S[i]=='\0') {
      break;
    }
    ans=ans+ctoi(S[i]);
  }
//  printf("%d\n", ans);
  if((ans%9) ==0){
    printf("Yes");
  }else{
    printf("No");
  }
 return 0;
}

Measured memory_bytes: 1880
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX(X, Y) (((X) > (Y))? (X) : (Y))
#define MIN(X, Y) (((X) < (Y))? (X) : (Y))
int compare_int(const void *a, const void *b){
  return *(long int*)b - *(long int*)a; // 大きい順
}
int compare_int_small(const void *a, const void *b){
  return *(long int*)a - *(long int*)b; // 小さい順
}
// 公約数
long long int gcd(long long int a, long long int b){
  if(b == 0){
    return a;
  }else{
    return gcd(b, a % b);
  }
}
// 最小公倍数 = a * b / 最大公約数
// 公倍数
long long int lcm(long long int a, long long int b){
  return a * b / gcd(a, b);
}

// 5min
int main(void){
  int p[11];
  int n;
  int ans = 0;
  
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &p[i]);
  }

  qsort(p, n, sizeof(int), compare_int);

  ans = p[0] / 2;

  for(int i = 1; i < n; i++){
    ans += p[i];
  }

  printf("%d\n", ans);
  
  return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3

def main():
    n = int(input())
    abs = []
    for i in range(n):
        a, b = map(int, input().split())
        abs.append((a, b))
    abs = sorted(abs, key=(lambda x: x[1]))
    time = 0
    possible = True
    for i in range(n):
        time += abs[i][0]
        if time > abs[i][1]:
            possible = False
    print("Yes" if possible else "No")

if __name__ == "__main__":
    main()


Measured memory_bytes: 33368
n,q = map(int,input().split())
s = input()
lr=[list(map(int,input().split())) for i in range(q)]
l=[0]*n
r=[0]*n
lcnt=0
rcnt=0
for i in range(n-1):
    if s[i]=="A" and s[i+1] == "C":
        # lcnt+=1
        rcnt+=1
        l[i+1]=1
    r[i+1]=rcnt
# print(l)
# print(r)
for i in lr:
    # print(max(0,r[i[1]-1]-r[i[0]-1]-l[i[0]-1]))
    # print(s[i[0]-1:i[1]])
    print(max(0,r[i[1]-1]-r[i[0]-1]))

Measured memory_bytes: 31496
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <cmath>
#include <set>
 
using namespace std;
 
int main()
{
    int a, b, x;
    cin >> x >> a >> b;
    cout << min(x + a, min(x + b, a + b)) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
██████╗  ███████╗  
██╔══██╗ ██╔════╝ 
██████╔╝ ███████╗ 
██╔══██╗ ╚════██║  
██║  ██║ ███████║      
╚═╝  ╚═╝ ╚══════╝                                                                                                             
*/

#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define haha(j,a,n) for(int j=a;j<n;j++)
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define endl "\n"
#define bc(v) v.begin(),v.end()
#define vl vector<ll>
#define vi vector<int>
#define why 1000000007
#define NUM 100005
#define F first
#define S second
#define bhar(a) rep(i,a.size()) cin>>a[i];
#define show(a) rep(i,a.size()) cout<<a[i]<<" ";
#define sott(a) sort(bc(a))
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define mapp map<ll,ll>
#define dkac cout<<fixed<<setprecision(15);
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define yeah(n) while(n--)
#define pi 3.1415926535897
ll gcd(int a, int b){if(b==0) return a; else return gcd(b,a%b);}
ll bitfun(ll x){
  return (x&(-x));
}
void solve(){
  dkac
  ll r; cin>>r;
  cout<<2*pi*r;
}
int main(){
    ios
    int t=1; 
    //cin>>t;
    yeah(t){
      solve();
    }
}

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

int P=0, Q=0, R=0;

int main(){
  cin >> P >> Q >> R;
  cout << P + Q + R - max({P, Q, R}) << endl;
}

Measured memory_bytes: 256