akhauriyash/Code-Regression huggingface dataset:
import sys
input = sys.stdin.readline
from operator import add, itemgetter


class RMQ():
    
    def __init__(self, size, op=min, init_value=10**8):
        """初期化"""
        self.size = size
        self.op = op
        self.init_value = init_value
        n = 2 ** ((size-1).bit_length())
        treesize = n * 2
        st = [init_value] * treesize
        self.st = st
        self.offset = len(st) // 2

    @classmethod
    def from_array(cls, a, op=min, init_value=10**8):
        st = cls(len(a), op=op, init_value=init_value)
        for i, x in enumerate(a):
            st.update(i, x)
        return st

    def update(self, key, value):
        """値の更新"""
        k = self.offset + key
        self.st[k] = value
        k >>= 1
        while k > 0:
            self.st[k] = self.op(self.st[k * 2], self.st[k * 2 + 1])
            k >>= 1

    def _query_bottomup(self, a, b):
        """区間[a, b) に対する累積操作
        """
        a += self.offset
        b += self.offset - 1
        s = self.init_value
        while a < b:
            if a & 1:
                s = self.op(s, self.st[a])
                a += 1
            a >>= 1
            if not b & 1:
                s = self.op(s, self.st[b])
                b -= 1
            b >>= 1
        if a == b:
            s = self.op(s, self.st[a])
        return s

    def _query_topdown(self, a, b, k=1, l=0, r=-1):
        """区間[a, b) に対する累積操作
        k: 着目しているノード (1-indexed)
        l: 探索区間 st[l, r) の左端 (0-indexed)
        r: 探索区間 st[l, r) の右端 (0-indexed)
        """
        if r == -1:
            r = self.offset
        if r <= a or b <= l:
            return self.init_value
        if a <= l and r <= b:
            return self.st[k]
        mid = (l + r) // 2
        lv = self._query_topdown(a, b, k * 2, l, mid)
        rv = self._query_topdown(a, b, k * 2 + 1, mid, r)
        return self.op(lv, rv)

    def query(self, a, b):
        """区間[a, b) に対する累積操作"""
        if a > b:
            raise ValueError("a must be less than equal b.")
        return self._query_bottomup(a, b)


def read():
    N, Q = map(int, input().strip().split())
    C = list(map(int, input().strip().split()))
    # クエリ [l, r) とその順序を持っておく
    LRI = []
    for i in range(Q):
        l, r = map(int, input().strip().split())
        LRI.append((l-1, r, i))
    return N, Q, C, LRI


def solve(N, Q, C, LRI, INF=10**7):
    prev = [-1 for i in range(N+1)]
    ans = [0 for i in range(Q)]
    
    rmq = RMQ(N, op=add, init_value=0)
    # Rの昇順にソート
    LRI.sort(key=itemgetter(1))
    r_prev = 0
    for l, r, i in LRI:
        for j in range(r_prev, r):
            c = C[j]
            # A[prev[c]] = 0
            if prev[c] != -1:
                rmq.update(prev[c], 0)
            prev[c] = j
            # A[j] = 1
            rmq.update(j, 1)
        r_prev = r
        ans[i] = rmq.query(l, r)

    for a in ans:
        print(a)


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


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

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

typedef long long ll;

ll INF = 100000000000000;
ll MOD = 1e9+7;

int main(){
    ll N;cin >> N;
    vector<ll> A(N);
    for(int i = 0;i < N;i++){
        cin >> A[i];
    }
    bitset<35> S;
    ll ans = 0,l = 0,r = 0;
    while(r < N){
        //cout << '(' << l << ',' << r << ')' <<S<< endl;
        bool frag = true;
        bitset<35> T(A[r]);
        for(int i = 0;i < 35;i++){
            if(S.test(i) && T.test(i)){
                frag = false;
            }
        }
        if(frag){
            S ^= T;
            ans += r - l + 1;
            r++;
        }else{
            bitset<35> U(A[l]);
            for(int i = 0;i < 35;i++){
                if(U.test(i) && S.test(i)){
                    S.set(i,0);
                }
            }
            l++;
        }
        if(l > r){
            break;
        }
    }
    cout << ans << endl;
}


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

int main()
{
    long long n, k;
    cin >> n >> k;
    if (n%k==0) cout << 0;
    else if (n>k)
    {
        if (n-(n/k)*k<=(n-(n/k+1)*k)*(-1)) cout << n-(n/k)*k;
        else cout << (n-(n/k+1)*k)*(-1);
    }
    else if (n<k)
    {
        if (n<=k-n)  cout << n;
        else cout << k-n;
    }


}


Measured memory_bytes: 256
s = int(input())
M = [-1]*1000001
As = [s]
M[s] = 0
for i in range(1, 1000001):
  a = As[i-1]
  b = a//2 if a%2 == 0 else 3*a+1
  if not(M[b] < 0):
    print(i+1)
    exit()
  M[b] = i
  As.append(b)
print(-1)


Measured memory_bytes: 10868
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

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

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main(){
ll n;
cin>>n;
ll a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
}
sort(a,a+n,greater<ll>());
ll sum=0;
sum+=a[0]/2;
for(int i=1;i<n;i++){
    sum+=a[i];
}
cout<<sum<<endl;
}












