akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, k;
	cin >> n >> k;
	if(n % k == 0) cout << 0 << endl;
	else cout << 1 << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

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

    int ans = 0;
    for (char d : N) ans += d - '0';

    int sum = 0;
    for (int i = 0; i < N.size(); i++) {
        if (N[i] == '0') continue;
        int num = sum + N[i] - '1';
        num += 9 * (N.size() - i - 1);
        ans = max(ans, num);

        sum += N[i] - '0';
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  int n,m;
  cin >> n >> m;
  
  if(m%2==1) {
    repo(i, (m+3)/2) {
    cout << i << " " << m+2-i << endl;
    }
    for(int i=m+2; i<m+2+m/2; i++) {
    cout << i << " " << 3*m+3-i << endl;
    }
  }
  
  if(m%2==0) {
    repo(i, (m/2)+1) {
    cout << i << " " << m+1-i << endl;
    }
    for(int i= m+1;i<=m+m/2;i++) {
    cout << i << " " << 3*m+2-i << endl;
    }
  }
}

Measured memory_bytes: 3656
n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = [input().split() for i in range(n)]
count = 0
for i in range(n):
  condition = 0
  for k in range(m):
    condition += int(a[i][k]) * b[k]
  if condition + c > 0:
    count += 1
print(int(count))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
string random_string( size_t length ) {
    auto randchar = []() -> char {
        const char charset[] =
        "NEWS";
        const size_t max_index = (sizeof(charset) - 1);
        return charset[ rand() % max_index ];
    };
    string str(length,0);
    generate_n( str.begin(), length, randchar );
    return str;
}
struct cube { int face[7];};
cube c_[101];
int face[7];
void roll(int fac[], int a, int b, int c, int d) {
    int tmp = fac[a]; fac[a] = fac[b]; fac[b] = fac[c]; fac[c] = fac[d]; fac[d] = tmp;
}
void make_cube(int top, int front) { //正しいサイコロを1つ用意 転がしまくる
    int c = 0;
    while (c++ < 1000) {
        string ch = random_string(1);
        if (ch == "N") roll(face, 1, 4, 6, 3);
        else if (ch == "E") roll(face, 1, 5, 6, 2);
        else if (ch == "W") roll(face, 1, 2, 6, 5);
        else roll(face, 1, 3, 6, 4);
        if (face[1] == top && face[3] == front) break;
    }
}
void const_make_cube(int i, string ch) {
    if (ch == "N") roll(c_[i].face, 1, 4, 6, 3);
    else if (ch == "E") roll(c_[i].face, 1, 5, 6, 2);
    else if (ch == "W") roll(c_[i].face, 1, 2, 6, 5);
    else roll(c_[i].face, 1, 3, 6, 4);
}
int dx[] = {0, 0, 1, 0, 0, -1}; //ENSW
int dy[] = {0, 0, 0, 1, -1, 0};
const int limit = 51 * 51;
int table[limit][limit];
int dep[limit][limit];
int main() {
    int n;
    while (cin >> n && n) {
        rep(i, limit) rep(j, limit) {table[i][j] = 0; dep[i][j] = 0;}
        rep(i, 7) face[i] = i;
        rep(i, n) {
            int top, front; cin >> top >> front;
            make_cube(top, front);
            rep(j, 7) c_[i].face[j] = face[j];
            int y = 101, x = 101;
            if (i == 0) {
                table[y][x] = top;
                dep[y][x] = 1;
                continue;
            }
            while (1) {
                int dir = -1, mmax = -1;
                int tmpy = y, tmpx = x;
                rrep(j, 2, 5 + 1) { //ENSW
                    int ny = y + dy[j], nx = x + dx[j];
                    if (dep[ny][nx] >= dep[y][x]) continue;
                    if (c_[i].face[j] >= 4 && c_[i].face[j] > mmax) {
                        mmax = c_[i].face[j];
                        dir = j;
                        tmpy = ny; tmpx = nx;
                    }
                }
                y = tmpy; x = tmpx;
                if (dir == -1) break;
                string ddir;
                if (dir == 2) ddir = "E";
                else if (dir == 3) ddir = "N";
                else if (dir == 5) ddir = "W";
                else ddir = "S";
                const_make_cube(i, ddir);
                if (dep[y][x] == 0) break;
            }
            dep[y][x]++;
            table[y][x] = c_[i].face[1];
        }
        int ans[7] = {0};
        rep(i, limit) rep(j, limit) ans[table[i][j]]++;
        rrep(i, 1, 7) {if (i >= 2) cout << " "; cout << ans[i];} cout << endl;
    }
}



