akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<algorithm>
using namespace std;
 int main()
{
 char s[10];
 scanf("%s", s);
 if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3])printf("Yes\n");
 else if(s[0] == s[2] && s[2] != s[1] && s[1] == s[3])printf("Yes\n");
 else if(s[0] == s[3] && s[3] != s[1] && s[1] == s[2])printf("Yes\n");
 else printf("No\n");
 }

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  ll ma = 0;
  ll ans = 0;
  for(int i=0;i<n;i++){
    ll a;cin>>a;
    ma = max(a,ma);
    ans += ma-a;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3560
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int N, A, B, C, D;
string S;

bool solve() {
  bool s_flag = false;
  for (int i = A + 1; i < D; i++) {
    if (S[i] == '#') {
      if (s_flag) {
        return false;
      }
      s_flag = true;
    } else {
      s_flag = false;
    }
  }

  if (C > D) {
    bool ok = false;
    int d_num = 0;
    for (int i = B - 1; i < D + 2; i++) {
      if (S[i] == '.') {
        d_num++;
        if (d_num == 3) {
          ok = true;
          break;
        }
      } else {
        d_num = 0;
      }
    }
    if (!ok) {
      return false;
    }
  }

  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> A >> B >> C >> D;
  cin >> S;
  A--;
  B--;
  C--;
  D--;

  if (solve()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;                                                            
#define pb push_back                                                            
#define mp make_pair                                                                                                                                
#define sqr(a) ((a) * (a))                                                      
#define io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);   
#define co() cout.precision(10);                                                
#define F for(li i=0;i<n;i++)
#define fo(i,a,n) for(i=a;i<n;i++)
#define ne cout<<"\n"; 
#define test int t;cin>>t;while(t--)
//#define oj #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif

typedef long long li;
typedef long double ld;

const li mod = 1000000007;

 
int main()
{
    io();
    li n;
    cin>>n;
    li a[n+1],i,c=0;
    fo(i,1,n+1)
    {	cin>>a[i];if(i%2 && a[i]%2)c++;}
    cout<<c;
}

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


int main() {
	int n;
	cin >> n;
	vector<ll>x(n);
	vector<int>y(n);
	rep(i, n) {
		cin >> x[i];
		y[i] = x[i];
	}
	sort(x.begin(), x.end());
	ll bottom = x[n / 2 - 1];
	ll upper = x[n / 2];
	rep(i, n) {
		if (y[i] <= bottom) {
			cout << upper << endl;
		}
		else cout << bottom << endl;
	}
	return 0;
}


Measured memory_bytes: 4480
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;

    int ans=0;
    for(int i=0;i<n;i++){
        int count=0;
        for(int j=0;i+j<n;j++){
            if(s[i+j]==t[j])count++;
            else{
                count=0;
                break;
            }
        }
        if(count!=0){
            ans=count;
            break;
        }
    }

    cout << s.size()+t.size()-ans << endl;

    return 0;
}


Measured memory_bytes: 3560
n = gets.to_i
c = gets.chomp.split('')

w = 0
r = c.size-1

cnt = 0
while w < r
  if c[w] == 'W' && c[r] == 'R'
    cnt += 1
    w += 1
    r -= 1
  elsif c[w] != 'W'
    w += 1
  elsif c[r] != 'R'
    r -= 1
  end
end

puts cnt

Measured memory_bytes: 30600
#include<iostream>
#include<vector>
#include<utility>
#include<math.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int> > vp;

#define pb push_back
#define inf 999999999
#define rep(i, n) for(int i = 0; i < n; i++)
#define For(i, a, n) for(int i = a; i < n; i++)
#define out(n) cout << n << endl;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  out((b - a == c - b ? "YES" : "NO"))
}


Measured memory_bytes: 256
Module Module1

    Sub Main()

        Dim N As Integer = Console.ReadLine()
        Dim i As Integer
        Dim ans As String

        ans = "No"
        If 1 <= N AndAlso N <= 81 Then
            For i = 9 To 1 Step -1
                If N \ i <= 9 AndAlso N Mod i = 0 Then
                    ans = "Yes"
                    Exit For
                End If
            Next
        End If

        Console.WriteLine(ans)
        'Console.Read()

    End Sub

End Module


Measured memory_bytes: 13140
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;
const string YES = "Yes";
const string NO = "No";
bool isSame(deque<char> a, string b){
    ll i=0;
    for(auto x: a){
        if(x != b.at(i))
            return false;
        i++;
    }
    return true;
}

void solve(std::string S, std::string T){
    deque<char> que;
    rep(i, S.length()){
        que.push_back(S[i]);
    }
    rep(i, S.length()){
        if(isSame(que, T)){
            cout << YES << endl;
            return;
        }
        char tmp = que.back();
        que.pop_back(); que.push_front(tmp);
    }
    cout << NO << endl;

}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>    //C++の標準ライブラリのヘッダを全て読み込む

#define _GLIBCXX_DEBUG

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

    int n, height = 0, max = 0;
    cin >> n;
    vector<int> mochi (n);
    for(int i=0; i < n; i++){
        cin >> mochi.at(i);
    }

    std::vector<int>::iterator iter = std::max_element(mochi.begin(), mochi.end());
    size_t index = std::distance(mochi.begin(), iter);
    do{
        if(max <= mochi.at(index) && mochi.at(index) != 0){
            height += (max == 0) ? 1 : 0;
            max = mochi.at(index);
            mochi.at(index) = 0;
        } else {
            max = 0;
        }
        
        iter = std::max_element(mochi.begin(), mochi.end());
        index = std::distance(mochi.begin(), iter);
    }while(mochi.at(index) != 0);

    cout << height << endl;
}

