akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  ui N; cin >> N;
  string S{"ABC001"};
  for(ui i = 2, k = 1000; i < S.size(); ++i, k /= 10){
    S[i] += (char)(N / k);
    N %= k;
  }

  S = S.substr(0, 3);
  cout << S << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
//repマクロ定義
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
//allマクロ定義
#define all(v) v.begin(),v.end()
using namespace std;

int main(){
  int n;
  int mx=-1,pin;
  cin >> n;
  vector<int> p(n);
  rep(i,n){
    cin >> p.at(i);
    if(mx<p.at(i)) {
      pin =i;
      mx=p.at(i);
    }
  }

  int sum=0;
  rep(i,n){
    if(i==pin){
      sum+=p.at(i)/2;
    }else{
      sum+=p.at(i);
    }
  }

  cout << sum << endl;


}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = list(map(int, input().split(" ")))

# ans = False
# x = a[0]
# y = a[1]
# available = list(a[2:])
# while available:
#     r = x ^ y
#     if r in available:
#         available.remove(r)
#         x = y
#         y = r
#     else:
#         break
# if not available:
#     ans = x ^ y == a[0]

# print("Yes" if ans else "No")

c = Counter(a).most_common()
if len(c) == 3 and c[0][0] ^ c[1][0] == c[2][0] and c[0][1] == c[1][1] and c[1][1] == c[2][1]:
    ans = True
elif len(c) == 2 and c[0][0] ^ c[1][0] == c[0][0] and (c[0][1] * 2 == c[1][1] or c[0][1] == c[1][1] * 2):
    ans = True
elif len(c) == 1 and c[0][0] == 0:
    ans = True
else:
    ans = False
print("Yes" if ans else "No")


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

int main()
{
    int x,t;
    cin >> x >> t;
    int ans = x-t;
    if(ans < 0){
        cout << 0 <<endl;
    }else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int n, k;
    cin >> n >> k;
    vector<int> mi, pr;
    rep(i,n) {
        int x;
        cin >> x;
        if (x < 0) mi.push_back(abs(x));
        else pr.push_back(x);
    }
    reverse(mi.begin(), mi.end());
    int ans = INF;
    for (int l = min(k,int(mi.size())); l >= 0; l--) {
        int r = k-l;
        if (r > pr.size()) break;
        int now = 0;
        if (l == 0) now = pr[r-1];
        else if (r == 0) now = mi[l-1];
        else {
            now = pr[r-1] + mi[l-1] + min(pr[r-1], mi[l-1]);
        }
        ans = min(ans, now);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3972
import scala.io.StdIn._

object Main extends App {
  val Array(a, b) = readLine().split(" ").map(_.toInt)
  val s = readLine()

  if (s.length != a + b + 1) {
    println("No")
  } else {
    val (before, after) = s.splitAt(a)
    if (after.head == '-' && before.forall(_.isDigit) && after.tail.forall(_.isDigit)) {
      println("Yes")
    } else {
      println("No")
    }
  }
}


Measured memory_bytes: 27452
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
 
const int Inf = 1000000007;
const long long mod = 1000000007;//998244353;
const double Pi = acos(-1);
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

double a, b, h, m;

int main()
{
	cin >> a >> b >> h >> m;
	double temp = 5.5 * (double(h * 60) + double(m));
	while(temp > 360)
	{
		temp -= 360;
	}
	temp = temp / 180 * Pi;
	double ans = a * a + b * b - 2 * a * b * cos(temp);
	cout << setprecision(10) << fixed << sqrt(ans);
}

Measured memory_bytes: 4228
from collections import deque
import copy
 
def main():
    h, w = map(int, input().split())
    a = [[j == "#" for j in input()] for _ in range(h)]
 
 
    que = deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])
 
    count = 0
    while True:
        count += 1
        nque = deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))
 
        if nque:
            que = copy.copy(nque)
        else:
            break
 
    print(count - 1)

if __name__ == "__main__":
    main()


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int main(){
    cin.sync_with_stdio(false);
    ll a, b, x;
    cin >> a >> b >> x;

    ll p = a / x;
    if (a % x == 0) p--;
    ll q = b / x;

    cout << q - p << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
      
       if((A < C && C < B)||(B < C && C < A)){
         System.out.println("Yes");
       }else{
         System.out.println("No");
       }
	}

}

Measured memory_bytes: 35508
<?php