Measured memory_bytes: 256
/**
 *     created by: nayakashutosh9
 *	   "Winners Never Quit and Quitters Never Win".
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl '\n'
#define mod 1000000007
#define inf 1e18
const int N = 300005;

/*************************************/



void solve() {

	int n; cin >> n;
	unordered_map<string, int> m;
	for (int i = 0; i < n; i++) {
		string x; cin >> x;
		m[x]++;
	}
	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;

}
int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout<<"Case #"<<(z++)<<": ";
		// clock_t clockst = clock();
		solve();
		// clock_t clocked = clock();
		// cout << clocked - clockst << endl;
	}

	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define int long long

using namespace std;

void B_MIX_JUICE() {
    int n, k, x, res = 0;
    cin >> n >> k;
    vector<int>kek;
    while(n--) {
        cin >> x;
        kek.push_back(x);
    }
    sort(kek.begin(), kek.end());
    for(int i = 0; i < k; i++) {
        res+=kek[i];
    }
    cout << res << "\n";
}


int power(int a, int p) {
    int res = 1;
    for(int i = 1; i <= p; i++) {
        res *= a;
    }
    return res;
}


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int x, tmp, deg = 1;
    string s;
    cin >> x;
    while(x > 0) {
        x-=1;
        s.push_back(97 + x % 26);
        x /= 26;
    }

    for(int i = s.size()-1; i >= 0; i--) {
        cout << s[i];
    }


    return 0;
}


Measured memory_bytes: 3520
N,M = map(int, input().split(' '))
A = []

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

if N == 1 and M == 0:
  print("0")
  exit()
  
for i in range(M):
  A.append(input().split(' '))

A = get_unique_list(A)

B = {}
for i in range(len(A)):
  if str(A[i][0]) in B:
    print("-1")
    exit()
  B[str(A[i][0])] = A[i][1]
if "1" in B:
  if M != 1:
    if B['1'] == "0":
      print("-1")
      exit()
  if N != 1:
    if B['1'] == "0":
      print("-1")
      exit()
ans=""  

for i in range(N):
  if str(i + 1) in B:
    ans = ans + B[str(i + 1)]
    continue
  if i == 0:
    ans = ans + "1"
    continue
  ans = ans + "0"
print(int(ans))

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;
const ll mod = 1000000007;

void solve() {
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i = k; i <= n + 1; i++) {
        ans = (ans + (n - i + 1) * i + 1) % mod;
    }
    cout << ans << endl;
    return;
}

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


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

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

    ll N, K;
    cin >> N >> K;
    vll d(K);
    vvll A(K);
    rep(i, K){
        cin >> d[i];
        A[i] = vll(d[i]);
        rep(j, d[i]) cin >> A[i][j];
    }

    vll c(N, 0);
    rep(i, K) rep(j, d[i]){
        c[A[i][j]-1] = 1;
    }
    ll count = 0;
    rep(i, N){
        if(c[i]==0) ++count;
    }
    cout << count << endl;
}


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

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int count = 0;
  for (int i = 0; i+2 < s.size(); i++){
      if( s[i] == 'A' ){
        if(s[i+1] == 'B'){
          if(s[i+2] == 'C'){
              count++;
          }
        }
      }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define mod 1000000007
#define N 1005
using namespace std;

typedef long long ll;

ll n, x[N], y[N], r[N];
double d[N];
vector < pair < ll , double > > g[N];
priority_queue < pair < double , ll > > q;

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	for(ll i = 1; i <= 2; i++)
		scanf("%lld %lld",x + i, y + i);
	scanf("%lld",&n);
	n += 3;
	for(ll i = 3; i <= n; i++)
		scanf("%lld %lld %lld",x + i, y + i, r + i);
	for(ll i = 1; i <= n; i++)
		for(ll j = 1; j <= n; j++){
			double uz = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
			uz -= r[i];
			uz -= r[j];
			uz = max(uz, 0.0);
			g[i].pb(mp(j, uz));
			g[j].pb(mp(i, uz));
		}
	for(ll i = 2; i <= n; i++)
		d[i] = 1.0*mod*100000;
	q.push(mp(0, 1));
	while(!q.empty()){
		ll node = q.top().nd;
		q.pop();
		for(ll i = 0; i < g[node].size(); i++){
			ll coc = g[node][i].st;
			double yol = g[node][i].nd;
			if(d[coc] > d[node] + yol){
				d[coc] = d[node] + yol;
				q.push(mp(-d[coc], coc));
			}
		}
	}
	printf("%.10lf\n", d[2]);
	return 0;
}

Measured memory_bytes: 38768
//ÃˆÃ“Ã£ Ã‡Ã¡Ã¡Ã¥ Ã¦Ã¡Ã‡ ÃÃ¦Ã¡ Ã¦Ã¡Ã‡ ÃžÃ¦Ã‰ Ã…Ã¡Ã‡ ÃˆÃ‡Ã¡Ã¡Ã¥
#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
#define pb push_back
#define ins insert
#define be begin
#define en end
#define fast ios::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
using namespace std;
const int INF=1e9;
//ll a,b;
ll a[202020],b[202020];
vector<ll>v;
pair<ll,ll>p;
map<string,int>mp;
//map<string,int>::iterator it;
set<ll>st;
set<ll>::iterator it;
string s;
ll q,t,n,m,k,z,x,y,d,sum,cnt,mx=0;
int main(){
	fast;
	int S,T,D;	
	cin>>D>>T>>S;
	if(S*T>=D)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}

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