Measured memory_bytes: 256
import java.util.*;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		int N = Integer.parseInt(in.readLine());
		String[] tokens = in.readLine().split(" ");
		int[] B = new int[N - 1];
		for (int i = 0; i < N - 1; ++i) {
			B[i] = Integer.parseInt(tokens[i]);
		}
		int[] A = new int[N];
		A[0] = B[0];
		A[N - 1] = B[N - 2];
		for (int i = 1; i < N - 1; ++i) {
			A[i] = Math.min(B[i - 1], B[i]);
		}
		long result = 0L;
		for (int i = 0; i < N; ++i) {
			result += A[i];
		}
		System.out.println(result);
	}

}


Measured memory_bytes: 21972
#include <iostream>
#include <cmath>

int main()
{
    int n, median, res = 0;
    int sum = 0;
    std::cin >> n;

    int arr[n];

    for(int i = 0; i < n; i++)
    {
        std::cin >> arr[i];
        sum += arr[i];
    }

    median = round(double(sum)/n);

    for(int i = 0; i < n; i++)
    {
        res += pow((arr[i] - median), 2);
    }

    std::cout << res << std::endl;

    return 0;
}


Measured memory_bytes: 384
#include"bits/stdc++.h"
using namespace std;

int main() {
  vector<char> vec;
  string s;
  int q;
  cin >> s;
  cin >> q;

  int reverseCount = 0;
  for(int i = 0; i < s.length(); i++) {
    vec.push_back(s[i]);
  }

  for(int i = 0; i < q; i++) {
    int t;
    cin >> t;
    if(t == 1) {
      reverseCount++;
    } else {
      int f;
      string c;
      cin >> f >> c;
      if(reverseCount % 2 == 1) {
        if(f == 1) {
          f = 2;
        } else {
          f = 1;
        }
      }
      if(f == 1) {
        vec.insert(vec.begin(), c[0]);
      } else {
        vec.push_back(c[0]);
      }
    }
  }

  if(reverseCount % 2 == 1) {
    reverse(vec.begin(), vec.end());
  }

  for (auto c : vec) {
    cout << c;
  }
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b,a) for(int i=b;i>=a;i--)
#define fori(a) for(auto i : a )
#define all(a) begin(a), end(a)
#define set(a,b) memset(a,b,sizeof(a))
#define sz(a) a.size()
#define pi 3.14159
#define ll long long
#define ull unsigned long long
#define pb push_back
#define PF push_front //deque
#define mp make_pair
#define pq priority_queue
#define mod 1000000007
#define f first
#define s second
#define pii pair< int, int >
#define vi vector<int>
#define vpii vector<pii>
#define debug(v) for(auto i:v) cout<<i<<" ";
#define tc int t; cin >> t; while(t--)

using namespace std;
string repeat(string s, int n) {
    string s1 = "";
    for (int i=0; i<n;i++)
        s1+=s;
    return s1;
}
string getString(char x) {
    string s(1, x);
    return s;
}

