akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int a, b, c, d;
void print(string signs){
    cout << a << signs[0] << b << signs[1] << c << signs[2] << d << "=7" << endl;
}

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

    // input
    string s;
    cin >> s;

    a = s[0] - '0';
    b = s[1] - '0';
    c = s[2] - '0';
    d = s[3] - '0';

    if(a+b+c+d==7){print("+++");}
    else if(a-b+c+d==7){print("-++");}
    else if(a+b-c+d==7){print("+-+");}
    else if(a-b-c+d==7){print("--+");}
    else if(a+b+c-d==7){print("++-");}
    else if(a-b+c-d==7){print("-+-");}
    else if(a+b-c-d==7){print("+--");}
    else if(a-b-c-d==7){print("---");}
    
    return 0;
}

Measured memory_bytes: 256
N = int (input ())
l = []
S = 'Yes'
A = input ()
W = A[-1]
l.append (A)
for i in range (N-1):
  A = input ()
  if A[0] != W or l.count(A) != 0:
    S = 'No'
    break
  l.append (A)
  W = A[-1]
print (S)

Measured memory_bytes: 9184
// 見せてやるぜ、奇跡ってやつをよぉ……
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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;}
#define DEBUG_VLL(vec) REP(i, vec.size()) cerr<<vec[i]<<(i==vec.size()-1?'\n':' ');

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

pair< vector<char>, vll > RunLengthEncoding(string s) {
    ll len=1;
    vector<char> c;
    vll l;
    s.push_back('$');
    for (int i=1; i<s.size(); i++) {
        if (s[i] != s[i-1]) {
            c.push_back(s[i-1]);
            l.push_back(len);
            len = 1;
        } else len++;
    }
    return make_pair(c, l);
} 

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    ll n = s.size()+1;
    s.push_back('<');
    vll ans(n, 0);
    char prev = '>';
    REP(i, n) {
        if (prev=='>' && s[i] == '<') {
            ll tmpi = i;
            while (tmpi-1>=0 && s[tmpi-1]=='>') {
                chmax(ans[tmpi-1], i-tmpi+1);
                // ans[tmpi-1] = i-tmpi+1;
                tmpi--;
            }
            tmpi = i;
            while (tmpi+1<n && s[tmpi] == '<') {
                chmax(ans[tmpi+1], tmpi-i+1);
                // ans[tmpi+1] = tmpi-i+1;
                tmpi++;
            }
            i = tmpi;
        }
        prev = s[i];
    }
    // DEBUG_VLL(ans)
    cout << accumulate(ALL(ans), 0LL) << '\n';
    return 0;
}


Measured memory_bytes: 4764
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int a, b, c;

int main() {
    while (cin >> a >> b >> c) {
        int all = 0;
        int part = 0;
        for (int i = 1; i <= 10; ++i) {
            if (i == a || i == b || i == c) continue;
            for (int j = 1; j <= 10; ++j) {
                if (i == j) continue;
                if (j == a || j == b || j == c) continue;
                
                ++all;
                if (a + b + i <= 20) ++part;
            }
        }
        if (part * 2 >= all) puts("YES");
        else puts("NO");
    }
    return 0;
}


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

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree < int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define smallk order_of_key
#define kth find_by_order
*/

#define nl '\n'
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pb push_back

typedef long long ll;

const int N = (int)1e6 + 123;
const int M = 1e9 + 7;
const int K = 500;

int n, a[N], dp[N];
int main(){

    //ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

    #ifdef LOCAL
        freopen("C.txt", "r", stdin);
    #endif // LOCAL

    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i];
    }
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
    for(int i = 3; i <= n; ++i){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
    }
    cout << dp[n];
    return 0;
}



Measured memory_bytes: 4736
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0

list_500 = list(range(A+1))
five_hundred_list = [n*500 for n in list_500]

list_100 = list(range(B+1))
one_hundred_list = [n*100 for n in list_100]

list_50 = list(range(C+1))
fifty_list = [n*50 for n in list_50]

for fh in range(len(five_hundred_list)):
    for oh in range(len(one_hundred_list)):
      for f in range(len(fifty_list)):
        if five_hundred_list[fh] + one_hundred_list[oh] + fifty_list[f] == X:
          counter += 1

