akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using plglg = pair<ll, ll>;
using tlglglg = tuple<ll, ll, ll>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << endl;}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
inline void yesno(bool ok, string yes = "Yes", string no = "No") {cout << (ok?yes:no) << endl;}


signed main() {
    //my-code
    int n; cin >> n;
    vll L(n); REP(i, n) cin >> L[i];

    ll a, b, c;
    ll ans = 0;
    REP(i, n-2) REPS(j, i+1, n-1) REPS(k, j+1, n) {
        a = L[i];
        b = L[j];
        c = L[k];
        if (a != b && b != c && c != a &&
            a+b>c && b+c>a && c+a>b) {
                ans++;
            }
    }
    print(ans);

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 3660
n = int(input())
p = [int(i) for i in input().split()]

cnt = 0

for i in range(n-2):
    if (p[i] < p[i+1] and p[i+1] < p[i+2]) or (p[i] > p[i+1] and p[i+1] > p[i+2]):
        cnt += 1
        
print(cnt)




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

#define INIT std::cin.tie(0);std::ios::sync_with_stdio(false);
#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define ASC(t) [](t& x, t& y){ return x < y; }
#define DESC(t) [](t& x, t& y){ return x > y; }
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))
#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << endl;

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define OUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n"

using PII = pair<int, int>;
using PLL = pair<long long, long long>;
using LL = long long;
using ULL = unsigned long long;
template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

int n, y;
V<int> ans;
V<int> m;

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

    ans.resize(3);

    int cn = y;

    REP(i,n) {
        if(0 < cn/10000) {
            ans[0]++; cn -= 10000;
        } else
        if(0 < cn/5000) {
            ans[1]++; cn -= 5000;
        } else
        if(0 < cn/1000) {
            ans[2]++; cn -= 1000;
        }
        if(cn == 0) break;
    }

    if(0 < cn) {
        cout << " -1 -1 -1" << "\n";
        return 0;
    }

    int sum = ans[0] + ans[1] + ans[2];
    REP(i,n) {
        if(sum == n) break;
        if((n - sum) % 4 == 0 && ans[1] > 0) {
            sum += 4; ans[1]--; ans[2] += 5;
        } else if(ans[0] > 0) {
            sum++; ans[0]--; ans[1] += 2;
        }
    }

    if(sum == n) cout << ans[0] << " " << ans[1] << " " << ans[2] << "\n";
    else cout << "-1 -1 -1" << "\n";
}

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

    typedef long long int ll;
    #define pb         push_back
    #define mp         make_pair
    #define F          first
    #define S          second
    #define fl(i,a,b)  for(ll i=a;i<b;i++)
    #define pll        pair<ll,ll>
    #define pii        pair<int,int>
    #define all(v)     v.begin(),v.end()
    #define M 1000000007
    #define tr(v, it) for(auto it = v.begin(); it != v.end(); it++)
    #define fast   ios::sync_with_stdio(false);cin.tie(0);cout.precision(10);cout << fixed;
    using namespace std;
    double dp[3005][3005];
    double dfs(int n, int i, double prob[], int cnt)
    {

        if(i>= n)
        {
            if(cnt> n/2)
                return 1;
            return 0;
        }
        if(dp[i][cnt]>-0.9)
            return dp[i][cnt];
        double ans=0;
        ans = ans + (prob[i]*dfs(n,i+1, prob, cnt+1));
        ans= ans + ((1-prob[i])*dfs(n,i+1,prob, cnt));
      //  cout<<i<<" "<<cnt<<" "<<ans<<"\n";
        return dp[i][cnt] =ans;
    }
    int main()
    {
            fast
         int n;
         cin>>n;
         double prob[n];
         for(int i=0; i<n; i++)
         {
             cin>>prob[i];
         }
         memset(dp,-1,sizeof(dp));
         printf("%0.10f",dfs(n,0,prob,0));

        return 0;

    }



Measured memory_bytes: 74628
e=enumerate
n,*a=map(int,open(0).read().split())
dp=[0]
for j,(a,i)in e(sorted((a,i)for i,a in e(a))[::-1]):dp=[dp[0]+a*abs(n-j-i-1)]+[max(dp[k]+a*abs(n-j+k-i-1),dp[k-1]+a*abs(i-k+1))for k in range(1,j+1)]+[dp[j]+a*abs(i-j)]
print(max(dp))

Measured memory_bytes: 9680
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args)throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    int[] h = new int[n];
    int count = 0;
    int ans = 0;
    for(int i = 0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
      if(i==0)
        continue;
      if(h[i-1]>=h[i]){
        count += 1;
        ans = Math.max(ans,count);
      }else{
        count = 0;
      }
    }
    System.out.println(ans);
  }
}

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

