akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int x;
    cin>>x;
    int ans=0,now=0;
    while(true){
        now+=x;
        ans++;
        if(now%360==0) break;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3580
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

const int MAX = 200000;
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    vector<int> X(N),Y(N),U(N);
    rep(i,N) {
        char c;
        cin >> X[i] >> Y[i] >> c;
        if (c=='U') U[i] = 0;
        else if (c=='R') U[i] = 1;
        else if (c=='D') U[i] = 2;
        else U[i] = 3;
    }

    auto Rotate=[&]() {
        rep(i,N) {
            int x = MAX - Y[i];
            int y = X[i];
            int u = (U[i]+3)%4;
            X[i] = x;
            Y[i] = y;
            U[i] = u;
        }
    };

    ll ans = 1e18;
    auto solve=[&]() {
        vector<vector<pii>> G(MAX*2+1);
        vector<vector<int>> P(MAX+1),Q(MAX+1);
        rep(i,N) {
            if (U[i] <= 1) {
                G[X[i]+Y[i]].emplace_back(X[i],U[i]);
            }
            if (U[i]==0) {
                P[X[i]].emplace_back(Y[i]);
            }
            if (U[i]==2) {
                Q[X[i]].emplace_back(Y[i]);
            }
        }

        rep(i,MAX*2+1) sort(all(G[i]));
        rep(i,MAX+1) {
            sort(all(P[i]));
            sort(all(Q[i]));
        }
        rep(i,MAX*2+1) {
            for (int j = 0; j < (int)G[i].size()-1; j++) {
                if (G[i][j].second==1 and G[i][j+1].second==0) {
                    chmin(ans,(G[i][j+1].first-G[i][j].first)*10);
                }
            }
        }

        rep(i,MAX+1) {
            int K = Q[i].size();
            int cur = 0;
            for (auto j : P[i]) {
                while (cur < K and Q[i][cur] <= j) cur++;
                if (cur < K) {
                    chmin(ans,(Q[i][cur]-j)*5);
                }
            }
        }
    };

    rep(i,4) {
        solve();
        Rotate();
    }
    if (ans==1e18) cout << "SAFE" << ln;
    else cout << ans << ln;
}


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

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define what_is(x) cerr << #x << " is " << x << endl;
#define MT make_tuple
#define eb emplace_back
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define REP(i,a,b) for (int i = a; i <= b; i++)
#define FOR(i,n) for (int i=0;i < n ; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}
clock_t startTime;
long double getTime(){
	return (long double)(clock()-startTime)/CLOCKS_PER_SEC;
}

string s;
string t;

string func(){
	if(s.length()!=t.length()) return "No";
	else{
		int n=s.length();
		for(char c='a'; c <='z';c++){
			std::vector<int> v;
			std::vector<int> w;
			FOR(i,n){
				if(s[i]==c) v.PB(i);
				if(t[i]==c) w.PB(i);
			}
			//if(c=='e') error(v.size(),w.size(),s.length());
			if(v.size()>0){
				char a=t[v[0]];
				for(int j=1;j < v.size();j++) if(t[v[j]]!=a) return "No";
			}
			if(w.size()>0){
				char b=s[w[0]];
				for(int k=1;k<w.size();k++) if(s[w[k]]!=b) return "No";
			}
		}
		return "Yes";
	}
}

int main(){
	startTime=clock();
	
	cin >> s >> t;
	cout << func();

	return 0;
}

Measured memory_bytes: 4600
#include <iostream>


int main(){

    int K;

    std::cin >> K;

    int k_1 = K%10;
    
    if (k_1 ==2 || k_1 ==4 || k_1 ==6 || k_1 ==8 || k_1 ==0 || k_1 ==5){
        std::cout << "-1" << std::endl;
        return 0;
    }

    int ans=0,i=7;
    bool searching = true;
    while(searching){
        ans++;
        if (i %K ==0){
            searching = false;
        }
        i=(i%K)*10 +7;

    }

    std::cout << ans << std::endl;



}


Measured memory_bytes: 3628
d, n = map(int, input().split())

if d == 0:
    if n == 100:
        print(n+1)
    else:
        print(n)
elif d == 1:
    if n == 100:
        print((n+1)*100)
    else:
        print(n*100)
elif d == 2:
    if n == 100:
        print((n+1)*10000)
    else:
        print(n*10000)


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