$n = trim(fgets (STDIN));
$nums = explode(" ", trim(fgets(STDIN)));
$array = [0];
for($i=1; $i<$n; $i++){
	if($i===1){
		$array[$i]=abs($nums[$i]-$nums[0]);
	}else{
		$from_one_before_step = $array[$i-1] + abs($nums[$i]-$nums[$i-1]);
		$from_two_before_step = $array[$i-2] + abs($nums[$i]-$nums[$i-2]);
		$array[$i] = $from_one_before_step < $from_two_before_step ? $from_one_before_step : $from_two_before_step;
	}
}
echo $array[$n-1] . "\n";


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007


int main(){
  
  string s;
  cin >> s;
  int n = s.size();
  vector<int> v(26,0);
  rep(i,n)v[s[i]-'a']++;
  ll res = 1;
  rep(i,26){
    for(int j = i+1;j < 26;j++){
      res += 1ll*v[i]*v[j];
    }
  }
  cout << res << endl;



  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int A[n], B[n], C[n-1];
  int ans = 0;
  rep(i, n) {
    cin >> A[i];
    A[i]--;
  }
  rep(i, n) cin >> B[i];
  rep(i, n-1) cin >> C[i];

  rep(i, n) ans += B[i];
  rep(i, n) {
    if (A[i+1]-A[i] == 1) {
      ans += C[A[i]];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
integer N
integer,allocatable,dimension(:,:)::A
integer,allocatable,dimension(:)::B,Anum
integer aite
integer cnt
logical nogame
read*,N
allocate(A(N,N-1),B(N),Anum(N))
Anum=1
do i=1,N
  read*,A(i,:)
end do

cnt=0
do i=1,N*N
  nogame=.true.
  B=0
  do j=1,N
    if(B(j)==0.and.Anum(J)/=N)then
      aite=A(J,Anum(J))
      if(A(aite,Anum(aite))==J.and.B(aite)==0)then
        Anum(j)=Anum(j)+1
        Anum(aite)=Anum(aite)+1
        nogame=.false.
        B(j)=1;B(aite)=1
        if(Anum(J)==N)cnt=cnt+1
        if(Anum(aite)==N)cnt=cnt+1
      endif
    endif
  end do
  if(cnt==N)then
    print"(i0)",i
    stop
  endif
  if(nogame)then
    print"(i0)",-1
    stop
  endif
end do
end

Measured memory_bytes: 4096
#include<iostream>
#include<queue>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define in_range(x,l,r) (l<=x && x<r)
using namespace std;
typedef pair<int,int> pii;

const int INF = 1e9+7;
const int dy[] = {-1,-1,0,1,1,1,0,-1}, dx[] = {0,1,1,1,0,-1,-1,-1};

bool check(int y, int x, int k, vector< vector<int> > &d, int t){
  int h = d.size(), w = d[0].size();
  int cnt = 0;
  rep(i,8){
    int ny = y+dy[i], nx = x+dx[i];
    if(!in_range(ny,0,h) || !in_range(nx,0,w))continue;
    if(d[ny][nx] <= t)cnt++;
  }
  return (k <= cnt);
}

int main(){
  int h,w;
  cin >> h >> w;

  vector<string> g(h);
  vector< vector<int> > d(h,vector<int>(w,INF));

  queue<pii> q;
  rep(i,h){
    cin >> g[i];
    rep(j,w){
      if(g[i][j] == '.'){
	q.push(pii(i,j));
	d[i][j] = 0;
      }
    }
  }

  int res = 0;
  while(q.size()){
    pii p = q.front(); q.pop();
    int y = p.first, x = p.second;

    res = max(res, d[y][x]);

    rep(i,8){
      int ny = y+dy[i], nx = x+dx[i];      
      if(!in_range(ny,0,h) || !in_range(nx,0,w))continue;
      
      if(g[ny][nx] != '.' && check(ny,nx,g[ny][nx]-'0',d,d[y][x])){
	g[ny][nx] = '.';
	d[ny][nx] = d[y][x] + 1;
	q.push(pii(ny,nx));
      }
    }
  }

  cout << res << endl;
}

Measured memory_bytes: 6284
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<vector<int>> f(n,vector<int>(10));
    rep(i,0,n) rep(j,0,10) cin>>f[i][j];
    vector<vector<int>> p(n,vector<int>(11));
    rep(i,0,n) rep(j,0,11) cin>>p[i][j];
    
    int ans=-INF;
    bool out=true;
    for(int bit=0;bit<(1<<10);bit++){
        if(out){
            out=false;
            continue;
        }
        int now=0;
        rep(i,0,n){ //i番目のお店について
            int c=0;
            rep(j,0,10){
                if(f[i][j] && bit&(1<<j)) c++;
            }
            now+=p[i][c];
        }
        ans=max(ans,now);
    }
    
    cout<<ans<<endl;
    
}



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

#define ll long long
#define d long double

#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define dscf(n) scanf("%Lf",&n)
#define pri(n) printf("%d ",(int)n)
#define lpri(n) printf("%lld ",n)
#define dpri(n) printf("%Lf ",n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define dprin(n) printf("%Lf\n",n)

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i,ini,n) for(ll i=ini;i<(int)n;i++)
#define all(x) x.begin(),x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define bitcount(n) __builtin_popcount(n)
#define tc   int tt; scf(tt); while(tt--)
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define PI 3.14159265358979323846264

const ll M =1e9+7;
const int N = 1e6+7;



int main()
{
    string s;
    cin>>s;
    if(s.back()=='s')
    s=s+"es";
    else
    {
        s=s+"s";
    }
    cout<<s;
return 0;
}

Measured memory_bytes: 3624
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


n, x = map(int, input().split())
x_list = list(map(int, input().split()))

ls = []

for i in range(n):
    ls.append(abs(x - x_list[i]))

ret = ls[0]

for i in range(1, n):
    ret = gcd(ret, ls[i])

print(ret)


Measured memory_bytes: 63640
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#define vel vector<long long>
#define veb vector<bool>
#define vvel vector<vel>
#define int long long
#define pin pair<int,int>
#define ppin pair<int,pin>
#define mkp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
signed main() {
	vel a(5);
	rep(i, 5) { cin >> a[i]; }
	sort(a.begin(), a.end());
	int k; cin >> k;
	if (a[4] - a[0] > k) { cout << ":(" << endl; }
	else { cout << "Yay!" << endl; }
	return 0;
}

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

int h, w;
pair<int, int> st, g;   //スタートとゴールの座標
vector<vector<bool>> s; //s: 道ならtrue, 壁ならfalse  dict: 魔法を何回使えばその座標に行けるか。-1で初期化
vector<vector<int>> dict;
vector<pair<int, int>> ite = {pair<int, int>(1, 0), pair<int, int>(0, 1), pair<int, int>(-1, 0), pair<int, int>(0, -1)};
queue<pair<int , int>> que; // fillで埋めたいところのリスト
queue<pair<int, int>> filled; //fillし終わったところ。


void fill(int x, int y, int num){ //座標(x, y)から歩いて行ける場所のdictをすべて num にする。
    dict[x][y] = num;
    filled.push(pair<int, int>(x, y));
    
    rep(i, 4){
        int x_ = x+ite[i].first;
        int y_ = y+ite[i].second;
        if(x_<0 || y_<0 || x_>=h || y_>= w)continue;
        if(s[x_][y_] && dict[x_][y_]==-1)fill(x_, y_, num);
    }
}

int main(){
    
    cin >> h >> w;
    
    cin >> st.first >> st.second;
    cin >> g.first >> g.second;
    st.first--;st.second--;
    g.first--;g.second--;
    
    
    s.resize(h);
    dict.resize(h);
    rep(i, h){
        s[i].resize(w);
        dict[i].resize(w);
        rep(j, w)dict[i][j]=-1;
    }
    
    rep(i, h){
        rep(j, w){
            char c;
            cin >> c;
            s[i][j] = bool(c=='.');
        }
    }
    
    int cnt = 0;
    que.push(st);
    while(1){
        if(que.empty())break;
        while(!que.empty()){
            
            int x=que.front().first;
            int y=que.front().second;
            que.pop();
            
            if(s[x][y])fill(x, y, cnt);
        }
        
        if(dict[g.first][g.second]!=-1)break;
        
        while(!filled.empty()){
            int x=filled.front().first;
            int y=filled.front().second;
            filled.pop();
            
            rep2(i, -2, 3){
                rep2(j, -2, 3){
                    if(x+i<0 || x+i>=h || y+j<0 || y+j>=w)continue;
                    if(s[x+i][y+j] && dict[x+i][y+j]==-1)que.push(pair<int, int>(x+i, y+j));
                }
            }
        }
        cnt++;
    }
    
    cout << dict[g.first][g.second] << endl;
}

Measured memory_bytes: 7968
(defun solve (N)
  (loop for a.b
        in (sort (loop repeat N
                       collect (cons (read) (read)))
                 #'< :key #'cdr)
        with sum = 0
        do (destructuring-bind
             (a . b) a.b
             (if (< b (incf sum a))
                 (return)))
        finally (return t)))

(if (solve (read))
    (princ "Yes")
    (princ "No"))

Measured memory_bytes: 63944
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

signed main() {
    string s; cin >> s;
    int ans = 0, sum = 0, N = s.length();
    for(int i=0; i<N; i++) {
        if(s[i] == 'L') sum--;
        if(s[i] == 'R') sum++;

        if(sum % 4 == 0) {
            if(sum > 0) ans++;
            sum = 0;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

int main()
{
  int H,W;
  cin >> H >> W;
  vector<string> field(H);
  REP(i,H) cin >> field[i];
  
  REP(i,H){
    REP(j,W){
      if(field[i][j]=='#'){
        cout << '#';
      }else{
        int cnt = 0;
        REP(k,8){
          int x = j + dx[k];
          int y = i + dy[k];
          if(x<0 || x>=W || y<0 || y>=H) continue;
          if(field[y][x] == '#') cnt++;
        }
        cout << cnt;
      }
    }
    cout << '\n';
  }
  return 0;
}

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

string decode(string s)
{
  string ans;
  string map[]=
    {
      "00000",
      "00001",
      "00010",
      "00011",
      "00100",
      "00101",
      "00110",
      "00111",
      "01000",      
      "01001",
      "01010",
      "01011",
      "01100",
      "01101",
      "01110",
      "01111",

      "10000",
      "10001",
      "10010",
      "10011",
      "10100",
      "10101",
      "10110",
      "10111",
      "11000",      
      "11001",
      "11010",
      "11011",
      "11100",
      "11101",
      "11110",
      "11111"     
    };
  string charset="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";

  for(int i=0;i<s.size();i+=5)
    {
      for(int j=0;j<32;j++)
	{
	  if(s.substr(i,5)==map[j])
	    ans+=charset[j];
	}
    }

  return ans;
}

string encode(string s)
{
  string ans;
  string code[]={
    "101",
    "000000",
    "000011",
    "10010001",
    "010001",
    "000001",
    "100101",
    "10011010",
    "0101",
    "0001",
    "110",
    "01001",
    "10011011",
    "010000",
    "0111",
    "10011000",
    "0110",
    "00100",
    "10011001",
    "10011110",
    "00101",
    "111",
    "10011111",
    "1000",
    "00110",
    "00111",
    "10011100",
    "10011101",
    "000010",
    "10010010",
    "10010011",
    "10010000"
};
  string charset=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ";

  for(int i=0;i<s.size();i++)
    {
      for(int j=0;j<32;j++)
	{
	  if(charset[j]==s[i])
	    {
	      ans+=code[j];
	      break;
	    }
	}
    }
  while(ans.size()%5!=0)
    ans+="0";
  return ans;
}

int main()
{
  string s;
  for(;getline(cin, s);)
    cout<<decode(encode(s))<<endl;
  
}

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    if(N%2!=0) {
        puts("No");
    }
    else {
        string a = S.substr(0,(N/2));
        string b = S.substr((N/2),(N/2));
        if(a==b) {
            puts("Yes");
        }
        else {
            puts("No");
        }
    }
    return 0;
}

Measured memory_bytes: 256
/**
  * author : thegeniushead
**/
#include <bits/stdc++.h>
 
/*.....DEFINITIONS...... */
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T() int tt; cin>>tt; while(tt--)
#define rep(i,start,lim) for(int i=start;i<lim;i++)
#define rep1(i,start,lim) for(int i=start; i<=lim; ++i)
#define repd(i,start,lim) for(int i=start;i>=lim;i--)
#define mp make_pair
#define pb push_back
#define lchild (2*node+1)
#define rchild (2*node+2)
#define ff first
#define ss second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define eps (1e-6)
#define sll(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define what_is(x) cerr << #x << " is " << x << "\n";
#define infll 9e18
#define inf 1e9
#define int long long int

using namespace std;
 
/*.....TYPEDEFS ....*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef long double ld;
 
/*....USEFUL FUNCTIONS....*/
ll pwr(ll base, ll exp, ll mod=MOD){ll res=1; while(exp>0){if(exp%2){res=(res*base)%mod;}base=(base*base)%mod;exp/=2;}return res;}
ll gcd(ll a, ll b){ if(b==0)return a; else gcd(b, a%b);}
bool isPrime(ll n){if(n<=1)return false;if(n<=3)return true;if (n%2==0||n%3==0)return false;for(int i=5; i*i<=n; i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
 
/*....I/O Functions...*/
inline string rs(){char x[1234567];scanf("%s", x);string s = x; return s;}
inline int ri(){int x; scanf("%d", &x);return x;}
inline long long rl(){long long x; scanf("%lld", &x); return x;}
 
/*---------Solution below this line --------*/
 
const int N = 1234567;

int n;
int a[N];

int solve(){
	int res = 0;
	int cur = 0;
	
	rep(i,0,n){
		if(i%2 == 0){
			if(cur + a[i] <= 0){
				res += abs(cur + a[i]) + 1;
				cur += abs(cur + a[i]) + 1;
				cur += a[i];
			}
			else{
				cur += a[i];
			}
		}
		else{
			if(cur + a[i] >= 0){
				res += (cur + a[i] + 1);
				cur -= (cur + a[i] + 1);
				cur += a[i];
			}
			else{
				cur += a[i];
			}
		}
		//cerr << "cur: " << cur << endl;
	}
	
	return res;
}

int32_t main()
{
	//FIO
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	scanf("%lld", &n);
	
	rep(i,0,n){
		scanf("%lld", a + i);
	}
	
	int ans = solve();
	

	rep(i,0,n){
		a[i] *= -1;
	}
	
	ans = min(ans, solve());
	
	printf("%lld\n", ans);
		
	
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int n;

int main(){
    scanf("%d", &n);
    for(int i=n; i<1000; i++){
        int aux = i/10;
        int a = i % 10;
        bool b = true;
        while(aux != 0){
            if(a != aux %10){
                b = false;
                break;
            }
            aux /= 10;
        }
        if(b){
            printf("%d\n", i);
            return 0;
        }
    }
}


Measured memory_bytes: 128
import math
n=int(input())
a=list(map(int,input().split()))
b=max(a)
a.remove(b)
d=b//2
a1=[]
for i in range(len(a)):
    a1.append(abs(d-a[i]))
c=min(a1)
if d+c in a:
    print("{} {}".format(b,d+c))
else:
    print("{} {}".format(b,d-c))


Measured memory_bytes: 14180
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

vector<ll> divisor(ll n)
{
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++)
    {
        if (i % 2)
        {
            auto y = divisor(i);
            if (y.size() == 8)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

int main() {
    const lint BIG = 1L << 30;

    int N, K;
    cin >> N >> K;

    mcf_graph<int, lint> mcf(2 * N + 2);
    int s = 2 * N, t = 2 * N + 1;

    mcf.add_edge(s, t, N * K, BIG);
    for_(i,0,N) {
        mcf.add_edge(s, i, K, 0);
        mcf.add_edge(N + i, t, K, 0);
    }

    for_(i,0,N) for_(j,0,N) {
        lint a;
        cin >> a;
        mcf.add_edge(i, N + j, 1, BIG - a);
    }

    auto res = mcf.flow(s, t, N * K);
    cout << 1LL * N * K * BIG - res.second << endl;

    vector<string> G(N, string(N, '.'));
    for (auto e : mcf.edges()) {
        if (e.from == s or e.to == t or e.flow == 0) continue;
        G[e.from][e.to - N] = 'X';
    }

    for_(i,0,N) cout << G[i] << endl;
}

Measured memory_bytes: 3912
#include <cstdio>
#include <vector>
#include <algorithm>

int main()
{
	int n, k;
	scanf("%d%d", &k, &n);
	std::vector<int> a(n + 1);
	for (int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	a[n] = a[0] + k;
	int ans = k;
	for (int i = 0; i < n; ++i)
		ans = std::min(ans, k - a[i + 1] + a[i]);
	printf("%d\n", ans);
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main () {
  int a [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int x , y ; cin >> x >> y ;
  cout << ( a [ x ] == a [ y ] ? " Yes " : " No ") << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define sp(x) fixed<<setprecision(x)
#define p_q priority_queue
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    fast_io;

    string s;
    cin>>s;

    int koto = s.size();
    if(s[koto-1] != 's')
    {
        cout<<s;
        cout<<'s';
    }

    else
    {
        cout<<s;
        cout<<'e'<<'s';
    }

    return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
//#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
//cerr
using namespace std;
signed main() {
	int n; cin >> n;
	for1(i, n) {
		int p; cin >> p;
		if (p % 2 == 0) {
			if (p % 3 == 0 || p % 5 == 0);
			else {
				cout << "DENIED\n";
				return 0;
			}
		}
	}
	cout << "APPROVED\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
vector <int> V[2];
char S[8005];
bool Exist[16005];
int X, Y;
int N, sol = 0;
void Read()
{
    cin.getline(S + 1, 8005);
    cin >> X >> Y;
    N = strlen(S + 1);
}
void precalcV()
{
    int ind = 0, number = 0, cnt = 0;
    for(int i = 1; S[i] != 0; i++)
    {
        if(S[i] == 'T')
        {
            ++cnt;
            if(cnt == 1)
                X -= number;
            else
            if(number != 0)
                V[ind].push_back(number);
            ind = 1 - ind;
            number = 0;
        }
        else
            number++;
    }
    ++cnt;
            if(cnt == 1)
                X -= number;
            else
            if(number != 0)
                V[ind].push_back(number);
}

void Solve(int ind)
{
    int add = N;
    for(int i = 0; i <= 2 * N; i++)
        Exist[i] = 0;
    Exist[add] = 1;
    vector <int> X2;
    for(int i = 0; i < V[ind].size(); i++)
    {
        X2.clear();
        int nb = V[ind][i];
        for(int j = N - nb + add; j >= -N + add; j--)
            if(Exist[j] == 1)
                X2.push_back(j + nb);
        for(int j = nb - N + add; j <= N + add; j++)
        if(Exist[j] == 1)
            X2.push_back(j - nb);
        for(int j = -N; j <= N; j++)
            Exist[j + add] = 0;
        for(int j = 0; j < X2.size(); j++)
            Exist[X2[j]] = 1;
    }
    if(ind == 0)
        if(X >= -N && X <= N && Exist[X + add] == 1)
            sol++;
    if(ind == 1)
        if(Y >= -N && Y <= N && Exist[Y + add] == 1)
            sol++;
}
int main()
{
    Read();
    precalcV();
    Solve(0);
    Solve(1);
    if(sol == 2)
    cout << "Yes\n";
    else
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void){
    int a, b;
    cin >> a >> b;
    string result = "Odd";
    if (a % 2 == 0 || b % 2 == 0) result = "Even";
    cout << result;
   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void)
{
  int a=0;int b=0;
  char x[200001];
  char y[200001];
  scanf("%s",x);
  scanf("%s",y);
  for(a=0;a<strlen(x);a++){
    if(x[a]!=y[a]){
      b++;
    }
  }
  printf("%d\n",b);
  return 0;
}


Measured memory_bytes: 2048
import std.stdio;
import std.string;
import std.conv;

void main() {
  double min = int.max.to!(double);
  double max = 0.0;
  string line;
  while((line = readln.chomp).length != 0) {
    double num = line.to!(double);
    if (max < num) max = num;
    else if (min > num) min = num;
  }
  (max - min).writeln;
}

Measured memory_bytes: 1132
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using P = pair<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

//0-indexedに注意！！
class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor,[0,sz_-1)で定義
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    ll L;
    cin >> L;
    vector<ll> p(K,0);
    vector<ll> q(K,0);
    vector<ll> r(L,0);
    vector<ll> s(L,0);
    for(ll i=0;i<K;++i){cin>>p[i]>>q[i];p[i]--;q[i]--;}
    for(ll i=0;i<L;++i){cin>>r[i]>>s[i];r[i]--;s[i]--;}
    UnionFind tree1(N);
    UnionFind tree2(N);
    for(ll i=0;i<K;++i)tree1.unite(p[i],q[i]);
    for(ll i=0;i<L;++i)tree2.unite(r[i],s[i]);
    vector<map<ll,ll>> vec(N);
    for(ll i=0;i<N;++i)vec[tree1.root(i)][tree2.root(i)]++;
    for(ll i=0;i<N;++i)cout<<vec[tree1.root(i)][tree2.root(i)]<<" ";
    cout<<endl;fl

    return 0;
}



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

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    int maxi = max(A, max(B, C));
    int sumu = maxi * 3 - A - B - C;
    int ans = 0;

    if (sumu % 2 == 0) {
        ans = sumu / 2;
    } else {
        ans = sumu / 2 + 2;
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 1e9 + 7
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
    int N;
    ll cnt = 0;
    ll *A;
    cin >> N;
    A = new ll[N];
    for (int i = 0; i < N; i++)
    {
        if (scanf("%lld", &A[i]) == 1)
            ;
    }
    FOR(i, 1, N)
    {
        if (A[i - 1] > A[i])
        {
            ll x = A[i - 1] - A[i];
            cnt += x;
            A[i] = A[i - 1];
        }
    }

    cout << cnt << endl;
}

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

int main() {
    int N; cin >> N;
    vector<int> subord(N, 0);
    for (int i=1; i<N; i++) {
        int c; cin >> c;
        subord[c-1]++;
    }
    for (int i=0; i<N; i++) {
        cout << subord[i] << endl;
    }
}

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

typedef pair<int,int> P;

const int INF = 1000000000;

#define fr first
#define sc second

struct SEG{
	int siz = 1<<18;
	int s[1<<19],t[1<<19];
	void init(){
		for(int i = 0 ; i < siz*2-1 ; i ++){
			s[i] = INF;
			t[i] = 0;
		}
	}
	void add(int a,int b,int x,int k,int l,int r){
		if(b <= l || r <= a)return;
		if(a <= l && r <= b){
			t[k] ++;
			return;
		}
		add(a,b,x,2*k+1,l,(l+r)/2);
		add(a,b,x,2*k+2,(l+r)/2,r);
		s[k] = min( s[2*k+1]+t[2*k+1] , s[2*k+2]+t[2*k+2] );
	}
	void chmin(int a, int x){
		int b = a+siz-1;
		x -= t[b];
		while(b > 0){
			b = (b-1)/2;
			x -= t[b];
		}
		a += siz-1;
		s[a] = min( s[a] , x );
		while(a > 0){
			x += t[a];
			a = (a-1)/2;
			s[a] = min( s[a] , x );
		}
	}
	int query(int a,int b,int k,int l,int r){
		if(b <= l || r <= a)return INF;
		if(a <= l && r <= b)return s[k]+t[k];
		int chl = query(a,b,2*k+1,l,(l+r)/2);
		int chr = query(a,b,2*k+2,(l+r)/2,r);
		return min(chl,chr)+t[k];
	}
}dp;

int main(){
	static int n;
	static int b[200010];
	static int q;
	static int l[200010],r[200010];
	scanf("%d",&n);
	for(int i = 1 ; i <= n ; i ++){
		scanf("%d",&b[i]);
	}
	scanf("%d",&q);
	for(int i = 1 ; i <= q ; i ++){
		scanf("%d%d",&l[i],&r[i]);
	}
	
	vector<P> vec;
	for(int i = 1 ; i <= q ; i ++){
		vec.push_back(P(l[i],r[i]));
	}
	sort(vec.begin(),vec.end());
	
	dp.init();
	dp.chmin(0,0);
	int loc = 0;
	for(int i = 1 ; i <= n ; i ++){
		while(loc < vec.size() && vec[loc].fr == i){
			dp.chmin(vec[loc].sc,dp.query(0,vec[loc].sc+1,0,0,dp.siz));
			loc ++;
		}
		if(b[i] == 0){
			dp.add(i,dp.siz,1,0,0,dp.siz);
		}
		else {
			dp.add(0,i,1,0,0,dp.siz);
		}
	}
	cout << dp.query(0,dp.siz,0,0,dp.siz) << endl;
}



Measured memory_bytes: 8432
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        void solve(InputReader in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();
            int D = in.nextInt();
            out.println(Math.min(A, B) + Math.min(C, D));
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }
//string al="abcdefghijklmnopqrstuvwxyz";
//vector< vector<int> > v (size1, vector<int>(size2) );



int main(){ 
    cin.tie(0);
    ios::sync_with_stdio(false);
    string al="abcdefghijklmnopqrstuvwxyz";
    string A;cin>>A;
    ll N;N=A.size();
    vector< vector<ll> > cnt (26, vector<ll>(N));
    FOR(i,0,26){
        ll c=0;
        FOR(j,0,N){
            if(A[j]==al[i])c++;
            cnt[i][j]=c;
        }
    }
    ll ans=0;
    FOR(i,0,N){
        ans+=N-cnt[A[i]-'a'][N-1]+cnt[A[i]-'a'][i]-i-1;
        //cout<<ans<<endl;
    }
    ans++;
    cout<<ans<<endl;
    
}
//666 Palindrome


Measured memory_bytes: 42772
#include <stdio.h>

int gcd(int a, int b){
    if(a < b){
        int t = a;

        a = b;
        b = t;
    }
    while(b > 0){
        int t = b;

        b = a % b;
        a = t;
    }
    return a;
}

int main(){
    long long int A, B;

    scanf("%lld%lld", &A, &B);
    printf("%lld\n", A * B / gcd((int) A, (int) B));
}

Measured memory_bytes: 128
#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>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	int n;
	string a, b, c;
	cin >> n >> a >> b >> c;
	int ans = 0;
	for(int i = 0; i < n; ++i){
		set<int> s = {a[i], b[i], c[i]};
		ans += s.size() - 1;
	}
	cout << ans << endl;
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
#include<stdio.h>
int solve(int,int);
int n,data[20];
int main(){
  int q,m;
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&data[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(0,m))printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m){
  int res;
  if(m==0)return 1;
  else if(i>=n)return 0;
  res=solve(i+1,m)||solve(i+1,m-data[i]);
  return res;
}



Measured memory_bytes: 2080
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
typedef pair<long long,int> P;
P pp[200001];
long long sum[200001];
int main(void)
{
	int n,i,j,d[200001],mid,low,high,mx;
	scanf("%d",&n);
	for(i=1;i<=n;i++)	scanf("%d",&d[i]);
	sum[0]=0;
	for(i=1;i<=n;i++)	sum[i]=sum[i-1]+d[i];
	for(i=0;i<=n;i++){
		pp[i].first=sum[i];	pp[i].second=i;
	}
	sort(pp,pp+n+1);
//	for(i=0;i<=n;i++)	{
//		printf("   %d %d\n",pp[i].first,pp[i].second);
//	}
	mx=0;
	for(i=0;i<n;i++)	{
		low=0;	high=n;
		while(low<=high)	{
			mid=(low+high)/2;
			if(pp[mid].first<=sum[i])	low=mid+1;
			else high=mid-1;
		}
		mx=max(mx,pp[high].second-i);
	}
    printf("%d\n",mx);
    return 0;
}


Measured memory_bytes: 8144
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,tax,bus;
  cin >>n>>a>>b;
  bus=n*a;
  tax=b;

  if(bus<tax){
    cout<<bus<<endl;
  }else{
    cout<<tax<<endl;
  }



  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+1;

int main()
{
    ll a,b,x;
    cin >> a >> b >> x;
    if(a<=x && x<=a+b){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main() {
    int n, k;
    cin >> n >> k;
    const int MOD = 998244353;
    vector<int> dp(n+10, 0), dp_sum(n+10, 0);
    vector<int> left(k), right(k);
    for (int i = 0; i < k; i++) cin >> left[i] >> right[i];
    dp[1] = 1;
    dp_sum[1] = 1;
    for (int i = 2; i < n+10; i++) {
        for (int j = 0; j < k; j++) {
            int r = i - left[j];
            int l = max(i - right[j], 1);
            if (r < 0) continue;
            dp[i] = (dp[i] + dp_sum[r] - dp_sum[l-1]) % MOD;
            if (dp[i] < 0) dp[i] += MOD;
        }
        dp_sum[i] = (dp_sum[i-1] + dp[i]) % MOD;
    }
    // for (auto x: dp) cout << x << ' ';
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  cin >> A >> B;
  
 if((A * B) % 2 == 0){
  cout << "Even" << endl;
 }
 if((A * B) % 2 == 1){
   cout << "Odd" << endl;
 }
}


Measured memory_bytes: 256
private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map(String::toInt)
private fun readStrings2() = readLn().split("").filter { it.isNotEmpty() }
private fun readInts2() = readStrings2().map(String::toInt)
private fun initArray(n:Int, v:String) = Array(n) { v }
private fun initIntArray(n:Int, v:Int) = IntArray(n) { v }

fun main(args: Array<String>) {
    val x = readInt()

    println(x + x * x + x * x * x)
}

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


def read_h(typ=int):
    return map(typ, input().split())


def read_v(n, typ=int):
    return [typ(input()) for _ in range(n)]


def main():
    K, S = read_h()
    cnt = 0
    for x in range(K + 1):
        for y in range(min(S - x, K) + 1):
            z = S - x - y
            if z <= K:
                cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int n;
    string s, t;
    cin >> n >> s >> t;

    string ans = "";
    rep(i, n)
    {
        ans += s[i];
        ans += t[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"YES\n"
#define no cout<<"NO\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a,b;
	cin>>a>>b;
	if(a==1||b==1)cout<<1<<endl;
	else if(a%2&&b%2)cout<<a*b/2+1<<endl;
	else cout<<a*b/2<<endl;
}







Measured memory_bytes: 256