akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);



		int n = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();

		int dp[][];

		int[][] p = new int[d+1][n+1];

		for(int day = 1; day <= d; day++) {

			for(int stockNum = 1; stockNum <= n; stockNum++) {
				p[day][stockNum] = sc.nextInt();
			}
		}

		for(int day = 1; day <= d-1; day++) {

			//dp[i][j] = 各日において、iまでの株をj円以下から選んだ時の翌日の最大差額
			// i=0, j=0の時は0で初期化
			dp = new int[n+1][x+1];

			for(int i = 1; i <= n; i++) {
				for(int j = 1; j <= x; j++) {
					if(j < p[day][i]) {
						//当日の株価より所持金が低い場合は買えないため、今までの株についての最大値を入れる
						dp[i][j] = dp[i-1][j];
					}else {
						//当日の株価よりも高い場合は、自分の株価を引いた総金額が所持金の場合＋1株追加で買った場合と、
						//今までの株のみ＝この株は買わない場合を比べる
						dp[i][j] = Math.max(dp[i-1][j], dp[i][j- p[day][i]] + p[day+1][i] - p[day][i]);
					}
				}
			}

			x += dp[n][x];
		}
		System.out.println(x);
	}
}




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


int main(){
int n;
cin>>n;
vector<int> vec(n);
for (int i = 0; i < n; i++) {
  cin >> vec.at(i);
}
int sw=0;
bool flag=1;
for (int i=0;flag;i++){
    flag=0;
    for(int j=n-1;j>=i+1;j--){
        if(vec[j]<vec[j-1]){
            swap(vec[j],vec[j-1]);
            flag=1;
            sw++;
        }
    }
}
for(int i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<vec[i];
}
cout<<endl;
cout<<sw<<endl;
return 0;
}


Measured memory_bytes: 3088
import java.util.Scanner;
// B	Crane and Turtle
class Main{
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int ba = sc.nextInt();
		int bb = sc.nextInt();

		int turu=0;
		int kame=0;

		for(int i=0;i<=(bb/2);i++){

			int a=0;

			a=bb-(i*2);

			if(a%4==0 && (i+a/4)==ba){
				turu=i;
				kame=a/4;
				break;
			}

		}

		if(turu==0 && kame==0){
			System.out.println("No");
			}else{
			System.out.println("Yes");
		}
	}
}

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