int main() {
	int a = 1, b = 1, i, j;
	while(a != 0 && b != 0) {	
		cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		}
		for(i = 1; i <= a; i++) {
			for(j = 1; j <= b; j++) {
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	} 
}


Measured memory_bytes: 3056
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node{ int p, l, r;};

Node T[MAX];
int n, D[MAX];

void print(int u){
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";
    if(T[u].p==NIL) cout << "root, ";
    else if(T[u].l==NIL) cout << "leaf, ";
    else cout << "internal node, ";
    
    cout << "[";
    
    for(int i=0, c = T[u].l; c!=NIL; i++, c=T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

void rec(int u, int p){
    D[u] = p;
    if(T[u].l != NIL) rec(T[u].l, p+1);
    if(T[u].r != NIL) rec(T[u].r,p);
}

int main(){
    int i,j,d,v,c,l,r;
    cin >> n;
    for(int i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
    
    for(i=0; i<n; i++){
        cin >> v >> d;
        for(j=0; j<d; j++){
            cin >> c;
            if(j==0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        }
    }
    for(i=0; i<n; i++){
        if(T[i].p==NIL) r = i;
    }

    rec(r,0);
    
    for(i=0; i<n; i++) print(i);
    
    return 0;
}

Measured memory_bytes: 4644
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<long, long>;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
#define rep(i, n) for(int i = 0; i<n; i++)
#define rep_s(i, start, n) for(int i= start;  i<n; i++)
#define ALL(a) (a).begin(), (a).end()
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower  = "abcdefghijklmnopqrstuvwxyz";

/*
using edge = struct {int to; ll cost;};
vector<edge> tree[limit];
ll depth[limit];

void dfs(int v, int p, ll d){
  depth[v] = d;
  //cout <<"v: " << v << endl;
  for (auto &e: tree[v]){
    //cout << "e.to: " << e.to << endl;
    if (e.to == p) continue;
    dfs(e.to, v, d+e.cost);
  }
}
*/
int keta_sum(int num){
  int dig, sum = 0;
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }
  return sum;
}


int main(void){
  ll N, A, B, W, H, C, D;

  cin >> A >> B >> C >> D;
  if (A+B>C+D) cout <<"Left" <<endl;
  else if(A+B == C+D) cout <<"Balanced" << endl;
  else cout << "Right" << endl;

}


Measured memory_bytes: 256
let () = Scanf.scanf "%d\n%d %d\n" @@ fun n d x ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d\n" @@ fun a -> a in
  Array.map (fun a -> 1 + (d - 1) / a) as_
  |> Array.fold_left ( + ) x
  |> Printf.printf "%d\n"



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

typedef long long ll;

int N, Q, A, B;
vector<int> X;
vector<ll> psum;

struct BIT {
    vector<ll> tree;
    void init() {
        tree = vector<ll>(4*N, 1e18);
    }
    void upd(int idx, ll val, int l, int r, int n) {
        if(idx < l || r < idx) return;
        if(l == r) {
            tree[n] = min(tree[n], val);
            return;
        }
        int m = (l + r)>>1;
        upd(idx, val, l, m, 2*n);
        upd(idx, val, m + 1, r, 2*n + 1);
        tree[n] = min(tree[2*n], tree[2*n + 1]);
    }
    ll quer(int a, int b, int l, int r, int n) {
        if(b < l || r < a) return 1e18;
        if(a <= l && r <= b) return tree[n];
        int m = (l + r)>>1;
        ll L = quer(a, b, l, m, 2*n);
        ll R = quer(a, b, m + 1, r, 2*n + 1);
        return min(L, R);
    }
} pb, mb;

vector<ll> dp;
int main() {
    scanf("%d %d %d %d", &N, &Q, &A, &B);
    X.push_back(--A);
    X.push_back(--B);
    for(int i = 0; i < Q; i++) {
        int x; scanf("%d", &x);
        X.push_back(--x);
    }
    psum.resize(X.size());
    psum[0] = 0;
    for(int i = 1; i < X.size(); i++) {
        psum[i] = psum[i - 1] + abs(X[i] - X[i - 1]);
    }
    dp.resize(X.size());
    pb.init();
    mb.init();
    for(int i = X.size() - 1; i >= 1; i--) {
        if(i != X.size() - 1) {
            dp[i] = pb.quer(X[i - 1], N - 1, 0, N - 1, 1) - X[i - 1] - psum[i];
            dp[i] = min(dp[i], mb.quer(0, X[i - 1], 0, N - 1, 1) + X[i - 1] - psum[i]);
        }
        else dp[i] = 0;
        dp[i] = min(dp[i], psum.back() - psum[i]);
        pb.upd(X[i], dp[i] + psum[i - 1] + X[i], 0, N - 1, 1);
        mb.upd(X[i], dp[i] + psum[i - 1] - X[i], 0, N - 1, 1);

        //cout << dp[i] << endl;
    }
    printf("%lld", dp[1]);
}


Measured memory_bytes: 16756
K = int(input())
A, B = map(int,input().split())
i = 0
Flag = False
while True:
  k = K * i
  if k >= A and k <= B:
    Flag = True
    break
  if k > B:
    break
  i = i + 1
print('OK' if Flag == True else 'NG')

Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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

	
	int N;
	cin >> N;
	int A[2000];
	int B[2001] = {};
	int goukei = 0;
	rep(i, N) {
		cin >> A[i];
		goukei += A[i];
		B[A[i]]++;
	}
	int hanbun = (goukei + 1) / 2;

	bitset<4000001> BS;
	BS[0] = true;
	rep(i, N) {
		BS |= BS << A[i];
		if (BS[hanbun]) {
			co(hanbun);
			return 0;
		}
	}

	for (int i = hanbun; i < 4000000; i++) {
		if (BS[i]) {
			co(i);
			break;
		}
	}

	Would you please return 0;
}

Measured memory_bytes: 1792
class PrimeFactor():

    def __init__(self, n):
        """
        エラトステネス　O(N loglog N)
        """
        self.n = n
        self.table = list(range(n+1))       # 最小素因数のリスト
        self.table[2::2] = [2]*(n//2)
        for p in range(3, int(n**0.5) + 2, 2):
            if self.table[p] == p:
                for q in range(p * p, n + 1, 2 * p):
                    if self.table[q] == q:
                        self.table[q] = p

    def prime_counter(self, x):
        """
        素因数分解（個数のリスト） O(logN)
        {素因数: 個数}　の形で返す
        """
        res = dict()
        if x < 2:
            return res
        while self.table[x] != 1:
            res[self.table[x]] = res.get(self.table[x], 0) + 1
            x //= self.table[x]
        return res

    def divisors_counter(self, x):
        """ 約数の個数　O((logN)^2) """
        res = 1
        for value in self.prime_counter(x).values():
            res *= (value+1)
        return res

N = int(input())
P = PrimeFactor(N)
res = 0
for i in range(1,N+1,2):
    if P.divisors_counter(i)==8:
        res += 1
print(res)

Measured memory_bytes: 62180
def main():
    x=int(input())
    dp=[0 for i in range(x+1000)]
    for i in range (100,106):
        dp[i]=1

    for i in range(x):
        if dp[i]==1:
            for j in range (100,106):
                dp[i+j]=1
    print(1 if dp[x]==1 else 0)


 
if __name__ == '__main__':
    main()

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair


void positive(int N) {
    stack<int> st;

    int x = N;
    st.push(x % 2);
    x /= 2;
    while (x) {
        int r = x % 4;
        x /= 4;
        switch (r) {
            case 0: st.push(0); st.push(0); break;
            case 1: st.push(1); st.push(1); break;
            case 2: st.push(0); st.push(1); break;
            case 3: st.push(1); st.push(0); x += 1; break;
        }
    }

    while (st.top() == 0) st.pop();

    while (!st.empty()) {
        cout << st.top(); st.pop();
    }
    cout << endl;
}

void negative(int N) {
    stack<int> st;

    int x = -N;
    while (x) {
        int r = x % 4;
        x /= 4;
        switch (r) {
            case 0: st.push(0); st.push(0); break;
            case 1: st.push(1); st.push(1); break;
            case 2: st.push(0); st.push(1); break;
            case 3: st.push(1); st.push(0); x += 1; break;
        }
    }

    while (st.top() == 0) st.pop();

    while (!st.empty()) {
        cout << st.top(); st.pop();
    }
    cout << endl;
}

int main() {
    int N; cin >> N;
    if (N == 0) {
        cout << '0' << endl;
    } else if (N > 0) {
        positive(N);
    } else {
        negative(N);
    }
    return 0;
}


Measured memory_bytes: 256
from itertools import product, permutations

N, C = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
grid = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(N)]

cost = [[0] * C for _ in range(3)]

for x, y in product(range(N), range(N)):
    cost[(x + y) % 3][grid[x][y]] += 1

minn = float("inf")
for colors in permutations(range(C), 3):
    t = 0
    for s, color_n in enumerate(colors):
        for color_p, n in enumerate(cost[s]):
            t += n * D[color_p][color_n]
    minn = min(minn, t)
print(minn)


Measured memory_bytes: 5620
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int b = a/1.08;
  if(b*1.08==a){
    cout << b << endl;
  }
  else if((b+1)*108/100==a){
    cout << b+1 << endl;
  }
  else{
    cout << ":(" << endl;
  }

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int n; cin >> n;
	string a[10][10];
	if (n == 2) cout << -1;
 	else {
        a[3][1] = "aa.";
        a[3][2] = "..a";
        a[3][3] = "..a";
      
        a[4][1] = "aacd";
        a[4][2] = "bbcd";
        a[4][3] = "dcaa";
        a[4][4] = "dcbb";
      
        a[5][1] = "aabbc";
        a[5][2] = "bcc.c";
        a[5][3] = "b..ab";
        a[5][4] = "a..ab";
        a[5][5] = "abbcc";

        a[6][1] = "aacd..";
        a[6][2] = "bbcd..";
        a[6][3] = "..aacd";
        a[6][4] = "..bbcd";
        a[6][5] = "ab..aa";
        a[6][6] = "ab..bb";

        a[7][1]= "aabbcc.";
        a[7][2] = "bb.aa.c";
        a[7][3] = "..a..bc";
        a[7][4] = "..a..ba";
        a[7][5] = "aa.aa.a";
        a[7][6] = "..a..ab";
        a[7][7] = "..a..ab";
      
      	for (int i = 0, m; n; n -= m, i += m) {
          	if (n > 7) m = 4; else m = n;
            for (int k = 1; k <= m; ++k) {
				for (int j = 1; j <= i; ++j)
                	cout << '.';
                cout << a[m][k];
                for (int j = 1; j <= n - m; ++j)
                	cout << '.';
              	cout << endl;
            }
        }
    }
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
	string s1,s2,s3;
	cin >> s1 >> s2 >> s3;

	string ans = "";
	
	ans.pb(toupper(s1[0]));
	
	ans.pb(toupper(s2[0]));

	ans.pb(toupper(s3[0]));

	cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (n); ++i)
#define rrep(i, j, n) for (int i = (n)-1; j <= i; --i)

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& a) {
  os << "{";
  for (size_t i = 0; i < a.size(); ++i) os << (i > 0 ? "," : "") << a[i];
  return os << "}";
}

[[maybe_unused]] constexpr ll MOD = 1000000007;
[[maybe_unused]] constexpr int INF = 0x3f3f3f3f;
[[maybe_unused]] constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  int n;
  cin >> n;
  ll ans = 1;
  rep(i, 0, n) {
    ll t;
    cin >> t;
    ans = lcm(ans, t);
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
	int sum = 0, ave = 0, goods_sum, goods_n, cntgoods = 0;
	while (scanf("%d,%d", &goods_sum, &goods_n) != EOF){
		sum += goods_sum * goods_n; ave += goods_n;
		cntgoods++;
	}
	printf("%d\n%d\n", sum, (int)((double)ave / cntgoods + 0.5));
	return 0;
}

Measured memory_bytes: 1184
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();

		int ans=0;
		for (int i=0;i<N;i++) {
			if(sc.nextInt()>=K) {
				ans++;
			}
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 49612
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(void){
    // Your code here!
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    
    double PI = acos(-1);
    
    
    double rad = c * PI / 180;
    
    double s,l,h;
    
    s = a * b * sin(rad) * 0.5;
    l = sqrt(a*a + b*b -2*a*b*cos(rad))+a+b;
    h = 2 * s / a;
    
    
    
    printf("%f %f %f\n",s,l,h);
    
    
}



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

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

int main(void){
  int n,k; cin >> n >> k;
  int cnt = 0;
  while(n != 0){
    n = n/k;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

int main(){

	int l,r,d;
	cin >> l >> r >> d;

	int count = 0;
	for(int i=l;i<=r;i++){
		if((i%d)==0){
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

bool triangle(ll a,ll b, ll c){
    bool res=true;
    if(a==b||b==c||c==a){
        res=false;
        return false;
    }
    if(a+b<=c||b+c<=a||c+a<=b){
        res=false;
    }
    return res;
}
int main(){
    ll N;cin>>N;
    vector<ll>A(N);
    rep(i,N){
        cin>>A[i];
    }
    ll ans=0;
    rep(i,N-2){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                if(triangle(A[i],A[j],A[k])){
                    ans++;
                }
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;
string s;
int k;
int INF=1000000000;
int dh[4]={0,1,0,-1};
int dw[4]={1,0,-1,0};

int main(){
    ll x,y;
  cin>>x>>y;
    ll ans=0;
    ll t=x;
    while(t<=y){
        t*=2;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
// Ref : https://book.mynavi.jp/ec/products/detail/id=35408

#include <iostream>
#include <vector>

using namespace std;

class DisjointSet {
public:
	vector<int> rank, p;

	DisjointSet() {}
	DisjointSet(int size) {
		rank.resize(size, 0);
		p.resize(size, 0);
		for (int i = 0; i < size; i++) makeSet(i);
	}

	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}

	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}

	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}

	void link(int x, int y) {
		if (rank[x] > rank[y]) {
			p[y] = x;
		}
		else {
			p[x] = y;
			if (rank[x] == rank[y]) {
				rank[y]++;
			}
		}
	}

	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};

int main() {
	int n, q, com, a, b;

	cin >> n >> q;
	DisjointSet ds = DisjointSet(n);

	for (int i = 0; i < q; i++) {
		cin >> com >> a >> b;
		if (com == 0) ds.unite(a, b);
		else if (com == 1) {
			if (ds.same(a, b)) cout << 1 << endl;
			else cout << 0 << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n;i>s;i--)
#define rep_re(i,s,n)for(int i = n;i>=s;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 999;// 1e25;
static const ll MAX_N = 100001;

ll dp[51][510][510];
ll A[41];
ll B[41];
ll C[41];
void chmin(long long &a, long long b) { if (a > b) a = b; }

int  main() {
	ll n, ma, mb; cin >> n >> ma >> mb;
	ll M = 510;
	//repe(i, 1, n) cin >> A[i] >> B[i] >> C[i];
	rep(i, 0, n) cin >> A[i] >> B[i] >> C[i];

	rep(i, 0, 51)rep(j, 0, M)rep(k, 0, M) dp[i][j][k] = INF;

	dp[0][0][0] = 0;

	rep(i, 0, n) {//
		repe(a, 0, 500) {
			repe(b, 0, 500)
			{
				if (dp[i][a][b] < INF) {
					// 使わない
					chmin(dp[i + 1][a][b], dp[i][a][b]);

					// 使う
					chmin(dp[i + 1][a + A[i]][b + B[i]], dp[i][a][b] + C[i]);
					//dp[i + 1][a][b] = dp[i][a][b];
					//dp[i + 1][a + A[i]][b + B[i]] = min(dp[i + 1][a + A[i]][b + B[i]], dp[i][a][b] + C[i]);
				}
			}
		}
	}
	//repe(i, 1, n) {//
	//	repe(a, 0, M) {
	//		repe(b, 0, M)
	//		{
	//			if (dp[i - 1][a][b] != INF) {
	//				dp[i][a + A[i]][b + B[i]] = min(dp[i][a + A[i]][b + B[i]], dp[i - 1][a][b] + C[i]);
	//				dp[i][a][b] = dp[i - 1][a][b];
	//			}
	//		}
	//	}
	//}

	ll ans = INF;
	rep(aa, 1, 500) {
		rep(bb, 1, 500) {
			//if (dp[n][aa][bb] == INF) continue;
			if (aa * mb != bb * ma) continue;
			//chmin(ans, dp[n][aa][bb]);
			ans = min(ans, dp[n][aa][bb]);
		}
	}
	if (ans < INF) cout << ans << endl;
	else cout << -1 << endl;

	return 0;
}

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

int main() {
    long long N, M;
    cin >> N >> M;
    long long hidari=0;
    long long migi=N;
    vector<int> card(N, 1);
    for (long long i=0; i<M; i++) {
        long long L, R;
        cin >> L >> R;
        for (long long i=hidari; i<L-1; i++) card.at(i) = 0;
        for (long long i=R; i<migi; i++) card.at(i) = 0;
        hidari = max(hidari, L-1);
        migi = min(migi,R);
    }
    long long sum = std::accumulate(card.begin(), card.end(), 0);
    cout << sum << endl;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int x,y,z;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> x >> y >> z;
}

int solve(){
    swap(x,y);
    swap(x,z);
    printf("%d %d %d",x,y,z);
    return 0;
}   

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


Measured memory_bytes: 256
#b = int(input())
#n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]

s = input()

count = 0
for i in range(3):
    if(s[i] == "R"):
        count = 1

for i in range(2):
    if(s[i] == "R" and s[i+1] == "R"):
        count = 2

if(s[0] == "R" and s[1] == "R" and s[i+1] == "R"):
    count = 3

print(count)

Measured memory_bytes: 61640
N = int(input())
t0,x0,y0=0,0,0
for i in range(N):
  t,x,y = list(map(int, input().strip().split(' ')))
  l=x+y-x0-y0
  if (t0-t)%2 ^ l%2:print("No");exit()
  if t-t0<l:print("No");exit()
  t0,x0,y0=t,x,y
print("Yes")

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

const ll N = 3*MAX5;
// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k, z, l;
string s, t, d, c;

ll par[N], sz[N];
ll comp;
// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> m >> k;
	if(m == 1) {
		if(k == 0) cout<<"0 0 1 1\n";
		else cout<<"-1\n";
	}
	else {
		if(k <= (pow(2,m)-1)) {
			for(ll i=0;i<=pow(2,m)-1;i++) {
				if(i!=k) cout<<i<<" ";
			}
			cout<<k<<" ";
			for(ll i=pow(2,m)-1; i>=0 ;i--) {
				if(i!=k) cout<<i<<" ";
			}
			cout<<k;newl;
		}
		else {
			cout<<"-1\n";
		}
	}
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 4032
#include<iostream>
using namespace std;
int main(){
  long long n,i,j,sum,dp[3001][3001],mod=1000000007;
  char s[3333];
  cin>>n>>s;
  for(i=1;i<=n;i++)
    for(j=0;j<n;j++)
      dp[i][j]=0;
  for(j=0;j<n;j++)
    dp[0][j]=1;
  for(i=1;i<n;i++){
    sum=0;
    if(s[i-1]=='<'){
      for(j=n-i;j>0;j--){
        sum=(sum+dp[i-1][j])%mod;
        dp[i][j-1]=sum;
      }
    }
    else{
      for(j=0;j<n-i;j++){
        sum=(sum+dp[i-1][j])%mod;
        dp[i][j]=sum;
      }
    }
  }
  cout<<dp[n-1][0]<<endl;
}


Measured memory_bytes: 70656
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main(){
    int n,m,x,ans=inf; cin>>n>>m>>x;
    vector<int> c(n,0);
    vector<vector<int>> a(n,vector<int>(m,0));
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    rep(i,(1<<n)){
        vector<int> q(m,0);
        int cnt=0;
        rep(j,n){
            if(i&(1<<j)){
                cnt+=c[j];
                rep(v,m) q[v]+=a[j][v];
            }
        }
        rep(v,m){
            if(q[v]<x) break;
            if(v==m-1){
                ans=min(ans,cnt);
            }
        }
    }
    cout<<(ans==inf ? -1 : ans)<<endl;
}

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

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;

class Solver {
 public:
  int n;
  vector<unsigned long long> a, zero;
  string s;
  Solver(LL n) : n(n), a(n){};

  void solve() {
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    cin >> s;
    DBG(a, s)
    int r = 0;
    for (int i = s.length() - 1; i >= 0; --i) {
      if (s[i] == '0') {
        zero.push_back(a[i]);
        r = sweepout2(zero);
      } else {
        if (!solve(zero, a[i])) {
          cout << 1 << endl;
          return;
        }
      }
      DBG(zero)
    }
    cout << 0 << endl;
  }
  bool solve(vector<unsigned long long> &t, unsigned long long x) {
    int p = 60;
    DBG(t, x)
    for (int i = 0; i < (int)t.size(); ++i) {
      while (p >= 0 && !((t[i] >> p) & 1)) p--;
      DBG(p)
      if (p < 0) break;
      if ((x >> p) & 1) x ^= t[i];
    }
    return x == 0;
  }
  int sweepout2(vector<unsigned long long> &t) {
    int row = t.size(), n = 60, rank = 0;
    for (int i = n - 1; i >= 0; --i) {
      int p = rank;
      while (((t[p] >> i) & 1) == 0) {
        p++;
        if (p == row) break;
      }
      if (p == row) continue;
      swap(t[rank], t[p]);
      for (int j = 0; j < row; ++j) {
        if (j != rank && ((t[j] >> i) & 1)) t[j] ^= t[rank];
      }
      rank++;
      if (rank == min(n, row)) break;
    }
    return rank;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);
  int t;
  std::cin >> t;
  for (int i = 0; i < t; ++i) {
    long long n = 0;
    std::cin >> n;

    Problem::Solver sol(n);
    sol.solve();
  }

  return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include <map>

std::map<int, int> nmap;

int main(int argc, char const* argv[])
{
	std::map<int, int> my_map;
	std::map<int, int>::iterator itr;
	int n;
	int writed_num = 0;

	std::cin >> n;
	for(int i = 0; i < n; i++)
	{
		int num;

		std::cin >> num;
		my_map[num]++;
	}

	for(itr = my_map.begin(); itr != my_map.end(); itr++)
	{
		writed_num += my_map[itr->first] % 2 == 0 ? 0 : 1;
	}
	std::cout << writed_num;
	return 0;
}


Measured memory_bytes: 4864
import math
import numpy as np

K = int(input())

ind = np.ones(K)

for i in range(K):
    if i ==0:
        pass
    else:
        num = i+1
        # num num other
        cout =0
        for j in range(1,num):
            cout += math.gcd(num,j)
        ind[i] = ind[i-1] + cout*3
        
        # num other other
        
        cout=0
        for k in range(1,num):
            ene = math.gcd(num,k)
            for l in range(1,num):
                cout+= math.gcd(ene,l)
            
        ind[i]+= cout*3 +num
        
           
print(int(ind[-1]))



Measured memory_bytes: 27128
/*
    B - Polygon
    https://atcoder.jp/contests/abc117/tasks/abc117_b
*/
#include <bits/stdc++.h>
using namespace std;

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

    int n;
    cin >> n;

    int sum = 0;
    int _max = 0;
    for (int i = 0; i < n; i++) {
        int input;
        cin >> input;
        sum += input;
        _max = max(_max, input);
    }
    sum -= _max;
    if (sum > _max)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
	int x, a, b;
	int s1, s2;
	cin >> x >> a >> b;
	s1 = x - a;
	if (s1 < 0) s1 *= -1;

	s2 = x - b;
	if (s2 < 0) s2 *= -1;
	if (s1 > s2) cout << "B"<<endl;
	else cout << "A"<<endl;
    return 0;
}

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

using namespace std;

unsigned long sum =0;
int sp[10];

void sprit(string s, int n, int k){
    string s1, s2;
    stringstream ss;
    for (unsigned int i=1; i<=s.length()-k; i++){
        s1 = s.substr(0, i);
        s2 = s.substr(i);
        ss << s1;
        ss >> sp[n-k];
        ss.clear();
        if (k != 1){
            sprit(s2, n, k-1);
        }else{
            ss << s2;
            ss >> sp[n-k + 1];
            ss.clear();
            for (int j=0; j<=n; j++){
                sum += sp[j];
            }
        }  
    }
}

int main(){
    string s;
    stringstream ss;
    long x;
    cin >> s;
    unsigned int n=1;
    while (n != s.length()){
        sprit(s, n, n);
        n++;
    }
    ss << s;
    ss >> x;
    sum += x;

    cout << sum <<endl;
    return 0;
}

Measured memory_bytes: 3660
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int []S = new int[n + 1];
		for(int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int []T = new int[q];
		for(int i = 0; i < q; i++) {
			T[i] = scan.nextInt();
		}
		scan.close();
		int sum = 0;
		for(int i = 0; i < q; i++) {
			if(binarySearch(S, n, T[i]) == 1) {
				sum ++;
			}
		}
		System.out.println(sum);
	}
	public static int binarySearch(int[] A, int n, int key) {
		int left = 0;
		int right = n;
		int mid;
		while(left < right) {
			mid = (left + right) / 2;
			if(key == A[mid]) {
				return 1;
			}
			if(key > A[mid]) {
				left = mid + 1;
			}else if(key < A[mid]){
				right = mid;
			}
		}
		return 0;
	}
}


Measured memory_bytes: 68520
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 14:37:00 2020

@author: matsui
"""
import numpy as np
bingo=np.zeros([3,3])
result=np.zeros([3,3])
A=input().split()
bingo[0,0]=int(A[0])
bingo[0,1]=int(A[1])
bingo[0,2]=int(A[2])
A=input().split()
bingo[1,0]=int(A[0])
bingo[1,1]=int(A[1])
bingo[1,2]=int(A[2])
A=input().split()
bingo[2,0]=int(A[0])
bingo[2,1]=int(A[1])
bingo[2,2]=int(A[2])

N=int(input())
for i in range(N):
    b=int(input())
    for j in range(3):
        for k in range(3):
            if bingo[j,k]==b: result[j,k]=1

ans='No'
if result[0,0]==1 and result[0,1]==1 and result[0,2]==1: ans='Yes'
if result[1,0]==1 and result[1,1]==1 and result[1,2]==1: ans='Yes'
if result[2,0]==1 and result[2,1]==1 and result[2,2]==1: ans='Yes'

if result[0,0]==1 and result[1,0]==1 and result[2,0]==1: ans='Yes'
if result[0,1]==1 and result[1,1]==1 and result[2,1]==1: ans='Yes'
if result[0,2]==1 and result[1,2]==1 and result[2,2]==1: ans='Yes'

if result[0,0]==1 and result[1,1]==1 and result[2,2]==1: ans='Yes'
if result[0,2]==1 and result[1,1]==1 and result[2,0]==1: ans='Yes'

print(ans)
#print(bingo)
#print(result)

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
//

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int n; cin >> n;
    vector<int> vec(n);
    for(int i = 0; i < n; ++i){
        cin >> vec[i];
    }
    int ans = 0;
    int max_h = 0;
    for(int i = 0; i < n; ++i) {
        if (max_h <= vec[i]) {
            max_h = vec[i];
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/*
                IftekharMd.Shishir
                Dept. of Information and Communication Engineering
                University of Rajshahi
*/

#include<bits/stdc++.h>

#define ll  long long
#define ull  unsigned long long
#define ld  long double
#define f(i,n)  for(i=0;i<n;i++)
#define F(i,n)  for(i=n-1;i>=0;i--)
#define fa(i,a,b)  for(i=a;i<=b;i++)
#define Fa(i,a,b)  for(i=a;i>=b;i--)
#define printArray(i,a,n)  f(i,n)cout<<a[i]<<" "; cout<<endl;
#define printSet(a)  for(auto setData:a) cout<<setData<<" ";cout<<endl;
#define printMap(a)  for(auto mapData:a) cout<<mapData.first<<" "<<mapData.second<<endl;
#define printVector(a)  for(auto vectorData:a)cout<<vectorData<<" ";cout<<endl;
#define printLinkedList()  temp=head;while(temp){cout<<temp->data<<" ";temp=temp->post;} cout<<endl;

#define pb(x)  push_back(x)
#define all(a)  a.begin(),a.end()
#define rall(a)  a.rbegin(),a.rend()
#define sor(a)  sort(a.begin(),a.end())
#define rev(a)  reverse(a.begin(),a.end())
#define mem(a,x)  memset(a,x,sizeof(a))
//[ ll *it; it = maxElement(a,a+n); ]

#define bs  binary_search
#define lb  lower_bound
#define ub  upper_bound
#define mp  make_pair
#define txtIO  freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define txtTest freopen("C:/Users/Iftekhar/Documents/what/input.txt", "r", stdin);
#define FastIO  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
#define TestCase  ll t;cin>>t;while(t--)
#define points(x)  fixed<<setprecision(x)
#define scd(a,x,y)  a/__gcd(x,y);
#define nl  cout<<endl;
#define done  return 0

const ld PI= 3.14159265358979323846264338327950288;  //2*acos(0.0);
const long long MOD= 1000000007;
const long long MAX = 32000;

// stringstream demo(str);  demo >> x;
// stringstream demo;  demo << x;  name=demo.str();

using namespace std;


int main()
{
        FastIO;
        //txtTest;
        string a;
        cin>>a;
        if(a[a.size()-1]=='s') a.pb('e'),a.pb('s'), cout<< a<<endl;
        else a.pb('s'), cout<< a << endl;
        done;
}

Measured memory_bytes: 3660
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000
struct Card{
	char suit;
	int value;
};
struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right)
{
	int i,j,k;
	int n1 = mid -left;
	int n2 = right - mid;
	for(i=0; i<n1;i++)
	{
		L[i] = A[left+i];
	}
	for(int i=0;i<n2;i++)
	{
		R[i] = A[mid+i];
	}
	L[n1].value=R[n2].value=SENTINEL;
	i=0;
	j=0;
	for(k=left;k<right;k++)
	{
		if(L[i].value<=R[j].value)
		{
			A[k]=L[i++];
		}
		else
		{
			A[k]=R[j++];
		}
	}
}

void mergeSort(int A[],int n,int left,int right)
{
	int mid;
	if(left+1<right)
	{
		mid = (left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
		
	}
}

int partition(struct Card A[], int n, int p,int r)
{
	int j;
	struct Card t,x;
	x=A[r];
	int i=p-1;
	for(j=p;j<r;j++)
	{
		if(A[j].value<=x.value)
		{
			i++;
			t=A[i];
			A[i]=A[j];
			A[j]=t;
		}
	}
	t=A[i+1];A[i+1]=A[r];
	A[r]=t;
	return i+1;
}
void quickSort(struct Card A[],int n,int p,int r)
{
	int q;
	if(p<r)
	{
		q=partition(A,n,p,r);
		quickSort(A,n,p,q-1);
		quickSort(A,n,q+1,r);
	}
}

int main(void)
{
	int n,i,v;
	struct Card A[MAX],B[MAX];
	char S[10];
	int stable = 1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %d",S,&v);
		A[i].suit = B[i].suit=S[0];
		A[i].value=B[i].value=v;
	}
	
	mergeSort(A,n,0,n);
	quickSort(B,n,0,n-1);
	for(i=0;i<n;i++)
	{
		if(A[i].suit !=B[i].suit)
		{
			stable=0;
		}
	}
	
	if(stable==1)
	{
		printf("Stable\n");
	}
	else printf("Not stable\n");
	for(i=0;i<n;i++)
	{
		printf("%c %d\n",B[i].suit,B[i].value);
	}
	return 0;
}


Measured memory_bytes: 4032
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long   ll;
typedef unsigned long long   ull;
typedef long double ld;
typedef pair<ll, ll>    pll;
typedef pair<ull, ull>    pull;
typedef pair<ll, ll>  pii;
typedef pair<ld, ld>  pld;
ll n, w;
ll dp[1000009];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    
    cin >> n >> w;
    for(ll i = 0; i <= 1e5; ++i)
        dp[i] = 1e18;
    ll x, y;
    for(ll i = 0; i < n; ++i){
        cin >> x >> y;
        for(ll i = 1e5; i > 0; --i){
            dp[i+y] = min(dp[i+y], dp[i]+x);
        }
        dp[y] = min(dp[y], x);
    }
    for(ll i = 1e5; i > 0; --i){
        if(dp[i] <= w){
            cout << i << "\n";
            return 0;
        }
    }
}

Measured memory_bytes: 1024