void optimizeIO(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int gcd(int a, int b){
    if (a == 0)  return b;
    return gcd(b % a, a);
}
void solve(){
  string s;
  cin>>s;
  ll ans=0;
  for(auto i:s){
    ans+= (i-'0');
  }
  if(ans%9==0) cout<<"Yes\n";
  else cout<<"No\n";
}
int main(){
    optimizeIO();
    // tc
    { solve();
    }
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/


signed main(){
  int x,y;
  cin>>x>>y;

  if(y-2*x>=0&&y%2==0&&4*x-y>=0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;

  }

  return 0;
}


Measured memory_bytes: 3620
S = input()
A = int(S[0]+S[1])
B = int(S[2]+S[3])
if 0 < A <= 12:
    if 0 < B <= 12:
        print('AMBIGUOUS')

    else:
        print('MMYY')

elif A > 12 or A == 0:
    if 0 < B <= 12:
        print('YYMM')

    else:
        print('NA')

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

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

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

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

    int a[5];
    rep(i, 5)
    {
        int tmp;
        cin >>  tmp;
        if(tmp==0)
        {
            cout << i+1 << endl;
        }
    }



    return 0;
}



Measured memory_bytes: 3536
check :: String -> Bool
check [] = True
check [s] = s `elem` "RUD"
check (s1:s2:ss)
  | s1 `elem` "RUD" && s2 `elem` "LUD" = check ss
  | otherwise = False

main :: IO ()
main = do
  s <- getLine
  putStrLn $ if check s then "Yes" else "No"

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

const int inf = 1e9;
const ll linf = 1e18;

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

    int n, m; cin >> n >> m;
    vector<bool> ac(n, false);
    vector<int> pen(n, 0);
    for (int i = 0; i < m; i++) {
        int p; cin >> p; p--;
        string s; cin >> s;
        if (s == "AC") ac[p] = true;
        if (s == "WA" && !ac[p]) pen[p]++;
    }
    int acs = 0, pens = 0;
    for (int i = 0; i < n; i++) if (ac[i]) acs++;
    for (int i = 0; i < n; i++) if (ac[i]) pens += pen[i];
    cout << acs << " " << pens << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1)
        a=a+13;
        if(b==1)
            b=b+13;
    if(a>b)
        cout<<"Alice"<<endl;
        else if(a<b)
            cout<<"Bob"<<endl;


    else
        cout<<"Draw"<<endl;


}


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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    int U1[10] = {}, U2[100] = {}, U3[1000] = {};
    for (int i = 0; i < N; ++i) {
        int s = S.at(i) - '0';
        for (int t = 0; t < 100; ++t) {
            if (U2[t] > 0)
                ++U3[10 * t + s];
        }
        for (int t = 0; t < 10; ++t) {
            if (U1[t] > 0)
                ++U2[10 * t + s];
        }
        ++U1[s];
    }
    int cnt = 0;
    for (int t = 0; t < 1000; ++t) {
        if (U3[t] > 0)
            ++cnt;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3668
/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

template<class T>
inline T read(T &a){
    register T x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
    return a = x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

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

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 

const int maxn = 2000;
int a[maxn], x;
int n;
int main() {
	read(x); read(n);
	For (i, 1, n) read(a[i]);
	for (int i = 0; i <= 200; i++) {
		int ok1 = 0, ok2 = 0;
		for (int j = 1; j <= n; j++) {
			if (a[j] == x + i) ok1 = 1;
			if (a[j] == x - i) ok2 = 1;
		}
		if (ok2 == 0) {
			cout << x - i << endl;
			return 0;
		}
		else if (ok1 == 0) {
			cout << x + i << endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3644
#include <cstdio>

const int MaxN = 200000 + 5;

int N;
long long C;
int H[MaxN];
long long F[MaxN], G[MaxN];

void init() {
  scanf("%d %lld", &N, &C);
  for (int i = 1; i <= N; ++i) scanf("%d", &H[i]);
}

inline double getK(int i, int j) {
  return 1.0 * (G[i] - G[j]) / (H[i] - H[j]);
}

void solve() {
  static int que[MaxN];
  int head = 1, tail = 0;
  F[1] = 0;
  G[1] = F[1] + 1LL * H[1] * H[1];
  que[++tail] = 1;
  for (int i = 2; i <= N; ++i) {
    while (head < tail && getK(que[head], que[head + 1]) < 2 * H[i]) head++;
    int j = que[head];
    F[i] = F[j] + 1LL * (H[i] - H[j]) * (H[i] - H[j]) + C;
    G[i] = F[i] + 1LL * H[i] * H[i];
    while (head < tail && getK(que[tail - 1], que[tail]) > getK(que[tail], i)) tail--;
    que[++tail] = i;
  }
  printf("%lld\n", F[N]);
}

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

Measured memory_bytes: 4864
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
long long MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    int blue=0,red=0;
    REP(i,s.length()) {
        if(s[i]=='R') ++red;
        else ++blue;
    }
    if(blue < red) cout << "Yes";
    else cout << "No";
    return 0;
}

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

int main() {
  string S;
  cin >> S;
  int count=0;
  int nagasa=0;
  char A='A';
  char T='T';
  char C='C';
  char G='G';
  for (int i=0; i < S.size() ; i++){
    if (S.at(i)==A || S.at(i)==T || S.at(i)==C || S.at(i)==G){
      count=count+1;
    }
    else {
      nagasa = max(count,nagasa);
      count = 0 ;
    }
  }
  nagasa =max(count,nagasa);
    cout << nagasa << endl;
}



Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = dict()
for _ in range(M):
    a, b = map(int, input().split())
    if a not in AB:
        AB[a] = [H[b-1]]
    else:
        AB[a].append(H[b-1])

    if b not in AB:
        AB[b] = [H[a-1]]
    else:
        AB[b].append(H[a-1])

cnt = 0
for n in range(1, N+1):
    if (n not in AB.keys()) or (max(AB[n]) < H[n-1]):
        cnt += 1

print(cnt)


Measured memory_bytes: 28312
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define N 4e7
#define nl "\n"
#define f first
#define s second
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back


typedef long long ll;
typedef double db;

using namespace std;

int main()
{
    io;
    //freopen("in.txt" , "r" , stdin);
    //freopen("out.txt" , "w" , stdout);

    ///Let the showdown begin

    int n,x,t;
    cin >> n >> x >> t;

    ll temp = 0;
    int index;
    for(int i=1 ; i ; i++)
    {
        temp = temp+x;
        if(temp >= n){
            index = i;
            break;
        }
    }
    cout << index*t << nl;

    ///Happily DONE
    return 0;
}


Measured memory_bytes: 3616
#include<iostream>
#include <string>

using namespace std;
int main(){
    string abcd;
    cin>>abcd;
    int A[4];
    for(int i=0;i<4;i++) A[i]=abcd[i]-'0';
    for(int i=0; i<(1<<3);++i){
        int sum=0;
        string S[5];
        for (int j=0;j<4;++j){
            if((i & (1<<(3-j))) == 0){
                sum+=A[j];
                S[j]="+";
            }else{
                sum-=A[j];
                S[j]="-";
            }
        }
        //cout <<"sum="<<sum<<endl;
        if(sum==7){
            S[4]="=7";
            for(int i=0;i<4;i++)cout <<A[i]<<S[i+1];
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 20, M = (1 << 12);
string s[N];
char lx[N][N];

int n, m, p[N];

bool check(int x, int y) {
  for(int i = 1; i <= n; ++i)
    if(lx[i][x] != lx[p[i]][y]) return false;
  return true;
}

bool in(int x, int y) {
  return (x >> y) & 1;
}

bool b[N][N], f[M];
void dfsc(int flg) {
//  puts("hello");
  for(int i = 1; i <= m; ++i)
    for(int j = i; j <= m; ++j)
      b[i][j] = check(i, j);
  memset(f, false, sizeof f);
  int tot = (1 << m) - 1;
  f[0] = 1;
  for(int i = 0; i <= tot; ++i) {
    if(!f[i]) continue;
    for(int j = 0; j < m; ++j)
      for(int k = j + 1; k < m; ++k) {
        if(in(i, j) || in(i, k) || !b[j + 1][k + 1]) continue;
        f[i | (1 << j) | (1 << k)] = 1;
      }
  }
/*  for(int i = 1; i <= m; ++i) 
    for(int j = i; j <= m; ++j) {
      if(b[i][j]) printf("%d %d\n", i, j);
  }
  for(int i = 0; i <= tot; ++i)
    if(f[i]) printf("f[%d]\n", i);*/
  if(!flg) {
    if(f[tot]) {
      puts("YES");
      exit(0);
    }
  } else {
    for(int i = 1; i <= m; ++i) {
      if(!b[i][i]) continue;
      if(f[tot ^ (1 << (i - 1))]) {
        puts("YES");
        exit(0);
      }
    }
  }
}

void dfsr(int dep, int flg) {
  if(dep > n) {
    dfsc(m & 1);
    return ;
  } else if(p[dep] != -1) {
    dfsr(dep + 1, flg); 
  } else {
    for(int i = dep + 1; i <= n; ++i) {
      if(p[i] == -1 && s[i] == s[dep]) {
        p[i] = dep, p[dep] = i;
        dfsr(dep + 1, flg);
        p[i] = p[dep] = -1;
      }
    }
    if(flg) {
      p[dep] = dep;
      dfsr(dep + 1, 0);
      p[dep] = -1;
    }
  }
}

int main() {
  scanf("%d%d", &n, &m);
  for(int i = 1; i <= n; ++i) {
    scanf("%s", lx[i] + 1);
    for(int j = 1; j <= m; ++j)
      s[i] += lx[i][j];
    sort(s[i].begin(), s[i].end());    
  }  
  memset(p, -1, sizeof p);
  dfsr(1, n & 1);
  puts("NO");  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef unsigned long long ull;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main() {
    int n;
    cin>>n;
    rep(i,0,n){
        int out=0;
        int score=0;
        int runner=0;
        string s;
        while(out!=3){
            cin>>s;
            if(s=="HIT"){
                if(runner==3)score++;
                else runner++;
            }else if(s=="OUT"){
                out++;
            }else{
                score+=runner+1;
                runner=0;
            }
        }
        cout<<score<<endl;
    }
    return 0;
}




Measured memory_bytes: 3144
S = input()
l = len(S)
dp = [[0] * 13 for _ in range(l+1)]
dp[0][0] = 1
MOD = 10 ** 9 + 7
mul = 1
for i in range(l):
    if S[-(i+1)] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(j * mul + k) % 13] += dp[i][k]
                dp[i+1][(j * mul + k) % 13] %= MOD
    else:
        j = int(S[-(i+1)])
        for k in range(13):
            dp[i+1][(j * mul + k) % 13] += dp[i][k]
            dp[i+1][(j * mul + k) % 13] %= MOD
    mul = mul * 10 % 13
print(dp[l][5])

Measured memory_bytes: 62300
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int N = 101010;
int n , x , a[N];

int main(){
    cin >> n >> x;
    rep(i,0,n) cin >> a[i];
    ll ans = 0;
    if(a[0] > x) ans += a[0] - x , a[0] = x;
    rep(i,1,n)
        if(a[i] + a[i-1] > x)
            ans += a[i] - (x - a[i-1]) , a[i] = x - a[i-1];
    cout << ans << endl;
    return 0;
}


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

template <typename T, typename D>
struct ReRooting {
  using L = function<T(T, D)>;
  using M = function<T(T, T)>;
  struct Edge {
    int to;
    D data;
    Edge(int to, D data) : to(to), data(data) {}
  };
  int n;
  vector<vector<Edge>> edges;
  L lift;
  M merge;
  T e;
  vector<vector<T>> dp;
  vector<int> par;
  int ans;
  ReRooting(int n, L lift, M merge, T e) : n(n), lift(lift), merge(merge), e(e) {
    edges = vector<vector<Edge>>(n);
  }
  void add_edge(int v, int u, D d) {
    edges[v].emplace_back(u, d);
  }
  T dfs(int v = 0, int p = -1) {
    int l = edges[v].size();
    dp[v] = vector<T>(l);
    T ret = e;
    for (int i = 0; i < l; i++) {
      auto e = edges[v][i];
      if (e.to == p) {
        par[v] = i;
        continue;
      }
      dp[v][i] = lift(dfs(e.to, v), e.data);
      ret = merge(ret, dp[v][i]);
    }
    return ret;
  }
  void bfs(int v, T t) {
    if (par[v] != -1) {
      dp[v][par[v]] = lift(t, edges[v][par[v]].data);
    }
    int l = edges[v].size();
    vector<T> dpl(l + 1, e);
    vector<T> dpr(l + 1, e);
    for (int i = 0; i < l; i++) {
      dpl[i + 1] = merge(dpl[i], dp[v][i]);
    }
    for (int i = l - 1; i >= 0; i--) {
      dpr[i] = merge(dpr[i + 1], dp[v][i]);
    }

    int fst = 0, snd = 0;
    for (int i = 0; i < l; i++) {
      if (fst <= dp[v][i]) {
        snd = fst, fst = dp[v][i];
      } else if (snd <= dp[v][i]) {
        snd = dp[v][i];
      }
    }
    ans = max(ans, fst + snd);

    for (int i = 0; i < l; i++) {
      if (i == par[v]) continue;
      int u = edges[v][i].to;
      bfs(u, merge(dpl[i], dpr[i + 1]));
    }
  }
  int solve() {
    dp = vector<vector<T>>(n);
    par = vector<int>(n, -1);
    ans = 0;
    dfs();
    bfs(0, e);
    return ans;
  }
};

int main() {
  auto lift = [](int a, int w) {
    return a + w;
  };
  auto merge = [](int a, int b) {
    return max(a, b);
  };
  int N; cin >> N;
  auto g = ReRooting<int, int>(N, lift, merge, 0);
  for (int i = 1; i < N; i++) {
    int s, t, w; cin >> s >> t >> w;
    g.add_edge(s, t, w);
  }
  cout << g.solve() << '\n';
  return 0;
}



Measured memory_bytes: 31232
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

const int N = 22;
int n, m;
int a[N][N], b[N][N];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

int solve(int x, int y) {
  if (a[x][y]) return -1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      //~ b[i][j] = a[i][j];
      b[i][j] = -1;
    }
  }
  queue<pair<int,int>> q;
  auto go = [&](int x1, int y1, int val) {
    if (x1 < 0 or x1 >= n or y1 < 0 or y1 >= m or a[x1][y1] or b[x1][y1] != -1) return;
    b[x1][y1] = val;
    q.push({x1, y1});
  };
  
  q.push({x, y});
  b[x][y] = 0;
  while (!q.empty()) {
    int u = q.front().first, v = q.front().second;
    q.pop();
    for (int i = 0; i < 4; ++i) {
      go(u + dx[i], v + dy[i], 1 + b[u][v]);
    }
  }
  int res = -1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      uax(res, b[i][j]);
    }
  }
  return res;
}

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  cin >> n >> m;
  for (int i = 0; i < n; ++i){
    string s; cin >> s;
    for (int j = 0; j < m; ++j) {
      a[i][j] = s[j] == '#';
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      uax(ans, solve(i, j));
    }
  }
  kek(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  size_t n;
  cin >> n;
  vector <ll> d (n);
  rep (i, n) cin >> d [i];

  ll ans = 0;
  rep (i, n) rep (j, i)
  {
    ans += d [i] * d [j];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
from collections import Counter


def solve(n, arr):
    if arr[0] != 0:
        return 0

    c = Counter(arr)

    if c[0] != 1:
        return 0
    max_c = max(c)
    for i in range(max_c + 1):
        if i not in c:
            return 0

    c = list(c.items())
    c.sort()

    prev = 1
    ans = 1
    mod = 998244353

    for _, i in c[1:]:
        ans *= pow(prev, i) % mod
        ans %= mod
        prev = i

    return ans


n = int(input())
arr = list(map(int, input().split()))

print(solve(n, arr))

Measured memory_bytes: 21468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,p[214514];
	cin>>n;
	for(int i=0;i<n;i++)cin>>p[i];
	ll mi=n+1,ans=0;
	for(int i=0;i<n;i++){
		if(p[i]<mi){
			ans++;
			mi=p[i];
		}
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 1792
// C++ program to illustrate Edge Coloring 
#include <bits/stdc++.h> 
using namespace std; 

// function to determine the edge colors 
void colorEdges(int ptr, vector<vector<pair<int, int> > >& gra, 
				vector<int>& edgeColors, bool isVisited[]) 
{ 
	queue<int> q; 
	int c = 0; 

	set<int> colored; 

	// return if isVisited[ptr] is true 
	if (isVisited[ptr]) 
		return; 

	// Mark the current node visited 
	isVisited[ptr] = 1; 

	// Traverse all edges of current vertex 
	for (int i = 0; i < gra[ptr].size(); i++) { 
		// if already colored, insert it into the set 
		if (edgeColors[gra[ptr][i].second] != -1) 
			colored.insert(edgeColors[gra[ptr][i].second]); 
	} 

	for (int i = 0; i < gra[ptr].size(); i++) { 
		// if not visited, inset into the queue 
		if (!isVisited[gra[ptr][i].first]) 
			q.push(gra[ptr][i].first); 

		if (edgeColors[gra[ptr][i].second] == -1) { 
			// if col vector -> negative 
			while (colored.find(c) != colored.end()) 

				// increment the color 
				c++; 

			// copy it in the vector 
			edgeColors[gra[ptr][i].second] = c; 

			// then add it to the set 
			colored.insert(c); 
			c++; 
		} 
	} 
	while (!q.empty()) { 
		int temp = q.front(); 
		q.pop(); 

		colorEdges(temp, gra, edgeColors, isVisited); 
	} 

	return; 
} 

// Driver Function 
int main() 
{ 
	set<int> empty; 

	// declaring vector of vector of pairs, to define Graph 
	vector<vector<pair<int, int> > > gra; 

	vector<int> edgeColors; 

	bool isVisited[100000] = { 0 }; 

	// Enter the Number of Vertices 
	// and the number of edges 
	int ver = 4; 
	int edge = 4;
	int x,y;
    cin>>ver;
    edge=ver-1;
	gra.resize(ver); 
	edgeColors.resize(edge, -1); 
	for(int i=0;i<ver-1;i++){
	    cin>>x>>y;
	    x--;
	    y--;
	    gra[x].push_back(make_pair(y, i)); 
        gra[y].push_back(make_pair(x, i)); 
	}
	colorEdges(0, gra, edgeColors, isVisited); 

	set<int>st; 
	for (int i = 0; i < edge; i++) 
	    st.insert(edgeColors[i] + 1);
	cout<<st.size()<<endl;
	for (int i = 0; i < edge; i++) 
		cout<<edgeColors[i] + 1 << "\n"; 

	return 0; 
} 


Measured memory_bytes: 60416
using System;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int[] read = inta();
        long a = read[0];
        long b = read[1];
        int k = 0;
        while(a > 0){
            a/=b;
            k++;
        }
        WriteLine(k);
    
    
    
    
    
    
    }
    //各種読取
    static string rstr(){
        return ReadLine();
    }
    static int rint(){
        return int.Parse(ReadLine());
    }
    static long rlong(){
        return long.Parse(ReadLine());
    }
    static string[] stra(){
        return ReadLine().Split(' ');
    }
    static int[] inta(){
        string[] read_str_array = ReadLine().Split(' ');
        int[] return_int_array = new int[read_str_array.Length];
        for(int countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
        }
        return return_int_array;
    }
    static int[,] inta2(int num_array,int in_array){
        int[,] int_array2 = new int[num_array,in_array];
        for(int i=0;i<num_array;i++){
            int[] temp_array = inta();
            for(int j=0;j<in_array;j++){
                int_array2[i,j] = temp_array[j];
            }
        }
        return int_array2;
    }
    // A/B小数点以下切上
    static int divideup(int divided,int divid){
        int temp_divide = divided/divid;
        if(divided % divid > 0){
            temp_divide++;
        }
        return temp_divide;
    }
}


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

#define AndIamIronMan ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
 
using namespace std;
 
typedef  long long int lli; 

int main(){
    
    lli i,x,j,k,n,y,m,t,a,b; 	
    AndIamIronMan;
//    cin>>t;
//    while(t--){
	cin>>a;
	cout<<a+(a*a)+(a*a*a);	
//	}
	return 0;
}


Measured memory_bytes: 3644
fun main(args:Array<String>){
  var n = readLine()!!.toInt()
  var h = readLine()!!.split(" ").map(String::toInt).toIntArray()
  var count = 0
  var a = h[0]
  for(i in 0..n-1){
    var b = h[i]
    if(a <= b){
      count++
      a = h[i]
    }
  }
  println(count)
}

Measured memory_bytes: 37788
import           Control.Monad
import qualified Data.Array.IO               as IO
import           Data.Bits
import qualified Data.ByteString.Char8       as BS
import           Data.Char
import           Data.Foldable
import           Data.List
import           Data.Maybe
import qualified Data.Sequence               as Seq
import qualified Data.Vector.Unboxed         as V
import qualified Data.Vector.Unboxed.Mutable as VM
import           Debug.Trace

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntVec n = V.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

readInteger = fst . fromJust . BS.readInteger
readIntegerList = map readInteger . BS.words
getInteger = readInteger <$> BS.getLine
getIntegerList = readIntegerList <$> BS.getLine

main = do
  k <- getInt

  arr <- IO.newArray ((1,1,1),(k,k,k)) (-1::Int) :: IO (IO.IOUArray (Int, Int, Int) Int)

  let gcd3 :: Int -> Int -> Int -> IO Int
      gcd3 x y z = do
        let [u, v, w] = sort [x, y, z]
        t <- IO.readArray arr (u, v, w)
        if t > 0
          then return t
          else do let a = gcd u (gcd v w)
                  IO.writeArray arr (u, v, w) a
                  return a

      solve :: Int -> Int -> Int -> Int -> IO Int
      solve x y z res | x == k && y == k && z == k = do g <- gcd3 x y z
                                                        return (res + g)
                      | y == k && z == k           = do g <- gcd3 x y z
                                                        solve (x+1) 1 1 (res + g)
                      | z == k                     = do g <- gcd3 x y z
                                                        solve x (y+1) 1 (res + g)
                      | otherwise                  = do g <- gcd3 x y z
                                                        solve x y (z+1) (res + g)

  ans <- solve 1 1 1 0
  print ans

Measured memory_bytes: 692920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll N, ans;

int main()
{
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    ll sum = 0, xr = 0, right = 0;
    for (int left = 0; left < N; left++)
    {
        while (right < N && (sum + A[right] == (xr ^ A[right])))
        {
            ans += (right - left + 1);
            sum += A[right], xr ^= A[right];
            right++;
        }
        if (right == left)
            right++;
        else
            sum -= A[left], xr ^= A[left];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS

#include<fstream>
#include<iostream>
#include<string>
#include<iomanip>
#include<list>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

void call(int n) {
	int i = 1;
	
	while (true) {
		int x = i;
		bool flag = true;
		if (x % 3 == 0) {
			cout << " " << i;
			flag = false;
		}
		while (flag) {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}
			x /= 10;
			if (!x) {
				break;
			}
		}
		if (++i > n) {
			break;
		}
	}
	cout << endl;
}

int main(int argc, char **argv){
	int room[4][3][10] = {0};
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		room[b - 1][f - 1][r - 1] += v;
	}
	for (int i = 0; i < 4; i++) {
		if (i != 0) {
			cout << "####################" << endl;
		}
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {
				cout << " " << room[i][j][k];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>

using namespace std;

int main(){
    int W,H,x,y,r;
    cin>>W>>H>>x>>y>>r;
    if((x>=r) && (x<= W-r) && (y>=r) &&( y<=H-r)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


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

int main() {
    string s;
    cin >> s;
    int i=0;
    while(s[i]!='A') ++i;
    int k=i;
    i=s.size() - 1;
    while(s[i]!='Z') --i;
    cout << i-k+1 <<endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
int n;
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	

	cin>>n;
	for(int i=0;i<n;i++){
		priority_queue <int > dp;
		for(int i=0;i<3;i++){
			int k;
			cin>>k;
			dp.push(k);
		}
		int a=dp.top();dp.pop();
		int b=dp.top();dp.pop();
		int c=dp.top();dp.pop();
		if(a*a==((b*b)+(c*c))){
			cout<<"YES\n";
		}else{
			cout<<"NO\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1196
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

import itertools

N = int(input())
P = tuple(input_nums())
Q = tuple(input_nums())

all = list(itertools.permutations(range(1, N+1)))

index_P = all.index(P)
index_Q = all.index(Q)
print(abs(index_P - index_Q))


Measured memory_bytes: 44784
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <algorithm>

using namespace std;

using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

int main() {
    int A, B, C, D;
    cin >> A;
    B = (A % 1000) / 100;
    C = (A % 100) / 10;
    D = A % 10;
    A = A / 1000;

    // 0 -> +, 1 -> -
    int ans1, ans2, ans3;
    for (int i = 0; i < 2; i++) {
        for (int k = 0; k < 2; k++) {
            for (int m = 0; m < 2; m++) {
                int val = A;

                if (i == 0) {
                    val += B;
                } else {
                    val -= B;
                }

                if (k == 0) {
                    val += C;
                } else {
                    val -= C;
                }

                if (m == 0) {
                    val += D;
                } else {
                    val -= D;
                }

                if (val == 7) {
                    ans1 = i;
                    ans2 = k;
                    ans3 = m;

                    cout << A << (ans1 == 0 ? "+" : "-") << B << (ans2 == 0 ? "+" : "-") << C << (ans3 == 0 ? "+" : "-") << D << "=7" << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}

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

int main(){
  double x1, y1, x2, y2;

  scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
  
  printf("%lf\n", sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)));

  return 0;
}



Measured memory_bytes: 2704
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}

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

Measured memory_bytes: 256
A,B = map(int,input().split())
if A != 1 and B != 1:
  if A > B:
    print("Alice")
  elif A == B:
    print("Draw")
  else:
    print("Bob")
    
else:
  if A > B:
    print("Bob")
  elif A == B:
    print("Draw")
  else:
    print("Alice")


Measured memory_bytes: 2940
def main():

    X,Y,A,B,C=map(int,input().split())

    p=list(map(int,input().split()))
    q=list(map(int,input().split()))
    r=list(map(int,input().split()))

    p.sort(reverse=True)
    q.sort(reverse=True)
    r.sort(reverse=True)

    p=p[:X]
    q=q[:Y]

    p.extend(q)

    p.extend(r)

    p.sort(reverse=True)

    print(sum(p[:X+Y]))
    
main()

Measured memory_bytes: 23984
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(), a.end()
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; }
using namespace std;

int main(){

    string S, T;
    cin >> S >> T;

    int s_sz = (int)S.size();
    int t_sz = (int)T.size();

    vector<int> sa(s_sz + 1, 0), sb(s_sz + 1, 0);
    vector<int> ta(t_sz + 1, 0), tb(t_sz + 1, 0);

    rep(i, s_sz){
        if(S[i] == 'A')sa[i + 1]++;
        else sb[i + 1]++;
        sa[i + 1] += sa[i];
        sb[i + 1] += sb[i];
    }

    rep(i, t_sz){
        if(T[i] == 'A')ta[i + 1]++;
        else tb[i + 1]++;
        ta[i + 1] += ta[i];
        tb[i + 1] += tb[i];
    }

    int Q;
    cin >> Q;

    rep(loop, Q){
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; c--;
        int sd = (sa[b] - sa[a]) - (sb[b] - sb[a]);
        int td = (ta[d] - ta[c]) - (tb[d] - tb[c]);
        if((sd - td) % 3 == 0)cout << "YES" << endl;
        else cout << "NO" << endl;
    }

}

Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1001001001;
const double PI = acos(-1);

int main() {
	
	rep(i, 5) {
		int x;
		cin >> x;
		if (!x) {
			cout << i + 1 << endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <list>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	string S;
	cin >> N;
	cin >> S;

	int l = 0;
	list<char> ans;
	for (int i = 0; i < N; i++) {
		if (S[i] == '(') {
			l++;
		} else if (S[i] == ')') {
			l--;
			if (l < 0) {
				ans.push_front('(');
				l = 0;
			}
		}
		ans.push_back(S[i]);
	}

	for (int i = 0; i < l; i++) ans.push_back(')');

	for (auto c : ans) cout << c;
	cout << endl;
	return 0;
}


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

namespace AtTest._700problems
{
    class ARC094_E
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            int n = ReadInt();

            long res = 0;
            long sameCnt = 0;
            List<long[]> remains = new List<long[]>();
            for(int i = 0; i < n; i++)
            {
                long[] ab = ReadLongs();
                if (ab[0] < ab[1])
                {
                    res += ab[0];
                }
                else
                {
                    if (ab[0] == ab[1])
                    {
                        sameCnt++;
                        res += ab[0];
                    }
                    else remains.Add(ab);
                }
            }

            if (sameCnt == n)
            {
                WriteLine(0);
                return;
            }

            long aSum = remains.Sum(a => a[0]);
            long max = 0;
            for(int i = 0; i < remains.Count; i++)
            {
                max = Max(max, aSum - remains[i][1]);
            }

            res += max;
            WriteLine(res);
        }

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


Measured memory_bytes: 19804
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int w,a,b;
    cin>>w>>a>>b;
    if((b<=a+w && a<=b)||(a<=b+w && b<=a)){
        cout<<0<<endl;
    }else{
        cout<<min(abs(b+w-a),abs(a+w-b))<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin>>N;
  vector<int64_t> luka(N+1);
  luka.at(0)=2;
  luka.at(1)=1;
  if(N>1)
    for(int i=2;i<N+1;i++)
      luka.at(i)=luka.at(i-1)+luka.at(i-2);
  cout<<luka.at(N)<<endl;
}

Measured memory_bytes: 256