int main(){
  int n,S,r;

  while(cin >> n >> S , n + S){
    int wit[n];
    for(int i = 0 ; i < n ; i++) 
      cin >> wit[i];

    int cnt = 0;
    for(int i = 0 ; i < n ; i++){
      for(int j = i + 1 ; j < n ; j++){
	if(wit[i] + wit[j] > S) cnt++;
      }
    }
    cout << cnt << endl;
  }

  return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    sort(all(a));
    bool ok = true;
    rep(i,n-1){
        if(a[i]==a[i+1])ok = false;
    }
    if(ok)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 4056
#include <stdio.h>
int n, k, t, s, ans;
int x[100000];
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", x + i);
	}
	ans = 2 * (x[n - 1] - x[0]);
	for (int i = 0; i <= n - k; i++) {
		if (x[i] >= 0) t = x[i + k - 1];
		if (x[i + k - 1] <= 0)t = -x[i];
		if (x[i] < 0 && 0 < x[i + k - 1]) {
			t = 2 * x[i + k - 1] - x[i];
			s = x[i + k - 1] - 2 * x[i];
			if (t > s)t = s;
		}
		if (t < ans)ans = t;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 512
import math
N=int(input())
A=list(map(int,input().split()))
L=[0]*(N+1)
R=[0]*(N+1)
for i in range(N):
    L[i]=math.gcd(L[i-1],A[i])
for i in range(N-1,0,-1):
    R[i]=math.gcd(R[i+1],A[i])
ans=0
for i in range(0,N):
    ans=max(ans,math.gcd(L[i-1],R[i+1]))
print(ans)

Measured memory_bytes: 20764
#include <cstdio>

int main(){
	int n,m[100],a[100],b[100];
	while(scanf("%d",&n),n != 0){
		bool ok = true;
		for(int i = 0; i < n; i++){
			scanf("%d%d%d",&m[i],&a[i],&b[i]);
		}
		for(int i = 0; i < n; i++){
			int s = 0;
			int t = a[i];
			for(int j = 0; j < n; j++){
				if(t >= a[j] && t < b[j]){
					s += m[j];
				}
			}
			if(s > 150){
				ok = false;
				break;
			}
		}
		printf("%s\n", ok ? "OK" : "NG");
	}
	return 0;
}

Measured memory_bytes: 2500
// 一次元リバーシ  / 
#include <bits/stdc++.h>
using namespace std;

int main(){
    string s;
    cin >> s;
    int ans=0;
    for(int i=1; i<s.size(); i++){
        if(s[i-1]!=s[i]){ans++;}
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  int count = 0;
  if (S.size() % 2 == 0) {
    for (int i = 0; i < S.size()/2; i++) {
      if (S.at(i) != S.at(S.size() - i - 1)) {
        count++;
      }
    }
  } else {
    for (int i = 0; i < (S.size() - 1)/2; i++) {
      if (S.at(i) != S.at(S.size() - i - 1)) {
        count++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main(){
    char a,b;
    cin>>a>>b;
    if(a=='H'&&b=='H')cout<<"H"<<endl;
    else if(a=='D'&&b=='H')cout<<"D"<<endl;
    else if(a=='H'&&b=='D')cout<<"D"<<endl;
    else if(a=='D'&&b=='D')cout<<"H"<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define intt int64_t
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(), vec.end()

int main() {
    int n;
    scanf("%d", &n);
    vector<vector<int> > play(n, vector<int>(3));
    rep(i,n) rep(j,3) scanf("%d", &play.at(i).at(j));
    vector<vector<int> > dp(n+1, vector<int>(3, 0));
    rep(i,n) {
        rep(j,3) {
            int c=max(dp.at(i).at((j+1)%3), dp.at(i).at((j+2)%3));
            dp.at(i+1).at(j) = play.at(i).at(j)+c;
        }
    }
    int ans=max(max(dp.at(n).at(0), dp.at(n).at(1)), dp.at(n).at(2));
    printf("%d\n", ans);
}

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

int main() {
  ll x, y;
  cin >> x >> y;
  ll n = x;
  for (int i = 1; ; i++) {
    n *= 2;
    if (n > y) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 3576
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        s: [chars; n],
    }
    let mut x = [0; 3];
    let mut tot = 0;
    for s in &s {
        for i in 0..s.len() - 1 {
            if s[i..i+2] == ['A', 'B'] {
                tot += 1;
            }
        }
        let mut k = 0;
        if s[0] == 'B' {
            k |= 1;
        }
        if s[s.len() - 1] == 'A' {
            k |= 2;
        }
        if k >= 1 {
            x[k - 1] += 1;
        }
    }
    if x[0] > 0 || x[1] > 0 {
        tot += x[2] + min(x[0], x[1]);
    } else {
        if x[2] > 0 {
            tot += x[2] - 1;
        }
    }
    puts!("{}\n", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    _ = int(input())
    m = [int(i) for i in input().split()]
    sum_set = set()
    for bit in range(1 << N):
        cur_sum = 0
        for i in range(N):
            if bit & (1 << i):
                cur_sum += A[i]
        sum_set.add(cur_sum)
    for mm in m:
        if mm in sum_set:
            print("yes")
        else:
            print("no")


if __name__ == '__main__':
    main()



Measured memory_bytes: 5632
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)

int main() {
  int n, m; cin >> n >> m;
  vector<int> G[200000];
  loop(i,0,m) {
    int a, b;
    cin >> a >> b; a--;b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  
  for (auto v: G[0]) {
    for (auto u: G[v]) {
      if (u == n-1) {
      cout << "POSSIBLE" << endl;
      return 0;
      }
    }
  }
  
  cout << "IMPOSSIBLE" << endl;
  return 0;
}


Measured memory_bytes: 14980
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long; using ll = long long; using ld = long double;
using pi = pair<int, int>; using pll = pair<ll, ll>;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
template<typename T> using minQ = priority_queue<T, vector<T>, greater<T>>;

#define endl '\n'
#define ALL(a)       (a).begin(),(a).end()
#define FOR(i,a,b)   for(ll i = (ll)(a); i < (ll)(b); ++i)
#define FORO(i,a,b)  for(ll i = (ll)(a); i <= (ll)(b); ++i)
#define RFOR(i,a,b)  for(ll i = (ll)(b) - 1; i >= (ll)(a); --i)
#define RFORO(i,a,b) for(ll i = (ll)(b); i >= (ll)(a); --i)
#define REP(i,n)     for(ll i = 0; i < (ll)(n); ++i)
#define REPO(i,n)    for(ll i = 1; i <= (ll)(n); ++i)
#define RREP(i,n)    for(ll i = (ll)(n) - 1; i >= 0; --i)
#define RREPO(i,n)   for(ll i = (ll)(n); i >= 1; --i)
#define SORT(a)      sort(ALL(a))
#define UNIQ(a)      a.erase(unique(ALL(a)), a.end())
#define SUNIQ(a)     SORT(a), UNIQ(a)
#define MINI(a,b)    a=min(a,(b))
#define MAXI(a,b)    a=max(a,(b))

const ll mod = 1e9 + 7;
const int INF = 1e9 + 10;
const ll LINF = 1000000000000000000ll;
const ld eps = 1e-8;
const ld PI = acosl(-1);

ll Nll() { ll a; cin >> a; return a; }
ld Nld() { ld a; cin >> a; return a; }
int Ni() { int a; cin >> a; return a; }
char Nc() { char a; cin >> a; return a; }
string Ns() { string a; cin >> a; return a; }

template <typename T>
void O(const T &a) { cout << a << endl; }
template <typename T>
void O(T &&a) { cout << a << endl; }
template <typename T>
void Os(const vector<T> &v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Os(vector<T> &&v) { REP(i, v.size() - 1) cout << v[i] << " \n"[i + 1 == (ll)v.size()]; }
template <typename T>
void Is(vector<T> &v) { for (auto& t : v) cin >> t; }

void yes(bool f) { cout << (f ? "yes" : "no") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }

struct Edge {
	int from, to;
	Edge() {}
	Edge(int f, int t) : from(f), to(t) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void solve();

int main() { ios::sync_with_stdio(false), cin.tie(0); cout << fixed << setprecision(20); solve(); }

//-----------------------------------------------template-------------------------------------------------------------

//-----------------------------------------------library-------------------------------------------------------------

void solve()
{
	int X = Ni(), t = Ni();
	O(max(0, X - t));
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
   public static void main(String[] args){
	   Scanner buf = new Scanner(System.in);
	   int[] a = new int[10];
	   for(int i=0;i<10;i++) a[i] = buf.nextInt();
	   Arrays.sort(a);
	   System.out.println(a[9]);
	   System.out.println(a[8]);
	   System.out.println(a[7]);
   }
}

Measured memory_bytes: 17184
#include<stdio.h>
#define MAX 45
int F[MAX];
  
int fib(int n)
{
  if ( n == 0 || n == 1 ){
       return F[n] = 1;
   }
  if ( F[n] != -1){ 
       return F[n];
   }
  return F[n] = fib(n - 1) + fib(n - 2);
}
  
int main()
{
  int n, i;
  for( i = 0; i < MAX ; i++){
     F[i] = -1;
  }
  scanf("%d", &n);
  printf("%d\n",fib(n));
  
  return 0;
}

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

int main() {
    string s[3];
    int next = 0;
    char c[] = {'A','B','C'};
    for(int i = 0;i < 3;i++) {
        cin >> s[i];
    }
    auto func = [](string* s) -> char
    {
        if(char c = (*s)[0]) {
            (*s).erase((*s).begin());
            return c;
        }
        return -1;
    };
    while(1) {
        switch(func(&s[next])) {
            case 'a':
                next = 0;
                break;
            case 'b':
                next = 1;
                break;
            case 'c':
                next = 2;
                break;
            default:
                cout << c[next] << endl;
                return 0;
        }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int num = sc.nextInt();
			int limit = sc.nextInt();
			int ans = 0;
			for (int i = 0; i < num; i++) {
				if (sc.nextInt() >= limit) {
					ans++;
				}
			}
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 46760
#include<stdio.h>
int main()
{
    int a,b,minj,c=0,i,j;
    scanf("%d",&a);
    int x[a];
    for(i=0;i<a;i++){
        scanf("%d",&x[i]);
    }
    for(i=0;i<a;i++){
        minj=i;
        for(j=i;j<a;j++){
            if(x[j]<x[minj]){
                minj=j;
            }
        }
        if(i!=minj){
        b=x[i];x[i]=x[minj];x[minj]=b;
        c++;
        }
    }
    for(i=0;i<a;i++){
        if(i==a-1)printf("%d\n",x[i]);
        else printf("%d ",x[i]);
    }
    printf("%d\n",c);
    return 0;
}

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

#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )

const int INF = 1e9;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;


int main() {

    char alpha;
    cin >> alpha;

    if ( alpha >= 'a' and alpha <= 'z' ) cout << "a\n";
    else cout << "A\n";

    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<cstdlib>

int H; // the number of elements

int parent(int i){
  if(i == 1) return 0;
  return i / 2;
}

int left(int i){
  if(i * 2 > H) return 0;
  return i * 2;
}

int right(int i){
  if(i * 2 + 1 > H) return 0;
  return i * 2 + 1;
}

void PrintAllElement(int *A){
  int i;
  for(i = 1; i < H + 1; i++){
    printf("node %d: key = %d, ", i, A[i]);
    if(parent(i)){
      printf("parent key = %d, ", A[parent(i)]);
    }
    if(left(i)){
      printf("left key = %d, ", A[left(i)]);
    }
    if(right(i)){
      printf("right key = %d, ", A[right(i)]);
    }
    printf("\n");
  }
}

int main(){
  int i, *A;
  
  scanf("%d", &H);
  A = (int *)malloc(sizeof(int) * H + 1);
  for(i = 1; i < H + 1; i++){
    scanf("%d", &A[i]);
  }

  PrintAllElement(A);

  return 0;
}



Measured memory_bytes: 2752
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    int N,M;
    cin >> N >> M;

    if(N == M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
using System;

class ABC_126_A
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int K = int.Parse(input[1]);

        string s = Console.ReadLine();
        string ans = "";

        for (int i = 0; i < s.Length; i++)
        {
            if (i == K - 1)
            {
                if(s[i]=='A') ans += 'a';
                else if (s[i] == 'B') ans += 'b';
                else if (s[i] == 'C') ans += 'c';
            }
            else
            {
                ans += s[i];
            }
        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
N = int(input())
A = list(map(int, input().split()))
# print(N, A)

boss_list = A

subordinaties = [0] * N
for boss in boss_list:
    index_of_boss = boss - 1
    subordinaties[index_of_boss] += 1

for subodinate in subordinaties:
    print(subodinate)

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

int main()
{
	int card[3][3];
	rep(i, 3)
		cin >> card[i][0] >> card[i][1] >> card[i][2];

	int n;
	cin >> n;

	bool ans[3][3] = { false };
	rep(i, n)
	{
		int b;
		cin >> b;

		rep(i, 3)
		{
			rep(j, 3)
			{
				if (b == card[i][j])
					ans[i][j] = true;
			}
		}
	}

	rep(i, 3)
	{
		if (ans[i][0] && ans[i][1] && ans[i][2]
			|| ans[0][i] && ans[1][i] && ans[2][i])
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	if (ans[1][1])
	{
		if (ans[0][0] && ans[2][2]
			|| ans[0][2] && ans[2][0])
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    static class Program
    {
        static void Main(string[] args)
        {
            int n = ReadInt();
            string s = ReadString();
            string ans = new string(s.Select(c => (char)('A' + (c - 'A' + n) % 26)).ToArray());
            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

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

using namespace std;

class A {
	int a;
	int ans{ 17 };

public:
	void solve()
	{
		for (int i{ 0 }; i < 3; i++)
		{
			cin >> a;
			
			if (a != 5 && a != 7) break;
			else ans -= a;
		}

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

};

class B {
	vector<string> S;
	int N, L;

public:
	void solve()
	{
		cin >> N >> L;
		S.resize(N);
		for (int i{ 0 }; i < N; i++) cin >> S[i];

		sort(S.begin(), S.end());
		
		for (int i{ 0 }; i < N; i++) cout << S[i];
		cout << endl;
	}
};


int main()
{
	A solution;
	solution.solve();

	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    n %= 10;
    if(n == 2 || n == 4 || n == 5 || n == 7 || n == 9) cout << "hon" << endl;
    if(n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << endl;
    if(n == 3) cout << "bon" << endl;
}


Measured memory_bytes: 3636
#include <stdint.h>
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

vector<ll> prime_count;

// エラトステネスの篩 O(n log log n)
void sieve(ll n) {
  prime_count.resize(0);
  for (int i = 0; i <= n; i++) {
    prime_count.push_back(1);
  }
  for (int i = 2; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      prime_count[j]++;
    }
  }
}

void solve(long long N) {
  sieve(N);
  ll ans = 0;
  REP(i, N + 1) {
    ans += i * prime_count[i];
  }
  cout << ans << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


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

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

    long long int ans=0;

    if((a>=0 && b>=0) && (c>=0 && d>=0)) {
        ans = b*d;
    } else if((a<=0 && b<=0) && (c<=0 && d<=0)) {
        ans = a*c;
    } else if(((a<=0 && b<=0) && (c>=0 && d>=0)) || ((a>=0 && b>=0) && (c<=0 && d<=0))){
        ans = max(a*d,b*c);
    } else if((a<=0 && b<=0)) {
        ans = a*c;
    } else if((c<=0 && d<=0)) {
        ans = a*c;
    } else if((a>=0 && b>=0)) {
        ans = b*d;
    } else if((c>=0 && d>=0)) {
        ans = b*d;
    } else {
        ans = max(a*c,b*d);
    }

    cout << ans << endl;
}

Measured memory_bytes: 3660
/*{{{*/
//#pragma GCC optimize("O3")

#include <bits/stdc++.h>

#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

typedef long long ll;
typedef std::pair<int, int> pii;

std::string Name = __FILE__;
std::string iput = Name.substr(0, Name.length() - 4) + ".in";
std::string oput = Name.substr(0, Name.length() - 4) + ".out";

template <class T> inline bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template <class T> inline bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }

template <class T> inline T &read(T &x)
{
    static int f;
    static char c; 
    for (f = 1; !isdigit(c = getchar()); ) {
        if (c == '-')
            f = -1;
    }
    for (x = 0; isdigit(c); c = getchar()) {
        x = x * 10 + c - 48;
    }
    return x *= f;
}
 
template <class T> inline void write(T x, const char p = '\n')
{
    static int top;
    static int s[30];
    if (x < 0) {
        x = -x;
        putchar('-');
    }
    do s[++ top] = x % 10 + 48;
    while (x /= 10);
    while (top)
        putchar(s[top --]);
    putchar(p);
}
/*}}}*/
 
const int maxn = 2000 + 5;
const int mo = 1e9 + 7;

inline long long qpow(long long a, long long n)
{
    long long ret = 1;
    while (n) {
        if (n & 1) ret = ret * a % mo;
        a = a * a % mo;
        n >>= 1;
    }
    return ret;
}
 
int n;
int k;
int f[maxn][maxn];

long long fac[maxn * maxn], inv[maxn * maxn];

long long C(int a, int b)
{
    return fac[a] * inv[b] % mo * inv[a - b] % mo;
}

void exec()
{
    read(n), read(k);
    if (k == 1) write(1), exit(0);

    for (int i = fac[0] = 1; i <= n * k; ++ i) {
        fac[i] = fac[i - 1] * i % mo;
    }
    inv[n * k] = qpow(fac[n * k], mo - 2);
    for (int i = n * k - 1; ~i; -- i) {
        inv[i] = inv[i + 1] * (i + 1) % mo;
    }

    f[n][n] = 1;
    for (int i = n; ~i; -- i)
        for (int j = n; j >= i; -- j) {
            if (i) (f[i - 1][j] += f[i][j]) %= mo;
            if (j > i) (f[i][j - 1] += f[i][j] * C(i + j * (k - 1) - 1, k - 2) % mo) %= mo;
        }

    long long ans = f[0][0] * fac[n] % mo;
    write(ans);
}

/*{{{*/
int main() 
{
    if (fopen(iput.c_str(), "r") != NULL) {
        freopen(iput.c_str(), "r", stdin);
        freopen(oput.c_str(), "w", stdout);
    }

    exec();

    fclose(stdin);
    fclose(stdout);

    return 0;
}
/*}}}*/




Measured memory_bytes: 78464
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;

template <class T> inline T nxi(){
	T x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

inline int hbit(lint x){
	if(!x) return -1;
	int ans=0;
	for(int i=32; i; i>>=1){
		if(x>>i) ans+=i,x>>=i;
	}
	return ans;
}

inline lint solve(lint a,lint b){
	if(a==b) return 1;
	if(a>b) std::swap(a,b);
	int dpos=hbit(a^b);
	a&=(1ll<<(dpos+1))-1;
	b&=(1ll<<(dpos+1))-1;
	if(b!=1ll<<dpos) b|=(1ll<<hbit(b^1ll<<dpos))-1;
	return (((1ll<<dpos)-a)<<1)+std::min((a|1ll<<dpos)-1,b)-(1ll<<dpos)+1;
}

int main(){
#ifdef LOCAL
	freopen("d.in","r",stdin);
#endif
	lint a=nxi<lint>(),b=nxi<lint>();
	printf("%lld\n",solve(a,b));
}

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

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

for i in range(n, 99999999999999999999999):
  if is_prime(i):
    if i >= n:
      print(i)
      exit()



Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include <numeric>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}
int x[100100];
int main() {
	int N, K;
	cin >> N >> K;
	REP(i, N)cin >> x[i];
	ll ans = INF;
	REP(i, N - K + 1) {
		if ((x[i] >= 0 && x[i + K - 1] >= 0)|| (x[i] <= 0 && x[i + K - 1] <= 0)) {
			ll res = max(abs(x[i]), abs(x[i + K - 1]));
			ans = min(ans, res);
		}
		else {
			ll res = abs(x[i]) + abs(x[i + K - 1]);
			res += min(abs(x[i]), abs(x[i + K - 1]));
			ans = min(ans, res);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 640
use proconio::input;

fn main() {
    input! {
        mut a: i32,
        b: i32,
        mut c: i32,
        d: i32,
    }
    loop {
        if a <= 0 {
            if c <= 0 {
                println!("Yes");
            } else {
                println!("No");
            }
            break;
        }
        if c <= 0 {
            println!("Yes");
            break;
        }
        a = a - d;
        c = c - b;
    }
}

Measured memory_bytes: 2140
def examA():
    N = LI()
    N.sort()
    if N[0]==N[1] and N[0]!=N[2]:
        print("Yes")
    elif N[1]==N[2] and N[0]!=N[2]:
        print("Yes")
    else:
        print("No")
    return

def examB():
    N = I()
    A = LI()
    for a in A:
        if a%2==0:
            if a%3!=0 and a%5!=0:
                print("DENIED")
                return
    print("APPROVED")
    return

def examC():
    N = I()
    S = [SI()for _ in range(N)]
    d = defaultdict(int)
    for s in S:
        d[s] += 1
    t = max(d.values())
    ans = []
    for s in S:
        if d[s]==t:
            ans.append(s)
            d[s] = 0
    ans.sort()
    for v in ans:
        print(v)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Measured memory_bytes: 36140
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
set<char> s;
s.insert('y');s.insert('h');s.insert('n');s.insert('u');s.insert('j');s.insert('m');s.insert('i');s.insert('k');s.insert('o');s.insert('l');s.insert('p');
while(1){
    string t;
    cin>>t;
    if(t[0]=='#')return 0;
    int now=(s.find(t[0])!=s.end());
    int ans=0;
    for(int i=1;i<t.size();i++){
             if(now!=(s.find(t[i])!=s.end())){
                 ans++;
                 now^=1;
             }
    }  
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 3204
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1 << 30);
const ll inf = (1LL << 60LL);
const int maxn = 200006;
int n, m, q;
vector<int> graph[maxn];
pair<int, int> queries[maxn];
int nxt_occurence[505];
class node{
public:
    vector<int> val;
    int lb, rb;
    node *left, *right;
    node(int levo, int desno){
        lb = levo;
        rb = desno;
        if(lb == rb){
            val.push_back(nxt_occurence[lb]);
        }
        else{
            int mid = (levo + desno) >> 1;
            left = new node(levo, mid);
            right = new node(mid + 1, desno);
            merge(left -> val.begin(), left->val.end(), right->val.begin(), right->val.end(), back_inserter(val));
        }
    }
    int query(int i, int j, int k){
        if(i <= lb and rb <= j){
            return (int)(lower_bound(val.begin(), val.end(), k) - val.begin());
        }
        // i j l r i j
        if(j < lb || rb < i)return 0;
        return left->query(i, j, k) + right->query(i, j, k);
    }
};
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    cin >> n >> m >> q;
    for(int i = 0; i <= 504; i ++){
        nxt_occurence[i] = -INF;
    }
    for(int i = 0; i < m; i ++){
        int a, b;
        cin >> a >> b;
        a --;
        b --;
        graph[a].push_back(b);
//        graph[b].push_back(a);
    }
    for(int i = 0; i < n; i ++){
        sort(graph[i].begin(), graph[i].end());
    }
    for(int i = 0; i < q; i ++){
        cin >> queries[i].first >> queries[i].second;
        queries[i].first --;
        queries[i].second --;
    }
    int i, j, a, b;
    int ret = 0;
    for(i = 0; i < q; i ++){
        a = queries[i].first;
        b = queries[i].second;
        ret = 0;
        for(j = a; j <= b; j ++){
            ret += (int)(lower_bound(graph[j].begin(), graph[j].end(), b + 1) - graph[j].begin());
        }
        cout << ret  << "\n";
    }
    
    return 0;
}


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

int main() {
  string a,b;
  cin >> a >> b;
  //cout << a << endl << b << endl;
  if( a.size() > b.size() ){
    cout << "GREATER" << endl;
  }else if( a.size() == b.size() ){
    for(int i=0;i<a.size();i++){
	  if( a.at(i) > b.at(i) ){
        cout << "GREATER" << endl;
        return 0;
      }else if( a.at(i) == b.at(i) ){
        continue;
      }else{
        cout << "LESS" << endl;
        return 0;
      }
    }
    cout << "EQUAL" << endl;
  }else{
    cout << "LESS" << endl;
  }
  return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>

int n;	//審判数
int sum;
int max;
int min;
	
void fun_max(int i, int j);
void fun_min(int i, int j);
	
int main()
{
	scanf("%d", &n);
	//printf("n=%d", n);
	
	while (n)
	{
		int i;
	
		sum = 0;
		max = -1;
		min = 1500;
		
		for (i=0; i<n; i++)
		{
			int input;
			
			scanf("%d", &input);
			//printf("input=%d\n", input);
			fun_max(max, input);
			//printf("max=%d\n", max);
			fun_min(min, input);
			//printf("min=%d\n", min);
			sum += input;
		}
		sum -= max;
		sum -= min;
		
		int ans;
		ans = sum/(n-2);
		printf("%d\n", ans);
		//printf("\n\n\n\n");
		
		scanf("%d", &n);
	}
	
	return 0;
}

void fun_max(int i, int j)
{
	if (i > j)
	{
		max = i;
	}
	else
	{
		max = j;
	}
	return;
}

void fun_min(int i, int j)
{
	if (i < j)
	{
		min = i;
	}
	else
	{
		min = j;
	}
	return;
}

Measured memory_bytes: 1028
/* ---------- STL Libraries ---------- */

// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */

using namespace std;

/* ---------- Type Abbreviation ---------- */

using ll = long long;

template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;

#define mp make_pair
#define mt make_tuple

/* ---------- conversion ---------- */

#define INT(c) static_cast<int>(c)
#define CHAR(n) static_cast<char>(n)
#define LL(n) static_cast<ll>(n)
#define DOUBLE(n) static_cast<double>(n)

/* ---------- container ---------- */

#define gsort(b, e) sort(b, e, greater<decltype(*b)>())

/* ----------- debug ---------- */

template <class T>
ostream& operator<<(ostream& os, vector<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class T>
ostream& operator<<(ostream& os, set<T> v) {
    os << "[";
    for (auto vv : v)
        os << vv << ",";
    return os << "]";
}

template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> p) {
    return os << "(" << p.first << "," << p.second << ")";
}

/* ---------- Constants ---------- */

// const ll MOD = 1e9 + 7;
// const int INF = 1 << 25;
// const ll INF = 1LL << 50;
// const double PI = acos(-1);
// const double EPS = 1e-10;
// mt19937 mert(LL(time(0)));

/* ---------- Short Functions ---------- */

template <typename T>
inline T sq(T a) { return a * a; }

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

template <typename T, typename U>
T mypow(T b, U n) {
    if (n == 0) return 1;
    if (n == 1) return b /* % MOD */;
    if (n % 2 == 0) {
        return mypow(b * b /* % MOD */, n / 2);
    } else {
        return mypow(b, n - 1) * b /* % MOD */;
    }
}

ll pcnt(ll b) {
    return __builtin_popcountll(b);
}

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */

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

    if (N == 1) {
        cout << P << endl;
        return 0;
    }

    ll ans = 1, cpP = P;
    for (ll i = 2; i * i <= cpP; ++i) {
        if (P % i) continue;

        int cnt = 0;
        while (P % i == 0) {
            ++cnt;
            P /= i;
        }

        ans *= mypow(i, cnt / N);
    }

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


Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;

int main() {
	string str;
	cin >> str;
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string op;
		cin >> op;
		int a, b;
		if (op == "print") {
			cin >> a >> b;
			cout << str.substr(a, b - a + 1) << endl;
		}
		else if (op == "reverse") {
			cin >> a >> b;
			reverse(str.begin() + a, str.begin() + b + 1);
		}
		else if (op == "replace") {
			string x;
			cin >> a >> b >> x;
			str = str.replace(a, b - a + 1, x);
		}
	}
	return 0;
}



Measured memory_bytes: 3192
/*
  AOJ 2575
  Title:D's Ambition
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

char D[1001];
char result[1001];
char moji[]="AIDUNY";
char replace[]="AIZUNYAN";
int  cnt[6];
rev_sch(char * s)
{
  int i;
  char c,*p;
  /*  
  for(i=-7;i<=0;i++)
    printf("%c|",s[i]);
  printf("\n");
  */

  
  memset(cnt,0,sizeof(int)*6);
  for(i=0;i<8;i++)
    {
      if(!(p=strchr(moji,s[-i])))
	return(i);

      cnt[ p - moji]++;
      if(cnt[0]>2 || cnt[1]>1 || cnt[2]>1 || cnt[3]>1 || cnt[4]>2
	 || cnt[5]>1)
	return(7);
    }
  /* 
  for(i=0;i<6;i++)
    printf("%d:",cnt[i]);
  printf("\n");
  */
  if(cnt[0]==2 && cnt[1]==1 && cnt[2]==1 && cnt[3]==1 && cnt[4]==2
     && cnt[5]==1)
    return(-1);
  else
    return(0);
  
}
void solve()
{
  char *p,*q;
  int ret,len;

  p=D;q=result;
  strcpy(result,D);
  len=strlen(D);
  if(len<8)
    return;
  while(1)
    {
      ret=rev_sch(p+7);
      //printf("ret=%d\n",ret);
      if(ret==-1)
	{
	  strncpy(q,replace,8);
	  p+=8;
	  q+=8;
	}
      else
	{
	  p+=(8-ret);
	  q+=(8-ret);
	}
      if(p>D+len)
	break;
    }
}


main()
{
  scanf("%s",&D[0]);
  solve();
  printf("%s\n",result);
  return(0);
}

Measured memory_bytes: 540
def sub():
    ss = [e for e in input()]
    if len(ss) == 1:
        print("0")
        return
    dp = {}
    if ss[0] == "0":
        dp[(0,0)] = 0
        dp[(0,1)] = 1
    else:
        dp[(0,0)] = 1 
        dp[(0,1)] = 0 
    N = len(ss)
    for i in range(1, N):
        cI = ss[i]
        if cI == "0":
            dp[(i,0)] = dp[(i-1,1)]
            dp[(i,1)] = dp[(i-1,0)] + 1
        else:
            dp[(i,0)] = dp[(i-1,1)] + 1
            dp[(i,1)] = dp[(i-1,0)]

    count = min(dp[(N-1,0)], dp[(N-1,1)])

    print("{}".format(count))

sub()


Measured memory_bytes: 38968
#include<iostream>
int main(){
  std::string s;
  std::cin >> s;
  int n = s.length();
  int x=0;
  for(int i=0; i<n/2; i++){
  	if(s[i] != s[n-1-i])
      x++;
  }
  printf("%d\n",x);
}

Measured memory_bytes: 256
n,y = map(int,input().split())
for i in range(n+1):
    for j in range((n-i)+1):
        if ((i*10000) + (j*5000) + ((n-(i+j))*1000)) == y:
            print(i,j,n-(i+j))
            exit()
print(-1,-1,-1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  LL n,a,b;
  cin >> n >> a >> b;
  vector<LL> x(n);
  for(LL &xi:x) cin >> xi;
  LL answer=0ll;
  REP(i,n-1) {
    answer+=min((x[i+1]-x[i])*a,b);
  }
  cout << answer << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <climits>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include<algorithm>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;
int d,t,s;

int main(){
  // freopen("input.txt","r",stdin);
  cin>>d>>t>>s;
  if(d > t*s) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


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

  string S;
  cin >> S;
  ll N=S.size();

  vector<int> d(N+1);
  ll count=1;
  for(int i=N-1; 0<=i; i--){
    int a = (S[i]-'0') * count % 2019;
    d[i]=(d[i+1]+a)%2019;
    count*=10;
    count%=2019;
  }

  vector<int> sum(2019);
  ll answer=0;
  for(int i=N; 0<=i; i--){
    answer+=sum[d[i]];
    sum[d[i]]++;
  }

  cout << answer << endl;
  
 
}


Measured memory_bytes: 4364
import java.util.Scanner;

class Main
{
  public static void main(String[] args) {
    int a, b, c, count=0;
    Scanner sc = new Scanner(System.in);
    a = sc.nextInt();
    b = sc.nextInt();
    c = sc.nextInt();
    for(int i=a ; i<=b ; i++){
      if(c%i == 0) count++;
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 26292
#include <stdio.h>
#include <string.h>

int main(){
  int x;
  char day[5];
  int n;

  scanf("%d", &x);
  scanf("%s", day);

  if(strcmp(day,"SUN") == 0){
    n = 7;
  }
  else if(strcmp(day,"MON") == 0){
    n = 6;
  }
  else if(strcmp(day,"TUE") == 0){
    n = 5;
  }
  else if(strcmp(day,"WED") == 0){
    n = 4;
  }
  else if(strcmp(day,"THU") == 0){
    n = 3;
  }
  else if(strcmp(day,"FRI") == 0){
    n = 2;
  }
  else{
    n = 1;
  }

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


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<numeric>
#include<map>
#include<set>
#include<bitset>
#include<regex>
using namespace std;
#define REP(i,m,n) for(int i = m; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a)  (a).rbegin(),(a).rend()
#define dup(x,y) (((x)+(y)-1) / (y)) //整数型のまま切り上げ演算する
#define PI 3.14159265359
typedef long long LL;
template<class T> inline void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> inline void chmin(T& a, T b) { if (a > b) { a = b; } }
template<class T> inline T gcd(T x, T y) { if (y == 0) { return x; } else if (x == 0) { return y; }return gcd(y, x % y); }
template<class T> inline T lcm(T x, T y) { return (x * y) / gcd(x, y); }
template<class T> inline vector<T> convert_to_binary_number(T x) { vector<T> binary_num; while (x != 1) { binary_num.push_back(x % 2); x /= 2; } binary_num.push_back(1); return binary_num; }
template<class T> inline void print_vector(vector<T> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } cout << endl; }
const LL MOD = 1e9 + 7;
const LL INF = 1LL << 60;



int main(void) {
	LL M, D;
	cin >> M >> D;

	LL count = 0;
	for (LL m = 1; m <= M; m++) {
		for (LL d = 1; d <= D; d++) {
			LL d1 = d % 10;
			LL d2 = d / 10;
			if (d1 >= 2 and d2 >= 2 and d1*d2 == m) {
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define mp make_pair
#define pb emplace_back
#define fi first
#define se second
#define sd(t) scanf("%d",&t)
#define pd(t) printf("%d\n",t)
#define slld(t) scanf("%lld",&t)
#define plld(t) printf("%lld\n",t)
#define For(i,n) for(ll i=0;i<n;i++)
#define bll __builtin_popcountll
#define speed ios::sync_with_stdio(false); cin.tie(0)



using namespace std;




int main()
{
	speed;
    ll n,k;
    cin>>n>>k;
    ll a[n];
    ll b[n]={0};

    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        b[i]=mod;
    }
    b[0]=0;
    b[1]=abs(a[0]-a[1]);
    for(ll i=2;i<n;i++)
    {
        ll p=0;
        for(ll j=i;j>=0;j--)
        {
            b[i]=min(b[i],b[j]+abs(a[i]-a[j]));
            p++;
            if(p==k+1)
            {
                break;
            }
        }
        
    }

    // for(ll i=0;i<n;i++)
    // {
    //     cout<<b[i]<<" ";
    // }
    cout<<b[n-1];

    
    

    
    return 0;
           
}

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  string ans = "";
  rep(i,s.size()) {
    char t = s.at(i);
    for(int j = 0; j < n; j++) {
      if (char(t) == 'Z') {
        t = 'A';
        continue;
      }
      t = char(t+1);
    }
    ans += t;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628