Measured memory_bytes: 55956
#include<bits/stdc++.h>
using namespace std;
int main(){
    int k,s,z,ans=0;
    cin>>k>>s;
    for(int x=0;x<=k;x++)
    {
        for(int y=0;y<=k;y++)
        {
            if(s-x-y>=0&&s-x-y<=k)
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter
import sys
n=int(sys.stdin.readline().rstrip())
S=[sys.stdin.readline().rstrip() for _ in range(n)]
    
cnt=Counter(S)
ma = max(cnt.values())
list=[]
for k in cnt.keys():
    if cnt[k] == ma:
      list.append(k)

list.sort()
for i in list:
    print(i)

Measured memory_bytes: 38688
num = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

sum = 0
count = 0
for i in range(0,num):
    count = A[i]
    if(i >= 1):
        if(A[i] -1 == A[i-1] ):
            sum = sum + B[count-1]+ C[count-2]
        else:
            sum = sum + B[count-1]
    else:
        sum = sum + B[count-1]
print(sum)

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

#define _GLIBCXX_DEBUG

int main() {
  double x;
  int count = 0;
  double keep;
  
  cin >> x;
  
  double money = 100;
  
  while(money < x) {
    keep = money + money / 100;
    count++;
    if(keep >= x) {
      break;
    }
    else {
      money = floor(keep);
    }
  }
  
    cout << count << endl;
}


Measured memory_bytes: 3720
#include <stdio.h>
int main(){


  int w,q;
  int wall[100];
  int i,j;
  char dami,action;
  char s[50];
  int n,haba;
  int count;
  int mark;
  int mark2;


  while(1){



    scanf("%d %d",&w,&q);
    if(w==0 && q==0)break;


    for(i=0;i<w;i++){
      wall[i]=-1;
    }

    for(i=0;i<q;i++){
      scanf("%s",s);
      action=s[0];

      if(action=='s'){

	scanf("%d %d",&n,&haba);
	count=0;
	for(j=0;j<w;j++){


	  if(count==0 && wall[j]<0){
	    mark=j;
	    count++;
	  }else if(wall[j]<0){
	    count++;
	  }else if(wall[j]>=0){
	    count=0;
	  }

	  if(count==haba){
	    mark2=j;
	    break;
	  }
	}


	if(count==haba){

	  printf("%d\n",mark);

	  for(j=mark;j<=mark2;j++){

	    wall[j]=n;
	  }
	}else {

	    printf("impossible\n");

	  
	    
	}
      }else if(action=='w'){

	scanf("%d",&n);

	for(j=0;j<w;j++){

	  if(wall[j]==n){
	    wall[j]=-1;
	  }

	}
      }

    }

    printf("END\n");

  }

  return 0;
}

Measured memory_bytes: 608
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

const int MAX = 200100;
const int LG = 20;

vector<int> E[MAX], F[MAX];

int L[MAX][LG];
int parent[MAX], d[MAX];

int lca(int u, int v) {
  if (d[u] < d[v]) swap(u, v);
  for (int j = LG - 1; j >= 0; --j)
    if (d[u] - (1 << j) >= d[v]) u = L[u][j];
  if (u == v) return u;
  for (int j = LG - 1; j >= 0; --j)
    if (L[u][j] != L[v][j]) u = L[u][j], v = L[v][j];
  return L[u][0];
}

int dist(int x, int y) { return d[x] + d[y] - 2 * d[lca(x, y)]; }

void dfs(int x) {
  for (int y : E[x]) {
    if (y != parent[x]) {
      parent[y] = x;
      d[y] = d[x] + 1;
      dfs(y);
    }
  }
}

int f[MAX];

void dfs2(int x, int dad, int d, int y) {
  int q = dist(x, y);
  f[x] = d;
  if (q <= d) return;

  for (int nx : F[x]) {
    if (nx != dad) {
      dfs2(nx, x, d + 1, y);
    }
  }
}

int main(void) {
  ios_base::sync_with_stdio(false);

  int N, X, Y;
  cin >> N >> X >> Y;
  --X, --Y;

  REP(i, N - 1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    F[a].push_back(b);
    F[b].push_back(a);
  }

  REP(i, N - 1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    E[a].push_back(b);
    E[b].push_back(a);
  }

  parent[0] = 0;
  dfs(0);

  REP(i, N) L[i][0] = parent[i];
  FOR(j, 1, LG) REP(i, N) L[i][j] = L[L[i][j - 1]][j - 1];

  REP(i, N) f[i] = -1;
  dfs2(X, -1, 0, Y);

  int ret = 0;
  REP(x, N) {
    if (f[x] != -1) {
      int q = dist(x, Y);
      if (f[x] <= q) {
        ret = max(ret, 2 * q);
      }

      if (f[x] < q) {
        for (int y : F[x]) {
          if (dist(x, y) > 2) {
            cout << -1 << "\n";
            return 0;
          }
        }
      }
    }
  }

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


Measured memory_bytes: 49152
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}




int main() {

  long n,w,h,a,b,c,d;
  string s;

  cin >> s;
  
  bool ans = false;

  string key = "keyence";

  int count = 0; 
  int removesize = s.size() - 7;


  for(int i=0;i<8;i++){
    string mat = "";
    for(int k =0;k<s.size();k++){
      if (k >= i && k< i + removesize){

      }else{
        mat += s[k];
      }
    }
    if (mat == key)ans =true;
  }

  if (removesize == 0){
    if (s == key)ans =true;
  }





  if (ans){
    cout << "YES" <<endl;
  }else{
    cout << "NO" <<endl;
  }



}




















Measured memory_bytes: 256
use std::io::stdin;

// fn cnt_combinations(n: u32, k: u32) -> u32 {
//     let mut numerator = 1;
//     for i in n..n-k {numerator *= i;}
//     let mut denominator = 1;
//     for i in 1..k+1 {denominator *= i;}
//     // must be integer
//     numerator / denominator
// }
// 
// fn main() {
//     // $B"-(B 1 $B$K$J$k(B
//     // println!("{}", 10 / 9);
// 
//     const A_UNIT: u32 = 50;
//     const B_UNIT: u32 = 100;
//     const C_UNIT: u32 = 500;
//     
//     // parse inputs
//     let mut s = String::new();
// 
//     stdin().read_line(&mut s).ok();
//     let mut a: u32 = s.trim().parse().ok().unwrap();
//     s.clear();
// 
//     stdin().read_line(&mut s).ok();
//     let mut b: u32 = s.trim().parse().ok().unwrap();
//     s.clear();
// 
//     stdin().read_line(&mut s).ok();
//     let mut c: u32 = s.trim().parse().ok().unwrap();
//     s.clear();
// 
//     stdin().read_line(&mut s).ok();
//     let x: u32 = s.trim().parse().ok().unwrap();
// 
//     // a, b, c $B$rEy>uBV8r49(B
//     let a2b = a / (B_UNIT / A_UNIT);
//     a = a % (B_UNIT / A_UNIT);
// 
//     let b2c = b / (C_UNIT / B_UNIT);
//     let a2c = a2b / (C_UNIT / B_UNIT);
//     b = b % (C_UNIT / B_UNIT);
// 
//     // count patterns
//     // 1. 500 -> 100 -> 50 $B$G(B "$BH"(B" $B$r7h$a$k(B
//     // 2. "$BH"(B" $B$NMxMQ%Q%?!<%s$r7h$a$k(B
//     let cn = ;
// }

fn main() {
    const A_UNIT: u32 = 500;
    const B_UNIT: u32 = 100;
    const C_UNIT: u32 = 50;
    
    // parse inputs
    let mut s = String::new();

    stdin().read_line(&mut s).ok();
    let a: u32 = s.trim().parse().ok().unwrap();
    s.clear();

    stdin().read_line(&mut s).ok();
    let b: u32 = s.trim().parse().ok().unwrap();
    s.clear();

    stdin().read_line(&mut s).ok();
    let c: u32 = s.trim().parse().ok().unwrap();
    s.clear();

    stdin().read_line(&mut s).ok();
    let x: u32 = s.trim().parse().ok().unwrap();

    let mut cnt = 0;

    // println!("A: {}, B: {}, C: {}, x: {}", a, b, c, x);

    for a_i in 0..a+1 {
        for b_i in 0..b+1 {
            for c_i in 0..c+1 {
                if (A_UNIT * a_i + B_UNIT * b_i + C_UNIT * c_i) == x {
                        // println!("{}, {}, {}", a_i, b_i, c_i);
                        // println!("{}", A_UNIT * a_i + B_UNIT * b_i + C_UNIT * c_i);
                        cnt += 1;
                    }
            }
        }
    }

    println!("{}", cnt);
}


Measured memory_bytes: 4352
n = int(input())
if 400 <= n <= 599:
    print(8)
elif n <= 799:
    print(7)
elif n <= 999:
    print(6)
elif n <= 1199:
    print(5)
elif n <= 1399:
    print(4)
elif n <= 1599:
    print(3)
elif n <= 1799:
    print(2)
elif n <= 1999:
    print(1)

Measured memory_bytes: 9192
a,b,c,d = map(int,input().split())
n = int(input())
INF = float("inf")
cost_1,cost_2 = INF,INF
for i in range(5):
	for j in range(3):
		for k in range(2):
			if 0.25*i + 0.5*j + 1*k == 1:
				cost_1 = min(cost_1,a*i+b*j+c*k)

for i in range(8):
	for j in range(5):
		for k in range(3):
			for l in range(2):
				if 0.25*i + 0.5*j + 1*k + 2*l == 2:
					cost_2 = min(cost_2, a*i+b*j+c*k+d*l)
ans = 0
if cost_2 <= cost_1 * 2:
	x,y = divmod(n,2)
	ans = x*cost_2 + y*cost_1
else:
	ans = n * cost_1

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define MAX_V 100
#define min(a, b) ((a) < (b) ? (a) : (b))

static long INF = (1L << 62);
long d[MAX_V][MAX_V];
int V;

void
warshall_floyd()
{
	int i, j, k;

	for (k = 0; k < V; ++k)
	{
		for (i = 0; i < V; ++i)
		{
			if (d[i][k] == INF)
				continue;

			for (j = 0; j < V; ++j)
			{
				if (d[k][j] != INF)
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

int
main(int argc, char** argv)
{
	int E;
	int s, t, c;
	int i, j;

	scanf("%d %d", &V, &E);
	for (i = 0; i < V; ++i)
	{
		for (j = 0; j < V; ++j)
			d[i][j] = (i == j) ? 0 : INF;
	}

	for (i = 0; i < E; ++i)
	{
		scanf("%d %d %d", &s, &t, &c);
		d[s][t] = c;
	}

	warshall_floyd();
	bool negative = false;
	for (i = 0; i < V; ++i)
	{
		if (d[i][i] < 0)
			negative = true;
	}

	if (negative)
		printf("NEGATIVE CYCLE\n");

	else
	{
		for (i = 0; i < V; ++i)
		{
			for (j = 0; j < V; ++j)
			{
				if (j != 0)
					printf(" ");
					
				if (d[i][j] == INF)
					printf("INF");
				else
					printf("%ld", d[i][j]);
			}

			printf("\n");
		}
	}

	return 0;
}

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

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	if (A >= K) cout << K << endl;
	else {
		if (A + B >= K) cout << A << endl;
		else cout << A - (K - A - B) << endl;
	}
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"

using namespace std;

void solve(void)
{
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		int d = 0, x = i;
		while(x)
		{
			d++;
			x /= 10;
		}
		if (d & 1)
			ans++;
	}
	cout << ans << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 256
N,W = [int(i) for i in input().split()]
w = [] # limit weight to knapsack capacity
v = [] # maximize value
for i in range(N):
  line = input().split()
  w.append(int(line[0]))
  v.append(int(line[1]))
mem = [[0]*(W+1) for i in range(N)]
for i in range(w[0], W+1):
  mem[0][i] = v[0]
for i in range(1, N):
  for j in range(1, W+1):
    if w[i] > j:
      mem[i][j] = mem[i-1][j]
    else:
      mem[i][j] = max(mem[i-1][j], v[i] + mem[i-1][j - w[i]])
#print(mem)
print("%s" % mem[N-1][W])

Measured memory_bytes: 119660
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

string s;

int main() {
    cin >> s;

    if (s == "AAA" || s == "BBB") {
        cout << "No" << '\n';
    } else {
        cout << "Yes" << '\n';
    }

    return 0;
}


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

int main(){
	int n;
	vector<int> array;
	for(int i = 0; i < 5; i++){
		cin >> n;
		array.push_back(n);
	}
	sort(array.begin(), array.end(), greater<int>());
	for(int i = 0; i < 4; i++){
		cout << array[i] << " ";
	}
	cout << array[4] << endl;
	return 0;
}

Measured memory_bytes: 1216
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n):
	for j in range(i+1,n):
		for k in range(j+1,n):
			if (l[i]+l[j]>l[k] and l[j]+l[k]>l[i] and l[i]+l[k]>l[j] and l[i]!=l[j] and l[j]!=l[k] and l[k]!=l[i]):
				ans+=1

print(ans)


Measured memory_bytes: 9192
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <b; i++)
typedef long long ll;
#define int ll
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pi;
#define trace(x) cout<<#x<<"="<<x<<"\n";
#define sz(x) (int)(x.size())
#define mod 1000000007
#define endl "\n"
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "{";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "[";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
    os << "[";
    typename map< F , S >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define deb(x) cerr << #x << " = " << x << endl;



int32_t main(){
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]){
    	cout<<"Yes\n";
    }
    else{
    	cout<<"No\n";
    }

    return 0;
}

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

using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define REP(i, n) for(int i=1;i<=n;i++)
typedef long long ll;

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	int ans1 = 0;
	rep(i, n) {
		if (a[i] > a[ans1]) {
			ans1 = i;
		}
	}
	ll temp = a[ans1] / 2;
	int ans2;
	if(ans1 == 0) ans2 = 1;
	else ans2 = 0;
	if (temp % 2 == 0) {
		rep(i, n) {
			if (i != ans1 && abs(temp - a[i]) < abs(temp - a[ans2])) ans2 = i;
		}
	} else {
		ll temp2 = temp + 1;
		rep(i, n) {
			if (i != ans1 && abs(temp - a[i]) < abs(temp - a[ans2])) ans2 = i;
			if (i != ans1 && abs(temp2 - a[i]) < abs(temp2 - a[ans2])) ans2 = i;
		}
	}
	cout << a[ans1] << " " << a[ans2] << endl;
	return 0;
}



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

int main() {
	string S;
	cin>>S;
	string ans = "No";
	rep(i,S.size()-1){
		if(S.substr(i,2)=="AC")ans="Yes";
	}
	cout<<ans<<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N+1);
  int i;
  
  //dainyu-
  for(i=1;i<N+1;i++)
    cin >> a.at(i);
  
  //search
  int s=1,sum=1;
  while(1){
    int t;
    t=s;
    s=a.at(s);
    a.at(t)=-1;
    if(s==2){
      cout<<sum<<endl;
      break;
    }
    else if(s==-1){
      cout<<-1<<endl;
      break;
    }
    sum++;
  }
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;
    vector<ll> a(N);
    REP(i,N){
        cin >> a.at(i);
    }
    ll ans = 0;
    REP(i,N){
        while(a.at(i)%2==0){
            a.at(i) /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3676
#include <stdio.h>
#include <ctype.h>
 
int main(void){

  char mr[1200];
  int i;

  for(i = 0; i < 1200; i++){
    scanf("%c", &mr[i]);
    if(mr[i] >= 65 && mr[i] <= 90){
      mr[i] = tolower(mr[i]);
    } else if(mr[i] >= 97 && mr[i] <= 122){
	mr[i] = toupper(mr[i]);
      }
    if( mr[i] == '\n'){
      mr[i] = '\0';
      break;
    }
  }
  printf("%s\n", mr);
  return 0;
}

Measured memory_bytes: 528
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <cstdint>
using namespace std;

inline namespace atcoder {
    using i32 = int32_t; using u32 = uint32_t;
    using i64 = int64_t; using u64 = uint64_t;
    using f32 = float; using f64 = double;

    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    int n, r; cin >> n >> r;
    cout << (n < 10 ? r + 100 * (10 - n) : r) << endl;
}



Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define INF 4000001
using namespace std;
int n,m;
struct edge{int to,co;};
vector<edge> g[100010];
int dis[100010];
set<int> disc[100010];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n>>m;
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		cin>>a>>b>>c;
		g[a].push_back({b,c});
		g[b].push_back({a,c});
	}

	dis[1]=0;
	for(int i=2;i<=n;i++)
		dis[i]=INF;
	priority_queue<pair<int,int>> q;
	q.push({-dis[1],1});
	while(q.size())
	{
		int now=q.top().second;
		int d=-q.top().first;
		q.pop();
		if(dis[now]<d) continue;
		for(edge j:g[now])
		{
			//cout<<j.to<<endl;
			int nd=dis[now];
			if(!disc[now].count(j.co)) nd++;
			if(nd<dis[j.to])
			{
				dis[j.to]=nd;
				disc[j.to].clear();
				disc[j.to].insert(j.co);
				q.push({-dis[j.to],j.to});
			}
			else if(nd==dis[j.to])
			{
				disc[j.to].insert(j.co);
			}
		}
	}
	if(dis[n]==INF)
		cout<<-1<<endl;
	else
		cout<<dis[n]<<endl;
}

Measured memory_bytes: 23412
#include <bits/stdc++.h> 
using namespace std;
//author_name:tourist
//date:2018/11/18
//title:AGC 010 E Rearranging
//ÒòÎªÇÓÅ³£¬ËùÒÔÌÓ±ÜÉúÃü£¬ÒÔ²»µÖ¿¹ÔÚ×îºÚ°µµÄ³ÁÂÙÖÐÉú³ö½¾°Á£¬ÒòÎª½¾°Á£¬ËùÒÔ²»Ñ¡ÔñÉú£¬ËùÒÔ¾Ü³â´Ö±ÉµÄÀÖ¹ÛÖ÷Òå¡£
//Ìì²ÅµÄ±¯¾çµØÓÚ±»Ð¡¶øÊæÊÊµÄÃûÍûËùÊø¸¿¡£
//It's human to lie. Most of the time we can't even be honest with ourselves.

const int N=2010;
const int NN=2010;

unsigned long long one=1;
unsigned long long g[N][NN];
unsigned long long was[NN];

int a[N];
int x[N];
bool alive[N];
bool can_put[N];

int main()
{	
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",a+i);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(__gcd(a[i],a[j])>1)
			{
				g[i][j>>6]|=(one<<(j&63));
				g[j][i>>6]|=(one<<(i&63));
			}
	int nn=((n-1)>>6)+1;
	for(int i=0;i<n;i++)
	{
		can_put[i]=true;
		alive[i]=true;
	}
	for(int it=0;it<n;it++)
	{
		for(int i=0;i<nn;i++)
			was[i]=0;
		for(int i=0;i<n;i++)
			if(!alive[i])
				was[i>>6]|=(one<<(i&63));
		int best=-1;
		for(int i=0;i<n;i++)
		{
			if(was[i >> 6]&(one << (i&63)))
				continue;
			
			int b=0,e=1;
			x[0]=i;
			was[i >> 6]|=(one << (i&63));
			while(b<e)
			{
				for(int j=0;j<nn;j++)
					if((g[x[b]][j]&was[j])!=g[x[b]][j])
						for(int u=j*64;u<(j+1)*64;u++)
							if(g[x[b]][u >> 6] & (one << (u&63)))
								if(!(was[u >> 6] & (one << (u&63))))
								{
									was[u >> 6]|=(one << (u&63));
									x[e++]=u;
								}
				b++;
			}
			int cur=-1;
			for(int j=0;j<e;j++)
			{
				if(!can_put[x[j]])
					continue;
				if(cur==-1||a[cur]>a[x[j]])
					cur=x[j];
			}
			if(best==-1||(cur!=-1&&a[cur]>a[best]))
				best=cur;
		}
		alive[best]=false;
		if(it>0) putchar(' ');
		printf("%d",a[best]);
		
		for(int i=0;i<n;i++)
		{
			if(!alive[i])
				continue;
			if(g[best][i >> 6] & (one << (i&63)))
				can_put[i]=true;
			else {
				if(a[best]<a[i]) 
					can_put[i]=false;
			}
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 29696
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        Console.WriteLine(Solve());
        //Solve();
        return;
    }

    public static string Solve()
    {
        int N = ReadInt();
        int[] A = ReadInts();
        int[] B = ReadInts();
        long ans = 0;
        for (int i = 0; i < N; i++)
        {
            if (B[i] >= A[i])
            {
                ans += A[i];
                B[i] -= A[i];
                if (B[i] >= A[i + 1])
                {
                    ans += A[i + 1];
                    A[i + 1] = 0;
                }
                else
                {
                    ans += B[i];
                    A[i + 1] -= B[i];                    
                }
            }
            else
            {
                ans += B[i];
            }
        }
        return ans.ToString();
    }

    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
    }

    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }

    private static string Read() { return Console.ReadLine(); }
    private static int ReadInt() { return int.Parse(Read()); }
    private static long ReadLong() { return long.Parse(Read()); }
    private static double ReadDouble() { return double.Parse(Read()); }
    private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
    private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
    private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}


Measured memory_bytes: 31580
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include<vector>
#include<iostream>
#include<set>
#include<map>
#include<algorithm>
using namespace std;




int main() {
	int n,k;
	cin >> n >> k;
	if(k == 0){
		cout << 1LL * n * n << endl;
		return 0;
	}
	
	unsigned long long int res = 0;
	for(int b=1;b<=n;++b){
		if(b <= k) continue;
		int tmp = b-k;
		res += (n/b)*tmp;
		if(n%b != 0 && n%b >= k)
			res += (n%b)-k+1;
		//cout << b << " " << n/b << " "<< (n/b)*tmp<<endl;
		//cout << n%b <<" " << (n%b)-k<< " " <<endl;
	}
	
	
	cout << res <<endl;
}


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

int main(){
int h,w,i,j;
i=1;
j=1;
while(true){
 cin >> h>>w;
 if (h==0 && w==0) break;
 while(j<=h){
  while(i<=w){
  cout <<"#";
  i++; 
  }
  cout << endl;
  i=1;
 j++;
 }
cout << endl;
j=1;
} 
   return 0;
}

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

int main(){
  int n,k,s;
  
  string str;
  
  cin >> n >> k >> str;
  
  int count = 0;
  rep(i,n){
    if(i == 0)continue;
    
    if(str[i] == str[i - 1]){
      s ++;
    }else{
      count++;
    }
    
  }
  
  int set = count / 2 + count%2;
  
  if(set <= k){
    s = n -1;
    
  }else{
    s += 2 * k;
  }
  
  cout << s;
  
  
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long 
using namespace std;
const int maxn = 1e6+10;

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

int k,m,n;
int a[maxn];
int dp[maxn][2],sum[maxn][2],max_[maxn];
signed main(){
	n=read();
	for(register int i=1;i<=n;i++)a[i]=read();
	for(register int i=1;i<=n;i++){
		sum[i][0]=sum[i-1][0];
		sum[i][1]=sum[i-1][1];
		if(i%2==0)sum[i][0]+=a[i];
		else sum[i][1]+=a[i];
	}
	if(n%2==0){
		int sum1=0,sum2=0;
		for(register int i=1;i<=n;i++){
			if(i%2==1)sum1+=a[i];
			else sum2+=a[i];
		}
		int ans=max(sum1,sum2);
		for(register int i=1;i<=n;i+=2){
			ans=max(ans,sum[i][1]+sum[n][0]-sum[i+1][0]);
		}
		printf("%lld\n",ans);
		return 0;
	}

	int ans=-1e16;
	for(register int i=1;i<n;i++){
		int summ=0,x=(i-1)%2;
		summ+=sum[i-1][x];
		summ+=sum[n][x^1]-sum[i+1][x^1];
		ans=max(ans,summ);
	}
	int summ=sum[n][(n-1)%2];
	ans=max(ans,summ); 
	for(register int i=1;i<n;i+=2){
		max_[i]=summ+sum[i+1][1]-sum[i+1][0];
	//	cout<<i<<" "<<max_[i]<<" "<<sum[i+1][1]<<endl;
		if(i>2)max_[i]=max(max_[i],max_[i-2]);
	}
	int maxx=0;
	for(register int i=n-1;i>1;i-=2){
		maxx=max(maxx,(sum[n][1]-sum[i-1][1])-(sum[n][0]-sum[i-1][0]));
		//cout<<i<<" "<<maxx<<" "<<max_[i+1]<<" "<<(sum[n][1]-sum[i-1][1])<<" "<<(sum[n][0]+sum[i-1][0])<<endl;
		ans=max(ans,max_[i-1]+maxx);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 9956
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pairs;

#define MOD 998244353


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

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}

ll n;
void dfs(string s, char mx){
    if(s.size() == n){
        cout<<s<<endl;
        return;
    }
    for(char c = 'a'; c<=mx+1; c++){
        string t = s;
        t += c;
        dfs(t, max(mx,c));
    }
    
}

int main(){
    cin>>n;
    dfs ("",'a'-1);
    return 0;
}
 



Measured memory_bytes: 1536
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
ab = [LIST() for _ in range(N)]
cd = [(LIST(), i+1) for i in range(M)]

for a, b in ab:
    print(min(cd, key=lambda x:abs(x[0][0]-a)+abs(x[0][1]-b))[1])


Measured memory_bytes: 10544
#include "bits/stdc++.h"

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


double solveRPN(vector<string> s){
    stack<double> stk;
    
    
    for(int i=0;i<s.size();i++){
        if( (s[i]!="+" && s[i]!="-" && s[i]!="*" && s[i]!="/") )stk.push( stoi(s[i])  );
        else{
            double b=stk.top(); stk.pop();
            double a=stk.top(); stk.pop();
            
            if(s[i]=="+")stk.push(a+b);
            if(s[i]=="-")stk.push(a-b);
            if(s[i]=="*")stk.push(a*b);
            if(s[i]=="/")stk.push(a/b);
        }
    }
    
    
    return stk.top();
}

int main(){
    string s;
    while(getline(cin,s)){
        vector<string> a;
    
        string now="";
        rep(i,s.size()){
            if(s[i]!=' ')now+=s[i];
            else{
                a.pb(now);
                now="";
            }
        }
        if(now.size())a.pb(now);
        printf("%.10lf\n",solveRPN(a));
    }
    return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<ll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t+1) out("Case #" << i << ": " << solve());
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; --i)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define printv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln}
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ' '; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1               // check ith bit
#define bitcount __builtin_popcount               // count set bits
#define firstbitindex __builtin_ctz               // count trailing zeros
#define lastbitindex __builtin_clz                // count leading zeros
#define bitparity __builtin_parity                // check set bits are even or odd
#define findv(v, x) (find(all(v), x) != v.end())
#define findsm(u, x) (u.find(x) != u.end())
#define findstr(s, x) (s.find(x) != string::npos)
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll MAXN = 1e6 + 5, MOD = 998244353, SIZE = 2e7;//, INF = 0x7f7f7f7f7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);
const int INFi = 0x7f7f7f7f;

//<<------Declare Variables Here----->>//
ll a, b, h, w;
char c;

//<<-----Implement Functions Here---->>//
void solve()
{
	in(a)
	out(a * (1 + a * (1 + a)))	
}

//<<----------Start of Main---------->>//
int main()
{
    fastio
    //ts
    solve();
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>

using namespace std;

int board[101][101],w,h;
bool visited[101][101];
int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

bool search(int x,int y,int tarx,int tary,int c)
{
	visited[y][x]=true;
	if(board[y][x]!=c)		return false;
	if(x==tarx && y==tary)	return true;
	
	for(int k=0;k<4;k++){
		int xx=x+dx[k],yy=y+dy[k];
		if(xx<=0 || w<xx || yy<=0 || h<yy)	continue;
		if(!visited[yy][xx] && search(xx,yy,tarx,tary,c))	return true;
	}
	return false;
}

int main()
{
	for(;cin>>w>>h,w;){
		for(int i=1;i<=h;i++)for(int j=1;j<=w;j++)board[i][j]=-1,visited[i][j]=false;
		int xs,ys,xg,yg,n;	cin>>xs>>ys>>xg>>yg>>n;
		while(n--){
			int c,d,x,y;	cin>>c>>d>>x>>y;
			for(int i=0;i<(d?4:2);i++)for(int j=0;j<(d?2:4);j++)board[y+i][x+j]=c;
		}

		if(board[ys][xs]!=board[yg][xg])	cout<<"NG"<<endl;
		else	cout<<(search(xs,ys,xg,yg,board[ys][xs])?"OK":"NG")<<endl;
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {
    public static void main(String[] args) {
        solve(new Scanner(System.in));
//        solve(new Scanner(ex));
    }

    private static final String ex = "WWWWW";
//    private static final String ex = "WWWWWBWBWBBBBWBWWWWBBBB";
//    private static final String ex = "WBWBWBWBWB";

    private static void solve(Scanner scanner) {
        String s = scanner.nextLine();

        LinkedList<Character> stones = new LinkedList<>();
        char last = s.charAt(0);
        stones.add(last);
        for (int i = 1; i < s.length(); i ++) {
            if (last != s.charAt(i)) {
                last = s.charAt(i);
                stones.add(last);
            }
        }

        if (stones.stream().allMatch(x -> x == 'W')) {
            System.out.println(0);
            return;
        } else if (stones.stream().allMatch(x -> x == 'B')) {
            System.out.println(0);
            return;
        }

        System.out.println(stones.size() - 1);
    }
}


Measured memory_bytes: 31436
/// __Macro's__
// #pragma GCC optimize("-O2")
#include <bits/stdc++.h>
using namespace std;
#define ll                   long long
#define II                   pair<int,int>
#define III                  pair<int, II>
#define VL                   vector<ll>
#define VI                   vector<int>
#define VII                  vector<II>
#define VIII                 vector<III>
#define VVI                  vector<vector<int>>
#define VVII                 vector<vector<II>>
#define fr                   first
#define sc                   second
#define mkpr                 make_pair
#define PQ                   priority_queue
#define pb                   push_back
#define eb                   emplace_back
#define all(v)               v.begin(), v.end()
#define LINE                 putc('\n', stdout)
#define SPACE                putc(' ' , stdout)
#define TAB                  putc('\t', stdout)
#define fillarr(arr, val)    fill((int*)arr, (int*)arr+(sizeof(arr)/sizeof(int)), val)
#define Log2(x)              (31^__builtin_clz(x))
#define inf                  2000000007 
#define MOD                  1000000007 
#define getint ReadInt()
const char IO_MODE = 3; // in-->00<--out (MSB-->LSB) | 0: Norm, 1: Fast 
inline ll ReadInt(){ll x=0,s=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')s=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+c-'0';
c=getchar();}return s*x;}inline void WriteInt(ll x){char c[20];if(!x){putchar('0');return;}if(x<0)putchar('-'),x=-x;int i=0;while(x>0)
c[++i]=x%10,x/=10;while(i)putchar(c[i--]+48);}template <typename T>inline void out(T x){if(IO_MODE&1)WriteInt(x);else if(typeid(x)==typeid(int))
printf("%i", x);else printf("%lld", (ll)x);}template<typename T, typename... Args>inline void out(T x,Args...args){out(x);SPACE;out(args...);}
template <typename T>inline void in(T &x){if(IO_MODE&2) x=ReadInt();else if(typeid(x)==typeid(int))scanf("%i",&x);else if(typeid(x)==typeid(ll))
scanf("%lld",&x);}template<typename T, typename... Args>inline void in(T &x,Args&...args){in(x);in(args...);}
int aa,bb,cc,dd,ee,ff,gg,hh,ii,jj,kk,mm,nn,oo,pp,qq,rr,ss,tt,uu,vv,ww,xx,yy,zz;
int tc;
///

#define nax 100100

int n;
int main()
{
  in(n);
  ll ans = (ll) n * (n-1) /2 ;
  ans += n%1;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;
const int maxn = 1e5 + 10;
const int INF = 0x3f3f3f3f;

int f[maxn];
int h[maxn];
int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	memset(f, INF, sizeof(f));
	f[0] = 0;
	for(int i = 0; i < n; i++) scanf("%d",&h[i]);
	for(int i = 0; i < n; i++)
		for(int j = 1; j <= k && i-j >= 0; j++)
				f[i] = min(f[i], f[i-j] + abs(h[i]-h[i-j]));

	// for(int i = 0; i < n; i++)
	// 	cout << f[i] << endl;
	printf("%d\n", f[n-1]);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep2(i,n) for (int i = 1; i <= (n); i++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
using ll = long long;
using vi = vector<int>;
template <class T>
using Grid = vector<vector<T>>;

int main(){
    string S, T;
    cin >> S >> T;
    int ans = 0;
    rep(i, 3) {
        if (S[i] == T[i])
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3640
import heapq
import sys
input=sys.stdin.readline
def dijk(s,edge,n):
    used = [-1] * n #True:未確定
    used[s] = 0
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,[e[0],e[1]])
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if used[minedge[1]]>=0:
            continue
        v = minedge[1]
        kai=minedge[0]
        used[v] = kai
        for e in edge[v]:
            if used[e[1]]==-1:
                heapq.heappush(edgelist,[e[0]+kai,e[1]])                   
    return used

################################
def main():
    n,m,s,t = map(int,input().split()) #n:頂点数　w:辺の数
    s-=1
    t-=1
    edge1 = [[] for i in range(n)]
    edge2= [[] for i in range(n)]
    #edge[i] : iから出る道の[重み,行先]の配列
    for i in range(m):
        x,y,z,w = map(int,input().split())
        edge1[x-1].append([z,y-1])
        edge1[y-1].append([z,x-1])
        edge2[x-1].append([w,y-1])
        edge2[y-1].append([w,x-1])
    en=dijk(s,edge1,n)
    su=dijk(t,edge2,n)
    ans=[]
    aa=10**20
    for i in range(n-1,-1,-1):
        aa=min(aa,en[i]+su[i])
        ans.append(10**15-aa)
    for i in range(n-1,-1,-1):
        print(ans[i])
if __name__=='__main__':
    main()


Measured memory_bytes: 122416
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;


void solve(){
 long long int a,b,c,d;
 cin>>a>>b>>c>>d;

 long long int ans=b*d;
 ans=max(ans, a*c);
 ans=max(ans,a*d);
 ans=max(ans, b*c);

 cout<<ans<<endl;
}


int main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
#ifndef ONLINE_JUDGE
      freopen("in.txt", "r", stdin);
     // freopen("ou1.txt","w",stdout);

#endif
  
//   time_t start, end; 
  
   
//     time(&start); 
      int  t;
      t=1;
      while (t--)
            solve();

      // time(&end); 
  
   
//     double time_taken = double(end - start); 
//     cout << "Time taken by program is : " << fixed 
//          << time_taken << setprecision(5); 
//     cout << " sec " << endl; 

      return 0;
}


Measured memory_bytes: 3644
inputs = input().strip().split()

H = int(inputs[0])
W = int(inputs[1])

a = []

for i in range(H):
    inputs = input()
    a.append(inputs)

for i in range(W):
    flag = True
    for j in range(H):
        if a[j][i] == "#":
            flag = False
    if flag:
        for j in range(H):
            a[j] = a[j][:i] + '*' + a[j][i+1:]

for i in range(H):
    if a[i].find("#") < 0:
        a[i] = ''

for i in range(H):
    if a[i] != '':
        print(a[i].replace('*', ''))

Measured memory_bytes: 3064
import numpy as np

h, w = map(int,input().split())
hw = [input() for i in range(h)]

isPaintable = [[1]*w for _ in range(h)]

predList = [[0,1],[0,-1],[1,0],[-1,0]]

for i in range(h):
  for j in range(w):
    if hw[i][j] == "#":
      for x, y in predList:
        if i+y in range(h) and j+x in range(w):
#          print(hw[i][j],hw[i+y][j+x],i,j,y,x)
          if hw[i+y][j+x]=="#":
            isPaintable[i][j] = 0
            break
    elif hw[i][j] == ".":
      isPaintable[i][j] = 0

if np.array(isPaintable).sum() == 0:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 20120
#include <iostream>
using namespace std;
      
      
int main()
{
      int a,b,c,n,index;
      
      index = 0; 
      cin >> n; 
      while(1)
      {
           cin >> a >> b >> c;       
           if( (a*a + b*b == c*c) || (a*a + c*c == b*b) || (c*c + b*b == a*a))     
                   cout << "YES" << endl;
           else
                   cout << "NO" << endl;
           
          if(index == n-1)
                   break;     
      
          index++;
     }
      
     return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int d,n; cin>>d>>n;
	int ans=pow(100,d)*n;
	if(n==100)ans+=pow(100,d);
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>
#include <sstream>

#define all_range(C) std::begin(C), std::end(C)


int main()
{
	using std::endl;
	using std::cout;
	using std::cin;

	while (true)
	{
		std::string gengou;
		cin >> gengou;
		if (gengou == "#") { break; }

		int y, m, d;
		cin >> y >> m >> d;
		if ((y > 31) || y == 31 && (
			m > 4
			)) {
			gengou = "?";
			y -= 30;
		}
		cout << gengou << ' '
			<< y << ' '
			<< m << ' '
			<< d << '\n';
	}

	return 0;
}
#endif



Measured memory_bytes: 3204
n = gets.chomp.to_i
s_arr = n.times.map{gets.chomp}

max = 0
hash = {}
s_arr.each do |s|
  count = (hash[s] || 0) + 1
  max = count if count > max
  hash[s] = count
end

arr = []
hash.each do |k, v|
  arr << k if v == max
end

arr.sort.each do |s|
  puts s
end


Measured memory_bytes: 41876
#include <stdio.h>
#include <string.h>
int main()
{
    int n;
    scanf("%d",&n);
    int i;
    char s[100000];
    int a=0 ,b=0,c=0,d = 0;
    for (i = 0;i<n;i++)
    {
        scanf("%s",&s[i]);
    }
    for (i=0;i<n;i++)
    {
        if (strncmp(&s[i],"A",1) == 0)
        {
            a++;
        }
        if (strncmp(&s[i],"W",1) == 0)
        {
            b++;
        }
        if (strncmp(&s[i],"T",1) == 0)
        {
            c++;
        }
        if (strncmp(&s[i],"R",1) == 0)
        {
            d++;
        }
    }
    printf("AC x %d\n",a);
    printf("WA x %d\n",b);
    printf("TLE x %d\n",c);
    printf("RE x %d\n",d);
    return 0;
}

Measured memory_bytes: 1820