int sumd(int x) {
    int res = 0;
    while (x != 0) {
        res += x % 10;
        x /= 10;
    }
    return res;
}

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

    int ans = INF;
    for (int i = 1; i < n;++i){
        int j = n - i;

        ans = min(ans, sumd(i) + sumd(j));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<int,int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define error(x) cerr << #x << " = " << x << endl
#define sz(x) (int)(x).size()
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int INF = 1e9 + 7;

int main(void) {
    ios_base::sync_with_stdio(0), cin.tie(nullptr);
    string s;
    for (int i = 0; i < 3; ++i) {
       string a; cin >> a;
       s += toupper(a[0]);
    }
    cout << s << '\n';
    return 0;
}


Measured memory_bytes: 256
def total(inlist,k):
    print(sum([ abs(i-k) for i in inlist ]))
    return
n = int(input())
a_list = [ int(v) for v in input().split() ]
a_list = [ v-i for i, v in enumerate(a_list,1) ]
a_list.sort()

total(a_list,a_list[n//2])

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

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

#define FOR(i,a,b) for(ll 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 br() p("")
#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;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

struct Card{
    ll v;
    char c;

    Card(ll _v, char _c){
        v = _v;
        c = _c;
    }
    Card(){}
    
    bool operator<(const Card &another) const
    {
        return v < another.v;
    }

    string ToString(){
        stringstream ss;
        ss << c << ' ' << v;
        return ss.str();
    }
};

ll partition(vector<Card>& A, ll p, ll r){
    ll x = A[r].v;
    ll i = p-1;
    FOR(j, p, r){
        if(A[j].v<=x){
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);
    return i+1;
}

void quick_sort(vector<Card>& A, ll p, ll r){
    if(p<r){
        ll q = partition(A, p, r);
        quick_sort(A, p, q-1);
        quick_sort(A, q+1, r);
    }
}

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

    // input
    ll N;
    cin >> N;

    vector<Card> A(N);
    FOR(i, 0, N){
        char c;
        ll v;
        cin >> c >> v;
        A[i] = Card(v, c);
    }

    auto B = A;

    quick_sort(A, 0, N-1);
    stable_sort(ALL(B));

    bool is_stable = true;
    FOR(i, 0, N){
        auto a = A[i];
        auto b = B[i];
        if(a.v==b.v && a.c==b.c){
            //
        }else{
            is_stable = false;
        }
    }
    
    if(is_stable){
        p("Stable");
    }else{
        p("Not stable");
    }

    FOR(i, 0, N){
        p(A[i].ToString());
    }
    
    return 0;
}


Measured memory_bytes: 7464
#include <stdio.h>
#define NMAX 200000
#define INF 1e11
#define abs(a) ((a) > 0 ? (a) : -(a))
#define min(a, b) ((a) < (b) ? (a) : (b))
long long bit[NMAX+1], revbit[NMAX+1];

void add(int index, long long value, int size);
long long minimize(int index);
void revadd(int index, long long value);
long long revminimize(int index, int size);
int main(void)
{
  int i, n, q, a, b;
  long long qsum = 0, ans = INF, dp[NMAX+1];
  scanf("%d %d %d %d", &n, &q, &a, &b);
  for (i = 0; i <= n; i++) bit[i] = revbit[i] = dp[i] = INF;
  dp[a] = 0;
  add(a, dp[a] - a, n);
  revadd(a, dp[a] + a);
  while (q--) {;
    long long tmin, rtmin, res;
    a = b;
    scanf("%d", &b);
    qsum += abs(a - b);
    tmin = minimize(b) + b;
    rtmin = revminimize(b, n) - b;
    dp[a] = min(tmin, rtmin) - abs(a - b);
    add(a, dp[a] - a, n);
    revadd(a, dp[a] + a);
  }
  for (i = 0; i <= n; i++) {
    if (ans > dp[i]) ans = dp[i];
  }
  printf("%lld\n", ans + qsum);
}

void add(int index, long long value, int size)
{
  while (index <= size) {
    if (bit[index] > value) bit[index] = value;
    index += index & (-index);
  }
}

long long minimize(int index)
{
  long long bmin = INF;
  while (index > 0) {
    if (bmin > bit[index]) bmin = bit[index];
    index -= index & (-index);
  }
  return bmin;
}

void revadd(int index, long long value)
{
  while (index > 0) {
    if (revbit[index] > value) revbit[index] = value;
    index -= index & (-index);
  }
}

long long revminimize(int index, int size)
{
  long long bmin = INF;
  while (index <= size) {
    if (bmin > revbit[index]) bmin = revbit[index];
    index += index & (-index);
  }
  return bmin;
}

Measured memory_bytes: 4864
#include <algorithm>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<ll, ll> P;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define all(c) c.begin(), c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main() {
    int r;
    cin >> r;
    cout << r * r;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define inf 20021225
#define ll long long
#define mxn 100010
using namespace std;
 
ll a[mxn],n;
 
int main()
{
	scanf("%lld",&n);ll ans=0;
	for(int i=1;i<=n;i++)	scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)
	{
		ll cnt=a[i];
		while(i<n && a[i+1]!=0)	cnt+=a[i+1],i++;
		ans+=cnt/2;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 896
import java.util.*;
public class Main {
    public static void main(final String[] args){
        final Scanner sc = new Scanner(System.in);
        
        final String color1 = sc.next();
        final String color2 = sc.next();

        // スペース区切りの整数の入力
        int color1_n = sc.nextInt();
        int color2_n = sc.nextInt();
        // 文字列の入力
        final String target = sc.next();

        if(target.equals(color1)){
            color1_n--;
        }else if(target.equals(color2)){
            color2_n--;
        }
        // 出力
        System.out.println(color1_n + " " + color2_n);
        sc.close();
    }
}

Measured memory_bytes: 23252
program main
  
  implicit none
  character(6) :: s
  integer :: n
  
  read(*,*) s
  n = 0 
  if( s(3:3) == s(4:4) ) n = n + 1
  if( s(5:5) == s(6:6) ) n = n + 1
 
  if( n == 2 ) then
     print*, "Yes"
  else
     print*, "No"
  end if
end program main


Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;

#define REP(i,e,s) for(register int i=e; i<=s; i++)
#define DREP(i,e,s) for(register int i=e; i>=s; i--)
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)

int read() {
	int x=0,f=1,ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
const int MAXN=100000+10;
int h[MAXN],use[MAXN];

int main() {
	int n=read();
	REP(i,1,n) h[i]=read();h[0]=-10000;

	REP(i,1,n) {
		if(h[i]>=h[i-1]+1) h[i]--;
	}
	REP(i,1,n) if(h[i]<h[i-1]) {puts("No"); return 0;}
	puts("Yes");
	return 0;
}

/*
5
1 2 2 2 1
*/


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

Vls = input().split(" ")

V = []

for i in range(0,len(Vls)):
    V.append(int(Vls[i]))

Cls = input().split(" ")

C = []

for i in range(0,len(Cls)):
    C.append(int(Cls[i]))


Max = 0

for i in range(0,N):
    if V[i] - C[i] >= 0:
        Max += V[i] - C[i]

print(Max)


Measured memory_bytes: 3064
K = int(input())

ans = 9

def countup(before):
  global ans
  global K
  next_arr = []
  for s in before:
    for diff in range(-1, 2):
      next_num = int(s[-1]) + diff
      if(0 <= next_num and next_num <= 9):
        next_arr.append(s + str(next_num))
        ans += 1
        if(ans == K):
          print(s + str(next_num))
          exit()
  return next_arr


if(K < 10):
  print(K)
  exit()
hoge = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
for _ in range(100):
  hoge = countup(hoge)

Measured memory_bytes: 8596
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)

using namespace std;

struct Dice {
  int l,r,f,b,d,u;
  void L() {
    int tmp = l;
    l = u;
    u = r;
    r = d;
    d = tmp;
  }
  void R() {
    L(); L(); L();
  }
  void F() {
    int tmp = f;
    f = u;
    u = b;
    b = d;
    d = tmp;
  }
  void B() {
    F(); F(); F();
  }
};

int main() {
  while (true) {
    int n;
    cin>>n;
    if (!n) break;
    using P = pair<int,int>;
    vector<map<P,int>> vd;
    REP(i,n) {
      int x,y;
      cin>>x>>y;
      int l,r,f,b,d,u;
      cin>>l>>r>>f>>b>>d>>u;
      Dice dice = {l, r, f, b, d, u};
      map<P,int> mp;
      mp[make_pair(x,y)] = dice.d;
      string s;
      cin>>s;
      for (char c:s) {
        switch (c) {
          case 'L':
            dice.L();
            --x;
            break;
          case 'R':
            dice.R();
            ++x;
            break;
          case 'F':
            dice.F();
            --y;
            break;
          case 'B':
            dice.B();
            ++y;
            break;
        }
        mp[make_pair(x,y)] = dice.d;
      }
      vd.push_back(move(mp));
    }
    vector<set<P>> vs(1<<n);
    REP(i,1<<n) {
      REP(j,n) {
        if ((i>>j) & 1) {
          for (auto p : vd[j]) {
            vs[i].insert(p.first);
          }
        }
      }
    }
    vector<int> dp(1<<n, 0);
    REP(i,1<<n) {
      REP(j,n) {
        if (!((i>>j)&1)) {
          int score = 0;
          for (auto p : vd[j]) {
            if (vs[i].count(p.first)) continue;
            score += p.second;
          }
          dp[i|(1<<j)] = max(dp[i|(1<<j)], dp[i] + score);
        }
      }
    }
    cout << dp.back() << endl;
  }
  return 0;
}

Measured memory_bytes: 234920
def cumsum_2d(arr, cumsum_from='top_left'):
    K = len(arr)  # arr: K * K array
    ret = [[0 for _ in range(K)] for _ in range(K)]
    # 行方向に累積和
    for y in range(K):
        v = 0
        for x in range(K):
            if 'right' in cumsum_from:
                x = K - 1 - x
            v += arr[y][x]
            ret[y][x] = v
    # 列方向に累積和
    for y in range(1, K):
        before_y = y - 1
        if 'bottom' in cumsum_from:
            y = K - 1 - y
            before_y = y + 1
        for x in range(K):
            ret[y][x] += ret[before_y][x]
    return ret


def main():
    N, K = list(map(int, input().split()))
    # 同じ色になるセルをひとまとめにする
    field_even = [[0 for _ in range(K)] for _ in range(K)]
    field_odd = [[0 for _ in range(K)] for _ in range(K)]
    for _ in range(N):
        X, Y, C = input().split()
        X = int(X) - 1
        Y = int(Y) - 1
        white_flag = 1 if C == 'W' else 0
        score = X // K + Y // K + white_flag
        if score % 2 == 0:
            field_even[Y % K][X % K] += 1
        else:
            field_odd[Y % K][X % K] += 1
    # 右上・右下・左上・左下からの2次元累積和
    even_tr = cumsum_2d(field_even, 'top_right')
    even_br = cumsum_2d(field_even, 'bottom_right')
    even_tl = cumsum_2d(field_even, 'top_left')
    even_bl = cumsum_2d(field_even, 'bottom_left')
    odd_tr = cumsum_2d(field_odd, 'top_right')
    odd_br = cumsum_2d(field_odd, 'bottom_right')
    odd_tl = cumsum_2d(field_odd, 'top_left')
    odd_bl = cumsum_2d(field_odd, 'bottom_left')
    # K * Kの正方形内の分割方法を全通り試して答えを求める
    # 分割のうち、左上の正方形の右下のセルの座標で場合分け
    ans = 0
    for y in range(-1, K):
        for x in range(-1, K):
            # pattern 1
            c = 0
            if y >= 0 and x >= 0:
                c += even_tl[y][x]
            if y + 1 < K and x + 1 < K:
                c += even_br[y + 1][x + 1]
            if y + 1 < K and x >= 0:
                c += odd_bl[y + 1][x]
            if y >= 0 and x + 1 < K:
                c += odd_tr[y][x + 1]
            ans = max(ans, c)
            # pattern 2(oddとeven入れ替え（白黒反転）)
            c = 0
            if y >= 0 and x >= 0:
                c += odd_tl[y][x]
            if y + 1 < K and x + 1 < K:
                c += odd_br[y + 1][x + 1]
            if y + 1 < K and x >= 0:
                c += even_bl[y + 1][x]
            if y >= 0 and x + 1 < K:
                c += even_tr[y][x + 1]
            ans = max(ans, c)
    print(ans)


if __name__ == '__main__':
    main()

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

using namespace std;

int main()
{
    int N;
    while(cin >> N, N)
    {
        int Y;
        int b, r, t;
        int ans;
        double ma = 0;
        cin >> Y;
        for(int i = 0; i < N; i++)
        {
            cin >> b >> r >> t;
            double latte = ((t == 1) ? (1 + Y * (r / 100.0)) : pow(1 + r / 100.0, Y));
            if(latte > ma)
            {
                ma = latte;
                ans = b;
            }
        }
        printf("%d\n", ans);
    }
}

Measured memory_bytes: 1148
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;

constexpr int INF = 1e9;
constexpr ll BIGINF = 1e18;
constexpr double EPS = 1e-16;
constexpr int MOD = 1e9 + 7;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int n;

vector<int> a;

void input() {
  cin >> n;

  a.resize(n);
  for (auto&& i : a) {
    cin >> i;
  }
}

void solve() {
  int ans = 1e9;

  for (int i = 1; i <= 100; ++i) {
    int cur = 0;

    for (auto&& j : a) {
      cur += (j - i) * (j - i);
    }

    ans = min(ans, cur);
  }

  cout << ans << '\n';
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();

  int t = 1;
//  cin >> t;

#ifdef _DEBUG
  t = 2;
#endif

  while (t--) {
    input();
    solve();
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = x * a + y * b;
    int ans2 = c * 2 * max(x, y);
    int ans3 = c * 2 * min(x, y) + a * (x - min(x, y)) + b * (y - min(x ,y));
    ans = min(ans, min(ans2, ans3));
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
int main()
{
	int A; //X
	int B; //Y
	int C; //Y=
	int D; //Y+
	int P; //JOI
	int X, Y;
	std::cin >> A >> B >> C >> D >> P;
	X = P * A;
	if (P > C) {
		Y = B + (P - C)*D;
	}
	else if (P < C) {
		Y = B;
	}
	if (X > Y) {
		std::cout << Y << std::endl;
	}
	else if (X < Y) {
		std::cout << X << std::endl;
	}
	return 0;
}


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

int main() {
  int DIV = 2019;
  int L, R; cin >> L >> R;
  int l, r;
  if (R-L+1 >= DIV) { l = 0; r = DIV; }
  else if (R % DIV < L % DIV) { l = L % DIV - DIV; r = (R+1) % DIV; }
  else { l = L % DIV; r = R % DIV + 1; }
  int min_num = 1e+9;
  for (int i = l; i < r-1; i++) {
    for (int j = i+1; j < r; j++) {
      min_num = min(min_num, (i+DIV)*(j+DIV)%DIV);
    }
  }
  cout << min_num << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char S[1001];
	scanf("%s", S);
	
	int i, count[4] = {};
	for (i = 0; S[i] != 0; i++) {
		if (S[i] == 'N') count[0]++;
		else if (S[i] == 'W') count[1]++;
		else if (S[i] == 'S') count[2]++;
		else count[3]++;
	}
	
	if (count[0] * count[1] * count[2] * count[3] != 0) printf("Yes\n");
	else if (count[0] == 0 && count[2] == 0 && count[1] * count[3] != 0) printf("Yes\n");
	else if (count[1] == 0 && count[3] == 0 && count[0] * count[2] != 0) printf("Yes\n");
	else if (count[0] == 0 && count[1] == 0 && count[2] == 0 && count[3] == 0) printf("Yes\n");
	else printf("No\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
def main():
    A = input()
    B = input()
    if A == B:
        print("EQUAL")
    elif len(A) == len(B):
        for i in range(len(A)):
            if A[i] > B[i]:
                print("GREATER")
                break
            elif A[i] < B[i]:
                print("LESS")
                break
    elif len(A) > len(B):
        print("GREATER")
    else:
        print("LESS")

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

	int N, M;
	cin >> N >> M;

	vector<int> num( N, 1 );
	vector<bool> red( N );
	red[0] = true;

	for( int i = 0; i < M; ++i ) {
		int x, y;
		cin >> x >> y;
		x -= 1;
		y -= 1;

		if( red[x] ) { red[y] = true; }
		num[x] -= 1;
		num[y] += 1;
		if( num[x] == 0 ) { red[x] = false; }
	}

	int ans = 0;
	for( int i = 0; i < N; ++i ) {
		ans += red[i];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
N = int(input())
S = list(input())
ans_lsit = []
for i in range(N):
    count = 0
    tmp = list(set(S[:i]))
    for j in range(len(tmp)):
        if tmp[j] in S[i:]:
            count += 1
    ans_lsit.append(count)

ans = max(ans_lsit)
print(ans)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);

        String str ="";
        while(sc.hasNextLine()){
            String sentense = sc.nextLine();
            str += sentense;
        }
//         System.out.println(str + " : ");
        int length = str.length();
        int count = 0;
        int i;
        int j;
 //       char [] c = new char[str.length()];
        String abc ="abcdefghijklmnopqrstuvwxyz";
        
        String[] strArray = str.split("");
        String[] abcArray = abc.split("");
 //     while(sc.hasNextLine()){      
            for(i = 0; i < 26; i++){
                for(j = 0; j < length; j++){    
     //           char c = str.charAt(i);//一文字づつみていく
                  if(abcArray[i].equalsIgnoreCase(strArray[j])){
                    count++;
                  }
                }
     //             }else{
       //               System.out.print("");
         //         }
            System.out.println(abcArray[i] + " : "+count);
            count = 0;
                
//            }
      }
    }
}




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

//macro
#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, n, m) for(int i = m; i < n; ++i)
#define LL long long

using namespace std;

typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;

int main(){
	int n;
	int a[101];
	int ranking[] = {399, 799, 1199, 1599, 1999, 2399, 2799, 3199};
	int rankcolor[] = {0, 0, 0, 0, 0, 0, 0, 0};
	cin >> n;
	int sum = 0;
	int freedom = 0;

	REP(i, n){
		int x;
		cin >> x;
		REP(j, 8){
			if(x <= ranking[j]){
				rankcolor[j] = 1;
				break;
			}
		}
		if(x >= 3200){
		freedom++;
		}
	
	}

	REP(i, 8){
		sum+=rankcolor[i];
	}

	cout << max(1 ,sum) << " " << sum + freedom << endl;
	
}


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

#define loop(s, e, i) for (int i=s; i<e; ++i)
#define print(s) cout << s << endl;
using namespace std;
using ll = long long;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

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

int main() {
  ll N;
  cin >> N;
  vector<pair<ll, ll>> A(N);
  loop(0, N, i) {
    ll a, b;
    cin >> a >> b;
    A[i] = make_pair(b, a);
  }
  sort(A.begin(), A.end());

  ll now = 0;
  bool result = true;
  loop(0, N, i) {
    now += A[i].second;
    if (now > A[i].first) {
      result = false;
      break;
    }
  }
  if (result) {
    print("Yes");
  } else{
    print("No");
  }
  
}

Measured memory_bytes: 6404
package main

import "fmt"

func main() {
	var s, ans string
	fmt.Scan(&s)
	for _, letter := range s {
		if letter != 'B' {
			ans += string(letter)
		} else if ans != "" {
			ans = ans[:len(ans)-1]
		}
	}
	fmt.Println(ans)
}


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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    if(a >= b && a >= c) {
        rep(i, k) {
            a *= 2;
        }
        cout << a + b + c << endl;
    }
    else if(b > a && b >= c) {
        rep(i, k) {
            b *= 2;
        }
        cout << a + b + c << endl;
    }
    else if (c > a && c > b) {
        rep(i, k) {
            c *= 2;
        }
        cout << a + b + c << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.Arrays;
import java.util.Set;
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int sum=0;
        int[]T=new int[N];
        for(int i=0;i<N;i++){
            T[i]=sc.nextInt();
            sum+=T[i];
        }
        int M=sc.nextInt();
        int[]P=new int[M];
        int[]X=new int[M];
        for(int i=0;i<M;i++){
            P[i]=sc.nextInt();
            X[i]=sc.nextInt();
        }
        for(int i=0;i<M;i++){
            System.out.println(sum-T[P[i]-1]+X[i]);
        }
        
        
        
}
        
        
    }


Measured memory_bytes: 23124
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String s = sc.next();
        char array[] = new char[n];

        for(int i = 0; i<n;i++){
            array[i] = s.charAt(i);
        }

        array[k-1] = Character.toLowerCase(array[k-1]); 
       // System.out.println(array[k-1]);



        for(int i = 0;i<n;i++){
            System.out.print(array[i]);
        }
        System.out.println("");
    }

}


Measured memory_bytes: 21972
# -*- coding: utf-8 -*-

import time

N = int(input())

all_num_list = []
nums = ["3", "5", "7"]

for a in nums:
    for b in nums:
        for c in nums:
            all_num_list.append(a+b+c)
            for d in nums:
                all_num_list.append(a+b+c+d)
                for e in nums:
                    all_num_list.append(a+b+c+d+e)
                    for f in nums:
                        all_num_list.append(a+b+c+d+e+f)
                        for g in nums:
                            all_num_list.append(a + b + c + d + e + f+g)
                            for h in nums:
                                all_num_list.append(a + b + c + d + e + f + g+h)
                                for i in nums:
                                    all_num_list.append(a+b+c+d+e+f+g+h+i)

cnt = 0
for num in all_num_list:
    if int(num) <= N and "3" in num and "5" in num and "7" in num:
        cnt += 1

print(cnt)

Measured memory_bytes: 5232
S = input()
T = "Yes"
for i in range(len(S)):
  if (i+1) % 2 == 1:
    if S[i] != "R" and S[i] != "U" and S[i]!= "D":
      T = "No"
      break
  else:
    if S[i] != "L" and S[i] != "U" and S[i] != "D":
      T = "No"
      break
print(T)

Measured memory_bytes: 2940
def resolve():
    N=int(input())
    S=sorted([int(input()) for i in range(N)])
    total=sum(S)
    if total%10!=0:
        print(total)
    else:
        for i in range(N):
            if S[i]%10!=0:
                print(total-S[i])
                break
            elif i==N-1:print(0)


resolve()

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

//--- 1 の位が 0 でなく最小のものを最後に足せば良い ---//
int main() {
  int menu[5];
  for(int i = 0; i < 5; i++) cin >> menu[i];
  int dif, minm = 9, sum = 0;
  for(int i = 0; i < 5; i++) {
    if(menu[i]%10 != 0) {
      minm = min(minm, menu[i]%10);
      menu[i] = ((menu[i] + 9) / 10)*10;
      dif = 10 - minm;
    }
    sum += menu[i];
  }
  cout << sum - dif << endl;
}


Measured memory_bytes: 256
program cm
   implicit none
   integer::N,M
   integer,allocatable,dimension(:)::H
   integer::a,b
   logical,allocatable,dimension(:)::GOOD
   integer::ans=0
   integer::i
   read*,N,M
   allocate(H(N))
   read*,H
   allocate(GOOD(N))
   GOOD=.true.
   do i=1,M
      read*,a,b
      if(H(b)>=H(a))GOOD(a)=.false.
      if(H(a)>=H(b))GOOD(b)=.false.
   end do
   do i=1,N
      if(GOOD(i))ANS=ANS+1
   end do
   print"(i0)",ans
contains
end program cm

Measured memory_bytes: 3776
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    if(S[2] == S[3] && S[4] == S[5]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3660
n, m = map(int, input().split())

h_l = list(map(int, input().split()))

good = [1 for i in range(n)]


for i in range(m):
    a, b = map(int, input().split())
    if h_l[a-1] > h_l[b-1]:
        good[b-1] = 0
    elif h_l[a-1] < h_l[b-1]:
        good[a-1] = 0
    elif h_l[a-1] == h_l[b-1]:
        good[a-1] = 0
        good[b-1] = 0

print(sum(good))


Measured memory_bytes: 20112
#include<bits/stdc++.h>
using namespace std;
int cnt;
char a[10],b[10];
int main()
{
	scanf("%s%s",a+1,b+1);
	for(register int i=1;i<=3;i++)
		if(a[i]==b[i])
			cnt++;
	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){

	int a , b;

	scanf("%d %d" , &a , &b);
	if(a < b){
		printf("a < b\n");//a < b ????????????????????´???????????????
	}
	else if(a > b){
		printf("a > b\n");//a > b ????????????????????´???????????????
	}
	else{
		printf("a == b\n");//???????????¶?????????????????????????????´???????????????
	}

	return 0;
}

Measured memory_bytes: 2548
#include <cstdio>

int main(void) {
  int N;
  scanf("%d", &N);
  char reply[N+2];
  scanf("%s", reply);
  reply[N] = reply[0]; reply[N+1] = reply[1];// reply N, N+1を忘れないように
  
  int animal[N+2];

  for (int initial = 0; initial < 4; initial++) {
    if (!(initial % 2)) { 
      animal[0] = 0;
      if (initial < 2) animal[1] = 0; else animal[1] = 1;
    } else {
      animal[0] = 1;
      if (initial < 2) animal[1] = 0; else animal[1] = 1;
    }
 

    for (int i = 0; i < N; i++) {
      if (animal[i+1] == 0) {
        if (reply[i+1] == 'o') animal[i+2] = animal[i]; 
        else animal[i+2] = 1-animal[i];
      } else {
        if (reply[i+1] == 'o') animal[i+2] = 1-animal[i];
        else animal[i+2] = animal[i];
      }
    }
    if (animal[0] == animal[N] && animal[1] == animal[N+1]) {
      for (int j = 0; j < N; j++) {
        if (animal[j] == 0) printf("S");
        else printf("W");
      }
      printf("\n");
      return 0;
    }
  }
  printf("-1\n");
  return 0;
}
 


Measured memory_bytes: 768
# coding: utf-8

import sys
def input(): return sys.stdin.readline().strip()

MOD = 10**9 + 7
# N = int(input())
# L = [int(x) for x in input().split()]
N, M = map(int, input().split())
# S = input()

dp = [0] * (N + 5)
dp[0] = 1

for _ in range(M):
    dp[int(input())] = -1

for i in range(N):
    if dp[i] == -1:
        continue
    if dp[i + 1] != -1:
        dp[i + 1] += dp[i]
        dp[i + 1] %= MOD
    if dp[i + 2] != -1:
        dp[i + 2] += dp[i]
        dp[i + 2] %= MOD

print(dp[N])


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

#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ms(a, b) memset((a), (b), sizeof(a))
#define len(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <class T> void __f(const char* name, T&& a) {
    cerr << name << ": " << a << '\n';
}
template <class T, class... Ts> void __f(const char* names, T&& a, Ts&&... b) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << a << " /";
    __f(comma + 1, b...);
}

template <class T> bool mini(T& a, const T& b) { return a > b ? (a = b, 1) : 0; }
template <class T> bool maxi(T& a, const T& b) { return a < b ? (a = b, 1) : 0; }

typedef long long ll;
typedef double db;
typedef pair<int, int> pi;
typedef pair<int, pi> ti;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ti> vti;
typedef vector<vpi> vvpi;

const int inf = (int)0x3f3f3f3f3f3f3f3f;
const int ninf = (int)0xc0c0c0c0c0c0c0c0;
const ll M = (ll)1e9 + 7;
const int N = 14e6 + 3;

ll fac[N], inv[N];

ll pw(ll a, ll b) {
    ll res = 1;
    for (a %= M; b; a = a * a % M, b >>= 1) if (b & 1) res = res * a % M;
    return res;
}

ll C(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fac[n] * inv[n - k] % M * inv[k] % M;
}

main() {
//    freopen("CP.inp", "r", stdin);
//    freopen("CP.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    fac[0] = 1;
    fore(i, 1, N) fac[i] = fac[i - 1] * i % M;
    inv[N - 1] = pw(fac[N - 1], M - 2);
    ford(i, N - 2, 0) inv[i] = inv[i + 1] * (i + 1) % M;
    int x, y; cin >> x >> y;
    int n = x + y;
    int m = y - x;
    if (n % 3) {
        cout << "0\n";
        return 0;
    }
    n /= 3;
    x -= n;
    y -= n;
    cout << C(x + y, x) << '\n';
}


Measured memory_bytes: 219008
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

ll gcd(ll a, ll b){
  ll temp;
	while (a % b != 0){
		temp = b;
		b = a % b;
		a = temp;
	}
	return b;
}

ll lcm(ll a, ll b){
  return a * b / gcd(a,b);
}

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};