print(counter)

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
def print_ans(N, input_line):
    """Test Case
    >>> print_ans(4, "0 1 1 2")
    2
    >>> print_ans(4, "1 1 1 1")
    0
    >>> print_ans(7, "0 3 2 1 2 2 1")
    24
    """
    ar = list(map(int,input_line.split()))
    ngflg = False
    if ar[0] != 0:
        ngflg = True
    k = max(ar)
    tmp_ar = [0] * (k + 1)
    for i in range(1,N):
        tmp_ar[ar[i]] += 1
    if tmp_ar[0] > 0:
        ngflg = True
    if ngflg:
        print("0")
    else:
        ans = 1
        for j in range(2, k + 1):
            ans *=  tmp_ar[j - 1] ** tmp_ar[j]
        print(ans % 998244353)

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = input().rstrip()
    print_ans(N, ar)


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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N; cin>>N;
    vec_int kosuu(N+1,0);

    for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
    for(int z=1;z<=100;z++){
        int val = x*x + y*y + z*z + x*y + y*z + z*x;
        if(val<=N){
            kosuu.at(val)++;
        }
    }
    }
    }

    for(int i=1;i<=N;i++){
        cout<<kosuu.at(i)<<endl;
    }



    return 0;
}

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

using namespace std;

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

#define F first
#define S second

const int MAXN = 1e5 + 10;