int hmAB(string s) {
  int c = 0;
  for (int i = 0; i < s.size()-1; i++) {
    if (s.at(i) == 'A' && s.at(i+1) == 'B')
      c++;
  }
  return c;
}

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++)
    cin >> s.at(i);
  int Bxx = 0, xxA = 0, BxA = 0;
  for (int i = 0; i < N; i++) {
    if (s.at(i).at(0) == 'B') {
      if (s.at(i).at(s.at(i).size()-1) == 'A')
        BxA++;
      else
        Bxx++;
    }
    else if (s.at(i).at(s.at(i).size()-1) == 'A')
      xxA++;
  }
  int ans = 0;
  for (int i = 0; i < N; i++)
    ans += hmAB(s.at(i));
  if (xxA > 0)
    while (BxA > 0) {
      ans++;
      BxA--;
    }
  else if (Bxx > 0)
    while (BxA > 0) {
      ans++;
      BxA--;
    }
  else if (BxA > 0) {
    ans += BxA - 1;
  }
  ans += min(xxA, Bxx);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 768
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
char s[102];
long long ans,n,t;
long long ww(int b,int l)
{
	long long ret=0,e=b+l-1;
	for(int i=b;i<=e;i++)
		ret=ret*10+s[i]-'0';
	return ret;
}
int main()
{
	scanf("%s",s+1);
	int len=strlen(s+1);
	sscanf(s+1,"%lld",&n);
    for(int i=1;i<=len;i++)
        for(int j=1;j+i-1<=len;j++)
		{
            int c=len-i-1;
            if(1<j&&j<len-i+1)
                c--;
            c=max(0,c);
            t=ww(j,i)*pow(2,c);
            ans+=t;
        }
	printf("%lld",ans);
	//return 0;
}

Measured memory_bytes: 128
N = gets.to_i
A = gets.chomp.split.map(&:to_i).sort
B = gets.chomp.split.map(&:to_i).sort
C = gets.chomp.split.map(&:to_i).sort

s = 0
B.each do |b|
  i = A.bsearch_index { |a| a >= b } || N
  k = N - (C.bsearch_index { |c| c > b } || N)
  s += i * k
end
puts s


Measured memory_bytes: 26804
from bisect import bisect_right as br
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):a[i]*=-1
a.sort()
b=[0]
for i in a:b.append(b[-1]+i)
ng=2*10**5+7
ok=-1
while ok+1!=ng:
  mid=(ng+ok)//2
  co=0
  for i in a:co+=br(a,-(mid+i))
  if co<m:ng=mid
  else:ok=mid
ans=0
co=0
for i in a:
  ind=br(a,-(ok+i)-1)
  co+=ind
  ans+=-b[ind]-i*ind
ans+=(m-co)*ok
print(ans)

Measured memory_bytes: 14196
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 10 21:29:58 2020