int main(){
    ll N,v;
    vector<float> V;
    cin >> N;
    llrep(i,N){
        cin >> v;
        V.push_back((float)v);
    }
    sort(V.begin(), V.end());
    float v0,v1,v_new;
    llrep(i, N-1){
        v0 = V[0];
        v1 = V[1];
        V.erase(V.begin(), V.begin()+2);
        v_new = (v0 + v1) / 2.0;
        auto Iter1 = lower_bound(V.begin(), V.end(), v_new);
        ll insert_pos = Iter1 - V.begin();
        V.insert(V.begin() + insert_pos, v_new);
    }
    cout << V[0] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

void judge(string str){
	vector<char> B;
	B.push_back('$');

	for(int i=0;i<str.length();i++){
		if(str[i] == '(')
			B.push_back('(');
		else if(str[i] == '[')
			B.push_back('[');
		else if(str[i] == ')')
			if(B[B.size()-1] == '(')
				B.pop_back();
			else
				B.push_back(')');
		else if(str[i] == ']')
			if(B[B.size()-1] == '[')
				B.pop_back();
			else
				B.push_back(']');
	}

	if(B.size() == 1)
		cout<<"yes"<<endl;
	else
		cout<<"no"<<endl;
}

int main(){
	while(1){
		string str;
		getline(cin, str);
		if(str == ".")
			break;

		judge(str);
	}

	return 0;
}

Measured memory_bytes: 1204