int n, m, v, p, a[MAXN];
ll pt[MAXN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m >> v >> p;
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	for (int i = 0; i < n; i++) pt[i+1] = pt[i] + a[i];
	int ans = 0;
	for (int i = 0; i < n; i++){
		int dest = a[i] + m;
		int pos = upper_bound(a, a + n, dest) - a;
		
		if (n-pos >= p) continue;

		pos = n - p + 1;
		if (n-pos+1 + i >= v) {
			ans++;
		}
		else {
			int rem = v - (n-pos+1+i);
			ll req = 1ll*rem*m;
			
			req -= 1ll*(pos-(i+1))*dest - (pt[pos] - pt[i+1]);
			if (req <= 0)
				ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 1408
N = int(input())

dp = [[0, 0, 0] for i in range(N+1)] # [A, B, C]
for i in range(1, N+1):
  a, b, c = map(int, input().split())
  dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a
  dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b
  dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c

print(max(dp[N]))

Measured memory_bytes: 22772
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int mod=1000000007;
    long long n,ih=0;
    cin>>n;
    vector<long long> a(200010,0),oj(200010,0);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        oj[i]=(a[i]%mod+oj[i-1]%mod)%mod;
        ih=(ih%mod+a[i]%mod)%mod;
    }
    long long sum=0;
    for(int i=1;i<n;i++){
        sum=(sum%mod+(a[i]%mod*(ih%mod+mod-oj[i]%mod))%mod)%mod;
    }
    cout<<sum%mod<<"\n";
    return(0);
}

Measured memory_bytes: 6428
#include<iostream>
using namespace std;
int map[3][101];
int most[3][101];
main()
{
int x;	
cin>>x;
for(int i=1;i<3;i++)
	for(int w=0;w<x;w++)
		cin>>map[i][w];
for(int i=1;i<3;i++)
	for(int w=0;w<x;w++)
		{
		most[i][w]=max(most[i-1][w]+map[i][w],most[i][w-1]+map[i][w]);	
		}
	cout<<most[2][x-1]<<endl;
}

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

int main()
{
    unsigned int N;
    std::string S, T1, T2;
    
    std::cin >> N >> S;

    T1 = S.substr(0, S.size() / 2);
    T2 = S.substr(S.size() / 2, S.size() / 2);

    if (S.size() % 2 != 0 || T1 != T2)
    {
        std::cout << "No" << std::endl;
    }
    else
    {
        std::cout << "Yes" << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 100000000;
const long long MOD = 1000000007;

std::vector<bool> IsPrime;

void sieve(size_t max)
{
  if (max + 1 > IsPrime.size())
  {                                // resizeで要素数が減らないように
    IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
  }
  IsPrime[0] = false; // 0は素数ではない
  IsPrime[1] = false; // 1は素数ではない

  for (size_t i = 2; i * i <= max; ++i)     // 0からsqrt(max)まで調べる
    if (IsPrime[i])                         // iが素数ならば
      for (size_t j = 2; i * j <= max; ++j) // (max以下の)iの倍数は
        IsPrime[i * j] = false;             // 素数ではない
}

class Pointer{
public:
  long long p;
  long long w;
};

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(0, min(b, d) - max(a, c)) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  int h,n;
  cin >> h >> n;
  int mas[n];
  int c=0;
  for (int i = 0; i < n; i++) {
    cin >> mas[i];
    c+=mas[i]; }
  if (c>= h) {
    cout << "Yes"; }
  else {
    cout << "No";} 
}
    

Measured memory_bytes: 640
# -*- coding: utf-8 -*-
#ARC076C
import sys
import math

#n=int(input())

tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

n=hoge[0]
m=hoge[1]

#total=1
#if(n==m):
#	total+=1

t = math.factorial(min(n,m))
#print(t)
#print(t**2)
if(abs(n-m)>1):
	print(0)
elif(n==m):
	print((2*(t**2))%1000000007)
else:
	print(((t**2)*max(n,m))%1000000007)


Measured memory_bytes: 4740
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> L(n);
	for(int i = 0; i < n; ++i) {
		cin >> L[i];
	}
	
	sort(L.begin(), L.end());
	ll ans = 0;
	
	for(int i = 0; i < n; ++i) {
		for(int j = i + 1; j < n; ++j) {
			int target = L[i] + L[j];
			int v = lower_bound(L.begin(), L.end(), target) - L.begin();
			int cnt = v - j - 1;
			ans += cnt;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;

public class Main {
  private static void solve() {
    int k = ni();
    int q = ni();

    long[] d = nal(k);

    for (int i = 0; i < q; i++) {
      long ret = f(ni(), ni(), ni(), Arrays.copyOf(d, k));
      System.out.println(ret);
    }
  }

  private static long f(long n, long x, long m, long[] d) {
    int k = d.length;
    long dsum = 0;
    long zero = 0;
    for (int i = 0; i < k; i++) {
      d[i] %= m;
      dsum += d[i];
      if (d[i] == 0) {
        zero++;
      }
    }

    long sum = x % m + dsum * ((n - 1) / k);
    zero *= (n - 1) / k;


    for (int i = 0; i < (n - 1) % k; i++) {
      sum += d[i];
      if (d[i] == 0) {
        zero++;
      }
    }

    long ret = (n - 1) - zero - sum / m;
    return ret;

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

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

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

int main() {
	int N, X;
  	cin >> N >> X;
  
  vector<int> D(N + 2);
  D.at(0) = 0;
  
  for (int i = 1; i <= N + 1; i++) {
  	int L;
    cin >> L;
    
    int DN = D.at(i - 1) + L;
     if (DN > X) {
     	cout << i << endl;
        break;
     }
     else if (i == N + 1) {
     	cout << i << endl;
     }
    D.at(i) = DN;    
  }       
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n)cin >> a[i];
	int q;
	cin >> q;
	vector<int> m(q);
	rep(i, q) cin >> m[i];

	function<bool(int,int)> f = [&](int i,int N)
	{
		if (N == 0)
		{
			return true;
		}
		if (i >= n)
		{
			return false;
		}
		return f(i + 1, N) || f(i + 1, N - a[i]);
		
	};
	for (int i = 0; i < q; i++)
	{
		if (f(0,m[i]))
		{
			cout << "yes" << endl;
		}
		else
		{
			cout << "no" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3084
def main():
	S, T = input(), input()

	Z = 3010
	dp = [[0] * Z for _ in range(Z)]
	for i in range(len(S)):
		for j in range(len(T)):
			if S[i] == T[j]:
				dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + 1)
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j])
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1])

	#for line in dp:
	#	print(line)
	#print(dp[len(S)][len(T)])
	i, j, result = len(S), len(T), ""
	while 0 < i and 0 < j:
		if dp[i][j] == dp[i - 1][j]:
			i -= 1
		elif dp[i][j] == dp[i][j - 1]:
			j -= 1
		else:
			result = S[i - 1] + result
			i -= 1
			j -= 1
	print(result)

main()


Measured memory_bytes: 113500
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    if(A == B) output("YES");
    else if(V <= W) output("NO");
    else {
        if(abs(A - B) <= abs(V - W) * T) output("YES");
        else output("NO");
    }
    return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int p[110000];
int q[110000];
int main(){
	int a;
	scanf("%d",&a);
	for(int i=0;i<a;i++){
		scanf("%d",p+i);
	}
	std::sort(p,p+a);
	long long ret=0;
	long long tmp=0;
	int ks=0;
	for(int i=0;i+1<a;i++){
		if(a%2==0&&i==a/2-1){
			ks++;
		}else if(i<a/2){
			ks+=2;
		}else if(i==a/2||(a%2==1&&i==a/2+1)){
			ks--;
		}else{
			ks-=2;
		}
	//	printf("%d %d\n",ks,p[i+1]-p[i]);
		ret+=(long long)ks*(p[i+1]-p[i]);
		tmp+=(long long)ks*(p[a-1-i]-p[a-2-i]);
	}
	ret=max(ret,tmp);
	printf("%lld\n",ret);
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>

#define size_t int

using namespace std;

int gcd(int a, int b) {
  int tmp;
  if (a < b) {
    tmp = a;
    a = b;
    b = tmp;
  }
  int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main(int argc, char const *argv[]) {
  int N, X;
  scanf("%d %d", &N, &X);
  int x[N];
  int _x;
  for (size_t i = 0; i < N; i++) {
    scanf("%d", &_x);
    x[i] = abs(_x - X);
  }
  int r = x[0];
  for (size_t i = 1; i < N; i++) {
    r = gcd(r, x[i]);
    // printf("%d\n", r);
  }
  printf("%d\n", r);
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const int INF=1000000001;
const double PI=3.141592653589;


int main(){
  char a,b; cin>>a>>b;
  if(a-'A'>b-'A')
  puts(">");
  else if(a-'A'<b-'A')
  puts("<");
  else
  puts("=");

  return 0;
}


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

using namespace std;
int n;
long long a[87];
int main()
{
    cin>>n;
    a[0]=2;
    a[1]=1;
    for(int i=2;i<=n;i++)
        a[i]=a[i-1]+a[i-2];
    cout<<a[n];
}

Measured memory_bytes: 256
<?php
$n = (int)trim(fgets(STDIN));
$input = explode(' ', trim(fgets(STDIN)));

sort($input);
for ($i=1; $i < $n; $i++) { 
	if ($input[$i-1] === $input[$i]) {
		echo "NO";
		exit();
	}
}
echo "YES";

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

typedef long long ll;

using namespace std;

int getInt(char c) {
    return c - '0';
}

int main() {
    char a, b;
    cin >> a >> b;
    string ab = "";
    string ba = "";
    for (int i = 0; i < getInt(b); i++) {
        ab += a;
    }
    for (int i = 0; i < getInt(a); i++) {
        ba += b;
    }

    cout << (ab <= ba ? ab : ba) << endl;

    return 0;
}



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

bool isPrime(int p) {
    if(p == 2) return true;
    if(p < 2 || p % 2 == 0) return false;
    for(int i=3; i<=sqrt(p); i = i + 2) {
        if(p % i == 0) return false;
    }
    return true;
}

int main() {
    int prime[100001] = {};
    for(int i=2; i<=100000; ++i) {
        prime[i] = prime[i-1];
        if(isPrime(i) && isPrime((i+1)/2)) ++prime[i];
    }

    int Q;
    cin >> Q;
    for(int i=0; i<Q; ++i) {
        int l,r;
        cin >> l >> r;
        cout << prime[r] - prime[l-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
using System;

namespace ABC_057_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');
            int A = int.Parse(word[0]);
            int B = int.Parse(word[1]);
            if (A + B >= 24)
            {
                Console.WriteLine(A + B - 24);
            }
            else
            {
                Console.WriteLine(A + B);
            }
            Console.ReadKey();
        }
    }
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

struct enemy{
  ll time,attack;
};
bool sorter(const enemy& a,const enemy& b){
  return a.time*b.attack<b.time*a.attack;
}

ll n;
ll h[40040],a[40040],d[40040],s[40040];
enemy es[40040];

int main(){
	cin.sync_with_stdio(false);
  cin>>n;
  n++;
  rep(i,n)cin>>h[i]>>a[i]>>d[i]>>s[i];
  repl(i,1,n){
    ll damege=mmax(0,a[0]-d[i]);
    ll attack=mmax(0,a[i]-d[0]);
    if(damege==0&&attack>0){
      cout<<-1<<endl;
      return 0;
    }
    if(damege!=0)es[i].time=(h[i]+damege-1)/damege;
    else es[i].time=1;
    es[i].attack=attack;
  }
  ll res=0,sum=0;
  repl(i,1,n){
    if(s[i]>s[0]){
      res+=es[i].attack;
    }
    sum+=es[i].attack;
  }

  sort(es+1,es+n,sorter);
  repl(i,1,n){
    res+=sum*(es[i].time-1)+(sum-es[i].attack);
    if(res>=h[0]){
      cout<<-1<<endl;
      return 0;
    }
    sum-=es[i].attack;
  }
  if(res>=h[0])cout<<-1<<endl;
  else cout<<res<<endl;
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<string> grid(n);
    rep(i, n) cin >> grid[i];

    int ans = 0;
    for (int a = 0; a < n; a++) {
        bool can = true;
        rep(i, n) {
            rep(j, n) {
                if (grid[(i + a) % n][j] != grid[(j + a) % n][i]) {
                    can = false;
                    break;
                }
            }
            if (!can) break;
        }
        if (can) ans += n;
    }
    cout << ans << endl;
}

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

bool isPrime(int x) {
  if(x <= 1) return false;
  for(int i = 2; i*i <= x; ++i) {
    if(x % i == 0) return false;
  }
  return true;
}

int main() {
  vector<int> ps;
  for(int x = 2; x <= 50000; ++x) {
    if(isPrime(x)) ps.push_back(x);
  }
  for(int m, a, b; cin >> m >> a >> b && (m|a|b); ) {
    int p = 0, q = 0;
    for(int i = 0; i < ps.size(); ++i) {
      for(int j = i; j < ps.size() && ps[i] * ps[j] <= m; ++j) {
        if(ps[i] * ps[j] <= m && 
           a * ps[j] <= b * ps[i] &&
           ps[i] * ps[j] > p * q) {
          p = ps[i]; q = ps[j];
        }
      }
    }
    cout << p << " " << q << endl;
  }
  return 0;
}

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

int main () {

    string S;
    cin >> S;

    int cnt = 0, ans = 0;

    S += " ";
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T') {
            cnt++;
        }
        else {
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

const int N=1e6+5,MOD=1e9+7;

typedef long long ll;

int n,c,u,v,k,tc,ans;

char s[N];

int main(){
    bool YYMM=false,MMYY=false;
	scanf("%s",s);
	int m=(s[0]-'0')*10+s[1]-'0',y=(s[2]-'0')*10+s[3]-'0';
	if (m>0 && m<=12)
        MMYY=true;
    if (y>0 && y<=12)
        YYMM=true;
    if (YYMM && MMYY)
        printf("AMBIGUOUS");
    else if (YYMM)
        printf("YYMM");
    else if (MMYY)
        printf("MMYY");
    else
        printf("NA");
	return 0;
}


Measured memory_bytes: 256
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 
 
using namespace std;
 
#define _int64 long long
 
int cnt[1000];
 
int main()
{
  int i,j,n,x,y,ans;
  vector<pair<pair<int,int>,int> > a;
  scanf("%d",&n);
  for (i=0;i<n;i++)
  {
    scanf("%d%d",&x,&y);
    a.push_back(make_pair(make_pair(x,y),0));
  }
  for (i=0;i<n;i++)
  {
    scanf("%d%d",&x,&y);
    a.push_back(make_pair(make_pair(x,y),1));
  }
  sort(a.begin(),a.end());
  memset(cnt,0,sizeof(cnt));
  ans=0;
  for (i=0;i<a.size();i++)
  {
    if (a[i].second==0)
    {
      cnt[a[i].first.second]++;
    }
    else
    {
      for (j=a[i].first.second-1;j>=0;j--)
      {
        if (cnt[j]>0)
        {
          cnt[j]--;
          ans++;
          break;
        }
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

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

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

  if(a > c){
    tmp = a;
    a = c;
    c = tmp;
  }
  if(b > c){
    tmp = b;
    b = c;
    c = tmp;
  }
  if(a > b){
    tmp = b;
    b = a;
    a = tmp;
  }
  cout << a << " " << b << " " << c << endl;
  return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

struct edge{ll to,cost;};

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   int a,b;
   cin >> a >> b;
   int point = b - a;
   ull tower = 0;
   for(int i=1;i<=point;i++){
      tower += i;
   }
   cout << tower - b << endl;
   return 0;
}


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

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, d;
	while (cin >> n >> d, n | d) {
		vector<vector<int>> c(n);
		for (int i = 0; i < n; i++) {
			int m;
			cin >> m;
			c[i].assign(m + 1, 0);
			for (int j = 0; j < m; j++) {
				cin >> c[i][j + 1];
				c[i][j + 1] += c[i][j];
			}
		}
		bool ok = true;
		for (int i = 0; i < n; i++) {
			for (int j = 1; j < (int)c[i].size(); j++) {
				int lb = c[i][j] - d, ub = c[i][j - 1] + d;
				bool ng = false;
				for (int k = 0; k < n; k++) if (k != i) {
					if (upper_bound(c[k].begin(), c[k].end(), ub) - lower_bound(c[k].begin(), c[k].end(), lb) <= 0) {
						ng = true;
						break;
					}
				}
				if (ng) {
					ok = false;
				}
			}
		}
		puts(ok ? "Yes" : "No");
	}
	return 0;
}



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

#define REP(i, n) for(int i = 0; i < (int) (n); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

int main(){
  int n, m, p;
  while(cin >> n >> m >> p and n + m + p){
    int count[n];
    REP(i, n) cin >> count[i];
    int sum = 0;
    REP(i, n) sum += count[i];
    int pool = (100 - p) * sum;
    cout << (count[m-1] == 0 ? 0 : pool / count[m-1]) << endl;
  }
  return 0;
}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;
const ll INFLL = 1000000000000000007LL;

ll modpow(ll a, ll n) {
  a %= MOD;
  if (n == 0) return 1;
  if (n % 2 == 1) return a * modpow(a, n - 1) % MOD;
  ll ret = modpow(a, n / 2);
  ret = sqr(ret) % MOD;
  return ret;
}

ll modcmb(ll n, ll r) {
  ll ret = 1;
  for (int i = 0; i < r; i++) {
    ret *= (n - i);
    ret %= MOD;
    ret *= modpow(i + 1, MOD - 2);
    ret %= MOD;
  }
  return ret;
}

void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  ll ans = modpow(2, n) - 1;
  ans -= modcmb(n, a);
  ans -= modcmb(n, b);
  cout << (ans + 2 * MOD) % MOD << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------

    int n;
    cin>>n;
    vector<int> a(n);
    REP(i,n) cin >> a[i];
    sort(all(a));
    vec dp(n,1);
    for(int i=1;i<n;i++){
        if(a[i-1]*2>=a[i]){
            dp[i]+=dp[i-1];
        }
        a[i]+=a[i-1];
    }
    cout<<dp[n-1]<<endl;
    
}

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

int compare_int(const void *a, const void *b)
{
    return *(double*)a - *(double*)b  ;
}

int main(){
    int N;
    cin >> N;
    double v[N];
    for(int i=0;i<N;i++){
        cin >> v[i];
    }
    qsort(v,N,sizeof(double),compare_int);

    
    for(int i=0;i<N-1;i++){
        v[i+1]=(v[i]+v[i+1])/2.0;

    }
    cout << setprecision(7) << v[N-1] << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;
constexpr ll infl = 1ll<<60;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n,m,l;
    cin>>n>>m>>l;
    vector<vector<ll>> dp(n,vector<ll>(n,infl));    
    vector<vector<ll>> dp2(n,vector<ll>(n,infl));
    for(int i=0;i<n;++i)dp[i][i] = dp2[i][i] = 0ll;
    for(int i=0;i<m;++i){
        int a,b;ll c;
        cin>>a>>b>>c;
        a--;b--;
        dp[a][b] = min(dp[a][b],c);
        dp[b][a] = min(dp[b][a],c);
    }
    for(int k=0;k<n;++k)for(int i=0;i<n;++i)for(int j=0;j<n;++j) dp[i][j] = min(dp[i][j],dp[i][k] + dp[k][j]);
    for(int i=0;i<n;++i)for(int j=0;j<n;++j){
        if(i==j)continue;
        if(dp[i][j] <= l)dp2[i][j] = min(dp2[i][j],1ll);
    }
    for(int k=0;k<n;++k)for(int i=0;i<n;++i)for(int j=0;j<n;++j)dp2[i][j] = min(dp2[i][j],dp2[i][k] + dp2[k][j]);
    int q;
    cin>>q;
    for(int i=0;i<q;++i){
        int s,t;
        cin>>s>>t;
        s--;t--;
        if(dp2[s][t] < infl) cout << dp2[s][t] -1 << endl;
        else cout << -1 << endl;
    }
    return 0;
}



Measured memory_bytes: 1920
#include<iostream>
#include<unordered_map> 
using namespace std ;
int main()  {
	unordered_map<string , int > arr ;
	string str ;
	long int n , i ;
	arr["AC"]=0 ;
	arr["WA"]=0 ;
	arr["TLE"]=0 ;
	arr["RE"]=0 ;
	cin>>n ;
	for(i=0;i<n ; i++)  {
		cin>>str ;
		arr[str]++ ;
	}
	cout<<"AC x "<<arr["AC"]<<endl ;
	cout<<"WA x "<<arr["WA"]<<endl ;
	cout<<"TLE x "<<arr["TLE"]<<endl ;
	cout<<"RE x "<<arr["RE"]<<endl ;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5+5;
char a[105];

int main(){
	scanf("%s",a+1);
	int n = strlen(a+1);
	bool ok = 1;
	for(int i = 1; i <= n / 2; i++) if(a[i] != a[n - i + 1]) ok = 0;
	for(int i = 1; i <= n/4; i++) if(a[i] != a[(n-1)/2 - i + 1]) ok = 0;
	int x = (n+3) / 2;
	for(int i = 1; i <= n/4; i++){
		if(a[x+i-1] != a[n - i + 1]) ok = 0;
	}
	if(ok) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
using namespace std;
const long long mod = 1e9 + 7;
long long n, k;
long long dp[100010], ans;
long long ksm(long long a, long long b) {
	long long ret = 1;
	while (b) {
		if (b & 1) {
			ret = (ret * a) % mod;
		}
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}
int main() {
	cin >> n >> k;
	for (long long i = k; i >= 1; i--) {
		long long num = k / i;
		dp[i] = ksm(num, n);
		for (long long j = i + i; j <= k; j += i) {
			dp[i] = (dp[i] - dp[j] + mod) % mod;
		}
		ans = (ans + dp[i] * i) % mod;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
ll powmod(ll n, ll k, ll m) {
ll r=1;
 for(; k>0; k >>=1) {
   if(k&1) r=(r*n)%m;
   n=(n*n)%m;
 }
  return r;
}

ll fact(ll n) {
ll a=1;
rep(i,n) {
a=a*(n-i);
}
return a;
}

ll pow(ll a, ll b) {
ll x=1;
rep(i,b) {
x=x*a;
}
return x;
}



int main() {
string S1;
  cin>>S1;
  ll c=S1.size();
  if((S1.at(c-1)=='2') ||(S1.at(c-1)=='4')||(S1.at(c-1)=='5')||(S1.at(c-1)=='7')||(S1.at(c-1)=='9')){
    cout<<"hon"<<endl;
  }
else if((S1.at(c-1)=='0')||(S1.at(c-1)=='1')||(S1.at(c-1)=='6')||(S1.at(c-1)=='8')) {
cout<<"pon"<<endl;
}

  else {
cout<<"bon"<<endl;
  }
  
}

  

Measured memory_bytes: 3580
import sys
import copy

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')

sys.setrecursionlimit(1000000)


ans = 0


def bfs(N, edge, v, search):

    search |= {v}

    global ans
    if len(search) == N:
        ans += 1
        return

    for e in edge[v]:
        if e not in search:
            bfs(N, edge, e, copy.copy(search))


def main():

    N, M = in_nn()

    edge = [[] for _ in range(N)]

    for i in range(M):
        a, b = in_nn()
        a, b = a - 1, b - 1
        edge[a].append(b)
        edge[b].append(a)

    bfs(N, edge, 0, set())

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9364
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        System.out.println(a + b + c > 21 ? "bust" : "win");
    }
}


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

int main() {
  ll N;
  cin >> N;
  vector<ll> a(N),b(N),c(N);
  rep(i,N)
  {
    cin>>a.at(i)>>b.at(i)>>c.at(i);
  }
  vector<ll> a_max(N),b_max(N),c_max(N);
  a_max.at(0)=a.at(0);
  b_max.at(0)=b.at(0);
  c_max.at(0)=c.at(0);
  rep(i,N-1)
  {
    a_max.at(i+1)=max(b_max.at(i),c_max.at(i))+a.at(i+1);
    b_max.at(i+1)=max(c_max.at(i),a_max.at(i))+b.at(i+1);
    c_max.at(i+1)=max(a_max.at(i),b_max.at(i))+c.at(i+1);
  }
  vector<ll> ans(3);
  ans.at(0)=a_max.at(N-1);
  ans.at(1)=b_max.at(N-1);
  ans.at(2)=c_max.at(N-1);
  sort(ans.begin(),ans.end());
  cout<<ans.at(2)<<endl;
  return 0;
}

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


int main()
{
    string s;
    cin >> s;
    vector<string> days = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    rep(i, 7) {
        if (s == days[i]) {
            cout << 7 - i << endl;
            return 0;
        } 
    }
    return 0;
}

Measured memory_bytes: 3600
// by adiforluls
#pragma GCC optimize ("-O2")
#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;
#define FAST            ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll              long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define all(a)          (a).begin(),(a).end()
#define clz(a)          __builtin_clz(a) // count leading zeroes
#define ctz(a)          __builtin_ctz(a) // count trailing zeroes
#define popc(a)         __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define rep(i,a,b)      for(int i=a;i<b;i++)
#define rfor(i,a,b)     for(int i=a; i>=b; i--)
#define debug(x)        cerr << #x << " = " << x << endl;
#define F               first
#define S               second
#define endl            '\n'
#define SIZE            1000005
#define deci(n)         cout<<fixed<<setprecision(n)
#define ordered_set     tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key(k)
// find_by_order(k)
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const ll lul2 = 998244353;
const ll lul = 1000000007;

void mod(ll &x)
{
    if(x>=lul) x-=lul;
    if(x<0) x+=lul;
}

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

ll expo(ll n, ll p)
{
    if(p == 0) return 1;
    ll x = expo((n*n)%lul, p/2)%lul;
    if(p&1) return (x*n)%lul;
    return x;
}
//---------------------------------------------------------------------

void solve()
{
    int n,t; cin>>n>>t;
    int a[n];
    priority_queue<int> pq;
    int mini=INF, ans = 0, maxi = -INF;
    rep(i,0,n)
    {
        cin>>a[i];
        mini = min(mini,a[i]);
        pq.push(a[i]-mini);
        maxi = pq.top();
    }
    while(!pq.empty() and pq.top()>0 and pq.top() == maxi)
    {
        ans++;
        pq.pop();
    }
    cout<<ans;
}
int main()
{   
    FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; /*cin>>t;*/ t=1;
    rep(i,1,t+1){
        solve();
    }
    return 0;
}

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

#define llint long long int

using namespace std;

int main(){
    int N;

    cin >> N;

    int ans = 0;

    for(int i = 1; i <= N; i ++){
        int a;

        cin >> a;

        if(i % 2 == 1 && a % 2 == 1){
            ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(int i=0; i<n; i++)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 999999999

typedef vector<int> VI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	
	int x;
	cin >> x;
	if (x == 3 || x == 5 || x == 7)puts("YES");
	else puts("NO");
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	ll N, A, B, C, D, E;
	cin >> N >> A >> B >> C >> D >> E;

	ll ans = ceil(1.0*N/A);
	ans = max(ans, ll(ceil(1.0*N/B)));
	ans = max(ans, ll(ceil(1.0*N/C)));
	ans = max(ans, ll(ceil(1.0*N/D)));
	ans = max(ans, ll(ceil(1.0*N/E)));

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

Measured memory_bytes: 888
from subprocess import*
call(('python3','-c',"""
from scipy.sparse import*
s=csgraph.floyd_warshall
n,m,l,*t=map(int,open(0).read().split())
d=eval('[9e9]*-~n,'*-~n)
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=d[b][a]=c
d=s(d)
d[d>l]=9e9
d[d<=l]=1
d=s(d)
d[d>9e9]=9e9
for s,t in zip(*[iter(t[m*3+1:])]*2):print(int(d[s,t]%9e9-1))
"""))

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

using namespace std;

// 多次元 mul_array<int, 1, 2, 3> a
//template <typename T, std::size_t... Ns>
//struct index_reverse_for_array;
//template <typename T, std::size_t N, std::size_t... Ns>
//struct index_reverse_for_array<T, N, Ns...> { using type = std::array< typename index_reverse_for_array<T, Ns...>::type, N>; };
//template <typename T, std::size_t N>
//struct index_reverse_for_array<T, N> { using type = std::array<T, N>; };
//template <class T, std::size_t... Ns> using mul_array = typename index_reverse_for_array<T, Ns...>::type;
//
//using u32 = uint32_t;
//using s32 = uint32_t;
//using u64 = uint64_t;
//using s64 = uint64_t;

int main() {
    //cout << fixed << setprecision(10);

    while (true) {
        int n, p;
        cin >> n >> p;
        if (n == 0 && p == 0) break;

        int hand = p;
        int now = 0;
        vector<int> otete(n);
        for (int i = 0; i < n; i++)
            otete[i] = 0;

        int emememememememememe = n;
        int nnnnnnnnnnnnnnnnnnn = 0;
        do {
            //cout << hand << ", " << now << ", " <<  emememememememememe << " : ";
            //for (int i = 0; i < n; i++) { cout << otete[i] << ", "; }
            //cout << endl;
            if (hand == 0) {
                if (otete[now] != 0) {
                    hand = otete[now];
                    otete[now] = 0;
                    emememememememememe++;
                }
            }
            else {
                otete[now]++;
                hand--;
                if (otete[now] == 1)
                    emememememememememe--;
                if (emememememememememe == n -1 && hand == 0) {
                    cout << now << endl;
                    break;
                }
            }
            now = (now + 1) % n;
            //getchar();

        } while (true);

    }

    return 0;
}




Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 1e5 + 5;
int n;
int a[maxn], b[maxn];
pair<int, int> c[maxn];
int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		c[i].first = a[i] + b[i];
		c[i].second = i;
	}
	sort(c, c + n);
	reverse(c, c + n);
	int res1 = 0;
	int res2 = 0;
	for(int i = 0; i < n; i += 2) {
		res1 += a[c[i].second];
	}
	for(int i = 1; i < n; i += 2) {
		res2 += b[c[i].second];
	}
	cout << res1 - res2 ;
	return 0;
}

Measured memory_bytes: 3328