@author: over-
"""

def kai(N):
    a=1
    for n in range(2,N+1):
        a*=n
    return a


N=int(input())
P=input().split()
Q=input().split()

a,b=0,0


A=[i+1 for i in range(N)]
for i in range(N-1):
    p=int(P[i])
    c=0
    for ai in A:
        if ai < p:
            c+=1
    a+=c*kai(N-i-1)
    A.remove(p)
    
A=[i+1 for i in range(N)]
for i in range(N-1):
    q=int(Q[i])
    c=0
    for ai in A:
        if ai < q:
            c+=1
    b+=c*kai(N-i-1)
    A.remove(q)
    
print(abs(a-b))

Measured memory_bytes: 3064
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    R = int(readline())
    ans = 2 * R * np.pi
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 26812
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int len = s.length();

		ArrayList<String> sa = new ArrayList<String>();

		for (int i = 0; i < len; i++) {
			sa.add(s.substring(i, i + 1));
		}

		for (int i = 0; i < sa.size() - 1; i++) {
			if (sa.get(i).equals(sa.get(i + 1))) {
				if (i < sa.size() - 2) {
					sa.set(i + 1, sa.get(i + 1) + sa.get(i + 2));
					sa.remove(i + 2);
					continue;
				} else {
					sa.set(i, sa.get(i + 1));
					sa.remove(i + 1);
				}
			}
		}
		System.out.println(sa.size());
	}
}

Measured memory_bytes: 51176
L = int(input())

bL = bin(L)[2:]

N = len(bL)
L = 2 * (N-1) + bL[1:].count('1')
print(N, L)

for i, b in enumerate(bL[1:]):
    if b == '1':
        print(1, i+2, 0)

M, m = 0, 0
for i, b in enumerate(bL[:0:-1]):
    add = M - m + 1
    if b == '1':
        print(N-i-1, N-i, add)
        print(N-i-1, N-i, 2*add)
        m += add
        M += 2 * add
    else:
        print(N-i-1, N-i, 0)
        print(N-i-1, N-i, add)
        M += add



Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int stone;
    while(cin >> stone, stone){
        int map[24][24] = {0};
        int x, y;
        x = y = 10;
        rep(i, stone){
            int a, b;
            cin >> a >> b;
            map[a][b] = 1;
        }
        int order;
        cin >> order;
        rep(i, order){
            int distance;
            char direction;
            cin >> direction >> distance;
            rep(j, distance){
                if(direction == 'N'){
                    y++;
                }else if(direction == 'E'){
                    x++;
                }else if(direction == 'S'){
                    y--;
                }else{
                    x--;
                }
                stone-= map[x][y];
                map[x][y] = 0;
            }
        }
        if(!stone) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

struct C {
    int k, l, r, diff;
};

int cmp(C &a, C &b) {
    return a.k<b.k;
}

void go() {
    int n; cin >> n;
    vector<C> c1, c2;
    ll ans = 0;

    for (int i=0;i<n;i++) {
        C t; cin >> t.k >> t.l >> t.r;
        t.k--;
        t.diff = t.l - t.r;
        if (t.diff>0) c1.pb(t); else c2.pb(t);
        ans += min(t.l, t.r);
    }

    sort(c1.begin(), c1.end(), cmp);
    sort(c2.begin(), c2.end(), cmp);
    reverse(c2.begin(), c2.end());

    priority_queue<int, vector<int>, greater<int>> pq1;
    int p = 0;
    for (int i=0;i<n;i++) {
        while (p<c1.size()&&c1[p].k<=i) {
            pq1.push(c1[p].diff);
            ans += c1[p].diff;
            p++;
        }
        while (pq1.size()>i+1) {
            ans -= pq1.top();
            pq1.pop();
        }
    }

    priority_queue<int, vector<int>, greater<int>> pq2;
    int q = 0;
    if (c2.size()) while (c2[q].k==n-1) q++;
    for (int i=0;i<n-1;i++) {
        while (q<c2.size()&&c2[q].k>=n-2-i) {
            pq2.push(-c2[q].diff);
            ans -= c2[q].diff;
            q++;
        }
        while (pq2.size()>i+1) {
            ans -= pq2.top();
            pq2.pop();
        }
    }

    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    int t; cin >> t;
    while (t--) go();
}


Measured memory_bytes: 7604
/*  .　　∧_∧
   　（ ´・ω・)
   　//＼￣￣旦＼
   ／/ ※ ＼＿＿＿＼
   ＼＼ 　※ 　※ 　※ ヽ
   　 ＼ヽ-＿_＿--＿__ヽ*/

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define vvsort(v) sort(v.begin(),v.end(),greater<int>());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
typedef priority_queue<int> pq;
typedef priority_queue<int,vector<int>,greater<int> > rpq;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
const double PI=acos(-1.0);
//-------------------------------------------------------------------------------------------------------------------------------------------//
string s;
int main(){
        cin>>s;
        int i=(int)s.length()-1;
        while(i>=0) {
                if(i>=4 && s.substr(i-4,5)=="dream") {
                        i-=5;
                }else if(i>=4 && s.substr(i-4,5)=="erase") {
                        i-=5;
                }else if(i>=6 && s.substr(i-6,7)=="dreamer") {
                        i-=7;
                }else if(i>=5 && s.substr(i-5,6)=="eraser") {
                        i-=6;
                }else{
                        cout<<"NO"<<endl;
                        return 0;
                }
        }
        if(i==-1) {
                cout<<"YES"<<endl;
        }else{
                cout<<"NO"<<endl;
        }
}


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

int main()
{
	string s;
	cin >> s;
	char a = s[0];
	char b = s[1];
	char c = s[2];
	char d = s[3];
	if (a == b&&c == d&&a != c ||
		a == c&&b == d&&a != b ||
		a == d&&b == c&&a != b)
		cout << "Yes";
	else
		cout << "No";


	return 0;
}

Measured memory_bytes: 256
let split str delim =
  let rec doit s acc =
    match
      try Some (String.index s delim)
      with _ -> None
    with
    | None -> s :: acc
    | Some i ->
        let s1 = String.sub s 0 i in
        let s2 = String.sub s (i + 1) (String.length s - String.length s1 - 1) in
        doit s2 (s1 :: acc)
  in
  List.rev (doit str [])

let make_dice = function
  | a :: b :: c :: d :: e :: f :: _ -> [(a, f); (b, e); (c, d)]
  | _ -> exit 1

let string_fold_left f init str =
  let n = String.length str in
  let rec doit i acc =
    if i >= n then acc
    else doit (i + 1) (f acc str.[i])
  in
  doit 0 init

let swap (a, b) = (b, a)

let roll dice cmd =
  match dice with
  | [] | [_] | _::_::[] -> exit 1
  | x :: y :: z :: _ ->
      match cmd with
      | 'N' -> [y; swap x; z]
      | 'S' -> [swap y; x; z]
      | 'E' -> [swap z; y; x]
      | 'W' -> [z; y; swap x]
      | _ -> exit 1

let top = function
  | [] | [_] | _::_::[] -> exit 1
  | (a, _) :: _ -> a

let () =
  let l = read_line () in
  let dice = make_dice (List.map int_of_string (split l ' ')) in
  let l = read_line () in
  let rolled = string_fold_left (fun acc c -> roll acc c) dice l in
  Printf.printf "%d\n" (top rolled)

Measured memory_bytes: 2320
#include <bits/stdc++.h>
 
using namespace std;
using LL = long long int; 

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<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.st <<","<<P.nd <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main() {
  int n;
  cin >> n;
  cout << v[n - 1];
}


Measured memory_bytes: 256
// Author := Abhishek Giri

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define V(type) vector<(type)> 
#define all(c) ((c).begin(),(c).end())
#define in(var) cin>>(var)
#define out(var) cout<<(var)
#define on(var) cout<<var<<"\n"
#define f(i,n) for(ll i = 0 ; i < n ;i++)
#define mfor(i,init,n,b) for(ll i = (init) ; i < (n) ; i+= (b))
#define cfor(i,c) for(auto i = (c).begin() ; i!= (c).end(); i++)
#define el "\n"

/*##################################################################################*/

/*
int prime[10000000] = {0} ;
void calculateprime()
{
    //calculating primes
    prime[0] = prime[1] = 1 ;
    for(int i = 2 ; (ll)i*i <= 10000000 ; i++)
    {
        if(prime[i] == 0)
        {
            for(ll j = i*i ; j <= 10000000 ; j += i )
            {
                prime[j] = 1 ;
            }
        }
    }
}
*/
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

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

ll fib(int n) 
{ 
  ll a = 0, b = 1, c, i; 
  if( n == 0) 
    return a; 
  for (i = 2; i <= n; i++) 
  { 
    c = (a + b); 
    a = b; 
    b = c; 
  } 
  return b; 
}


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



ll findgrouplcm(vector<int> &arr, int n) 
{ 
    ll ans = arr[0]; 
  
    for (ll i = 1; i < n; i++) 
        ans = (arr[i] * (ans/(gcd(arr[i], ans))));
  
    return ans; 
}


ll powerwithmod(ll x, unsigned ll y, ll p)  
{  
    ll res = 1;    
  
    x = x % p; 
   
    if (x == 0) return 0;
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
   
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;  
}
 

bool comp(const pair<ll,ll> &a , const pair<ll,ll> &b){
    return a.first > b.first;
}

void solve(){
    ll a ,b;
    in(a);char ch ;
    in(ch);
    in(b);
    if(ch == '+')   out(a+b);
    else    out(a-b);
}

int main() {
    fast();
    ll t = 1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
program sum_of_three_integers
  implicit none
  integer :: k, s, i, m = 0
  read(*,*) k, s
  do i = 0, min(k, s)
    m = m + max(0, min(k, s - i) - max(0, s - i - k) + 1)
  end do
  write(*,'(i0)') m
end program sum_of_three_integers

Measured memory_bytes: 2916
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int a = sc.nextInt();
        int s = h / a;
        if(h % a != 0){
            s++;
        }
        System.out.println(s);
        sc.close();
    }
}

Measured memory_bytes: 35648
N=int(input())
S=input()

ans=0
for i in range(1,N-1):
    a=[0]*26
    for j in range(i):
        a[ord(S[j])-97]|=1
    for j in range(i,N):
        a[ord(S[j])-97]|=2
    ans=max(ans,a.count(3))

print(ans)


Measured memory_bytes: 9112
import java.util.*;


public class Main {
    static boolean[] list;
    static int numr = 0;
    static int numw = 0;
    static int num = 0;
    static int lw = -1;
    static int rr = 0;
        public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        num = Integer.parseInt(line);
        line = sc.nextLine();
        list = new boolean[num]; //R=false,W=true

        for (int i = 0; i < num; i++){
            if (line.charAt(i) == 'R') {
                list[i] = false;
                rr = i;
                numr++;
            } else {
                list[i] = true;
                if (lw == -1) {
                    lw = i;
                }
                numw++;
            }
        }

        if (numr == 0 || numw == 0) {
            System.out.println("0");
            return ;
        }
        
        int count = 0;
        for (int i = 0; i < num - numw;i++){
            if(list[i]){
                count++;
            }
        }
        
        System.out.println(count);
    }

    public static void check() {
        for (int i = lw; i <= num - numw + 1; i++) {
            if (list[i]) {
                lw = i;
                break;
            }
        }

        for (int i = rr; i >= numr - 1; i--) {
            if (!list[i]) {
                rr = i;
                break;
            }
        }
        return;
    }
}


Measured memory_bytes: 41832
#include <iostream>
#include <algorithm>
#include<string>
#include<cmath>
#include<stack>
#include <vector>
#include<queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include<utility>
using namespace std;
using ll = long long;

int main() {
	int n, a[100000], b[100000];
	cin >> n;
	for (int i = 0; i<n/2; i++) {
		int x, y;
		cin >> x >> y;
		a[x]++;
		b[y]++;
	}
	int memoa[100000], memob[100000];
	for (int i = 0; i < 100000; i++) {
		memoa[i] = a[i];
		memob[i] = b[i];
	}
	sort(a, a + 100000);
	sort(b, b + 100000);
	int s, t;
	for (int i = 0; i < 100000; i++) {
		if (memoa[i] == a[99999] && memob[i] == b[99999]) {
			cout << n-max(a[99999] + b[99998], a[99998] + b[99999]) << endl;
			return 0;
		}
	}
	cout << n-(a[99999] + b[99999]) << endl;
	return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using li = long int;
#define pb push_back

int N, Q, val1, val2, tmp;
li sum = 0;
vector<int> A(100010, 0);

int main(){
    cin >> N;
    for(int i = 0; i < N; i++){ 
        cin >> val1;
        sum += val1;
        A[val1] += 1;
    }
  
  	cin >> Q;

    for(int i = 0; i < Q; i++){ 
        cin >> val1 >> val2;
      	sum = sum - (val1 - val2) * A[val1];
        cout << sum << endl;
      	tmp = A[val1];
      	A[val1] = 0; A[val2] += tmp;  //val2の個数はval1分増える
    }

    return 0;

}

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

int main()
{
	int H, W;
	cin >> H >> W;
	vector<string> a(H);
	for (int i = 0; i < H; i++) {
		cin >> a[i];
	}
	cout << string(W + 2, '#') << endl;
	for (int i = 0; i < H; i++) {
		cout << '#';
		cout << a[i];
		cout << '#' << endl;
	}
	cout << string(W + 2, '#') << endl;
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(int i=x;i<y;i++)
#define frr(i,x,y) for(int i=x-1;i>=y;i--)
#define inf 1e18+1
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    string s,t;
    cin>>s>>t;
    ll ct=0;
    fr(i,0,SZ(s))
    {
        if(s[i]!=t[i])
            ct++;
    }
    cout<<ct<<endl;
    return  ;
}
int main()
{
    IOS;
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
/* stuff you should look for
        * int overflow, array bounds
        * special cases (n=1?)
        * do smth instead of nothing and stay organized
        * WRITE STUFF DOWN
*/
// BITMASK:
// 1)When some constrall is of the order of 15-20, think of bitmask DP.
// 2)When some constrall is around 40, try out meet in the middle
// 3) See Strings,palindromes,prefix,suffix etc -> KMP,Z algorithm

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

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;

    vector<string> v;
    string s;
    for(int i=0;i<k;i++){
        cin >> s;
        v.push_back(s);
    }

    int min;

    for(int i=n;i<=100000;i++){
        min = i;
        bool flag = true;
        for(int j=0;j<k;j++){
            if( (to_string(i).find(v[j]) != string::npos )){
                flag = false;
            }            
        }
        if(flag) break;
    }

    cout << min;

    
}

Measured memory_bytes: 256
def LCSSolver():
    X   = raw_input()
    Y   = raw_input()
    XN  = len(X)
    YN  = len(Y)
    LaterLCS = [0 for i in range(YN+1)]

    for i in range(1, XN + 1):
        EarlierLCS = LaterLCS + []
        for j in range(1, YN + 1):
            if X[i - 1] == Y[j - 1]:
                LaterLCS[j] = EarlierLCS[j - 1] + 1
            elif EarlierLCS[j] < LaterLCS[j - 1]:
                LaterLCS[j] = LaterLCS[j - 1]
    print LaterLCS[j]

Rep = input()
for c in range(Rep):
    LCSSolver()

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

#define M 1000000
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
  return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M - 1)); }

int find(char str[]){
    int i, h;
    long long key = getKey(str);
    for (i = 0; ; i++) {
        int h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) {
            return 1;
        } else if (strlen(H[h]) == 0) {
            return 0;
        }
    }
    return 0;
}

int insert(char str[]){
    int i, h;
    long long key = getKey(str);
    for (i = 0; ; i++) {
        int h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) {
            return 1;
        } else if (strlen(H[h]) == 0) {
            strcpy(H[h], str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';

    scanf("%d", &n);

    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);

	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



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

int main(){
  int M1,D1,M2,D2;
  cin>>M1>>D1>>M2>>D2;
  if(M1 != M2){
    cout<<1<<endl;
    return 0;
  }
  cout<<0<<endl;
  return 0;
}



    

Measured memory_bytes: 3580
#include <iostream>

using namespace std;

int main()
{
int x,y;
cin >> x >> y;
if(x>y)
{
cout << "a" << " " << ">" << " " << "b" << endl;
}
else if(x==y)
{
cout << "a" << " " << "=" << "=" << " " << "b" << endl;
}
else if(x<y)
{
cout << "a" << " " << "<" << " " << "b" << endl;
}
}


Measured memory_bytes: 3080
//Unique Number
#include <iostream>

using namespace std;

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

    int A[N][3];
    for(int i = 0; i < N; i++) for(int j = 0; j < 3; j++)
            cin >> A[i][j];
    for(int k = 0; k < 3; k++) {
        for(int i = 0; i < N - 1; i++) {
            if(A[i][k] == 0) continue;
            int a = A[i][k];
            for(int j = i + 1; j < N; j++) {
                if(a == A[j][k]) {
                    A[i][k] = A[j][k] = 0;
                }
            }
        }
    }
    for(int i = 0; i < N; i++) {
        cout << (A[i][0] + A[i][1] + A[i][2]) << endl;
    }

    return 0;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <functional>
#include <string.h>

using namespace std;
typedef pair<long long, long long> P;


void solve()
{
	int A, B;
	cin >> A >> B;
	int ans = 0;
	for (int i = 0; i < 2; ++i)
	{
		if (A >= B)
		{
			ans += A;
			--A;
		}
		else
		{
			ans += B;
			--B;
		}
	}
	cout << ans << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
///   BISMILLAHIR RAHMANIR RAHEEM
///   ALLAH IS WATCHING ME
///   ALLAH save us from COVID-19.Amin.

///   █▀█─█──█──█▀█─█─█
///   █▄█─█──█──█▄█─█▄█
///   █─█─█▄─█▄─█─█─█─█

///   كُلُّ نَفْسٍ ذَآئِقَةُ الْمَوْت
///   Every soul shall taste death.

/// TODO::

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

///  order_of_key return number of elements less than x.
///  find_by_order return index.

using namespace std;
using namespace __gnu_pbds;


#define MOHAMMAD  ios::sync_with_stdio(0);cin.tie(0);
#define all(x)    (x).begin(), (x).end()
#define AE        cout << fixed << setprecision(10);

int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; // 8-direction.......
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[]= {1,-1,0,0}; // 4-direction...........
int dy4[]= {0,0,1,-1};

typedef tree< int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;

//debug
template<typename F,typename S>ostream&operator<<(ostream&os,const pair<F,S>&p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>ostream&operator<<(ostream&os,const vector<T>&v){os<<"{";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"}";}
template<typename T>ostream&operator<<(ostream&os,const set<T>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<",";os<<*it;}return os<<"]";}
template<typename T>ostream&operator<<(ostream&os,const multiset<T>&v) {os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<*it;}return os<<"]";}
template<typename F,typename S>ostream&operator<<(ostream&os,const map<F,S>&v){os<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())os<<", ";os<<it->first<<" = "<<it->second;}return os<<"]";}
#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu(){cerr << endl;}
template<typename T>void faltu(T a[],int n){for(int i=0;i<n;++i)cerr<<a[i]<<' ';cerr<<endl;}
template<typename T,typename...hello>void faltu(T arg,const hello&...rest){cerr<<arg<<' ';faltu(rest...);}
//#else
//#define dbg(args...)
//***********************************************  The END **********************************************************************************************************************************
using ll = long long;

int main()
{

  /// MOHAMMAD
 string s,t;
 cin >> s >> t;
 ll mn = 0;

 for ( ll i = 0 ; i<s.size() ; ++i ){
      if(s[i]!=t[i])mn++;
 }
 mn+=(t.size()-s.size());
 cout << mn << "\n";



}

/*





  Alhamdulillah
*/



Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define P pair<int, int>

using namespace std;
const int INF=1e5;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if((a&1)|(b&1)|(c&1)){
    cout << 0 << endl;
    return 0;
  }
  if(a==b && b==c){
    cout << -1 << endl;
    return 0;
  }
  for(int i=1;;i++){
    int ha=a/2;
    int hb=b/2;
    int hc=c/2;
    a=hb+hc;
    b=ha+hc;
    c=ha+hb;
    if((a&1)|(b&1)|(c&1)){
      cout << i << endl;
      return 0;
    }
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
using ll = long long;
#define ull unsigned ll
#define endl "\n"
#define vi vector<int>
#define vl vector<ll>
#define all(v) (v).begin(),(v).end()
#define mst(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define pll pair<ll, ll>
#define ppi pair<int, pii>
#define vpi vector<pii>
#define vpl vector<pll>
#define mt make_tuple
#define eb emplace_back
using namespace std;

const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;


void solve(){
    ll n, k;
    cin >> n >> k;
    vl a(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }
    vl cost(n);
    for(ll i = 0; i < n; i++){
        cin >> cost[i];
    }
    ll ans = -inf;
    for(ll i = 0; i < n; i++){
        vl point;
        ll j = a[i];
        ll k1 = a[j];
        point.pb(cost[j]);
        while(k1 != j){
            point.pb(cost[k1]);
            k1 = a[k1];
            ll m = point.size();
            point[m - 1] += point[m - 2];
        }
        ll m = point.size();
        if(k <= m){
            for(ll p = 0; p < k; p++){
                ans = max(ans, point[p]);
            }
        }
        else{
            for(ll p = 0; p < m; p++){
                ans = max(ans, point[p]);
                //cout << point[p] << endl;
            }
            ll times = k / m;
            ll rem = k % m;
            if(rem == 0){
                times--;
                rem = m;
            }
            ll tsum = point[m - 1] * times;
            ans = max(ans, tsum);
            
            for(ll p = 0; p < rem; p++){
                ll ttsum = tsum + point[p];
                ans = max(ans, ttsum);
                //cout << tsum << " ";
            }
        }
        //cout << endl;
    }
    //assert(ans <= inf * 4ll);
    cout << ans << endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cout.tie(0);
    /*#ifndef ONLINE_JUDGE
        freopen("Input.txt", "r", stdin);
    #endif*/
    //freopen("running_on_fumes_chapter_1_input (1).txt", "r", stdin);
    //freopen("Output.txt", "w", stdout);
    int t = 1, p;
    //cin >> t;
    for(p = 1; p <= t; p++){
        //cout << "Case #" << p << ": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rrep(i, n) for(ll i = n - 1; i > -1; i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define fi first
#define se second
#define debug(V) rep(i, V.size()) cout << V[i] << " ";
const ll INF = 1LL << 61;
const ll MOD = 1000000007 /*998244353*/;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, h, x, y, z, p, q, m, n, t, r, k, w, l, ans, i, j;
string S, T;
vl A, B;
void solve() { cout << (c * 60 + d - (a * 60 + b) + 24 * 60) % (24 * 60) - k << endl; }
int main() {
    // cout<<fixed<<setprecision(15);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c >> d >> k;
    solve();
}

Measured memory_bytes: 3652
#include<stdio.h>

int main(void){
  char s[4];
  int i,a=0,b=0,c=0;
  
   scanf("%s",s);
   for(i=0;i<3;i++){
      if(s[i]=='a')
         a++;
       if(s[i]=='b')
         b++;
       if(s[i]=='c')
         c++;
    }
   if(a==1&&b==1&&c==1){
      printf("Yes\n");
   }else{
   printf("No\n");
   }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;///0 es el turno de Taro y 1 el turno de jiro
long long  n,ans1,ans2;
vector<long long > deq;
long long  dp[3010][3010][2];

long long  recur(long long  id1,long long  id2, long long  turn){
    if(id1 == id2) return (turn == 0 ? deq[id1] : -deq[id1]);
    if(dp[id1][id2][turn] != -1) return dp[id1][id2][turn];
    else{
        if(turn == 0){
            return dp[id1][id2][turn] = max(deq[id1] + recur(id1+1,id2,1), deq[id2] + recur(id1,id2-1,1));
        }else{
            return dp[id1][id2][turn] = min(recur(id1+1,id2,0) - deq[id1],recur(id1,id2-1,0) - deq[id2]);
        }
    }
}

int main(){
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    cin>>n;
    deq.resize(n);
    memset(dp,-1,sizeof dp);
    for(long long  i = 0 ; i < n; i++) cin>>deq[i];
    cout<<recur(0,n-1,0);
}


Measured memory_bytes: 141952
#include <iostream>
#include <math.h>
using namespace std;

const int mod = 1e+9 + 7;

int main() {
    int n;
    cin >> n;

    long long a[n];
    for (int i; i < n; i++) {
        cin >> a[i];
    }

    long long ans = 0;
    long long count = 0;
    long long base = 0;
    long long pattern = 0;
    for (int i = 0; i < 60; i++) {
        base = (1ll << i) % mod;
        count = 0;
        for (int j = 0; j < n; j++) {
            if (((a[j] >> i) & 1) == 1) {
                count += 1;
            }
        }
        pattern = (count * (n - count)) % mod;
        ans += (base * pattern) % mod;
    }

    cout << (ans % mod) << '\n';

    return 0;
}

Measured memory_bytes: 2560
N = gets.to_i
P = gets.chomp.split(" ").map(&:to_i)

ans = 0
(1..N-2).each{|i|
  if P[i-1] < P[i] && P[i] <= P[i+1] then
    ans += 1
  elsif P[i+1] < P[i] && P[i] <= P[i-1] then
    ans += 1
  end
}

puts ans


Measured memory_bytes: 1788
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))
       printf("YES\n");
       else
        printf("NO\n");
    return 0;
}


Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N, cnt = 0;
map<int, int> mp;

int main(void){
	
	scanf("%d", &N);
	for(int i = 0; i < N; ++i){
	    int a; scanf("%d", &a);
	    ++mp[a];
	}
	
	for(auto m : mp){
	    if(m.first > m.second) cnt += m.second;
	    else cnt += m.second - m.first;
	}
	
	printf("%d\n", cnt);
	
    return 0;
}


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

int top;
int S[1000];

int pop()
{
	top--;
	return S[top+1];
}

void push(int x)
{
	top++;
	S[top] = x;
	return;
}

int main()
{
	int a,b;
	top = 0;

	string ope;
	while (cin >> ope) {

		if (ope[0] == '+') {
			a = pop();
			b = pop();
			push(a+b);
		} else if (ope[0] == '-') {
			a = pop();
			b = pop();
			push(b-a);
		} else if (ope[0] == '*') {
			a = pop();
			b = pop();
			push(a*b);
		} else {
			push(atoi(ope.c_str()));
		}
	}

	cout << pop() << '\n';

	return 0;
}


Measured memory_bytes: 3212
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
using namespace std;

int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> score(N, 0);
    for(int i = 0; i < Q; ++i)
    {
        int p;
        cin >> p;
        score[p - 1] += 1;
    }

    for(auto s : score)
    {
        if(s + K - Q > 0)
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}


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

int main(){
  int N;
  cin>>N;
  int a=N%10;
  int b=N%100-a;
  int c=N-b-a;
  if(a==7||b==70||c==700){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
 
/*------------------------------------------------------------------*/
 
int main(){
    string s; cin >> s;
    if(s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    int n;
    cin >> n;
    bool works = true;
    FOR(i, 0, n) {
        int x;
        cin >> x;
        if (x % 2 == 0) {
            works &= (x % 3 == 0) || (x % 5 == 0);
        }
    }
    cout << (works ? "APPROVED" : "DENIED");
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting, graph is not a tree/connected
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


Measured memory_bytes: 256
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 310
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

int a[maxn * 2], n, cnt = 0;
ll f[maxn * 2][maxn][maxn], ans = 0;
const ll p = 1e9 + 7;
bool vis[maxn * 2], ban[maxn * 2];
template <class T> void read(T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
void upd(ll &x, const ll &y) {
  x = (x + y) % p;
}
int main() {
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) {
    cin >> a[i];
    if (~a[i])
      vis[a[i]] = true;
  }
  for (int i = 1; i <= n; i++) {
    if (~a[2 * i - 1] && ~a[2 * i])
      ban[a[2 * i - 1]] = ban[a[2 * i]] = true;
    else if (!~a[2 * i - 1] && !~a[2 * i])
      cnt++;
  }
  f[2 * n + 1][0][0] = 1;
  for (int i = 2 * n; i; i--) {
    if (ban[i]) {
      memcpy(f[i], f[i + 1], sizeof(f[i + 1]));
      continue;
    }
    if (!vis[i]) {
      for (int j = 0; j <= n; j++) {
        for (int k = 0; k <= n; k++) {
          if (j)
            upd(f[i][j][k], f[i + 1][j - 1][k]);
          upd(f[i][j][k], f[i + 1][j + 1][k]);
          upd(f[i][j][k], f[i + 1][j][k + 1] * (k + 1));
        }
      }
    } else {
      for (int j = 0; j <= n; j++) {
        for (int k = 0; k <= n; k++) {
          if (k)
            upd(f[i][j][k], f[i + 1][j][k - 1]);
          upd(f[i][j][k], f[i + 1][j + 1][k]);
        }
      }
    }
  }
  ans = f[1][0][0];
  for (int i = 1; i <= cnt; i++) {
    ans = ans * i % p;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 452096
#include <stdio.h>
    #include <string.h>
    #include <algorithm>
    using namespace std;
     
    char str[2][105];
    int N;
     
    int main() {
    	scanf("%d %s %s", &N, str[0], str[1]);
    	for(int l = N; ~l; l--) {
    		bool flag = false;
    		for(int i = 0; i < l; i++)
    			if(str[0][N+i-l] != str[1][i]) {
    				flag = true; break;
    			}
    		if(flag) continue;
    		printf("%d\n", 2*N-l);
    		return 0;
    	}
    	return 0;
    }

Measured memory_bytes: 128
S = input()
if S == 'SAT': print(1)
elif S == 'SUN': print(7)
elif S == 'MON': print(6)
elif S == 'TUE': print(5)
elif S == 'WED': print(4)
elif S == 'THU': print(3)
elif S == 'FRI': print(2)


Measured memory_bytes: 2940