akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->parent = y;

  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}


void inorder(Node u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node u){
  if(u == NULL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}



int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

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

    if(com[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }
    else{
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



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

typedef long long ll;

ll g1(ll n, int p) {
    if(n == 0) {
        return 0;
    }
    return n / p + g1(n / p, p);
}

ll g2(ll n, int p) { return g1(n / 2, p); }

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

    if(N % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    cout << g2(N, 5) << endl;

    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func rs() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	h, w := ri(), ri()

	s := make([]string, h+2)
	s[0] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
	for i := 1; i <= h; i++ {
		s[i] = "x" + rs() + "x"
	}
	s[h+1] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

	for i := 1; i <= h; i++ {
		for j := 1; j <= w; j++ {
			if s[i][j] == '#' && s[i][j-1] != '#' && s[i][j+1] != '#' && s[i-1][j] != '#' && s[i+1][j] != '#' {
				fmt.Println("No")
				return
			}
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+7;
int num[maxn];
int flag[maxn];
int res[maxn];
int main()
{
	string s;cin>>s;
	int len=s.length();int now=1;num[0]=1;
	for(int i=0;i<len-1;i++)
	{
		if(s[i]=='R'&&s[i+1]=='L')
		{
			flag[i]=1;flag[i+1]=1;
			num[i+1]=1;
		}
		else if(s[i]==s[i+1])
		{
			num[i+1]=num[i]+1;
		}
		else
		{
			num[i+1]=1;
		}
	}
	for(int i=0;i<len;)
	{
		if(flag[i]==1)
		{
			int lst=i;
			i+=2;
			while(i<len&&flag[i]==0&&s[i]=='L') i++;
			int len1=i-lst-1 + num[lst];
			if(len1%2==0) res[lst]=len1/2,res[lst+1]=len1/2;
			else
			{
				int mx=max(i-lst-1,num[lst]);
				if((mx)%2==1)
				{
					if(i-lst-1>num[lst])
					{
						res[lst+1]=(len1+1)/2;
						res[lst]=len1/2;
					}
					else
					{
						res[lst]=(len1+1)/2;
						res[lst+1]=len1/2;
					} 
				}
				else
				{
					if(i-lst-1>num[lst])
					{
						res[lst]=(len1+1)/2;
						res[lst+1]=len1/2;
					}
					else
					{
						res[lst+1]=(len1+1)/2;
						res[lst]=len1/2;
					} 
				}
			}
		}
		else i++;
	}
	for(int i=0;i<len;i++)
	{
		cout<<res[i]<<" ";
	}
	
 } 

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,A;
  cin >> N;
  A=N;
  vector<int>V(N);
  for (int i=0 ; i<N ; i++)
    cin >> V.at(i);
  sort(V.begin(),V.end());
  for(int i=0; i<N-1; i++){
    if (V.at(i)==V.at(i+1))
      A--;
  }
  cout << A << endl;
}
  


Measured memory_bytes: 256
k,n=map(int,input().split())
a=list(map(int,input().split()))
a=a*2
s=0
t=10**9
def dis(a,b,k):
    if b-a<0:
        return b-a+k
    else:
        return b-a
for i in range(n):
    s=min(k-dis(a[i],a[i+1],k),k-dis(a[i-1+n],a[i],k))
    t=min(s,t)
print(t)

Measured memory_bytes: 26444
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

int ns,nl;
struct edge{
	int to,cost,used,rev;
	edge(){}
	edge(int tt,int cc,int revv){
		to=tt;
		cost=cc;
		used=0;
		rev=revv;
	}
};
typedef pair<int,int> P;
vector<edge> G[21];
vector<int> res;
vector<int> pass;
int cost,rescost;

bool passmax(vector<int> &a,vector<int> &b){
	if(a.size()>b.size())return true;
	if(b.size()>a.size())return false;
	for(int i=0;i<min(a.size(),b.size());i++){
		if(a[i]>b[i])return false;
		if(b[i]<a[i])return true;
	}
	return true;
}

void dfs(int v){
	if(cost>rescost ||(cost==rescost && passmax(pass,res))){
		rescost=cost;
		res=pass;
	}
	for(int i=0;i<G[v].size();i++){
		edge &e=G[v][i];
		if(e.used==0){
			cost+=e.cost;
			e.used++;
			G[e.to][e.rev].used++;
			pass.push_back(e.to);
			dfs(e.to);
			pass.pop_back();
			cost-=e.cost;
			e.used--;
			G[e.to][e.rev].used--;
		}
	}
}

void check(){
	res.clear();
	rescost=0;
	for(int i=1;i<=ns;i++){
		cost=0;
		pass.push_back(i);
		dfs(i);
		pass.pop_back();
	}
}
int main(void){
	while(1){
		scanf("%d %d",&ns,&nl);
		if(ns+nl==0)break;
		for(int i=0;i<=ns;i++){
			G[i].clear();
		}
		for(int i=0;i<nl;i++){
			int a,b,c;
			scanf("%d %d %d",&a,&b,&c);
			G[a].push_back(edge(b,c,G[b].size()));
			G[b].push_back(edge(a,c,G[a].size()-1));
		}
		check();
		printf("%d\n",rescost);
		for(int i=0;i<res.size();i++){
			printf("%d%c",res[i],i==res.size()-1?'\n':' ');
		}
	}
	return 0;
}

Measured memory_bytes: 1056
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[15],k[15];
    cin>>s;
    cin>>k;
    int i,l,x=0;
    l=strlen(s);
    for(i=0;i<l;i++)
    {
        if(s[i]==k[i]) x++;
    }
    if(x==l) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3620
N = int(input())
height = [int(i) for i in input().split()] + [0]
k = 0
while True :
    if sum(height) == 0 :
        break 
    for i in range(N):
        if height[i] > 0 :
            lv = i 
            break 

    for i in range(lv,N+1):
        if height[i] == 0 :
            uv = i 
            break 
    for i in range(lv,uv):
        height[i] -= 1
    k += 1
print(k)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

const ll mod = 1e9+7;

// a^n mod を計算する
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a) {
    return modpow(a, mod - 2);
}

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

    vector<ll> tmp(n+2);
    tmp[1] = 1;
    reps(i,2,n+2){
        tmp[i] = (tmp[i-1] + modinv(i)) % mod;
    }

    ll ans = 0;
    rep(i,n-1){
        ll tmp2 = (x[i+1]-x[i]+ mod) % mod;
        tmp2 = (tmp2 * tmp[i+1]) % mod;
        ans = (ans + tmp2) % mod;
    }
    //cout << ans << endl;
    
    vector<ll> fact(n+2);

    fact[0] = 1;
    fact[1] = 1;
    reps(i,2,n+2){
        fact[i] = (fact[i-1] * i)% mod;
        //cout <<i << " " << fact[i] << endl;
    }
    
    ans = (ans * fact[n-1]) %mod;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5516
import java.io.*;
import java.util.*;
 
class Main{
    public static void main(String[] args){
    BufferedReader sc=new BufferedReader(new InputStreamReader(System.in));
    try {
        String st;
        while((st=sc.readLine())!=null){
        String[] sp = st.split(" ");
        System.out.println(Integer.valueOf(sp[0])+Integer.valueOf(sp[1]));
        }
    }catch(Exception e){
        System.out.println("Error");
    }
    }
}

Measured memory_bytes: 16996
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const ll MOD = 1e9 + 7;

int main(){
	int D; cin>>D;
	vector<int> cs(26);
	vector<vector<int>> s(D,vector<int> (26));
	vector<int> last(26,-1);
	rep(i,26)cin>>cs[i];
	rep(i,D)rep(j,26)cin>>s[i][j];

	vector<int> ans(D);
	rep(d, D){
		int m_type;
		int m_plus = -inf;
		rep(t, 26){
			int e_ans = s[d][t];
			rep(k, 26){
				if(t == k)continue;
				e_ans -= cs[k] * (d - last[k]);
			}
			if(e_ans > m_plus){
				m_plus = e_ans;
				m_type = t;
			}
		}
		ans[d] = m_type + 1;
	}
	rep(i,D)cout<<ans[i]<<endl;
	return 0;
}

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

int main() {
  bool a = false;
  int N;
  char S;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    
    if (S == 'Y') {
      a = true;
    }
  }
  
  if (a) {
    cout << "Four" << endl;
  }
  
  else {
    cout << "Three" << endl;
  }
  
}

Measured memory_bytes: 3636
// Code for B - Distance 
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

int main() {
  int N, D;
  cin >> N >> D;
  vector<int> X(N), Y(N);
  REP(i, N) {
    cin >> X[i] >> Y[i];
  }

  int total = 0;
  REP(i, N) {
    double x = X[i];
    double y = Y[i];

    if (sqrt(x * x + y * y) <= D) {
      total ++;
    }
  }

  cout << total << endl;
  return 0;
}


Measured memory_bytes: 4904
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define INF 0x3f3f3f3f
#define ll long long

using namespace std;

const int inf = 0x3f3f3f3f;
const int maxn = 1005;
const int maxm = 200005;

ll cost[maxn][maxn];
int n;

ll Floyd(int n)/*贪心迭代*/
{
    int i,j,k;
    long long ans = 0;

    for(i=1;i<=n;i++)
        for(j=1;j<=i;j++){
            int flag = 1;
            for(k=1;k<=n;k++){
                if(cost[i][k] + cost[k][j] < cost[i][j]) {
                    puts("-1");
                    return 0;
                }
                else if(i != k && j != k && cost[i][j] == cost[i][k] + cost[k][j]) {
                    flag = 0;
                }
            }
            if(flag) ans += cost[i][j];
        }
    return ans;
}

int main()
{
    while(~scanf("%d", &n)) {
        int a;
        for(int i = 1; i <= n; i++) {
            for(int j = 1; j <= n; j++) {
                scanf("%lld", &a);
                cost[i][j] = a;
            }
        }
        ll ans = Floyd(n);
        if(ans) {
            printf("%lld\n", ans);
        }
    }
    return 0;
}


Measured memory_bytes: 3968
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

s=list(ss())

ans=0
temp=0
for i in range(len(s)):
    if s[i] in ["A","C","G","T"]:
        temp+=1
        ans=max(temp,ans)
    else:
        temp=0
print(ans)




Measured memory_bytes: 63852
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

vector<vector<int>> G(100010);
vector<bool> visited(100010);
vector<int> color(100010, -1);
bool valid = true;
ll wcnt, bcnt;

void dfs(int cv){
    visited[cv] = true;

    for(auto nv : G[cv]){
        if(color[cv] == color[nv]){
            valid = false;
        }

        if(!visited[nv]){
            if(color[cv] == 0){
                color[nv] = 1;
                bcnt++;
            }
            else{
                color[nv] = 0;
                wcnt++;
            }

            dfs(nv);
        }
    }
}

int main(){
    ll n, m; cin>>n>>m;
    for(int i=0; i<m; i++){
        int a, b; cin>>a>>b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    wcnt++;
    color[0] = 0;
    dfs(0);

    if(valid){
        cout << wcnt * bcnt - m << endl;
    }
    else{
        cout << n * (n - 1) / 2 - m << endl;
    }
}

Measured memory_bytes: 7040
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

ll dp[3003][3003];

int main(void){
	int n,i,j;
	string s;
	ll ans=0ll;
	fill(dp[0],dp[3003],0ll);
	dp[0][0] = 1ll;
	cin >> n;
	cin >> s;
	for(i=1; i<n; ++i){
		for(j=1; j<i; ++j){
			dp[i-1][j] += dp[i-1][j-1];
		}
		for(j=0; j<=i; ++j){
			if(s[i-1]=='<'){
				add_mod(dp[i][j],((j)?dp[i-1][j-1]:0ll));
			}else{
				add_mod(dp[i][j],(dp[i-1][i-1]+MOD-((j)?dp[i-1][j-1]:0ll))%MOD);
			}
		}
	}
	for(i=0; i<n; ++i){
		add_mod(ans,dp[n-1][i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 70656
import numpy as np
import math

N = int(input())
P = np.array(list(map(int, input().split())))
Q = np.array(list(map(int, input().split())))

def _get_order(N, v, i):
  order=np.argsort(v[i:])
  return list(order).index(0) * math.factorial(len(order)-1)

def get_order(N, v):
  each_order=list(map(lambda i: _get_order(N, v, i), range(N)))
  return each_order
a = sum(get_order(N, P))
b = sum(get_order(N, Q))
print(abs(a-b))

Measured memory_bytes: 12432
import Data.List (sort)

solve :: Integral a => [a] -> a
solve = sol . sort
    where
        sol [] = 0
        sol [_] = 0
        sol (x : y : zs) = min x y + sol zs

main :: IO ()
main = do
    _ <- getLine
    print . solve . fmap (read :: String -> Int) . words =<< getLine


Measured memory_bytes: 1020
#include <bits/stdc++.h>
#define int long long
using namespace std;

int32_t main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0),cin.tie(0);
	int n,m;
	cin >> n >> m;
	if(n==m)cout << "Yes";
	else cout << "No";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl 	"\n"

typedef vector< ll > 	vi;
typedef vector< vi > 	vvi;
typedef pair< ll,ll > 	ii;
#define pb 		push_back
#define all(c) 		(c).begin(),(c).end()
#define tr(c,i) 	for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) 	((c).find(x) != (c).end())

#define MOD 	1000000007
#define INF 	(int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))

int main()
{	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	

	string s;
	cin>>s;
	if(s == "Sunny")
		cout<<"Cloudy";
	else if(s== "Cloudy")
		cout<<"Rainy";
	else if(s== "Rainy")
		cout<<"Sunny";
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
signed main(){
    fast;
    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
		cin>>a[i];
	int ans = 1e18;
	for(int i=-100;i<=100;i++){
		int cnt = 0;
		for(int j=1;j<=n;j++)
			cnt+=(abs(a[j]-i))*(abs(a[j]-i));
		ans = min(ans,cnt);
	}
	cout<<ans;
}  


Measured memory_bytes: 256
import sys

input = lambda: sys.stdin.readline().rstrip()


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


N, M = map(int, input().split())


def solve():

    uni = UnionFind(N)

    for i in range(M):
        x, y, z = map(int, input().split())
        x, y = x - 1, y - 1
        uni.union(x, y)

    print(uni.group_count())


if __name__ == '__main__':
    solve()


Measured memory_bytes: 7856
#include<bits/stdc++.h>
using namespace std;
const int mxN=1e5+10;
int n,x;
pair<int,int>v[mxN];
int main(){
cin>>n;
for(int i=0;i<n;i++){
    cin>>x;
    v[i]={x,i+1};
}
sort(v,v+n);
for(int i=0;i<n;i++){
    cout<<v[i].second<<" ";
}
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);


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


int main() {

ll n,k;
cin>>n>>k;
ll a[n];
for(int i=0;i<n;i++){
  cin>>a[i];
}
sort(a,a+n);
int st = n-1;
for(int i=0;i<k;i++){

   a[st] = 0;
   st--;

}

ll num  = 0;

for(int i=0;i<n;i++){
  num += a[i];
}

cout<<num<<"\n";

  
  return 0;
}


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

int main(){
    int n, i, j, m, tem = 0, res = MOD;
    cin >> n;
    int x[n];
    for(i=0; i<n; i++){
        cin >> x[i];
    }
    sort(x, x+n);
    for(i=1; i<=100; i++){
        tem = 0;
        for(j=0; j<n; j++){
            tem += (x[j]-i)*(x[j] -i);
        }
        res = min(tem, res);
    }
    cout << res;
}

Measured memory_bytes: 256
// 200

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

int main(){
    int cnt[5];
    for(int i=1;i<=4;i++) cnt[i]=0;
    int one=0;
    for(int i=0;i<6;i++){
        int a;
        cin >> a;
        cnt[a]++;
    }

    for(int i=1;i<=4;i++){
        if(cnt[i]==0){
            cout << "NO" << endl;
            return 0;
        }
        if(cnt[i]==1) one++;
    }

    if(one==2) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		long x=sc.nextLong();
		long y=x/11;
		long z=x%11;
		if(z==0)z=0;
		else if(z>6)z=2;
	    else z=1;
	    System.out.println(y*2+z);
		
		}
		
	}




Measured memory_bytes: 10192
#include <iostream>
#include <vector>

#define FOR(var, start, end)    for(var = start; var < end; ++var)
#define WHILE(var, end)  while(var != end)
#define SHOW_ALL(a, b, c)    cout << a << endl; \
                                cout << b << endl; \
                                cout << c << endl;

using namespace std;


void BubbleSort(vector <int> &num)
{
      int i, j, flag = 1;    // set flag to 1 to start first pass
      int temp;             // holding variable
      int numLength = num.size( ); 
      for(i = 1; (i <= numLength) && flag; i++)
     {
          flag = 0;
          for (j=0; j < (numLength -1); j++)
         {
               if (num[j+1] > num[j])      // ascending order simply changes to <
              { 
                    temp = num[j];             // swap elements
                    num[j] = num[j+1];
                    num[j+1] = temp;
                    flag = 1;               // indicates that a swap occurred.
               }
          }
     }
     return;   //arrays are passed to functions by address; nothing is returned
}

int main()
{
    int input;
    vector<int> input_array;
    while(cin >> input){
        input_array.push_back(input);
    }
    BubbleSort(input_array);
    printf("%d %d %d %d %d\n", input_array[0],input_array[1],input_array[2],input_array[3],input_array[4]);

    
}

Measured memory_bytes: 3156
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);

        int T;
        T=1;
        while((T--)>0)
        {
            //code comes here
            int N=in.nextInt();
            int num=N%10;
            if(num==3)
            {
                System.out.println("bon");
            }
            else if(num==0 || num==1 || num==6 || num==8)
            System.out.println("pon");
            else
            System.out.println("hon");


        }   
        in.close();
    }

}

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

using namespace std;

int a[200000 + 5];

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

    // x=1, 2n-1はメジアンにならない
    if (x == 1 or x == 2 * n - 1) {
        cout << "No" << endl;
        return 0;
    }

    set<int> st;
    for (int i = 1; i <= 2 * n - 1; ++i) {
        st.insert(i);
    }

    // x=2のとき
    if (x == 2) {
        for (int i = 1; i <= 4; ++i) {
            st.erase(i);
        }

        auto itr = st.begin();
        for (int i = 1; i <= n - 2; ++i) {
            a[i] = *itr;
            itr++;
        }
        for (int i = n + 3; i <= 2 * n - 1; ++i) {
            a[i] = *itr;
            itr++;
        }

        a[n - 1] = 3;
        a[n] = 2;
        a[n + 1] = 1;
        a[n + 2] = 4;
    }

    // 3<=x<=2n-2のとき
    if (x != 2) {
        for (int i = x - 2; i <= x + 1; ++i) {
            st.erase(i);
        }

        auto itr = st.begin();
        for (int i = 1; i <= n - 2; ++i) {
            a[i] = *itr;
            itr++;
        }

        for (int i = n + 3; i <= 2 * n - 1; ++i) {
            a[i] = *itr;
            itr++;
        }

        a[n - 1] = x - 1;
        a[n] = x;
        a[n + 1] = x + 1;
        a[n + 2] = x - 2;
    }

    cout << "Yes" << endl;
    for (int i = 1; i <= 2 * n - 1; ++i) {
        cout << a[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 11648
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

int64_t dfs(const vector<vector<int64_t>>& links, int64_t target, int64_t ng, int64_t current, int64_t parent) {
  int64_t ret = 0;
  for (auto v : links[current]) {    
    if (v == parent) {
      continue;
    }

    if (v == target) {
      return 0;
    }
    
    if (v == ng) {
      return 1;
    }
    
    ret += dfs(links, target, ng, v, current);
  }

  return ret;
}

main() {
  int64_t n, m;
  cin >> n >> m;
  
  vector<vector<int64_t>> links(n);
  for (auto i : irange(0L, m)) {
    int64_t a, b;
    cin >> a >> b;
    --a;
    --b;
    links[a].emplace_back(b);
    links[b].emplace_back(a);
  }
  
  int64_t x = -1, y = -1;
  bool ok = false;
  for (auto i : irange(0L, n)) {
    int64_t k = links[i].size();
    if (k % 2 == 1) {
      cout << "No" << endl;
      return 0;
    }
    
    if (k >= 6) {
      ok = true;
    }
    
    if (k == 4) {
      if (x == -1) {
        x = i;
      } else if (y == -1) {
        y = i;
      } else {
        ok = true;
      }
    }
  }
  
  if (ok) {
    cout << "Yes" << endl;
    return 0;
  }
  
  if (y == -1) {
    cout << "No" << endl;
    return 0;
  }
  
  auto ret = dfs(links, x, y, x, -1);
  if (ret == 2) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

 int main(){
 	int n,k;
 	scanf("%d%d",&n,&k);

 	int* h = new int[n];
 	int x;
 	for(int i=0;i<n;i++){
 		scanf("%d",&h[i]);
 	}

 	int count = 0;
 	for(int i=0;i<n;i++){
 		if(k <= h[i]){
 			count ++;
 		}
 	}
 	printf("%d",count);
 	return 0;
 }

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;

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

const int MAXP = 1000 * 1000;
int p[MAXP] = {};

int main()
{
    p[0] = p[1] = 1;
    for(int i = 2; i < MAXP; i++)if(!p[i])
        for(int j = i * 2; j < MAXP; j += i) p[j] = 1;
    
    int a, d, n;
    while(cin >> a >> d >> n && n)
    {
        int ai = 0, num = 0;
        REP(MAXP)
        {
            ai = a + d * i;
            if(!p[ai]) num++;
            if(num == n) {cout << ai << endl; break;}
        }
    }

    return 0;
}

Measured memory_bytes: 5064
/*  ex4_1
    L40S38  */
#include<stdio.h>
#include<math.h>
int main(void){
    int tree,distance;
    //tree:リンゴの木の本数
    //d:iの木の監視員はx番の木(i-d<=x<=i+d})を監視
    scanf("%d %d",&tree,&distance);
    int ans=ceil((double)tree/(2*distance+1));//監視員は最大2*d+1本の木を監視
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 128
k = int(input())

a, b = list(map(int, input().split()))

x = int(a / k)
y = int(b / k)
rx = a % k
ry = b % k

if a == 0:
    print("NG")

if y - x >= 1 or rx * ry == 0:
    print("OK")
else:
    print("NG")


Measured memory_bytes: 9124
import math
#素因数分解
def prime_factorization(n):
    i = 2
    factors = []
    while i <= math.floor(n**0.5):
        if n%i == 0:
            factors.append(i)
            n //= i
        else:
            i += 1
    if n>1:
        factors.append(n)
    return factors
N = int(input())
ls = []
#コーナーケース
if N == 1:
    print(1)
else:
    for i in range(1,N+1):
      #1~Nの、それぞれで素因数分解した結果を1つのリストにする。
        ls.extend(prime_factorization(i))
    ls.sort()
    ans = 1 # ansはN!の約数の個数
    now = 1 # nowは現在の連続数
    now_2 = 0 #now_2は現在参照対象の数
    for i in range(len(ls)):
        if i == 0:
            now_2 = ls[i]
        else:
            if ls[i] == now_2:
                now += 1
            else:
                ans *= (now+1)
                now = 1
                now_2 = ls[i]
    ans *= (now+1)
    print(ans%(10**9+7))


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;

#define MOD 998244353


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

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

int main(){
    ll a,b;
    cin>>a>>b;
    ll n = max({a,b});
    
    
    for(ll i = 0; i<n; i++){
        if(a>b)cout<<b;
        else if(a<b)cout<<a;
        else cout<<a;
    }
    cout<<endl;
    return 0;
}



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

using ll = long long;
// #define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  map<char, int> mp;
  REP(i,n) {
    ++mp[s[i]];
  }
  ll ans = 1;
  REPOBJ(itr, mp) {
    if(itr->second) {
      ans = (ans * (itr->second+1)) % MOD;
    }
  }
  ans = (ans-1)%MOD;
  if(ans < 0) ans += MOD;
  cout << ans;

  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 22:05:28 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
N, M = map(int,input().split())
A = [list(map(int,input().split())) for i in range(N)]


#s = [0 for _ in range(M+1)]
p = [0 for _ in range(N)]
un_held = set([])
ans = M + 10**3

while len(un_held) < M:
    s = [0 for _ in range(M+1)]
    for i in range(N):
        s[A[i][p[i]]] += 1
    tmp = 0
    for j in range(1,M+1):
        if s[j] > tmp:
            tmp = s[j]
            un = j
    ans = min(tmp,ans)
    un_held.add(un)
    for i in range(N):
        while p[i] < M and A[i][p[i]] in un_held:
            p[i] += 1
    #s[un] = 0
#    print(ans,un_held)
#    print(s)
#    print(p)

print(ans)

Measured memory_bytes: 43996
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    mod = 10 ** 9 + 7
    print((pow(10, n, mod) - (2 * pow(9, n, mod)) + pow(8, n, mod)) % mod)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9132
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <map>
#include <iomanip>
using namespace std;

typedef long long ll;

#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long long a, long long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long long a, long long b){
	return a / gcd(a,b) * b;
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int sum;
int tmp;

int main(){
	REP(i,2){
		cin >> tmp;

		sum += tmp;
	}

	cout << 6-sum << endl;

	return 0;
}

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

int main() {
  string S;
  cin >> S;
  if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}


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

int main()
{
	int n = 0;
	cin >> n;
	int *array;
	array = new int[n];
	int x = 0;
	for (int i = 0; i < n; i++){
		cin >> x;
		array[i] = x;
	}
	int min = array[0], max = array[0];
	long long sum = array[0];
	for (int j = 1; j < n; j++){
		if (min>array[j]) min = array[j];
		if (max < array[j])  max = array[j];
		sum += array[j];
	}
	cout << min << " " << max << " " << sum << endl;
	return 0;
}

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

int main(){
	string A, B, C;
	cin >> A >> B >> C;

	string *now = &A;
	char ans = 'A';
	while (true){
		if (now->empty()) break;

		if ((*now)[0] == 'a'){
			now->erase(now->begin());
			ans = 'A';
			now = &A;
		}
		else if ((*now)[0] == 'b'){
			now->erase(now->begin());
			ans = 'B';
			now = &B;
		}
		else{
			now->erase(now->begin());
			ans = 'C';
			now = &C;
		}

	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
/**
 *  author: MOOONI
 *  hackers are welcome!
**/
#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9 + 10;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, x;
  cin >> n >> m >> x;
  vector<vector<int>> a(n, vector<int>(m));
  vector<int> c(n);
  int ans = inf;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int b = 0; b < (1 << n); b++) {
    vector<int> sum(m);
    int cost = 0;
    for (int j = 0; j < n; j++) {
      if ((1 << j) & b) {
        cost += c[j];
        for (int k = 0; k < m;  k++) {
          sum[k] += a[j][k];
        }
      }
    }
    bool ok = true;
    for (int i = 0; i < m; i++) {
      ok &= (sum[i] >= x);
    } 
    if (!ok) {
      continue;
    }
    ans = min(ans, cost);
  }
  if (ans == inf) {
    cout << -1 << '\n';
    return 0;
  }
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    vector<ll> A(N), B(N), C(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    ll ans = 0;
    rep(i, N) {
        ll b = B[i];
        ll cnt_a = lower_bound(A.begin(), A.end(), b) - A.begin();
        ll cnt_c = C.end() - upper_bound(C.begin(), C.end(), b);
        ans += cnt_a * cnt_c;
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 2560
def Card_Game(n , al):

    al.sort(reverse=True)

    Alice = al[0::2]
    Bob = al[1::2]

    ans = sum(Alice) - sum(Bob)

    return ans

def main():
    n = int(input())
    al = list(map(int , input().split()))
    print(Card_Game(n , al))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
import java.util.*;

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

    String str = sc.next();
    boolean flag = true;

    if (!(String.valueOf(str.charAt(0)).equals("A"))) {
      flag = false;
    } else if (Character.isUpperCase(str.charAt(1)) || Character.isUpperCase(str.charAt(str.length()-1))) {
      flag = false;
    } else {
      int count = 0;

      for (int i = 2; i < str.length()-1; i++) {
        if (String.valueOf(str.charAt(i)).equals("C")) {
          count++;
        } else if (Character.isUpperCase(str.charAt(i))) {
          flag = false;
        }
      }

      if (count != 1) {
        flag = false;
      }
    }

    if (flag == true) {
      System.out.println("AC");
    } else {
      System.out.println("WA");
    }
  }
}


Measured memory_bytes: 21588
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b;
	cin >> a >> b;
	int ans = a*b;
	if (ans % 2 == 0) {
		cout << "Even" << endl;
	}
	else {
		cout << "Odd" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll long long
#define M 100000007
#define fr first
#define sc second
#define endl "\n"
#define vc vector
#define pb push_back
#define pii pair<ll,ll>
#define psi pair<string,ll>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.14159265
#define r0 return 0

/* typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
*/
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

using namespace std;

int main()
{
	fast
    int n;
    cin>>n;
    ll a[n];
    rep(i,0,n) cin>>a[i];

    rep(i,0,n){
        if(i==0) a[i]-=1;
        else{
            if(a[i]-1>=a[i-1]) a[i]-=1;
        }
    }
    int flag=0;
    rep(i,1,n){
        if(a[i]>=a[i-1]);
        else {
            cout<<"No";
            flag++;
            break;
        }
    }
    if (flag==0)cout<<"Yes";
}


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

int N,x,y;
int a[100],b[100];

int main(){
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> a[i];
    x += a[i];
  }
  for(int i=0; i<N; i++){
    cin >> b[i];
  }
  x += b[N-1];
  y = x;

  for(int i=1; i<N; i++){
    y += b[N-1-i]-a[N-i];
    if(x<y) x=y;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

/** Example:
 * input!(n: usize, s: chars, vs: [i64; n], ts: [(i64, f64); n]);
 * usize型の変数n, String型(実際は文字配列型)のs, Vector<i64>型のvs, tuple配列のtsに読み込まれる。
 */
fn main() {
    input!(n: usize, ab: [(i64, i64); n], cd: [(i64, i64); n]);

    let mut ab = ab;
    ab.sort();
    let mut cd = cd;
    cd.sort();

    let mut rys = std::collections::BTreeSet::<i64>::new();
    let mut ridx = 0;
    let mut ans: usize = 0;
    for &(bx, by) in cd.iter() {
        // x座標が青点のよりも小さければ、とりあえず候補にぶち込んでいく
        while ridx < ab.len() && ab[ridx].0 < bx {
            rys.insert(ab[ridx].1);
            ridx += 1;
        }

        // y座標ができるだけ大きい赤点をペア候補にする
        let mut ry_cand: i64 = -1;
        for &ry in rys.iter() {
            if ry < by && ry > ry_cand {
                ry_cand = ry;
            }
        }

        if ry_cand >= 0 {
            ans += 1;
            // 複数ペアにはなれないため、候補から削除
            rys.remove(&ry_cand);
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int a, b, c, x, res; cin >> a >> b >> c >> x;
    res = 0;
    for (int i = 0; i <= a; i++)
    {
        for (int j = 0; j <= b; j++)
        {
            for (int k = 0; k <= c; k++)
            {
                if (500 * i + 100 * j + 50 * k == x)
                {
                    res++;
                }
            }
        }
    }
    cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast",3,"inline")
#include <bits/stdc++.h>
using namespace std;
int ans;
string s,str;
int main(){
	ios_base::sync_with_stdio(false);
	cin>>s>>str;
	for(int i=0;i<3;i++){
		if(s[i]==str[i]) ans++;
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
int main() {
	iostream::sync_with_stdio(false);
	while (true) {
		int n;
		cin >> n;
		if (n == 0) return 0;
		vector<pair<long double, long double>> inputs;
		REP(i, n) {
			long double a, b;
			cin >> a >> b;
			inputs.push_back(make_pair(a, b));
		}
		int ans = 1;
		REP(i, inputs.size()) {
			for (int q = i + 1; q < inputs.size(); ++q) {
				long double x = inputs[i].first + inputs[q].first;
				long double y = inputs[i].second + inputs[q].second;
				x /= 2.0;
				y /= 2.0;
				long double neko = (x - inputs[i].first) * (x - inputs[i].first) + (y - inputs[i].second) * (y - inputs[i].second);
				if (neko > 1.0+eps) {
					continue;
				}
				neko = sqrt(1.0 - neko);
				long double xe = inputs[i].second - inputs[q].second;
				long double ye = inputs[i].first - inputs[q].first;
				ye *= -1.0;
				long double tani = xe * xe + ye * ye;
				tani = sqrt(tani);
				xe /= tani;
				ye /= tani;
				for (long double j = -1; j <= 1; j += 2.0) {
					long double next_x = x + xe * j * neko;
					long double next_y = y + ye * j * neko;
					int cnt = 0;
					REP(j, inputs.size()) {
						long double dist = (inputs[j].first - next_x) * (inputs[j].first - next_x) + (inputs[j].second - next_y) * (inputs[j].second - next_y);
						if (dist <= 1.0 + eps) {
							cnt++;
						}
					}
					ans = max(ans, cnt);
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3248
#include<stdio.h>
int main(){

	int a[100],b[100],c;
	int i = 0 ,tra = 0;
	
	while (scanf("%d",&c) != EOF){
		if(c >= 1 && c<=10){
		
			a[tra] = c;
			tra ++;
	
		}
		else if(c == 0){
			tra--;
			b[i] = a[tra];
			i++;
		}
	}
		
	for( c = 0 ;c < i; c++){
		printf("%d\n",b[c]);
	}
	return 0;
}
	

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
#include <math.h>
#include<list>
#include<algorithm>
using namespace std;

int main(){
  list<int> L;

  string s;
  int n,data;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s;
    if(s[0]=='i'){
      cin>>data;
      L.push_front(data);
    }else if(s[6]=='F'){
      L.pop_front();
    }else if(s[6]=='L'){
      L.pop_back();
    }else{
      cin>>data;
      for(list<int>::iterator it=L.begin();it!=L.end();it++){
        if(*it==data){ L.erase(it); break;}
      }
    }
  }
  for(list<int>::iterator it=L.begin();it!=L.end();it++){
    if(it!=L.begin()) cout<<" ";
    cout<<*it;
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 34392